lookatstudy-mobile 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install-termux.sh +109 -26
- package/package.json +1 -1
- package/server.cjs +25306 -601
- package/web/assets/abnfDiagram-N423BO3Z-CU2Rg7X-.js +1 -0
- package/web/assets/api-web-DI50TDfG.js +1 -0
- package/web/assets/{arc-Bj7Boh6s.js → arc-CVHcrwtq.js} +1 -1
- package/web/assets/architectureDiagram-T3A2C74G-CbOpSoqA.js +36 -0
- package/web/assets/{blockDiagram-VBNYF7ZC-DAzIMkNI.js → blockDiagram-VBNYF7ZC-DkENfYJJ.js} +2 -2
- package/web/assets/{c4Diagram-5PPSVZJV-NlYvtXbZ.js → c4Diagram-5PPSVZJV-D2nKbUxh.js} +2 -2
- package/web/assets/channel-AThd-Hly.js +1 -0
- package/web/assets/{chunk-2GRJ4B5K-Cy2RZsUk.js → chunk-2GRJ4B5K-B2LBmawX.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-DtK3xo3Z.js → chunk-2Q5K7J3B-ByZtx99c.js} +1 -1
- package/web/assets/{chunk-5RXB4S5H-CmVGejcd.js → chunk-5RXB4S5H-b6PGx0ql.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-EO_k0Crh.js → chunk-5VM5RSS4-wmKKoEHl.js} +1 -1
- package/web/assets/{chunk-6Q2QTUOP-TBVy-R-c.js → chunk-6Q2QTUOP-CZ89fwLd.js} +1 -1
- package/web/assets/{chunk-GF5L2VYU-_N0jD1tE.js → chunk-GF5L2VYU-3EIIkl6Y.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-BIAuolFx.js → chunk-JWPE2WC7-CdCWYrp8.js} +1 -1
- package/web/assets/{chunk-KBJHAD2P-DqcnXfI8.js → chunk-KBJHAD2P-CmZTgHqr.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-D5RQKqlg.js → chunk-RYQCIY6F-DfyARx_z.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-1Ksx_dPa.js → chunk-XXDRQBXY-DIoEGjYu.js} +1 -1
- package/web/assets/classDiagram-JCYQIIEL-Ccd6qf2i.js +1 -0
- package/web/assets/classDiagram-v2-OCEON4UE-Ccd6qf2i.js +1 -0
- package/web/assets/cose-bilkent-JH36ORCC-BktEcSRI.js +1 -0
- package/web/assets/{cynefin-VYW2F7L2-CAYbjl57.js → cynefin-VYW2F7L2-sXHUKhTr.js} +1 -1
- package/web/assets/cynefinDiagram-MW4NZA55-CQvZqGMF.js +62 -0
- package/web/assets/{dagre-VZM6K2ZE-CKP3kBHM.js → dagre-VZM6K2ZE-BgVOc66g.js} +2 -2
- package/web/assets/{diagram-7IWD3JNH-CLfr8NaW.js → diagram-7IWD3JNH-CqXnEFCF.js} +2 -2
- package/web/assets/{diagram-B4RE2ZJO-h051w7zn.js → diagram-B4RE2ZJO-CbG6ewsb.js} +2 -2
- package/web/assets/diagram-LBJQPF4R-qCVZtiwb.js +24 -0
- package/web/assets/diagram-Q27KOJAE-fRbvC_4J.js +24 -0
- package/web/assets/diagram-UB23O5K3-DYruB-zm.js +41 -0
- package/web/assets/ebnfDiagram-BXEA7PRR-BKbJqSDg.js +1 -0
- package/web/assets/{erDiagram-JOGREHBK-Bz30kI2B.js → erDiagram-JOGREHBK-anDPN9Fg.js} +2 -2
- package/web/assets/{flowDiagram-UKHOOZJN-CsFP_-KD.js → flowDiagram-UKHOOZJN-DlMRxaQ8.js} +1 -1
- package/web/assets/ganttDiagram-PKOTCBZU-BoCCJylo.js +292 -0
- package/web/assets/gitGraphDiagram-DS77QQ5N-D37HEJEv.js +106 -0
- package/web/assets/index-CeFnA9sR.js +53 -0
- package/web/assets/index-D8iAKGNi.css +1 -0
- package/web/assets/infoDiagram-6WML65LV-Cp2uwsRp.js +2 -0
- package/web/assets/{ishikawaDiagram-WSZJBQD7-Bt6EfUkc.js → ishikawaDiagram-WSZJBQD7-IDCvF8oq.js} +2 -2
- package/web/assets/{journeyDiagram-NVQOT4AX-DmVq_JOG.js → journeyDiagram-NVQOT4AX-CqJjuMRj.js} +2 -2
- package/web/assets/{kanban-definition-27J2QSJJ-tE00W58E.js → kanban-definition-27J2QSJJ-Bzy4l8Im.js} +2 -2
- package/web/assets/{linear-CAqnKu9J.js → linear-BYt2jke2.js} +1 -1
- package/web/assets/main-BaffLdJi.js +528 -0
- package/web/assets/{mermaid.core-uJSxER2x.js → mermaid.core-ChBcV6rX.js} +11 -11
- package/web/assets/{mindmap-definition-FAOFIHXS-D5S_P9_s.js → mindmap-definition-FAOFIHXS-BiQCF2qx.js} +2 -2
- package/web/assets/pegDiagram-VL7TDLO6-JrAhM2Rh.js +1 -0
- package/web/assets/pet-CTf4hJTR.css +1 -0
- package/web/assets/pet-f5Q8AEiU.js +1 -0
- package/web/assets/{pieDiagram-7S7Q4E2Y-DYpiHnao.js → pieDiagram-7S7Q4E2Y-DNB9KI82.js} +2 -2
- package/web/assets/{quadrantDiagram-CIZ2JOQS-BqycGz7D.js → quadrantDiagram-CIZ2JOQS-D9CQH6qH.js} +4 -4
- package/web/assets/railroadDiagram-AXF67PYL-GRAK-BbS.js +1 -0
- package/web/assets/{requirementDiagram-LRYGKXZP-CH-xotLo.js → requirementDiagram-LRYGKXZP-CTFmkmvv.js} +2 -2
- package/web/assets/{sankeyDiagram-W5VNT64P-BCLFObl1.js → sankeyDiagram-W5VNT64P-ocFhBtMa.js} +2 -2
- package/web/assets/{sequenceDiagram-SI44F4Z6-CE1T-Oar.js → sequenceDiagram-SI44F4Z6-itHtrU2O.js} +2 -2
- package/web/assets/sizeCapture-X5ZJPWSS-Bj_0p16L.js +1 -0
- package/web/assets/stateDiagram-OKZ733FA-BZ3FXzdZ.js +1 -0
- package/web/assets/stateDiagram-v2-UEYNNEHI-DacbF0mj.js +1 -0
- package/web/assets/swimlanes-SLNWSIFB-nlxlUqVN.js +2 -0
- package/web/assets/swimlanesDiagram-ULZ7WXOC-Bk858mY5.js +8 -0
- package/web/assets/{timeline-definition-Z64GVDOM-CPajwTED.js → timeline-definition-Z64GVDOM-B-IqLhkR.js} +2 -2
- package/web/assets/{vennDiagram-T6HMQDX7-DKkB137-.js → vennDiagram-T6HMQDX7-Dr1sgkuO.js} +2 -2
- package/web/assets/{wardleyDiagram-T6FBY63Y-CHD6tq1V.js → wardleyDiagram-T6FBY63Y-BOOJsnbk.js} +2 -2
- package/web/assets/{xychartDiagram-ELKLHX3M-DIO9Q6BD.js → xychartDiagram-ELKLHX3M-Bb3lgEh4.js} +2 -2
- package/web/index.html +3 -2
- package/web/pet.html +19 -0
- package/web/assets/abnfDiagram-N423BO3Z-uVyZuC2D.js +0 -1
- package/web/assets/api-web-BydHmVA4.js +0 -1
- package/web/assets/architectureDiagram-T3A2C74G-CrbkXNQp.js +0 -36
- package/web/assets/channel-JNlIjRLZ.js +0 -1
- package/web/assets/classDiagram-JCYQIIEL-C-12RKGI.js +0 -1
- package/web/assets/classDiagram-v2-OCEON4UE-C-12RKGI.js +0 -1
- package/web/assets/cose-bilkent-JH36ORCC-DAUofPwo.js +0 -1
- package/web/assets/cynefinDiagram-MW4NZA55-UaEI49aN.js +0 -62
- package/web/assets/diagram-LBJQPF4R-CUOsO4df.js +0 -24
- package/web/assets/diagram-Q27KOJAE-BXbJxAlu.js +0 -24
- package/web/assets/diagram-UB23O5K3-BHV6tpU9.js +0 -41
- package/web/assets/ebnfDiagram-BXEA7PRR-CAahAB9-.js +0 -1
- package/web/assets/ganttDiagram-PKOTCBZU-Cm5qe_5U.js +0 -292
- package/web/assets/gitGraphDiagram-DS77QQ5N-DNktj2Kq.js +0 -106
- package/web/assets/index-BC_sP79K.js +0 -563
- package/web/assets/index-BSTI-ywB.css +0 -1
- package/web/assets/infoDiagram-6WML65LV-vZK5e7Xx.js +0 -2
- package/web/assets/pegDiagram-VL7TDLO6-BZkaiQ_9.js +0 -1
- package/web/assets/railroadDiagram-AXF67PYL-DEoY1V9D.js +0 -1
- package/web/assets/sizeCapture-X5ZJPWSS-uf4-mQAU.js +0 -1
- package/web/assets/stateDiagram-OKZ733FA-Dt2wQF9A.js +0 -1
- package/web/assets/stateDiagram-v2-UEYNNEHI-BbJD6fMT.js +0 -1
- package/web/assets/swimlanes-SLNWSIFB-jLXDXtjZ.js +0 -2
- package/web/assets/swimlanesDiagram-ULZ7WXOC-BTdV0I38.js +0 -8
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-ChBcV6rX.js","./index-CeFnA9sR.js","./index-D8iAKGNi.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Sx=Object.defineProperty;var Cx=(e,t,n)=>t in e?Sx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var La=(e,t,n)=>Cx(e,typeof t!="symbol"?t+"":t,n);import{r as v,d as Ax,j as u,e as uu,b as Kl,u as Xl,h as du,k as er,l as Nx,m as $o,n as _x,o as Ix,p as zt,q as Mx,V as Rx,v as Lx,F as hu,s as fu,t as Px,w as Hf,x as Dx,y as mu,z as pu,A as Ox,B as jx,C as Fx,D as Uf,E as qo,G as Bx,M as zf,H as Hx,I as gu,J as Ux,K as zx,L as xu,g as an,N as zn,R as Vx,O as $x,P as bu,Q as yu,S as Pa,T as qx,U as Wr,W as Zs,X as Wx,Y as Yx,Z as Gx,_ as Kx,$ as Xx,a0 as vu,a1 as Qx,a2 as Zx,a3 as Jx,a4 as e1,a5 as Ql}from"./index-CeFnA9sR.js";const t1="modulepreload",n1=function(e,t){return new URL(e,t).href},Eu={},ji=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=a(n.map(h=>{if(h=n1(h,r),h in Eu)return;Eu[h]=!0;const f=h.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(!!r)for(let g=o.length-1;g>=0;g--){const x=o[g];if(x.href===h&&(!f||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${m}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":t1,f||(p.as="script"),p.crossOrigin="",p.href=h,c&&p.setAttribute("nonce",c),document.head.appendChild(p),f)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};/**
|
|
3
|
+
* @license lucide-react v0.468.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const r1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vf=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
8
|
+
* @license lucide-react v0.468.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/var s1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
13
|
+
* @license lucide-react v0.468.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/const i1=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>v.createElement("svg",{ref:l,...s1,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Vf("lucide",i),...o},[...a.map(([c,h])=>v.createElement(c,h)),...Array.isArray(s)?s:[s]]));/**
|
|
18
|
+
* @license lucide-react v0.468.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/const pe=(e,t)=>{const n=v.forwardRef(({className:r,...i},s)=>v.createElement(i1,{ref:s,iconNode:t,className:Vf(`lucide-${r1(e)}`,r),...i}));return n.displayName=`${e}`,n};/**
|
|
23
|
+
* @license lucide-react v0.468.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/const a1=pe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
28
|
+
* @license lucide-react v0.468.0 - ISC
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the ISC license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/const Wo=pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
33
|
+
* @license lucide-react v0.468.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/const o1=pe("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
38
|
+
* @license lucide-react v0.468.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/const l1=pe("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
|
|
43
|
+
* @license lucide-react v0.468.0 - ISC
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the ISC license.
|
|
46
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/const fn=pe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
48
|
+
* @license lucide-react v0.468.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/const c1=pe("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
|
|
53
|
+
* @license lucide-react v0.468.0 - ISC
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the ISC license.
|
|
56
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/const u1=pe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
58
|
+
* @license lucide-react v0.468.0 - ISC
|
|
59
|
+
*
|
|
60
|
+
* This source code is licensed under the ISC license.
|
|
61
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
+
*/const d1=pe("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
|
|
63
|
+
* @license lucide-react v0.468.0 - ISC
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the ISC license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/const Bt=pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
68
|
+
* @license lucide-react v0.468.0 - ISC
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the ISC license.
|
|
71
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
+
*/const Zl=pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
73
|
+
* @license lucide-react v0.468.0 - ISC
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the ISC license.
|
|
76
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/const h1=pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
78
|
+
* @license lucide-react v0.468.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/const $f=pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
83
|
+
* @license lucide-react v0.468.0 - ISC
|
|
84
|
+
*
|
|
85
|
+
* This source code is licensed under the ISC license.
|
|
86
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
+
*/const Yo=pe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
88
|
+
* @license lucide-react v0.468.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/const tn=pe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
93
|
+
* @license lucide-react v0.468.0 - ISC
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the ISC license.
|
|
96
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/const f1=pe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
98
|
+
* @license lucide-react v0.468.0 - ISC
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the ISC license.
|
|
101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
+
*/const m1=pe("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/**
|
|
103
|
+
* @license lucide-react v0.468.0 - ISC
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the ISC license.
|
|
106
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/const lr=pe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
108
|
+
* @license lucide-react v0.468.0 - ISC
|
|
109
|
+
*
|
|
110
|
+
* This source code is licensed under the ISC license.
|
|
111
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
+
*/const qf=pe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
113
|
+
* @license lucide-react v0.468.0 - ISC
|
|
114
|
+
*
|
|
115
|
+
* This source code is licensed under the ISC license.
|
|
116
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
+
*/const Wf=pe("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
118
|
+
* @license lucide-react v0.468.0 - ISC
|
|
119
|
+
*
|
|
120
|
+
* This source code is licensed under the ISC license.
|
|
121
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
+
*/const p1=pe("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"}]]);/**
|
|
123
|
+
* @license lucide-react v0.468.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/const Yf=pe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
|
|
128
|
+
* @license lucide-react v0.468.0 - ISC
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the ISC license.
|
|
131
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
+
*/const g1=pe("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/**
|
|
133
|
+
* @license lucide-react v0.468.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/const x1=pe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
138
|
+
* @license lucide-react v0.468.0 - ISC
|
|
139
|
+
*
|
|
140
|
+
* This source code is licensed under the ISC license.
|
|
141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
+
*/const Ds=pe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
143
|
+
* @license lucide-react v0.468.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/const Gf=pe("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
|
|
148
|
+
* @license lucide-react v0.468.0 - ISC
|
|
149
|
+
*
|
|
150
|
+
* This source code is licensed under the ISC license.
|
|
151
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
+
*/const b1=pe("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/**
|
|
153
|
+
* @license lucide-react v0.468.0 - ISC
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the ISC license.
|
|
156
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/const y1=pe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
158
|
+
* @license lucide-react v0.468.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/const v1=pe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
163
|
+
* @license lucide-react v0.468.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const Kf=pe("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
|
|
168
|
+
* @license lucide-react v0.468.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const E1=pe("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
|
|
173
|
+
* @license lucide-react v0.468.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const k1=pe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
178
|
+
* @license lucide-react v0.468.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const w1=pe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
183
|
+
* @license lucide-react v0.468.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const T1=pe("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
|
|
188
|
+
* @license lucide-react v0.468.0 - ISC
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the ISC license.
|
|
191
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/const Fi=pe("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
|
|
193
|
+
* @license lucide-react v0.468.0 - ISC
|
|
194
|
+
*
|
|
195
|
+
* This source code is licensed under the ISC license.
|
|
196
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
+
*/const S1=pe("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
198
|
+
* @license lucide-react v0.468.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/const Jl=pe("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
203
|
+
* @license lucide-react v0.468.0 - ISC
|
|
204
|
+
*
|
|
205
|
+
* This source code is licensed under the ISC license.
|
|
206
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
+
*/const C1=pe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
208
|
+
* @license lucide-react v0.468.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/const A1=pe("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
213
|
+
* @license lucide-react v0.468.0 - ISC
|
|
214
|
+
*
|
|
215
|
+
* This source code is licensed under the ISC license.
|
|
216
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
+
*/const ec=pe("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/**
|
|
218
|
+
* @license lucide-react v0.468.0 - ISC
|
|
219
|
+
*
|
|
220
|
+
* This source code is licensed under the ISC license.
|
|
221
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
222
|
+
*/const Os=pe("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
223
|
+
* @license lucide-react v0.468.0 - ISC
|
|
224
|
+
*
|
|
225
|
+
* This source code is licensed under the ISC license.
|
|
226
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
227
|
+
*/const Xf=pe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
228
|
+
* @license lucide-react v0.468.0 - ISC
|
|
229
|
+
*
|
|
230
|
+
* This source code is licensed under the ISC license.
|
|
231
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
232
|
+
*/const N1=pe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
233
|
+
* @license lucide-react v0.468.0 - ISC
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the ISC license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/const ls=pe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
238
|
+
* @license lucide-react v0.468.0 - ISC
|
|
239
|
+
*
|
|
240
|
+
* This source code is licensed under the ISC license.
|
|
241
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
+
*/const _1=pe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
243
|
+
* @license lucide-react v0.468.0 - ISC
|
|
244
|
+
*
|
|
245
|
+
* This source code is licensed under the ISC license.
|
|
246
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
247
|
+
*/const I1=pe("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
|
|
248
|
+
* @license lucide-react v0.468.0 - ISC
|
|
249
|
+
*
|
|
250
|
+
* This source code is licensed under the ISC license.
|
|
251
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
252
|
+
*/const ku=pe("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
|
|
253
|
+
* @license lucide-react v0.468.0 - ISC
|
|
254
|
+
*
|
|
255
|
+
* This source code is licensed under the ISC license.
|
|
256
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
257
|
+
*/const M1=pe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
258
|
+
* @license lucide-react v0.468.0 - ISC
|
|
259
|
+
*
|
|
260
|
+
* This source code is licensed under the ISC license.
|
|
261
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
262
|
+
*/const R1=pe("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
263
|
+
* @license lucide-react v0.468.0 - ISC
|
|
264
|
+
*
|
|
265
|
+
* This source code is licensed under the ISC license.
|
|
266
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
267
|
+
*/const L1=pe("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
268
|
+
* @license lucide-react v0.468.0 - ISC
|
|
269
|
+
*
|
|
270
|
+
* This source code is licensed under the ISC license.
|
|
271
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
+
*/const P1=pe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
|
|
273
|
+
* @license lucide-react v0.468.0 - ISC
|
|
274
|
+
*
|
|
275
|
+
* This source code is licensed under the ISC license.
|
|
276
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
+
*/const Ts=pe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
278
|
+
* @license lucide-react v0.468.0 - ISC
|
|
279
|
+
*
|
|
280
|
+
* This source code is licensed under the ISC license.
|
|
281
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
+
*/const wu=pe("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/**
|
|
283
|
+
* @license lucide-react v0.468.0 - ISC
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the ISC license.
|
|
286
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
+
*/const aa=pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
288
|
+
* @license lucide-react v0.468.0 - ISC
|
|
289
|
+
*
|
|
290
|
+
* This source code is licensed under the ISC license.
|
|
291
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
+
*/const Da=pe("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/**
|
|
293
|
+
* @license lucide-react v0.468.0 - ISC
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the ISC license.
|
|
296
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/const Qf=pe("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
|
|
298
|
+
* @license lucide-react v0.468.0 - ISC
|
|
299
|
+
*
|
|
300
|
+
* This source code is licensed under the ISC license.
|
|
301
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
+
*/const D1=pe("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
303
|
+
* @license lucide-react v0.468.0 - ISC
|
|
304
|
+
*
|
|
305
|
+
* This source code is licensed under the ISC license.
|
|
306
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
307
|
+
*/const O1=pe("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
|
|
308
|
+
* @license lucide-react v0.468.0 - ISC
|
|
309
|
+
*
|
|
310
|
+
* This source code is licensed under the ISC license.
|
|
311
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
312
|
+
*/const cs=pe("RotateCcw",[["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"}]]);/**
|
|
313
|
+
* @license lucide-react v0.468.0 - ISC
|
|
314
|
+
*
|
|
315
|
+
* This source code is licensed under the ISC license.
|
|
316
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
317
|
+
*/const j1=pe("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
318
|
+
* @license lucide-react v0.468.0 - ISC
|
|
319
|
+
*
|
|
320
|
+
* This source code is licensed under the ISC license.
|
|
321
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
322
|
+
*/const F1=pe("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/**
|
|
323
|
+
* @license lucide-react v0.468.0 - ISC
|
|
324
|
+
*
|
|
325
|
+
* This source code is licensed under the ISC license.
|
|
326
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
327
|
+
*/const tc=pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
328
|
+
* @license lucide-react v0.468.0 - ISC
|
|
329
|
+
*
|
|
330
|
+
* This source code is licensed under the ISC license.
|
|
331
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
332
|
+
*/const B1=pe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
333
|
+
* @license lucide-react v0.468.0 - ISC
|
|
334
|
+
*
|
|
335
|
+
* This source code is licensed under the ISC license.
|
|
336
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
337
|
+
*/const H1=pe("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
338
|
+
* @license lucide-react v0.468.0 - ISC
|
|
339
|
+
*
|
|
340
|
+
* This source code is licensed under the ISC license.
|
|
341
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
342
|
+
*/const Bi=pe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
343
|
+
* @license lucide-react v0.468.0 - ISC
|
|
344
|
+
*
|
|
345
|
+
* This source code is licensed under the ISC license.
|
|
346
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
347
|
+
*/const nc=pe("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
|
348
|
+
* @license lucide-react v0.468.0 - ISC
|
|
349
|
+
*
|
|
350
|
+
* This source code is licensed under the ISC license.
|
|
351
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
352
|
+
*/const U1=pe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
|
353
|
+
* @license lucide-react v0.468.0 - ISC
|
|
354
|
+
*
|
|
355
|
+
* This source code is licensed under the ISC license.
|
|
356
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
357
|
+
*/const z1=pe("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/**
|
|
358
|
+
* @license lucide-react v0.468.0 - ISC
|
|
359
|
+
*
|
|
360
|
+
* This source code is licensed under the ISC license.
|
|
361
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
362
|
+
*/const Go=pe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
363
|
+
* @license lucide-react v0.468.0 - ISC
|
|
364
|
+
*
|
|
365
|
+
* This source code is licensed under the ISC license.
|
|
366
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
367
|
+
*/const V1=pe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
|
|
368
|
+
* @license lucide-react v0.468.0 - ISC
|
|
369
|
+
*
|
|
370
|
+
* This source code is licensed under the ISC license.
|
|
371
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
372
|
+
*/const rc=pe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
373
|
+
* @license lucide-react v0.468.0 - ISC
|
|
374
|
+
*
|
|
375
|
+
* This source code is licensed under the ISC license.
|
|
376
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
377
|
+
*/const $1=pe("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
378
|
+
* @license lucide-react v0.468.0 - ISC
|
|
379
|
+
*
|
|
380
|
+
* This source code is licensed under the ISC license.
|
|
381
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
382
|
+
*/const Zf=pe("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/**
|
|
383
|
+
* @license lucide-react v0.468.0 - ISC
|
|
384
|
+
*
|
|
385
|
+
* This source code is licensed under the ISC license.
|
|
386
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
387
|
+
*/const Nr=pe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
|
|
388
|
+
* @license lucide-react v0.468.0 - ISC
|
|
389
|
+
*
|
|
390
|
+
* This source code is licensed under the ISC license.
|
|
391
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
392
|
+
*/const q1=pe("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
|
|
393
|
+
* @license lucide-react v0.468.0 - ISC
|
|
394
|
+
*
|
|
395
|
+
* This source code is licensed under the ISC license.
|
|
396
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
397
|
+
*/const Jf=pe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
398
|
+
* @license lucide-react v0.468.0 - ISC
|
|
399
|
+
*
|
|
400
|
+
* This source code is licensed under the ISC license.
|
|
401
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
402
|
+
*/const Ko=pe("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
|
|
403
|
+
* @license lucide-react v0.468.0 - ISC
|
|
404
|
+
*
|
|
405
|
+
* This source code is licensed under the ISC license.
|
|
406
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
407
|
+
*/const En=pe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
408
|
+
* @license lucide-react v0.468.0 - ISC
|
|
409
|
+
*
|
|
410
|
+
* This source code is licensed under the ISC license.
|
|
411
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
412
|
+
*/const W1=pe("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
|
|
413
|
+
* @license lucide-react v0.468.0 - ISC
|
|
414
|
+
*
|
|
415
|
+
* This source code is licensed under the ISC license.
|
|
416
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
417
|
+
*/const em=pe("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
418
|
+
* @license lucide-react v0.468.0 - ISC
|
|
419
|
+
*
|
|
420
|
+
* This source code is licensed under the ISC license.
|
|
421
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
422
|
+
*/const Y1=pe("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
|
|
423
|
+
* @license lucide-react v0.468.0 - ISC
|
|
424
|
+
*
|
|
425
|
+
* This source code is licensed under the ISC license.
|
|
426
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
427
|
+
*/const js=pe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
428
|
+
* @license lucide-react v0.468.0 - ISC
|
|
429
|
+
*
|
|
430
|
+
* This source code is licensed under the ISC license.
|
|
431
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
432
|
+
*/const Kt=pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
433
|
+
* @license lucide-react v0.468.0 - ISC
|
|
434
|
+
*
|
|
435
|
+
* This source code is licensed under the ISC license.
|
|
436
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
437
|
+
*/const Xo=pe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),X=new Proxy({},{get(e,t){if(typeof window>"u"||!window.api)throw new Error(`window.api 未注入(尝试访问 ${t})。请检查 preload 是否正确加载。`);const n=window.api[t];if(typeof n!="function")throw new Error(`window.api.${t} 不是函数`);return n}}),xn=typeof navigator<"u"&&navigator.userAgent.includes("Electron"),G1=/[\u2E80-\u9FFF\uF900-\uFAFF\u3000-\u303F\uFF00-\uFFEF]/g;function tm(e){if(!e)return 0;const t=(e.match(G1)??[]).length,n=e.length-t;return Math.ceil(t*11/10+n/4)}function K1(e,t){return!t||t<=0?null:e<=0?0:Math.min(100,Math.round(e/t*100))}function X1(e,t){const n=e.reduce((r,i)=>r+i,0);return n<=0||t<=0?e.map(()=>0):e.map(r=>t*r/n)}function pr(e){return e<1e3?String(Math.round(e)):e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.round(e/1e3)}k`}const nm=.5,Q1=.9,Z1=.85;var sc=Ax();const rm="lookatstudy-lang";let Hi=typeof localStorage>"u"?"zh-CN":localStorage.getItem(rm)||"zh-CN";const Qo=new Set;function sm(e){return Qo.add(e),()=>{Qo.delete(e)}}const Tu={"zh-CN":{"action.close":"关闭","action.delete":"删除","action.undo":"撤销","action.confirm":"确认","action.cancel":"取消","header.toggleLeft":"切换左栏 (Ctrl+B)","header.toggleRight":"切换右栏","header.font.smaller":"缩小字号","header.font.larger":"放大字号","header.settings":"设置 (Ctrl+S)","header.xp":"XP","header.theme.dark":"切换到亮色","header.theme.light":"切换到暗色","map.tab.map":"课程地图","map.tab.import":"导入课程","map.course.none":"未选择课程","map.review.label":"复习","map.search.label":"搜索","map.search.placeholder":"搜索章节、课时或内容…","map.search.close":"关闭","map.search.clear":"清空","map.search.noResults":"没有匹配的结果","map.search.contentGroup":"内容匹配","chat.action.startLearning":"开始学习「{title}」","chat.action.startLearningPrompt":`我想开始学「{title}」。但我现在没什么劲——别直接讲概念,也别出计分题考我。请这样开场:
|
|
438
|
+
1. 先用一两句散文抛个钩子(反直觉的、或跟我日常有关的,让我产生好奇);
|
|
439
|
+
2. 然后调用 pose_guess 工具,给我一个二选一的小猜测(就是玩,不是考试);
|
|
440
|
+
3. 我会点选项猜,你【下一回合】再揭晓,顺带把这课最核心的一点讲清楚。
|
|
441
|
+
铁律:起手不要讲座、不要用 generate_quiz 出计分题、不要计分。把我勾住是唯一目标。`,"starter.go-deeper.label":"深入这点","starter.go-deeper.hint":"把刚揭晓的概念讲深一层","starter.go-deeper.message":"帮我深入讲讲「{title}」刚才那个核心点——展开它的结构、细节和容易忽略的边界。","starter.give-example.label":"举个例子","starter.give-example.hint":"用真实例子帮你看懂","starter.give-example.message":"给我一个「{title}」的实际例子或用法,让我更具体地理解。","starter.quiz-me.label":"考考我","starter.quiz-me.hint":"出题检验(答对涨掌握度)","starter.quiz-me.message":"出一道关于「{title}」的应用题考考我,看我是否真懂了——我答完请判断对错。","starter.confused.label":"我没太懂","starter.confused.hint":"告诉 AI 你卡在哪(会记下)","starter.confused.message":"关于「{title}」,我有地方不太懂,帮我理一理——先问我是哪里不清楚。","map.world.study":"学习","map.world.practice":"实操","pane.switcher":"视图切换","pane.map":"课程","pane.chat":"导师","pane.notes":"黑板","map.streaming.notice":"AI 正在回答,完成后可切换节点","map.generating":"正在生成课程路径…","map.empty.cta.title":"开始你的第一门课","map.empty.cta.desc":"导入一个 GitHub 学习仓库,自动生成选关路径","map.empty.cta.btn":"点这里导入 →","map.empty.practice":"这个课程暂无实操练习内容","node.locked.chapterHint":"(完成本章所有课时后解锁)","node.due.hint":"(待复习)","import.empty":"还没有课程。用下方导入第一个吧。","import.cta":"导入新课程","import.tab.url":"URL","import.tab.md":"MD","import.tab.folder":"文件夹","import.url.placeholder":"GitHub 仓库 / 网页文章 / arXiv 论文 链接","import.url.desc":"粘贴任意链接自动识别:GitHub 仓库 / arXiv 论文 / 网页文章 / B站·YouTube 视频(转写成课;B站多分P 不带 ?p= 导整季;更多站点需自装 yt-dlp)。","import.btn.url":"导入","import.btn.url.busy":"导入中…","import.placeholder.name":"课程名称(可选)","import.placeholder.md":"粘贴任意长文本或 Markdown…(没有小标题会自动分段)","import.btn.md":"导入为课程","import.btn.md.busy":"生成中…","import.folder.desc":"递归扫描 .txt/.md/.html/.pdf,适合已下载的课程资料包。","import.btn.folder":"选择文件夹","import.tab.epub":"电子书","import.epub.desc":"EPUB 电子书按章节拆课(章节边界来自书的目录与书脊顺序)。","import.btn.epub":"选择 EPUB 文件导入","import.tab.audio":"音频","import.audio.desc":"播客/讲座音频或本地视频(mp4)本地转写成课(音频 wav/mp3/m4a/flac,视频 mp4/m4v/mov,可多选=多集)。首次使用自动下载 Whisper 模型(约 1GB)。","import.btn.audio":"选择音频文件导入","import.tab.pack":"课程包","import.btn.pack":"选择课程包文件导入","import.pack.desc":"课程包是别人分享的导入方案快照(零 AI 调用,秒过分类和结构设计)。GitHub 仓库内容一致时直接复用;有更新会自动丢弃消失文件对应的课。","import.export":"导出","import.folder.pathPlaceholder":"服务器侧文件夹路径(如 /storage/emulated/0/Download/我的课程)","import.folder.pathRequired":"请填写服务器侧文件夹路径","import.pack.export":"导出课程包(分享给别人零 AI 导入)","import.pack.exported":"课程包已导出:{path}","import.error.resume":"从断点重试(跳过已完成的 AI 步骤)","import.success.reused":"复用已有方案,零 AI 调用","import.btn.folder.busy":"处理中…","import.delete":"删除","import.delete.confirm":"所有进度和练习都会清除,无法撤销。","import.delete.current":"删除当前课程","course.empty.title":"选择一门课程开始学习","course.empty.desc":"从左侧「导入课程」面板选择一门已导入的课程,或导入新课程。","import.success.md":"生成成功","import.success.folder":"导入成功","import.error.network":`
|
|
442
|
+
|
|
443
|
+
网络受限或私有仓库请改用「Markdown」方式。`,"import.progress.elapsed":"已 {s}s","import.progress.title":"正在导入课程…","import.progress.starting":"正在启动…","import.progress.note":"导入在后台进行,可继续浏览其他课程","import.progress.cancel":"取消导入","import.cancelled":"已取消导入","toast.threadCreateFailed":"创建失败了,再试一次","toast.threadCreated":"新对话","toast.threadRenamed":"已重命名","toast.threadArchived":"已归档","toast.threadDeleted":"已删除","toast.threadDefault":"新会话","toast.restored":"已恢复","toast.noteSaved":"已加到笔记","toast.noteDeleted":"已删除笔记","toast.artifactSaved":"已记到笔记本","artifact.type.concept_map":"概念图","artifact.type.quiz":"练习题","artifact.type.compare_table":"对比表","artifact.type.diagram":"流程图","artifact.type.code_walkthrough":"代码讲解","artifact.type.unknown":"产物","command.placeholder":"输入指令或问题…(↑↓ 选择,Enter 确认)","command.empty.node":"没有匹配的命令","command.empty.nonode":"先在左侧选一个节点,才能用这些命令","command.footer.hint":"AI 导师会根据指令生成对应内容","command.footer.keys":"↵ 确认 · esc 关闭","command.group.node":"基于当前节点","command.group.mode":"学习模式","command.group.nav":"导航","command.explain_simple":"用大白话解释这一节","command.quiz_3":"出 3 道练习题考考我","command.concept_map":"画个概念图理清结构","command.compare_prev":"和上一节做对比表","command.socratic":"切到苏格拉底模式(提问引导)","command.exam_mode":"切到考试冲刺模式","review.title":"复习","review.nudge":"📅 今天有 {n} 个待复习,点左侧地图的「复习」入口巩固一下","review.loading":"正在检查哪些课该复习了…","review.empty.title":"还没有复习项","review.empty.desc":"完成一些练习后,这里会出现间隔复习提醒","review.due.count":"个待复习","review.start":"开始复习","review.shuffle":"混合练习(随机交错)","review.interleave":"交错复习","review.reviewLesson":"复习该课","review.selectSection":"选择章节","review.dueIn":"待复习","review.noDueInSection":"该章节暂无待复习内容","review.srsHint":"复习提醒","review.myProgress":"我的课程进度","review.overdueQuickHint":"逾期项,点击直接复习","review.quadrant.overdue":"逾期","review.quadrant.short":"短期","review.quadrant.long":"长期","review.quadrant.inactive":"待激活","review.quadrant.more":"更多","review.tip":"复习采用 SM-2 间隔重复算法。逾期项优先复习;长期记忆项间隔更长。单次复习封顶 {n} 题,避免积压压垮节奏。","review.selfrated":"✓ 已记录,掌握度已更新","review.selfrate.title":"复习完了吗?给自己打分","review.selfrate.again":"忘了","review.selfrate.again.hint":"明天重练","review.selfrate.remembered":"记得","review.selfrate.remembered.hint":"推迟几天","review.selfrate.mastered":"很熟","review.selfrate.mastered.hint":"很久后再看","lang.original":"原文","error.checkReadyFailed":"无法检查就绪状态","notebook.tab.explain":"讲解","notebook.tab.notes":"笔记","notebook.tab.board":"黑板","notebook.board.empty":"对话里产生概念图、流程图、对比表、代码讲解时,这里会实时展示最新的一幅大图,方便边看边问。","notebook.zone.understand":"理解","notebook.zone.note":"记录","notebook.zone.practice":"练习","notebook.empty.explain.title":"选一节课开始","notebook.empty.explain.desc":"在左侧地图选一个课时,这里会显示讲解内容","notebook.empty.notes.title":"还没有笔记","notebook.empty.notes.desc":"选中讲解文字画线,或让 AI 生成概念图/对比表,会出现在这里","settings.group.ai":"主模型","settings.group.speech":"语音模型","settings.group.vision":"看图模型","settings.group.appearance":"外观与语言","settings.row.provider":"服务商","settings.row.theme":"主题","settings.row.interface_lang":"界面语言","settings.row.import_lang":"导入偏好","settings.custom.form_title":"添加自定义 Provider","settings.footer.hint":"主模型区的改动需保存后生效,其余即时生效","settings.footer.save":"保存 AI 配置","header.energy":"今日能量","header.level.title":"等级(累计经验值的持久成长线,不随每日能量清零)","settings.title":"设置","view.tree":"技能树","view.dashboard":"仪表盘","view.import":"导入课程","mode.chat":"💬 对话","mode.exercise":"📝 练习","mode.settings":"⚙️ 设置","chat.starter.hint":"💡 从下面选一个开始,或者直接输入你的问题","chat.no_key.title":"还没有配置 AI 模型","chat.no_key.desc":"配置后即可开始 AI 导师对话和练习","chat.no_key.btn":"去配置模型","chat.input.placeholder":"问 AI 导师…(Enter 发送)","chat.input.no_node":"先在左侧选一个 lesson…","chat.send":"发送","chat.stop":"停止","chat.clear":"清空对话历史","chat.selection.quote":"提问这段","chat.soul.label":"风格:","chat.no_key.short":"未配置 AI 模型","chat.no_key.cta":"去配置 →","chat.attach.add":"添加图片或文件(可粘贴 / 拖拽)","chat.attach.remove":"移除 {name}","chat.attach.tooMany":"一条消息最多 {n} 个附件","chat.attach.tooLargeImage":"图片超过 5MB:{name}","chat.attach.tooLargeText":"文本文件超过 256KB:{name}","chat.attach.unsupported":"暂不支持该类型:{name}(支持图片与常见文本 / 代码文件)","chat.attach.visionUnsupported":"当前模型不支持看图,请用右侧模型切换器选一个带眼睛图标的模型,或在设置 → AI 看图里配置视觉模型覆盖","chat.attach.bridgeChip":"主模型是纯文本:图片将先由 {model} 转译成文字再交给它","chat.attach.preview":"查看 {name}","chat.attach.textChip":"文本附件,内容已随消息发给 AI","chat.attach.imageOnlyText":"请看这张图片。","context.label":"上下文","context.aria":"上下文已用 {p}","context.approx":"约","context.system":"系统提示","context.node":"课文","context.learner":"学习者状态","context.history":"对话历史","context.draft":"草稿","context.unknownWindow":"模型窗口未知","model.picker.label":"模型","model.picker.manage":"管理模型与密钥…","model.picker.vision":"支持看图","model.picker.noneConfigured":"还没有配置任何 provider 密钥","effort.label":"思考强度","effort.auto.label":"自动","effort.auto.desc":"模型默认行为,不干预","effort.fast.label":"快速","effort.fast.desc":"尽量关思考,答得快、省 token","effort.deep.label":"深度","effort.deep.desc":"尽量开思考,难题多想几步","effort.unsupported":"当前 provider 暂不支持思考强度切换","soul.direct":"精讲","soul.guide":"引导","soul.practice":"实战","soul.direct.desc":"精讲派 · 新手/想搞懂时用。先讲清楚再确认,给完整范例,不让你猜","soul.guide.desc":"引导派 · 有点基础、想自己推时用。不直接给答案,用引导性问题帮你推导","soul.practice.desc":"实战派 · 想动手时用。围绕真实世界的乱问题,在做中把概念织成网","settings.provider":"AI 服务商(Provider)","settings.model":"模型(Model)","settings.apikey":"API Key","settings.test":"测试连接","settings.testing":"测试中…","settings.save":"保存设置","settings.saved":"✅ 已保存","settings.daily_goal":"每日学习目标(XP)","settings.custom.add":"+ 添加自定义 Provider","settings.language":"语言(Language)","settings.add_custom":"自定义","settings.custom.label_ph":"名称","settings.custom.baseurl_ph":"Base URL(如 https://api.example.com/v1)","settings.custom.model_ph":"模型 ID","settings.custom.new":"新建自定义","settings.custom.form_title_vision":"配置看图模型(自定义 provider)","settings.custom.model_ph_vision":"如 glm-4.6v / gpt-4o","settings.custom.form_title_tts":"配置朗读 provider(OpenAI 兼容 /audio/speech 端点)","settings.custom.model_ph_tts":"如 tts-1 / FunAudioLLM/CosyVoice2-0.5B","settings.custom.form_title_asr":"配置听写 provider(OpenAI 兼容 /audio/transcriptions 端点)","settings.custom.model_ph_asr":"如 whisper-large-v3-turbo","settings.custom.apikey_ph":"API Key(可选)","settings.custom.save":"保存","settings.custom.windowLabel":"上下文窗口(tokens)","settings.custom.windowPh":"如 128000 或 128k(留空 = 未知)","settings.custom.windowHint":"当前模型的最大上下文,可在模型官方文档查到。填了输入框旁的上下文表才会显示占比。","settings.custom.vision":"支持看图(多模态)","settings.custom.visionHint":"勾选后系统将图片直接发给主模型;不勾选则走视觉转译桥(需在 AI 看图区配视觉模型)或跳过图片。","settings.delete_custom":"删除此自定义 Provider","settings.delete_custom_confirm":"删除自定义 Provider「{name}」?无法撤销。","settings.key.overwrite_ph":"覆盖…","settings.key.paste_ph":"粘贴 key","settings.key.get":"获取 →","settings.refresh":"刷新","settings.discovering":"刷新中…","settings.discover_failed":"刷新失败(可能网络受限)","settings.daily_goal.hint":"XP / 天(每答对一题 +10 XP)","settings.theme.auto":"跟随系统","settings.theme.light":"浅色","settings.theme.dark":"深色","settings.theme.following":"当前跟随系统:{mode}","settings.lang_pref.desc":"导入课程时自动按此偏好选择翻译。仓库原文语言与偏好一致时直接用原文;无对应翻译时也用原文。","settings.img_download":"图片下载","settings.img_download.desc":"导入课程时自动下载 md/notebook 里引用的图片(默认开启)","settings.multimodal.toggle":"AI 看图(聊天时)","settings.multimodal.toggle.desc":"开启后,聊天时 AI 能看到当前课关联的图片并讲解;问图/图表/架构图时生效(需 vision 模型)。导入时下载图片由上面的「图片下载」控制。","settings.group.memory":"学习者记忆","settings.memory.toggle":"让 AI 记住我","settings.memory.toggle.desc":"开启后,AI 会跨会话记住你的学习方式(偏好/卡点/反复混淆),越教越懂你。你拿皇冠(通关一节)时自动总结;也可手动触发。所有记忆只存本地。","settings.group.companion":"伴学伙伴","settings.companion.toggle":"伴学伙伴","settings.companion.toggle.desc":"伴学伙伴常驻课程地图、笔记本与对话栏:高光时刻一起庆祝,朗读课文时对口型,你的每次键击它都跟着拍手。五款形象随时换,只在本地运行。","settings.companion.sfx":"宠物音效","settings.companion.sfx.desc":"戳他/被拍/落地时的短促啾哔声(合成音,低音量)","settings.companion.pet":"桌宠模式","settings.companion.pet.desc":"伴学伙伴在应用外常驻桌面:透明置顶、慢慢巡游,点他仍可互动。开启后应用内的伙伴会休息,避免双影。","settings.companion.form":"形象","companion.name":"小焰","companion.form.ember.name":"小焰","companion.form.ember.desc":"赤焰守护机——热情的原点,能量核随今日 XP 充能","companion.form.frost.name":"霜绒","companion.form.frost.desc":"冰晶守望机——冷静沉稳,六瓣冰晶核逐瓣点亮","companion.form.moss.name":"苔芽","companion.form.moss.desc":"自然精灵机——温软陪伴,胸口种子随进度发芽张叶","companion.form.astro.name":"星尘","companion.form.astro.desc":"星空观测机——夜空屏面,能量核是随 XP 变圆的月相","companion.form.ink.name":"墨墨","companion.form.ink.desc":"砚上学者机——书房静气,墨池水位就是今日进度","companion.greet.1":"我在呢,继续!","companion.greet.2":"这节快拿下了!","companion.greet.3":"要我再讲一遍吗?","companion.greet.4":"深呼吸,再来一次。","settings.multimodal.current_model":"当前主模型:{model}","settings.multimodal.not_selected":"(未选)","settings.multimodal.hint_custom":"自定义 provider — 视觉能力未知。如不支持看图,在下方覆盖一个 vision 模型。","settings.multimodal.hint_preset":"如当前模型不支持 vision,可在下方配置专门的 vision 模型。常见:GLM-4V / GPT-4o / Claude 3.5 / Gemini。","settings.multimodal.override_title":"Vision 模型覆盖(可选 — 留空则复用主模型)","settings.multimodal.override_bridge_hint":"主模型不支持看图时,聊天中上传的图片会先由该模型转译成文字描述,再交给主模型解读(图像转译桥)。","settings.multimodal.legacy_preset":"旧配置(预设 {label})仍生效;可停止覆盖或改用自定义。","settings.multimodal.replace_custom":"更换","settings.multimodal.stop_override":"停止覆盖","settings.multimodal.vision_capable":"vision","settings.multimodal.test_override":"测试模型","settings.saved_text":"已保存","settings.key.configured":"已配置","settings.custom.test_label":"(测试)","settings.proto.openai":"OpenAI 兼容","chat.empty.overview":"这是这一课的概览","chat.empty.summary.title":"本课摘要","chat.empty.summary.none":"暂无摘要,点开始学习让 AI 帮你了解这一课","chat.empty.start":"开始学习","chat.empty.greeting":"👋 准备好了吗?这一课我们慢慢来。","chat.empty.keyless.title":"内容已在右侧,先读一读","chat.empty.keyless.desc":"配置好 AI 模型,就能和我对练、做练习、追踪掌握度。","chat.empty.keyless.btn":"去配置 AI 模型","chat.empty.no_node.title":"从左侧地图选一个节点","chat.empty.no_node.desc":"点击圆球节点开始学习。绿色=可学,金色=已掌握,紫色=章节考试","chat.scroll.bottom":"回到底部","chat.speech.speak":"朗读这条消息","chat.speech.stop":"停止朗读","chat.speech.progress":"{n}/{total} 句","chat.speech.model_missing":"语音模型还没下载。到 设置 → 语音能力 下载后即可朗读。","chat.speech.engine_unavailable":"语音引擎未就位。桌面版开箱可用;Termux 端重跑一行安装命令即可补装(约 12MB)。","chat.speech.dictation":"语音输入","chat.speech.hold_to_talk":"按住说话","chat.speech.release_to_stop":"松开,结束录音","chat.speech.recording_hint":"正在录音,松开结束","chat.speech.rerecord":"取消重录","chat.speech.retry":"重试","chat.speech.back_to_keyboard":"切回键盘输入","chat.speech.keyboard":"键盘","chat.speech.custom_provider_missing":"自定义语音 provider 不存在或已删除,到 设置 → 语音模型 重新配置。","chat.speech.no_speech":"没听到声音,请检查麦克风后重试。","chat.speech.transcribing":"转录中…","chat.speech.asr_failed":"转录失败,请重试。","chat.speech.groq_key_missing":"Groq 密钥未配置。到 设置 → 模型服务 配置 Groq,或改用本地引擎。","chat.speech.azure_stt_key_missing":"旧 Azure 听写配置缺少密钥。请在 设置 → 语音模型 改用自定义听写端点。","chat.speech.azure_stt_region_missing":"旧 Azure 听写配置缺少区域。请在 设置 → 语音模型 改用自定义听写端点。","chat.speech.asr_model_missing":"听写模型还没下载。到 设置 → 语音模型 下载 Whisper(本地离线),或改用自定义听写端点。","chat.speech.asr_start_fail":"麦克风启动失败,请检查系统权限。","chat.speech.asr_insecure_context":"浏览器只允许在安全上下文(https 或 127.0.0.1)使用麦克风。请用手机引导器打开本页,或给 serve 配置 --tls-cert/--tls-key 后改走 https 访问。","chat.speech.read_aloud_node":"朗读本课","chat.speech.azure_key_missing":"Azure 朗读缺少密钥。到 设置 → 语音能力 填写后使用。","chat.speech.azure_region_missing":"Azure 朗读缺少区域。到 设置 → 语音能力 填写后使用。","chat.speech.edge_failed":"在线朗读失败,且本地模型未就绪无法降级。稍后重试或改用本地引擎。","chat.speech.edge_disclosed":"朗读将文本发送至微软在线服务(Edge 免费通道)。想完全离线:设置 → 语音能力 → 本地离线。","settings.speech.tts_engine":"朗读引擎","settings.speech.engine.edge":"Edge 在线","settings.speech.engine.azure":"Azure","settings.speech.engine.local":"本地离线","settings.speech.engine.custom":"自定义","settings.speech.engine.system":"系统引擎","settings.speech.engine.system_note":"音色来自本机浏览器/系统的语音引擎,质量随设备而定(国产手机的厂商/讯飞引擎通常更自然)。本地播放、不联网;朗读时逐句高亮照常,伴学嘴型不可用。","settings.speech.engine.system_unavailable":"当前环境(WebView)不支持系统朗读","settings.speech.voice_auto":"自动(优先中文音色)","settings.speech.model.turbo_short":"Whisper Turbo(约 1GB)","settings.speech.model.small_short":"Whisper Small(约 360MB)","settings.speech.tts_title":"朗读","settings.speech.asr_title":"听写","settings.speech.custom_voice_ph":"如 alloy(留空用端点默认)","settings.speech.legacy":"旧配置,仍生效","settings.speech.key_saved":"密钥已存","settings.speech.confirm_del_custom":"删除后该档不可用,确认?","settings.speech.downloading":"下载中…","settings.speech.asr_engine.custom_note":"OpenAI 兼容转写端点;Groq 用户填 https://api.groq.com/openai/v1 + whisper-large-v3-turbo。","settings.speech.engine.edge_note":"微软 Edge 朗读通道:免费、无需密钥、音色为产品级;文本经在线服务合成。","settings.speech.voice":"音色","settings.speech.speed":"语速","settings.speech.asr_engine":"听写引擎","settings.speech.asr_engine.local":"本地离线","settings.speech.asr_engine.local_note":"Whisper 离线转写(自带标点,中文质量好);下载模型后完全离线,Turbo 约 1GB / Small 约 360MB。","settings.speech.asr_auto_stop":"静音后自动停止录音","settings.speech.asr_ux_note":"点输入框旁的麦克风进入语音模式:按住说话,松开后可修改识别文字再发送。","settings.speech.model.asr_turbo":"听写引擎 Whisper Turbo(约 1GB,推荐桌面)","settings.speech.model.asr_small":"听写引擎 Whisper Small(约 360MB,轻量)","settings.speech.license_mit":"MIT · 本地推理","settings.speech.model.tts":"朗读引擎(Kokoro,约 430MB)","settings.speech.state.absent":"未下载","settings.speech.state.ready":"已就绪","settings.speech.state.error":"出错","settings.speech.download":"下载","settings.speech.delete":"删除","settings.speech.license":"Apache-2.0 · 本地推理","chat.friction.trigger":"我卡住了","chat.friction.hint":"选一个最接近的感受(可选写一句原因),AI 会记住并据此调整讲解。","chat.friction.confused":"糊涂","chat.friction.blocked":"卡住","chat.friction.frustrated":"受挫","chat.friction.desc_placeholder":"具体卡在哪了?(可选)","chat.friction.cancel":"取消","chat.friction.submit":"记下","chat.friction.saved":"已记下,AI 会据此调整这一课的讲法","chat.mastered.toast":"👑 太棒了!你掌握了这一课","chat.note.add":"加笔记","chat.note.add.title":"把这段对话存到记录区","chat.reasoning.label":"思考过程","chat.reasoning.chars":"{n} 字","chat.proposal.title":"AI 提议","chat.proposal.fallback":"提议({tool})","chat.proposal.apply":"应用","chat.proposal.reject":"拒绝","chat.proposal.mastered.title":"AI 建议你已掌握这节课","chat.proposal.mastered.hint":"采纳后本课解锁皇冠、进入复习排期。","chat.proposal.confirm":"确认掌握","chat.proposal.later":"再练练","chat.proposal.applied":"已采纳 · 本课已掌握","chat.proposal.rejected":"已忽略,继续学习","chat.copy":"复制","chat.copied":"已复制","chat.tool.get_node_info":"读取节点信息","chat.tool.record_answer":"记录答题观测","chat.tool.mark_mastered":"标记掌握","chat.tool.show_concept_map":"生成概念图","chat.tool.generate_quiz":"出练习题","chat.tool.compare_table":"生成对比表","chat.tool.draw_diagram":"画流程图","chat.tool.show_code_walkthrough":"代码讲解","thread.empty.no_node":"未选节点","thread.empty.hint":"输入问题开始","thread.actions.label":"操作","thread.new.label":"新建会话","thread.menu.rename":"重命名","thread.menu.archive":"归档","thread.delete.confirm":"删除会话「{name}」?消息也会一并删除。","notebook.empty.select_node":"从左侧地图选一个节点开始学习,讲解会显示在这里","notebook.empty.no_notes_message":"这一节还没有笔记。选中讲解文字「加笔记」,或问 AI「画个概念图」「出 3 道题」「做个对比表」","notebook.node_type.section":"章节","notebook.node_type.concept":"概念","notebook.node_type.lesson":"课时","notebook.content.loading":"正在加载这一节的讲解…","notebook.content.load_failed":"内容加载失败。","notebook.content.retry":"重试","notebook.content.render_failed":"这段内容渲染失败(可能翻译格式有问题)。","notebook.content.truncated":"…(截断)","notebook.content.retry_render":"重试渲染","notebook.content.empty":"这一节还没有讲解内容。问 AI 导师:「给我讲讲这一节」","notebook.images.heading":"插图({n})","notebook.quote.template":"关于这段内容「{text}」,我不太懂,请帮我解释:","notebook.quote.ask":"提问","notebook.quote.add_note":"加笔记","notebook.quote.save_note.title":"把选中文字存到记录区,带溯源跳转","notebook.quote.hint":"选中讲解文字点「加笔记」;AI 生成的概念图/对比表/练习卡会自动进「笔记」标签","notebook.source.label":"来源","notebook.source.jump_content":"跳到讲解原位","notebook.source.jump_chat":"跳到对话原位","notebook.zone.understand.subtitle":"AI 帮你梳理的知识结构","notebook.zone.understand.empty_hint":"问 AI「画个概念图」「做个对比表」梳理这一节","notebook.zone.note.subtitle":"你的画线,点击可跳回原位","notebook.zone.note.empty_hint":"选中讲解或对话的文字,点「加笔记」存到这里","notebook.zone.practice.subtitle_empty":"做题检验掌握,可重做","notebook.zone.practice.subtitle_stats":"{n} 题 · 上次答对 {c} · 答错 {w}","notebook.zone.practice.empty_hint":"问 AI「出 3 道题考考我」,题目会自动进这里","notebook.note.comment.ph_new":"写下你对这段画线的注释…","notebook.note.comment.ph_edit":"编辑注释…(清空保存即可删除)","notebook.action.save":"保存","notebook.action.cancel":"取消","notebook.note.edit_comment":"编辑注释","notebook.note.add_comment":"加注释","notebook.note.pinned":"已置顶","notebook.note.pin":"置顶","notebook.note.unpin":"取消置顶","notebook.note.delete":"删除","notebook.quiz.last_correct":"上次答对","notebook.quiz.last_wrong":"上次答错","notebook.artifact.broken":"产物数据损坏","notebook.asset.loading":"加载中…","exam.loading":"正在生成章节考试题…","exam.errorTitle":"考试加载失败","exam.errorEmpty":"题目生成失败,请稍后重试","exam.reload":"重新加载","exam.question.label":"第 {n} 题","exam.next":"下一题","exam.submit":"提交考试","exam.accuracy":"正确率 {n}%","exam.stars.congrats":"恭喜,获得 {n} 星!","exam.stars.thisAndBest":"本次 {n} 星 · 历史最佳 {m} 星","exam.stars.failed":"未达 60%,再接再厉","exam.review.title":"逐题回顾","exam.review.questionFallback":"(题目 {n})","exam.review.yourAnswer":"你的答案:","exam.review.correctAnswer":"正确:","exam.review.unanswered":"(未答)","exam.retry":"重新考试(题目已缓存)","exam.generating.title":"正在生成章节考试题…","exam.generating.stage":"AI 正在按本章知识点逐批出题","exam.generating.kcProgress":"已覆盖 {done} / {total} 个知识点","exam.generating.preparing":"准备中…","exam.generating.canLeave":"可以离开本页,生成会在后台继续;完成后会通知你。","exam.failed.retry":"重新生成","exam.ready.title":"考试已生成","exam.ready.meta":"{q} 题 · 覆盖 {kc} 个知识点 · 预计 {min} 分钟","exam.ready.toast":"「{title}」的考试题已生成,随时可以开考","exam.start":"开始考试","exam.retryExam":"重新考试","exam.regenerate":"重新出题","exam.regenerate.confirmMsg":"重新出题会丢弃当前题库,并让 AI 按本章知识点重新出一批(历史成绩保留)。","exam.submitting":"正在判分…","exam.q.progress":"第 {i} / {n} 题","exam.q.next":"下一题","exam.q.submit":"提交考试","exam.terminated.banner":"本场考试因中途离开被终止,未答的题按答错计分。","exam.result.score":"{correct} / {total} 题正确","exam.result.accuracy":"正确率 {pct}%","exam.result.best":"历史最好:{stars} 星","exam.result.attempts":"已考 {n} 次","exam.result.kcBreakdown":"按知识点","exam.result.weakKc":"薄弱 · 建议复习","exam.result.correctLabel":"答对","exam.result.unanswered":"未答","exam.result.yourAnswer":"你的答案:","exam.result.correctAnswer":"正确答案:","exam.result.review":"逐题回顾","exam.leave.title":"离开将终止考试","exam.leave.message":"未答的题将按答错计分,本场成绩会被记录。确定要离开吗?","exam.leave.confirm":"终止并离开","exam.leave.cancel":"继续考试","error.renderFailed":"这部分内容渲染失败(可能格式有问题)。","error.retry":"重试","artifact.unknownHeader":"产物(未识别类型)","artifact.zoomOut":"缩小","artifact.zoomReset":"重置缩放","artifact.zoomIn":"放大","artifact.canvas.fit":"适屏","artifact.viewer.open":"放大查看","artifact.viewer.hint":"双指缩放 · 单指拖动 · Ctrl+滚轮","artifact.conceptmap.stats":"{nodes} 个概念 · {edges} 个关系 · Ctrl+滚轮缩放 · 拖动平移","artifact.codewalk.sectionLabel":"逐段讲解(点击定位代码)","artifact.codewalk.lineSingle":"第 {n} 行","artifact.codewalk.lineRange":"第 {a}-{b} 行","artifact.diagram.flowchart":"流程图","artifact.diagram.sequence":"时序图","artifact.diagram.state":"状态图","artifact.mermaid.openLive":"在 mermaid.live 打开(可编辑)","artifact.mermaid.rendering":"渲染图中…","artifact.mermaid.renderFailed":"渲染失败,显示源码(可复制到 mermaid.live 查看)","artifact.mermaid.errorPrefix":"错误: {msg}","artifact.mermaid.hint":"Ctrl+滚轮缩放 · 拖动平移查看","quiz.questionProgress":"第 {cur}/{total} 题","quiz.answeredCorrect":"已答对 {n}","quiz.correct":"答对了","quiz.wrong":"答错了","quiz.finish":"完成练习","quiz.scoreSummary":"{correct}/{total} 答对","quiz.hook.label":"📊 答题完成:{{correct}}/{{total}}","quiz.hook.finish":"完成答题","quiz.hook.sent":"成绩单已交给导师,等待分析…","quiz.hook.message":`我刚做完了答题卡{{title}},成绩 {{correct}}/{{total}}。下面是逐题情况:
|
|
444
|
+
请根据我的表现决定下一步:答错的题讲清为什么错和正确思路;全对的话判断我是否可以进入下一部分。不要重新出同一组题,也不要只说一句做得好。`,"quiz.hook.lineOk":"✅ 第{{n}}题「{{prompt}}」:答对","quiz.hook.lineWrong":"❌ 第{{n}}题「{{prompt}}」:我选了「{{chosen}}」,正确答案是「{{answer}}」","quiz.allCorrectHint":"全部答对,掌握度已提议更新","quiz.tryAgainHint":"再练一组巩固一下","quiz.action.nextPrompt":"接下来可以:","quiz.action.explainWrong":"讲讲我答错的","quiz.action.retry":"再来一组","quiz.action.goDeeper":"深入讲讲原理","quiz.action.markMastered":"确认我掌握了","quiz.action.nextTopic":"下一个知识点","guess.header":"来猜一个","guess.pickedPrefix":"我猜:","guess.waitReveal":"已猜,等 AI 揭晓 ⋯","import.deleted":"已删除:{title}","exercise.title":"📝 练习","exercise.generate":"出一道练习","exercise.submit":"提交答案","exercise.next":"下一题 →","exercise.correct":"✅ 答对了!","exercise.wrong":"❌ 答错了","exercise.types.mcq":"选择题","exercise.types.fill_blank":"填空题","exercise.types.true_false":"判断题","dashboard.title":"学习仪表盘","dashboard.stat.streak":"连续天数","dashboard.stat.due":"今日待复习","dashboard.stat.mastery":"整体掌握度","dashboard.review":"去复习","dashboard.cleared":"已清空","dashboard.export.md":"📄 导出报告","dashboard.export.json":"导出 JSON","dashboard.section_mastery":"按章节掌握度","dashboard.mini.sections":"章节掌握度","dashboard.mini.struggle":"你的薄弱点(点开重学)","import.title":"导入课程","import.url":"GitHub URL","import.markdown":"粘贴 Markdown","import.btn":"导入","import.md_btn":"生成课程","streak.days":"天","streak.title":"连续学习 {n} 天 · 最长 {m} 天","streak.freeze.title":"剩余冻结 {n} 个:漏签一天可自动保住连击"},en:{"action.close":"Close","action.delete":"Delete","action.undo":"Undo","action.confirm":"Confirm","action.cancel":"Cancel","header.toggleLeft":"Toggle left pane (Ctrl+B)","header.toggleRight":"Toggle right pane","header.font.smaller":"Decrease font size","header.font.larger":"Increase font size","header.settings":"Settings (Ctrl+S)","header.xp":"XP","header.theme.dark":"Switch to light","header.theme.light":"Switch to dark","map.tab.map":"Course Map","map.tab.import":"Import","map.course.none":"No course selected","map.review.label":"Review","map.search.label":"Search","map.search.placeholder":"Search chapters, lessons or content…","map.search.close":"Close","map.search.clear":"Clear","map.search.noResults":"No results","map.search.contentGroup":"Content matches","chat.action.startLearning":"Start learning “{title}”","chat.action.startLearningPrompt":`I want to start learning “{title}”, but I'm low on energy right now — don't lecture me with concepts and don't quiz me with scored questions. Open like this instead:
|
|
445
|
+
1. First hook me with a sentence or two of prose (counter-intuitive, or tied to daily life — make me curious);
|
|
446
|
+
2. Then call the pose_guess tool with a small two-option guess (just for fun, not a test);
|
|
447
|
+
3. I'll pick an option and guess; in your NEXT turn, reveal the answer and teach the one core idea of this lesson.
|
|
448
|
+
Iron rules: no lecture to start, no generate_quiz scored questions, no scoring. Hooking me is the only goal.`,"starter.go-deeper.label":"Go deeper","starter.go-deeper.hint":"Unpack the concept one level down","starter.go-deeper.message":"Go deeper on “{title}” — expand the structure, the details, and the easy-to-miss edge cases of the core point we just uncovered.","starter.give-example.label":"Give an example","starter.give-example.hint":"Make it concrete with a real example","starter.give-example.message":"Give me a concrete example or use case for “{title}” so I can understand it more tangibly.","starter.quiz-me.label":"Quiz me","starter.quiz-me.hint":"Retrieve and apply (correct answers raise mastery)","starter.quiz-me.message":"Quiz me with one applied question about “{title}” to check whether I really get it — judge my answer when I respond.","starter.confused.label":"I'm lost","starter.confused.hint":"Tell the AI where you're stuck (it takes notes)","starter.confused.message":"I'm fuzzy on part of “{title}” — help me untangle it, and start by asking which part isn't clear.","map.world.study":"Learn","map.world.practice":"Practice","pane.switcher":"Switch view","pane.map":"Course","pane.chat":"Tutor","pane.notes":"Blackboard","map.streaming.notice":"AI is responding. Switch nodes after it finishes.","map.generating":"Generating course path…","map.empty.cta.title":"Start your first course","map.empty.cta.desc":"Import a GitHub learning repo to auto-generate a skill path","map.empty.cta.btn":"Click to import →","map.empty.practice":"No practice content for this course","node.locked.chapterHint":"(unlocks after completing all lessons in this chapter)","node.due.hint":"(due for review)","import.empty":"No courses yet. Import your first one below.","import.cta":"Import New Course","import.tab.url":"URL","import.tab.md":"MD","import.tab.folder":"Folder","import.url.placeholder":"GitHub repo / web article / arXiv paper link","import.url.desc":"Paste any link — GitHub repo / arXiv paper / web article / Bilibili·YouTube video (transcribed into a course; multi-part Bilibili videos import the whole season without ?p=; more sites need yt-dlp installed).","import.btn.url":"Import","import.btn.url.busy":"Importing…","import.placeholder.name":"Course name (optional)","import.placeholder.md":"Paste any long text or Markdown… (auto-split when there are no headings)","import.btn.md":"Import as Course","import.btn.md.busy":"Generating…","import.folder.desc":"Recursively scans .txt/.md/.html/.pdf. For downloaded course material packs.","import.btn.folder":"Select Folder","import.tab.epub":"eBook","import.epub.desc":"EPUB books become one lesson per chapter (chapter order from the book's spine & TOC).","import.btn.epub":"Pick an EPUB file","import.tab.audio":"Audio","import.audio.desc":"Audio (wav/mp3/m4a/flac) or local video (mp4/m4v/mov) transcribed locally into a course; multi-select = multiple episodes. Whisper model (~1 GB) downloads automatically on first use.","import.btn.audio":"Pick audio files","import.tab.pack":"Pack","import.btn.pack":"Pick a course pack file","import.pack.desc":"A course pack is a shared import-plan snapshot — zero AI calls, classification and structure design are instant. Reused as-is when the GitHub repo matches; if the repo moved on, lessons pointing at removed files are dropped automatically.","import.export":"Export","import.folder.pathPlaceholder":"Server-side folder path (e.g. /storage/emulated/0/Download/my-course)","import.folder.pathRequired":"Enter the server-side folder path first","import.pack.export":"Export course pack (share for zero-AI import)","import.pack.exported":"Course pack exported: {path}","import.error.resume":"Retry from checkpoint (skips finished AI steps)","import.success.reused":"reused saved plan, zero AI calls","import.btn.folder.busy":"Processing…","import.delete":"Delete","import.delete.confirm":"All progress and exercises will be erased. This cannot be undone.","import.delete.current":"Delete current course","course.empty.title":"Pick a course to start learning","course.empty.desc":"Choose an imported course from the Import panel on the left, or import a new one.","import.success.md":"Generated","import.success.folder":"Imported","import.error.network":`
|
|
449
|
+
|
|
450
|
+
For restricted networks or private repos, use the Markdown method.`,"import.progress.elapsed":"{s}s elapsed","import.progress.title":"Importing course…","import.progress.starting":"Starting…","import.progress.note":"Import runs in the background — keep browsing other courses","import.progress.cancel":"Cancel import","import.cancelled":"Import cancelled","toast.threadCreateFailed":"Couldn't create — try again","toast.threadCreated":"New chat","toast.threadRenamed":"Renamed","toast.threadArchived":"Archived","toast.threadDeleted":"Deleted","toast.threadDefault":"New thread","toast.restored":"Restored","toast.noteSaved":"Added to notes","toast.noteDeleted":"Note deleted","toast.artifactSaved":"Saved to notebook","artifact.type.concept_map":"Concept Map","artifact.type.quiz":"Quiz","artifact.type.compare_table":"Comparison Table","artifact.type.diagram":"Diagram","artifact.type.code_walkthrough":"Code Walkthrough","artifact.type.unknown":"Artifact","command.placeholder":"Type a command or question… (↑↓ to select, Enter to confirm)","command.empty.node":"No matching commands","command.empty.nonode":"Select a node on the left first","command.footer.hint":"The AI tutor generates content based on your command","command.footer.keys":"↵ confirm · esc to close","command.group.node":"Current Node","command.group.mode":"Study Mode","command.group.nav":"Navigation","command.explain_simple":"Explain this section in plain words","command.quiz_3":"Give me 3 practice questions","command.concept_map":"Draw a concept map","command.compare_prev":"Compare with the previous section","command.socratic":"Switch to Socratic mode (guided questions)","command.exam_mode":"Switch to Exam prep mode","review.title":"Review","review.nudge":"📅 {n} review(s) due today — tap the Review entry in the map to consolidate","review.loading":"Checking what to review…","review.empty.title":"No reviews yet","review.empty.desc":"Complete some exercises and spaced-repetition reminders will appear here","review.due.count":"due","review.start":"Start Review","review.shuffle":"Shuffle (interleaved)","review.interleave":"Interleaved Review","review.reviewLesson":"Review","review.selectSection":"Select a section","review.dueIn":"due","review.noDueInSection":"No reviews in this section","review.srsHint":"Review Reminders","review.myProgress":"My Progress","review.overdueQuickHint":"Overdue items — click to review","review.quadrant.overdue":"Overdue","review.quadrant.short":"Short-term","review.quadrant.long":"Long-term","review.quadrant.inactive":"Inactive","review.quadrant.more":"more","review.tip":"Review uses the SM-2 spaced repetition algorithm. Overdue items first; long-term memory items have longer intervals. Capped at {n} items per session to avoid backlog overwhelm.","review.selfrated":"✓ Recorded. Mastery updated.","review.selfrate.title":"Done reviewing? Rate yourself","review.selfrate.again":"Forgot","review.selfrate.again.hint":"Review tomorrow","review.selfrate.remembered":"Recalled","review.selfrate.remembered.hint":"In a few days","review.selfrate.mastered":"Easy","review.selfrate.mastered.hint":"Much later","lang.original":"Original","error.checkReadyFailed":"Could not check readiness","notebook.tab.explain":"Explain","notebook.tab.notes":"Notes","notebook.tab.board":"Blackboard","notebook.board.empty":"When the tutor produces a concept map, diagram, comparison table, or code walkthrough in chat, the latest one is rendered here in full size.","notebook.zone.understand":"Understand","notebook.zone.note":"Notes","notebook.zone.practice":"Practice","notebook.empty.explain.title":"Pick a lesson to start","notebook.empty.explain.desc":"Select a lesson in the map on the left; its explanation shows here.","notebook.empty.notes.title":"No notes yet","notebook.empty.notes.desc":"Highlight text in the explanation, or have the AI generate a concept map / comparison table — it shows up here.","settings.group.ai":"Main Model","settings.group.speech":"Speech Models","settings.group.vision":"Vision Model","settings.group.appearance":"Appearance & Language","settings.row.provider":"Provider","settings.row.theme":"Theme","settings.row.interface_lang":"Interface language","settings.row.import_lang":"Import preference","settings.custom.form_title":"Add custom provider","settings.footer.hint":"Main model changes need Save; everything else is instant.","settings.footer.save":"Save AI config","header.energy":"Today's energy","header.level.title":"Level (cumulative XP growth line — doesn't reset with daily energy)","settings.title":"Settings","view.tree":"Skill Tree","view.dashboard":"Dashboard","view.import":"Import Course","mode.chat":"💬 Chat","mode.exercise":"📝 Practice","mode.settings":"⚙️ Settings","chat.starter.hint":"💡 Pick one to start, or type your question","chat.no_key.title":"No AI model configured","chat.no_key.desc":"Configure a model to start AI tutoring and practice","chat.no_key.btn":"Configure Model","chat.input.placeholder":"Ask your AI tutor… (Enter to send)","chat.input.no_node":"Select a lesson on the left…","chat.send":"Send","chat.stop":"Stop","chat.clear":"Clear chat history","chat.selection.quote":"Ask about this","chat.soul.label":"Style:","chat.no_key.short":"AI model not configured","chat.no_key.cta":"Configure →","chat.attach.add":"Add image or file (paste / drag also works)","chat.attach.remove":"Remove {name}","chat.attach.tooMany":"Up to {n} attachments per message","chat.attach.tooLargeImage":"Image over 5MB: {name}","chat.attach.tooLargeText":"Text file over 256KB: {name}","chat.attach.unsupported":"Unsupported type: {name} (images and common text / code files)","chat.attach.visionUnsupported":"Current model can't see images — pick one with the eye icon in the model switcher, or set a vision model override in Settings → AI vision","chat.attach.bridgeChip":"Main model is text-only: images will be transcribed to text by {model} first","chat.attach.preview":"View {name}","chat.attach.textChip":"Text attachment, content sent with the message","chat.attach.imageOnlyText":"Please look at this image.","context.label":"Context","context.aria":"{p} of context used","context.approx":"~","context.system":"System prompt","context.node":"Lesson","context.learner":"Learner state","context.history":"History","context.draft":"Draft","context.unknownWindow":"model window unknown","model.picker.label":"Model","model.picker.manage":"Manage models & keys…","model.picker.vision":"Vision capable","model.picker.noneConfigured":"No provider key configured yet","effort.label":"Thinking effort","effort.auto.label":"Auto","effort.auto.desc":"Model default, no override","effort.fast.label":"Fast","effort.fast.desc":"Thinking off when possible — quicker, fewer tokens","effort.deep.label":"Deep","effort.deep.desc":"Thinking on when possible — extra steps for hard problems","effort.unsupported":"Current provider doesn't support effort switching","soul.direct":"Direct","soul.guide":"Guide","soul.practice":"Practice","soul.direct.desc":"Direct · for beginners or low energy. Explains clearly then checks, gives full worked examples — never makes you guess","soul.guide.desc":"Guide · when you have some footing and want to reason it out. No direct answers — guiding questions help you derive it","soul.practice.desc":"Practice · for hands-on learners. Each concept lands on a messy real-world problem; learn by doing and connect the dots","settings.provider":"AI Provider","settings.model":"Model","settings.apikey":"API Key","settings.test":"Test Connection","settings.testing":"Testing…","settings.save":"Save Settings","settings.saved":"✅ Saved","settings.daily_goal":"Daily Goal (XP)","settings.custom.add":"+ Add Custom Provider","settings.language":"Language","settings.add_custom":"Custom","settings.custom.label_ph":"Name","settings.custom.baseurl_ph":"Base URL (e.g. https://api.example.com/v1)","settings.custom.model_ph":"Model ID","settings.custom.new":"New custom","settings.custom.form_title_vision":"Configure vision model (custom provider)","settings.custom.model_ph_vision":"e.g. glm-4.6v / gpt-4o","settings.custom.form_title_tts":"Configure TTS provider (OpenAI-compatible /audio/speech)","settings.custom.model_ph_tts":"e.g. tts-1 / FunAudioLLM/CosyVoice2-0.5B","settings.custom.form_title_asr":"Configure dictation provider (OpenAI-compatible /audio/transcriptions)","settings.custom.model_ph_asr":"e.g. whisper-large-v3-turbo","settings.custom.apikey_ph":"API Key (optional)","settings.custom.save":"Save","settings.custom.windowLabel":"Context window (tokens)","settings.custom.windowPh":"e.g. 128000 or 128k (empty = unknown)","settings.custom.windowHint":"Max context of the current model, found in its official docs. The composer context meter only shows a percentage when this is set.","settings.custom.vision":"Supports vision (multimodal)","settings.custom.visionHint":"When checked, images are sent directly to the main model. Unchecked uses the vision bridge (configure a vision model in AI Vision section) or skips images.","settings.delete_custom":"Delete this custom provider","settings.delete_custom_confirm":'Delete custom provider "{name}"? This cannot be undone.',"settings.key.overwrite_ph":"Overwrite…","settings.key.paste_ph":"Paste key","settings.key.get":"Get key →","settings.refresh":"Refresh","settings.discovering":"Refreshing…","settings.discover_failed":"Refresh failed (network may be restricted)","settings.daily_goal.hint":"XP / day (+10 XP per correct answer)","settings.theme.auto":"System","settings.theme.light":"Light","settings.theme.dark":"Dark","settings.theme.following":"Following system: {mode}","settings.lang_pref.desc":"When importing a course, auto-pick the translation matching this preference. If the repo's source language already matches, the original is used; if no translation exists, the original is used as well.","settings.img_download":"Image download","settings.img_download.desc":"Auto-download images referenced in markdown/notebooks during import (on by default)","settings.multimodal.toggle":"AI vision (in chat)","settings.multimodal.toggle.desc":"When on, the AI can see and explain this lesson's images during chat — used for diagrams/charts/architecture (needs a vision model).","settings.group.memory":"Learner memory","settings.memory.toggle":"Let the AI remember me","settings.memory.toggle.desc":"When on, the AI remembers how you learn across sessions (preferences / stuck points / recurring confusions) and adapts over time. Auto-summarized when you earn a crown (clear a node); also manually triggerable. All memory stays local.","settings.group.companion":"Learning companion","settings.companion.toggle":"Learning companion","settings.companion.toggle.desc":"Your companion lives in the course map, notebook and chat: celebrates wins, lip-syncs read-alouds, and taps along with every keystroke. Five forms to switch between. Fully local.","settings.companion.sfx":"Pet sounds","settings.companion.sfx.desc":"Short chirps when poked/hit/landing (synthesized, low volume)","settings.companion.pet":"Desktop pet mode","settings.companion.pet.desc":"Keep the companion on your desktop outside the app: transparent, always on top, wandering slowly — still poke-able. The in-app buddy takes a rest so you never see double.","settings.companion.form":"Form","companion.name":"Ember","companion.form.ember.name":"Ember","companion.form.ember.desc":"Blazing guardian — the passionate original; core charges with today's XP","companion.form.frost.name":"Frost","companion.form.frost.desc":"Crystal watcher — calm and steady; the hex core lights petal by petal","companion.form.moss.name":"Moss","companion.form.moss.desc":"Nature spirit — gentle company; the seed sprouts as you progress","companion.form.astro.name":"Astro","companion.form.astro.desc":"Stargazer — night-sky visor; the core moon waxes with today's XP","companion.form.ink.name":"Ink","companion.form.ink.desc":"Inkstone scholar — quiet study vibes; the ink pool rises with your progress","companion.greet.1":"I'm here — keep going!","companion.greet.2":"Almost got this one!","companion.greet.3":"Want me to explain again?","companion.greet.4":"Breathe. One more try.","settings.multimodal.current_model":"Current main model: {model}","settings.multimodal.not_selected":"(none)","settings.multimodal.hint_custom":"Custom provider — vision capability unknown. If it can't see images, override a vision model below.","settings.multimodal.hint_preset":"If the current model lacks vision, configure a dedicated vision model below. Common: GLM-4V / GPT-4o / Claude 3.5 / Gemini.","settings.multimodal.override_title":"Vision model override (optional — leave blank to reuse main model)","settings.multimodal.override_bridge_hint":"When the main model is text-only, images uploaded in chat are transcribed to text by this model before reaching the main model (image bridge).","settings.multimodal.legacy_preset":"Legacy config (preset {label}) still active; stop the override or switch to custom.","settings.multimodal.replace_custom":"Replace","settings.multimodal.stop_override":"Stop override","settings.multimodal.vision_capable":"vision","settings.multimodal.test_override":"Test model","settings.saved_text":"Saved","settings.key.configured":"Configured","settings.custom.test_label":"(test)","settings.proto.openai":"OpenAI-compatible","chat.empty.overview":"Overview of this lesson","chat.empty.summary.title":"Lesson Summary","chat.empty.summary.none":"No summary yet — click Start to let the AI walk you through this lesson.","chat.empty.start":"Start Learning","chat.empty.greeting":"👋 Ready? Let's take this one step at a time.","chat.empty.keyless.title":"The lesson is on the right — give it a read","chat.empty.keyless.desc":"Configure an AI model to practice with me, do exercises, and track mastery.","chat.empty.keyless.btn":"Configure AI model","chat.empty.no_node.title":"Pick a node from the map on the left","chat.empty.no_node.desc":"Click a node to start learning. Green = available, Gold = mastered, Purple = chapter exam","chat.scroll.bottom":"Scroll to bottom","chat.speech.speak":"Read aloud","chat.speech.stop":"Stop reading","chat.speech.progress":"{n}/{total}","chat.speech.model_missing":"Speech model not downloaded yet. Get it in Settings → Speech.","chat.speech.engine_unavailable":"Speech engine not installed. Desktop has it built in; on Termux rerun the one-line install command to restore it (~12MB).","chat.speech.dictation":"Voice input","chat.speech.hold_to_talk":"Hold to talk","chat.speech.release_to_stop":"Release to finish","chat.speech.recording_hint":"Recording — release to finish","chat.speech.rerecord":"Discard & retry","chat.speech.retry":"Retry","chat.speech.back_to_keyboard":"Back to keyboard input","chat.speech.keyboard":"Keyboard","chat.speech.custom_provider_missing":"Custom speech provider missing or deleted. Reconfigure it in Settings → Speech Models.","chat.speech.no_speech":"No speech detected. Check your microphone and retry.","chat.speech.transcribing":"Transcribing…","chat.speech.asr_failed":"Transcription failed. Please retry.","chat.speech.groq_key_missing":"Groq key not configured. Set it in Settings → Model providers, or switch to the local engine.","chat.speech.azure_stt_key_missing":"Legacy Azure dictation key missing. Switch to a custom endpoint in Settings → Speech Models.","chat.speech.azure_stt_region_missing":"Legacy Azure dictation region missing. Switch to a custom endpoint in Settings → Speech Models.","chat.speech.asr_model_missing":"Dictation model not downloaded. Get Whisper in Settings → Speech Models (local offline), or use a custom endpoint.","chat.speech.asr_start_fail":"Microphone failed to start. Check system permissions.","chat.speech.asr_insecure_context":"Browsers only allow the microphone on secure contexts (https or 127.0.0.1). Open this page via the phone launcher, or enable serve TLS (--tls-cert/--tls-key) and access over https.","chat.speech.read_aloud_node":"Read this lesson","chat.speech.azure_key_missing":"Azure TTS key missing. Fill it in Settings → Speech.","chat.speech.azure_region_missing":"Azure TTS region missing. Fill it in Settings → Speech.","chat.speech.edge_failed":"Online synthesis failed and no local fallback model is ready. Retry later or switch to the local engine.","chat.speech.edge_disclosed":"Read-aloud sends text to Microsoft's online service (free Edge channel). For fully offline: Settings → Speech → Local.","settings.speech.tts_engine":"TTS engine","settings.speech.engine.edge":"Edge online","settings.speech.engine.azure":"Azure","settings.speech.engine.local":"Local offline","settings.speech.engine.custom":"Custom","settings.speech.engine.system":"System","settings.speech.engine.system_note":"Voices come from this device's browser/system speech engine; quality varies by device (vendor engines on Chinese Android phones are often more natural). Plays locally with no network; sentence highlighting still works while reading, companion mouth animation is unavailable.","settings.speech.engine.system_unavailable":"System speech is unavailable in this WebView","settings.speech.voice_auto":"Auto (prefer Chinese)","settings.speech.model.turbo_short":"Whisper Turbo (~1GB)","settings.speech.model.small_short":"Whisper Small (~360MB)","settings.speech.tts_title":"Read aloud","settings.speech.asr_title":"Dictation","settings.speech.custom_voice_ph":"e.g. alloy (empty = endpoint default)","settings.speech.legacy":"legacy, still active","settings.speech.key_saved":"key saved","settings.speech.confirm_del_custom":"Delete this provider? The tier becomes unusable.","settings.speech.downloading":"Downloading…","settings.speech.asr_engine.custom_note":"OpenAI-compatible transcription endpoint; for Groq use https://api.groq.com/openai/v1 + whisper-large-v3-turbo.","settings.speech.engine.edge_note":"Microsoft Edge read-aloud channel: free, no key, product-grade voices; text is synthesized online.","settings.speech.voice":"Voice","settings.speech.speed":"Speed","settings.speech.asr_engine":"Dictation engine","settings.speech.asr_engine.local":"Local offline","settings.speech.asr_engine.local_note":"Whisper offline transcription (native punctuation, strong Chinese); fully offline once the model is downloaded — Turbo ~1GB / Small ~360MB.","settings.speech.asr_auto_stop":"Auto-stop recording after silence","settings.speech.asr_ux_note":"Click the mic beside the input box to enter voice mode: hold to talk, then edit the recognized text before sending.","settings.speech.model.asr_turbo":"Dictation engine Whisper Turbo (~1GB, recommended on desktop)","settings.speech.model.asr_small":"Dictation engine Whisper Small (~360MB, lightweight)","settings.speech.license_mit":"MIT · local inference","settings.speech.model.tts":"Read-aloud engine (Kokoro, ~430MB)","settings.speech.state.absent":"Not downloaded","settings.speech.state.ready":"Ready","settings.speech.state.error":"Error","settings.speech.download":"Download","settings.speech.delete":"Delete","settings.speech.license":"Apache-2.0 · local inference","chat.friction.trigger":"I'm stuck","chat.friction.hint":"Pick what fits (optional one-liner). The AI will remember and adapt how it teaches this.","chat.friction.confused":"Confused","chat.friction.blocked":"Blocked","chat.friction.frustrated":"Frustrated","chat.friction.desc_placeholder":"Where exactly? (optional)","chat.friction.cancel":"Cancel","chat.friction.submit":"Log it","chat.friction.saved":"Logged — the AI will adapt how it teaches this lesson","chat.mastered.toast":"👑 You mastered this lesson!","chat.note.add":"Add note","chat.note.add.title":"Save this message to your notes","chat.reasoning.label":"Reasoning","chat.reasoning.chars":"{n} chars","chat.proposal.title":"AI Proposal","chat.proposal.fallback":"Proposal ({tool})","chat.proposal.apply":"Apply","chat.proposal.reject":"Reject","chat.proposal.mastered.title":"AI suggests you've mastered this lesson","chat.proposal.mastered.hint":"Accept to unlock the crown and schedule reviews.","chat.proposal.confirm":"Confirm mastery","chat.proposal.later":"Keep practicing","chat.proposal.applied":"Accepted · lesson mastered","chat.proposal.rejected":"Dismissed, keep learning","chat.copy":"Copy","chat.copied":"Copied","chat.tool.get_node_info":"Read node info","chat.tool.record_answer":"Record answer","chat.tool.mark_mastered":"Mark mastered","chat.tool.show_concept_map":"Generate concept map","chat.tool.generate_quiz":"Generate quiz","chat.tool.compare_table":"Generate comparison table","chat.tool.draw_diagram":"Draw diagram","chat.tool.show_code_walkthrough":"Code walkthrough","thread.empty.no_node":"No node selected","thread.empty.hint":"Type to start","thread.actions.label":"Actions","thread.new.label":"New thread","thread.menu.rename":"Rename","thread.menu.archive":"Archive","thread.delete.confirm":'Delete thread "{name}"? Messages will also be deleted.',"notebook.empty.select_node":"Pick a node from the map on the left — its explanation shows here.","notebook.empty.no_notes_message":'No notes for this lesson yet. Select explanation text to "Add note", or ask the AI to "draw a concept map", "generate 3 questions", or "make a comparison table".',"notebook.node_type.section":"Chapter","notebook.node_type.concept":"Concept","notebook.node_type.lesson":"Lesson","notebook.content.loading":"Loading this lesson…","notebook.content.load_failed":"Failed to load content. ","notebook.content.retry":"Retry","notebook.content.render_failed":"This content failed to render (possibly malformed translation).","notebook.content.truncated":"…(truncated)","notebook.content.retry_render":"Retry render","notebook.content.empty":'No explanation for this lesson yet. Ask the AI tutor: "Walk me through this lesson."',"notebook.images.heading":"Images ({n})","notebook.quote.template":"About this passage 「{text}」, I don't quite get it. Please explain:","notebook.quote.ask":"Ask","notebook.quote.add_note":"Add note","notebook.quote.save_note.title":"Save the selected text to your notes (with source jump)","notebook.quote.hint":"Select any text in the explanation to add a note; AI-generated concept maps, comparison tables, and quiz cards land in the Notes tab automatically.","notebook.source.label":"Source","notebook.source.jump_content":"Jump to explanation","notebook.source.jump_chat":"Jump to chat message","notebook.zone.understand.subtitle":"Knowledge structure the AI lays out for you","notebook.zone.understand.empty_hint":'Ask the AI to "draw a concept map" or "make a comparison table" to structure this lesson',"notebook.zone.note.subtitle":"Your highlights — click to jump back to source","notebook.zone.note.empty_hint":'Select text in the explanation or chat, then "Add note" to save here',"notebook.zone.practice.subtitle_empty":"Test your grasp; redoable","notebook.zone.practice.subtitle_stats":"{n} questions · last correct {c} · wrong {w}","notebook.zone.practice.empty_hint":'Ask the AI "give me 3 questions" — they land here',"notebook.note.comment.ph_new":"Write a note about this highlight…","notebook.note.comment.ph_edit":"Edit note… (clear + save to delete)","notebook.action.save":"Save","notebook.action.cancel":"Cancel","notebook.note.edit_comment":"Edit note","notebook.note.add_comment":"Add note","notebook.note.pinned":"Pinned","notebook.note.pin":"Pin","notebook.note.unpin":"Unpin","notebook.note.delete":"Delete","notebook.quiz.last_correct":"Last correct","notebook.quiz.last_wrong":"Last wrong","notebook.artifact.broken":"Broken artifact data","notebook.asset.loading":"Loading…","exam.loading":"Generating exam questions…","exam.errorTitle":"Exam failed to load","exam.errorEmpty":"Failed to generate questions. Please try again later.","exam.reload":"Reload","exam.question.label":"Question {n}","exam.next":"Next","exam.submit":"Submit Exam","exam.accuracy":"Accuracy {n}%","exam.stars.congrats":"Congratulations! {n} stars earned!","exam.stars.thisAndBest":"This run: {n} stars · Best: {m} stars","exam.stars.failed":"Below 60%. Keep practicing!","exam.review.title":"Question Review","exam.review.questionFallback":"(Question {n})","exam.review.yourAnswer":"Your answer:","exam.review.correctAnswer":"Correct:","exam.review.unanswered":"(no answer)","exam.retry":"Retake exam (questions cached)","exam.generating.title":"Generating chapter exam…","exam.generating.stage":"AI is writing questions knowledge point by knowledge point","exam.generating.kcProgress":"{done} / {total} knowledge points covered","exam.generating.preparing":"Preparing…","exam.generating.canLeave":"You can leave this page — generation continues in the background and you'll be notified.","exam.failed.retry":"Regenerate","exam.ready.title":"Exam ready","exam.ready.meta":"{q} questions · {kc} knowledge points · ~{min} min","exam.ready.toast":'Exam questions for "{title}" are ready',"exam.start":"Start exam","exam.retryExam":"Retake exam","exam.regenerate":"New questions","exam.regenerate.confirmMsg":"Regenerating discards the current questions and has the AI write a fresh set for this chapter (past scores are kept).","exam.submitting":"Grading…","exam.q.progress":"Question {i} / {n}","exam.q.next":"Next","exam.q.submit":"Submit exam","exam.terminated.banner":"This attempt was terminated by leaving mid-exam. Unanswered questions were counted as wrong.","exam.result.score":"{correct} / {total} correct","exam.result.accuracy":"Accuracy {pct}%","exam.result.best":"Best: {stars} stars","exam.result.attempts":"{n} attempts","exam.result.kcBreakdown":"By knowledge point","exam.result.weakKc":"Weak · review suggested","exam.result.correctLabel":"Correct","exam.result.unanswered":"No answer","exam.result.yourAnswer":"Your answer:","exam.result.correctAnswer":"Correct answer:","exam.result.review":"Question review","exam.leave.title":"Leaving will end the exam","exam.leave.message":"Unanswered questions will be counted as wrong and this attempt will be recorded. Leave anyway?","exam.leave.confirm":"End and leave","exam.leave.cancel":"Keep going","error.renderFailed":"This content failed to render (possibly malformed).","error.retry":"Retry","artifact.unknownHeader":"Artifact (unknown type)","artifact.zoomOut":"Zoom out","artifact.zoomReset":"Reset zoom","artifact.zoomIn":"Zoom in","artifact.canvas.fit":"Fit","artifact.viewer.open":"Open large view","artifact.viewer.hint":"Pinch to zoom · drag to pan · Ctrl+scroll","artifact.conceptmap.stats":"{nodes} concepts · {edges} relations · Ctrl+scroll to zoom · drag to pan","artifact.codewalk.sectionLabel":"Step-by-step notes (click to jump to code)","artifact.codewalk.lineSingle":"Line {n}","artifact.codewalk.lineRange":"Lines {a}-{b}","artifact.diagram.flowchart":"Flowchart","artifact.diagram.sequence":"Sequence","artifact.diagram.state":"State","artifact.mermaid.openLive":"Open in mermaid.live (editable)","artifact.mermaid.rendering":"Rendering diagram…","artifact.mermaid.renderFailed":"Render failed. Showing source (copy to mermaid.live to view).","artifact.mermaid.errorPrefix":"Error: {msg}","artifact.mermaid.hint":"Ctrl+scroll to zoom · drag to pan","quiz.questionProgress":"Q {cur}/{total}","quiz.answeredCorrect":"{n} correct","quiz.correct":"Correct","quiz.wrong":"Wrong","quiz.finish":"Finish","quiz.scoreSummary":"{correct}/{total} correct","quiz.hook.label":"📊 Quiz done: {{correct}}/{{total}}","quiz.hook.finish":"Finish quiz","quiz.hook.sent":"Results sent to your tutor, awaiting analysis…","quiz.hook.message":`I just finished the quiz{{title}}, scoring {{correct}}/{{total}}. Per-question breakdown below:
|
|
451
|
+
Based on my performance, decide what comes next: explain why I got questions wrong and the right reasoning, or judge whether I can move on. Do not re-issue the same set of questions, and do not just say well done.`,"quiz.hook.lineOk":"✅ Q{{n}}: {{prompt}} — correct","quiz.hook.lineWrong":"❌ Q{{n}}: {{prompt}} — I chose {{chosen}}, correct answer is {{answer}}","quiz.allCorrectHint":"All correct! Mastery update proposed.","quiz.tryAgainHint":"Practice another set to consolidate.","quiz.action.nextPrompt":"What's next:","quiz.action.explainWrong":"Explain what I got wrong","quiz.action.retry":"Another set","quiz.action.goDeeper":"Go deeper","quiz.action.markMastered":"Confirm I've mastered it","quiz.action.nextTopic":"Next topic","guess.header":"Take a guess","guess.pickedPrefix":"I guess: ","guess.waitReveal":"Guessed — waiting for the reveal…","import.deleted":"Deleted: {title}","exercise.title":"📝 Practice","exercise.generate":"Generate a question","exercise.submit":"Submit Answer","exercise.next":"Next →","exercise.correct":"✅ Correct!","exercise.wrong":"❌ Wrong","exercise.types.mcq":"Multiple Choice","exercise.types.fill_blank":"Fill in the Blank","exercise.types.true_false":"True or False","dashboard.title":"Learning Dashboard","dashboard.stat.streak":"Streak","dashboard.stat.due":"Due Today","dashboard.stat.mastery":"Overall Mastery","dashboard.review":"Review","dashboard.cleared":"Cleared","dashboard.export.md":"📄 Export Report","dashboard.export.json":"Export JSON","dashboard.section_mastery":"Mastery by Section","dashboard.mini.sections":"Mastery by section","dashboard.mini.struggle":"Your struggle spots (tap to relearn)","import.title":"Import Course","import.url":"GitHub URL","import.markdown":"Paste Markdown","import.btn":"Import","import.md_btn":"Generate Course","streak.days":"days","streak.title":"{n}-day streak · longest {m} days","streak.freeze.title":"{n} freeze left: saves your streak on a missed day"}};function Mr(){return Hi}function J1(e){e!==Hi&&(Hi=e,typeof localStorage<"u"&&localStorage.setItem(rm,e),Qo.forEach(t=>t()))}function ic(e,t=Hi,n){var i,s;let r=((i=Tu[t])==null?void 0:i[e])??((s=Tu["zh-CN"])==null?void 0:s[e])??e;if(n)for(const[a,o]of Object.entries(n))r=r.replaceAll(`{${a}}`,String(o));return r}function _e(){const e=v.useSyncExternalStore(sm,Mr,Mr);return v.useCallback((t,n)=>ic(t,e,n),[e])}function im(){return v.useSyncExternalStore(sm,Mr,Mr)}const eb=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].map(e=>`${e}:not([hidden])`).join(",");function Su(e){return Array.from(e.querySelectorAll(eb)).filter(t=>t.offsetParent!==null||t===document.activeElement)}function jr(e,t){v.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement,s=Su(n)[0]??n,a=window.setTimeout(()=>s.focus(),0),o=l=>{if(l.key!=="Tab")return;const c=Su(n);if(c.length===0){l.preventDefault(),n.focus();return}const h=c[0],f=c[c.length-1];l.shiftKey?(document.activeElement===h||!n.contains(document.activeElement))&&(l.preventDefault(),f.focus()):document.activeElement===f&&(l.preventDefault(),h.focus())};return n.addEventListener("keydown",o),()=>{if(window.clearTimeout(a),n.removeEventListener("keydown",o),r&&document.body.contains(r))try{r.focus()}catch{}}},[e,t])}const Js=220;function oa({anchorRect:e,message:t,onConfirm:n,onCancel:r,confirmLabel:i,cancelLabel:s,danger:a=!1,testid:o="confirm-card"}){const l=_e(),c=v.useRef(null);jr(c,!0);const h=i??l("action.confirm"),f=s??l("action.cancel");v.useEffect(()=>{const b=T=>{c.current&&!c.current.contains(T.target)&&r()},k=T=>{T.key==="Escape"&&r(),T.key==="Enter"&&(T.preventDefault(),n())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",k)}},[r,n]);const m=window.innerWidth,d=window.innerHeight,p=e.right-Js,g=Math.max(8,Math.min(p,m-Js-8)),x=e.bottom+4+Js>d?Math.max(8,e.top-4-Js):e.bottom+4;return sc.createPortal(u.jsxs("div",{ref:c,className:`confirm-card fixed z-[60] w-[220px] bg-surface-0 rounded-xl shadow-elevated border p-3 ${a?"border-warning/50":"border-[var(--border)]"}`,style:{left:g,top:x},role:"alertdialog","aria-modal":"false","data-testid":o,onClick:b=>b.stopPropagation(),children:[u.jsx("p",{className:"text-body text-ink-muted leading-relaxed mb-3",children:t}),u.jsxs("div",{className:"flex gap-2 justify-end",children:[u.jsx("button",{onClick:r,"data-testid":`${o}-cancel`,className:"px-2.5 py-1 rounded-md text-label font-bold text-ink-muted hover:text-ink-strong hover:bg-surface-3 transition-colors",children:f}),u.jsx("button",{onClick:n,"data-testid":`${o}-confirm`,className:"btn-3d-brand px-2.5 py-1 text-label",style:a?{background:"var(--warning)",boxShadow:"0 3px 0 0 var(--warning-dark)"}:void 0,children:h})]})]}),document.body)}function tb(e,t,n){return[...e].sort((r,i)=>r.orderIdx-i.orderIdx).map(r=>{const i=t.filter(o=>o.parentId===r.id).sort((o,l)=>o.orderIdx-l.orderIdx),s=i.filter(o=>o.type==="lesson"),a=s.length>0&&s.every(o=>{var l;return(((l=n[o.id])==null?void 0:l.mastery)??0)>=nm});return{section:r,lessons:i,chapterLessonsMastered:a}})}function Zo(e,t,n){var r;return e.type==="exam"?!n:(((r=t[e.id])==null?void 0:r.status)??"locked")==="locked"}function nb(e,t){const n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return e;const r=i=>{const s=i.toLowerCase();return n.every(a=>s.includes(a))};return e.map(i=>{if(r(i.section.title))return i;const s=i.lessons.filter(a=>r(a.title));return s.length>0?{...i,lessons:s}:null}).filter(i=>i!==null)}function rb(e,t){const n=t.trim().split(/\s+/).filter(Boolean)[0];if(!n)return null;const r=e.toLowerCase().indexOf(n.toLowerCase());return r>=0?[r,r+n.length]:null}function sb(e){const t=_e(),[n,r]=v.useState(""),[i,s]=v.useState([]),a=v.useRef(null);v.useEffect(()=>{var g;(g=a.current)==null||g.focus()},[]);const o=v.useMemo(()=>tb(e.sections,e.tree,e.progressMap),[e.sections,e.tree,e.progressMap]),l=v.useMemo(()=>nb(o,n),[o,n]),c=v.useMemo(()=>new Set(e.tree.map(g=>g.id)),[e.tree]),h=v.useMemo(()=>new Set(l.flatMap(g=>g.lessons.map(x=>x.id))),[l]),f=v.useMemo(()=>new Map(e.tree.map(g=>[g.id,g])),[e.tree]),m=v.useMemo(()=>new Map(o.map(g=>[g.section.id,g.chapterLessonsMastered])),[o]);v.useEffect(()=>{const g=n.trim();if(g.length<2){s([]);return}const x=setTimeout(()=>{X.searchContent(g).then(b=>{s(b.filter(k=>c.has(k.nodeId)&&!h.has(k.nodeId)).slice(0,8))}).catch(()=>s([]))},250);return()=>clearTimeout(x)},[n,c,h]);const d=v.useMemo(()=>{for(const g of l){const x=g.lessons.find(b=>!Zo(b,e.progressMap,g.chapterLessonsMastered));if(x)return x}return null},[l,e.progressMap]),p=l.length>0||i.length>0;return u.jsxs("div",{"data-testid":"course-search-panel",className:"absolute inset-0 z-50 flex flex-col",style:{background:"rgb(var(--surface-rail-rgb) / 0.96)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},onKeyDown:g=>{g.key==="Escape"&&e.onClose()},children:[u.jsxs("div",{className:"flex items-center gap-1.5 m-2 p-1.5 rounded-lg bg-black/40 ring-1 ring-white/15 focus-within:ring-brand/60 transition-colors",children:[u.jsx(tc,{className:"w-4 h-4 text-white/50 shrink-0"}),u.jsx("input",{ref:a,value:n,onChange:g=>r(g.target.value),onKeyDown:g=>{g.key==="Enter"&&d&&e.onJump(d)},placeholder:t("map.search.placeholder"),"data-testid":"course-search-input",className:"flex-1 bg-transparent text-body text-white placeholder:text-white/35 outline-none min-w-0"}),n&&u.jsx("button",{onClick:()=>{var g;r(""),(g=a.current)==null||g.focus()},"aria-label":t("map.search.clear"),className:"shrink-0 flex items-center justify-center w-5 h-5 rounded-md text-white/50 hover:text-white hover:bg-white/10 transition-colors",children:u.jsx(Kt,{className:"w-3.5 h-3.5"})}),u.jsx("button",{onClick:e.onClose,"data-testid":"course-search-close","aria-label":t("map.search.close"),className:"shrink-0 flex items-center justify-center w-5 h-5 rounded-md text-white/50 hover:text-white hover:bg-white/10 transition-colors",children:u.jsx(Kt,{className:"w-3.5 h-3.5"})})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto px-2 pb-3 space-y-2",children:[!p&&u.jsx("div",{"data-testid":"course-search-empty",className:"text-center text-label text-white/60 mt-8 px-4",children:t("map.search.noResults")}),l.map((g,x)=>u.jsx(ib,{row:g,sectionIndex:x,query:n,progressMap:e.progressMap,selectedNodeId:e.selectedNodeId,onPick:e.onJump},g.section.id)),i.length>0&&u.jsxs("div",{"data-testid":"course-search-content-group",className:"pt-1",children:[u.jsx("div",{className:"px-1.5 py-1 text-caption font-bold text-white/50 uppercase tracking-wider",children:t("map.search.contentGroup")}),i.map(g=>{const x=f.get(g.nodeId);if(!x)return null;const b=Zo(x,e.progressMap,m.get(x.parentId??"")??!1);return u.jsxs("button",{disabled:b,"data-testid":`search-content-row-${x.id.slice(0,8)}`,onClick:()=>!b&&e.onJump(x),className:`w-full text-left px-2 py-1.5 rounded-lg transition-colors ${b?"opacity-45 cursor-not-allowed":"hover:bg-white/10 cursor-pointer"} ${x.id===e.selectedNodeId?"bg-accent/15 ring-1 ring-accent/40":""}`,children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(fn,{className:"w-3.5 h-3.5 text-white/70 shrink-0"}),u.jsx("span",{className:"flex-1 text-label font-bold text-white truncate",children:u.jsx(Jo,{text:g.title,query:n})})]}),u.jsx("div",{className:"text-caption text-white/55 line-clamp-2 leading-snug pl-5.5",children:g.snippet})]},g.nodeId)})]})]})]})}function ib({row:e,sectionIndex:t,query:n,progressMap:r,selectedNodeId:i,onPick:s}){const a=_e(),o=(e.section.world??"study")==="practice";return u.jsxs("div",{"data-testid":`search-section-${e.section.id.slice(0,8)}`,children:[u.jsxs("div",{className:"flex items-center gap-2 px-1.5 py-1",children:[u.jsx("span",{className:"w-5 h-5 rounded-full bg-gold text-neutral-900 text-caption font-extrabold flex items-center justify-center shrink-0 ring-2 ring-gold/40",children:t+1}),u.jsx("span",{className:"text-label font-bold text-white truncate flex-1",children:u.jsx(Jo,{text:e.section.title,query:n})}),o&&u.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-accent/20 text-accent text-caption font-bold",children:a("map.world.practice")})]}),e.lessons.map(l=>{var m;const c=Zo(l,r,e.chapterLessonsMastered),h=((m=r[l.id])==null?void 0:m.status)??"locked",f=l.type==="exam";return u.jsxs("button",{disabled:c,"data-testid":`search-row-${l.id.slice(0,8)}`,onClick:()=>!c&&s(l),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left transition-colors ${c?"opacity-45 cursor-not-allowed":"hover:bg-white/10 cursor-pointer"} ${l.id===i?"bg-accent/15 ring-1 ring-accent/40":""}`,children:[c?u.jsx(A1,{className:"w-3.5 h-3.5 text-white/50 shrink-0"}):f?u.jsx(Nr,{className:"w-3.5 h-3.5 text-accent shrink-0"}):h==="mastered"?u.jsx(Yf,{className:"w-3.5 h-3.5 text-gold shrink-0"}):u.jsx(fn,{className:"w-3.5 h-3.5 text-white/70 shrink-0"}),u.jsx("span",{className:"flex-1 text-label text-white truncate",children:u.jsx(Jo,{text:l.title,query:n})})]},l.id)})]})}function Jo({text:e,query:t}){const n=rb(e,t);return n?u.jsxs(u.Fragment,{children:[e.slice(0,n[0]),u.jsx("span",{className:"text-brand font-extrabold",children:e.slice(n[0],n[1])}),e.slice(n[1])]}):u.jsx(u.Fragment,{children:e})}const ab=268,ac=28,ob=20,am=ac*2+ob,lb=am+8,cb=104,ub=18,Oa=ac+6,db=26,hb=22;function el(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function fb(e,t=ab,n=""){const r=[],i=t/2,s=t/2-ub-ac;for(let l=0;l<e;l++){const c=Oa+l*cb,f=el(`${n}:${l}`)/4294967295*2-1,m=i+f*s,p=el(`${n}:${l}:y`)/4294967295*2-1,g=c+p*db;r.push({x:m,y:g,index:l})}if(r.length>0){r[0].y<Oa&&(r[0].y=Oa);for(let l=1;l<r.length;l++){const c=r[l-1].y+lb;r[l].y<c&&(r[l].y=c)}}const a=[];for(let l=0;l<r.length-1;l++)a.push({from:r[l],to:r[l+1],index:l});const o=r.length===0?40:r[r.length-1].y+am/2+10;return{nodes:r,segments:a,height:o}}function mb(e){const{from:t,to:n}=e,r=(t.y+n.y)/2+hb;return`M ${t.x} ${t.y} C ${t.x} ${r}, ${n.x} ${r}, ${n.x} ${n.y}`}var ki={exports:{}};/*!
|
|
452
|
+
* matter-js 0.19.0 by @liabru
|
|
453
|
+
* http://brm.io/matter-js/
|
|
454
|
+
* License MIT
|
|
455
|
+
*
|
|
456
|
+
* The MIT License (MIT)
|
|
457
|
+
*
|
|
458
|
+
* Copyright (c) Liam Brummitt and contributors.
|
|
459
|
+
*
|
|
460
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
461
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
462
|
+
* in the Software without restriction, including without limitation the rights
|
|
463
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
464
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
465
|
+
* furnished to do so, subject to the following conditions:
|
|
466
|
+
*
|
|
467
|
+
* The above copyright notice and this permission notice shall be included in
|
|
468
|
+
* all copies or substantial portions of the Software.
|
|
469
|
+
*
|
|
470
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
471
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
472
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
473
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
474
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
475
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
476
|
+
* THE SOFTWARE.
|
|
477
|
+
*/var pb=ki.exports,Cu;function gb(){return Cu||(Cu=1,(function(e,t){(function(r,i){e.exports=i()})(pb,function(){return(function(n){var r={};function i(s){if(r[s])return r[s].exports;var a=r[s]={i:s,l:!1,exports:{}};return n[s].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=n,i.c=r,i.d=function(s,a,o){i.o(s,a)||Object.defineProperty(s,a,{enumerable:!0,get:o})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,a){if(a&1&&(s=i(s)),a&8||a&4&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),a&2&&typeof s!="string")for(var l in s)i.d(o,l,(function(c){return s[c]}).bind(null,l));return o},i.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(a,"a",a),a},i.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},i.p="",i(i.s=20)})([(function(n,r){var i={};n.exports=i,(function(){i._baseDelta=1e3/60,i._nextId=0,i._seed=0,i._nowStartTime=+new Date,i._warnedOnce={},i._decomp=null,i.extend=function(a,o){var l,c;typeof o=="boolean"?(l=2,c=o):(l=1,c=!0);for(var h=l;h<arguments.length;h++){var f=arguments[h];if(f)for(var m in f)c&&f[m]&&f[m].constructor===Object&&(!a[m]||a[m].constructor===Object)?(a[m]=a[m]||{},i.extend(a[m],c,f[m])):a[m]=f[m]}return a},i.clone=function(a,o){return i.extend({},o,a)},i.keys=function(a){if(Object.keys)return Object.keys(a);var o=[];for(var l in a)o.push(l);return o},i.values=function(a){var o=[];if(Object.keys){for(var l=Object.keys(a),c=0;c<l.length;c++)o.push(a[l[c]]);return o}for(var h in a)o.push(a[h]);return o},i.get=function(a,o,l,c){o=o.split(".").slice(l,c);for(var h=0;h<o.length;h+=1)a=a[o[h]];return a},i.set=function(a,o,l,c,h){var f=o.split(".").slice(c,h);return i.get(a,o,0,-1)[f[f.length-1]]=l,l},i.shuffle=function(a){for(var o=a.length-1;o>0;o--){var l=Math.floor(i.random()*(o+1)),c=a[o];a[o]=a[l],a[l]=c}return a},i.choose=function(a){return a[Math.floor(i.random()*a.length)]},i.isElement=function(a){return typeof HTMLElement<"u"?a instanceof HTMLElement:!!(a&&a.nodeType&&a.nodeName)},i.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"},i.isFunction=function(a){return typeof a=="function"},i.isPlainObject=function(a){return typeof a=="object"&&a.constructor===Object},i.isString=function(a){return toString.call(a)==="[object String]"},i.clamp=function(a,o,l){return a<o?o:a>l?l:a},i.sign=function(a){return a<0?-1:1},i.now=function(){if(typeof window<"u"&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-i._nowStartTime},i.random=function(a,o){return a=typeof a<"u"?a:0,o=typeof o<"u"?o:1,a+s()*(o-a)};var s=function(){return i._seed=(i._seed*9301+49297)%233280,i._seed/233280};i.colorToNumber=function(a){return a=a.replace("#",""),a.length==3&&(a=a.charAt(0)+a.charAt(0)+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)),parseInt(a,16)},i.logLevel=1,i.log=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.info=function(){console&&i.logLevel>0&&i.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warn=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warnOnce=function(){var a=Array.prototype.slice.call(arguments).join(" ");i._warnedOnce[a]||(i.warn(a),i._warnedOnce[a]=!0)},i.deprecated=function(a,o,l){a[o]=i.chain(function(){i.warnOnce("🔅 deprecated 🔅",l)},a[o])},i.nextId=function(){return i._nextId++},i.indexOf=function(a,o){if(a.indexOf)return a.indexOf(o);for(var l=0;l<a.length;l++)if(a[l]===o)return l;return-1},i.map=function(a,o){if(a.map)return a.map(o);for(var l=[],c=0;c<a.length;c+=1)l.push(o(a[c]));return l},i.topologicalSort=function(a){var o=[],l=[],c=[];for(var h in a)!l[h]&&!c[h]&&i._topologicalSort(h,l,c,a,o);return o},i._topologicalSort=function(a,o,l,c,h){var f=c[a]||[];l[a]=!0;for(var m=0;m<f.length;m+=1){var d=f[m];l[d]||o[d]||i._topologicalSort(d,o,l,c,h)}l[a]=!1,o[a]=!0,h.push(a)},i.chain=function(){for(var a=[],o=0;o<arguments.length;o+=1){var l=arguments[o];l._chained?a.push.apply(a,l._chained):a.push(l)}var c=function(){for(var h,f=new Array(arguments.length),m=0,d=arguments.length;m<d;m++)f[m]=arguments[m];for(m=0;m<a.length;m+=1){var p=a[m].apply(h,f);typeof p<"u"&&(h=p)}return h};return c._chained=a,c},i.chainPathBefore=function(a,o,l){return i.set(a,o,i.chain(l,i.get(a,o)))},i.chainPathAfter=function(a,o,l){return i.set(a,o,i.chain(i.get(a,o),l))},i.setDecomp=function(a){i._decomp=a},i.getDecomp=function(){var a=i._decomp;try{!a&&typeof window<"u"&&(a=window.decomp),!a&&typeof uu<"u"&&(a=uu.decomp)}catch{a=null}return a}})()}),(function(n,r){var i={};n.exports=i,(function(){i.create=function(s){var a={min:{x:0,y:0},max:{x:0,y:0}};return s&&i.update(a,s),a},i.update=function(s,a,o){s.min.x=1/0,s.max.x=-1/0,s.min.y=1/0,s.max.y=-1/0;for(var l=0;l<a.length;l++){var c=a[l];c.x>s.max.x&&(s.max.x=c.x),c.x<s.min.x&&(s.min.x=c.x),c.y>s.max.y&&(s.max.y=c.y),c.y<s.min.y&&(s.min.y=c.y)}o&&(o.x>0?s.max.x+=o.x:s.min.x+=o.x,o.y>0?s.max.y+=o.y:s.min.y+=o.y)},i.contains=function(s,a){return a.x>=s.min.x&&a.x<=s.max.x&&a.y>=s.min.y&&a.y<=s.max.y},i.overlaps=function(s,a){return s.min.x<=a.max.x&&s.max.x>=a.min.x&&s.max.y>=a.min.y&&s.min.y<=a.max.y},i.translate=function(s,a){s.min.x+=a.x,s.max.x+=a.x,s.min.y+=a.y,s.max.y+=a.y},i.shift=function(s,a){var o=s.max.x-s.min.x,l=s.max.y-s.min.y;s.min.x=a.x,s.max.x=a.x+o,s.min.y=a.y,s.max.y=a.y+l}})()}),(function(n,r){var i={};n.exports=i,(function(){i.create=function(s,a){return{x:s||0,y:a||0}},i.clone=function(s){return{x:s.x,y:s.y}},i.magnitude=function(s){return Math.sqrt(s.x*s.x+s.y*s.y)},i.magnitudeSquared=function(s){return s.x*s.x+s.y*s.y},i.rotate=function(s,a,o){var l=Math.cos(a),c=Math.sin(a);o||(o={});var h=s.x*l-s.y*c;return o.y=s.x*c+s.y*l,o.x=h,o},i.rotateAbout=function(s,a,o,l){var c=Math.cos(a),h=Math.sin(a);l||(l={});var f=o.x+((s.x-o.x)*c-(s.y-o.y)*h);return l.y=o.y+((s.x-o.x)*h+(s.y-o.y)*c),l.x=f,l},i.normalise=function(s){var a=i.magnitude(s);return a===0?{x:0,y:0}:{x:s.x/a,y:s.y/a}},i.dot=function(s,a){return s.x*a.x+s.y*a.y},i.cross=function(s,a){return s.x*a.y-s.y*a.x},i.cross3=function(s,a,o){return(a.x-s.x)*(o.y-s.y)-(a.y-s.y)*(o.x-s.x)},i.add=function(s,a,o){return o||(o={}),o.x=s.x+a.x,o.y=s.y+a.y,o},i.sub=function(s,a,o){return o||(o={}),o.x=s.x-a.x,o.y=s.y-a.y,o},i.mult=function(s,a){return{x:s.x*a,y:s.y*a}},i.div=function(s,a){return{x:s.x/a,y:s.y/a}},i.perp=function(s,a){return a=a===!0?-1:1,{x:a*-s.y,y:a*s.x}},i.neg=function(s){return{x:-s.x,y:-s.y}},i.angle=function(s,a){return Math.atan2(a.y-s.y,a.x-s.x)},i._temp=[i.create(),i.create(),i.create(),i.create(),i.create(),i.create()]})()}),(function(n,r,i){var s={};n.exports=s;var a=i(2),o=i(0);(function(){s.create=function(l,c){for(var h=[],f=0;f<l.length;f++){var m=l[f],d={x:m.x,y:m.y,index:f,body:c,isInternal:!1};h.push(d)}return h},s.fromPath=function(l,c){var h=/L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/ig,f=[];return l.replace(h,function(m,d,p){f.push({x:parseFloat(d),y:parseFloat(p)})}),s.create(f,c)},s.centre=function(l){for(var c=s.area(l,!0),h={x:0,y:0},f,m,d,p=0;p<l.length;p++)d=(p+1)%l.length,f=a.cross(l[p],l[d]),m=a.mult(a.add(l[p],l[d]),f),h=a.add(h,m);return a.div(h,6*c)},s.mean=function(l){for(var c={x:0,y:0},h=0;h<l.length;h++)c.x+=l[h].x,c.y+=l[h].y;return a.div(c,l.length)},s.area=function(l,c){for(var h=0,f=l.length-1,m=0;m<l.length;m++)h+=(l[f].x-l[m].x)*(l[f].y+l[m].y),f=m;return c?h/2:Math.abs(h)/2},s.inertia=function(l,c){for(var h=0,f=0,m=l,d,p,g=0;g<m.length;g++)p=(g+1)%m.length,d=Math.abs(a.cross(m[p],m[g])),h+=d*(a.dot(m[p],m[p])+a.dot(m[p],m[g])+a.dot(m[g],m[g])),f+=d;return c/6*(h/f)},s.translate=function(l,c,h){h=typeof h<"u"?h:1;var f=l.length,m=c.x*h,d=c.y*h,p;for(p=0;p<f;p++)l[p].x+=m,l[p].y+=d;return l},s.rotate=function(l,c,h){if(c!==0){var f=Math.cos(c),m=Math.sin(c),d=h.x,p=h.y,g=l.length,x,b,k,T;for(T=0;T<g;T++)x=l[T],b=x.x-d,k=x.y-p,x.x=d+(b*f-k*m),x.y=p+(b*m+k*f);return l}},s.contains=function(l,c){for(var h=c.x,f=c.y,m=l.length,d=l[m-1],p,g=0;g<m;g++){if(p=l[g],(h-d.x)*(p.y-d.y)+(f-d.y)*(d.x-p.x)>0)return!1;d=p}return!0},s.scale=function(l,c,h,f){if(c===1&&h===1)return l;f=f||s.centre(l);for(var m,d,p=0;p<l.length;p++)m=l[p],d=a.sub(m,f),l[p].x=f.x+d.x*c,l[p].y=f.y+d.y*h;return l},s.chamfer=function(l,c,h,f,m){typeof c=="number"?c=[c]:c=c||[8],h=typeof h<"u"?h:-1,f=f||2,m=m||14;for(var d=[],p=0;p<l.length;p++){var g=l[p-1>=0?p-1:l.length-1],x=l[p],b=l[(p+1)%l.length],k=c[p<c.length?p:c.length-1];if(k===0){d.push(x);continue}var T=a.normalise({x:x.y-g.y,y:g.x-x.x}),A=a.normalise({x:b.y-x.y,y:x.x-b.x}),E=Math.sqrt(2*Math.pow(k,2)),C=a.mult(o.clone(T),k),_=a.normalise(a.mult(a.add(T,A),.5)),w=a.sub(x,a.mult(_,E)),N=h;h===-1&&(N=Math.pow(k,.32)*1.75),N=o.clamp(N,f,m),N%2===1&&(N+=1);for(var S=Math.acos(a.dot(T,A)),R=S/N,M=0;M<N;M++)d.push(a.add(a.rotate(C,R*M),w))}return d},s.clockwiseSort=function(l){var c=s.mean(l);return l.sort(function(h,f){return a.angle(c,h)-a.angle(c,f)}),l},s.isConvex=function(l){var c=0,h=l.length,f,m,d,p;if(h<3)return null;for(f=0;f<h;f++)if(m=(f+1)%h,d=(f+2)%h,p=(l[m].x-l[f].x)*(l[d].y-l[m].y),p-=(l[m].y-l[f].y)*(l[d].x-l[m].x),p<0?c|=1:p>0&&(c|=2),c===3)return!1;return c!==0?!0:null},s.hull=function(l){var c=[],h=[],f,m;for(l=l.slice(0),l.sort(function(d,p){var g=d.x-p.x;return g!==0?g:d.y-p.y}),m=0;m<l.length;m+=1){for(f=l[m];h.length>=2&&a.cross3(h[h.length-2],h[h.length-1],f)<=0;)h.pop();h.push(f)}for(m=l.length-1;m>=0;m-=1){for(f=l[m];c.length>=2&&a.cross3(c[c.length-2],c[c.length-1],f)<=0;)c.pop();c.push(f)}return c.pop(),h.pop(),c.concat(h)}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(3),o=i(2),l=i(7),c=i(0),h=i(1),f=i(11);(function(){s._timeCorrection=!0,s._inertiaScale=4,s._nextCollidingGroupId=1,s._nextNonCollidingGroupId=-1,s._nextCategory=1,s._baseDelta=1e3/60,s.create=function(d){var p={id:c.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:a.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,deltaTime:16.666666666666668,_original:null},g=c.extend(p,d);return m(g,d),g},s.nextGroup=function(d){return d?s._nextNonCollidingGroupId--:s._nextCollidingGroupId++},s.nextCategory=function(){return s._nextCategory=s._nextCategory<<1,s._nextCategory};var m=function(d,p){p=p||{},s.set(d,{bounds:d.bounds||h.create(d.vertices),positionPrev:d.positionPrev||o.clone(d.position),anglePrev:d.anglePrev||d.angle,vertices:d.vertices,parts:d.parts||[d],isStatic:d.isStatic,isSleeping:d.isSleeping,parent:d.parent||d}),a.rotate(d.vertices,d.angle,d.position),f.rotate(d.axes,d.angle),h.update(d.bounds,d.vertices,d.velocity),s.set(d,{axes:p.axes||d.axes,area:p.area||d.area,mass:p.mass||d.mass,inertia:p.inertia||d.inertia});var g=d.isStatic?"#14151f":c.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),x=d.isStatic?"#555":"#ccc",b=d.isStatic&&d.render.fillStyle===null?1:0;d.render.fillStyle=d.render.fillStyle||g,d.render.strokeStyle=d.render.strokeStyle||x,d.render.lineWidth=d.render.lineWidth||b,d.render.sprite.xOffset+=-(d.bounds.min.x-d.position.x)/(d.bounds.max.x-d.bounds.min.x),d.render.sprite.yOffset+=-(d.bounds.min.y-d.position.y)/(d.bounds.max.y-d.bounds.min.y)};s.set=function(d,p,g){var x;typeof p=="string"&&(x=p,p={},p[x]=g);for(x in p)if(Object.prototype.hasOwnProperty.call(p,x))switch(g=p[x],x){case"isStatic":s.setStatic(d,g);break;case"isSleeping":l.set(d,g);break;case"mass":s.setMass(d,g);break;case"density":s.setDensity(d,g);break;case"inertia":s.setInertia(d,g);break;case"vertices":s.setVertices(d,g);break;case"position":s.setPosition(d,g);break;case"angle":s.setAngle(d,g);break;case"velocity":s.setVelocity(d,g);break;case"angularVelocity":s.setAngularVelocity(d,g);break;case"speed":s.setSpeed(d,g);break;case"angularSpeed":s.setAngularSpeed(d,g);break;case"parts":s.setParts(d,g);break;case"centre":s.setCentre(d,g);break;default:d[x]=g}},s.setStatic=function(d,p){for(var g=0;g<d.parts.length;g++){var x=d.parts[g];x.isStatic=p,p?(x._original={restitution:x.restitution,friction:x.friction,mass:x.mass,inertia:x.inertia,density:x.density,inverseMass:x.inverseMass,inverseInertia:x.inverseInertia},x.restitution=0,x.friction=1,x.mass=x.inertia=x.density=1/0,x.inverseMass=x.inverseInertia=0,x.positionPrev.x=x.position.x,x.positionPrev.y=x.position.y,x.anglePrev=x.angle,x.angularVelocity=0,x.speed=0,x.angularSpeed=0,x.motion=0):x._original&&(x.restitution=x._original.restitution,x.friction=x._original.friction,x.mass=x._original.mass,x.inertia=x._original.inertia,x.density=x._original.density,x.inverseMass=x._original.inverseMass,x.inverseInertia=x._original.inverseInertia,x._original=null)}},s.setMass=function(d,p){var g=d.inertia/(d.mass/6);d.inertia=g*(p/6),d.inverseInertia=1/d.inertia,d.mass=p,d.inverseMass=1/d.mass,d.density=d.mass/d.area},s.setDensity=function(d,p){s.setMass(d,p*d.area),d.density=p},s.setInertia=function(d,p){d.inertia=p,d.inverseInertia=1/d.inertia},s.setVertices=function(d,p){p[0].body===d?d.vertices=p:d.vertices=a.create(p,d),d.axes=f.fromVertices(d.vertices),d.area=a.area(d.vertices),s.setMass(d,d.density*d.area);var g=a.centre(d.vertices);a.translate(d.vertices,g,-1),s.setInertia(d,s._inertiaScale*a.inertia(d.vertices,d.mass)),a.translate(d.vertices,d.position),h.update(d.bounds,d.vertices,d.velocity)},s.setParts=function(d,p,g){var x;for(p=p.slice(0),d.parts.length=0,d.parts.push(d),d.parent=d,x=0;x<p.length;x++){var b=p[x];b!==d&&(b.parent=d,d.parts.push(b))}if(d.parts.length!==1){if(g=typeof g<"u"?g:!0,g){var k=[];for(x=0;x<p.length;x++)k=k.concat(p[x].vertices);a.clockwiseSort(k);var T=a.hull(k),A=a.centre(T);s.setVertices(d,T),a.translate(d.vertices,A)}var E=s._totalProperties(d);d.area=E.area,d.parent=d,d.position.x=E.centre.x,d.position.y=E.centre.y,d.positionPrev.x=E.centre.x,d.positionPrev.y=E.centre.y,s.setMass(d,E.mass),s.setInertia(d,E.inertia),s.setPosition(d,E.centre)}},s.setCentre=function(d,p,g){g?(d.positionPrev.x+=p.x,d.positionPrev.y+=p.y,d.position.x+=p.x,d.position.y+=p.y):(d.positionPrev.x=p.x-(d.position.x-d.positionPrev.x),d.positionPrev.y=p.y-(d.position.y-d.positionPrev.y),d.position.x=p.x,d.position.y=p.y)},s.setPosition=function(d,p,g){var x=o.sub(p,d.position);g?(d.positionPrev.x=d.position.x,d.positionPrev.y=d.position.y,d.velocity.x=x.x,d.velocity.y=x.y,d.speed=o.magnitude(x)):(d.positionPrev.x+=x.x,d.positionPrev.y+=x.y);for(var b=0;b<d.parts.length;b++){var k=d.parts[b];k.position.x+=x.x,k.position.y+=x.y,a.translate(k.vertices,x),h.update(k.bounds,k.vertices,d.velocity)}},s.setAngle=function(d,p,g){var x=p-d.angle;g?(d.anglePrev=d.angle,d.angularVelocity=x,d.angularSpeed=Math.abs(x)):d.anglePrev+=x;for(var b=0;b<d.parts.length;b++){var k=d.parts[b];k.angle+=x,a.rotate(k.vertices,x,d.position),f.rotate(k.axes,x),h.update(k.bounds,k.vertices,d.velocity),b>0&&o.rotateAbout(k.position,x,d.position,k.position)}},s.setVelocity=function(d,p){var g=d.deltaTime/s._baseDelta;d.positionPrev.x=d.position.x-p.x*g,d.positionPrev.y=d.position.y-p.y*g,d.velocity.x=(d.position.x-d.positionPrev.x)/g,d.velocity.y=(d.position.y-d.positionPrev.y)/g,d.speed=o.magnitude(d.velocity)},s.getVelocity=function(d){var p=s._baseDelta/d.deltaTime;return{x:(d.position.x-d.positionPrev.x)*p,y:(d.position.y-d.positionPrev.y)*p}},s.getSpeed=function(d){return o.magnitude(s.getVelocity(d))},s.setSpeed=function(d,p){s.setVelocity(d,o.mult(o.normalise(s.getVelocity(d)),p))},s.setAngularVelocity=function(d,p){var g=d.deltaTime/s._baseDelta;d.anglePrev=d.angle-p*g,d.angularVelocity=(d.angle-d.anglePrev)/g,d.angularSpeed=Math.abs(d.angularVelocity)},s.getAngularVelocity=function(d){return(d.angle-d.anglePrev)*s._baseDelta/d.deltaTime},s.getAngularSpeed=function(d){return Math.abs(s.getAngularVelocity(d))},s.setAngularSpeed=function(d,p){s.setAngularVelocity(d,c.sign(s.getAngularVelocity(d))*p)},s.translate=function(d,p,g){s.setPosition(d,o.add(d.position,p),g)},s.rotate=function(d,p,g,x){if(!g)s.setAngle(d,d.angle+p,x);else{var b=Math.cos(p),k=Math.sin(p),T=d.position.x-g.x,A=d.position.y-g.y;s.setPosition(d,{x:g.x+(T*b-A*k),y:g.y+(T*k+A*b)},x),s.setAngle(d,d.angle+p,x)}},s.scale=function(d,p,g,x){var b=0,k=0;x=x||d.position;for(var T=0;T<d.parts.length;T++){var A=d.parts[T];a.scale(A.vertices,p,g,x),A.axes=f.fromVertices(A.vertices),A.area=a.area(A.vertices),s.setMass(A,d.density*A.area),a.translate(A.vertices,{x:-A.position.x,y:-A.position.y}),s.setInertia(A,s._inertiaScale*a.inertia(A.vertices,A.mass)),a.translate(A.vertices,{x:A.position.x,y:A.position.y}),T>0&&(b+=A.area,k+=A.inertia),A.position.x=x.x+(A.position.x-x.x)*p,A.position.y=x.y+(A.position.y-x.y)*g,h.update(A.bounds,A.vertices,d.velocity)}d.parts.length>1&&(d.area=b,d.isStatic||(s.setMass(d,d.density*b),s.setInertia(d,k))),d.circleRadius&&(p===g?d.circleRadius*=p:d.circleRadius=null)},s.update=function(d,p){p=(typeof p<"u"?p:1e3/60)*d.timeScale;var g=p*p,x=s._timeCorrection?p/(d.deltaTime||p):1,b=1-d.frictionAir*(p/c._baseDelta),k=(d.position.x-d.positionPrev.x)*x,T=(d.position.y-d.positionPrev.y)*x;d.velocity.x=k*b+d.force.x/d.mass*g,d.velocity.y=T*b+d.force.y/d.mass*g,d.positionPrev.x=d.position.x,d.positionPrev.y=d.position.y,d.position.x+=d.velocity.x,d.position.y+=d.velocity.y,d.deltaTime=p,d.angularVelocity=(d.angle-d.anglePrev)*b*x+d.torque/d.inertia*g,d.anglePrev=d.angle,d.angle+=d.angularVelocity;for(var A=0;A<d.parts.length;A++){var E=d.parts[A];a.translate(E.vertices,d.velocity),A>0&&(E.position.x+=d.velocity.x,E.position.y+=d.velocity.y),d.angularVelocity!==0&&(a.rotate(E.vertices,d.angularVelocity,d.position),f.rotate(E.axes,d.angularVelocity),A>0&&o.rotateAbout(E.position,d.angularVelocity,d.position,E.position)),h.update(E.bounds,E.vertices,d.velocity)}},s.updateVelocities=function(d){var p=s._baseDelta/d.deltaTime,g=d.velocity;g.x=(d.position.x-d.positionPrev.x)*p,g.y=(d.position.y-d.positionPrev.y)*p,d.speed=Math.sqrt(g.x*g.x+g.y*g.y),d.angularVelocity=(d.angle-d.anglePrev)*p,d.angularSpeed=Math.abs(d.angularVelocity)},s.applyForce=function(d,p,g){var x={x:p.x-d.position.x,y:p.y-d.position.y};d.force.x+=g.x,d.force.y+=g.y,d.torque+=x.x*g.y-x.y*g.x},s._totalProperties=function(d){for(var p={mass:0,area:0,inertia:0,centre:{x:0,y:0}},g=d.parts.length===1?0:1;g<d.parts.length;g++){var x=d.parts[g],b=x.mass!==1/0?x.mass:1;p.mass+=b,p.area+=x.area,p.inertia+=x.inertia,p.centre=o.add(p.centre,o.mult(x.position,b))}return p.centre=o.div(p.centre,p.mass),p}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(0);(function(){s.on=function(o,l,c){for(var h=l.split(" "),f,m=0;m<h.length;m++)f=h[m],o.events=o.events||{},o.events[f]=o.events[f]||[],o.events[f].push(c);return c},s.off=function(o,l,c){if(!l){o.events={};return}typeof l=="function"&&(c=l,l=a.keys(o.events).join(" "));for(var h=l.split(" "),f=0;f<h.length;f++){var m=o.events[h[f]],d=[];if(c&&m)for(var p=0;p<m.length;p++)m[p]!==c&&d.push(m[p]);o.events[h[f]]=d}},s.trigger=function(o,l,c){var h,f,m,d,p=o.events;if(p&&a.keys(p).length>0){c||(c={}),h=l.split(" ");for(var g=0;g<h.length;g++)if(f=h[g],m=p[f],m){d=a.clone(c,!1),d.name=f,d.source=o;for(var x=0;x<m.length;x++)m[x].apply(o,[d])}}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(5),o=i(0),l=i(1),c=i(4);(function(){s.create=function(h){return o.extend({id:o.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},h)},s.setModified=function(h,f,m,d){if(h.isModified=f,f&&h.cache&&(h.cache.allBodies=null,h.cache.allConstraints=null,h.cache.allComposites=null),m&&h.parent&&s.setModified(h.parent,f,m,d),d)for(var p=0;p<h.composites.length;p++){var g=h.composites[p];s.setModified(g,f,m,d)}},s.add=function(h,f){var m=[].concat(f);a.trigger(h,"beforeAdd",{object:f});for(var d=0;d<m.length;d++){var p=m[d];switch(p.type){case"body":if(p.parent!==p){o.warn("Composite.add: skipped adding a compound body part (you must add its parent instead)");break}s.addBody(h,p);break;case"constraint":s.addConstraint(h,p);break;case"composite":s.addComposite(h,p);break;case"mouseConstraint":s.addConstraint(h,p.constraint);break}}return a.trigger(h,"afterAdd",{object:f}),h},s.remove=function(h,f,m){var d=[].concat(f);a.trigger(h,"beforeRemove",{object:f});for(var p=0;p<d.length;p++){var g=d[p];switch(g.type){case"body":s.removeBody(h,g,m);break;case"constraint":s.removeConstraint(h,g,m);break;case"composite":s.removeComposite(h,g,m);break;case"mouseConstraint":s.removeConstraint(h,g.constraint);break}}return a.trigger(h,"afterRemove",{object:f}),h},s.addComposite=function(h,f){return h.composites.push(f),f.parent=h,s.setModified(h,!0,!0,!1),h},s.removeComposite=function(h,f,m){var d=o.indexOf(h.composites,f);if(d!==-1&&s.removeCompositeAt(h,d),m)for(var p=0;p<h.composites.length;p++)s.removeComposite(h.composites[p],f,!0);return h},s.removeCompositeAt=function(h,f){return h.composites.splice(f,1),s.setModified(h,!0,!0,!1),h},s.addBody=function(h,f){return h.bodies.push(f),s.setModified(h,!0,!0,!1),h},s.removeBody=function(h,f,m){var d=o.indexOf(h.bodies,f);if(d!==-1&&s.removeBodyAt(h,d),m)for(var p=0;p<h.composites.length;p++)s.removeBody(h.composites[p],f,!0);return h},s.removeBodyAt=function(h,f){return h.bodies.splice(f,1),s.setModified(h,!0,!0,!1),h},s.addConstraint=function(h,f){return h.constraints.push(f),s.setModified(h,!0,!0,!1),h},s.removeConstraint=function(h,f,m){var d=o.indexOf(h.constraints,f);if(d!==-1&&s.removeConstraintAt(h,d),m)for(var p=0;p<h.composites.length;p++)s.removeConstraint(h.composites[p],f,!0);return h},s.removeConstraintAt=function(h,f){return h.constraints.splice(f,1),s.setModified(h,!0,!0,!1),h},s.clear=function(h,f,m){if(m)for(var d=0;d<h.composites.length;d++)s.clear(h.composites[d],f,!0);return f?h.bodies=h.bodies.filter(function(p){return p.isStatic}):h.bodies.length=0,h.constraints.length=0,h.composites.length=0,s.setModified(h,!0,!0,!1),h},s.allBodies=function(h){if(h.cache&&h.cache.allBodies)return h.cache.allBodies;for(var f=[].concat(h.bodies),m=0;m<h.composites.length;m++)f=f.concat(s.allBodies(h.composites[m]));return h.cache&&(h.cache.allBodies=f),f},s.allConstraints=function(h){if(h.cache&&h.cache.allConstraints)return h.cache.allConstraints;for(var f=[].concat(h.constraints),m=0;m<h.composites.length;m++)f=f.concat(s.allConstraints(h.composites[m]));return h.cache&&(h.cache.allConstraints=f),f},s.allComposites=function(h){if(h.cache&&h.cache.allComposites)return h.cache.allComposites;for(var f=[].concat(h.composites),m=0;m<h.composites.length;m++)f=f.concat(s.allComposites(h.composites[m]));return h.cache&&(h.cache.allComposites=f),f},s.get=function(h,f,m){var d,p;switch(m){case"body":d=s.allBodies(h);break;case"constraint":d=s.allConstraints(h);break;case"composite":d=s.allComposites(h).concat(h);break}return d?(p=d.filter(function(g){return g.id.toString()===f.toString()}),p.length===0?null:p[0]):null},s.move=function(h,f,m){return s.remove(h,f),s.add(m,f),h},s.rebase=function(h){for(var f=s.allBodies(h).concat(s.allConstraints(h)).concat(s.allComposites(h)),m=0;m<f.length;m++)f[m].id=o.nextId();return h},s.translate=function(h,f,m){for(var d=m?s.allBodies(h):h.bodies,p=0;p<d.length;p++)c.translate(d[p],f);return h},s.rotate=function(h,f,m,d){for(var p=Math.cos(f),g=Math.sin(f),x=d?s.allBodies(h):h.bodies,b=0;b<x.length;b++){var k=x[b],T=k.position.x-m.x,A=k.position.y-m.y;c.setPosition(k,{x:m.x+(T*p-A*g),y:m.y+(T*g+A*p)}),c.rotate(k,f)}return h},s.scale=function(h,f,m,d,p){for(var g=p?s.allBodies(h):h.bodies,x=0;x<g.length;x++){var b=g[x],k=b.position.x-d.x,T=b.position.y-d.y;c.setPosition(b,{x:d.x+k*f,y:d.y+T*m}),c.scale(b,f,m)}return h},s.bounds=function(h){for(var f=s.allBodies(h),m=[],d=0;d<f.length;d+=1){var p=f[d];m.push(p.bounds.min,p.bounds.max)}return l.create(m)}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(4),o=i(5),l=i(0);(function(){s._motionWakeThreshold=.18,s._motionSleepThreshold=.08,s._minBias=.9,s.update=function(c,h){for(var f=h/l._baseDelta,m=s._motionSleepThreshold,d=0;d<c.length;d++){var p=c[d],g=a.getSpeed(p),x=a.getAngularSpeed(p),b=g*g+x*x;if(p.force.x!==0||p.force.y!==0){s.set(p,!1);continue}var k=Math.min(p.motion,b),T=Math.max(p.motion,b);p.motion=s._minBias*k+(1-s._minBias)*T,p.sleepThreshold>0&&p.motion<m?(p.sleepCounter+=1,p.sleepCounter>=p.sleepThreshold/f&&s.set(p,!0)):p.sleepCounter>0&&(p.sleepCounter-=1)}},s.afterCollisions=function(c){for(var h=s._motionSleepThreshold,f=0;f<c.length;f++){var m=c[f];if(m.isActive){var d=m.collision,p=d.bodyA.parent,g=d.bodyB.parent;if(!(p.isSleeping&&g.isSleeping||p.isStatic||g.isStatic)&&(p.isSleeping||g.isSleeping)){var x=p.isSleeping&&!p.isStatic?p:g,b=x===p?g:p;!x.isStatic&&b.motion>h&&s.set(x,!1)}}}},s.set=function(c,h){var f=c.isSleeping;h?(c.isSleeping=!0,c.sleepCounter=c.sleepThreshold,c.positionImpulse.x=0,c.positionImpulse.y=0,c.positionPrev.x=c.position.x,c.positionPrev.y=c.position.y,c.anglePrev=c.angle,c.speed=0,c.angularSpeed=0,c.motion=0,f||o.trigger(c,"sleepStart")):(c.isSleeping=!1,c.sleepCounter=0,f&&o.trigger(c,"sleepEnd"))}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(3),o=i(9);(function(){var l=[],c={overlap:0,axis:null},h={overlap:0,axis:null};s.create=function(f,m){return{pair:null,collided:!1,bodyA:f,bodyB:m,parentA:f.parent,parentB:m.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},s.collides=function(f,m,d){if(s._overlapAxes(c,f.vertices,m.vertices,f.axes),c.overlap<=0||(s._overlapAxes(h,m.vertices,f.vertices,m.axes),h.overlap<=0))return null;var p=d&&d.table[o.id(f,m)],g;p?g=p.collision:(g=s.create(f,m),g.collided=!0,g.bodyA=f.id<m.id?f:m,g.bodyB=f.id<m.id?m:f,g.parentA=g.bodyA.parent,g.parentB=g.bodyB.parent),f=g.bodyA,m=g.bodyB;var x;c.overlap<h.overlap?x=c:x=h;var b=g.normal,k=g.supports,T=x.axis,A=T.x,E=T.y;A*(m.position.x-f.position.x)+E*(m.position.y-f.position.y)<0?(b.x=A,b.y=E):(b.x=-A,b.y=-E),g.tangent.x=-b.y,g.tangent.y=b.x,g.depth=x.overlap,g.penetration.x=b.x*g.depth,g.penetration.y=b.y*g.depth;var C=s._findSupports(f,m,b,1),_=0;if(a.contains(f.vertices,C[0])&&(k[_++]=C[0]),a.contains(f.vertices,C[1])&&(k[_++]=C[1]),_<2){var w=s._findSupports(m,f,b,-1);a.contains(m.vertices,w[0])&&(k[_++]=w[0]),_<2&&a.contains(m.vertices,w[1])&&(k[_++]=w[1])}return _===0&&(k[_++]=C[0]),k.length=_,g},s._overlapAxes=function(f,m,d,p){var g=m.length,x=d.length,b=m[0].x,k=m[0].y,T=d[0].x,A=d[0].y,E=p.length,C=Number.MAX_VALUE,_=0,w,N,S,R,M,O;for(M=0;M<E;M++){var L=p[M],I=L.x,j=L.y,U=b*I+k*j,B=T*I+A*j,W=U,D=B;for(O=1;O<g;O+=1)R=m[O].x*I+m[O].y*j,R>W?W=R:R<U&&(U=R);for(O=1;O<x;O+=1)R=d[O].x*I+d[O].y*j,R>D?D=R:R<B&&(B=R);if(N=W-B,S=D-U,w=N<S?N:S,w<C&&(C=w,_=M,w<=0))break}f.axis=p[_],f.overlap=C},s._projectToAxis=function(f,m,d){for(var p=m[0].x*d.x+m[0].y*d.y,g=p,x=1;x<m.length;x+=1){var b=m[x].x*d.x+m[x].y*d.y;b>g?g=b:b<p&&(p=b)}f.min=p,f.max=g},s._findSupports=function(f,m,d,p){var g=m.vertices,x=g.length,b=f.position.x,k=f.position.y,T=d.x*p,A=d.y*p,E=Number.MAX_VALUE,C,_,w,N,S;for(S=0;S<x;S+=1)_=g[S],N=T*(b-_.x)+A*(k-_.y),N<E&&(E=N,C=_);return w=g[(x+C.index-1)%x],E=T*(b-w.x)+A*(k-w.y),_=g[(C.index+1)%x],T*(b-_.x)+A*(k-_.y)<E?(l[0]=C,l[1]=_,l):(l[0]=C,l[1]=w,l)}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(16);(function(){s.create=function(o,l){var c=o.bodyA,h=o.bodyB,f={id:s.id(c,h),bodyA:c,bodyB:h,collision:o,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:c.isSensor||h.isSensor,timeCreated:l,timeUpdated:l,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return s.update(f,o,l),f},s.update=function(o,l,c){var h=o.contacts,f=l.supports,m=o.activeContacts,d=l.parentA,p=l.parentB,g=d.vertices.length;o.isActive=!0,o.timeUpdated=c,o.collision=l,o.separation=l.depth,o.inverseMass=d.inverseMass+p.inverseMass,o.friction=d.friction<p.friction?d.friction:p.friction,o.frictionStatic=d.frictionStatic>p.frictionStatic?d.frictionStatic:p.frictionStatic,o.restitution=d.restitution>p.restitution?d.restitution:p.restitution,o.slop=d.slop>p.slop?d.slop:p.slop,l.pair=o,m.length=0;for(var x=0;x<f.length;x++){var b=f[x],k=b.body===d?b.index:g+b.index,T=h[k];T?m.push(T):m.push(h[k]=a.create(b))}},s.setActive=function(o,l,c){l?(o.isActive=!0,o.timeUpdated=c):(o.isActive=!1,o.activeContacts.length=0)},s.id=function(o,l){return o.id<l.id?"A"+o.id+"B"+l.id:"A"+l.id+"B"+o.id}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(3),o=i(2),l=i(7),c=i(1),h=i(11),f=i(0);(function(){s._warming=.4,s._torqueDampen=1,s._minLength=1e-6,s.create=function(m){var d=m;d.bodyA&&!d.pointA&&(d.pointA={x:0,y:0}),d.bodyB&&!d.pointB&&(d.pointB={x:0,y:0});var p=d.bodyA?o.add(d.bodyA.position,d.pointA):d.pointA,g=d.bodyB?o.add(d.bodyB.position,d.pointB):d.pointB,x=o.magnitude(o.sub(p,g));d.length=typeof d.length<"u"?d.length:x,d.id=d.id||f.nextId(),d.label=d.label||"Constraint",d.type="constraint",d.stiffness=d.stiffness||(d.length>0?1:.7),d.damping=d.damping||0,d.angularStiffness=d.angularStiffness||0,d.angleA=d.bodyA?d.bodyA.angle:d.angleA,d.angleB=d.bodyB?d.bodyB.angle:d.angleB,d.plugin={};var b={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return d.length===0&&d.stiffness>.1?(b.type="pin",b.anchors=!1):d.stiffness<.9&&(b.type="spring"),d.render=f.extend(b,d.render),d},s.preSolveAll=function(m){for(var d=0;d<m.length;d+=1){var p=m[d],g=p.constraintImpulse;p.isStatic||g.x===0&&g.y===0&&g.angle===0||(p.position.x+=g.x,p.position.y+=g.y,p.angle+=g.angle)}},s.solveAll=function(m,d){for(var p=f.clamp(d/f._baseDelta,0,1),g=0;g<m.length;g+=1){var x=m[g],b=!x.bodyA||x.bodyA&&x.bodyA.isStatic,k=!x.bodyB||x.bodyB&&x.bodyB.isStatic;(b||k)&&s.solve(m[g],p)}for(g=0;g<m.length;g+=1)x=m[g],b=!x.bodyA||x.bodyA&&x.bodyA.isStatic,k=!x.bodyB||x.bodyB&&x.bodyB.isStatic,!b&&!k&&s.solve(m[g],p)},s.solve=function(m,d){var p=m.bodyA,g=m.bodyB,x=m.pointA,b=m.pointB;if(!(!p&&!g)){p&&!p.isStatic&&(o.rotate(x,p.angle-m.angleA,x),m.angleA=p.angle),g&&!g.isStatic&&(o.rotate(b,g.angle-m.angleB,b),m.angleB=g.angle);var k=x,T=b;if(p&&(k=o.add(p.position,x)),g&&(T=o.add(g.position,b)),!(!k||!T)){var A=o.sub(k,T),E=o.magnitude(A);E<s._minLength&&(E=s._minLength);var C=(E-m.length)/E,_=m.stiffness>=1||m.length===0,w=_?m.stiffness*d:m.stiffness*d*d,N=m.damping*d,S=o.mult(A,C*w),R=(p?p.inverseMass:0)+(g?g.inverseMass:0),M=(p?p.inverseInertia:0)+(g?g.inverseInertia:0),O=R+M,L,I,j,U,B;if(N>0){var W=o.create();j=o.div(A,E),B=o.sub(g&&o.sub(g.position,g.positionPrev)||W,p&&o.sub(p.position,p.positionPrev)||W),U=o.dot(j,B)}p&&!p.isStatic&&(I=p.inverseMass/R,p.constraintImpulse.x-=S.x*I,p.constraintImpulse.y-=S.y*I,p.position.x-=S.x*I,p.position.y-=S.y*I,N>0&&(p.positionPrev.x-=N*j.x*U*I,p.positionPrev.y-=N*j.y*U*I),L=o.cross(x,S)/O*s._torqueDampen*p.inverseInertia*(1-m.angularStiffness),p.constraintImpulse.angle-=L,p.angle-=L),g&&!g.isStatic&&(I=g.inverseMass/R,g.constraintImpulse.x+=S.x*I,g.constraintImpulse.y+=S.y*I,g.position.x+=S.x*I,g.position.y+=S.y*I,N>0&&(g.positionPrev.x+=N*j.x*U*I,g.positionPrev.y+=N*j.y*U*I),L=o.cross(b,S)/O*s._torqueDampen*g.inverseInertia*(1-m.angularStiffness),g.constraintImpulse.angle+=L,g.angle+=L)}}},s.postSolveAll=function(m){for(var d=0;d<m.length;d++){var p=m[d],g=p.constraintImpulse;if(!(p.isStatic||g.x===0&&g.y===0&&g.angle===0)){l.set(p,!1);for(var x=0;x<p.parts.length;x++){var b=p.parts[x];a.translate(b.vertices,g),x>0&&(b.position.x+=g.x,b.position.y+=g.y),g.angle!==0&&(a.rotate(b.vertices,g.angle,p.position),h.rotate(b.axes,g.angle),x>0&&o.rotateAbout(b.position,g.angle,p.position,b.position)),c.update(b.bounds,b.vertices,p.velocity)}g.angle*=s._warming,g.x*=s._warming,g.y*=s._warming}}},s.pointAWorld=function(m){return{x:(m.bodyA?m.bodyA.position.x:0)+(m.pointA?m.pointA.x:0),y:(m.bodyA?m.bodyA.position.y:0)+(m.pointA?m.pointA.y:0)}},s.pointBWorld=function(m){return{x:(m.bodyB?m.bodyB.position.x:0)+(m.pointB?m.pointB.x:0),y:(m.bodyB?m.bodyB.position.y:0)+(m.pointB?m.pointB.y:0)}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(2),o=i(0);(function(){s.fromVertices=function(l){for(var c={},h=0;h<l.length;h++){var f=(h+1)%l.length,m=a.normalise({x:l[f].y-l[h].y,y:l[h].x-l[f].x}),d=m.y===0?1/0:m.x/m.y;d=d.toFixed(3).toString(),c[d]=m}return o.values(c)},s.rotate=function(l,c){if(c!==0)for(var h=Math.cos(c),f=Math.sin(c),m=0;m<l.length;m++){var d=l[m],p;p=d.x*h-d.y*f,d.y=d.x*f+d.y*h,d.x=p}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(3),o=i(0),l=i(4),c=i(1),h=i(2);(function(){s.rectangle=function(f,m,d,p,g){g=g||{};var x={label:"Rectangle Body",position:{x:f,y:m},vertices:a.fromPath("L 0 0 L "+d+" 0 L "+d+" "+p+" L 0 "+p)};if(g.chamfer){var b=g.chamfer;x.vertices=a.chamfer(x.vertices,b.radius,b.quality,b.qualityMin,b.qualityMax),delete g.chamfer}return l.create(o.extend({},x,g))},s.trapezoid=function(f,m,d,p,g,x){x=x||{},g*=.5;var b=(1-g*2)*d,k=d*g,T=k+b,A=T+k,E;g<.5?E="L 0 0 L "+k+" "+-p+" L "+T+" "+-p+" L "+A+" 0":E="L 0 0 L "+T+" "+-p+" L "+A+" 0";var C={label:"Trapezoid Body",position:{x:f,y:m},vertices:a.fromPath(E)};if(x.chamfer){var _=x.chamfer;C.vertices=a.chamfer(C.vertices,_.radius,_.quality,_.qualityMin,_.qualityMax),delete x.chamfer}return l.create(o.extend({},C,x))},s.circle=function(f,m,d,p,g){p=p||{};var x={label:"Circle Body",circleRadius:d};g=g||25;var b=Math.ceil(Math.max(10,Math.min(g,d)));return b%2===1&&(b+=1),s.polygon(f,m,b,d,o.extend({},x,p))},s.polygon=function(f,m,d,p,g){if(g=g||{},d<3)return s.circle(f,m,p,g);for(var x=2*Math.PI/d,b="",k=x*.5,T=0;T<d;T+=1){var A=k+T*x,E=Math.cos(A)*p,C=Math.sin(A)*p;b+="L "+E.toFixed(3)+" "+C.toFixed(3)+" "}var _={label:"Polygon Body",position:{x:f,y:m},vertices:a.fromPath(b)};if(g.chamfer){var w=g.chamfer;_.vertices=a.chamfer(_.vertices,w.radius,w.quality,w.qualityMin,w.qualityMax),delete g.chamfer}return l.create(o.extend({},_,g))},s.fromVertices=function(f,m,d,p,g,x,b,k){var T=o.getDecomp(),A,E,C,_,w,N,S,R,M,O,L;for(A=!!(T&&T.quickDecomp),p=p||{},C=[],g=typeof g<"u"?g:!1,x=typeof x<"u"?x:.01,b=typeof b<"u"?b:10,k=typeof k<"u"?k:.01,o.isArray(d[0])||(d=[d]),O=0;O<d.length;O+=1)if(N=d[O],_=a.isConvex(N),w=!_,w&&!A&&o.warnOnce("Bodies.fromVertices: Install the 'poly-decomp' library and use Common.setDecomp or provide 'decomp' as a global to decompose concave vertices."),_||!A)_?N=a.clockwiseSort(N):N=a.hull(N),C.push({position:{x:f,y:m},vertices:N});else{var I=N.map(function($){return[$.x,$.y]});T.makeCCW(I),x!==!1&&T.removeCollinearPoints(I,x),k!==!1&&T.removeDuplicatePoints&&T.removeDuplicatePoints(I,k);var j=T.quickDecomp(I);for(S=0;S<j.length;S++){var U=j[S],B=U.map(function($){return{x:$[0],y:$[1]}});b>0&&a.area(B)<b||C.push({position:a.centre(B),vertices:B})}}for(S=0;S<C.length;S++)C[S]=l.create(o.extend(C[S],p));if(g){var W=5;for(S=0;S<C.length;S++){var D=C[S];for(R=S+1;R<C.length;R++){var q=C[R];if(c.overlaps(D.bounds,q.bounds)){var Z=D.vertices,P=q.vertices;for(M=0;M<D.vertices.length;M++)for(L=0;L<q.vertices.length;L++){var K=h.magnitudeSquared(h.sub(Z[(M+1)%Z.length],P[L])),V=h.magnitudeSquared(h.sub(Z[M],P[(L+1)%P.length]));K<W&&V<W&&(Z[M].isInternal=!0,P[L].isInternal=!0)}}}}}return C.length>1?(E=l.create(o.extend({parts:C.slice(0)},p)),l.setPosition(E,{x:f,y:m}),E):C[0]}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(0),o=i(8);(function(){s.create=function(l){var c={bodies:[],pairs:null};return a.extend(c,l)},s.setBodies=function(l,c){l.bodies=c.slice(0)},s.clear=function(l){l.bodies=[]},s.collisions=function(l){var c=[],h=l.pairs,f=l.bodies,m=f.length,d=s.canCollide,p=o.collides,g,x;for(f.sort(s._compareBoundsX),g=0;g<m;g++){var b=f[g],k=b.bounds,T=b.bounds.max.x,A=b.bounds.max.y,E=b.bounds.min.y,C=b.isStatic||b.isSleeping,_=b.parts.length,w=_===1;for(x=g+1;x<m;x++){var N=f[x],S=N.bounds;if(S.min.x>T)break;if(!(A<S.min.y||E>S.max.y)&&!(C&&(N.isStatic||N.isSleeping))&&d(b.collisionFilter,N.collisionFilter)){var R=N.parts.length;if(w&&R===1){var M=p(b,N,h);M&&c.push(M)}else for(var O=_>1?1:0,L=R>1?1:0,I=O;I<_;I++)for(var j=b.parts[I],k=j.bounds,U=L;U<R;U++){var B=N.parts[U],S=B.bounds;if(!(k.min.x>S.max.x||k.max.x<S.min.x||k.max.y<S.min.y||k.min.y>S.max.y)){var M=p(j,B,h);M&&c.push(M)}}}}}return c},s.canCollide=function(l,c){return l.group===c.group&&l.group!==0?l.group>0:(l.mask&c.category)!==0&&(c.mask&l.category)!==0},s._compareBoundsX=function(l,c){return l.bounds.min.x-c.bounds.min.x}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(0);(function(){s.create=function(o){var l={};return o||a.log("Mouse.create: element was undefined, defaulting to document.body","warn"),l.element=o||document.body,l.absolute={x:0,y:0},l.position={x:0,y:0},l.mousedownPosition={x:0,y:0},l.mouseupPosition={x:0,y:0},l.offset={x:0,y:0},l.scale={x:1,y:1},l.wheelDelta=0,l.button=-1,l.pixelRatio=parseInt(l.element.getAttribute("data-pixel-ratio"),10)||1,l.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},l.mousemove=function(c){var h=s._getRelativeMousePosition(c,l.element,l.pixelRatio),f=c.changedTouches;f&&(l.button=0,c.preventDefault()),l.absolute.x=h.x,l.absolute.y=h.y,l.position.x=l.absolute.x*l.scale.x+l.offset.x,l.position.y=l.absolute.y*l.scale.y+l.offset.y,l.sourceEvents.mousemove=c},l.mousedown=function(c){var h=s._getRelativeMousePosition(c,l.element,l.pixelRatio),f=c.changedTouches;f?(l.button=0,c.preventDefault()):l.button=c.button,l.absolute.x=h.x,l.absolute.y=h.y,l.position.x=l.absolute.x*l.scale.x+l.offset.x,l.position.y=l.absolute.y*l.scale.y+l.offset.y,l.mousedownPosition.x=l.position.x,l.mousedownPosition.y=l.position.y,l.sourceEvents.mousedown=c},l.mouseup=function(c){var h=s._getRelativeMousePosition(c,l.element,l.pixelRatio),f=c.changedTouches;f&&c.preventDefault(),l.button=-1,l.absolute.x=h.x,l.absolute.y=h.y,l.position.x=l.absolute.x*l.scale.x+l.offset.x,l.position.y=l.absolute.y*l.scale.y+l.offset.y,l.mouseupPosition.x=l.position.x,l.mouseupPosition.y=l.position.y,l.sourceEvents.mouseup=c},l.mousewheel=function(c){l.wheelDelta=Math.max(-1,Math.min(1,c.wheelDelta||-c.detail)),c.preventDefault()},s.setElement(l,l.element),l},s.setElement=function(o,l){o.element=l,l.addEventListener("mousemove",o.mousemove),l.addEventListener("mousedown",o.mousedown),l.addEventListener("mouseup",o.mouseup),l.addEventListener("mousewheel",o.mousewheel),l.addEventListener("DOMMouseScroll",o.mousewheel),l.addEventListener("touchmove",o.mousemove),l.addEventListener("touchstart",o.mousedown),l.addEventListener("touchend",o.mouseup)},s.clearSourceEvents=function(o){o.sourceEvents.mousemove=null,o.sourceEvents.mousedown=null,o.sourceEvents.mouseup=null,o.sourceEvents.mousewheel=null,o.wheelDelta=0},s.setOffset=function(o,l){o.offset.x=l.x,o.offset.y=l.y,o.position.x=o.absolute.x*o.scale.x+o.offset.x,o.position.y=o.absolute.y*o.scale.y+o.offset.y},s.setScale=function(o,l){o.scale.x=l.x,o.scale.y=l.y,o.position.x=o.absolute.x*o.scale.x+o.offset.x,o.position.y=o.absolute.y*o.scale.y+o.offset.y},s._getRelativeMousePosition=function(o,l,c){var h=l.getBoundingClientRect(),f=document.documentElement||document.body.parentNode||document.body,m=window.pageXOffset!==void 0?window.pageXOffset:f.scrollLeft,d=window.pageYOffset!==void 0?window.pageYOffset:f.scrollTop,p=o.changedTouches,g,x;return p?(g=p[0].pageX-h.left-m,x=p[0].pageY-h.top-d):(g=o.pageX-h.left-m,x=o.pageY-h.top-d),{x:g/(l.clientWidth/(l.width||l.clientWidth)*c),y:x/(l.clientHeight/(l.height||l.clientHeight)*c)}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(0);(function(){s._registry={},s.register=function(o){if(s.isPlugin(o)||a.warn("Plugin.register:",s.toString(o),"does not implement all required fields."),o.name in s._registry){var l=s._registry[o.name],c=s.versionParse(o.version).number,h=s.versionParse(l.version).number;c>h?(a.warn("Plugin.register:",s.toString(l),"was upgraded to",s.toString(o)),s._registry[o.name]=o):c<h?a.warn("Plugin.register:",s.toString(l),"can not be downgraded to",s.toString(o)):o!==l&&a.warn("Plugin.register:",s.toString(o),"is already registered to different plugin object")}else s._registry[o.name]=o;return o},s.resolve=function(o){return s._registry[s.dependencyParse(o).name]},s.toString=function(o){return typeof o=="string"?o:(o.name||"anonymous")+"@"+(o.version||o.range||"0.0.0")},s.isPlugin=function(o){return o&&o.name&&o.version&&o.install},s.isUsed=function(o,l){return o.used.indexOf(l)>-1},s.isFor=function(o,l){var c=o.for&&s.dependencyParse(o.for);return!o.for||l.name===c.name&&s.versionSatisfies(l.version,c.range)},s.use=function(o,l){if(o.uses=(o.uses||[]).concat(l||[]),o.uses.length===0){a.warn("Plugin.use:",s.toString(o),"does not specify any dependencies to install.");return}for(var c=s.dependencies(o),h=a.topologicalSort(c),f=[],m=0;m<h.length;m+=1)if(h[m]!==o.name){var d=s.resolve(h[m]);if(!d){f.push("❌ "+h[m]);continue}s.isUsed(o,d.name)||(s.isFor(d,o)||(a.warn("Plugin.use:",s.toString(d),"is for",d.for,"but installed on",s.toString(o)+"."),d._warned=!0),d.install?d.install(o):(a.warn("Plugin.use:",s.toString(d),"does not specify an install function."),d._warned=!0),d._warned?(f.push("🔶 "+s.toString(d)),delete d._warned):f.push("✅ "+s.toString(d)),o.used.push(d.name))}f.length>0&&a.info(f.join(" "))},s.dependencies=function(o,l){var c=s.dependencyParse(o),h=c.name;if(l=l||{},!(h in l)){o=s.resolve(o)||o,l[h]=a.map(o.uses||[],function(m){s.isPlugin(m)&&s.register(m);var d=s.dependencyParse(m),p=s.resolve(m);return p&&!s.versionSatisfies(p.version,d.range)?(a.warn("Plugin.dependencies:",s.toString(p),"does not satisfy",s.toString(d),"used by",s.toString(c)+"."),p._warned=!0,o._warned=!0):p||(a.warn("Plugin.dependencies:",s.toString(m),"used by",s.toString(c),"could not be resolved."),o._warned=!0),d.name});for(var f=0;f<l[h].length;f+=1)s.dependencies(l[h][f],l);return l}},s.dependencyParse=function(o){if(a.isString(o)){var l=/^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-+]+)?))?$/;return l.test(o)||a.warn("Plugin.dependencyParse:",o,"is not a valid dependency string."),{name:o.split("@")[0],range:o.split("@")[1]||"*"}}return{name:o.name,range:o.range||o.version}},s.versionParse=function(o){var l=/^(\*)|(\^|~|>=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;l.test(o)||a.warn("Plugin.versionParse:",o,"is not a valid version or range.");var c=l.exec(o),h=Number(c[4]),f=Number(c[5]),m=Number(c[6]);return{isRange:!!(c[1]||c[2]),version:c[3],range:o,operator:c[1]||c[2]||"",major:h,minor:f,patch:m,parts:[h,f,m],prerelease:c[7],number:h*1e8+f*1e4+m}},s.versionSatisfies=function(o,l){l=l||"*";var c=s.versionParse(l),h=s.versionParse(o);if(c.isRange){if(c.operator==="*"||o==="*")return!0;if(c.operator===">")return h.number>c.number;if(c.operator===">=")return h.number>=c.number;if(c.operator==="~")return h.major===c.major&&h.minor===c.minor&&h.patch>=c.patch;if(c.operator==="^")return c.major>0?h.major===c.major&&h.number>=c.number:c.minor>0?h.minor===c.minor&&h.patch>=c.patch:h.patch===c.patch}return o===l||o==="*"}})()}),(function(n,r){var i={};n.exports=i,(function(){i.create=function(s){return{vertex:s,normalImpulse:0,tangentImpulse:0}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(7),o=i(18),l=i(13),c=i(19),h=i(5),f=i(6),m=i(10),d=i(0),p=i(4);(function(){s.create=function(g){g=g||{};var x={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},b=d.extend(x,g);return b.world=g.world||f.create({label:"World"}),b.pairs=g.pairs||c.create(),b.detector=g.detector||l.create(),b.grid={buckets:[]},b.world.gravity=b.gravity,b.broadphase=b.grid,b.metrics={},b},s.update=function(g,x){var b=d.now(),k=g.world,T=g.detector,A=g.pairs,E=g.timing,C=E.timestamp,_;x=typeof x<"u"?x:d._baseDelta,x*=E.timeScale,E.timestamp+=x,E.lastDelta=x;var w={timestamp:E.timestamp,delta:x};h.trigger(g,"beforeUpdate",w);var N=f.allBodies(k),S=f.allConstraints(k);for(k.isModified&&(l.setBodies(T,N),f.setModified(k,!1,!1,!0)),g.enableSleeping&&a.update(N,x),s._bodiesApplyGravity(N,g.gravity),x>0&&s._bodiesUpdate(N,x),m.preSolveAll(N),_=0;_<g.constraintIterations;_++)m.solveAll(S,x);m.postSolveAll(N),T.pairs=g.pairs;var R=l.collisions(T);c.update(A,R,C),g.enableSleeping&&a.afterCollisions(A.list),A.collisionStart.length>0&&h.trigger(g,"collisionStart",{pairs:A.collisionStart});var M=d.clamp(20/g.positionIterations,0,1);for(o.preSolvePosition(A.list),_=0;_<g.positionIterations;_++)o.solvePosition(A.list,x,M);for(o.postSolvePosition(N),m.preSolveAll(N),_=0;_<g.constraintIterations;_++)m.solveAll(S,x);for(m.postSolveAll(N),o.preSolveVelocity(A.list),_=0;_<g.velocityIterations;_++)o.solveVelocity(A.list,x);return s._bodiesUpdateVelocities(N),A.collisionActive.length>0&&h.trigger(g,"collisionActive",{pairs:A.collisionActive}),A.collisionEnd.length>0&&h.trigger(g,"collisionEnd",{pairs:A.collisionEnd}),s._bodiesClearForces(N),h.trigger(g,"afterUpdate",w),g.timing.lastElapsed=d.now()-b,g},s.merge=function(g,x){if(d.extend(g,x),x.world){g.world=x.world,s.clear(g);for(var b=f.allBodies(g.world),k=0;k<b.length;k++){var T=b[k];a.set(T,!1),T.id=d.nextId()}}},s.clear=function(g){c.clear(g.pairs),l.clear(g.detector)},s._bodiesClearForces=function(g){for(var x=g.length,b=0;b<x;b++){var k=g[b];k.force.x=0,k.force.y=0,k.torque=0}},s._bodiesApplyGravity=function(g,x){var b=typeof x.scale<"u"?x.scale:.001,k=g.length;if(!(x.x===0&&x.y===0||b===0))for(var T=0;T<k;T++){var A=g[T];A.isStatic||A.isSleeping||(A.force.y+=A.mass*x.y*b,A.force.x+=A.mass*x.x*b)}},s._bodiesUpdate=function(g,x){for(var b=g.length,k=0;k<b;k++){var T=g[k];T.isStatic||T.isSleeping||p.update(T,x)}},s._bodiesUpdateVelocities=function(g){for(var x=g.length,b=0;b<x;b++)p.updateVelocities(g[b])}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(3),o=i(0),l=i(1);(function(){s._restingThresh=2,s._restingThreshTangent=Math.sqrt(6),s._positionDampen=.9,s._positionWarming=.8,s._frictionNormalMultiplier=5,s._frictionMaxStatic=Number.MAX_VALUE,s.preSolvePosition=function(c){var h,f,m,d=c.length;for(h=0;h<d;h++)f=c[h],f.isActive&&(m=f.activeContacts.length,f.collision.parentA.totalContacts+=m,f.collision.parentB.totalContacts+=m)},s.solvePosition=function(c,h,f){var m,d,p,g,x,b,k,T,A=s._positionDampen*(f||1),E=o.clamp(h/o._baseDelta,0,1),C=c.length;for(m=0;m<C;m++)d=c[m],!(!d.isActive||d.isSensor)&&(p=d.collision,g=p.parentA,x=p.parentB,b=p.normal,d.separation=b.x*(x.positionImpulse.x+p.penetration.x-g.positionImpulse.x)+b.y*(x.positionImpulse.y+p.penetration.y-g.positionImpulse.y));for(m=0;m<C;m++)d=c[m],!(!d.isActive||d.isSensor)&&(p=d.collision,g=p.parentA,x=p.parentB,b=p.normal,T=d.separation-d.slop*E,(g.isStatic||x.isStatic)&&(T*=2),g.isStatic||g.isSleeping||(k=A/g.totalContacts,g.positionImpulse.x+=b.x*T*k,g.positionImpulse.y+=b.y*T*k),x.isStatic||x.isSleeping||(k=A/x.totalContacts,x.positionImpulse.x-=b.x*T*k,x.positionImpulse.y-=b.y*T*k))},s.postSolvePosition=function(c){for(var h=s._positionWarming,f=c.length,m=a.translate,d=l.update,p=0;p<f;p++){var g=c[p],x=g.positionImpulse,b=x.x,k=x.y,T=g.velocity;if(g.totalContacts=0,b!==0||k!==0){for(var A=0;A<g.parts.length;A++){var E=g.parts[A];m(E.vertices,x),d(E.bounds,E.vertices,T),E.position.x+=b,E.position.y+=k}g.positionPrev.x+=b,g.positionPrev.y+=k,b*T.x+k*T.y<0?(x.x=0,x.y=0):(x.x*=h,x.y*=h)}}},s.preSolveVelocity=function(c){var h=c.length,f,m;for(f=0;f<h;f++){var d=c[f];if(!(!d.isActive||d.isSensor)){var p=d.activeContacts,g=p.length,x=d.collision,b=x.parentA,k=x.parentB,T=x.normal,A=x.tangent;for(m=0;m<g;m++){var E=p[m],C=E.vertex,_=E.normalImpulse,w=E.tangentImpulse;if(_!==0||w!==0){var N=T.x*_+A.x*w,S=T.y*_+A.y*w;b.isStatic||b.isSleeping||(b.positionPrev.x+=N*b.inverseMass,b.positionPrev.y+=S*b.inverseMass,b.anglePrev+=b.inverseInertia*((C.x-b.position.x)*S-(C.y-b.position.y)*N)),k.isStatic||k.isSleeping||(k.positionPrev.x-=N*k.inverseMass,k.positionPrev.y-=S*k.inverseMass,k.anglePrev-=k.inverseInertia*((C.x-k.position.x)*S-(C.y-k.position.y)*N))}}}}},s.solveVelocity=function(c,h){var f=h/o._baseDelta,m=f*f,d=m*f,p=-s._restingThresh*f,g=s._restingThreshTangent,x=s._frictionNormalMultiplier*f,b=s._frictionMaxStatic,k=c.length,T,A,E,C;for(E=0;E<k;E++){var _=c[E];if(!(!_.isActive||_.isSensor)){var w=_.collision,N=w.parentA,S=w.parentB,R=N.velocity,M=S.velocity,O=w.normal.x,L=w.normal.y,I=w.tangent.x,j=w.tangent.y,U=_.activeContacts,B=U.length,W=1/B,D=N.inverseMass+S.inverseMass,q=_.friction*_.frictionStatic*x;for(R.x=N.position.x-N.positionPrev.x,R.y=N.position.y-N.positionPrev.y,M.x=S.position.x-S.positionPrev.x,M.y=S.position.y-S.positionPrev.y,N.angularVelocity=N.angle-N.anglePrev,S.angularVelocity=S.angle-S.anglePrev,C=0;C<B;C++){var Z=U[C],P=Z.vertex,K=P.x-N.position.x,V=P.y-N.position.y,$=P.x-S.position.x,ae=P.y-S.position.y,ne=R.x-V*N.angularVelocity,Y=R.y+K*N.angularVelocity,ye=M.x-ae*S.angularVelocity,re=M.y+$*S.angularVelocity,ie=ne-ye,le=Y-re,xe=O*ie+L*le,ke=I*ie+j*le,ze=_.separation+xe,Te=Math.min(ze,1);Te=ze<0?0:Te;var Ge=Te*q;ke<-Ge||ke>Ge?(A=ke>0?ke:-ke,T=_.friction*(ke>0?1:-1)*d,T<-A?T=-A:T>A&&(T=A)):(T=ke,A=b);var oe=K*L-V*O,Ie=$*L-ae*O,We=W/(D+N.inverseInertia*oe*oe+S.inverseInertia*Ie*Ie),Ue=(1+_.restitution)*xe*We;if(T*=We,xe<p)Z.normalImpulse=0;else{var Xe=Z.normalImpulse;Z.normalImpulse+=Ue,Z.normalImpulse>0&&(Z.normalImpulse=0),Ue=Z.normalImpulse-Xe}if(ke<-g||ke>g)Z.tangentImpulse=0;else{var De=Z.tangentImpulse;Z.tangentImpulse+=T,Z.tangentImpulse<-A&&(Z.tangentImpulse=-A),Z.tangentImpulse>A&&(Z.tangentImpulse=A),T=Z.tangentImpulse-De}var we=O*Ue+I*T,ee=L*Ue+j*T;N.isStatic||N.isSleeping||(N.positionPrev.x+=we*N.inverseMass,N.positionPrev.y+=ee*N.inverseMass,N.anglePrev+=(K*ee-V*we)*N.inverseInertia),S.isStatic||S.isSleeping||(S.positionPrev.x-=we*S.inverseMass,S.positionPrev.y-=ee*S.inverseMass,S.anglePrev-=($*ee-ae*we)*S.inverseInertia)}}}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(9),o=i(0);(function(){s.create=function(l){return o.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},l)},s.update=function(l,c,h){var f=l.list,m=f.length,d=l.table,p=c.length,g=l.collisionStart,x=l.collisionEnd,b=l.collisionActive,k,T,A,E;for(g.length=0,x.length=0,b.length=0,E=0;E<m;E++)f[E].confirmedActive=!1;for(E=0;E<p;E++)k=c[E],A=k.pair,A?(A.isActive?b.push(A):g.push(A),a.update(A,k,h),A.confirmedActive=!0):(A=a.create(k,h),d[A.id]=A,g.push(A),f.push(A));var C=[];for(m=f.length,E=0;E<m;E++)A=f[E],A.confirmedActive||(a.setActive(A,!1,h),x.push(A),!A.collision.bodyA.isSleeping&&!A.collision.bodyB.isSleeping&&C.push(E));for(E=0;E<C.length;E++)T=C[E]-E,A=f[T],f.splice(T,1),delete d[A.id]},s.clear=function(l){return l.table={},l.list.length=0,l.collisionStart.length=0,l.collisionActive.length=0,l.collisionEnd.length=0,l}})()}),(function(n,r,i){var s=n.exports=i(21);s.Axes=i(11),s.Bodies=i(12),s.Body=i(4),s.Bounds=i(1),s.Collision=i(8),s.Common=i(0),s.Composite=i(6),s.Composites=i(22),s.Constraint=i(10),s.Contact=i(16),s.Detector=i(13),s.Engine=i(17),s.Events=i(5),s.Grid=i(23),s.Mouse=i(14),s.MouseConstraint=i(24),s.Pair=i(9),s.Pairs=i(19),s.Plugin=i(15),s.Query=i(25),s.Render=i(26),s.Resolver=i(18),s.Runner=i(27),s.SAT=i(28),s.Sleeping=i(7),s.Svg=i(29),s.Vector=i(2),s.Vertices=i(3),s.World=i(30),s.Engine.run=s.Runner.run,s.Common.deprecated(s.Engine,"run","Engine.run ➤ use Matter.Runner.run(engine) instead")}),(function(n,r,i){var s={};n.exports=s;var a=i(15),o=i(0);(function(){s.name="matter-js",s.version="0.19.0",s.uses=[],s.used=[],s.use=function(){a.use(s,Array.prototype.slice.call(arguments))},s.before=function(l,c){return l=l.replace(/^Matter./,""),o.chainPathBefore(s,l,c)},s.after=function(l,c){return l=l.replace(/^Matter./,""),o.chainPathAfter(s,l,c)}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(6),o=i(10),l=i(0),c=i(4),h=i(12),f=l.deprecated;(function(){s.stack=function(m,d,p,g,x,b,k){for(var T=a.create({label:"Stack"}),A=m,E=d,C,_=0,w=0;w<g;w++){for(var N=0,S=0;S<p;S++){var R=k(A,E,S,w,C,_);if(R){var M=R.bounds.max.y-R.bounds.min.y,O=R.bounds.max.x-R.bounds.min.x;M>N&&(N=M),c.translate(R,{x:O*.5,y:M*.5}),A=R.bounds.max.x+x,a.addBody(T,R),C=R,_+=1}else A+=x}E+=N+b,A=m}return T},s.chain=function(m,d,p,g,x,b){for(var k=m.bodies,T=1;T<k.length;T++){var A=k[T-1],E=k[T],C=A.bounds.max.y-A.bounds.min.y,_=A.bounds.max.x-A.bounds.min.x,w=E.bounds.max.y-E.bounds.min.y,N=E.bounds.max.x-E.bounds.min.x,S={bodyA:A,pointA:{x:_*d,y:C*p},bodyB:E,pointB:{x:N*g,y:w*x}},R=l.extend(S,b);a.addConstraint(m,o.create(R))}return m.label+=" Chain",m},s.mesh=function(m,d,p,g,x){var b=m.bodies,k,T,A,E,C;for(k=0;k<p;k++){for(T=1;T<d;T++)A=b[T-1+k*d],E=b[T+k*d],a.addConstraint(m,o.create(l.extend({bodyA:A,bodyB:E},x)));if(k>0)for(T=0;T<d;T++)A=b[T+(k-1)*d],E=b[T+k*d],a.addConstraint(m,o.create(l.extend({bodyA:A,bodyB:E},x))),g&&T>0&&(C=b[T-1+(k-1)*d],a.addConstraint(m,o.create(l.extend({bodyA:C,bodyB:E},x)))),g&&T<d-1&&(C=b[T+1+(k-1)*d],a.addConstraint(m,o.create(l.extend({bodyA:C,bodyB:E},x))))}return m.label+=" Mesh",m},s.pyramid=function(m,d,p,g,x,b,k){return s.stack(m,d,p,g,x,b,function(T,A,E,C,_,w){var N=Math.min(g,Math.ceil(p/2)),S=_?_.bounds.max.x-_.bounds.min.x:0;if(!(C>N)){C=N-C;var R=C,M=p-1-C;if(!(E<R||E>M)){w===1&&c.translate(_,{x:(E+(p%2===1?1:-1))*S,y:0});var O=_?E*S:0;return k(m+O+E*x,A,E,C,_,w)}}})},s.newtonsCradle=function(m,d,p,g,x){for(var b=a.create({label:"Newtons Cradle"}),k=0;k<p;k++){var T=1.9,A=h.circle(m+k*(g*T),d+x,g,{inertia:1/0,restitution:1,friction:0,frictionAir:1e-4,slop:1}),E=o.create({pointA:{x:m+k*(g*T),y:d},bodyB:A});a.addBody(b,A),a.addConstraint(b,E)}return b},f(s,"newtonsCradle","Composites.newtonsCradle ➤ moved to newtonsCradle example"),s.car=function(m,d,p,g,x){var b=c.nextGroup(!0),k=20,T=-p*.5+k,A=p*.5-k,E=0,C=a.create({label:"Car"}),_=h.rectangle(m,d,p,g,{collisionFilter:{group:b},chamfer:{radius:g*.5},density:2e-4}),w=h.circle(m+T,d+E,x,{collisionFilter:{group:b},friction:.8}),N=h.circle(m+A,d+E,x,{collisionFilter:{group:b},friction:.8}),S=o.create({bodyB:_,pointB:{x:T,y:E},bodyA:w,stiffness:1,length:0}),R=o.create({bodyB:_,pointB:{x:A,y:E},bodyA:N,stiffness:1,length:0});return a.addBody(C,_),a.addBody(C,w),a.addBody(C,N),a.addConstraint(C,S),a.addConstraint(C,R),C},f(s,"car","Composites.car ➤ moved to car example"),s.softBody=function(m,d,p,g,x,b,k,T,A,E){A=l.extend({inertia:1/0},A),E=l.extend({stiffness:.2,render:{type:"line",anchors:!1}},E);var C=s.stack(m,d,p,g,x,b,function(_,w){return h.circle(_,w,T,A)});return s.mesh(C,p,g,k,E),C.label="Soft Body",C},f(s,"softBody","Composites.softBody ➤ moved to softBody and cloth examples")})()}),(function(n,r,i){var s={};n.exports=s;var a=i(9),o=i(0),l=o.deprecated;(function(){s.create=function(c){var h={buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return o.extend(h,c)},s.update=function(c,h,f,m){var d,p,g,x=f.world,b=c.buckets,k,T,A=!1;for(d=0;d<h.length;d++){var E=h[d];if(!(E.isSleeping&&!m)&&!(x.bounds&&(E.bounds.max.x<x.bounds.min.x||E.bounds.min.x>x.bounds.max.x||E.bounds.max.y<x.bounds.min.y||E.bounds.min.y>x.bounds.max.y))){var C=s._getRegion(c,E);if(!E.region||C.id!==E.region.id||m){(!E.region||m)&&(E.region=C);var _=s._regionUnion(C,E.region);for(p=_.startCol;p<=_.endCol;p++)for(g=_.startRow;g<=_.endRow;g++){T=s._getBucketId(p,g),k=b[T];var w=p>=C.startCol&&p<=C.endCol&&g>=C.startRow&&g<=C.endRow,N=p>=E.region.startCol&&p<=E.region.endCol&&g>=E.region.startRow&&g<=E.region.endRow;!w&&N&&N&&k&&s._bucketRemoveBody(c,k,E),(E.region===C||w&&!N||m)&&(k||(k=s._createBucket(b,T)),s._bucketAddBody(c,k,E))}E.region=C,A=!0}}}A&&(c.pairsList=s._createActivePairsList(c))},l(s,"update","Grid.update ➤ replaced by Matter.Detector"),s.clear=function(c){c.buckets={},c.pairs={},c.pairsList=[]},l(s,"clear","Grid.clear ➤ replaced by Matter.Detector"),s._regionUnion=function(c,h){var f=Math.min(c.startCol,h.startCol),m=Math.max(c.endCol,h.endCol),d=Math.min(c.startRow,h.startRow),p=Math.max(c.endRow,h.endRow);return s._createRegion(f,m,d,p)},s._getRegion=function(c,h){var f=h.bounds,m=Math.floor(f.min.x/c.bucketWidth),d=Math.floor(f.max.x/c.bucketWidth),p=Math.floor(f.min.y/c.bucketHeight),g=Math.floor(f.max.y/c.bucketHeight);return s._createRegion(m,d,p,g)},s._createRegion=function(c,h,f,m){return{id:c+","+h+","+f+","+m,startCol:c,endCol:h,startRow:f,endRow:m}},s._getBucketId=function(c,h){return"C"+c+"R"+h},s._createBucket=function(c,h){var f=c[h]=[];return f},s._bucketAddBody=function(c,h,f){var m=c.pairs,d=a.id,p=h.length,g;for(g=0;g<p;g++){var x=h[g];if(!(f.id===x.id||f.isStatic&&x.isStatic)){var b=d(f,x),k=m[b];k?k[2]+=1:m[b]=[f,x,1]}}h.push(f)},s._bucketRemoveBody=function(c,h,f){var m=c.pairs,d=a.id,p;h.splice(o.indexOf(h,f),1);var g=h.length;for(p=0;p<g;p++){var x=m[d(f,h[p])];x&&(x[2]-=1)}},s._createActivePairsList=function(c){var h,f=c.pairs,m=o.keys(f),d=m.length,p=[],g;for(g=0;g<d;g++)h=f[m[g]],h[2]>0?p.push(h):delete f[m[g]];return p}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(3),o=i(7),l=i(14),c=i(5),h=i(13),f=i(10),m=i(6),d=i(0),p=i(1);(function(){s.create=function(g,x){var b=(g?g.mouse:null)||(x?x.mouse:null);b||(g&&g.render&&g.render.canvas?b=l.create(g.render.canvas):x&&x.element?b=l.create(x.element):(b=l.create(),d.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var k=f.create({label:"Mouse Constraint",pointA:b.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),T={type:"mouseConstraint",mouse:b,element:null,body:null,constraint:k,collisionFilter:{category:1,mask:4294967295,group:0}},A=d.extend(T,x);return c.on(g,"beforeUpdate",function(){var E=m.allBodies(g.world);s.update(A,E),s._triggerEvents(A)}),A},s.update=function(g,x){var b=g.mouse,k=g.constraint,T=g.body;if(b.button===0){if(k.bodyB)o.set(k.bodyB,!1),k.pointA=b.position;else for(var A=0;A<x.length;A++)if(T=x[A],p.contains(T.bounds,b.position)&&h.canCollide(T.collisionFilter,g.collisionFilter))for(var E=T.parts.length>1?1:0;E<T.parts.length;E++){var C=T.parts[E];if(a.contains(C.vertices,b.position)){k.pointA=b.position,k.bodyB=g.body=T,k.pointB={x:b.position.x-T.position.x,y:b.position.y-T.position.y},k.angleB=T.angle,o.set(T,!1),c.trigger(g,"startdrag",{mouse:b,body:T});break}}}else k.bodyB=g.body=null,k.pointB=null,T&&c.trigger(g,"enddrag",{mouse:b,body:T})},s._triggerEvents=function(g){var x=g.mouse,b=x.sourceEvents;b.mousemove&&c.trigger(g,"mousemove",{mouse:x}),b.mousedown&&c.trigger(g,"mousedown",{mouse:x}),b.mouseup&&c.trigger(g,"mouseup",{mouse:x}),l.clearSourceEvents(x)}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(2),o=i(8),l=i(1),c=i(12),h=i(3);(function(){s.collides=function(f,m){for(var d=[],p=m.length,g=f.bounds,x=o.collides,b=l.overlaps,k=0;k<p;k++){var T=m[k],A=T.parts.length,E=A===1?0:1;if(b(T.bounds,g))for(var C=E;C<A;C++){var _=T.parts[C];if(b(_.bounds,g)){var w=x(_,f);if(w){d.push(w);break}}}}return d},s.ray=function(f,m,d,p){p=p||1e-100;for(var g=a.angle(m,d),x=a.magnitude(a.sub(m,d)),b=(d.x+m.x)*.5,k=(d.y+m.y)*.5,T=c.rectangle(b,k,x,p,{angle:g}),A=s.collides(T,f),E=0;E<A.length;E+=1){var C=A[E];C.body=C.bodyB=C.bodyA}return A},s.region=function(f,m,d){for(var p=[],g=0;g<f.length;g++){var x=f[g],b=l.overlaps(x.bounds,m);(b&&!d||!b&&d)&&p.push(x)}return p},s.point=function(f,m){for(var d=[],p=0;p<f.length;p++){var g=f[p];if(l.contains(g.bounds,m))for(var x=g.parts.length===1?0:1;x<g.parts.length;x++){var b=g.parts[x];if(l.contains(b.bounds,m)&&h.contains(b.vertices,m)){d.push(g);break}}}return d}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(4),o=i(0),l=i(6),c=i(1),h=i(5),f=i(2),m=i(14);(function(){var d,p;typeof window<"u"&&(d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(E){window.setTimeout(function(){E(o.now())},1e3/60)},p=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),s._goodFps=30,s._goodDelta=1e3/60,s.create=function(E){var C={engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,timing:{historySize:60,delta:0,deltaHistory:[],lastTime:0,lastTimestamp:0,lastElapsed:0,timestampElapsed:0,timestampElapsedHistory:[],engineDeltaHistory:[],engineElapsedHistory:[],elapsedHistory:[]},options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",hasBounds:!!E.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showStats:!1,showPerformance:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},_=o.extend(C,E);return _.canvas&&(_.canvas.width=_.options.width||_.canvas.width,_.canvas.height=_.options.height||_.canvas.height),_.mouse=E.mouse,_.engine=E.engine,_.canvas=_.canvas||b(_.options.width,_.options.height),_.context=_.canvas.getContext("2d"),_.textures={},_.bounds=_.bounds||{min:{x:0,y:0},max:{x:_.canvas.width,y:_.canvas.height}},_.controller=s,_.options.showBroadphase=!1,_.options.pixelRatio!==1&&s.setPixelRatio(_,_.options.pixelRatio),o.isElement(_.element)&&_.element.appendChild(_.canvas),_},s.run=function(E){(function C(_){E.frameRequestId=d(C),g(E,_),s.world(E,_),(E.options.showStats||E.options.showDebug)&&s.stats(E,E.context,_),(E.options.showPerformance||E.options.showDebug)&&s.performance(E,E.context,_)})()},s.stop=function(E){p(E.frameRequestId)},s.setPixelRatio=function(E,C){var _=E.options,w=E.canvas;C==="auto"&&(C=k(w)),_.pixelRatio=C,w.setAttribute("data-pixel-ratio",C),w.width=_.width*C,w.height=_.height*C,w.style.width=_.width+"px",w.style.height=_.height+"px"},s.lookAt=function(E,C,_,w){w=typeof w<"u"?w:!0,C=o.isArray(C)?C:[C],_=_||{x:0,y:0};for(var N={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},S=0;S<C.length;S+=1){var R=C[S],M=R.bounds?R.bounds.min:R.min||R.position||R,O=R.bounds?R.bounds.max:R.max||R.position||R;M&&O&&(M.x<N.min.x&&(N.min.x=M.x),O.x>N.max.x&&(N.max.x=O.x),M.y<N.min.y&&(N.min.y=M.y),O.y>N.max.y&&(N.max.y=O.y))}var L=N.max.x-N.min.x+2*_.x,I=N.max.y-N.min.y+2*_.y,j=E.canvas.height,U=E.canvas.width,B=U/j,W=L/I,D=1,q=1;W>B?q=W/B:D=B/W,E.options.hasBounds=!0,E.bounds.min.x=N.min.x,E.bounds.max.x=N.min.x+L*D,E.bounds.min.y=N.min.y,E.bounds.max.y=N.min.y+I*q,w&&(E.bounds.min.x+=L*.5-L*D*.5,E.bounds.max.x+=L*.5-L*D*.5,E.bounds.min.y+=I*.5-I*q*.5,E.bounds.max.y+=I*.5-I*q*.5),E.bounds.min.x-=_.x,E.bounds.max.x-=_.x,E.bounds.min.y-=_.y,E.bounds.max.y-=_.y,E.mouse&&(m.setScale(E.mouse,{x:(E.bounds.max.x-E.bounds.min.x)/E.canvas.width,y:(E.bounds.max.y-E.bounds.min.y)/E.canvas.height}),m.setOffset(E.mouse,E.bounds.min))},s.startViewTransform=function(E){var C=E.bounds.max.x-E.bounds.min.x,_=E.bounds.max.y-E.bounds.min.y,w=C/E.options.width,N=_/E.options.height;E.context.setTransform(E.options.pixelRatio/w,0,0,E.options.pixelRatio/N,0,0),E.context.translate(-E.bounds.min.x,-E.bounds.min.y)},s.endViewTransform=function(E){E.context.setTransform(E.options.pixelRatio,0,0,E.options.pixelRatio,0,0)},s.world=function(E,C){var _=o.now(),w=E.engine,N=w.world,S=E.canvas,R=E.context,M=E.options,O=E.timing,L=l.allBodies(N),I=l.allConstraints(N),j=M.wireframes?M.wireframeBackground:M.background,U=[],B=[],W,D={timestamp:w.timing.timestamp};if(h.trigger(E,"beforeRender",D),E.currentBackground!==j&&A(E,j),R.globalCompositeOperation="source-in",R.fillStyle="transparent",R.fillRect(0,0,S.width,S.height),R.globalCompositeOperation="source-over",M.hasBounds){for(W=0;W<L.length;W++){var q=L[W];c.overlaps(q.bounds,E.bounds)&&U.push(q)}for(W=0;W<I.length;W++){var Z=I[W],P=Z.bodyA,K=Z.bodyB,V=Z.pointA,$=Z.pointB;P&&(V=f.add(P.position,Z.pointA)),K&&($=f.add(K.position,Z.pointB)),!(!V||!$)&&(c.contains(E.bounds,V)||c.contains(E.bounds,$))&&B.push(Z)}s.startViewTransform(E),E.mouse&&(m.setScale(E.mouse,{x:(E.bounds.max.x-E.bounds.min.x)/E.options.width,y:(E.bounds.max.y-E.bounds.min.y)/E.options.height}),m.setOffset(E.mouse,E.bounds.min))}else B=I,U=L,E.options.pixelRatio!==1&&E.context.setTransform(E.options.pixelRatio,0,0,E.options.pixelRatio,0,0);!M.wireframes||w.enableSleeping&&M.showSleeping?s.bodies(E,U,R):(M.showConvexHulls&&s.bodyConvexHulls(E,U,R),s.bodyWireframes(E,U,R)),M.showBounds&&s.bodyBounds(E,U,R),(M.showAxes||M.showAngleIndicator)&&s.bodyAxes(E,U,R),M.showPositions&&s.bodyPositions(E,U,R),M.showVelocity&&s.bodyVelocity(E,U,R),M.showIds&&s.bodyIds(E,U,R),M.showSeparations&&s.separations(E,w.pairs.list,R),M.showCollisions&&s.collisions(E,w.pairs.list,R),M.showVertexNumbers&&s.vertexNumbers(E,U,R),M.showMousePosition&&s.mousePosition(E,E.mouse,R),s.constraints(B,R),M.hasBounds&&s.endViewTransform(E),h.trigger(E,"afterRender",D),O.lastElapsed=o.now()-_},s.stats=function(E,C,_){for(var w=E.engine,N=w.world,S=l.allBodies(N),R=0,M=55,O=44,L=0,I=0,j=0;j<S.length;j+=1)R+=S[j].parts.length;var U={Part:R,Body:S.length,Cons:l.allConstraints(N).length,Comp:l.allComposites(N).length,Pair:w.pairs.list.length};C.fillStyle="#0e0f19",C.fillRect(L,I,M*5.5,O),C.font="12px Arial",C.textBaseline="top",C.textAlign="right";for(var B in U){var W=U[B];C.fillStyle="#aaa",C.fillText(B,L+M,I+8),C.fillStyle="#eee",C.fillText(W,L+M,I+26),L+=M}},s.performance=function(E,C){var _=E.engine,w=E.timing,N=w.deltaHistory,S=w.elapsedHistory,R=w.timestampElapsedHistory,M=w.engineDeltaHistory,O=w.engineElapsedHistory,L=_.timing.lastDelta,I=x(N),j=x(S),U=x(M),B=x(O),W=x(R),D=W/I||0,q=1e3/I||0,Z=4,P=12,K=60,V=34,$=10,ae=69;C.fillStyle="#0e0f19",C.fillRect(0,50,P*4+K*5+22,V),s.status(C,$,ae,K,Z,N.length,Math.round(q)+" fps",q/s._goodFps,function(ne){return N[ne]/I-1}),s.status(C,$+P+K,ae,K,Z,M.length,L.toFixed(2)+" dt",s._goodDelta/L,function(ne){return M[ne]/U-1}),s.status(C,$+(P+K)*2,ae,K,Z,O.length,B.toFixed(2)+" ut",1-B/s._goodFps,function(ne){return O[ne]/B-1}),s.status(C,$+(P+K)*3,ae,K,Z,S.length,j.toFixed(2)+" rt",1-j/s._goodFps,function(ne){return S[ne]/j-1}),s.status(C,$+(P+K)*4,ae,K,Z,R.length,D.toFixed(2)+" x",D*D*D,function(ne){return(R[ne]/N[ne]/D||0)-1})},s.status=function(E,C,_,w,N,S,R,M,O){E.strokeStyle="#888",E.fillStyle="#444",E.lineWidth=1,E.fillRect(C,_+7,w,1),E.beginPath(),E.moveTo(C,_+7-N*o.clamp(.4*O(0),-2,2));for(var L=0;L<w;L+=1)E.lineTo(C+L,_+7-(L<S?N*o.clamp(.4*O(L),-2,2):0));E.stroke(),E.fillStyle="hsl("+o.clamp(25+95*M,0,120)+",100%,60%)",E.fillRect(C,_-7,4,4),E.font="12px Arial",E.textBaseline="middle",E.textAlign="right",E.fillStyle="#eee",E.fillText(R,C+w,_-5)},s.constraints=function(E,C){for(var _=C,w=0;w<E.length;w++){var N=E[w];if(!(!N.render.visible||!N.pointA||!N.pointB)){var S=N.bodyA,R=N.bodyB,M,O;if(S?M=f.add(S.position,N.pointA):M=N.pointA,N.render.type==="pin")_.beginPath(),_.arc(M.x,M.y,3,0,2*Math.PI),_.closePath();else{if(R?O=f.add(R.position,N.pointB):O=N.pointB,_.beginPath(),_.moveTo(M.x,M.y),N.render.type==="spring")for(var L=f.sub(O,M),I=f.perp(f.normalise(L)),j=Math.ceil(o.clamp(N.length/5,12,20)),U,B=1;B<j;B+=1)U=B%2===0?1:-1,_.lineTo(M.x+L.x*(B/j)+I.x*U*4,M.y+L.y*(B/j)+I.y*U*4);_.lineTo(O.x,O.y)}N.render.lineWidth&&(_.lineWidth=N.render.lineWidth,_.strokeStyle=N.render.strokeStyle,_.stroke()),N.render.anchors&&(_.fillStyle=N.render.strokeStyle,_.beginPath(),_.arc(M.x,M.y,3,0,2*Math.PI),_.arc(O.x,O.y,3,0,2*Math.PI),_.closePath(),_.fill())}}},s.bodies=function(E,C,_){var w=_;E.engine;var N=E.options,S=N.showInternalEdges||!N.wireframes,R,M,O,L;for(O=0;O<C.length;O++)if(R=C[O],!!R.render.visible){for(L=R.parts.length>1?1:0;L<R.parts.length;L++)if(M=R.parts[L],!!M.render.visible){if(N.showSleeping&&R.isSleeping?w.globalAlpha=.5*M.render.opacity:M.render.opacity!==1&&(w.globalAlpha=M.render.opacity),M.render.sprite&&M.render.sprite.texture&&!N.wireframes){var I=M.render.sprite,j=T(E,I.texture);w.translate(M.position.x,M.position.y),w.rotate(M.angle),w.drawImage(j,j.width*-I.xOffset*I.xScale,j.height*-I.yOffset*I.yScale,j.width*I.xScale,j.height*I.yScale),w.rotate(-M.angle),w.translate(-M.position.x,-M.position.y)}else{if(M.circleRadius)w.beginPath(),w.arc(M.position.x,M.position.y,M.circleRadius,0,2*Math.PI);else{w.beginPath(),w.moveTo(M.vertices[0].x,M.vertices[0].y);for(var U=1;U<M.vertices.length;U++)!M.vertices[U-1].isInternal||S?w.lineTo(M.vertices[U].x,M.vertices[U].y):w.moveTo(M.vertices[U].x,M.vertices[U].y),M.vertices[U].isInternal&&!S&&w.moveTo(M.vertices[(U+1)%M.vertices.length].x,M.vertices[(U+1)%M.vertices.length].y);w.lineTo(M.vertices[0].x,M.vertices[0].y),w.closePath()}N.wireframes?(w.lineWidth=1,w.strokeStyle="#bbb",w.stroke()):(w.fillStyle=M.render.fillStyle,M.render.lineWidth&&(w.lineWidth=M.render.lineWidth,w.strokeStyle=M.render.strokeStyle,w.stroke()),w.fill())}w.globalAlpha=1}}},s.bodyWireframes=function(E,C,_){var w=_,N=E.options.showInternalEdges,S,R,M,O,L;for(w.beginPath(),M=0;M<C.length;M++)if(S=C[M],!!S.render.visible)for(L=S.parts.length>1?1:0;L<S.parts.length;L++){for(R=S.parts[L],w.moveTo(R.vertices[0].x,R.vertices[0].y),O=1;O<R.vertices.length;O++)!R.vertices[O-1].isInternal||N?w.lineTo(R.vertices[O].x,R.vertices[O].y):w.moveTo(R.vertices[O].x,R.vertices[O].y),R.vertices[O].isInternal&&!N&&w.moveTo(R.vertices[(O+1)%R.vertices.length].x,R.vertices[(O+1)%R.vertices.length].y);w.lineTo(R.vertices[0].x,R.vertices[0].y)}w.lineWidth=1,w.strokeStyle="#bbb",w.stroke()},s.bodyConvexHulls=function(E,C,_){var w=_,N,S,R;for(w.beginPath(),S=0;S<C.length;S++)if(N=C[S],!(!N.render.visible||N.parts.length===1)){for(w.moveTo(N.vertices[0].x,N.vertices[0].y),R=1;R<N.vertices.length;R++)w.lineTo(N.vertices[R].x,N.vertices[R].y);w.lineTo(N.vertices[0].x,N.vertices[0].y)}w.lineWidth=1,w.strokeStyle="rgba(255,255,255,0.2)",w.stroke()},s.vertexNumbers=function(E,C,_){var w=_,N,S,R;for(N=0;N<C.length;N++){var M=C[N].parts;for(R=M.length>1?1:0;R<M.length;R++){var O=M[R];for(S=0;S<O.vertices.length;S++)w.fillStyle="rgba(255,255,255,0.2)",w.fillText(N+"_"+S,O.position.x+(O.vertices[S].x-O.position.x)*.8,O.position.y+(O.vertices[S].y-O.position.y)*.8)}}},s.mousePosition=function(E,C,_){var w=_;w.fillStyle="rgba(255,255,255,0.8)",w.fillText(C.position.x+" "+C.position.y,C.position.x+5,C.position.y-5)},s.bodyBounds=function(E,C,_){var w=_;E.engine;var N=E.options;w.beginPath();for(var S=0;S<C.length;S++){var R=C[S];if(R.render.visible)for(var M=C[S].parts,O=M.length>1?1:0;O<M.length;O++){var L=M[O];w.rect(L.bounds.min.x,L.bounds.min.y,L.bounds.max.x-L.bounds.min.x,L.bounds.max.y-L.bounds.min.y)}}N.wireframes?w.strokeStyle="rgba(255,255,255,0.08)":w.strokeStyle="rgba(0,0,0,0.1)",w.lineWidth=1,w.stroke()},s.bodyAxes=function(E,C,_){var w=_;E.engine;var N=E.options,S,R,M,O;for(w.beginPath(),R=0;R<C.length;R++){var L=C[R],I=L.parts;if(L.render.visible)if(N.showAxes)for(M=I.length>1?1:0;M<I.length;M++)for(S=I[M],O=0;O<S.axes.length;O++){var j=S.axes[O];w.moveTo(S.position.x,S.position.y),w.lineTo(S.position.x+j.x*20,S.position.y+j.y*20)}else for(M=I.length>1?1:0;M<I.length;M++)for(S=I[M],O=0;O<S.axes.length;O++)w.moveTo(S.position.x,S.position.y),w.lineTo((S.vertices[0].x+S.vertices[S.vertices.length-1].x)/2,(S.vertices[0].y+S.vertices[S.vertices.length-1].y)/2)}N.wireframes?(w.strokeStyle="indianred",w.lineWidth=1):(w.strokeStyle="rgba(255, 255, 255, 0.4)",w.globalCompositeOperation="overlay",w.lineWidth=2),w.stroke(),w.globalCompositeOperation="source-over"},s.bodyPositions=function(E,C,_){var w=_;E.engine;var N=E.options,S,R,M,O;for(w.beginPath(),M=0;M<C.length;M++)if(S=C[M],!!S.render.visible)for(O=0;O<S.parts.length;O++)R=S.parts[O],w.arc(R.position.x,R.position.y,3,0,2*Math.PI,!1),w.closePath();for(N.wireframes?w.fillStyle="indianred":w.fillStyle="rgba(0,0,0,0.5)",w.fill(),w.beginPath(),M=0;M<C.length;M++)S=C[M],S.render.visible&&(w.arc(S.positionPrev.x,S.positionPrev.y,2,0,2*Math.PI,!1),w.closePath());w.fillStyle="rgba(255,165,0,0.8)",w.fill()},s.bodyVelocity=function(E,C,_){var w=_;w.beginPath();for(var N=0;N<C.length;N++){var S=C[N];if(S.render.visible){var R=a.getVelocity(S);w.moveTo(S.position.x,S.position.y),w.lineTo(S.position.x+R.x,S.position.y+R.y)}}w.lineWidth=3,w.strokeStyle="cornflowerblue",w.stroke()},s.bodyIds=function(E,C,_){var w=_,N,S;for(N=0;N<C.length;N++)if(C[N].render.visible){var R=C[N].parts;for(S=R.length>1?1:0;S<R.length;S++){var M=R[S];w.font="12px Arial",w.fillStyle="rgba(255,255,255,0.5)",w.fillText(M.id,M.position.x+10,M.position.y-10)}}},s.collisions=function(E,C,_){var w=_,N=E.options,S,R,M,O;for(w.beginPath(),M=0;M<C.length;M++)if(S=C[M],!!S.isActive)for(R=S.collision,O=0;O<S.activeContacts.length;O++){var L=S.activeContacts[O],I=L.vertex;w.rect(I.x-1.5,I.y-1.5,3.5,3.5)}for(N.wireframes?w.fillStyle="rgba(255,255,255,0.7)":w.fillStyle="orange",w.fill(),w.beginPath(),M=0;M<C.length;M++)if(S=C[M],!!S.isActive&&(R=S.collision,S.activeContacts.length>0)){var j=S.activeContacts[0].vertex.x,U=S.activeContacts[0].vertex.y;S.activeContacts.length===2&&(j=(S.activeContacts[0].vertex.x+S.activeContacts[1].vertex.x)/2,U=(S.activeContacts[0].vertex.y+S.activeContacts[1].vertex.y)/2),R.bodyB===R.supports[0].body||R.bodyA.isStatic===!0?w.moveTo(j-R.normal.x*8,U-R.normal.y*8):w.moveTo(j+R.normal.x*8,U+R.normal.y*8),w.lineTo(j,U)}N.wireframes?w.strokeStyle="rgba(255,165,0,0.7)":w.strokeStyle="orange",w.lineWidth=1,w.stroke()},s.separations=function(E,C,_){var w=_,N=E.options,S,R,M,O,L;for(w.beginPath(),L=0;L<C.length;L++)if(S=C[L],!!S.isActive){R=S.collision,M=R.bodyA,O=R.bodyB;var I=1;!O.isStatic&&!M.isStatic&&(I=.5),O.isStatic&&(I=0),w.moveTo(O.position.x,O.position.y),w.lineTo(O.position.x-R.penetration.x*I,O.position.y-R.penetration.y*I),I=1,!O.isStatic&&!M.isStatic&&(I=.5),M.isStatic&&(I=0),w.moveTo(M.position.x,M.position.y),w.lineTo(M.position.x+R.penetration.x*I,M.position.y+R.penetration.y*I)}N.wireframes?w.strokeStyle="rgba(255,165,0,0.5)":w.strokeStyle="orange",w.stroke()},s.inspector=function(E,C){E.engine;var _=E.selected,w=E.render,N=w.options,S;if(N.hasBounds){var R=w.bounds.max.x-w.bounds.min.x,M=w.bounds.max.y-w.bounds.min.y,O=R/w.options.width,L=M/w.options.height;C.scale(1/O,1/L),C.translate(-w.bounds.min.x,-w.bounds.min.y)}for(var I=0;I<_.length;I++){var j=_[I].data;switch(C.translate(.5,.5),C.lineWidth=1,C.strokeStyle="rgba(255,165,0,0.9)",C.setLineDash([1,2]),j.type){case"body":S=j.bounds,C.beginPath(),C.rect(Math.floor(S.min.x-3),Math.floor(S.min.y-3),Math.floor(S.max.x-S.min.x+6),Math.floor(S.max.y-S.min.y+6)),C.closePath(),C.stroke();break;case"constraint":var U=j.pointA;j.bodyA&&(U=j.pointB),C.beginPath(),C.arc(U.x,U.y,10,0,2*Math.PI),C.closePath(),C.stroke();break}C.setLineDash([]),C.translate(-.5,-.5)}E.selectStart!==null&&(C.translate(.5,.5),C.lineWidth=1,C.strokeStyle="rgba(255,165,0,0.6)",C.fillStyle="rgba(255,165,0,0.1)",S=E.selectBounds,C.beginPath(),C.rect(Math.floor(S.min.x),Math.floor(S.min.y),Math.floor(S.max.x-S.min.x),Math.floor(S.max.y-S.min.y)),C.closePath(),C.stroke(),C.fill(),C.translate(-.5,-.5)),N.hasBounds&&C.setTransform(1,0,0,1,0,0)};var g=function(E,C){var _=E.engine,w=E.timing,N=w.historySize,S=_.timing.timestamp;w.delta=C-w.lastTime||s._goodDelta,w.lastTime=C,w.timestampElapsed=S-w.lastTimestamp||0,w.lastTimestamp=S,w.deltaHistory.unshift(w.delta),w.deltaHistory.length=Math.min(w.deltaHistory.length,N),w.engineDeltaHistory.unshift(_.timing.lastDelta),w.engineDeltaHistory.length=Math.min(w.engineDeltaHistory.length,N),w.timestampElapsedHistory.unshift(w.timestampElapsed),w.timestampElapsedHistory.length=Math.min(w.timestampElapsedHistory.length,N),w.engineElapsedHistory.unshift(_.timing.lastElapsed),w.engineElapsedHistory.length=Math.min(w.engineElapsedHistory.length,N),w.elapsedHistory.unshift(w.lastElapsed),w.elapsedHistory.length=Math.min(w.elapsedHistory.length,N)},x=function(E){for(var C=0,_=0;_<E.length;_+=1)C+=E[_];return C/E.length||0},b=function(E,C){var _=document.createElement("canvas");return _.width=E,_.height=C,_.oncontextmenu=function(){return!1},_.onselectstart=function(){return!1},_},k=function(E){var C=E.getContext("2d"),_=window.devicePixelRatio||1,w=C.webkitBackingStorePixelRatio||C.mozBackingStorePixelRatio||C.msBackingStorePixelRatio||C.oBackingStorePixelRatio||C.backingStorePixelRatio||1;return _/w},T=function(E,C){var _=E.textures[C];return _||(_=E.textures[C]=new Image,_.src=C,_)},A=function(E,C){var _=C;/(jpg|gif|png)$/.test(C)&&(_="url("+C+")"),E.canvas.style.background=_,E.canvas.style.backgroundSize="contain",E.currentBackground=C}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(5),o=i(17),l=i(0);(function(){var c,h;if(typeof window<"u"&&(c=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,h=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),!c){var f;c=function(m){f=setTimeout(function(){m(l.now())},1e3/60)},h=function(){clearTimeout(f)}}s.create=function(m){var d={fps:60,deltaSampleSize:60,counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,frameRequestId:null,isFixed:!1,enabled:!0},p=l.extend(d,m);return p.delta=p.delta||1e3/p.fps,p.deltaMin=p.deltaMin||1e3/p.fps,p.deltaMax=p.deltaMax||1e3/(p.fps*.5),p.fps=1e3/p.delta,p},s.run=function(m,d){return typeof m.positionIterations<"u"&&(d=m,m=s.create()),(function p(g){m.frameRequestId=c(p),g&&m.enabled&&s.tick(m,d,g)})(),m},s.tick=function(m,d,p){var g=d.timing,x;m.isFixed?x=m.delta:(x=p-m.timePrev||m.delta,m.timePrev=p,m.deltaHistory.push(x),m.deltaHistory=m.deltaHistory.slice(-m.deltaSampleSize),x=Math.min.apply(null,m.deltaHistory),x=x<m.deltaMin?m.deltaMin:x,x=x>m.deltaMax?m.deltaMax:x,m.delta=x);var b={timestamp:g.timestamp};a.trigger(m,"beforeTick",b),m.frameCounter+=1,p-m.counterTimestamp>=1e3&&(m.fps=m.frameCounter*((p-m.counterTimestamp)/1e3),m.counterTimestamp=p,m.frameCounter=0),a.trigger(m,"tick",b),a.trigger(m,"beforeUpdate",b),o.update(d,x),a.trigger(m,"afterUpdate",b),a.trigger(m,"afterTick",b)},s.stop=function(m){h(m.frameRequestId)},s.start=function(m,d){s.run(m,d)}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(8),o=i(0),l=o.deprecated;(function(){s.collides=function(c,h){return a.collides(c,h)},l(s,"collides","SAT.collides ➤ replaced by Collision.collides")})()}),(function(n,r,i){var s={};n.exports=s,i(1);var a=i(0);(function(){s.pathToVertices=function(o,l){typeof window<"u"&&!("SVGPathSeg"in window)&&a.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var c,h,f,m,d,p,g,x,b,k,T=[],A,E,C=0,_=0,w=0;l=l||15;var N=function(R,M,O){var L=O%2===1&&O>1;if(!b||R!=b.x||M!=b.y){b&&L?(A=b.x,E=b.y):(A=0,E=0);var I={x:A+R,y:E+M};(L||!b)&&(b=I),T.push(I),_=A+R,w=E+M}},S=function(R){var M=R.pathSegTypeAsLetter.toUpperCase();if(M!=="Z"){switch(M){case"M":case"L":case"T":case"C":case"S":case"Q":_=R.x,w=R.y;break;case"H":_=R.x;break;case"V":w=R.y;break}N(_,w,R.pathSegType)}};for(s._svgPathToAbsolute(o),f=o.getTotalLength(),p=[],c=0;c<o.pathSegList.numberOfItems;c+=1)p.push(o.pathSegList.getItem(c));for(g=p.concat();C<f;){if(k=o.getPathSegAtLength(C),d=p[k],d!=x){for(;g.length&&g[0]!=d;)S(g.shift());x=d}switch(d.pathSegTypeAsLetter.toUpperCase()){case"C":case"T":case"S":case"Q":case"A":m=o.getPointAtLength(C),N(m.x,m.y,0);break}C+=l}for(c=0,h=g.length;c<h;++c)S(g[c]);return T},s._svgPathToAbsolute=function(o){for(var l,c,h,f,m,d,p=o.pathSegList,g=0,x=0,b=p.numberOfItems,k=0;k<b;++k){var T=p.getItem(k),A=T.pathSegTypeAsLetter;if(/[MLHVCSQTA]/.test(A))"x"in T&&(g=T.x),"y"in T&&(x=T.y);else switch("x1"in T&&(h=g+T.x1),"x2"in T&&(m=g+T.x2),"y1"in T&&(f=x+T.y1),"y2"in T&&(d=x+T.y2),"x"in T&&(g+=T.x),"y"in T&&(x+=T.y),A){case"m":p.replaceItem(o.createSVGPathSegMovetoAbs(g,x),k);break;case"l":p.replaceItem(o.createSVGPathSegLinetoAbs(g,x),k);break;case"h":p.replaceItem(o.createSVGPathSegLinetoHorizontalAbs(g),k);break;case"v":p.replaceItem(o.createSVGPathSegLinetoVerticalAbs(x),k);break;case"c":p.replaceItem(o.createSVGPathSegCurvetoCubicAbs(g,x,h,f,m,d),k);break;case"s":p.replaceItem(o.createSVGPathSegCurvetoCubicSmoothAbs(g,x,m,d),k);break;case"q":p.replaceItem(o.createSVGPathSegCurvetoQuadraticAbs(g,x,h,f),k);break;case"t":p.replaceItem(o.createSVGPathSegCurvetoQuadraticSmoothAbs(g,x),k);break;case"a":p.replaceItem(o.createSVGPathSegArcAbs(g,x,T.r1,T.r2,T.angle,T.largeArcFlag,T.sweepFlag),k);break;case"z":case"Z":g=l,x=c;break}(A=="M"||A=="m")&&(l=g,c=x)}}})()}),(function(n,r,i){var s={};n.exports=s;var a=i(6);i(0),(function(){s.create=a.create,s.add=a.add,s.remove=a.remove,s.clear=a.clear,s.addComposite=a.addComposite,s.addBody=a.addBody,s.addConstraint=a.addConstraint})()})])})})(ki)),ki.exports}var xb=gb();const Nn=Kl(xb);{const e=Nn.Resolver;e&&typeof e._restingThresh=="number"&&(e._restingThresh=1.4)}const bb=6,$t=28,yn=.92,ja=1.12,yb=34;function Au(e,t,n){return Math.hypot(t-e.startX,n-e.startY)<bb?"click":"drag"}function vb(e){const t=e.length;if(t===0)return"";const n=i=>`${i.x.toFixed(1)} ${i.y.toFixed(1)}`;if(t===1)return`M ${n(e[0])}`;if(t===2)return`M ${n(e[0])} L ${n(e[1])}`;let r=`M ${n(e[0])}`;for(let i=1;i<t-1;i++){const s=e[i],a=e[i+1];r+=` Q ${n(s)} ${((s.x+a.x)/2).toFixed(1)} ${((s.y+a.y)/2).toFixed(1)}`}return`${r} L ${n(e[t-1])}`}function Eb(e,t){return e*Math.exp(-t/90)}function kb(e,t,n,r){const i=`translate3d(${e.toFixed(1)}px, ${t.toFixed(1)}px, 0)`;if(n<.01)return i;const s=r*180/Math.PI,a=Math.min(.35,n);return`${i} rotate(${s.toFixed(1)}deg) scale(${(1+a).toFixed(3)}, ${(1-a).toFixed(3)}) rotate(${(-s).toFixed(1)}deg)`}const om=4e-5,wb=5e-4;function lm(e,t,n){return Math.sin(n*37e-5+t*.0013)*.6+Math.sin(n*19e-5+e*7e-4+1.7)*.4}function cm(e){switch(e){case"storm":return{wind:.95,gust:1,rainRate:.006,snowRate:0,airDrag:1.05};case"rain":return{wind:.6,gust:.25,rainRate:.004,snowRate:0,airDrag:1};case"snow":return{wind:.25,gust:0,rainRate:0,snowRate:4e-4,airDrag:1};case"fog":return{wind:.06,gust:0,rainRate:0,snowRate:0,airDrag:1.7};case"cloudy":return{wind:.4,gust:.1,rainRate:0,snowRate:0,airDrag:1};case"clear":default:return{wind:.3,gust:0,rainRate:0,snowRate:0,airDrag:1}}}function um(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,(t>>>0)/4294967295}const Yr=120,Tb=.9,Nu=.7,Sb=.09,Cb=2.2,Ab=2,Fa=$t*2.45,Nb=.006,Ba=22,Ha=.06;function _b(e){var O;const t=e.ballRadius??$t,n=cm(e.weather??"clear"),{Engine:r,Bodies:i,Body:s,Composite:a,Constraint:o,Events:l}=Nn,c=r.create();c.gravity.y=1,c.positionIterations=8,c.velocityIterations=4;const h=e.nodes.map(L=>{var B,W;const I=((B=L.spawn)==null?void 0:B.x)??L.x,j=((W=L.spawn)==null?void 0:W.y)??L.y,U=i.circle(I,j,t,{restitution:.5,friction:.01,frictionAir:.03*n.airDrag,density:L.isExam?.0016:.001,inertia:1/0,isStatic:!!L.locked,collisionFilter:{group:0,category:2,mask:6}});return{nodeId:L.id,body:U,layoutX:L.x,layoutY:L.y,isExam:!!L.isExam,snow:0,field:0,squash:0,squashAngle:0}});for(const L of h){a.add(c.world,L.body);const I=(O=e.nodes.find(j=>j.id===L.nodeId))==null?void 0:O.spawn;I&&(I.vx!==void 0||I.vy!==void 0)&&s.setVelocity(L.body,{x:I.vx??0,y:I.vy??0})}const f=Yr/2,m={isStatic:!0,restitution:.4,friction:.05,collisionFilter:{category:4,mask:2}},d=(L,I)=>({x:Math.min(e.width-t,Math.max(t,L)),y:Math.min(e.height-t,Math.max(t,I))});a.add(c.world,[i.rectangle(e.width/2,-f,e.width*3,Yr,m),i.rectangle(e.width/2,e.height+f,e.width*3,Yr,m),i.rectangle(-f,e.height/2,Yr,e.height*3,m),i.rectangle(e.width+f,e.height/2,Yr,e.height*3,m)]);const p=L=>({x:L.body.position.x,y:L.body.position.y+t*yn}),g=[];function x(L,I,j,U,B){return"body"in L?o.create({bodyA:L.body,pointA:L.offset,bodyB:I,pointB:j,length:U,stiffness:B,damping:.05}):o.create({pointA:L.point,bodyB:I,pointB:j,length:U,stiffness:B,damping:.05})}function b(L,I,j,U){const B={x:j.body.position.x,y:j.body.position.y+t*yn},W=B.x-L.x,D=B.y-L.y,q=Math.max(60,Math.hypot(W,D)),Z=Math.max(5,Math.min(14,Math.round(q/yb))),P=q*ja/Z,K=[];let V=I?{body:I,offset:{x:L.x-I.position.x,y:L.y-I.position.y}}:{point:L},$=!0;for(let ae=1;ae<Z;ae++){const ne=ae/Z,Y=Math.sin(Math.PI*ne)*q*(ja-1)*.85,ye=i.circle(L.x+W*ne,L.y+D*ne+Y,3.5,{density:7e-4,frictionAir:.1*n.airDrag,collisionFilter:{category:8,mask:0}});K.push(ye),a.add(c.world,ye),a.add(c.world,x(V,ye,void 0,P,$?Nu:Tb)),$=!1,V={body:ye,offset:{x:0,y:0}}}a.add(c.world,x(V,j.body,{x:0,y:t*yn},P,Nu)),g.push({from:U,to:j.nodeId,restLen:q*ja,particles:K})}const k=h[0],T=k?{x:e.anchorKnotX??k.layoutX,y:Ui}:{x:e.width/2,y:Ui};k&&b(T,null,k,"__anchor");for(let L=0;L<h.length-1;L++){const I=h[L],j=h[L+1];b(p(I),I.body,j,I.nodeId)}const A=h[h.length-1],E=e.nextKnot&&(A!=null&&A.isExam)?e.nextKnot:void 0;E&&A&&b(E,null,A,"__next");const C=new Map;for(const L of h){let I=0;for(const U of g)if(U.from===L.nodeId||U.to===L.nodeId)for(const B of U.particles)I+=B.mass*.5;const j=Math.min(.25,I/L.body.mass);C.set(L.nodeId,(1+j)*(.96+um(L.nodeId)*.08))}let _=0,w=1;l.on(c,"beforeUpdate",()=>{const L=c.timing.timestamp;_*=.97,n.gust>0&&Math.random()<.0025*n.gust&&(_=n.gust*(.6+Math.random()*.4),w=Math.random()<.5?-1:1);for(const I of h){const j=I.body.mass,U=c.gravity.y*c.gravity.scale,B=lm(I.body.position.x,I.body.position.y,L)*n.wind*om*j+w*_*wb*j;let W=-j*U*(C.get(I.nodeId)??1);n.rainRate>0&&Math.random()<n.rainRate&&(W+=j*U*.35,s.applyForce(I.body,I.body.position,{x:(Math.random()-.5)*j*U*.3,y:0})),s.applyForce(I.body,I.body.position,{x:B,y:W})}});const N=[],S=(L,I,j,U)=>{if(L.snow<=Ha)return;const B=Math.max(1,Math.min(U,Math.round(L.snow*U)+1));for(let W=0;W<B;W++){const D=-(.35+Math.random()*1.9),q=t*(.55+Math.random()*.45);N.push({x:L.body.position.x+Math.cos(D)*q,y:L.body.position.y+Math.sin(D)*q,vx:L.body.velocity.x*.75+I.x*(.5+Math.random()*1.8)+(Math.random()-.5)*1.2,vy:L.body.velocity.y*.75+I.y*(.5+Math.random()*1.8)-.6-Math.random()*.8,amount:.02+Math.min(.05,j*.004)})}L.snow=Math.max(Ha*.5,L.snow-B*(.03+Math.min(.07,j*.005))),N.length>96&&N.splice(0,N.length-96)},R=[];l.on(c,"collisionStart",L=>{var I;for(const j of L.pairs){const{bodyA:U,bodyB:B}=j,W=h.find($=>$.body===U),D=h.find($=>$.body===B);if(!W&&!D)continue;const q={x:U.velocity.x-B.velocity.x,y:U.velocity.y-B.velocity.y},Z=Math.hypot(q.x,q.y);if(Z<Cb)continue;const P=j.collision.normal,K=(I=j.collision.supports)==null?void 0:I[0];R.push(K?{x:K.x,y:K.y,speed:Z}:{x:(U.position.x+B.position.x)/2,y:(U.position.y+B.position.y)/2,speed:Z}),R.length>64&&R.shift();const V=Math.min(.32,Z*.028);W&&V>W.squash&&(W.squash=V,W.squashAngle=Math.atan2(P.y,P.x)),D&&V>D.squash&&(D.squash=V,D.squashAngle=Math.atan2(-P.y,-P.x)),W&&S(W,{x:P.x,y:P.y},Z,5),D&&S(D,{x:-P.x,y:-P.y},Z,5)}}),l.on(c,"afterUpdate",()=>{if(!(n.snowRate<=0))for(const L of h)L.snow=Math.min(1,L.snow+n.snowRate)});let M=null;return{balls:h,links:g,anchor:T,nextKnot:E,ball(L){return h.find(I=>I.nodeId===L)},step(L){r.update(c,Math.min(33,Math.max(8,L)));for(let I=0;I<h.length;I++){const j=h[I];for(let U=I+1;U<h.length;U++){const B=h[U],W=B.body.position.x-j.body.position.x,D=B.body.position.y-j.body.position.y,q=W*W+D*D;if(q>=Fa*Fa||q<.01)continue;const Z=Math.sqrt(q),P=(Z-2*t)/(Fa-2*t),K=P<=0?1:P>=1?0:1-P,$=Math.hypot(j.body.velocity.x-B.body.velocity.x,j.body.velocity.y-B.body.velocity.y)<1.2?Nb*K*K:0,ae=W/Z,ne=D/Z;j.body.isStatic||s.applyForce(j.body,j.body.position,{x:-ae*$*j.body.mass,y:-ne*$*j.body.mass}),B.body.isStatic||s.applyForce(B.body,B.body.position,{x:ae*$*B.body.mass,y:ne*$*B.body.mass}),j.field=Math.max(j.field,K),B.field=Math.max(B.field,K)}}for(const I of h)I.field*=.88;for(const I of h){if(I.body.isStatic)continue;const j=I.body.velocity,U=Math.hypot(j.x,j.y);U>Ba&&s.setVelocity(I.body,{x:j.x/U*Ba,y:j.y/U*Ba})}for(let I=0;I<h.length;I++){const j=h[I];for(let U=I+1;U<h.length;U++){const B=h[U];let W=B.body.position.x-j.body.position.x,D=B.body.position.y-j.body.position.y,q=Math.hypot(W,D);if(q>=t*2)continue;q<.01&&(W=1,D=0,q=1);const Z=t*2-q+.05,P=W/q,K=D/q;j.body.isStatic&&B.body.isStatic||(j.body.isStatic?s.setPosition(B.body,{x:B.body.position.x+P*Z,y:B.body.position.y+K*Z}):B.body.isStatic?s.setPosition(j.body,{x:j.body.position.x-P*Z,y:j.body.position.y-K*Z}):(s.setPosition(j.body,{x:j.body.position.x-P*Z/2,y:j.body.position.y-K*Z/2}),s.setPosition(B.body,{x:B.body.position.x+P*Z/2,y:B.body.position.y+K*Z/2})))}}for(const I of h){const j=Math.hypot(I.body.velocity.x,I.body.velocity.y);I.snow>Ha&&j>Ab&&S(I,{x:I.body.velocity.x/j,y:I.body.velocity.y/j},j,2)}for(const I of h){if(I.body.isStatic)continue;const j=I.body.position.x,U=I.body.position.y,B=Math.min(e.width-t,Math.max(t,j)),W=Math.min(e.height-t,Math.max(t,U));(B!==j||W!==U)&&(s.setPosition(I.body,{x:B,y:W}),s.setVelocity(I.body,{x:j<t||j>e.width-t?0:I.body.velocity.x,y:U<t||U>e.height-t?0:I.body.velocity.y}))}},beginDrag(L,I,j){this.endDrag();const U=this.ball(L);if(!U)return;const B=o.create({pointA:d(I,j),bodyB:U.body,length:0,stiffness:Sb,damping:.12});a.add(c.world,B),M={constraint:B,nodeId:L}},moveDrag(L,I){if(!M)return;const j=d(L,I);M.constraint.pointA=j},endDrag(){M&&(a.remove(c.world,M.constraint),M=null)},isDragging(){return M!==null},drainImpacts(){const L=R.slice();return R.length=0,L},drainFlakes(){const L=N.slice();return N.length=0,L},dispose(){this.endDrag(),l.off(c,"beforeUpdate"),l.off(c,"afterUpdate"),l.off(c,"collisionStart"),a.clear(c.world,!1),r.clear(c)}}}const Ui=-12;function ei(e,t,n=20){return t<=n*2?t/2:n+um(e)*(t-n*2)}function Ib(e,t,n,r=$t){if(t<=0||Math.abs(t-n)<=1)return e;const i=n/t,s={x:Math.min(n-r,Math.max(r,e.x*i)),y:e.y,vy:e.vy};return e.vx!==void 0&&(s.vx=e.vx*i),s}const tr=(e,t,n)=>e+(t-e)*n,la=(e,t,n)=>e<t?t:e>n?n:e,Ss=e=>e<0?0:e>1?1:e*e*(3-2*e);function nr(e,t,n){return[tr(e[0],t[0],n),tr(e[1],t[1],n),tr(e[2],t[2],n)]}const Ua=e=>`rgb(${e[0]|0},${e[1]|0},${e[2]|0})`,Rr=(e,t)=>`rgba(${e[0]|0},${e[1]|0},${e[2]|0},${t})`;function ca(){return[{t:0,top:[8,10,26],mid:[16,20,44],hor:[34,30,58]},{t:.12,top:[30,32,72],mid:[78,56,104],hor:[158,100,116]},{t:.22,top:[124,156,214],mid:[232,152,120],hor:[250,196,128]},{t:.36,top:[80,142,196],mid:[132,186,226],hor:[188,214,232]},{t:.5,top:[60,120,178],mid:[108,168,212],hor:[168,200,226]},{t:.62,top:[120,132,152],mid:[150,150,160],hor:[180,178,182]},{t:.74,top:[70,60,88],mid:[108,78,110],hor:[180,110,100]},{t:.86,top:[40,30,60],mid:[88,44,76],hor:[168,72,72]},{t:1,top:[8,10,26],mid:[16,20,44],hor:[34,30,58]}]}function ua(e,t){return e.map(n=>({t:n.t,top:t(n.top),mid:t(n.mid),hor:t(n.hor)}))}const za=()=>ua(ca(),e=>[e[0]*1,e[1]*1.15,e[2]*.7]),ti=()=>ua(ca(),e=>[e[0]*.75,e[1]*1,Math.min(255,e[2]*1.25)]),Va=()=>ua(ca(),e=>[Math.min(255,e[0]*1.35),e[1]*.8,e[2]*.55]),_u=()=>ua(ca(),e=>{const t=(e[0]+e[1]+e[2])/3;return[t*.7+e[0]*.1,t*.7+e[1]*.1,t*.95+e[2]*.15]}),$a={far:[28,50,36],near:[56,110,52],snowy:!1},ni={far:[20,48,30],near:[34,82,40],snowy:!1},qa={far:[54,36,24],near:[128,78,36],snowy:!1},Iu={far:[60,66,82],near:[232,236,244],snowy:!0};function Vt(e){return t=>{let n=e;return t>.3&&t<.5?n=tr(n,Math.min(1,n+.2),Ss((t-.3)/.2)):t>=.5&&t<.74?n=Math.min(1,n+.15):t>=.74&&t<.84&&(n=tr(n,Math.max(0,n-.3),Ss((t-.74)/.1))),la(n,0,1)}}const dm={"spring|clear":{season:"spring",weather:"clear",sky:za(),cloudCover:Vt(.1),particles:"none",lightning:!1,fogAlpha:0,ground:$a},"spring|cloudy":{season:"spring",weather:"cloudy",sky:za(),cloudCover:Vt(.5),particles:"none",lightning:!1,fogAlpha:0,ground:$a},"spring|rain":{season:"spring",weather:"rain",sky:za(),cloudCover:Vt(.85),particles:"rain",lightning:!1,fogAlpha:0,ground:$a},"summer|clear":{season:"summer",weather:"clear",sky:ti(),cloudCover:Vt(.1),particles:"none",lightning:!1,fogAlpha:0,ground:ni},"summer|cloudy":{season:"summer",weather:"cloudy",sky:ti(),cloudCover:Vt(.5),particles:"none",lightning:!1,fogAlpha:0,ground:ni},"summer|rain":{season:"summer",weather:"rain",sky:ti(),cloudCover:Vt(.85),particles:"rain",lightning:!1,fogAlpha:0,ground:ni},"summer|storm":{season:"summer",weather:"storm",sky:ti(),cloudCover:Vt(1),particles:"rain",lightning:!0,fogAlpha:0,ground:ni},"autumn|clear":{season:"autumn",weather:"clear",sky:Va(),cloudCover:Vt(.15),particles:"none",lightning:!1,fogAlpha:0,ground:qa,sunTint:[255,180,110]},"autumn|cloudy":{season:"autumn",weather:"cloudy",sky:Va(),cloudCover:Vt(.55),particles:"none",lightning:!1,fogAlpha:0,ground:qa},"autumn|storm":{season:"autumn",weather:"storm",sky:Va(),cloudCover:Vt(1),particles:"rain",lightning:!0,fogAlpha:0,ground:qa},"winter|clear":{season:"winter",weather:"clear",sky:_u(),cloudCover:Vt(.2),particles:"none",lightning:!1,fogAlpha:0,ground:Iu,sunTint:[220,230,245]},"winter|snow":{season:"winter",weather:"snow",sky:_u(),cloudCover:Vt(.9),particles:"snow",lightning:!1,fogAlpha:.2,ground:Iu}},Mu=Object.keys(dm);function Mb(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function Rb(e){const t=`${e??"none"}:${Math.floor(performance.now()/1e3)}`;return Mu[Mb(t)%Mu.length]}function Lb(e,t){let n=0;for(;n<t.length-1&&e>t[n+1].t;)n++;const r=t[n],i=t[Math.min(n+1,t.length-1)],s=Ss(la((e-r.t)/(i.t-r.t||1),0,1));return{top:nr(r.top,i.top,s),mid:nr(r.mid,i.mid,s),hor:nr(r.hor,i.hor,s)}}function Pb(e,t,n,r,i){if(e<r||e>i)return null;const s=(e-r)/(i-r),a=tr(.1,.9,s),o=n*.26,l=n*.98,c=l-Math.sin(s*Math.PI)*(l-o);return{x:a*t,y:c,peakness:Math.sin(s*Math.PI)}}function Db(e,t,n,r,i){let s;if(e>=r)s=(e-r)/(1-r+i);else if(e<=i)s=(1-r+e)/(1-r+i);else return null;const a=tr(.12,.88,s),o=n*.26,l=n*.98,c=l-Math.sin(s*Math.PI)*(l-o);return{x:a*t,y:c,peakness:Math.sin(s*Math.PI)}}function hm(e){return function(){e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function Ru(e,t){const n=hm(20260809),r=Math.max(28,Math.round(e*t/7e3)),i=[];for(let s=0;s<r;s++)i.push({x:n(),y:n()*.7,r:n()*1.2+.3,tw:n()*Math.PI*2,sp:.6+n()*1.4,big:n()<.06});return i}function Ob(){const e=hm(7),t=[];for(let n=0;n<6;n++)t.push({x:e(),y:.12+e()*.4,s:.55+e()*1.2,speed:18e-6+e()*35e-6,seed:e()*1e3,drift:e()*.035+.008});return t}function jb(e,t,n,r){const i=e.createLinearGradient(0,0,0,r);i.addColorStop(0,Ua(t.top)),i.addColorStop(.55,Ua(t.mid)),i.addColorStop(1,Ua(t.hor)),e.fillStyle=i,e.fillRect(0,0,n,r)}function Fb(e,t,n,r,i,s){let a=0;if(t<.22?a=Ss(1-t/.22):t>.8&&(a=Ss((t-.8)/.2)),!(a<=.01))for(const o of n){const l=.55+.45*Math.sin(s*o.sp+o.tw),c=a*l;if(c<.02)continue;e.fillStyle=`rgba(255,248,228,${c})`;const h=o.big?o.r*1.8:o.r;e.beginPath(),e.arc(o.x*r,o.y*i,h,0,Math.PI*2),e.fill(),o.big&&(e.fillStyle=`rgba(255,240,210,${c*.35})`,e.fillRect(o.x*r-h*4,o.y*i-.4,h*8,.8),e.fillRect(o.x*r-.4,o.y*i-h*4,.8,h*8))}}function Bb(e,t,n){if(!t)return;const{x:r,y:i,peakness:s}=t,a=28+s*8,o=e.createRadialGradient(r,i,a*.4,r,i,a*5);o.addColorStop(0,"rgba(255,236,190,0.55)"),o.addColorStop(.4,"rgba(255,210,150,0.16)"),o.addColorStop(1,"rgba(255,200,140,0)"),e.fillStyle=o,e.fillRect(r-a*5,i-a*5,a*10,a*10);const l=e.createRadialGradient(r,i,0,r,i,a),c=n??[255,236,180],h=n?nr(n,[255,214,150],.5):[255,214,150];l.addColorStop(0,"rgba(255,252,238,1)"),l.addColorStop(.7,Rr(c,1)),l.addColorStop(1,Rr(h,.9)),e.fillStyle=l,e.beginPath(),e.arc(r,i,a,0,Math.PI*2),e.fill()}function Hb(e,t){if(!t)return;const{x:n,y:r}=t,i=24,s=e.createRadialGradient(n,r,i*.8,n,r,i*5);s.addColorStop(0,"rgba(220,232,255,0.38)"),s.addColorStop(.5,"rgba(220,232,255,0.1)"),s.addColorStop(1,"rgba(220,232,255,0)"),e.fillStyle=s,e.fillRect(n-i*5,r-i*5,i*10,i*10);const a=e.createRadialGradient(n-i*.25,r-i*.3,i*.2,n,r,i);a.addColorStop(0,"rgba(255,254,247,1)"),a.addColorStop(.7,"rgba(244,242,232,1)"),a.addColorStop(1,"rgba(214,222,236,1)"),e.fillStyle=a,e.beginPath(),e.arc(n,r,i,0,Math.PI*2),e.fill(),e.fillStyle="rgba(150,160,180,0.16)";const o=[[-10,-6,4],[5,3,5],[-3,9,3],[11,-8,3]];for(const[l,c,h]of o)e.beginPath(),e.arc(n+l,r+c,h,0,Math.PI*2),e.fill()}function Ub(e,t,n,r,i,s){const a=18*r,o=[[0,0,1],[-1.1,.1,.8],[1.1,.1,.8],[-.5,-.5,.7],[.6,-.45,.75],[-1.8,.3,.6],[1.8,.3,.6]];e.save(),e.translate(t,n),e.fillStyle=Rr([i[0]*.7,i[1]*.7,i[2]*.78],s*.9);for(const[l,c,h]of o)e.beginPath(),e.arc(l*a,c*a*1.1+a*.45,a*h*1.05,0,Math.PI*2),e.fill();e.fillStyle=Rr(i,s);for(const[l,c,h]of o)e.beginPath(),e.arc(l*a,c*a,a*h,0,Math.PI*2),e.fill();e.restore()}function zb(e,t,n,r,i,s,a,o,l){const c=a(t);if(c<.02)return;const h=nr(o.hor,[255,255,255],.35),f=nr(o.mid,[20,20,30],.45),m=l?f:h;for(let d=0;d<n.length;d++){const p=n[d],g=(p.x+s*p.speed)%1.2-.1,x=p.y+Math.sin(s*1e-4+p.seed)*p.drift;d/n.length<c&&Ub(e,g*r,x*i,p.s,m,la(c*.92,0,.92))}}const Er=[];let Yn=[];const rs=[];let Gn=[];const ri=[],Gr=[];let ss=[];function Vb(e,t,n,r,i,s){if(i<.04)return;const a=r*(.02+i*.07),o=.12+i*.73,l=t-r*o,c=t+r*o,h=n-Math.sqrt(Math.max(0,r*r-r*o*(r*o))),f=n-r-a,m=(h+f)/2;e.save(),e.beginPath(),e.moveTo(l,h),e.bezierCurveTo(l,m,t-r*.3,f,t,f),e.bezierCurveTo(t+r*.3,f,c,m,c,h),e.quadraticCurveTo(t,n-r*.78,l,h),e.closePath();const d=e.createLinearGradient(0,f,0,h);d.addColorStop(0,"rgba(255,255,255,0.98)"),d.addColorStop(.65,"rgba(245,250,255,0.95)"),d.addColorStop(1,"rgba(218,230,246,0.9)"),e.fillStyle=d,e.fill(),e.strokeStyle="rgba(168,192,225,0.28)",e.lineWidth=1.5,e.beginPath(),e.moveTo(l,h),e.quadraticCurveTo(t,n-r*.78,c,h),e.stroke(),e.restore()}function Wa(e,t,n,r,i){const s=Math.sin(r),a=Math.cos(r);return{x:e+Math.sin(i)*s*n,y:t-a*n}}function $b(e,t,n,r){e.save(),e.beginPath(),e.arc(t,n,r*.99,0,Math.PI*2),e.clip();const i=e.createRadialGradient(t-r*.35,n-r*.4,0,t-r*.35,n-r*.4,r*.8);i.addColorStop(0,"rgba(255,255,255,0.4)"),i.addColorStop(.5,"rgba(255,255,255,0.12)"),i.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=i,e.fillRect(t-r,n-r,r*2,r*2),e.strokeStyle="rgba(255,255,255,0.55)",e.lineWidth=1.8,e.beginPath(),e.arc(t,n,r*.92,Math.PI*1.15,Math.PI*1.5),e.stroke(),e.restore()}function qb(e,t){if(t.length!==0){e.save();for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.x+=r.vx,r.y+=r.vy,r.vy+=.14,r.vx*=.985,r.vy*=.99,r.life--,r.life<=0){t.splice(n,1);continue}const i=r.life/r.maxLife;e.fillStyle=`rgba(248,250,255,${(.9*i).toFixed(3)})`,e.beginPath(),e.arc(r.x,r.y,r.r*(.5+.5*i),0,Math.PI*2),e.fill()}e.restore()}}function fm(e,t){e.save();for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.x+=r.vx,r.y+=r.vy,r.vy+=.18,r.life--,r.life<=0){t.splice(n,1);continue}const i=Math.min(1,r.life/20)*.8;e.fillStyle=`rgba(215,238,255,${i})`,e.beginPath(),e.arc(r.x,r.y,1.3,0,Math.PI*2),e.fill()}e.restore()}function Wb(e,t,n,r,i,s){e.save(),e.beginPath(),e.arc(t,n,r*.99,0,Math.PI*2),e.clip();for(let a=i.length-1;a>=0;a--){const o=i[a];if(o.prog+=o.speed,o.life--,o.prog>Math.PI*1.05||o.life<=0){i.splice(a,1);continue}const l=7;for(let f=0;f<l;f++){const m=o.prog-o.len*(f/l),d=o.prog-o.len*((f+1)/l),p=Wa(t,n,r,m,o.theta),g=Wa(t,n,r,d,o.theta),x=(1-f/l)*.42;e.strokeStyle=`rgba(200,228,250,${x})`,e.lineWidth=o.thick*(1-f/l*.7),e.lineCap="round",e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(g.x,g.y),e.stroke()}const c=Wa(t,n,r,o.prog,o.theta),h=e.createRadialGradient(c.x-1.2,c.y-1.2,0,c.x,c.y,o.thick*1.3);h.addColorStop(0,"rgba(255,255,255,0.85)"),h.addColorStop(.4,"rgba(180,215,240,0.5)"),h.addColorStop(1,"rgba(120,165,205,0.25)"),e.fillStyle=h,e.beginPath(),e.arc(c.x,c.y,o.thick*1.1,0,Math.PI*2),e.fill()}e.restore()}function Yb(e,t,n,r){for(;Er.length<t.length;)Er.push([]);for(;Yn.length<t.length;)Yn.push(0);for(;ss.length<t.length;)ss.push(.3);for(;rs.length<t.length;)rs.push([]);for(;Gn.length<t.length;)Gn.push(0);for(let i=0;i<t.length;i++){const s=t[i];if(n.particles==="snow"){const a=s.snow!==void 0?s.snow:Math.min(1,(ss[i]??.3)+8e-4);ss[i]=a,Vb(e,s.x,s.y,s.r,a)}else if(n.particles==="rain"){if($b(e,s.x,s.y,s.r),Yn[i]=Yn[i]-1,Yn[i]<=0&&Er[i].length<3){const a=Math.random()<.5?-1:1;Er[i].push({theta:a*(.2+Math.random()*.3),prog:.1+Math.random()*.2,speed:.012+Math.random()*.012,len:.3+Math.random()*.3,thick:1.6+Math.random()*1.4,life:250+Math.random()*200}),Yn[i]=40+Math.random()*60}if(Wb(e,s.x,s.y,s.r,Er[i]),Gn[i]=Gn[i]-1,Gn[i]<=0){const a=s.x+(Math.random()-.5)*s.r*1.2,o=a-s.x,l=s.y-Math.sqrt(Math.max(0,s.r*s.r-o*o)),c=4+Math.floor(Math.random()*3);for(let h=0;h<c;h++){const f=o<0?-1:1;rs[i].push({x:a,y:l,vx:f*(.5+Math.random()*2)*(Math.random()<.5?-1:1),vy:-(1.5+Math.random()*2.5),life:18+Math.floor(Math.random()*14)})}Gn[i]=30+Math.floor(Math.random()*50)}fm(e,rs[i])}}}function Gb(e,t,n,r,i){e.save(),e.strokeStyle=i?"rgba(205,224,244,0.42)":"rgba(210,224,238,0.3)",e.lineWidth=i?1:.7,e.lineCap="round";const s=i?.013:.007;for(const a of r){a.y+=a.v*s,a.y>1&&(a.y-=1,a.x=Math.random());const o=a.x*t,l=a.y*n;e.beginPath(),e.moveTo(o,l),e.lineTo(o,l+a.len),e.stroke()}e.restore()}function Kb(e,t,n,r,i){e.save(),e.fillStyle="rgba(250,250,255,0.85)";for(const s of r){s.y+=s.v*.004;const a=(s.x+Math.sin(i*5e-4+s.phase)*.02)*t,o=s.y*n;s.y>1&&(s.y-=1),e.beginPath(),e.arc(a,o,s.r,0,Math.PI*2),e.fill()}e.restore()}function Xb(e,t,n,r,i){const s=e.createLinearGradient(0,n*.4,0,n),a=nr(i.hor,[255,255,255],.3);s.addColorStop(0,Rr(a,0)),s.addColorStop(1,Rr(a,r)),e.fillStyle=s,e.fillRect(0,n*.4,t,n*.6)}let gr=0,Lu=0;function Qb(e,t,n,r,i){if(i>Lu&&(gr=1,Lu=i+1400+Math.random()*2600),gr*=.86,gr<.02){gr=0;return}if(e.fillStyle=`rgba(255,255,255,${gr*.5})`,e.fillRect(0,0,t,n),gr>.6){e.save(),e.strokeStyle="rgba(255,255,255,0.95)",e.lineWidth=2.2,e.shadowColor="rgba(220,230,255,0.9)",e.shadowBlur=22;let s=t*(.3+Math.random()*.4),a=0;for(e.beginPath(),e.moveTo(s,a);a<n*.6;)s+=(Math.random()-.5)*60,a+=24+Math.random()*30,e.lineTo(s,a);e.stroke(),e.restore()}}function Zb(e,t,n,r){const i=e.getContext("2d");if(!i)return()=>{};const s=i,a=n;let o=0,l=0,c=1,h=Ru(1,1);const f=Ob();let m=[],d=[],p=0,g=0,x=!0;const b=performance.now(),k=window.matchMedia("(prefers-reduced-motion: reduce)").matches;function T(){const N=a.getBoundingClientRect();if(c=Math.min(window.devicePixelRatio||1,2),o=Math.max(1,N.width),l=Math.max(1,N.height),e.width=Math.floor(o*c),e.height=Math.floor(l*c),e.style.width=o+"px",e.style.height=l+"px",s.setTransform(c,0,0,c,0,0),h=Ru(o,l),r.particles==="rain"&&m.length===0){const S=r.weather==="storm",R=S?140:70;for(let M=0;M<R;M++)m.push({x:Math.random(),y:Math.random(),len:S?12+Math.random()*14:6+Math.random()*8,v:S?.9+Math.random()*.4:.5+Math.random()*.3})}if(r.particles==="snow"&&d.length===0)for(let S=0;S<120;S++)d.push({x:Math.random(),y:Math.random(),r:.8+Math.random()*1.6,v:.5+Math.random()*.8,phase:Math.random()*Math.PI*2})}function A(){const N=t.scrollHeight-t.clientHeight;p=N>0?la(t.scrollTop/N,0,1):0}function E(N){if(!x)return;const S=p,R=k?0:(N-b)/1e3,M=Lb(S,r.sky);jb(s,M,o,l),Fb(s,S,h,o,l,R),Hb(s,Db(S,o,l,.92,.08)),Bb(s,Pb(S,o,l,.16,.88),r.sunTint),zb(s,S,f,o,l,N,r.cloudCover,M,r.weather==="storm"),r.particles==="rain"&&Gb(s,o,l,m,r.weather==="storm"),r.particles==="snow"&&Kb(s,o,l,d,N),r.fogAlpha>0&&Xb(s,o,l,r.fogAlpha,M),r.lightning&&Qb(s,o,l,!0,N),k||(g=requestAnimationFrame(E))}const C=()=>A(),_=new ResizeObserver(()=>{T(),A()});_.observe(a),T(),A();let w;if(k){let N=!1;w=()=>{A(),N||(N=!0,requestAnimationFrame(()=>{N=!1,E(performance.now())}))},t.addEventListener("scroll",w,{passive:!0}),E(performance.now())}else w=C,t.addEventListener("scroll",w,{passive:!0}),g=requestAnimationFrame(E);return()=>{x=!1,cancelAnimationFrame(g),_.disconnect(),t.removeEventListener("scroll",w)}}function Jb(e,t,n,r,i,s){const a=()=>{Er.length=0,ss.length=0,Yn.length=0,rs.length=0,Gn.length=0,ri.length=0,Gr.length=0;const k=e.getContext("2d");k&&k.clearRect(0,0,e.width,e.height)};if(a(),window.matchMedia("(prefers-reduced-motion: reduce)").matches)return()=>{};if(n.particles!=="rain"&&n.particles!=="snow")return()=>{};const l=e.getContext("2d");if(!l)return()=>{};const c=l;let h=0,f=0,m=1,d=0,p=!0;function g(){const k=t.getBoundingClientRect();m=Math.min(window.devicePixelRatio||1,2),h=Math.max(1,k.width),f=Math.max(1,k.height),e.width=Math.floor(h*m),e.height=Math.floor(f*m),e.style.width=h+"px",e.style.height=f+"px",c.setTransform(m,0,0,m,0,0)}function x(k){if(!p)return;c.clearRect(0,0,h,f);const T=r();if(Yb(c,T,n),i){for(const A of i()){const E=3+Math.min(5,Math.floor(A.speed/3));for(let C=0;C<E;C++)ri.push({x:A.x,y:A.y,vx:(Math.random()-.5)*3.2,vy:-(1.5+Math.random()*2.5),life:16+Math.floor(Math.random()*12)})}ri.length>0&&fm(c,ri)}if(s){for(const A of s()){const E=1+Math.min(2,Math.round(A.amount*40));for(let C=0;C<E;C++){const _=55+Math.floor(Math.random()*40);Gr.push({x:A.x+(Math.random()-.5)*8,y:A.y+(Math.random()-.5)*6,vx:A.vx*.6+(Math.random()-.5)*.8,vy:A.vy*.6-Math.random()*.5,life:_,maxLife:_,r:1.2+Math.random()*2.2})}}for(;Gr.length>240;)Gr.shift();qb(c,Gr)}d=requestAnimationFrame(x)}const b=new ResizeObserver(g);return b.observe(t),g(),d=requestAnimationFrame(x),()=>{p=!1,cancelAnimationFrame(d),b.disconnect(),a()}}function ey(e){const t=_e(),[n,r]=v.useState("import"),[i,s]=v.useState("study"),a=v.useRef(null),o=v.useRef(null),l=Math.round(e.overallMastery*100),h=!Xl(),f=v.useRef([]),m=v.useRef(M=>{f.current.push(...M),f.current.length>64&&f.current.splice(0,f.current.length-64)}).current,d=v.useRef([]),p=v.useRef(new Map),g=v.useRef(M=>{d.current.push(...M),d.current.length>96&&d.current.splice(0,d.current.length-96)}).current,x=e.sections.filter(M=>(M.world??"study")===i),b=e.sections.some(M=>M.world==="practice"),[k,T]=v.useState(null);v.useEffect(()=>{T(Rb(e.courseId))},[e.courseId]);const A=k?dm[k]??null:null;v.useEffect(()=>(du({nav:a.current,visible:n==="map",weather:(A==null?void 0:A.weather)??"clear"}),()=>{du({visible:!1,nav:null})}),[n,A,a]);const[E,C]=v.useState(!1);v.useEffect(()=>{if(!e.selectedNodeId)return;const M=o.current;if(!M)return;const O=M.querySelector(`[data-node-id="${CSS.escape(e.selectedNodeId)}"]`);if(!O)return;const L=M.getBoundingClientRect(),I=O.getBoundingClientRect();(I.top<L.top+60||I.bottom>L.bottom-60)&&O.scrollIntoView({behavior:"smooth",block:"center"})},[e.selectedNodeId]);const _=v.useRef(null);v.useEffect(()=>{C(!1),e.courseId&&(_.current===null||_.current!==e.courseId)&&(r("map"),s("study")),!e.courseId&&_.current!==null&&(r("import"),s("study")),_.current=e.courseId},[e.courseId]);const[w,N]=v.useState(null),S=v.useRef({}),R=v.useRef(null);return v.useEffect(()=>{var I;const M=S.current,O={};let L=!1;for(const j of e.tree){const U=((I=e.progressMap[j.id])==null?void 0:I.status)??"locked";O[j.id]=U,M[j.id]==="locked"&&U!=="locked"&&(L=!0)}L&&Object.keys(M).length>0&&er("unlock"),S.current=O},[e.tree,e.progressMap]),u.jsxs("nav",{ref:a,className:`map-rail-scope relative h-full flex flex-col bg-surface-rail shrink-0 overflow-hidden ${e.fullWidth?"w-full":"w-[300px]"}`,"data-testid":"map-rail",children:[A&&u.jsxs(u.Fragment,{children:[u.jsx(ny,{scrollRef:o,navRef:a,preset:A}),u.jsx(ry,{scrollRef:o,navRef:a,preset:A,getImpacts:()=>f.current.splice(0),getFlakes:()=>d.current.splice(0),orbSnowRef:p})]}),u.jsxs("div",{className:"absolute top-0 left-0 right-0 z-40 px-2 pt-2 pb-2 pointer-events-none [&_button]:pointer-events-auto","data-testid":"map-rail-topbar",children:[u.jsxs("div",{className:"flex p-1 rounded-lg gap-1 mb-2",style:{background:"rgb(var(--surface-rail-rgb) / 0.55)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[u.jsxs("button",{onClick:()=>r("map"),"data-testid":"map-tab-map",className:`flex-1 flex items-center justify-center gap-1 py-1.5 rounded-md text-label font-bold transition-colors ${n==="map"?"bg-brand/20 text-brand":"text-white/50 hover:text-white/80"}`,children:[u.jsx(ec,{className:"w-3 h-3"})," ",t("map.tab.map")]}),u.jsxs("button",{onClick:()=>r("import"),"data-testid":"map-tab-import",className:`flex-1 flex items-center justify-center gap-1 py-1.5 rounded-md text-label font-bold transition-colors ${n==="import"?"bg-brand/20 text-brand":"text-white/50 hover:text-white/80"}`,children:[u.jsx(Ds,{className:"w-3 h-3"})," ",t("map.tab.import")]})]}),n==="map"&&u.jsxs("div",{className:"px-3 py-2 rounded-lg pointer-events-auto",style:{background:"rgb(var(--surface-rail-rgb) / 0.55)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("h2",{className:"text-body font-extrabold text-white truncate flex-1","data-tooltip":e.courseTitle??"",children:e.courseTitle??t("map.course.none")}),e.availableLanguages.length>0&&u.jsx(cy,{available:e.availableLanguages,current:e.currentLocale,onChange:e.onLocaleChange}),e.courseId&&u.jsx("button",{onClick:M=>{const O=M.currentTarget.getBoundingClientRect();N({id:e.courseId,title:e.courseTitle??"",rect:O})},"data-testid":"course-delete-btn","aria-label":t("import.delete.current"),"data-tooltip":t("import.delete.current"),className:"shrink-0 flex items-center justify-center w-5 h-5 rounded-md text-white/40 hover:text-warning hover:bg-white/10 transition-colors",children:u.jsx(Jf,{className:"w-3 h-3"})})]}),u.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[u.jsx("div",{className:"flex-1 h-2.5 bg-black/40 rounded-full overflow-hidden ring-1 ring-white/10",children:u.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${l>=100?"bg-gold":"bg-brand"}`,style:{width:`${Math.max(3,l)}%`}})}),u.jsxs("span",{className:"text-label font-extrabold tabular-nums text-white drop-shadow-[0_1px_3px_rgba(0,0,0,0.6)]",children:[l,"%"]})]}),u.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1.5 text-caption",children:[u.jsxs("button",{onClick:()=>C(!0),"data-testid":"map-search-btn",className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-white/5 ring-1 ring-white/10 hover:bg-white/10 transition-colors",children:[u.jsx(tc,{className:"w-3 h-3 text-white/50"}),u.jsx("span",{className:"font-bold text-white/60",children:t("map.search.label")})]}),u.jsxs("button",{onClick:e.onOpenReview,className:`flex items-center gap-1 px-1.5 py-0.5 rounded-full transition-colors ${e.dueCount>0?"bg-review/20 ring-1 ring-review/30 hover:bg-review/30":"bg-white/5 ring-1 ring-white/10 hover:bg-white/10"}`,"data-testid":"map-review-badge",children:[u.jsx(fn,{className:`w-3 h-3 ${e.dueCount>0?"text-review":"text-white/50"}`}),u.jsx("span",{className:`font-bold ${e.dueCount>0?"text-review":"text-white/60"}`,children:t("map.review.label")}),e.dueCount>0&&u.jsx("span",{className:"font-extrabold text-review tabular-nums",children:e.dueCount})]})]}),b&&u.jsxs("div",{className:"flex gap-1 mt-1.5 p-0.5 rounded-lg bg-black/30",children:[u.jsxs("button",{onClick:()=>s("study"),"data-testid":"world-tab-study",className:`flex-1 flex items-center justify-center gap-1 py-1 rounded-md text-caption font-bold transition-colors ${i==="study"?"bg-brand/30 text-brand":"text-white/50 hover:text-white/80"}`,children:[u.jsx(fn,{className:"w-3 h-3"})," ",t("map.world.study")]}),u.jsxs("button",{onClick:()=>s("practice"),"data-testid":"world-tab-practice",className:`flex-1 flex items-center justify-center gap-1 py-1 rounded-md text-caption font-bold transition-colors ${i==="practice"?"bg-accent/30 text-accent":"text-white/50 hover:text-white/80"}`,children:[u.jsx(js,{className:"w-3 h-3"})," ",t("map.world.practice")]})]})]})]}),u.jsx("div",{className:"absolute inset-0 overflow-hidden z-10",children:u.jsxs("div",{className:"flex h-full transition-transform duration-300",style:{transform:n==="map"?"translateX(0)":"translateX(-50%)",width:"200%"},children:[u.jsx("div",{className:"w-1/2 h-full relative",children:u.jsx("div",{ref:o,className:"map-path h-full overflow-y-auto overflow-x-hidden px-2 pt-48 pb-4","data-testid":"map-path",onPointerDown:M=>{R.current={x:M.clientX,y:M.clientY}},onClick:M=>{const O=R.current;R.current=null,!(!O||Math.hypot(M.clientX-O.x,M.clientY-O.y)>6)&&(M.target.closest("button, a, input, textarea, select")||Nx(M.clientX,M.clientY))},children:u.jsxs("div",{className:`map-sky-content ${A?`env-${A.season} env-${A.weather}`:""}`,children:[e.streaming&&u.jsxs("div",{className:"mb-3 mx-1 px-3 py-2 rounded-xl bg-brand/10 border border-brand/30 flex items-center gap-2 text-label text-brand font-medium backdrop-blur-sm","data-testid":"streaming-notice",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),t("map.streaming.notice")]}),e.sections.length===0?e.courseTitle?u.jsxs("div",{className:"text-center text-label text-white/60 mt-8 px-4 flex items-center justify-center gap-2",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),t("map.generating")]}):u.jsxs("button",{onClick:()=>r("import"),className:"block w-full mt-8 mx-auto p-4 rounded-2xl border-2 border-dashed border-brand/40 hover:border-brand hover:bg-brand/5 transition-all text-center group","data-testid":"map-empty-cta",children:[u.jsx("div",{className:"text-3xl mb-2 group-hover:scale-110 transition-transform",children:"🗺️"}),u.jsx("div",{className:"text-body font-bold text-white/90 mb-1",children:t("map.empty.cta.title")}),u.jsx("div",{className:"text-label text-white/60 leading-relaxed",children:t("map.empty.cta.desc")}),u.jsx("div",{className:"mt-2 text-caption text-brand font-bold",children:t("map.empty.cta.btn")})]}):x.length===0?u.jsx("div",{className:"text-center text-label text-white/60 mt-8 px-4",children:t(i==="practice"?"map.empty.practice":"map.generating")}):u.jsx("div",{className:"space-y-6 pt-2",children:x.map((M,O)=>u.jsx(sy,{section:M,sectionIndex:O,tree:e.tree,progressMap:e.progressMap,selectedNodeId:e.selectedNodeId,dueNodeIds:e.dueNodeIds,onJumpNode:e.onJumpNode,physics:h,physicsWeather:(A==null?void 0:A.weather)??"clear",scrollRef:o,navRef:a,onImpacts:m,onFlakes:g,orbSnowRef:p},M.id))})]})})}),u.jsx("div",{className:"w-1/2 h-full overflow-y-auto px-3 pt-20 pb-3 space-y-2.5",children:u.jsx(ty,{courses:e.courses,selectedCourseId:e.courseId,onSelectCourse:M=>{e.onSelectCourse(M),r("map")},onDeleteCourse:(M,O,L)=>N({id:M,title:O,rect:L}),onCoursesChanged:e.onCoursesChanged})})]})}),E&&e.courseId&&u.jsx(sb,{sections:e.sections,tree:e.tree,progressMap:e.progressMap,selectedNodeId:e.selectedNodeId,onJump:M=>{s(M.world??"study"),C(!1),$o(null,null,M.id),e.onJumpNode(M.id)},onClose:()=>C(!1)}),w&&u.jsx(oa,{anchorRect:w.rect,message:`${w.title} — ${t("import.delete.confirm")}`,danger:!0,confirmLabel:t("import.delete"),testid:"course-delete-confirm",onConfirm:()=>{e.onDeleteCourse(w.id),N(null)},onCancel:()=>N(null)})]})}function ty({courses:e,selectedCourseId:t,onSelectCourse:n,onDeleteCourse:r,onCoursesChanged:i}){const s=_e(),[a,o]=v.useState("url"),[l,c]=v.useState(!1),[h,f]=v.useState(""),[m,d]=v.useState(""),p=v.useRef(null),g=v.useRef(null),x=v.useRef(null),[b,k]=v.useState(""),[T,A]=v.useState(""),[E,C]=v.useState(!1),[_,w]=v.useState(null),[N,S]=v.useState(null),[R,M]=v.useState(null),[O,L]=v.useState(null),[I,j]=v.useState([]),[,U]=v.useState(0),B=v.useRef(null);v.useEffect(()=>{const re=X.on("import:progress",le=>{j(xe=>{const ke=/\d+\/\d+/.test(le),ze=xe[xe.length-1];if(ke&&ze&&ze.status==="working"){const Ge=[...xe];return Ge[Ge.length-1]={...ze,msg:le},Ge}const Te=xe.map(Ge=>Ge.status==="working"?{...Ge,status:"done"}:Ge);return Te.push({msg:le,status:"working",ts:Date.now()}),Te})}),ie=setInterval(()=>U(le=>le+1),1e3);return()=>{re(),clearInterval(ie)}},[]),v.useEffect(()=>X.on("import:done",ie=>{C(!1),zt(!1),ie.cancelled||Mx(ie.ok),M(ie.ok?null:ie.planId??null),ie.ok?(S(`${s("import.success.folder")}: ${ie.title??""}${ie.reused?`(${s("import.success.reused")})`:""}`),L(ie.courseId?{courseId:ie.courseId,packable:ie.packable??!1}:null),i()):ie.cancelled?(j([]),w(null),S(s("import.cancelled"))):w(ie.error??"导入失败")}),[i,s]),v.useEffect(()=>{const re=B.current;re&&(re.scrollTop=re.scrollHeight)},[I]);const W=async()=>{if(!(!h.trim()||E)){w(null),S(null),j([]);try{await X.importUrl(h.trim()),C(!0),zt(!0)}catch(re){w(re instanceof Error?re.message:String(re))}}},D=async()=>{if(!(!b.trim()||E)){w(null),S(null),j([]);try{await X.importText({name:T.trim()||void 0,text:b.trim()}),C(!0),zt(!0)}catch(re){w(re instanceof Error?re.message:String(re))}}},q=async()=>{var ie;if(E)return;if(w(null),S(null),j([]),!xn){(ie=g.current)==null||ie.click();return}await X.importEpub().catch(le=>(w(le instanceof Error?le.message:String(le)),null))&&(C(!0),zt(!0))},Z=async re=>{if(!(!re||E)){w(null),S(null),j([]);try{const ie=new Uint8Array(await re.arrayBuffer());let le="";for(let ke=0;ke<ie.length;ke+=32768)le+=String.fromCharCode(...ie.subarray(ke,ke+32768));await X.importEpub({fileName:re.name,contentBase64:btoa(le)})&&C(!0),zt(!0)}catch(ie){w(ie instanceof Error?ie.message:String(ie))}}},P=async()=>{if(E)return;if(w(null),S(null),j([]),!xn){const ie=m.trim();if(!ie){w(s("import.folder.pathRequired"));return}try{await X.importLocalFolder(ie)&&C(!0),zt(!0)}catch(le){w(le instanceof Error?le.message:String(le))}return}await X.importLocalFolder()&&(C(!0),zt(!0))},K=async()=>{var ie;if(E)return;if(w(null),S(null),j([]),!xn){(ie=p.current)==null||ie.click();return}await X.importPack().catch(le=>(w(le instanceof Error?le.message:String(le)),null))&&(C(!0),zt(!0))},V=async re=>{if(!(!re||E)){w(null),S(null),j([]);try{const ie=await re.text();await X.importPack({fileName:re.name,content:ie})&&C(!0),zt(!0)}catch(ie){w(ie instanceof Error?ie.message:String(ie))}}},$=async()=>{var ie;if(E)return;if(w(null),S(null),j([]),!xn){(ie=x.current)==null||ie.click();return}await X.importAudio().catch(le=>(w(le instanceof Error?le.message:String(le)),null))&&(C(!0),zt(!0))},ae=async re=>{if(!(!re||re.length===0||E)){w(null),S(null),j([]);try{const ie=[];for(const xe of Array.from(re)){const ke=new Uint8Array(await xe.arrayBuffer());let ze="";for(let Te=0;Te<ke.length;Te+=32768)ze+=String.fromCharCode(...ke.subarray(Te,Te+32768));ie.push({fileName:xe.name,contentBase64:btoa(ze)})}await X.importAudio(ie)&&C(!0),zt(!0)}catch(ie){w(ie instanceof Error?ie.message:String(ie))}}},ne=async re=>{if(!E){w(null),j([]);try{await X.importResume(re),C(!0),zt(!0)}catch(ie){w(ie instanceof Error?ie.message:String(ie))}}},Y=async re=>{try{const ie=await X.exportPack(re);ie!=null&&ie.content&&ie.fileName?(ye(ie.fileName,ie.content),S(s("import.pack.exported",{path:ie.fileName}))):ie!=null&&ie.path&&S(s("import.pack.exported",{path:ie.path}))}catch(ie){w(ie instanceof Error?ie.message:String(ie))}},ye=(re,ie)=>{const le=new Blob([ie],{type:"application/json"}),xe=URL.createObjectURL(le),ke=document.createElement("a");ke.href=xe,ke.download=re,ke.click(),setTimeout(()=>URL.revokeObjectURL(xe),5e3)};return u.jsxs(u.Fragment,{children:[e.length===0?u.jsxs("div",{className:"text-center py-10",children:[u.jsx("div",{className:"text-3xl mb-2 opacity-30",children:"📚"}),u.jsx("p",{className:"text-label text-white/45 leading-relaxed",children:s("import.empty")})]}):u.jsx("div",{className:"space-y-2","data-testid":"course-list",children:e.map(re=>{const ie=re.id===t;return u.jsxs("div",{"data-testid":"course-row",className:`relative rounded-xl transition-all duration-150 group ${ie?"bg-brand/12 ring-1 ring-brand/40":"bg-white/5 hover:bg-white/10 hover:-translate-y-0.5"}`,children:[u.jsx("button",{onClick:()=>n(re.id),className:"w-full text-left p-3",children:u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:`text-body font-bold truncate ${ie?"text-brand":"text-white/90"}`,children:re.title}),u.jsx("div",{className:"text-caption text-white/40 truncate mt-0.5",children:re.repoName})]}),ie&&u.jsx("span",{className:"shrink-0 w-5 h-5 rounded-full bg-brand flex items-center justify-center",children:u.jsx(Bt,{className:"w-3 h-3 text-white"})})]})}),u.jsxs("div",{className:"absolute bottom-1.5 right-2 flex items-center gap-2.5 opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100 focus-within:opacity-100 transition-opacity",children:[u.jsxs("button",{onClick:le=>{le.stopPropagation(),w(null),S(null),X.exportPack(re.id).then(xe=>{xe!=null&&xe.content&&xe.fileName?(ye(xe.fileName,xe.content),S(s("import.pack.exported",{path:xe.fileName}))):xe!=null&&xe.path&&S(s("import.pack.exported",{path:xe.path}))}).catch(xe=>{w(xe instanceof Error?xe.message:String(xe))})},"data-testid":"course-row-export",className:"text-caption text-white/40 hover:text-brand flex items-center gap-0.5",children:[u.jsx(ku,{className:"w-2.5 h-2.5"})," ",s("import.export")]}),u.jsxs("button",{onClick:le=>{le.stopPropagation();const xe=le.currentTarget.getBoundingClientRect();r(re.id,re.title,xe)},"data-testid":"course-row-delete",className:"text-caption text-white/40 hover:text-warning flex items-center gap-0.5",children:[u.jsx(Jf,{className:"w-2.5 h-2.5"})," ",s("import.delete")]})]})]},re.id)})}),u.jsxs("div",{className:e.length>0?"mt-6":"",children:[u.jsxs("button",{onClick:()=>c(!l),className:`w-full flex items-center justify-center gap-1.5 py-3 rounded-xl border-2 border-dashed transition-all text-body font-bold ${l?"border-brand/40 bg-brand/8 text-brand":"border-white/20 hover:border-brand/50 hover:bg-brand/8 text-white/70 hover:text-brand"}`,children:[u.jsx(aa,{className:`w-4 h-4 transition-transform ${l?"rotate-45":""}`})," ",s("import.cta")]}),l&&u.jsxs("div",{className:"mt-3 space-y-3",children:[E?u.jsxs("div",{className:"rounded-xl bg-black/30 border border-brand/30 p-4","data-testid":"import-progress",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin shrink-0"}),u.jsx("span",{className:"text-body font-bold text-white/90",children:s("import.progress.title")}),u.jsx("button",{onClick:()=>{X.importCancel()},"data-testid":"import-cancel-btn",className:"ml-auto text-caption text-white/50 hover:text-warning transition-colors",children:s("import.progress.cancel")})]}),u.jsx("div",{className:"text-caption text-white/40 mb-2.5",children:s("import.progress.note")}),(a==="url"?h.trim():a==="markdown"&&T.trim())?u.jsx("div",{className:"text-caption text-white/40 font-mono truncate mb-2.5",children:a==="url"?h.trim():T.trim()}):null,u.jsx("div",{ref:B,className:"space-y-1.5 max-h-[40vh] overflow-y-auto pr-1",children:I.length===0?u.jsx("div",{className:"text-caption text-white/50 py-1",children:s("import.progress.starting")}):I.map((re,ie)=>u.jsxs("div",{className:"flex items-start gap-1.5 text-caption",children:[re.status==="done"?u.jsx(Bt,{className:"w-3 h-3 text-brand shrink-0 mt-px"}):u.jsx("span",{className:"inline-block w-2.5 h-2.5 border-2 border-brand border-t-transparent rounded-full animate-spin shrink-0 mt-px"}),u.jsxs("span",{className:re.status==="done"?"text-white/40":"text-white/90",children:[re.msg,re.status==="working"&&u.jsxs("span",{className:"text-white/35 ml-1",children:["(",s("import.progress.elapsed",{s:Math.floor((Date.now()-re.ts)/1e3)}),")"]})]})]},ie))})]}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"@container flex flex-wrap gap-1 p-1 bg-white/5 rounded-lg",children:[{k:"url",label:s("import.tab.url"),icon:S1},{k:"markdown",label:s("import.tab.md"),icon:Ds},{k:"folder",label:s("import.tab.folder"),icon:b1},{k:"epub",label:s("import.tab.epub"),icon:fn},{k:"audio",label:s("import.tab.audio"),icon:ls},{k:"pack",label:s("import.tab.pack"),icon:ku}].map(({k:re,label:ie,icon:le})=>u.jsxs("button",{onClick:()=>o(re),className:`min-w-[72px] flex-1 flex items-center justify-center gap-0.5 py-1.5 px-0.5 rounded-md font-bold transition-colors ${a===re?"bg-brand/15 text-brand":"text-white/50 hover:text-white/80"}`,children:[u.jsx(le,{className:"w-3 h-3 shrink-0"}),u.jsx("span",{className:"whitespace-nowrap",style:{fontSize:"clamp(0.75rem, 4cqi, 0.875rem)"},children:ie})]},re))}),a==="url"?u.jsxs("section",{className:"space-y-2","data-testid":"import-url-section",children:[u.jsx("input",{type:"text",value:h,onChange:re=>f(re.target.value),placeholder:s("import.url.placeholder"),"data-testid":"repo-url-input",className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors"}),u.jsx("p",{className:"text-caption text-white/45 leading-relaxed",children:s("import.url.desc")}),u.jsx("button",{onClick:W,disabled:!h.trim()||E,"data-testid":"import-url-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:s("import.btn.url")})]}):a==="markdown"?u.jsxs("section",{className:"space-y-2","data-testid":"import-md-section",children:[u.jsx("input",{type:"text",value:T,onChange:re=>A(re.target.value),placeholder:s("import.placeholder.name"),"data-testid":"md-name-input",className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors"}),u.jsx("textarea",{value:b,onChange:re=>k(re.target.value),placeholder:s("import.placeholder.md"),"data-testid":"md-text-input",rows:4,className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors resize-none"}),u.jsx("button",{onClick:D,disabled:!b.trim()||E,"data-testid":"import-md-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:s("import.btn.md")})]}):a==="folder"?u.jsxs("section",{className:"space-y-2","data-testid":"import-folder-section",children:[u.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:s("import.folder.desc")}),!xn&&u.jsx("input",{type:"text",value:m,onChange:re=>d(re.target.value),placeholder:s("import.folder.pathPlaceholder"),"data-testid":"import-folder-path",className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors"}),u.jsx("button",{onClick:P,disabled:E||!xn&&!m.trim(),"data-testid":"import-folder-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:s("import.btn.folder")})]}):a==="epub"?u.jsxs("section",{className:"space-y-2","data-testid":"import-epub-section",children:[u.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:s("import.epub.desc")}),!xn&&u.jsx("input",{ref:g,type:"file",accept:".epub,application/epub+zip",className:"hidden","data-testid":"import-epub-file",onChange:re=>{var ie;Z((ie=re.target.files)==null?void 0:ie[0]),re.currentTarget.value=""}}),u.jsx("button",{onClick:q,disabled:E,"data-testid":"import-epub-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:s("import.btn.epub")})]}):a==="audio"?u.jsxs("section",{className:"space-y-2","data-testid":"import-audio-section",children:[u.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:s("import.audio.desc")}),!xn&&u.jsx("input",{ref:x,type:"file",multiple:!0,accept:".wav,.mp3,.m4a,.flac,.aac,.ogg,.opus,audio/*",className:"hidden","data-testid":"import-audio-file",onChange:re=>{ae(re.target.files),re.currentTarget.value=""}}),u.jsx("button",{onClick:$,disabled:E,"data-testid":"import-audio-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:s("import.btn.audio")})]}):u.jsxs("section",{className:"space-y-2","data-testid":"import-pack-section",children:[u.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:s("import.pack.desc")}),!xn&&u.jsx("input",{ref:p,type:"file",accept:".json,application/json",className:"hidden","data-testid":"import-pack-file",onChange:re=>{var ie;V((ie=re.target.files)==null?void 0:ie[0]),re.currentTarget.value=""}}),u.jsx("button",{onClick:K,disabled:E,"data-testid":"import-pack-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:s("import.btn.pack")})]})]}),_&&u.jsxs("div",{className:"border border-warning/40 text-warning-light text-label rounded-lg p-2 whitespace-pre-wrap","data-testid":"import-error",children:[_,R&&u.jsx("button",{onClick:()=>void ne(R),disabled:E,"data-testid":"import-resume-btn",className:"block mt-1.5 text-label font-bold text-warning-light hover:text-warning underline underline-offset-2 disabled:opacity-40",children:s("import.error.resume")})]}),N&&u.jsxs("div",{className:"border border-brand/30 text-brand text-label rounded-lg p-2","data-testid":"import-success",children:[u.jsx(Bt,{className:"inline-block w-3.5 h-3.5 mr-1 align-[-3px]"}),N,(O==null?void 0:O.packable)&&u.jsx("button",{onClick:()=>void Y(O.courseId),disabled:E,"data-testid":"import-export-pack-btn",className:"block mt-1.5 text-label font-bold hover:underline underline-offset-2 disabled:opacity-40",children:s("import.pack.export")})]})]})]})]})}function ny({scrollRef:e,navRef:t,preset:n}){const r=v.useRef(null);return v.useEffect(()=>{const i=r.current,s=e.current,a=t.current;return!i||!s||!a?void 0:Zb(i,s,a,n)},[e,t,n]),u.jsx("canvas",{ref:r,className:"map-sky-canvas","aria-hidden":"true"})}function ry({scrollRef:e,navRef:t,preset:n,getImpacts:r,getFlakes:i,orbSnowRef:s}){const a=v.useRef(null);return v.useEffect(()=>{const o=a.current,l=t.current,c=e.current;if(!o||!l||!c)return;let h=null,f=null;const m=()=>{h=null,f=null},d=new MutationObserver(m);d.observe(c,{childList:!0,subtree:!0}),window.addEventListener("resize",m);const g=Jb(o,l,n,()=>{var k,T;h||(h=Array.from(c.querySelectorAll(".lesson-bubble")));const x=f??l.getBoundingClientRect();f=x;const b=[];for(const A of h){const E=A.getBoundingClientRect();if(E.bottom<x.top||E.top>x.bottom)continue;const C=(k=A.closest("[data-node-id]"))==null?void 0:k.getAttribute("data-node-id"),_=C?(T=s==null?void 0:s.current)==null?void 0:T.get(C):void 0;b.push({x:E.left-x.left+E.width/2,y:E.top-x.top+E.height/2,r:E.width/2,..._!==void 0?{snow:_}:{}})}return b},r,i);return()=>{g(),d.disconnect(),window.removeEventListener("resize",m)}},[e,t,n,r,i]),u.jsx("canvas",{ref:a,className:"map-orb-weather-canvas","aria-hidden":"true"})}function sy({section:e,sectionIndex:t,tree:n,progressMap:r,selectedNodeId:i,dueNodeIds:s,onJumpNode:a,physics:o,physicsWeather:l,scrollRef:c,navRef:h,onImpacts:f,onFlakes:m,orbSnowRef:d}){const p=n.filter(V=>V.parentId===e.id).sort((V,$)=>V.orderIdx-$.orderIdx),g=p.filter(V=>V.type==="lesson"),x=g.length>0&&g.every(V=>{var $;return((($=r[V.id])==null?void 0:$.mastery)??0)>=nm}),b=v.useRef(null),[k,T]=v.useState(268);v.useEffect(()=>{if(!b.current)return;const V=()=>{var ne;const ae=((ne=b.current)==null?void 0:ne.clientWidth)??268;T(ae>0?ae:268)};V();const $=new ResizeObserver(V);return $.observe(b.current),()=>$.disconnect()},[]);const A=fb(p.length,k,e.id),E=A.height,C=110,_=76,w=v.useRef(null),N=v.useRef(new Map),S=v.useRef(0),R=v.useRef(null),M=v.useRef(0),O=p.map(V=>V.id).join(","),L=p.map(V=>{var $;return(V.type==="exam"?!x:((($=r[V.id])==null?void 0:$.status)??"locked")==="locked")?1:0}).join("");v.useEffect(()=>{var Xe,De;if(!o||p.length===0||k<=0)return;const V=b.current,$=c.current;if(!V||!$)return;let ae;const ne=p[p.length-1];if((ne==null?void 0:ne.type)==="exam"){const we=(De=(Xe=V.closest("section"))==null?void 0:Xe.nextElementSibling)==null?void 0:De.querySelector(".map-signpost");we&&(ae={x:ei(`${e.id}:next`,k),y:we.getBoundingClientRect().top-V.getBoundingClientRect().top})}const Y=_b({nodes:A.nodes.map((we,ee)=>{const ce=p[ee];return{id:ce.id,x:we.x,y:we.y,isExam:ce.type==="exam",locked:I(ce),spawn:(()=>{const ve=N.current.get(ce.id);return ve?Ib(ve,S.current,k):void 0})()}}),width:k,height:A.height+40,weather:l,anchorKnotX:ei(`${e.id}:knot`,k),nextKnot:ae});w.current=Y,_x(e.id,Y,V);const ye=V.querySelector("[data-next-knot]");ye&&(Y.nextKnot?(ye.setAttribute("cx",String(Y.nextKnot.x)),ye.setAttribute("cy",String(Y.nextKnot.y))):ye.setAttribute("opacity","0"));const re=V.querySelector("[data-exam-rope]");re&&!Y.nextKnot&&re.setAttribute("opacity","0");const ie=new Map;for(const we of V.querySelectorAll("[data-node-id]"))we.dataset.nodeId&&ie.set(we.dataset.nodeId,we);const le=Array.from(V.querySelectorAll("[data-rope]")),xe=Array.from(V.querySelectorAll("[data-pulse]")),ke=Array.from(V.querySelectorAll("[data-field]"));let ze=!0;const Te=new IntersectionObserver(we=>{for(const ee of we)ze=ee.isIntersecting},{root:$,rootMargin:"200px 0px 200px 0px"});Te.observe(V);const Ge=520,oe=[];let Ie=0,We=performance.now();const Ue=we=>{var Se;Ie=requestAnimationFrame(Ue);const ee=Math.min(50,we-We);if(We=we,!ze)return;Y.step(ee);for(const de of Y.balls){const be=ie.get(de.nodeId);be&&(be.style.transform=kb(de.body.position.x-de.layoutX,de.body.position.y-de.layoutY,de.squash,de.squashAngle)),de.squash=Eb(de.squash,ee),(Se=d.current)==null||Se.set(de.nodeId,de.snow)}const ce=de=>{if(de==="__anchor")return Y.anchor;if(de==="__next")return Y.nextKnot??Y.anchor;const be=Y.ball(de);if(be)return{x:be.body.position.x,y:be.body.position.y+$t*yn};const Ce=p.findIndex(Mt=>Mt.id===de),Ve=Ce>=0?A.nodes[Ce]:void 0;return Ve?{x:Ve.x,y:Ve.y+$t*yn}:{x:0,y:0}};for(let de=0;de<Y.links.length&&de<le.length;de++){const be=Y.links[de],Ce=[ce(be.from)];for(const Ve of be.particles)Ce.push({x:Ve.position.x,y:Ve.position.y});Ce.push(ce(be.to)),le[de].setAttribute("d",vb(Ce))}for(let de=0;de<Y.balls.length&&de<ke.length;de++){const be=Y.balls[de],Ce=ke[de];be.field>.03?(Ce.setAttribute("cx",String(be.body.position.x)),Ce.setAttribute("cy",String(be.body.position.y)),Ce.setAttribute("r",String($t+4+be.field*5)),Ce.setAttribute("opacity",String((.3*be.field).toFixed(3)))):Ce.setAttribute("opacity","0")}const ve=Y.drainImpacts();for(const de of ve)oe.push({x:de.x,y:de.y,t0:we,s:Math.min(1,de.speed/14)});for(let de=oe.length-1;de>=0;de--)we-oe[de].t0>Ge&&oe.splice(de,1);for(let de=0;de<xe.length;de++){const be=oe[de],Ce=xe[de];if(!be){Ce.setAttribute("opacity","0");continue}const Ve=(we-be.t0)/Ge;Ce.setAttribute("cx",String(be.x)),Ce.setAttribute("cy",String(be.y)),Ce.setAttribute("r",String(6+Ve*(14+be.s*14))),Ce.setAttribute("opacity",String(.55*(1-Ve))),Ce.setAttribute("stroke-width",String(2+be.s*1.5))}const ge=Y.drainFlakes();if((ve.length>0||ge.length>0)&&h.current){const de=V.getBoundingClientRect(),be=h.current.getBoundingClientRect(),Ce=Ve=>({x:Ve.x+de.left-be.left,y:Ve.y+de.top-be.top});ve.length>0&&f(ve.map(Ve=>({...Ce(Ve),speed:Ve.speed}))),ge.length>0&&m(ge.map(Ve=>({...Ce(Ve),vx:Ve.vx,vy:Ve.vy,amount:Ve.amount})))}};return Ie=requestAnimationFrame(Ue),()=>{cancelAnimationFrame(Ie),Te.disconnect();for(const we of Y.balls)N.current.set(we.nodeId,{x:we.body.position.x,y:we.body.position.y,vx:we.body.velocity.x,vy:we.body.velocity.y});S.current=k,Ix(e.id),Y.dispose(),w.current=null;for(const we of ie.values())we.style.transform=""}},[o,k,O,L,e.id,l]);const I=V=>{var $;return V?V.type==="exam"?!x:((($=r[V.id])==null?void 0:$.status)??"locked")==="locked":!0},j=(V,$)=>{if(!(!w.current||V.button!==0||I(p.find(Y=>Y.id===$))||!b.current)){try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}M.current=0,R.current={track:{startX:V.clientX,startY:V.clientY},id:V.pointerId,dragging:!1,nodeId:$}}},U=V=>{const $=R.current,ae=w.current;if(!$||!ae||V.pointerId!==$.id)return;const ne=b.current;if(!ne||(!$.dragging&&Au($.track,V.clientX,V.clientY)==="drag"&&($.dragging=!0,V.currentTarget.style.zIndex="40",ae.beginDrag($.nodeId,V.clientX-ne.getBoundingClientRect().left,V.clientY-ne.getBoundingClientRect().top)),!$.dragging))return;const Y=ne.getBoundingClientRect();ae.moveDrag(V.clientX-Y.left,V.clientY-Y.top)},B=V=>{var ae;const $=R.current;if(!(!$||V.pointerId!==$.id)){if((ae=w.current)==null||ae.endDrag(),V.currentTarget.style.zIndex="",Au($.track,V.clientX,V.clientY)==="drag")M.current=Date.now()+300;else{const ne=p.find(Y=>Y.id===$.nodeId);ne&&Date.now()>=M.current&&!I(ne)&&($o(V.clientX,V.clientY,ne.id),a(ne.id))}R.current=null}},W=V=>{const $=p[V],ae=$?r[$.id]:void 0,ne=(ae==null?void 0:ae.status)==="mastered"||(ae==null?void 0:ae.status)==="in_progress"||(ae==null?void 0:ae.status)==="available";return{stroke:ne?"var(--brand)":"var(--ink-faint)",strokeWidth:ne?4:2.5,strokeOpacity:ne?.6:.5,strokeDasharray:ne?"none":"3 7"}},D=A.nodes[0]?{x:ei(`${e.id}:knot`,k),y:Ui}:{x:k/2,y:Ui},q=p[p.length-1],Z=(q==null?void 0:q.type)==="exam",P=A.nodes[A.nodes.length-1],K=Z&&P?{x:ei(`${e.id}:next`,k),y:E+24}:void 0;return u.jsxs("section",{"data-testid":`map-section-${e.id.slice(0,8)}`,className:"py-3 px-2",children:[u.jsxs("div",{className:"map-signpost flex items-center gap-2 mb-3 px-2.5 py-1.5 rounded-lg shadow-sm",children:[u.jsx("span",{className:"w-6 h-6 rounded-full bg-gold text-neutral-900 text-caption font-extrabold flex items-center justify-center shrink-0 ring-2 ring-gold/40 shadow-sm",children:t+1}),u.jsx("span",{className:"text-label font-bold text-white truncate flex-1 drop-shadow-[0_1px_2px_rgba(0,0,0,0.7)]",children:e.title})]}),u.jsxs("div",{ref:b,className:"relative",style:{minHeight:E},children:[u.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none","aria-hidden":"true",style:{height:E,overflow:"visible"},children:o?u.jsxs(u.Fragment,{children:[A.nodes[0]&&u.jsx("circle",{cx:D.x,cy:D.y,r:3.5,fill:"#ffc800",opacity:.9}),A.nodes[0]&&u.jsx("path",{"data-rope":0,d:`M ${D.x} ${D.y} L ${A.nodes[0].x} ${A.nodes[0].y+$t*yn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(0)}),A.segments.map((V,$)=>u.jsx("path",{"data-rope":$+1,d:`M ${V.from.x} ${V.from.y+$t*yn} L ${V.to.x} ${V.to.y+$t*yn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(V.index)},V.index)),K&&P&&u.jsxs(u.Fragment,{children:[u.jsx("path",{"data-rope":A.segments.length+1,"data-exam-rope":!0,d:`M ${K.x} ${K.y} L ${P.x} ${P.y+$t*yn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(p.length-1)}),u.jsx("circle",{"data-next-knot":!0,cx:K.x,cy:K.y,r:3.5,fill:"#ffc800",opacity:.9})]}),Array.from({length:8},(V,$)=>u.jsx("circle",{"data-pulse":$,cx:0,cy:0,r:0,fill:"none",stroke:"white",opacity:0},$)),p.map((V,$)=>u.jsx("circle",{"data-field":$,cx:0,cy:0,r:0,fill:"none",stroke:"#1cb0f6",strokeWidth:2,opacity:0},`f-${V.id}`))]}):A.segments.map(V=>{const $=iy(p[V.index],r);return u.jsx("path",{d:mb(V),stroke:$?"var(--brand)":"var(--ink-faint)",strokeWidth:$?4:2.5,strokeOpacity:$?.6:.5,fill:"none",strokeLinecap:"round",strokeDasharray:$?"none":"3 7",style:$?{pathLength:1,animation:"path-draw 600ms var(--ease-out-expo)"}:void 0},V.index)})}),p.map((V,$)=>{const ae=A.nodes[$];if(!ae)return null;const ne=el(V.id),Y=`${ne%40/10}s`,ye=`${5+ne%30/10}s`;return u.jsx("div",{"data-node-id":V.id,"data-noswipe":"",className:o?`absolute hover:z-30 will-change-transform ${I(V)?"cursor-not-allowed":"cursor-grab active:cursor-grabbing"}`:"absolute balloon-bob hover:z-30",style:{left:ae.x-C/2,top:ae.y-_/2+10,width:C,...o?{touchAction:"pan-y"}:{"--bob-delay":Y,"--bob-duration":ye}},onPointerDown:o?re=>j(re,V.id):void 0,onPointerMove:o?U:void 0,onPointerUp:o?B:void 0,onPointerCancel:o?B:void 0,children:u.jsx(ay,{lesson:V,progress:r[V.id],isSelected:V.id===i,isDue:s.has(V.id),chapterLessonsMastered:x,onClick:()=>{Date.now()<M.current||($o(null,null,V.id),a(V.id))}})},V.id)})]})]})}function iy(e,t){const n=e?t[e.id]:void 0;return(n==null?void 0:n.status)==="mastered"||(n==null?void 0:n.status)==="in_progress"||(n==null?void 0:n.status)==="available"}function ay({lesson:e,progress:t,isSelected:n,isDue:r,chapterLessonsMastered:i,onClick:s}){const a=_e(),o=(t==null?void 0:t.status)??"locked",l=(t==null?void 0:t.crownLevel)??0,c=e.type==="exam",h=Math.min(3,l),f=c?!i:o==="locked",m=c&&f,d=!c&&(o==="in_progress"||o==="mastered"),p=o==="mastered"?100:o==="in_progress"?Math.round(((t==null?void 0:t.mastery)??0)*100):0;return u.jsxs("div",{className:"group relative flex flex-col items-center w-full",children:[u.jsxs("button",{onClick:()=>!f&&s(),disabled:f,"data-testid":`${c?"exam-node":"map-node"}-${e.id.slice(0,8)}`,className:`group relative w-14 h-14 flex items-center justify-center text-2xl rounded-full transition-all duration-200 ${c?m?"lesson-bubble exam-bubble-locked":ly(l>0):oy(o)} ${f?"cursor-not-allowed":"cursor-pointer hover:scale-105"} ${n?"ring-4 ring-accent ring-offset-2 ring-offset-neutral-50 dark:ring-offset-neutral-950":""}`,title:void 0,"data-tooltip":m?`🔒 ${e.title}${a("node.locked.chapterHint")}`:c?`🎯 ${e.title}`:f?`🔒 ${e.title}`:r?`📖 ${e.title}${a("node.due.hint")}`:e.title,children:[d&&u.jsxs("svg",{className:"absolute inset-0 w-full h-full -rotate-90 pointer-events-none",viewBox:"0 0 56 56","aria-hidden":"true",children:[u.jsx("circle",{cx:"28",cy:"28",r:"25",fill:"none",stroke:"rgb(255 255 255 / 0.2)",strokeWidth:"2.5"}),u.jsx("circle",{cx:"28",cy:"28",r:"25",fill:"none",stroke:o==="mastered"?"#ffc800":"white",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${p/100*157} 157`,className:"transition-all duration-500"})]}),c?m?u.jsx("span",{"aria-label":"exam-locked",className:"relative z-10 opacity-60",children:"🔒"}):u.jsx(Nr,{"aria-label":"exam",className:"relative z-10 w-6 h-6 text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.4)]",strokeWidth:2.5}):f?u.jsx("span",{"aria-label":"locked",className:"relative z-10 opacity-50",children:"🔒"}):o==="mastered"?u.jsx("span",{"aria-label":"mastered",className:"relative z-10 drop-shadow-lg crown-sparkle",children:"👑"}):o==="in_progress"?u.jsx(fn,{"aria-label":"in-progress",className:"relative z-10 w-6 h-6 text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.4)]",strokeWidth:2.5}):u.jsx("span",{"aria-label":"available",className:"relative z-10 drop-shadow",children:"⭐"}),r&&!f&&!c&&u.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-review text-white text-caption flex items-center justify-center font-bold border-2 border-neutral-50 dark:border-neutral-950",children:"!"})]}),c&&u.jsx("div",{className:"flex gap-0.5 mt-1","data-testid":`map-stars-${e.id.slice(0,8)}`,children:[0,1,2].map(g=>u.jsx("span",{className:`text-caption ${g<h?"text-gold":"text-white/25"}`,children:"★"},g))}),n&&u.jsx("div",{className:"mt-1 text-caption text-center leading-tight max-w-[120px] font-bold px-1.5 py-0.5 rounded-md bg-brand/90 text-white shadow-sm",children:e.title})]})}function oy(e){switch(e){case"locked":return"lesson-bubble lesson-bubble-locked";case"available":return"lesson-bubble lesson-bubble-available";case"in_progress":return"lesson-bubble lesson-bubble-in-progress";case"mastered":return"lesson-bubble lesson-bubble-mastered";default:return"lesson-bubble lesson-bubble-locked"}}function ly(e){return e?"lesson-bubble exam-bubble-passed":"lesson-bubble exam-bubble"}function cy({available:e,current:t,onChange:n}){const r=_e(),[i,s]=v.useState(!1),a={en:"English","zh-CN":"中文","zh-TW":"繁體",ja:"日本語",ko:"한국어",fr:"Français",de:"Deutsch",es:"Español","pt-BR":"Português",ru:"Русский",it:"Italiano",ar:"العربية",hi:"हिन्दी",tr:"Türkçe",pl:"Polski",nl:"Nederlands",id:"Indonesia",vi:"Tiếng Việt",th:"ไทย",sv:"Svenska",fi:"Suomi"},o=t?a[t]??t:r("lang.original");return u.jsxs("div",{className:"relative shrink-0",children:[u.jsxs("button",{onClick:()=>s(!i),className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-caption font-bold text-white/80 hover:text-white hover:bg-white/10 transition-colors","data-testid":"lang-switcher-btn",children:[u.jsx(v1,{className:"w-3 h-3"}),o]}),i&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>s(!1)}),u.jsxs("div",{className:"absolute top-full right-0 mt-1 z-50 bg-surface-0 rounded-lg shadow-elevated p-1 min-w-[100px] max-h-48 overflow-y-auto",children:[u.jsx("button",{"data-testid":"lang-option-original",onClick:()=>{n(null),s(!1)},className:`w-full text-left px-2 py-1 rounded-md text-caption font-bold transition-colors ${t===null?"bg-brand/15 text-brand":"text-ink-muted hover:bg-neutral-100 dark:hover:bg-neutral-800"}`,children:r("lang.original")}),e.map(l=>u.jsx("button",{"data-testid":`lang-option-${l}`,onClick:()=>{n(l),s(!1)},className:`w-full text-left px-2 py-1 rounded-md text-caption font-bold transition-colors ${t===l?"bg-brand/15 text-brand":"text-ink-muted hover:bg-neutral-100 dark:hover:bg-neutral-800"}`,children:a[l]??l},l))]})]})]})}const uy=500,Vn=8;function dy(){const[e,t]=v.useState(null),[n,r]=v.useState({mode:"cursor",x:0,y:0}),[i,s]=v.useState({w:0,h:0}),a=v.useRef(null),o=v.useCallback(()=>window.matchMedia("(pointer: coarse)").matches,[]),l=v.useCallback(x=>{o()||r(b=>b.mode==="cursor"?{...b,x:x.clientX,y:x.clientY}:b)},[o]),c=v.useCallback(x=>{var T;if(o())return;const b=(T=x.target)==null?void 0:T.closest("[data-tooltip]"),k=b==null?void 0:b.getAttribute("data-tooltip");if(k){t(k),r({mode:"cursor",x:x.clientX,y:x.clientY});return}t(null)},[o]),h=v.useCallback(x=>{var k,T;if(o())return;((T=(k=x.target)==null?void 0:k.closest)==null?void 0:T.call(k,"[data-tooltip]"))&&t(null)},[o]);if(v.useEffect(()=>(document.addEventListener("mousemove",l,{passive:!0}),document.addEventListener("mouseover",c,{passive:!0}),document.addEventListener("mouseout",h,{passive:!0}),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseover",c),document.removeEventListener("mouseout",h)}),[l,c,h]),v.useEffect(()=>{let x=null;const b=()=>{x&&(clearTimeout(x),x=null)},k=C=>{var S;if(!o()||C.touches.length!==1)return b();const _=(S=C.target)==null?void 0:S.closest("[data-tooltip]"),w=_==null?void 0:_.getAttribute("data-tooltip");if(!w||!_)return b();const N=_;b(),x=setTimeout(()=>{N.isConnected&&(t(w),r({mode:"rect",x:0,y:0,rect:N.getBoundingClientRect()}))},uy)},T=()=>{b(),t(C=>C&&null)},A=()=>b(),E=()=>{b(),t(null)};return document.addEventListener("touchstart",k,{passive:!0}),document.addEventListener("touchend",T,{passive:!0}),document.addEventListener("touchmove",A,{passive:!0}),document.addEventListener("touchcancel",E,{passive:!0}),()=>{b(),document.removeEventListener("touchstart",k),document.removeEventListener("touchend",T),document.removeEventListener("touchmove",A),document.removeEventListener("touchcancel",E)}},[o]),v.useLayoutEffect(()=>{a.current&&e&&s({w:a.current.offsetWidth,h:a.current.offsetHeight})},[e]),!e)return null;const f=window.innerWidth,m=window.innerHeight;let d,p,g;if(n.mode==="rect"&&n.rect){const x=n.rect;d=x.left+x.width/2-i.w/2,p=x.top-i.h-6,g="none",p<Vn&&(p=x.bottom+6)}else d=n.x,p=n.y-6,g="translate(0, -100%)";return d=Math.min(Math.max(d,Vn),Math.max(Vn,f-i.w-Vn)),p=Math.min(Math.max(p,Vn),Math.max(Vn,m-i.h-Vn)),sc.createPortal(u.jsx("div",{ref:a,style:{position:"fixed",left:d,top:p,transform:g,zIndex:99999,pointerEvents:"none",visibility:i.w?"visible":"hidden",background:"rgb(var(--surface-0-rgb) / 0.92)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",color:"var(--ink)",border:"1px solid rgb(var(--border-rgb) / 0.5)",fontSize:"0.875rem",fontWeight:600,lineHeight:1.4,padding:"4px 10px",borderRadius:"8px",maxWidth:"260px",wordBreak:"break-word",boxShadow:"0 4px 12px rgb(var(--shadow-rgb) / 0.15)",whiteSpace:"normal"},children:e}),document.body)}function Pu(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function mm(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const hy=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fy=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,my={};function Du(e,t){return(my.jsx?fy:hy).test(e)}const py=/[ \t\n\f\r]/g;function gy(e){return typeof e=="object"?e.type==="text"?Ou(e.value):!1:Ou(e)}function Ou(e){return e.replace(py,"")===""}class Fs{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Fs.prototype.normal={};Fs.prototype.property={};Fs.prototype.space=void 0;function pm(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Fs(n,r,t)}function Cs(e){return e.toLowerCase()}class Pt{constructor(t,n){this.attribute=n,this.property=t}}Pt.prototype.attribute="";Pt.prototype.booleanish=!1;Pt.prototype.boolean=!1;Pt.prototype.commaOrSpaceSeparated=!1;Pt.prototype.commaSeparated=!1;Pt.prototype.defined=!1;Pt.prototype.mustUseProperty=!1;Pt.prototype.number=!1;Pt.prototype.overloadedBoolean=!1;Pt.prototype.property="";Pt.prototype.spaceSeparated=!1;Pt.prototype.space=void 0;let xy=0;const Me=dr(),ht=dr(),tl=dr(),fe=dr(),Ze=dr(),rr=dr(),Ft=dr();function dr(){return 2**++xy}const nl=Object.freeze(Object.defineProperty({__proto__:null,boolean:Me,booleanish:ht,commaOrSpaceSeparated:Ft,commaSeparated:rr,number:fe,overloadedBoolean:tl,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),Ya=Object.keys(nl);class oc extends Pt{constructor(t,n,r,i){let s=-1;if(super(t,n),ju(this,"space",i),typeof r=="number")for(;++s<Ya.length;){const a=Ya[s];ju(this,Ya[s],(r&nl[a])===nl[a])}}}oc.prototype.defined=!0;function ju(e,t,n){n&&(e[t]=n)}function Fr(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new oc(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Cs(r)]=r,n[Cs(s.attribute)]=r}return new Fs(t,n,e.space)}const gm=Fr({properties:{ariaActiveDescendant:null,ariaAtomic:ht,ariaAutoComplete:null,ariaBusy:ht,ariaChecked:ht,ariaColCount:fe,ariaColIndex:fe,ariaColSpan:fe,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:ht,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:ht,ariaFlowTo:Ze,ariaGrabbed:ht,ariaHasPopup:null,ariaHidden:ht,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:fe,ariaLive:null,ariaModal:ht,ariaMultiLine:ht,ariaMultiSelectable:ht,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:fe,ariaPressed:ht,ariaReadOnly:ht,ariaRelevant:null,ariaRequired:ht,ariaRoleDescription:Ze,ariaRowCount:fe,ariaRowIndex:fe,ariaRowSpan:fe,ariaSelected:ht,ariaSetSize:fe,ariaSort:null,ariaValueMax:fe,ariaValueMin:fe,ariaValueNow:fe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function xm(e,t){return t in e?e[t]:t}function bm(e,t){return xm(e,t.toLowerCase())}const by=Fr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:rr,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Me,allowPaymentRequest:Me,allowUserMedia:Me,alpha:Me,alt:null,as:null,async:Me,autoCapitalize:null,autoComplete:Ze,autoFocus:Me,autoPlay:Me,blocking:Ze,capture:null,charSet:null,checked:Me,cite:null,className:Ze,closedBy:null,colorSpace:null,cols:fe,colSpan:fe,command:null,commandFor:null,content:null,contentEditable:ht,controls:Me,controlsList:Ze,coords:fe|rr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Me,defer:Me,dir:null,dirName:null,disabled:Me,download:tl,draggable:ht,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Me,formTarget:null,headers:Ze,height:fe,hidden:tl,high:fe,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Me,inputMode:null,integrity:null,is:null,isMap:Me,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Me,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Me,low:fe,manifest:null,max:null,maxLength:fe,media:null,method:null,min:null,minLength:fe,multiple:Me,muted:Me,name:null,nonce:null,noModule:Me,noValidate:Me,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:Me,optimum:fe,pattern:null,ping:Ze,placeholder:null,playsInline:Me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Me,referrerPolicy:null,rel:Ze,required:Me,reversed:Me,rows:fe,rowSpan:fe,sandbox:Ze,scope:null,scoped:Me,seamless:Me,selected:Me,shadowRootClonable:Me,shadowRootCustomElementRegistry:Me,shadowRootDelegatesFocus:Me,shadowRootMode:null,shadowRootSerializable:Me,shape:null,size:fe,sizes:null,slot:null,span:fe,spellCheck:ht,src:null,srcDoc:null,srcLang:null,srcSet:null,start:fe,step:null,style:null,tabIndex:fe,target:null,title:null,translate:null,type:null,typeMustMatch:Me,useMap:null,value:ht,width:fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:fe,borderColor:null,bottomMargin:fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Me,declare:Me,event:null,face:null,frame:null,frameBorder:null,hSpace:fe,leftMargin:fe,link:null,longDesc:null,lowSrc:null,marginHeight:fe,marginWidth:fe,noResize:Me,noHref:Me,noShade:Me,noWrap:Me,object:null,profile:null,prompt:null,rev:null,rightMargin:fe,rules:null,scheme:null,scrolling:ht,standby:null,summary:null,text:null,topMargin:fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:fe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Me,disablePictureInPicture:Me,disableRemotePlayback:Me,exportParts:rr,part:Ze,prefix:null,property:null,results:fe,security:null,unselectable:null},space:"html",transform:bm}),yy=Fr({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:Ft,accentHeight:fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:fe,amplitude:fe,arabicForm:null,ascent:fe,attributeName:null,attributeType:null,azimuth:fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:fe,by:null,calcMode:null,capHeight:fe,className:Ze,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:fe,diffuseConstant:fe,direction:null,display:null,dur:null,divisor:fe,dominantBaseline:null,download:Me,dx:null,dy:null,edgeMode:null,editable:null,elevation:fe,enableBackground:null,end:null,event:null,exponent:fe,externalResourcesRequired:null,fill:null,fillOpacity:fe,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:rr,g2:rr,glyphName:rr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:fe,horizOriginX:fe,horizOriginY:fe,id:null,ideographic:fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:fe,k:fe,k1:fe,k2:fe,k3:fe,k4:fe,kernelMatrix:Ft,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:fe,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:fe,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:fe,overlineThickness:fe,paintOrder:null,panose1:null,path:null,pathLength:fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:fe,pointsAtY:fe,pointsAtZ:fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ft,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ft,rev:Ft,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ft,requiredFeatures:Ft,requiredFonts:Ft,requiredFormats:Ft,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:fe,specularExponent:fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:fe,strikethroughThickness:fe,string:null,stroke:null,strokeDashArray:Ft,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:fe,strokeOpacity:fe,strokeWidth:null,style:null,surfaceScale:fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ft,tabIndex:fe,tableValues:null,target:null,targetX:fe,targetY:fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ft,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:fe,underlineThickness:fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:fe,values:null,vAlphabetic:fe,vMathematical:fe,vectorEffect:null,vHanging:fe,vIdeographic:fe,version:null,vertAdvY:fe,vertOriginX:fe,vertOriginY:fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xm}),ym=Fr({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()}}),vm=Fr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bm}),Em=Fr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vy={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ey=/[A-Z]/g,Fu=/-[a-z]/g,ky=/^data[-\w.:]+$/i;function da(e,t){const n=Cs(t);let r=t,i=Pt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ky.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Fu,Ty);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Fu.test(s)){let a=s.replace(Ey,wy);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=oc}return new i(r,t)}function wy(e){return"-"+e.toLowerCase()}function Ty(e){return e.charAt(1).toUpperCase()}const Bs=pm([gm,by,ym,vm,Em],"html"),Ln=pm([gm,yy,ym,vm,Em],"svg");function Bu(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function km(e){return e.join(" ").trim()}var xr={},Ga,Hu;function Sy(){if(Hu)return Ga;Hu=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
|
|
478
|
+
`,c="/",h="*",f="",m="comment",d="declaration";function p(x,b){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];b=b||{};var k=1,T=1;function A(L){var I=L.match(t);I&&(k+=I.length);var j=L.lastIndexOf(l);T=~j?L.length-j:T+L.length}function E(){var L={line:k,column:T};return function(I){return I.position=new C(L),N(),I}}function C(L){this.start=L,this.end={line:k,column:T},this.source=b.source}C.prototype.content=x;function _(L){var I=new Error(b.source+":"+k+":"+T+": "+L);if(I.reason=L,I.filename=b.source,I.line=k,I.column=T,I.source=x,!b.silent)throw I}function w(L){var I=L.exec(x);if(I){var j=I[0];return A(j),x=x.slice(j.length),I}}function N(){w(n)}function S(L){var I;for(L=L||[];I=R();)I!==!1&&L.push(I);return L}function R(){var L=E();if(!(c!=x.charAt(0)||h!=x.charAt(1))){for(var I=2;f!=x.charAt(I)&&(h!=x.charAt(I)||c!=x.charAt(I+1));)++I;if(I+=2,f===x.charAt(I-1))return _("End of comment missing");var j=x.slice(2,I-2);return T+=2,A(j),x=x.slice(I),T+=2,L({type:m,comment:j})}}function M(){var L=E(),I=w(r);if(I){if(R(),!w(i))return _("property missing ':'");var j=w(s),U=L({type:d,property:g(I[0].replace(e,f)),value:j?g(j[0].replace(e,f)):f});return w(a),U}}function O(){var L=[];S(L);for(var I;I=M();)I!==!1&&(L.push(I),S(L));return L}return N(),O()}function g(x){return x?x.replace(o,f):f}return Ga=p,Ga}var Uu;function Cy(){if(Uu)return xr;Uu=1;var e=xr&&xr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xr,"__esModule",{value:!0}),xr.default=n;const t=e(Sy());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const a=(0,t.default)(r),o=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:h}=l;o?i(c,h,l):h&&(s=s||{},s[c]=h)}),s}return xr}var Kr={},zu;function Ay(){if(zu)return Kr;zu=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||e.test(c)},a=function(c,h){return h.toUpperCase()},o=function(c,h){return"".concat(h,"-")},l=function(c,h){return h===void 0&&(h={}),s(c)?c:(c=c.toLowerCase(),h.reactCompat?c=c.replace(i,o):c=c.replace(r,o),c.replace(t,a))};return Kr.camelCase=l,Kr}var Xr,Vu;function Ny(){if(Vu)return Xr;Vu=1;var e=Xr&&Xr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(Cy()),n=Ay();function r(i,s){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(o,l){o&&l&&(a[(0,n.camelCase)(o,s)]=l)}),a}return r.default=r,Xr=r,Xr}var _y=Ny();const Iy=Kl(_y),ha=wm("end"),pn=wm("start");function wm(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Tm(e){const t=pn(e),n=ha(e);if(t&&n)return{start:t,end:n}}function us(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$u(e.position):"start"in e||"end"in e?$u(e):"line"in e||"column"in e?rl(e):""}function rl(e){return qu(e&&e.line)+":"+qu(e&&e.column)}function $u(e){return rl(e&&e.start)+"-"+rl(e&&e.end)}function qu(e){return e&&typeof e=="number"?e:1}class wt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=us(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}wt.prototype.file="";wt.prototype.name="";wt.prototype.reason="";wt.prototype.message="";wt.prototype.stack="";wt.prototype.column=void 0;wt.prototype.line=void 0;wt.prototype.ancestors=void 0;wt.prototype.cause=void 0;wt.prototype.fatal=void 0;wt.prototype.place=void 0;wt.prototype.ruleId=void 0;wt.prototype.source=void 0;const lc={}.hasOwnProperty,My=new Map,Ry=/[A-Z]/g,Ly=new Set(["table","tbody","thead","tfoot","tr"]),Py=new Set(["td","th"]),Sm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dy(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Vy(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=zy(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ln:Bs,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Cm(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Cm(e,t,n){if(t.type==="element")return Oy(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return jy(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return By(e,t,n);if(t.type==="mdxjsEsm")return Fy(e,t);if(t.type==="root")return Hy(e,t,n);if(t.type==="text")return Uy(e,t)}function Oy(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Ln,e.schema=i),e.ancestors.push(t);const s=Nm(e,t.tagName,!1),a=$y(e,t);let o=uc(e,t);return Ly.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!gy(l):!0})),Am(e,a,s,t),cc(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function jy(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}As(e,t.position)}function Fy(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);As(e,t.position)}function By(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Ln,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Nm(e,t.name,!0),a=qy(e,t),o=uc(e,t);return Am(e,a,s,t),cc(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Hy(e,t,n){const r={};return cc(r,uc(e,t)),e.create(t,e.Fragment,r,n)}function Uy(e,t){return t.value}function Am(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cc(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function zy(e,t,n){return r;function r(i,s,a,o){const c=Array.isArray(a.children)?n:t;return o?c(s,a,o):c(s,a)}}function Vy(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=pn(r);return t(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function $y(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&lc.call(t.properties,i)){const s=Wy(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Py.has(t.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function qy(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else As(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else As(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function uc(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:My;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const o=Cm(e,s,a);o!==void 0&&n.push(o)}return n}function Wy(e,t,n){const r=da(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?mm(n):km(n)),r.property==="style"){let i=typeof n=="object"?n:Yy(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Gy(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?vy[r.property]||r.property:r.attribute,n]}}function Yy(e,t){try{return Iy(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new wt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Sm+"#cannot-parse-style-attribute",i}}function Nm(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,a;for(;++s<i.length;){const o=Du(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=Du(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return lc.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);As(e)}function As(e,t){const n=new wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Sm+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Gy(e){const t={};let n;for(n in e)lc.call(e,n)&&(t[Ky(n)]=e[n]);return t}function Ky(e){let t=e.replace(Ry,Xy);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Xy(e){return"-"+e.toLowerCase()}const Ka={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Qy={};function dc(e,t){const n=Qy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return _m(e,r,i)}function _m(e,t,n){if(Zy(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wu(e.children,t,n)}return Array.isArray(e)?Wu(e,t,n):""}function Wu(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=_m(e[i],t,n);return r.join("")}function Zy(e){return!!(e&&typeof e=="object")}const Yu=document.createElement("i");function hc(e){const t="&"+e+";";Yu.innerHTML=t;const n=Yu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ht(e,t,n,r){const i=e.length;let s=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(t,0),e.splice(...a),s+=1e4,t+=1e4}function qt(e,t){return e.length>0?(Ht(e,e.length,0,t),e):t}const Gu={}.hasOwnProperty;function Im(e){const t={};let n=-1;for(;++n<e.length;)Jy(t,e[n]);return t}function Jy(e,t){let n;for(n in t){const i=(Gu.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){Gu.call(i,a)||(i[a]=[]);const o=s[a];e2(i[a],Array.isArray(o)?o:o?[o]:[])}}}function e2(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ht(e,0,0,r)}function Mm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function nn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nt=Pn(/[A-Za-z]/),kt=Pn(/[\dA-Za-z]/),t2=Pn(/[#-'*+\--9=?A-Z^-~]/);function zi(e){return e!==null&&(e<32||e===127)}const sl=Pn(/\d/),n2=Pn(/[\dA-Fa-f]/),r2=Pn(/[!-/:-@[-`{-~]/);function Ne(e){return e!==null&&e<-2}function tt(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const fa=Pn(new RegExp("\\p{P}|\\p{S}","u")),cr=Pn(/\s/);function Pn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Br(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&kt(e.charCodeAt(n+1))&&kt(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return He(l)?(e.enter(n),o(l)):t(l)}function o(l){return He(l)&&s++<i?(e.consume(l),o):(e.exit(n),t(l))}}const s2={tokenize:i2};function i2(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),qe(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),s(o)}function s(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return Ne(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),a)}}const a2={tokenize:o2},Ku={tokenize:l2};function o2(e){const t=this,n=[];let r=0,i,s,a;return o;function o(T){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,l,c)(T)}return c(T)}function l(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&k();const A=t.events.length;let E=A,C;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){C=t.events[E][1].end;break}b(r);let _=A;for(;_<t.events.length;)t.events[_][1].end={...C},_++;return Ht(t.events,E+1,0,t.events.slice(A)),t.events.length=_,c(T)}return o(T)}function c(T){if(r===n.length){if(!i)return m(T);if(i.currentConstruct&&i.currentConstruct.concrete)return p(T);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ku,h,f)(T)}function h(T){return i&&k(),b(r),m(T)}function f(T){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,p(T)}function m(T){return t.containerState={},e.attempt(Ku,d,p)(T)}function d(T){return r++,n.push([t.currentConstruct,t.containerState]),m(T)}function p(T){if(T===null){i&&k(),b(0),e.consume(T);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(T)}function g(T){if(T===null){x(e.exit("chunkFlow"),!0),b(0),e.consume(T);return}return Ne(T)?(e.consume(T),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(T),g)}function x(T,A){const E=t.sliceStream(T);if(A&&E.push(null),T.previous=s,s&&(s.next=T),s=T,i.defineSkip(T.start),i.write(E),t.parser.lazy[T.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<a&&(!i.events[C][1].end||i.events[C][1].end.offset>a))return;const _=t.events.length;let w=_,N,S;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){if(N){S=t.events[w][1].end;break}N=!0}for(b(r),C=_;C<t.events.length;)t.events[C][1].end={...S},C++;Ht(t.events,w+1,0,t.events.slice(_)),t.events.length=C}}function b(T){let A=n.length;for(;A-- >T;){const E=n[A];t.containerState=E[1],E[0].exit.call(t,e)}n.length=T}function k(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function l2(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Lr(e){if(e===null||tt(e)||cr(e))return 1;if(fa(e))return 2}function ma(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const il={name:"attention",resolveAll:c2,tokenize:u2};function c2(e,t){let n=-1,r,i,s,a,o,l,c,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},m={...e[n][1].start};Xu(f,-l),Xu(m,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=qt(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=qt(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),c=qt(c,ma(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=qt(c,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,c=qt(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Ht(e,r-1,n-r+3,c),n=r+c.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function u2(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Lr(r);let s;return a;function a(l){return s=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===s)return e.consume(l),o;const c=e.exit("attentionSequence"),h=Lr(l),f=!h||h===2&&i||n.includes(l),m=!i||i===2&&h||n.includes(r);return c._open=!!(s===42?f:f&&(i||!m)),c._close=!!(s===42?m:m&&(h||!f)),t(l)}}function Xu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const d2={name:"autolink",tokenize:h2};function h2(e,t,n){let r=0;return i;function i(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(d){return Nt(d)?(e.consume(d),a):d===64?n(d):c(d)}function a(d){return d===43||d===45||d===46||kt(d)?(r=1,o(d)):c(d)}function o(d){return d===58?(e.consume(d),r=0,l):(d===43||d===45||d===46||kt(d))&&r++<32?(e.consume(d),o):(r=0,c(d))}function l(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||zi(d)?n(d):(e.consume(d),l)}function c(d){return d===64?(e.consume(d),h):t2(d)?(e.consume(d),c):n(d)}function h(d){return kt(d)?f(d):n(d)}function f(d){return d===46?(e.consume(d),r=0,h):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):m(d)}function m(d){if((d===45||kt(d))&&r++<63){const p=d===45?m:f;return e.consume(d),p}return n(d)}}const Hs={partial:!0,tokenize:f2};function f2(e,t,n){return r;function r(s){return He(s)?qe(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ne(s)?t(s):n(s)}}const Rm={continuation:{tokenize:p2},exit:g2,name:"blockQuote",tokenize:m2};function m2(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return n(a)}function s(a){return He(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function p2(e,t,n){const r=this;return i;function i(a){return He(a)?qe(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(Rm,t,n)(a)}}function g2(e){e.exit("blockQuote")}const Lm={name:"characterEscape",tokenize:x2};function x2(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return r2(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Pm={name:"characterReference",tokenize:b2};function b2(e,t,n){const r=this;let i=0,s,a;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,a=kt,h(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=n2,h):(e.enter("characterReferenceValue"),s=7,a=sl,h(f))}function h(f){if(f===59&&i){const m=e.exit("characterReferenceValue");return a===kt&&!hc(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&i++<s?(e.consume(f),h):n(f)}}const Qu={partial:!0,tokenize:v2},Zu={concrete:!0,name:"codeFenced",tokenize:y2};function y2(e,t,n){const r=this,i={partial:!0,tokenize:E};let s=0,a=0,o;return l;function l(C){return c(C)}function c(C){const _=r.events[r.events.length-1];return s=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,o=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(C)}function h(C){return C===o?(a++,e.consume(C),h):a<3?n(C):(e.exit("codeFencedFenceSequence"),He(C)?qe(e,f,"whitespace")(C):f(C))}function f(C){return C===null||Ne(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(Qu,g,A)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||Ne(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(C)):He(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,d,"whitespace")(C)):C===96&&C===o?n(C):(e.consume(C),m)}function d(C){return C===null||Ne(C)?f(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||Ne(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(C)):C===96&&C===o?n(C):(e.consume(C),p)}function g(C){return e.attempt(i,A,x)(C)}function x(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),b}function b(C){return s>0&&He(C)?qe(e,k,"linePrefix",s+1)(C):k(C)}function k(C){return C===null||Ne(C)?e.check(Qu,g,A)(C):(e.enter("codeFlowValue"),T(C))}function T(C){return C===null||Ne(C)?(e.exit("codeFlowValue"),k(C)):(e.consume(C),T)}function A(C){return e.exit("codeFenced"),t(C)}function E(C,_,w){let N=0;return S;function S(I){return C.enter("lineEnding"),C.consume(I),C.exit("lineEnding"),R}function R(I){return C.enter("codeFencedFence"),He(I)?qe(C,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):M(I)}function M(I){return I===o?(C.enter("codeFencedFenceSequence"),O(I)):w(I)}function O(I){return I===o?(N++,C.consume(I),O):N>=a?(C.exit("codeFencedFenceSequence"),He(I)?qe(C,L,"whitespace")(I):L(I)):w(I)}function L(I){return I===null||Ne(I)?(C.exit("codeFencedFence"),_(I)):w(I)}}}function v2(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Xa={name:"codeIndented",tokenize:k2},E2={partial:!0,tokenize:w2};function k2(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),qe(e,s,"linePrefix",5)(c)}function s(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Ne(c)?e.attempt(E2,a,l)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||Ne(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),o)}function l(c){return e.exit("codeIndented"),t(c)}}function w2(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Ne(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):qe(e,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):Ne(a)?i(a):n(a)}}const T2={name:"codeText",previous:C2,resolve:S2,tokenize:A2};function S2(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function C2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function A2(e,t,n){let r=0,i,s;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(s=e.enter("codeTextSequence"),i=0,h(f)):Ne(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||Ne(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function h(f){return f===96?(e.consume(f),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",c(f))}}class N2{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Qr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qr(this.left,n.reverse())}}}function Qr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Dm(e){const t={};let n=-1,r,i,s,a,o,l,c;const h=new N2(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,_2(h,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=h.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},o=h.slice(i,n),o.unshift(r),h.splice(i,n-i+1,o))}}return Ht(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function _2(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let h,f,m=-1,d=n,p=0,g=0;const x=[g];for(;d;){for(;e.get(++i)[1]!==d;);s.push(i),d._tokenizer||(h=r.sliceStream(d),d.next||h.push(null),f&&a.defineSkip(d.start),d._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),d._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=d,d=d.next}for(d=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(g=m+1,x.push(g),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(a.events=[],d?(d._tokenizer=void 0,d.previous=void 0):x.pop(),m=x.length;m--;){const b=o.slice(x[m],x[m+1]),k=s.pop();l.push([k,k+b.length-1]),e.splice(k,2,b)}for(l.reverse(),m=-1;++m<l.length;)c[p+l[m][0]]=p+l[m][1],p+=l[m][1]-l[m][0]-1;return c}const I2={resolve:R2,tokenize:L2},M2={partial:!0,tokenize:P2};function R2(e){return Dm(e),e}function L2(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):Ne(o)?e.check(M2,a,s)(o):(e.consume(o),i)}function s(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function P2(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),qe(e,s,"linePrefix")}function s(a){if(a===null||Ne(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function Om(e,t,n,r,i,s,a,o,l){const c=l||Number.POSITIVE_INFINITY;let h=0;return f;function f(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),m):b===null||b===32||b===41||zi(b)?n(b):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(b))}function m(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||Ne(b)?n(b):(e.consume(b),b===92?p:d)}function p(b){return b===60||b===62||b===92?(e.consume(b),d):d(b)}function g(b){return!h&&(b===null||b===41||tt(b))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(b)):h<c&&b===40?(e.consume(b),h++,g):b===41?(e.consume(b),h--,g):b===null||b===32||b===40||zi(b)?n(b):(e.consume(b),b===92?x:g)}function x(b){return b===40||b===41||b===92?(e.consume(b),g):g(b)}}function jm(e,t,n,r,i,s){const a=this;let o=0,l;return c;function c(d){return e.enter(r),e.enter(i),e.consume(d),e.exit(i),e.enter(s),h}function h(d){return o>999||d===null||d===91||d===93&&!l||d===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(e.exit(s),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):Ne(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||Ne(d)||o++>999?(e.exit("chunkString"),h(d)):(e.consume(d),l||(l=!He(d)),d===92?m:f)}function m(d){return d===91||d===92||d===93?(e.consume(d),o++,f):f(d)}}function Fm(e,t,n,r,i,s){let a;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),a=m===40?41:m,l):n(m)}function l(m){return m===a?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(s),c(m))}function c(m){return m===a?(e.exit(s),l(a)):m===null?n(m):Ne(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),qe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===a||m===null||Ne(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?f:h)}function f(m){return m===a||m===92?(e.consume(m),h):h(m)}}function ds(e,t){let n;return r;function r(i){return Ne(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):He(i)?qe(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const D2={name:"definition",tokenize:j2},O2={partial:!0,tokenize:F2};function j2(e,t,n){const r=this;let i;return s;function s(d){return e.enter("definition"),a(d)}function a(d){return jm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function o(d){return i=nn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),l):n(d)}function l(d){return tt(d)?ds(e,c)(d):c(d)}function c(d){return Om(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function h(d){return e.attempt(O2,f,f)(d)}function f(d){return He(d)?qe(e,m,"whitespace")(d):m(d)}function m(d){return d===null||Ne(d)?(e.exit("definition"),r.parser.defined.push(i),t(d)):n(d)}}function F2(e,t,n){return r;function r(o){return tt(o)?ds(e,i)(o):n(o)}function i(o){return Fm(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return He(o)?qe(e,a,"whitespace")(o):a(o)}function a(o){return o===null||Ne(o)?t(o):n(o)}}const B2={name:"hardBreakEscape",tokenize:H2};function H2(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ne(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const U2={name:"headingAtx",resolve:z2,tokenize:V2};function z2(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ht(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function V2(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||tt(h)?(e.exit("atxHeadingSequence"),o(h)):n(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||Ne(h)?(e.exit("atxHeading"),t(h)):He(h)?qe(e,o,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function l(h){return h===35?(e.consume(h),l):(e.exit("atxHeadingSequence"),o(h))}function c(h){return h===null||h===35||tt(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),c)}}const $2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ju=["pre","script","style","textarea"],q2={concrete:!0,name:"htmlFlow",resolveTo:G2,tokenize:K2},W2={partial:!0,tokenize:Q2},Y2={partial:!0,tokenize:X2};function G2(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function K2(e,t,n){const r=this;let i,s,a,o,l;return c;function c(P){return h(P)}function h(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),m):P===47?(e.consume(P),s=!0,g):P===63?(e.consume(P),i=3,r.interrupt?t:D):Nt(P)?(e.consume(P),a=String.fromCharCode(P),x):n(P)}function m(P){return P===45?(e.consume(P),i=2,d):P===91?(e.consume(P),i=5,o=0,p):Nt(P)?(e.consume(P),i=4,r.interrupt?t:D):n(P)}function d(P){return P===45?(e.consume(P),r.interrupt?t:D):n(P)}function p(P){const K="CDATA[";return P===K.charCodeAt(o++)?(e.consume(P),o===K.length?r.interrupt?t:M:p):n(P)}function g(P){return Nt(P)?(e.consume(P),a=String.fromCharCode(P),x):n(P)}function x(P){if(P===null||P===47||P===62||tt(P)){const K=P===47,V=a.toLowerCase();return!K&&!s&&Ju.includes(V)?(i=1,r.interrupt?t(P):M(P)):$2.includes(a.toLowerCase())?(i=6,K?(e.consume(P),b):r.interrupt?t(P):M(P)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):s?k(P):T(P))}return P===45||kt(P)?(e.consume(P),a+=String.fromCharCode(P),x):n(P)}function b(P){return P===62?(e.consume(P),r.interrupt?t:M):n(P)}function k(P){return He(P)?(e.consume(P),k):S(P)}function T(P){return P===47?(e.consume(P),S):P===58||P===95||Nt(P)?(e.consume(P),A):He(P)?(e.consume(P),T):S(P)}function A(P){return P===45||P===46||P===58||P===95||kt(P)?(e.consume(P),A):E(P)}function E(P){return P===61?(e.consume(P),C):He(P)?(e.consume(P),E):T(P)}function C(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),l=P,_):He(P)?(e.consume(P),C):w(P)}function _(P){return P===l?(e.consume(P),l=null,N):P===null||Ne(P)?n(P):(e.consume(P),_)}function w(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||tt(P)?E(P):(e.consume(P),w)}function N(P){return P===47||P===62||He(P)?T(P):n(P)}function S(P){return P===62?(e.consume(P),R):n(P)}function R(P){return P===null||Ne(P)?M(P):He(P)?(e.consume(P),R):n(P)}function M(P){return P===45&&i===2?(e.consume(P),j):P===60&&i===1?(e.consume(P),U):P===62&&i===4?(e.consume(P),q):P===63&&i===3?(e.consume(P),D):P===93&&i===5?(e.consume(P),W):Ne(P)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(W2,Z,O)(P)):P===null||Ne(P)?(e.exit("htmlFlowData"),O(P)):(e.consume(P),M)}function O(P){return e.check(Y2,L,Z)(P)}function L(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),I}function I(P){return P===null||Ne(P)?O(P):(e.enter("htmlFlowData"),M(P))}function j(P){return P===45?(e.consume(P),D):M(P)}function U(P){return P===47?(e.consume(P),a="",B):M(P)}function B(P){if(P===62){const K=a.toLowerCase();return Ju.includes(K)?(e.consume(P),q):M(P)}return Nt(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),B):M(P)}function W(P){return P===93?(e.consume(P),D):M(P)}function D(P){return P===62?(e.consume(P),q):P===45&&i===2?(e.consume(P),D):M(P)}function q(P){return P===null||Ne(P)?(e.exit("htmlFlowData"),Z(P)):(e.consume(P),q)}function Z(P){return e.exit("htmlFlow"),t(P)}}function X2(e,t,n){const r=this;return i;function i(a){return Ne(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Q2(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Hs,t,n)}}const Z2={name:"htmlText",tokenize:J2};function J2(e,t,n){const r=this;let i,s,a;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),c):D===47?(e.consume(D),E):D===63?(e.consume(D),T):Nt(D)?(e.consume(D),w):n(D)}function c(D){return D===45?(e.consume(D),h):D===91?(e.consume(D),s=0,p):Nt(D)?(e.consume(D),k):n(D)}function h(D){return D===45?(e.consume(D),d):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),m):Ne(D)?(a=f,U(D)):(e.consume(D),f)}function m(D){return D===45?(e.consume(D),d):f(D)}function d(D){return D===62?j(D):D===45?m(D):f(D)}function p(D){const q="CDATA[";return D===q.charCodeAt(s++)?(e.consume(D),s===q.length?g:p):n(D)}function g(D){return D===null?n(D):D===93?(e.consume(D),x):Ne(D)?(a=g,U(D)):(e.consume(D),g)}function x(D){return D===93?(e.consume(D),b):g(D)}function b(D){return D===62?j(D):D===93?(e.consume(D),b):g(D)}function k(D){return D===null||D===62?j(D):Ne(D)?(a=k,U(D)):(e.consume(D),k)}function T(D){return D===null?n(D):D===63?(e.consume(D),A):Ne(D)?(a=T,U(D)):(e.consume(D),T)}function A(D){return D===62?j(D):T(D)}function E(D){return Nt(D)?(e.consume(D),C):n(D)}function C(D){return D===45||kt(D)?(e.consume(D),C):_(D)}function _(D){return Ne(D)?(a=_,U(D)):He(D)?(e.consume(D),_):j(D)}function w(D){return D===45||kt(D)?(e.consume(D),w):D===47||D===62||tt(D)?N(D):n(D)}function N(D){return D===47?(e.consume(D),j):D===58||D===95||Nt(D)?(e.consume(D),S):Ne(D)?(a=N,U(D)):He(D)?(e.consume(D),N):j(D)}function S(D){return D===45||D===46||D===58||D===95||kt(D)?(e.consume(D),S):R(D)}function R(D){return D===61?(e.consume(D),M):Ne(D)?(a=R,U(D)):He(D)?(e.consume(D),R):N(D)}function M(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),i=D,O):Ne(D)?(a=M,U(D)):He(D)?(e.consume(D),M):(e.consume(D),L)}function O(D){return D===i?(e.consume(D),i=void 0,I):D===null?n(D):Ne(D)?(a=O,U(D)):(e.consume(D),O)}function L(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||tt(D)?N(D):(e.consume(D),L)}function I(D){return D===47||D===62||tt(D)?N(D):n(D)}function j(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function U(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),B}function B(D){return He(D)?qe(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):W(D)}function W(D){return e.enter("htmlTextData"),a(D)}}const fc={name:"labelEnd",resolveAll:rv,resolveTo:sv,tokenize:iv},ev={tokenize:av},tv={tokenize:ov},nv={tokenize:lv};function rv(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ht(e,0,e.length,n),e}function sv(e,t){let n=e.length,r=0,i,s,a,o;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=qt(o,e.slice(s+1,s+r+3)),o=qt(o,[["enter",h,t]]),o=qt(o,ma(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),o=qt(o,[["exit",h,t],e[a-2],e[a-1],["exit",c,t]]),o=qt(o,e.slice(a+1)),o=qt(o,[["exit",l,t]]),Ht(e,s,e.length,o),e}function iv(e,t,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(m){return s?s._inactive?f(m):(a=r.parser.defined.includes(nn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(ev,h,a?h:f)(m):m===91?e.attempt(tv,h,a?c:f)(m):a?h(m):f(m)}function c(m){return e.attempt(nv,h,f)(m)}function h(m){return t(m)}function f(m){return s._balanced=!0,n(m)}}function av(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return tt(f)?ds(e,s)(f):s(f)}function s(f){return f===41?h(f):Om(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return tt(f)?ds(e,l)(f):h(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Fm(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):h(f)}function c(f){return tt(f)?ds(e,h)(f):h(f)}function h(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function ov(e,t,n){const r=this;return i;function i(o){return jm.call(r,e,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(nn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function lv(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const cv={name:"labelStartImage",resolveAll:fc.resolveAll,tokenize:uv};function uv(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),s}function s(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const dv={name:"labelStartLink",resolveAll:fc.resolveAll,tokenize:hv};function hv(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Qa={name:"lineEnding",tokenize:fv};function fv(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}const wi={name:"thematicBreak",tokenize:mv};function mv(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Ne(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),He(c)?qe(e,o,"whitespace")(c):o(c))}}const Lt={continuation:{tokenize:bv},exit:vv,name:"list",tokenize:xv},pv={partial:!0,tokenize:Ev},gv={partial:!0,tokenize:yv};function xv(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(d){const p=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:sl(d)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(wi,n,c)(d):c(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(d)}return n(d)}function l(d){return sl(d)&&++a<10?(e.consume(d),l):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),c(d)):n(d)}function c(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(Hs,r.interrupt?n:h,e.attempt(pv,m,f))}function h(d){return r.containerState.initialBlankLine=!0,s++,m(d)}function f(d){return He(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),m):n(d)}function m(d){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function bv(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Hs,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!He(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(gv,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(Lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function yv(e,t,n){const r=this;return qe(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function vv(e){e.exit(this.containerState.type)}function Ev(e,t,n){const r=this;return qe(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!He(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const ed={name:"setextUnderline",resolveTo:kv,tokenize:wv};function kv(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function wv(e,t,n){const r=this;let i;return s;function s(c){let h=r.events.length,f;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){f=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),He(c)?qe(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ne(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Tv={tokenize:Sv};function Sv(e){const t=this,n=e.attempt(Hs,r,e.attempt(this.parser.constructs.flowInitial,i,qe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(I2,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Cv={resolveAll:Hm()},Av=Bm("string"),Nv=Bm("text");function Bm(e){return{resolveAll:Hm(e==="text"?_v:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,o);return a;function a(h){return c(h)?s(h):o(h)}function o(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),l}function l(h){return c(h)?(n.exit("data"),s(h)):(n.consume(h),l)}function c(h){if(h===null)return!0;const f=i[h];let m=-1;if(f)for(;++m<f.length;){const d=f[m];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function Hm(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function _v(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,a=-1,o=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const Iv={42:Lt,43:Lt,45:Lt,48:Lt,49:Lt,50:Lt,51:Lt,52:Lt,53:Lt,54:Lt,55:Lt,56:Lt,57:Lt,62:Rm},Mv={91:D2},Rv={[-2]:Xa,[-1]:Xa,32:Xa},Lv={35:U2,42:wi,45:[ed,wi],60:q2,61:ed,95:wi,96:Zu,126:Zu},Pv={38:Pm,92:Lm},Dv={[-5]:Qa,[-4]:Qa,[-3]:Qa,33:cv,38:Pm,42:il,60:[d2,Z2],91:dv,92:[B2,Lm],93:fc,95:il,96:T2},Ov={null:[il,Cv]},jv={null:[42,95]},Fv={null:[]},Bv=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jv,contentInitial:Mv,disable:Fv,document:Iv,flow:Lv,flowInitial:Rv,insideSpan:Ov,string:Pv,text:Dv},Symbol.toStringTag,{value:"Module"}));function Hv(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],o=[];const l={attempt:_(E),check:_(C),consume:k,enter:T,exit:A,interrupt:_(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:e,previous:null,sliceSerialize:m,sliceStream:d,write:f};let h=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function f(R){return a=qt(a,R),x(),a[a.length-1]!==null?[]:(w(t,0),c.events=ma(s,c.events,c),c.events)}function m(R,M){return zv(d(R),M)}function d(R){return Uv(a,R)}function p(){const{_bufferIndex:R,_index:M,line:O,column:L,offset:I}=r;return{_bufferIndex:R,_index:M,line:O,column:L,offset:I}}function g(R){i[R.line]=R.column,S()}function x(){let R;for(;r._index<a.length;){const M=a[r._index];if(typeof M=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<M.length;)b(M.charCodeAt(r._bufferIndex));else b(M)}}function b(R){h=h(R)}function k(R){Ne(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,S()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=R}function T(R,M){const O=M||{};return O.type=R,O.start=p(),c.events.push(["enter",O,c]),o.push(O),O}function A(R){const M=o.pop();return M.end=p(),c.events.push(["exit",M,c]),M}function E(R,M){w(R,M.from)}function C(R,M){M.restore()}function _(R,M){return O;function O(L,I,j){let U,B,W,D;return Array.isArray(L)?Z(L):"tokenize"in L?Z([L]):q(L);function q($){return ae;function ae(ne){const Y=ne!==null&&$[ne],ye=ne!==null&&$.null,re=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return Z(re)(ne)}}function Z($){return U=$,B=0,$.length===0?j:P($[B])}function P($){return ae;function ae(ne){return D=N(),W=$,$.partial||(c.currentConstruct=$),$.name&&c.parser.constructs.disable.null.includes($.name)?V():$.tokenize.call(M?Object.assign(Object.create(c),M):c,l,K,V)(ne)}}function K($){return R(W,D),I}function V($){return D.restore(),++B<U.length?P(U[B]):j}}}function w(R,M){R.resolveAll&&!s.includes(R)&&s.push(R),R.resolve&&Ht(c.events,M,c.events.length-M,R.resolve(c.events.slice(M),c)),R.resolveTo&&(c.events=R.resolveTo(c.events,c))}function N(){const R=p(),M=c.previous,O=c.currentConstruct,L=c.events.length,I=Array.from(o);return{from:L,restore:j};function j(){r=R,c.previous=M,c.currentConstruct=O,c.events.length=L,o=I,S()}}function S(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Uv(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,s)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function zv(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
|
|
479
|
+
`;break}case-3:{a=`\r
|
|
480
|
+
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function Vv(e){const r={constructs:Im([Bv,...(e||{}).extensions||[]]),content:i(s2),defined:[],document:i(a2),flow:i(Tv),lazy:{},string:i(Av),text:i(Nv)};return r;function i(s){return a;function a(o){return Hv(r,s,o)}}}function $v(e){for(;!Dm(e););return e}const td=/[\0\t\n\r]/g;function qv(){let e=1,t="",n=!0,r;return i;function i(s,a,o){const l=[];let c,h,f,m,d;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(td.lastIndex=f,c=td.exec(s),m=c&&c.index!==void 0?c.index:s.length,d=s.charCodeAt(m),!c){t=s.slice(f);break}if(d===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(s.slice(f,m)),e+=m-f),d){case 0:{l.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,l.push(-2);e++<h;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Wv=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Yv(e){return e.replace(Wv,Gv)}function Gv(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Mm(n.slice(s?2:1),s?16:10)}return hc(n)||e}const Um={}.hasOwnProperty;function Kv(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Xv(n)($v(Vv(n).document().write(qv()(e,t,!0))))}function Xv(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(oe),autolinkProtocol:N,autolinkEmail:N,atxHeading:s(ke),blockQuote:s(ye),characterEscape:N,characterReference:N,codeFenced:s(re),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(re,a),codeText:s(ie,a),codeTextData:N,data:N,codeFlowValue:N,definition:s(le),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(xe),hardBreakEscape:s(ze),hardBreakTrailing:s(ze),htmlFlow:s(Te,a),htmlFlowData:N,htmlText:s(Te,a),htmlTextData:N,image:s(Ge),label:a,link:s(oe),listItem:s(We),listItemValue:m,listOrdered:s(Ie,f),listUnordered:s(Ie),paragraph:s(Ue),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(ke),strong:s(Xe),thematicBreak:s(we)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:Y,autolinkProtocol:ne,blockQuote:l(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:$,characterReference:ae,codeFenced:l(x),codeFencedFence:g,codeFencedFenceInfo:d,codeFencedFenceMeta:p,codeFlowValue:S,codeIndented:l(b),codeText:l(I),codeTextData:S,data:S,definition:l(),definitionDestinationString:A,definitionLabelString:k,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(O),htmlFlowData:S,htmlText:l(L),htmlTextData:S,image:l(U),label:W,labelText:B,lineEnding:R,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:K,resourceDestinationString:D,resourceTitleString:q,resource:Z,setextHeading:l(w),setextHeadingLineSequence:_,setextHeadingText:C,strong:l(),thematicBreak:l()}};zm(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ee){let ce={type:"root",children:[]};const ve={stack:[ce],tokenStack:[],config:t,enter:o,exit:c,buffer:a,resume:h,data:n},ge=[];let Se=-1;for(;++Se<ee.length;)if(ee[Se][1].type==="listOrdered"||ee[Se][1].type==="listUnordered")if(ee[Se][0]==="enter")ge.push(Se);else{const de=ge.pop();Se=i(ee,de,Se)}for(Se=-1;++Se<ee.length;){const de=t[ee[Se][0]];Um.call(de,ee[Se][1].type)&&de[ee[Se][1].type].call(Object.assign({sliceSerialize:ee[Se][2].sliceSerialize},ve),ee[Se][1])}if(ve.tokenStack.length>0){const de=ve.tokenStack[ve.tokenStack.length-1];(de[1]||nd).call(ve,void 0,de[0])}for(ce.position={start:wn(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:wn(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Se=-1;++Se<t.transforms.length;)ce=t.transforms[Se](ce)||ce;return ce}function i(ee,ce,ve){let ge=ce-1,Se=-1,de=!1,be,Ce,Ve,Mt;for(;++ge<=ve;){const ct=ee[ge];switch(ct[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ct[0]==="enter"?Se++:Se--,Mt=void 0;break}case"lineEndingBlank":{ct[0]==="enter"&&(be&&!Mt&&!Se&&!Ve&&(Ve=ge),Mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Mt=void 0}if(!Se&&ct[0]==="enter"&&ct[1].type==="listItemPrefix"||Se===-1&&ct[0]==="exit"&&(ct[1].type==="listUnordered"||ct[1].type==="listOrdered")){if(be){let St=ge;for(Ce=void 0;St--;){const Pe=ee[St];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;Ce&&(ee[Ce][1].type="lineEndingBlank",de=!0),Pe[1].type="lineEnding",Ce=St}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}Ve&&(!Ce||Ve<Ce)&&(be._spread=!0),be.end=Object.assign({},Ce?ee[Ce][1].start:ct[1].end),ee.splice(Ce||ge,0,["exit",be,ct[2]]),ge++,ve++}if(ct[1].type==="listItemPrefix"){const St={type:"listItem",_spread:!1,start:Object.assign({},ct[1].start),end:void 0};be=St,ee.splice(ge,0,["enter",St,ct[2]]),ge++,ve++,Ve=void 0,Mt=!0}}}return ee[ce][1]._spread=de,ve}function s(ee,ce){return ve;function ve(ge){o.call(this,ee(ge),ge),ce&&ce.call(this,ge)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(ee,ce,ve){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([ce,ve||void 0]),ee.position={start:wn(ce.start),end:void 0}}function l(ee){return ce;function ce(ve){ee&&ee.call(this,ve),c.call(this,ve)}}function c(ee,ce){const ve=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==ee.type&&(ce?ce.call(this,ee,ge[0]):(ge[1]||nd).call(this,ee,ge[0]));else throw new Error("Cannot close `"+ee.type+"` ("+us({start:ee.start,end:ee.end})+"): it’s not open");ve.position.end=wn(ee.end)}function h(){return dc(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(ee){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0}}function d(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=ee}function p(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=ee}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee.replace(/(\r?\n|\r)$/g,"")}function k(ee){const ce=this.resume(),ve=this.stack[this.stack.length-1];ve.label=ce,ve.identifier=nn(this.sliceSerialize(ee)).toLowerCase()}function T(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.title=ee}function A(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.url=ee}function E(ee){const ce=this.stack[this.stack.length-1];if(!ce.depth){const ve=this.sliceSerialize(ee).length;ce.depth=ve}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function _(ee){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function N(ee){const ve=this.stack[this.stack.length-1].children;let ge=ve[ve.length-1];(!ge||ge.type!=="text")&&(ge=De(),ge.position={start:wn(ee.start),end:void 0},ve.push(ge)),this.stack.push(ge)}function S(ee){const ce=this.stack.pop();ce.value+=this.sliceSerialize(ee),ce.position.end=wn(ee.end)}function R(ee){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=ce.children[ce.children.length-1];ve.position.end=wn(ee.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(N.call(this,ee),S.call(this,ee))}function M(){this.data.atHardBreak=!0}function O(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee}function L(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee}function I(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee}function j(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ce,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function U(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ce,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function B(ee){const ce=this.sliceSerialize(ee),ve=this.stack[this.stack.length-2];ve.label=Yv(ce),ve.identifier=nn(ce).toLowerCase()}function W(){const ee=this.stack[this.stack.length-1],ce=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const ge=ee.children;ve.children=ge}else ve.alt=ce}function D(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.url=ee}function q(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.title=ee}function Z(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function K(ee){const ce=this.resume(),ve=this.stack[this.stack.length-1];ve.label=ce,ve.identifier=nn(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function V(ee){this.data.characterReferenceType=ee.type}function $(ee){const ce=this.sliceSerialize(ee),ve=this.data.characterReferenceType;let ge;ve?(ge=Mm(ce,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=hc(ce);const Se=this.stack[this.stack.length-1];Se.value+=ge}function ae(ee){const ce=this.stack.pop();ce.position.end=wn(ee.end)}function ne(ee){S.call(this,ee);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(ee)}function Y(ee){S.call(this,ee);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(ee)}function ye(){return{type:"blockquote",children:[]}}function re(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function ke(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function Te(){return{type:"html",value:""}}function Ge(){return{type:"image",title:null,url:"",alt:null}}function oe(){return{type:"link",title:null,url:"",children:[]}}function Ie(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function We(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function Ue(){return{type:"paragraph",children:[]}}function Xe(){return{type:"strong",children:[]}}function De(){return{type:"text",value:""}}function we(){return{type:"thematicBreak"}}}function wn(e){return{line:e.line,column:e.column,offset:e.offset}}function zm(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?zm(e,r):Qv(e,r)}}function Qv(e,t){let n;for(n in t)if(Um.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function nd(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+us({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+us({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+us({start:t.start,end:t.end})+") is still open")}function Zv(e){const t=this;t.parser=n;function n(r){return Kv(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Jv(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function eE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
481
|
+
`}]}function tE(e,t){const n=t.value?t.value+`
|
|
482
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function nE(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Br(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function iE(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Vm(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function oE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Vm(e,t);const i={src:Br(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function lE(e,t){const n={src:Br(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function cE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function uE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Vm(e,t);const i={href:Br(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function dE(e,t){const n={href:Br(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function hE(e,t,n){const r=e.all(t),i=n?fE(n):$m(t),s={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let f;h&&h.type==="element"&&h.tagName==="p"?f=h:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const h=r[o];(i||o!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
|
|
483
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?a.push(...h.children):a.push(h)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
|
|
484
|
+
`});const c={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,c),e.applyData(t,c)}function fE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=$m(n[r])}return t}function $m(e){const t=e.spread;return t??e.children.length>1}function mE(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function pE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function xE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bE(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=pn(t.children[1]),l=ha(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function yE(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let l=-1;const c=[];for(;++l<o;){const f=t.children[l],m={},d=a?a[l]:void 0;d&&(m.align=d);let p={type:"element",tagName:s,properties:m,children:[]};f&&(p.children=e.all(f),e.patch(f,p),p=e.applyData(f,p)),c.push(p)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function vE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const rd=9,sd=32;function EE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(id(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(id(t.slice(i),i>0,!1)),s.join("")}function id(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===rd||s===sd;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===rd||s===sd;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function kE(e,t){const n={type:"text",value:EE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const TE={blockquote:Jv,break:eE,code:tE,delete:nE,emphasis:rE,footnoteReference:sE,heading:iE,html:aE,imageReference:oE,image:lE,inlineCode:cE,linkReference:uE,link:dE,listItem:hE,list:mE,paragraph:pE,root:gE,strong:xE,table:bE,tableCell:vE,tableRow:yE,text:kE,thematicBreak:wE,toml:si,yaml:si,definition:si,footnoteDefinition:si};function si(){}const qm=-1,pa=0,hs=1,Vi=2,mc=3,pc=4,gc=5,xc=6,Wm=7,Ym=8,Gm=typeof self=="object"?self:globalThis,ad=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Gm[e](t)},SE=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case pa:case qm:return n(a,i);case hs:{const o=n([],i);for(const l of a)o.push(r(l));return o}case Vi:{const o=n({},i);for(const[l,c]of a)o[r(l)]=r(c);return o}case mc:return n(new Date(a),i);case pc:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case gc:{const o=n(new Map,i);for(const[l,c]of a)o.set(r(l),r(c));return o}case xc:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case Wm:{const{name:o,message:l}=a;return n(typeof Gm[o]=="function"?ad(o,l):new Error(l),i)}case Ym:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(ad(s,a),i)};return r},od=e=>SE(new Map,e)(0),Kn="",{toString:CE}={},{keys:AE}=Object,Zr=e=>{const t=typeof e;if(t!=="object"||!e)return[pa,t];const n=CE.call(e).slice(8,-1);switch(n){case"Array":return[hs,Kn];case"Object":return[Vi,Kn];case"Date":return[mc,Kn];case"RegExp":return[pc,Kn];case"Map":return[gc,Kn];case"Set":return[xc,Kn];case"DataView":return[hs,n]}return n.includes("Array")?[hs,n]:e instanceof Error?[Wm,e.name||"Error"]:[Vi,n]},ii=([e,t])=>e===pa&&(t==="function"||t==="symbol"),NE=(e,t,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=Zr(a);switch(o){case pa:{let h=a;switch(l){case"bigint":o=Ym,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([qm],a)}return i([o,h],a)}case hs:{if(l){let m=a;return l==="DataView"?m=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(a)),i([l,[...m]],a)}const h=[],f=i([o,h],a);for(const m of a)h.push(s(m));return f}case Vi:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const h=[],f=i([o,h],a);for(const m of AE(a))(e||!ii(Zr(a[m])))&&h.push([s(m),s(a[m])]);return f}case mc:return i([o,isNaN(a.getTime())?Kn:a.toISOString()],a);case pc:{const{source:h,flags:f}=a;return i([o,{source:h,flags:f}],a)}case gc:{const h=[],f=i([o,h],a);for(const[m,d]of a)(e||!(ii(Zr(m))||ii(Zr(d))))&&h.push([s(m),s(d)]);return f}case xc:{const h=[],f=i([o,h],a);for(const m of a)(e||!ii(Zr(m)))&&h.push(s(m));return f}}const{message:c}=a;return i([o,{name:l,message:c}],a)};return s},ld=(e,{json:t,lossy:n}={})=>{const r=[];return NE(!(t||n),!!t,new Map,r)(e),r},ur=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?od(ld(e,t)):structuredClone(e):(e,t)=>od(ld(e,t));function _E(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function IE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ME(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||_E,r=e.options.footnoteBackLabel||IE,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const h=e.all(c),f=String(c.identifier).toUpperCase(),m=Br(f.toLowerCase());let d=0;const p=[],g=e.footnoteCounts.get(f);for(;g!==void 0&&++d<=g;){p.length>0&&p.push({type:"text",value:" "});let k=typeof n=="string"?n:n(l,d);typeof k=="string"&&(k={type:"text",value:k}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const x=h[h.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const k=x.children[x.children.length-1];k&&k.type==="text"?k.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...p)}else h.push(...p);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(h,!0)};e.patch(c,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...ur(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
485
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
486
|
+
`}]}}const ga=(function(e){if(e==null)return DE;if(typeof e=="function")return xa(e);if(typeof e=="object")return Array.isArray(e)?RE(e):LE(e);if(typeof e=="string")return PE(e);throw new Error("Expected function, string, or object as test")});function RE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ga(e[n]);return xa(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function LE(e){const t=e;return xa(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function PE(e){return xa(t);function t(n){return n&&n.type===e}}function xa(e){return t;function t(n,r,i){return!!(OE(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function DE(){return!0}function OE(e){return e!==null&&typeof e=="object"&&"type"in e}const Km=[],jE=!0,al=!1,FE="skip";function Xm(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=ga(i),a=r?-1:1;o(e,void 0,[])();function o(l,c,h){const f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){const d=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=Km,p,g,x;if((!t||s(l,c,h[h.length-1]||void 0))&&(d=BE(n(l,h)),d[0]===al))return d;if("children"in l&&l.children){const b=l;if(b.children&&d[0]!==FE)for(g=(r?b.children.length:-1)+a,x=h.concat(b);g>-1&&g<b.children.length;){const k=b.children[g];if(p=o(k,g,x)(),p[0]===al)return p;g=typeof p[1]=="number"?p[1]:g+a}}return d}}}function BE(e){return Array.isArray(e)?e:typeof e=="number"?[jE,e]:e==null?Km:[e]}function ba(e,t,n,r){let i,s,a;typeof t=="function"&&typeof n!="function"?(s=void 0,a=t,i=n):(s=t,a=n,i=r),Xm(e,s,o,i);function o(l,c){const h=c[c.length-1],f=h?h.children.indexOf(l):void 0;return a(l,f,h)}}const ol={}.hasOwnProperty,HE={};function UE(e,t){const n=t||HE,r=new Map,i=new Map,s=new Map,a={...TE,...n.handlers},o={all:c,applyData:VE,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:l,options:n,patch:zE,wrap:qE};return ba(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const f=h.type==="definition"?r:i,m=String(h.identifier).toUpperCase();f.has(m)||f.set(m,h)}}),o;function l(h,f){const m=h.type,d=o.handlers[m];if(ol.call(o.handlers,m)&&d)return d(o,h,f);if(o.options.passThrough&&o.options.passThrough.includes(m)){if("children"in h){const{children:g,...x}=h,b=ur(x);return b.children=o.all(h),b}return ur(h)}return(o.options.unknownHandler||$E)(o,h,f)}function c(h){const f=[];if("children"in h){const m=h.children;let d=-1;for(;++d<m.length;){const p=o.one(m[d],h);if(p){if(d&&m[d-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=cd(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=cd(g.value))}Array.isArray(p)?f.push(...p):f.push(p)}}}return f}}function zE(e,t){e.position&&(t.position=Tm(e))}function VE(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,ur(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function $E(e,t){const n=t.data||{},r="value"in t&&!(ol.call(n,"hProperties")||ol.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
487
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
488
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
489
|
+
`}),n}function cd(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ud(e,t){const n=UE(e,t),r=n.one(e,void 0),i=ME(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
490
|
+
`},i),s}function WE(e,t){return e&&"run"in e?async function(n,r){const i=ud(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ud(n,{file:r,...e||t})}}function dd(e){if(e)throw e}var Za,hd;function YE(){if(hd)return Za;hd=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},s=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var h=e.call(c,"constructor"),f=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!h&&!f)return!1;var m;for(m in c);return typeof m>"u"||e.call(c,m)},a=function(c,h){n&&h.name==="__proto__"?n(c,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):c[h.name]=h.newValue},o=function(c,h){if(h==="__proto__")if(e.call(c,h)){if(r)return r(c,h).value}else return;return c[h]};return Za=function l(){var c,h,f,m,d,p,g=arguments[0],x=1,b=arguments.length,k=!1;for(typeof g=="boolean"&&(k=g,g=arguments[1]||{},x=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});x<b;++x)if(c=arguments[x],c!=null)for(h in c)f=o(g,h),m=o(c,h),g!==m&&(k&&m&&(s(m)||(d=i(m)))?(d?(d=!1,p=f&&i(f)?f:[]):p=f&&s(f)?f:{},a(g,{name:h,newValue:l(k,p,m)})):typeof m<"u"&&a(g,{name:h,newValue:m}));return g},Za}var GE=YE();const Ja=Kl(GE);function ll(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function KE(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...c){const h=e[++s];let f=-1;if(l){a(l);return}for(;++f<i.length;)(c[f]===null||c[f]===void 0)&&(c[f]=i[f]);i=c,h?XE(h,o)(...c):a(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function XE(e,t){let n;return r;function r(...a){const o=e.length>a.length;let l;o&&a.push(i);try{l=e.apply(this,a)}catch(c){const h=c;if(o&&n)throw h;return i(h)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,t(a,...o))}function s(a){i(null,a)}}const on={basename:QE,dirname:ZE,extname:JE,join:ek,sep:"/"};function QE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Us(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function ZE(e){if(Us(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function JE(e){Us(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function ek(...e){let t=-1,n;for(;++t<e.length;)Us(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":tk(n)}function tk(e){Us(e);const t=e.codePointAt(0)===47;let n=nk(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nk(e,t){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function Us(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rk={cwd:sk};function sk(){return"/"}function cl(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ik(e){if(typeof e=="string")e=new URL(e);else if(!cl(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return ak(e)}function ak(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const eo=["history","path","basename","stem","extname","dirname"];class Qm{constructor(t){let n;t?cl(t)?n={path:t}:typeof t=="string"||ok(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":rk.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<eo.length;){const s=eo[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)eo.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?on.basename(this.path):void 0}set basename(t){no(t,"basename"),to(t,"basename"),this.path=on.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?on.dirname(this.path):void 0}set dirname(t){fd(this.basename,"dirname"),this.path=on.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?on.extname(this.path):void 0}set extname(t){if(to(t,"extname"),fd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=on.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cl(t)&&(t=ik(t)),no(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?on.basename(this.path,this.extname):void 0}set stem(t){no(t,"stem"),to(t,"stem"),this.path=on.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new wt(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function to(e,t){if(e&&e.includes(on.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+on.sep+"`")}function no(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function fd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ok(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lk=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),ck={}.hasOwnProperty;class bc extends lk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=KE()}copy(){const t=new bc;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ja(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(io("data",this.frozen),this.namespace[t]=n,this):ck.call(this.namespace,t)&&this.namespace[t]||void 0:t?(io("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ai(t),r=this.parser||this.Parser;return ro("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ro("process",this.parser||this.Parser),so("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=ai(t),l=r.parse(o);r.run(l,o,function(h,f,m){if(h||!f||!m)return c(h);const d=f,p=r.stringify(d,m);hk(p)?m.value=p:m.result=p,c(h,m)});function c(h,f){h||!f?a(h):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),ro("processSync",this.parser||this.Parser),so("processSync",this.compiler||this.Compiler),this.process(t,i),pd("processSync","process",n),r;function i(s,a){n=!0,dd(s),r=a}}run(t,n,r){md(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const l=ai(n);i.run(t,l,c);function c(h,f,m){const d=f||t;h?o(h):a?a(d):r(void 0,d,m)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),pd("runSync","run",r),i;function s(a,o){dd(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=ai(n),i=this.compiler||this.Compiler;return so("stringify",i),md(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(io("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...f]=c;l(h,f)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(i.settings=Ja(!0,i.settings,c.settings))}function o(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const f=c[h];s(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,h){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===c){m=f;break}if(m===-1)r.push([c,...h]);else if(h.length>0){let[d,...p]=h;const g=r[m][1];ll(g)&&ll(d)&&(d=Ja(!0,g,d)),r[m]=[c,d,...p]}}}}const uk=new bc().freeze();function ro(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function so(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function io(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function md(e){if(!ll(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ai(e){return dk(e)?e:new Qm(e)}function dk(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function hk(e){return typeof e=="string"||fk(e)}function fk(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gd=[],xd={allowDangerousHtml:!0},pk=/^(https?|ircs?|mailto|xmpp)$/i,gk=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Zm(e){const t=xk(e),n=bk(e);return yk(t.runSync(t.parse(n),n),e)}function xk(e){const t=e.rehypePlugins||gd,n=e.remarkPlugins||gd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xd}:xd;return uk().use(Zv).use(n).use(WE,r).use(t)}function bk(e){const t=e.children||"",n=new Qm;return typeof t=="string"&&(n.value=t),n}function yk(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||vk;for(const h of gk)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+mk+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),ba(e,c),Dy(e,{Fragment:u.Fragment,components:i,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(h,f,m){if(h.type==="raw"&&m&&typeof f=="number")return a?m.children.splice(f,1):m.children[f]={type:"text",value:h.value},f;if(h.type==="element"){let d;for(d in Ka)if(Object.hasOwn(Ka,d)&&Object.hasOwn(h.properties,d)){const p=h.properties[d],g=Ka[d];(g===null||g.includes(h.tagName))&&(h.properties[d]=l(String(p||""),d,h))}}if(h.type==="element"){let d=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!d&&r&&typeof f=="number"&&(d=!r(h,f,m)),d&&m&&typeof f=="number")return o&&h.children?m.children.splice(f,1,...h.children):m.children.splice(f,1),f}}}function vk(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||pk.test(e.slice(0,t))?e:""}function bd(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Ek(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function kk(e,t,n){const i=ga((n||{}).ignore||[]),s=wk(t);let a=-1;for(;++a<s.length;)Xm(e,"text",o);function o(c,h){let f=-1,m;for(;++f<h.length;){const d=h[f],p=m?m.children:void 0;if(i(d,p?p.indexOf(d):void 0,m))return;m=d}if(m)return l(c,h)}function l(c,h){const f=h[h.length-1],m=s[a][0],d=s[a][1];let p=0;const x=f.children.indexOf(c);let b=!1,k=[];m.lastIndex=0;let T=m.exec(c.value);for(;T;){const A=T.index,E={index:T.index,input:T.input,stack:[...h,c]};let C=d(...T,E);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?m.lastIndex=A+1:(p!==A&&k.push({type:"text",value:c.value.slice(p,A)}),Array.isArray(C)?k.push(...C):C&&k.push(C),p=A+T[0].length,b=!0),!m.global)break;T=m.exec(c.value)}return b?(p<c.value.length&&k.push({type:"text",value:c.value.slice(p)}),f.children.splice(x,1,...k)):k=[c],x+k.length}}function wk(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([Tk(i[0]),Sk(i[1])])}return t}function Tk(e){return typeof e=="string"?new RegExp(Ek(e),"g"):e}function Sk(e){return typeof e=="function"?e:function(){return e}}const ao="phrasing",oo=["autolink","link","image","label"];function Ck(){return{transforms:[Lk],enter:{literalAutolink:Nk,literalAutolinkEmail:lo,literalAutolinkHttp:lo,literalAutolinkWww:lo},exit:{literalAutolink:Rk,literalAutolinkEmail:Mk,literalAutolinkHttp:_k,literalAutolinkWww:Ik}}}function Ak(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ao,notInConstruct:oo},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ao,notInConstruct:oo},{character:":",before:"[ps]",after:"\\/",inConstruct:ao,notInConstruct:oo}]}}function Nk(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function lo(e){this.config.enter.autolinkProtocol.call(this,e)}function _k(e){this.config.exit.autolinkProtocol.call(this,e)}function Ik(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Mk(e){this.config.exit.autolinkEmail.call(this,e)}function Rk(e){this.exit(e)}function Lk(e){kk(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Pk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Dk]],{ignore:["link","linkReference"]})}function Pk(e,t,n,r,i){let s="";if(!Jm(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Ok(n)))return!1;const a=jk(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:s+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function Dk(e,t,n,r){return!Jm(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ok(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function jk(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=bd(e,"(");let s=bd(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Jm(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||cr(n)||fa(n))&&(!t||n!==47)}ep.peek=Wk;function Fk(){this.buffer()}function Bk(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Hk(){this.buffer()}function Uk(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function zk(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=nn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vk(e){this.exit(e)}function $k(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=nn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qk(e){this.exit(e)}function Wk(){return"["}function ep(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),o(),a(),s+=i.move("]"),s}function Yk(){return{enter:{gfmFootnoteCallString:Fk,gfmFootnoteCall:Bk,gfmFootnoteDefinitionLabelString:Hk,gfmFootnoteDefinition:Uk},exit:{gfmFootnoteCallString:zk,gfmFootnoteCall:Vk,gfmFootnoteDefinitionLabelString:$k,gfmFootnoteDefinition:qk}}}function Gk(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ep},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const o=s.createTracker(a);let l=o.move("[^");const c=s.enter("footnoteDefinition"),h=s.enter("label");return l+=o.move(s.safe(s.associationId(r),{before:l,after:"]"})),h(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?`
|
|
491
|
+
`:" ")+s.indentLines(s.containerFlow(r,o.current()),t?tp:Kk))),c(),l}}function Kk(e,t,n){return t===0?e:tp(e,t,n)}function tp(e,t,n){return(n?"":" ")+e}const Xk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];np.peek=tw;function Qk(){return{canContainEols:["delete"],enter:{strikethrough:Jk},exit:{strikethrough:ew}}}function Zk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Xk}],handlers:{delete:np}}}function Jk(e){this.enter({type:"delete",children:[]},e)}function ew(e){this.exit(e)}function np(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function tw(){return"~"}function nw(e){return e.length}function rw(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||nw,s=[],a=[],o=[],l=[];let c=0,h=-1;for(;++h<e.length;){const g=[],x=[];let b=-1;for(e[h].length>c&&(c=e[h].length);++b<e[h].length;){const k=sw(e[h][b]);if(n.alignDelimiters!==!1){const T=i(k);x[b]=T,(l[b]===void 0||T>l[b])&&(l[b]=T)}g.push(k)}a[h]=g,o[h]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<c;)s[f]=yd(r[f]);else{const g=yd(r);for(;++f<c;)s[f]=g}f=-1;const m=[],d=[];for(;++f<c;){const g=s[f];let x="",b="";g===99?(x=":",b=":"):g===108?x=":":g===114&&(b=":");let k=n.alignDelimiters===!1?1:Math.max(1,l[f]-x.length-b.length);const T=x+"-".repeat(k)+b;n.alignDelimiters!==!1&&(k=x.length+k+b.length,k>l[f]&&(l[f]=k),d[f]=k),m[f]=T}a.splice(1,0,m),o.splice(1,0,d),h=-1;const p=[];for(;++h<a.length;){const g=a[h],x=o[h];f=-1;const b=[];for(;++f<c;){const k=g[f]||"";let T="",A="";if(n.alignDelimiters!==!1){const E=l[f]-(x[f]||0),C=s[f];C===114?T=" ".repeat(E):C===99?E%2?(T=" ".repeat(E/2+.5),A=" ".repeat(E/2-.5)):(T=" ".repeat(E/2),A=T):A=" ".repeat(E)}n.delimiterStart!==!1&&!f&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||f)&&b.push(" "),n.alignDelimiters!==!1&&b.push(T),b.push(k),n.alignDelimiters!==!1&&b.push(A),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||f!==c-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
|
|
492
|
+
`)}function sw(e){return e==null?"":String(e)}function yd(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const vd={}.hasOwnProperty;function rp(e,t){const n=t||{};function r(i,...s){let a=r.invalid;const o=r.handlers;if(i&&vd.call(i,e)){const l=String(i[e]);a=vd.call(o,l)?o[l]:r.unknown}if(a)return a.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function iw(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),aw);return i(),a}function aw(e,t,n){return">"+(n?"":" ")+e}function ow(e,t){return Ed(e,t.inConstruct,!0)&&!Ed(e,t.notInConstruct,!1)}function Ed(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function kd(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
493
|
+
`&&ow(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
494
|
+
`}function lw(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function cw(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uw(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function dw(e,t,n,r){const i=uw(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(cw(e,n)){const f=n.enter("codeIndented"),m=n.indentLines(s,hw);return f(),m}const o=n.createTracker(r),l=i.repeat(Math.max(lw(s,i)+1,3)),c=n.enter("codeFenced");let h=o.move(l);if(e.lang){const f=n.enter(`codeFencedLang${a}`);h+=o.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);h+=o.move(" "),h+=o.move(n.safe(e.meta,{before:h,after:`
|
|
495
|
+
`,encode:["`"],...o.current()})),f()}return h+=o.move(`
|
|
496
|
+
`),s&&(h+=o.move(s+`
|
|
497
|
+
`)),h+=o.move(l),c(),h}function hw(e,t,n){return(n?"":" ")+e}function yc(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fw(e,t,n,r){const i=yc(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
|
|
498
|
+
`,...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),o()),a(),c}function mw(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ns(e){return"&#x"+e.toString(16).toUpperCase()+";"}function $i(e,t,n){const r=Lr(e),i=Lr(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}sp.peek=pw;function sp(e,t,n,r){const i=mw(n),s=n.enter("emphasis"),a=n.createTracker(r),o=a.move(i);let l=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const c=l.charCodeAt(0),h=$i(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=Ns(c)+l.slice(1));const f=l.charCodeAt(l.length-1),m=$i(r.after.charCodeAt(0),f,i);m.inside&&(l=l.slice(0,-1)+Ns(f));const d=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:h.outside},o+l+d}function pw(e,t,n){return n.options.emphasis||"*"}function gw(e,t){let n=!1;return ba(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,al}),!!((!e.depth||e.depth<3)&&dc(e)&&(t.options.setext||n))}function xw(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(gw(e,n)){const h=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...s.current(),before:`
|
|
499
|
+
`,after:`
|
|
500
|
+
`});return f(),h(),m+`
|
|
501
|
+
`+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
|
502
|
+
`))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),l=n.enter("phrasing");s.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
503
|
+
`,...s.current()});return/^[\t ]/.test(c)&&(c=Ns(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),o(),c}ip.peek=bw;function ip(e){return e.value||""}function bw(){return"<"}ap.peek=yw;function ap(e,t,n,r){const i=yc(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),o()),c+=l.move(")"),a(),c}function yw(){return"!"}op.peek=vw;function op(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const c=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=h,s(),i==="full"||!c||c!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function vw(){return"!"}lp.peek=Ew;function lp(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],o=n.compilePattern(a);let l;if(a.atBreak)for(;l=o.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function Ew(){return"`"}function cp(e,t){const n=dc(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}up.peek=kw;function up(e,t,n,r){const i=yc(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(cp(e,n)){const h=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=h,f}o=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(e,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(n.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function kw(e,t,n){return cp(e,n)?"<":"["}dp.peek=ww;function dp(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=h,s(),i==="full"||!c||c!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function ww(){return"["}function vc(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Tw(e){const t=vc(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Sw(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function hp(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Cw(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?Sw(n):vc(n);const o=e.ordered?a==="."?")":".":Tw(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),hp(n)===a&&h){let f=-1;for(;++f<e.children.length;){const m=e.children[f];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=o),n.bulletCurrent=a;const c=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),c}function Aw(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Nw(e,t,n,r){const i=Aw(n);let s=n.bulletCurrent||vc(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(s+" ".repeat(a-s.length)),o.shift(a);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,o.current()),h);return l(),c;function h(f,m,d){return m?(d?"":" ".repeat(a))+f:(d?s:s+" ".repeat(a-s.length))+f}}function _w(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const Iw=ga(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Mw(e,t,n,r){return(e.children.some(function(a){return Iw(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Rw(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}fp.peek=Lw;function fp(e,t,n,r){const i=Rw(n),s=n.enter("strong"),a=n.createTracker(r),o=a.move(i+i);let l=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const c=l.charCodeAt(0),h=$i(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=Ns(c)+l.slice(1));const f=l.charCodeAt(l.length-1),m=$i(r.after.charCodeAt(0),f,i);m.inside&&(l=l.slice(0,-1)+Ns(f));const d=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:h.outside},o+l+d}function Lw(e,t,n){return n.options.strong||"*"}function Pw(e,t,n,r){return n.safe(e.value,r)}function Dw(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Ow(e,t,n){const r=(hp(n)+(n.options.ruleSpaces?" ":"")).repeat(Dw(n));return n.options.ruleSpaces?r.slice(0,-1):r}const mp={blockquote:iw,break:kd,code:dw,definition:fw,emphasis:sp,hardBreak:kd,heading:xw,html:ip,image:ap,imageReference:op,inlineCode:lp,link:up,linkReference:dp,list:Cw,listItem:Nw,paragraph:_w,root:Mw,strong:fp,text:Pw,thematicBreak:Ow};function jw(){return{enter:{table:Fw,tableData:wd,tableHeader:wd,tableRow:Hw},exit:{codeText:Uw,table:Bw,tableData:co,tableHeader:co,tableRow:co}}}function Fw(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Bw(e){this.exit(e),this.data.inTable=void 0}function Hw(e){this.enter({type:"tableRow",children:[]},e)}function co(e){this.exit(e)}function wd(e){this.enter({type:"tableCell",children:[]},e)}function Uw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zw));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function zw(e,t){return t==="|"?t:e}function Vw(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
504
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:a,tableCell:l,tableRow:o}};function a(d,p,g,x){return c(h(d,g,x),d.align)}function o(d,p,g,x){const b=f(d,g,x),k=c([b]);return k.slice(0,k.indexOf(`
|
|
505
|
+
`))}function l(d,p,g,x){const b=g.enter("tableCell"),k=g.enter("phrasing"),T=g.containerPhrasing(d,{...x,before:s,after:s});return k(),b(),T}function c(d,p){return rw(d,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function h(d,p,g){const x=d.children;let b=-1;const k=[],T=p.enter("table");for(;++b<x.length;)k[b]=f(x[b],p,g);return T(),k}function f(d,p,g){const x=d.children;let b=-1;const k=[],T=p.enter("tableRow");for(;++b<x.length;)k[b]=l(x[b],d,p,g);return T(),k}function m(d,p,g){let x=mp.inlineCode(d,p,g);return g.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function $w(){return{exit:{taskListCheckValueChecked:Td,taskListCheckValueUnchecked:Td,paragraph:Ww}}}function qw(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Yw}}}function Td(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Ww(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,a;for(;++s<i.length;){const o=i[s];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Yw(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);s&&o.move(a);let l=mp.listItem(e,t,n,{...r,...o.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(h){return h+a}}function Gw(){return[Ck(),Yk(),Qk(),jw(),$w()]}function Kw(e){return{extensions:[Ak(),Gk(e),Zk(),Vw(e),qw()]}}const Xw={tokenize:nT,partial:!0},pp={tokenize:rT,partial:!0},gp={tokenize:sT,partial:!0},xp={tokenize:iT,partial:!0},Qw={tokenize:aT,partial:!0},bp={name:"wwwAutolink",tokenize:eT,previous:vp},yp={name:"protocolAutolink",tokenize:tT,previous:Ep},kn={name:"emailAutolink",tokenize:Jw,previous:kp},gn={};function Zw(){return{text:gn}}let $n=48;for(;$n<123;)gn[$n]=kn,$n++,$n===58?$n=65:$n===91&&($n=97);gn[43]=kn;gn[45]=kn;gn[46]=kn;gn[95]=kn;gn[72]=[kn,yp];gn[104]=[kn,yp];gn[87]=[kn,bp];gn[119]=[kn,bp];function Jw(e,t,n){const r=this;let i,s;return a;function a(f){return!ul(f)||!kp.call(r,r.previous)||Ec(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(f))}function o(f){return ul(f)?(e.consume(f),o):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(Qw,h,c)(f):f===45||f===95||kt(f)?(s=!0,e.consume(f),l):h(f)}function c(f){return e.consume(f),i=!0,l}function h(f){return s&&i&&Nt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function eT(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!vp.call(r,r.previous)||Ec(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Xw,e.attempt(pp,e.attempt(gp,s),n),n)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function tT(e,t,n){const r=this;let i="",s=!1;return a;function a(f){return(f===72||f===104)&&Ep.call(r,r.previous)&&!Ec(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),o):n(f)}function o(f){if(Nt(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),o;if(f===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),s?c:(s=!0,l)):n(f)}function c(f){return f===null||zi(f)||tt(f)||cr(f)||fa(f)?n(f):e.attempt(pp,e.attempt(gp,h),n)(f)}function h(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function nT(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),s):n(a)}function s(a){return a===null?n(a):t(a)}}function rT(e,t,n){let r,i,s;return a;function a(c){return c===46||c===95?e.check(xp,l,o)(c):c===null||tt(c)||cr(c)||c!==45&&fa(c)?l(c):(s=!0,e.consume(c),a)}function o(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),a}function l(c){return i||r||!s?n(c):t(c)}}function sT(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(xp,t,s)(a):a===null||tt(a)||cr(a)?t(a):(e.consume(a),i)}function s(a){return a===41&&r++,e.consume(a),i}}function iT(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),s):o===93?(e.consume(o),i):o===60||o===null||tt(o)||cr(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||tt(o)||cr(o)?t(o):r(o)}function s(o){return Nt(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):Nt(o)?(e.consume(o),a):n(o)}}function aT(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return kt(s)?n(s):t(s)}}function vp(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||tt(e)}function Ep(e){return!Nt(e)}function kp(e){return!(e===47||ul(e))}function ul(e){return e===43||e===45||e===46||e===95||kt(e)}function Ec(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const oT={tokenize:pT,partial:!0};function lT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hT,continuation:{tokenize:fT},exit:mT}},text:{91:{name:"gfmFootnoteCall",tokenize:dT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:cT,resolveTo:uT}}}}function cT(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const c=nn(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function uT(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function dT(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(f){if(s>999||f===93&&!a||f===null||f===91||tt(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(nn(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return tt(f)||(a=!0),s++,e.consume(f),f===92?h:c}function h(f){return f===91||f===92||f===93?(e.consume(f),s++,c):c(f)}}function hT(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,o;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(p)}function h(p){if(a>999||p===93&&!o||p===null||p===91||tt(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=nn(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return tt(p)||(o=!0),a++,e.consume(p),p===92?f:h}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}function m(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),i.includes(s)||i.push(s),qe(e,d,"gfmFootnoteDefinitionWhitespace")):n(p)}function d(p){return t(p)}}function fT(e,t,n){return e.check(Hs,t,e.attempt(oT,t,n))}function mT(e){e.exit("gfmFootnoteDefinition")}function pT(e,t,n){const r=this;return qe(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function gT(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},f={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},m=[["enter",h,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",f,o]],d=o.parser.constructs.insideSpan.null;d&&Ht(m,m.length,0,ma(d,a.slice(c+1,l),o)),Ht(m,m.length,0,[["exit",f,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",h,o]]),Ht(a,c-1,l-c+3,m),l=c+m.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function s(a,o,l){const c=this.previous,h=this.events;let f=0;return m;function m(p){return c===126&&h[h.length-1][1].type!=="characterEscape"?l(p):(a.enter("strikethroughSequenceTemporary"),d(p))}function d(p){const g=Lr(c);if(p===126)return f>1?l(p):(a.consume(p),f++,d);if(f<2&&!n)return l(p);const x=a.exit("strikethroughSequenceTemporary"),b=Lr(p);return x._open=!b||b===2&&!!g,x._close=!g||g===2&&!!b,o(p)}}}class xT{constructor(){this.map=[]}add(t,n,r){bT(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function bT(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function yT(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function vT(){return{flow:{null:{name:"table",tokenize:ET,resolveAll:kT}}}}function ET(e,t,n){const r=this;let i=0,s=0,a;return o;function o(S){let R=r.events.length-1;for(;R>-1;){const L=r.events[R][1].type;if(L==="lineEnding"||L==="linePrefix")R--;else break}const M=R>-1?r.events[R][1].type:null,O=M==="tableHead"||M==="tableRow"?C:l;return O===C&&r.parser.lazy[r.now().line]?n(S):O(S)}function l(S){return e.enter("tableHead"),e.enter("tableRow"),c(S)}function c(S){return S===124||(a=!0,s+=1),h(S)}function h(S){return S===null?n(S):Ne(S)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),d):n(S):He(S)?qe(e,h,"whitespace")(S):(s+=1,a&&(a=!1,i+=1),S===124?(e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),f(S)))}function f(S){return S===null||S===124||tt(S)?(e.exit("data"),h(S)):(e.consume(S),S===92?m:f)}function m(S){return S===92||S===124?(e.consume(S),f):f(S)}function d(S){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(S):(e.enter("tableDelimiterRow"),a=!1,He(S)?qe(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):p(S))}function p(S){return S===45||S===58?x(S):S===124?(a=!0,e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),g):E(S)}function g(S){return He(S)?qe(e,x,"whitespace")(S):x(S)}function x(S){return S===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(S),e.exit("tableDelimiterMarker"),b):S===45?(s+=1,b(S)):S===null||Ne(S)?A(S):E(S)}function b(S){return S===45?(e.enter("tableDelimiterFiller"),k(S)):E(S)}function k(S){return S===45?(e.consume(S),k):S===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(S),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(S))}function T(S){return He(S)?qe(e,A,"whitespace")(S):A(S)}function A(S){return S===124?p(S):S===null||Ne(S)?!a||i!==s?E(S):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(S)):E(S)}function E(S){return n(S)}function C(S){return e.enter("tableRow"),_(S)}function _(S){return S===124?(e.enter("tableCellDivider"),e.consume(S),e.exit("tableCellDivider"),_):S===null||Ne(S)?(e.exit("tableRow"),t(S)):He(S)?qe(e,_,"whitespace")(S):(e.enter("data"),w(S))}function w(S){return S===null||S===124||tt(S)?(e.exit("data"),_(S)):(e.consume(S),S===92?N:w)}function N(S){return S===92||S===124?(e.consume(S),w):w(S)}}function kT(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,c,h,f;const m=new xT;for(;++n<e.length;){const d=e[n],p=d[1];d[0]==="enter"?p.type==="tableHead"?(o=!1,l!==0&&(Sd(m,t,l,c,h),h=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},m.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,f=void 0,s=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},m.add(n,0,[["enter",h,t]])),i=p.type==="tableDelimiterRow"?2:h?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],f=oi(m,t,s,i,void 0,f),s=[0,0,0,0]),a[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],f=oi(m,t,s,i,void 0,f)),s=a,a=[s[1],n,0,0])):p.type==="tableHead"?(o=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,s[1]!==0?(a[0]=a[1],f=oi(m,t,s,i,n,f)):a[1]!==0&&(f=oi(m,t,a,i,n,f)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&Sd(m,t,l,c,h),m.consume(t.events),n=-1;++n<t.events.length;){const d=t.events[n];d[0]==="enter"&&d[1].type==="table"&&(d[1]._align=yT(t.events,n))}return e}function oi(e,t,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},kr(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=kr(t.events,n[1]);if(s={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=kr(t.events,n[2]),h=kr(t.events,n[3]),f={type:o,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const m=t.events[n[2]],d=t.events[n[3]];if(m[1].end=Object.assign({},d[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;e.add(p,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},kr(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Sd(e,t,n,r,i){const s=[],a=kr(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function kr(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const wT={name:"tasklistCheck",tokenize:ST};function TT(){return{text:{91:wT}}}function ST(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return tt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return Ne(l)?t(l):He(l)?e.check({tokenize:CT},t,n)(l):n(l)}}function CT(e,t,n){return qe(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function AT(e){return Im([Zw(),lT(),gT(e),vT(),TT()])}const NT={};function wp(e){const t=this,n=e||NT,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(AT(n)),s.push(Gw()),a.push(Kw(n))}const Cd=/[#.]/g;function _T(e,t){const n=e||"",r={};let i=0,s,a;for(;i<n.length;){Cd.lastIndex=i;const o=Cd.exec(n),l=n.slice(i,o?o.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:a=l,i+=l.length),o&&(s=o[0],i++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}function Tp(e,t,n){const r=n?LT(n):void 0;function i(s,a,...o){let l;if(s==null){l={type:"root",children:[]};const c=a;o.unshift(c)}else{l=_T(s,t);const c=l.tagName.toLowerCase(),h=r?r.get(c):void 0;if(l.tagName=h||c,IT(a))o.unshift(a);else for(const[f,m]of Object.entries(a))MT(e,l.properties,f,m)}for(const c of o)dl(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function IT(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const i=t[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const a of s)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function MT(e,t,n,r){const i=da(e,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=Bu(r):i.commaSeparated?s=Pu(r):i.commaOrSpaceSeparated?s=Bu(Pu(r).join(" ")):s=Ad(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?RT(r):String(r);if(Array.isArray(s)){const a=[];for(const o of s)a.push(Ad(i,i.property,o));s=a}i.property==="className"&&Array.isArray(t.className)&&(s=t.className.concat(s)),t[i.property]=s}}function dl(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)dl(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?dl(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function Ad(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Cs(n)===Cs(t)))return!0}return n}function RT(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function LT(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const PT=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],DT=Tp(Bs,"div"),OT=Tp(Ln,"g",PT);function jT(e){const t=String(e),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const l=Nd(t,n[a-1]);o=l===-1?t.length+1:l+1,n[a]=o}if(o>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const o=n[n.length-1],l=Nd(t,o),c=l===-1?t.length+1:l+1;if(o===c)break;n.push(c)}const a=(s.line>1?n[s.line-2]:0)+s.column-1;if(a<n[s.line-1])return a}}}function Nd(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
506
|
+
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Qn={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Sp={}.hasOwnProperty,FT=Object.prototype;function BT(e,t){const n=t||{};return kc({file:n.file||void 0,location:!1,schema:n.space==="svg"?Ln:Bs,verbose:n.verbose||!1},e)}function kc(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},Ti(e,r,n),n}case"#document":case"#document-fragment":{const r=t,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:Cp(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){const s=String(e.file),a=jT(s),o=a.toPoint(0),l=a.toPoint(s.length);n.position={start:o,end:l}}return n}case"#documentType":{const r=t;return n={type:"doctype"},Ti(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},Ti(e,r,n),n}default:return n=HT(e,t),n}}function Cp(e,t){let n=-1;const r=[];for(;++n<t.length;){const i=kc(e,t[n]);r.push(i)}return r}function HT(e,t){const n=e.schema;e.schema=t.namespaceURI===Qn.svg?Ln:Bs;let r=-1;const i={};for(;++r<t.attrs.length;){const o=t.attrs[r],l=(o.prefix?o.prefix+":":"")+o.name;Sp.call(FT,l)||(i[l]=o.value)}const a=(e.schema.space==="svg"?OT:DT)(t.tagName,i,Cp(e,t.childNodes));if(Ti(e,t,a),a.tagName==="template"){const o=t,l=o.sourceCodeLocation,c=l&&l.startTag&&Tr(l.startTag),h=l&&l.endTag&&Tr(l.endTag),f=kc(e,o.content);c&&h&&e.file&&(f.position={start:c.end,end:h.start}),a.content=f}return e.schema=n,a}function Ti(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=UT(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function UT(e,t,n){const r=Tr(n);if(t.type==="element"){const i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){const s={};let a;if(n.attrs)for(a in n.attrs)Sp.call(n.attrs,a)&&(s[da(e.schema,a).property]=Tr(n.attrs[a]));n.startTag;const o=Tr(n.startTag),l=n.endTag?Tr(n.endTag):void 0,c={opening:o};l&&(c.closing=l),c.properties=s,t.data={position:c}}}return r}function Tr(e){const t=_d({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=_d({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function _d(e){return e.line&&e.column?e:void 0}const zT={},VT={}.hasOwnProperty,Ap=rp("type",{handlers:{root:qT,element:XT,text:GT,comment:KT,doctype:YT}});function $T(e,t){const r=(t||zT).space;return Ap(e,r==="svg"?Ln:Bs)}function qT(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=wc(e.children,n,t),Hr(e,n),n}function WT(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=wc(e.children,n,t),Hr(e,n),n}function YT(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return Hr(e,t),t}function GT(e){const t={nodeName:"#text",value:e.value,parentNode:null};return Hr(e,t),t}function KT(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return Hr(e,t),t}function XT(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=Ln);const i=[];let s;if(e.properties){for(s in e.properties)if(s!=="children"&&VT.call(e.properties,s)){const l=QT(r,s,e.properties[s]);l&&i.push(l)}}const a=r.space,o={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Qn[a],childNodes:[],parentNode:null};return o.childNodes=wc(e.children,o,r),Hr(e,o),e.tagName==="template"&&e.content&&(o.content=WT(e.content,r)),o}function QT(e,t,n){const r=da(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?mm(n):km(n));const i={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const s=i.name.indexOf(":");s<0?i.prefix="":(i.name=i.name.slice(s+1),i.prefix=r.attribute.slice(0,s)),i.namespace=Qn[r.space]}return i}function wc(e,t,n){let r=-1;const i=[];if(e)for(;++r<e.length;){const s=Ap(e[r],n);s.parentNode=t,i.push(s)}return i}function Hr(e,t){const n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}const ZT=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],JT=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),st="�";var F;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(F||(F={}));const Rt={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function Np(e){return e>=55296&&e<=57343}function eS(e){return e>=56320&&e<=57343}function tS(e,t){return(e-55296)*1024+9216+t}function _p(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Ip(e){return e>=64976&&e<=65007||JT.has(e)}var te;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(te||(te={}));const nS=65536;class rS{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=nS,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:i,offset:s}=this,a=i+n,o=s+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(eS(n))return this.pos++,this._addGap(),tS(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,F.EOF;return this._err(te.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,F.EOF;const r=this.html.charCodeAt(n);return r===F.CARRIAGE_RETURN?F.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,F.EOF;let t=this.html.charCodeAt(this.pos);return t===F.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,F.LINE_FEED):t===F.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Np(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===F.LINE_FEED||t===F.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){_p(t)?this._err(te.controlCharacterInInputStream):Ip(t)&&this._err(te.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Fe;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(Fe||(Fe={}));function Mp(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const sS=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),iS=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function aS(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=iS.get(e))!==null&&t!==void 0?t:e}var xt;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(xt||(xt={}));const oS=32;var _n;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(_n||(_n={}));function hl(e){return e>=xt.ZERO&&e<=xt.NINE}function lS(e){return e>=xt.UPPER_A&&e<=xt.UPPER_F||e>=xt.LOWER_A&&e<=xt.LOWER_F}function cS(e){return e>=xt.UPPER_A&&e<=xt.UPPER_Z||e>=xt.LOWER_A&&e<=xt.LOWER_Z||hl(e)}function uS(e){return e===xt.EQUALS||cS(e)}var gt;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(gt||(gt={}));var vn;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(vn||(vn={}));class dS{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=gt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=vn.Strict}startEntity(t){this.decodeMode=t,this.state=gt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case gt.EntityStart:return t.charCodeAt(n)===xt.NUM?(this.state=gt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=gt.NamedEntity,this.stateNamedEntity(t,n));case gt.NumericStart:return this.stateNumericStart(t,n);case gt.NumericDecimal:return this.stateNumericDecimal(t,n);case gt.NumericHex:return this.stateNumericHex(t,n);case gt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|oS)===xt.LOWER_X?(this.state=gt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=gt.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(t.substr(n,s),i),this.consumed+=s}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const i=t.charCodeAt(n);if(hl(i)||lS(i))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const i=t.charCodeAt(n);if(hl(i))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===xt.SEMI)this.consumed+=1;else if(this.decodeMode===vn.Strict)return 0;return this.emitCodePoint(aS(this.result),this.consumed),this.errors&&(t!==xt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&_n.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const a=t.charCodeAt(n);if(this.treeIndex=hS(r,i,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return this.result===0||this.decodeMode===vn.Attribute&&(s===0||uS(a))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&_n.VALUE_LENGTH)>>14,s!==0){if(a===xt.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==vn.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,i=(r[n]&_n.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~_n.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case gt.NamedEntity:return this.result!==0&&(this.decodeMode!==vn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case gt.NumericDecimal:return this.emitNumericEntity(0,2);case gt.NumericHex:return this.emitNumericEntity(0,3);case gt.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case gt.EntityStart:return 0}}}function hS(e,t,n,r){const i=(t&_n.BRANCH_LENGTH)>>7,s=t&_n.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:e[n+l]-1}let a=n,o=a+i-1;for(;a<=o;){const l=a+o>>>1,c=e[l];if(c<r)a=l+1;else if(c>r)o=l-1;else return e[l+i]}return-1}var ue;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ue||(ue={}));var sr;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(sr||(sr={}));var Wt;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Wt||(Wt={}));var J;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(J||(J={}));var y;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(y||(y={}));const fS=new Map([[J.A,y.A],[J.ADDRESS,y.ADDRESS],[J.ANNOTATION_XML,y.ANNOTATION_XML],[J.APPLET,y.APPLET],[J.AREA,y.AREA],[J.ARTICLE,y.ARTICLE],[J.ASIDE,y.ASIDE],[J.B,y.B],[J.BASE,y.BASE],[J.BASEFONT,y.BASEFONT],[J.BGSOUND,y.BGSOUND],[J.BIG,y.BIG],[J.BLOCKQUOTE,y.BLOCKQUOTE],[J.BODY,y.BODY],[J.BR,y.BR],[J.BUTTON,y.BUTTON],[J.CAPTION,y.CAPTION],[J.CENTER,y.CENTER],[J.CODE,y.CODE],[J.COL,y.COL],[J.COLGROUP,y.COLGROUP],[J.DD,y.DD],[J.DESC,y.DESC],[J.DETAILS,y.DETAILS],[J.DIALOG,y.DIALOG],[J.DIR,y.DIR],[J.DIV,y.DIV],[J.DL,y.DL],[J.DT,y.DT],[J.EM,y.EM],[J.EMBED,y.EMBED],[J.FIELDSET,y.FIELDSET],[J.FIGCAPTION,y.FIGCAPTION],[J.FIGURE,y.FIGURE],[J.FONT,y.FONT],[J.FOOTER,y.FOOTER],[J.FOREIGN_OBJECT,y.FOREIGN_OBJECT],[J.FORM,y.FORM],[J.FRAME,y.FRAME],[J.FRAMESET,y.FRAMESET],[J.H1,y.H1],[J.H2,y.H2],[J.H3,y.H3],[J.H4,y.H4],[J.H5,y.H5],[J.H6,y.H6],[J.HEAD,y.HEAD],[J.HEADER,y.HEADER],[J.HGROUP,y.HGROUP],[J.HR,y.HR],[J.HTML,y.HTML],[J.I,y.I],[J.IMG,y.IMG],[J.IMAGE,y.IMAGE],[J.INPUT,y.INPUT],[J.IFRAME,y.IFRAME],[J.KEYGEN,y.KEYGEN],[J.LABEL,y.LABEL],[J.LI,y.LI],[J.LINK,y.LINK],[J.LISTING,y.LISTING],[J.MAIN,y.MAIN],[J.MALIGNMARK,y.MALIGNMARK],[J.MARQUEE,y.MARQUEE],[J.MATH,y.MATH],[J.MENU,y.MENU],[J.META,y.META],[J.MGLYPH,y.MGLYPH],[J.MI,y.MI],[J.MO,y.MO],[J.MN,y.MN],[J.MS,y.MS],[J.MTEXT,y.MTEXT],[J.NAV,y.NAV],[J.NOBR,y.NOBR],[J.NOFRAMES,y.NOFRAMES],[J.NOEMBED,y.NOEMBED],[J.NOSCRIPT,y.NOSCRIPT],[J.OBJECT,y.OBJECT],[J.OL,y.OL],[J.OPTGROUP,y.OPTGROUP],[J.OPTION,y.OPTION],[J.P,y.P],[J.PARAM,y.PARAM],[J.PLAINTEXT,y.PLAINTEXT],[J.PRE,y.PRE],[J.RB,y.RB],[J.RP,y.RP],[J.RT,y.RT],[J.RTC,y.RTC],[J.RUBY,y.RUBY],[J.S,y.S],[J.SCRIPT,y.SCRIPT],[J.SEARCH,y.SEARCH],[J.SECTION,y.SECTION],[J.SELECT,y.SELECT],[J.SOURCE,y.SOURCE],[J.SMALL,y.SMALL],[J.SPAN,y.SPAN],[J.STRIKE,y.STRIKE],[J.STRONG,y.STRONG],[J.STYLE,y.STYLE],[J.SUB,y.SUB],[J.SUMMARY,y.SUMMARY],[J.SUP,y.SUP],[J.TABLE,y.TABLE],[J.TBODY,y.TBODY],[J.TEMPLATE,y.TEMPLATE],[J.TEXTAREA,y.TEXTAREA],[J.TFOOT,y.TFOOT],[J.TD,y.TD],[J.TH,y.TH],[J.THEAD,y.THEAD],[J.TITLE,y.TITLE],[J.TR,y.TR],[J.TRACK,y.TRACK],[J.TT,y.TT],[J.U,y.U],[J.UL,y.UL],[J.SVG,y.SVG],[J.VAR,y.VAR],[J.WBR,y.WBR],[J.XMP,y.XMP]]);function Ur(e){var t;return(t=fS.get(e))!==null&&t!==void 0?t:y.UNKNOWN}const he=y,mS={[ue.HTML]:new Set([he.ADDRESS,he.APPLET,he.AREA,he.ARTICLE,he.ASIDE,he.BASE,he.BASEFONT,he.BGSOUND,he.BLOCKQUOTE,he.BODY,he.BR,he.BUTTON,he.CAPTION,he.CENTER,he.COL,he.COLGROUP,he.DD,he.DETAILS,he.DIR,he.DIV,he.DL,he.DT,he.EMBED,he.FIELDSET,he.FIGCAPTION,he.FIGURE,he.FOOTER,he.FORM,he.FRAME,he.FRAMESET,he.H1,he.H2,he.H3,he.H4,he.H5,he.H6,he.HEAD,he.HEADER,he.HGROUP,he.HR,he.HTML,he.IFRAME,he.IMG,he.INPUT,he.LI,he.LINK,he.LISTING,he.MAIN,he.MARQUEE,he.MENU,he.META,he.NAV,he.NOEMBED,he.NOFRAMES,he.NOSCRIPT,he.OBJECT,he.OL,he.P,he.PARAM,he.PLAINTEXT,he.PRE,he.SCRIPT,he.SECTION,he.SELECT,he.SOURCE,he.STYLE,he.SUMMARY,he.TABLE,he.TBODY,he.TD,he.TEMPLATE,he.TEXTAREA,he.TFOOT,he.TH,he.THEAD,he.TITLE,he.TR,he.TRACK,he.UL,he.WBR,he.XMP]),[ue.MATHML]:new Set([he.MI,he.MO,he.MN,he.MS,he.MTEXT,he.ANNOTATION_XML]),[ue.SVG]:new Set([he.TITLE,he.FOREIGN_OBJECT,he.DESC]),[ue.XLINK]:new Set,[ue.XML]:new Set,[ue.XMLNS]:new Set},fl=new Set([he.H1,he.H2,he.H3,he.H4,he.H5,he.H6]);J.STYLE,J.SCRIPT,J.XMP,J.IFRAME,J.NOEMBED,J.NOFRAMES,J.PLAINTEXT;var H;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(H||(H={}));const dt={DATA:H.DATA,RCDATA:H.RCDATA,RAWTEXT:H.RAWTEXT,SCRIPT_DATA:H.SCRIPT_DATA,PLAINTEXT:H.PLAINTEXT,CDATA_SECTION:H.CDATA_SECTION};function pS(e){return e>=F.DIGIT_0&&e<=F.DIGIT_9}function is(e){return e>=F.LATIN_CAPITAL_A&&e<=F.LATIN_CAPITAL_Z}function gS(e){return e>=F.LATIN_SMALL_A&&e<=F.LATIN_SMALL_Z}function Tn(e){return gS(e)||is(e)}function Id(e){return Tn(e)||pS(e)}function li(e){return e+32}function Rp(e){return e===F.SPACE||e===F.LINE_FEED||e===F.TABULATION||e===F.FORM_FEED}function Md(e){return Rp(e)||e===F.SOLIDUS||e===F.GREATER_THAN_SIGN}function xS(e){return e===F.NULL?te.nullCharacterReference:e>1114111?te.characterReferenceOutsideUnicodeRange:Np(e)?te.surrogateCharacterReference:Ip(e)?te.noncharacterCharacterReference:_p(e)||e===F.CARRIAGE_RETURN?te.controlCharacterReference:null}class bS{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=H.DATA,this.returnState=H.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new rS(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new dS(sS,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(te.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(te.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=xS(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:Fe.START_TAG,tagName:"",tagID:y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Fe.END_TAG,tagName:"",tagID:y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:Fe.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:Fe.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(Mp(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(te.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Ur(t.tagName),t.type===Fe.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(te.endTagWithAttributes),t.selfClosing&&this._err(te.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Fe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Fe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Fe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Fe.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=Rp(t)?Fe.WHITESPACE_CHARACTER:t===F.NULL?Fe.NULL_CHARACTER:Fe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Fe.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=H.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?vn.Attribute:vn.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===H.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===H.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===H.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case H.DATA:{this._stateData(t);break}case H.RCDATA:{this._stateRcdata(t);break}case H.RAWTEXT:{this._stateRawtext(t);break}case H.SCRIPT_DATA:{this._stateScriptData(t);break}case H.PLAINTEXT:{this._statePlaintext(t);break}case H.TAG_OPEN:{this._stateTagOpen(t);break}case H.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case H.TAG_NAME:{this._stateTagName(t);break}case H.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case H.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case H.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case H.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case H.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case H.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case H.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case H.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case H.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case H.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case H.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case H.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case H.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case H.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case H.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case H.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case H.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case H.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case H.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case H.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case H.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case H.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case H.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case H.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case H.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case H.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case H.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case H.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case H.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case H.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case H.BOGUS_COMMENT:{this._stateBogusComment(t);break}case H.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case H.COMMENT_START:{this._stateCommentStart(t);break}case H.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case H.COMMENT:{this._stateComment(t);break}case H.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case H.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case H.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case H.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case H.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case H.COMMENT_END:{this._stateCommentEnd(t);break}case H.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case H.DOCTYPE:{this._stateDoctype(t);break}case H.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case H.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case H.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case H.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case H.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case H.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case H.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case H.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case H.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case H.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case H.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case H.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case H.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case H.CDATA_SECTION:{this._stateCdataSection(t);break}case H.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case H.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case H.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case H.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case F.LESS_THAN_SIGN:{this.state=H.TAG_OPEN;break}case F.AMPERSAND:{this._startCharacterReference();break}case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitCodePoint(t);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case F.AMPERSAND:{this._startCharacterReference();break}case F.LESS_THAN_SIGN:{this.state=H.RCDATA_LESS_THAN_SIGN;break}case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitChars(st);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case F.LESS_THAN_SIGN:{this.state=H.RAWTEXT_LESS_THAN_SIGN;break}case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitChars(st);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_LESS_THAN_SIGN;break}case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitChars(st);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitChars(st);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Tn(t))this._createStartTagToken(),this.state=H.TAG_NAME,this._stateTagName(t);else switch(t){case F.EXCLAMATION_MARK:{this.state=H.MARKUP_DECLARATION_OPEN;break}case F.SOLIDUS:{this.state=H.END_TAG_OPEN;break}case F.QUESTION_MARK:{this._err(te.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=H.BOGUS_COMMENT,this._stateBogusComment(t);break}case F.EOF:{this._err(te.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(te.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=H.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Tn(t))this._createEndTagToken(),this.state=H.TAG_NAME,this._stateTagName(t);else switch(t){case F.GREATER_THAN_SIGN:{this._err(te.missingEndTagName),this.state=H.DATA;break}case F.EOF:{this._err(te.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(te.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=H.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this.state=H.BEFORE_ATTRIBUTE_NAME;break}case F.SOLIDUS:{this.state=H.SELF_CLOSING_START_TAG;break}case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentTagToken();break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.tagName+=st;break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(is(t)?li(t):t)}}_stateRcdataLessThanSign(t){t===F.SOLIDUS?this.state=H.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=H.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Tn(t)?(this.state=H.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=H.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=H.BEFORE_ATTRIBUTE_NAME,!1;case F.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=H.SELF_CLOSING_START_TAG,!1;case F.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=H.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=H.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===F.SOLIDUS?this.state=H.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=H.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Tn(t)?(this.state=H.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=H.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=H.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case F.SOLIDUS:{this.state=H.SCRIPT_DATA_END_TAG_OPEN;break}case F.EXCLAMATION_MARK:{this.state=H.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=H.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Tn(t)?(this.state=H.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=H.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=H.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===F.HYPHEN_MINUS?(this.state=H.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=H.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===F.HYPHEN_MINUS?(this.state=H.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=H.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case F.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitChars(st);break}case F.EOF:{this._err(te.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case F.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_ESCAPED,this._emitChars(st);break}case F.EOF:{this._err(te.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case F.HYPHEN_MINUS:{this._emitChars("-");break}case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case F.GREATER_THAN_SIGN:{this.state=H.SCRIPT_DATA,this._emitChars(">");break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_ESCAPED,this._emitChars(st);break}case F.EOF:{this._err(te.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===F.SOLIDUS?this.state=H.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Tn(t)?(this._emitChars("<"),this.state=H.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=H.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Tn(t)?(this.state=H.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=H.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=H.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Rt.SCRIPT,!1)&&Md(this.preprocessor.peek(Rt.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Rt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=H.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case F.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case F.NULL:{this._err(te.unexpectedNullCharacter),this._emitChars(st);break}case F.EOF:{this._err(te.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case F.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(st);break}case F.EOF:{this._err(te.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case F.HYPHEN_MINUS:{this._emitChars("-");break}case F.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case F.GREATER_THAN_SIGN:{this.state=H.SCRIPT_DATA,this._emitChars(">");break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(st);break}case F.EOF:{this._err(te.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===F.SOLIDUS?(this.state=H.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Rt.SCRIPT,!1)&&Md(this.preprocessor.peek(Rt.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Rt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=H.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.SOLIDUS:case F.GREATER_THAN_SIGN:case F.EOF:{this.state=H.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case F.EQUALS_SIGN:{this._err(te.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=H.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=H.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:case F.SOLIDUS:case F.GREATER_THAN_SIGN:case F.EOF:{this._leaveAttrName(),this.state=H.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case F.EQUALS_SIGN:{this._leaveAttrName(),this.state=H.BEFORE_ATTRIBUTE_VALUE;break}case F.QUOTATION_MARK:case F.APOSTROPHE:case F.LESS_THAN_SIGN:{this._err(te.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.currentAttr.name+=st;break}default:this.currentAttr.name+=String.fromCodePoint(is(t)?li(t):t)}}_stateAfterAttributeName(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.SOLIDUS:{this.state=H.SELF_CLOSING_START_TAG;break}case F.EQUALS_SIGN:{this.state=H.BEFORE_ATTRIBUTE_VALUE;break}case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentTagToken();break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=H.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.QUOTATION_MARK:{this.state=H.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case F.APOSTROPHE:{this.state=H.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case F.GREATER_THAN_SIGN:{this._err(te.missingAttributeValue),this.state=H.DATA,this.emitCurrentTagToken();break}default:this.state=H.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case F.QUOTATION_MARK:{this.state=H.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case F.AMPERSAND:{this._startCharacterReference();break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.currentAttr.value+=st;break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case F.APOSTROPHE:{this.state=H.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case F.AMPERSAND:{this._startCharacterReference();break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.currentAttr.value+=st;break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this._leaveAttrValue(),this.state=H.BEFORE_ATTRIBUTE_NAME;break}case F.AMPERSAND:{this._startCharacterReference();break}case F.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=H.DATA,this.emitCurrentTagToken();break}case F.NULL:{this._err(te.unexpectedNullCharacter),this.currentAttr.value+=st;break}case F.QUOTATION_MARK:case F.APOSTROPHE:case F.LESS_THAN_SIGN:case F.EQUALS_SIGN:case F.GRAVE_ACCENT:{this._err(te.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this._leaveAttrValue(),this.state=H.BEFORE_ATTRIBUTE_NAME;break}case F.SOLIDUS:{this._leaveAttrValue(),this.state=H.SELF_CLOSING_START_TAG;break}case F.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=H.DATA,this.emitCurrentTagToken();break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:this._err(te.missingWhitespaceBetweenAttributes),this.state=H.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case F.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=H.DATA,this.emitCurrentTagToken();break}case F.EOF:{this._err(te.eofInTag),this._emitEOFToken();break}default:this._err(te.unexpectedSolidusInTag),this.state=H.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentComment(n);break}case F.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.data+=st;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Rt.DASH_DASH,!0)?(this._createCommentToken(Rt.DASH_DASH.length+1),this.state=H.COMMENT_START):this._consumeSequenceIfMatch(Rt.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Rt.DOCTYPE.length+1),this.state=H.DOCTYPE):this._consumeSequenceIfMatch(Rt.CDATA_START,!0)?this.inForeignNode?this.state=H.CDATA_SECTION:(this._err(te.cdataInHtmlContent),this._createCommentToken(Rt.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=H.BOGUS_COMMENT):this._ensureHibernation()||(this._err(te.incorrectlyOpenedComment),this._createCommentToken(2),this.state=H.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case F.HYPHEN_MINUS:{this.state=H.COMMENT_START_DASH;break}case F.GREATER_THAN_SIGN:{this._err(te.abruptClosingOfEmptyComment),this.state=H.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=H.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case F.HYPHEN_MINUS:{this.state=H.COMMENT_END;break}case F.GREATER_THAN_SIGN:{this._err(te.abruptClosingOfEmptyComment),this.state=H.DATA,this.emitCurrentComment(n);break}case F.EOF:{this._err(te.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=H.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case F.HYPHEN_MINUS:{this.state=H.COMMENT_END_DASH;break}case F.LESS_THAN_SIGN:{n.data+="<",this.state=H.COMMENT_LESS_THAN_SIGN;break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.data+=st;break}case F.EOF:{this._err(te.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case F.EXCLAMATION_MARK:{n.data+="!",this.state=H.COMMENT_LESS_THAN_SIGN_BANG;break}case F.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=H.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===F.HYPHEN_MINUS?this.state=H.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=H.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===F.HYPHEN_MINUS?this.state=H.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=H.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==F.GREATER_THAN_SIGN&&t!==F.EOF&&this._err(te.nestedComment),this.state=H.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case F.HYPHEN_MINUS:{this.state=H.COMMENT_END;break}case F.EOF:{this._err(te.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=H.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentComment(n);break}case F.EXCLAMATION_MARK:{this.state=H.COMMENT_END_BANG;break}case F.HYPHEN_MINUS:{n.data+="-";break}case F.EOF:{this._err(te.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=H.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case F.HYPHEN_MINUS:{n.data+="--!",this.state=H.COMMENT_END_DASH;break}case F.GREATER_THAN_SIGN:{this._err(te.incorrectlyClosedComment),this.state=H.DATA,this.emitCurrentComment(n);break}case F.EOF:{this._err(te.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=H.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this.state=H.BEFORE_DOCTYPE_NAME;break}case F.GREATER_THAN_SIGN:{this.state=H.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case F.EOF:{this._err(te.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingWhitespaceBeforeDoctypeName),this.state=H.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(is(t))this._createDoctypeToken(String.fromCharCode(li(t))),this.state=H.DOCTYPE_NAME;else switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.NULL:{this._err(te.unexpectedNullCharacter),this._createDoctypeToken(st),this.state=H.DOCTYPE_NAME;break}case F.GREATER_THAN_SIGN:{this._err(te.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.EOF:{this._err(te.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=H.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this.state=H.AFTER_DOCTYPE_NAME;break}case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.name+=st;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(is(t)?li(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Rt.PUBLIC,!1)?this.state=H.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Rt.SYSTEM,!1)?this.state=H.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(te.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this.state=H.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case F.QUOTATION_MARK:{this._err(te.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case F.APOSTROPHE:{this._err(te.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case F.GREATER_THAN_SIGN:{this._err(te.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.QUOTATION_MARK:{n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case F.APOSTROPHE:{n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case F.GREATER_THAN_SIGN:{this._err(te.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case F.QUOTATION_MARK:{this.state=H.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.publicId+=st;break}case F.GREATER_THAN_SIGN:{this._err(te.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case F.APOSTROPHE:{this.state=H.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.publicId+=st;break}case F.GREATER_THAN_SIGN:{this._err(te.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this.state=H.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case F.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.QUOTATION_MARK:{this._err(te.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case F.APOSTROPHE:{this._err(te.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.QUOTATION_MARK:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case F.APOSTROPHE:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:{this.state=H.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case F.QUOTATION_MARK:{this._err(te.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case F.APOSTROPHE:{this._err(te.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case F.GREATER_THAN_SIGN:{this._err(te.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.QUOTATION_MARK:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case F.APOSTROPHE:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case F.GREATER_THAN_SIGN:{this._err(te.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case F.QUOTATION_MARK:{this.state=H.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.systemId+=st;break}case F.GREATER_THAN_SIGN:{this._err(te.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case F.APOSTROPHE:{this.state=H.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case F.NULL:{this._err(te.unexpectedNullCharacter),n.systemId+=st;break}case F.GREATER_THAN_SIGN:{this._err(te.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case F.SPACE:case F.LINE_FEED:case F.TABULATION:case F.FORM_FEED:break;case F.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.EOF:{this._err(te.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(te.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case F.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=H.DATA;break}case F.NULL:{this._err(te.unexpectedNullCharacter);break}case F.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case F.RIGHT_SQUARE_BRACKET:{this.state=H.CDATA_SECTION_BRACKET;break}case F.EOF:{this._err(te.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===F.RIGHT_SQUARE_BRACKET?this.state=H.CDATA_SECTION_END:(this._emitChars("]"),this.state=H.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case F.GREATER_THAN_SIGN:{this.state=H.DATA;break}case F.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=H.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(F.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Id(this.preprocessor.peek(1))?H.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){Id(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===F.SEMICOLON&&this._err(te.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const Lp=new Set([y.DD,y.DT,y.LI,y.OPTGROUP,y.OPTION,y.P,y.RB,y.RP,y.RT,y.RTC]),Rd=new Set([...Lp,y.CAPTION,y.COLGROUP,y.TBODY,y.TD,y.TFOOT,y.TH,y.THEAD,y.TR]),qi=new Set([y.APPLET,y.CAPTION,y.HTML,y.MARQUEE,y.OBJECT,y.TABLE,y.TD,y.TEMPLATE,y.TH]),yS=new Set([...qi,y.OL,y.UL]),vS=new Set([...qi,y.BUTTON]),Ld=new Set([y.ANNOTATION_XML,y.MI,y.MN,y.MO,y.MS,y.MTEXT]),Pd=new Set([y.DESC,y.FOREIGN_OBJECT,y.TITLE]),ES=new Set([y.TR,y.TEMPLATE,y.HTML]),kS=new Set([y.TBODY,y.TFOOT,y.THEAD,y.TEMPLATE,y.HTML]),wS=new Set([y.TABLE,y.TEMPLATE,y.HTML]),TS=new Set([y.TD,y.TH]);class SS{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=y.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===y.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ue.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ue.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(fl,ue.HTML)}popUntilTableCellPopped(){this.popUntilPopped(TS,ue.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(wS,ue.HTML)}clearBackToTableBodyContext(){this.clearBackTo(kS,ue.HTML)}clearBackToTableRowContext(){this.clearBackTo(ES,ue.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===y.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===y.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ue.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case ue.SVG:{if(Pd.has(i))return!1;break}case ue.MATHML:{if(Ld.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,qi)}hasInListItemScope(t){return this.hasInDynamicScope(t,yS)}hasInButtonScope(t){return this.hasInDynamicScope(t,vS)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ue.HTML:{if(fl.has(n))return!0;if(qi.has(n))return!1;break}case ue.SVG:{if(Pd.has(n))return!1;break}case ue.MATHML:{if(Ld.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ue.HTML)switch(this.tagIDs[n]){case t:return!0;case y.TABLE:case y.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ue.HTML)switch(this.tagIDs[t]){case y.TBODY:case y.THEAD:case y.TFOOT:return!0;case y.TABLE:case y.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ue.HTML)switch(this.tagIDs[n]){case t:return!0;case y.OPTION:case y.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Lp.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Rd.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Rd.has(this.currentTagId);)this.pop()}}const uo=3;var cn;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(cn||(cn={}));const Dd={type:cn.Marker};class CS{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const l=this.entries[o];if(l.type===cn.Marker)break;const{element:c}=l;if(this.treeAdapter.getTagName(c)===s&&this.treeAdapter.getNamespaceURI(c)===a){const h=this.treeAdapter.getAttrList(c);h.length===i&&r.push({idx:o,attrs:h})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<uo)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<uo)return;const i=new Map(n.map(a=>[a.name,a.value]));let s=0;for(let a=0;a<r.length;a++){const o=r[a];o.attrs.every(l=>i.get(l.name)===l.value)&&(s+=1,s>=uo&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(Dd)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:cn.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:cn.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(Dd);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===cn.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===cn.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===cn.Element&&n.element===t)}}const Sn={createDocument(){return{nodeName:"#document",mode:Wt.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const i=e.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};Sn.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(Sn.isTextNode(n)){n.value+=t;return}}Sn.appendChild(e,Sn.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Sn.isTextNode(r)?r.value+=t:Sn.insertBefore(e,Sn.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Pp="html",AS="about:legacy-compat",NS="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Dp=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],_S=[...Dp,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],IS=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),Op=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],MS=[...Op,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Od(e,t){return t.some(n=>e.startsWith(n))}function RS(e){return e.name===Pp&&e.publicId===null&&(e.systemId===null||e.systemId===AS)}function LS(e){if(e.name!==Pp)return Wt.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===NS)return Wt.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),IS.has(n))return Wt.QUIRKS;let r=t===null?_S:Dp;if(Od(n,r))return Wt.QUIRKS;if(r=t===null?Op:MS,Od(n,r))return Wt.LIMITED_QUIRKS}return Wt.NO_QUIRKS}const jd={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},PS="definitionurl",DS="definitionURL",OS=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),jS=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ue.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ue.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ue.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ue.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ue.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ue.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ue.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ue.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ue.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ue.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ue.XMLNS}]]),FS=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),BS=new Set([y.B,y.BIG,y.BLOCKQUOTE,y.BODY,y.BR,y.CENTER,y.CODE,y.DD,y.DIV,y.DL,y.DT,y.EM,y.EMBED,y.H1,y.H2,y.H3,y.H4,y.H5,y.H6,y.HEAD,y.HR,y.I,y.IMG,y.LI,y.LISTING,y.MENU,y.META,y.NOBR,y.OL,y.P,y.PRE,y.RUBY,y.S,y.SMALL,y.SPAN,y.STRONG,y.STRIKE,y.SUB,y.SUP,y.TABLE,y.TT,y.U,y.UL,y.VAR]);function HS(e){const t=e.tagID;return t===y.FONT&&e.attrs.some(({name:r})=>r===sr.COLOR||r===sr.SIZE||r===sr.FACE)||BS.has(t)}function jp(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===PS){e.attrs[t].name=DS;break}}function Fp(e){for(let t=0;t<e.attrs.length;t++){const n=OS.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Tc(e){for(let t=0;t<e.attrs.length;t++){const n=jS.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function US(e){const t=FS.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Ur(e.tagName))}function zS(e,t){return t===ue.MATHML&&(e===y.MI||e===y.MO||e===y.MN||e===y.MS||e===y.MTEXT)}function VS(e,t,n){if(t===ue.MATHML&&e===y.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===sr.ENCODING){const i=n[r].value.toLowerCase();return i===jd.TEXT_HTML||i===jd.APPLICATION_XML}}return t===ue.SVG&&(e===y.FOREIGN_OBJECT||e===y.DESC||e===y.TITLE)}function $S(e,t,n,r){return(!r||r===ue.HTML)&&VS(e,t,n)||(!r||r===ue.MATHML)&&zS(e,t)}const qS="hidden",WS=8,YS=3;var z;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(z||(z={}));const GS={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Bp=new Set([y.TABLE,y.TBODY,y.TFOOT,y.THEAD,y.TR]),Fd={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Sn,onParseError:null};class Bd{constructor(t,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=z.INITIAL,this.originalInsertionMode=z.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Fd,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new bS(this.options,this),this.activeFormattingElements=new CS(this.treeAdapter),this.fragmentContextID=r?Ur(this.treeAdapter.getTagName(r)):y.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new SS(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...Fd,...n};t??(t=r.treeAdapter.createElement(J.TEMPLATE,ue.HTML,[]));const i=r.treeAdapter.createElement("documentmock",ue.HTML,[]),s=new this(r,i,t);return s.fragmentContextID===y.TEMPLATE&&s.tmplInsertionModeStack.unshift(z.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var i;if(!this.onParseError)return;const s=(i=t.location)!==null&&i!==void 0?i:GS,a={code:n,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:r?s.startLine:s.endLine,endCol:r?s.startCol:s.endCol,endOffset:r?s.startOffset:s.endOffset};this.onParseError(a)}onItemPush(t,n,r){var i,s;(s=(i=this.treeAdapter).onItemPush)===null||s===void 0||s.call(i,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let s,a;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,this._setContextModes(s,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ue.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ue.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=z.TEXT}switchToPlaintextParsing(){this.insertionMode=z.TEXT,this.originalInsertionMode=z.IN_BODY,this.tokenizer.state=dt.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===J.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ue.HTML))switch(this.fragmentContextID){case y.TITLE:case y.TEXTAREA:{this.tokenizer.state=dt.RCDATA;break}case y.STYLE:case y.XMP:case y.IFRAME:case y.NOEMBED:case y.NOFRAMES:case y.NOSCRIPT:{this.tokenizer.state=dt.RAWTEXT;break}case y.SCRIPT:{this.tokenizer.state=dt.SCRIPT_DATA;break}case y.PLAINTEXT:{this.tokenizer.state=dt.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ue.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ue.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(J.HTML,ue.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,y.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,a=i[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:l,endCol:c,endOffset:h}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:l,endCol:c,endOffset:h})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(t),s=n.type===Fe.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,s)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===y.SVG&&this.treeAdapter.getTagName(n)===J.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ue.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===y.MGLYPH||t.tagID===y.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ue.HTML)}_processToken(t){switch(t.type){case Fe.CHARACTER:{this.onCharacter(t);break}case Fe.NULL_CHARACTER:{this.onNullCharacter(t);break}case Fe.COMMENT:{this.onComment(t);break}case Fe.DOCTYPE:{this.onDoctype(t);break}case Fe.START_TAG:{this._processStartTag(t);break}case Fe.END_TAG:{this.onEndTag(t);break}case Fe.EOF:{this.onEof(t);break}case Fe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return $S(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===cn.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=z.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(y.P),this.openElements.popUntilTagNamePopped(y.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case y.TR:{this.insertionMode=z.IN_ROW;return}case y.TBODY:case y.THEAD:case y.TFOOT:{this.insertionMode=z.IN_TABLE_BODY;return}case y.CAPTION:{this.insertionMode=z.IN_CAPTION;return}case y.COLGROUP:{this.insertionMode=z.IN_COLUMN_GROUP;return}case y.TABLE:{this.insertionMode=z.IN_TABLE;return}case y.BODY:{this.insertionMode=z.IN_BODY;return}case y.FRAMESET:{this.insertionMode=z.IN_FRAMESET;return}case y.SELECT:{this._resetInsertionModeForSelect(t);return}case y.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case y.HTML:{this.insertionMode=this.headElement?z.AFTER_HEAD:z.BEFORE_HEAD;return}case y.TD:case y.TH:{if(t>0){this.insertionMode=z.IN_CELL;return}break}case y.HEAD:{if(t>0){this.insertionMode=z.IN_HEAD;return}break}}this.insertionMode=z.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===y.TEMPLATE)break;if(r===y.TABLE){this.insertionMode=z.IN_SELECT_IN_TABLE;return}}this.insertionMode=z.IN_SELECT}_isElementCausesFosterParenting(t){return Bp.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case y.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ue.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case y.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return mS[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){T3(this,t);return}switch(this.insertionMode){case z.INITIAL:{Jr(this,t);break}case z.BEFORE_HTML:{fs(this,t);break}case z.BEFORE_HEAD:{ms(this,t);break}case z.IN_HEAD:{ps(this,t);break}case z.IN_HEAD_NO_SCRIPT:{gs(this,t);break}case z.AFTER_HEAD:{xs(this,t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:{Up(this,t);break}case z.TEXT:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{ho(this,t);break}case z.IN_TABLE_TEXT:{Yp(this,t);break}case z.IN_COLUMN_GROUP:{Wi(this,t);break}case z.AFTER_BODY:{Yi(this,t);break}case z.AFTER_AFTER_BODY:{Si(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){w3(this,t);return}switch(this.insertionMode){case z.INITIAL:{Jr(this,t);break}case z.BEFORE_HTML:{fs(this,t);break}case z.BEFORE_HEAD:{ms(this,t);break}case z.IN_HEAD:{ps(this,t);break}case z.IN_HEAD_NO_SCRIPT:{gs(this,t);break}case z.AFTER_HEAD:{xs(this,t);break}case z.TEXT:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{ho(this,t);break}case z.IN_COLUMN_GROUP:{Wi(this,t);break}case z.AFTER_BODY:{Yi(this,t);break}case z.AFTER_AFTER_BODY:{Si(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){ml(this,t);return}switch(this.insertionMode){case z.INITIAL:case z.BEFORE_HTML:case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:case z.IN_BODY:case z.IN_TABLE:case z.IN_CAPTION:case z.IN_COLUMN_GROUP:case z.IN_TABLE_BODY:case z.IN_ROW:case z.IN_CELL:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:case z.IN_TEMPLATE:case z.IN_FRAMESET:case z.AFTER_FRAMESET:{ml(this,t);break}case z.IN_TABLE_TEXT:{es(this,t);break}case z.AFTER_BODY:{tC(this,t);break}case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{nC(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case z.INITIAL:{rC(this,t);break}case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:{this._err(t,te.misplacedDoctype);break}case z.IN_TABLE_TEXT:{es(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,te.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?S3(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{Jr(this,t);break}case z.BEFORE_HTML:{sC(this,t);break}case z.BEFORE_HEAD:{aC(this,t);break}case z.IN_HEAD:{sn(this,t);break}case z.IN_HEAD_NO_SCRIPT:{cC(this,t);break}case z.AFTER_HEAD:{dC(this,t);break}case z.IN_BODY:{Tt(this,t);break}case z.IN_TABLE:{Pr(this,t);break}case z.IN_TABLE_TEXT:{es(this,t);break}case z.IN_CAPTION:{o3(this,t);break}case z.IN_COLUMN_GROUP:{Ac(this,t);break}case z.IN_TABLE_BODY:{Ea(this,t);break}case z.IN_ROW:{ka(this,t);break}case z.IN_CELL:{u3(this,t);break}case z.IN_SELECT:{Xp(this,t);break}case z.IN_SELECT_IN_TABLE:{h3(this,t);break}case z.IN_TEMPLATE:{m3(this,t);break}case z.AFTER_BODY:{g3(this,t);break}case z.IN_FRAMESET:{x3(this,t);break}case z.AFTER_FRAMESET:{y3(this,t);break}case z.AFTER_AFTER_BODY:{E3(this,t);break}case z.AFTER_AFTER_FRAMESET:{k3(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?C3(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{Jr(this,t);break}case z.BEFORE_HTML:{iC(this,t);break}case z.BEFORE_HEAD:{oC(this,t);break}case z.IN_HEAD:{lC(this,t);break}case z.IN_HEAD_NO_SCRIPT:{uC(this,t);break}case z.AFTER_HEAD:{hC(this,t);break}case z.IN_BODY:{va(this,t);break}case z.TEXT:{QC(this,t);break}case z.IN_TABLE:{_s(this,t);break}case z.IN_TABLE_TEXT:{es(this,t);break}case z.IN_CAPTION:{l3(this,t);break}case z.IN_COLUMN_GROUP:{c3(this,t);break}case z.IN_TABLE_BODY:{pl(this,t);break}case z.IN_ROW:{Kp(this,t);break}case z.IN_CELL:{d3(this,t);break}case z.IN_SELECT:{Qp(this,t);break}case z.IN_SELECT_IN_TABLE:{f3(this,t);break}case z.IN_TEMPLATE:{p3(this,t);break}case z.AFTER_BODY:{Jp(this,t);break}case z.IN_FRAMESET:{b3(this,t);break}case z.AFTER_FRAMESET:{v3(this,t);break}case z.AFTER_AFTER_BODY:{Si(this,t);break}}}onEof(t){switch(this.insertionMode){case z.INITIAL:{Jr(this,t);break}case z.BEFORE_HTML:{fs(this,t);break}case z.BEFORE_HEAD:{ms(this,t);break}case z.IN_HEAD:{ps(this,t);break}case z.IN_HEAD_NO_SCRIPT:{gs(this,t);break}case z.AFTER_HEAD:{xs(this,t);break}case z.IN_BODY:case z.IN_TABLE:case z.IN_CAPTION:case z.IN_COLUMN_GROUP:case z.IN_TABLE_BODY:case z.IN_ROW:case z.IN_CELL:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:{qp(this,t);break}case z.TEXT:{ZC(this,t);break}case z.IN_TABLE_TEXT:{es(this,t);break}case z.IN_TEMPLATE:{Zp(this,t);break}case z.AFTER_BODY:case z.IN_FRAMESET:case z.AFTER_FRAMESET:case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{Cc(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===F.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:case z.TEXT:case z.IN_COLUMN_GROUP:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:case z.IN_FRAMESET:case z.AFTER_FRAMESET:{this._insertCharacters(t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:case z.AFTER_BODY:case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{Hp(this,t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{ho(this,t);break}case z.IN_TABLE_TEXT:{Wp(this,t);break}}}}function KS(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):$p(e,t),n}function XS(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function QS(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let s=0,a=i;a!==n;s++,a=i){i=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),l=o&&s>=YS;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=ZS(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function ZS(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function JS(e,t,n){const r=e.treeAdapter.getTagName(t),i=Ur(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===y.TEMPLATE&&s===ue.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function eC(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,i.tagID)}function Sc(e,t){for(let n=0;n<WS;n++){const r=KS(e,t);if(!r)break;const i=XS(e,r);if(!i)break;e.activeFormattingElements.bookmark=r;const s=QS(e,i,r.element),a=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(s),a&&JS(e,a,s),eC(e,i,r)}}function ml(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function tC(e,t){e._appendCommentNode(t,e.openElements.items[0])}function nC(e,t){e._appendCommentNode(t,e.document)}function Cc(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(s);a&&!a.endTag&&e._setEndLocation(s,t)}}}}function rC(e,t){e._setDocumentType(t);const n=t.forceQuirks?Wt.QUIRKS:LS(t);RS(t)||e._err(t,te.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=z.BEFORE_HTML}function Jr(e,t){e._err(t,te.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Wt.QUIRKS),e.insertionMode=z.BEFORE_HTML,e._processToken(t)}function sC(e,t){t.tagID===y.HTML?(e._insertElement(t,ue.HTML),e.insertionMode=z.BEFORE_HEAD):fs(e,t)}function iC(e,t){const n=t.tagID;(n===y.HTML||n===y.HEAD||n===y.BODY||n===y.BR)&&fs(e,t)}function fs(e,t){e._insertFakeRootElement(),e.insertionMode=z.BEFORE_HEAD,e._processToken(t)}function aC(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.HEAD:{e._insertElement(t,ue.HTML),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD;break}default:ms(e,t)}}function oC(e,t){const n=t.tagID;n===y.HEAD||n===y.BODY||n===y.HTML||n===y.BR?ms(e,t):e._err(t,te.endTagWithoutMatchingOpenElement)}function ms(e,t){e._insertFakeElement(J.HEAD,y.HEAD),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD,e._processToken(t)}function sn(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.BASE:case y.BASEFONT:case y.BGSOUND:case y.LINK:case y.META:{e._appendElement(t,ue.HTML),t.ackSelfClosing=!0;break}case y.TITLE:{e._switchToTextParsing(t,dt.RCDATA);break}case y.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,dt.RAWTEXT):(e._insertElement(t,ue.HTML),e.insertionMode=z.IN_HEAD_NO_SCRIPT);break}case y.NOFRAMES:case y.STYLE:{e._switchToTextParsing(t,dt.RAWTEXT);break}case y.SCRIPT:{e._switchToTextParsing(t,dt.SCRIPT_DATA);break}case y.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=z.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(z.IN_TEMPLATE);break}case y.HEAD:{e._err(t,te.misplacedStartTagForHeadElement);break}default:ps(e,t)}}function lC(e,t){switch(t.tagID){case y.HEAD:{e.openElements.pop(),e.insertionMode=z.AFTER_HEAD;break}case y.BODY:case y.BR:case y.HTML:{ps(e,t);break}case y.TEMPLATE:{hr(e,t);break}default:e._err(t,te.endTagWithoutMatchingOpenElement)}}function hr(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==y.TEMPLATE&&e._err(t,te.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,te.endTagWithoutMatchingOpenElement)}function ps(e,t){e.openElements.pop(),e.insertionMode=z.AFTER_HEAD,e._processToken(t)}function cC(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.BASEFONT:case y.BGSOUND:case y.HEAD:case y.LINK:case y.META:case y.NOFRAMES:case y.STYLE:{sn(e,t);break}case y.NOSCRIPT:{e._err(t,te.nestedNoscriptInHead);break}default:gs(e,t)}}function uC(e,t){switch(t.tagID){case y.NOSCRIPT:{e.openElements.pop(),e.insertionMode=z.IN_HEAD;break}case y.BR:{gs(e,t);break}default:e._err(t,te.endTagWithoutMatchingOpenElement)}}function gs(e,t){const n=t.type===Fe.EOF?te.openElementsLeftAfterEof:te.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=z.IN_HEAD,e._processToken(t)}function dC(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.BODY:{e._insertElement(t,ue.HTML),e.framesetOk=!1,e.insertionMode=z.IN_BODY;break}case y.FRAMESET:{e._insertElement(t,ue.HTML),e.insertionMode=z.IN_FRAMESET;break}case y.BASE:case y.BASEFONT:case y.BGSOUND:case y.LINK:case y.META:case y.NOFRAMES:case y.SCRIPT:case y.STYLE:case y.TEMPLATE:case y.TITLE:{e._err(t,te.abandonedHeadElementChild),e.openElements.push(e.headElement,y.HEAD),sn(e,t),e.openElements.remove(e.headElement);break}case y.HEAD:{e._err(t,te.misplacedStartTagForHeadElement);break}default:xs(e,t)}}function hC(e,t){switch(t.tagID){case y.BODY:case y.HTML:case y.BR:{xs(e,t);break}case y.TEMPLATE:{hr(e,t);break}default:e._err(t,te.endTagWithoutMatchingOpenElement)}}function xs(e,t){e._insertFakeElement(J.BODY,y.BODY),e.insertionMode=z.IN_BODY,ya(e,t)}function ya(e,t){switch(t.type){case Fe.CHARACTER:{Up(e,t);break}case Fe.WHITESPACE_CHARACTER:{Hp(e,t);break}case Fe.COMMENT:{ml(e,t);break}case Fe.START_TAG:{Tt(e,t);break}case Fe.END_TAG:{va(e,t);break}case Fe.EOF:{qp(e,t);break}}}function Hp(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function Up(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function fC(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function mC(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function pC(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_FRAMESET)}function gC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML)}function xC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&fl.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ue.HTML)}function bC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function yC(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),n||(e.formElement=e.openElements.current))}function vC(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const i=e.openElements.tagIDs[r];if(n===y.LI&&i===y.LI||(n===y.DD||n===y.DT)&&(i===y.DD||i===y.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==y.ADDRESS&&i!==y.DIV&&i!==y.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML)}function EC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),e.tokenizer.state=dt.PLAINTEXT}function kC(e,t){e.openElements.hasInScope(y.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(y.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.framesetOk=!1}function wC(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(J.A);n&&(Sc(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function TC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function SC(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(y.NOBR)&&(Sc(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ue.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function CC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function AC(e,t){e.treeAdapter.getDocumentMode(e.document)!==Wt.QUIRKS&&e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),e.framesetOk=!1,e.insertionMode=z.IN_TABLE}function zp(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ue.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Vp(e){const t=Mp(e,sr.TYPE);return t!=null&&t.toLowerCase()===qS}function NC(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ue.HTML),Vp(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function _C(e,t){e._appendElement(t,ue.HTML),t.ackSelfClosing=!0}function IC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._appendElement(t,ue.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function MC(e,t){t.tagName=J.IMG,t.tagID=y.IMG,zp(e,t)}function RC(e,t){e._insertElement(t,ue.HTML),e.skipNextNewLine=!0,e.tokenizer.state=dt.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=z.TEXT}function LC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,dt.RAWTEXT)}function PC(e,t){e.framesetOk=!1,e._switchToTextParsing(t,dt.RAWTEXT)}function Hd(e,t){e._switchToTextParsing(t,dt.RAWTEXT)}function DC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===z.IN_TABLE||e.insertionMode===z.IN_CAPTION||e.insertionMode===z.IN_TABLE_BODY||e.insertionMode===z.IN_ROW||e.insertionMode===z.IN_CELL?z.IN_SELECT_IN_TABLE:z.IN_SELECT}function OC(e,t){e.openElements.currentTagId===y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML)}function jC(e,t){e.openElements.hasInScope(y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ue.HTML)}function FC(e,t){e.openElements.hasInScope(y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(y.RTC),e._insertElement(t,ue.HTML)}function BC(e,t){e._reconstructActiveFormattingElements(),jp(t),Tc(t),t.selfClosing?e._appendElement(t,ue.MATHML):e._insertElement(t,ue.MATHML),t.ackSelfClosing=!0}function HC(e,t){e._reconstructActiveFormattingElements(),Fp(t),Tc(t),t.selfClosing?e._appendElement(t,ue.SVG):e._insertElement(t,ue.SVG),t.ackSelfClosing=!0}function Ud(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML)}function Tt(e,t){switch(t.tagID){case y.I:case y.S:case y.B:case y.U:case y.EM:case y.TT:case y.BIG:case y.CODE:case y.FONT:case y.SMALL:case y.STRIKE:case y.STRONG:{TC(e,t);break}case y.A:{wC(e,t);break}case y.H1:case y.H2:case y.H3:case y.H4:case y.H5:case y.H6:{xC(e,t);break}case y.P:case y.DL:case y.OL:case y.UL:case y.DIV:case y.DIR:case y.NAV:case y.MAIN:case y.MENU:case y.ASIDE:case y.CENTER:case y.FIGURE:case y.FOOTER:case y.HEADER:case y.HGROUP:case y.DIALOG:case y.DETAILS:case y.ADDRESS:case y.ARTICLE:case y.SEARCH:case y.SECTION:case y.SUMMARY:case y.FIELDSET:case y.BLOCKQUOTE:case y.FIGCAPTION:{gC(e,t);break}case y.LI:case y.DD:case y.DT:{vC(e,t);break}case y.BR:case y.IMG:case y.WBR:case y.AREA:case y.EMBED:case y.KEYGEN:{zp(e,t);break}case y.HR:{IC(e,t);break}case y.RB:case y.RTC:{jC(e,t);break}case y.RT:case y.RP:{FC(e,t);break}case y.PRE:case y.LISTING:{bC(e,t);break}case y.XMP:{LC(e,t);break}case y.SVG:{HC(e,t);break}case y.HTML:{fC(e,t);break}case y.BASE:case y.LINK:case y.META:case y.STYLE:case y.TITLE:case y.SCRIPT:case y.BGSOUND:case y.BASEFONT:case y.TEMPLATE:{sn(e,t);break}case y.BODY:{mC(e,t);break}case y.FORM:{yC(e,t);break}case y.NOBR:{SC(e,t);break}case y.MATH:{BC(e,t);break}case y.TABLE:{AC(e,t);break}case y.INPUT:{NC(e,t);break}case y.PARAM:case y.TRACK:case y.SOURCE:{_C(e,t);break}case y.IMAGE:{MC(e,t);break}case y.BUTTON:{kC(e,t);break}case y.APPLET:case y.OBJECT:case y.MARQUEE:{CC(e,t);break}case y.IFRAME:{PC(e,t);break}case y.SELECT:{DC(e,t);break}case y.OPTION:case y.OPTGROUP:{OC(e,t);break}case y.NOEMBED:case y.NOFRAMES:{Hd(e,t);break}case y.FRAMESET:{pC(e,t);break}case y.TEXTAREA:{RC(e,t);break}case y.NOSCRIPT:{e.options.scriptingEnabled?Hd(e,t):Ud(e,t);break}case y.PLAINTEXT:{EC(e,t);break}case y.COL:case y.TH:case y.TD:case y.TR:case y.HEAD:case y.FRAME:case y.TBODY:case y.TFOOT:case y.THEAD:case y.CAPTION:case y.COLGROUP:break;default:Ud(e,t)}}function UC(e,t){if(e.openElements.hasInScope(y.BODY)&&(e.insertionMode=z.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function zC(e,t){e.openElements.hasInScope(y.BODY)&&(e.insertionMode=z.AFTER_BODY,Jp(e,t))}function VC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function $C(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(y.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(y.FORM):n&&e.openElements.remove(n))}function qC(e){e.openElements.hasInButtonScope(y.P)||e._insertFakeElement(J.P,y.P),e._closePElement()}function WC(e){e.openElements.hasInListItemScope(y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(y.LI),e.openElements.popUntilTagNamePopped(y.LI))}function YC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function GC(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function KC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function XC(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(J.BR,y.BR),e.openElements.pop(),e.framesetOk=!1}function $p(e,t){const n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const s=e.openElements.items[i],a=e.openElements.tagIDs[i];if(r===a&&(r!==y.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(s,a))break}}function va(e,t){switch(t.tagID){case y.A:case y.B:case y.I:case y.S:case y.U:case y.EM:case y.TT:case y.BIG:case y.CODE:case y.FONT:case y.NOBR:case y.SMALL:case y.STRIKE:case y.STRONG:{Sc(e,t);break}case y.P:{qC(e);break}case y.DL:case y.UL:case y.OL:case y.DIR:case y.DIV:case y.NAV:case y.PRE:case y.MAIN:case y.MENU:case y.ASIDE:case y.BUTTON:case y.CENTER:case y.FIGURE:case y.FOOTER:case y.HEADER:case y.HGROUP:case y.DIALOG:case y.ADDRESS:case y.ARTICLE:case y.DETAILS:case y.SEARCH:case y.SECTION:case y.SUMMARY:case y.LISTING:case y.FIELDSET:case y.BLOCKQUOTE:case y.FIGCAPTION:{VC(e,t);break}case y.LI:{WC(e);break}case y.DD:case y.DT:{YC(e,t);break}case y.H1:case y.H2:case y.H3:case y.H4:case y.H5:case y.H6:{GC(e);break}case y.BR:{XC(e);break}case y.BODY:{UC(e,t);break}case y.HTML:{zC(e,t);break}case y.FORM:{$C(e);break}case y.APPLET:case y.OBJECT:case y.MARQUEE:{KC(e,t);break}case y.TEMPLATE:{hr(e,t);break}default:$p(e,t)}}function qp(e,t){e.tmplInsertionModeStack.length>0?Zp(e,t):Cc(e,t)}function QC(e,t){var n;t.tagID===y.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function ZC(e,t){e._err(t,te.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function ho(e,t){if(e.openElements.currentTagId!==void 0&&Bp.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=z.IN_TABLE_TEXT,t.type){case Fe.CHARACTER:{Yp(e,t);break}case Fe.WHITESPACE_CHARACTER:{Wp(e,t);break}}else zs(e,t)}function JC(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_CAPTION}function e3(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_COLUMN_GROUP}function t3(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.COLGROUP,y.COLGROUP),e.insertionMode=z.IN_COLUMN_GROUP,Ac(e,t)}function n3(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_TABLE_BODY}function r3(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.TBODY,y.TBODY),e.insertionMode=z.IN_TABLE_BODY,Ea(e,t)}function s3(e,t){e.openElements.hasInTableScope(y.TABLE)&&(e.openElements.popUntilTagNamePopped(y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function i3(e,t){Vp(t)?e._appendElement(t,ue.HTML):zs(e,t),t.ackSelfClosing=!0}function a3(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ue.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Pr(e,t){switch(t.tagID){case y.TD:case y.TH:case y.TR:{r3(e,t);break}case y.STYLE:case y.SCRIPT:case y.TEMPLATE:{sn(e,t);break}case y.COL:{t3(e,t);break}case y.FORM:{a3(e,t);break}case y.TABLE:{s3(e,t);break}case y.TBODY:case y.TFOOT:case y.THEAD:{n3(e,t);break}case y.INPUT:{i3(e,t);break}case y.CAPTION:{JC(e,t);break}case y.COLGROUP:{e3(e,t);break}default:zs(e,t)}}function _s(e,t){switch(t.tagID){case y.TABLE:{e.openElements.hasInTableScope(y.TABLE)&&(e.openElements.popUntilTagNamePopped(y.TABLE),e._resetInsertionMode());break}case y.TEMPLATE:{hr(e,t);break}case y.BODY:case y.CAPTION:case y.COL:case y.COLGROUP:case y.HTML:case y.TBODY:case y.TD:case y.TFOOT:case y.TH:case y.THEAD:case y.TR:break;default:zs(e,t)}}function zs(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,ya(e,t),e.fosterParentingEnabled=n}function Wp(e,t){e.pendingCharacterTokens.push(t)}function Yp(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function es(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)zs(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Gp=new Set([y.CAPTION,y.COL,y.COLGROUP,y.TBODY,y.TD,y.TFOOT,y.TH,y.THEAD,y.TR]);function o3(e,t){const n=t.tagID;Gp.has(n)?e.openElements.hasInTableScope(y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=z.IN_TABLE,Pr(e,t)):Tt(e,t)}function l3(e,t){const n=t.tagID;switch(n){case y.CAPTION:case y.TABLE:{e.openElements.hasInTableScope(y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=z.IN_TABLE,n===y.TABLE&&_s(e,t));break}case y.BODY:case y.COL:case y.COLGROUP:case y.HTML:case y.TBODY:case y.TD:case y.TFOOT:case y.TH:case y.THEAD:case y.TR:break;default:va(e,t)}}function Ac(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.COL:{e._appendElement(t,ue.HTML),t.ackSelfClosing=!0;break}case y.TEMPLATE:{sn(e,t);break}default:Wi(e,t)}}function c3(e,t){switch(t.tagID){case y.COLGROUP:{e.openElements.currentTagId===y.COLGROUP&&(e.openElements.pop(),e.insertionMode=z.IN_TABLE);break}case y.TEMPLATE:{hr(e,t);break}case y.COL:break;default:Wi(e,t)}}function Wi(e,t){e.openElements.currentTagId===y.COLGROUP&&(e.openElements.pop(),e.insertionMode=z.IN_TABLE,e._processToken(t))}function Ea(e,t){switch(t.tagID){case y.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_ROW;break}case y.TH:case y.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(J.TR,y.TR),e.insertionMode=z.IN_ROW,ka(e,t);break}case y.CAPTION:case y.COL:case y.COLGROUP:case y.TBODY:case y.TFOOT:case y.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE,Pr(e,t));break}default:Pr(e,t)}}function pl(e,t){const n=t.tagID;switch(t.tagID){case y.TBODY:case y.TFOOT:case y.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE);break}case y.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE,_s(e,t));break}case y.BODY:case y.CAPTION:case y.COL:case y.COLGROUP:case y.HTML:case y.TD:case y.TH:case y.TR:break;default:_s(e,t)}}function ka(e,t){switch(t.tagID){case y.TH:case y.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_CELL,e.activeFormattingElements.insertMarker();break}case y.CAPTION:case y.COL:case y.COLGROUP:case y.TBODY:case y.TFOOT:case y.THEAD:case y.TR:{e.openElements.hasInTableScope(y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE_BODY,Ea(e,t));break}default:Pr(e,t)}}function Kp(e,t){switch(t.tagID){case y.TR:{e.openElements.hasInTableScope(y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE_BODY);break}case y.TABLE:{e.openElements.hasInTableScope(y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE_BODY,pl(e,t));break}case y.TBODY:case y.TFOOT:case y.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(y.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=z.IN_TABLE_BODY,pl(e,t));break}case y.BODY:case y.CAPTION:case y.COL:case y.COLGROUP:case y.HTML:case y.TD:case y.TH:break;default:_s(e,t)}}function u3(e,t){const n=t.tagID;Gp.has(n)?(e.openElements.hasInTableScope(y.TD)||e.openElements.hasInTableScope(y.TH))&&(e._closeTableCell(),ka(e,t)):Tt(e,t)}function d3(e,t){const n=t.tagID;switch(n){case y.TD:case y.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=z.IN_ROW);break}case y.TABLE:case y.TBODY:case y.TFOOT:case y.THEAD:case y.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Kp(e,t));break}case y.BODY:case y.CAPTION:case y.COL:case y.COLGROUP:case y.HTML:break;default:va(e,t)}}function Xp(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.OPTION:{e.openElements.currentTagId===y.OPTION&&e.openElements.pop(),e._insertElement(t,ue.HTML);break}case y.OPTGROUP:{e.openElements.currentTagId===y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===y.OPTGROUP&&e.openElements.pop(),e._insertElement(t,ue.HTML);break}case y.HR:{e.openElements.currentTagId===y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===y.OPTGROUP&&e.openElements.pop(),e._appendElement(t,ue.HTML),t.ackSelfClosing=!0;break}case y.INPUT:case y.KEYGEN:case y.TEXTAREA:case y.SELECT:{e.openElements.hasInSelectScope(y.SELECT)&&(e.openElements.popUntilTagNamePopped(y.SELECT),e._resetInsertionMode(),t.tagID!==y.SELECT&&e._processStartTag(t));break}case y.SCRIPT:case y.TEMPLATE:{sn(e,t);break}}}function Qp(e,t){switch(t.tagID){case y.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===y.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===y.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===y.OPTGROUP&&e.openElements.pop();break}case y.OPTION:{e.openElements.currentTagId===y.OPTION&&e.openElements.pop();break}case y.SELECT:{e.openElements.hasInSelectScope(y.SELECT)&&(e.openElements.popUntilTagNamePopped(y.SELECT),e._resetInsertionMode());break}case y.TEMPLATE:{hr(e,t);break}}}function h3(e,t){const n=t.tagID;n===y.CAPTION||n===y.TABLE||n===y.TBODY||n===y.TFOOT||n===y.THEAD||n===y.TR||n===y.TD||n===y.TH?(e.openElements.popUntilTagNamePopped(y.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Xp(e,t)}function f3(e,t){const n=t.tagID;n===y.CAPTION||n===y.TABLE||n===y.TBODY||n===y.TFOOT||n===y.THEAD||n===y.TR||n===y.TD||n===y.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(y.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Qp(e,t)}function m3(e,t){switch(t.tagID){case y.BASE:case y.BASEFONT:case y.BGSOUND:case y.LINK:case y.META:case y.NOFRAMES:case y.SCRIPT:case y.STYLE:case y.TEMPLATE:case y.TITLE:{sn(e,t);break}case y.CAPTION:case y.COLGROUP:case y.TBODY:case y.TFOOT:case y.THEAD:{e.tmplInsertionModeStack[0]=z.IN_TABLE,e.insertionMode=z.IN_TABLE,Pr(e,t);break}case y.COL:{e.tmplInsertionModeStack[0]=z.IN_COLUMN_GROUP,e.insertionMode=z.IN_COLUMN_GROUP,Ac(e,t);break}case y.TR:{e.tmplInsertionModeStack[0]=z.IN_TABLE_BODY,e.insertionMode=z.IN_TABLE_BODY,Ea(e,t);break}case y.TD:case y.TH:{e.tmplInsertionModeStack[0]=z.IN_ROW,e.insertionMode=z.IN_ROW,ka(e,t);break}default:e.tmplInsertionModeStack[0]=z.IN_BODY,e.insertionMode=z.IN_BODY,Tt(e,t)}}function p3(e,t){t.tagID===y.TEMPLATE&&hr(e,t)}function Zp(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Cc(e,t)}function g3(e,t){t.tagID===y.HTML?Tt(e,t):Yi(e,t)}function Jp(e,t){var n;if(t.tagID===y.HTML){if(e.fragmentContext||(e.insertionMode=z.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===y.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Yi(e,t)}function Yi(e,t){e.insertionMode=z.IN_BODY,ya(e,t)}function x3(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.FRAMESET:{e._insertElement(t,ue.HTML);break}case y.FRAME:{e._appendElement(t,ue.HTML),t.ackSelfClosing=!0;break}case y.NOFRAMES:{sn(e,t);break}}}function b3(e,t){t.tagID===y.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==y.FRAMESET&&(e.insertionMode=z.AFTER_FRAMESET))}function y3(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.NOFRAMES:{sn(e,t);break}}}function v3(e,t){t.tagID===y.HTML&&(e.insertionMode=z.AFTER_AFTER_FRAMESET)}function E3(e,t){t.tagID===y.HTML?Tt(e,t):Si(e,t)}function Si(e,t){e.insertionMode=z.IN_BODY,ya(e,t)}function k3(e,t){switch(t.tagID){case y.HTML:{Tt(e,t);break}case y.NOFRAMES:{sn(e,t);break}}}function w3(e,t){t.chars=st,e._insertCharacters(t)}function T3(e,t){e._insertCharacters(t),e.framesetOk=!1}function e0(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ue.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function S3(e,t){if(HS(t))e0(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ue.MATHML?jp(t):r===ue.SVG&&(US(t),Fp(t)),Tc(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function C3(e,t){if(t.tagID===y.P||t.tagID===y.BR){e0(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ue.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}J.AREA,J.BASE,J.BASEFONT,J.BGSOUND,J.BR,J.COL,J.EMBED,J.FRAME,J.HR,J.IMG,J.INPUT,J.KEYGEN,J.LINK,J.META,J.PARAM,J.SOURCE,J.TRACK,J.WBR;const A3=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,N3=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),zd={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function t0(e,t){const n=F3(e),r=rp("type",{handlers:{root:_3,element:I3,text:M3,comment:r0,doctype:R3,raw:P3},unknown:D3}),i={parser:n?new Bd(zd):Bd.getFragmentParser(void 0,zd),handle(o){r(o,i)},stitches:!1,options:t||{}};r(e,i),zr(i,pn());const s=n?i.parser.document:i.parser.getFragment(),a=BT(s,{file:i.options.file});return i.stitches&&ba(a,"comment",function(o,l,c){const h=o;if(h.value.stitch&&c&&l!==void 0){const f=c.children;return f[l]=h.value.stitch,l}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function n0(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function _3(e,t){n0(e.children,t)}function I3(e,t){O3(e,t),n0(e.children,t),j3(e,t)}function M3(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:Fe.CHARACTER,chars:e.value,location:Vs(e)};zr(t,pn(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function R3(e,t){const n={type:Fe.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Vs(e)};zr(t,pn(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function L3(e,t){t.stitches=!0;const n=B3(e);if("children"in e&&"children"in n){const r=t0({type:"root",children:e.children},t.options);n.children=r.children}r0({type:"comment",value:{stitch:n}},t)}function r0(e,t){const n=e.value,r={type:Fe.COMMENT,data:n,location:Vs(e)};zr(t,pn(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function P3(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,s0(t,pn(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(A3,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function D3(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))L3(n,t);else{let r="";throw N3.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function zr(e,t){s0(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=dt.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function s0(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function O3(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===dt.PLAINTEXT)return;zr(t,pn(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:Qn.html;i===Qn.html&&n==="svg"&&(i=Qn.svg);const s=$T({...e,children:[]},{space:i===Qn.svg?"svg":"html"}),a={type:Fe.START_TAG,tagName:n,tagID:Ur(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:Vs(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function j3(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&ZT.includes(n)||t.parser.tokenizer.state===dt.PLAINTEXT)return;zr(t,ha(e));const r={type:Fe.END_TAG,tagName:n,tagID:Ur(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Vs(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===dt.RCDATA||t.parser.tokenizer.state===dt.RAWTEXT||t.parser.tokenizer.state===dt.SCRIPT_DATA)&&(t.parser.tokenizer.state=dt.DATA)}function F3(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Vs(e){const t=pn(e)||{line:void 0,column:void 0,offset:void 0},n=ha(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function B3(e){return"children"in e?ur({...e,children:[]}):ur(e)}function i0(e){return function(t,n){return t0(t,{...e,file:n})}}const qn=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],bs={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...qn,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...qn],h2:[["className","sr-only"]],img:[...qn,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...qn,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...qn],table:[...qn],ul:[...qn,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},An={}.hasOwnProperty;function H3(e,t){let n={type:"root",children:[]};const r={schema:t?{...bs,...t}:bs,stack:[]},i=a0(r,e);return i&&(Array.isArray(i)?i.length===1?n=i[0]:n.children=i:n=i),n}function a0(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return U3(e,n);case"doctype":return z3(e,n);case"element":return V3(e,n);case"root":return $3(e,n);case"text":return q3(e,n)}}}function U3(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),s={type:"comment",value:r<0?n:n.slice(0,r)};return $s(s,t),s}}function z3(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return $s(n,t),n}}function V3(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=o0(e,t.children),i=W3(e,t.properties);e.stack.pop();let s=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(s=!0,e.schema.ancestors&&An.call(e.schema.ancestors,n))){const o=e.schema.ancestors[n];let l=-1;for(s=!1;++l<o.length;)e.stack.includes(o[l])&&(s=!0)}if(!s)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const a={type:"element",tagName:n,properties:i,children:r};return $s(a,t),a}function $3(e,t){const r={type:"root",children:o0(e,t.children)};return $s(r,t),r}function q3(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return $s(r,t),r}function o0(e,t){const n=[];if(Array.isArray(t)){const r=t;let i=-1;for(;++i<r.length;){const s=a0(e,r[i]);s&&(Array.isArray(s)?n.push(...s):n.push(s))}}return n}function W3(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,s=r&&An.call(r,n)?r[n]:void 0,a=r&&An.call(r,"*")?r["*"]:void 0,o=t&&typeof t=="object"?t:{},l={};let c;for(c in o)if(An.call(o,c)){const h=o[c];let f=Vd(e,$d(s,c),c,h);f==null&&(f=Vd(e,$d(a,c),c,h)),f!=null&&(l[c]=f)}if(i&&An.call(i,n)){const h=i[n];for(c in h)An.call(h,c)&&!An.call(l,c)&&(l[c]=h[c])}return l}function Vd(e,t,n,r){return t?Array.isArray(r)?Y3(e,t,n,r):l0(e,t,n,r):void 0}function Y3(e,t,n,r){let i=-1;const s=[];for(;++i<r.length;){const a=l0(e,t,n,r[i]);(typeof a=="number"||typeof a=="string")&&s.push(a)}return s}function l0(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&G3(e,n,r)){if(typeof t=="object"&&t.length>1){let i=!1,s=0;for(;++s<t.length;){const a=t[s];if(a&&typeof a=="object"&&"flags"in a){if(a.test(String(r))){i=!0;break}}else if(a===r){i=!0;break}}if(!i)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function G3(e,t,n){const r=e.schema.protocols&&An.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;const i=String(n),s=i.indexOf(":"),a=i.indexOf("?"),o=i.indexOf("#"),l=i.indexOf("/");if(s<0||l>-1&&s>l||a>-1&&s>a||o>-1&&s>o)return!0;let c=-1;for(;++c<r.length;){const h=r[c];if(s===h.length&&i.slice(0,h.length)===h)return!0}return!1}function $s(e,t){const n=Tm(t);t.data&&(e.data=ur(t.data)),n&&(e.position=n)}function $d(e,t){let n,r=-1;if(e)for(;++r<e.length;){const i=e[r],s=typeof i=="string"?i:i[0];if(s===t)return i;s==="data*"&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function c0(e){return function(t){return H3(t,e)}}var Bf;const u0={...bs,protocols:{...bs.protocols,src:[...((Bf=bs.protocols)==null?void 0:Bf.src)??["http","https","mailto"],"data"]}};function K3({retry:e}){const t=_e();return u.jsxs("div",{className:"text-body text-warning p-4 flex items-start gap-2",children:[u.jsx(En,{className:"w-4 h-4 shrink-0 mt-0.5"}),u.jsxs("span",{children:[t("error.renderFailed")," ",u.jsx("button",{className:"underline ml-1",onClick:e,children:t("error.retry")})]})]})}class X3 extends v.Component{constructor(){super(...arguments);La(this,"state",{error:null});La(this,"retry",()=>this.setState({error:null}))}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary caught]",n,r.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error,this.retry):u.jsx(K3,{error:this.state.error,retry:this.retry}):this.props.children}}function Q3({nodeId:e,onRated:t}){const n=_e(),[r,i]=v.useState(!1),[s,a]=v.useState(!1),o=async l=>{if(!(r||s)){i(!0);try{await X.recordReview(e,l),a(!0),t==null||t(),er(l>=4?"correct":"wrong")}catch{}finally{i(!1)}}};return s?u.jsx("div",{className:"text-center text-body text-brand py-2","data-testid":"self-rated",children:n("review.selfrated")}):u.jsxs("div",{className:"border-t border-[var(--border-faint)] pt-3 mt-3","data-testid":"self-rating",children:[u.jsx("div",{className:"text-caption font-bold text-ink-muted uppercase tracking-wider mb-2 text-center",children:n("review.selfrate.title")}),u.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[u.jsxs("button",{onClick:()=>o(1),disabled:r,"data-testid":"rate-again",className:"py-2 rounded-lg border border-warning/40 text-warning hover:bg-warning/10 transition-colors disabled:opacity-40 flex flex-col items-center gap-0.5",children:[u.jsx("span",{className:"text-body font-bold",children:n("review.selfrate.again")}),u.jsx("span",{className:"text-caption opacity-70",children:n("review.selfrate.again.hint")})]}),u.jsxs("button",{onClick:()=>o(4),disabled:r,"data-testid":"rate-remembered",className:"py-2 rounded-lg border border-accent/40 text-accent hover:bg-accent/10 transition-colors disabled:opacity-40 flex flex-col items-center gap-0.5",children:[u.jsx("span",{className:"text-body font-bold",children:n("review.selfrate.remembered")}),u.jsx("span",{className:"text-caption opacity-70",children:n("review.selfrate.remembered.hint")})]}),u.jsxs("button",{onClick:()=>o(5),disabled:r,"data-testid":"rate-mastered",className:"py-2 rounded-lg border border-brand/40 text-brand hover:bg-brand/10 transition-colors disabled:opacity-40 flex flex-col items-center gap-0.5",children:[u.jsx("span",{className:"text-body font-bold",children:n("review.selfrate.mastered")}),u.jsx("span",{className:"text-caption opacity-70",children:n("review.selfrate.mastered.hint")})]})]})]})}function Is(e,t,n){const r=[];let i="";const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(o){const l=o.parentElement;if(!l)return NodeFilter.FILTER_REJECT;const c=l.tagName;return c==="SCRIPT"||c==="STYLE"||!(n!=null&&n.includeMarks)&&l.closest("mark.lookatstudy-underline")||t&&!l.closest(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let a;for(;a=s.nextNode();){const o=a,l=o.textContent??"",c=i.length;i+=l,r.push({node:o,start:c,end:i.length})}return{text:i,nodes:r}}function d0(e,t){const n=qd(e.startContainer,e.startOffset,t,"start"),r=qd(e.endContainer,e.endOffset,t,"end");return n==null||r==null||r<=n?null:{start:n,end:r}}function qd(e,t,n,r){var i,s,a;if(e.nodeType===Node.TEXT_NODE){for(const o of n.nodes)if(o.node===e)return o.start+Math.min(t,((i=o.node.textContent)==null?void 0:i.length)??0);return r==="start"?((s=n.nodes[0])==null?void 0:s.start)??null:((a=n.nodes[n.nodes.length-1])==null?void 0:a.end)??null}if(e instanceof Element){const o=Array.from(e.childNodes);if(r==="end"){for(let c=t;c<o.length;c++){const h=h0(o[c],n);if(h!=null)return h}const l=n.nodes[n.nodes.length-1];return l?l.end:null}else{for(let c=t;c>=0;c--){const h=f0(o[c],n);if(h!=null)return h}const l=n.nodes[0];return l?l.start:null}}return null}function h0(e,t){if(e.nodeType===Node.TEXT_NODE){for(const n of t.nodes)if(n.node===e)return n.start;return null}if(e instanceof Element)for(const n of e.childNodes){const r=h0(n,t);if(r!=null)return r}return null}function f0(e,t){if(e.nodeType===Node.TEXT_NODE){for(const n of t.nodes)if(n.node===e)return n.end;return null}if(e instanceof Element){let n=null;for(const r of e.childNodes){const i=f0(r,t);i!=null&&(n=i)}return n}return null}function m0(e,t,n){var o,l,c,h;if(n<=t)return null;let r=null,i=0,s=null,a=0;for(const f of e.nodes)if(!r&&t>=f.start&&t<f.end&&(r=f.node,i=t-f.start),!s&&n>f.start&&n<=f.end&&(s=f.node,a=n-f.start),r&&s)break;if(!r&&e.nodes.length>0){const f=e.nodes[e.nodes.length-1];r=f.node,i=((o=f.node.textContent)==null?void 0:o.length)??0}if(!s&&e.nodes.length>0){const f=e.nodes[e.nodes.length-1];s=f.node,a=((l=f.node.textContent)==null?void 0:l.length)??0}if(!r||!s)return null;try{const f=document.createRange();return f.setStart(r,Math.min(i,((c=r.textContent)==null?void 0:c.length)??0)),f.setEnd(s,Math.min(a,((h=s.textContent)==null?void 0:h.length)??0)),f}catch{return null}}function p0(e,t){e.querySelectorAll("mark.lookatstudy-underline").forEach(s=>{const a=s.parentNode;if(a){for(;s.firstChild;)a.insertBefore(s.firstChild,s);a.removeChild(s)}}),e.normalize();const n=new Map;if(t.length===0)return n;const r=Is(e),i=[];for(const s of t){const a=Z3(r.text,s.text,s.surrounding);a>=0&&i.push({noteId:s.noteId,start:a,end:a+s.text.length})}i.sort((s,a)=>a.start-s.start);for(const s of i){const a=m0(r,s.start,s.end);if(!a)continue;const o=J3(a,s.noteId);o&&n.set(s.noteId,o)}return n}function Z3(e,t,n){if(!t)return-1;let r=e.indexOf(t);if(r<0){const i=t.replace(/\s+/g," ").trim();if(r=e.replace(/\s+/g," ").indexOf(i),r<0)return-1;const a=t.slice(0,Math.min(15,t.length));return e.indexOf(a)}if(n&&n.length>5){const i=e.indexOf(n.slice(0,20));if(i>=0){let s=r,a=Math.abs(r-i),o=r+1;for(;;){const l=e.indexOf(t,o);if(l<0)break;const c=Math.abs(l-i);c<a&&(s=l,a=c),o=l+1}return s}}return r}function J3(e,t){const n="color: inherit; background: transparent; border-bottom: 2px solid rgb(34, 197, 94); padding-bottom: 1px;",r=document.createElement("mark");return r.className="lookatstudy-underline",r.dataset.noteId=t,r.style.cssText=n,g0(e,r)}function g0(e,t){var n;if(e.startContainer===e.endContainer&&e.startContainer.nodeType===Node.TEXT_NODE)try{return e.surroundContents(t),t}catch{}try{const r=[],i=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode(o){return e.intersectsNode(o)&&(o===e.startContainer||o===e.endContainer||e.intersectsNode(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let s;for(;s=i.nextNode();)r.push(s);if(r.length===0)return null;let a=null;for(const o of r){let l=o;if(o===e.startContainer&&e.startOffset>0&&(l=o.splitText(e.startOffset)),o===e.endContainer||l===e.endContainer){const h=l===e.endContainer?e.endOffset:e.endOffset-(o===e.startContainer?e.startOffset:0);h<l.textContent.length&&l.splitText(h)}if(!l.textContent)continue;const c=a?t.cloneNode(!1):t;(n=l.parentNode)==null||n.insertBefore(c,l),c.appendChild(l),a||(a=c)}return a}catch{return null}}const x0="cp-reading-mark",b0="cp-reading";function ir(e){var n;const t=CSS;try{(n=t.highlights)==null||n.delete(b0)}catch{}Nc=null,e.querySelectorAll(`.${x0}`).forEach(r=>{const i=r.parentNode;if(i){for(;r.firstChild;)i.insertBefore(r.firstChild,r);i.removeChild(r)}}),e.normalize()}const eA=/[0-9A-Za-z\u00C0-\u024F\u0370-\u03FF\u0400-\u04FF\u4E00-\u9FFF\u3040-\u30FF\uAC00-\uD7AF]/,tA=`「『(([【<《"'“‘`,nA=`。』」))]】>》"'”’!!??…,,、;;::`;function y0(e){const t=e.codePointAt(0);let n=e;return t>=65281&&t<=65374&&(n=String.fromCharCode(t-65248)),eA.test(n)?n.toLowerCase():null}function rA(e){let t="";const n=[];for(let r=0;r<e.length;r++){const i=y0(e[r]);i!==null&&(t+=i,n.push(r))}return{canon:t,map:n}}function sA(e,t){if(t<=0)return 0;let n=0,r=e.length;for(;n<r;){const i=n+r>>1;e[i]<t?n=i+1:r=i}return n}function Wd(e,t,n){const{canon:r,map:i}=rA(e),s=t.trim().split(/\s+/).map(p=>[...p].map(y0).filter(Boolean).join("")).filter(p=>p.length>0);if(s.length===0||r.length===0){const p=t.trim();if(!p)return null;const g=e.indexOf(p,Math.max(0,n));return g>=0?{start:g,end:g+p.length}:null}const a=sA(i,Math.max(0,n)),o=s.join("");let l=-1,c=-1;const h=r.indexOf(o,a);if(h>=0)l=h,c=h+o.length-1;else{let p=a;for(const g of s){const x=r.indexOf(g,p);if(x<0)return null;l<0&&(l=x),c=x+g.length-1,p=c+1}if(l<0||c-l+1>o.length*3+40)return null}if(c>=i.length||l<0)return null;let f=i[l],m=i[c]+1;const d=n>0?n:0;for(let p=0;p<3&&f-1>=d&&tA.includes(e[f-1]);p++)f--;for(let p=0;p<4&&m<e.length&&nA.includes(e[m]);p++)m++;return{start:f,end:m}}const gl=new WeakMap;function v0(e){gl.delete(e)}function E0(e,t,n){ir(e);const r=t.trim();if(!r)return null;const i=Is(e,n==null?void 0:n.within,{includeMarks:!0}),s=gl.get(e)??0;let a=Wd(i.text,r,s);if(!a&&s>0&&(a=Wd(i.text,r,0)),!a)return null;gl.set(e,a.end);const o=m0(i,a.start,a.end);if(!o)return null;const l=CSS;if(typeof Highlight<"u"&&l.highlights)try{return l.highlights.set(b0,new Highlight(o)),Nc=o,o}catch{}const c=document.createElement("span");return c.className=x0,g0(o,c)?o:null}let Nc=null;function iA(){return Nc}let Ci=null,xl=null;function aA(e){Ci=e,xl=(e==null?void 0:e.textContent)??null}function oA(){if(lA(Ci))return Ci;if(xl){for(const e of document.querySelectorAll("mark.lookatstudy-underline"))if(e.textContent===xl)return Ci=e,e}return null}function lA(e){return!!e&&e.isConnected}function k0(e){e.scrollIntoView({behavior:"smooth",block:"center"}),e.style.transition="background 0.3s, border-bottom-color 0.3s, border-bottom-width 0.3s",e.style.background="rgba(250, 204, 21, 0.35)",e.style.borderBottom="4px solid rgb(34, 197, 94)",setTimeout(()=>{e.style.color="inherit",e.style.background="transparent",e.style.borderBottom="2px solid rgb(34, 197, 94)"},1500)}const Ai=new Set(["。","!","?","!","?",";",";","…"]),cA=new Set([",",",","、",":",":"," "," "]),uA=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}]/u;function Yd(e){return e!=null&&uA.test(String.fromCodePoint(e))}const dA=/(?:[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}](?:\uFE0F|\u200D[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}]|[\u{1F3FB}-\u{1F3FF}])*)$/u,bl=new Set(["”",'"',"」","』","》",")","】","])".slice(0,1)]);function hA(e){let t=e;return t=t.replace(/\r\n?/g,`
|
|
507
|
+
`),t=t.replace(/(?:^|\n)[ \t]*(?:```|~~~)[^\n]*\n[\s\S]*?(?:\n[ \t]*(?:```|~~~)[^\n]*|\n?$)/g,`
|
|
508
|
+
`),t=t.replace(/`[^`\n]*`/g,""),t=t.replace(/!\[[^\]]*\]\([^)\n]*\)/g,""),t=t.replace(/\[([^\]]+)\]\([^)\n]*\)/g,"$1"),t=t.replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,""),t=t.replace(/^[ \t]*(?:[-*+]|\d+\.)[ \t]+/gm,""),t=t.replace(/^[ \t]*>[ \t]?/gm,""),t=t.replace(/\|/g," "),t=t.replace(/^[ \t]*[-: ]{3,}[ \t]*$/gm,""),t=t.replace(/(\*\*|__)(.*?)\1/g,"$2"),t=t.replace(new RegExp("(?<![*\\w])(\\*|_)(?!\\s)(.+?)(?<!\\s)\\1(?![*\\w])","g"),"$2"),t=t.replace(/~~(.+?)~~/g,"$1"),t=t.replace(/\n{3,}/g,`
|
|
509
|
+
|
|
510
|
+
`),t.trim()}function fA(e){return mA(hA(e),{flush:!0}).sentences}function w0(e,t){if(t<0||t>=e.length)return"";let n=t;for(;n>0&&!pA(e[n-1]??"");)n--;const r=[];for(let i=n;i<=t;i++){const s=e[i];s&&s.trim()&&r.push(s)}return r.join(" ")}function mA(e,t={}){const n=Math.max(8,t.maxBuffer??120),r=t.flush??!1,i=[],s=e.length;let a=0,o=0,l=-1;const c=f=>{const m=e.slice(a,f).trim();m&&i.push(m),a=f,l=-1};for(;o<s;){const f=e[o],m=e.codePointAt(o);if(Yd(m)){let d=o+(m>65535?2:1);for(;d<s;){const p=e.codePointAt(d),g=p>65535?2:1;if(p===65039||p===8205||p>=127995&&p<=127999||Yd(p)){d+=g;continue}break}c(d),o=d;continue}if(f===`
|
|
511
|
+
`){const d=e.slice(a,o+1).replace(/[^\S\n]+$/,"");d.trim()&&i.push(d),a=o+1,l=-1,o++;continue}if(Ai.has(f)){let d=o+1;for(;d<s&&(Ai.has(e[d])||bl.has(e[d]));)d++;c(d),o=d;continue}if(f==="."){const d=o>0?e[o-1]:"",p=o+1<s?e[o+1]:"";if((p===""||/\s/.test(p))&&!/\d/.test(d)){let g=o+1;for(;g<s&&(bl.has(e[g])||Ai.has(e[g]));)g++;c(g),o=g;continue}}if(cA.has(f)&&(l=o),o-a+1>n)if(l>a){const d=l;c(d),a=d+1}else{c(o+1),o++;continue}o++}const h=e.slice(a).trim();return r&&h&&i.push(h),{sentences:i,rest:r?"":h}}function pA(e){if(/\n\s*$/.test(e))return!0;const t=e.trimEnd();if(!t)return!0;let n=t.length-1;for(;n>=0&&bl.has(t[n]);)n--;if(n<0)return!0;const r=t[n];return Ai.has(r)||r==="."||r===`
|
|
512
|
+
`?!0:dA.test(t)}function T0(e,t,n){const i=e.top+e.height/2;return e.right+8+n<=t?{left:e.right+8,top:i,transform:"translate(0, -50%)"}:e.left-8-n>=0?{left:e.left-8,top:i,transform:"translate(-100%, -50%)"}:{left:e.left,top:e.bottom+8,transform:"translate(0, 0)"}}function wa({title:e,onClose:t,children:n}){const r=_e(),i=v.useRef(null);return jr(i,!0),v.useEffect(()=>{const s=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t]),sc.createPortal(u.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/80","data-testid":"diagram-viewer-modal","data-noswipe":"",role:"dialog","aria-modal":"true","aria-label":e,children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2.5 shrink-0",onClick:s=>s.stopPropagation(),children:[u.jsx("h3",{className:"text-body font-bold text-white truncate",children:e}),u.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[u.jsx("span",{className:"text-caption text-white/50 hidden sm:inline",children:r("artifact.viewer.hint")}),u.jsx("button",{onClick:t,"data-testid":"diagram-viewer-close","aria-label":r("action.close"),"data-tooltip":r("action.close"),className:"text-white/70 hover:text-white w-9 h-9 flex items-center justify-center rounded-lg hover:bg-white/10 transition-colors",children:u.jsx(Kt,{className:"w-5 h-5"})})]})]}),u.jsx("div",{className:"flex-1 min-h-0 px-2 pb-2",onClick:t,children:u.jsx("div",{ref:i,className:"h-full w-full",onClick:s=>s.stopPropagation(),children:n})})]}),document.body)}function gA(e,t,n,r,i=24){if(e<=0||t<=0||n<=0||r<=0)return 1;const s=Math.min((n-i*2)/e,(r-i*2)/t,1);return Math.max(.02,s)}function xA(e,t,n,r,i=24){const s=gA(e,t,n,r,i);return{scale:s,x:(n-e*s)/2,y:(r-t*s)/2}}function bA(e,t,n,r){return{scale:e.scale*t,x:n-(n-e.x)*t,y:r-(r-e.y)*t}}function as(e,t,n,r,i,s=64){const a=t*e.scale,o=n*e.scale;let{x:l,y:c}=e;return a<=r?l=(r-a)/2:l=Math.min(Math.max(l,r-a-s),s),o<=i?c=(i-o)/2:c=Math.min(Math.max(c,i-o-s),s),{x:l,y:c,scale:e.scale}}function yA(e,t,n,r,i){const s=e.scale*t,a=Math.min(Math.max(s,i.min),i.max)/e.scale;return a===1?e:as(bA(e,a,n,r),i.contentW,i.contentH,i.viewW,i.viewH)}const Gd=.05,Kd=4,ci=1.25;function qs({children:e,grid:t=!0,testid:n}){const r=_e(),i=v.useRef(null),s=v.useRef(null),[a,o]=v.useState({x:0,y:0,scale:1}),[l,c]=v.useState(null),[h,f]=v.useState(!1),m=v.useRef("mouse"),d=v.useRef(!0),p=v.useRef({pointers:new Map,pinchBase:null,lastMid:null,panning:!1,moved:!1}),g=v.useRef(null),x=v.useCallback(()=>{const w=i.current,N=s.current;return{min:Gd,max:Kd,contentW:(N==null?void 0:N.offsetWidth)??0,contentH:(N==null?void 0:N.offsetHeight)??0,viewW:(w==null?void 0:w.clientWidth)??0,viewH:(w==null?void 0:w.clientHeight)??0}},[]),b=v.useCallback(()=>{const w=x();!w.contentW||!w.viewW||(o(xA(w.contentW,w.contentH,w.viewW,w.viewH)),d.current=!0)},[x]);v.useEffect(()=>{const w=i.current,N=s.current;if(!w||!N)return;const S=()=>{c({w:N.offsetWidth,h:N.offsetHeight}),b()};S();const R=new ResizeObserver(S);return R.observe(N),R.observe(w),()=>R.disconnect()},[b]);const k=v.useCallback((w,N,S)=>{const R=x(),M=N??R.viewW/2,O=S??R.viewH/2;o(L=>yA(L,w,M,O,R)),d.current=!1},[x]),T=v.useCallback(w=>{var R,M;if((M=(R=w.target).closest)!=null&&M.call(R,"[data-testid=canvas-zoom-controls]"))return;const N=w.currentTarget;try{N.setPointerCapture(w.pointerId)}catch{}const S=p.current;if(m.current=w.pointerType,S.pointers.size===0&&f(!0),S.pointers.set(w.pointerId,{x:w.clientX,y:w.clientY}),S.pointers.size===2){const[O,L]=[...S.pointers.values()];S.pinchBase={dist:Math.hypot(O.x-L.x,O.y-L.y),factorAcc:1},S.lastMid={x:(O.x+L.x)/2,y:(O.y+L.y)/2},S.panning=!1}else S.pointers.size===1&&(S.panning=!0,S.moved=!1,S.lastMid={x:w.clientX,y:w.clientY})},[]),A=v.useCallback(w=>{const N=p.current;if(!N.pointers.has(w.pointerId))return;N.pointers.set(w.pointerId,{x:w.clientX,y:w.clientY});const S=i.current;if(!S)return;const R=S.getBoundingClientRect();if(N.pointers.size>=2&&N.pinchBase){const[M,O]=[...N.pointers.values()],L=Math.hypot(M.x-O.x,M.y-O.y),I={x:(M.x+O.x)/2,y:(M.y+O.y)/2};if(N.pinchBase.dist>0){const j=L/N.pinchBase.dist/N.pinchBase.factorAcc;N.pinchBase.factorAcc*=j,k(j,I.x-R.left,I.y-R.top)}if(N.lastMid){const j=I.x-N.lastMid.x,U=I.y-N.lastMid.y,B=x();o(W=>as({...W,x:W.x+j,y:W.y+U},B.contentW,B.contentH,B.viewW,B.viewH))}N.lastMid=I;return}if(N.panning&&N.lastMid){const M=w.clientX-N.lastMid.x,O=w.clientY-N.lastMid.y;Math.abs(M)+Math.abs(O)>2&&(N.moved=!0);const L=x();o(I=>as({...I,x:I.x+M,y:I.y+O},L.contentW,L.contentH,L.viewW,L.viewH)),N.lastMid={x:w.clientX,y:w.clientY}}},[x,k]),E=v.useCallback(w=>{const N=p.current,S=N.pointers.size===1;if(N.pointers.delete(w.pointerId),N.pointers.size<2&&(N.pinchBase=null),N.pointers.size===0){if(N.panning=!1,N.lastMid=null,f(!1),S&&!N.moved&&w.pointerType!=="mouse"){const R=performance.now(),M=g.current;if(M&&R-M.t<320&&Math.hypot(w.clientX-M.x,w.clientY-M.y)<32){const O=x();d.current?(o(as({x:(O.viewW-O.contentW)/2,y:Math.max(24,(O.viewH-O.contentH)/2),scale:1},O.contentW,O.contentH,O.viewW,O.viewH)),d.current=!1):b(),g.current=null}else g.current={t:R,x:w.clientX,y:w.clientY}}}else if(N.pointers.size===1){const R=[...N.pointers.values()][0];N.lastMid={x:R.x,y:R.y},N.panning=!0}},[x,b]),C=v.useCallback(w=>{var S;w.preventDefault();const N=(S=i.current)==null?void 0:S.getBoundingClientRect();N&&k(w.deltaY<0?ci:1/ci,w.clientX-N.left,w.clientY-N.top)},[k]),_=v.useCallback(()=>{if(m.current!=="mouse")return;const w=x();d.current?(o(as({x:(w.viewW-w.contentW)/2,y:Math.max(24,(w.viewH-w.contentH)/2),scale:1},w.contentW,w.contentH,w.viewW,w.viewH)),d.current=!1):b()},[x,b]);return u.jsxs("div",{ref:i,"data-testid":n,"data-noswipe":"",className:`relative h-full w-full overflow-hidden select-none touch-none ${t?"canvas-grid":""}`,style:{touchAction:"none"},onPointerDown:T,onPointerMove:A,onPointerUp:E,onPointerCancel:E,onWheel:C,onDoubleClick:_,children:[u.jsx("div",{ref:s,className:`absolute top-0 left-0 canvas-stage-gesture ${h?"":"motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-out"}`,style:{transform:`translate(${a.x}px, ${a.y}px) scale(${a.scale})`,transformOrigin:"0 0"},children:e}),u.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-0.5 p-1 rounded-xl bg-surface-0/90 backdrop-blur border border-[var(--border)] shadow-elevated","data-testid":"canvas-zoom-controls",children:[u.jsx("button",{onClick:()=>k(1/ci),disabled:a.scale<=Gd+1e-6,"aria-label":r("artifact.zoomOut"),"data-tooltip":r("artifact.zoomOut"),"data-testid":"canvas-zoom-out",className:"w-8 h-8 rounded-lg flex items-center justify-center text-ink-muted hover:bg-ink/5 hover:text-ink-strong disabled:opacity-30 disabled:pointer-events-none transition-colors",children:u.jsx(_1,{className:"w-4 h-4"})}),u.jsxs("span",{className:"text-label font-bold tabular-nums text-ink-muted min-w-[3.25rem] text-center select-none","data-testid":"canvas-zoom-pct",children:[Math.round(a.scale*100),"%"]}),u.jsx("button",{onClick:()=>k(ci),disabled:a.scale>=Kd-1e-6,"aria-label":r("artifact.zoomIn"),"data-tooltip":r("artifact.zoomIn"),"data-testid":"canvas-zoom-in",className:"w-8 h-8 rounded-lg flex items-center justify-center text-ink-muted hover:bg-ink/5 hover:text-ink-strong disabled:opacity-30 disabled:pointer-events-none transition-colors",children:u.jsx(aa,{className:"w-4 h-4"})}),u.jsx("button",{onClick:b,"aria-label":r("artifact.canvas.fit"),"data-tooltip":r("artifact.canvas.fit"),"data-testid":"canvas-zoom-fit",className:"w-8 h-8 rounded-lg flex items-center justify-center text-ink-muted hover:bg-ink/5 hover:text-ink-strong transition-colors",children:u.jsx(Os,{className:"w-4 h-4"})})]}),u.jsx("span",{"data-testid":"canvas-natural-size",className:"hidden",children:l?`${l.w}x${l.h}`:""})]})}function Zt(e,t=13){let n=0;for(const r of e)n+=/[\u2e80-\u9fff\uf900-\ufaff\uff00-\uffef\u3000-\u303f]/.test(r)?t:t*.58;return n}const br=118;function vA(e){if(Zt(e)<=br)return[e];const t=[];for(let l=0;l<e.length;l++)/[\s/\-—·]/.test(e[l]??"")&&t.push(l);const n=e.length/2;let r=-1,i=1/0;for(const l of t){const c=Math.abs(l+1-n);c<i&&(i=c,r=l)}let s,a;if(r>=0)s=e.slice(0,r+1).trim(),a=e.slice(r+1).trim();else{let l=0,c=0;for(const h of e)if(l+=Zt(h),c++,l>=Zt(e)/2)break;s=e.slice(0,c),a=e.slice(c)}if(Zt(s)<=br&&Zt(a)<=br)return[s,a];const o=l=>{let c="";for(const h of l){if(Zt(c+h+"…")>br)break;c+=h}return c+"…"};return[Zt(s)>br?o(s):s,Zt(a)>br?o(a):a]}function EA(e,t){const n=vA(e),r=t?14:13,i=Math.max(...n.map(l=>Zt(l,r))),s=t?32:24,a=17,o=t?20:16;return{width:Math.min(t?196:170,Math.max(t?92:76,i+s)),height:o+n.length*a,lines:n,hub:t}}const kA=28,wA=52,Xd=34;function S0(e,t){var M,O,L;const n=e.map(I=>I.id),r=new Set(n),i=new Map;for(const I of e)i.set(I.id,new Set);const s=new Set,a=[];for(const I of t){if(!r.has(I.from)||!r.has(I.to)||I.from===I.to)continue;a.push(I);const j=[I.from,I.to].sort().join("→");s.has(j)||(s.add(j),i.get(I.from).add(I.to),i.get(I.to).add(I.from))}const o=I=>{var j;return((j=i.get(I))==null?void 0:j.size)??0};let l=((M=e[0])==null?void 0:M.id)??"";for(const I of e)o(I.id)>o(l)&&(l=I.id);const c=new Map(n.map((I,j)=>[I,j])),h=new Map,f=new Map;for(const I of e)f.set(I.id,[]);const m=new Map;if(l){m.set(l,0);const I=[l];for(;I.length;){const j=I.shift();for(const U of[...i.get(j)??[]].sort((B,W)=>(c.get(B)??0)-(c.get(W)??0)))m.has(U)||(m.set(U,(m.get(j)??0)+1),h.set(U,j),f.get(j).push(U),I.push(U))}}let d=0;for(const I of m.values())d=Math.max(d,I);const p=e.filter(I=>!m.has(I.id)).map(I=>I.id);for(const I of p)m.set(I,d+1),h.set(I,l),f.get(l).push(I);for(const I of m.values())d=Math.max(d,I);const g=new Map,x=I=>{const j=g.get(I);if(j!=null)return j;const U=f.get(I)??[],B=U.length===0?1:U.reduce((W,D)=>W+x(D),0);return g.set(I,B),B};l&&x(l);const b=new Map,k=(I,j,U)=>{const B=f.get(I)??[];if(B.length===0)return;const W=B.reduce((q,Z)=>q+(g.get(Z)??1),0);let D=j;for(const q of B){const Z=(g.get(q)??1)/W*U;b.set(q,D+Z/2),k(q,D,Z),D+=Z}};l&&k(l,-Math.PI/2,Math.PI*2);const T=new Map;for(const I of e)T.set(I.id,EA(I.label,I.id===l||o(I.id)>=4));const A=new Map;for(const I of e){const j=m.get(I.id)??0;A.has(j)||A.set(j,[]),A.get(j).push(I.id)}const E=new Map;E.set(0,0);for(let I=1;I<=d;I++){const j=A.get(I)??[];if(j.length===0){E.set(I,E.get(I-1)??0);continue}const B=j.reduce((V,$)=>{var ae;return V+(((ae=T.get($))==null?void 0:ae.width)??0)+Xd},0)/(Math.PI*2),W=j.map(V=>({id:V,a:b.get(V)??0})).sort((V,$)=>V.a-$.a);let D=0;if(W.length>1)for(let V=0;V<W.length;V++){const $=W[V],ae=W[(V+1)%W.length];let ne=ae.a-$.a;if(V===W.length-1&&(ne+=Math.PI*2),ne<=.01)continue;const Y=((((O=T.get($.id))==null?void 0:O.width)??0)+(((L=T.get(ae.id))==null?void 0:L.width)??0))/2+Xd;D=Math.max(D,Y/(2*Math.sin(Math.min(Math.PI,ne)/2)))}const q=E.get(I-1)??0,Z=Math.max(...(A.get(I-1)??[]).map(V=>{var $;return((($=T.get(V))==null?void 0:$.height)??0)/2}),0),P=Math.max(...j.map(V=>{var $;return((($=T.get(V))==null?void 0:$.height)??0)/2})),K=j.length===1?60:0;E.set(I,Math.max(q+Z+P+wA,B,D+K))}const C=new Map;for(const I of e){const j=m.get(I.id)??0,U=E.get(j)??0,B=j===0?0:b.get(I.id)??0;C.set(I.id,{id:I.id,center:{x:U*Math.cos(B),y:U*Math.sin(B)},box:T.get(I.id),degree:o(I.id),depth:j})}let _=0;for(const I of C.values())_=Math.max(_,Math.abs(I.center.x)+I.box.width/2,Math.abs(I.center.y)+I.box.height/2);const w=Math.ceil(2*(_+kA)),N=w/2;for(const I of C.values())I.center={x:I.center.x+N,y:I.center.y+N};const S=[],R=[];for(const I of a){const j=C.get(I.from),U=C.get(I.to);if(!j||!U)continue;const B=Qd(j,U.center),W=Qd(U,j.center),D={x:(B.x+W.x)/2,y:(B.y+W.y)/2},q=W.x-B.x,Z=W.y-B.y,P=Math.hypot(q,Z)||1,K=Math.min(34,Math.max(10,P*.16)),V={x:D.x+Z/P*K,y:D.y-q/P*K};let $={x:(B.x+2*V.x+W.x)/4,y:(B.y+2*V.y+W.y)/4};if(I.label){const ae=Zt(I.label,12)+14;for(const ne of R)if(Math.hypot($.x-ne.pt.x,$.y-ne.pt.y)<(ae+ne.w)/2+6){$={x:$.x+Z/P*22,y:$.y-q/P*22};break}R.push({pt:$,w:ae})}S.push({edge:I,d:`M ${B.x.toFixed(1)} ${B.y.toFixed(1)} Q ${V.x.toFixed(1)} ${V.y.toFixed(1)} ${W.x.toFixed(1)} ${W.y.toFixed(1)}`,labelPt:$})}return{nodes:C,edges:S,rootId:l,width:Math.ceil(w),height:Math.ceil(w)}}function Qd(e,t){const n=t.x-e.center.x,r=t.y-e.center.y,i=e.box.width/2+3,s=e.box.height/2+3;if(n===0&&r===0)return{x:e.center.x,y:e.center.y-s};const a=n===0?1/0:i/Math.abs(n),o=r===0?1/0:s/Math.abs(r),l=Math.min(a,o);return{x:e.center.x+n*l,y:e.center.y+r*l}}function TA(e){return{width:Zt(e,12)+16,height:19}}const ui=.4,fo=2.5,di=.2;function Zd({data:e}){const t=v.useMemo(()=>S0(e.nodes,e.edges),[e.nodes,e.edges]);return u.jsxs("svg",{width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,style:{display:"block"},"data-testid":"conceptmap-svg",children:[u.jsx("defs",{children:u.jsx("marker",{id:"cm-arrow",viewBox:"0 0 10 10",refX:9,refY:5,markerWidth:6.5,markerHeight:6.5,orient:"auto-start-reverse",children:u.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-ink-faint"})})}),t.edges.map(({edge:n,d:r,labelPt:i},s)=>{const a=n.label?TA(n.label):null;return u.jsxs("g",{children:[u.jsx("path",{d:r,className:"fill-none stroke-ink-faint/70",strokeWidth:1.6,markerEnd:"url(#cm-arrow)"}),n.label&&a&&u.jsxs("g",{children:[u.jsx("rect",{x:i.x-a.width/2,y:i.y-a.height/2,width:a.width,height:a.height,rx:a.height/2,className:"fill-surface-0 stroke-[var(--border-faint)]",strokeWidth:1}),u.jsx("text",{x:i.x,y:i.y+3.5,textAnchor:"middle",className:"fill-ink-muted text-caption font-medium",children:n.label})]})]},`e-${s}`)}),[...t.nodes.values()].map(n=>{const r=n.center.x-n.box.width/2,i=n.center.y-n.box.height/2,s=n.box.hub?14:13;return u.jsxs("g",{children:[u.jsx("rect",{x:r,y:i,width:n.box.width,height:n.box.height,rx:n.box.hub?13:11,className:n.box.hub?"fill-accent/10 stroke-accent/80":"fill-surface-3 stroke-[var(--border)]",strokeWidth:n.box.hub?1.6:1.1}),n.box.lines.map((a,o)=>u.jsx("text",{x:n.center.x,y:n.center.y+(o-(n.box.lines.length-1)/2)*17+4.5,textAnchor:"middle",fontSize:s,className:n.box.hub?"fill-ink-strong font-bold":"fill-ink",children:a},o))]},n.id)})]})}function C0({data:e,variant:t="card"}){const n=e,r=_e(),i=v.useMemo(()=>S0(n.nodes,n.edges),[n.nodes,n.edges]),[s,a]=v.useState(1),[o,l]=v.useState(!1),c=v.useRef(null);v.useEffect(()=>{const p=c.current;if(!p)return;const g=()=>{const b=(p.clientWidth-16)/i.width;b<1&&a(Math.max(ui,+b.toFixed(2)))};g();const x=new ResizeObserver(g);return x.observe(p),()=>x.disconnect()},[i.width]);const h=v.useCallback(()=>a(p=>Math.min(fo,+(p+di).toFixed(2))),[]),f=v.useCallback(()=>a(p=>Math.max(ui,+(p-di).toFixed(2))),[]),m=v.useCallback(()=>a(1),[]),d=v.useCallback(p=>{if(!p.ctrlKey&&!p.metaKey)return;p.preventDefault();const g=p.deltaY>0?-di:di;a(x=>Math.min(fo,Math.max(ui,+(x+g).toFixed(2))))},[]);return t==="canvas"?u.jsx("div",{"data-testid":"conceptmap-canvas-content",children:u.jsx(Zd,{data:n})}):u.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-concept-map",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[u.jsx(nc,{className:"w-4 h-4 text-ink-muted shrink-0"}),u.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title})]}),u.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-1","data-testid":"conceptmap-zoom-controls",children:[u.jsx("button",{onClick:f,disabled:s<=ui,className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 disabled:opacity-30 text-label font-bold flex items-center justify-center",title:r("artifact.zoomOut"),children:"−"}),u.jsxs("button",{onClick:m,className:"px-1.5 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 text-caption font-bold tabular-nums",title:r("artifact.zoomReset"),children:[Math.round(s*100),"%"]}),u.jsx("button",{onClick:h,disabled:s>=fo,className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 disabled:opacity-30 text-label font-bold flex items-center justify-center",title:r("artifact.zoomIn"),children:"+"})]}),u.jsx("button",{onClick:()=>l(!0),"data-testid":"conceptmap-expand","aria-label":r("artifact.viewer.open"),"data-tooltip":r("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center",children:u.jsx(Os,{className:"w-3.5 h-3.5"})})]})]}),u.jsx("div",{ref:c,onClick:()=>l(!0),onWheel:d,className:"bg-surface-0/40 rounded-lg p-2 overflow-auto min-h-[160px] max-h-[500px] select-none",style:{touchAction:"pan-x pan-y"},"data-testid":"conceptmap-render-area","data-noswipe":"",children:u.jsx("div",{style:{width:i.width*s,height:i.height*s,margin:"0 auto"},children:u.jsx("div",{style:{transform:`scale(${s})`,transformOrigin:"top left",width:i.width,height:i.height},children:u.jsx(Zd,{data:n})})})}),u.jsx("div",{className:"mt-1.5 flex items-center justify-between text-caption text-ink-muted",children:u.jsx("span",{children:r("artifact.conceptmap.stats",{nodes:n.nodes.length,edges:n.edges.length})})}),n.warnings&&n.warnings.length>0&&u.jsxs("div",{className:"mt-1 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[u.jsx(En,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]}),o&&u.jsx(wa,{title:n.title,onClose:()=>l(!1),children:u.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:u.jsx(qs,{testid:"conceptmap-modal-stage",children:u.jsx(C0,{data:e,variant:"canvas"})})})})]})}function SA(e,t){const{correct:n,total:r}=e,i=r>0&&n===r,s=r>0&&n<r,a=t!=null&&t>=Q1,o=t!=null&&t>=Z1;return s?[{id:"explain-wrong"},{id:"retry"}]:i&&a?[{id:"next-topic"},{id:"go-deeper"}]:i&&o?[{id:"mark-mastered",advancesMastery:!0},{id:"next-topic"},{id:"go-deeper"}]:[{id:"go-deeper"},{id:"retry"}]}const CA="ls-quiz-progress:";function AA(e){const t=e.questions.map(r=>`${r.prompt}|${(r.options??[]).join("/")}#${r.answer??""}`).join(`
|
|
513
|
+
`);let n=2166136261;for(let r=0;r<t.length;r++)n^=t.charCodeAt(r),n=Math.imul(n,16777619);return`${CA}${(n>>>0).toString(36)}`}function NA(e){var t,n;try{const r=localStorage.getItem(e);if(!r)return null;const i=JSON.parse(r);return typeof(i==null?void 0:i.current)=="number"&&i.current>=0&&typeof((t=i==null?void 0:i.score)==null?void 0:t.correct)=="number"&&typeof((n=i==null?void 0:i.score)==null?void 0:n.total)=="number"?i:null}catch{return null}}function _A(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const IA={"explain-wrong":{icon:f1,labelKey:"quiz.action.explainWrong",message:"我刚才有题答错了,帮我讲讲为什么错、正确的思路是什么。"},retry:{icon:cs,labelKey:"quiz.action.retry",message:"再来一组类似的题巩固一下。"},"go-deeper":{icon:Go,labelKey:"quiz.action.goDeeper",message:"这组我答得不错,帮我深入讲讲背后的原理和容易混淆的地方。"},"mark-mastered":{icon:tn,labelKey:"quiz.action.markMastered",message:"这课我觉得掌握了,帮我确认一下——出个综合题检验,通过了就标记为掌握。"},"next-topic":{icon:Wo,labelKey:"quiz.action.nextTopic",message:"进入下一个知识点。"}};function MA({data:e,onAnswered:t,quizMastery:n,onPickAction:r,onQuizCompleted:i}){const s=e,a=_e(),o=v.useMemo(()=>AA(s),[s]),l=v.useMemo(()=>NA(o),[o]),[c,h]=v.useState((l==null?void 0:l.current)??0),[f,m]=v.useState(null),[d,p]=v.useState(!1),[g,x]=v.useState((l==null?void 0:l.score)??{correct:0,total:0}),b=v.useRef([]);v.useEffect(()=>{_A(o,{current:c,score:g})},[o,c,g]);const[k,T]=v.useState(!1);if(c>=s.questions.length){const w=!!r&&!i;if(i)return u.jsxs("div",{className:"surface-card p-4 text-center","data-testid":"artifact-quiz-done",children:[u.jsx("div",{className:"text-2xl mb-2",children:g.correct===g.total?"🎉":"📚"}),u.jsx("div",{className:"text-body font-bold text-ink",children:a("quiz.scoreSummary",{correct:g.correct,total:g.total})}),k?u.jsx("div",{className:"text-label text-ink-muted mt-1","data-testid":"quiz-hook-sent",children:a("quiz.hook.sent")}):u.jsx("button",{onClick:()=>{T(!0),i({title:s.title??"",correct:g.correct,total:g.total,detail:[...b.current]})},"data-testid":"quiz-hook-finish",className:"btn-3d-brand mt-3 px-5 py-2 text-body",children:a("quiz.hook.finish")})]});const N=w?SA(g,n??null):[];return u.jsxs("div",{className:"surface-card p-4 text-center","data-testid":"artifact-quiz-done",children:[u.jsx("div",{className:"text-2xl mb-2",children:g.correct===g.total?"🎉":"📚"}),u.jsx("div",{className:"text-body font-bold text-ink",children:a("quiz.scoreSummary",{correct:g.correct,total:g.total})}),u.jsx("div",{className:"text-label text-ink-muted mt-1",children:g.correct===g.total?a("quiz.allCorrectHint"):a("quiz.tryAgainHint")}),N.length>0&&u.jsxs("div",{className:"mt-3 space-y-2 text-left","data-testid":"quiz-next-actions",children:[u.jsx("div",{className:"text-label text-ink-muted",children:a("quiz.action.nextPrompt")}),N.map((S,R)=>{const M=IA[S.id],O=M.icon;return u.jsxs("button",{onClick:()=>r==null?void 0:r(M.message),"data-testid":`quiz-action-${S.id}`,className:`${R===0?"btn-3d-brand":"btn-3d-neutral"} w-full py-2 text-body flex items-center justify-center gap-1.5`,children:[u.jsx(O,{className:"w-4 h-4"}),a(M.labelKey)]},S.id)})]})]})}const A=s.questions[c],E=d&&f===A.answer,C=()=>{if(f===null)return;p(!0);const w=f===A.answer;x(N=>({correct:N.correct+(w?1:0),total:N.total+1})),t==null||t(A,f,w),b.current.push({prompt:A.prompt,chosen:A.options[f]??"?",answerText:A.options[A.answer]??"?",correct:w}),er(w?"correct":"wrong")},_=()=>{c===s.questions.length-1&&i&&!k&&(T(!0),i({title:s.title??"",correct:g.correct,total:g.total,detail:[...b.current]})),h(w=>w+1),m(null),p(!1)};return u.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-quiz",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Jl,{className:"w-4 h-4 text-brand"}),u.jsx("span",{className:"text-label font-bold text-brand",children:a("quiz.questionProgress",{cur:c+1,total:s.questions.length})})]}),u.jsx("span",{className:"text-label text-ink-muted",children:a("quiz.answeredCorrect",{n:g.correct})})]}),u.jsx("div",{className:"text-body text-ink font-medium mb-3 leading-relaxed",children:A.prompt}),u.jsx("div",{className:"space-y-2 mb-3",children:A.options.map((w,N)=>{const S=f===N,R=d&&N===A.answer,M=d&&S&&!R;return u.jsxs("button",{onClick:()=>!d&&m(N),disabled:d,"data-testid":`quiz-option-${N}`,className:`w-full text-left text-body p-2.5 rounded-lg border-2 font-medium transition-colors ${R?"border-brand bg-brand/10 text-brand animate-answer-correct":M?"border-warning bg-warning/10 text-warning animate-answer-wrong":S?"border-accent bg-accent/10 text-accent":"border-[var(--border)] text-ink-muted hover:border-[var(--border)]"} ${d?"cursor-default":"cursor-pointer"}`,children:[u.jsx("span",{className:"font-bold mr-2",children:String.fromCharCode(65+N)}),w,R&&u.jsx("span",{className:"float-right",children:u.jsx(Bt,{className:"w-4 h-4 inline-block"})}),M&&u.jsx("span",{className:"float-right",children:u.jsx(Kt,{className:"w-4 h-4 inline-block"})})]},N)})}),d&&u.jsxs("div",{className:`rounded-lg p-3 mb-3 text-body leading-relaxed animate-artifact-render ${E?"bg-brand/10 border border-brand/30 text-brand":"bg-warning/10 border border-warning/30 text-warning"}`,"data-testid":"quiz-explanation",children:[u.jsxs("div",{className:"font-bold mb-1 flex items-center gap-1.5",children:[E?u.jsx(Bt,{className:"w-4 h-4"}):u.jsx(Kt,{className:"w-4 h-4"}),u.jsx("span",{children:a(E?"quiz.correct":"quiz.wrong")})]}),u.jsx("div",{className:"text-ink-muted",children:A.explanation})]}),d?u.jsx("button",{onClick:_,"data-testid":"quiz-next",className:"btn-3d-brand w-full py-2 text-body",children:c+1<s.questions.length?a("exercise.next"):a("quiz.finish")}):u.jsx("button",{onClick:C,disabled:f===null,"data-testid":"quiz-submit",className:"btn-3d-brand w-full py-2 text-body disabled:opacity-40",children:a("exercise.submit")}),s.warnings&&s.warnings.length>0&&u.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[u.jsx(En,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:s.warnings.join("; ")})]})]})}function A0({data:e,variant:t="card"}){const n=e,r=_e(),[i,s]=v.useState(!1),a=u.jsxs("table",{className:"text-body",style:{width:"max-content",minWidth:"100%"},children:[u.jsx("thead",{children:u.jsx("tr",{className:"bg-surface-3/60",children:n.headers.map((o,l)=>u.jsx("th",{className:`px-3 py-2.5 text-left font-bold border-b border-[var(--border)] ${l===0?"text-ink-strong":"text-ink"}`,children:o},l))})}),u.jsx("tbody",{children:n.rows.map((o,l)=>u.jsx("tr",{className:l%2===0?"bg-surface-0/40":"",children:o.map((c,h)=>u.jsx("td",{className:`px-3 py-2.5 border-b border-[var(--border-faint)] align-top leading-relaxed ${h===0?"font-bold text-ink-strong whitespace-nowrap bg-surface-1/40":"text-ink-muted"}`,style:h===0?void 0:{maxWidth:260,overflowWrap:"anywhere"},children:c},h))},l))})]});return t==="canvas"?u.jsx("div",{className:"w-fit","data-testid":"comparetable-canvas-content",children:a}):u.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-compare-table",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u.jsx(Zf,{className:"w-4 h-4 text-ink-muted shrink-0"}),u.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title})]}),u.jsx("button",{onClick:()=>s(!0),"data-testid":"comparetable-expand","aria-label":r("artifact.viewer.open"),"data-tooltip":r("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center shrink-0",children:u.jsx(Os,{className:"w-3.5 h-3.5"})})]}),u.jsx("div",{className:"overflow-x-auto rounded-lg border border-[var(--border-faint)]",onClick:()=>s(!0),style:{touchAction:"pan-x pan-y"},"data-noswipe":"",children:a}),n.warnings&&n.warnings.length>0&&u.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[u.jsx(En,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]}),i&&u.jsx(wa,{title:n.title,onClose:()=>s(!1),children:u.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:u.jsx(qs,{testid:"comparetable-modal-stage",children:u.jsx("div",{className:"p-2 surface-card",children:u.jsx(A0,{data:e,variant:"canvas"})})})})})]})}let Ni=null;function RA(){return Ni||(Ni=ji(()=>import("./mermaid.core-ChBcV6rX.js").then(e=>e.bp),__vite__mapDeps([0,1,2]),import.meta.url).then(e=>{const t=e.default;return t.initialize({startOnLoad:!1,theme:"base",securityLevel:"loose",themeVariables:LA(),flowchart:{useMaxWidth:!0,htmlLabels:!0,curve:"basis",nodeSpacing:42,rankSpacing:54,padding:10},sequence:{useMaxWidth:!0,boxMargin:8,noteMargin:8,messageMargin:32}}),t})),Ni}function LA(){const e=(n,r)=>{if(typeof document>"u")return r;const i=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return i?`rgb(${i})`:r};return{background:"transparent",fontFamily:typeof document<"u"&&getComputedStyle(document.body).fontFamily||"ui-sans-serif, system-ui, sans-serif",fontSize:"14px",primaryColor:e("--surface-3-rgb","rgb(42 43 46)"),primaryBorderColor:e("--border-rgb","rgb(37 38 41)"),primaryTextColor:e("--ink-strong-rgb","rgb(250 250 250)"),secondaryColor:e("--surface-2-rgb","rgb(32 33 36)"),secondaryBorderColor:e("--border-faint-rgb","rgb(26 26 29)"),secondaryTextColor:e("--ink-rgb","rgb(245 245 250)"),tertiaryColor:e("--surface-1-rgb","rgb(24 25 27)"),tertiaryBorderColor:e("--border-faint-rgb","rgb(26 26 29)"),tertiaryTextColor:e("--ink-rgb","rgb(245 245 250)"),lineColor:e("--ink-faint-rgb","rgb(117 117 126)"),textColor:e("--ink-rgb","rgb(245 245 250)"),edgeLabelBackground:e("--surface-0-rgb","rgb(12 13 15)"),clusterBkg:e("--surface-1-rgb","rgb(24 25 27)"),clusterBorder:e("--border-faint-rgb","rgb(26 26 29)"),nodeBorder:e("--border-rgb","rgb(37 38 41)"),mainBkg:e("--surface-3-rgb","rgb(42 43 46)"),nodeTextColor:e("--ink-rgb","rgb(245 245 250)"),arrowheadColor:e("--ink-faint-rgb","rgb(117 117 126)"),actorBkg:e("--surface-3-rgb","rgb(42 43 46)"),actorBorder:e("--border-rgb","rgb(37 38 41)"),actorTextColor:e("--ink-strong-rgb","rgb(250 250 250)"),activationBkgColor:e("--surface-3-rgb","rgb(42 43 46)"),activationBorderColor:e("--border-rgb","rgb(37 38 41)"),signalColor:e("--ink-rgb","rgb(245 245 250)"),signalTextColor:e("--ink-rgb","rgb(245 245 250)"),labelBoxBkgColor:e("--surface-2-rgb","rgb(32 33 36)"),labelBoxBorderColor:e("--border-rgb","rgb(37 38 41)"),labelTextColor:e("--ink-rgb","rgb(245 245 250)"),loopTextColor:e("--ink-strong-rgb","rgb(250 250 250)"),noteBkgColor:"rgb(255 200 0 / 0.12)",noteBorderColor:"rgb(255 200 0 / 0.4)",noteTextColor:e("--ink-rgb","rgb(245 245 250)")}}typeof window<"u"&&window.addEventListener("theme-changed",()=>{Ni=null});async function PA(e,t){const n=await RA();try{await n.parse(t)}catch(i){throw new Error(`mermaid 语法校验失败: ${i instanceof Error?i.message:String(i)}`)}const{svg:r}=await n.render(e,t);if(r.includes('aria-roledescription="error"')||r.includes('class="error-text"')||r.includes("Syntax error"))throw new Error("mermaid 渲染失败(语法错误或节点 label 含未转义特殊字符)");return r}const mo=.3,po=3,hi=.2;function N0({data:e,variant:t="card"}){const n=e,r=_e(),i={flowchart:r("artifact.diagram.flowchart"),sequence:r("artifact.diagram.sequence"),state:r("artifact.diagram.state")},s=v.useId().replace(/[:]/g,"_"),[a,o]=v.useState({status:"loading"}),[l,c]=v.useState(0);v.useEffect(()=>{const C=()=>c(_=>_+1);return window.addEventListener("theme-changed",C),()=>window.removeEventListener("theme-changed",C)},[]);const[h,f]=v.useState(null),[m,d]=v.useState(1),[p,g]=v.useState(!1);v.useEffect(()=>{let C=!1;return o({status:"loading"}),f(null),PA(`mmd-${s}`,n.mermaid).then(_=>{C||o({status:"rendered",svg:_})}).catch(_=>{C||(console.error("[MermaidArtifact] render failed:",_),o({status:"error",message:_ instanceof Error?_.message:String(_)}))}),()=>{C=!0}},[n.mermaid,s,l]);const x=`https://mermaid.live/edit#${encodeURIComponent(n.mermaid)}`,b=v.useCallback(()=>d(C=>Math.min(po,+(C+hi).toFixed(2))),[]),k=v.useCallback(()=>d(C=>Math.max(mo,+(C-hi).toFixed(2))),[]),T=v.useCallback(()=>d(1),[]),A=v.useCallback(C=>{if(!C.ctrlKey&&!C.metaKey)return;C.preventDefault();const _=C.deltaY>0?-hi:hi;d(w=>Math.min(po,Math.max(mo,+(w+_).toFixed(2))))},[]),E=a.status==="rendered"?u.jsx("div",{ref:C=>{var _;if(C&&!h){const w=C.querySelector("svg");if(w){const N=w.getBoundingClientRect(),S=(_=w.viewBox)==null?void 0:_.baseVal,R=S&&S.width?S.width:N.width,M=S&&S.height?S.height:N.height;R>0&&M>0&&f({width:R,height:M})}}},style:{width:(h==null?void 0:h.width)??void 0,height:(h==null?void 0:h.height)??void 0},dangerouslySetInnerHTML:{__html:a.svg},"data-testid":"mermaid-svg"}):null;return t==="canvas"?u.jsx("div",{"data-testid":"mermaid-canvas-content",children:E}):u.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-mermaid",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[u.jsx(Y1,{className:"w-4 h-4 text-ink-muted shrink-0"}),u.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title}),u.jsx("span",{className:"text-caption font-bold px-1.5 py-0.5 rounded bg-accent/15 text-accent shrink-0",children:i[n.diagramType]??n.diagramType})]}),u.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.status==="rendered"&&u.jsxs("div",{className:"flex items-center gap-1","data-testid":"mermaid-zoom-controls",children:[u.jsx("button",{onClick:k,disabled:m<=mo,className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-1 hover:bg-surface-3 disabled:opacity-30 text-label font-bold flex items-center justify-center",title:r("artifact.zoomOut"),"data-testid":"mermaid-zoom-out",children:"−"}),u.jsxs("button",{onClick:T,className:"px-1.5 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-1 hover:bg-surface-3 text-caption font-bold tabular-nums",title:r("artifact.zoomReset"),"data-testid":"mermaid-zoom-reset",children:[Math.round(m*100),"%"]}),u.jsx("button",{onClick:b,disabled:m>=po,className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-1 hover:bg-surface-3 disabled:opacity-30 text-label font-bold flex items-center justify-center",title:r("artifact.zoomIn"),"data-testid":"mermaid-zoom-in",children:"+"})]}),a.status==="rendered"&&u.jsx("button",{onClick:()=>g(!0),"data-testid":"mermaid-expand","aria-label":r("artifact.viewer.open"),"data-tooltip":r("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center",children:u.jsx(Os,{className:"w-3.5 h-3.5"})})]}),u.jsx("button",{onClick:()=>window.open(x,"_blank"),className:"text-caption text-accent hover:underline font-bold shrink-0","data-testid":"mermaid-open-live",title:r("artifact.mermaid.openLive"),children:"mermaid.live ↗"})]}),u.jsxs("div",{onClick:()=>{a.status==="rendered"&&g(!0)},onWheel:A,className:"bg-surface-0/40 rounded-lg p-3 overflow-auto min-h-[120px] max-h-[500px] select-none",style:{touchAction:"pan-x pan-y"},"data-testid":"mermaid-render-area","data-noswipe":"",children:[a.status==="loading"&&u.jsxs("div",{className:"flex items-center gap-2 text-body text-ink-muted my-8 justify-center","data-testid":"mermaid-loading",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-accent rounded-full inline-block"}),u.jsx("span",{children:r("artifact.mermaid.rendering")})]}),a.status==="rendered"&&u.jsx("div",{style:{width:h?h.width*m:"auto",height:h?h.height*m:"auto",margin:"0 auto"},children:u.jsx("div",{style:{transform:`scale(${m})`,transformOrigin:"top left"},children:E})}),a.status==="error"&&u.jsxs("div",{className:"w-full text-center my-4","data-testid":"mermaid-fallback",children:[u.jsxs("div",{className:"text-body text-warning mb-2 flex items-center justify-center gap-1.5",children:[u.jsx(En,{className:"w-4 h-4 shrink-0"}),u.jsx("span",{children:r("artifact.mermaid.renderFailed")})]}),u.jsx("pre",{className:"text-label bg-surface-1/60 rounded p-2 overflow-x-auto text-ink-muted font-mono text-left",children:n.mermaid}),u.jsx("div",{className:"text-caption text-ink-muted mt-2",children:r("artifact.mermaid.errorPrefix",{msg:a.message})})]})]}),a.status==="rendered"&&u.jsx("div",{className:"mt-1.5 text-caption text-ink-muted flex items-center gap-2",children:u.jsx("span",{children:r("artifact.mermaid.hint")})}),p&&a.status==="rendered"&&u.jsx(wa,{title:n.title,onClose:()=>g(!1),children:u.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:u.jsx(qs,{testid:"mermaid-modal-stage",children:u.jsx(N0,{data:e,variant:"canvas"})})})}),n.warnings&&n.warnings.length>0&&u.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[u.jsx(En,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]})]})}function _0({data:e,variant:t="card"}){const n=e,r=_e(),[i,s]=v.useState(null),[a,o]=v.useState(!1),l=v.useRef([]),c=v.useRef([]),h=n.code.split(`
|
|
514
|
+
`),f=g=>{if(i===null)return!1;const x=n.annotations[i];return x&&g>=x.lineStart&&g<=x.lineEnd},m=g=>{const x=i===g?null:g;if(s(x),x!==null){const b=n.annotations[x],k=(a?c:l).current[b.lineStart-1];k==null||k.scrollIntoView({behavior:"smooth",block:"center"})}},d=g=>u.jsx("div",{className:"bg-neutral-950 rounded-lg overflow-hidden border border-neutral-800 max-h-[420px] overflow-y-auto",children:u.jsx("pre",{className:"text-label font-mono leading-relaxed overflow-x-auto",children:u.jsx("code",{children:h.map((x,b)=>{const k=b+1;return u.jsxs("div",{ref:T=>{g.current[b]=T},className:`flex ${f(k)?"bg-brand/15":""}`,children:[u.jsx("span",{className:"select-none text-neutral-600 pr-3 pl-3 text-right w-10 shrink-0 border-r border-neutral-800 tabular-nums",children:k}),u.jsx("span",{className:"text-neutral-200 pl-3 whitespace-pre",children:x||" "})]},b)})})})}),p=u.jsxs("div",{className:"space-y-2",children:[u.jsx("div",{className:"text-caption font-bold text-ink-muted",children:r("artifact.codewalk.sectionLabel")}),n.annotations.map((g,x)=>u.jsxs("button",{onClick:()=>m(x),"data-testid":`annotation-${x}`,className:`w-full text-left p-2.5 rounded-lg border transition-colors ${i===x?"border-brand bg-brand/10":"border-[var(--border-faint)] hover:border-[var(--border)]"}`,children:[u.jsx("div",{className:"text-caption font-bold text-brand mb-0.5",children:g.lineEnd!==g.lineStart?r("artifact.codewalk.lineRange",{a:g.lineStart,b:g.lineEnd}):r("artifact.codewalk.lineSingle",{n:g.lineStart})}),u.jsx("div",{className:"text-body text-ink-muted leading-relaxed",children:g.note})]},x))]});return t==="canvas"?u.jsx("div",{className:"w-fit","data-testid":"codewalk-canvas-content",children:d(c)}):u.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-code-walkthrough",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u.jsx(qf,{className:"w-4 h-4 text-ink-muted shrink-0"}),u.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title}),u.jsx("span",{className:"text-caption font-bold px-1.5 py-0.5 rounded bg-surface-3 text-ink-muted font-mono shrink-0",children:n.language})]}),u.jsx("button",{onClick:()=>o(!0),"data-testid":"codewalk-expand","aria-label":r("artifact.viewer.open"),"data-tooltip":r("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center shrink-0",children:u.jsx(Os,{className:"w-3.5 h-3.5"})})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[u.jsx("div",{onClick:()=>{a||o(!0)},style:{touchAction:"pan-x pan-y"},"data-noswipe":"",children:d(l)}),p]}),n.warnings&&n.warnings.length>0&&u.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[u.jsx(En,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]}),a&&u.jsx(wa,{title:n.title,onClose:()=>o(!1),children:u.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:u.jsx(qs,{testid:"codewalk-modal-stage",children:u.jsx(_0,{data:e,variant:"canvas"})})})})]})}function DA({data:e,onPickAction:t}){const n=e,r=_e(),[i,s]=v.useState(null),a=o=>{i||(s(o.id),t==null||t(`${r("guess.pickedPrefix")}${o.label}`))};return u.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-guess",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[u.jsx(g1,{className:"w-4 h-4 text-accent"}),u.jsx("span",{className:"text-label font-bold text-accent",children:r("guess.header")})]}),u.jsx("div",{className:"text-body text-ink font-medium mb-3 leading-relaxed",children:n.prompt}),u.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mb-2",children:n.options.map(o=>{const l=i===o.id,c=i!==null;return u.jsxs("button",{onClick:()=>a(o),disabled:c,"data-testid":`guess-option-${o.id}`,className:`text-body p-2.5 rounded-lg border-2 font-medium transition-colors text-left flex items-center justify-between gap-2 ${l?"border-accent bg-accent/10 text-accent":c?"border-[var(--border-faint)] text-ink-faint cursor-default":"border-[var(--border)] text-ink-muted hover:border-accent hover:text-accent cursor-pointer"}`,children:[u.jsx("span",{children:o.label}),l&&u.jsx(Bt,{className:"w-4 h-4 shrink-0"})]},o.id)})}),i&&u.jsx("div",{className:"text-label text-ink-muted mt-1","data-testid":"guess-picked-hint",children:r("guess.waitReveal")}),n.warnings&&n.warnings.length>0&&u.jsx("div",{className:"mt-2 text-caption text-warning","data-testid":"artifact-warnings",children:n.warnings.join("; ")})]})}function _c({data:e,onQuizAnswered:t,quizMastery:n,onPickAction:r,onQuizCompleted:i,variant:s="card"}){const a=e;if(!a||!a.artifactType)return u.jsx(Jd,{data:e});switch(a.artifactType){case"concept_map":return u.jsx(C0,{data:e,variant:s});case"quiz":return u.jsx(MA,{data:e,onAnswered:t,quizMastery:n,onPickAction:r,onQuizCompleted:i});case"compare_table":return u.jsx(A0,{data:e,variant:s});case"diagram":return u.jsx(N0,{data:e,variant:s});case"code_walkthrough":return u.jsx(_0,{data:e,variant:s});case"guess":return u.jsx(DA,{data:e,onPickAction:r});default:return u.jsx(Jd,{data:e})}}function Jd({data:e}){var n;const t=_e();return u.jsxs("div",{className:"surface-card p-4 text-body text-ink-muted","data-testid":"artifact-unknown",children:[u.jsxs("div",{className:"font-bold mb-1 flex items-center gap-1.5",children:[u.jsx(Qf,{className:"w-4 h-4"}),t("artifact.unknownHeader")]}),u.jsx("pre",{className:"text-caption overflow-x-auto text-ink-muted",children:(n=JSON.stringify(e,null,2))==null?void 0:n.slice(0,200)})]})}const yl="lookatstudy-tts-settings-changed";function vl(e){const t=n=>{const r=n.toLowerCase();return r==="zh-cn"||r==="zh_cn"||r==="zh"?0:r.startsWith("zh")?1:2};return[...e].sort((n,r)=>t(n.lang)-t(r.lang)||n.lang.localeCompare(r.lang)||n.name.localeCompare(r.name))}function eh(e,t){if(e.length===0)return null;const n=t==null?void 0:t.trim();if(n){const s=e.find(a=>a.name===n);if(s)return s}const r=vl(e.filter(s=>s.default));return r.length>0&&OA(r[0].lang)?r[0]:vl(e)[0]??null}function OA(e){return e.toLowerCase().startsWith("zh")}function jA(e){return`${e.name} · ${e.lang}`}const th=new WeakMap;let I0=null;function go(e){I0=e}function FA(){return I0}const M0=1024;function R0(e){let t=th.get(e);return t||(t=e.createAnalyser(),t.fftSize=M0,t.smoothingTimeConstant=.55,th.set(e,t)),t}function BA(e,t){try{const n=R0(e);t.connect(n),n.connect(e.destination)}catch{try{t.connect(e.destination)}catch{}}}const _r=1024,nh=512,HA=3500,UA=7500,zA=.3,VA=.16,$A=1400,qA=2800,fi=70,L0=new Float64Array(_r);for(let e=0;e<_r;e++)L0[e]=.5*(1-Math.cos(2*Math.PI*e/(_r-1)));function WA(e,t){const n=e.length;for(let r=1,i=0;r<n;r++){let s=n>>1;for(;i&s;s>>=1)i^=s;if(i|=s,r<i){const a=e[r];e[r]=e[i],e[i]=a;const o=t[r];t[r]=t[i],t[i]=o}}for(let r=2;r<=n;r<<=1){const i=-2*Math.PI/r,s=Math.cos(i),a=Math.sin(i),o=r>>1;for(let l=0;l<n;l+=r){let c=1,h=0;for(let f=0;f<o;f++){const m=e[l+f],d=t[l+f],p=e[l+f+o],g=t[l+f+o],x=p*c-g*h,b=p*h+g*c;e[l+f]=m+x,t[l+f]=d+b,e[l+f+o]=m-x,t[l+f+o]=d-b;const k=c*s-h*a;h=c*a+h*s,c=k}}}}function YA(e,t){const n=e.length;let r=0;const i=new Float64Array(n),s=new Float64Array(n);for(let g=0;g<n;g++){const x=e[g];r+=Math.abs(x),i[g]=x*L0[g]}WA(i,s);const a=n>>1,o=t/n,l=new Float64Array(a);let c=0,h=0,f=0,m=0,d=0,p=0;for(let g=0;g<a;g++){const x=g*o;if(x>=t/2-o)break;const b=Math.hypot(i[g],s[g])/a;l[g]=b,c+=b,x>=HA&&x<UA&&(h+=b),x>=hu.lo&&x<hu.hi?(f+=b,m+=b*x):x>=fu.lo&&x<fu.hi&&(d+=b,p+=b*x)}return{level:n>0?Math.min(1,r/n/.22):0,f1:f>0?m/f:400,f2:d>0?p/d:800,hfRatio:c>0?h/c:0}}function GA(e,t){return e.level<=Rx?"closed":e.hfRatio>=zA?"SS":e.hfRatio>=VA&&e.level<.45?"FV":t==="closed"&&e.f2>=$A&&e.f2<=qA?"L":Lx(e.f1,e.f2,e.level)}function KA(e,t){const n=[],r=(h,f,m,d)=>{if(f<=0)return;const p=n[n.length-1];if(p&&p.viseme===m&&Math.abs(p.t+p.dur-h)<1e-9){p.dur+=f,p.level=Math.max(p.level,d);return}n.push({t:h,dur:f,viseme:m,level:d})};if(e.length<_r)return{cues:[{t:0,dur:Math.max(0,e.length/t),viseme:"closed",level:0}],duration:Math.max(0,e.length/t)};let i="closed";const s=nh/t;for(let h=0;h+_r<=e.length;h+=nh){const f=e.subarray(h,h+_r),m=YA(f,t),d=GA(m,i);r(h/t,s,d,m.level),i=d}const a=e.length/t,o=n.length>0?n[n.length-1].t+n[n.length-1].dur:0;o<a-1e-9&&r(o,a-o,"closed",0);const l=n[0];if(l&&l.viseme!=="closed")if(l.dur<=fi/1e3)l.viseme="closed";else{const h=Math.min(l.dur*.5,fi/1e3);l.dur-=h,l.t+=h,n.unshift({t:0,dur:h,viseme:"closed",level:0})}const c=n[n.length-1];if(c&&c.viseme!=="closed"){const h=Math.min(c.dur*.5,fi/1e3);c.dur-=h,n.push({t:c.t+c.dur,dur:h,viseme:"closed",level:0})}for(let h=n.length-1;h>=1;h--){const f=n[h];if(f.viseme!=="closed"&&f.dur<fi/1e3){const m=n[h-1];m.dur+=f.dur,n.splice(h,1)}}return{cues:n,duration:a}}function XA(e){const t=[...e].filter(i=>i.dur>0&&Number.isFinite(i.t)).sort((i,s)=>i.t-s.t),n=[];let r=0;for(const i of t){const s=Math.max(0,i.t/1e3),a=i.dur/1e3;s>r+1e-9&&n.push({t:r,dur:s-r,viseme:"closed",level:0});const o=n[n.length-1];o&&o.viseme===i.viseme&&Math.abs(o.t+o.dur-s)<1e-9?(o.dur+=a,o.level=Math.max(o.level,Math.min(1,Math.max(0,i.level)))):n.push({t:s,dur:a,viseme:i.viseme,level:Math.min(1,Math.max(0,i.level))}),r=s+a}return{cues:n,duration:r}}function QA(e,t){const n=e.cues;if(n.length===0||t<0)return null;let r=0,i=n.length-1;for(;r<i;){const a=r+i+1>>1;n[a].t<=t?r=a:i=a-1}const s=n[r];return t<=s.t+s.dur+1e-9?s:null}function P0(){const[e,t]=v.useState(null),[n,r]=v.useState(null),[i,s]=v.useState(null),[a,o]=v.useState([]),l=v.useRef([]),[c,h]=v.useState(null),[f,m]=v.useState(!1),d=v.useRef(null),p=v.useRef(new Map),g=v.useRef(new Map),x=v.useRef(0),b=v.useRef(!1),k=v.useRef([]),T=v.useRef(0),A=v.useRef(0),E=v.useRef(!1),C=v.useRef(null),_=v.useRef(0),w=v.useRef(null),N=v.useRef(null),S=v.useRef(null);S.current||(S.current=()=>{const B=N.current,W=typeof window<"u"?window.speechSynthesis:void 0;if(!B||B.stopped||!W)return;if(B.i>=B.sentences.length){N.current=null,C.current=null,t(null),r(null),s(null);return}const D=B.i,q=B.sentences[D],Z=new SpeechSynthesisUtterance(q);B.voice&&(Z.voice=B.voice,Z.lang=B.voice.lang),Z.rate=B.rate,Z.onstart=()=>{!N.current||N.current.stopped||s({index:D,total:B.sentences.length,text:q})};const P=()=>{var K;!N.current||N.current.stopped||(N.current.i+=1,(K=S.current)==null||K.call(S))};Z.onend=P,Z.onerror=P,W.speak(Z)});const R=v.useCallback((B,W)=>{var P;if(typeof window>"u"||!("speechSynthesis"in window)){h("engine-unavailable");return}const D=fA(W);if(D.length===0){h("empty-text");return}l.current=D.slice(),o(D.slice()),_.current=D.length,r({index:0,total:D.length,text:D[0]??""});const q=w.current,Z=eh(window.speechSynthesis.getVoices(),(q==null?void 0:q.systemVoice)??null);N.current={messageId:B,sentences:D,i:0,stopped:!1,voice:Z,rate:rh(q==null?void 0:q.speed)},window.speechSynthesis.cancel(),(P=S.current)==null||P.call(S)},[]),M=()=>{if(!d.current){const B=window.AudioContext??window.webkitAudioContext;d.current=new B}return d.current.resume(),d.current},O=v.useCallback(()=>{E.current&&A.current>=T.current&&!b.current&&(C.current=null,t(null),r(null),s(null))},[]),L=v.useCallback(()=>{const B=d.current;if(!B||b.current)return;const W=p.current.get(x.current);if(!W){O();return}const D=x.current;p.current.delete(D),b.current=!0,s({index:D,total:_.current,text:l.current[D]??""}),x.current+=1;const q=B.createBufferSource();q.buffer=W,BA(B,q),go({ctx:B,timeline:g.current.get(D)??null,startedAtCtxTime:B.currentTime,analyser:R0(B)}),q.onended=()=>{A.current+=1,b.current=!1,go(null),L()},k.current.push(q),q.start()},[O]),I=v.useCallback(()=>{for(const B of k.current)try{B.onended=null,B.stop()}catch{}k.current=[],p.current.clear(),g.current.clear(),go(null),b.current=!1,T.current=0,A.current=0,E.current=!1,C.current=null,x.current=0,_.current=0,l.current=[],o([]),t(null),r(null),s(null),N.current&&(N.current.stopped=!0,N.current=null),typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()},[]),j=v.useCallback(()=>{I(),window.api.ttsStop().catch(()=>{})},[I]),U=v.useCallback((B,W)=>{var D;if(C.current===B){j();return}if(I(),window.dispatchEvent(new CustomEvent("lookatstudy-speech-start",{detail:B})),h(null),C.current=B,T.current=0,A.current=0,E.current=!1,x.current=0,_.current=0,t(B),r({index:0,total:0,text:""}),((D=w.current)==null?void 0:D.engine)==="system"){R(B,W);return}M(),window.api.ttsSpeak(W,B).then(q=>{if(q.ok){q.firstUse&&m(!0);return}I(),q.reason!=="empty-text"&&h(q.reason)}).catch(()=>I())},[R,j,I]);return v.useEffect(()=>{const B=window.api.on("speech:ttsAudio",q=>{if(q.messageId!==C.current)return;const Z=M();T.current+=1,_.current=q.sentenceTotal,r({index:q.sentenceIndex,total:q.sentenceTotal,text:q.sentence??""}),q.sentence!=null&&(l.current[q.sentenceIndex]=q.sentence,o(l.current.slice())),Z.decodeAudioData(q.wavBytes).then(P=>{var K;if(q.messageId===C.current){p.current.set(q.sentenceIndex,P);try{const V=(K=q.visemeCues)!=null&&K.length?XA(q.visemeCues):KA(ZA(P),P.sampleRate);V&&g.current.set(q.sentenceIndex,V)}catch{}L()}},()=>{q.messageId===C.current&&(T.current-=1,L())})}),W=window.api.on("speech:ttsDone",q=>{q.messageId===C.current&&(E.current=!0,O())}),D=window.api.on("speech:ttsError",()=>I());return()=>{B(),W(),D()}},[O,L,I]),v.useEffect(()=>I,[I]),v.useEffect(()=>{const B=W=>{const D=W.detail;C.current&&D!==C.current&&I()};return window.addEventListener("lookatstudy-speech-start",B),()=>window.removeEventListener("lookatstudy-speech-start",B)},[I]),v.useEffect(()=>{let B=!0;const W=()=>{Promise.all([window.api.getSetting("tts_engine"),window.api.getSetting("tts_system_voice"),window.api.getSetting("tts_speed")]).then(([D,q,Z])=>{B&&(w.current={engine:(D??"").trim(),systemVoice:q??null,speed:rh(Z)})}).catch(()=>{})};return W(),window.addEventListener(yl,W),()=>{B=!1,window.removeEventListener(yl,W)}},[]),v.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const B=()=>{var D;const W=N.current;!W||W.voice||(W.voice=eh(window.speechSynthesis.getVoices(),((D=w.current)==null?void 0:D.systemVoice)??null))};return window.speechSynthesis.addEventListener("voiceschanged",B),()=>window.speechSynthesis.removeEventListener("voiceschanged",B)},[]),v.useEffect(()=>{Px(e!==null)},[e]),{speakingMessageId:e,speakingSentence:n,playingSentence:i,streamTexts:a,failReason:c,clearFailReason:()=>h(null),onlineNotice:f,clearOnlineNotice:()=>m(!1),speak:U,stop:j}}function ZA(e){if(e.numberOfChannels===1)return e.getChannelData(0);const t=e.getChannelData(0),n=e.getChannelData(1),r=new Float32Array(t.length);for(let i=0;i<t.length;i++)r[i]=(t[i]+n[i])/2;return r}function rh(e){const t=typeof e=="number"?e:Number.parseFloat(e??"");return Number.isFinite(t)?Math.min(2,Math.max(.5,t)):1}const D0=v.createContext(null);let JA=0;const eN={default:4e3,success:4e3,info:4e3,warning:5e3,error:6e3},tN={default:null,success:u.jsx(tn,{className:"w-4 h-4 text-brand shrink-0"}),error:u.jsx(Yo,{className:"w-4 h-4 text-warning shrink-0"}),warning:u.jsx(En,{className:"w-4 h-4 text-review shrink-0"}),info:u.jsx(w1,{className:"w-4 h-4 text-accent shrink-0"})};function nN({children:e}){const[t,n]=v.useState([]),r=v.useCallback(a=>{n(o=>o.filter(l=>l.id!==a))},[]),i=v.useCallback(a=>{n(o=>o.map(l=>l.id===a?{...l,exiting:!0}:l))},[]),s=v.useCallback((a,o)=>{const l=++JA,c=(o==null?void 0:o.severity)??"default",h=(o==null?void 0:o.duration)??eN[c],f={id:l,message:a,action:o==null?void 0:o.action,duration:h,severity:c,exiting:!1};n(m=>[...m,f]),window.setTimeout(()=>i(l),h)},[i]);return u.jsxs(D0.Provider,{value:{show:s},children:[e,u.jsx("div",{className:"fixed top-14 left-1/2 -translate-x-1/2 z-[100] flex flex-col items-center gap-2 pointer-events-none",role:"region","aria-live":"polite","aria-label":"Notifications",children:t.map(a=>u.jsx(rN,{item:a,onAction:()=>{a.action.onClick(),i(a.id)},onDismiss:()=>i(a.id),onExitDone:()=>r(a.id)},a.id))})]})}function rN({item:e,onAction:t,onDismiss:n,onExitDone:r}){const i=_e(),s=tN[e.severity];return u.jsxs("div",{className:`pointer-events-auto flex items-center gap-2.5 pl-4 pr-2 py-2 rounded-full bg-surface-0 text-ink-strong text-body shadow-elevated max-w-md ${e.exiting?"toast-exit":"toast-enter"}`,"data-testid":`toast-${e.id}`,"data-severity":e.severity,onAnimationEnd:e.exiting?r:void 0,children:[s,u.jsx("span",{className:"flex-1",children:e.message}),e.action&&u.jsx("button",{onClick:t,className:"text-brand font-bold text-body hover:underline shrink-0 px-1.5 py-1 rounded transition-colors hover:bg-brand/10","data-testid":`toast-action-${e.id}`,children:e.action.label}),u.jsx("button",{onClick:n,className:"text-ink-muted hover:text-ink-strong shrink-0 w-6 h-6 flex items-center justify-center rounded transition-colors hover:bg-surface-3","aria-label":i("action.close"),children:u.jsx(Kt,{className:"w-3.5 h-3.5"})})]})}function Ic(){const e=v.useContext(D0);return e||{show:()=>{}}}const sN={concept_map:nc,quiz:Jl,compare_table:Zf,diagram:y1,code_walkthrough:qf},iN=new Set(["concept_map","quiz","compare_table","diagram","code_walkthrough"]);function aN(e,t){return iN.has(t)?e(`artifact.type.${t}`):e("artifact.type.unknown")}function oN({selectedNode:e,items:t,loading:n,forceTab:r,canvasArtifact:i,isReviewing:s,onReviewDone:a,onUserTabChange:o,onRemove:l,onTogglePin:c,onRecordQuizResult:h,onSaveContentNote:f,onUpdateNoteComment:m,onJumpToSource:d,onQuoteToChat:p,locale:g}){var _;const x=_e(),[b,k]=v.useState("content"),T=r??b,A=w=>{k(w),o==null||o()},E=e?t.filter(w=>w.nodeId===e.id):[],C=v.useRef(null);return v.useEffect(()=>{var w;(w=C.current)==null||w.scrollTo({top:0})},[e==null?void 0:e.id]),u.jsxs("div",{className:"relative h-full flex flex-col bg-surface-2","data-testid":"notebook-panel",children:[u.jsx("div",{className:"px-3 pt-3 pb-1 shrink-0","data-testid":"notebook-tabs",children:u.jsxs("div",{className:"flex p-1 rounded-lg gap-1 bg-ink/[0.08]",role:"tablist","aria-label":"Notebook",children:[u.jsx(vo,{label:x("notebook.tab.explain"),icon:fn,active:T==="content",onClick:()=>A("content"),testid:"tab-content"}),u.jsx(vo,{label:x("notebook.tab.notes"),icon:I1,active:T==="notes",onClick:()=>{A("notes"),Hf()},testid:"tab-notes",badge:E.length>0?String(E.length):void 0}),u.jsx(vo,{label:x("notebook.tab.board"),icon:Da,active:T==="board",onClick:()=>A("board"),testid:"tab-board"})]})}),u.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 animate-tab-slide",ref:C,role:"tabpanel",children:T==="board"?u.jsx("div",{className:"h-full flex flex-col","data-testid":"board-tab-content",children:i?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"px-4 pt-3 pb-2 shrink-0 flex items-center gap-2 min-w-0",children:[u.jsx(Da,{className:"w-4 h-4 text-ink-muted shrink-0"}),u.jsx("span",{className:"text-label font-bold text-ink truncate",children:((_=i.output)==null?void 0:_.title)??i.toolName})]}),u.jsx("div",{className:"flex-1 min-h-0 px-2 pb-2",children:u.jsx("div",{className:"h-full rounded-xl overflow-hidden bg-surface-0/60 border border-[var(--border-faint)]",children:u.jsx(qs,{testid:"board-canvas-stage",children:u.jsx(_c,{data:i.output,variant:"canvas"})})})})]}):u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6",children:[u.jsx(Da,{className:"w-10 h-10 mb-3 text-ink-muted opacity-30"}),u.jsx("div",{className:"text-body text-ink-muted max-w-sm leading-relaxed",children:x("notebook.board.empty")})]})}):u.jsx(u.Fragment,{children:u.jsx("div",{className:"mx-auto w-full max-w-[960px] min-h-full flex flex-col",children:T==="content"?u.jsx(lN,{selectedNode:e,contentNotes:E.filter(w=>w.artifactType==="user_note"&&w.sourceAnchor),onQuoteToChat:p,onSaveContentNote:f,locale:g,isReviewing:s,onReviewDone:a}):u.jsx(cN,{items:E,loading:n,selectedNode:e,onRemove:l,onTogglePin:c,onRecordQuizResult:h,onUpdateNoteComment:m,onJumpToSource:d})})})},T)]})}function lN({selectedNode:e,contentNotes:t,onQuoteToChat:n,onSaveContentNote:r,locale:i,isReviewing:s,onReviewDone:a}){const o=_e(),l=Ic(),c=P0();v.useEffect(()=>{if(c.failReason){const O=c.failReason==="engine-unavailable"?"chat.speech.engine_unavailable":c.failReason==="azure-key-missing"?"chat.speech.azure_key_missing":c.failReason==="azure-region-missing"?"chat.speech.azure_region_missing":c.failReason==="edge-failed"?"chat.speech.edge_failed":"chat.speech.model_missing";l.show(o(O),{severity:"warning"}),c.clearFailReason()}else c.onlineNotice&&(l.show(o("chat.speech.edge_disclosed"),{severity:"info"}),c.clearOnlineNotice())},[c.failReason,c.onlineNotice,l,o,c]);const h=v.useRef(c.stop);h.current=c.stop;const f=e?`content-${e.id}`:null;v.useEffect(()=>()=>{h.current()},[f]);const[m,d]=v.useState(null),[p,g]=v.useState(!1),[x,b]=v.useState(!1),[k,T]=v.useState([]),[A,E]=v.useState(null),C=v.useRef(null),_=v.useRef(null);v.useEffect(()=>{if(!e){d(null),b(!1);return}let O=!1;return g(!0),b(!1),X.getNodeContent(e.id,i??void 0).then(L=>{O||d(L)}).catch(()=>{O||(d(null),b(!0))}).finally(()=>{O||g(!1)}),()=>{O=!0}},[e==null?void 0:e.id,i]),v.useEffect(()=>{if(!e){T([]);return}let O=!1;return X.listAssetsByNode(e.id).then(L=>{O||T(L)}).catch(()=>{O||T([])}),()=>{O=!0}},[e==null?void 0:e.id]),v.useEffect(()=>{if(!m||!C.current)return;const O=[];for(const I of t)try{const j=JSON.parse(I.sourceAnchor);if(j.type==="content"){const U=JSON.parse(I.data).text??"";U&&O.push({noteId:I.id,text:U,surrounding:j.surroundingText})}}catch{}const L=setTimeout(()=>{_.current&&p0(_.current,O)},80);return()=>clearTimeout(L)},[m,t]),v.useEffect(()=>{const O=L=>{var U;const I=L.detail;if(!I)return;const j=(U=_.current)==null?void 0:U.querySelector(`mark[data-note-id="${I}"]`);j&&k0(j)};return window.addEventListener("lookatstudy-jump-to-note",O),()=>window.removeEventListener("lookatstudy-jump-to-note",O)},[]);const w=c.speakingMessageId===f&&c.playingSentence!=null?c.playingSentence.index:null;v.useEffect(()=>{const O=_.current;if(!O)return;if(w==null){ir(O);return}const L=w0(c.streamTexts,w);if(!L)return;w===0&&v0(O);const I=setTimeout(()=>{const j=E0(O,L);if(!j)return;const U=j.startContainer.parentElement??j.startContainer,B=U.getBoundingClientRect(),W=O.closest(".overflow-y-auto"),D=W==null?void 0:W.getBoundingClientRect();(!D||B.top<D.top+48||B.bottom>D.bottom-48)&&U.scrollIntoView({behavior:"smooth",block:"center"})},30);return()=>clearTimeout(I)},[w,c.streamTexts,f]),v.useEffect(()=>{w==null&&_.current&&ir(_.current)},[w]);const N=v.useRef(!1);N.current=w!=null,v.useEffect(()=>()=>{N.current&&ir(document.body)},[]);const S=v.useCallback(()=>{var K;if(!n&&!r)return;const O=window.getSelection(),L=(O==null?void 0:O.toString().trim())??"";if(L.length<2||L.length>500){E(null);return}const I=O==null?void 0:O.getRangeAt(0);if(!I||!((K=C.current)!=null&&K.contains(I.commonAncestorContainer))){E(null);return}const j=I.getBoundingClientRect(),U=C.current.getBoundingClientRect(),B=_.current;let W=null;if(B&&B.contains(I.commonAncestorContainer)){const V=Is(B);W=d0(I,V)}const D=B?Is(B).text:L,q=W?W.start:D.indexOf(L),Z=q>=0?D.slice(Math.max(0,q-30),q+L.length+30):L,P=T0({left:j.left-U.left,top:j.top-U.top,right:j.right-U.left,bottom:j.bottom-U.top,width:j.width,height:j.height},U.width,n?150:100);E({x:P.left,y:P.top,transform:P.transform,text:L,surrounding:Z,offsets:W??void 0})},[n,r]);v.useEffect(()=>{let O=null,L=null;const I=()=>{O||(O=setTimeout(()=>{var U;O=null,(((U=window.getSelection())==null?void 0:U.toString().trim().length)??0)>=2?(L&&(clearTimeout(L),L=null),S()):L||(L=setTimeout(()=>E(B=>B&&null),250))},80))};return document.addEventListener("selectionchange",I),()=>{document.removeEventListener("selectionchange",I),O&&clearTimeout(O),L&&clearTimeout(L)}},[S]);const R=v.useCallback(()=>{var L;if(!A||!n)return;const O=A.text.length>200?A.text.slice(0,200)+"…":A.text;n(o("notebook.quote.template",{text:O})),E(null),(L=window.getSelection())==null||L.removeAllRanges()},[A,n,o]),M=v.useCallback(()=>{var L,I,j;if(!A||!r||!e)return;const O=A.text.length>200?A.text.slice(0,200)+"…":A.text;r(O,{type:"content",surroundingText:A.surrounding,startOffset:(L=A.offsets)==null?void 0:L.start,endOffset:(I=A.offsets)==null?void 0:I.end}),Hf(),setTimeout(()=>{var W;const U=(W=_.current)==null?void 0:W.querySelectorAll("mark.lookatstudy-underline"),B=U&&U.length>0?U[U.length-1]:null;B&&aA(B)},200),E(null),(j=window.getSelection())==null||j.removeAllRanges()},[A,r,e]);return e?u.jsxs("div",{className:"p-5 relative","data-testid":"node-content",ref:C,onMouseUp:S,children:[!p&&!x&&m&&u.jsx("div",{className:"sticky top-0 z-20 flex justify-end -mt-2 pointer-events-none",children:u.jsx("button",{onClick:()=>c.speak(f??"content",m),"data-tooltip":c.speakingMessageId===f?o("chat.speech.stop"):o("chat.speech.read_aloud_node"),"aria-label":c.speakingMessageId===f?o("chat.speech.stop"):o("chat.speech.read_aloud_node"),"data-testid":c.speakingMessageId===f?"node-content-speak-active":"node-content-speak",className:`pointer-events-auto shrink-0 rounded-full p-2 bg-surface-2 shadow-elevated transition-colors ${c.speakingMessageId===f?"text-brand animate-pulse":"text-ink-muted hover:text-ink-strong"}`,children:c.speakingMessageId===f?u.jsx(rc,{className:"w-4 h-4"}):u.jsx(em,{className:"w-4 h-4"})})}),u.jsx("div",{className:"text-caption font-bold text-brand uppercase tracking-wider mb-1",children:e.type==="section"?o("notebook.node_type.section"):e.type==="concept"?o("notebook.node_type.concept"):o("notebook.node_type.lesson")}),u.jsx("div",{className:"flex items-start justify-between gap-3 mb-4",children:u.jsx("h2",{className:"text-title font-extrabold text-ink-strong tracking-tight","data-testid":"node-content-title",children:e.title})}),p?u.jsxs("div",{className:"text-body text-ink-muted flex items-center gap-2",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),o("notebook.content.loading")]}):x?u.jsxs("div",{className:"text-body text-warning",children:[o("notebook.content.load_failed"),u.jsx("button",{className:"underline ml-1",onClick:()=>{b(!1),g(!0),X.getNodeContent(e.id,i??void 0).then(d).catch(()=>b(!0)).finally(()=>g(!1))},children:o("notebook.content.retry")})]}):m?u.jsx(X3,{fallback:(O,L)=>u.jsxs("div",{className:"prose prose-sm max-w-[80ch] leading-relaxed [&_pre]:max-w-full [&_pre]:overflow-x-auto",children:[u.jsx("div",{className:"text-body text-warning mb-2",children:o("notebook.content.render_failed")}),u.jsxs("pre",{className:"text-caption text-ink-muted whitespace-pre-wrap break-words bg-surface-1 p-3 rounded",children:[m.slice(0,500),m.length>500?`
|
|
515
|
+
`+o("notebook.content.truncated"):""]}),u.jsx("div",{className:"flex gap-2 mt-2",children:u.jsx("button",{className:"text-caption underline text-accent",onClick:L,children:o("notebook.content.retry_render")})})]}),children:u.jsx("div",{ref:_,className:"prose prose-sm max-w-[80ch] leading-relaxed break-words overflow-x-auto [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_img]:max-w-full [&_video]:max-w-full [&_iframe]:max-w-full select-text",children:u.jsx(Zm,{remarkPlugins:[wp],rehypePlugins:[i0,[c0,u0]],urlTransform:O=>O,components:{a({children:O,...L}){return u.jsx("a",{...L,target:"_blank",rel:"noopener noreferrer",children:O})},img({src:O,alt:L,...I}){return u.jsx(uN,{src:O,alt:L,assets:k,...I})},table({children:O}){return u.jsx("div",{className:"overflow-x-auto my-4",children:u.jsx("table",{children:O})})}},children:m})})},`${e.id}-${i??"orig"}`):u.jsx("div",{className:"text-body text-ink-muted",children:o("notebook.content.empty")}),k.length>0&&u.jsxs("div",{className:"mt-6 pt-4 border-t border-[var(--border-faint)]",children:[u.jsxs("div",{className:"text-label font-bold text-ink-muted mb-2 flex items-center gap-1",children:[u.jsx(k1,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:o("notebook.images.heading",{n:k.length})})]}),u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:k.map(O=>u.jsx(dN,{asset:O},O.id))})]}),A&&u.jsxs("div",{style:{left:A.x,top:A.y,transform:A.transform},className:"absolute z-20 flex items-center gap-0.5 msg-enter",children:[n&&u.jsxs("button",{onClick:R,"data-testid":"quote-to-chat-btn","aria-label":o("notebook.quote.ask"),className:"px-2 py-1.5 rounded-lg bg-brand text-white text-label font-bold shadow-elevated flex items-center gap-1 hover:bg-brand-light transition-colors",children:[u.jsx(Xf,{className:"w-3 h-3"}),o("notebook.quote.ask")]}),u.jsxs("button",{onClick:M,"data-testid":"save-note-btn","aria-label":o("notebook.quote.add_note"),className:"px-2 py-1.5 rounded-lg bg-accent text-white text-label font-bold shadow-elevated flex items-center gap-1 hover:brightness-110 transition",title:o("notebook.quote.save_note.title"),children:[u.jsx(Ts,{className:"w-3.5 h-3.5"}),o("notebook.quote.add_note")]})]}),e.sourcePath&&u.jsx("div",{className:"mt-6 pt-3 border-t border-[var(--border-faint)] text-label text-ink-muted",children:o("notebook.source.label",{path:e.sourcePath})}),u.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-accent/5 border border-accent/20 text-body text-ink-muted flex items-start gap-1.5",children:[u.jsx(Fi,{className:"w-3.5 h-3.5 shrink-0 mt-0.5 text-accent"}),u.jsx("span",{children:o("notebook.quote.hint")})]}),s&&e&&u.jsx(Q3,{nodeId:e.id,onRated:a})]}):u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6",children:[u.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"📖"}),u.jsx("div",{className:"text-body text-ink-muted max-w-xs",children:o("notebook.empty.select_node")})]})}function cN({items:e,loading:t,selectedNode:n,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o}){const l=_e();if(!n)return u.jsx(sh,{message:l("notebook.empty.notes.title"),icon:"📓"});if(t)return u.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 text-body text-ink-muted",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),l("notebook.empty.notes.title")]});const c=e.filter(g=>["concept_map","compare_table","diagram","code_walkthrough"].includes(g.artifactType)),h=e.filter(g=>g.artifactType==="user_note"),f=e.filter(g=>g.artifactType==="quiz"),m=e.length,d=f.filter(g=>g.lastResult==="correct").length,p=f.filter(g=>g.lastResult==="wrong").length;return m===0?u.jsx(sh,{message:l("notebook.empty.no_notes_message"),icon:"🧩"}):u.jsxs("div",{className:"p-4 space-y-3","data-testid":"notes-list",children:[u.jsx(xo,{title:l("notebook.zone.understand"),icon:u.jsx(nc,{className:"w-4 h-4"}),subtitle:l("notebook.zone.understand.subtitle"),count:c.length,testid:"zone-understand",defaultOpen:!1,children:c.length===0?u.jsx(bo,{hint:l("notebook.zone.understand.empty_hint")}):c.map(g=>u.jsx(yo,{item:g,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o},g.id))}),u.jsx(xo,{title:l("notebook.zone.note"),icon:u.jsx(Ts,{className:"w-4 h-4"}),subtitle:l("notebook.zone.note.subtitle"),count:h.length,testid:"zone-note",defaultOpen:!1,children:h.length===0?u.jsx(bo,{hint:l("notebook.zone.note.empty_hint")}):h.map(g=>u.jsx(yo,{item:g,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o},g.id))}),u.jsx(xo,{title:l("notebook.zone.practice"),icon:u.jsx(Jl,{className:"w-4 h-4"}),subtitle:f.length>0?l("notebook.zone.practice.subtitle_stats",{total:f.length,correct:d,wrong:p}):l("notebook.zone.practice.subtitle_empty"),count:f.length,testid:"zone-practice",defaultOpen:!1,children:f.length===0?u.jsx(bo,{hint:l("notebook.zone.practice.empty_hint")}):f.map(g=>u.jsx(yo,{item:g,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o},g.id))})]})}function xo({title:e,icon:t,subtitle:n,count:r,testid:i,defaultOpen:s=!0,children:a}){const[o,l]=v.useState(s),c=v.useRef(!0),h=v.useRef(r);return v.useEffect(()=>{if(c.current){c.current=!1,h.current=r;return}r>h.current&&l(!0),h.current=r},[r]),u.jsxs("section",{className:"rounded-xl bg-surface-1 overflow-hidden","data-testid":i,children:[u.jsxs("button",{onClick:()=>l(f=>!f),"aria-expanded":o,className:"w-full flex items-center gap-2 px-3 py-2.5 bg-surface-1/50 hover:bg-surface-3/60 transition-colors text-left","data-testid":`${i}-toggle`,children:[u.jsx(Zl,{className:`w-4 h-4 text-ink-muted transition-transform duration-200 ease-out-back ${o?"":"-rotate-90"}`}),u.jsx("span",{className:"text-body text-ink-strong flex items-center",children:t}),u.jsx("span",{className:"text-body font-bold text-ink",children:e}),u.jsx("span",{className:"text-caption font-bold px-1.5 py-0.5 rounded-full bg-brand/15 text-brand",children:r}),u.jsx("span",{className:"text-label text-ink-muted ml-auto truncate",children:n})]}),u.jsx("div",{className:"grid transition-all duration-200 ease-out-expo",style:{gridTemplateRows:o?"1fr":"0fr"},children:u.jsx("div",{className:"overflow-hidden",children:u.jsx("div",{className:"p-3 space-y-3",children:a})})})]})}function bo({hint:e}){return u.jsx("div",{className:"text-center py-3 text-body text-ink-muted",children:e})}function yo({item:e,onRemove:t,onTogglePin:n,onRecordQuizResult:r,onUpdateNoteComment:i,onJumpToSource:s}){const a=_e(),[o,l]=v.useState(!1),[c,h]=v.useState(e.notes??""),f=v.useCallback((T,A,E)=>{e.nodeId&&X.recordQuizAnswer(e.nodeId,E).catch(()=>{}),r(e.id,E)},[e.nodeId,e.id,r]),m=e.artifactType==="user_note";let d="",p=null;if(m){try{d=JSON.parse(e.data).text??""}catch{d=e.title??""}try{e.sourceAnchor&&(p=JSON.parse(e.sourceAnchor))}catch{p=null}}let g=null;if(!m)try{g=JSON.parse(e.data)}catch{g=null}const x=new Date(e.createdAt),b=`${x.getMonth()+1}/${x.getDate()} ${x.getHours().toString().padStart(2,"0")}:${x.getMinutes().toString().padStart(2,"0")}`;if(m){const T=e.notes&&e.notes.trim().length>0?e.notes:null,A=()=>{h(T??""),l(!0)},E=()=>{h(T??""),l(!1)},C=()=>{i==null||i(e.id,c),l(!1)};return u.jsx("div",{className:`bg-surface-2 rounded-lg p-3 relative ${e.pinned?"ring-1 ring-brand/40 bg-brand/5":""}`,"data-testid":`canvas-item-${e.id.slice(0,8)}`,children:u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx(D1,{className:"w-4 h-4 text-accent shrink-0 mt-0.5"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body text-ink leading-relaxed whitespace-pre-wrap",children:d}),i&&o?u.jsxs("div",{className:"mt-2 space-y-1.5","data-testid":`note-comment-edit-${e.id.slice(0,8)}`,children:[u.jsx("textarea",{value:c,onChange:_=>h(_.target.value),rows:2,placeholder:a(T?"notebook.note.comment.ph_edit":"notebook.note.comment.ph_new"),className:"w-full text-label leading-relaxed p-2 rounded-md border border-[var(--border-faint)] bg-surface-0 text-ink resize-none focus:outline-none focus:border-brand","data-testid":`note-comment-textarea-${e.id.slice(0,8)}`}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{onClick:C,className:"inline-flex items-center gap-1 text-caption font-bold text-white bg-brand hover:bg-brand/90 px-2 py-0.5 rounded","data-testid":`note-comment-save-${e.id.slice(0,8)}`,children:[u.jsx(Bt,{className:"w-3 h-3"})," ",a("notebook.action.save")]}),u.jsxs("button",{onClick:E,className:"inline-flex items-center gap-1 text-caption text-ink-muted hover:text-ink","data-testid":`note-comment-cancel-${e.id.slice(0,8)}`,children:[u.jsx(Kt,{className:"w-3 h-3"})," ",a("notebook.action.cancel")]})]})]}):T?u.jsxs("div",{className:"mt-2 px-2.5 py-1.5 rounded-lg bg-ink/5",children:[u.jsx("div",{className:"text-label text-ink-muted italic leading-relaxed whitespace-pre-wrap",children:T}),i&&u.jsxs("button",{onClick:A,className:"mt-1 inline-flex items-center gap-0.5 text-caption text-ink-muted hover:text-accent","data-testid":`note-comment-edit-btn-${e.id.slice(0,8)}`,title:a("notebook.note.edit_comment"),children:[u.jsx(Ts,{className:"w-2.5 h-2.5"})," ",a("notebook.note.edit_comment")]})]}):i?u.jsxs("button",{onClick:A,className:"mt-2 inline-flex items-center gap-0.5 text-caption text-ink-muted hover:text-accent","data-testid":`note-comment-add-${e.id.slice(0,8)}`,title:a("notebook.note.add_comment"),children:[u.jsx(Ts,{className:"w-2.5 h-2.5"})," ",a("notebook.note.add_comment")]}):null,p&&s&&u.jsx("button",{onClick:()=>s(p,d,e.id),className:"mt-2 inline-flex items-center gap-1 text-caption text-accent hover:underline font-bold","data-testid":`note-source-${e.id.slice(0,8)}`,children:p.type==="content"?u.jsxs(u.Fragment,{children:[u.jsx(fn,{className:"w-3 h-3"}),a("notebook.source.jump_content")]}):u.jsxs(u.Fragment,{children:[u.jsx(Xf,{className:"w-3 h-3"}),a("notebook.source.jump_chat")]})}),u.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[u.jsx("span",{className:"text-caption text-ink-muted",children:b}),u.jsx("button",{onClick:()=>t(e.id),className:"text-caption text-ink-muted hover:text-warning","data-testid":`canvas-delete-${e.id.slice(0,8)}`,title:a("notebook.note.delete"),children:u.jsx(Ko,{className:"w-3 h-3"})})]})]})]})})}const k=sN[e.artifactType]??Qf;return u.jsxs("div",{className:`bg-surface-2 rounded-lg p-3 relative ${e.pinned?"ring-1 ring-brand/40 bg-brand/5":""}`,"data-testid":`canvas-item-${e.id.slice(0,8)}`,children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx("span",{className:"text-body inline-flex items-center text-ink-strong",children:u.jsx(k,{className:"w-4 h-4"})}),u.jsx("span",{className:"text-label font-bold text-ink-muted flex-1 truncate",children:e.title??aN(a,e.artifactType)}),e.artifactType==="quiz"&&e.lastResult&&u.jsx("span",{className:`text-caption font-bold px-1.5 py-0.5 rounded-full ${e.lastResult==="correct"?"bg-brand/15 text-brand":"bg-warning/15 text-warning"}`,"data-testid":`quiz-result-${e.id.slice(0,8)}`,children:e.lastResult==="correct"?a("notebook.quiz.last_correct"):a("notebook.quiz.last_wrong")}),e.pinned?u.jsxs("span",{className:"text-caption text-brand font-bold flex items-center gap-0.5",children:[u.jsx(wu,{className:"w-2.5 h-2.5"}),a("notebook.note.pinned")]}):null,u.jsx("button",{onClick:()=>n(e.id),className:"text-caption text-ink-muted hover:text-brand","data-testid":`canvas-pin-${e.id.slice(0,8)}`,title:e.pinned?a("notebook.note.unpin"):a("notebook.note.pin"),children:u.jsx(wu,{className:"w-3 h-3"})}),u.jsx("button",{onClick:()=>t(e.id),className:"text-caption text-ink-muted hover:text-warning","data-testid":`canvas-delete-${e.id.slice(0,8)}`,title:a("notebook.note.delete"),children:u.jsx(Ko,{className:"w-3 h-3"})})]}),u.jsx("div",{className:"text-label",children:g?u.jsx(_c,{data:g,onQuizAnswered:f}):u.jsx("div",{className:"text-ink-muted",children:a("notebook.artifact.broken")})}),u.jsx("div",{className:"text-caption text-ink-muted mt-2",children:b})]})}function sh({message:e,icon:t}){return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6","data-testid":"empty-notebook",children:[u.jsx("div",{className:"text-4xl mb-3 opacity-30",children:t}),u.jsx("div",{className:"text-body text-ink-muted max-w-xs leading-relaxed",children:e})]})}function vo({label:e,icon:t,active:n,onClick:r,testid:i,badge:s}){return u.jsxs("button",{onClick:r,"data-testid":i,role:"tab","aria-selected":n,className:`flex-1 flex items-center justify-center gap-1 py-1.5 rounded-md text-label font-bold transition-colors ${n?"bg-brand/20 text-brand":"text-ink-muted hover:text-ink-strong"}`,children:[u.jsx(t,{className:"w-3 h-3"}),u.jsx("span",{children:e}),s&&u.jsx("span",{className:`text-caption px-1.5 py-0.5 rounded-full font-bold ${n?"bg-brand/30 text-brand":"bg-ink/10 text-ink-faint"}`,children:s})]})}function uN({src:e,alt:t,assets:n,...r}){const[i,s]=v.useState(null),a=e??"",o=v.useMemo(()=>{if(!a||a.startsWith("http")||a.startsWith("data:"))return null;const c=a.split("/").pop()??a;return n.find(h=>{var f;return(f=h.sourcePath)==null?void 0:f.endsWith(c)})??n.find(h=>h.filename===c)??null},[a,n]);if(v.useEffect(()=>{if(!o){s(null);return}let c=!1;return X.getAssetDataUrl(o.id).then(h=>{c||s(h)}),()=>{c=!0}},[o]),!a)return null;const l=i??a;return u.jsx("img",{src:l,alt:t??"","data-asset-id":o==null?void 0:o.id,className:"rounded-lg max-w-full h-auto my-3",loading:"lazy",...r})}function dN({asset:e}){const t=_e(),[n,r]=v.useState(null),[i,s]=v.useState(!1);return v.useEffect(()=>{let a=!1;return X.getAssetDataUrl(e.id).then(o=>{a||r(o)}),()=>{a=!0}},[e.id]),u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>s(!0),className:"block rounded-lg overflow-hidden bg-ink/5 dark:bg-ink/10 hover:ring-2 hover:ring-accent transition-all",title:e.altText??e.filename,children:n?u.jsx("img",{src:n,alt:e.altText??e.filename,"data-asset-id":e.id,className:"w-full h-24 object-cover",loading:"lazy"}):u.jsx("div",{className:"w-full h-24 flex items-center justify-center text-ink-faint text-caption",children:t("notebook.asset.loading")})}),i&&n&&u.jsxs("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-8 cursor-pointer",onClick:()=>s(!1),children:[u.jsx("img",{src:n,alt:e.altText??e.filename,"data-asset-id":e.id,className:"max-w-[90vw] max-h-[90vh] object-contain rounded-lg"}),u.jsx("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white","aria-label":t("action.close"),onClick:a=>{a.stopPropagation(),s(!1)},children:u.jsx(Kt,{className:"w-6 h-6"})})]})]})}function hN(e){const[t,n]=v.useState([]),[r,i]=v.useState(!0),s=v.useCallback(async()=>{if(!e){n([]),i(!1);return}try{const p=await X.canvasList(e);n(p)}catch{n([])}finally{i(!1)}},[e]);v.useEffect(()=>{s()},[s]);const a=v.useCallback(async p=>{if(!e)return null;try{const g=await X.canvasSave({...p,courseId:e});return n(x=>x.some(b=>b.id===g.id)?x:[g,...x]),g}catch{return null}},[e]),o=v.useCallback(async p=>{if(!e)return null;try{const g=await X.canvasSaveUserNote({...p,courseId:e});return n(x=>[g,...x]),g}catch{return null}},[e]),l=v.useCallback(async(p,g)=>{try{const x=await X.canvasRecordQuizResult(p,g);return x&&n(b=>b.map(k=>k.id===p?x:k)),x}catch{return null}},[]),c=v.useCallback(async(p,g)=>{try{const x=await X.canvasUpdateUserNoteComment(p,g);return x&&n(b=>b.map(k=>k.id===p?x:k)),x}catch{return null}},[]),h=v.useCallback(async p=>{try{await X.canvasDelete(p),n(g=>g.filter(x=>x.id!==p))}catch{}},[]),f=v.useCallback(async p=>{try{const g=await X.canvasTogglePin(p);g&&n(x=>x.map(k=>k.id===p?g:k).sort((k,T)=>T.pinned!==k.pinned?T.pinned-k.pinned:T.createdAt.localeCompare(k.createdAt)))}catch{}},[]),m=v.useCallback(p=>p===null?t:t.filter(g=>g.nodeId===p),[t]),d=v.useCallback((p,g)=>{const x=p===null?t:t.filter(b=>b.nodeId===p);return g==="note"?x.filter(b=>b.artifactType==="user_note"):g==="practice"?x.filter(b=>b.artifactType==="quiz"):x.filter(b=>["concept_map","compare_table","diagram","code_walkthrough"].includes(b.artifactType))},[t]);return{items:t,loading:r,reload:s,save:a,saveUserNote:o,recordQuizResult:l,updateUserNoteComment:c,remove:h,togglePin:f,byNode:m,byZone:d}}const ih={small:16,medium:17,large:18},ah="lookatstudy-font-size",fN="medium";function mN(){const[e,t]=v.useState(()=>{if(typeof localStorage<"u"){const r=localStorage.getItem(ah);if(r&&r in ih)return r}return fN});v.useEffect(()=>{document.documentElement.style.fontSize=`${ih[e]}px`,localStorage.setItem(ah,e)},[e]);const n=v.useCallback(r=>{t(i=>{const s=["small","medium","large"],a=s.indexOf(i),o=r==="up"?Math.min(a+1,s.length-1):Math.max(a-1,0);return s[o]})},[]);return{size:e,bump:n}}const Eo=new Map;function pN({ref_:e,onOpen:t}){const n=_e(),[r,i]=v.useState(e.previewUrl??(e.file?Eo.get(e.file)??null:null));return v.useEffect(()=>{if(r||!e.file)return;let s=!1;return(async()=>{const a=Eo.get(e.file);if(a){s||i(a);return}const o=await X.getAttachmentDataUrl(e.file);o&&!s&&(Eo.set(e.file,o),i(o))})(),()=>{s=!0}},[e.file,r]),r?u.jsx("button",{type:"button",onClick:()=>t(r),"aria-label":n("chat.attach.preview",{name:e.name}),className:"w-24 h-24 rounded-lg overflow-hidden border border-[var(--border)] hover:border-accent transition-colors shrink-0",children:u.jsx("img",{src:r,alt:e.name,className:"w-full h-full object-cover"})}):u.jsx("div",{className:"w-24 h-24 rounded-lg bg-ink/[0.06] flex items-center justify-center text-caption text-ink-faint",title:e.name,children:e.name.slice(0,8)})}function gN({src:e,name:t,onClose:n}){return v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n]),u.jsxs("div",{role:"dialog","aria-label":t,className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center p-8 cursor-zoom-out animate-[toast-enter_.15s_ease-out]",onClick:n,"data-testid":"attachment-lightbox",children:[u.jsx("img",{src:e,alt:t,className:"max-w-full max-h-full object-contain rounded-lg shadow-elevated"}),u.jsx("button",{type:"button","aria-label":"close",onClick:n,className:"absolute top-4 right-4 w-9 h-9 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center transition-colors",children:u.jsx(Kt,{className:"w-4 h-4"})})]})}function xN({parts:e}){const t=_e(),[n,r]=v.useState(null),i=e.filter(o=>o.type==="attachment").map(o=>o.attachment);if(i.length===0)return null;const s=i.filter(o=>o.kind==="image"),a=i.filter(o=>o.kind==="text");return u.jsxs("div",{className:"flex flex-col gap-1.5 mb-1","data-testid":"message-attachments",children:[s.length>0&&u.jsx("div",{className:"flex gap-1.5 flex-wrap",children:s.map((o,l)=>u.jsx(pN,{ref_:o,onOpen:c=>r({src:c,name:o.name})},o.file??o.previewUrl??`${o.name}:${l}`))}),a.length>0&&u.jsx("div",{className:"flex gap-1.5 flex-wrap",children:a.map((o,l)=>u.jsxs("span",{"data-tooltip":t("chat.attach.textChip"),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-ink/[0.06] text-caption text-ink-muted",children:[u.jsx(Ds,{className:"w-3 h-3 shrink-0"}),u.jsx("span",{className:"truncate max-w-[12rem]",children:o.name})]},`${o.name}:${l}`))}),n&&u.jsx(gN,{src:n.src,name:n.name,onClose:()=>r(null)})]})}function bN({messages:e,streaming:t,onApplyProposal:n,onRejectProposal:r,summary:i,onStartLearning:s,agentReady:a=!0,onGotoSettings:o,hasNode:l=!0,selectedNodeId:c,threadId:h,onSaveChatNote:f,chatNotes:m,onPickQuizAction:d,onQuizCompleted:p,cardMode:g=!1}){const x=_e(),b=Ic(),k=P0();v.useEffect(()=>{if(k.failReason){const U=k.failReason==="engine-unavailable"?"chat.speech.engine_unavailable":k.failReason==="azure-key-missing"?"chat.speech.azure_key_missing":k.failReason==="azure-region-missing"?"chat.speech.azure_region_missing":k.failReason==="edge-failed"?"chat.speech.edge_failed":k.failReason==="custom-provider-missing"?"chat.speech.custom_provider_missing":"chat.speech.model_missing";b.show(x(U),{severity:"warning"}),k.clearFailReason()}},[k.failReason,b,x,k]),v.useEffect(()=>{k.onlineNotice&&(b.show(x("chat.speech.edge_disclosed"),{severity:"info"}),k.clearOnlineNotice())},[k.onlineNotice,b,x,k]);const T=v.useCallback((U,B,W)=>{c&&X.recordQuizAnswer(c,W,U.kc).catch(()=>{})},[c]),[A,E]=v.useState(null);v.useEffect(()=>{if(!c){E(null);return}let U=!1;const B=()=>X.getProgress(c).then(D=>{U||E((D==null?void 0:D.mastery)??null)}).catch(()=>{});B();const W=X.on("state:changed",D=>{D==="mastery"&&B()});return()=>{U=!0,W()}},[c]);const C=v.useRef(null),_=v.useRef(!0),[w,N]=v.useState(!1);v.useEffect(()=>{const U=B=>{const W=B.detail;if(!(W!=null&&W.msgId))return;const D=document.querySelector(`[data-msg-id="${W.msgId}"]`);D&&(D.scrollIntoView({behavior:"smooth",block:"center"}),D.classList.add("ring-2","ring-accent","rounded-lg"),setTimeout(()=>D.classList.remove("ring-2","ring-accent","rounded-lg"),2500))};return window.addEventListener("lookatstudy-highlight-message",U),()=>window.removeEventListener("lookatstudy-highlight-message",U)},[]),v.useEffect(()=>{if(t||!C.current||!m||m.length===0)return;const U=setTimeout(()=>{if(!C.current)return;const B=new Map;for(const W of m)try{const D=JSON.parse(W.sourceAnchor);if(D.type==="chat"&&D.msgId){const q=JSON.parse(W.data).text??"";if(q){const Z=B.get(D.msgId)??[];Z.push({noteId:W.id,text:q}),B.set(D.msgId,Z)}}}catch{}for(const[W,D]of B){const q=C.current.querySelector(`[data-msg-id="${W}"]`);q&&p0(q,D)}},150);return()=>clearTimeout(U)},[e,m,t]),v.useEffect(()=>{const U=B=>{var q;const W=B.detail;if(!W)return;const D=(q=C.current)==null?void 0:q.querySelector(`mark[data-note-id="${W}"]`);D&&k0(D)};return window.addEventListener("lookatstudy-jump-to-chat-note",U),()=>window.removeEventListener("lookatstudy-jump-to-chat-note",U)},[]);const[S,R]=v.useState(null),M=v.useCallback(()=>{if(!f||!h)return;const U=window.getSelection(),B=(U==null?void 0:U.toString().trim())??"";if(B.length<2||B.length>500){R(null);return}const W=U==null?void 0:U.getRangeAt(0);if(!W){R(null);return}const D=C.current;if(!(D!=null&&D.contains(W.commonAncestorContainer))){R(null);return}let q=W.commonAncestorContainer,Z=null;for(;q&&q!==D;){if(q instanceof HTMLElement&&q.dataset.msgId){Z=q;break}q=q.parentNode}if(!Z){R(null);return}const P=Z.dataset.msgId,K=Is(Z),V=d0(W,K),$=W.getBoundingClientRect(),ae=D.getBoundingClientRect(),ne=T0({left:$.left-ae.left,top:$.top-ae.top,right:$.right-ae.left,bottom:$.bottom-ae.top,width:$.width,height:$.height},ae.width,110);R({x:ne.left,y:ne.top,transform:ne.transform,text:B,msgId:P,startOffset:V==null?void 0:V.start,endOffset:V==null?void 0:V.end})},[f,h]);v.useEffect(()=>{let U=null,B=null;const W=()=>{U&&clearTimeout(U),U=setTimeout(()=>{var q;(((q=window.getSelection())==null?void 0:q.toString().trim().length)??0)>=2?(B&&(clearTimeout(B),B=null),M()):B||(B=setTimeout(()=>R(Z=>Z&&null),250))},250)};return document.addEventListener("selectionchange",W),()=>{document.removeEventListener("selectionchange",W),U&&clearTimeout(U),B&&clearTimeout(B)}},[M]);const O=v.useCallback(()=>{var B;if(!S||!f)return;const U=S.text.length>200?S.text.slice(0,200)+"…":S.text;f(U,S.msgId,S.startOffset,S.endOffset),R(null),(B=window.getSelection())==null||B.removeAllRanges()},[S,f]),L=v.useCallback(()=>{const U=C.current;if(!U)return;const B=U.scrollHeight-U.scrollTop-U.clientHeight<80;_.current=B,N(W=>W===!B?W:!B)},[]);v.useEffect(()=>{if(!_.current)return;const U=C.current;U&&(U.scrollTop=U.scrollHeight)},[e,t]);const I=e.length>0&&e[e.length-1].role==="user";v.useEffect(()=>{if(!I)return;_.current=!0,N(!1);const U=C.current;U&&(U.scrollTop=U.scrollHeight)},[I]);const j=v.useCallback(()=>{const U=C.current;U&&(U.scrollTop=U.scrollHeight,_.current=!0,N(!1))},[]);return u.jsxs("div",{className:"relative flex-1 min-h-0",children:[u.jsxs("div",{ref:C,onScroll:L,onMouseUp:M,className:`h-full overflow-y-auto px-3 py-4 space-y-2 relative ${g?"":"px-5 py-6 space-y-6"}`,"data-testid":"chat-stream",children:[e.length===0&&u.jsx("div",{className:"mt-10 mx-auto max-w-md","data-testid":"chat-empty-state",children:l?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"text-center mb-4",children:[u.jsx("div",{className:"text-4xl mb-2 opacity-30",children:"📖"}),u.jsx("div",{className:"text-body font-bold text-ink-muted mb-1",children:x("chat.empty.greeting")}),u.jsx("div",{className:"text-ink-muted text-label",children:x("chat.empty.overview")})]}),i?u.jsxs("div",{className:"surface-card p-4 mb-4",children:[u.jsx("div",{className:"text-caption font-bold text-brand uppercase tracking-wider mb-2",children:x("chat.empty.summary.title")}),u.jsx("div",{className:"text-body text-ink-muted leading-relaxed whitespace-pre-wrap",children:i})]}):u.jsx("div",{className:"surface-card p-4 mb-4 text-center",children:u.jsx("div",{className:"text-body text-ink-muted",children:x("chat.empty.summary.none")})}),a?u.jsx(u.Fragment,{children:s&&u.jsxs("button",{onClick:s,disabled:t,"data-testid":"start-learning-btn",className:"btn-3d-brand w-full py-3 text-body font-bold flex items-center justify-center gap-2 disabled:opacity-40",children:[u.jsx(O1,{className:"w-4 h-4"}),u.jsx("span",{children:x("chat.empty.start")})]})}):u.jsxs("div",{className:"surface-card p-4 mb-2","data-testid":"keyless-card",children:[u.jsx("div",{className:"text-body font-bold text-ink-muted mb-1",children:x("chat.empty.keyless.title")}),u.jsx("div",{className:"text-label text-ink-muted mb-3",children:x("chat.empty.keyless.desc")}),u.jsxs("button",{onClick:o,className:"btn-3d-brand w-full py-2 text-body font-bold flex items-center justify-center gap-2",children:[u.jsx(Bi,{className:"w-4 h-4"}),u.jsx("span",{children:x("chat.empty.keyless.btn")})]})]})]}):u.jsxs("div",{className:"text-center mt-16","data-testid":"no-node-selected",children:[u.jsx("div",{className:"text-5xl mb-3 opacity-25",children:"🗺️"}),u.jsx("div",{className:"text-body font-bold text-ink-muted mb-1",children:x("chat.empty.no_node.title")}),u.jsx("div",{className:"text-body text-ink-muted max-w-xs mx-auto",children:x("chat.empty.no_node.desc")})]})}),e.map(U=>u.jsx("div",{className:g?"":"contents",children:u.jsx("div",{className:g&&U.role==="assistant"?"surface-card p-4 rounded-2xl shadow-card":void 0,children:u.jsx(yN,{msg:U,onApplyProposal:n,onRejectProposal:r,onQuizAnswered:T,quizMastery:A,onPickAction:d,onQuizCompleted:p,speakingMessageId:k.speakingMessageId,speakingSentence:k.speakingSentence,playingSentence:k.playingSentence,streamTexts:k.streamTexts,onSpeak:k.speak})})},U.id)),t&&u.jsxs("div",{className:"flex items-center gap-1.5 text-body text-brand",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"})]})]}),w&&e.length>0&&u.jsxs("button",{onClick:j,"data-testid":"scroll-to-bottom","aria-label":x("chat.scroll.bottom"),title:x("chat.scroll.bottom"),className:"absolute bottom-4 right-4 w-9 h-9 rounded-full bg-ink-strong text-surface-0 shadow-elevated flex items-center justify-center hover:scale-105 active:scale-95 transition-transform msg-enter",children:[u.jsx(Zl,{className:"w-5 h-5"}),t&&u.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2.5 h-2.5 bg-brand rounded-full border-2 border-[var(--ink-strong)] animate-pulse"})]}),S&&u.jsxs("button",{onClick:O,"data-testid":"save-chat-note-btn",style:{left:S.x,top:S.y,transform:S.transform},className:"absolute z-20 px-3 py-1.5 rounded-lg bg-brand text-white text-body font-bold shadow-elevated flex items-center gap-1 hover:bg-brand-light transition msg-enter",title:x("chat.note.add.title"),children:[u.jsx(Ts,{className:"w-3 h-3"})," ",x("chat.note.add")]})]})}function oh(e){const t=[];for(const n of e)if(n.role==="assistant")for(let r=0;r<n.parts.length;r++){const i=n.parts[r];i.type==="tool-call"&&i.state==="output-available"&&i.output&&typeof i.output=="object"&&"artifactType"in i.output&&t.push({id:`${n.id}-${r}`,toolName:i.toolName,output:i.output})}return t}function yN({msg:e,onApplyProposal:t,onRejectProposal:n,onQuizAnswered:r,quizMastery:i,onPickAction:s,onQuizCompleted:a,speakingMessageId:o,speakingSentence:l,playingSentence:c,streamTexts:h,onSpeak:f}){const m=_e(),d=v.useRef(null),p=e.parts.map(k=>k.type==="text"?k.text:"").join("").trim(),g=o===e.id,x=g&&c!=null?c.index:null;v.useEffect(()=>{const k=d.current;if(!k)return;if(x==null){ir(k);return}const T=w0(h??[],x);if(!T)return;x===0&&v0(k);const A=setTimeout(()=>{const E=E0(k,T,{within:'[data-testid="part-text"]'});if(!E)return;const C=E.startContainer.parentElement??E.startContainer,_=C.getBoundingClientRect(),w=k.closest(".overflow-y-auto"),N=w==null?void 0:w.getBoundingClientRect();(!N||_.top<N.top+48||_.bottom>N.bottom-48)&&C.scrollIntoView({behavior:"smooth",block:"center"})},30);return()=>clearTimeout(A)},[x,h]),v.useEffect(()=>{x==null&&d.current&&ir(d.current)},[x]);const b=v.useRef(!1);return b.current=x!=null,v.useEffect(()=>()=>{b.current&&ir(document.body)},[]),e.role==="user"?u.jsx("div",{className:"msg-enter flex justify-end","data-testid":"msg-user","data-msg-id":e.id,children:u.jsxs("div",{className:"max-w-[85%] bg-ink/[0.04] rounded-2xl rounded-br-md px-4 py-2.5",children:[u.jsx(xN,{parts:e.parts}),u.jsx("div",{className:"font-medium text-ink-strong whitespace-pre-wrap select-text text-body",children:e.displayText??e.parts.map((k,T)=>k.type==="text"?u.jsx("span",{children:k.text},T):null)})]})}):u.jsxs("div",{className:"msg-enter",ref:d,"data-testid":"msg-assistant","data-msg-id":e.id,children:[u.jsx("div",{className:"min-w-0 space-y-2.5",children:e.parts.map((k,T)=>u.jsx(vN,{part:k,msgId:e.id,toolCallIdx:T,onApplyProposal:t,onRejectProposal:n,onQuizAnswered:r,quizMastery:i,onPickAction:s,onQuizCompleted:a},T))}),f&&p&&u.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[u.jsx("button",{onClick:()=>f(e.id,p),"data-testid":g?"speech-stop-btn":"speech-speak-btn","aria-label":m(g?"chat.speech.stop":"chat.speech.speak"),title:m(g?"chat.speech.stop":"chat.speech.speak"),className:`w-7 h-7 rounded-lg flex items-center justify-center transition ${g?"bg-brand/15 text-brand":"text-ink-muted hover:bg-ink/[0.06] hover:text-ink"}`,children:g?u.jsx(rc,{className:"w-3.5 h-3.5"}):u.jsx(em,{className:"w-4 h-4"})}),g&&l&&l.total>0&&u.jsx("span",{className:"text-caption text-ink-muted",children:m("chat.speech.progress").replace("{n}",String(l.index+1)).replace("{total}",String(l.total))})]})]})}function vN({part:e,msgId:t,toolCallIdx:n,onApplyProposal:r,onRejectProposal:i,onQuizAnswered:s,quizMastery:a,onPickAction:o,onQuizCompleted:l}){if(e.type==="text")return u.jsx("div",{className:"prose prose-sm max-w-[80ch] leading-relaxed break-words [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_img]:max-w-full [&_video]:max-w-full [&_iframe]:max-w-full select-text","data-testid":"part-text",children:u.jsx(Zm,{remarkPlugins:[wp],rehypePlugins:[i0,[c0,u0]],urlTransform:d=>d,components:wN,children:e.text})});if(e.type==="reasoning")return u.jsx(EN,{text:e.text});if(e.type!=="tool-call")return null;const{toolName:c,state:h,output:f,error:m}=e;return u.jsx(kN,{toolName:c,state:h,output:f,error:m,msgId:t,toolCallIdx:n,onApplyProposal:r,onRejectProposal:i,onQuizAnswered:s,quizMastery:a,onPickAction:o,onQuizCompleted:l})}function EN({text:e}){const t=_e(),[n,r]=v.useState(!1);return u.jsxs("div",{className:"rounded-lg bg-surface-1/60 border border-[var(--border-faint)]","data-testid":"part-reasoning",children:[u.jsxs("button",{onClick:()=>r(i=>!i),className:"w-full flex items-center justify-between px-3 py-1.5 text-label font-bold text-ink-muted hover:text-ink-strong transition-colors",children:[u.jsxs("span",{children:[n?"▾":"▸"," ",t("chat.reasoning.label")]}),u.jsx("span",{className:"text-ink-muted font-normal",children:t("chat.reasoning.chars",{n:e.length})})]}),n&&u.jsx("div",{className:"px-3 pb-2.5 text-label text-ink-muted whitespace-pre-wrap leading-relaxed border-t border-[var(--border-faint)]/60 pt-2",children:e})]})}function kN({toolName:e,state:t,output:n,error:r,msgId:i,toolCallIdx:s,onApplyProposal:a,onRejectProposal:o,onQuizAnswered:l,quizMastery:c,onPickAction:h,onQuizCompleted:f}){const m=_e(),p=(e==="record_answer"||e==="mark_mastered")&&t==="output-available"&&typeof n=="object"&&n!==null?n:null;if(p!=null&&p.proposalId){const b=p.status;return b==="applied"?u.jsxs("div",{className:"proposal-card rounded-xl border border-gold/30 bg-gold/5 p-3 flex items-center gap-2","data-testid":"part-proposal",children:[u.jsx(tn,{className:"w-4 h-4 text-gold shrink-0"}),u.jsx("span",{className:"text-body font-bold text-ink",children:m("chat.proposal.applied")})]}):b==="rejected"?u.jsxs("div",{className:"proposal-card rounded-xl border border-ink/10 bg-ink/5 p-3 flex items-center gap-2","data-testid":"part-proposal",children:[u.jsx(m1,{className:"w-4 h-4 text-ink-muted shrink-0"}),u.jsx("span",{className:"text-body text-ink-muted",children:m("chat.proposal.rejected")})]}):u.jsxs("div",{className:"proposal-card relative rounded-xl border border-brand/30 bg-brand/5 overflow-hidden","data-testid":"part-proposal",children:[u.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-brand"}),u.jsxs("div",{className:"pl-4 pr-3 py-3",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx("span",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-brand/15 text-brand shrink-0",children:u.jsx(Kf,{className:"w-4 h-4"})}),u.jsx("span",{className:"text-lead font-bold text-ink",children:m("chat.proposal.mastered.title")})]}),p.message&&u.jsx("div",{className:"text-body text-ink mb-2 leading-relaxed",children:p.message}),u.jsx("div",{className:"text-caption text-ink-muted mb-3",children:m("chat.proposal.mastered.hint")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs("button",{onClick:()=>a==null?void 0:a(p.proposalId,i,s),"data-testid":"proposal-apply",className:"btn-3d-brand px-4 py-1.5 text-body",children:[u.jsx(Bt,{className:"w-3.5 h-3.5 inline"}),m("chat.proposal.confirm")]}),u.jsx("button",{onClick:()=>o==null?void 0:o(p.proposalId,i,s),"data-testid":"proposal-reject",className:"btn-3d-neutral px-4 py-1.5 text-body",children:m("chat.proposal.later")})]})]})]})}if(t==="output-available"&&n&&typeof n=="object"&&"artifactType"in n){const b=n.artifactType;return u.jsx("div",{className:"my-1 max-w-full","data-testid":`inline-artifact-${b}`,"data-tool":e,children:u.jsx(_c,{data:n,onQuizAnswered:l,quizMastery:c,onPickAction:h,onQuizCompleted:f})})}const x=SN(e,m);return u.jsx("div",{className:"inline-flex items-center gap-1.5 text-label px-2.5 py-1 rounded-md bg-surface-1/60 border border-[var(--border-faint)]","data-testid":"part-tool","data-tool":e,"data-state":t,children:t==="input-available"?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),u.jsxs("span",{className:"text-ink-muted",children:[x,"…"]})]}):t==="output-error"?u.jsxs(u.Fragment,{children:[u.jsx(lr,{className:"w-3.5 h-3.5 text-warning shrink-0"}),u.jsxs("span",{className:"text-warning",children:[x,": ",r]})]}):u.jsxs(u.Fragment,{children:[u.jsx(js,{className:"w-3.5 h-3.5 text-ink-faint shrink-0"}),u.jsx("span",{className:"text-ink-muted",children:x})]})})}const wN={pre({children:e,...t}){return u.jsx(TN,{...t,children:e})},a({children:e,...t}){return u.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",children:e})},table({children:e}){return u.jsx("div",{className:"overflow-x-auto my-4",children:u.jsx("table",{children:e})})}};function TN({children:e,...t}){const n=_e(),[r,i]=v.useState(!1),s=Array.isArray(e)?e[0]:e,a=(s==null?void 0:s.props)??{},o=/language-(\w+)/.exec(a.className??""),l=(o==null?void 0:o[1])??"",c=()=>{var m;const h=a.children,f=typeof h=="string"?h:Array.isArray(h)?h.join(""):"";(m=navigator.clipboard)==null||m.writeText(f).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})};return u.jsxs("div",{className:"relative group my-3","data-testid":"md-codeblock",children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-1 border border-b-0 border-[var(--border-faint)] rounded-t-md",children:[u.jsx("span",{className:"text-caption font-mono text-ink-faint uppercase tracking-wider",children:l||"code"}),u.jsx("button",{onClick:c,"aria-label":n("chat.copy"),className:"text-caption text-ink-muted hover:text-brand transition-colors opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100 inline-flex items-center gap-1","data-testid":"md-copy",children:r?u.jsxs(u.Fragment,{children:[u.jsx(Bt,{className:"w-3 h-3 inline"}),n("chat.copied")]}):u.jsxs(u.Fragment,{children:[u.jsx(p1,{className:"w-3 h-3 inline"}),n("chat.copy")]})})]}),u.jsx("pre",{...t,className:"!mt-0 !rounded-t-none !border-t-0",children:e})]})}function SN(e,t){return{get_node_info:t("chat.tool.get_node_info"),record_answer:t("chat.tool.record_answer"),mark_mastered:t("chat.tool.mark_mastered"),show_concept_map:t("chat.tool.show_concept_map"),generate_quiz:t("chat.tool.generate_quiz"),compare_table:t("chat.tool.compare_table"),draw_diagram:t("chat.tool.draw_diagram"),show_code_walkthrough:t("chat.tool.show_code_walkthrough")}[e]??e}const ys={maxPerMessage:4,maxImageBytes:5*1024*1024,maxTextBytes:256*1024},CN=new Set(["txt","md","markdown","rst","org","adoc","log","csv","tsv","json","yaml","yml","toml","ini","env","py","js","mjs","cjs","ts","tsx","jsx","go","rs","java","c","h","cpp","hpp","cs","rb","sh","bash","zsh","ps1","sql","html","htm","css","scss","vue","svelte","kt","swift","php","lua","r","dart","scala","clj","ex","exs","erl","hs","ml","jl","m","mm","pl","vb","bat","dockerfile"]);function lh(e){const t=e.lastIndexOf(".");return t<=0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function AN(e,t,n){return t&&t.startsWith("image/")||["png","jpg","jpeg","webp","gif","bmp"].includes(lh(e))?n>ys.maxImageBytes?{ok:!1,reason:"tooLargeImage"}:{ok:!0,kind:"image"}:CN.has(lh(e))?n>ys.maxTextBytes?{ok:!1,reason:"tooLargeText"}:{ok:!0,kind:"text"}:{ok:!1,reason:"unsupported"}}function NN(e,t){const n=e.length,r=n*2,i=new ArrayBuffer(44+r),s=new DataView(i),a=(l,c)=>{for(let h=0;h<c.length;h++)s.setUint8(l+h,c.charCodeAt(h))};a(0,"RIFF"),s.setUint32(4,36+r,!0),a(8,"WAVE"),a(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,t,!0),s.setUint32(28,t*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),a(36,"data"),s.setUint32(40,r,!0);let o=44;for(let l=0;l<n;l++){const c=e[l]<=-1?-1:e[l]>=1?1:e[l];s.setInt16(o,Math.round(c*32767),!0),o+=2}return i}function _N(e,t){const n=Math.floor(e.length/t),r=new Float32Array(n);for(let i=0;i<n;i++){const s=i*t,a=Math.floor(s),o=s-a,l=e[a]??0,c=e[a+1]??l;r[i]=l+(c-l)*o}return r}function IN(e,t,n={}){if(e.length===0||e.length!==t.length)return e;const r=n.threshold??.012;let i=0;for(;i<e.length-1&&t[i]<r;)i+=1;let s=e.length;for(;s>i+1&&t[s-1]<r;)s-=1;return e.slice(i,s)}function MN(e={}){const t=e.rmsThreshold??.015,n=e.minSpeechMs??300,r=e.silenceMs??1200,i=e.maxMs??6e4,s=e.autoStop!==!1;let a=null,o=0,l=null,c=null,h=!1;return{feed(f,m){a==null&&(a=m);const d=c==null?0:Math.max(0,m-c);if(c=m,f>=t)o+=d,o>=n&&(h=!0,l=m);else if(s&&h&&l!=null&&m-l>=r)return"auto-stop";return s&&m-a>=i?"auto-stop":"listening"},hadSpeech(){return h}}}const ko=16e3;function RN(e,t={}){const[n,r]=v.useState(!1),[i,s]=v.useState(!1),[a,o]=v.useState(0),[l,c]=v.useState(null),[h,f]=v.useState(null),m=v.useRef(null),d=v.useRef(null),p=v.useRef(null),g=v.useRef([]),x=v.useRef([]),b=v.useRef(!1),k=v.useRef(null),T=v.useRef(0),A=v.useRef(e);A.current=e;const E=v.useRef(t);E.current=t;const C=v.useRef(!1),_=v.useRef(!1),w=v.useCallback(()=>{var O,L,I;b.current=!1,(O=p.current)==null||O.disconnect(),p.current=null,(L=d.current)==null||L.getTracks().forEach(j=>j.stop()),d.current=null,(I=m.current)==null||I.close().catch(()=>{}),m.current=null,g.current=[],x.current=[],k.current=null,o(0)},[]),N=v.useCallback(()=>{var Z;const O=g.current,L=x.current,I=((Z=k.current)==null?void 0:Z.hadSpeech())??!1;g.current=[],x.current=[];let j=0;for(const P of O)j+=P.length;if(w(),r(!1),j===0)return;if(!I){f("no-speech");return}const U=IN(O,L);let B=0;for(const P of U)B+=P.length;const W=new Float32Array(B);let D=0;for(const P of U)W.set(P,D),D+=P.length;const q=NN(W,ko);s(!0),f(null),window.api.asrTranscribe(q,E.current.locale).then(P=>{P.ok?A.current(P.text):f(P.reason)}).catch(()=>f("asr-failed")).finally(()=>s(!1))},[w]),S=v.useCallback(()=>{b.current&&N()},[N]),R=v.useCallback(()=>{b.current||C.current||(c(null),C.current=!0,(async()=>{var O;try{if(((O=navigator.mediaDevices)==null?void 0:O.getUserMedia)==null){c(window.isSecureContext?"mic-unavailable":"mic-insecure-context");return}const L=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}}),I=window.AudioContext??window.webkitAudioContext;let j;try{j=new I({sampleRate:ko})}catch{j=new I}m.current=j,d.current=L,b.current=!0,k.current=MN({autoStop:E.current.autoStop!==!1});const U=j.createMediaStreamSource(L),B=j.createScriptProcessor(4096,1,1);p.current=B;const W=j.sampleRate/ko;B.onaudioprocess=q=>{var ae;if(!b.current)return;const Z=q.inputBuffer.getChannelData(0),P=W===1?new Float32Array(Z):_N(Z,W);g.current.push(P);let K=0;for(let ne=0;ne<P.length;ne++)K+=P[ne]*P[ne];const V=Math.sqrt(K/P.length);x.current.push(V),T.current=T.current*.7+V*.3,o(Math.min(1,T.current*8)),Dx(Math.min(1,T.current*8)),((ae=k.current)==null?void 0:ae.feed(V,performance.now()))==="auto-stop"&&b.current&&N()},U.connect(B);const D=j.createGain();D.gain.value=0,B.connect(D),D.connect(j.destination),r(!0),_.current&&(_.current=!1,N())}catch(L){w(),r(!1),c(L instanceof Error?L.message:String(L))}finally{C.current=!1}})())},[w,N]),M=v.useCallback(()=>{b.current?S():C.current&&(_.current=!0)},[S]);return v.useEffect(()=>()=>{b.current&&w()},[w]),{listening:n,transcribing:i,level:a,startError:l,transcribeError:h,clearTranscribeError:()=>f(null),beginHold:R,endHold:M}}function LN({onGotoSettings:e}){var g;const t=_e(),[n,r]=v.useState(!1),[i,s]=v.useState(null),[a,o]=v.useState(""),[l,c]=v.useState(""),h=v.useRef(null),f=v.useCallback(async()=>{var x,b;try{const[k,T,A,E]=await Promise.all([X.getProviderPresets(),X.listCustomProviders(),X.getSetting("active_provider"),X.getSetting("active_model")]),C=A??"glm",_=await Promise.all(k.map(async O=>await X.getSetting(O.apiKeySetting)!=null)),w=new Set;k.forEach((O,L)=>{(_[L]||O.id===C)&&w.add(O.id)});const N=[],S=(O,L,I)=>{for(const j of I)N.push({providerId:O,providerLabel:L,modelId:j.id,modelLabel:j.label,vision:(j.capabilities??[]).includes("vision"),contextWindow:j.contextWindow})};for(const O of k)w.has(O.id)&&S(O.id,O.label,O.models);const R=T.filter(O=>O.kind==="llm");for(const O of R)S(O.id,O.label,O.models);const M=E??"";if(M&&!N.some(O=>O.providerId===C&&O.modelId===M)){const O=((x=k.find(L=>L.id===C))==null?void 0:x.label)??((b=R.find(L=>L.id===C))==null?void 0:b.label)??C;N.unshift({providerId:C,providerLabel:O,modelId:M,modelLabel:M,vision:!0,contextWindow:null})}s(N),o(C),c(M)}catch{s([])}},[]);v.useEffect(()=>{f();const x=()=>void f();return window.addEventListener("llm-config-changed",x),()=>window.removeEventListener("llm-config-changed",x)},[f]),v.useEffect(()=>{if(!n)return;const x=k=>{var T;k.target instanceof Node&&((T=h.current)==null?void 0:T.contains(k.target))!==!0&&r(!1)},b=k=>{k.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",b),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",b)}},[n]);const m=async x=>{if(r(!1),!(x.providerId===a&&x.modelId===l))try{await X.setSetting("active_provider",x.providerId),await X.setSetting("active_model",x.modelId),o(x.providerId),c(x.modelId),window.dispatchEvent(new Event("llm-config-changed"))}catch{}},d=((g=i==null?void 0:i.find(x=>x.providerId===a&&x.modelId===l))==null?void 0:g.modelLabel)??l??t("model.picker.label"),p=[];for(const x of i??[]){const b=p[p.length-1];b&&b.label===x.providerLabel?b.rows.push(x):p.push({label:x.providerLabel,rows:[x]})}return u.jsxs("div",{ref:h,className:"relative","data-testid":"composer-model",children:[u.jsxs("button",{type:"button",onClick:()=>r(!n),"aria-haspopup":"menu","aria-expanded":n,"data-tooltip":t("model.picker.label"),"data-testid":"composer-model-trigger",className:"flex items-center gap-1 max-w-[13rem] px-1.5 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:[u.jsx(c1,{className:"w-3 h-3 shrink-0 coarse-only","aria-hidden":!0}),u.jsx("span",{className:"truncate tb-label",children:d}),u.jsx($f,{className:`w-3 h-3 shrink-0 tb-chevron transition-transform ${n?"":"rotate-180"}`})]}),n&&u.jsxs("div",{role:"menu","aria-label":t("model.picker.label"),"data-testid":"composer-model-menu",className:"absolute bottom-full right-0 mb-1.5 z-50 w-64 max-h-72 overflow-y-auto bg-surface-0 rounded-xl shadow-elevated border border-[var(--border)] py-1.5",children:[p.length===0&&u.jsx("div",{className:"px-3 py-2 text-caption text-ink-faint",children:t("model.picker.noneConfigured")}),p.map(x=>u.jsxs("div",{role:"group","aria-label":x.label,children:[u.jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-caption font-bold text-ink-faint",children:x.label}),x.rows.map(b=>{const k=b.providerId===a&&b.modelId===l;return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":k,onClick:()=>void m(b),className:`w-full flex items-center gap-1.5 px-3 py-1.5 text-left transition-colors ${k?"text-brand":"text-ink-strong hover:bg-ink/[0.06]"}`,children:[u.jsx(Bt,{className:`w-3.5 h-3.5 shrink-0 ${k?"opacity-100":"opacity-0"}`}),u.jsx("span",{className:"flex-1 truncate text-label",children:b.modelLabel}),b.vision&&u.jsx(x1,{className:"w-3 h-3 shrink-0 text-ink-faint","aria-label":t("model.picker.vision")})]},`${b.providerId}:${b.modelId}`)})]},x.label)),u.jsx("div",{className:"border-t border-[var(--border)] mt-1 pt-1",children:u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{r(!1),e()},className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-left text-label text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:[u.jsx(H1,{className:"w-3.5 h-3.5"}),t("model.picker.manage")]})})]})]})}const El=5.5,ch=2*Math.PI*El,yr=["system","node","learner","history","draft"],uh={system:"bg-accent",node:"bg-brand",learner:"bg-gold",history:"bg-ink/50",draft:"bg-exam"};function PN({info:e,historyTokens:t,draftTokens:n}){const r=_e(),[i,s]=v.useState(!1),a=v.useRef(null);if(v.useEffect(()=>{!(e!=null&&e.contextWindow)&&i&&s(!1)},[e==null?void 0:e.contextWindow,i]),v.useEffect(()=>{if(!i)return;const m=p=>{var g;p.target instanceof Node&&((g=a.current)==null?void 0:g.contains(p.target))!==!0&&s(!1)},d=p=>{p.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",d)}},[i]),!e)return null;const o={system:e.systemTokens,node:e.nodeTokens,learner:e.learnerTokens,history:t,draft:n},l=yr.reduce((m,d)=>m+o[d],0),c=K1(l,e.contextWindow),h=c!==null&&c>=85,f=X1(yr.map(m=>o[m]),c??0);return u.jsxs("span",{ref:a,className:"relative inline-flex items-center","data-testid":"composer-context",children:[u.jsxs("button",{type:"button",onClick:()=>s(!i),disabled:e.contextWindow===null,"aria-label":r("context.aria",{p:c!==null?`${c}%`:pr(l)}),"aria-haspopup":"dialog","aria-expanded":i,"data-testid":"composer-context-trigger","data-tooltip":e.contextWindow===null?`${r("context.label")} ~${pr(l)} · ${r("context.unknownWindow")}`:r("context.aria",{p:`${c}%`}),className:`flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium transition-colors ${h?"text-warning":"text-ink-muted"} hover:bg-ink/[0.06] disabled:hover:bg-transparent`,children:[u.jsxs("svg",{viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":!0,className:"shrink-0",children:[u.jsx("circle",{cx:"7",cy:"7",r:El,fill:"none",strokeWidth:"2",className:"stroke-ink/20"}),u.jsx("circle",{cx:"7",cy:"7",r:El,fill:"none",strokeWidth:"2",stroke:"currentColor",strokeLinecap:"round",strokeDasharray:`${ch*(c??100)/100} ${ch}`,transform:"rotate(-90 7 7)"})]}),c!==null?u.jsxs("span",{className:"tb-label",children:[c,"%"]}):u.jsxs("span",{className:"tb-label",children:["~",pr(l)]})]}),i&&e.contextWindow!==null&&u.jsxs("div",{role:"dialog","aria-label":r("context.label"),"data-testid":"composer-context-panel",className:"absolute bottom-full right-0 mb-1.5 z-50 w-64 bg-surface-0 rounded-xl shadow-elevated border border-[var(--border)] p-3",children:[u.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[u.jsx("span",{className:"text-label font-bold text-ink-strong",children:r("context.label")}),u.jsxs("span",{className:`text-caption ${h?"text-warning":"text-ink-muted"}`,children:[r("context.approx")," ",pr(l)," / ",pr(e.contextWindow)]})]}),u.jsx("div",{className:"flex h-2 rounded-full overflow-hidden bg-ink/10 mb-2",role:"img","aria-label":`${c}%`,children:yr.map(m=>f[yr.indexOf(m)]>0?u.jsx("div",{className:uh[m],style:{width:`${f[yr.indexOf(m)]}%`}},m):null)}),u.jsx("dl",{className:"space-y-1",children:yr.map(m=>u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("dt",{className:"flex items-center gap-1.5 text-caption text-ink-muted",children:[u.jsx("span",{className:`w-2 h-2 rounded-sm ${uh[m]}`,"aria-hidden":!0}),r(`context.${m}`)]}),u.jsxs("dd",{className:"text-caption text-ink-strong tabular-nums",children:["~",pr(o[m])]})]},m))})]})]})}const kl={glm:{fast:e=>{e.thinking={type:"disabled"},e.reasoning_effort="low"},deep:e=>{e.thinking={type:"enabled"}}},qwen:{fast:e=>{e.enable_thinking=!1},deep:e=>{e.enable_thinking=!0}},siliconcloud:{fast:e=>{e.enable_thinking=!1},deep:e=>{e.enable_thinking=!0}}};function DN(e,t,n){if(e==="openai"||e in kl)return e;const r=(t??"").toLowerCase(),i=(n??"").toLowerCase();return r.includes("bigmodel.cn")||r.includes("z.ai")||i.startsWith("glm")?"glm":r.includes("dashscope")||i.startsWith("qwen")?"qwen":r.includes("siliconflow")?"siliconcloud":e}function ON(e,t,n){return t==="anthropic"||t==="google"||e==="openai"||e in kl?!0:DN(e,n==null?void 0:n.baseUrl,n==null?void 0:n.model)in kl}const wo=[{value:"",labelKey:"effort.auto.label",descKey:"effort.auto.desc"},{value:"fast",labelKey:"effort.fast.label",descKey:"effort.fast.desc"},{value:"deep",labelKey:"effort.deep.label",descKey:"effort.deep.desc"}];function jN(){const e=_e(),[t,n]=v.useState(!1),[r,i]=v.useState(""),[s,a]=v.useState(!0),o=v.useRef(null),l=v.useRef(null),[c,h]=v.useState("right"),[f,m]=v.useState(0),d=v.useRef(0),[p,g]=v.useState(0);v.useLayoutEffect(()=>{if(!t){g(0),d.current=0,m(0);return}const T=l.current;if(!T)return;const A=T.getBoundingClientRect(),E=A.left-d.current,C=A.right-d.current,_=window.innerWidth;if(p===0){if(E<8&&C<=_-8){h("left"),g(1);return}if(C>_-8&&E>=8){h("right"),g(1);return}g(1)}const w=Math.min(0,_-8-C)+Math.max(0,8-E);w!==d.current&&(d.current=w,m(w))},[t,p]);const x=v.useCallback(async()=>{var T;try{const[A,E,C,_,w]=await Promise.all([X.getSetting("active_provider"),X.getSetting("reasoning_effort"),X.getProviderPresets(),X.listCustomProviders(),X.getSetting("active_model")]),N=A??"glm",S=_.find(O=>O.id===N),R=((T=C.find(O=>O.id===N))==null?void 0:T.protocol)??(S==null?void 0:S.protocol)??"openai-compatible";a(ON(N,R,{baseUrl:S==null?void 0:S.baseUrl,model:w??(S==null?void 0:S.defaultModel)}));const M=E??"";i(M==="fast"||M==="deep"?M:"")}catch{a(!1)}},[]);v.useEffect(()=>{x();const T=()=>void x();return window.addEventListener("llm-config-changed",T),()=>window.removeEventListener("llm-config-changed",T)},[x]),v.useEffect(()=>{if(!t)return;const T=E=>{var C;E.target instanceof Node&&((C=o.current)==null?void 0:C.contains(E.target))!==!0&&n(!1)},A=E=>{E.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",A),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",A)}},[t]);const b=async T=>{if(n(!1),T!==r){i(T);try{await X.setSetting("reasoning_effort",T)}catch{i(r)}}},k=wo.find(T=>T.value===r)??wo[0];return u.jsxs("div",{ref:o,className:"relative","data-testid":"composer-effort",children:[u.jsxs("button",{type:"button",onClick:()=>!!s&&n(!t),disabled:!s,"aria-haspopup":"menu","aria-expanded":t,"data-testid":"composer-effort-trigger","data-tooltip":e(s?"effort.label":"effort.unsupported"),className:`flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium transition-colors ${r?"text-accent":"text-ink-muted"} ${s?"hover:text-ink-strong hover:bg-ink/[0.06]":"opacity-40 cursor-not-allowed"}`,children:[u.jsx(u1,{className:"w-3 h-3 shrink-0"}),u.jsx("span",{className:"truncate tb-label",children:e(k.labelKey)}),u.jsx($f,{className:`w-3 h-3 shrink-0 tb-chevron transition-transform ${t?"":"rotate-180"}`})]}),t&&u.jsx("div",{ref:l,role:"menu","aria-label":e("effort.label"),"data-testid":"composer-effort-menu",style:{transform:f?`translateX(${f}px)`:void 0},className:`absolute bottom-full ${c==="right"?"right-0":"left-0"} mb-1.5 z-50 w-60 max-w-[calc(100vw-1.5rem)] bg-surface-0 rounded-xl shadow-elevated border border-[var(--border)] py-1.5`,children:wo.map(T=>{const A=T.value===r;return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":A,onClick:()=>void b(T.value),className:`w-full flex items-start gap-1.5 px-3 py-1.5 text-left transition-colors ${A?"text-brand":"text-ink-strong hover:bg-ink/[0.06]"}`,children:[u.jsx(Bt,{className:`w-3.5 h-3.5 shrink-0 mt-0.5 ${A?"opacity-100":"opacity-0"}`}),u.jsxs("span",{className:"flex-1",children:[u.jsx("span",{className:"block text-label font-bold",children:e(T.labelKey)}),u.jsx("span",{className:"block text-caption text-ink-faint",children:e(T.descKey)})]})]},T.value||"auto")})})]})}function FN(e){const t=Math.floor(e/1e3),n=Math.floor(t/60);return`${String(n).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}function BN({view:e,level:t,text:n,onTextChange:r,onSend:i,onRerecord:s,errorMessage:a,sendDisabled:o}){const l=_e(),[c,h]=v.useState(0),f=v.useRef(performance.now());return v.useEffect(()=>{f.current=performance.now(),h(0)},[e]),v.useEffect(()=>{if(e!=="recording")return;const m=window.setInterval(()=>h(performance.now()-f.current),250);return()=>window.clearInterval(m)},[e]),u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-20 rounded-2xl bg-surface-0 shadow-elevated p-4 flex flex-col gap-3",role:"status","aria-live":"polite","data-testid":e==="recording"?"voice-panel-recording":e==="transcribing"?"voice-panel-transcribing":e==="review"?"voice-panel-review":"voice-panel-error",children:[e==="recording"&&u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("span",{className:"w-11 h-11 shrink-0 rounded-full bg-warning/15 text-warning flex items-center justify-center",children:u.jsx(ls,{className:"w-5 h-5 animate-pulse"})}),u.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between text-label text-ink-muted",children:[u.jsx("span",{children:l("chat.speech.recording_hint")}),u.jsx("span",{className:"tabular-nums",children:FN(c)})]}),u.jsx("span",{className:"block h-2 rounded-full bg-ink/[0.08] overflow-hidden","data-testid":"voice-level",children:u.jsx("span",{className:"block h-full bg-warning transition-[width] duration-100",style:{width:`${Math.round(Math.min(1,t)*100)}%`}})})]})]}),e==="transcribing"&&u.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-body text-ink-muted",children:[u.jsx(C1,{className:"w-4 h-4 animate-spin"}),u.jsx("span",{children:l("chat.speech.transcribing")})]}),e==="review"&&u.jsxs(u.Fragment,{children:[u.jsx("textarea",{value:n,onChange:m=>r(m.target.value),autoFocus:!0,rows:4,"data-testid":"voice-result-text",className:"w-full bg-ink/[0.05] text-body text-ink-strong rounded-xl px-3 py-2 resize-none focus:outline-none focus:bg-ink/[0.08]"}),u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx("button",{type:"button",onClick:s,"data-testid":"voice-rerecord",className:"btn-3d-neutral px-4 py-1.5 text-body",children:l("chat.speech.rerecord")}),u.jsxs("button",{type:"button",onClick:i,disabled:o,"data-testid":"voice-send",className:"btn-3d-brand px-4 py-1.5 text-body flex items-center gap-1.5 disabled:opacity-40",children:[u.jsx(B1,{className:"w-3.5 h-3.5"}),l("chat.send")]})]})]}),e==="error"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-body text-warning py-1",children:a??l("chat.speech.asr_failed")}),u.jsx("div",{className:"flex items-center justify-end",children:u.jsxs("button",{type:"button",onClick:s,"data-testid":"voice-rerecord",className:"btn-3d-neutral px-4 py-1.5 text-body flex items-center gap-1.5",children:[u.jsx(cs,{className:"w-3.5 h-3.5"}),l("chat.speech.retry")]})})]})]})}const HN={direct:"soul.direct",guide:"soul.guide",practice:"soul.practice"},UN={direct:fn,guide:Wf,practice:E1},zN={direct:"soul.direct.desc",guide:"soul.guide.desc",practice:"soul.practice.desc"},VN=["image/png","image/jpeg","image/webp","image/gif",".txt",".md",".markdown",".rst",".org",".adoc",".log",".csv",".tsv",".json",".yaml",".yml",".toml",".ini",".py",".js",".mjs",".cjs",".ts",".tsx",".jsx",".go",".rs",".java",".c",".h",".cpp",".hpp",".cs",".rb",".sh",".sql",".html",".css",".scss",".vue",".svelte",".kt",".swift",".php"].join(",");let dh=0;function $N({nodeId:e,agentReady:t,streaming:n,souls:r,activeSoul:i,starterPrompts:s,onPickSoul:a,onSend:o,onStop:l,onLogFriction:c,onGotoSettings:h,insertText:f,historyTokens:m}){const d=_e(),p=im(),[g,x]=v.useState(""),[b,k]=v.useState([]),[T,A]=v.useState(null),[E,C]=v.useState(null),[_,w]=v.useState(!1),N=v.useRef(null),S=v.useRef(0),[R,M]=v.useState(!0);v.useEffect(()=>{X.getSetting("asr_auto_stop").then(oe=>M(oe!=="0"))},[]);const[O,L]=v.useState(!1);v.useEffect(()=>(mu(O),()=>mu(!1)),[O]);const[I,j]=v.useState(""),[U,B]=v.useState(!1),[W,D]=v.useState(null),q=RN(oe=>{j(oe),B(!0)},{locale:p,autoStop:R}),Z=q.startError??q.transcribeError;v.useEffect(()=>{if(!Z)return;D(d(Z==="no-speech"?"chat.speech.no_speech":Z==="model-missing"?"chat.speech.asr_model_missing":Z==="engine-unavailable"?"chat.speech.engine_unavailable":Z==="custom-provider-missing"?"chat.speech.custom_provider_missing":Z==="groq-key-missing"?"chat.speech.groq_key_missing":Z==="azure-key-missing"?"chat.speech.azure_stt_key_missing":Z==="azure-region-missing"?"chat.speech.azure_stt_region_missing":Z==="mic-insecure-context"?"chat.speech.asr_insecure_context":Z==="mic-unavailable"?"chat.speech.asr_start_fail":"chat.speech.asr_failed")),q.clearTranscribeError()},[Z,q,d]);const P=W?"error":q.listening?"recording":q.transcribing?"transcribing":U?"review":"idle",K=(oe,Ie,We)=>{Ox(),o(oe,Ie,We)},V=v.useCallback(()=>{j(""),B(!1),D(null)},[]),$=v.useCallback(()=>{L(!1),V()},[V]),ae=()=>{const oe=I.trim();!oe||n||!e||(K(oe),$())};v.useEffect(()=>{f&&x(oe=>oe.trim()?`${oe}
|
|
516
|
+
|
|
517
|
+
${f}`:f)},[f]),v.useEffect(()=>{if(!e){C(null);return}let oe=!1;(async()=>{try{const We=await X.getContextUsage(e,p);oe||C(We)}catch{oe||C(null)}})();const Ie=()=>{X.getContextUsage(e,p).then(We=>{oe||C(We)}).catch(()=>{})};return window.addEventListener("llm-config-changed",Ie),()=>{oe=!0,window.removeEventListener("llm-config-changed",Ie)}},[e,p]),v.useEffect(()=>{if(!T)return;const oe=setTimeout(()=>A(null),3e3);return()=>clearTimeout(oe)},[T]);const ne=v.useRef(new Set);v.useEffect(()=>()=>{for(const oe of ne.current)URL.revokeObjectURL(oe)},[]);const Y=v.useCallback(oe=>{k(Ie=>{const We=Ie.find(Ue=>Ue.id===oe);return We!=null&&We.previewUrl&&(URL.revokeObjectURL(We.previewUrl),ne.current.delete(We.previewUrl)),Ie.filter(Ue=>Ue.id!==oe)})},[]),ye=v.useCallback(async oe=>{if(oe.length===0)return;const Ie=ys.maxPerMessage-b.length;if(Ie<=0){A(d("chat.attach.tooMany",{n:ys.maxPerMessage}));return}const We=oe.length>Ie?oe.slice(0,Ie):oe;oe.length>Ie&&A(d("chat.attach.tooMany",{n:ys.maxPerMessage}));const Ue=[],Xe=[];for(const De of We){const we=AN(De.name,De.type,De.size);if(!we.ok){A(we.reason==="unsupported"?d("chat.attach.unsupported",{name:De.name}):we.reason==="tooLargeImage"?d("chat.attach.tooLargeImage",{name:De.name}):d("chat.attach.tooLargeText",{name:De.name}));continue}if(we.kind==="image"){if((E==null?void 0:E.visionCapable)===!1){A(d("chat.attach.visionUnsupported"));continue}const ee=await new Promise(ve=>{const ge=new FileReader;ge.onload=()=>{const Se=ge.result;ve(typeof Se=="string"?Se.slice(Se.indexOf(",")+1):null)},ge.onerror=()=>ve(null),ge.readAsDataURL(De)});if(ee===null)continue;const ce=URL.createObjectURL(De);Xe.push(ce),Ue.push({id:++dh,kind:"image",name:De.name,mime:De.type||"image/png",size:De.size,previewUrl:ce,base64:ee})}else try{const ee=await De.text();Ue.push({id:++dh,kind:"text",name:De.name,mime:De.type||"text/plain",size:De.size,text:ee})}catch{}}if(Ue.length>0){for(const De of Xe)ne.current.add(De);k(De=>[...De,...Ue])}else for(const De of Xe)URL.revokeObjectURL(De)},[b.length,E==null?void 0:E.visionCapable,d]),re=oe=>{const Ie=oe.trim();if(n||!e||!Ie&&b.length===0)return;const We=Ie||ic("chat.attach.imageOnlyText"),Ue=b.map(Xe=>({kind:Xe.kind,name:Xe.name,mime:Xe.mime,size:Xe.size,data:Xe.kind==="image"?Xe.base64??"":Xe.text??"",...Xe.kind==="image"&&Xe.previewUrl?{previewUrl:Xe.previewUrl}:{}}));K(We,void 0,Ue.length>0?Ue:void 0),x(""),k([])},ie=()=>re(g),le=oe=>{n||(K(oe.message,oe.label),oe.frictionCategory&&(c==null||c(oe.frictionCategory,null)))},xe=oe=>{const Ie=Array.from(oe.clipboardData.files??[]);Ie.length>0&&(oe.preventDefault(),ye(Ie))},ke=oe=>{oe.dataTransfer.types.includes("Files")&&(oe.preventDefault(),S.current+=1,w(!0))},ze=oe=>{oe.dataTransfer.types.includes("Files")&&(S.current=Math.max(0,S.current-1),S.current===0&&w(!1))},Te=oe=>{oe.dataTransfer.types.includes("Files")&&(oe.preventDefault(),S.current=0,w(!1),ye(Array.from(oe.dataTransfer.files??[])))},Ge=v.useMemo(()=>tm(g),[g]);return t?u.jsxs("div",{className:"px-5 pb-4 pt-1 shrink-0","data-testid":"composer",children:[!O&&s.length>0&&e&&u.jsx("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-2","data-testid":"starter-prompts",children:s.map((oe,Ie)=>u.jsx("button",{onClick:()=>le(oe),disabled:n,"data-testid":`starter-prompt-${Ie}`,"data-tooltip":oe.hint??oe.label,className:"shrink-0 whitespace-nowrap px-2.5 py-1 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors disabled:opacity-30",children:oe.label},Ie))}),u.jsx("div",{className:`composer-card relative rounded-2xl transition-colors px-3 pt-2 pb-1.5 ${_?"bg-accent/10 ring-1 ring-accent":"bg-ink/[0.05] focus-within:bg-ink/[0.07]"}`,onDragEnter:ke,onDragOver:oe=>{oe.dataTransfer.types.includes("Files")&&oe.preventDefault()},onDragLeave:ze,onDrop:Te,"data-testid":"composer-card",children:O?u.jsxs(u.Fragment,{children:[P!=="idle"&&u.jsx(BN,{view:P,level:q.level,text:I,onTextChange:j,onSend:ae,onRerecord:V,errorMessage:W,sendDisabled:n||!e||!I.trim()}),u.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[u.jsxs("span",{className:"flex items-center gap-1.5 text-label text-ink-muted font-medium",children:[u.jsx(ls,{className:"w-3.5 h-3.5 text-accent"}),d("chat.speech.dictation")]}),u.jsxs("button",{type:"button",onClick:$,"data-tooltip":d("chat.speech.back_to_keyboard"),"aria-label":d("chat.speech.back_to_keyboard"),"data-testid":"voice-keyboard-toggle",className:"touch-lift flex items-center gap-1 px-2 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:[u.jsx(T1,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:d("chat.speech.keyboard")})]})]}),u.jsxs("button",{type:"button",onPointerDown:oe=>{oe.preventDefault(),q.beginHold()},onPointerUp:q.endHold,onPointerLeave:q.endHold,onPointerCancel:q.endHold,onContextMenu:oe=>oe.preventDefault(),disabled:!e||P!=="idle","data-testid":q.listening?"voice-hold-btn-active":"voice-hold-btn",className:`w-full py-5 rounded-xl text-lead font-bold flex items-center justify-center gap-2 transition-all touch-none select-none disabled:opacity-40 ${q.listening?"bg-accent/25 text-accent scale-[0.99]":"bg-accent/10 text-accent hover:bg-accent/20 active:bg-accent/25 active:scale-[0.99]"}`,children:[u.jsx(ls,{className:"w-5 h-5"}),q.listening?d("chat.speech.release_to_stop"):d("chat.speech.hold_to_talk")]})]}):u.jsxs(u.Fragment,{children:[r.length>0&&u.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto mb-1","data-testid":"soul-picker",children:[u.jsx("span",{className:"text-body text-ink-faint shrink-0",children:d("chat.soul.label")}),r.map(oe=>{const Ie=i===oe.name,We=UN[oe.name]??Wf,Ue=d(zN[oe.name]??"soul.direct.desc");return u.jsxs("button",{onClick:()=>a(oe.name),"data-testid":`soul-pill-${oe.name}`,"data-tooltip":Ue,className:`shrink-0 flex items-center gap-1 px-2 py-0.5 rounded-full text-body font-medium transition-colors ${Ie?"bg-brand/15 text-brand":"text-ink-muted hover:text-ink-strong hover:bg-ink/5"}`,children:[u.jsx(We,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:d(HN[oe.name]??"soul.direct")})]},oe.id)})]}),b.length>0&&u.jsxs("div",{className:"flex gap-1.5 flex-wrap mb-1.5","data-testid":"composer-attachments",children:[(E==null?void 0:E.visionBridgeModel)&&b.some(oe=>oe.kind==="image")&&u.jsxs("div",{className:"w-full flex items-center gap-1 text-caption text-ink-muted","data-testid":"vision-bridge-chip",children:[u.jsx(F1,{className:"w-3.5 h-3.5 shrink-0"}),u.jsx("span",{children:d("chat.attach.bridgeChip",{model:E.visionBridgeModel})})]}),b.map(oe=>oe.kind==="image"?u.jsxs("div",{className:"relative w-16 h-16 shrink-0",children:[u.jsx("img",{src:oe.previewUrl,alt:oe.name,className:"w-16 h-16 object-cover rounded-lg border border-[var(--border)]"}),u.jsx("button",{type:"button",onClick:()=>Y(oe.id),"aria-label":d("chat.attach.remove",{name:oe.name}),className:"touch-target-sm absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-ink/70 hover:bg-warning text-white flex items-center justify-center transition-colors",children:u.jsx(Kt,{className:"w-3 h-3"})})]},oe.id):u.jsxs("span",{className:"inline-flex items-center gap-1 pl-2 pr-1 py-1 rounded-full bg-ink/[0.08] text-caption text-ink-strong",children:[u.jsx(Ds,{className:"w-3 h-3 shrink-0 text-ink-faint"}),u.jsx("span",{className:"truncate max-w-[10rem]",children:oe.name}),u.jsx("button",{type:"button",onClick:()=>Y(oe.id),"aria-label":d("chat.attach.remove",{name:oe.name}),className:"touch-target-sm w-4 h-4 rounded-full hover:bg-ink/20 flex items-center justify-center text-ink-muted hover:text-warning transition-colors",children:u.jsx(Kt,{className:"w-2.5 h-2.5"})})]},oe.id))]}),T&&u.jsx("div",{className:"text-caption text-warning pb-1",role:"status","data-testid":"composer-notice",children:T}),u.jsxs("div",{className:"flex gap-2 items-end",children:[u.jsx("textarea",{value:g,onChange:oe=>x(oe.target.value),onFocus:()=>pu(!0),onBlur:()=>pu(!1),onKeyDown:oe=>{oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),ie())},onPaste:xe,placeholder:d(e?"chat.input.placeholder":"chat.input.no_node"),disabled:n||!e,rows:2,"data-testid":"chat-input",className:"flex-1 bg-transparent text-ink-strong text-body rounded-lg px-1 py-1 resize-none focus:outline-none disabled:opacity-40 placeholder:text-ink-faint"}),n?u.jsx("button",{onClick:l,"data-testid":"chat-stop",className:"btn-icon-3d-warning shrink-0 w-9 h-9",title:d("chat.stop"),"aria-label":d("chat.stop"),children:u.jsx(rc,{className:"w-3.5 h-3.5 fill-current"})}):u.jsx("button",{onClick:ie,disabled:n||!g.trim()&&b.length===0||!e,"data-testid":"chat-send",className:"btn-icon-3d-brand shrink-0 w-9 h-9",title:d("chat.send"),"aria-label":d("chat.send"),children:u.jsx(o1,{className:"w-4 h-4"})})]}),u.jsxs("div",{className:"composer-toolbar flex flex-wrap items-center justify-between gap-x-0.5 gap-y-1 mt-0.5",children:[u.jsx("button",{type:"button",onClick:()=>{V(),L(!0)},disabled:!e,"data-tooltip":d("chat.speech.dictation"),"aria-label":d("chat.speech.dictation"),"data-testid":"composer-mic",className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors disabled:opacity-50",children:u.jsx(ls,{className:"w-3.5 h-3.5"})}),u.jsx("button",{type:"button",onClick:()=>{var oe;return(oe=N.current)==null?void 0:oe.click()},"data-tooltip":d("chat.attach.add"),"aria-label":d("chat.attach.add"),"data-testid":"composer-attach",className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:u.jsx(L1,{className:"w-3 h-3"})}),u.jsx("input",{ref:N,type:"file",multiple:!0,accept:VN,className:"hidden",onChange:oe=>{ye(Array.from(oe.target.files??[])),oe.target.value=""}}),u.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-0.5",children:[u.jsx(jN,{}),u.jsx(PN,{info:E,historyTokens:m,draftTokens:Ge}),u.jsx(LN,{onGotoSettings:h})]})]})]})})]}):u.jsx("div",{className:"px-5 pb-4 shrink-0","data-testid":"composer-nokey",children:u.jsxs("div",{className:"flex items-center justify-center gap-3 py-3 text-body text-ink-muted",children:[u.jsx("span",{children:d("chat.no_key.short")}),u.jsx("button",{onClick:h,className:"text-brand hover:underline font-bold",children:d("chat.no_key.cta")})]})})}const hh={viseme:"closed",open:0};function qN(e){const[t,n]=v.useState(hh);return v.useEffect(()=>{if(!e){n(hh);return}const r=new Uint8Array(256),i=new Uint8Array(M0/2);let s=0,a="",o=null,l=0;const c=()=>{const h=FA();if(h){let f,m;if(h.timeline&&h.timeline.cues.length>0){const g=Math.max(0,h.ctx.currentTime-h.startedAtCtxTime),x=QA(h.timeline,g);f=(x==null?void 0:x.viseme)??"closed",m=(x==null?void 0:x.level)??0}else if(h.analyser){const g=h.analyser;g.getByteTimeDomainData(r),g.getByteFrequencyData(i);const x=jx(r,i,g.context.sampleRate,g.fftSize);f=x.viseme,f!==a.split(":")[0]?(f==="closed"||f===o?f===o&&l++:(o=f,l=1),f!=="closed"&&!(f===o&&l>=2)&&(f=a.split(":")[0]||"closed")):(o=null,l=0),m=x.level}else f="closed",m=0;const d=Fx(f,m),p=f+":"+d;p!==a&&(a=p,n({viseme:f,open:d}))}s=requestAnimationFrame(c)};return s=requestAnimationFrame(c),()=>cancelAnimationFrame(s)},[e]),t}const WN=22,YN=35e-5,fh=.012,mh=.12,ph=.3,GN=16.667,To=12,KN=3.2,gh=56,vr=.6;function XN(e,t,n,r,i=0,s=0){let a=0,o=0;for(const c of r){const h=e-c.x,f=t-c.y,m=Math.hypot(h,f),d=c.r+n,p=d+gh;if(m>=p)continue;if(m<1e-4){o-=vr;continue}const g=h/m,x=f/m,b=Math.min(1.6,Math.max(0,1-(m-d)/gh)),k=i*g+s*x,T=k<0?1+Math.min(1.6,-k/4):1;a+=g*vr*b*T,o+=x*vr*b*T}const l=Math.hypot(a,o);return l>vr*2&&(a=a/l*vr*2,o=o/l*vr*2),{x:a,y:o}}function QN(e,t,n,r=34){const i=n*.001;return{x:e.x+Math.sin(i*.31+t*2.1)*r,y:e.y+Math.sin(i*.47+t*4.7)*(r*.55)+Math.sin(i*1.7+t)*4}}function ZN(e,t,n,r,i=GN){const s=Math.max(64,i*i),a=wl((n.x-e.x)*fh-t.x*mh,ph),o=wl((n.y-e.y)*fh-t.y*mh,ph);return{fx:a*r/s,fy:o*r/s-r*.001}}function wl(e,t){return e>t?t:e<-t?-t:e}function JN(e,t,n,r,i,s,a,o,l,c){const h=e-s,f=t-a,m=Math.hypot(h,f),d=i+c;if(m>=d||m<1e-4)return null;const p=h/m,g=f/m,x=n-o,b=r-l,k=x*p+b*g,T=d-m,A=k<0?-k*.9:0;return{nx:p,ny:g,dvx:p*(T*.55+A*.85),dvy:g*(T*.55+A*.85),bfx:-p*A*.02,bfy:-g*A*.02,hitSpeed:-k}}function e5(e,t){return Math.hypot(e,t)<.35?0:wl(e*.06,.5)}function t5(e,t,n,r=0){const i=[.14,.32,.5,.68,.86],s=[.38,.5,.62],a=(r%15+15)%15;let o={x:e*.5,y:t*.5},l=-1/0;for(let c=0;c<15;c++){const h=(a+c)%15,f=e*i[h%5],m=t*s[Math.floor(h/5)];let d=1/0;for(const p of n){const g=Math.hypot(f-p.x,m-p.y)-p.r;g<d&&(d=g)}d>l+1e-9&&(l=d,o={x:f,y:m})}return o}function n5(e,t,n=220){let r=null,i=n;for(const s of t){const a=Math.hypot(s.x-e.x,s.y-e.y);a<i&&(i=a,r={x:s.x,y:s.y})}return r}function r5(e){const t=e.radius??WN,{Bodies:n,Body:r,Composite:i,Engine:s}=Nn,a=s.create();a.gravity.y=1,a.positionIterations=4,a.velocityIterations=3;const o=n.circle(e.width*.7,120,t,{restitution:.55,friction:.02,frictionAir:.028,density:YN});i.add(a.world,o);const l=240;let c=[];const h=(d,p)=>{for(const x of c)i.remove(a.world,x);const g=(x,b,k,T)=>n.rectangle(x,b,k,T,{isStatic:!0,restitution:.5});c=[g(-l/2,p/2-160,l,p+640),g(d+l/2,p/2-160,l,p+640),g(d/2,p+l/2,d+l*2,l),g(d/2,-320-l/2,d+l*2,l)];for(const x of c)i.add(a.world,x)};h(e.width,e.height);let f=0,m=e.width;return{body:o,resize(d,p){m=d,h(d,p)},step(d,p,g,x,b){const k=x<f;s.update(a,Math.min(33,Math.max(8,d)));let T=!1;if(!k&&p){const O=b!=null&&b.settle?{x:p.x,y:p.y+Math.sin(x*.0012)*2}:QN(p,Math.floor(x/4200),x),L=Math.max(64,d*d),I=ZN({x:o.position.x,y:o.position.y},{x:o.velocity.x,y:o.velocity.y},O,o.mass,d),j=XN(o.position.x,o.position.y,t,g,o.velocity.x,o.velocity.y);r.applyForce(o,o.position,{x:I.fx+j.x*o.mass/L,y:I.fy+j.y*o.mass/L}),r.setAngularVelocity(o,o.angularVelocity-o.angle*.06-o.angularVelocity*.08)}{const O=o.velocity,L=Math.hypot(O.x,O.y);L>To&&r.setVelocity(o,{x:O.x/L*To,y:O.y/L*To})}let A=0,E=0,C=0,_=0,w=0;for(const O of g){const L=JN(o.position.x,o.position.y,o.velocity.x,o.velocity.y,t,O.x,O.y,O.vx,O.vy,O.r);L&&(E+=L.nx*Math.min(4,L.dvx),C+=L.ny*Math.min(4,L.dvy),_+=L.dvx*.9,w+=L.dvy*.9,O.isStatic||O.push(L.bfx,L.bfy),L.hitSpeed>A&&(A=L.hitSpeed))}const N=Math.hypot(E,C);N>4&&(E=E/N*4,C=C/N*4);const S=Math.hypot(_,w);S>7&&(_=_/S*7,w=w/S*7),(N>0||S>0)&&(r.setPosition(o,{x:o.position.x+E,y:o.position.y+C}),r.setVelocity(o,{x:o.velocity.x+_,y:o.velocity.y+w})),A>=KN&&!k&&(f=x+900,T=!0);const R=o.position;R.x<t&&(r.setPosition(o,{x:t,y:R.y}),o.velocity.x<0&&r.setVelocity(o,{x:-o.velocity.x*.5,y:o.velocity.y})),R.x>m-t&&(r.setPosition(o,{x:m-t,y:R.y}),o.velocity.x>0&&r.setVelocity(o,{x:-o.velocity.x*.5,y:o.velocity.y}));const M=b==null?void 0:b.ceilY;return M!==void 0&&R.y<M+t&&(r.setPosition(o,{x:R.x,y:M+t}),o.velocity.y<0&&r.setVelocity(o,{x:o.velocity.x,y:-o.velocity.y*.5})),T},dizzyRemaining(d){return Math.max(0,f-d)},throwDizzy(d){f=d+900},dispose(){i.clear(a.world,!1),s.clear(a)}}}const jt={rail:76,chat:96,notebook:120};function xh(){const t=document.querySelector('[data-testid="composer-card"]')??document.querySelector('[data-testid="composer"]')??document.querySelector('[data-testid="composer-nokey"]');if(!t)return null;const n=t.getBoundingClientRect();return{x:n.right-78,y:n.top-44}}function s5(){const e=document.querySelector('[data-testid="notebook-panel"]');if(!e)return null;const t=e.getBoundingClientRect();return{x:t.right-64,y:t.top+84}}function i5({courseId:e}){const t=v.useSyncExternalStore(Uf,qo),n=qN(t.state.talking),r=Xl(),[i,s]=v.useState(!1),[a,o]=v.useState(null),[l,c]=v.useState("rail"),h=v.useRef("rail"),f=v.useRef(null),[m,d]=v.useState(!1),p=v.useRef(!1),g=v.useRef(null),x=v.useRef(null),b=v.useRef(null),k=v.useRef(null),T=v.useRef(t.state.zone),A=v.useRef(!1),E=v.useRef(0),C=v.useRef(null),[_,w]=v.useState(null),N=v.useRef(0),S=v.useRef(null),R=v.useRef(null),M=v.useRef(0),O=v.useRef(null),L=v.useRef(0),I=v.useRef({pane:"rail",bucket:-1}),j=v.useRef(null),U=v.useRef(null);v.useEffect(()=>{var Z,P,K;if(l===T.current||(T.current=l,r))return;s(!0),(P=(Z=g.current)==null?void 0:Z.animate)==null||P.call(Z,[{transform:"scale(1, 1)"},{transform:"scale(1.08, 0.86)",offset:.3},{transform:"scale(0.96, 1.1)",offset:.65},{transform:"scale(1, 1)"}],{duration:620,easing:"cubic-bezier(0.2, 1.4, 0.4, 1)",composite:"add"}),(K=g.current)==null||K.classList.add("cp-takeoff"),setTimeout(()=>{var V;return(V=g.current)==null?void 0:V.classList.remove("cp-takeoff")},650);const q=[setTimeout(()=>s(!1),950),setTimeout(()=>{var $;const V=g.current;!V||l==="rail"||(Bx(),($=V.animate)==null||$.call(V,[{transform:"scale(1, 1)"},{transform:"scale(1.07, 0.88)",offset:.42},{transform:"scale(0.98, 1.03)",offset:.72},{transform:"scale(1, 1)"}],{duration:280,easing:"ease-out",composite:"add"}))},940)];return()=>{for(const V of q)clearTimeout(V)}},[l,r]),v.useEffect(()=>{if(!e)return;let q=!0;return window.api.getDashboard(e).then(Z=>{var $,ae;if(!q)return;const P=($=Z==null?void 0:Z.frictionByNode)==null?void 0:$[0];if(!(P!=null&&P.nodeId))return;U.current=P.nodeId;const K=bu(),V=(ae=K.nav)==null?void 0:ae.getBoundingClientRect();if(V)for(const{island:ne,container:Y}of K.sections.values()){const ye=ne.ball(P.nodeId);if(!ye)continue;const re=Y.getBoundingClientRect(),ie=re.left-V.left+ye.body.position.x,le=re.top-V.top+ye.body.position.y;R.current={x:ie,y:Math.max(40,le-92)},M.current=performance.now()+8e3,setTimeout(()=>{q&&yu()},1200);return}}).catch(()=>{}),()=>{q=!1}},[e]),v.useEffect(()=>{const q=Z=>{const P=Z.detail,K=U.current;P!=="mastery"||!K||!e||window.api.getDashboard(e).then(V=>{var ae;((ae=V==null?void 0:V.frictionByNode)==null?void 0:ae.some(ne=>ne.nodeId===K))||(U.current=null,M.current=0,Ux())}).catch(()=>{})};return window.addEventListener("companion-state-changed",q),()=>window.removeEventListener("companion-state-changed",q)},[e]),v.useEffect(()=>{const q=P=>{const K=O.current;if(!K)return;const V=performance.now(),$=Math.max(8,V-K.t);O.current={x:P.clientX,y:P.clientY,vx:(P.clientX-K.x)/$*16.7,vy:(P.clientY-K.y)/$*16.7,t:V}},Z=()=>{const P=O.current;if(!P)return;O.current=null;const K=Math.hypot(P.vx,P.vy),V=x.current;V&&K>=2.5&&(Nn.Body.setVelocity(V.body,{x:P.vx*.9,y:P.vy*.9}),V.throwDizzy(performance.now())),gu(!1,K)};return window.addEventListener("pointermove",q,{passive:!0}),window.addEventListener("pointerup",Z,{passive:!0}),window.addEventListener("pointercancel",Z,{passive:!0}),()=>{window.removeEventListener("pointermove",q),window.removeEventListener("pointerup",Z),window.removeEventListener("pointercancel",Z)}},[]),v.useEffect(()=>{if(!t.enabledLoaded||!t.enabled||t.petMode)return;const q=g.current;if(!q)return;let Z=0,P=performance.now(),K=0,V=0,$=0,ae=-1e9,ne=null,Y=null,ye=0,re=0;const ie=le=>{var St,Pe,On,Q,Oe,rt,Et;Z=requestAnimationFrame(ie);const xe=Math.min(50,le-P);P=le;const ke=bu(),ze=ke.nav,Te=(ze==null?void 0:ze.getBoundingClientRect())??null,Ge=qo().state,oe=!!O.current,Ie=!!Te&&Te.width>40&&(ke.visible||Ge.importing);le-ae>150&&(ae=le,ne=((St=document.querySelector('[data-testid="chat-panel"]'))==null?void 0:St.getBoundingClientRect())??null,Y=((Pe=document.querySelector('[data-testid="notebook-panel"]'))==null?void 0:Pe.getBoundingClientRect())??null,ye=((On=document.querySelector("header.app-header"))==null?void 0:On.getBoundingClientRect().bottom)??0,re=((Q=document.querySelector('[data-testid="map-rail-topbar"]'))==null?void 0:Q.getBoundingClientRect().bottom)??0);const We=ne,Ue=Y,Xe=()=>Math.max(ye,re)-((Te==null?void 0:Te.top)??0),De=Math.floor(le/Vx);if(I.current.bucket!==De){const Re=[];if(Ie&&Re.push("rail"),We&&Re.push("chat"),Ue&&Re.push("notebook"),I.current={pane:zx(I.current.pane,De,Re),bucket:De},Ie&&Ge.zone==="roam"){const $e=document.querySelector('[data-testid="map-review-badge"]'),it=!!$e&&$e.className.includes("bg-review/20");let Ke=null;for(const{island:Le,container:je}of ke.sections.values()){const Ct=Le.balls.find(Ye=>!Ye.body.isStatic);if(Ct){const Ye=je.getBoundingClientRect();Ke={x:Ye.left+Ct.body.position.x,y:Ye.top+Ct.body.position.y};break}}const ut=M.current>le?R.current:null,Be=Yx(De,{hasReview:it,hasNext:!!Ke,hasFriction:!!ut});if(Be==="review"&&$e){const Le=$e.getBoundingClientRect();j.current={kind:Be,until:le+Pa,pos:{x:Le.right+44,y:Le.bottom+64},fired:!1},I.current.pane="rail"}else Be==="inspect"&&Ke?(j.current={kind:Be,until:le+Pa,pos:{x:Ke.x+34,y:Ke.y-66},fired:!1},I.current.pane="rail"):Be==="friction"&&ut&&(j.current={kind:Be,until:le+Pa,pos:{x:ut.x,y:ut.y},fired:!1},I.current.pane="rail")}}const we=j.current&&le<j.current.until?j.current:null;j.current&&!we&&(j.current=null);const ee=Gx();if(ee&&ee.seq!==E.current){E.current=ee.seq;let Re=ee.x,$e=ee.y;if((Re==null||$e==null)&&Ie)for(const{island:it,container:Ke}of ke.sections.values()){const ut=it.ball(ee.nodeId);if(ut){const Be=Ke.getBoundingClientRect();Re=Be.left+ut.body.position.x,$e=Be.top+ut.body.position.y;break}}Ie&&Re!=null&&$e!=null?(C.current={nodeId:ee.nodeId,x:Re,y:$e,until:le+2400,fired:!1,fly:!0},w({until:le+2400})):(C.current={nodeId:ee.nodeId,x:0,y:0,until:le+1600,fired:!0,fly:!1},w({until:le+1600}))}const ce=!!C.current&&le<C.current.until;if(C.current&&!ce&&(C.current=null,w(null)),ce&&C.current&&!C.current.fired){const Re=C.current;if(Re.fired=!0,Re.fly&&Te)for(const{island:$e}of ke.sections.values()){const it=$e.ball(Re.nodeId);if(it&&!it.body.isStatic){Nn.Body.applyForce(it.body,it.body.position,{x:.0035,y:-.005});break}}}const ve=Kx();if(ve&&ve.seq!==N.current&&(N.current=ve.seq,Ie&&Te)){const Re=Xe();S.current={x:Math.min(Te.width-44,Math.max(44,ve.x-Te.left)),y:Math.min(Te.height-44,Math.max(Re+52,ve.y-Te.top)),until:le+3200}}const ge=!!S.current&&le<S.current.until;S.current&&!ge&&(S.current=null);const Se=iA(),de=Se?Se.startContainer.parentElement??null:null;let be=null,Ce=I.current.pane;if(oe){const Re=O.current;x.current=null,be={x:Re.x,y:Re.y},$=Math.max(-.5,Math.min(.5,Re.vx*.04)),Ce=h.current}else if(de&&Se){const Re=de.closest('[data-testid="notebook-panel"], [data-testid="chat-stream"]'),$e=Re==null?void 0:Re.getBoundingClientRect(),it=Se.getClientRects(),Ke=[];for(let Ye=0;Ye<it.length;Ye++){const ot=it[Ye];ot.width>1&&ot.height>1&&Ke.push({left:ot.left,right:ot.right,top:ot.top,bottom:ot.bottom})}const ut=Ke.length?Ke[Ke.length-1]:null,Be=Ke.length?Ke[0]:null,Le=Se.getBoundingClientRect(),je=!!(Re!=null&&Re.closest('[data-testid="chat-stream"]')),Ct=je?jt.chat:jt.notebook;if(Ce=je?"chat":"notebook",$e&&(ut||Le.width>0)){const Ye=xu({left:Le.left,right:Le.right,top:Le.top,bottom:Le.bottom},$e,Ct,{first:Be??void 0,last:ut??void 0},Ke),ot={dir:Ye.dir,pane:Ce};if((((Oe=f.current)==null?void 0:Oe.dir)!==ot.dir||((rt=f.current)==null?void 0:rt.pane)!==ot.pane)&&(f.current=ot,o(ot)),p.current!==Ye.occluding&&(p.current=Ye.occluding,d(Ye.occluding)),r)be=Ye,$=0;else{const bt=b.current??{x:Ye.x,y:Ye.y};be=an(bt,Ye,xe,qx,110),$=Ye.dir==="left"?-.07:Ye.dir==="right"?.07:0}}else{f.current!==null&&(f.current=null,o(null)),p.current&&(p.current=!1,d(!1));const Ye=$e?{left:$e.left,top:$e.top,right:$e.right,bottom:$e.bottom}:{left:8,top:8,right:window.innerWidth-8,bottom:window.innerHeight-8},ot=zn(Ye,Ct,le),bt=b.current??{x:ot.x,y:ot.y};be=an(bt,ot,xe,Wr,140),$=Math.max(-.25,Math.min(.25,(be.x-bt.x)*.01))}}else{f.current!==null&&(f.current=null,o(null)),p.current&&(p.current=!1,d(!1));const Re=Ge.pose==="writing"?oA():null,$e=Ge.zone,it=Re?Re.closest('[data-testid="notebook-panel"], [data-testid="chat-stream"]'):null,Ke=Re==null?void 0:Re.getBoundingClientRect(),ut=!!(it&&Ke&&Ke.width>0);if(Re&&ut){const Be=it,Le=Be.getBoundingClientRect(),je=Ke,Ct=!!Be.closest('[data-testid="chat-stream"]');Ce=Ct?"chat":"notebook";{const Ye=xu(je,Le,Ct?jt.chat:jt.notebook);if(x.current=null,r)be=Ye,$=0;else{const ot=b.current??{x:Ye.x,y:Ye.y};be=an(ot,Ye,xe,Zs),$=.08}}}else if($e==="chat"&&xh()){x.current=null,Ce="chat";const Be=xh();if(r)be=Be,$=0;else{const Le=$x("chat",le),je=b.current??{x:Be.x,y:Be.y};be=an(je,{x:Be.x+Le.x,y:Be.y+Le.y},xe,Zs),$=Math.max(-.35,Math.min(.35,(be.x-je.x)*.014))}}else if($e==="notebook"&&Ue)if(x.current=null,Ce="notebook",r)be=s5()??{x:Ue.left+Ue.width/2,y:Ue.top+120},$=0;else{const Be=zn(Ue,jt.notebook,le),Le=b.current??{x:Be.x,y:Be.y};be=an(Le,Be,xe,Zs),$=Math.max(-.3,Math.min(.3,(be.x-Le.x)*.012))}else if(Ie&&(ce||ge||$e==="rail"||$e==="roam"&&(I.current.pane==="rail"||we))){const Be=Te.width,Le=Te.height;if(Ce="rail",r)be={x:Te.left+Be*.5,y:Te.top+Le*.5},$=0;else{if((Be!==K||Le!==V)&&(K=Be,V=Le,(Et=x.current)==null||Et.resize(Be,Le),R.current=null),!x.current){x.current=r5({width:Be,height:Le});const pt=b.current;pt&&Nn.Body.setPosition(x.current.body,{x:Math.min(Be-30,Math.max(30,pt.x-Te.left)),y:Math.min(Le-30,Math.max(30,pt.y-Te.top))})}const je=x.current,Ct=[],Ye=[];for(const{island:pt,container:at}of ke.sections.values()){const fr=at.getBoundingClientRect();if(fr.bottom<Te.top-120||fr.top>Te.bottom+120)continue;const Bn=fr.left-Te.left,mr=fr.top-Te.top;for(const Dt of pt.balls)Ct.push({x:Bn+Dt.body.position.x,y:mr+Dt.body.position.y,vx:Dt.body.velocity.x,vy:Dt.body.velocity.y,r:$t,isStatic:Dt.body.isStatic,push:(Hn,Un)=>Nn.Body.applyForce(Dt.body,Dt.body.position,{x:Hn,y:Un})}),Ye.push({x:Bn+Dt.body.position.x,y:mr+Dt.body.position.y-$t-20});for(const Dt of pt.links)for(const Hn of Dt.particles)Ye.push({x:Bn+Hn.position.x,y:mr+Hn.position.y-8})}const ot=$e==="roam";let bt=R.current,jn=!1;if(ge&&S.current)bt={x:S.current.x+28,y:S.current.y-52},jn=!1;else if(ce&&C.current&&C.current.fly)bt={x:C.current.x-Te.left+34,y:C.current.y-Te.top-46},jn=!1;else if(we)bt={x:we.pos.x-Te.left,y:we.pos.y-Te.top},we.fired||(we.fired=!0,yu());else if(ot){const pt=zn(Te,jt.rail,le);bt={x:pt.x-Te.left,y:pt.y-Te.top}}else{if(Ge.mode==="veil"){const pt=n5({x:je.body.position.x,y:je.body.position.y},Ye,220);pt&&(bt=pt,jn=!0)}(!bt||le>M.current)&&(R.current=t5(Be,Le,Ct,Math.floor(le/1e3)),M.current=le+3e3,bt=R.current)}const Fn=je.step(xe,bt,Ge.mode==="veil"&&!ot?[]:Ct,le,{settle:jn,ceilY:Xe()});if(Fn&&!A.current&&Wx(),A.current=Fn||je.dizzyRemaining(le)>0,je.dizzyRemaining(le)===0){const pt=cm(ke.weather);if(pt.wind>=.3){const at=je.body.mass;Nn.Body.applyForce(je.body,je.body.position,{x:lm(je.body.position.x,je.body.position.y,le)*pt.wind*om*at*2.2,y:0})}(ke.weather==="rain"||ke.weather==="storm")&&Ge.mode!=="veil"&&le>L.current&&(L.current=le+6e3+Math.random()*4e3,q.classList.add("cp-shiver"),setTimeout(()=>q.classList.remove("cp-shiver"),460))}const Xs=je.body.position,Qs={x:Te.left+Xs.x,y:Te.top+Xs.y},At=b.current??Qs;be=an(At,Qs,xe,Zs),$=je.body.angle+e5(je.body.velocity.x,je.body.velocity.y)}}else{x.current=null;const Be=I.current.pane;if(Be==="chat"&&We){Ce="chat";const Le=zn(We,jt.chat,le),je=b.current??{x:Le.x,y:Le.y};be=an(je,Le,xe,Wr,140),$=Math.max(-.25,Math.min(.25,(be.x-je.x)*.01))}else if(Be==="notebook"&&Ue){Ce="notebook";const Le=zn(Ue,jt.notebook,le),je=b.current??{x:Le.x,y:Le.y};be=an(je,Le,xe,Wr,140),$=Math.max(-.25,Math.min(.25,(be.x-je.x)*.01))}else if(Ie){Ce="rail";const Le=zn(Te,jt.rail,le),je=b.current??{x:Le.x,y:Le.y};be=an(je,Le,xe,Wr,140),$=Math.max(-.25,Math.min(.25,(be.x-je.x)*.01))}else{Ce="chat";const Le=zn({left:8,top:8,right:window.innerWidth-8,bottom:window.innerHeight-8},jt.chat,le),je=b.current??{x:Le.x,y:Le.y};be=an(je,Le,xe,Wr,140),$=Math.max(-.25,Math.min(.25,(be.x-je.x)*.008))}}}if(h.current!==Ce&&(h.current=Ce,c(Ce)),!be){q.style.opacity="0",b.current=null,k.current=null;return}b.current=be;const Ve=q.offsetWidth||jt[Ce],Mt=Ce==="rail"?Math.max(ye,re):ye;be.y<Mt+Ve/2+10&&(be.y=Mt+Ve/2+10),q.style.transform=`translate3d(${(be.x-Ve/2).toFixed(1)}px, ${(be.y-Ve/2).toFixed(1)}px, 0) rotate(${($*57.2958).toFixed(1)}deg)`;const ct=k.current;if(ct){const Re=be.x-ct.x,$e=be.y-ct.y,Ke=Math.hypot(Re,$e)/Math.max(1,xe);if(q.style.setProperty("--cp-speed",Math.min(1,Ke/.45).toFixed(3)),Ke>.02){const ut=(Math.atan2($e,Re)*57.2958+90+360)%360;q.style.setProperty("--cp-thrust-deg",ut.toFixed(1)+"deg")}}k.current={x:be.x,y:be.y}};return Z=requestAnimationFrame(ie),()=>{var le;cancelAnimationFrame(Z),(le=x.current)==null||le.dispose(),x.current=null}},[t.enabledLoaded,t.enabled,t.petMode,r]);const B=v.useRef(0);if(v.useEffect(()=>{const q=g.current;if(!q||t.state.keySeq===B.current)return;B.current=t.state.keySeq,q.classList.remove("cp-keypress"),q.offsetWidth,q.classList.add("cp-keypress");const Z=setTimeout(()=>q.classList.remove("cp-keypress"),160);return()=>clearTimeout(Z)},[t.state.keySeq]),!t.enabledLoaded||!t.enabled||t.petMode)return null;const W=i?"flying":t.state.typing?"typing":_||(a==null?void 0:a.dir)==="left"?"point":(a==null?void 0:a.dir)==="right"?"pointr":(a==null?void 0:a.dir)==="up"?"pointu":(a==null?void 0:a.dir)==="down"?"pointd":t.state.pose,D=a?jt[a.pane]:jt[l];return u.jsx("div",{ref:g,className:`cp-creature fixed left-0 top-0 z-40 will-change-transform ${t.state.mode==="veil"?"cp-veil":""} ${m?"cp-occluding":""} ${t.state.grabbed?"cp-grabbed":""}`,"data-testid":"companion-creature","data-zone":t.state.zone==="roam"?l:t.state.zone,"data-mode":t.state.mode,children:u.jsx(zf,{form:t.form,expression:t.state.expression,screenKey:t.state.typing?t.state.lastKey??(t.state.lastKeyKind==="enter"?"→":t.state.lastKeyKind==="back"?"⌫":null):null,keyFlash:t.state.typing&&t.state.lastKey==null&&(t.state.lastKeyKind==="enter"||t.state.lastKeyKind==="back"),coreLit:t.state.correctStreak>=3,noteTick:Date.now()<t.state.noteTickUntil,pose:W,viseme:n.viseme,openScale:n.open,energyRatio:t.energyRatio,streakLit:t.streakLit,size:D,interactive:!0,ariaLabel:"companion",onPoke:Hx,onGrab:(q,Z)=>{O.current||(O.current={x:q,y:Z,vx:0,vy:0,t:performance.now()},gu(!0))},haloBadge:t.halo,testid:"companion-mascot",keySeq:t.state.keySeq,keySide:t.state.keySide})})}function So(e){return e.length>=200||e.includes("```")?90:60}function a5(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function o5(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function bh(e,t){const n=Array.from({length:e},(r,i)=>i);for(let r=e-1;r>0;r--){const i=Math.floor(t()*(r+1)),s=n[r];n[r]=n[i],n[i]=s}return n}function l5(e,t){const n=o5(a5(t)),r=bh(e.length,n),i={};for(const s of e)i[s.id]=bh(Math.max(1,s.optionCount),n);return{questionOrder:r,optionPerms:i}}function c5(e,t){const n=e[t];return String(n??t)}function u5({stars:e}){return u.jsx("div",{className:"flex gap-1","aria-label":`${e} stars`,children:[1,2,3].map(t=>u.jsx($1,{className:`w-7 h-7 ${t<=e?"text-gold fill-gold":"text-ink/20"}`},t))})}function d5({examNode:e,locale:t,onExamCompleted:n,onSessionChange:r,paused:i}){const s=_e(),[a,o]=v.useState("loading"),[l,c]=v.useState(null),[h,f]=v.useState([]),[m,d]=v.useState(null),[p,g]=v.useState(0),[x,b]=v.useState(null),[k,T]=v.useState(null),[A,E]=v.useState(""),[C,_]=v.useState(0),[w,N]=v.useState(null),S=v.useRef({}),R=v.useRef(null),M=v.useRef(null),O=v.useRef(null),L=m?h[m.questionOrder[p]]??null:null,I=L&&m?m.optionPerms[L.id]??[]:[],j=(L==null?void 0:L.options)??[],U=I.length===j.length?I:j.map((P,K)=>K);v.useEffect(()=>{let P=!1;return o("loading"),E(""),T(null),c(null),(async()=>{try{const K=await X.examGetStatus(e.id);if(P)return;c(K),f(K.exercises),K.status==="generating"?o("generating"):K.status==="failed"?(E(K.error??s("exam.errorEmpty")),o("failed")):K.status==="ready"?K.latestAttempt&&K.latestAttempt.finishedAt?(T({correctCount:K.latestAttempt.correctCount,totalCount:K.latestAttempt.totalCount,stars:K.latestAttempt.stars,bestStars:K.bestStars,terminated:K.latestAttempt.terminated,perQuestion:K.latestAttempt.perQuestion??[]}),o("result")):o("ready"):(o("generating"),X.examPrepare(e.id,t??null).catch(()=>{}))}catch(K){P||(E(K instanceof Error?K.message:String(K)),o("failed"))}})(),()=>{P=!0}},[e.id]),v.useEffect(()=>X.on("exam:status",K=>{K.nodeId===e.id&&(K.status==="ready"?X.examGetStatus(e.id).then(V=>{c(V),f(V.exercises),o($=>$==="generating"?V.latestAttempt?"result":"ready":$)}).catch(()=>{}):K.status==="failed"?(E(K.error??s("exam.errorEmpty")),o("failed")):(c(V=>V&&{...V,...K}),o(V=>V==="loading"?"generating":V)))}),[e.id]);const B=v.useCallback(async()=>{var P;try{const K=await X.examStartAttempt(e.id),V=l5(K.exercises.map($=>{var ae;return{id:$.id,optionCount:((ae=$.options)==null?void 0:ae.length)??0}}),K.attemptId);f(K.exercises),R.current=K.attemptId,d(V),S.current={},g(0),b(null),T(null),M.current=null,o("answering"),_(So(((P=K.exercises[V.questionOrder[0]])==null?void 0:P.prompt)??""))}catch(K){E(K instanceof Error?K.message:String(K)),o("failed")}},[e.id]),W=v.useCallback(()=>{N(null),T(null),o("generating"),c(P=>P&&{...P,status:"generating",done:0,total:0}),X.examRegenerate(e.id,t??null).then(P=>{P.status==="failed"&&(E(P.error??s("exam.errorEmpty")),o("failed"))}).catch(P=>{E(P instanceof Error?P.message:String(P)),o("failed")})},[e.id,t,s]),D=u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:"btn-3d-neutral px-4 py-1.5 text-body","data-testid":"exam-regen-btn",onClick:P=>N(P.currentTarget.getBoundingClientRect()),children:[u.jsx(cs,{className:"w-3.5 h-3.5 inline"}),s("exam.regenerate")]}),w&&u.jsx(oa,{anchorRect:w,message:s("exam.regenerate.confirmMsg"),confirmLabel:s("exam.regenerate"),onConfirm:W,onCancel:()=>N(null)})]});v.useEffect(()=>{var P;a!=="answering"||!L||M.current!==L.id&&(_(So(L.prompt)),b(null),(P=O.current)==null||P.scrollTo({top:0}))},[p,a]),v.useEffect(()=>{if(a!=="answering"||i)return;const P=setInterval(()=>{_(K=>K>0?K-1:0)},1e3);return()=>clearInterval(P)},[a,i]);const q=v.useCallback(P=>{const K=L;if(!K||a!=="answering"||M.current===K.id)return;M.current=K.id;const V=P===null?"":c5(U,P),$={...S.current,[K.id]:V};S.current=$,R.current&&X.examRecordAnswer(e.id,R.current,K.id,V).catch(()=>{}),p+1<h.length?g(p+1):(o("submitting"),(async()=>{try{const ae=await X.examSubmitAttempt(e.id,R.current,$);T({correctCount:ae.correctCount,totalCount:ae.totalCount,stars:ae.stars,bestStars:ae.bestStars,terminated:ae.terminated,perQuestion:ae.perQuestion}),o("result"),n==null||n(),ae.stars>=1&&er("exam-pass")}catch(ae){E(ae instanceof Error?ae.message:String(ae)),o("failed")}})())},[L,a,U,p,h.length,e.id,n]),Z=v.useCallback(()=>{x!==null&&q(x)},[x,q]);if(v.useEffect(()=>{a!=="answering"||C>0||i||q(x)},[C,a,i]),v.useEffect(()=>{const P=async()=>{if(R.current)try{await X.examSubmitAttempt(e.id,R.current,S.current,{terminated:!0}),n==null||n()}catch{}},K=a==="answering"||a==="submitting";return r==null||r(K?{active:!0,terminate:P}:{active:!1,terminate:null}),()=>r==null?void 0:r({active:!1,terminate:null})},[a,e.id,n,r]),a==="loading")return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-loading",children:[u.jsx(Nr,{className:"w-12 h-12 text-accent mb-4 opacity-60"}),u.jsxs("div",{className:"flex gap-1",children:[u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),u.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"})]})]});if(a==="generating"){const P=(l==null?void 0:l.done)??0,K=(l==null?void 0:l.total)??0,V=K>0?Math.round(P/K*100):0;return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-generating",children:[u.jsx(Nr,{className:"w-12 h-12 text-accent mb-4 opacity-60"}),u.jsx("div",{className:"text-title font-bold text-ink mb-2",children:s("exam.generating.title")}),u.jsx("div",{className:"text-body text-ink-muted mb-4",children:s("exam.generating.stage")}),u.jsx("div",{className:"w-56 h-2.5 rounded-full bg-ink/10 overflow-hidden mb-2",role:"progressbar","aria-valuenow":V,"aria-valuemin":0,"aria-valuemax":100,children:u.jsx("div",{className:"h-full rounded-full bg-brand transition-all duration-500",style:{width:`${Math.max(4,V)}%`}})}),u.jsx("div",{className:"text-label text-ink-muted tabular-nums mb-6",children:K>0?s("exam.generating.kcProgress",{done:P,total:K}):s("exam.generating.preparing")}),u.jsx("div",{className:"text-caption text-ink-muted max-w-xs text-center",children:s("exam.generating.canLeave")})]})}if(a==="failed")return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center","data-testid":"exam-error",children:[u.jsx(Yo,{className:"w-10 h-10 text-warning mb-3"}),u.jsx("div",{className:"text-body font-bold text-ink mb-1",children:s("exam.errorTitle")}),u.jsx("div",{className:"text-body text-ink-muted mb-4 max-w-xs break-words",children:A||s("exam.errorEmpty")}),u.jsxs("button",{className:"btn-3d-brand px-4 py-1.5 text-body",onClick:()=>{o("generating"),X.examPrepare(e.id,t??null).catch(()=>{})},children:[u.jsx(cs,{className:"w-3.5 h-3.5 inline"}),s("exam.failed.retry")]})]});if(a==="ready"&&l){const P=l.exercises.reduce((V,$)=>V+So($.prompt),0),K=Math.max(1,Math.round(P/60));return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-ready",children:[u.jsx("div",{className:"w-14 h-14 rounded-full bg-brand/15 flex items-center justify-center mb-4",children:u.jsx(Nr,{className:"w-7 h-7 text-brand"})}),u.jsx("div",{className:"text-hero font-extrabold text-ink mb-1",children:s("exam.ready.title")}),u.jsx("div",{className:"text-body text-ink-muted mb-3 text-center",children:e.title}),u.jsx("div",{className:"text-label text-ink-muted mb-8",children:s("exam.ready.meta",{q:l.questionCount,kc:l.kcCount,min:K})}),u.jsxs("div",{className:"flex flex-col items-center gap-3",children:[u.jsxs("button",{className:"btn-3d-brand px-6 py-2 text-lead",onClick:B,"data-testid":"exam-start-btn",children:[s("exam.start"),u.jsx(Wo,{className:"w-4 h-4 inline ml-1"})]}),D]})]})}if(a==="answering"||a==="submitting"){if(!L)return null;const P=C<=10;return u.jsxs("div",{className:"flex-1 flex flex-col min-h-0","data-testid":"exam-answering",children:[u.jsxs("div",{className:"px-6 pt-6 w-full max-w-2xl mx-auto shrink-0",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("div",{className:"text-label text-ink-muted tabular-nums",children:s("exam.q.progress",{i:p+1,n:h.length})}),u.jsxs("div",{className:`flex items-center gap-1 text-label font-bold tabular-nums transition-colors ${P?"text-warning":"text-ink"}`,"data-testid":"exam-timer",children:[u.jsx(q1,{className:"w-3.5 h-3.5"}),Math.floor(C/60),":",String(C%60).padStart(2,"0")]})]}),u.jsx("div",{className:"w-full h-1.5 rounded-full bg-ink/10 overflow-hidden mb-6",children:u.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${p/h.length*100}%`}})})]}),u.jsxs("div",{ref:O,className:"flex-1 min-h-0 overflow-y-auto px-6 pb-6 w-full max-w-2xl mx-auto",children:[L.kcTitle&&u.jsxs("div",{className:"inline-flex items-center gap-1 text-caption text-accent bg-accent/10 rounded-full px-2.5 py-1 mb-3 self-start",children:[u.jsx(Fi,{className:"w-3 h-3"}),L.kcTitle]}),u.jsx("div",{className:"text-lead text-ink leading-relaxed mb-6 whitespace-pre-wrap break-words",children:L.prompt}),u.jsx("div",{className:"flex flex-col gap-2.5",children:U.map((K,V)=>u.jsx("button",{onClick:()=>b(V),"data-testid":`exam-option-${V}`,className:`text-left px-4 py-3 rounded-xl border transition-all duration-150 ${x===V?"border-accent bg-accent/15 text-ink":"border-ink/10 bg-ink/5 text-ink hover:border-ink/25"}`,children:u.jsx("span",{className:"text-body break-words",children:j[K]})},K))}),u.jsx("div",{className:"mt-6 flex justify-end",children:a==="submitting"?u.jsx("div",{className:"text-body text-ink-muted",children:s("exam.submitting")}):u.jsxs("button",{className:"btn-3d-brand px-5 py-2 text-body disabled:opacity-40 disabled:cursor-not-allowed",disabled:x===null,onClick:Z,"data-testid":"exam-next-btn",children:[p+1<h.length?s("exam.q.next"):s("exam.q.submit"),u.jsx(Wo,{className:"w-3.5 h-3.5 inline ml-1"})]})})]})]})}if(a==="result"&&k){const P=k.totalCount>0?Math.round(k.correctCount/k.totalCount*100):0,K=new Map;for(const $ of k.perQuestion){const ae=$.kcTitle??"";if(!ae)continue;const ne=K.get(ae)??{correct:0,total:0};ne.total++,$.correct&&ne.correct++,K.set(ae,ne)}const V=new Map(h.map($=>[$.id,$]));return u.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-8 max-w-2xl w-full mx-auto","data-testid":"exam-result",children:[u.jsxs("div",{className:"flex flex-col items-center mb-6",children:[u.jsx(u5,{stars:k.stars}),u.jsx("div",{className:"text-hero font-extrabold text-ink mt-3",children:s("exam.result.score",{correct:k.correctCount,total:k.totalCount})}),u.jsx("div",{className:"text-body text-ink-muted mt-1",children:s("exam.result.accuracy",{pct:P})}),u.jsxs("div",{className:"flex items-center gap-3 text-label text-ink-muted mt-2",children:[u.jsx("span",{children:s("exam.result.best",{stars:k.bestStars})}),l&&l.attemptCount>1&&u.jsx("span",{children:s("exam.result.attempts",{n:l.attemptCount})})]})]}),k.terminated&&u.jsxs("div",{className:"rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 mb-6 flex items-center gap-2",children:[u.jsx(Yo,{className:"w-4 h-4 text-warning shrink-0"}),u.jsx("span",{className:"text-body text-ink",children:s("exam.terminated.banner")})]}),K.size>0&&u.jsxs("div",{className:"mb-8",children:[u.jsx("div",{className:"text-title font-bold text-ink mb-3",children:s("exam.result.kcBreakdown")}),u.jsx("div",{className:"flex flex-col gap-2",children:[...K.entries()].map(([$,ae])=>{const Y=(ae.total>0?ae.correct/ae.total:0)<.6;return u.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 rounded-xl bg-ink/5","data-testid":"exam-kc-row",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u.jsx(Fi,{className:"w-3.5 h-3.5 text-accent shrink-0"}),u.jsx("span",{className:"text-body text-ink truncate",children:$})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[Y&&u.jsx("span",{className:"text-caption text-warning",children:s("exam.result.weakKc")}),u.jsxs("span",{className:"text-label text-ink-muted tabular-nums",children:[ae.correct,"/",ae.total]})]})]},$)})})]}),u.jsxs("div",{className:"mb-8",children:[u.jsx("div",{className:"text-title font-bold text-ink mb-3",children:s("exam.result.review")}),u.jsx("div",{className:"flex flex-col gap-2",children:k.perQuestion.map(($,ae)=>{const ne=V.get($.exerciseId),Y=$.options??(ne==null?void 0:ne.options)??null,ye=$.prompt??(ne==null?void 0:ne.prompt)??`#${ae+1}`,re=ie=>Y&&ie!==""&&Y[Number(ie)]!==void 0?Y[Number(ie)]:ie;return u.jsx("div",{className:"px-4 py-3 rounded-xl bg-ink/5","data-testid":"exam-review-row",children:u.jsxs("div",{className:"flex items-start gap-2",children:[$.correct?u.jsx(Bt,{className:"w-4 h-4 text-brand shrink-0 mt-0.5"}):u.jsx(Kt,{className:`w-4 h-4 shrink-0 mt-0.5 ${$.answered?"text-warning":"text-ink-muted"}`}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"text-body text-ink mb-1",children:ye}),u.jsx("div",{className:"text-caption text-ink-muted",children:$.answered?$.correct?u.jsx("span",{className:"text-brand",children:s("exam.result.correctLabel")}):u.jsxs(u.Fragment,{children:[s("exam.result.yourAnswer"),":",re($.userAnswer),u.jsx("span",{className:"mx-1",children:"·"}),s("exam.result.correctAnswer"),":",re($.correctAnswer)]}):s("exam.result.unanswered")}),$.explanation&&u.jsx("div",{className:"text-caption text-ink-muted mt-1 leading-relaxed",children:$.explanation})]})]})},$.exerciseId)})})]}),u.jsxs("div",{className:"flex justify-center items-center gap-3 pb-4",children:[u.jsxs("button",{className:"btn-3d-brand px-5 py-2 text-body",onClick:B,"data-testid":"exam-retry-btn",children:[u.jsx(cs,{className:"w-3.5 h-3.5 inline"}),s("exam.retryExam")]}),D]})]})}return null}const h5=[{id:"explain_simple",icon:Fi,labelKey:"command.explain_simple",group:"command.group.node",requiresNode:!0},{id:"quiz_3",icon:Ds,labelKey:"command.quiz_3",group:"command.group.node",requiresNode:!0},{id:"concept_map",icon:ec,labelKey:"command.concept_map",group:"command.group.node",requiresNode:!0},{id:"compare_prev",icon:d1,labelKey:"command.compare_prev",group:"command.group.node",requiresNode:!0},{id:"socratic",icon:Kf,labelKey:"command.socratic",group:"command.group.mode"},{id:"exam_mode",icon:Nr,labelKey:"command.exam_mode",group:"command.group.mode"}],f5=["command.group.node","command.group.mode","command.group.nav"];function m5({onClose:e,onPick:t,hasNode:n}){const r=_e(),[i,s]=v.useState(""),[a,o]=v.useState(0),l=v.useRef(null),c=v.useRef(null);v.useEffect(()=>{var d;(d=l.current)==null||d.focus()},[]),jr(c,!0);const f=h5.filter(d=>r(d.labelKey).toLowerCase().includes(i.toLowerCase())).filter(d=>!d.requiresNode||n),m=d=>{d.key==="ArrowDown"?(d.preventDefault(),o(p=>Math.min(p+1,f.length-1))):d.key==="ArrowUp"?(d.preventDefault(),o(p=>Math.max(p-1,0))):d.key==="Enter"&&f[a]&&(d.preventDefault(),t(f[a].id))};return u.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] px-4","data-testid":"command-palette",children:[u.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:e}),u.jsxs("div",{ref:c,role:"dialog","aria-modal":"true","aria-label":r("command.footer.hint"),className:"relative w-full max-w-lg bg-surface-0 rounded-xl shadow-elevated overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border-faint)]",children:[u.jsx(tc,{className:"w-4 h-4 text-ink-faint"}),u.jsx("input",{ref:l,value:i,onChange:d=>{s(d.target.value),o(0)},onKeyDown:m,placeholder:r("command.placeholder"),className:"flex-1 bg-transparent text-body text-ink-strong placeholder:text-ink-faint focus:outline-none","data-testid":"command-input"}),u.jsx("kbd",{className:"text-caption text-ink-faint px-1.5 py-0.5 rounded border border-[var(--border-faint)]",children:"ESC"})]}),u.jsx("div",{className:"max-h-80 overflow-y-auto py-2","data-testid":"command-list",children:f.length===0?u.jsx("div",{className:"px-4 py-6 text-center text-body text-ink-faint",children:r(n?"command.empty.node":"command.empty.nonode")}):f5.map(d=>{const p=f.filter(g=>g.group===d);return p.length===0?null:u.jsxs("div",{children:[u.jsx("div",{className:"px-4 pt-2 pb-1 text-caption font-bold text-ink-faint uppercase tracking-wider",children:r(d)}),p.map(g=>{const x=f.indexOf(g),b=g.icon;return u.jsxs("button",{onClick:()=>t(g.id),onMouseEnter:()=>o(x),"data-testid":`command-${g.id}`,className:`w-full flex items-center gap-3 px-4 py-2 text-left transition-colors ${x===a?"bg-brand/10 text-brand":"text-ink-muted hover:bg-surface-1 hover:bg-surface-3/50"}`,children:[u.jsx(b,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}),u.jsx("span",{className:"text-body font-medium flex-1",children:r(g.labelKey)})]},g.id)})]},d)})}),u.jsxs("div",{className:"px-4 py-2 border-t border-[var(--border-faint)] flex items-center justify-between text-caption text-ink-faint",children:[u.jsx("span",{children:r("command.footer.hint")}),u.jsx("span",{children:r("command.footer.keys")})]})]})]})}const ts="bg-ink/[0.04] text-ink-strong text-label rounded-lg border border-transparent focus:border-accent focus:bg-ink/[0.06] transition-colors placeholder:text-ink-faint";function Gi({kind:e,showProtocol:t=!0,testPrefix:n="custom",titleKey:r="settings.custom.form_title",modelPhKey:i="settings.custom.model_ph",testOverride:s,onSaved:a,onCancel:o}){const l=_e(),[c,h]=v.useState(""),[f,m]=v.useState("openai-compatible"),[d,p]=v.useState(""),[g,x]=v.useState(""),[b,k]=v.useState(""),[T,A]=v.useState(!1),[E,C]=v.useState(!1),[_,w]=v.useState(null),N=async()=>{if(!(!d.trim()||!b.trim()||E)){C(!0),w(null);try{const R=s?await s({baseUrl:d.trim(),apiKey:g.trim(),model:b.trim()}):await X.testCustomProvider({label:c||l("settings.custom.test_label"),protocol:f,baseUrl:d.trim(),apiKey:g.trim()||void 0,defaultModel:b.trim()});w({ok:R.ok,detail:R.detail})}catch(R){w({ok:!1,detail:R instanceof Error?R.message:String(R)})}finally{C(!1)}}},S=async()=>{if(!(!c.trim()||!d.trim()||!b.trim()))try{const R=await X.createCustomProvider({label:c.trim(),kind:e,protocol:t?f:"openai-compatible",baseUrl:d.trim(),apiKey:g.trim()||void 0,defaultModel:b.trim(),vision:e==="llm"?T:void 0});a(R)}catch{}};return u.jsxs("div",{className:"space-y-2.5","data-testid":`${n}-provider-form`,children:[u.jsx("div",{className:"text-label font-bold text-ink-strong",children:l(r)}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{type:"text",value:c,onChange:R=>h(R.target.value),placeholder:l("settings.custom.label_ph"),"data-testid":`${n}-label`,className:`${ts} flex-1 px-2.5 py-1.5`}),t&&u.jsxs("select",{value:f,onChange:R=>m(R.target.value),"data-testid":`${n}-protocol`,className:`${ts} px-2 py-1.5`,children:[u.jsx("option",{value:"openai-compatible",children:l("settings.proto.openai")}),u.jsx("option",{value:"anthropic",children:"Anthropic"}),u.jsx("option",{value:"google",children:"Google"})]})]}),u.jsx("input",{type:"text",value:d,onChange:R=>p(R.target.value),placeholder:l("settings.custom.baseurl_ph"),"data-testid":`${n}-baseurl`,className:`${ts} w-full px-2.5 py-1.5 font-mono`}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{type:"text",value:b,onChange:R=>k(R.target.value),placeholder:l(i),"data-testid":`${n}-model`,className:`${ts} flex-1 px-2.5 py-1.5 font-mono`}),u.jsx("input",{type:"password",value:g,onChange:R=>x(R.target.value),placeholder:l("settings.custom.apikey_ph"),"data-testid":`${n}-apikey`,className:`${ts} flex-1 px-2.5 py-1.5`})]}),e==="llm"&&u.jsxs("label",{className:"inline-flex items-center gap-2 text-label cursor-pointer select-none","data-testid":`${n}-vision`,children:[u.jsx("input",{type:"checkbox",checked:T,onChange:R=>A(R.target.checked),className:"w-4 h-4 rounded accent-brand"}),u.jsx("span",{className:"text-ink-strong",children:l("settings.custom.vision")}),u.jsx("span",{className:"text-ink-faint",children:l("settings.custom.visionHint")})]}),_&&u.jsxs("div",{className:`text-label rounded p-2 inline-flex items-start gap-1.5 ${_.ok?"bg-brand/10 text-brand":"bg-warning/10 text-warning"}`,children:[_.ok?u.jsx(tn,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}):u.jsx(lr,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}),u.jsx("span",{className:"break-words",children:_.detail})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>void N(),disabled:!d.trim()||!b.trim()||E,"data-testid":`${n}-test`,className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:l(E?"settings.testing":"settings.test")}),u.jsx("button",{onClick:()=>void S(),disabled:!c.trim()||!d.trim()||!b.trim(),"data-testid":`${n}-save`,className:"btn-3d-brand px-3 py-1.5 text-label disabled:opacity-40",children:l("settings.custom.save")}),o&&u.jsx("button",{onClick:o,className:"text-label text-ink-muted hover:text-ink-strong px-3 py-1.5 transition-colors",children:l("action.cancel")})]})]})}const O0="lookatstudy-theme",yh="auto",j0="(prefers-color-scheme: dark)";function Co(){return typeof window>"u"||window.matchMedia(j0).matches?"dark":"light"}function p5(){if(typeof localStorage>"u")return yh;const e=localStorage.getItem(O0);return e==="auto"||e==="light"||e==="dark"?e:yh}function Ao(e){const t=document.documentElement;t.classList.remove("dark","light"),t.classList.add(e),window.dispatchEvent(new CustomEvent("theme-changed",{detail:{resolved:e}}))}function g5(){const[e,t]=v.useState(()=>p5()),[n,r]=v.useState(()=>e==="auto"?Co():e),i=v.useCallback(s=>{t(s),localStorage.setItem(O0,s);const a=s==="auto"?Co():s;r(a),Ao(a)},[]);return v.useEffect(()=>{if(e!=="auto")return;const s=window.matchMedia(j0),a=o=>{const l=o.matches?"dark":"light";r(l),Ao(l)};return s.addEventListener("change",a),()=>s.removeEventListener("change",a)},[e]),v.useEffect(()=>{const s=e==="auto"?Co():e;r(s),Ao(s)},[e]),{mode:e,resolved:n,setMode:i}}function mi(){window.dispatchEvent(new Event(yl))}const dn="bg-surface-1 text-ink text-body rounded-lg border border-[var(--border)] focus:border-brand focus:outline-none transition-colors placeholder:text-ink-faint",Jt="bg-surface-3 text-ink-muted hover:bg-surface-3 hover:bg-surface-3 hover:text-ink-strong",en="bg-brand text-white shadow-sm";function nt(e){return e?"px-4 py-3.5 border-t border-[var(--border-faint)]":"px-4 py-3.5"}function x5(){const e=_e(),[t,n]=v.useState([]),[r,i]=v.useState([]),[s,a]=v.useState("glm"),[o,l]=v.useState(""),[c,h]=v.useState(""),[f,m]=v.useState(null),[d,p]=v.useState(!1),[g,x]=v.useState(null),[b,k]=v.useState(!1),[T,A]=v.useState(!1),[E,C]=v.useState([]),[_,w]=v.useState(!1),[N,S]=v.useState(null),[R,M]=v.useState(null),[O,L]=v.useState(""),[I,j]=v.useState(!1),U=g5(),B=async Y=>{if($)try{await X.updateCustomProvider($.id,{vision:Y}),await D()}catch{}},W=async()=>{w(!0),S(null);try{const Y=await X.discoverModels();Y.ok&&Y.models?C(Y.models):S(Y.error||e("settings.discover_failed"))}catch(Y){S(Y instanceof Error?Y.message:String(Y))}finally{w(!1)}},D=v.useCallback(async()=>{try{const[Y,ye,re,ie]=await Promise.all([X.getProviderPresets(),X.listCustomProviders(),X.getSetting("active_provider"),X.getSetting("active_model")]);n(Y),i(ye);const le=re??"glm";if(a(le),le.startsWith("custom-")){const xe=ye.find(ke=>ke.id===le);m(xe!=null&&xe.hasApiKey?e("settings.key.configured"):null)}else{const xe=Y.find(ke=>ke.id===le);if(xe){const ke=await X.getSetting(xe.apiKeySetting);m(ke?`${ke.slice(0,4)}…${ke.slice(-4)}`:null)}}if(le.startsWith("custom-")){const xe=ye.find(ke=>ke.id===le);l(ie??(xe==null?void 0:xe.defaultModel)??"")}else{const xe=Y.find(ke=>ke.id===le);l(ie??(xe==null?void 0:xe.defaultModel)??"")}}catch(Y){console.error("[SettingsView] load() failed:",Y)}},[e]);v.useEffect(()=>{D()},[D]);const q=async Y=>{a(Y),x(null),h("");const ye=t.find(re=>re.id===Y);if(ye){const re=await X.getSetting(ye.apiKeySetting);m(re?`${re.slice(0,4)}…${re.slice(-4)}`:null),l(o||ye.defaultModel)}},Z=async()=>{k(!1);try{if(await X.setSetting("active_provider",s),await X.setSetting("active_model",o),c.trim()){const Y=t.find(ye=>ye.id===s);Y&&(await X.setSetting(Y.apiKeySetting,c.trim()),m(`${c.trim().slice(0,4)}…${c.trim().slice(-4)}`),h(""))}k(!0),setTimeout(()=>k(!1),2e3),window.dispatchEvent(new Event("llm-config-changed"))}catch{}},P=async()=>{p(!0),x(null);try{const Y=await X.testLlmConnection();x(Y)}catch(Y){x({ok:!1,detail:Y instanceof Error?Y.message:String(Y),errorKind:"unknown"})}finally{p(!1)}},K=async Y=>{await X.setSetting("active_provider",Y.id),await X.setSetting("active_model",Y.defaultModel),a(Y.id),l(Y.defaultModel),A(!1),await D(),window.dispatchEvent(new Event("llm-config-changed"))},V=async Y=>{try{await X.deleteCustomProvider(Y),s===Y&&(await X.setSetting("active_provider","glm"),a("glm")),await D()}catch{}},$=s.startsWith("custom-")?r.find(Y=>Y.id===s):null;v.useEffect(()=>{if(!$)return;const Y=$.models.find(ye=>ye.id===o);L(Y!=null&&Y.contextWindow?String(Y.contextWindow):"")},[$,o]);const ae=async()=>{var le,xe;if(!$)return;const Y=O.trim().replace(/[,\s_]/g,""),ye=/^(\d+)([km]?)$/i.exec(Y);if(Y!==""&&!ye)return;const re=((le=ye==null?void 0:ye[2])==null?void 0:le.toLowerCase())==="k"?1e3:((xe=ye==null?void 0:ye[2])==null?void 0:xe.toLowerCase())==="m"?1e6:1,ie=Y===""||!ye?null:Math.max(1,Math.round(parseInt(ye[1],10)*re));j(!0);try{const ke=$.models.map(ze=>ze.id===o?{...ze,contextWindow:ie}:ze);await X.updateCustomProvider($.id,{models:ke}),await D(),window.dispatchEvent(new Event("llm-config-changed"))}catch{}finally{j(!1)}},ne=s.startsWith("custom-")?null:t.find(Y=>Y.id===s);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"px-5 pt-5 space-y-6",children:[u.jsxs("section",{children:[u.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:e("settings.group.ai")}),u.jsxs("div",{className:"surface-card overflow-hidden",children:[u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.row.provider")}),u.jsxs("div",{className:"flex flex-wrap gap-1.5","data-testid":"provider-grid",children:[t.map(Y=>u.jsx("button",{onClick:()=>q(Y.id),"data-testid":`provider-card-${Y.id}`,"aria-pressed":s===Y.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors ${s===Y.id?en:Jt}`,children:Y.label},Y.id)),r.filter(Y=>Y.kind==="llm").map(Y=>u.jsxs("button",{onClick:()=>q(Y.id),"data-testid":`provider-card-${Y.id}`,"aria-pressed":s===Y.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors inline-flex items-center gap-1 ${s===Y.id?en:Jt}`,children:[u.jsx(js,{className:"w-3.5 h-3.5","aria-hidden":"true"}),Y.label]},Y.id)),u.jsxs("button",{onClick:()=>A(Y=>!Y),"data-testid":"add-custom-provider",className:"px-3 py-1.5 rounded-lg text-label whitespace-nowrap inline-flex items-center gap-1 border border-dashed border-[var(--border)] text-ink-muted hover:border-ink-muted hover:text-ink-strong transition-colors",children:[u.jsx(aa,{className:"w-3.5 h-3.5","aria-hidden":"true"}),e("settings.add_custom")]})]})]}),T&&u.jsx("div",{className:"px-4 py-3.5 bg-surface-1 border-t border-[var(--border-faint)]",children:u.jsx(Gi,{kind:"llm",testPrefix:"custom",onSaved:Y=>void K(Y),onCancel:()=>A(!1)})}),r.length>0&&s.startsWith("custom-")&&u.jsx("div",{className:nt(!0),children:u.jsx("button",{onClick:Y=>{const ye=Y.currentTarget.getBoundingClientRect(),re=r.find(ie=>ie.id===s);re&&M({id:re.id,label:re.label,rect:ye})},className:"text-label text-warning hover:underline",children:e("settings.delete_custom")})}),ne&&u.jsxs(u.Fragment,{children:[ne.baseUrl&&u.jsxs("div",{className:nt(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:"Base URL"}),u.jsx("code",{className:"text-label text-ink-faint font-mono break-all",children:ne.baseUrl})]}),u.jsxs("div",{className:nt(!0),children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:e("settings.model")}),u.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[u.jsxs("select",{value:o,onChange:Y=>l(Y.target.value),"data-testid":"model-select",className:`${dn} flex-1 px-2.5 py-1.5`,children:[ne.models.map(Y=>u.jsx("option",{value:Y.id,children:Y.id},Y.id)),s==="openrouter"&&E.map(Y=>u.jsx("option",{value:Y.id,children:Y.id},Y.id))]}),s==="openrouter"&&u.jsxs("button",{onClick:W,disabled:_,"data-testid":"discover-models-btn",className:"text-label text-accent hover:underline disabled:opacity-40 whitespace-nowrap inline-flex items-center gap-1",children:[u.jsx(j1,{className:`w-3.5 h-3.5 ${_?"animate-spin":""}`,"aria-hidden":"true"}),e(_?"settings.discovering":"settings.refresh")]})]})]}),N&&u.jsx("div",{className:"text-label text-warning mt-1.5 ml-[68px]",children:N})]}),u.jsx("div",{className:nt(!0),children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:e("settings.apikey")}),u.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[f&&u.jsxs("span",{className:"text-label text-brand shrink-0 inline-flex items-center gap-1",children:[u.jsx(tn,{className:"w-3.5 h-3.5","aria-hidden":"true"}),f]}),u.jsx("input",{type:"password",value:c,onChange:Y=>h(Y.target.value),placeholder:e(f?"settings.key.overwrite_ph":"settings.key.paste_ph"),"data-testid":"settings-key-input",className:`${dn} flex-1 px-2.5 py-1.5`}),u.jsx("a",{href:ne.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-label text-brand hover:underline whitespace-nowrap",children:e("settings.key.get")})]})]})}),u.jsx("div",{className:nt(!0),children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("button",{onClick:P,disabled:d,"data-testid":"test-connection-btn",className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:e(d?"settings.testing":"settings.test")}),g&&u.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${g.ok?"text-brand":"text-warning"}`,children:[g.ok?u.jsx(tn,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(lr,{className:"w-4 h-4","aria-hidden":"true"}),g.detail]})]})})]}),$&&!ne&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:nt(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:"Base URL"}),u.jsx("code",{className:"text-label text-ink-faint font-mono break-all",children:$.baseUrl})]}),u.jsx("div",{className:nt(!0),children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:e("settings.model")}),$.models.length>1?u.jsx("select",{value:o,onChange:Y=>l(Y.target.value),"data-testid":"model-select-custom",className:`${dn} flex-1 px-2.5 py-1.5`,children:$.models.map(Y=>u.jsx("option",{value:Y.id,children:Y.id},Y.id))}):u.jsx("input",{type:"text",value:o,onChange:Y=>l(Y.target.value),placeholder:e("settings.custom.model_ph"),"data-testid":"model-input-custom",className:`${dn} flex-1 px-2.5 py-1.5 font-mono`})]})}),u.jsxs("div",{className:nt(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.custom.windowLabel")}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{type:"text",inputMode:"numeric",value:O,onChange:Y=>L(Y.target.value),placeholder:e("settings.custom.windowPh"),"data-testid":"context-window-input",className:`${dn} flex-1 px-2.5 py-1.5 font-mono tabular-nums`}),u.jsx("button",{onClick:ae,disabled:I,"data-testid":"context-window-save",className:"btn-3d-neutral px-3 py-1.5 text-label shrink-0 disabled:opacity-40",children:e("settings.custom.save")})]}),u.jsx("div",{className:"text-caption text-ink-faint mt-1",children:e("settings.custom.windowHint")})]}),u.jsx("div",{className:nt(!0),children:u.jsxs("label",{className:"inline-flex items-center gap-2 text-label cursor-pointer select-none","data-testid":"custom-vision-toggle",children:[u.jsx("input",{type:"checkbox",checked:$.vision,onChange:Y=>void B(Y.target.checked),className:"w-4 h-4 rounded accent-brand"}),u.jsx("span",{className:"text-ink-strong",children:e("settings.custom.vision")}),u.jsx("span",{className:"text-ink-faint",children:e("settings.custom.visionHint")})]})}),u.jsx("div",{className:nt(!0),children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("button",{onClick:P,disabled:d,"data-testid":"test-connection-btn",className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:e(d?"settings.testing":"settings.test")}),g&&u.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${g.ok?"text-brand":"text-warning"}`,children:[g.ok?u.jsx(tn,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(lr,{className:"w-4 h-4","aria-hidden":"true"}),g.detail]})]})})]})]})]}),u.jsxs("section",{children:[u.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:e("settings.group.vision")}),u.jsx("div",{className:"surface-card overflow-hidden",children:u.jsx(y5,{activeProvider:s,activeModel:o,presets:t,customProviders:r})})]}),u.jsxs("section",{children:[u.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:e("settings.group.speech")}),u.jsx("div",{className:"surface-card overflow-hidden",children:u.jsx(T5,{})})]}),u.jsxs("section",{children:[u.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:e("settings.group.memory")}),u.jsx("div",{className:"surface-card overflow-hidden",children:u.jsx(v5,{})})]}),u.jsxs("section",{children:[u.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:e("settings.group.companion")}),u.jsx("div",{className:"surface-card overflow-hidden",children:u.jsx(E5,{})})]}),u.jsxs("section",{children:[u.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:e("settings.group.appearance")}),u.jsxs("div",{className:"surface-card overflow-hidden",children:[u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.row.theme")}),u.jsx("div",{className:"flex gap-2",children:[{mode:"auto",label:e("settings.theme.auto")},{mode:"light",label:e("settings.theme.light")},{mode:"dark",label:e("settings.theme.dark")}].map(({mode:Y,label:ye})=>u.jsx("button",{onClick:()=>U.setMode(Y),"data-testid":`theme-${Y}`,"aria-pressed":U.mode===Y,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${U.mode===Y?en:Jt}`,children:ye},Y))}),u.jsx("p",{className:"text-label text-ink-muted mt-2",children:U.mode==="auto"?e("settings.theme.following",{mode:e(`settings.theme.${U.resolved}`)}):null})]}),u.jsxs("div",{className:nt(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.row.interface_lang")}),u.jsx("div",{className:"flex gap-2",children:["zh-CN","en"].map(Y=>u.jsx("button",{onClick:()=>J1(Y),"data-testid":`lang-${Y}`,"aria-pressed":Mr()===Y,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${Mr()===Y?en:Jt}`,children:Y==="zh-CN"?"中文":"English"},Y))})]}),u.jsxs("div",{className:nt(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.row.import_lang")}),u.jsx(b5,{})]})]})]})]}),u.jsxs("div",{className:"sticky bottom-0 px-5 py-3 bg-surface-0 border-t border-[var(--border)] flex items-center justify-between gap-3",children:[u.jsx("span",{className:"text-label text-ink-muted",children:e("settings.footer.hint")}),u.jsxs("button",{onClick:Z,"data-testid":"settings-save",className:"btn-3d-brand px-5 py-2 text-body inline-flex items-center gap-1.5",children:[b&&u.jsx(Bt,{className:"w-4 h-4","aria-hidden":"true"}),e(b?"settings.saved_text":"settings.footer.save")]})]}),R&&u.jsx(oa,{anchorRect:R.rect,message:e("settings.delete_custom_confirm",{name:R.label}),danger:!0,confirmLabel:e("action.delete"),testid:"custom-provider-delete-confirm",onConfirm:()=>{V(R.id),M(null)},onCancel:()=>M(null)})]})}function b5(){const[e,t]=v.useState("en"),[n,r]=v.useState(!1);v.useEffect(()=>{X.getSetting("pref_lang").then(a=>{a&&t(a),r(!0)})},[]);const i=async a=>{t(a),await X.setSetting("pref_lang",a)},s=[{code:"en",label:"English"},{code:"zh-CN",label:"简体中文"},{code:"zh-TW",label:"繁體中文"}];return n?u.jsx("div",{className:"flex gap-2","data-testid":"pref-lang-options",children:s.map(a=>u.jsx("button",{onClick:()=>i(a.code),"data-testid":`pref-lang-${a.code}`,"aria-pressed":e===a.code,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${e===a.code?en:Jt}`,children:a.label},a.code))}):null}function y5({activeProvider:e,activeModel:t,presets:n,customProviders:r}){const i=_e(),[s,a]=v.useState(!1),[o,l]=v.useState(!1),[c,h]=v.useState(""),[f,m]=v.useState(!1),[d,p]=v.useState(!1),[g,x]=v.useState(null);v.useEffect(()=>{Promise.all([X.getSetting("flag_multimodal_import"),X.getSetting("vision_provider_override"),X.getSetting("vision_model_override")]).then(([w,N])=>{a(w==="true"),h(N??""),l(!0)})},[]);const b=async()=>{const w=!s;a(w),await X.setSetting("flag_multimodal_import",String(w))},k=async w=>{await X.setSetting("vision_provider_override",w.id),await X.setSetting("vision_model_override",w.defaultModel),h(w.id),m(!1)},T=async()=>{await X.setSetting("vision_provider_override",""),await X.setSetting("vision_model_override",""),h(""),m(!1)},A=async()=>{if(!d){p(!0),x(null);try{const w=await X.testLlmConnection({vision:!0});x({ok:w.ok,detail:w.detail})}catch(w){x({ok:!1,detail:w instanceof Error?w.message:String(w)})}finally{p(!1)}}},E=r.filter(w=>w.kind==="vision"),C=c.startsWith("custom-")?r.find(w=>w.id===c):null,_=c&&!c.startsWith("custom-")?n.find(w=>w.id===c):null;return o?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[u.jsx(Ir,{checked:s,onChange:b,label:i("settings.multimodal.toggle"),testid:"multimodal-toggle"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium text-ink-strong",children:i("settings.multimodal.toggle")}),u.jsx("div",{className:"text-label text-ink-muted",children:i("settings.multimodal.toggle.desc")})]})]}),u.jsxs("div",{className:"px-4 py-3.5 border-t border-[var(--border-faint)] space-y-3",children:[u.jsxs("div",{className:"text-label text-ink-muted bg-ink/5 rounded-lg p-3",children:[u.jsx("div",{className:"font-medium mb-1",children:i("settings.multimodal.current_model",{model:t||i("settings.multimodal.not_selected")})}),u.jsx("div",{children:e.startsWith("custom-")?i("settings.multimodal.hint_custom"):i("settings.multimodal.hint_preset")})]}),u.jsxs("div",{className:"bg-ink/5 rounded-lg p-3",children:[u.jsx("div",{className:"text-label font-medium text-ink-muted mb-2",children:i("settings.multimodal.override_title")}),u.jsx("div",{className:"text-caption text-ink-muted mb-2",children:i("settings.multimodal.override_bridge_hint")}),u.jsxs("div",{className:"space-y-3 mt-1",children:[C&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[u.jsx(js,{className:"w-3.5 h-3.5 text-ink-faint shrink-0","aria-hidden":"true"}),u.jsx("span",{className:"font-medium text-ink-strong",children:C.label}),u.jsx("code",{className:"text-ink-faint font-mono break-all",children:C.defaultModel}),u.jsx("span",{className:"text-ink-faint break-all min-w-0",children:C.baseUrl})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("button",{onClick:()=>void A(),disabled:d,"data-testid":"vision-override-test",className:"btn-3d-neutral px-4 py-1.5 text-label disabled:opacity-50",children:i(d?"settings.testing":"settings.multimodal.test_override")}),u.jsx("button",{onClick:()=>m(w=>!w),className:"text-label text-accent hover:underline",children:i("settings.multimodal.replace_custom")}),u.jsx("button",{onClick:()=>void T(),className:"text-label text-ink-muted hover:text-ink-strong",children:i("settings.multimodal.stop_override")}),g&&u.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${g.ok?"text-brand":"text-warning"}`,children:[g.ok?u.jsx(tn,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(lr,{className:"w-4 h-4","aria-hidden":"true"}),g.detail]})]})]}),_&&u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[u.jsx("span",{className:"text-ink-muted",children:i("settings.multimodal.legacy_preset",{label:_.label})}),u.jsx("button",{onClick:()=>void T(),className:"text-label text-ink-muted hover:text-ink-strong underline",children:i("settings.multimodal.stop_override")})]}),!C&&!_&&u.jsxs(u.Fragment,{children:[E.map(w=>u.jsxs("button",{onClick:()=>void k(w),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`vision-pick-${w.id}`,children:[u.jsx("span",{className:"text-label font-medium text-ink-strong",children:w.label}),u.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:w.defaultModel})]},w.id)),(f||E.length===0)&&u.jsx(Gi,{kind:"vision",testPrefix:"vision-custom",titleKey:"settings.custom.form_title_vision",modelPhKey:"settings.custom.model_ph_vision",onSaved:w=>void k(w),onCancel:()=>m(!1)}),E.length>0&&u.jsx("button",{onClick:()=>m(w=>!w),className:"text-label text-accent hover:underline",children:i(f?"action.cancel":"settings.custom.new")})]})]})]})]})]}):null}function v5(){const e=_e(),[t,n]=v.useState(!1),[r,i]=v.useState(!1);v.useEffect(()=>{X.getSetting("flag_memory_system").then(a=>{n(a==="true"),i(!0)})},[]);const s=async()=>{const a=!t;n(a),await X.setSetting("flag_memory_system",String(a))};return r?u.jsxs("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[u.jsx(Ir,{checked:t,onChange:s,label:e("settings.memory.toggle"),testid:"memory-toggle"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium text-ink-strong",children:e("settings.memory.toggle")}),u.jsx("div",{className:"text-label text-ink-muted",children:e("settings.memory.toggle.desc")})]})]}):null}function E5(){const e=_e(),[t,n]=v.useState(!0),[r,i]=v.useState(!1),s=v.useSyncExternalStore(Uf,qo),[a,o]=v.useState(!0),[l,c]=v.useState(!1),h=typeof window<"u"&&!!window.__lookatstudyWeb;v.useEffect(()=>{X.getSetting("companion_enabled").then(g=>{n(g!=="false"&&g!=="0"),i(!0)}),X.getSetting("companion_sfx").then(g=>{o(g!=="false"&&g!=="0")}),X.getSetting("companion_pet_mode").then(g=>{c(g==="1")})},[]);const f=async()=>{const g=!t;n(g),await X.setSetting("companion_enabled",String(g)),window.dispatchEvent(new Event("companion-config-changed"))},m=async()=>{const g=!a;o(g),await X.setSetting("companion_sfx",String(g)),window.dispatchEvent(new Event("companion-config-changed"))},d=async()=>{const g=!l;c(g),await X.setSetting("companion_pet_mode",g?"1":"0"),window.dispatchEvent(new Event("companion-config-changed"))},p=async g=>{g!==s.form&&(await X.setSetting("companion_form",g),window.dispatchEvent(new Event("companion-config-changed")))};return r?u.jsxs("div",{className:"px-4 py-3.5 flex flex-col gap-4",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Ir,{checked:t,onChange:f,label:e("settings.companion.toggle"),testid:"companion-toggle"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium text-ink-strong",children:e("settings.companion.toggle")}),u.jsx("div",{className:"text-label text-ink-muted",children:e("settings.companion.toggle.desc")})]})]}),t&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Ir,{checked:a,onChange:m,label:e("settings.companion.sfx"),testid:"companion-sfx-toggle"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium text-ink-strong",children:e("settings.companion.sfx")}),u.jsx("div",{className:"text-label text-ink-muted",children:e("settings.companion.sfx.desc")})]})]}),!h&&u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Ir,{checked:l,onChange:d,label:e("settings.companion.pet"),testid:"companion-pet-toggle"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium text-ink-strong",children:e("settings.companion.pet")}),u.jsx("div",{className:"text-label text-ink-muted",children:e("settings.companion.pet.desc")})]})]}),u.jsxs("div",{children:[u.jsx("div",{className:"text-label text-ink-muted mb-2",children:e("settings.companion.form")}),u.jsx("div",{className:"grid grid-cols-5 gap-2",role:"radiogroup","aria-label":e("settings.companion.form"),children:Xx.map(g=>{const x=s.form===g;return u.jsxs("button",{type:"button",role:"radio","aria-checked":x,"data-testid":`companion-form-${g}`,onClick:()=>{p(g)},className:`flex flex-col items-center gap-0.5 rounded-xl p-1.5 border motion-safe:transition-colors
|
|
518
|
+
${x?"border-[var(--accent)] bg-surface-2 shadow-card":"border-[var(--border-faint)] hover:bg-surface-2"}`,title:e(`companion.form.${g}.desc`),children:[u.jsx(zf,{form:g,expression:"happy",pose:"float",size:64}),u.jsx("span",{className:`text-label ${x?"text-ink-strong font-medium":"text-ink-muted"}`,children:e(`companion.form.${g}.name`)})]},g)})})]})]})]}):null}function Ir({checked:e,onChange:t,label:n,testid:r}){return u.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,onClick:t,"data-testid":r,className:`relative w-12 h-6 rounded-full transition-colors shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/60 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)] ${e?"bg-brand":"bg-ink/20 hover:bg-ink/25"}`,children:u.jsx("span",{className:`absolute left-0.5 top-1/2 -translate-y-1/2 w-5 h-5 rounded-full bg-white shadow transition-transform ${e?"translate-x-6":""}`})})}const k5=[{id:"zh-CN-XiaoxiaoNeural",label:"zh-CN · 晓晓(女)"},{id:"zh-CN-XiaoyiNeural",label:"zh-CN · 晓伊(女)"},{id:"zh-CN-YunxiNeural",label:"zh-CN · 云希(男)"},{id:"zh-CN-YunyangNeural",label:"zh-CN · 云扬(男·新闻)"},{id:"zh-CN-liaoning-XiaobeiNeural",label:"zh-CN · 晓北(女·东北)"},{id:"zh-CN-shaanxi-XiaoniNeural",label:"zh-CN · 晓妮(女·陕西)"},{id:"en-US-AriaNeural",label:"en-US · Aria(女)"},{id:"en-US-GuyNeural",label:"en-US · Guy(男)"},{id:"en-US-JennyNeural",label:"en-US · Jenny(女)"}],w5=[{sid:"45",label:"zf_xiaobei(女)"},{sid:"46",label:"zf_xiaoni(女)"},{sid:"47",label:"zf_xiaoxiao(女)"},{sid:"48",label:"zf_xiaoyi(女·默认)"},{sid:"49",label:"zm_yunjian(男)"},{sid:"50",label:"zm_yunxi(男)"},{sid:"51",label:"zm_yunxia(男)"},{sid:"52",label:"zm_yunyang(男)"}];function T5(){const e=_e(),[t,n]=v.useState([]),[r,i]=v.useState(null),[s,a]=v.useState(null),[o,l]=v.useState(null),[c,h]=v.useState(null),[f,m]=v.useState("edge"),[d,p]=v.useState("zh-CN-XiaoxiaoNeural"),[g,x]=v.useState("48"),[b,k]=v.useState("1.0"),[T,A]=v.useState(""),[E,C]=v.useState(""),[_,w]=v.useState([]),N=typeof window<"u"&&"speechSynthesis"in window,[S,R]=v.useState("local"),[M,O]=v.useState("asr-whisper-turbo"),[L,I]=v.useState(!0),[j,U]=v.useState([]),[B,W]=v.useState(!1),[D,q]=v.useState(!1),[Z,P]=v.useState(!1),[K,V]=v.useState(!1),[$,ae]=v.useState(!1),[ne,Y]=v.useState(null),[ye,re]=v.useState(!1),[ie,le]=v.useState(null),[xe,ke]=v.useState(null),ze=v.useCallback(()=>{X.listCustomProviders().then(Q=>U(Q.filter(Oe=>Oe.kind==="tts"||Oe.kind==="asr"))).catch(()=>{})},[]);v.useEffect(()=>{Promise.all([X.getSetting("tts_engine"),X.getSetting("tts_voice_edge"),X.getSetting("tts_sid_local"),X.getSetting("tts_speed"),X.getSetting("tts_custom_voice"),X.getSetting("tts_system_voice"),X.getSetting("asr_engine"),X.getSetting("asr_local_model"),X.getSetting("asr_auto_stop")]).then(([Q,Oe,rt,Et,Re,$e,it,Ke,ut])=>{Q&&m(Q),Oe&&p(Oe),rt&&x(rt),Et&&k(Et),Re&&A(Re),$e&&C($e),it&&R(it),(Ke==="asr-whisper-turbo"||Ke==="asr-whisper-small")&&O(Ke),I(ut!=="0")}),ze()},[ze]),v.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const Q=()=>w(vl(window.speechSynthesis.getVoices()));return Q(),window.speechSynthesis.addEventListener("voiceschanged",Q),()=>window.speechSynthesis.removeEventListener("voiceschanged",Q)},[]);const Te=v.useCallback(()=>{window.api.getSpeechModelStatus().then(Q=>n(Q)).catch(()=>{})},[]);v.useEffect(()=>(Te(),window.api.on("speech:modelProgress",Oe=>{l({id:Oe.id,pct:Math.floor(Oe.progress*100),label:Oe.currentFile?Oe.currentFile.split("/").pop()??"":""})})),[Te]);const Ge=Q=>{a(null),i(Q),l({id:Q,pct:0,label:""}),window.api.ensureSpeechModel(Q).then(()=>{i(null),l(null),Te()}).catch(Oe=>{i(null),l(null),a(Oe instanceof Error?Oe.message:String(Oe)),Te()})},oe=Q=>{i(Q),h(null),window.api.deleteSpeechModel(Q).then(Te).catch(Oe=>a(Oe instanceof Error?Oe.message:String(Oe))).finally(()=>i(null))},Ie=Q=>e(Q==="tts-kokoro"?"settings.speech.model.tts":Q==="asr-whisper-turbo"?"settings.speech.model.asr_turbo":"settings.speech.model.asr_small"),We=Q=>e(Q==="asr-whisper-turbo"?"settings.speech.model.turbo_short":"settings.speech.model.small_short"),Ue=Q=>Q.startsWith("asr-whisper")?e("settings.speech.license_mit"):e("settings.speech.license"),Xe=Q=>e(Q==="ready"?"settings.speech.state.ready":Q==="error"?"settings.speech.state.error":"settings.speech.state.absent"),De=Q=>{var Oe;return((Oe=t.find(rt=>rt.id===Q))==null?void 0:Oe.state)??"absent"},we=Q=>{m(Q),Y(null),X.setSetting("tts_engine",Q),mi()},ee=Q=>{C(Q),X.setSetting("tts_system_voice",Q),mi()},ce=Q=>{R(Q),le(null),X.setSetting("asr_engine",Q)},ve=j.filter(Q=>Q.kind==="tts"),ge=j.filter(Q=>Q.kind==="asr"),Se=f.startsWith("custom-")?ve.find(Q=>Q.id===f)??null:null,de=S.startsWith("custom-")?ge.find(Q=>Q.id===S)??null:null,be=f==="azure",Ce=S==="groq",Ve=S==="azure",Mt=async()=>{if(!(!Se||$)){ae(!0),Y(null);try{Y(await X.testCustomTts({providerId:Se.id}))}catch(Q){Y({ok:!1,detail:Q instanceof Error?Q.message:String(Q)})}finally{ae(!1)}}},ct=async()=>{if(!(!de||ye)){re(!0),le(null);try{le(await X.testCustomAsr({providerId:de.id}))}catch(Q){le({ok:!1,detail:Q instanceof Error?Q.message:String(Q)})}finally{re(!1)}}},St=async(Q,Oe)=>{ke(null);try{await X.deleteCustomProvider(Q),Oe==="tts"&&f===Q&&we("edge"),Oe==="asr"&&S===Q&&ce("local"),ze()}catch{}},Pe=Q=>{const Oe=t.find(Et=>Et.id===Q),rt=(Oe==null?void 0:Oe.state)??"absent";return u.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"text-label font-medium text-ink-strong truncate",children:Ie(Q)}),u.jsxs("div",{className:"text-caption text-ink-muted",children:[Xe(rt)," · ",Ue(Q)]}),r===Q&&(o==null?void 0:o.id)===Q&&u.jsx("div",{className:"mt-1.5 h-1.5 rounded-full bg-ink/[0.08] overflow-hidden","data-testid":`speech-dl-bar-${Q}`,children:u.jsx("div",{className:"h-full bg-brand transition-all",style:{width:`${o.pct}%`}})}),r===Q&&(o==null?void 0:o.id)===Q&&u.jsxs("div",{className:"text-caption text-ink-faint mt-0.5","data-testid":`speech-dl-pct-${Q}`,children:[o.pct,"%",o.label?` · ${o.label}`:""]})]}),rt==="ready"?c===Q?u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"text-caption text-warning",children:e("settings.speech.confirm_del")}),u.jsx("button",{onClick:()=>oe(Q),className:"text-label text-warning hover:underline","data-testid":`speech-del-confirm-${Q}`,children:e("settings.speech.delete")}),u.jsx("button",{onClick:()=>h(null),className:"text-label text-ink-muted hover:text-ink-strong",children:e("action.cancel")})]}):u.jsx("button",{onClick:()=>h(Q),disabled:r===Q,className:"text-label text-ink-muted hover:text-warning disabled:opacity-40","data-testid":`speech-del-${Q}`,children:e("settings.speech.delete")}):u.jsx("button",{onClick:()=>Ge(Q),disabled:r!=null||rt==="downloading",className:"btn-3d-brand px-3 py-1 text-label disabled:opacity-40","data-testid":`speech-dl-${Q}`,children:e(r===Q||rt==="downloading"?"settings.speech.downloading":"settings.speech.download")})]},Q)},On=(Q,Oe,rt,Et,Re)=>u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[u.jsx(js,{className:"w-3.5 h-3.5 text-ink-faint shrink-0","aria-hidden":"true"}),u.jsx("span",{className:"font-medium text-ink-strong",children:Q.label}),u.jsx("code",{className:"text-ink-faint font-mono break-all",children:Q.defaultModel}),u.jsx("span",{className:"text-ink-faint break-all min-w-0",children:Q.baseUrl}),Q.hasApiKey&&u.jsxs("span",{className:"text-brand shrink-0 inline-flex items-center gap-0.5",children:[u.jsx(tn,{className:"w-3.5 h-3.5","aria-hidden":"true"}),e("settings.speech.key_saved")]})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[u.jsx("button",{onClick:()=>void Re(),disabled:rt,className:"btn-3d-neutral px-3 py-1 text-label disabled:opacity-40","data-testid":`${Oe}-custom-test`,children:e(rt?"settings.testing":"settings.test")}),xe===Q.id?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"text-caption text-warning",children:e("settings.speech.confirm_del_custom")}),u.jsx("button",{onClick:()=>void St(Q.id,Oe),className:"text-label text-warning hover:underline","data-testid":`${Oe}-custom-del-confirm`,children:e("settings.speech.delete")}),u.jsx("button",{onClick:()=>ke(null),className:"text-label text-ink-muted hover:text-ink-strong",children:e("action.cancel")})]}):u.jsx("button",{onClick:()=>ke(Q.id),className:"text-label text-ink-muted hover:text-warning","data-testid":`${Oe}-custom-del`,children:e("settings.speech.delete")}),Et&&u.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${Et.ok?"text-brand":"text-warning"}`,children:[Et.ok?u.jsx(tn,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(lr,{className:"w-4 h-4","aria-hidden":"true"}),Et.detail]})]})]});return u.jsxs("div",{"data-testid":"settings-speech",children:[u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.speech.tts_title")}),u.jsxs("div",{className:"flex gap-2 flex-wrap",children:[u.jsx("button",{onClick:()=>{we("edge"),W(!1),P(!1)},"data-testid":"tts-engine-edge","aria-pressed":f==="edge",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${f==="edge"?en:Jt}`,children:e("settings.speech.engine.edge")}),u.jsxs("button",{onClick:()=>{we("local"),W(!1),P(!1)},"data-testid":"tts-engine-local","aria-pressed":f==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${f==="local"?en:Jt}`,children:[e("settings.speech.engine.local"),De("tts-kokoro")!=="ready"?` · ${e("settings.speech.state.absent")}`:""]}),u.jsx("button",{onClick:()=>{we("system"),W(!1),P(!1)},disabled:!N,"data-testid":"tts-engine-system","aria-pressed":f==="system",title:N?void 0:e("settings.speech.engine.system_unavailable"),className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${f==="system"?en:Jt} ${N?"":"opacity-40 cursor-not-allowed"}`,children:e("settings.speech.engine.system")}),u.jsx("button",{onClick:()=>{W(Q=>!Q),B||P(!1)},"data-testid":"tts-engine-custom","aria-pressed":f.startsWith("custom-")||B,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${f.startsWith("custom-")||B?en:Jt}`,children:e("settings.speech.engine.custom")}),be&&u.jsxs("button",{disabled:!0,"data-testid":"tts-engine-azure",className:"px-4 py-2 rounded-xl text-body font-bold opacity-50 cursor-not-allowed",children:["Azure · ",e("settings.speech.legacy")]})]}),f==="edge"&&u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.engine.edge_note")})]}),f==="edge"&&u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.speech.voice")}),u.jsx("select",{value:d,onChange:Q=>{p(Q.target.value),X.setSetting("tts_voice_edge",Q.target.value)},"data-testid":"tts-voice-select",className:`${dn} w-full min-w-0 px-2.5 py-1.5`,children:k5.map(Q=>u.jsx("option",{value:Q.id,children:Q.label},Q.id))})]}),f==="local"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.speech.voice")}),u.jsx("select",{value:g,onChange:Q=>{x(Q.target.value),X.setSetting("tts_sid_local",Q.target.value)},"data-testid":"tts-sid-select",className:`${dn} w-full min-w-0 px-2.5 py-1.5`,children:w5.map(Q=>u.jsx("option",{value:Q.sid,children:Q.label},Q.sid))})]}),u.jsx("div",{className:nt(!1),children:Pe("tts-kokoro")})]}),f==="system"&&u.jsx(u.Fragment,{children:u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.speech.voice")}),u.jsxs("select",{value:E,onChange:Q=>ee(Q.target.value),"data-testid":"tts-system-voice-select",className:`${dn} w-full min-w-0 px-2.5 py-1.5`,children:[u.jsx("option",{value:"",children:e("settings.speech.voice_auto")}),_.map(Q=>u.jsx("option",{value:Q.name,children:jA(Q)},Q.voiceURI))]}),u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.engine.system_note")})]})}),B&&u.jsx("div",{className:nt(!1),children:u.jsxs("div",{className:"space-y-3",children:[Se&&On(Se,"tts",$,ne,Mt),Se&&u.jsxs("div",{children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.speech.voice")}),u.jsx("input",{type:"text",value:T,onChange:Q=>A(Q.target.value),onBlur:()=>void X.setSetting("tts_custom_voice",T.trim()),placeholder:e("settings.speech.custom_voice_ph"),"data-testid":"tts-custom-voice",className:`${dn} w-full min-w-0 px-2.5 py-1.5 font-mono`})]}),!Se&&ve.map(Q=>u.jsxs("button",{onClick:()=>we(Q.id),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`tts-pick-${Q.id}`,children:[u.jsx("span",{className:"text-label font-medium text-ink-strong",children:Q.label}),u.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:Q.defaultModel})]},Q.id)),(Z||!Se&&ve.length===0)&&u.jsx(Gi,{kind:"tts",showProtocol:!1,testPrefix:"tts-custom",titleKey:"settings.custom.form_title_tts",modelPhKey:"settings.custom.model_ph_tts",testOverride:Q=>X.testCustomTts({baseUrl:Q.baseUrl,apiKey:Q.apiKey||void 0,model:Q.model}),onSaved:Q=>{we(Q.id),P(!1),ze()},onCancel:()=>P(!1)}),(Se||ve.length>0)&&u.jsx("button",{onClick:()=>P(Q=>!Q),className:"text-label text-accent hover:underline",children:e(Z?"action.cancel":"settings.custom.new")})]})}),u.jsx("div",{className:nt(!0),children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:e("settings.speech.speed")}),u.jsx("input",{type:"range",min:"0.5",max:"2",step:"0.05",value:b,onChange:Q=>k(Q.target.value),onPointerUp:()=>{X.setSetting("tts_speed",b),mi()},onKeyUp:()=>{X.setSetting("tts_speed",b),mi()},"data-testid":"tts-speed-range",className:"flex-1 min-w-0 accent-[var(--brand)]"}),u.jsxs("span",{className:"text-label text-ink-muted tabular-nums w-10 text-right","data-testid":"tts-speed-value",children:[Number(b).toFixed(2),"x"]})]})}),u.jsxs("div",{className:nt(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.speech.asr_title")}),u.jsxs("div",{className:"flex gap-2 flex-wrap",children:[u.jsx("button",{onClick:()=>{ce("local"),q(!1),V(!1)},"data-testid":"asr-engine-local","aria-pressed":S==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${S==="local"?en:Jt}`,children:e("settings.speech.asr_engine.local")}),u.jsx("button",{onClick:()=>{q(Q=>!Q),D||V(!1)},"data-testid":"asr-engine-custom","aria-pressed":S.startsWith("custom-")||D,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${S.startsWith("custom-")||D?en:Jt}`,children:e("settings.speech.engine.custom")}),Ce&&u.jsxs("button",{disabled:!0,"data-testid":"asr-engine-groq",className:"px-4 py-2 rounded-xl text-body font-bold opacity-50 cursor-not-allowed",children:["Groq · ",e("settings.speech.legacy")]}),Ve&&u.jsxs("button",{disabled:!0,"data-testid":"asr-engine-azure",className:"px-4 py-2 rounded-xl text-body font-bold opacity-50 cursor-not-allowed",children:["Azure · ",e("settings.speech.legacy")]})]}),S==="local"?u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.asr_engine.local_note")}):S.startsWith("custom-")&&u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.asr_engine.custom_note")})]}),S==="local"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:nt(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.model")}),u.jsx("select",{value:M,onChange:Q=>{O(Q.target.value),X.setSetting("asr_local_model",Q.target.value)},"data-testid":"asr-model-select",className:`${dn} w-full min-w-0 px-2.5 py-1.5`,children:["asr-whisper-turbo","asr-whisper-small"].map(Q=>u.jsxs("option",{value:Q,children:[We(Q)," · ",Xe(De(Q))]},Q))})]}),u.jsx("div",{className:nt(!1),children:Pe(M)})]}),D&&u.jsx("div",{className:nt(!1),children:u.jsxs("div",{className:"space-y-3",children:[de&&On(de,"asr",ye,ie,ct),!de&&ge.map(Q=>u.jsxs("button",{onClick:()=>ce(Q.id),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`asr-pick-${Q.id}`,children:[u.jsx("span",{className:"text-label font-medium text-ink-strong",children:Q.label}),u.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:Q.defaultModel})]},Q.id)),(K||!de&&ge.length===0)&&u.jsx(Gi,{kind:"asr",showProtocol:!1,testPrefix:"asr-custom",titleKey:"settings.custom.form_title_asr",modelPhKey:"settings.custom.model_ph_asr",testOverride:Q=>X.testCustomAsr({baseUrl:Q.baseUrl,apiKey:Q.apiKey||void 0,model:Q.model}),onSaved:Q=>{ce(Q.id),V(!1),ze()},onCancel:()=>V(!1)}),(de||ge.length>0)&&u.jsx("button",{onClick:()=>V(Q=>!Q),className:"text-label text-accent hover:underline",children:e(K?"action.cancel":"settings.custom.new")})]})}),u.jsxs("div",{className:nt(!0),children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Ir,{checked:L,onChange:()=>{const Q=!L;I(Q),X.setSetting("asr_auto_stop",Q?"1":"0")},label:e("settings.speech.asr_auto_stop"),testid:"asr-auto-stop-toggle"}),u.jsx("div",{className:"text-body font-medium text-ink-strong",children:e("settings.speech.asr_auto_stop")})]}),u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.asr_ux_note")})]}),s&&u.jsx("div",{className:"px-4 py-3 text-label text-warning break-all",role:"alert",children:s==="engine-unavailable"?e("chat.speech.engine_unavailable"):s})]})}function S5(e,t){if(t.type==="text"){const n=e[e.length-1];return n&&n.type==="text"?[...e.slice(0,-1),{type:"text",text:n.text+t.text}]:[...e,{type:"text",text:t.text}]}if(t.type==="reasoning"){const n=e[e.length-1];return n&&n.type==="reasoning"?[...e.slice(0,-1),{type:"reasoning",text:n.text+t.text}]:[...e,{type:"reasoning",text:t.text}]}if(t.type==="tool-start")return[...e,{type:"tool-call",toolName:t.toolName,state:"input-available"}];if(t.type==="tool-result"){let n=-1;for(let r=e.length-1;r>=0;r--){const i=e[r];if(i.type==="tool-call"&&i.toolName===t.toolName&&i.state==="input-available"){n=r;break}}return n<0?e:e.map((r,i)=>i===n?{...r,state:"output-available",output:t.output}:r)}if(t.type==="tool-error"){let n=-1;for(let r=e.length-1;r>=0;r--){const i=e[r];if(i.type==="tool-call"&&i.toolName===t.toolName&&i.state==="input-available"){n=r;break}}return n<0?e:e.map((r,i)=>i===n?{...r,state:"output-error",error:t.error}:r)}return e}let C5=0;const pi=()=>`msg-v2-${++C5}`;function A5(e){if(!e)return null;try{const t=JSON.parse(e);return!Array.isArray(t)||t.length===0?null:t.every(r=>typeof r=="object"&&r!==null&&typeof r.type=="string")?t:null}catch{return null}}function N5(e,t){const[n,r]=v.useState([]),[i,s]=v.useState(!1),a=v.useRef(null);v.useEffect(()=>{if(!e){r([]),s(!1),a.current=null;return}let m=!1;return(async()=>{try{const d=await X.threadGetMessages(e);if(m)return;r(d.map(p=>{const g=A5(p.partsJson);return{id:p.id,role:p.role,parts:g??[{type:"text",text:p.content}],...p.displayText?{displayText:p.displayText}:{}}}))}catch{m||r([])}})(),()=>{m=!0}},[e]),v.useEffect(()=>X.on("chat:part",d=>{const g=a.current;r(x=>{let b=g,k=x;if(!(b&&x.some(E=>E.id===b))){const E=x[x.length-1];E&&E.role==="assistant"?b=E.id:(b=pi(),k=[...x,{id:b,role:"assistant",parts:[]}])}const A=b;return k.map(E=>E.id===A?{...E,parts:S5(E.parts,d)}:E)})}),[]),v.useEffect(()=>X.on("chat:done",(d,p)=>{s(!1),a.current=null,p&&(p.userMessageId||p.assistantMessageId)&&r(g=>{let x=-1,b=-1;for(let k=g.length-1;k>=0&&(g[k].role==="user"&&x===-1&&(x=k),g[k].role==="assistant"&&b===-1&&(b=k),!(x!==-1&&b!==-1));k--);return g.map((k,T)=>T===x&&p.userMessageId?{...k,id:p.userMessageId}:T===b&&p.assistantMessageId?{...k,id:p.assistantMessageId}:k)})}),[]),v.useEffect(()=>X.on("chat:error",d=>{s(!1),a.current=null,r(p=>[...p,{id:pi(),role:"assistant",parts:[{type:"text",text:`⚠️ ${d}`}]}])}),[]);const o=v.useCallback(async(m,d,p,g)=>{const x=d??e;if(!x||i||!m.trim())return;const b=m.trim(),k={id:pi(),role:"user",parts:[...(g??[]).map(T=>({type:"attachment",attachment:{kind:T.kind,name:T.name,mime:T.mime,size:T.size,...T.previewUrl?{previewUrl:T.previewUrl}:{}}})),{type:"text",text:b}],...p?{displayText:p}:{}};r(T=>[...T,k]),s(!0),a.current=null;try{await X.agentChatThread(x,b,p,t??null,g)}catch(T){s(!1),r(A=>[...A,{id:pi(),role:"assistant",parts:[{type:"text",text:`⚠️ ${T instanceof Error?T.message:String(T)}`}]}])}},[e,i,t]),l=v.useCallback(async()=>{if(!(!e||!i)){try{await X.abortAgentChatThread(e)}catch{}s(!1),a.current=null}},[e,i]),c=v.useCallback(()=>{r([])},[]);v.useEffect(()=>{const m=d=>{const p=d.detail;if(typeof p!="string")return;const x={explain_simple:{msg:"用大白话给我讲讲这一节的核心概念",labelKey:"command.explain_simple"},quiz_3:{msg:"出 3 道练习题考考我",labelKey:"command.quiz_3"},compare_prev:{msg:"把这一节和上一节做个对比表",labelKey:"command.compare_prev"},concept_map:{msg:"画个概念图帮我理清这一节的知识结构",labelKey:"command.concept_map"},socratic:{msg:"切换到苏格拉底模式,用提问引导我思考",labelKey:"command.socratic"},exam_mode:{msg:"切换到考试冲刺模式,出有难度的题",labelKey:"command.exam_mode"}}[p];x&&o(x.msg,void 0,ic(x.labelKey))};return window.addEventListener("lookatstudy-command",m),()=>window.removeEventListener("lookatstudy-command",m)},[o]);const h=v.useCallback((m,d,p)=>{r(g=>g.map(x=>{if(x.id!==m)return x;const b=[...x.parts],k=b[d];return k&&k.type==="tool-call"&&(b[d]={...k,output:{...typeof k.output=="object"&&k.output?k.output:{},status:p?"applied":"rejected"}}),{...x,parts:b}}))},[]),f=v.useCallback(m=>{r(m)},[]);return{messages:n,streaming:i,send:o,stop:l,clear:c,markProposalStatus:h,setMessagesForNode:f}}const gi=(e,t=60)=>e.length>t?e.slice(0,t)+"…":e;function _5(e,t){return t("quiz.hook.label",{correct:e.correct,total:e.total})}function I5(e,t){const n=e.detail.map((i,s)=>i.correct?t("quiz.hook.lineOk",{n:s+1,prompt:gi(i.prompt)}):t("quiz.hook.lineWrong",{n:s+1,prompt:gi(i.prompt),chosen:gi(i.chosen,30),answer:gi(i.answerText,30)})),r=e.title?`《${e.title}》`:"";return t("quiz.hook.message",{title:r,correct:e.correct,total:e.total})+(n.length?`
|
|
519
|
+
`+n.join(`
|
|
520
|
+
`):"")}function M5(e,t){const[n,r]=v.useState([]),[i,s]=v.useState(null),a=v.useCallback(async()=>{if(!e||!t){r([]),s(null);return}try{const g=(await X.threadList(e,"active")).filter(x=>x.focusNodeId===t);r(g),g.length>0?s(g[0].id):s(null)}catch{r([]),s(null)}},[e,t]);v.useEffect(()=>{a()},[a]);const o=v.useCallback(async p=>{if(!e||!t)return null;try{const g=await X.threadCreate({...p,courseId:e,focusNodeId:t});return r(x=>[g,...x]),s(g.id),g}catch{return null}},[e,t]),l=v.useCallback(async(p,g)=>{try{const x=await X.threadUpdate(p,g);return x&&(x.status==="archived"?(r(b=>b.filter(k=>k.id!==p)),s(b=>{var T;return b!==p?b:((T=n.filter(A=>A.id!==p)[0])==null?void 0:T.id)??null})):r(b=>b.map(k=>k.id===p?x:k))),x}catch{return null}},[n]),c=v.useCallback(async p=>{try{await X.threadDelete(p),r(g=>g.filter(x=>x.id!==p)),s(g=>{var b;return g!==p?g:((b=n.filter(k=>k.id!==p)[0])==null?void 0:b.id)??null})}catch{}},[n]),h=v.useCallback(p=>{const g=n.find(x=>x.id===p)??null;return g?(r(x=>x.filter(b=>b.id!==p)),s(x=>{var k;return x!==p?x:((k=n.filter(T=>T.id!==p)[0])==null?void 0:k.id)??null}),g):null},[n]),f=v.useCallback(p=>{r(g=>[p,...g.filter(x=>x.id!==p.id)]),s(p.id)},[]),m=v.useCallback(async(p,g)=>{if(!e||!t)return null;if(i)return i;const x=await o({title:(g??p).trim()});return(x==null?void 0:x.id)??null},[e,t,i,o]),d=n.find(p=>p.id===i)??null;return{threads:n,activeId:i,activeThread:d,setActiveId:s,reload:a,create:o,update:l,remove:c,removeWithUndo:h,restore:f,ensureThreadForSend:m}}function R5({threads:e,activeThread:t,focusNodeTitle:n,onPickThread:r,onCreate:i,onRename:s,onArchive:a,onDelete:o}){const l=_e(),[c,h]=v.useState(null),[f,m]=v.useState(null),[d,p]=v.useState(null),[g,x]=v.useState(""),[b,k]=v.useState(null),T=v.useRef(null);v.useEffect(()=>{const _=w=>{T.current&&!T.current.contains(w.target)&&(h(null),m(null))};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const A=(_,w)=>{_.stopPropagation();const N=_.currentTarget.getBoundingClientRect(),S=Math.max(8,N.right-128),R=N.bottom+4;m({top:R,left:S}),h(c===w?null:w)},E=_=>{p(_.id),x(_.title??""),h(null),m(null)},C=()=>{d&&g.trim()&&s(d,g.trim()),p(null)};return e.length===0?u.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2 text-label bg-surface-1 opacity-60","data-testid":"thread-switcher-empty",children:[u.jsx("span",{className:"w-1 h-1 rounded-full bg-brand shrink-0"}),u.jsx("span",{className:"text-ink-muted truncate flex-1",children:n??l("thread.empty.no_node")}),u.jsx("span",{className:"text-caption text-ink-muted shrink-0",children:l("thread.empty.hint")})]}):u.jsxs("div",{className:"shrink-0 bg-surface-1","data-testid":"thread-switcher",children:[u.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-thin px-3 py-1.5 opacity-70 hover:opacity-100 transition-opacity",children:[e.map(_=>{const w=_.id===(t==null?void 0:t.id),N=d===_.id;return u.jsxs("div",{className:`group relative flex items-center gap-1.5 px-2 py-0.5 cursor-pointer whitespace-nowrap transition-colors shrink-0 rounded ${w?"text-ink-strong":"text-ink-muted hover:text-ink-strong"}`,onClick:()=>!N&&r(_.id),"data-testid":`thread-tab-${_.id.slice(0,8)}`,children:[u.jsx("span",{className:`w-1 h-1 rounded-full shrink-0 transition-opacity ${w?"bg-brand opacity-100":"bg-[var(--border)] opacity-0 group-hover:opacity-60"}`}),N?u.jsx("input",{value:g,onChange:S=>x(S.target.value),onKeyDown:S=>{S.key==="Enter"&&C(),S.key==="Escape"&&p(null)},onBlur:C,onClick:S=>S.stopPropagation(),autoFocus:!0,className:"bg-surface-0 text-ink-strong text-label rounded px-1.5 py-0.5 border border-brand focus:outline-none focus:ring-2 focus:ring-brand/20 w-28","data-testid":"thread-rename-input"}):u.jsx("span",{className:`text-label max-w-[120px] truncate ${w?"font-semibold":"font-normal"}`,"data-tooltip":_.title||l("toast.threadDefault"),children:_.title||l("toast.threadDefault")}),!N&&u.jsx("button",{onClick:S=>A(S,_.id),className:"flex items-center justify-center w-4 h-4 rounded text-ink-muted hover:text-ink-strong hover:bg-ink/5 opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100 transition-all","data-testid":`thread-gear-${_.id.slice(0,8)}`,title:l("thread.actions.label"),"aria-label":l("thread.actions.label"),children:u.jsx(Bi,{className:"w-3 h-3"})})]},_.id)}),u.jsx("button",{onClick:i,className:"flex items-center justify-center w-6 h-6 ml-1 rounded text-ink-muted hover:text-brand hover:bg-ink/5 transition-colors shrink-0","data-testid":"thread-new",title:l("thread.new.label"),"aria-label":l("thread.new.label"),children:u.jsx(aa,{className:"w-3.5 h-3.5"})})]}),c&&f&&(()=>{const _=e.find(w=>w.id===c);return _?u.jsxs("div",{ref:T,style:{position:"fixed",top:f.top,left:f.left},className:"z-50 w-32 bg-surface-0 rounded-lg shadow-pop py-1 border border-[var(--border-faint)]","data-testid":`thread-menu-${_.id.slice(0,8)}`,onClick:w=>w.stopPropagation(),children:[u.jsxs("button",{onClick:()=>E(_),className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-label text-ink-muted hover:bg-surface-1 hover:bg-surface-3 hover:text-ink-strong transition-colors",children:[u.jsx(V1,{className:"w-3 h-3"}),l("thread.menu.rename")]}),u.jsxs("button",{onClick:()=>{a(_.id),h(null),m(null)},className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-label text-ink-muted hover:bg-surface-1 hover:bg-surface-3 hover:text-ink-strong transition-colors",children:[u.jsx(a1,{className:"w-3 h-3"}),l("thread.menu.archive")]}),u.jsxs("button",{onClick:w=>{const N=w.currentTarget.getBoundingClientRect();k({id:_.id,title:_.title??l("toast.threadDefault"),rect:N}),h(null),m(null)},className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-label text-warning hover:bg-warning/10 transition-colors",children:[u.jsx(Ko,{className:"w-3 h-3"}),l("action.delete")]})]}):null})(),b&&u.jsx(oa,{anchorRect:b.rect,message:l("thread.delete.confirm",{name:b.title}),danger:!0,confirmLabel:l("action.delete"),testid:"thread-delete-confirm",onConfirm:()=>{o(b.id),k(null)},onCancel:()=>k(null)})]})}const L5=1240,P5=920;function D5(e){return e>=L5?1:e>=P5?2:3}function O5(e){return e==="rail"?"rail":"notebook"}function j5(e,t,n){if(Math.abs(t)<60||Math.abs(t)<Math.abs(n)*1.6)return null;const r=["rail","chat","notebook"],i=r.indexOf(e)+(t<0?1:-1);return i>=0&&i<r.length?r[i]:null}function F5(e){return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}function B5(){return D5(typeof window>"u"?H5:window.innerWidth)}const H5=99999;function U5(){return v.useSyncExternalStore(F5,B5,()=>1)}const Mc=v.createContext({});function Rc(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const z5=typeof window<"u",Ki=z5?v.useLayoutEffect:v.useEffect,Ta=v.createContext(null);function Lc(e,t){e.indexOf(t)===-1&&e.push(t)}function Xi(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const mn=(e,t,n)=>n>t?t:n<e?e:n;let Sa=()=>{};const Mn={},F0=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),B0=e=>typeof e=="object"&&e!==null,H0=e=>/^0[^.\s]+$/u.test(e);function U0(e){let t;return()=>(t===void 0&&(t=e()),t)}const Gt=e=>e,Ws=(...e)=>e.reduce((t,n)=>r=>n(t(r))),Ms=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1};class Pc{constructor(){this.subscriptions=[]}add(t){return Lc(this.subscriptions,t),()=>Xi(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s<i;s++){const a=this.subscriptions[s];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ut=e=>e*1e3,Yt=e=>e/1e3,z0=(e,t)=>t?e*(1e3/t):0,V0=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,V5=1e-7,$5=12;function q5(e,t,n,r,i){let s,a,o=0;do a=t+(n-t)/2,s=V0(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>V5&&++o<$5);return a}function Ys(e,t,n,r){if(e===t&&n===r)return Gt;const i=s=>q5(s,0,1,e,n);return s=>s===0||s===1?s:V0(i(s),t,r)}const $0=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,q0=e=>t=>1-e(1-t),W0=Ys(.33,1.53,.69,.99),Dc=q0(W0),Y0=$0(Dc),G0=e=>e>=1?1:(e*=2)<1?.5*Dc(e):.5*(2-Math.pow(2,-10*(e-1))),Oc=e=>1-Math.sin(Math.acos(e)),K0=q0(Oc),X0=$0(Oc),W5=Ys(.42,0,1,1),Y5=Ys(0,0,.58,1),Q0=Ys(.42,0,.58,1),G5=e=>Array.isArray(e)&&typeof e[0]!="number",Z0=e=>Array.isArray(e)&&typeof e[0]=="number",K5={linear:Gt,easeIn:W5,easeInOut:Q0,easeOut:Y5,circIn:Oc,circInOut:X0,circOut:K0,backIn:Dc,backInOut:Y0,backOut:W0,anticipate:G0},X5=e=>typeof e=="string",vh=e=>{if(Z0(e)){Sa(e.length===4);const[t,n,r,i]=e;return Ys(t,n,r,i)}else if(X5(e))return K5[e];return e},xi=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Q5(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(c){s.has(c)&&(l.schedule(c),e()),c(a)}const l={schedule:(c,h=!1,f=!1)=>{const d=f&&r?t:n;return h&&s.add(c),d.add(c),c},cancel:c=>{n.delete(c),s.delete(c)},process:c=>{if(a=c,r){i=!0;return}r=!0;const h=t;t=n,n=h,t.forEach(o),t.clear(),r=!1,i&&(i=!1,l.process(c))}};return l}const Z5=40;function J0(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=xi.reduce((T,A)=>(T[A]=Q5(s),T),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:h,update:f,preRender:m,render:d,postRender:p}=a,g=()=>{const T=Mn.useManualTiming,A=T?i.timestamp:performance.now();n=!1,T||(i.delta=r?1e3/60:Math.max(Math.min(A-i.timestamp,Z5),1)),i.timestamp=A,i.isProcessing=!0,o.process(i),l.process(i),c.process(i),h.process(i),f.process(i),m.process(i),d.process(i),p.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(g))},x=()=>{n=!0,r=!0,i.isProcessing||e(g)};return{schedule:xi.reduce((T,A)=>{const E=a[A];return T[A]=(C,_=!1,w=!1)=>(n||x(),E.schedule(C,_,w)),T},{}),cancel:T=>{for(let A=0;A<xi.length;A++)a[xi[A]].cancel(T)},state:i,steps:a}}const{schedule:et,cancel:Rn,state:yt,steps:No}=J0(typeof requestAnimationFrame<"u"?requestAnimationFrame:Gt,!0);let _i;function J5(){_i=void 0}const _t={now:()=>(_i===void 0&&_t.set(yt.isProcessing||Mn.useManualTiming?yt.timestamp:performance.now()),_i),set:e=>{_i=e,queueMicrotask(J5)}},eg=e=>t=>typeof t=="string"&&t.startsWith(e),tg=eg("--"),e_=eg("var(--"),jc=e=>e_(e)?t_.test(e.split("/*")[0].trim()):!1,t_=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Eh(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Vr={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Rs={...Vr,transform:e=>mn(0,1,e)},bi={...Vr,default:1},vs=e=>Math.round(e*1e5)/1e5,Fc=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function n_(e){return e==null}const r_=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Bc=(e,t)=>n=>!!(typeof n=="string"&&r_.test(n)&&n.startsWith(e)||t&&!n_(n)&&Object.prototype.hasOwnProperty.call(n,t)),ng=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,o]=r.match(Fc);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},s_=e=>mn(0,255,e),_o={...Vr,transform:e=>Math.round(s_(e))},Zn={test:Bc("rgb","red"),parse:ng("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+_o.transform(e)+", "+_o.transform(t)+", "+_o.transform(n)+", "+vs(Rs.transform(r))+")"};function i_(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Tl={test:Bc("#"),parse:i_,transform:Zn.transform},Gs=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),bn=Gs("deg"),hn=Gs("%"),Ee=Gs("px"),a_=Gs("vh"),o_=Gs("vw"),kh={...hn,parse:e=>hn.parse(e)/100,transform:e=>hn.transform(e*100)},Sr={test:Bc("hsl","hue"),parse:ng("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+hn.transform(vs(t))+", "+hn.transform(vs(n))+", "+vs(Rs.transform(r))+")"},ft={test:e=>Zn.test(e)||Tl.test(e)||Sr.test(e),parse:e=>Zn.test(e)?Zn.parse(e):Sr.test(e)?Sr.parse(e):Tl.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Zn.transform(e):Sr.transform(e),getAnimatableNone:e=>{const t=ft.parse(e);return t.alpha=0,ft.transform(t)}},l_=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function c_(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Fc))==null?void 0:t.length)||0)+(((n=e.match(l_))==null?void 0:n.length)||0)>0}const rg="number",sg="color",u_="var",d_="var(",wh="${}",h_=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Dr(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const o=t.replace(h_,l=>(ft.test(l)?(r.color.push(s),i.push(sg),n.push(ft.parse(l))):l.startsWith(d_)?(r.var.push(s),i.push(u_),n.push(l)):(r.number.push(s),i.push(rg),n.push(parseFloat(l))),++s,wh)).split(wh);return{values:n,split:o,indexes:r,types:i}}function f_(e){return Dr(e).values}function ig({split:e,types:t}){const n=e.length;return r=>{let i="";for(let s=0;s<n;s++)if(i+=e[s],r[s]!==void 0){const a=t[s];a===rg?i+=vs(r[s]):a===sg?i+=ft.transform(r[s]):i+=r[s]}return i}}function m_(e){return ig(Dr(e))}const p_=e=>typeof e=="number"?0:ft.test(e)?ft.getAnimatableNone(e):e,g_=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:p_(e);function x_(e){const t=Dr(e);return ig(t)(t.values.map((r,i)=>g_(r,t.split[i])))}const rn={test:c_,parse:f_,createTransformer:m_,getAnimatableNone:x_};function Io(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function b_({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,a=0;if(!t)i=s=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;i=Io(l,o,e+1/3),s=Io(l,o,e),a=Io(l,o,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function Qi(e,t){return n=>n>0?t:e}const Je=(e,t,n)=>e+(t-e)*n,Mo=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},y_=[Tl,Zn,Sr],v_=e=>y_.find(t=>t.test(e));function Th(e){const t=v_(e);if(!t)return!1;let n=t.parse(e);return t===Sr&&(n=b_(n)),n}const Sh=(e,t)=>{const n=Th(e),r=Th(t);if(!n||!r)return Qi(e,t);const i={...n};return s=>(i.red=Mo(n.red,r.red,s),i.green=Mo(n.green,r.green,s),i.blue=Mo(n.blue,r.blue,s),i.alpha=Je(n.alpha,r.alpha,s),Zn.transform(i))},Sl=new Set(["none","hidden"]);function E_(e,t){return Sl.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function k_(e,t){return n=>Je(e,t,n)}function Hc(e){return typeof e=="number"?k_:typeof e=="string"?jc(e)?Qi:ft.test(e)?Sh:S_:Array.isArray(e)?ag:typeof e=="object"?ft.test(e)?Sh:w_:Qi}function ag(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>Hc(s)(s,t[a]));return s=>{for(let a=0;a<r;a++)n[a]=i[a](s);return n}}function w_(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Hc(e[i])(e[i],t[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function T_(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const s=t.types[i],a=e.indexes[s][r[s]],o=e.values[a]??0;n[i]=o,r[s]++}return n}const S_=(e,t)=>{const n=rn.createTransformer(t),r=Dr(e),i=Dr(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Sl.has(e)&&!i.values.length||Sl.has(t)&&!r.values.length?E_(e,t):Ws(ag(T_(r,i),i.values),n):Qi(e,t)};function og(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Je(e,t,n):Hc(e)(e,t)}const C_=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>et.update(t,n),stop:()=>Rn(t),now:()=>yt.isProcessing?yt.timestamp:_t.now()}},lg=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s<i;s++)r+=Math.round(e(s/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Zi=2e4;function Uc(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Zi;)t+=n,r=e.next(t);return t>=Zi?1/0:t}function A_(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(Uc(r),Zi);return{type:"keyframes",ease:s=>r.next(i*s).value/t,duration:Yt(i)}}const lt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Cl(e,t){return e*Math.sqrt(1-t*t)}const N_=12;function __(e,t,n){let r=n;for(let i=1;i<N_;i++)r=r-e(r)/t(r);return r}const Ro=.001;function I_({duration:e=lt.duration,bounce:t=lt.bounce,velocity:n=lt.velocity,mass:r=lt.mass}){let i,s,a=1-t;a=mn(lt.minDamping,lt.maxDamping,a),e=mn(lt.minDuration,lt.maxDuration,Yt(e)),a<1?(i=c=>{const h=c*a,f=h*e,m=h-n,d=Cl(c,a),p=Math.exp(-f);return Ro-m/d*p},s=c=>{const f=c*a*e,m=f*n+n,d=Math.pow(a,2)*Math.pow(c,2)*e,p=Math.exp(-f),g=Cl(Math.pow(c,2),a);return(-i(c)+Ro>0?-1:1)*((m-d)*p)/g}):(i=c=>{const h=Math.exp(-c*e),f=(c-n)*e+1;return-Ro+h*f},s=c=>{const h=Math.exp(-c*e),f=(n-c)*(e*e);return h*f});const o=5/e,l=__(i,s,o);if(e=Ut(e),isNaN(l))return{stiffness:lt.stiffness,damping:lt.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:a*2*Math.sqrt(r*c),duration:e}}}const M_=["duration","bounce"],R_=["stiffness","damping","mass"];function Ch(e,t){return t.some(n=>e[n]!==void 0)}function L_(e){let t={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...e};if(!Ch(e,R_)&&Ch(e,M_))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*mn(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:lt.mass,stiffness:i,damping:s}}else{const n=I_({...e,velocity:0});t={...t,...n,mass:lt.mass},t.isResolvedFromDuration=!0}return t}function Ji(e=lt.visualDuration,t=lt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:l,damping:c,mass:h,duration:f,velocity:m,isResolvedFromDuration:d}=L_({...n,velocity:-Yt(n.velocity||0)}),p=m||0,g=c/(2*Math.sqrt(l*h)),x=a-s,b=Yt(Math.sqrt(l/h)),k=Math.abs(x)<5;r||(r=k?lt.restSpeed.granular:lt.restSpeed.default),i||(i=k?lt.restDelta.granular:lt.restDelta.default);let T,A,E,C,_,w;if(g<1)E=Cl(b,g),C=(p+g*b*x)/E,T=S=>{const R=Math.exp(-g*b*S);return a-R*(C*Math.sin(E*S)+x*Math.cos(E*S))},_=g*b*C+x*E,w=g*b*x-C*E,A=S=>Math.exp(-g*b*S)*(_*Math.sin(E*S)+w*Math.cos(E*S));else if(g===1){T=R=>a-Math.exp(-b*R)*(x+(p+b*x)*R);const S=p+b*x;A=R=>Math.exp(-b*R)*(b*S*R-p)}else{const S=b*Math.sqrt(g*g-1);T=L=>{const I=Math.exp(-g*b*L),j=Math.min(S*L,300);return a-I*((p+g*b*x)*Math.sinh(j)+S*x*Math.cosh(j))/S};const R=(p+g*b*x)/S,M=g*b*R-x*S,O=g*b*x-R*S;A=L=>{const I=Math.exp(-g*b*L),j=Math.min(S*L,300);return I*(M*Math.sinh(j)+O*Math.cosh(j))}}const N={calculatedDuration:d&&f||null,velocity:S=>Ut(A(S)),next:S=>{if(!d&&g<1){const M=Math.exp(-g*b*S),O=Math.sin(E*S),L=Math.cos(E*S),I=a-M*(C*O+x*L),j=Ut(M*(_*O+w*L));return o.done=Math.abs(j)<=r&&Math.abs(a-I)<=i,o.value=o.done?a:I,o}const R=T(S);if(d)o.done=S>=f;else{const M=Ut(A(S));o.done=Math.abs(M)<=r&&Math.abs(a-R)<=i}return o.value=o.done?a:R,o},toString:()=>{const S=Math.min(Uc(N),Zi),R=lg(M=>N.next(S*M).value,S,30);return S+"ms "+R},toTransition:()=>{}};return N}Ji.applyToOptions=e=>{const t=A_(e,100,Ji);return e.ease=t.ease,e.duration=Ut(t.duration),e.type="keyframes",e};const P_=5;function cg(e,t,n){const r=Math.max(t-P_,0);return z0(n-e(r),t-r)}function Al({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:h}){const f=e[0],m={done:!1,value:f},d=w=>o!==void 0&&w<o||l!==void 0&&w>l,p=w=>o===void 0?l:l===void 0||Math.abs(o-w)<Math.abs(l-w)?o:l;let g=n*t;const x=f+g,b=a===void 0?x:a(x);b!==x&&(g=b-f);const k=w=>-g*Math.exp(-w/r),T=w=>b+k(w),A=w=>{const N=k(w),S=T(w);m.done=Math.abs(N)<=c,m.value=m.done?b:S};let E,C;const _=w=>{d(m.value)&&(E=w,C=Ji({keyframes:[m.value,p(m.value)],velocity:cg(T,w,m.value),damping:i,stiffness:s,restDelta:c,restSpeed:h}))};return _(0),{calculatedDuration:null,next:w=>{let N=!1;return!C&&E===void 0&&(N=!0,A(w),_(w)),E!==void 0&&w>=E?C.next(w-E):(!N&&A(w),m)}}}function D_(e,t,n){const r=[],i=n||Mn.mix||og,s=e.length-1;for(let a=0;a<s;a++){let o=i(e[a],e[a+1]);if(t){const l=Array.isArray(t)?t[a]||Gt:t;o=Ws(l,o)}r.push(o)}return r}function O_(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const s=e.length;if(Sa(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=D_(t,r,i),l=o.length,c=h=>{if(a&&h<e[0])return t[0];let f=0;if(l>1)for(;f<e.length-2&&!(h<e[f+1]);f++);const m=Ms(e[f],e[f+1],h);return o[f](m)};return n?h=>c(mn(e[0],e[s-1],h)):c}function j_(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Ms(0,t,r);e.push(Je(n,1,i))}}function F_(e){const t=[0];return j_(t,e.length-1),t}function B_(e,t){return e.map(n=>n*t)}function H_(e,t){return e.map(()=>t||Q0).splice(0,e.length-1)}function Es({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=G5(r)?r.map(vh):vh(r),s={done:!1,value:t[0]},a=B_(n&&n.length===t.length?n:F_(t),e),o=O_(a,t,{ease:Array.isArray(i)?i:H_(t,i)});return{calculatedDuration:e,next:l=>(s.value=o(l),s.done=l>=e,s)}}const U_=e=>e!==null;function Ca(e,{repeat:t,repeatType:n="loop"},r,i=1){const s=e.filter(U_),o=i<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}const z_={decay:Al,inertia:Al,tween:Es,keyframes:Es,spring:Ji};function ug(e){typeof e.type=="string"&&(e.type=z_[e.type])}class zc{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const V_=e=>e/100;class ea extends zc{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==_t.now()&&this.tick(_t.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;ug(t);const{type:n=Es,repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:a=0}=t;let{keyframes:o}=t;const l=n||Es;l!==Es&&typeof o[0]!="number"&&(this.mixKeyframes=Ws(V_,og(o[0],o[1])),o=[0,100]);const c=l({...t,keyframes:o});s==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Uc(c));const{calculatedDuration:h}=c;this.calculatedDuration=h,this.resolvedDuration=h+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:s,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:h,repeat:f,repeatType:m,repeatDelay:d,type:p,onUpdate:g,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const b=this.currentTime-c*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?b<0:b>i;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let T=this.currentTime,A=r;if(f){const w=Math.min(this.currentTime,i)/o;let N=Math.floor(w),S=w%1;!S&&w>=1&&(S=1),S===1&&N--,N=Math.min(N,f+1),!!(N%2)&&(m==="reverse"?(S=1-S,d&&(S-=d/o)):m==="mirror"&&(A=a)),T=mn(0,1,S)*o}let E;k?(this.delayState.value=h[0],E=this.delayState):E=A.next(T),s&&!k&&(E.value=s(E.value));let{done:C}=E;!k&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return _&&p!==Al&&(E.value=Ca(h,this.options,x,this.speed)),g&&g(E.value),_&&this.finish(),E}then(t,n){return this.finished.then(t,n)}get duration(){return Yt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Yt(t)}get time(){return Yt(this.currentTime)}set time(t){t=Ut(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return cg(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(_t.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Yt(this.currentTime))}play(){var i,s;if(this.isStopped)return;const{driver:t=C_,startTime:n}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),(s=(i=this.options).onPlay)==null||s.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(_t.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function $_(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Jn=e=>e*180/Math.PI,Nl=e=>{const t=Jn(Math.atan2(e[1],e[0]));return _l(t)},q_={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Nl,rotateZ:Nl,skewX:e=>Jn(Math.atan(e[1])),skewY:e=>Jn(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},_l=e=>(e=e%360,e<0&&(e+=360),e),Ah=Nl,Nh=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_h=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),W_={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Nh,scaleY:_h,scale:e=>(Nh(e)+_h(e))/2,rotateX:e=>_l(Jn(Math.atan2(e[6],e[5]))),rotateY:e=>_l(Jn(Math.atan2(-e[2],e[0]))),rotateZ:Ah,rotate:Ah,skewX:e=>Jn(Math.atan(e[4])),skewY:e=>Jn(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Il(e){return e.includes("scale")?1:0}function Ml(e,t){if(!e||e==="none")return Il(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=W_,i=n;else{const o=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=q_,i=o}if(!i)return Il(t);const s=r[t],a=i[1].split(",").map(G_);return typeof s=="function"?s(a):a[s]}const Y_=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Ml(n,t)};function G_(e){return parseFloat(e.trim())}const $r=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],qr=new Set([...$r,"pathRotation"]),Ih=e=>e===Vr||e===Ee,K_=new Set(["x","y","z"]),X_=$r.filter(e=>!K_.has(e));function Q_(e){const t=[];return X_.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const In={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Ml(t,"x"),y:(e,{transform:t})=>Ml(t,"y")};In.translateX=In.x;In.translateY=In.y;const ar=new Set;let Rl=!1,Ll=!1,Pl=!1;function dg(){if(Ll){const e=Array.from(ar).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=Q_(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,a])=>{var o;(o=r.getValue(s))==null||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Ll=!1,Rl=!1,ar.forEach(e=>e.complete(Pl)),ar.clear()}function hg(){ar.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ll=!0)})}function Z_(){Pl=!0,hg(),dg(),Pl=!1}class Vc{constructor(t,n,r,i,s,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(ar.add(this),Rl||(Rl=!0,et.read(hg),et.resolveKeyframes(dg))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const s=i==null?void 0:i.get(),a=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&n){const o=r.readValue(n,a);o!=null&&(t[0]=o)}t[0]===void 0&&(t[0]=a),i&&s===void 0&&i.set(t[0])}$_(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ar.delete(this)}cancel(){this.state==="scheduled"&&(ar.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const J_=e=>e.startsWith("--");function fg(e,t,n){J_(t)?e.style.setProperty(t,n):e.style[t]=n}const e4={};function mg(e,t){const n=U0(e);return()=>e4[t]??n()}const t4=mg(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),pg=mg(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),os=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Mh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:os([0,.65,.55,1]),circOut:os([.55,0,1,.45]),backIn:os([.31,.01,.66,-.59]),backOut:os([.33,1.53,.69,.99])};function gg(e,t){if(e)return typeof e=="function"?pg()?lg(e,t):"ease-out":Z0(e)?os(e):Array.isArray(e)?e.map(n=>gg(n,t)||Mh.easeOut):Mh[e]}function n4(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c=void 0){const h={[t]:n};l&&(h.offset=l);const f=gg(o,i);Array.isArray(f)&&(h.easing=f);const m={delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"};return c&&(m.pseudoElement=c),e.animate(h,m)}function xg(e){return typeof e=="function"&&"applyToOptions"in e}function r4({type:e,...t}){return xg(e)&&pg()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class bg extends zc{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:s,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=!!s,this.allowFlatten=a,this.options=t,Sa(typeof t.type!="string");const c=r4(t);this.animation=n4(n,r,i,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const h=Ca(i,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(h),fg(n,r,h),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,i;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(r=this.animation).commitStyles)==null||i.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Yt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Yt(t)}get time(){return Yt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ut(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:i}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&t4()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Gt):i(this)}}const yg={anticipate:G0,backInOut:Y0,circInOut:X0};function s4(e){return e in yg}function i4(e){typeof e.ease=="string"&&s4(e.ease)&&(e.ease=yg[e.ease])}const Lo=10;class a4 extends bg{constructor(t){i4(t),ug(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:s,...a}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const o=new ea({...a,autoplay:!1}),l=Math.max(Lo,_t.now()-this.startTime),c=mn(0,Lo,l-Lo),h=o.sample(l).value,{name:f}=this.options;s&&f&&fg(s,f,h),n.setWithVelocity(o.sample(Math.max(0,l-c)).value,h,c),o.stop()}}const Rh=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rn.test(e)||e==="0")&&!e.startsWith("url("));function o4(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function l4(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],a=Rh(i,t),o=Rh(s,t);return!a||!o?!1:o4(e)||(n==="spring"||xg(n))&&r}function Dl(e){e.duration=0,e.type="keyframes"}const vg=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),c4=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function u4(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&c4.test(e[t]))return!0;return!1}const d4=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),h4=U0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function f4(e){var f;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:s,type:a,keyframes:o}=e,l=(f=t==null?void 0:t.owner)==null?void 0:f.current;if(!(l instanceof HTMLElement)&&!(l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:h}=t.owner.getProps();return h4()&&n&&(vg.has(n)||d4.has(n)&&u4(o))&&(n!=="transform"||!h)&&!c&&!r&&i!=="mirror"&&s!==0&&a!=="inertia"}const m4=40;class p4 extends zc{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:a="loop",keyframes:o,name:l,motionValue:c,element:h,...f}){var p;super(),this.stop=()=>{var g,x;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=_t.now();const m={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:a,name:l,motionValue:c,element:h,...f},d=(h==null?void 0:h.KeyframeResolver)||Vc;this.keyframeResolver=new d(o,(g,x,b)=>this.onKeyframesResolved(g,x,m,!b),l,c,h),(p=this.keyframeResolver)==null||p.scheduleResolve()}onKeyframesResolved(t,n,r,i){var b,k;this.keyframeResolver=void 0;const{name:s,type:a,velocity:o,delay:l,isHandoff:c,onUpdate:h}=r;this.resolvedAt=_t.now();let f=!0;l4(t,s,a,o)||(f=!1,(Mn.instantAnimations||!l)&&(h==null||h(Ca(t,r,n))),t[0]=t[t.length-1],Dl(r),r.repeat=0);const d={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>m4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=f&&!c&&f4(d),g=(k=(b=d.motionValue)==null?void 0:b.owner)==null?void 0:k.current;let x;if(p)try{x=new a4({...d,element:g})}catch{x=new ea(d)}else x=new ea(d);x.finished.then(()=>{this.notifyFinished()}).catch(Gt),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Z_()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function Eg(e,t,n,r=0,i=1){const s=Array.from(e).sort((c,h)=>c.sortNodePosition(h)).indexOf(t),a=e.size,o=(a-1)*r;return typeof n=="function"?n(s,a):i===1?s*r:o-s*r}const Lh=30,g4=e=>!isNaN(parseFloat(e));class x4{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var s;const i=_t.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=_t.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=g4(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Pc);const r=this.events[t].add(n);return t==="change"?()=>{r(),et.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=_t.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Lh)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Lh);return z0(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Or(e,t){return new x4(e,t)}function kg(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function $c(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?kg(n,e):n}const b4={type:"spring",stiffness:500,damping:25,restSpeed:10},y4=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),v4={type:"keyframes",duration:.8},E4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},k4=(e,{keyframes:t})=>t.length>2?v4:qr.has(e)?e.startsWith("scale")?y4(t[1]):b4:E4,w4=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function T4(e){for(const t in e)if(!w4.has(t))return!0;return!1}const qc=(e,t,n,r={},i,s)=>a=>{const o=$c(r,e)||{},l=o.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Ut(l);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:m=>{t.set(m),o.onUpdate&&o.onUpdate(m)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:i};T4(o)||Object.assign(h,k4(e,h)),h.duration&&(h.duration=Ut(h.duration)),h.repeatDelay&&(h.repeatDelay=Ut(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let f=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(Dl(h),h.delay===0&&(f=!0)),(Mn.instantAnimations||Mn.skipAnimations||i!=null&&i.shouldSkipAnimations||o.skipAnimations)&&(f=!0,Dl(h),h.delay=0),h.allowFlatten=!o.type&&!o.ease,f&&!s&&t.get()!==void 0){const m=Ca(h.keyframes,o);if(m!==void 0){et.update(()=>{h.onUpdate(m),h.onComplete()});return}}return o.isSync?new ea(h):new p4(h)},S4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function C4(e){const t=S4.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function wg(e,t,n=1){const[r,i]=C4(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return F0(a)?parseFloat(a):a}return jc(i)?wg(i,t,n+1):i}function Ph(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Wc(e,t,n,r){if(typeof t=="function"){const[i,s]=Ph(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=Ph(r);t=t(n!==void 0?n:e.custom,i,s)}return t}function or(e,t,n){const r=e.getProps();return Wc(r,t,n!==void 0?n:r.custom,e)}const Tg=new Set(["width","height","top","left","right","bottom",...$r]),Ol=e=>Array.isArray(e);function A4(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Or(n))}function N4(e){return Ol(e)?e[e.length-1]||0:e}function _4(e,t){const n=or(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const o=N4(s[a]);A4(e,a,o)}}const vt=e=>!!(e&&e.getVelocity);function I4(e){return!!(vt(e)&&e.add)}function jl(e,t){const n=e.getValue("willChange");if(I4(n))return n.add(t);if(!n&&Mn.WillChange){const r=new Mn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Yc(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const M4="framerAppearId",Sg="data-"+Yc(M4);function Cg(e){return e.props[Sg]}function R4({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Ag(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:a,...o}=t;const l=e.getDefaultTransition();s=s?kg(s,l):l;const c=s==null?void 0:s.reduceMotion,h=s==null?void 0:s.skipAnimations;r&&(s=r);const f=[],m=i&&e.animationState&&e.animationState.getState()[i],d=s==null?void 0:s.path;d&&d.animateVisualElement(e,o,s,n,f);for(const p in o){const g=e.getValue(p,e.latestValues[p]??null),x=o[p];if(x===void 0||m&&R4(m,p))continue;const b={delay:n,...$c(s||{},p)};h&&(b.skipAnimations=!0);const k=g.get();if(k!==void 0&&!g.isAnimating()&&!Array.isArray(x)&&x===k&&!b.velocity){et.update(()=>g.set(x));continue}let T=!1;if(window.MotionHandoffAnimation){const C=Cg(e);if(C){const _=window.MotionHandoffAnimation(C,p,et);_!==null&&(b.startTime=_,T=!0)}}jl(e,p);const A=c??e.shouldReduceMotion;g.start(qc(p,g,x,A&&Tg.has(p)?{type:!1}:b,e,T));const E=g.animation;E&&f.push(E)}if(a){const p=()=>et.update(()=>{a&&_4(e,a)});f.length?Promise.all(f).then(p):p()}return f}function Fl(e,t,n={}){var l;const r=or(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const s=r?()=>Promise.all(Ag(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:h=0,staggerChildren:f,staggerDirection:m}=i;return L4(e,t,c,h,f,m,n)}:()=>Promise.resolve(),{when:o}=i;if(o){const[c,h]=o==="beforeChildren"?[s,a]:[a,s];return c().then(()=>h())}else return Promise.all([s(),a(n.delay)])}function L4(e,t,n=0,r=0,i=0,s=1,a){const o=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),o.push(Fl(l,t,{...a,delay:n+(typeof r=="function"?0:r)+Eg(e.variantChildren,l,r,i,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}function P4(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>Fl(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=Fl(e,t,n);else{const i=typeof t=="function"?or(e,t,n.custom):t;r=Promise.all(Ag(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const D4={test:e=>e==="auto",parse:e=>e},Ng=e=>t=>t.test(e),_g=[Vr,Ee,hn,bn,o_,a_,D4],Dh=e=>_g.find(Ng(e));function O4(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||H0(e):!0}const j4=new Set(["brightness","contrast","saturate","opacity"]);function F4(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Fc)||[];if(!r)return e;const i=n.replace(r,"");let s=j4.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const B4=/\b([a-z-]*)\(.*?\)/gu,Bl={...rn,getAnimatableNone:e=>{const t=e.match(B4);return t?t.map(F4).join(" "):e}},Hl={...rn,getAnimatableNone:e=>{const t=rn.parse(e);return rn.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Oh={...Vr,transform:Math.round},H4={rotate:bn,pathRotation:bn,rotateX:bn,rotateY:bn,rotateZ:bn,scale:bi,scaleX:bi,scaleY:bi,scaleZ:bi,skew:bn,skewX:bn,skewY:bn,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:Rs,originX:kh,originY:kh,originZ:Ee},ta={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,inset:Ee,insetBlock:Ee,insetBlockStart:Ee,insetBlockEnd:Ee,insetInline:Ee,insetInlineStart:Ee,insetInlineEnd:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,paddingBlock:Ee,paddingBlockStart:Ee,paddingBlockEnd:Ee,paddingInline:Ee,paddingInlineStart:Ee,paddingInlineEnd:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,marginBlock:Ee,marginBlockStart:Ee,marginBlockEnd:Ee,marginInline:Ee,marginInlineStart:Ee,marginInlineEnd:Ee,fontSize:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee,...H4,zIndex:Oh,fillOpacity:Rs,strokeOpacity:Rs,numOctaves:Oh},U4={...ta,color:ft,backgroundColor:ft,outlineColor:ft,fill:ft,stroke:ft,borderColor:ft,borderTopColor:ft,borderRightColor:ft,borderBottomColor:ft,borderLeftColor:ft,filter:Bl,WebkitFilter:Bl,mask:Hl,WebkitMask:Hl},Ig=e=>U4[e],z4=new Set([Bl,Hl]);function Mg(e,t){let n=Ig(e);return z4.has(n)||(n=rn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const V4=new Set(["auto","none","0"]);function $4(e,t,n){let r=0,i;for(;r<e.length&&!i;){const s=e[r];typeof s=="string"&&!V4.has(s)&&Dr(s).values.length&&(i=e[r]),r++}if(i&&n)for(const s of t)e[s]=Mg(n,i)}class q4 extends Vc{constructor(t,n,r,i,s){super(t,n,r,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<t.length;h++){let f=t[h];if(typeof f=="string"&&(f=f.trim(),jc(f))){const m=wg(f,n.current);m!==void 0&&(t[h]=m),h===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!Tg.has(r)||t.length!==2)return;const[i,s]=t,a=Dh(i),o=Dh(s),l=Eh(i),c=Eh(s);if(l!==c&&In[r]){this.needsMeasurement=!0;return}if(a!==o)if(Ih(a)&&Ih(o))for(let h=0;h<t.length;h++){const f=t[h];typeof f=="string"&&(t[h]=parseFloat(f))}else In[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||O4(t[i]))&&r.push(i);r.length&&$4(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=In[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){var o;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const s=r.length-1,a=r[s];r[s]=In[n](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}const Gc=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Rg(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const Ul=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Ii(e){return B0(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Kc}=J0(queueMicrotask,!1),Qt={x:!1,y:!1};function Lg(){return Qt.x||Qt.y}function W4(e){return e==="x"||e==="y"?Qt[e]?null:(Qt[e]=!0,()=>{Qt[e]=!1}):Qt.x||Qt.y?null:(Qt.x=Qt.y=!0,()=>{Qt.x=Qt.y=!1})}function Pg(e,t){const n=Rg(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Y4(e){return!(e.pointerType==="touch"||Lg())}function G4(e,t,n={}){const[r,i,s]=Pg(e,n);return r.forEach(a=>{let o=!1,l=!1,c;const h=()=>{a.removeEventListener("pointerleave",p)},f=x=>{c&&(c(x),c=void 0),h()},m=x=>{o=!1,window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),l&&(l=!1,f(x))},d=()=>{o=!0,window.addEventListener("pointerup",m,i),window.addEventListener("pointercancel",m,i)},p=x=>{if(x.pointerType!=="touch"){if(o){l=!0;return}f(x)}},g=x=>{if(!Y4(x))return;l=!1;const b=t(a,x);typeof b=="function"&&(c=b,a.addEventListener("pointerleave",p,i))};a.addEventListener("pointerenter",g,i),a.addEventListener("pointerdown",d,i)}),s}const Dg=(e,t)=>t?e===t?!0:Dg(e,t.parentElement):!1,Xc=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,K4=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function X4(e){return K4.has(e.tagName)||e.isContentEditable===!0}const Q4=new Set(["INPUT","SELECT","TEXTAREA"]);function Z4(e){return Q4.has(e.tagName)||e.isContentEditable===!0}const Mi=new WeakSet;function jh(e){return t=>{t.key==="Enter"&&e(t)}}function Po(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const J4=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=jh(()=>{if(Mi.has(n))return;Po(n,"down");const i=jh(()=>{Po(n,"up")}),s=()=>Po(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Fh(e){return Xc(e)&&!Lg()}const Bh=new WeakSet;function eI(e,t,n={}){const[r,i,s]=Pg(e,n),a=o=>{const l=o.currentTarget;if(!Fh(o)||Bh.has(o))return;Mi.add(l),n.stopPropagation&&Bh.add(o);const c=t(l,o),h={...i,capture:!0},f=(p,g)=>{window.removeEventListener("pointerup",m,h),window.removeEventListener("pointercancel",d,h),Mi.has(l)&&Mi.delete(l),Fh(p)&&typeof c=="function"&&c(p,{success:g})},m=p=>{f(p,l===window||l===document||n.useGlobalTarget||Dg(l,p.target))},d=p=>{f(p,!1)};window.addEventListener("pointerup",m,h),window.addEventListener("pointercancel",d,h)};return r.forEach(o=>{(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,i),Ii(o)&&(o.addEventListener("focus",c=>J4(c,i)),!X4(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),s}function Qc(e){return B0(e)&&"ownerSVGElement"in e}const Ri=new WeakMap;let Cn;const Og=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:Qc(r)&&"getBBox"in r?r.getBBox()[t]:r[n],tI=Og("inline","width","offsetWidth"),nI=Og("block","height","offsetHeight");function rI({target:e,borderBoxSize:t}){var n;(n=Ri.get(e))==null||n.forEach(r=>{r(e,{get width(){return tI(e,t)},get height(){return nI(e,t)}})})}function sI(e){e.forEach(rI)}function iI(){typeof ResizeObserver>"u"||(Cn=new ResizeObserver(sI))}function aI(e,t){Cn||iI();const n=Rg(e);return n.forEach(r=>{let i=Ri.get(r);i||(i=new Set,Ri.set(r,i)),i.add(t),Cn==null||Cn.observe(r)}),()=>{n.forEach(r=>{const i=Ri.get(r);i==null||i.delete(t),i!=null&&i.size||Cn==null||Cn.unobserve(r)})}}const Li=new Set;let Cr;function oI(){Cr=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Li.forEach(t=>t(e))},window.addEventListener("resize",Cr)}function lI(e){return Li.add(e),Cr||oI(),()=>{Li.delete(e),!Li.size&&typeof Cr=="function"&&(window.removeEventListener("resize",Cr),Cr=void 0)}}function Hh(e,t){return typeof e=="function"?lI(e):aI(e,t)}function cI(e){return Qc(e)&&e.tagName==="svg"}const uI=[..._g,ft,rn],dI=e=>uI.find(Ng(e)),Uh=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ar=()=>({x:Uh(),y:Uh()}),zh=()=>({min:0,max:0}),mt=()=>({x:zh(),y:zh()}),hI=new WeakMap;function Aa(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Ls(e){return typeof e=="string"||Array.isArray(e)}const Zc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Jc=["initial",...Zc];function Na(e){return Aa(e.animate)||Jc.some(t=>Ls(e[t]))}function jg(e){return!!(Na(e)||e.variants)}function fI(e,t,n){for(const r in t){const i=t[r],s=n[r];if(vt(i))e.addValue(r,i);else if(vt(s))e.addValue(r,Or(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(r);e.addValue(r,Or(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const zl={current:null},Fg={current:!1},mI=typeof window<"u";function pI(){if(Fg.current=!0,!!mI)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>zl.current=e.matches;e.addEventListener("change",t),t()}else zl.current=!1}const Vh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let na={};function Bg(e){na=e}function gI(){return na}class xI{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:s,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Vc,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=_t.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,et.render(this.render,!1,!0))};const{latestValues:c,renderState:h}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=h,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=s,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=Na(n),this.isVariantNode=jg(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in m){const p=m[d];c[d]!==void 0&&vt(p)&&p.set(c[d])}}mount(t){var n,r;if(this.hasBeenMounted)for(const i in this.initialValues)(n=this.values.get(i))==null||n.jump(this.initialValues[i]),this.latestValues[i]=this.initialValues[i];this.current=t,hI.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,s)=>this.bindToMotionValue(s,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Fg.current||pI(),this.shouldReduceMotion=zl.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Rn(this.notifyUpdate),Rn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&vg.has(t)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:c,duration:h}=n.accelerate,f=new bg({element:this.current,name:t,keyframes:o,times:l,ease:c,duration:Ut(h)}),m=a(f);this.valueSubscriptions.set(t,()=>{m(),f.cancel()});return}const r=qr.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&et.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s&&s()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in na){const n=na[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):mt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Vh.length;r++){const i=Vh[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s="on"+i,a=t[s];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=fI(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Or(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(F0(r)||H0(r))?r=parseFloat(r):!dI(r)&&rn.test(n)&&(r=Mg(t,n)),this.setBaseTarget(t,vt(r)?r.get():r)),vt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var s;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const a=Wc(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);a&&(r=a[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!vt(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Pc),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Kc.render(this.render)}}class Hg extends xI{constructor(){super(...arguments),this.KeyframeResolver=q4}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;vt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Dn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Ug({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function bI({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function yI(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Do(e){return e===void 0||e===1}function Vl({scale:e,scaleX:t,scaleY:n}){return!Do(e)||!Do(t)||!Do(n)}function Xn(e){return Vl(e)||zg(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function zg(e){return $h(e.x)||$h(e.y)}function $h(e){return e&&e!=="0%"}function ra(e,t,n){const r=e-n,i=t*r;return n+i}function qh(e,t,n,r,i){return i!==void 0&&(e=ra(e,i,r)),ra(e,n,r)+t}function $l(e,t=0,n=1,r,i){e.min=qh(e.min,t,n,r,i),e.max=qh(e.max,t,n,r,i)}function Vg(e,{x:t,y:n}){$l(e.x,t.translate,t.scale,t.originPoint),$l(e.y,n.translate,n.scale,n.originPoint)}const Wh=.999999999999,Yh=1.0000000000001;function vI(e,t,n,r=!1){var o;const i=n.length;if(!i)return;t.x=t.y=1;let s,a;for(let l=0;l<i;l++){s=n[l],a=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(un(e.x,-s.scroll.offset.x),un(e.y,-s.scroll.offset.y)),a&&(t.x*=a.x.scale,t.y*=a.y.scale,Vg(e,a)),r&&Xn(s.latestValues)&&Pi(e,s.latestValues,(o=s.layout)==null?void 0:o.layoutBox))}t.x<Yh&&t.x>Wh&&(t.x=1),t.y<Yh&&t.y>Wh&&(t.y=1)}function un(e,t){e.min+=t,e.max+=t}function Gh(e,t,n,r,i=.5){const s=Je(e.min,e.max,i);$l(e,t,n,s,r)}function Kh(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Pi(e,t,n){const r=n??e;Gh(e.x,Kh(t.x,r.x),t.scaleX,t.scale,t.originX),Gh(e.y,Kh(t.y,r.y),t.scaleY,t.scale,t.originY)}function $g(e,t){return Ug(yI(e.getBoundingClientRect(),t))}function EI(e,t,n){const r=$g(e,n),{scroll:i}=t;return i&&(un(r.x,i.offset.x),un(r.y,i.offset.y)),r}const kI={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},wI=$r.length;function TI(e,t,n){let r="",i=!0;for(let a=0;a<wI;a++){const o=$r[a],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(o.startsWith("scale")?1:0);else{const h=parseFloat(l);c=o.startsWith("scale")?h===1:h===0}if(!c||n){const h=Ul(l,ta[o]);if(!c){i=!1;const f=kI[o]||o;r+=`${f}(${h}) `}n&&(t[o]=h)}}const s=e.pathRotation;return s&&(i=!1,r+=`rotate(${Ul(s,ta.pathRotation)}) `),r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function eu(e,t,n){const{style:r,vars:i,transformOrigin:s}=e;let a=!1,o=!1;for(const l in t){const c=t[l];if(qr.has(l)){a=!0;continue}else if(tg(l)){i[l]=c;continue}else{const h=Ul(c,ta[l]);l.startsWith("origin")?(o=!0,s[l]=h):r[l]=h}}if(t.transform||(a||n?r.transform=TI(t,e.transform,n):r.transform&&(r.transform="none")),o){const{originX:l="50%",originY:c="50%",originZ:h=0}=s;r.transformOrigin=`${l} ${c} ${h}`}}function qg(e,{style:t,vars:n},r,i){const s=e.style;let a;for(a in t)s[a]=t[a];i==null||i.applyProjectionStyles(s,r);for(a in n)s.setProperty(a,n[a])}function Xh(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ns={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ee.test(e))e=parseFloat(e);else return e;const n=Xh(e,t.target.x),r=Xh(e,t.target.y);return`${n}% ${r}%`}},SI={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=rn.parse(e);if(i.length>5)return r;const s=rn.createTransformer(e),a=typeof i[0]!="number"?1:0,o=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=o,i[1+a]/=l;const c=Je(o,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=c),typeof i[3+a]=="number"&&(i[3+a]/=c),s(i)}},ql={borderRadius:{...ns,applyTo:[...Gc]},borderTopLeftRadius:ns,borderTopRightRadius:ns,borderBottomLeftRadius:ns,borderBottomRightRadius:ns,boxShadow:SI};function Wg(e,{layout:t,layoutId:n}){return qr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ql[e]||e==="opacity")}function tu(e,t,n){var a;const r=e.style,i=t==null?void 0:t.style,s={};if(!r)return s;for(const o in r)(vt(r[o])||i&&vt(i[o])||Wg(o,e)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}function CI(e){return window.getComputedStyle(e)}class AI extends Hg{constructor(){super(...arguments),this.type="html",this.renderInstance=qg}mount(t){Sa(!!t.style),super.mount(t)}readValueFromInstance(t,n){var r;if(qr.has(n))return(r=this.projection)!=null&&r.isProjecting?Il(n):Y_(t,n);{const i=CI(t),s=(tg(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return $g(t,n)}build(t,n,r){eu(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return tu(t,n,r)}}const NI={offset:"stroke-dashoffset",array:"stroke-dasharray"},_I={offset:"strokeDashoffset",array:"strokeDasharray"};function II(e,t,n=1,r=0,i=!0){e.pathLength=1;const s=i?NI:_I;e[s.offset]=`${-r}`,e[s.array]=`${t} ${n}`}const Yg=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Gg(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:a=0,...o},l,c,h){if(eu(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m}=e;for(const d of Yg)f[d]!==void 0&&(m[d]=f[d],delete f[d]);(m.transform||f.transformOrigin)&&(m.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),m.transform&&(m.transformBox=(h==null?void 0:h.transformBox)??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),i!==void 0&&II(f,i,s,a,!1)}const Kg=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Xg=e=>typeof e=="string"&&e.toLowerCase()==="svg";function MI(e,t,n,r){qg(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Kg.has(i)?i:Yc(i),t.attrs[i])}function Qg(e,t,n){const r=tu(e,t,n);for(const i in e)if(vt(e[i])||vt(t[i])){const s=$r.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}class RI extends Hg{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=mt}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(qr.has(n)){const r=Ig(n);return r&&r.default||0}if(Yg.includes(n)){const i=getComputedStyle(t)[n];if(typeof i=="string"&&i)return i.trim()}return n=Kg.has(n)?n:Yc(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Qg(t,n,r)}build(t,n,r){Gg(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){MI(t,n,r,i)}mount(t){this.isSVGTag=Xg(t.tagName),super.mount(t)}}const LI=Jc.length;function Zg(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Zg(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<LI;n++){const r=Jc[n],i=e.props[r];(Ls(i)||i===!1)&&(t[r]=i)}return t}function Jg(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const PI=[...Zc].reverse(),DI=Zc.length;function OI(e){return t=>Promise.all(t.map(({animation:n,options:r})=>P4(e,n,r)))}function jI(e){let t=OI(e),n=Qh(),r=!0,i=!1;const s=c=>(h,f)=>{var d;const m=or(e,f,c==="exit"?(d=e.presenceContext)==null?void 0:d.custom:void 0);if(m){const{transition:p,transitionEnd:g,...x}=m;h={...h,...x,...g}}return h};function a(c){t=c(e)}function o(c){const{props:h}=e,f=Zg(e.parent)||{},m=[],d=new Set;let p={},g=1/0;for(let b=0;b<DI;b++){const k=PI[b],T=n[k],A=h[k]!==void 0?h[k]:f[k],E=Ls(A),C=k===c?T.isActive:null;C===!1&&(g=b);let _=A===f[k]&&A!==h[k]&&E;if(_&&(r||i)&&e.manuallyAnimateOnMount&&(_=!1),T.protectedKeys={...p},!T.isActive&&C===null||!A&&!T.prevProp||Aa(A)||typeof A=="boolean")continue;if(k==="exit"&&T.isActive&&C!==!0){T.prevResolvedValues&&(p={...p,...T.prevResolvedValues});continue}const w=FI(T.prevProp,A);let N=w||k===c&&T.isActive&&!_&&E||b>g&&E,S=!1;const R=Array.isArray(A)?A:[A];let M=R.reduce(s(k),{});C===!1&&(M={});const{prevResolvedValues:O={}}=T,L={...O,...M},I=B=>{N=!0,d.has(B)&&(S=!0,d.delete(B)),T.needsAnimating[B]=!0;const W=e.getValue(B);W&&(W.liveStyle=!1)};for(const B in L){const W=M[B],D=O[B];if(p.hasOwnProperty(B))continue;let q=!1;Ol(W)&&Ol(D)?q=!Jg(W,D)||w:q=W!==D,q?W!=null?I(B):d.add(B):W!==void 0&&d.has(B)?I(B):T.protectedKeys[B]=!0}T.prevProp=A,T.prevResolvedValues=M,T.isActive&&(p={...p,...M}),(r||i)&&e.blockInitialAnimation&&(N=!1);const j=_&&w;N&&(!j||S)&&m.push(...R.map(B=>{const W={type:k};if(typeof B=="string"&&(r||i)&&!j&&e.manuallyAnimateOnMount&&e.parent){const{parent:D}=e,q=or(D,B);if(D.enteringChildren&&q){const{delayChildren:Z}=q.transition||{};W.delay=Eg(D.enteringChildren,e,Z)}}return{animation:B,options:W}}))}if(d.size){const b={};if(typeof h.initial!="boolean"){const k=or(e,Array.isArray(h.initial)?h.initial[0]:h.initial);k&&k.transition&&(b.transition=k.transition)}d.forEach(k=>{const T=e.getBaseTarget(k),A=e.getValue(k);A&&(A.liveStyle=!0),b[k]=T??null}),m.push({animation:b})}let x=!!m.length;return r&&(h.initial===!1||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,i=!1,x?t(m):Promise.resolve()}function l(c,h){var m;if(n[c].isActive===h)return Promise.resolve();(m=e.variantChildren)==null||m.forEach(d=>{var p;return(p=d.animationState)==null?void 0:p.setActive(c,h)}),n[c].isActive=h;const f=o(c);for(const d in n)n[d].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=Qh(),i=!0}}}function FI(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Jg(t,e):!1}function Wn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Qh(){return{animate:Wn(!0),whileInView:Wn(),whileHover:Wn(),whileTap:Wn(),whileDrag:Wn(),whileFocus:Wn(),exit:Wn()}}function Wl(e,t){e.min=t.min,e.max=t.max}function Xt(e,t){Wl(e.x,t.x),Wl(e.y,t.y)}function Zh(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const ex=1e-4,BI=1-ex,HI=1+ex,tx=.01,UI=0-tx,zI=0+tx;function It(e){return e.max-e.min}function VI(e,t,n){return Math.abs(e-t)<=n}function Jh(e,t,n,r=.5){e.origin=r,e.originPoint=Je(t.min,t.max,e.origin),e.scale=It(n)/It(t),e.translate=Je(n.min,n.max,e.origin)-e.originPoint,(e.scale>=BI&&e.scale<=HI||isNaN(e.scale))&&(e.scale=1),(e.translate>=UI&&e.translate<=zI||isNaN(e.translate))&&(e.translate=0)}function ks(e,t,n,r){Jh(e.x,t.x,n.x,r?r.originX:void 0),Jh(e.y,t.y,n.y,r?r.originY:void 0)}function ef(e,t,n,r=0){const i=r?Je(n.min,n.max,r):n.min;e.min=i+t.min,e.max=e.min+It(t)}function $I(e,t,n,r){ef(e.x,t.x,n.x,r==null?void 0:r.x),ef(e.y,t.y,n.y,r==null?void 0:r.y)}function tf(e,t,n,r=0){const i=r?Je(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+It(t)}function sa(e,t,n,r){tf(e.x,t.x,n.x,r==null?void 0:r.x),tf(e.y,t.y,n.y,r==null?void 0:r.y)}function nf(e,t,n,r,i){return e-=t,e=ra(e,1/n,r),i!==void 0&&(e=ra(e,1/i,r)),e}function qI(e,t=0,n=1,r=.5,i,s=e,a=e){if(hn.test(t)&&(t=parseFloat(t),t=Je(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=Je(s.min,s.max,r);e===s&&(o-=t),e.min=nf(e.min,t,n,o,i),e.max=nf(e.max,t,n,o,i)}function rf(e,t,[n,r,i],s,a){qI(e,t[n],t[r],t[i],t.scale,s,a)}const WI=["x","scaleX","originX"],YI=["y","scaleY","originY"];function sf(e,t,n,r){rf(e.x,t,WI,n?n.x:void 0,r?r.x:void 0),rf(e.y,t,YI,n?n.y:void 0,r?r.y:void 0)}function af(e){return e.translate===0&&e.scale===1}function nx(e){return af(e.x)&&af(e.y)}function of(e,t){return e.min===t.min&&e.max===t.max}function GI(e,t){return of(e.x,t.x)&&of(e.y,t.y)}function lf(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function rx(e,t){return lf(e.x,t.x)&&lf(e.y,t.y)}function cf(e){return It(e.x)/It(e.y)}function uf(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ln(e){return[e("x"),e("y")]}function KI(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||s||a)&&(r=`translate3d(${i}px, ${s}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:h,pathRotation:f,rotateX:m,rotateY:d,skewX:p,skewY:g}=n;c&&(r=`perspective(${c}px) ${r}`),h&&(r+=`rotate(${h}deg) `),f&&(r+=`rotate(${f}deg) `),m&&(r+=`rotateX(${m}deg) `),d&&(r+=`rotateY(${d}deg) `),p&&(r+=`skewX(${p}deg) `),g&&(r+=`skewY(${g}deg) `)}const o=e.x.scale*t.x,l=e.y.scale*t.y;return(o!==1||l!==1)&&(r+=`scale(${o}, ${l})`),r||"none"}const XI=Gc.length,df=e=>typeof e=="string"?parseFloat(e):e,hf=e=>typeof e=="number"||Ee.test(e);function QI(e,t,n,r,i,s){i?(e.opacity=Je(0,n.opacity??1,ZI(r)),e.opacityExit=Je(t.opacity??1,0,JI(r))):s&&(e.opacity=Je(t.opacity??1,n.opacity??1,r));for(let a=0;a<XI;a++){const o=Gc[a];let l=ff(t,o),c=ff(n,o);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||hf(l)===hf(c)?(e[o]=Math.max(Je(df(l),df(c),r),0),(hn.test(c)||hn.test(l))&&(e[o]+="%")):e[o]=c}(t.rotate||n.rotate)&&(e.rotate=Je(t.rotate||0,n.rotate||0,r))}function ff(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ZI=sx(0,.5,K0),JI=sx(.5,.95,Gt);function sx(e,t,n){return r=>r<e?0:r>t?1:n(Ms(e,t,r))}function e6(e,t,n){const r=vt(e)?e:Or(e);return r.start(qc("",r,t,n)),r.animation}function Ps(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const t6=(e,t)=>e.depth-t.depth;class n6{constructor(){this.children=[],this.isDirty=!1}add(t){Lc(this.children,t),this.isDirty=!0}remove(t){Xi(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(t6),this.isDirty=!1,this.children.forEach(t)}}function r6(e,t){const n=_t.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Rn(r),e(s-t))};return et.setup(r,!0),()=>Rn(r)}function Di(e){return vt(e)?e.get():e}class s6{constructor(){this.members=[]}add(t){Lc(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Xi(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Xi(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&((n=i.instance)==null?void 0:n.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,n){var i;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:a}=t.options;(s===void 0||s!==a)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,i,s,a;(r=(n=t.options).onExitComplete)==null||r.call(n),(a=(i=t.resumingFrom)==null?void 0:(s=i.options).onExitComplete)==null||a.call(s)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const Oi={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Oo=["","X","Y","Z"],i6=1e3;let a6=0;function jo(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function ix(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Cg(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",et,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&ix(r)}function ax({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},o=t==null?void 0:t()){this.id=a6++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(c6),this.nodes.forEach(p6),this.nodes.forEach(g6),this.nodes.forEach(u6)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new n6)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Pc),this.eventHandlers.get(a).add(o)}notifyListeners(a,...o){const l=this.eventHandlers.get(a);l&&l.notify(...o)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=Qc(a)&&!cI(a),this.instance=a;const{layoutId:o,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),e){let h,f=0;const m=()=>this.root.updateBlockedByResize=!1;et.read(()=>{f=window.innerWidth}),e(a,()=>{const d=window.innerWidth;d!==f&&(f=d,this.root.updateBlockedByResize=!0,h&&h(),h=r6(m,250),Oi.hasAnimatedSinceResize&&(Oi.hasAnimatedSinceResize=!1,this.nodes.forEach(gf)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&c&&(o||l)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeLayoutChanged:m,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||E6,{onLayoutAnimationStart:g,onLayoutAnimationComplete:x}=c.getProps(),b=!this.targetLayout||!rx(this.targetLayout,d),k=!f&&m;if(this.options.layoutRoot||this.resumeFrom||k||f&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...$c(p,"layout"),onPlay:g,onComplete:x};(c.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(h,k,T.path)}else f||gf(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Rn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(x6),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ix(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const f=this.path[h];f.shouldResetTransform=!0,(typeof f.latestValues.x=="string"||typeof f.latestValues.y=="string")&&(f.isLayoutDirty=!0),f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(h6),this.nodes.forEach(mf);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(pf);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(f6),this.nodes.forEach(m6),this.nodes.forEach(o6),this.nodes.forEach(l6)):this.nodes.forEach(pf),this.clearAllSnapshots();const o=_t.now();yt.delta=mn(0,1e3/60,o-yt.timestamp),yt.timestamp=o,yt.isProcessing=!0,No.update.process(yt),No.preRender.process(yt),No.render.process(yt),yt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Kc.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(d6),this.sharedNodes.forEach(b6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,et.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){et.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!It(this.snapshot.measuredBox.x)&&!It(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=mt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(o=!1),o&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!nx(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,h=c!==this.prevTransformTemplateValue;a&&this.instance&&(o||Xn(this.latestValues)||h)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return a&&(l=this.removeTransform(l)),k6(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:a}=this.options;if(!a)return mt();const o=a.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(w6))){const{scroll:h}=this.root;h&&(un(o.x,h.offset.x),un(o.y,h.offset.y))}return o}removeElementScroll(a){var l;const o=mt();if(Xt(o,a),(l=this.scroll)!=null&&l.wasRoot)return o;for(let c=0;c<this.path.length;c++){const h=this.path[c],{scroll:f,options:m}=h;h!==this.root&&f&&m.layoutScroll&&(f.wasRoot&&Xt(o,a),un(o.x,f.offset.x),un(o.y,f.offset.y))}return o}applyTransform(a,o=!1,l){var h,f;const c=l||mt();Xt(c,a);for(let m=0;m<this.path.length;m++){const d=this.path[m];!o&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(un(c.x,-d.scroll.offset.x),un(c.y,-d.scroll.offset.y)),Xn(d.latestValues)&&Pi(c,d.latestValues,(h=d.layout)==null?void 0:h.layoutBox)}return Xn(this.latestValues)&&Pi(c,this.latestValues,(f=this.layout)==null?void 0:f.layoutBox),c}removeTransform(a){var l;const o=mt();Xt(o,a);for(let c=0;c<this.path.length;c++){const h=this.path[c];if(!Xn(h.latestValues))continue;let f;h.instance&&(Vl(h.latestValues)&&h.updateSnapshot(),f=mt(),Xt(f,h.measurePageBox())),sf(o,h.latestValues,(l=h.snapshot)==null?void 0:l.layoutBox,f)}return Xn(this.latestValues)&&sf(o,this.latestValues),o}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==yt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var d;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(a||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(d=this.parent)!=null&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:f}=this.options;if(!this.layout||!(h||f))return;this.resolvedRelativeTargetAt=yt.timestamp;const m=this.getClosestProjectingParent();m&&this.linkedParentVersion!==m.layoutVersion&&!m.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&m&&m.layout?this.createRelativeTarget(m,this.layout.layoutBox,m.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=mt(),this.targetWithTransforms=mt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),$I(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Xt(this.target,this.layout.layoutBox),Vg(this.target,this.targetDelta)):Xt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?this.createRelativeTarget(m,this.target,m.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Vl(this.parent.latestValues)||zg(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,o,l){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=mt(),this.relativeTargetOrigin=mt(),sa(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),Xt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var p;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===yt.timestamp&&(l=!1),l)return;const{layout:c,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||h))return;Xt(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;vI(this.layoutCorrected,this.treeScale,this.path,o),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=mt());const{target:d}=a;if(!d){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Zh(this.prevProjectionDelta.x,this.projectionDelta.x),Zh(this.prevProjectionDelta.y,this.projectionDelta.y)),ks(this.projectionDelta,this.layoutCorrected,d,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!uf(this.projectionDelta.x,this.prevProjectionDelta.x)||!uf(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",d))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ar(),this.projectionDelta=Ar(),this.projectionDeltaWithTransform=Ar()}setAnimationOrigin(a,o=!1,l){const c=this.snapshot,h=c?c.latestValues:{},f={...this.latestValues},m=Ar();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const d=mt(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,b=this.getStack(),k=!b||b.members.length<=1,T=!!(x&&!k&&this.options.crossfade===!0&&!this.path.some(v6));this.animationProgress=0;let A;const E=l==null?void 0:l.interpolateProjection(a);this.mixTargetDelta=C=>{const _=C/1e3,w=E==null?void 0:E(_);w?(m.x.translate=w.x,m.x.scale=Je(a.x.scale,1,_),m.x.origin=a.x.origin,m.x.originPoint=a.x.originPoint,m.y.translate=w.y,m.y.scale=Je(a.y.scale,1,_),m.y.origin=a.y.origin,m.y.originPoint=a.y.originPoint):(xf(m.x,a.x,_),xf(m.y,a.y,_)),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sa(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),y6(this.relativeTarget,this.relativeTargetOrigin,d,_),A&&GI(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=mt()),Xt(A,this.relativeTarget)),x&&(this.animationValues=f,QI(f,h,this.latestValues,_,T,k)),w&&w.rotate!==void 0&&(this.animationValues||(this.animationValues=f),this.animationValues.pathRotation=w.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var o,l,c;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Rn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=et.update(()=>{Oi.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Or(0)),this.motionValue.jump(0,!1),this.currentAnimation=e6(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(i6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:c,latestValues:h}=a;if(!(!o||!l||!c)){if(this!==a&&this.layout&&c&&ox(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||mt();const f=It(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+f;const m=It(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+m}Xt(o,l),Pi(o,h),ks(this.projectionDeltaWithTransform,this.layoutCorrected,o,h)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new s6),this.sharedNodes.get(a).add(o);const c=o.options.initialPromotionConfig;o.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const c={};l.z&&jo("z",a,c,this.animationValues);for(let h=0;h<Oo.length;h++)jo(`rotate${Oo[h]}`,a,c,this.animationValues),jo(`skew${Oo[h]}`,a,c,this.animationValues);a.render();for(const h in c)a.setStaticValue(h,c[h]),this.animationValues&&(this.animationValues[h]=c[h]);a.scheduleRender()}applyProjectionStyles(a,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=Di(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=Di(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Xn(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const h=c.animationValues||c.latestValues;this.applyTransformsToTarget();let f=KI(this.projectionDeltaWithTransform,this.treeScale,h);l&&(f=l(h,f)),a.transform=f;const{x:m,y:d}=this.projectionDelta;a.transformOrigin=`${m.origin*100}% ${d.origin*100}% 0`,c.animationValues?a.opacity=c===this?h.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:a.opacity=c===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const p in ql){if(h[p]===void 0)continue;const{correct:g,applyTo:x,isCSSVariable:b}=ql[p],k=f==="none"?h[p]:g(h[p],c);if(x){const T=x.length;for(let A=0;A<T;A++)a[x[A]]=k}else b?this.options.visualElement.renderState.vars[p]=k:a[p]=k}this.options.layoutId&&(a.pointerEvents=c===this?Di(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var o;return(o=a.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(mf),this.root.sharedNodes.clear()}}}function o6(e){e.updateLayout()}function l6(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:s}=e.options,a=t.source!==e.layout.source;if(s==="size")ln(f=>{const m=a?t.measuredBox[f]:t.layoutBox[f],d=It(m);m.min=r[f].min,m.max=m.min+d});else if(s==="x"||s==="y"){const f=s==="x"?"y":"x";Wl(a?t.measuredBox[f]:t.layoutBox[f],r[f])}else ox(s,t.layoutBox,r)&&ln(f=>{const m=a?t.measuredBox[f]:t.layoutBox[f],d=It(r[f]);m.max=m.min+d,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+d)});const o=Ar();ks(o,r,t.layoutBox);const l=Ar();a?ks(l,e.applyTransform(i,!0),t.measuredBox):ks(l,r,t.layoutBox);const c=!nx(o);let h=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:m,layout:d}=f;if(m&&d){const p=e.options.layoutAnchor||void 0,g=mt();sa(g,t.layoutBox,m.layoutBox,p);const x=mt();sa(x,r,d.layoutBox,p),rx(g,x)||(h=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function c6(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function u6(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function d6(e){e.clearSnapshot()}function mf(e){e.clearMeasurements()}function h6(e){e.isLayoutDirty=!0,e.updateLayout()}function pf(e){e.isLayoutDirty=!1}function f6(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function m6(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function gf(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function p6(e){e.resolveTargetDelta()}function g6(e){e.calcProjection()}function x6(e){e.resetSkewAndRotation()}function b6(e){e.removeLeadSnapshot()}function xf(e,t,n){e.translate=Je(t.translate,0,n),e.scale=Je(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function bf(e,t,n,r){e.min=Je(t.min,n.min,r),e.max=Je(t.max,n.max,r)}function y6(e,t,n,r){bf(e.x,t.x,n.x,r),bf(e.y,t.y,n.y,r)}function v6(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const E6={duration:.45,ease:[.4,0,.1,1]},yf=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),vf=yf("applewebkit/")&&!yf("chrome/")?Math.round:Gt;function Ef(e){e.min=vf(e.min),e.max=vf(e.max)}function k6(e){Ef(e.x),Ef(e.y)}function ox(e,t,n){return e==="position"||e==="preserve-aspect"&&!VI(cf(t),cf(n),.2)}function w6(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const T6=ax({attachResizeListener:(e,t)=>Ps(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Fo={current:void 0},lx=ax({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Fo.current){const e=new T6({});e.mount(window),e.setOptions({layoutScroll:!0}),Fo.current=e}return Fo.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),nu=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function kf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function S6(...e){return t=>{let n=!1;const r=e.map(i=>{const s=kf(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():kf(e[i],null)}}}}function C6(...e){return v.useCallback(S6(...e),e)}class A6 extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Ii(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=Ii(r)&&r.offsetWidth||0,s=Ii(r)&&r.offsetHeight||0,a=getComputedStyle(n),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left,o.bottom=s-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function N6({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:s}){var m;const a=v.useId(),o=v.useRef(null),l=v.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=v.useContext(nu),h=s!==!1?((m=e.props)==null?void 0:m.ref)??(e==null?void 0:e.ref):void 0,f=C6(o,h);return v.useInsertionEffect(()=>{const{width:d,height:p,top:g,left:x,right:b,bottom:k,direction:T}=l.current;if(t||s===!1||!o.current||!d||!p)return;const A=T==="rtl",E=n==="left"?A?`right: ${b}`:`left: ${x}`:A?`left: ${x}`:`right: ${b}`,C=r==="bottom"?`bottom: ${k}`:`top: ${g}`;o.current.dataset.motionPopId=a;const _=document.createElement("style");c&&(_.nonce=c);const w=i??document.head;return w.appendChild(_),_.sheet&&_.sheet.insertRule(`
|
|
521
|
+
[data-motion-pop-id="${a}"] {
|
|
522
|
+
position: absolute !important;
|
|
523
|
+
width: ${d}px !important;
|
|
524
|
+
height: ${p}px !important;
|
|
525
|
+
${E}px !important;
|
|
526
|
+
${C}px !important;
|
|
527
|
+
}
|
|
528
|
+
`),()=>{var N;(N=o.current)==null||N.removeAttribute("data-motion-pop-id"),w.contains(_)&&w.removeChild(_)}},[t]),u.jsx(A6,{isPresent:t,childRef:o,sizeRef:l,pop:s,children:s===!1?e:v.cloneElement(e,{ref:f})})}const _6=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a,anchorX:o,anchorY:l,root:c})=>{const h=Rc(I6),f=v.useId(),m=v.useRef(n),d=v.useRef(r);Ki(()=>{m.current=n,d.current=r});let p=!0,g=v.useMemo(()=>(p=!1,{id:f,initial:t,isPresent:n,custom:i,onExitComplete:x=>{h.set(x,!0);for(const b of h.values())if(!b)return;r&&r()},register:x=>(h.set(x,!1),()=>{var b;h.delete(x),!m.current&&!h.size&&((b=d.current)==null||b.call(d))})}),[n,h,r]);return s&&p&&(g={...g}),v.useMemo(()=>{h.forEach((x,b)=>h.set(b,!1))},[n]),v.useEffect(()=>{!n&&!h.size&&r&&r()},[n]),e=u.jsx(N6,{pop:a==="popLayout",isPresent:n,anchorX:o,anchorY:l,root:c,children:e}),u.jsx(Ta.Provider,{value:g,children:e})};function I6(){return new Map}function cx(e=!0){const t=v.useContext(Ta);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=v.useId();v.useEffect(()=>{if(e)return i(s)},[e]);const a=v.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,a]:[!0]}const yi=e=>e.key||"";function wf(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const M6=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:c})=>{const[h,f]=cx(a),m=v.useMemo(()=>wf(e),[e]),d=a&&!h?[]:m.map(yi),p=v.useRef(!0),g=v.useRef(m),x=Rc(()=>new Map),b=v.useRef(new Set),[k,T]=v.useState(m),[A,E]=v.useState(m);Ki(()=>{a&&!h&&!A.length&&(f==null||f())},[h,a,A.length,f]),Ki(()=>{p.current=!1,g.current=m;for(let w=0;w<A.length;w++){const N=yi(A[w]);d.includes(N)?(x.delete(N),b.current.delete(N)):x.get(N)!==!0&&x.set(N,!1)}},[A,d.length,d.join("-")]);const C=[];if(m!==k){let w=[...m];for(let N=0;N<A.length;N++){const S=A[N],R=yi(S);d.includes(R)||(w.splice(N,0,S),C.push(S))}return s==="wait"&&C.length&&(w=C),E(wf(w)),T(m),null}const{forceRender:_}=v.useContext(Mc);return u.jsx(u.Fragment,{children:A.map(w=>{const N=yi(w),S=a&&!h?!1:m===A||d.includes(N),R=()=>{if(b.current.has(N))return;if(x.has(N))b.current.add(N),x.set(N,!0);else return;let M=!0;x.forEach(O=>{O||(M=!1)}),M&&(_==null||_(),E(g.current),a&&(f==null||f()),r&&r())};return u.jsx(_6,{isPresent:S,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:s,root:c,onExitComplete:S?void 0:R,anchorX:o,anchorY:l,children:w},N)})})},ux=v.createContext({strict:!1}),Tf={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Sf=!1;function R6(){if(Sf)return;const e={};for(const t in Tf)e[t]={isEnabled:n=>Tf[t].some(r=>!!n[r])};Bg(e),Sf=!0}function dx(){return R6(),gI()}function L6(e){const t=dx();for(const n in e)t[n]={...t[n],...e[n]};Bg(t)}const _a=v.createContext({});function P6(e,t){if(Na(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Ls(n)?n:void 0,animate:Ls(r)?r:void 0}}return e.inherit!==!1?t:{}}function D6(e){const{initial:t,animate:n}=P6(e,v.useContext(_a));return v.useMemo(()=>({initial:t,animate:n}),[Cf(t),Cf(n)])}function Cf(e){return Array.isArray(e)?e.join(" "):e}const ru=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function hx(e,t,n){for(const r in t)!vt(t[r])&&!Wg(r,n)&&(e[r]=t[r])}function O6({transformTemplate:e},t){return v.useMemo(()=>{const n=ru();return eu(n,t,e),Object.assign({},n.vars,n.style)},[t])}function j6(e,t){const n=e.style||{},r={};return hx(r,n,e),Object.assign(r,O6(e,t)),r}function F6(e,t){const n={},r=j6(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const fx=()=>({...ru(),attrs:{}});function B6(e,t,n,r){const i=v.useMemo(()=>{const s=fx();return Gg(s,t,Xg(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};hx(s,e.style,e),i.style={...s,...i.style}}return i}const H6=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function ia(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||H6.has(e)}function U6(e,t){return e.startsWith("on")?!ia(e):(t==null?void 0:t(e))??!ia(e)}function z6(e,t,n,r){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||vt(e[s])||(U6(s,r)||n===!0&&ia(s)||!t&&!ia(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}const V6=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function su(e){return typeof e!="string"||e.includes("-")?!1:!!(V6.indexOf(e)>-1||/[A-Z]/u.test(e))}function $6(e,t,n,{latestValues:r},i,s=!1,a,o){const c=(a??su(e)?B6:F6)(t,r,i,e),h=z6(t,typeof e=="string",s,o),f=e!==v.Fragment?{...h,...c,ref:n}:{},{children:m}=t,d=v.useMemo(()=>vt(m)?m.get():m,[m]);return v.createElement(e,{...f,children:d})}function q6({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:W6(n,r,i,e),renderState:t()}}function W6(e,t,n,r){const i={},s=r(e,{});for(const m in s)i[m]=Di(s[m]);let{initial:a,animate:o}=e;const l=Na(e),c=jg(e);t&&c&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let h=n?n.initial===!1:!1;h=h||a===!1;const f=h?o:a;if(f&&typeof f!="boolean"&&!Aa(f)){const m=Array.isArray(f)?f:[f];for(let d=0;d<m.length;d++){const p=Wc(e,m[d]);if(p){const{transitionEnd:g,transition:x,...b}=p;for(const k in b){let T=b[k];if(Array.isArray(T)){const A=h?T.length-1:0;T=T[A]}T!==null&&(i[k]=T)}for(const k in g)i[k]=g[k]}}}return i}const mx=e=>(t,n)=>{const r=v.useContext(_a),i=v.useContext(Ta),s=()=>q6(e,t,r,i);return n?s():Rc(s)},Y6=mx({scrapeMotionValuesFromProps:tu,createRenderState:ru}),G6=mx({scrapeMotionValuesFromProps:Qg,createRenderState:fx}),K6=Symbol.for("motionComponentSymbol");function X6(e,t,n){const r=v.useRef(n);v.useInsertionEffect(()=>{r.current=n});const i=v.useRef(null);return v.useCallback(s=>{var o;s&&((o=e.onMount)==null||o.call(e,s)),t&&(s?t.mount(s):t.unmount());const a=r.current;if(typeof a=="function")if(s){const l=a(s);typeof l=="function"&&(i.current=l)}else i.current?(i.current(),i.current=null):a(s);else a&&(a.current=s)},[t])}const px=v.createContext({});function wr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Q6(e,t,n,r,i,s){var T,A;const{visualElement:a}=v.useContext(_a),o=v.useContext(ux),l=v.useContext(Ta),c=v.useContext(nu),h=c.reducedMotion,f=c.skipAnimations,m=v.useRef(null),d=v.useRef(!1);r=r||o.renderer,!m.current&&r&&(m.current=r(e,{visualState:t,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:h,skipAnimations:f,isSVG:s}),d.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const p=m.current,g=v.useContext(px);p&&!p.projection&&i&&(p.type==="html"||p.type==="svg")&&Z6(m.current,n,i,g);const x=v.useRef(!1);v.useInsertionEffect(()=>{p&&x.current&&p.update(n,l)});const b=n[Sg],k=v.useRef(!!b&&typeof window<"u"&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,b))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,b)));return Ki(()=>{d.current=!0,p&&(x.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),k.current&&p.animationState&&p.animationState.animateChanges())}),v.useEffect(()=>{p&&(!k.current&&p.animationState&&p.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,b)}),k.current=!1),p.enteringChildren=void 0)}),p}function Z6(e,t,n,r){const{layoutId:i,layout:s,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutAnchor:h,layoutCrossfade:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:gx(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||o&&wr(o),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:f,layoutScroll:l,layoutRoot:c,layoutAnchor:h})}function gx(e){if(e)return e.options.allowProjection!==!1?e.projection:gx(e.parent)}function Bo(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&L6(r);const s=n?n==="svg":su(e),a=s?G6:Y6;function o(c,h){let f;const m={...v.useContext(nu),...c,layoutId:J6(c)},{isStatic:d,isValidProp:p}=m,g=D6(c),x=a(c,d);if(!d&&typeof window<"u"){eM();const b=tM(m);f=b.MeasureLayout,g.visualElement=Q6(e,x,m,i,b.ProjectionNode,s)}return u.jsxs(_a.Provider,{value:g,children:[f&&g.visualElement?u.jsx(f,{visualElement:g.visualElement,...m}):null,$6(e,c,X6(x,g.visualElement,h),x,d,t,s,p)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=v.forwardRef(o);return l[K6]=e,l}function J6({layoutId:e}){const t=v.useContext(Mc).id;return t&&e!==void 0?t+"-"+e:e}function eM(e,t){v.useContext(ux).strict}function tM(e){const t=dx(),{drag:n,layout:r}=t;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function nM(e,t){if(typeof Proxy>"u")return Bo;const n=new Map,r=(s,a)=>Bo(s,a,e,t),i=(s,a)=>r(s,a);return new Proxy(i,{get:(s,a)=>a==="create"?r:(n.has(a)||n.set(a,Bo(a,void 0,e,t)),n.get(a))})}const rM=(e,t)=>t.isSVG??su(e)?new RI(t):new AI(t,{allowProjection:e!==v.Fragment});class sM extends Dn{constructor(t){super(t),t.animationState||(t.animationState=jI(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Aa(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let iM=0;class aM extends Dn{constructor(){super(...arguments),this.id=iM++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a)){const l=or(this.node,a,o);if(l){const{transition:c,transitionEnd:h,...f}=l;for(const m in f)(s=this.node.getValue(m))==null||s.jump(f[m])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const oM={animation:{Feature:sM},exit:{Feature:aM}};function Ks(e){return{point:{x:e.pageX,y:e.pageY}}}const lM=e=>t=>Xc(t)&&e(t,Ks(t));function ws(e,t,n,r){return Ps(e,t,lM(n),r)}const xx=({current:e})=>e?e.ownerDocument.defaultView:null,Af=(e,t)=>Math.abs(e-t);function cM(e,t){const n=Af(e.x,t.x),r=Af(e.y,t.y);return Math.sqrt(n**2+r**2)}const Nf=new Set(["auto","scroll"]);class bx{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:s=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=vi(this.lastRawMoveEventInfo,this.transformPagePoint));const p=Ho(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=cM(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:b}=p,{timestamp:k}=yt;this.history.push({...b,timestamp:k});const{onStart:T,onMove:A}=this.handlers;g||(T&&T(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=vi(g,this.transformPagePoint),et.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:x,onSessionEnd:b,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=Ho(p.type==="pointercancel"?this.lastMoveEventInfo:vi(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(p,T),b&&b(p,T)},!Xc(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=i||window;const l=Ks(t),c=vi(l,this.transformPagePoint),{point:h}=c,{timestamp:f}=yt;this.history=[{...h,timestamp:f}];const{onSessionStart:m}=n;m&&m(t,Ho(c,this.history));const d={passive:!0,capture:!0};this.removeListeners=Ws(ws(this.contextWindow,"pointermove",this.handlePointerMove,d),ws(this.contextWindow,"pointerup",this.handlePointerUp,d),ws(this.contextWindow,"pointercancel",this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Nf.has(r.overflowX)||Nf.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:i.x-n.x,y:i.y-n.y};s.x===0&&s.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,i),et.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Rn(this.updatePoint)}}function vi(e,t){return t?{point:t(e.point)}:e}function _f(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ho({point:e},t){return{point:e,delta:_f(e,yx(t)),offset:_f(e,uM(t)),velocity:dM(t,.1)}}function uM(e){return e[0]}function yx(e){return e[e.length-1]}function dM(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=yx(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ut(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Ut(t)*2&&(r=e[1]);const s=Yt(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const a={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function hM(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Je(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Je(n,e,r.max):Math.min(e,n)),e}function If(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function fM(e,{top:t,left:n,bottom:r,right:i}){return{x:If(e.x,n,i),y:If(e.y,t,r)}}function Mf(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function mM(e,t){return{x:Mf(e.x,t.x),y:Mf(e.y,t.y)}}function pM(e,t){let n=.5;const r=It(e),i=It(t);return i>r?n=Ms(t.min,t.max-r,e.min):r>i&&(n=Ms(e.min,e.max-i,t.min)),mn(0,1,n)}function gM(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Yl=.35;function xM(e=Yl){return e===!1?e=0:e===!0&&(e=Yl),{x:Rf(e,"left","right"),y:Rf(e,"top","bottom")}}function Rf(e,t,n){return{min:Lf(e,t),max:Lf(e,n)}}function Lf(e,t){return typeof e=="number"?e:e[t]||0}const bM=new WeakMap;class yM{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=mt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const s=f=>{n&&this.snapToCursor(Ks(f).point),this.stopAnimation()},a=(f,m)=>{const{drag:d,dragPropagation:p,onDragStart:g}=this.getProps();if(d&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=W4(d),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ln(b=>{let k=this.getAxisMotionValue(b).get()||0;if(hn.test(k)){const{projection:T}=this.visualElement;if(T&&T.layout){const A=T.layout.layoutBox[b];A&&(k=It(A)*(parseFloat(k)/100))}}this.originPoint[b]=k}),g&&et.update(()=>g(f,m),!1,!0),jl(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m;const{dragPropagation:d,dragDirectionLock:p,onDirectionLock:g,onDrag:x}=this.getProps();if(!d&&!this.openDragLock)return;const{offset:b}=m;if(p&&this.currentDirection===null){this.currentDirection=EM(b),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),x&&et.update(()=>x(f,m),!1,!0)},l=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m,this.stop(f,m),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new bx(t,{onSessionStart:s,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:r,contextWindow:xx(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!i||!r)return;const{velocity:a}=i;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&et.postRender(()=>o(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Ei(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=hM(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var s;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,i=this.constraints;t&&wr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=fM(r.layoutBox,t):this.constraints=!1,this.elastic=xM(n),i!==this.constraints&&!wr(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&ln(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=gM(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!wr(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());const s=EI(r,i.root,this.visualElement.getTransformPagePoint());let a=mM(i.layout.layoutBox,s);if(n){const o=n(bI(a));this.hasMutatedConstraints=!!o,o&&(a=Ug(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},c=ln(h=>{if(!Ei(h,n,this.currentDirection))return;let f=l&&l[h]||{};(a===!0||a===h)&&(f={min:0,max:0});const m=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:r?t[h]:0,bounceStiffness:m,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(h,p)});return Promise.all(c).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return jl(this.visualElement,t),r.start(qc(t,r,0,n,this.visualElement,!1))}stopAnimation(){ln(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps()[n];return i||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){ln(n=>{const{drag:r}=this.getProps();if(!Ei(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:o}=i.layout.layoutBox[n],l=s.get()||0;s.set(t[n]-Je(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!wr(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ln(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();i[a]=pM({min:l,max:l},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),ln(a=>{if(!Ei(a,t,null))return;const o=this.getAxisMotionValue(a),{min:l,max:c}=this.constraints[a];o.set(Je(l,c,i[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;bM.set(this.visualElement,this);const t=this.visualElement.current,n=ws(t,"pointerdown",c=>{const{drag:h,dragListener:f=!0}=this.getProps(),m=c.target,d=m!==t&&Z4(m);h&&f&&!d&&this.start(c)});let r;const i=()=>{const{dragConstraints:c}=this.getProps();wr(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=vM(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,a=s.addEventListener("measure",i);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),et.read(i);const o=Ps(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:h})=>{this.isDragging&&h&&(ln(f=>{const m=this.getAxisMotionValue(f);m&&(this.originPoint[f]+=c[f].translate,m.set(m.get()+c[f].translate))}),this.visualElement.render())}));return()=>{o(),n(),a(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:a=Yl,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:o}}}function Pf(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function vM(e,t,n){const r=Hh(e,Pf(n)),i=Hh(t,Pf(n));return()=>{r(),i()}}function Ei(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function EM(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class kM extends Dn{constructor(t){super(t),this.removeGroupControls=Gt,this.removeListeners=Gt,this.controls=new yM(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Gt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Uo=e=>(t,n)=>{e&&et.update(()=>e(t,n),!1,!0)};class wM extends Dn{constructor(){super(...arguments),this.removePointerDownListener=Gt}onPointerDown(t){this.session=new bx(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xx(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Uo(t),onStart:Uo(n),onMove:Uo(r),onEnd:(s,a)=>{delete this.session,i&&et.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=ws(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let zo=!1;class TM extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),zo&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Oi.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,{projection:a}=r;return a&&(a.isPresent=s,t.layoutDependency!==n&&a.setOptions({...a.options,layoutDependency:n}),zo=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==s?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||et.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Kc.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;zo=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function vx(e){const[t,n]=cx(),r=v.useContext(Mc);return u.jsx(TM,{...e,layoutGroup:r,switchLayoutGroup:v.useContext(px),isPresent:t,safeToRemove:n})}const SM={pan:{Feature:wM},drag:{Feature:kM,ProjectionNode:lx,MeasureLayout:vx}};function Df(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,s=r[i];s&&et.postRender(()=>s(t,Ks(t)))}class CM extends Dn{mount(){const{current:t}=this.node;t&&(this.unmount=G4(t,(n,r)=>(Df(this.node,r,"Start"),i=>Df(this.node,i,"End"))))}unmount(){}}class AM extends Dn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ws(Ps(this.node.current,"focus",()=>this.onFocus()),Ps(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Of(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),s=r[i];s&&et.postRender(()=>s(t,Ks(t)))}class NM extends Dn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=eI(t,(i,s)=>(Of(this.node,s,"Start"),(a,{success:o})=>Of(this.node,a,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Gl=new WeakMap,Vo=new WeakMap,_M=e=>{const t=Gl.get(e.target);t&&t(e)},IM=e=>{e.forEach(_M)};function MM({root:e,...t}){const n=e||document;Vo.has(n)||Vo.set(n,{});const r=Vo.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(IM,{root:e,...t})),r[i]}function RM(e,t,n){const r=MM(t);return Gl.set(e,n),r.observe(e),()=>{Gl.delete(e),r.unobserve(e)}}const LM={some:0,all:1};class PM extends Dn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:LM[i]},o=c=>{const{isIntersecting:h}=c;if(this.isInView===h||(this.isInView=h,s&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:f,onViewportLeave:m}=this.node.getProps(),d=h?f:m;d&&d(c)};this.stopObserver=RM(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(DM(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function DM({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const OM={inView:{Feature:PM},tap:{Feature:NM},focus:{Feature:AM},hover:{Feature:CM}},jM={layout:{ProjectionNode:lx,MeasureLayout:vx}},FM={...oM,...OM,...SM,...jM},BM=nM(FM,rM),HM=BM;function UM(e){switch(e){case"correct":return{Icon:tn,color:"var(--brand)"};case"wrong":return{Icon:lr,color:"var(--warning)"};case"mastery":case"level-up":return{Icon:Yf,color:"var(--gold)"};case"unlock":return{Icon:Go,color:"var(--brand)"};case"streak":return{Icon:Gf,color:"var(--review)"};case"energy-full":return{Icon:Xo,color:"var(--brand)"};case"exam-pass":return{Icon:l1,color:"var(--exam)"};case"lesson-complete":return{Icon:W1,color:"var(--gold)"};default:return{Icon:Go,color:"var(--brand)"}}}function zM(){const e=Xl(),t=v.useRef(null),n=v.useRef([]),r=v.useRef(0),[i,s]=v.useState(null);return v.useEffect(()=>{if(e)return;const a=t.current;if(!a)return;const o=a.getContext("2d");if(!o)return;const l=()=>{const m=Math.min(window.devicePixelRatio||1,2);a.width=window.innerWidth*m,a.height=window.innerHeight*m,a.style.width=window.innerWidth+"px",a.style.height=window.innerHeight+"px",o.setTransform(m,0,0,m,0,0)};l(),window.addEventListener("resize",l);const c=()=>{o.clearRect(0,0,window.innerWidth,window.innerHeight);const m=n.current;for(let d=m.length-1;d>=0;d--){const p=m[d];if(p.x+=p.vx,p.y+=p.vy,p.vy+=.25,p.vx*=.99,p.rot+=p.vr,p.life--,p.life<=0){m.splice(d,1);continue}const g=Math.min(1,p.life/p.maxLife);o.save(),o.globalAlpha=g,o.translate(p.x,p.y),o.rotate(p.rot),o.fillStyle=p.color,p.shape==="circle"?(o.beginPath(),o.arc(0,0,p.size,0,Math.PI*2),o.fill()):o.fillRect(-p.size/2,-p.size/2,p.size,p.size*.6),o.restore()}r.current=m.length>0?requestAnimationFrame(c):0},f=vu(m=>{var b,k;const d=Qx(m.kind),p=Math.round(d.particles*(m.intensity??1)),g=((b=m.origin)==null?void 0:b.x)??window.innerWidth/2,x=((k=m.origin)==null?void 0:k.y)??window.innerHeight/2;for(let T=0;T<p;T++){const A=Math.PI*2*T/p+Math.random()*.3,E=3+Math.random()*6,C=d.durationMs/16*(.7+Math.random()*.5);n.current.push({x:g,y:x,vx:Math.cos(A)*E,vy:Math.sin(A)*E-2,life:C,maxLife:C,color:d.colors[T%d.colors.length],size:4+Math.random()*5,rot:Math.random()*Math.PI,vr:(Math.random()-.5)*.3,shape:Math.random()<.5?"rect":"circle"})}r.current===0&&(r.current=requestAnimationFrame(c))});return()=>{f(),window.removeEventListener("resize",l),r.current&&cancelAnimationFrame(r.current),r.current=0,n.current=[]}},[e]),v.useEffect(()=>{if(!e)return;let a=0;return vu(l=>{const c=++a;s({kind:l.kind,id:c}),setTimeout(()=>{c===a&&s(null)},600)})},[e]),e?u.jsx(M6,{children:i&&(()=>{const{Icon:a,color:o}=UM(i.kind);return u.jsx(HM.div,{className:"fixed inset-0 pointer-events-none z-[60] flex items-center justify-center","aria-hidden":"true",initial:{opacity:0},animate:{opacity:.45},exit:{opacity:0},transition:{duration:.2},children:u.jsx(a,{className:"w-24 h-24",color:o,strokeWidth:1.5})},i.id)})()}):u.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none z-[60]","aria-hidden":"true"})}const jf=["direct","guide","practice"];function VM(){const e=_e(),[t,n]=v.useState([]),[r,i]=v.useState([]),[s,a]=v.useState({}),[o,l]=v.useState(null),[c,h]=v.useState(null),[f,m]=v.useState(null),[d,p]=v.useState(null),g=v.useCallback(G=>{p(G instanceof Error?G.message:String(G)),console.error(G)},[]),[x,b]=v.useState([]),[k,T]=v.useState(null),[A,E]=v.useState([]),[C,_]=v.useState(null),[w,N]=v.useState("map"),[S,R]=v.useState(null),[M,O]=v.useState(new Set),[L,I]=v.useState(null),j=v.useRef({active:!1,terminate:null}),[U,B]=v.useState({open:!1,pendingAction:null}),W=v.useRef(null),[D,q]=v.useState(null),[Z,P]=v.useState(!1),[K,V]=v.useState(!0),[$,ae]=v.useState(!0),ne=U5(),[Y,ye]=v.useState("notebook"),[re,ie]=v.useState("chat"),le=v.useRef(re);le.current=re;const xe=v.useRef(ne);v.useEffect(()=>{xe.current!==ne&&(ne===1?(V(!0),ae(!0)):ne===2&&xe.current===3&&ye(O5(le.current)),xe.current=ne)},[ne]);const ke=ne===3?re==="rail":ne===2?Y==="rail":K,ze=ne===3?re==="notebook":ne===2?Y==="notebook":$,Te=ne!==3||re==="chat",Ge=()=>{ne===1?V(G=>!G):ne===2?ye(G=>G==="rail"?"notebook":"rail"):ie(G=>G==="rail"?"chat":"rail")},oe=()=>{ne===1?ae(G=>!G):ne===2?ye(G=>G==="notebook"?"rail":"notebook"):ie(G=>G==="notebook"?"chat":"notebook")},Ie=v.useRef(null),We=G=>{var me,Ae;if(ne!==3)return;const se=G.touches[0];Ie.current={x:se.clientX,y:se.clientY,multi:G.touches.length>1,noswipe:!!((Ae=(me=G.target).closest)!=null&&Ae.call(me,"[data-noswipe]"))}},Ue=G=>{const se=Ie.current;if(Ie.current=null,!se||se.multi||se.noswipe||ne!==3)return;const me=G.changedTouches[0],Ae=j5(le.current,me.clientX-se.x,me.clientY-se.y);Ae&&ie(Ae)},[Xe,De]=v.useState(!1),[we,ee]=v.useState(null),[ce,ve]=v.useState([]),ge=M5(f,L),Se=im(),de=N5(ge.activeId,Se);v.useEffect(()=>{Zx(de.streaming)},[de.streaming]);const[be,Ce]=v.useState(""),Ve=v.useCallback(G=>{Ce(G)},[]),Mt=v.useCallback((G,se,me)=>{if(G.type==="content"){if(q("content"),me){const Ae=Qe=>{document.querySelector(`mark[data-note-id="${me}"]`)?window.dispatchEvent(new CustomEvent("lookatstudy-jump-to-note",{detail:me})):Qe>0&&setTimeout(()=>Ae(Qe-1),150)};setTimeout(()=>Ae(10),100)}}else if(G.threadId!==ge.activeId&&ge.setActiveId(G.threadId),me){const Ae=Qe=>{document.querySelector(`mark[data-note-id="${me}"]`)?window.dispatchEvent(new CustomEvent("lookatstudy-jump-to-chat-note",{detail:me})):Qe>0&&setTimeout(()=>Ae(Qe-1),150)};setTimeout(()=>Ae(10),120)}},[ge]),[ct,St]=v.useState(null);v.useEffect(()=>{if(!L){St(null);return}let G=!1;return X.getNodeSummary(L,Se).then(se=>{G||St(se)}).catch(()=>{G||St(null)}),()=>{G=!0}},[L,Se]);const Pe=v.useMemo(()=>r.find(G=>G.id===L)??null,[r,L]),On=v.useMemo(()=>ce.map(G=>({...G,label:e(`starter.${G.key}.label`),hint:e(`starter.${G.key}.hint`),message:e(`starter.${G.key}.message`,{title:(Pe==null?void 0:Pe.title)??""})})),[ce,Pe,e]),Q=v.useRef(null),Oe=v.useCallback(()=>{var G;Pe&&((G=Q.current)==null||G.call(Q,e("chat.action.startLearningPrompt",{title:Pe.title}),e("chat.action.startLearning",{title:Pe.title})))},[Pe,e]),rt=v.useCallback(async()=>{try{const[G,se,me,Ae,Qe,Ot]=await Promise.all([X.listCourses(),X.getStreak(),X.listSouls(),X.getActiveSoul(),X.getXpStatus(),X.getDueReviews()]);n(G),l(se),E(me),h(Qe),_(Ae),O(new Set(Ot)),f&&!G.some(Tx=>Tx.id===f)&&(m(null),I(null),i([]),a({}),R(null),b([]),T(null))}catch(G){p(G instanceof Error?G.message:String(G))}},[f]);v.useEffect(()=>{rt()},[rt]);const Et=v.useCallback(async()=>{try{ee(await X.isAgentReady())}catch{ee({ready:!1,missing:e("error.checkReadyFailed")})}},[e]);v.useEffect(()=>{Et();const G=()=>Et();return window.addEventListener("llm-config-changed",G),()=>window.removeEventListener("llm-config-changed",G)},[Et]);const Re=v.useRef(0),$e=v.useRef(0);v.useEffect(()=>{Re.current=(c==null?void 0:c.todayXp)??0},[c]),v.useEffect(()=>{$e.current=(o==null?void 0:o.currentStreak)??0},[o]);const it=v.useCallback(async()=>{const G=r.filter(Ae=>Ae.type==="lesson"||Ae.type==="exam"),se=await Promise.all(G.map(async Ae=>{const Qe=await X.getProgress(Ae.id);return[Ae.id,Qe]})),me={};for(const[Ae,Qe]of se)Qe&&(me[Ae]=Qe);a(me)},[r]);v.useEffect(()=>X.on("state:changed",se=>{se==="xp"?X.getXpStatus().then(me=>{h(me),Re.current<100&&me.todayXp>=100&&er("energy-full")}).catch(()=>{}):se==="streak"?X.getStreak().then(me=>{l(me),me.currentStreak>$e.current&&er("streak")}).catch(()=>{}):se==="mastery"&&(er("mastery"),rt(),it())}),[rt,it]),v.useEffect(()=>{f&&(X.getCourseLanguages(f).then(b).catch(()=>b([])),X.getCourseLanguage(f).then(T).catch(()=>T(null)))},[f]),v.useEffect(()=>{f&&(X.getCourseTree(f,k??void 0).then(async G=>{i(G);const se=G.filter(Qe=>Qe.type==="lesson"||Qe.type==="exam"),me=await Promise.all(se.map(async Qe=>{const Ot=await X.getProgress(Qe.id);return[Qe.id,Ot]})),Ae={};for(const[Qe,Ot]of me)Ot&&(Ae[Qe]=Ot);a(Ae)}).catch(g),X.getDashboard(f).then(R).catch(g))},[f,k,g]),v.useEffect(()=>{if(!L){ve([]);return}X.getStarterPrompts(L).then(ve).catch(()=>ve([]))},[L]),v.useEffect(()=>{const G=se=>{if(se.key==="Escape"&&ge.activeId&&(X.abortAgentChatThread(ge.activeId).catch(()=>{}),P(!1),De(!1)),(se.ctrlKey||se.metaKey)&&se.key==="k"&&(se.preventDefault(),De(me=>!me)),(se.ctrlKey||se.metaKey)&&se.key==="b"&&(se.preventDefault(),Ge()),(se.ctrlKey||se.metaKey)&&se.key==="Tab"){if(se.preventDefault(),j.current.active)return;const me=ge.threads;if(me.length>1){const Ae=me.findIndex(Ot=>Ot.id===ge.activeId),Qe=se.shiftKey?(Ae-1+me.length)%me.length:(Ae+1)%me.length;ge.setActiveId(me[Qe].id)}}(!se.target||!se.target.matches("input, textarea, select"))&&(se.key==="1"&&N("map"),se.key==="2"&&N("import"),se.key==="s"&&(se.ctrlKey||se.metaKey)&&(se.preventDefault(),P(!0)))};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[L]);const Ke=v.useCallback(async G=>{var se;try{if(G.type==="exam"){I(G.id),q("content");return}if(((se=s[G.id])==null?void 0:se.status)==="locked"){I(null);return}await X.markNodeAttempted(G.id);const me=await X.getStreak();await it(),l(me),I(G.id),q("content"),Ra(!1)}catch(me){g(me)}},[s,it,g]),ut=v.useCallback(G=>{if(j.current.active){B({open:!0,pendingAction:G});return}G()},[]),Be=v.useCallback(G=>{if(j.current.active&&G.id!==L){B({open:!0,pendingAction:()=>void Ke(G)});return}Ke(G)},[Ke,L]),Le=v.useCallback(G=>{j.current=G},[]),je=v.useCallback(async()=>{const G=U.pendingAction;B({open:!1,pendingAction:null});const se=j.current;if(j.current={active:!1,terminate:null},se.active&&se.terminate)try{await se.terminate()}catch{}G==null||G()},[U.pendingAction]);jr(W,U.open),v.useEffect(()=>{if(!U.open)return;const G=se=>{se.key==="Escape"&&B({open:!1,pendingAction:null})};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[U.open]);const Ct=async G=>{try{await X.setActiveSoul(G),_(G)}catch(se){g(se)}},Ye=v.useCallback(async(G,se,me)=>{try{await X.applyProposal(G),de.markProposalStatus(se,me,!0)}catch(Ae){g(Ae)}},[de,g]),ot=v.useCallback(async(G,se,me)=>{try{await X.rejectProposal(G),de.markProposalStatus(se,me,!1)}catch(Ae){g(Ae)}},[de,g]),bt=t.find(G=>G.id===f),jn=v.useMemo(()=>{const G=new Set(r.map(se=>se.id));return new Set([...M].filter(se=>G.has(se)))},[M,r]),Fn=jn.size,Xs=v.useMemo(()=>r.filter(G=>G.type==="section").sort((G,se)=>G.orderIdx-se.orderIdx),[r]),Qs=v.useMemo(()=>{const G=jf.map(me=>A.find(Ae=>Ae.name===me)).filter(me=>!!me),se=A.filter(me=>!jf.includes(me.name));return[...G,...se]},[A]),At=hN(f),pt=mN(),at=Ic();v.useEffect(()=>X.on("exam:status",se=>{if(se.status!=="ready"||se.nodeId===L)return;const me=r.find(Ae=>Ae.id===se.nodeId);me&&at.show(e("exam.ready.toast",{title:me.title}),{duration:4e3})}),[L,r,at,e]);const fr=v.useCallback(async G=>{const se=t.find(me=>me.id===G);try{await X.deleteCourse(G),at.show(e("import.deleted",{title:(se==null?void 0:se.title)??G}),{duration:3e3}),rt()}catch(me){g(me)}},[t,rt,g,at,e]),Bn=v.useCallback(async(G,se,me)=>{if(!G.trim()||de.streaming)return;if(!ge.activeId){const Qe=await ge.ensureThreadForSend(G,se);if(Qe){de.send(G,Qe,se,me);return}at.show(e("toast.threadCreateFailed"));return}const Ae=ge.activeThread;Ae&&!Ae.title&&ge.update(Ae.id,{title:(se??G).trim()}),de.send(G,void 0,se,me)},[de,ge,at,e]),mr=v.useRef(de.streaming);mr.current=de.streaming;const Dt=v.useCallback(G=>{const se=I5(G,e),me=_5(G,e),Ae=Qe=>{var Ot;if(!mr.current){(Ot=Q.current)==null||Ot.call(Q,se,me);return}Qe>0&&setTimeout(()=>Ae(Qe-1),2e3)};Ae(10)},[e]);Q.current=Bn;const Hn=new Set(["concept_map","diagram","compare_table","code_walkthrough"]),Un=v.useMemo(()=>{const G=oh(de.messages).filter(me=>{var Ae;return Hn.has(((Ae=me.output)==null?void 0:Ae.artifactType)??"")});if(G.length)return G[G.length-1];const se=At.items.filter(me=>Hn.has(me.artifactType)).map(me=>{try{return{id:me.id,toolName:me.artifactType,output:JSON.parse(me.data)}}catch{return null}}).filter(me=>me!==null);return se.length?se[se.length-1]:null},[de.messages,At.items]),iu=v.useRef(new Set);v.useEffect(()=>{!Un||iu.current.has(Un.id)||(iu.current.add(Un.id),de.streaming&&q("board"))},[Un,de.streaming]);const kx=v.useMemo(()=>de.messages.reduce((G,se)=>G+se.parts.reduce((me,Ae)=>Ae.type==="text"?me+tm(Ae.text):me,0),0),[de.messages]),au=v.useRef(!1);v.useEffect(()=>{Fn>0&&!au.current&&(au.current=!0,at.show(e("review.nudge",{n:Fn}),{duration:4e3}))},[Fn,at,e]);const ou=v.useMemo(()=>oh(de.messages),[de.messages]),lu=v.useRef(new Set);v.useEffect(()=>{for(const G of ou){const se=G.output;if(!se||!se.artifactType)continue;const me=`${se.artifactType}:${JSON.stringify(se)}`;lu.current.has(me)||(lu.current.add(me),At.save({nodeId:L,artifactType:se.artifactType,title:se.title??null,data:se}),at.show(e("toast.artifactSaved"),{duration:3e3}))}},[ou,At,L,at,e]),v.useEffect(()=>{w!=="map"&&q(null)},[w]);const[wx,Ia]=v.useState(!1),[Ma,Ra]=v.useState(!1),cu=(Pe==null?void 0:Pe.type)==="exam";return v.useEffect(()=>{cu&&window.dispatchEvent(new CustomEvent("companion-exam-enter"))},[cu]),v.useEffect(()=>{Jx(Ma)},[Ma]),u.jsxs("div",{className:"h-[var(--app-height,100vh)] flex flex-col bg-surface-1 text-neutral-900 dark:text-neutral-100 overflow-hidden",children:[u.jsx(qM,{streak:o,xp:c,fontSize:pt.size,onFontBump:pt.bump,onOpenSettings:()=>P(!0),leftVisible:ke,rightVisible:ze,onToggleLeft:Ge,onToggleRight:oe,tier:ne,bottomBar:ne===3?u.jsx("nav",{className:"inline-flex items-center gap-0.5 p-0.5 rounded-lg bg-ink/5 ring-1 ring-inset ring-[var(--border)]","data-testid":"t3-pane-switcher",role:"tablist","aria-label":e("pane.switcher"),children:[{k:"rail",icon:ec,label:e("pane.map"),testid:"t3-btn-rail"},{k:"chat",icon:N1,label:e("pane.chat"),testid:"t3-btn-chat"},{k:"notebook",icon:P1,label:e("pane.notes"),testid:"t3-btn-notebook"}].map(({k:G,icon:se,label:me,testid:Ae})=>u.jsx("button",{role:"tab","aria-selected":re===G,"aria-label":me,"data-testid":Ae,"data-tooltip":me,onClick:()=>ie(G),className:`w-8 h-7 flex items-center justify-center rounded-md transition-colors ${re===G?"bg-brand/20 text-brand":"text-ink-muted active:bg-ink/10"}`,children:u.jsx(se,{className:"w-4 h-4"})},G))}):void 0}),d&&u.jsx(GM,{message:d,onClose:()=>p(null)}),u.jsxs("div",{className:"flex-1 flex min-h-0 min-w-0",onTouchStart:We,onTouchEnd:Ue,children:[ke&&u.jsx(ey,{fullWidth:ne===3,view:w,onViewChange:N,courseTitle:(bt==null?void 0:bt.title)??null,courseId:f,courses:t,sections:Xs,tree:r,progressMap:s,selectedNodeId:L,dueCount:Fn,dueNodeIds:jn,overallMastery:(S==null?void 0:S.overallMastery)??0,streak:(o==null?void 0:o.currentStreak)??0,streaming:de.streaming,onJumpNode:G=>{if(de.streaming)return;const se=r.find(me=>me.id===G);se&&Be(se),ne===3&&ie("chat")},onOpenReview:()=>Ia(!0),onSelectCourse:G=>ut(()=>{m(G),rt()}),onDeleteCourse:G=>ut(()=>{fr(G)}),onCoursesChanged:()=>{rt()},availableLanguages:x,currentLocale:k,onLocaleChange:async G=>{f&&(await X.setCourseLanguage(f,G),T(G))}}),u.jsxs(u.Fragment,{children:[Te&&u.jsx("div",{className:"relative flex flex-col h-full bg-surface-1 shrink-0 min-w-0 motion-safe:transition-[width] motion-safe:duration-200",style:ne===3?{flex:1}:ze?{width:"clamp(480px, 36vw, 800px)"}:{flex:1},"data-testid":"chat-panel",children:f?(Pe==null?void 0:Pe.type)==="exam"?u.jsx(d5,{examNode:Pe,locale:Se,onSessionChange:Le,paused:U.open,onExamCompleted:()=>{X.getProgress(Pe.id).then(G=>{G&&a(se=>({...se,[Pe.id]:G}))})}}):u.jsxs(u.Fragment,{children:[u.jsx(R5,{threads:ge.threads,activeThread:ge.activeThread,focusNodeTitle:(Pe==null?void 0:Pe.title)??null,onPickThread:G=>{de.streaming||ge.setActiveId(G)},onCreate:()=>{de.streaming||(ge.create({title:null}),at.show(e("toast.threadCreated")))},onRename:(G,se)=>{ge.update(G,{title:se}),at.show(e("toast.threadRenamed"))},onArchive:G=>{ge.update(G,{status:"archived"}),at.show(e("toast.threadArchived"),{duration:5e3,action:{label:e("action.undo"),onClick:()=>ge.update(G,{status:"active"})}})},onDelete:G=>{const se=ge.removeWithUndo(G);se&&(at.show(`${e("toast.threadDeleted")}${se.title?`「${se.title}」`:""}`,{duration:5e3,action:{label:e("action.undo"),onClick:()=>{ge.restore(se),at.show(e("toast.restored"))}}}),setTimeout(()=>{X.threadDelete(se.id).catch(()=>{})},5500))}}),u.jsx(bN,{messages:de.messages,streaming:de.streaming,onApplyProposal:Ye,onRejectProposal:ot,summary:ct,onStartLearning:we!=null&&we.ready?Oe:void 0,agentReady:(we==null?void 0:we.ready)??!1,onGotoSettings:()=>P(!0),hasNode:!!Pe,selectedNodeId:L,threadId:ge.activeId,onPickQuizAction:G=>{Bn(G)},onQuizCompleted:Dt,cardMode:ne===3,chatNotes:At.items.filter(G=>G.artifactType==="user_note"&&G.sourceAnchor),onSaveChatNote:(G,se,me,Ae)=>{!Pe||!ge.activeId||(At.saveUserNote({nodeId:Pe.id,text:G,sourceType:"chat",sourceAnchor:{type:"chat",threadId:ge.activeId,msgId:se,startOffset:me,endOffset:Ae}}),at.show(e("toast.noteSaved"),{duration:2e3}))}}),u.jsx($N,{nodeId:L,agentReady:(we==null?void 0:we.ready)??!1,streaming:de.streaming,souls:Qs,activeSoul:C,starterPrompts:de.messages.length>0?On:[],onPickSoul:Ct,onSend:Bn,onStop:de.stop,onLogFriction:L?(G,se)=>{X.logFriction(L,G,se),at.show(e("chat.friction.saved"),{duration:2500})}:void 0,onGotoSettings:()=>P(!0),insertText:be,historyTokens:kx})]}):u.jsx("div",{className:"flex-1 flex items-center justify-center px-6","data-testid":"chat-no-course",children:u.jsxs("div",{className:"text-center max-w-sm",children:[u.jsx("div",{className:"text-5xl mb-4 opacity-30",children:"📚"}),u.jsx("div",{className:"text-title font-bold text-ink mb-2",children:e("course.empty.title")}),u.jsx("div",{className:"text-body text-ink-muted leading-relaxed",children:e("course.empty.desc")})]})})}),ze&&u.jsx("main",{className:ne===3?"flex-1 min-w-0 bg-surface-2":"flex-1 min-w-[440px] bg-surface-2","data-testid":ne===3?"notebook-pane-full":void 0,children:u.jsx(oN,{selectedNode:Pe,items:At.items,loading:At.loading,forceTab:D,canvasArtifact:Un,onUserTabChange:()=>q(null),onRemove:G=>{At.remove(G),at.show(e("toast.noteDeleted"))},onTogglePin:G=>{At.togglePin(G)},onRecordQuizResult:(G,se)=>{At.recordQuizResult(G,se)},onUpdateNoteComment:(G,se)=>{At.updateUserNoteComment(G,se)},onSaveContentNote:(G,se)=>{Pe&&(At.saveUserNote({nodeId:Pe.id,text:G,sourceType:"content",sourceAnchor:se}),at.show(e("toast.noteSaved"),{duration:2e3}))},onJumpToSource:Mt,onQuoteToChat:Ve,locale:k,isReviewing:Ma,onReviewDone:()=>Ra(!1)})})]})]}),Z&&u.jsx(WM,{onClose:()=>P(!1)}),wx&&u.jsx(YM,{onClose:()=>Ia(!1),tree:r,dashboard:S,progressMap:s,onPickNode:G=>{ut(()=>{I(G),q("content"),Ia(!1),Ra(!0)})}}),U.open&&u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50","data-testid":"exam-leave-modal",children:u.jsxs("div",{ref:W,className:"w-[min(400px,90vw)] rounded-2xl bg-surface-0 p-6 shadow-elevated border border-warning/40",role:"dialog","aria-modal":"true","aria-label":e("exam.leave.title"),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[u.jsx(En,{className:"w-5 h-5 text-warning shrink-0"}),u.jsx("span",{className:"text-title font-bold text-ink",children:e("exam.leave.title")})]}),u.jsx("div",{className:"text-body text-ink-muted mb-5 leading-relaxed",children:e("exam.leave.message")}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx("button",{className:"btn-3d-neutral px-4 py-1.5 text-body",onClick:()=>B({open:!1,pendingAction:null}),"data-testid":"exam-leave-cancel",children:e("exam.leave.cancel")}),u.jsx("button",{className:"btn-3d-brand px-4 py-1.5 text-body",style:{background:"var(--warning)",boxShadow:"0 3px 0 0 var(--warning-dark)"},onClick:()=>void je(),"data-testid":"exam-leave-confirm",children:e("exam.leave.confirm")})]})]})}),Xe&&u.jsx(m5,{onClose:()=>De(!1),onPick:G=>{De(!1),$M(G)},hasNode:!!L}),u.jsx(dy,{}),u.jsx(zM,{}),u.jsx(i5,{courseId:f})]})}function $M(e){window.dispatchEvent(new CustomEvent("lookatstudy-command",{detail:e}))}function qM({streak:e,xp:t,fontSize:n,onFontBump:r,onOpenSettings:i,leftVisible:s,rightVisible:a,onToggleLeft:o,onToggleRight:l,tier:c,bottomBar:h}){const f=_e();return h?u.jsx("header",{className:"app-header shrink-0",children:u.jsxs("div",{className:"flex items-center h-12 px-4",children:[u.jsx("div",{className:"flex-1 flex items-center min-w-0",children:t&&u.jsxs("div",{className:"flex items-center gap-1 shrink-0","data-testid":"xp-bar",title:f("header.energy"),children:[u.jsx(Xo,{className:`w-3.5 h-3.5 text-brand ${t.todayXp>=100?"energy-breathe":""}`,fill:t.todayXp>=100?"currentColor":"none","aria-hidden":"true"}),u.jsx("span",{className:"text-label font-bold tabular-nums text-brand",children:t.todayXp})]})}),h,u.jsx("div",{className:"flex-1 flex items-center justify-end",children:u.jsx("button",{onClick:i,"data-testid":"header-settings","aria-label":f("header.settings"),className:"text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 w-8 h-8 flex items-center justify-center rounded-lg hover:bg-neutral-200 dark:hover:bg-neutral-800/50 transition-colors",title:f("header.settings"),children:u.jsx(Bi,{className:"w-4 h-4"})})})]})}):u.jsx("header",{className:"app-header shrink-0 flex flex-col",children:u.jsxs("div",{className:"flex items-center pt-2.5 pb-3 px-6 justify-between",children:[u.jsx("div",{className:"flex items-center gap-2 min-w-0",children:u.jsxs("h1",{className:"text-body font-extrabold tracking-tight text-neutral-900 dark:text-neutral-100 select-none min-w-0 truncate",children:["Lookat",u.jsx("span",{className:"text-brand",children:"Study"})]})}),u.jsxs("div",{className:"flex items-center gap-3",children:[c!==3&&u.jsxs("div",{className:"flex items-center gap-0.5",children:[u.jsx("button",{onClick:o,"data-testid":"layout-toggle-left",className:`w-7 h-7 flex items-center justify-center rounded-md transition-colors ${s?"text-neutral-500 hover:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-800":"text-neutral-600 bg-neutral-200 dark:bg-neutral-800"}`,title:f("header.toggleLeft"),children:u.jsx(M1,{className:"w-4 h-4"})}),u.jsx("button",{onClick:l,"data-testid":"layout-toggle-right",className:`w-7 h-7 flex items-center justify-center rounded-md transition-colors ${a?"text-neutral-500 hover:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-800":"text-neutral-600 bg-neutral-200 dark:bg-neutral-800"}`,title:f("header.toggleRight"),children:u.jsx(R1,{className:"w-4 h-4"})})]}),c!==3&&u.jsxs("div",{className:"flex items-center gap-0.5","data-testid":"font-size-control",children:[u.jsx("button",{onClick:()=>r("down"),disabled:n==="small","data-testid":"font-smaller",className:"text-label w-7 h-7 flex items-center justify-center rounded-md text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 hover:bg-ink/5 disabled:opacity-20 disabled:cursor-not-allowed transition-colors",title:f("header.font.smaller"),children:"A-"}),u.jsx("button",{onClick:()=>r("up"),disabled:n==="large","data-testid":"font-larger",className:"text-body w-7 h-7 flex items-center justify-center rounded-md text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 hover:bg-ink/5 disabled:opacity-20 disabled:cursor-not-allowed transition-colors",title:f("header.font.larger"),children:"A+"})]}),t&&u.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"xp-bar",title:f("header.energy"),children:[u.jsx(Xo,{className:`w-3.5 h-3.5 text-brand ${t.todayXp>=100?"energy-breathe":""}`,fill:t.todayXp>=100?"currentColor":"none","aria-hidden":"true"}),u.jsx("div",{className:"w-16 h-2 bg-neutral-200 dark:bg-neutral-800 rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full bg-brand transition-all duration-500",style:{width:`${Math.min(100,Math.max(3,t.todayXp))}%`}})}),u.jsx("span",{className:"text-label font-bold tabular-nums text-brand",children:t.todayXp})]}),t&&u.jsx("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-brand/10","data-testid":"level-badge",title:f("header.level.title"),children:u.jsxs("span",{className:"text-label font-bold text-brand",children:["Lv.",t.level]})}),e&&u.jsx(KM,{streak:e}),u.jsx("button",{onClick:i,"data-testid":"header-settings",className:"text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 w-8 h-8 flex items-center justify-center rounded-lg hover:bg-neutral-200 dark:hover:bg-neutral-800/50 transition-colors",title:f("header.settings"),children:u.jsx(Bi,{className:"w-4 h-4"})})]})]})})}function WM({onClose:e}){const t=_e(),n=v.useRef(null);return jr(n,!0),u.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end","data-testid":"settings-drawer",children:[u.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:e}),u.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-label":t("settings.title"),className:"relative w-full max-w-lg h-full bg-surface-0 border-l border-[var(--border)] shadow-elevated flex flex-col",children:[u.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0",children:[u.jsx("h2",{className:"text-body font-bold",children:t("settings.title")}),u.jsx("button",{onClick:e,"data-testid":"settings-close","aria-label":t("action.close"),className:"text-ink-muted hover:text-ink-strong w-8 h-8 flex items-center justify-center rounded-lg hover:bg-surface-3",children:"✕"})]}),u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(x5,{})})]})]})}function YM({onClose:e,tree:t,onPickNode:n,dashboard:r,progressMap:i}){const s=_e(),a=v.useRef(null);jr(a,!0);const[o,l]=v.useState([]);v.useEffect(()=>{X.getAllSrsItems().then(T=>l(T)).catch(()=>l([]))},[]);const c=v.useMemo(()=>new Map(o.map(T=>[T.nodeId,T])),[o]),h=v.useMemo(()=>{const T=new Map(t.map(E=>[E.id,E])),A=o.filter(E=>T.has(E.nodeId));return{overdue:A.filter(E=>E.overdue),short:A.filter(E=>!E.overdue&&E.intervalDays>0&&E.intervalDays<=7),long:A.filter(E=>!E.overdue&&E.intervalDays>7),inactive:A.filter(E=>E.repetitions===0&&!E.overdue)}},[o,t]),f=v.useMemo(()=>t.filter(A=>A.type==="section"&&(A.world??"study")==="study").sort((A,E)=>A.orderIdx-E.orderIdx).map(A=>({section:A,lessons:t.filter(E=>E.parentId===A.id&&E.type==="lesson").sort((E,C)=>E.orderIdx-C.orderIdx)})),[t]),m=v.useMemo(()=>{const T=new Map;for(const A of(r==null?void 0:r.sections)??[])T.set(A.sectionId,A.avgMastery);return T},[r]),d=v.useMemo(()=>t.filter(T=>{var E;const A=(E=i[T.id])==null?void 0:E.status;return T.type==="lesson"&&(T.world??"study")==="study"&&(A==="in_progress"||A==="mastered")}),[t,i]),[p,g]=v.useState(new Set),x=T=>g(A=>{const E=new Set(A);return E.has(T)?E.delete(T):E.add(T),E}),b=T=>{const A=c.get(T);return A?A.overdue?{color:"bg-review",title:s("review.quadrant.overdue")}:A.intervalDays>0&&A.intervalDays<=7?{color:"bg-gold",title:s("review.quadrant.short")}:A.intervalDays>7?{color:"bg-brand",title:s("review.quadrant.long")}:null:null},k=h.overdue.length>0;return u.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end","data-testid":"review-drawer",children:[u.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:e}),u.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":s("review.title"),className:"relative w-full max-w-md h-full bg-surface-0 border-l border-[var(--border)] shadow-elevated flex flex-col",children:[u.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0",children:[u.jsxs("h2",{className:"text-body font-bold flex items-center gap-1.5",children:[u.jsx(fn,{className:"w-4 h-4","aria-hidden":"true"})," ",s("review.title")]}),u.jsx("button",{onClick:e,"data-testid":"review-close","aria-label":s("action.close"),className:"text-ink-muted hover:text-ink-strong w-8 h-8 flex items-center justify-center rounded-lg hover:bg-surface-3",children:"✕"})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-5","data-testid":"review-panel",children:[d.length>0&&u.jsxs("button",{onClick:()=>{const T=d[Math.floor(Math.random()*d.length)];T&&n(T.id)},"data-testid":"review-interleave",className:"btn-3d-neutral w-full py-2.5 text-body flex items-center justify-center gap-1.5",children:[u.jsx(z1,{className:"w-4 h-4"}),s("review.interleave")]}),o.length>0&&u.jsxs("div",{children:[u.jsx("div",{className:"text-caption font-bold text-ink-muted uppercase tracking-wider mb-2",children:s("review.srsHint")}),u.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:[{items:h.overdue,label:s("review.quadrant.overdue"),dot:"bg-review"},{items:h.short,label:s("review.quadrant.short"),dot:"bg-gold"},{items:h.long,label:s("review.quadrant.long"),dot:"bg-brand"},{items:h.inactive,label:s("review.quadrant.inactive"),dot:"bg-ink-faint"}].filter(T=>T.items.length>0).map(T=>u.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 rounded-full bg-surface-3",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${T.dot}`}),u.jsx("span",{className:"text-label text-ink-muted",children:T.label}),u.jsx("span",{className:"text-label font-extrabold text-ink-strong tabular-nums",children:T.items.length})]},T.label))}),k&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-label text-ink-faint mb-1.5",children:s("review.overdueQuickHint")}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.overdue.slice(0,8).map(T=>{const A=t.find(E=>E.id===T.nodeId);return A?u.jsx("button",{onClick:()=>n(T.nodeId),"data-testid":`review-overdue-${T.nodeId.slice(0,8)}`,className:"px-2 py-1 rounded-full bg-review/10 ring-1 ring-review/20 text-label text-review font-bold hover:bg-review/20 transition-colors truncate max-w-[140px]",children:A.title},T.nodeId):null})})]})]}),f.length>0&&u.jsxs("div",{children:[u.jsx("div",{className:"text-caption font-bold text-ink-muted uppercase tracking-wider mb-2",children:s("review.myProgress")}),u.jsx("div",{className:"space-y-1",children:f.map(({section:T,lessons:A})=>{const E=Math.round((m.get(T.id)??0)*100),C=p.has(T.id),_=A.filter(w=>{var S;const N=(S=i[w.id])==null?void 0:S.status;return N==="in_progress"||N==="mastered"});return u.jsxs("div",{children:[u.jsxs("button",{onClick:()=>x(T.id),className:"w-full flex items-center gap-2 p-2 rounded-lg hover:bg-surface-3 transition-colors",children:[C?u.jsx(Zl,{className:"w-3.5 h-3.5 text-ink-muted shrink-0"}):u.jsx(h1,{className:"w-3.5 h-3.5 text-ink-muted shrink-0"}),u.jsx("span",{className:"text-body text-ink-strong font-bold truncate flex-1 text-left",children:T.title}),_.length>0&&u.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u.jsx("div",{className:"w-16 h-1.5 bg-surface-3 rounded-full overflow-hidden",children:u.jsx("div",{className:`h-full rounded-full ${E>=100?"bg-gold":"bg-brand"}`,style:{width:`${Math.max(3,E)}%`}})}),u.jsxs("span",{className:"text-label tabular-nums text-ink-muted w-8 text-right",children:[E,"%"]})]})]}),C&&u.jsx("div",{className:"ml-5 mt-0.5 mb-1 space-y-0.5","data-testid":"review-lesson-list",children:A.length===0?u.jsx("div",{className:"text-label text-ink-faint py-1.5 pl-1",children:"—"}):A.map(w=>{const N=i[w.id],S=N?Math.round((N.mastery??0)*100):null,R=b(w.id),M=(N==null?void 0:N.status)==="in_progress"||(N==null?void 0:N.status)==="mastered";return u.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors ${(R==null?void 0:R.color)==="bg-review"?"bg-review/8":"hover:bg-surface-3"}`,children:[R?u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${R.color} shrink-0`,title:R.title}):u.jsx("span",{className:"w-1.5 h-1.5 shrink-0"}),u.jsx("span",{className:`text-label truncate flex-1 ${M?"text-ink-strong":"text-ink-faint"}`,children:w.title}),S!==null&&u.jsxs("span",{className:"text-label tabular-nums text-ink-muted shrink-0 w-8 text-right",children:[S,"%"]}),M&&u.jsx("button",{onClick:()=>n(w.id),"data-testid":`review-lesson-${w.id.slice(0,8)}`,className:"shrink-0 px-2 py-0.5 rounded-md bg-brand/15 text-brand text-caption font-bold hover:bg-brand/25 transition-colors",children:s("review.reviewLesson")})]},w.id)})})]},T.id)})})]}),r&&r.frictionByNode.length>0&&u.jsxs("div",{children:[u.jsx("div",{className:"text-caption font-bold text-review uppercase tracking-wider mb-1.5",children:s("dashboard.mini.struggle")}),r.frictionByNode.map(T=>u.jsxs("button",{onClick:()=>n(T.nodeId),className:"flex items-center gap-2 py-0.5 w-full text-left hover:bg-surface-3 rounded px-1",children:[u.jsxs("span",{className:"text-label text-review font-bold tabular-nums",children:[T.count,"×"]}),u.jsx("span",{className:"text-label text-ink-strong truncate flex-1",children:T.title})]},T.nodeId))]}),d.length===0&&o.length===0&&f.length===0&&u.jsxs("div",{className:"text-center py-16","data-testid":"review-empty",children:[u.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"📖"}),u.jsx("div",{className:"text-body text-ink-muted",children:s("review.empty.title")}),u.jsx("div",{className:"text-label text-ink-faint mt-1",children:s("review.empty.desc")})]})]})]})]})}function GM({message:e,onClose:t}){const n=_e();return u.jsxs("div",{role:"alert","data-testid":"error-banner",className:"px-4 py-2 border-b border-warning-tint-border text-warning text-body flex items-center justify-between",style:{backgroundColor:"var(--warning-tint)"},children:[u.jsxs("span",{children:["⚠️ ",e]}),u.jsx("button",{className:"ml-3 underline text-warning-light",onClick:t,children:n("action.close")})]})}function KM({streak:e}){const t=_e();return u.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full border border-review/20",style:{backgroundColor:"var(--review-tint)"},"data-testid":"streak-badge",title:t("streak.title",{n:e.currentStreak,m:e.longestStreak}),children:[u.jsx(Gf,{className:"w-4 h-4 text-review flame-flicker"}),u.jsx("span",{className:"text-body font-extrabold text-review",children:e.currentStreak}),e.freezeCount>0&&u.jsxs("span",{className:"flex items-center gap-0.5 ml-0.5","data-testid":"freeze-badge",title:t("streak.freeze.title",{n:e.freezeCount}),children:[u.jsx(U1,{className:"w-3 h-3 text-review/80","aria-hidden":"true"}),u.jsx("span",{className:"text-label font-bold text-review/80",children:e.freezeCount})]})]})}window.addEventListener("error",e=>{var t;console.error("[FATAL renderer error]",((t=e.error)==null?void 0:t.stack)||e.message)});window.addEventListener("unhandledrejection",e=>{var t;console.error("[FATAL unhandled rejection]",((t=e.reason)==null?void 0:t.stack)||e.reason)});function XM({rejected:e}){const t=navigator.language.startsWith("zh"),[n,r]=Ql.useState(""),i=s=>{s.preventDefault();const a=n.trim();if(!a)return;const o=a.includes("token=")?new URL(a).searchParams.get("token")??"":a;o&&ji(async()=>{const{setWebToken:l}=await import("./api-web-DI50TDfG.js");return{setWebToken:l}},[],import.meta.url).then(({setWebToken:l})=>l(o))};return u.jsx("div",{className:"min-h-[var(--app-height,100vh)] bg-[#0e2a12] flex items-center justify-center p-6",children:u.jsxs("form",{onSubmit:i,className:"w-full max-w-sm text-center",children:[u.jsx("div",{className:"text-4xl mb-3",children:"🎈"}),u.jsx("h1",{className:"text-title font-bold text-white mb-1",children:"LookatStudy"}),u.jsx("p",{className:"text-label text-white/55 leading-relaxed mb-5",children:t?"连接本机学习服务:粘贴启动时打印的令牌或整条链接":"Connect to your study server — paste the token or the full link printed at startup"}),e&&u.jsx("p",{className:"text-label text-warning-light mb-3",children:t?"上次的令牌被拒绝了,请重新输入":"Previous token was rejected, please re-enter"}),u.jsx("input",{type:"text",value:n,onChange:s=>r(s.target.value),placeholder:t?"访问令牌":"access token",autoFocus:!0,className:"w-full bg-black/30 text-white placeholder:text-white/30 text-body font-mono rounded-lg px-3 py-2.5 border border-white/20 focus:border-brand focus:outline-none transition-colors mb-3"}),u.jsx("button",{type:"submit",disabled:!n.trim(),className:"btn-3d-brand w-full px-3 py-2.5 text-body disabled:opacity-40",children:t?"连接":"Connect"}),u.jsx("p",{className:"text-caption text-white/40 leading-relaxed mt-5",children:t?"令牌在服务启动日志里,形如 http://127.0.0.1:17890/?token=…,也可以直接打开那个链接。":"The token is in the server startup log, like http://127.0.0.1:17890/?token=… — opening that link directly works too."})]})})}const Ex=e1.createRoot(document.getElementById("root"));function QM(){Ex.render(u.jsx(Ql.StrictMode,{children:u.jsx(nN,{children:u.jsx(VM,{})})}))}function Ff(e){Ex.render(u.jsx(Ql.StrictMode,{children:u.jsx(XM,{rejected:e})}))}async function ZM(){const{installAppHeight:e}=await ji(async()=>{const{installAppHeight:t}=await import("./app-height-D5bf5z0g.js");return{installAppHeight:t}},[],import.meta.url);if(e(),!window.api){const t=await ji(()=>import("./api-web-DI50TDfG.js"),[],import.meta.url);if(window.addEventListener(t.TOKEN_REJECTED_EVENT,()=>Ff(!0)),!t.hasWebToken()){Ff(!1);return}try{await t.installWebApi()}catch(n){console.error("[boot] web api 安装失败:",n)}}QM()}ZM();export{ji as _};
|