lookatstudy-mobile 0.17.0 → 0.19.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 +165 -2
- package/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/web/assets/{abnfDiagram-N423BO3Z-DEPbDjND.js → abnfDiagram-N423BO3Z-DRLqlsQe.js} +1 -1
- package/web/assets/{arc-BdnEbtZD.js → arc-DX37qc14.js} +1 -1
- package/web/assets/{architectureDiagram-T3A2C74G-2LUkfdBV.js → architectureDiagram-T3A2C74G-4mH-M23W.js} +1 -1
- package/web/assets/{blockDiagram-VBNYF7ZC-CCe1iJWW.js → blockDiagram-VBNYF7ZC-CfFl91r9.js} +1 -1
- package/web/assets/{c4Diagram-5PPSVZJV-BRjp2_ep.js → c4Diagram-5PPSVZJV-CoYqbpkG.js} +1 -1
- package/web/assets/channel-DwTlw7UU.js +1 -0
- package/web/assets/{chunk-2GRJ4B5K-D3jR_gkO.js → chunk-2GRJ4B5K-DdZFJzXx.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-BYL8Mj1H.js → chunk-2Q5K7J3B-CjvT22rq.js} +1 -1
- package/web/assets/{chunk-5RXB4S5H-BmdtCOUM.js → chunk-5RXB4S5H-BO3dLHxP.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-BElAuyeD.js → chunk-5VM5RSS4-BRWuBMF-.js} +1 -1
- package/web/assets/{chunk-6Q2QTUOP-DD5GiOn2.js → chunk-6Q2QTUOP-BBL9yZr5.js} +1 -1
- package/web/assets/{chunk-GF5L2VYU-DEXR2XHl.js → chunk-GF5L2VYU-BzgRNoMK.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-BnQRJatb.js → chunk-JWPE2WC7-Rx7velok.js} +1 -1
- package/web/assets/{chunk-KBJHAD2P-DWr3zlUn.js → chunk-KBJHAD2P-BUmqDQFS.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-DEwEVB-X.js → chunk-RYQCIY6F-DiWSKlNj.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-fSX2AkEZ.js → chunk-XXDRQBXY-BaIS0itG.js} +1 -1
- package/web/assets/classDiagram-JCYQIIEL-CoMu7USw.js +1 -0
- package/web/assets/classDiagram-v2-OCEON4UE-CoMu7USw.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-CzFzhaR6.js → cose-bilkent-JH36ORCC-BbQclxlG.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-DkGVzNSQ.js → cynefin-VYW2F7L2-BoAEtYBt.js} +1 -1
- package/web/assets/{cynefinDiagram-MW4NZA55-DsCoCXNB.js → cynefinDiagram-MW4NZA55-1NTeoXpW.js} +1 -1
- package/web/assets/{dagre-VZM6K2ZE-5iQ0Vlad.js → dagre-VZM6K2ZE-D1IJUP3L.js} +1 -1
- package/web/assets/{diagram-7IWD3JNH-BNse2wL1.js → diagram-7IWD3JNH-Bq4zahZs.js} +1 -1
- package/web/assets/{diagram-B4RE2ZJO-otdSZlNZ.js → diagram-B4RE2ZJO-DwR-n08L.js} +1 -1
- package/web/assets/{diagram-LBJQPF4R-Cu9AIxYr.js → diagram-LBJQPF4R-x8ddz6fv.js} +1 -1
- package/web/assets/{diagram-Q27KOJAE-BDy_SsNa.js → diagram-Q27KOJAE-BQvPuANj.js} +1 -1
- package/web/assets/{diagram-UB23O5K3-Dj9VK1f8.js → diagram-UB23O5K3-2HRRnPaM.js} +1 -1
- package/web/assets/{ebnfDiagram-BXEA7PRR-B86BfBHU.js → ebnfDiagram-BXEA7PRR-C6w-Hol8.js} +1 -1
- package/web/assets/{erDiagram-JOGREHBK-BYPttEDR.js → erDiagram-JOGREHBK-D0B9HX21.js} +1 -1
- package/web/assets/{flowDiagram-UKHOOZJN-BiQj7CX4.js → flowDiagram-UKHOOZJN-BAFPos1j.js} +1 -1
- package/web/assets/{ganttDiagram-PKOTCBZU-BHHFGprI.js → ganttDiagram-PKOTCBZU-cEfBlMbu.js} +1 -1
- package/web/assets/{gitGraphDiagram-DS77QQ5N-CMV6VrQV.js → gitGraphDiagram-DS77QQ5N-kEgMAveq.js} +1 -1
- package/web/assets/index-D8iAKGNi.css +1 -0
- package/web/assets/index-DFfbtrtQ.js +53 -0
- package/web/assets/{infoDiagram-6WML65LV-a_LG2_IJ.js → infoDiagram-6WML65LV-B3O-sBT9.js} +1 -1
- package/web/assets/{ishikawaDiagram-WSZJBQD7-DNaQdaG3.js → ishikawaDiagram-WSZJBQD7-Lltvy9NV.js} +1 -1
- package/web/assets/{journeyDiagram-NVQOT4AX-DnlltTZa.js → journeyDiagram-NVQOT4AX-CoTpdbQG.js} +1 -1
- package/web/assets/{kanban-definition-27J2QSJJ-fRW60JCZ.js → kanban-definition-27J2QSJJ-C6MlEhKf.js} +1 -1
- package/web/assets/{linear-DivBiqV_.js → linear-BOCC78Hx.js} +1 -1
- package/web/assets/main-BXa7WYYr.css +1 -0
- package/web/assets/main-_hK--hbF.js +792 -0
- package/web/assets/{mermaid.core-BhIcHd-X.js → mermaid.core-BnzH2M4g.js} +4 -4
- package/web/assets/{mindmap-definition-FAOFIHXS-wFGzI1GW.js → mindmap-definition-FAOFIHXS-2aXmimCX.js} +1 -1
- package/web/assets/{pegDiagram-VL7TDLO6-g8lPC9jo.js → pegDiagram-VL7TDLO6-BUgOGs18.js} +1 -1
- package/web/assets/{pet-auCGJOK0.js → pet-a4xGZJ4o.js} +1 -1
- package/web/assets/{pieDiagram-7S7Q4E2Y-C5VJiY2V.js → pieDiagram-7S7Q4E2Y-QH3MSwJC.js} +1 -1
- package/web/assets/{quadrantDiagram-CIZ2JOQS-BUCplORK.js → quadrantDiagram-CIZ2JOQS-BHgzjRDJ.js} +1 -1
- package/web/assets/{railroadDiagram-AXF67PYL-CXOqC1jS.js → railroadDiagram-AXF67PYL-eT-6KI97.js} +1 -1
- package/web/assets/{requirementDiagram-LRYGKXZP-D77Fdqkd.js → requirementDiagram-LRYGKXZP-SCqCciaJ.js} +1 -1
- package/web/assets/{sankeyDiagram-W5VNT64P-DCRQPRof.js → sankeyDiagram-W5VNT64P-X7ftmy-X.js} +1 -1
- package/web/assets/{sequenceDiagram-SI44F4Z6-CKFv7rwK.js → sequenceDiagram-SI44F4Z6-CJiMe-ST.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-DkXWYyxk.js → sizeCapture-X5ZJPWSS-D0BOwnXt.js} +1 -1
- package/web/assets/{stateDiagram-OKZ733FA-BT3rvlSZ.js → stateDiagram-OKZ733FA-BiPOcNEG.js} +1 -1
- package/web/assets/stateDiagram-v2-UEYNNEHI-URZ9UNRl.js +1 -0
- package/web/assets/swimlanes-SLNWSIFB-CtLG2CHX.js +2 -0
- package/web/assets/swimlanesDiagram-ULZ7WXOC-CdA8x7iG.js +8 -0
- package/web/assets/{timeline-definition-Z64GVDOM-Byr_G_qH.js → timeline-definition-Z64GVDOM-NOUkxoIk.js} +1 -1
- package/web/assets/{vennDiagram-T6HMQDX7-cJwjkqtI.js → vennDiagram-T6HMQDX7-jIX0UihP.js} +1 -1
- package/web/assets/{wardleyDiagram-T6FBY63Y-2mUDEXFT.js → wardleyDiagram-T6FBY63Y-BWfUG4_t.js} +1 -1
- package/web/assets/{xychartDiagram-ELKLHX3M-CweyVwyd.js → xychartDiagram-ELKLHX3M-CVZ-lb3j.js} +1 -1
- package/web/index.html +4 -3
- package/web/pet.html +3 -3
- package/web/assets/channel-DXyVa_LM.js +0 -1
- package/web/assets/classDiagram-JCYQIIEL-D93mjgH9.js +0 -1
- package/web/assets/classDiagram-v2-OCEON4UE-D93mjgH9.js +0 -1
- package/web/assets/index-BKXGqAJP.js +0 -53
- package/web/assets/index-C0z4TGfi.css +0 -1
- package/web/assets/main-XmO4BzRy.js +0 -518
- package/web/assets/stateDiagram-v2-UEYNNEHI-BgeHQ9bA.js +0 -1
- package/web/assets/swimlanes-SLNWSIFB-CzxJLsll.js +0 -2
- package/web/assets/swimlanesDiagram-ULZ7WXOC-BQOu93XJ.js +0 -8
|
@@ -1,518 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-BhIcHd-X.js","./index-BKXGqAJP.js","./index-C0z4TGfi.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var gx=Object.defineProperty;var xx=(e,t,n)=>t in e?gx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ba=(e,t,n)=>xx(e,typeof t!="symbol"?t+"":t,n);import{r as v,d as bx,j as u,e as Kc,b as Il,u as Ml,h as Xc,k as jn,l as yx,m as vx,n as At,o as Ex,V as kx,v as Tx,F as Qc,p as Jc,q as wx,s as kf,t as Sx,w as Zc,x as eu,y as Cx,z as Ax,A as Nx,B as Tf,C as _o,D as _x,M as wf,E as Ix,G as tu,H as Mx,I as Rx,J as nu,g as Zt,K as Qn,R as Lx,L as Px,N as ru,O as ya,P as Dx,Q as Ds,S as Ox,T as Os,U as su,W as jx,X as Fx,Y as iu,Z as Bx,_ as Hx,$ as Ux,a0 as zx,a1 as Rl}from"./index-BKXGqAJP.js";const Vx="modulepreload",$x=function(e,t){return new URL(e,t).href},au={},yi=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=$x(h,r),h in au)return;au[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":Vx,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 qx=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Sf=(...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 Wx={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 Yx=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,...Wx,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Sf("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(Yx,{ref:s,iconNode:t,className:Sf(`lucide-${qx(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 Gx=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 Io=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 Kx=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 Xx=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 Kt=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 Qx=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"}]]);/**
|
|
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 Jx=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"}]]);/**
|
|
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 wt=pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 Ll=pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 Zx=pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 Cf=pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 Mo=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"}]]);/**
|
|
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 Ft=pe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 e1=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"}]]);/**
|
|
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 t1=pe("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/**
|
|
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 qn=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"}]]);/**
|
|
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 Af=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"}]]);/**
|
|
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 Nf=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"}]]);/**
|
|
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 n1=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"}]]);/**
|
|
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 _f=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"}]]);/**
|
|
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 r1=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"}]]);/**
|
|
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 s1=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"}]]);/**
|
|
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 ys=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"}]]);/**
|
|
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 If=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"}]]);/**
|
|
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 i1=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"}]]);/**
|
|
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 a1=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"}]]);/**
|
|
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 o1=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"}]]);/**
|
|
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 Mf=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"}]]);/**
|
|
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 l1=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"}]]);/**
|
|
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 c1=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"}]]);/**
|
|
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 u1=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"}]]);/**
|
|
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 d1=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"}]]);/**
|
|
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 vi=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"}]]);/**
|
|
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 h1=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"}]]);/**
|
|
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 Pl=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"}]]);/**
|
|
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 f1=pe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 m1=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"}]]);/**
|
|
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 Dl=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"}]]);/**
|
|
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 vs=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"}]]);/**
|
|
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 Rf=pe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
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 p1=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"}]]);/**
|
|
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 Wr=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"}]]);/**
|
|
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 g1=pe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
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 x1=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"}]]);/**
|
|
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 ou=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"}]]);/**
|
|
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 b1=pe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
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 y1=pe("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
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 v1=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"}]]);/**
|
|
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 E1=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"}]]);/**
|
|
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 ls=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"}]]);/**
|
|
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 lu=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"}]]);/**
|
|
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 zi=pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 va=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"}]]);/**
|
|
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 Lf=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"}]]);/**
|
|
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 k1=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"}]]);/**
|
|
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 T1=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"}]]);/**
|
|
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 Yr=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"}]]);/**
|
|
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 w1=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"}]]);/**
|
|
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 S1=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"}]]);/**
|
|
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 Ol=pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 C1=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"}]]);/**
|
|
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 A1=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"}]]);/**
|
|
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 Ei=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"}]]);/**
|
|
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 jl=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"}]]);/**
|
|
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 N1=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"}]]);/**
|
|
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 _1=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"}]]);/**
|
|
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 Ro=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"}]]);/**
|
|
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 I1=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"}]]);/**
|
|
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 Fl=pe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 M1=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"}]]);/**
|
|
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 Pf=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"}]]);/**
|
|
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 dr=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"}]]);/**
|
|
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 R1=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"}]]);/**
|
|
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 Df=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"}]]);/**
|
|
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 Lo=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"}]]);/**
|
|
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 an=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"}]]);/**
|
|
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 L1=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"}]]);/**
|
|
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 Of=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"}]]);/**
|
|
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 P1=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"}]]);/**
|
|
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 Es=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"}]]);/**
|
|
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 Pt=pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
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 Po=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"}]]),K=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}}),en=typeof navigator<"u"&&navigator.userAgent.includes("Electron"),D1=/[\u2E80-\u9FFF\uF900-\uFAFF\u3000-\u303F\uFF00-\uFFEF]/g;function jf(e){if(!e)return 0;const t=(e.match(D1)??[]).length,n=e.length-t;return Math.ceil(t*11/10+n/4)}function O1(e,t){return!t||t<=0?null:e<=0?0:Math.min(100,Math.round(e/t*100))}function j1(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 Jn(e){return e<1e3?String(Math.round(e)):e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.round(e/1e3)}k`}const Ff=.5,F1=.9,B1=.85;var Bl=bx();const Bf="lookatstudy-lang";let ki=typeof localStorage>"u"?"zh-CN":localStorage.getItem(Bf)||"zh-CN";const Do=new Set;function Hf(e){return Do.add(e),()=>{Do.delete(e)}}const cu={"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}」。但我现在没什么劲——别直接讲概念,也别出计分题考我。请这样开场:
|
|
433
|
-
1. 先用一两句散文抛个钩子(反直觉的、或跟我日常有关的,让我产生好奇);
|
|
434
|
-
2. 然后调用 pose_guess 工具,给我一个二选一的小猜测(就是玩,不是考试);
|
|
435
|
-
3. 我会点选项猜,你【下一回合】再揭晓,顺带把这课最核心的一点讲清楚。
|
|
436
|
-
铁律:起手不要讲座、不要用 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":`
|
|
437
|
-
|
|
438
|
-
网络受限或私有仓库请改用「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.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}}。下面是逐题情况:
|
|
439
|
-
请根据我的表现决定下一步:答错的题讲清为什么错和正确思路;全对的话判断我是否可以进入下一部分。不要重新出同一组题,也不要只说一句做得好。`,"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:
|
|
440
|
-
1. First hook me with a sentence or two of prose (counter-intuitive, or tied to daily life — make me curious);
|
|
441
|
-
2. Then call the pose_guess tool with a small two-option guess (just for fun, not a test);
|
|
442
|
-
3. I'll pick an option and guess; in your NEXT turn, reveal the answer and teach the one core idea of this lesson.
|
|
443
|
-
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":`
|
|
444
|
-
|
|
445
|
-
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.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:
|
|
446
|
-
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 ki}function H1(e){e!==ki&&(ki=e,typeof localStorage<"u"&&localStorage.setItem(Bf,e),Do.forEach(t=>t()))}function Hl(e,t=ki,n){var i,s;let r=((i=cu[t])==null?void 0:i[e])??((s=cu["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 Ne(){const e=v.useSyncExternalStore(Hf,mr,mr);return v.useCallback((t,n)=>Hl(t,e,n),[e])}function Uf(){return v.useSyncExternalStore(Hf,mr,mr)}const U1=["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 uu(e){return Array.from(e.querySelectorAll(U1)).filter(t=>t.offsetParent!==null||t===document.activeElement)}function vr(e,t){v.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement,s=uu(n)[0]??n,a=window.setTimeout(()=>s.focus(),0),o=l=>{if(l.key!=="Tab")return;const c=uu(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 Vi({anchorRect:e,message:t,onConfirm:n,onCancel:r,confirmLabel:i,cancelLabel:s,danger:a=!1,testid:o="confirm-card"}){const l=Ne(),c=v.useRef(null);vr(c,!0);const h=i??l("action.confirm"),f=s??l("action.cancel");v.useEffect(()=>{const b=w=>{c.current&&!c.current.contains(w.target)&&r()},T=w=>{w.key==="Escape"&&r(),w.key==="Enter"&&(w.preventDefault(),n())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",T)}},[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 Bl.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 z1(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)>=Ff});return{section:r,lessons:i,chapterLessonsMastered:a}})}function Oo(e,t,n){var r;return e.type==="exam"?!n:(((r=t[e.id])==null?void 0:r.status)??"locked")==="locked"}function V1(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 $1(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 q1(e){const t=Ne(),[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(()=>z1(e.sections,e.tree,e.progressMap),[e.sections,e.tree,e.progressMap]),l=v.useMemo(()=>V1(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(()=>{K.searchContent(g).then(b=>{s(b.filter(T=>c.has(T.nodeId)&&!h.has(T.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=>!Oo(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(Ol,{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(Pt,{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(Pt,{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(W1,{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=Oo(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(Kt,{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 W1({row:e,sectionIndex:t,query:n,progressMap:r,selectedNodeId:i,onPick:s}){const a=Ne(),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=Oo(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(m1,{className:"w-3.5 h-3.5 text-white/50 shrink-0"}):f?u.jsx(dr,{className:"w-3.5 h-3.5 text-accent shrink-0"}):h==="mastered"?u.jsx(_f,{className:"w-3.5 h-3.5 text-gold shrink-0"}):u.jsx(Kt,{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=$1(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 Y1=268,Ul=28,G1=20,zf=Ul*2+G1,K1=zf+8,X1=104,Q1=18,Ea=Ul+6,J1=26,Z1=22;function Fo(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 eb(e,t=Y1,n=""){const r=[],i=t/2,s=t/2-Q1-Ul;for(let l=0;l<e;l++){const c=Ea+l*X1,f=Fo(`${n}:${l}`)/4294967295*2-1,m=i+f*s,p=Fo(`${n}:${l}:y`)/4294967295*2-1,g=c+p*J1;r.push({x:m,y:g,index:l})}if(r.length>0){r[0].y<Ea&&(r[0].y=Ea);for(let l=1;l<r.length;l++){const c=r[l-1].y+K1;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+zf/2+10;return{nodes:r,segments:a,height:o}}function tb(e){const{from:t,to:n}=e,r=(t.y+n.y)/2+Z1;return`M ${t.x} ${t.y} C ${t.x} ${r}, ${n.x} ${r}, ${n.x} ${n.y}`}var ii={exports:{}};/*!
|
|
447
|
-
* matter-js 0.19.0 by @liabru
|
|
448
|
-
* http://brm.io/matter-js/
|
|
449
|
-
* License MIT
|
|
450
|
-
*
|
|
451
|
-
* The MIT License (MIT)
|
|
452
|
-
*
|
|
453
|
-
* Copyright (c) Liam Brummitt and contributors.
|
|
454
|
-
*
|
|
455
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
456
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
457
|
-
* in the Software without restriction, including without limitation the rights
|
|
458
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
459
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
460
|
-
* furnished to do so, subject to the following conditions:
|
|
461
|
-
*
|
|
462
|
-
* The above copyright notice and this permission notice shall be included in
|
|
463
|
-
* all copies or substantial portions of the Software.
|
|
464
|
-
*
|
|
465
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
466
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
467
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
468
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
469
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
470
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
471
|
-
* THE SOFTWARE.
|
|
472
|
-
*/var nb=ii.exports,du;function rb(){return du||(du=1,(function(e,t){(function(r,i){e.exports=i()})(nb,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 Kc<"u"&&(a=Kc.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,T,w;for(w=0;w<g;w++)x=l[w],b=x.x-d,T=x.y-p,x.x=d+(b*f-T*m),x.y=p+(b*m+T*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],T=c[p<c.length?p:c.length-1];if(T===0){d.push(x);continue}var w=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(T,2)),S=a.mult(o.clone(w),T),_=a.normalise(a.mult(a.add(w,A),.5)),k=a.sub(x,a.mult(_,E)),N=h;h===-1&&(N=Math.pow(T,.32)*1.75),N=o.clamp(N,f,m),N%2===1&&(N+=1);for(var C=Math.acos(a.dot(w,A)),R=C/N,M=0;M<N;M++)d.push(a.add(a.rotate(S,R*M),k))}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 T=[];for(x=0;x<p.length;x++)T=T.concat(p[x].vertices);a.clockwiseSort(T);var w=a.hull(T),A=a.centre(w);s.setVertices(d,w),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 T=d.parts[b];T.position.x+=x.x,T.position.y+=x.y,a.translate(T.vertices,x),h.update(T.bounds,T.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 T=d.parts[b];T.angle+=x,a.rotate(T.vertices,x,d.position),f.rotate(T.axes,x),h.update(T.bounds,T.vertices,d.velocity),b>0&&o.rotateAbout(T.position,x,d.position,T.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),T=Math.sin(p),w=d.position.x-g.x,A=d.position.y-g.y;s.setPosition(d,{x:g.x+(w*b-A*T),y:g.y+(w*T+A*b)},x),s.setAngle(d,d.angle+p,x)}},s.scale=function(d,p,g,x){var b=0,T=0;x=x||d.position;for(var w=0;w<d.parts.length;w++){var A=d.parts[w];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}),w>0&&(b+=A.area,T+=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,T))),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),T=(d.position.x-d.positionPrev.x)*x,w=(d.position.y-d.positionPrev.y)*x;d.velocity.x=T*b+d.force.x/d.mass*g,d.velocity.y=w*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 T=x[b],w=T.position.x-m.x,A=T.position.y-m.y;c.setPosition(T,{x:m.x+(w*p-A*g),y:m.y+(w*g+A*p)}),c.rotate(T,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],T=b.position.x-d.x,w=b.position.y-d.y;c.setPosition(b,{x:d.x+T*f,y:d.y+w*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 T=Math.min(p.motion,b),w=Math.max(p.motion,b);p.motion=s._minBias*T+(1-s._minBias)*w,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,T=g.supports,w=x.axis,A=w.x,E=w.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 S=s._findSupports(f,m,b,1),_=0;if(a.contains(f.vertices,S[0])&&(T[_++]=S[0]),a.contains(f.vertices,S[1])&&(T[_++]=S[1]),_<2){var k=s._findSupports(m,f,b,-1);a.contains(m.vertices,k[0])&&(T[_++]=k[0]),_<2&&a.contains(m.vertices,k[1])&&(T[_++]=k[1])}return _===0&&(T[_++]=S[0]),T.length=_,g},s._overlapAxes=function(f,m,d,p){var g=m.length,x=d.length,b=m[0].x,T=m[0].y,w=d[0].x,A=d[0].y,E=p.length,S=Number.MAX_VALUE,_=0,k,N,C,R,M,O;for(M=0;M<E;M++){var L=p[M],I=L.x,j=L.y,F=b*I+T*j,U=w*I+A*j,W=F,D=U;for(O=1;O<g;O+=1)R=m[O].x*I+m[O].y*j,R>W?W=R:R<F&&(F=R);for(O=1;O<x;O+=1)R=d[O].x*I+d[O].y*j,R>D?D=R:R<U&&(U=R);if(N=W-U,C=D-F,k=N<C?N:C,k<S&&(S=k,_=M,k<=0))break}f.axis=p[_],f.overlap=S},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,T=f.position.y,w=d.x*p,A=d.y*p,E=Number.MAX_VALUE,S,_,k,N,C;for(C=0;C<x;C+=1)_=g[C],N=w*(b-_.x)+A*(T-_.y),N<E&&(E=N,S=_);return k=g[(x+S.index-1)%x],E=w*(b-k.x)+A*(T-k.y),_=g[(S.index+1)%x],w*(b-_.x)+A*(T-_.y)<E?(l[0]=S,l[1]=_,l):(l[0]=S,l[1]=k,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],T=b.body===d?b.index:g+b.index,w=h[T];w?m.push(w):m.push(h[T]=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,T=!x.bodyB||x.bodyB&&x.bodyB.isStatic;(b||T)&&s.solve(m[g],p)}for(g=0;g<m.length;g+=1)x=m[g],b=!x.bodyA||x.bodyA&&x.bodyA.isStatic,T=!x.bodyB||x.bodyB&&x.bodyB.isStatic,!b&&!T&&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 T=x,w=b;if(p&&(T=o.add(p.position,x)),g&&(w=o.add(g.position,b)),!(!T||!w)){var A=o.sub(T,w),E=o.magnitude(A);E<s._minLength&&(E=s._minLength);var S=(E-m.length)/E,_=m.stiffness>=1||m.length===0,k=_?m.stiffness*d:m.stiffness*d*d,N=m.damping*d,C=o.mult(A,S*k),R=(p?p.inverseMass:0)+(g?g.inverseMass:0),M=(p?p.inverseInertia:0)+(g?g.inverseInertia:0),O=R+M,L,I,j,F,U;if(N>0){var W=o.create();j=o.div(A,E),U=o.sub(g&&o.sub(g.position,g.positionPrev)||W,p&&o.sub(p.position,p.positionPrev)||W),F=o.dot(j,U)}p&&!p.isStatic&&(I=p.inverseMass/R,p.constraintImpulse.x-=C.x*I,p.constraintImpulse.y-=C.y*I,p.position.x-=C.x*I,p.position.y-=C.y*I,N>0&&(p.positionPrev.x-=N*j.x*F*I,p.positionPrev.y-=N*j.y*F*I),L=o.cross(x,C)/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+=C.x*I,g.constraintImpulse.y+=C.y*I,g.position.x+=C.x*I,g.position.y+=C.y*I,N>0&&(g.positionPrev.x+=N*j.x*F*I,g.positionPrev.y+=N*j.y*F*I),L=o.cross(b,C)/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,T=d*g,w=T+b,A=w+T,E;g<.5?E="L 0 0 L "+T+" "+-p+" L "+w+" "+-p+" L "+A+" 0":E="L 0 0 L "+w+" "+-p+" L "+A+" 0";var S={label:"Trapezoid Body",position:{x:f,y:m},vertices:a.fromPath(E)};if(x.chamfer){var _=x.chamfer;S.vertices=a.chamfer(S.vertices,_.radius,_.quality,_.qualityMin,_.qualityMax),delete x.chamfer}return l.create(o.extend({},S,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="",T=x*.5,w=0;w<d;w+=1){var A=T+w*x,E=Math.cos(A)*p,S=Math.sin(A)*p;b+="L "+E.toFixed(3)+" "+S.toFixed(3)+" "}var _={label:"Polygon Body",position:{x:f,y:m},vertices:a.fromPath(b)};if(g.chamfer){var k=g.chamfer;_.vertices=a.chamfer(_.vertices,k.radius,k.quality,k.qualityMin,k.qualityMax),delete g.chamfer}return l.create(o.extend({},_,g))},s.fromVertices=function(f,m,d,p,g,x,b,T){var w=o.getDecomp(),A,E,S,_,k,N,C,R,M,O,L;for(A=!!(w&&w.quickDecomp),p=p||{},S=[],g=typeof g<"u"?g:!1,x=typeof x<"u"?x:.01,b=typeof b<"u"?b:10,T=typeof T<"u"?T:.01,o.isArray(d[0])||(d=[d]),O=0;O<d.length;O+=1)if(N=d[O],_=a.isConvex(N),k=!_,k&&!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),S.push({position:{x:f,y:m},vertices:N});else{var I=N.map(function(q){return[q.x,q.y]});w.makeCCW(I),x!==!1&&w.removeCollinearPoints(I,x),T!==!1&&w.removeDuplicatePoints&&w.removeDuplicatePoints(I,T);var j=w.quickDecomp(I);for(C=0;C<j.length;C++){var F=j[C],U=F.map(function(q){return{x:q[0],y:q[1]}});b>0&&a.area(U)<b||S.push({position:a.centre(U),vertices:U})}}for(C=0;C<S.length;C++)S[C]=l.create(o.extend(S[C],p));if(g){var W=5;for(C=0;C<S.length;C++){var D=S[C];for(R=C+1;R<S.length;R++){var Z=S[R];if(c.overlaps(D.bounds,Z.bounds)){var ee=D.vertices,P=Z.vertices;for(M=0;M<D.vertices.length;M++)for(L=0;L<Z.vertices.length;L++){var Q=h.magnitudeSquared(h.sub(ee[(M+1)%ee.length],P[L])),$=h.magnitudeSquared(h.sub(ee[M],P[(L+1)%P.length]));Q<W&&$<W&&(ee[M].isInternal=!0,P[L].isInternal=!0)}}}}}return S.length>1?(E=l.create(o.extend({parts:S.slice(0)},p)),l.setPosition(E,{x:f,y:m}),E):S[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],T=b.bounds,w=b.bounds.max.x,A=b.bounds.max.y,E=b.bounds.min.y,S=b.isStatic||b.isSleeping,_=b.parts.length,k=_===1;for(x=g+1;x<m;x++){var N=f[x],C=N.bounds;if(C.min.x>w)break;if(!(A<C.min.y||E>C.max.y)&&!(S&&(N.isStatic||N.isSleeping))&&d(b.collisionFilter,N.collisionFilter)){var R=N.parts.length;if(k&&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],T=j.bounds,F=L;F<R;F++){var U=N.parts[F],C=U.bounds;if(!(T.min.x>C.max.x||T.max.x<C.min.x||T.max.y<C.min.y||T.min.y>C.max.y)){var M=p(j,U,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(),T=g.world,w=g.detector,A=g.pairs,E=g.timing,S=E.timestamp,_;x=typeof x<"u"?x:d._baseDelta,x*=E.timeScale,E.timestamp+=x,E.lastDelta=x;var k={timestamp:E.timestamp,delta:x};h.trigger(g,"beforeUpdate",k);var N=f.allBodies(T),C=f.allConstraints(T);for(T.isModified&&(l.setBodies(w,N),f.setModified(T,!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(C,x);m.postSolveAll(N),w.pairs=g.pairs;var R=l.collisions(w);c.update(A,R,S),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(C,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",k),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),T=0;T<b.length;T++){var w=b[T];a.set(w,!1),w.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 T=g[b];T.force.x=0,T.force.y=0,T.torque=0}},s._bodiesApplyGravity=function(g,x){var b=typeof x.scale<"u"?x.scale:.001,T=g.length;if(!(x.x===0&&x.y===0||b===0))for(var w=0;w<T;w++){var A=g[w];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,T=0;T<b;T++){var w=g[T];w.isStatic||w.isSleeping||p.update(w,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,T,w,A=s._positionDampen*(f||1),E=o.clamp(h/o._baseDelta,0,1),S=c.length;for(m=0;m<S;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<S;m++)d=c[m],!(!d.isActive||d.isSensor)&&(p=d.collision,g=p.parentA,x=p.parentB,b=p.normal,w=d.separation-d.slop*E,(g.isStatic||x.isStatic)&&(w*=2),g.isStatic||g.isSleeping||(T=A/g.totalContacts,g.positionImpulse.x+=b.x*w*T,g.positionImpulse.y+=b.y*w*T),x.isStatic||x.isSleeping||(T=A/x.totalContacts,x.positionImpulse.x-=b.x*w*T,x.positionImpulse.y-=b.y*w*T))},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,T=x.y,w=g.velocity;if(g.totalContacts=0,b!==0||T!==0){for(var A=0;A<g.parts.length;A++){var E=g.parts[A];m(E.vertices,x),d(E.bounds,E.vertices,w),E.position.x+=b,E.position.y+=T}g.positionPrev.x+=b,g.positionPrev.y+=T,b*w.x+T*w.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,T=x.parentB,w=x.normal,A=x.tangent;for(m=0;m<g;m++){var E=p[m],S=E.vertex,_=E.normalImpulse,k=E.tangentImpulse;if(_!==0||k!==0){var N=w.x*_+A.x*k,C=w.y*_+A.y*k;b.isStatic||b.isSleeping||(b.positionPrev.x+=N*b.inverseMass,b.positionPrev.y+=C*b.inverseMass,b.anglePrev+=b.inverseInertia*((S.x-b.position.x)*C-(S.y-b.position.y)*N)),T.isStatic||T.isSleeping||(T.positionPrev.x-=N*T.inverseMass,T.positionPrev.y-=C*T.inverseMass,T.anglePrev-=T.inverseInertia*((S.x-T.position.x)*C-(S.y-T.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,T=c.length,w,A,E,S;for(E=0;E<T;E++){var _=c[E];if(!(!_.isActive||_.isSensor)){var k=_.collision,N=k.parentA,C=k.parentB,R=N.velocity,M=C.velocity,O=k.normal.x,L=k.normal.y,I=k.tangent.x,j=k.tangent.y,F=_.activeContacts,U=F.length,W=1/U,D=N.inverseMass+C.inverseMass,Z=_.friction*_.frictionStatic*x;for(R.x=N.position.x-N.positionPrev.x,R.y=N.position.y-N.positionPrev.y,M.x=C.position.x-C.positionPrev.x,M.y=C.position.y-C.positionPrev.y,N.angularVelocity=N.angle-N.anglePrev,C.angularVelocity=C.angle-C.anglePrev,S=0;S<U;S++){var ee=F[S],P=ee.vertex,Q=P.x-N.position.x,$=P.y-N.position.y,q=P.x-C.position.x,se=P.y-C.position.y,te=R.x-$*N.angularVelocity,G=R.y+Q*N.angularVelocity,Ee=M.x-se*C.angularVelocity,ae=M.y+q*C.angularVelocity,ie=te-Ee,ke=G-ae,ve=O*ie+L*ke,Se=I*ie+j*ke,Ve=_.separation+ve,_e=Math.min(Ve,1);_e=Ve<0?0:_e;var De=_e*Z;Se<-De||Se>De?(A=Se>0?Se:-Se,w=_.friction*(Se>0?1:-1)*d,w<-A?w=-A:w>A&&(w=A)):(w=Se,A=b);var le=Q*L-$*O,Me=q*L-se*O,Be=W/(D+N.inverseInertia*le*le+C.inverseInertia*Me*Me),Ue=(1+_.restitution)*ve*Be;if(w*=Be,ve<p)ee.normalImpulse=0;else{var ze=ee.normalImpulse;ee.normalImpulse+=Ue,ee.normalImpulse>0&&(ee.normalImpulse=0),Ue=ee.normalImpulse-ze}if(Se<-g||Se>g)ee.tangentImpulse=0;else{var Re=ee.tangentImpulse;ee.tangentImpulse+=w,ee.tangentImpulse<-A&&(ee.tangentImpulse=-A),ee.tangentImpulse>A&&(ee.tangentImpulse=A),w=ee.tangentImpulse-Re}var ge=O*Ue+I*w,J=L*Ue+j*w;N.isStatic||N.isSleeping||(N.positionPrev.x+=ge*N.inverseMass,N.positionPrev.y+=J*N.inverseMass,N.anglePrev+=(Q*J-$*ge)*N.inverseInertia),C.isStatic||C.isSleeping||(C.positionPrev.x-=ge*C.inverseMass,C.positionPrev.y-=J*C.inverseMass,C.anglePrev-=(q*J-se*ge)*C.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,T,w,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++)T=c[E],A=T.pair,A?(A.isActive?b.push(A):g.push(A),a.update(A,T,h),A.confirmedActive=!0):(A=a.create(T,h),d[A.id]=A,g.push(A),f.push(A));var S=[];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&&S.push(E));for(E=0;E<S.length;E++)w=S[E]-E,A=f[w],f.splice(w,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,T){for(var w=a.create({label:"Stack"}),A=m,E=d,S,_=0,k=0;k<g;k++){for(var N=0,C=0;C<p;C++){var R=T(A,E,C,k,S,_);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(w,R),S=R,_+=1}else A+=x}E+=N+b,A=m}return w},s.chain=function(m,d,p,g,x,b){for(var T=m.bodies,w=1;w<T.length;w++){var A=T[w-1],E=T[w],S=A.bounds.max.y-A.bounds.min.y,_=A.bounds.max.x-A.bounds.min.x,k=E.bounds.max.y-E.bounds.min.y,N=E.bounds.max.x-E.bounds.min.x,C={bodyA:A,pointA:{x:_*d,y:S*p},bodyB:E,pointB:{x:N*g,y:k*x}},R=l.extend(C,b);a.addConstraint(m,o.create(R))}return m.label+=" Chain",m},s.mesh=function(m,d,p,g,x){var b=m.bodies,T,w,A,E,S;for(T=0;T<p;T++){for(w=1;w<d;w++)A=b[w-1+T*d],E=b[w+T*d],a.addConstraint(m,o.create(l.extend({bodyA:A,bodyB:E},x)));if(T>0)for(w=0;w<d;w++)A=b[w+(T-1)*d],E=b[w+T*d],a.addConstraint(m,o.create(l.extend({bodyA:A,bodyB:E},x))),g&&w>0&&(S=b[w-1+(T-1)*d],a.addConstraint(m,o.create(l.extend({bodyA:S,bodyB:E},x)))),g&&w<d-1&&(S=b[w+1+(T-1)*d],a.addConstraint(m,o.create(l.extend({bodyA:S,bodyB:E},x))))}return m.label+=" Mesh",m},s.pyramid=function(m,d,p,g,x,b,T){return s.stack(m,d,p,g,x,b,function(w,A,E,S,_,k){var N=Math.min(g,Math.ceil(p/2)),C=_?_.bounds.max.x-_.bounds.min.x:0;if(!(S>N)){S=N-S;var R=S,M=p-1-S;if(!(E<R||E>M)){k===1&&c.translate(_,{x:(E+(p%2===1?1:-1))*C,y:0});var O=_?E*C:0;return T(m+O+E*x,A,E,S,_,k)}}})},s.newtonsCradle=function(m,d,p,g,x){for(var b=a.create({label:"Newtons Cradle"}),T=0;T<p;T++){var w=1.9,A=h.circle(m+T*(g*w),d+x,g,{inertia:1/0,restitution:1,friction:0,frictionAir:1e-4,slop:1}),E=o.create({pointA:{x:m+T*(g*w),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),T=20,w=-p*.5+T,A=p*.5-T,E=0,S=a.create({label:"Car"}),_=h.rectangle(m,d,p,g,{collisionFilter:{group:b},chamfer:{radius:g*.5},density:2e-4}),k=h.circle(m+w,d+E,x,{collisionFilter:{group:b},friction:.8}),N=h.circle(m+A,d+E,x,{collisionFilter:{group:b},friction:.8}),C=o.create({bodyB:_,pointB:{x:w,y:E},bodyA:k,stiffness:1,length:0}),R=o.create({bodyB:_,pointB:{x:A,y:E},bodyA:N,stiffness:1,length:0});return a.addBody(S,_),a.addBody(S,k),a.addBody(S,N),a.addConstraint(S,C),a.addConstraint(S,R),S},f(s,"car","Composites.car ➤ moved to car example"),s.softBody=function(m,d,p,g,x,b,T,w,A,E){A=l.extend({inertia:1/0},A),E=l.extend({stiffness:.2,render:{type:"line",anchors:!1}},E);var S=s.stack(m,d,p,g,x,b,function(_,k){return h.circle(_,k,w,A)});return s.mesh(S,p,g,T,E),S.label="Soft Body",S},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,T,w,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 S=s._getRegion(c,E);if(!E.region||S.id!==E.region.id||m){(!E.region||m)&&(E.region=S);var _=s._regionUnion(S,E.region);for(p=_.startCol;p<=_.endCol;p++)for(g=_.startRow;g<=_.endRow;g++){w=s._getBucketId(p,g),T=b[w];var k=p>=S.startCol&&p<=S.endCol&&g>=S.startRow&&g<=S.endRow,N=p>=E.region.startCol&&p<=E.region.endCol&&g>=E.region.startRow&&g<=E.region.endRow;!k&&N&&N&&T&&s._bucketRemoveBody(c,T,E),(E.region===S||k&&!N||m)&&(T||(T=s._createBucket(b,w)),s._bucketAddBody(c,T,E))}E.region=S,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),T=m[b];T?T[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 T=f.create({label:"Mouse Constraint",pointA:b.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),w={type:"mouseConstraint",mouse:b,element:null,body:null,constraint:T,collisionFilter:{category:1,mask:4294967295,group:0}},A=d.extend(w,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,T=g.constraint,w=g.body;if(b.button===0){if(T.bodyB)o.set(T.bodyB,!1),T.pointA=b.position;else for(var A=0;A<x.length;A++)if(w=x[A],p.contains(w.bounds,b.position)&&h.canCollide(w.collisionFilter,g.collisionFilter))for(var E=w.parts.length>1?1:0;E<w.parts.length;E++){var S=w.parts[E];if(a.contains(S.vertices,b.position)){T.pointA=b.position,T.bodyB=g.body=w,T.pointB={x:b.position.x-w.position.x,y:b.position.y-w.position.y},T.angleB=w.angle,o.set(w,!1),c.trigger(g,"startdrag",{mouse:b,body:w});break}}}else T.bodyB=g.body=null,T.pointB=null,w&&c.trigger(g,"enddrag",{mouse:b,body:w})},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,T=0;T<p;T++){var w=m[T],A=w.parts.length,E=A===1?0:1;if(b(w.bounds,g))for(var S=E;S<A;S++){var _=w.parts[S];if(b(_.bounds,g)){var k=x(_,f);if(k){d.push(k);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,T=(d.y+m.y)*.5,w=c.rectangle(b,T,x,p,{angle:g}),A=s.collides(w,f),E=0;E<A.length;E+=1){var S=A[E];S.body=S.bodyB=S.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 S={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(S,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 S(_){E.frameRequestId=d(S),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,S){var _=E.options,k=E.canvas;S==="auto"&&(S=T(k)),_.pixelRatio=S,k.setAttribute("data-pixel-ratio",S),k.width=_.width*S,k.height=_.height*S,k.style.width=_.width+"px",k.style.height=_.height+"px"},s.lookAt=function(E,S,_,k){k=typeof k<"u"?k:!0,S=o.isArray(S)?S:[S],_=_||{x:0,y:0};for(var N={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},C=0;C<S.length;C+=1){var R=S[C],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,F=E.canvas.width,U=F/j,W=L/I,D=1,Z=1;W>U?Z=W/U:D=U/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*Z,k&&(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*Z*.5,E.bounds.max.y+=I*.5-I*Z*.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 S=E.bounds.max.x-E.bounds.min.x,_=E.bounds.max.y-E.bounds.min.y,k=S/E.options.width,N=_/E.options.height;E.context.setTransform(E.options.pixelRatio/k,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,S){var _=o.now(),k=E.engine,N=k.world,C=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,F=[],U=[],W,D={timestamp:k.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,C.width,C.height),R.globalCompositeOperation="source-over",M.hasBounds){for(W=0;W<L.length;W++){var Z=L[W];c.overlaps(Z.bounds,E.bounds)&&F.push(Z)}for(W=0;W<I.length;W++){var ee=I[W],P=ee.bodyA,Q=ee.bodyB,$=ee.pointA,q=ee.pointB;P&&($=f.add(P.position,ee.pointA)),Q&&(q=f.add(Q.position,ee.pointB)),!(!$||!q)&&(c.contains(E.bounds,$)||c.contains(E.bounds,q))&&U.push(ee)}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 U=I,F=L,E.options.pixelRatio!==1&&E.context.setTransform(E.options.pixelRatio,0,0,E.options.pixelRatio,0,0);!M.wireframes||k.enableSleeping&&M.showSleeping?s.bodies(E,F,R):(M.showConvexHulls&&s.bodyConvexHulls(E,F,R),s.bodyWireframes(E,F,R)),M.showBounds&&s.bodyBounds(E,F,R),(M.showAxes||M.showAngleIndicator)&&s.bodyAxes(E,F,R),M.showPositions&&s.bodyPositions(E,F,R),M.showVelocity&&s.bodyVelocity(E,F,R),M.showIds&&s.bodyIds(E,F,R),M.showSeparations&&s.separations(E,k.pairs.list,R),M.showCollisions&&s.collisions(E,k.pairs.list,R),M.showVertexNumbers&&s.vertexNumbers(E,F,R),M.showMousePosition&&s.mousePosition(E,E.mouse,R),s.constraints(U,R),M.hasBounds&&s.endViewTransform(E),h.trigger(E,"afterRender",D),O.lastElapsed=o.now()-_},s.stats=function(E,S,_){for(var k=E.engine,N=k.world,C=l.allBodies(N),R=0,M=55,O=44,L=0,I=0,j=0;j<C.length;j+=1)R+=C[j].parts.length;var F={Part:R,Body:C.length,Cons:l.allConstraints(N).length,Comp:l.allComposites(N).length,Pair:k.pairs.list.length};S.fillStyle="#0e0f19",S.fillRect(L,I,M*5.5,O),S.font="12px Arial",S.textBaseline="top",S.textAlign="right";for(var U in F){var W=F[U];S.fillStyle="#aaa",S.fillText(U,L+M,I+8),S.fillStyle="#eee",S.fillText(W,L+M,I+26),L+=M}},s.performance=function(E,S){var _=E.engine,k=E.timing,N=k.deltaHistory,C=k.elapsedHistory,R=k.timestampElapsedHistory,M=k.engineDeltaHistory,O=k.engineElapsedHistory,L=_.timing.lastDelta,I=x(N),j=x(C),F=x(M),U=x(O),W=x(R),D=W/I||0,Z=1e3/I||0,ee=4,P=12,Q=60,$=34,q=10,se=69;S.fillStyle="#0e0f19",S.fillRect(0,50,P*4+Q*5+22,$),s.status(S,q,se,Q,ee,N.length,Math.round(Z)+" fps",Z/s._goodFps,function(te){return N[te]/I-1}),s.status(S,q+P+Q,se,Q,ee,M.length,L.toFixed(2)+" dt",s._goodDelta/L,function(te){return M[te]/F-1}),s.status(S,q+(P+Q)*2,se,Q,ee,O.length,U.toFixed(2)+" ut",1-U/s._goodFps,function(te){return O[te]/U-1}),s.status(S,q+(P+Q)*3,se,Q,ee,C.length,j.toFixed(2)+" rt",1-j/s._goodFps,function(te){return C[te]/j-1}),s.status(S,q+(P+Q)*4,se,Q,ee,R.length,D.toFixed(2)+" x",D*D*D,function(te){return(R[te]/N[te]/D||0)-1})},s.status=function(E,S,_,k,N,C,R,M,O){E.strokeStyle="#888",E.fillStyle="#444",E.lineWidth=1,E.fillRect(S,_+7,k,1),E.beginPath(),E.moveTo(S,_+7-N*o.clamp(.4*O(0),-2,2));for(var L=0;L<k;L+=1)E.lineTo(S+L,_+7-(L<C?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(S,_-7,4,4),E.font="12px Arial",E.textBaseline="middle",E.textAlign="right",E.fillStyle="#eee",E.fillText(R,S+k,_-5)},s.constraints=function(E,S){for(var _=S,k=0;k<E.length;k++){var N=E[k];if(!(!N.render.visible||!N.pointA||!N.pointB)){var C=N.bodyA,R=N.bodyB,M,O;if(C?M=f.add(C.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)),F,U=1;U<j;U+=1)F=U%2===0?1:-1,_.lineTo(M.x+L.x*(U/j)+I.x*F*4,M.y+L.y*(U/j)+I.y*F*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,S,_){var k=_;E.engine;var N=E.options,C=N.showInternalEdges||!N.wireframes,R,M,O,L;for(O=0;O<S.length;O++)if(R=S[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?k.globalAlpha=.5*M.render.opacity:M.render.opacity!==1&&(k.globalAlpha=M.render.opacity),M.render.sprite&&M.render.sprite.texture&&!N.wireframes){var I=M.render.sprite,j=w(E,I.texture);k.translate(M.position.x,M.position.y),k.rotate(M.angle),k.drawImage(j,j.width*-I.xOffset*I.xScale,j.height*-I.yOffset*I.yScale,j.width*I.xScale,j.height*I.yScale),k.rotate(-M.angle),k.translate(-M.position.x,-M.position.y)}else{if(M.circleRadius)k.beginPath(),k.arc(M.position.x,M.position.y,M.circleRadius,0,2*Math.PI);else{k.beginPath(),k.moveTo(M.vertices[0].x,M.vertices[0].y);for(var F=1;F<M.vertices.length;F++)!M.vertices[F-1].isInternal||C?k.lineTo(M.vertices[F].x,M.vertices[F].y):k.moveTo(M.vertices[F].x,M.vertices[F].y),M.vertices[F].isInternal&&!C&&k.moveTo(M.vertices[(F+1)%M.vertices.length].x,M.vertices[(F+1)%M.vertices.length].y);k.lineTo(M.vertices[0].x,M.vertices[0].y),k.closePath()}N.wireframes?(k.lineWidth=1,k.strokeStyle="#bbb",k.stroke()):(k.fillStyle=M.render.fillStyle,M.render.lineWidth&&(k.lineWidth=M.render.lineWidth,k.strokeStyle=M.render.strokeStyle,k.stroke()),k.fill())}k.globalAlpha=1}}},s.bodyWireframes=function(E,S,_){var k=_,N=E.options.showInternalEdges,C,R,M,O,L;for(k.beginPath(),M=0;M<S.length;M++)if(C=S[M],!!C.render.visible)for(L=C.parts.length>1?1:0;L<C.parts.length;L++){for(R=C.parts[L],k.moveTo(R.vertices[0].x,R.vertices[0].y),O=1;O<R.vertices.length;O++)!R.vertices[O-1].isInternal||N?k.lineTo(R.vertices[O].x,R.vertices[O].y):k.moveTo(R.vertices[O].x,R.vertices[O].y),R.vertices[O].isInternal&&!N&&k.moveTo(R.vertices[(O+1)%R.vertices.length].x,R.vertices[(O+1)%R.vertices.length].y);k.lineTo(R.vertices[0].x,R.vertices[0].y)}k.lineWidth=1,k.strokeStyle="#bbb",k.stroke()},s.bodyConvexHulls=function(E,S,_){var k=_,N,C,R;for(k.beginPath(),C=0;C<S.length;C++)if(N=S[C],!(!N.render.visible||N.parts.length===1)){for(k.moveTo(N.vertices[0].x,N.vertices[0].y),R=1;R<N.vertices.length;R++)k.lineTo(N.vertices[R].x,N.vertices[R].y);k.lineTo(N.vertices[0].x,N.vertices[0].y)}k.lineWidth=1,k.strokeStyle="rgba(255,255,255,0.2)",k.stroke()},s.vertexNumbers=function(E,S,_){var k=_,N,C,R;for(N=0;N<S.length;N++){var M=S[N].parts;for(R=M.length>1?1:0;R<M.length;R++){var O=M[R];for(C=0;C<O.vertices.length;C++)k.fillStyle="rgba(255,255,255,0.2)",k.fillText(N+"_"+C,O.position.x+(O.vertices[C].x-O.position.x)*.8,O.position.y+(O.vertices[C].y-O.position.y)*.8)}}},s.mousePosition=function(E,S,_){var k=_;k.fillStyle="rgba(255,255,255,0.8)",k.fillText(S.position.x+" "+S.position.y,S.position.x+5,S.position.y-5)},s.bodyBounds=function(E,S,_){var k=_;E.engine;var N=E.options;k.beginPath();for(var C=0;C<S.length;C++){var R=S[C];if(R.render.visible)for(var M=S[C].parts,O=M.length>1?1:0;O<M.length;O++){var L=M[O];k.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?k.strokeStyle="rgba(255,255,255,0.08)":k.strokeStyle="rgba(0,0,0,0.1)",k.lineWidth=1,k.stroke()},s.bodyAxes=function(E,S,_){var k=_;E.engine;var N=E.options,C,R,M,O;for(k.beginPath(),R=0;R<S.length;R++){var L=S[R],I=L.parts;if(L.render.visible)if(N.showAxes)for(M=I.length>1?1:0;M<I.length;M++)for(C=I[M],O=0;O<C.axes.length;O++){var j=C.axes[O];k.moveTo(C.position.x,C.position.y),k.lineTo(C.position.x+j.x*20,C.position.y+j.y*20)}else for(M=I.length>1?1:0;M<I.length;M++)for(C=I[M],O=0;O<C.axes.length;O++)k.moveTo(C.position.x,C.position.y),k.lineTo((C.vertices[0].x+C.vertices[C.vertices.length-1].x)/2,(C.vertices[0].y+C.vertices[C.vertices.length-1].y)/2)}N.wireframes?(k.strokeStyle="indianred",k.lineWidth=1):(k.strokeStyle="rgba(255, 255, 255, 0.4)",k.globalCompositeOperation="overlay",k.lineWidth=2),k.stroke(),k.globalCompositeOperation="source-over"},s.bodyPositions=function(E,S,_){var k=_;E.engine;var N=E.options,C,R,M,O;for(k.beginPath(),M=0;M<S.length;M++)if(C=S[M],!!C.render.visible)for(O=0;O<C.parts.length;O++)R=C.parts[O],k.arc(R.position.x,R.position.y,3,0,2*Math.PI,!1),k.closePath();for(N.wireframes?k.fillStyle="indianred":k.fillStyle="rgba(0,0,0,0.5)",k.fill(),k.beginPath(),M=0;M<S.length;M++)C=S[M],C.render.visible&&(k.arc(C.positionPrev.x,C.positionPrev.y,2,0,2*Math.PI,!1),k.closePath());k.fillStyle="rgba(255,165,0,0.8)",k.fill()},s.bodyVelocity=function(E,S,_){var k=_;k.beginPath();for(var N=0;N<S.length;N++){var C=S[N];if(C.render.visible){var R=a.getVelocity(C);k.moveTo(C.position.x,C.position.y),k.lineTo(C.position.x+R.x,C.position.y+R.y)}}k.lineWidth=3,k.strokeStyle="cornflowerblue",k.stroke()},s.bodyIds=function(E,S,_){var k=_,N,C;for(N=0;N<S.length;N++)if(S[N].render.visible){var R=S[N].parts;for(C=R.length>1?1:0;C<R.length;C++){var M=R[C];k.font="12px Arial",k.fillStyle="rgba(255,255,255,0.5)",k.fillText(M.id,M.position.x+10,M.position.y-10)}}},s.collisions=function(E,S,_){var k=_,N=E.options,C,R,M,O;for(k.beginPath(),M=0;M<S.length;M++)if(C=S[M],!!C.isActive)for(R=C.collision,O=0;O<C.activeContacts.length;O++){var L=C.activeContacts[O],I=L.vertex;k.rect(I.x-1.5,I.y-1.5,3.5,3.5)}for(N.wireframes?k.fillStyle="rgba(255,255,255,0.7)":k.fillStyle="orange",k.fill(),k.beginPath(),M=0;M<S.length;M++)if(C=S[M],!!C.isActive&&(R=C.collision,C.activeContacts.length>0)){var j=C.activeContacts[0].vertex.x,F=C.activeContacts[0].vertex.y;C.activeContacts.length===2&&(j=(C.activeContacts[0].vertex.x+C.activeContacts[1].vertex.x)/2,F=(C.activeContacts[0].vertex.y+C.activeContacts[1].vertex.y)/2),R.bodyB===R.supports[0].body||R.bodyA.isStatic===!0?k.moveTo(j-R.normal.x*8,F-R.normal.y*8):k.moveTo(j+R.normal.x*8,F+R.normal.y*8),k.lineTo(j,F)}N.wireframes?k.strokeStyle="rgba(255,165,0,0.7)":k.strokeStyle="orange",k.lineWidth=1,k.stroke()},s.separations=function(E,S,_){var k=_,N=E.options,C,R,M,O,L;for(k.beginPath(),L=0;L<S.length;L++)if(C=S[L],!!C.isActive){R=C.collision,M=R.bodyA,O=R.bodyB;var I=1;!O.isStatic&&!M.isStatic&&(I=.5),O.isStatic&&(I=0),k.moveTo(O.position.x,O.position.y),k.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),k.moveTo(M.position.x,M.position.y),k.lineTo(M.position.x+R.penetration.x*I,M.position.y+R.penetration.y*I)}N.wireframes?k.strokeStyle="rgba(255,165,0,0.5)":k.strokeStyle="orange",k.stroke()},s.inspector=function(E,S){E.engine;var _=E.selected,k=E.render,N=k.options,C;if(N.hasBounds){var R=k.bounds.max.x-k.bounds.min.x,M=k.bounds.max.y-k.bounds.min.y,O=R/k.options.width,L=M/k.options.height;S.scale(1/O,1/L),S.translate(-k.bounds.min.x,-k.bounds.min.y)}for(var I=0;I<_.length;I++){var j=_[I].data;switch(S.translate(.5,.5),S.lineWidth=1,S.strokeStyle="rgba(255,165,0,0.9)",S.setLineDash([1,2]),j.type){case"body":C=j.bounds,S.beginPath(),S.rect(Math.floor(C.min.x-3),Math.floor(C.min.y-3),Math.floor(C.max.x-C.min.x+6),Math.floor(C.max.y-C.min.y+6)),S.closePath(),S.stroke();break;case"constraint":var F=j.pointA;j.bodyA&&(F=j.pointB),S.beginPath(),S.arc(F.x,F.y,10,0,2*Math.PI),S.closePath(),S.stroke();break}S.setLineDash([]),S.translate(-.5,-.5)}E.selectStart!==null&&(S.translate(.5,.5),S.lineWidth=1,S.strokeStyle="rgba(255,165,0,0.6)",S.fillStyle="rgba(255,165,0,0.1)",C=E.selectBounds,S.beginPath(),S.rect(Math.floor(C.min.x),Math.floor(C.min.y),Math.floor(C.max.x-C.min.x),Math.floor(C.max.y-C.min.y)),S.closePath(),S.stroke(),S.fill(),S.translate(-.5,-.5)),N.hasBounds&&S.setTransform(1,0,0,1,0,0)};var g=function(E,S){var _=E.engine,k=E.timing,N=k.historySize,C=_.timing.timestamp;k.delta=S-k.lastTime||s._goodDelta,k.lastTime=S,k.timestampElapsed=C-k.lastTimestamp||0,k.lastTimestamp=C,k.deltaHistory.unshift(k.delta),k.deltaHistory.length=Math.min(k.deltaHistory.length,N),k.engineDeltaHistory.unshift(_.timing.lastDelta),k.engineDeltaHistory.length=Math.min(k.engineDeltaHistory.length,N),k.timestampElapsedHistory.unshift(k.timestampElapsed),k.timestampElapsedHistory.length=Math.min(k.timestampElapsedHistory.length,N),k.engineElapsedHistory.unshift(_.timing.lastElapsed),k.engineElapsedHistory.length=Math.min(k.engineElapsedHistory.length,N),k.elapsedHistory.unshift(k.lastElapsed),k.elapsedHistory.length=Math.min(k.elapsedHistory.length,N)},x=function(E){for(var S=0,_=0;_<E.length;_+=1)S+=E[_];return S/E.length||0},b=function(E,S){var _=document.createElement("canvas");return _.width=E,_.height=S,_.oncontextmenu=function(){return!1},_.onselectstart=function(){return!1},_},T=function(E){var S=E.getContext("2d"),_=window.devicePixelRatio||1,k=S.webkitBackingStorePixelRatio||S.mozBackingStorePixelRatio||S.msBackingStorePixelRatio||S.oBackingStorePixelRatio||S.backingStorePixelRatio||1;return _/k},w=function(E,S){var _=E.textures[S];return _||(_=E.textures[S]=new Image,_.src=S,_)},A=function(E,S){var _=S;/(jpg|gif|png)$/.test(S)&&(_="url("+S+")"),E.canvas.style.background=_,E.canvas.style.backgroundSize="contain",E.currentBackground=S}})()}),(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,T,w=[],A,E,S=0,_=0,k=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),w.push(I),_=A+R,k=E+M}},C=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,k=R.y;break;case"H":_=R.x;break;case"V":k=R.y;break}N(_,k,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();S<f;){if(T=o.getPathSegAtLength(S),d=p[T],d!=x){for(;g.length&&g[0]!=d;)C(g.shift());x=d}switch(d.pathSegTypeAsLetter.toUpperCase()){case"C":case"T":case"S":case"Q":case"A":m=o.getPointAtLength(S),N(m.x,m.y,0);break}S+=l}for(c=0,h=g.length;c<h;++c)C(g[c]);return w},s._svgPathToAbsolute=function(o){for(var l,c,h,f,m,d,p=o.pathSegList,g=0,x=0,b=p.numberOfItems,T=0;T<b;++T){var w=p.getItem(T),A=w.pathSegTypeAsLetter;if(/[MLHVCSQTA]/.test(A))"x"in w&&(g=w.x),"y"in w&&(x=w.y);else switch("x1"in w&&(h=g+w.x1),"x2"in w&&(m=g+w.x2),"y1"in w&&(f=x+w.y1),"y2"in w&&(d=x+w.y2),"x"in w&&(g+=w.x),"y"in w&&(x+=w.y),A){case"m":p.replaceItem(o.createSVGPathSegMovetoAbs(g,x),T);break;case"l":p.replaceItem(o.createSVGPathSegLinetoAbs(g,x),T);break;case"h":p.replaceItem(o.createSVGPathSegLinetoHorizontalAbs(g),T);break;case"v":p.replaceItem(o.createSVGPathSegLinetoVerticalAbs(x),T);break;case"c":p.replaceItem(o.createSVGPathSegCurvetoCubicAbs(g,x,h,f,m,d),T);break;case"s":p.replaceItem(o.createSVGPathSegCurvetoCubicSmoothAbs(g,x,m,d),T);break;case"q":p.replaceItem(o.createSVGPathSegCurvetoQuadraticAbs(g,x,h,f),T);break;case"t":p.replaceItem(o.createSVGPathSegCurvetoQuadraticSmoothAbs(g,x),T);break;case"a":p.replaceItem(o.createSVGPathSegArcAbs(g,x,w.r1,w.r2,w.angle,w.largeArcFlag,w.sweepFlag),T);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})()})])})})(ii)),ii.exports}var sb=rb();const Ln=Il(sb);{const e=Ln.Resolver;e&&typeof e._restingThresh=="number"&&(e._restingThresh=1.4)}const ib=6,_t=28,nn=.92,ka=1.12,ab=34;function hu(e,t,n){return Math.hypot(t-e.startX,n-e.startY)<ib?"click":"drag"}function ob(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 lb(e,t){return e*Math.exp(-t/90)}function cb(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 Vf=4e-5,ub=5e-4;function $f(e,t,n){return Math.sin(n*37e-5+t*.0013)*.6+Math.sin(n*19e-5+e*7e-4+1.7)*.4}function qf(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 Wf(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 Mr=120,db=.9,fu=.7,hb=.09,fb=2.2,mb=2,Ta=_t*2.45,pb=.006,wa=22,Sa=.06;function gb(e){var O;const t=e.ballRadius??_t,n=qf(e.weather??"clear"),{Engine:r,Bodies:i,Body:s,Composite:a,Constraint:o,Events:l}=Ln,c=r.create();c.gravity.y=1,c.positionIterations=8,c.velocityIterations=4;const h=e.nodes.map(L=>{var U,W;const I=((U=L.spawn)==null?void 0:U.x)??L.x,j=((W=L.spawn)==null?void 0:W.y)??L.y,F=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:F,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=Mr/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,Mr,m),i.rectangle(e.width/2,e.height+f,e.width*3,Mr,m),i.rectangle(-f,e.height/2,Mr,e.height*3,m),i.rectangle(e.width+f,e.height/2,Mr,e.height*3,m)]);const p=L=>({x:L.body.position.x,y:L.body.position.y+t*nn}),g=[];function x(L,I,j,F,U){return"body"in L?o.create({bodyA:L.body,pointA:L.offset,bodyB:I,pointB:j,length:F,stiffness:U,damping:.05}):o.create({pointA:L.point,bodyB:I,pointB:j,length:F,stiffness:U,damping:.05})}function b(L,I,j,F){const U={x:j.body.position.x,y:j.body.position.y+t*nn},W=U.x-L.x,D=U.y-L.y,Z=Math.max(60,Math.hypot(W,D)),ee=Math.max(5,Math.min(14,Math.round(Z/ab))),P=Z*ka/ee,Q=[];let $=I?{body:I,offset:{x:L.x-I.position.x,y:L.y-I.position.y}}:{point:L},q=!0;for(let se=1;se<ee;se++){const te=se/ee,G=Math.sin(Math.PI*te)*Z*(ka-1)*.85,Ee=i.circle(L.x+W*te,L.y+D*te+G,3.5,{density:7e-4,frictionAir:.1*n.airDrag,collisionFilter:{category:8,mask:0}});Q.push(Ee),a.add(c.world,Ee),a.add(c.world,x($,Ee,void 0,P,q?fu:db)),q=!1,$={body:Ee,offset:{x:0,y:0}}}a.add(c.world,x($,j.body,{x:0,y:t*nn},P,fu)),g.push({from:F,to:j.nodeId,restLen:Z*ka,particles:Q})}const T=h[0],w=T?{x:e.anchorKnotX??T.layoutX,y:Ti}:{x:e.width/2,y:Ti};T&&b(w,null,T,"__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 S=new Map;for(const L of h){let I=0;for(const F of g)if(F.from===L.nodeId||F.to===L.nodeId)for(const U of F.particles)I+=U.mass*.5;const j=Math.min(.25,I/L.body.mass);S.set(L.nodeId,(1+j)*(.96+Wf(L.nodeId)*.08))}let _=0,k=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),k=Math.random()<.5?-1:1);for(const I of h){const j=I.body.mass,F=c.gravity.y*c.gravity.scale,U=$f(I.body.position.x,I.body.position.y,L)*n.wind*Vf*j+k*_*ub*j;let W=-j*F*(S.get(I.nodeId)??1);n.rainRate>0&&Math.random()<n.rainRate&&(W+=j*F*.35,s.applyForce(I.body,I.body.position,{x:(Math.random()-.5)*j*F*.3,y:0})),s.applyForce(I.body,I.body.position,{x:U,y:W})}});const N=[],C=(L,I,j,F)=>{if(L.snow<=Sa)return;const U=Math.max(1,Math.min(F,Math.round(L.snow*F)+1));for(let W=0;W<U;W++){const D=-(.35+Math.random()*1.9),Z=t*(.55+Math.random()*.45);N.push({x:L.body.position.x+Math.cos(D)*Z,y:L.body.position.y+Math.sin(D)*Z,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(Sa*.5,L.snow-U*(.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:F,bodyB:U}=j,W=h.find(q=>q.body===F),D=h.find(q=>q.body===U);if(!W&&!D)continue;const Z={x:F.velocity.x-U.velocity.x,y:F.velocity.y-U.velocity.y},ee=Math.hypot(Z.x,Z.y);if(ee<fb)continue;const P=j.collision.normal,Q=(I=j.collision.supports)==null?void 0:I[0];R.push(Q?{x:Q.x,y:Q.y,speed:ee}:{x:(F.position.x+U.position.x)/2,y:(F.position.y+U.position.y)/2,speed:ee}),R.length>64&&R.shift();const $=Math.min(.32,ee*.028);W&&$>W.squash&&(W.squash=$,W.squashAngle=Math.atan2(P.y,P.x)),D&&$>D.squash&&(D.squash=$,D.squashAngle=Math.atan2(-P.y,-P.x)),W&&C(W,{x:P.x,y:P.y},ee,5),D&&C(D,{x:-P.x,y:-P.y},ee,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:w,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 F=I+1;F<h.length;F++){const U=h[F],W=U.body.position.x-j.body.position.x,D=U.body.position.y-j.body.position.y,Z=W*W+D*D;if(Z>=Ta*Ta||Z<.01)continue;const ee=Math.sqrt(Z),P=(ee-2*t)/(Ta-2*t),Q=P<=0?1:P>=1?0:1-P,q=Math.hypot(j.body.velocity.x-U.body.velocity.x,j.body.velocity.y-U.body.velocity.y)<1.2?pb*Q*Q:0,se=W/ee,te=D/ee;j.body.isStatic||s.applyForce(j.body,j.body.position,{x:-se*q*j.body.mass,y:-te*q*j.body.mass}),U.body.isStatic||s.applyForce(U.body,U.body.position,{x:se*q*U.body.mass,y:te*q*U.body.mass}),j.field=Math.max(j.field,Q),U.field=Math.max(U.field,Q)}}for(const I of h)I.field*=.88;for(const I of h){if(I.body.isStatic)continue;const j=I.body.velocity,F=Math.hypot(j.x,j.y);F>wa&&s.setVelocity(I.body,{x:j.x/F*wa,y:j.y/F*wa})}for(let I=0;I<h.length;I++){const j=h[I];for(let F=I+1;F<h.length;F++){const U=h[F];let W=U.body.position.x-j.body.position.x,D=U.body.position.y-j.body.position.y,Z=Math.hypot(W,D);if(Z>=t*2)continue;Z<.01&&(W=1,D=0,Z=1);const ee=t*2-Z+.05,P=W/Z,Q=D/Z;j.body.isStatic&&U.body.isStatic||(j.body.isStatic?s.setPosition(U.body,{x:U.body.position.x+P*ee,y:U.body.position.y+Q*ee}):U.body.isStatic?s.setPosition(j.body,{x:j.body.position.x-P*ee,y:j.body.position.y-Q*ee}):(s.setPosition(j.body,{x:j.body.position.x-P*ee/2,y:j.body.position.y-Q*ee/2}),s.setPosition(U.body,{x:U.body.position.x+P*ee/2,y:U.body.position.y+Q*ee/2})))}}for(const I of h){const j=Math.hypot(I.body.velocity.x,I.body.velocity.y);I.snow>Sa&&j>mb&&C(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,F=I.body.position.y,U=Math.min(e.width-t,Math.max(t,j)),W=Math.min(e.height-t,Math.max(t,F));(U!==j||W!==F)&&(s.setPosition(I.body,{x:U,y:W}),s.setVelocity(I.body,{x:j<t||j>e.width-t?0:I.body.velocity.x,y:F<t||F>e.height-t?0:I.body.velocity.y}))}},beginDrag(L,I,j){this.endDrag();const F=this.ball(L);if(!F)return;const U=o.create({pointA:d(I,j),bodyB:F.body,length:0,stiffness:hb,damping:.12});a.add(c.world,U),M={constraint:U,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 Ti=-12;function Fs(e,t,n=20){return t<=n*2?t/2:n+Wf(e)*(t-n*2)}function xb(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 Fn=(e,t,n)=>e+(t-e)*n,$i=(e,t,n)=>e<t?t:e>n?n:e,cs=e=>e<0?0:e>1?1:e*e*(3-2*e);function Bn(e,t,n){return[Fn(e[0],t[0],n),Fn(e[1],t[1],n),Fn(e[2],t[2],n)]}const Ca=e=>`rgb(${e[0]|0},${e[1]|0},${e[2]|0})`,pr=(e,t)=>`rgba(${e[0]|0},${e[1]|0},${e[2]|0},${t})`;function qi(){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 Wi(e,t){return e.map(n=>({t:n.t,top:t(n.top),mid:t(n.mid),hor:t(n.hor)}))}const Aa=()=>Wi(qi(),e=>[e[0]*1,e[1]*1.15,e[2]*.7]),Bs=()=>Wi(qi(),e=>[e[0]*.75,e[1]*1,Math.min(255,e[2]*1.25)]),Na=()=>Wi(qi(),e=>[Math.min(255,e[0]*1.35),e[1]*.8,e[2]*.55]),mu=()=>Wi(qi(),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},Hs={far:[20,48,30],near:[34,82,40],snowy:!1},Ia={far:[54,36,24],near:[128,78,36],snowy:!1},pu={far:[60,66,82],near:[232,236,244],snowy:!0};function Nt(e){return t=>{let n=e;return t>.3&&t<.5?n=Fn(n,Math.min(1,n+.2),cs((t-.3)/.2)):t>=.5&&t<.74?n=Math.min(1,n+.15):t>=.74&&t<.84&&(n=Fn(n,Math.max(0,n-.3),cs((t-.74)/.1))),$i(n,0,1)}}const Yf={"spring|clear":{season:"spring",weather:"clear",sky:Aa(),cloudCover:Nt(.1),particles:"none",lightning:!1,fogAlpha:0,ground:_a},"spring|cloudy":{season:"spring",weather:"cloudy",sky:Aa(),cloudCover:Nt(.5),particles:"none",lightning:!1,fogAlpha:0,ground:_a},"spring|rain":{season:"spring",weather:"rain",sky:Aa(),cloudCover:Nt(.85),particles:"rain",lightning:!1,fogAlpha:0,ground:_a},"summer|clear":{season:"summer",weather:"clear",sky:Bs(),cloudCover:Nt(.1),particles:"none",lightning:!1,fogAlpha:0,ground:Hs},"summer|cloudy":{season:"summer",weather:"cloudy",sky:Bs(),cloudCover:Nt(.5),particles:"none",lightning:!1,fogAlpha:0,ground:Hs},"summer|rain":{season:"summer",weather:"rain",sky:Bs(),cloudCover:Nt(.85),particles:"rain",lightning:!1,fogAlpha:0,ground:Hs},"summer|storm":{season:"summer",weather:"storm",sky:Bs(),cloudCover:Nt(1),particles:"rain",lightning:!0,fogAlpha:0,ground:Hs},"autumn|clear":{season:"autumn",weather:"clear",sky:Na(),cloudCover:Nt(.15),particles:"none",lightning:!1,fogAlpha:0,ground:Ia,sunTint:[255,180,110]},"autumn|cloudy":{season:"autumn",weather:"cloudy",sky:Na(),cloudCover:Nt(.55),particles:"none",lightning:!1,fogAlpha:0,ground:Ia},"autumn|storm":{season:"autumn",weather:"storm",sky:Na(),cloudCover:Nt(1),particles:"rain",lightning:!0,fogAlpha:0,ground:Ia},"winter|clear":{season:"winter",weather:"clear",sky:mu(),cloudCover:Nt(.2),particles:"none",lightning:!1,fogAlpha:0,ground:pu,sunTint:[220,230,245]},"winter|snow":{season:"winter",weather:"snow",sky:mu(),cloudCover:Nt(.9),particles:"snow",lightning:!1,fogAlpha:.2,ground:pu}},gu=Object.keys(Yf);function bb(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 yb(e){const t=`${e??"none"}:${Math.floor(performance.now()/1e3)}`;return gu[bb(t)%gu.length]}function vb(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=cs($i((e-r.t)/(i.t-r.t||1),0,1));return{top:Bn(r.top,i.top,s),mid:Bn(r.mid,i.mid,s),hor:Bn(r.hor,i.hor,s)}}function Eb(e,t,n,r,i){if(e<r||e>i)return null;const s=(e-r)/(i-r),a=Fn(.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 kb(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=Fn(.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 Gf(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 xu(e,t){const n=Gf(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 Tb(){const e=Gf(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 wb(e,t,n,r){const i=e.createLinearGradient(0,0,0,r);i.addColorStop(0,Ca(t.top)),i.addColorStop(.55,Ca(t.mid)),i.addColorStop(1,Ca(t.hor)),e.fillStyle=i,e.fillRect(0,0,n,r)}function Sb(e,t,n,r,i,s){let a=0;if(t<.22?a=cs(1-t/.22):t>.8&&(a=cs((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 Cb(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?Bn(n,[255,214,150],.5):[255,214,150];l.addColorStop(0,"rgba(255,252,238,1)"),l.addColorStop(.7,pr(c,1)),l.addColorStop(1,pr(h,.9)),e.fillStyle=l,e.beginPath(),e.arc(r,i,a,0,Math.PI*2),e.fill()}function Ab(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 Nb(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=pr([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=pr(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 _b(e,t,n,r,i,s,a,o,l){const c=a(t);if(c<.02)return;const h=Bn(o.hor,[255,255,255],.35),f=Bn(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&&Nb(e,g*r,x*i,p.s,m,$i(c*.92,0,.92))}}const sr=[];let _n=[];const Ur=[];let In=[];const Us=[],Rr=[];let zr=[];function Ib(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 Ma(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 Mb(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 Rb(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 Kf(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 Lb(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=Ma(t,n,r,m,o.theta),g=Ma(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=Ma(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 Pb(e,t,n,r){for(;sr.length<t.length;)sr.push([]);for(;_n.length<t.length;)_n.push(0);for(;zr.length<t.length;)zr.push(.3);for(;Ur.length<t.length;)Ur.push([]);for(;In.length<t.length;)In.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,(zr[i]??.3)+8e-4);zr[i]=a,Ib(e,s.x,s.y,s.r,a)}else if(n.particles==="rain"){if(Mb(e,s.x,s.y,s.r),_n[i]=_n[i]-1,_n[i]<=0&&sr[i].length<3){const a=Math.random()<.5?-1:1;sr[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}),_n[i]=40+Math.random()*60}if(Lb(e,s.x,s.y,s.r,sr[i]),In[i]=In[i]-1,In[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;Ur[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)})}In[i]=30+Math.floor(Math.random()*50)}Kf(e,Ur[i])}}}function Db(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 Ob(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 jb(e,t,n,r,i){const s=e.createLinearGradient(0,n*.4,0,n),a=Bn(i.hor,[255,255,255],.3);s.addColorStop(0,pr(a,0)),s.addColorStop(1,pr(a,r)),e.fillStyle=s,e.fillRect(0,n*.4,t,n*.6)}let Zn=0,bu=0;function Fb(e,t,n,r,i){if(i>bu&&(Zn=1,bu=i+1400+Math.random()*2600),Zn*=.86,Zn<.02){Zn=0;return}if(e.fillStyle=`rgba(255,255,255,${Zn*.5})`,e.fillRect(0,0,t,n),Zn>.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 Bb(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=xu(1,1);const f=Tb();let m=[],d=[],p=0,g=0,x=!0;const b=performance.now(),T=window.matchMedia("(prefers-reduced-motion: reduce)").matches;function w(){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=xu(o,l),r.particles==="rain"&&m.length===0){const C=r.weather==="storm",R=C?140:70;for(let M=0;M<R;M++)m.push({x:Math.random(),y:Math.random(),len:C?12+Math.random()*14:6+Math.random()*8,v:C?.9+Math.random()*.4:.5+Math.random()*.3})}if(r.particles==="snow"&&d.length===0)for(let C=0;C<120;C++)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?$i(t.scrollTop/N,0,1):0}function E(N){if(!x)return;const C=p,R=T?0:(N-b)/1e3,M=vb(C,r.sky);wb(s,M,o,l),Sb(s,C,h,o,l,R),Ab(s,kb(C,o,l,.92,.08)),Cb(s,Eb(C,o,l,.16,.88),r.sunTint),_b(s,C,f,o,l,N,r.cloudCover,M,r.weather==="storm"),r.particles==="rain"&&Db(s,o,l,m,r.weather==="storm"),r.particles==="snow"&&Ob(s,o,l,d,N),r.fogAlpha>0&&jb(s,o,l,r.fogAlpha,M),r.lightning&&Fb(s,o,l,!0,N),T||(g=requestAnimationFrame(E))}const S=()=>A(),_=new ResizeObserver(()=>{w(),A()});_.observe(a),w(),A();let k;if(T){let N=!1;k=()=>{A(),N||(N=!0,requestAnimationFrame(()=>{N=!1,E(performance.now())}))},t.addEventListener("scroll",k,{passive:!0}),E(performance.now())}else k=S,t.addEventListener("scroll",k,{passive:!0}),g=requestAnimationFrame(E);return()=>{x=!1,cancelAnimationFrame(g),_.disconnect(),t.removeEventListener("scroll",k)}}function Hb(e,t,n,r,i,s){const a=()=>{sr.length=0,zr.length=0,_n.length=0,Ur.length=0,In.length=0,Us.length=0,Rr.length=0;const T=e.getContext("2d");T&&T.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 T=t.getBoundingClientRect();m=Math.min(window.devicePixelRatio||1,2),h=Math.max(1,T.width),f=Math.max(1,T.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(T){if(!p)return;c.clearRect(0,0,h,f);const w=r();if(Pb(c,w,n),i){for(const A of i()){const E=3+Math.min(5,Math.floor(A.speed/3));for(let S=0;S<E;S++)Us.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)})}Us.length>0&&Kf(c,Us)}if(s){for(const A of s()){const E=1+Math.min(2,Math.round(A.amount*40));for(let S=0;S<E;S++){const _=55+Math.floor(Math.random()*40);Rr.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(;Rr.length>240;)Rr.shift();Rb(c,Rr)}d=requestAnimationFrame(x)}const b=new ResizeObserver(g);return b.observe(t),g(),d=requestAnimationFrame(x),()=>{p=!1,cancelAnimationFrame(d),b.disconnect(),a()}}function Ub(e){const t=Ne(),[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=!Ml(),f=v.useRef([]),m=v.useRef(R=>{f.current.push(...R),f.current.length>64&&f.current.splice(0,f.current.length-64)}).current,d=v.useRef([]),p=v.useRef(new Map),g=v.useRef(R=>{d.current.push(...R),d.current.length>96&&d.current.splice(0,d.current.length-96)}).current,x=e.sections.filter(R=>(R.world??"study")===i),b=e.sections.some(R=>R.world==="practice"),[T,w]=v.useState(null);v.useEffect(()=>{w(yb(e.courseId))},[e.courseId]);const A=T?Yf[T]??null:null;v.useEffect(()=>(Xc({nav:a.current,visible:n==="map",weather:(A==null?void 0:A.weather)??"clear"}),()=>{Xc({visible:!1,nav:null})}),[n,A,a]);const[E,S]=v.useState(!1);v.useEffect(()=>{if(!e.selectedNodeId)return;const R=o.current;if(!R)return;const M=R.querySelector(`[data-node-id="${CSS.escape(e.selectedNodeId)}"]`);if(!M)return;const O=R.getBoundingClientRect(),L=M.getBoundingClientRect();(L.top<O.top+60||L.bottom>O.bottom-60)&&M.scrollIntoView({behavior:"smooth",block:"center"})},[e.selectedNodeId]);const _=v.useRef(null);v.useEffect(()=>{S(!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[k,N]=v.useState(null),C=v.useRef({});return v.useEffect(()=>{var L;const R=C.current,M={};let O=!1;for(const I of e.tree){const j=((L=e.progressMap[I.id])==null?void 0:L.status)??"locked";M[I.id]=j,R[I.id]==="locked"&&j!=="locked"&&(O=!0)}O&&Object.keys(R).length>0&&jn("unlock"),C.current=M},[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(Vb,{scrollRef:o,navRef:a,preset:A}),u.jsx($b,{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",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(Dl,{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(ys,{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(Xb,{available:e.availableLanguages,current:e.currentLocale,onChange:e.onLocaleChange}),e.courseId&&u.jsx("button",{onClick:R=>{const M=R.currentTarget.getBoundingClientRect();N({id:e.courseId,title:e.courseTitle??"",rect:M})},"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(Df,{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:()=>S(!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(Ol,{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(Kt,{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(Kt,{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(Es,{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",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((R,M)=>u.jsx(qb,{section:R,sectionIndex:M,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},R.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(zb,{courses:e.courses,selectedCourseId:e.courseId,onSelectCourse:R=>{e.onSelectCourse(R),r("map")},onDeleteCourse:(R,M,O)=>N({id:R,title:M,rect:O}),onCoursesChanged:e.onCoursesChanged})})]})}),E&&e.courseId&&u.jsx(q1,{sections:e.sections,tree:e.tree,progressMap:e.progressMap,selectedNodeId:e.selectedNodeId,onJump:R=>{s(R.world??"study"),S(!1),e.onJumpNode(R.id)},onClose:()=>S(!1)}),k&&u.jsx(Vi,{anchorRect:k.rect,message:`${k.title} — ${t("import.delete.confirm")}`,danger:!0,confirmLabel:t("import.delete"),testid:"course-delete-confirm",onConfirm:()=>{e.onDeleteCourse(k.id),N(null)},onCancel:()=>N(null)})]})}function zb({courses:e,selectedCourseId:t,onSelectCourse:n,onDeleteCourse:r,onCoursesChanged:i}){const s=Ne(),[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,T]=v.useState(""),[w,A]=v.useState(""),[E,S]=v.useState(!1),[_,k]=v.useState(null),[N,C]=v.useState(null),[R,M]=v.useState(null),[O,L]=v.useState(null),[I,j]=v.useState([]),[,F]=v.useState(0),U=v.useRef(null);v.useEffect(()=>{const ae=K.on("import:progress",ke=>{j(ve=>{const Se=/\d+\/\d+/.test(ke),Ve=ve[ve.length-1];if(Se&&Ve&&Ve.status==="working"){const De=[...ve];return De[De.length-1]={...Ve,msg:ke},De}const _e=ve.map(De=>De.status==="working"?{...De,status:"done"}:De);return _e.push({msg:ke,status:"working",ts:Date.now()}),_e})}),ie=setInterval(()=>F(ke=>ke+1),1e3);return()=>{ae(),clearInterval(ie)}},[]),v.useEffect(()=>K.on("import:done",ie=>{S(!1),At(!1),ie.cancelled||Ex(ie.ok),M(ie.ok?null:ie.planId??null),ie.ok?(C(`${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([]),k(null),C(s("import.cancelled"))):k(ie.error??"导入失败")}),[i,s]),v.useEffect(()=>{const ae=U.current;ae&&(ae.scrollTop=ae.scrollHeight)},[I]);const W=async()=>{if(!(!h.trim()||E)){k(null),C(null),j([]);try{await K.importUrl(h.trim()),S(!0),At(!0)}catch(ae){k(ae instanceof Error?ae.message:String(ae))}}},D=async()=>{if(!(!b.trim()||E)){k(null),C(null),j([]);try{await K.importText({name:w.trim()||void 0,text:b.trim()}),S(!0),At(!0)}catch(ae){k(ae instanceof Error?ae.message:String(ae))}}},Z=async()=>{var ie;if(E)return;if(k(null),C(null),j([]),!en){(ie=g.current)==null||ie.click();return}await K.importEpub().catch(ke=>(k(ke instanceof Error?ke.message:String(ke)),null))&&(S(!0),At(!0))},ee=async ae=>{if(!(!ae||E)){k(null),C(null),j([]);try{const ie=new Uint8Array(await ae.arrayBuffer());let ke="";for(let Se=0;Se<ie.length;Se+=32768)ke+=String.fromCharCode(...ie.subarray(Se,Se+32768));await K.importEpub({fileName:ae.name,contentBase64:btoa(ke)})&&S(!0),At(!0)}catch(ie){k(ie instanceof Error?ie.message:String(ie))}}},P=async()=>{if(E)return;if(k(null),C(null),j([]),!en){const ie=m.trim();if(!ie){k(s("import.folder.pathRequired"));return}try{await K.importLocalFolder(ie)&&S(!0),At(!0)}catch(ke){k(ke instanceof Error?ke.message:String(ke))}return}await K.importLocalFolder()&&(S(!0),At(!0))},Q=async()=>{var ie;if(E)return;if(k(null),C(null),j([]),!en){(ie=p.current)==null||ie.click();return}await K.importPack().catch(ke=>(k(ke instanceof Error?ke.message:String(ke)),null))&&(S(!0),At(!0))},$=async ae=>{if(!(!ae||E)){k(null),C(null),j([]);try{const ie=await ae.text();await K.importPack({fileName:ae.name,content:ie})&&S(!0),At(!0)}catch(ie){k(ie instanceof Error?ie.message:String(ie))}}},q=async()=>{var ie;if(E)return;if(k(null),C(null),j([]),!en){(ie=x.current)==null||ie.click();return}await K.importAudio().catch(ke=>(k(ke instanceof Error?ke.message:String(ke)),null))&&(S(!0),At(!0))},se=async ae=>{if(!(!ae||ae.length===0||E)){k(null),C(null),j([]);try{const ie=[];for(const ve of Array.from(ae)){const Se=new Uint8Array(await ve.arrayBuffer());let Ve="";for(let _e=0;_e<Se.length;_e+=32768)Ve+=String.fromCharCode(...Se.subarray(_e,_e+32768));ie.push({fileName:ve.name,contentBase64:btoa(Ve)})}await K.importAudio(ie)&&S(!0),At(!0)}catch(ie){k(ie instanceof Error?ie.message:String(ie))}}},te=async ae=>{if(!E){k(null),j([]);try{await K.importResume(ae),S(!0),At(!0)}catch(ie){k(ie instanceof Error?ie.message:String(ie))}}},G=async ae=>{try{const ie=await K.exportPack(ae);ie!=null&&ie.content&&ie.fileName?(Ee(ie.fileName,ie.content),C(s("import.pack.exported",{path:ie.fileName}))):ie!=null&&ie.path&&C(s("import.pack.exported",{path:ie.path}))}catch(ie){k(ie instanceof Error?ie.message:String(ie))}},Ee=(ae,ie)=>{const ke=new Blob([ie],{type:"application/json"}),ve=URL.createObjectURL(ke),Se=document.createElement("a");Se.href=ve,Se.download=ae,Se.click(),setTimeout(()=>URL.revokeObjectURL(ve),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(ae=>{const ie=ae.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(ae.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:ae.title}),u.jsx("div",{className:"text-caption text-white/40 truncate mt-0.5",children:ae.repoName})]}),ie&&u.jsx("span",{className:"shrink-0 w-5 h-5 rounded-full bg-brand flex items-center justify-center",children:u.jsx(wt,{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:ke=>{ke.stopPropagation(),k(null),C(null),K.exportPack(ae.id).then(ve=>{ve!=null&&ve.content&&ve.fileName?(Ee(ve.fileName,ve.content),C(s("import.pack.exported",{path:ve.fileName}))):ve!=null&&ve.path&&C(s("import.pack.exported",{path:ve.path}))}).catch(ve=>{k(ve instanceof Error?ve.message:String(ve))})},"data-testid":"course-row-export",className:"text-caption text-white/40 hover:text-brand flex items-center gap-0.5",children:[u.jsx(ou,{className:"w-2.5 h-2.5"})," ",s("import.export")]}),u.jsxs("button",{onClick:ke=>{ke.stopPropagation();const ve=ke.currentTarget.getBoundingClientRect();r(ae.id,ae.title,ve)},"data-testid":"course-row-delete",className:"text-caption text-white/40 hover:text-warning flex items-center gap-0.5",children:[u.jsx(Df,{className:"w-2.5 h-2.5"})," ",s("import.delete")]})]})]},ae.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(zi,{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:()=>{K.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"&&w.trim())?u.jsx("div",{className:"text-caption text-white/40 font-mono truncate mb-2.5",children:a==="url"?h.trim():w.trim()}):null,u.jsx("div",{ref:U,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((ae,ie)=>u.jsxs("div",{className:"flex items-start gap-1.5 text-caption",children:[ae.status==="done"?u.jsx(wt,{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:ae.status==="done"?"text-white/40":"text-white/90",children:[ae.msg,ae.status==="working"&&u.jsxs("span",{className:"text-white/35 ml-1",children:["(",s("import.progress.elapsed",{s:Math.floor((Date.now()-ae.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:h1},{k:"markdown",label:s("import.tab.md"),icon:ys},{k:"folder",label:s("import.tab.folder"),icon:i1},{k:"epub",label:s("import.tab.epub"),icon:Kt},{k:"audio",label:s("import.tab.audio"),icon:Wr},{k:"pack",label:s("import.tab.pack"),icon:ou}].map(({k:ae,label:ie,icon:ke})=>u.jsxs("button",{onClick:()=>o(ae),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===ae?"bg-brand/15 text-brand":"text-white/50 hover:text-white/80"}`,children:[u.jsx(ke,{className:"w-3 h-3 shrink-0"}),u.jsx("span",{className:"whitespace-nowrap",style:{fontSize:"clamp(0.75rem, 4cqi, 0.875rem)"},children:ie})]},ae))}),a==="url"?u.jsxs("section",{className:"space-y-2","data-testid":"import-url-section",children:[u.jsx("input",{type:"text",value:h,onChange:ae=>f(ae.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:w,onChange:ae=>A(ae.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:ae=>T(ae.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")}),!en&&u.jsx("input",{type:"text",value:m,onChange:ae=>d(ae.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||!en&&!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")}),!en&&u.jsx("input",{ref:g,type:"file",accept:".epub,application/epub+zip",className:"hidden","data-testid":"import-epub-file",onChange:ae=>{var ie;ee((ie=ae.target.files)==null?void 0:ie[0]),ae.currentTarget.value=""}}),u.jsx("button",{onClick:Z,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")}),!en&&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:ae=>{se(ae.target.files),ae.currentTarget.value=""}}),u.jsx("button",{onClick:q,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")}),!en&&u.jsx("input",{ref:p,type:"file",accept:".json,application/json",className:"hidden","data-testid":"import-pack-file",onChange:ae=>{var ie;$((ie=ae.target.files)==null?void 0:ie[0]),ae.currentTarget.value=""}}),u.jsx("button",{onClick:Q,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 te(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(wt,{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 G(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 Vb({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:Bb(i,s,a,n)},[e,t,n]),u.jsx("canvas",{ref:r,className:"map-sky-canvas","aria-hidden":"true"})}function $b({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=Hb(o,l,n,()=>{var T,w;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 S=(T=A.closest("[data-node-id]"))==null?void 0:T.getAttribute("data-node-id"),_=S?(w=s==null?void 0:s.current)==null?void 0:w.get(S):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 qb({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($=>$.parentId===e.id).sort(($,q)=>$.orderIdx-q.orderIdx),g=p.filter($=>$.type==="lesson"),x=g.length>0&&g.every($=>{var q;return(((q=r[$.id])==null?void 0:q.mastery)??0)>=Ff}),b=v.useRef(null),[T,w]=v.useState(268);v.useEffect(()=>{if(!b.current)return;const $=()=>{var te;const se=((te=b.current)==null?void 0:te.clientWidth)??268;w(se>0?se:268)};$();const q=new ResizeObserver($);return q.observe(b.current),()=>q.disconnect()},[]);const A=eb(p.length,T,e.id),E=A.height,S=110,_=76,k=v.useRef(null),N=v.useRef(new Map),C=v.useRef(0),R=v.useRef(null),M=v.useRef(0),O=p.map($=>$.id).join(","),L=p.map($=>{var q;return($.type==="exam"?!x:(((q=r[$.id])==null?void 0:q.status)??"locked")==="locked")?1:0}).join("");v.useEffect(()=>{var ze,Re;if(!o||p.length===0||T<=0)return;const $=b.current,q=c.current;if(!$||!q)return;let se;const te=p[p.length-1];if((te==null?void 0:te.type)==="exam"){const ge=(Re=(ze=$.closest("section"))==null?void 0:ze.nextElementSibling)==null?void 0:Re.querySelector(".map-signpost");ge&&(se={x:Fs(`${e.id}:next`,T),y:ge.getBoundingClientRect().top-$.getBoundingClientRect().top})}const G=gb({nodes:A.nodes.map((ge,J)=>{const ce=p[J];return{id:ce.id,x:ge.x,y:ge.y,isExam:ce.type==="exam",locked:I(ce),spawn:(()=>{const xe=N.current.get(ce.id);return xe?xb(xe,C.current,T):void 0})()}}),width:T,height:A.height+40,weather:l,anchorKnotX:Fs(`${e.id}:knot`,T),nextKnot:se});k.current=G,yx(e.id,G,$);const Ee=$.querySelector("[data-next-knot]");Ee&&(G.nextKnot?(Ee.setAttribute("cx",String(G.nextKnot.x)),Ee.setAttribute("cy",String(G.nextKnot.y))):Ee.setAttribute("opacity","0"));const ae=$.querySelector("[data-exam-rope]");ae&&!G.nextKnot&&ae.setAttribute("opacity","0");const ie=new Map;for(const ge of $.querySelectorAll("[data-node-id]"))ge.dataset.nodeId&&ie.set(ge.dataset.nodeId,ge);const ke=Array.from($.querySelectorAll("[data-rope]")),ve=Array.from($.querySelectorAll("[data-pulse]")),Se=Array.from($.querySelectorAll("[data-field]"));let Ve=!0;const _e=new IntersectionObserver(ge=>{for(const J of ge)Ve=J.isIntersecting},{root:q,rootMargin:"200px 0px 200px 0px"});_e.observe($);const De=520,le=[];let Me=0,Be=performance.now();const Ue=ge=>{var ye;Me=requestAnimationFrame(Ue);const J=Math.min(50,ge-Be);if(Be=ge,!Ve)return;G.step(J);for(const re of G.balls){const be=ie.get(re.nodeId);be&&(be.style.transform=cb(re.body.position.x-re.layoutX,re.body.position.y-re.layoutY,re.squash,re.squashAngle)),re.squash=lb(re.squash,J),(ye=d.current)==null||ye.set(re.nodeId,re.snow)}const ce=re=>{if(re==="__anchor")return G.anchor;if(re==="__next")return G.nextKnot??G.anchor;const be=G.ball(re);if(be)return{x:be.body.position.x,y:be.body.position.y+_t*nn};const Ie=p.findIndex(we=>we.id===re),V=Ie>=0?A.nodes[Ie]:void 0;return V?{x:V.x,y:V.y+_t*nn}:{x:0,y:0}};for(let re=0;re<G.links.length&&re<ke.length;re++){const be=G.links[re],Ie=[ce(be.from)];for(const V of be.particles)Ie.push({x:V.position.x,y:V.position.y});Ie.push(ce(be.to)),ke[re].setAttribute("d",ob(Ie))}for(let re=0;re<G.balls.length&&re<Se.length;re++){const be=G.balls[re],Ie=Se[re];be.field>.03?(Ie.setAttribute("cx",String(be.body.position.x)),Ie.setAttribute("cy",String(be.body.position.y)),Ie.setAttribute("r",String(_t+4+be.field*5)),Ie.setAttribute("opacity",String((.3*be.field).toFixed(3)))):Ie.setAttribute("opacity","0")}const xe=G.drainImpacts();for(const re of xe)le.push({x:re.x,y:re.y,t0:ge,s:Math.min(1,re.speed/14)});for(let re=le.length-1;re>=0;re--)ge-le[re].t0>De&&le.splice(re,1);for(let re=0;re<ve.length;re++){const be=le[re],Ie=ve[re];if(!be){Ie.setAttribute("opacity","0");continue}const V=(ge-be.t0)/De;Ie.setAttribute("cx",String(be.x)),Ie.setAttribute("cy",String(be.y)),Ie.setAttribute("r",String(6+V*(14+be.s*14))),Ie.setAttribute("opacity",String(.55*(1-V))),Ie.setAttribute("stroke-width",String(2+be.s*1.5))}const fe=G.drainFlakes();if((xe.length>0||fe.length>0)&&h.current){const re=$.getBoundingClientRect(),be=h.current.getBoundingClientRect(),Ie=V=>({x:V.x+re.left-be.left,y:V.y+re.top-be.top});xe.length>0&&f(xe.map(V=>({...Ie(V),speed:V.speed}))),fe.length>0&&m(fe.map(V=>({...Ie(V),vx:V.vx,vy:V.vy,amount:V.amount})))}};return Me=requestAnimationFrame(Ue),()=>{cancelAnimationFrame(Me),_e.disconnect();for(const ge of G.balls)N.current.set(ge.nodeId,{x:ge.body.position.x,y:ge.body.position.y,vx:ge.body.velocity.x,vy:ge.body.velocity.y});C.current=T,vx(e.id),G.dispose(),k.current=null;for(const ge of ie.values())ge.style.transform=""}},[o,T,O,L,e.id,l]);const I=$=>{var q;return $?$.type==="exam"?!x:(((q=r[$.id])==null?void 0:q.status)??"locked")==="locked":!0},j=($,q)=>{if(!(!k.current||$.button!==0||I(p.find(G=>G.id===q))||!b.current)){try{$.currentTarget.setPointerCapture($.pointerId)}catch{}M.current=0,R.current={track:{startX:$.clientX,startY:$.clientY},id:$.pointerId,dragging:!1,nodeId:q}}},F=$=>{const q=R.current,se=k.current;if(!q||!se||$.pointerId!==q.id)return;const te=b.current;if(!te||(!q.dragging&&hu(q.track,$.clientX,$.clientY)==="drag"&&(q.dragging=!0,$.currentTarget.style.zIndex="40",se.beginDrag(q.nodeId,$.clientX-te.getBoundingClientRect().left,$.clientY-te.getBoundingClientRect().top)),!q.dragging))return;const G=te.getBoundingClientRect();se.moveDrag($.clientX-G.left,$.clientY-G.top)},U=$=>{var se;const q=R.current;if(!(!q||$.pointerId!==q.id)){if((se=k.current)==null||se.endDrag(),$.currentTarget.style.zIndex="",hu(q.track,$.clientX,$.clientY)==="drag")M.current=Date.now()+300;else{const te=p.find(G=>G.id===q.nodeId);te&&Date.now()>=M.current&&!I(te)&&a(te.id)}R.current=null}},W=$=>{const q=p[$],se=q?r[q.id]:void 0,te=(se==null?void 0:se.status)==="mastered"||(se==null?void 0:se.status)==="in_progress"||(se==null?void 0:se.status)==="available";return{stroke:te?"var(--brand)":"var(--ink-faint)",strokeWidth:te?4:2.5,strokeOpacity:te?.6:.5,strokeDasharray:te?"none":"3 7"}},D=A.nodes[0]?{x:Fs(`${e.id}:knot`,T),y:Ti}:{x:T/2,y:Ti},Z=p[p.length-1],ee=(Z==null?void 0:Z.type)==="exam",P=A.nodes[A.nodes.length-1],Q=ee&&P?{x:Fs(`${e.id}:next`,T),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*nn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(0)}),A.segments.map(($,q)=>u.jsx("path",{"data-rope":q+1,d:`M ${$.from.x} ${$.from.y+_t*nn} L ${$.to.x} ${$.to.y+_t*nn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W($.index)},$.index)),Q&&P&&u.jsxs(u.Fragment,{children:[u.jsx("path",{"data-rope":A.segments.length+1,"data-exam-rope":!0,d:`M ${Q.x} ${Q.y} L ${P.x} ${P.y+_t*nn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(p.length-1)}),u.jsx("circle",{"data-next-knot":!0,cx:Q.x,cy:Q.y,r:3.5,fill:"#ffc800",opacity:.9})]}),Array.from({length:8},($,q)=>u.jsx("circle",{"data-pulse":q,cx:0,cy:0,r:0,fill:"none",stroke:"white",opacity:0},q)),p.map(($,q)=>u.jsx("circle",{"data-field":q,cx:0,cy:0,r:0,fill:"none",stroke:"#1cb0f6",strokeWidth:2,opacity:0},`f-${$.id}`))]}):A.segments.map($=>{const q=Wb(p[$.index],r);return u.jsx("path",{d:tb($),stroke:q?"var(--brand)":"var(--ink-faint)",strokeWidth:q?4:2.5,strokeOpacity:q?.6:.5,fill:"none",strokeLinecap:"round",strokeDasharray:q?"none":"3 7",style:q?{pathLength:1,animation:"path-draw 600ms var(--ease-out-expo)"}:void 0},$.index)})}),p.map(($,q)=>{const se=A.nodes[q];if(!se)return null;const te=Fo($.id),G=`${te%40/10}s`,Ee=`${5+te%30/10}s`;return u.jsx("div",{"data-node-id":$.id,"data-noswipe":"",className:o?`absolute hover:z-30 will-change-transform ${I($)?"cursor-not-allowed":"cursor-grab active:cursor-grabbing"}`:"absolute balloon-bob hover:z-30",style:{left:se.x-S/2,top:se.y-_/2+10,width:S,...o?{touchAction:"pan-y"}:{"--bob-delay":G,"--bob-duration":Ee}},onPointerDown:o?ae=>j(ae,$.id):void 0,onPointerMove:o?F:void 0,onPointerUp:o?U:void 0,onPointerCancel:o?U:void 0,children:u.jsx(Yb,{lesson:$,progress:r[$.id],isSelected:$.id===i,isDue:s.has($.id),chapterLessonsMastered:x,onClick:()=>{Date.now()<M.current||a($.id)}})},$.id)})]})]})}function Wb(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 Yb({lesson:e,progress:t,isSelected:n,isDue:r,chapterLessonsMastered:i,onClick:s}){const a=Ne(),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":Kb(l>0):Gb(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(dr,{"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(Kt,{"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 Gb(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 Kb(e){return e?"lesson-bubble exam-bubble-passed":"lesson-bubble exam-bubble"}function Xb({available:e,current:t,onChange:n}){const r=Ne(),[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(o1,{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 Qb=500,Sn=8;function Jb(){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 w;if(o())return;const b=(w=x.target)==null?void 0:w.closest("[data-tooltip]"),T=b==null?void 0:b.getAttribute("data-tooltip");if(T){t(T),r({mode:"cursor",x:x.clientX,y:x.clientY});return}t(null)},[o]),h=v.useCallback(x=>{var T,w;if(o())return;((w=(T=x.target)==null?void 0:T.closest)==null?void 0:w.call(T,"[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)},T=S=>{var C;if(!o()||S.touches.length!==1)return b();const _=(C=S.target)==null?void 0:C.closest("[data-tooltip]"),k=_==null?void 0:_.getAttribute("data-tooltip");if(!k||!_)return b();const N=_;b(),x=setTimeout(()=>{N.isConnected&&(t(k),r({mode:"rect",x:0,y:0,rect:N.getBoundingClientRect()}))},Qb)},w=()=>{b(),t(S=>S&&null)},A=()=>b(),E=()=>{b(),t(null)};return document.addEventListener("touchstart",T,{passive:!0}),document.addEventListener("touchend",w,{passive:!0}),document.addEventListener("touchmove",A,{passive:!0}),document.addEventListener("touchcancel",E,{passive:!0}),()=>{b(),document.removeEventListener("touchstart",T),document.removeEventListener("touchend",w),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<Sn&&(p=x.bottom+6)}else d=n.x,p=n.y-6,g="translate(0, -100%)";return d=Math.min(Math.max(d,Sn),Math.max(Sn,f-i.w-Sn)),p=Math.min(Math.max(p,Sn),Math.max(Sn,m-i.h-Sn)),Bl.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 yu(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 Xf(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Zb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ey=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ty={};function vu(e,t){return(ty.jsx?ey:Zb).test(e)}const ny=/[ \t\n\f\r]/g;function ry(e){return typeof e=="object"?e.type==="text"?Eu(e.value):!1:Eu(e)}function Eu(e){return e.replace(ny,"")===""}class ks{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ks.prototype.normal={};ks.prototype.property={};ks.prototype.space=void 0;function Qf(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ks(n,r,t)}function us(e){return e.toLowerCase()}class yt{constructor(t,n){this.attribute=n,this.property=t}}yt.prototype.attribute="";yt.prototype.booleanish=!1;yt.prototype.boolean=!1;yt.prototype.commaOrSpaceSeparated=!1;yt.prototype.commaSeparated=!1;yt.prototype.defined=!1;yt.prototype.mustUseProperty=!1;yt.prototype.number=!1;yt.prototype.overloadedBoolean=!1;yt.prototype.property="";yt.prototype.spaceSeparated=!1;yt.prototype.space=void 0;let sy=0;const Le=Gn(),tt=Gn(),Bo=Gn(),he=Gn(),qe=Gn(),Hn=Gn(),Tt=Gn();function Gn(){return 2**++sy}const Ho=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:tt,commaOrSpaceSeparated:Tt,commaSeparated:Hn,number:he,overloadedBoolean:Bo,spaceSeparated:qe},Symbol.toStringTag,{value:"Module"})),Ra=Object.keys(Ho);class zl extends yt{constructor(t,n,r,i){let s=-1;if(super(t,n),ku(this,"space",i),typeof r=="number")for(;++s<Ra.length;){const a=Ra[s];ku(this,Ra[s],(r&Ho[a])===Ho[a])}}}zl.prototype.defined=!0;function ku(e,t,n){n&&(e[t]=n)}function Er(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new zl(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[us(r)]=r,n[us(s.attribute)]=r}return new ks(t,n,e.space)}const Jf=Er({properties:{ariaActiveDescendant:null,ariaAtomic:tt,ariaAutoComplete:null,ariaBusy:tt,ariaChecked:tt,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:qe,ariaCurrent:null,ariaDescribedBy:qe,ariaDetails:null,ariaDisabled:tt,ariaDropEffect:qe,ariaErrorMessage:null,ariaExpanded:tt,ariaFlowTo:qe,ariaGrabbed:tt,ariaHasPopup:null,ariaHidden:tt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qe,ariaLevel:he,ariaLive:null,ariaModal:tt,ariaMultiLine:tt,ariaMultiSelectable:tt,ariaOrientation:null,ariaOwns:qe,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:tt,ariaReadOnly:tt,ariaRelevant:null,ariaRequired:tt,ariaRoleDescription:qe,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:tt,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Zf(e,t){return t in e?e[t]:t}function em(e,t){return Zf(e,t.toLowerCase())}const iy=Er({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Hn,acceptCharset:qe,accessKey:qe,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alpha:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:qe,autoFocus:Le,autoPlay:Le,blocking:qe,capture:null,charSet:null,checked:Le,cite:null,className:qe,closedBy:null,colorSpace:null,cols:he,colSpan:he,command:null,commandFor:null,content:null,contentEditable:tt,controls:Le,controlsList:qe,coords:he|Hn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:Bo,draggable:tt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:qe,height:he,hidden:Bo,high:he,href:null,hrefLang:null,htmlFor:qe,httpEquiv:qe,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:qe,itemRef:qe,itemScope:Le,itemType:qe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,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:Le,optimum:he,pattern:null,ping:qe,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:qe,required:Le,reversed:Le,rows:he,rowSpan:he,sandbox:qe,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootCustomElementRegistry:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shadowRootSerializable:Le,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:tt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:tt,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qe,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:tt,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Le,disablePictureInPicture:Le,disableRemotePlayback:Le,exportParts:Hn,part:qe,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:em}),ay=Er({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:Tt,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:qe,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:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,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:Hn,g2:Hn,glyphName:Hn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:Tt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,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:he,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:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tt,rev:Tt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tt,requiredFeatures:Tt,requiredFonts:Tt,requiredFormats:Tt,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:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:Tt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tt,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Zf}),tm=Er({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()}}),nm=Er({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:em}),rm=Er({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),oy={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"},ly=/[A-Z]/g,Tu=/-[a-z]/g,cy=/^data[-\w.:]+$/i;function Yi(e,t){const n=us(t);let r=t,i=yt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&cy.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Tu,dy);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Tu.test(s)){let a=s.replace(ly,uy);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=zl}return new i(r,t)}function uy(e){return"-"+e.toLowerCase()}function dy(e){return e.charAt(1).toUpperCase()}const Ts=Qf([Jf,iy,tm,nm,rm],"html"),yn=Qf([Jf,ay,tm,nm,rm],"svg");function wu(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function sm(e){return e.join(" ").trim()}var er={},La,Su;function hy(){if(Su)return La;Su=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=`
|
|
473
|
-
`,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 T=1,w=1;function A(L){var I=L.match(t);I&&(T+=I.length);var j=L.lastIndexOf(l);w=~j?L.length-j:w+L.length}function E(){var L={line:T,column:w};return function(I){return I.position=new S(L),N(),I}}function S(L){this.start=L,this.end={line:T,column:w},this.source=b.source}S.prototype.content=x;function _(L){var I=new Error(b.source+":"+T+":"+w+": "+L);if(I.reason=L,I.filename=b.source,I.line=T,I.column=w,I.source=x,!b.silent)throw I}function k(L){var I=L.exec(x);if(I){var j=I[0];return A(j),x=x.slice(j.length),I}}function N(){k(n)}function C(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 w+=2,A(j),x=x.slice(I),w+=2,L({type:m,comment:j})}}function M(){var L=E(),I=k(r);if(I){if(R(),!k(i))return _("property missing ':'");var j=k(s),F=L({type:d,property:g(I[0].replace(e,f)),value:j?g(j[0].replace(e,f)):f});return k(a),F}}function O(){var L=[];C(L);for(var I;I=M();)I!==!1&&(L.push(I),C(L));return L}return N(),O()}function g(x){return x?x.replace(o,f):f}return La=p,La}var Cu;function fy(){if(Cu)return er;Cu=1;var e=er&&er.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(er,"__esModule",{value:!0}),er.default=n;const t=e(hy());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 er}var Lr={},Au;function my(){if(Au)return Lr;Au=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.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 Lr.camelCase=l,Lr}var Pr,Nu;function py(){if(Nu)return Pr;Nu=1;var e=Pr&&Pr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(fy()),n=my();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,Pr=r,Pr}var gy=py();const xy=Il(gy),Gi=im("end"),Qt=im("start");function im(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 am(e){const t=Qt(e),n=Gi(e);if(t&&n)return{start:t,end:n}}function Gr(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?Uo(e):""}function Uo(e){return Iu(e&&e.line)+":"+Iu(e&&e.column)}function _u(e){return Uo(e&&e.start)+"-"+Uo(e&&e.end)}function Iu(e){return e&&typeof e=="number"?e:1}class ut 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=Gr(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}}ut.prototype.file="";ut.prototype.name="";ut.prototype.reason="";ut.prototype.message="";ut.prototype.stack="";ut.prototype.column=void 0;ut.prototype.line=void 0;ut.prototype.ancestors=void 0;ut.prototype.cause=void 0;ut.prototype.fatal=void 0;ut.prototype.place=void 0;ut.prototype.ruleId=void 0;ut.prototype.source=void 0;const Vl={}.hasOwnProperty,by=new Map,yy=/[A-Z]/g,vy=new Set(["table","tbody","thead","tfoot","tr"]),Ey=new Set(["td","th"]),om="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ky(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=Iy(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=_y(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"?yn:Ts,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=lm(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function lm(e,t,n){if(t.type==="element")return Ty(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return wy(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Cy(e,t,n);if(t.type==="mdxjsEsm")return Sy(e,t);if(t.type==="root")return Ay(e,t,n);if(t.type==="text")return Ny(e,t)}function Ty(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=yn,e.schema=i),e.ancestors.push(t);const s=um(e,t.tagName,!1),a=My(e,t);let o=ql(e,t);return vy.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!ry(l):!0})),cm(e,a,s,t),$l(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function wy(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)}ds(e,t.position)}function Sy(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ds(e,t.position)}function Cy(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=yn,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:um(e,t.name,!0),a=Ry(e,t),o=ql(e,t);return cm(e,a,s,t),$l(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Ay(e,t,n){const r={};return $l(r,ql(e,t)),e.create(t,e.Fragment,r,n)}function Ny(e,t){return t.value}function cm(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $l(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _y(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 Iy(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=Qt(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 My(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Vl.call(t.properties,i)){const s=Ly(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Ey.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 Ry(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 ds(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 ds(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ql(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:by;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=lm(e,s,a);o!==void 0&&n.push(o)}return n}function Ly(e,t,n){const r=Yi(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Xf(n):sm(n)),r.property==="style"){let i=typeof n=="object"?n:Py(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Dy(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?oy[r.property]||r.property:r.attribute,n]}}function Py(e,t){try{return xy(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ut("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=om+"#cannot-parse-style-attribute",i}}function um(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=vu(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=vu(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Vl.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ds(e)}function ds(e,t){const n=new ut("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=om+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Dy(e){const t={};let n;for(n in e)Vl.call(e,n)&&(t[Oy(n)]=e[n]);return t}function Oy(e){let t=e.replace(yy,jy);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jy(e){return"-"+e.toLowerCase()}const Pa={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"]},Fy={};function Wl(e,t){const n=Fy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return dm(e,r,i)}function dm(e,t,n){if(By(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 Mu(e.children,t,n)}return Array.isArray(e)?Mu(e,t,n):""}function Mu(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=dm(e[i],t,n);return r.join("")}function By(e){return!!(e&&typeof e=="object")}const Ru=document.createElement("i");function Yl(e){const t="&"+e+";";Ru.innerHTML=t;const n=Ru.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function St(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 It(e,t){return e.length>0?(St(e,e.length,0,t),e):t}const Lu={}.hasOwnProperty;function hm(e){const t={};let n=-1;for(;++n<e.length;)Hy(t,e[n]);return t}function Hy(e,t){let n;for(n in t){const i=(Lu.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){Lu.call(i,a)||(i[a]=[]);const o=s[a];Uy(i[a],Array.isArray(o)?o:o?[o]:[])}}}function Uy(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);St(e,0,0,r)}function fm(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 Bt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ft=vn(/[A-Za-z]/),ct=vn(/[\dA-Za-z]/),zy=vn(/[#-'*+\--9=?A-Z^-~]/);function wi(e){return e!==null&&(e<32||e===127)}const zo=vn(/\d/),Vy=vn(/[\dA-Fa-f]/),$y=vn(/[!-/:-@[-`{-~]/);function Ae(e){return e!==null&&e<-2}function Ge(e){return e!==null&&(e<0||e===32)}function Fe(e){return e===-2||e===-1||e===32}const Ki=vn(new RegExp("\\p{P}|\\p{S}","u")),Wn=vn(/\s/);function vn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function kr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&ct(e.charCodeAt(n+1))&&ct(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 He(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return Fe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Fe(l)&&s++<i?(e.consume(l),o):(e.exit(n),t(l))}}const qy={tokenize:Wy};function Wy(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"),He(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 Ae(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),a)}}const Yy={tokenize:Gy},Pu={tokenize:Ky};function Gy(e){const t=this,n=[];let r=0,i,s,a;return o;function o(w){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&T();const A=t.events.length;let E=A,S;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){S=t.events[E][1].end;break}b(r);let _=A;for(;_<t.events.length;)t.events[_][1].end={...S},_++;return St(t.events,E+1,0,t.events.slice(A)),t.events.length=_,c(w)}return o(w)}function c(w){if(r===n.length){if(!i)return m(w);if(i.currentConstruct&&i.currentConstruct.concrete)return p(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Pu,h,f)(w)}function h(w){return i&&T(),b(r),m(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,p(w)}function m(w){return t.containerState={},e.attempt(Pu,d,p)(w)}function d(w){return r++,n.push([t.currentConstruct,t.containerState]),m(w)}function p(w){if(w===null){i&&T(),b(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(w)}function g(w){if(w===null){x(e.exit("chunkFlow"),!0),b(0),e.consume(w);return}return Ae(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(w),g)}function x(w,A){const E=t.sliceStream(w);if(A&&E.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(E),t.parser.lazy[w.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<a&&(!i.events[S][1].end||i.events[S][1].end.offset>a))return;const _=t.events.length;let k=_,N,C;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(N){C=t.events[k][1].end;break}N=!0}for(b(r),S=_;S<t.events.length;)t.events[S][1].end={...C},S++;St(t.events,k+1,0,t.events.slice(_)),t.events.length=S}}function b(w){let A=n.length;for(;A-- >w;){const E=n[A];t.containerState=E[1],E[0].exit.call(t,e)}n.length=w}function T(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ky(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function gr(e){if(e===null||Ge(e)||Wn(e))return 1;if(Ki(e))return 2}function Xi(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 Vo={name:"attention",resolveAll:Xy,tokenize:Qy};function Xy(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};Du(f,-l),Du(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=It(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=It(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),c=It(c,Xi(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=It(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=It(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,St(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 Qy(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=gr(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=gr(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 Du(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Jy={name:"autolink",tokenize:Zy};function Zy(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 ft(d)?(e.consume(d),a):d===64?n(d):c(d)}function a(d){return d===43||d===45||d===46||ct(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||ct(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||wi(d)?n(d):(e.consume(d),l)}function c(d){return d===64?(e.consume(d),h):zy(d)?(e.consume(d),c):n(d)}function h(d){return ct(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||ct(d))&&r++<63){const p=d===45?m:f;return e.consume(d),p}return n(d)}}const ws={partial:!0,tokenize:e2};function e2(e,t,n){return r;function r(s){return Fe(s)?He(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ae(s)?t(s):n(s)}}const mm={continuation:{tokenize:n2},exit:r2,name:"blockQuote",tokenize:t2};function t2(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 Fe(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function n2(e,t,n){const r=this;return i;function i(a){return Fe(a)?He(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(mm,t,n)(a)}}function r2(e){e.exit("blockQuote")}const pm={name:"characterEscape",tokenize:s2};function s2(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 $y(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const gm={name:"characterReference",tokenize:i2};function i2(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=ct,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=Vy,h):(e.enter("characterReferenceValue"),s=7,a=zo,h(f))}function h(f){if(f===59&&i){const m=e.exit("characterReferenceValue");return a===ct&&!Yl(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 Ou={partial:!0,tokenize:o2},ju={concrete:!0,name:"codeFenced",tokenize:a2};function a2(e,t,n){const r=this,i={partial:!0,tokenize:E};let s=0,a=0,o;return l;function l(S){return c(S)}function c(S){const _=r.events[r.events.length-1];return s=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,o=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(S)}function h(S){return S===o?(a++,e.consume(S),h):a<3?n(S):(e.exit("codeFencedFenceSequence"),Fe(S)?He(e,f,"whitespace")(S):f(S))}function f(S){return S===null||Ae(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(Ou,g,A)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Ae(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):Fe(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,d,"whitespace")(S)):S===96&&S===o?n(S):(e.consume(S),m)}function d(S){return S===null||Ae(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||Ae(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(S)):S===96&&S===o?n(S):(e.consume(S),p)}function g(S){return e.attempt(i,A,x)(S)}function x(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),b}function b(S){return s>0&&Fe(S)?He(e,T,"linePrefix",s+1)(S):T(S)}function T(S){return S===null||Ae(S)?e.check(Ou,g,A)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||Ae(S)?(e.exit("codeFlowValue"),T(S)):(e.consume(S),w)}function A(S){return e.exit("codeFenced"),t(S)}function E(S,_,k){let N=0;return C;function C(I){return S.enter("lineEnding"),S.consume(I),S.exit("lineEnding"),R}function R(I){return S.enter("codeFencedFence"),Fe(I)?He(S,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):M(I)}function M(I){return I===o?(S.enter("codeFencedFenceSequence"),O(I)):k(I)}function O(I){return I===o?(N++,S.consume(I),O):N>=a?(S.exit("codeFencedFenceSequence"),Fe(I)?He(S,L,"whitespace")(I):L(I)):k(I)}function L(I){return I===null||Ae(I)?(S.exit("codeFencedFence"),_(I)):k(I)}}}function o2(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 Da={name:"codeIndented",tokenize:c2},l2={partial:!0,tokenize:u2};function c2(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),He(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):Ae(c)?e.attempt(l2,a,l)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||Ae(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),o)}function l(c){return e.exit("codeIndented"),t(c)}}function u2(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Ae(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):He(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):Ae(a)?i(a):n(a)}}const d2={name:"codeText",previous:f2,resolve:h2,tokenize:m2};function h2(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 f2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function m2(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)):Ae(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||Ae(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 p2{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&&Dr(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),Dr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Dr(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);Dr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Dr(this.left,n.reverse())}}}function Dr(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 xm(e){const t={};let n=-1,r,i,s,a,o,l,c;const h=new p2(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,g2(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 St(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function g2(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]),T=s.pop();l.push([T,T+b.length-1]),e.splice(T,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 x2={resolve:y2,tokenize:v2},b2={partial:!0,tokenize:E2};function y2(e){return xm(e),e}function v2(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):Ae(o)?e.check(b2,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 E2(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),He(e,s,"linePrefix")}function s(a){if(a===null||Ae(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 bm(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||wi(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||Ae(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||Ge(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||wi(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 ym(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):Ae(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||Ae(d)||o++>999?(e.exit("chunkString"),h(d)):(e.consume(d),l||(l=!Fe(d)),d===92?m:f)}function m(d){return d===91||d===92||d===93?(e.consume(d),o++,f):f(d)}}function vm(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):Ae(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),He(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===a||m===null||Ae(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 Kr(e,t){let n;return r;function r(i){return Ae(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Fe(i)?He(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const k2={name:"definition",tokenize:w2},T2={partial:!0,tokenize:S2};function w2(e,t,n){const r=this;let i;return s;function s(d){return e.enter("definition"),a(d)}function a(d){return ym.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function o(d){return i=Bt(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 Ge(d)?Kr(e,c)(d):c(d)}function c(d){return bm(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function h(d){return e.attempt(T2,f,f)(d)}function f(d){return Fe(d)?He(e,m,"whitespace")(d):m(d)}function m(d){return d===null||Ae(d)?(e.exit("definition"),r.parser.defined.push(i),t(d)):n(d)}}function S2(e,t,n){return r;function r(o){return Ge(o)?Kr(e,i)(o):n(o)}function i(o){return vm(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return Fe(o)?He(e,a,"whitespace")(o):a(o)}function a(o){return o===null||Ae(o)?t(o):n(o)}}const C2={name:"hardBreakEscape",tokenize:A2};function A2(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ae(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const N2={name:"headingAtx",resolve:_2,tokenize:I2};function _2(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"},St(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function I2(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||Ge(h)?(e.exit("atxHeadingSequence"),o(h)):n(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||Ae(h)?(e.exit("atxHeading"),t(h)):Fe(h)?He(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||Ge(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),c)}}const M2=["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"],Fu=["pre","script","style","textarea"],R2={concrete:!0,name:"htmlFlow",resolveTo:D2,tokenize:O2},L2={partial:!0,tokenize:F2},P2={partial:!0,tokenize:j2};function D2(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 O2(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):ft(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):ft(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 Q="CDATA[";return P===Q.charCodeAt(o++)?(e.consume(P),o===Q.length?r.interrupt?t:M:p):n(P)}function g(P){return ft(P)?(e.consume(P),a=String.fromCharCode(P),x):n(P)}function x(P){if(P===null||P===47||P===62||Ge(P)){const Q=P===47,$=a.toLowerCase();return!Q&&!s&&Fu.includes($)?(i=1,r.interrupt?t(P):M(P)):M2.includes(a.toLowerCase())?(i=6,Q?(e.consume(P),b):r.interrupt?t(P):M(P)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):s?T(P):w(P))}return P===45||ct(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 T(P){return Fe(P)?(e.consume(P),T):C(P)}function w(P){return P===47?(e.consume(P),C):P===58||P===95||ft(P)?(e.consume(P),A):Fe(P)?(e.consume(P),w):C(P)}function A(P){return P===45||P===46||P===58||P===95||ct(P)?(e.consume(P),A):E(P)}function E(P){return P===61?(e.consume(P),S):Fe(P)?(e.consume(P),E):w(P)}function S(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),l=P,_):Fe(P)?(e.consume(P),S):k(P)}function _(P){return P===l?(e.consume(P),l=null,N):P===null||Ae(P)?n(P):(e.consume(P),_)}function k(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Ge(P)?E(P):(e.consume(P),k)}function N(P){return P===47||P===62||Fe(P)?w(P):n(P)}function C(P){return P===62?(e.consume(P),R):n(P)}function R(P){return P===null||Ae(P)?M(P):Fe(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),F):P===62&&i===4?(e.consume(P),Z):P===63&&i===3?(e.consume(P),D):P===93&&i===5?(e.consume(P),W):Ae(P)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(L2,ee,O)(P)):P===null||Ae(P)?(e.exit("htmlFlowData"),O(P)):(e.consume(P),M)}function O(P){return e.check(P2,L,ee)(P)}function L(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),I}function I(P){return P===null||Ae(P)?O(P):(e.enter("htmlFlowData"),M(P))}function j(P){return P===45?(e.consume(P),D):M(P)}function F(P){return P===47?(e.consume(P),a="",U):M(P)}function U(P){if(P===62){const Q=a.toLowerCase();return Fu.includes(Q)?(e.consume(P),Z):M(P)}return ft(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),U):M(P)}function W(P){return P===93?(e.consume(P),D):M(P)}function D(P){return P===62?(e.consume(P),Z):P===45&&i===2?(e.consume(P),D):M(P)}function Z(P){return P===null||Ae(P)?(e.exit("htmlFlowData"),ee(P)):(e.consume(P),Z)}function ee(P){return e.exit("htmlFlow"),t(P)}}function j2(e,t,n){const r=this;return i;function i(a){return Ae(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 F2(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ws,t,n)}}const B2={name:"htmlText",tokenize:H2};function H2(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),w):ft(D)?(e.consume(D),k):n(D)}function c(D){return D===45?(e.consume(D),h):D===91?(e.consume(D),s=0,p):ft(D)?(e.consume(D),T):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):Ae(D)?(a=f,F(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 Z="CDATA[";return D===Z.charCodeAt(s++)?(e.consume(D),s===Z.length?g:p):n(D)}function g(D){return D===null?n(D):D===93?(e.consume(D),x):Ae(D)?(a=g,F(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 T(D){return D===null||D===62?j(D):Ae(D)?(a=T,F(D)):(e.consume(D),T)}function w(D){return D===null?n(D):D===63?(e.consume(D),A):Ae(D)?(a=w,F(D)):(e.consume(D),w)}function A(D){return D===62?j(D):w(D)}function E(D){return ft(D)?(e.consume(D),S):n(D)}function S(D){return D===45||ct(D)?(e.consume(D),S):_(D)}function _(D){return Ae(D)?(a=_,F(D)):Fe(D)?(e.consume(D),_):j(D)}function k(D){return D===45||ct(D)?(e.consume(D),k):D===47||D===62||Ge(D)?N(D):n(D)}function N(D){return D===47?(e.consume(D),j):D===58||D===95||ft(D)?(e.consume(D),C):Ae(D)?(a=N,F(D)):Fe(D)?(e.consume(D),N):j(D)}function C(D){return D===45||D===46||D===58||D===95||ct(D)?(e.consume(D),C):R(D)}function R(D){return D===61?(e.consume(D),M):Ae(D)?(a=R,F(D)):Fe(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):Ae(D)?(a=M,F(D)):Fe(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):Ae(D)?(a=O,F(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||Ge(D)?N(D):(e.consume(D),L)}function I(D){return D===47||D===62||Ge(D)?N(D):n(D)}function j(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function F(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),U}function U(D){return Fe(D)?He(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 Gl={name:"labelEnd",resolveAll:$2,resolveTo:q2,tokenize:W2},U2={tokenize:Y2},z2={tokenize:G2},V2={tokenize:K2};function $2(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&&St(e,0,e.length,n),e}function q2(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=It(o,e.slice(s+1,s+r+3)),o=It(o,[["enter",h,t]]),o=It(o,Xi(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),o=It(o,[["exit",h,t],e[a-2],e[a-1],["exit",c,t]]),o=It(o,e.slice(a+1)),o=It(o,[["exit",l,t]]),St(e,s,e.length,o),e}function W2(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(Bt(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(U2,h,a?h:f)(m):m===91?e.attempt(z2,h,a?c:f)(m):a?h(m):f(m)}function c(m){return e.attempt(V2,h,f)(m)}function h(m){return t(m)}function f(m){return s._balanced=!0,n(m)}}function Y2(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 Ge(f)?Kr(e,s)(f):s(f)}function s(f){return f===41?h(f):bm(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Ge(f)?Kr(e,l)(f):h(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?vm(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):h(f)}function c(f){return Ge(f)?Kr(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 G2(e,t,n){const r=this;return i;function i(o){return ym.call(r,e,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(Bt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function K2(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 X2={name:"labelStartImage",resolveAll:Gl.resolveAll,tokenize:Q2};function Q2(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 J2={name:"labelStartLink",resolveAll:Gl.resolveAll,tokenize:Z2};function Z2(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 Oa={name:"lineEnding",tokenize:ev};function ev(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const ai={name:"thematicBreak",tokenize:tv};function tv(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||Ae(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Fe(c)?He(e,o,"whitespace")(c):o(c))}}const bt={continuation:{tokenize:iv},exit:ov,name:"list",tokenize:sv},nv={partial:!0,tokenize:lv},rv={partial:!0,tokenize:av};function sv(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:zo(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(ai,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 zo(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(ws,r.interrupt?n:h,e.attempt(nv,m,f))}function h(d){return r.containerState.initialBlankLine=!0,s++,m(d)}function f(d){return Fe(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 iv(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ws,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!Fe(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(rv,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(bt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function av(e,t,n){const r=this;return He(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 ov(e){e.exit(this.containerState.type)}function lv(e,t,n){const r=this;return He(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!Fe(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Bu={name:"setextUnderline",resolveTo:cv,tokenize:uv};function cv(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 uv(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"),Fe(c)?He(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ae(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const dv={tokenize:hv};function hv(e){const t=this,n=e.attempt(ws,r,e.attempt(this.parser.constructs.flowInitial,i,He(e,e.attempt(this.parser.constructs.flow,i,e.attempt(x2,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 fv={resolveAll:km()},mv=Em("string"),pv=Em("text");function Em(e){return{resolveAll:km(e==="text"?gv: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 km(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 gv(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 xv={42:bt,43:bt,45:bt,48:bt,49:bt,50:bt,51:bt,52:bt,53:bt,54:bt,55:bt,56:bt,57:bt,62:mm},bv={91:k2},yv={[-2]:Da,[-1]:Da,32:Da},vv={35:N2,42:ai,45:[Bu,ai],60:R2,61:Bu,95:ai,96:ju,126:ju},Ev={38:gm,92:pm},kv={[-5]:Oa,[-4]:Oa,[-3]:Oa,33:X2,38:gm,42:Vo,60:[Jy,B2],91:J2,92:[C2,pm],93:Gl,95:Vo,96:d2},Tv={null:[Vo,fv]},wv={null:[42,95]},Sv={null:[]},Cv=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wv,contentInitial:bv,disable:Sv,document:xv,flow:vv,flowInitial:yv,insideSpan:Tv,string:Ev,text:kv},Symbol.toStringTag,{value:"Module"}));function Av(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:_(S),consume:T,enter:w,exit:A,interrupt:_(S,{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=It(a,R),x(),a[a.length-1]!==null?[]:(k(t,0),c.events=Xi(s,c.events,c),c.events)}function m(R,M){return _v(d(R),M)}function d(R){return Nv(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,C()}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 T(R){Ae(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,C()):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 w(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){k(R,M.from)}function S(R,M){M.restore()}function _(R,M){return O;function O(L,I,j){let F,U,W,D;return Array.isArray(L)?ee(L):"tokenize"in L?ee([L]):Z(L);function Z(q){return se;function se(te){const G=te!==null&&q[te],Ee=te!==null&&q.null,ae=[...Array.isArray(G)?G:G?[G]:[],...Array.isArray(Ee)?Ee:Ee?[Ee]:[]];return ee(ae)(te)}}function ee(q){return F=q,U=0,q.length===0?j:P(q[U])}function P(q){return se;function se(te){return D=N(),W=q,q.partial||(c.currentConstruct=q),q.name&&c.parser.constructs.disable.null.includes(q.name)?$():q.tokenize.call(M?Object.assign(Object.create(c),M):c,l,Q,$)(te)}}function Q(q){return R(W,D),I}function $(q){return D.restore(),++U<F.length?P(F[U]):j}}}function k(R,M){R.resolveAll&&!s.includes(R)&&s.push(R),R.resolve&&St(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,C()}}function C(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Nv(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 _v(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=`
|
|
474
|
-
`;break}case-3:{a=`\r
|
|
475
|
-
`;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 Iv(e){const r={constructs:hm([Cv,...(e||{}).extensions||[]]),content:i(qy),defined:[],document:i(Yy),flow:i(dv),lazy:{},string:i(mv),text:i(pv)};return r;function i(s){return a;function a(o){return Av(r,s,o)}}}function Mv(e){for(;!xm(e););return e}const Hu=/[\0\t\n\r]/g;function Rv(){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(Hu.lastIndex=f,c=Hu.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 Lv=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Pv(e){return e.replace(Lv,Dv)}function Dv(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return fm(n.slice(s?2:1),s?16:10)}return Yl(n)||e}const Tm={}.hasOwnProperty;function Ov(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),jv(n)(Mv(Iv(n).document().write(Rv()(e,t,!0))))}function jv(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(le),autolinkProtocol:N,autolinkEmail:N,atxHeading:s(Se),blockQuote:s(Ee),characterEscape:N,characterReference:N,codeFenced:s(ae),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(ae,a),codeText:s(ie,a),codeTextData:N,data:N,codeFlowValue:N,definition:s(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(ve),hardBreakEscape:s(Ve),hardBreakTrailing:s(Ve),htmlFlow:s(_e,a),htmlFlowData:N,htmlText:s(_e,a),htmlTextData:N,image:s(De),label:a,link:s(le),listItem:s(Be),listItemValue:m,listOrdered:s(Me,f),listUnordered:s(Me),paragraph:s(Ue),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Se),strong:s(ze),thematicBreak:s(ge)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:G,autolinkProtocol:te,blockQuote:l(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:q,characterReference:se,codeFenced:l(x),codeFencedFence:g,codeFencedFenceInfo:d,codeFencedFenceMeta:p,codeFlowValue:C,codeIndented:l(b),codeText:l(I),codeTextData:C,data:C,definition:l(),definitionDestinationString:A,definitionLabelString:T,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(O),htmlFlowData:C,htmlText:l(L),htmlTextData:C,image:l(F),label:W,labelText:U,lineEnding:R,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Q,resourceDestinationString:D,resourceTitleString:Z,resource:ee,setextHeading:l(k),setextHeadingLineSequence:_,setextHeadingText:S,strong:l(),thematicBreak:l()}};wm(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(J){let ce={type:"root",children:[]};const xe={stack:[ce],tokenStack:[],config:t,enter:o,exit:c,buffer:a,resume:h,data:n},fe=[];let ye=-1;for(;++ye<J.length;)if(J[ye][1].type==="listOrdered"||J[ye][1].type==="listUnordered")if(J[ye][0]==="enter")fe.push(ye);else{const re=fe.pop();ye=i(J,re,ye)}for(ye=-1;++ye<J.length;){const re=t[J[ye][0]];Tm.call(re,J[ye][1].type)&&re[J[ye][1].type].call(Object.assign({sliceSerialize:J[ye][2].sliceSerialize},xe),J[ye][1])}if(xe.tokenStack.length>0){const re=xe.tokenStack[xe.tokenStack.length-1];(re[1]||Uu).call(xe,void 0,re[0])}for(ce.position={start:un(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:un(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)ce=t.transforms[ye](ce)||ce;return ce}function i(J,ce,xe){let fe=ce-1,ye=-1,re=!1,be,Ie,V,we;for(;++fe<=xe;){const je=J[fe];switch(je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{je[0]==="enter"?ye++:ye--,we=void 0;break}case"lineEndingBlank":{je[0]==="enter"&&(be&&!we&&!ye&&!V&&(V=fe),we=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:we=void 0}if(!ye&&je[0]==="enter"&&je[1].type==="listItemPrefix"||ye===-1&&je[0]==="exit"&&(je[1].type==="listUnordered"||je[1].type==="listOrdered")){if(be){let Je=fe;for(Ie=void 0;Je--;){const Pe=J[Je];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;Ie&&(J[Ie][1].type="lineEndingBlank",re=!0),Pe[1].type="lineEnding",Ie=Je}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}V&&(!Ie||V<Ie)&&(be._spread=!0),be.end=Object.assign({},Ie?J[Ie][1].start:je[1].end),J.splice(Ie||fe,0,["exit",be,je[2]]),fe++,xe++}if(je[1].type==="listItemPrefix"){const Je={type:"listItem",_spread:!1,start:Object.assign({},je[1].start),end:void 0};be=Je,J.splice(fe,0,["enter",Je,je[2]]),fe++,xe++,V=void 0,we=!0}}}return J[ce][1]._spread=re,xe}function s(J,ce){return xe;function xe(fe){o.call(this,J(fe),fe),ce&&ce.call(this,fe)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(J,ce,xe){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([ce,xe||void 0]),J.position={start:un(ce.start),end:void 0}}function l(J){return ce;function ce(xe){J&&J.call(this,xe),c.call(this,xe)}}function c(J,ce){const xe=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==J.type&&(ce?ce.call(this,J,fe[0]):(fe[1]||Uu).call(this,J,fe[0]));else throw new Error("Cannot close `"+J.type+"` ("+Gr({start:J.start,end:J.end})+"): it’s not open");xe.position.end=un(J.end)}function h(){return Wl(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(J){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function d(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=J}function p(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=J}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J.replace(/(\r?\n|\r)$/g,"")}function T(J){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.label=ce,xe.identifier=Bt(this.sliceSerialize(J)).toLowerCase()}function w(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.title=J}function A(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.url=J}function E(J){const ce=this.stack[this.stack.length-1];if(!ce.depth){const xe=this.sliceSerialize(J).length;ce.depth=xe}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function _(J){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function N(J){const xe=this.stack[this.stack.length-1].children;let fe=xe[xe.length-1];(!fe||fe.type!=="text")&&(fe=Re(),fe.position={start:un(J.start),end:void 0},xe.push(fe)),this.stack.push(fe)}function C(J){const ce=this.stack.pop();ce.value+=this.sliceSerialize(J),ce.position.end=un(J.end)}function R(J){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=ce.children[ce.children.length-1];xe.position.end=un(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(N.call(this,J),C.call(this,J))}function M(){this.data.atHardBreak=!0}function O(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J}function L(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J}function I(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J}function j(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=ce,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function F(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=ce,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function U(J){const ce=this.sliceSerialize(J),xe=this.stack[this.stack.length-2];xe.label=Pv(ce),xe.identifier=Bt(ce).toLowerCase()}function W(){const J=this.stack[this.stack.length-1],ce=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const fe=J.children;xe.children=fe}else xe.alt=ce}function D(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.url=J}function Z(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.title=J}function ee(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function Q(J){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.label=ce,xe.identifier=Bt(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function $(J){this.data.characterReferenceType=J.type}function q(J){const ce=this.sliceSerialize(J),xe=this.data.characterReferenceType;let fe;xe?(fe=fm(ce,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=Yl(ce);const ye=this.stack[this.stack.length-1];ye.value+=fe}function se(J){const ce=this.stack.pop();ce.position.end=un(J.end)}function te(J){C.call(this,J);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(J)}function G(J){C.call(this,J);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(J)}function Ee(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function Se(){return{type:"heading",depth:0,children:[]}}function Ve(){return{type:"break"}}function _e(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function le(){return{type:"link",title:null,url:"",children:[]}}function Me(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function Be(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function Ue(){return{type:"paragraph",children:[]}}function ze(){return{type:"strong",children:[]}}function Re(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function un(e){return{line:e.line,column:e.column,offset:e.offset}}function wm(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?wm(e,r):Fv(e,r)}}function Fv(e,t){let n;for(n in t)if(Tm.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 Uu(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Gr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Gr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Gr({start:t.start,end:t.end})+") is still open")}function Bv(e){const t=this;t.parser=n;function n(r){return Ov(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Hv(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 Uv(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
476
|
-
`}]}function zv(e,t){const n=t.value?t.value+`
|
|
477
|
-
`:"",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 Vv(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $v(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qv(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=kr(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 Wv(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 Yv(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Sm(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 Gv(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sm(e,t);const i={src:kr(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 Kv(e,t){const n={src:kr(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 Xv(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 Qv(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sm(e,t);const i={href:kr(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 Jv(e,t){const n={href:kr(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 Zv(e,t,n){const r=e.all(t),i=n?eE(n):Cm(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:`
|
|
478
|
-
`}),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:`
|
|
479
|
-
`});const c={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,c),e.applyData(t,c)}function eE(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=Cm(n[r])}return t}function Cm(e){const t=e.spread;return t??e.children.length>1}function tE(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 nE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function sE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iE(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=Qt(t.children[1]),l=Gi(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 aE(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 oE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const zu=9,Vu=32;function lE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push($u(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push($u(t.slice(i),i>0,!1)),s.join("")}function $u(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===zu||s===Vu;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===zu||s===Vu;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function cE(e,t){const n={type:"text",value:lE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function uE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const dE={blockquote:Hv,break:Uv,code:zv,delete:Vv,emphasis:$v,footnoteReference:qv,heading:Wv,html:Yv,imageReference:Gv,image:Kv,inlineCode:Xv,linkReference:Qv,link:Jv,listItem:Zv,list:tE,paragraph:nE,root:rE,strong:sE,table:iE,tableCell:oE,tableRow:aE,text:cE,thematicBreak:uE,toml:zs,yaml:zs,definition:zs,footnoteDefinition:zs};function zs(){}const Am=-1,Qi=0,Xr=1,Si=2,Kl=3,Xl=4,Ql=5,Jl=6,Nm=7,_m=8,Im=typeof self=="object"?self:globalThis,qu=(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 Im[e](t)},hE=(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 Qi:case Am:return n(a,i);case Xr:{const o=n([],i);for(const l of a)o.push(r(l));return o}case Si:{const o=n({},i);for(const[l,c]of a)o[r(l)]=r(c);return o}case Kl:return n(new Date(a),i);case Xl:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case Ql:{const o=n(new Map,i);for(const[l,c]of a)o.set(r(l),r(c));return o}case Jl:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case Nm:{const{name:o,message:l}=a;return n(typeof Im[o]=="function"?qu(o,l):new Error(l),i)}case _m: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(qu(s,a),i)};return r},Wu=e=>hE(new Map,e)(0),Mn="",{toString:fE}={},{keys:mE}=Object,Or=e=>{const t=typeof e;if(t!=="object"||!e)return[Qi,t];const n=fE.call(e).slice(8,-1);switch(n){case"Array":return[Xr,Mn];case"Object":return[Si,Mn];case"Date":return[Kl,Mn];case"RegExp":return[Xl,Mn];case"Map":return[Ql,Mn];case"Set":return[Jl,Mn];case"DataView":return[Xr,n]}return n.includes("Array")?[Xr,n]:e instanceof Error?[Nm,e.name||"Error"]:[Si,n]},Vs=([e,t])=>e===Qi&&(t==="function"||t==="symbol"),pE=(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]=Or(a);switch(o){case Qi:{let h=a;switch(l){case"bigint":o=_m,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([Am],a)}return i([o,h],a)}case Xr:{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 Si:{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 mE(a))(e||!Vs(Or(a[m])))&&h.push([s(m),s(a[m])]);return f}case Kl:return i([o,isNaN(a.getTime())?Mn:a.toISOString()],a);case Xl:{const{source:h,flags:f}=a;return i([o,{source:h,flags:f}],a)}case Ql:{const h=[],f=i([o,h],a);for(const[m,d]of a)(e||!(Vs(Or(m))||Vs(Or(d))))&&h.push([s(m),s(d)]);return f}case Jl:{const h=[],f=i([o,h],a);for(const m of a)(e||!Vs(Or(m)))&&h.push(s(m));return f}}const{message:c}=a;return i([o,{name:l,message:c}],a)};return s},Yu=(e,{json:t,lossy:n}={})=>{const r=[];return pE(!(t||n),!!t,new Map,r)(e),r},Yn=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Wu(Yu(e,t)):structuredClone(e):(e,t)=>Wu(Yu(e,t));function gE(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 xE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function bE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||gE,r=e.options.footnoteBackLabel||xE,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=kr(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 T=typeof n=="string"?n:n(l,d);typeof T=="string"&&(T={type:"text",value:T}),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(T)?T:[T]})}const x=h[h.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const T=x.children[x.children.length-1];T&&T.type==="text"?T.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:{...Yn(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
480
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
481
|
-
`}]}}const Ji=(function(e){if(e==null)return kE;if(typeof e=="function")return Zi(e);if(typeof e=="object")return Array.isArray(e)?yE(e):vE(e);if(typeof e=="string")return EE(e);throw new Error("Expected function, string, or object as test")});function yE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ji(e[n]);return Zi(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function vE(e){const t=e;return Zi(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function EE(e){return Zi(t);function t(n){return n&&n.type===e}}function Zi(e){return t;function t(n,r,i){return!!(TE(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function kE(){return!0}function TE(e){return e!==null&&typeof e=="object"&&"type"in e}const Mm=[],wE=!0,$o=!1,SE="skip";function Rm(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Ji(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=Mm,p,g,x;if((!t||s(l,c,h[h.length-1]||void 0))&&(d=CE(n(l,h)),d[0]===$o))return d;if("children"in l&&l.children){const b=l;if(b.children&&d[0]!==SE)for(g=(r?b.children.length:-1)+a,x=h.concat(b);g>-1&&g<b.children.length;){const T=b.children[g];if(p=o(T,g,x)(),p[0]===$o)return p;g=typeof p[1]=="number"?p[1]:g+a}}return d}}}function CE(e){return Array.isArray(e)?e:typeof e=="number"?[wE,e]:e==null?Mm:[e]}function ea(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),Rm(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 qo={}.hasOwnProperty,AE={};function NE(e,t){const n=t||AE,r=new Map,i=new Map,s=new Map,a={...dE,...n.handlers},o={all:c,applyData:IE,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:l,options:n,patch:_E,wrap:RE};return ea(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(qo.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=Yn(x);return b.children=o.all(h),b}return Yn(h)}return(o.options.unknownHandler||ME)(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=Gu(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=Gu(g.value))}Array.isArray(p)?f.push(...p):f.push(p)}}}return f}}function _E(e,t){e.position&&(t.position=am(e))}function IE(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,Yn(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function ME(e,t){const n=t.data||{},r="value"in t&&!(qo.call(n,"hProperties")||qo.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 RE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
482
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
483
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
484
|
-
`}),n}function Gu(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ku(e,t){const n=NE(e,t),r=n.one(e,void 0),i=bE(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
485
|
-
`},i),s}function LE(e,t){return e&&"run"in e?async function(n,r){const i=Ku(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ku(n,{file:r,...e||t})}}function Xu(e){if(e)throw e}var ja,Qu;function PE(){if(Qu)return ja;Qu=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 ja=function l(){var c,h,f,m,d,p,g=arguments[0],x=1,b=arguments.length,T=!1;for(typeof g=="boolean"&&(T=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&&(T&&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(T,p,m)})):typeof m<"u"&&a(g,{name:h,newValue:m}));return g},ja}var DE=PE();const Fa=Il(DE);function Wo(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 OE(){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?jE(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 jE(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 zt={basename:FE,dirname:BE,extname:HE,join:UE,sep:"/"};function FE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ss(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 BE(e){if(Ss(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 HE(e){Ss(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 UE(...e){let t=-1,n;for(;++t<e.length;)Ss(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":zE(n)}function zE(e){Ss(e);const t=e.codePointAt(0)===47;let n=VE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function VE(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 Ss(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const $E={cwd:qE};function qE(){return"/"}function Yo(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function WE(e){if(typeof e=="string")e=new URL(e);else if(!Yo(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 YE(e)}function YE(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 Ba=["history","path","basename","stem","extname","dirname"];class Lm{constructor(t){let n;t?Yo(t)?n={path:t}:typeof t=="string"||GE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":$E.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ba.length;){const s=Ba[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)Ba.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){Ua(t,"basename"),Ha(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){Ju(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Ha(t,"extname"),Ju(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=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Yo(t)&&(t=WE(t)),Ua(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){Ua(t,"stem"),Ha(t,"stem"),this.path=zt.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 ut(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 Ha(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function Ua(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ju(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function GE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const KE=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),XE={}.hasOwnProperty;class Zl extends KE{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=OE()}copy(){const t=new Zl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Fa(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?($a("data",this.frozen),this.namespace[t]=n,this):XE.call(this.namespace,t)&&this.namespace[t]||void 0:t?($a("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=$s(t),r=this.parser||this.Parser;return za("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),za("process",this.parser||this.Parser),Va("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=$s(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);ZE(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(),za("processSync",this.parser||this.Parser),Va("processSync",this.compiler||this.Compiler),this.process(t,i),ed("processSync","process",n),r;function i(s,a){n=!0,Xu(s),r=a}}run(t,n,r){Zu(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=$s(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),ed("runSync","run",r),i;function s(a,o){Xu(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=$s(n),i=this.compiler||this.Compiler;return Va("stringify",i),Zu(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if($a("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=Fa(!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];Wo(g)&&Wo(d)&&(d=Fa(!0,g,d)),r[m]=[c,d,...p]}}}}const QE=new Zl().freeze();function za(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Va(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $a(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 Zu(e){if(!Wo(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ed(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function $s(e){return JE(e)?e:new Lm(e)}function JE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ZE(e){return typeof e=="string"||ek(e)}function ek(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const tk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",td=[],nd={allowDangerousHtml:!0},nk=/^(https?|ircs?|mailto|xmpp)$/i,rk=[{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 Pm(e){const t=sk(e),n=ik(e);return ak(t.runSync(t.parse(n),n),e)}function sk(e){const t=e.rehypePlugins||td,n=e.remarkPlugins||td,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nd}:nd;return QE().use(Bv).use(n).use(LE,r).use(t)}function ik(e){const t=e.children||"",n=new Lm;return typeof t=="string"&&(n.value=t),n}function ak(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||ok;for(const h of rk)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+tk+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),ea(e,c),ky(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 Pa)if(Object.hasOwn(Pa,d)&&Object.hasOwn(h.properties,d)){const p=h.properties[d],g=Pa[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 ok(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||nk.test(e.slice(0,t))?e:""}function rd(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 lk(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ck(e,t,n){const i=Ji((n||{}).ignore||[]),s=uk(t);let a=-1;for(;++a<s.length;)Rm(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,T=[];m.lastIndex=0;let w=m.exec(c.value);for(;w;){const A=w.index,E={index:w.index,input:w.input,stack:[...h,c]};let S=d(...w,E);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?m.lastIndex=A+1:(p!==A&&T.push({type:"text",value:c.value.slice(p,A)}),Array.isArray(S)?T.push(...S):S&&T.push(S),p=A+w[0].length,b=!0),!m.global)break;w=m.exec(c.value)}return b?(p<c.value.length&&T.push({type:"text",value:c.value.slice(p)}),f.children.splice(x,1,...T)):T=[c],x+T.length}}function uk(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([dk(i[0]),hk(i[1])])}return t}function dk(e){return typeof e=="string"?new RegExp(lk(e),"g"):e}function hk(e){return typeof e=="function"?e:function(){return e}}const qa="phrasing",Wa=["autolink","link","image","label"];function fk(){return{transforms:[vk],enter:{literalAutolink:pk,literalAutolinkEmail:Ya,literalAutolinkHttp:Ya,literalAutolinkWww:Ya},exit:{literalAutolink:yk,literalAutolinkEmail:bk,literalAutolinkHttp:gk,literalAutolinkWww:xk}}}function mk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:qa,notInConstruct:Wa},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:qa,notInConstruct:Wa},{character:":",before:"[ps]",after:"\\/",inConstruct:qa,notInConstruct:Wa}]}}function pk(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ya(e){this.config.enter.autolinkProtocol.call(this,e)}function gk(e){this.config.exit.autolinkProtocol.call(this,e)}function xk(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 bk(e){this.config.exit.autolinkEmail.call(this,e)}function yk(e){this.exit(e)}function vk(e){ck(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ek],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),kk]],{ignore:["link","linkReference"]})}function Ek(e,t,n,r,i){let s="";if(!Dm(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Tk(n)))return!1;const a=wk(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 kk(e,t,n,r){return!Dm(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Tk(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 wk(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=rd(e,"(");let s=rd(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 Dm(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Wn(n)||Ki(n))&&(!t||n!==47)}Om.peek=Lk;function Sk(){this.buffer()}function Ck(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ak(){this.buffer()}function Nk(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function _k(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ik(e){this.exit(e)}function Mk(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Rk(e){this.exit(e)}function Lk(){return"["}function Om(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 Pk(){return{enter:{gfmFootnoteCallString:Sk,gfmFootnoteCall:Ck,gfmFootnoteDefinitionLabelString:Ak,gfmFootnoteDefinition:Nk},exit:{gfmFootnoteCallString:_k,gfmFootnoteCall:Ik,gfmFootnoteDefinitionLabelString:Mk,gfmFootnoteDefinition:Rk}}}function Dk(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Om},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?`
|
|
486
|
-
`:" ")+s.indentLines(s.containerFlow(r,o.current()),t?jm:Ok))),c(),l}}function Ok(e,t,n){return t===0?e:jm(e,t,n)}function jm(e,t,n){return(n?"":" ")+e}const jk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Fm.peek=zk;function Fk(){return{canContainEols:["delete"],enter:{strikethrough:Hk},exit:{strikethrough:Uk}}}function Bk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:jk}],handlers:{delete:Fm}}}function Hk(e){this.enter({type:"delete",children:[]},e)}function Uk(e){this.exit(e)}function Fm(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 zk(){return"~"}function Vk(e){return e.length}function $k(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Vk,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 T=qk(e[h][b]);if(n.alignDelimiters!==!1){const w=i(T);x[b]=w,(l[b]===void 0||w>l[b])&&(l[b]=w)}g.push(T)}a[h]=g,o[h]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<c;)s[f]=sd(r[f]);else{const g=sd(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 T=n.alignDelimiters===!1?1:Math.max(1,l[f]-x.length-b.length);const w=x+"-".repeat(T)+b;n.alignDelimiters!==!1&&(T=x.length+T+b.length,T>l[f]&&(l[f]=T),d[f]=T),m[f]=w}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 T=g[f]||"";let w="",A="";if(n.alignDelimiters!==!1){const E=l[f]-(x[f]||0),S=s[f];S===114?w=" ".repeat(E):S===99?E%2?(w=" ".repeat(E/2+.5),A=" ".repeat(E/2-.5)):(w=" ".repeat(E/2),A=w):A=" ".repeat(E)}n.delimiterStart!==!1&&!f&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||f)&&b.push(" "),n.alignDelimiters!==!1&&b.push(w),b.push(T),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(`
|
|
487
|
-
`)}function qk(e){return e==null?"":String(e)}function sd(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 id={}.hasOwnProperty;function Bm(e,t){const n=t||{};function r(i,...s){let a=r.invalid;const o=r.handlers;if(i&&id.call(i,e)){const l=String(i[e]);a=id.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 Wk(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()),Yk);return i(),a}function Yk(e,t,n){return">"+(n?"":" ")+e}function Gk(e,t){return ad(e,t.inConstruct,!0)&&!ad(e,t.notInConstruct,!1)}function ad(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 od(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
488
|
-
`&&Gk(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
489
|
-
`}function Kk(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 Xk(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 Qk(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 Jk(e,t,n,r){const i=Qk(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(Xk(e,n)){const f=n.enter("codeIndented"),m=n.indentLines(s,Zk);return f(),m}const o=n.createTracker(r),l=i.repeat(Math.max(Kk(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:`
|
|
490
|
-
`,encode:["`"],...o.current()})),f()}return h+=o.move(`
|
|
491
|
-
`),s&&(h+=o.move(s+`
|
|
492
|
-
`)),h+=o.move(l),c(),h}function Zk(e,t,n){return(n?"":" ")+e}function ec(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 eT(e,t,n,r){const i=ec(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?" ":`
|
|
493
|
-
`,...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 tT(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 hs(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ci(e,t,n){const r=gr(e),i=gr(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}}Hm.peek=nT;function Hm(e,t,n,r){const i=tT(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=Ci(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=hs(c)+l.slice(1));const f=l.charCodeAt(l.length-1),m=Ci(r.after.charCodeAt(0),f,i);m.inside&&(l=l.slice(0,-1)+hs(f));const d=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:h.outside},o+l+d}function nT(e,t,n){return n.options.emphasis||"*"}function rT(e,t){let n=!1;return ea(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,$o}),!!((!e.depth||e.depth<3)&&Wl(e)&&(t.options.setext||n))}function sT(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(rT(e,n)){const h=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...s.current(),before:`
|
|
494
|
-
`,after:`
|
|
495
|
-
`});return f(),h(),m+`
|
|
496
|
-
`+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
|
497
|
-
`))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),l=n.enter("phrasing");s.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
498
|
-
`,...s.current()});return/^[\t ]/.test(c)&&(c=hs(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),o(),c}Um.peek=iT;function Um(e){return e.value||""}function iT(){return"<"}zm.peek=aT;function zm(e,t,n,r){const i=ec(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 aT(){return"!"}Vm.peek=oT;function Vm(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 oT(){return"!"}$m.peek=lT;function $m(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 lT(){return"`"}function qm(e,t){const n=Wl(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))}Wm.peek=cT;function Wm(e,t,n,r){const i=ec(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(qm(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 cT(e,t,n){return qm(e,n)?"<":"["}Ym.peek=uT;function Ym(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 uT(){return"["}function tc(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 dT(e){const t=tc(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 hT(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 Gm(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 fT(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?hT(n):tc(n);const o=e.ordered?a==="."?")":".":dT(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),Gm(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 mT(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 pT(e,t,n,r){const i=mT(n);let s=n.bulletCurrent||tc(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 gT(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const xT=Ji(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function bT(e,t,n,r){return(e.children.some(function(a){return xT(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function yT(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Km.peek=vT;function Km(e,t,n,r){const i=yT(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=Ci(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=hs(c)+l.slice(1));const f=l.charCodeAt(l.length-1),m=Ci(r.after.charCodeAt(0),f,i);m.inside&&(l=l.slice(0,-1)+hs(f));const d=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:h.outside},o+l+d}function vT(e,t,n){return n.options.strong||"*"}function ET(e,t,n,r){return n.safe(e.value,r)}function kT(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 TT(e,t,n){const r=(Gm(n)+(n.options.ruleSpaces?" ":"")).repeat(kT(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Xm={blockquote:Wk,break:od,code:Jk,definition:eT,emphasis:Hm,hardBreak:od,heading:sT,html:Um,image:zm,imageReference:Vm,inlineCode:$m,link:Wm,linkReference:Ym,list:fT,listItem:pT,paragraph:gT,root:bT,strong:Km,text:ET,thematicBreak:TT};function wT(){return{enter:{table:ST,tableData:ld,tableHeader:ld,tableRow:AT},exit:{codeText:NT,table:CT,tableData:Ga,tableHeader:Ga,tableRow:Ga}}}function ST(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 CT(e){this.exit(e),this.data.inTable=void 0}function AT(e){this.enter({type:"tableRow",children:[]},e)}function Ga(e){this.exit(e)}function ld(e){this.enter({type:"tableCell",children:[]},e)}function NT(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_T));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function _T(e,t){return t==="|"?t:e}function IT(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
499
|
-
`,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),T=c([b]);return T.slice(0,T.indexOf(`
|
|
500
|
-
`))}function l(d,p,g,x){const b=g.enter("tableCell"),T=g.enter("phrasing"),w=g.containerPhrasing(d,{...x,before:s,after:s});return T(),b(),w}function c(d,p){return $k(d,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function h(d,p,g){const x=d.children;let b=-1;const T=[],w=p.enter("table");for(;++b<x.length;)T[b]=f(x[b],p,g);return w(),T}function f(d,p,g){const x=d.children;let b=-1;const T=[],w=p.enter("tableRow");for(;++b<x.length;)T[b]=l(x[b],d,p,g);return w(),T}function m(d,p,g){let x=Xm.inlineCode(d,p,g);return g.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function MT(){return{exit:{taskListCheckValueChecked:cd,taskListCheckValueUnchecked:cd,paragraph:LT}}}function RT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PT}}}function cd(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function LT(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 PT(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=Xm.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 DT(){return[fk(),Pk(),Fk(),wT(),MT()]}function OT(e){return{extensions:[mk(),Dk(e),Bk(),IT(e),RT()]}}const jT={tokenize:VT,partial:!0},Qm={tokenize:$T,partial:!0},Jm={tokenize:qT,partial:!0},Zm={tokenize:WT,partial:!0},FT={tokenize:YT,partial:!0},ep={name:"wwwAutolink",tokenize:UT,previous:np},tp={name:"protocolAutolink",tokenize:zT,previous:rp},on={name:"emailAutolink",tokenize:HT,previous:sp},Jt={};function BT(){return{text:Jt}}let Cn=48;for(;Cn<123;)Jt[Cn]=on,Cn++,Cn===58?Cn=65:Cn===91&&(Cn=97);Jt[43]=on;Jt[45]=on;Jt[46]=on;Jt[95]=on;Jt[72]=[on,tp];Jt[104]=[on,tp];Jt[87]=[on,ep];Jt[119]=[on,ep];function HT(e,t,n){const r=this;let i,s;return a;function a(f){return!Go(f)||!sp.call(r,r.previous)||nc(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(f))}function o(f){return Go(f)?(e.consume(f),o):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(FT,h,c)(f):f===45||f===95||ct(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&&ft(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function UT(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!np.call(r,r.previous)||nc(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(jT,e.attempt(Qm,e.attempt(Jm,s),n),n)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function zT(e,t,n){const r=this;let i="",s=!1;return a;function a(f){return(f===72||f===104)&&rp.call(r,r.previous)&&!nc(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),o):n(f)}function o(f){if(ft(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||wi(f)||Ge(f)||Wn(f)||Ki(f)?n(f):e.attempt(Qm,e.attempt(Jm,h),n)(f)}function h(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function VT(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 $T(e,t,n){let r,i,s;return a;function a(c){return c===46||c===95?e.check(Zm,l,o)(c):c===null||Ge(c)||Wn(c)||c!==45&&Ki(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 qT(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(Zm,t,s)(a):a===null||Ge(a)||Wn(a)?t(a):(e.consume(a),i)}function s(a){return a===41&&r++,e.consume(a),i}}function WT(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||Ge(o)||Wn(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Ge(o)||Wn(o)?t(o):r(o)}function s(o){return ft(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):ft(o)?(e.consume(o),a):n(o)}}function YT(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return ct(s)?n(s):t(s)}}function np(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ge(e)}function rp(e){return!ft(e)}function sp(e){return!(e===47||Go(e))}function Go(e){return e===43||e===45||e===46||e===95||ct(e)}function nc(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 GT={tokenize:nw,partial:!0};function KT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ZT,continuation:{tokenize:ew},exit:tw}},text:{91:{name:"gfmFootnoteCall",tokenize:JT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:XT,resolveTo:QT}}}}function XT(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=Bt(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 QT(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 JT(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||Ge(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(Bt(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Ge(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 ZT(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||Ge(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=Bt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Ge(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),He(e,d,"gfmFootnoteDefinitionWhitespace")):n(p)}function d(p){return t(p)}}function ew(e,t,n){return e.check(ws,t,e.attempt(GT,t,n))}function tw(e){e.exit("gfmFootnoteDefinition")}function nw(e,t,n){const r=this;return He(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 rw(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&&St(m,m.length,0,Xi(d,a.slice(c+1,l),o)),St(m,m.length,0,[["exit",f,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",h,o]]),St(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=gr(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=gr(p);return x._open=!b||b===2&&!!g,x._close=!g||g===2&&!!b,o(p)}}}class sw{constructor(){this.map=[]}add(t,n,r){iw(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 iw(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 aw(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 ow(){return{flow:{null:{name:"table",tokenize:lw,resolveAll:cw}}}}function lw(e,t,n){const r=this;let i=0,s=0,a;return o;function o(C){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"?S:l;return O===S&&r.parser.lazy[r.now().line]?n(C):O(C)}function l(C){return e.enter("tableHead"),e.enter("tableRow"),c(C)}function c(C){return C===124||(a=!0,s+=1),h(C)}function h(C){return C===null?n(C):Ae(C)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),d):n(C):Fe(C)?He(e,h,"whitespace")(C):(s+=1,a&&(a=!1,i+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),f(C)))}function f(C){return C===null||C===124||Ge(C)?(e.exit("data"),h(C)):(e.consume(C),C===92?m:f)}function m(C){return C===92||C===124?(e.consume(C),f):f(C)}function d(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),a=!1,Fe(C)?He(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):p(C))}function p(C){return C===45||C===58?x(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),g):E(C)}function g(C){return Fe(C)?He(e,x,"whitespace")(C):x(C)}function x(C){return C===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),b):C===45?(s+=1,b(C)):C===null||Ae(C)?A(C):E(C)}function b(C){return C===45?(e.enter("tableDelimiterFiller"),T(C)):E(C)}function T(C){return C===45?(e.consume(C),T):C===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(C))}function w(C){return Fe(C)?He(e,A,"whitespace")(C):A(C)}function A(C){return C===124?p(C):C===null||Ae(C)?!a||i!==s?E(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):E(C)}function E(C){return n(C)}function S(C){return e.enter("tableRow"),_(C)}function _(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),_):C===null||Ae(C)?(e.exit("tableRow"),t(C)):Fe(C)?He(e,_,"whitespace")(C):(e.enter("data"),k(C))}function k(C){return C===null||C===124||Ge(C)?(e.exit("data"),_(C)):(e.consume(C),C===92?N:k)}function N(C){return C===92||C===124?(e.consume(C),k):k(C)}}function cw(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 sw;for(;++n<e.length;){const d=e[n],p=d[1];d[0]==="enter"?p.type==="tableHead"?(o=!1,l!==0&&(ud(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=qs(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=qs(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=qs(m,t,s,i,n,f)):a[1]!==0&&(f=qs(m,t,a,i,n,f)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&ud(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=aw(t.events,n))}return e}function qs(e,t,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},ir(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=ir(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=ir(t.events,n[2]),h=ir(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({},ir(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function ud(e,t,n,r,i){const s=[],a=ir(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 ir(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const uw={name:"tasklistCheck",tokenize:hw};function dw(){return{text:{91:uw}}}function hw(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 Ge(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 Ae(l)?t(l):Fe(l)?e.check({tokenize:fw},t,n)(l):n(l)}}function fw(e,t,n){return He(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function mw(e){return hm([BT(),KT(),rw(e),ow(),dw()])}const pw={};function ip(e){const t=this,n=e||pw,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(mw(n)),s.push(DT()),a.push(OT(n))}const dd=/[#.]/g;function gw(e,t){const n=e||"",r={};let i=0,s,a;for(;i<n.length;){dd.lastIndex=i;const o=dd.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 ap(e,t,n){const r=n?vw(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=gw(s,t);const c=l.tagName.toLowerCase(),h=r?r.get(c):void 0;if(l.tagName=h||c,xw(a))o.unshift(a);else for(const[f,m]of Object.entries(a))bw(e,l.properties,f,m)}for(const c of o)Ko(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function xw(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 bw(e,t,n,r){const i=Yi(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=wu(r):i.commaSeparated?s=yu(r):i.commaOrSpaceSeparated?s=wu(yu(r).join(" ")):s=hd(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?yw(r):String(r);if(Array.isArray(s)){const a=[];for(const o of s)a.push(hd(i,i.property,o));s=a}i.property==="className"&&Array.isArray(t.className)&&(s=t.className.concat(s)),t[i.property]=s}}function Ko(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)Ko(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Ko(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function hd(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||us(n)===us(t)))return!0}return n}function yw(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function vw(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Ew=["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"],kw=ap(Ts,"div"),Tw=ap(yn,"g",Ew);function ww(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=fd(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=fd(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 fd(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
501
|
-
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Pn={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/"},op={}.hasOwnProperty,Sw=Object.prototype;function Cw(e,t){const n=t||{};return rc({file:n.file||void 0,location:!1,schema:n.space==="svg"?yn:Ts,verbose:n.verbose||!1},e)}function rc(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},oi(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:lp(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){const s=String(e.file),a=ww(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"},oi(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},oi(e,r,n),n}default:return n=Aw(e,t),n}}function lp(e,t){let n=-1;const r=[];for(;++n<t.length;){const i=rc(e,t[n]);r.push(i)}return r}function Aw(e,t){const n=e.schema;e.schema=t.namespaceURI===Pn.svg?yn:Ts;let r=-1;const i={};for(;++r<t.attrs.length;){const o=t.attrs[r],l=(o.prefix?o.prefix+":":"")+o.name;op.call(Sw,l)||(i[l]=o.value)}const a=(e.schema.space==="svg"?Tw:kw)(t.tagName,i,lp(e,t.childNodes));if(oi(e,t,a),a.tagName==="template"){const o=t,l=o.sourceCodeLocation,c=l&&l.startTag&&or(l.startTag),h=l&&l.endTag&&or(l.endTag),f=rc(e,o.content);c&&h&&e.file&&(f.position={start:c.end,end:h.start}),a.content=f}return e.schema=n,a}function oi(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=Nw(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function Nw(e,t,n){const r=or(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)op.call(n.attrs,a)&&(s[Yi(e.schema,a).property]=or(n.attrs[a]));n.startTag;const o=or(n.startTag),l=n.endTag?or(n.endTag):void 0,c={opening:o};l&&(c.closing=l),c.properties=s,t.data={position:c}}}return r}function or(e){const t=md({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=md({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function md(e){return e.line&&e.column?e:void 0}const _w={},Iw={}.hasOwnProperty,cp=Bm("type",{handlers:{root:Rw,element:jw,text:Dw,comment:Ow,doctype:Pw}});function Mw(e,t){const r=(t||_w).space;return cp(e,r==="svg"?yn:Ts)}function Rw(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=sc(e.children,n,t),Tr(e,n),n}function Lw(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=sc(e.children,n,t),Tr(e,n),n}function Pw(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return Tr(e,t),t}function Dw(e){const t={nodeName:"#text",value:e.value,parentNode:null};return Tr(e,t),t}function Ow(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return Tr(e,t),t}function jw(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=yn);const i=[];let s;if(e.properties){for(s in e.properties)if(s!=="children"&&Iw.call(e.properties,s)){const l=Fw(r,s,e.properties[s]);l&&i.push(l)}}const a=r.space,o={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Pn[a],childNodes:[],parentNode:null};return o.childNodes=sc(e.children,o,r),Tr(e,o),e.tagName==="template"&&e.content&&(o.content=Lw(e.content,r)),o}function Fw(e,t,n){const r=Yi(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?Xf(n):sm(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=Pn[r.space]}return i}function sc(e,t,n){let r=-1;const i=[];if(e)for(;++r<e.length;){const s=cp(e[r],n);s.parentNode=t,i.push(s)}return i}function Tr(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 Bw=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Hw=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]),Qe="�";var B;(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"})(B||(B={}));const xt={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function up(e){return e>=55296&&e<=57343}function Uw(e){return e>=56320&&e<=57343}function zw(e,t){return(e-55296)*1024+9216+t}function dp(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function hp(e){return e>=64976&&e<=65007||Hw.has(e)}var ne;(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"})(ne||(ne={}));const Vw=65536;class $w{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=Vw,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(Uw(n))return this.pos++,this._addGap(),zw(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(ne.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,B.EOF;const r=this.html.charCodeAt(n);return r===B.CARRIAGE_RETURN?B.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,B.EOF;let t=this.html.charCodeAt(this.pos);return t===B.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,B.LINE_FEED):t===B.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,up(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===B.LINE_FEED||t===B.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){dp(t)?this._err(ne.controlCharacterInInputStream):hp(t)&&this._err(ne.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Oe;(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"})(Oe||(Oe={}));function fp(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 qw=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))),Ww=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 Yw(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Ww.get(e))!==null&&t!==void 0?t:e}var at;(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"})(at||(at={}));const Gw=32;var pn;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(pn||(pn={}));function Xo(e){return e>=at.ZERO&&e<=at.NINE}function Kw(e){return e>=at.UPPER_A&&e<=at.UPPER_F||e>=at.LOWER_A&&e<=at.LOWER_F}function Xw(e){return e>=at.UPPER_A&&e<=at.UPPER_Z||e>=at.LOWER_A&&e<=at.LOWER_Z||Xo(e)}function Qw(e){return e===at.EQUALS||Xw(e)}var it;(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"})(it||(it={}));var rn;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(rn||(rn={}));class Jw{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=it.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=rn.Strict}startEntity(t){this.decodeMode=t,this.state=it.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case it.EntityStart:return t.charCodeAt(n)===at.NUM?(this.state=it.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=it.NamedEntity,this.stateNamedEntity(t,n));case it.NumericStart:return this.stateNumericStart(t,n);case it.NumericDecimal:return this.stateNumericDecimal(t,n);case it.NumericHex:return this.stateNumericHex(t,n);case it.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Gw)===at.LOWER_X?(this.state=it.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=it.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(Xo(i)||Kw(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(Xo(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===at.SEMI)this.consumed+=1;else if(this.decodeMode===rn.Strict)return 0;return this.emitCodePoint(Yw(this.result),this.consumed),this.errors&&(t!==at.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&pn.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const a=t.charCodeAt(n);if(this.treeIndex=Zw(r,i,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return this.result===0||this.decodeMode===rn.Attribute&&(s===0||Qw(a))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&pn.VALUE_LENGTH)>>14,s!==0){if(a===at.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==rn.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]&pn.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]&~pn.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case it.NamedEntity:return this.result!==0&&(this.decodeMode!==rn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case it.NumericDecimal:return this.emitNumericEntity(0,2);case it.NumericHex:return this.emitNumericEntity(0,3);case it.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case it.EntityStart:return 0}}}function Zw(e,t,n,r){const i=(t&pn.BRANCH_LENGTH)>>7,s=t&pn.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 Un;(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"})(Un||(Un={}));var Mt;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Mt||(Mt={}));var X;(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"})(X||(X={}));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 eS=new Map([[X.A,y.A],[X.ADDRESS,y.ADDRESS],[X.ANNOTATION_XML,y.ANNOTATION_XML],[X.APPLET,y.APPLET],[X.AREA,y.AREA],[X.ARTICLE,y.ARTICLE],[X.ASIDE,y.ASIDE],[X.B,y.B],[X.BASE,y.BASE],[X.BASEFONT,y.BASEFONT],[X.BGSOUND,y.BGSOUND],[X.BIG,y.BIG],[X.BLOCKQUOTE,y.BLOCKQUOTE],[X.BODY,y.BODY],[X.BR,y.BR],[X.BUTTON,y.BUTTON],[X.CAPTION,y.CAPTION],[X.CENTER,y.CENTER],[X.CODE,y.CODE],[X.COL,y.COL],[X.COLGROUP,y.COLGROUP],[X.DD,y.DD],[X.DESC,y.DESC],[X.DETAILS,y.DETAILS],[X.DIALOG,y.DIALOG],[X.DIR,y.DIR],[X.DIV,y.DIV],[X.DL,y.DL],[X.DT,y.DT],[X.EM,y.EM],[X.EMBED,y.EMBED],[X.FIELDSET,y.FIELDSET],[X.FIGCAPTION,y.FIGCAPTION],[X.FIGURE,y.FIGURE],[X.FONT,y.FONT],[X.FOOTER,y.FOOTER],[X.FOREIGN_OBJECT,y.FOREIGN_OBJECT],[X.FORM,y.FORM],[X.FRAME,y.FRAME],[X.FRAMESET,y.FRAMESET],[X.H1,y.H1],[X.H2,y.H2],[X.H3,y.H3],[X.H4,y.H4],[X.H5,y.H5],[X.H6,y.H6],[X.HEAD,y.HEAD],[X.HEADER,y.HEADER],[X.HGROUP,y.HGROUP],[X.HR,y.HR],[X.HTML,y.HTML],[X.I,y.I],[X.IMG,y.IMG],[X.IMAGE,y.IMAGE],[X.INPUT,y.INPUT],[X.IFRAME,y.IFRAME],[X.KEYGEN,y.KEYGEN],[X.LABEL,y.LABEL],[X.LI,y.LI],[X.LINK,y.LINK],[X.LISTING,y.LISTING],[X.MAIN,y.MAIN],[X.MALIGNMARK,y.MALIGNMARK],[X.MARQUEE,y.MARQUEE],[X.MATH,y.MATH],[X.MENU,y.MENU],[X.META,y.META],[X.MGLYPH,y.MGLYPH],[X.MI,y.MI],[X.MO,y.MO],[X.MN,y.MN],[X.MS,y.MS],[X.MTEXT,y.MTEXT],[X.NAV,y.NAV],[X.NOBR,y.NOBR],[X.NOFRAMES,y.NOFRAMES],[X.NOEMBED,y.NOEMBED],[X.NOSCRIPT,y.NOSCRIPT],[X.OBJECT,y.OBJECT],[X.OL,y.OL],[X.OPTGROUP,y.OPTGROUP],[X.OPTION,y.OPTION],[X.P,y.P],[X.PARAM,y.PARAM],[X.PLAINTEXT,y.PLAINTEXT],[X.PRE,y.PRE],[X.RB,y.RB],[X.RP,y.RP],[X.RT,y.RT],[X.RTC,y.RTC],[X.RUBY,y.RUBY],[X.S,y.S],[X.SCRIPT,y.SCRIPT],[X.SEARCH,y.SEARCH],[X.SECTION,y.SECTION],[X.SELECT,y.SELECT],[X.SOURCE,y.SOURCE],[X.SMALL,y.SMALL],[X.SPAN,y.SPAN],[X.STRIKE,y.STRIKE],[X.STRONG,y.STRONG],[X.STYLE,y.STYLE],[X.SUB,y.SUB],[X.SUMMARY,y.SUMMARY],[X.SUP,y.SUP],[X.TABLE,y.TABLE],[X.TBODY,y.TBODY],[X.TEMPLATE,y.TEMPLATE],[X.TEXTAREA,y.TEXTAREA],[X.TFOOT,y.TFOOT],[X.TD,y.TD],[X.TH,y.TH],[X.THEAD,y.THEAD],[X.TITLE,y.TITLE],[X.TR,y.TR],[X.TRACK,y.TRACK],[X.TT,y.TT],[X.U,y.U],[X.UL,y.UL],[X.SVG,y.SVG],[X.VAR,y.VAR],[X.WBR,y.WBR],[X.XMP,y.XMP]]);function wr(e){var t;return(t=eS.get(e))!==null&&t!==void 0?t:y.UNKNOWN}const de=y,tS={[ue.HTML]:new Set([de.ADDRESS,de.APPLET,de.AREA,de.ARTICLE,de.ASIDE,de.BASE,de.BASEFONT,de.BGSOUND,de.BLOCKQUOTE,de.BODY,de.BR,de.BUTTON,de.CAPTION,de.CENTER,de.COL,de.COLGROUP,de.DD,de.DETAILS,de.DIR,de.DIV,de.DL,de.DT,de.EMBED,de.FIELDSET,de.FIGCAPTION,de.FIGURE,de.FOOTER,de.FORM,de.FRAME,de.FRAMESET,de.H1,de.H2,de.H3,de.H4,de.H5,de.H6,de.HEAD,de.HEADER,de.HGROUP,de.HR,de.HTML,de.IFRAME,de.IMG,de.INPUT,de.LI,de.LINK,de.LISTING,de.MAIN,de.MARQUEE,de.MENU,de.META,de.NAV,de.NOEMBED,de.NOFRAMES,de.NOSCRIPT,de.OBJECT,de.OL,de.P,de.PARAM,de.PLAINTEXT,de.PRE,de.SCRIPT,de.SECTION,de.SELECT,de.SOURCE,de.STYLE,de.SUMMARY,de.TABLE,de.TBODY,de.TD,de.TEMPLATE,de.TEXTAREA,de.TFOOT,de.TH,de.THEAD,de.TITLE,de.TR,de.TRACK,de.UL,de.WBR,de.XMP]),[ue.MATHML]:new Set([de.MI,de.MO,de.MN,de.MS,de.MTEXT,de.ANNOTATION_XML]),[ue.SVG]:new Set([de.TITLE,de.FOREIGN_OBJECT,de.DESC]),[ue.XLINK]:new Set,[ue.XML]:new Set,[ue.XMLNS]:new Set},Qo=new Set([de.H1,de.H2,de.H3,de.H4,de.H5,de.H6]);X.STYLE,X.SCRIPT,X.XMP,X.IFRAME,X.NOEMBED,X.NOFRAMES,X.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 et={DATA:H.DATA,RCDATA:H.RCDATA,RAWTEXT:H.RAWTEXT,SCRIPT_DATA:H.SCRIPT_DATA,PLAINTEXT:H.PLAINTEXT,CDATA_SECTION:H.CDATA_SECTION};function nS(e){return e>=B.DIGIT_0&&e<=B.DIGIT_9}function Vr(e){return e>=B.LATIN_CAPITAL_A&&e<=B.LATIN_CAPITAL_Z}function rS(e){return e>=B.LATIN_SMALL_A&&e<=B.LATIN_SMALL_Z}function dn(e){return rS(e)||Vr(e)}function pd(e){return dn(e)||nS(e)}function Ws(e){return e+32}function mp(e){return e===B.SPACE||e===B.LINE_FEED||e===B.TABULATION||e===B.FORM_FEED}function gd(e){return mp(e)||e===B.SOLIDUS||e===B.GREATER_THAN_SIGN}function sS(e){return e===B.NULL?ne.nullCharacterReference:e>1114111?ne.characterReferenceOutsideUnicodeRange:up(e)?ne.surrogateCharacterReference:hp(e)?ne.noncharacterCharacterReference:dp(e)||e===B.CARRIAGE_RETURN?ne.controlCharacterReference:null}class iS{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 $w(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Jw(qw,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ne.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(ne.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=sS(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:Oe.START_TAG,tagName:"",tagID:y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Oe.END_TAG,tagName:"",tagID:y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:Oe.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:Oe.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(fp(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(ne.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=wr(t.tagName),t.type===Oe.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(ne.endTagWithAttributes),t.selfClosing&&this._err(ne.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 Oe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Oe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Oe.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:Oe.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=mp(t)?Oe.WHITESPACE_CHARACTER:t===B.NULL?Oe.NULL_CHARACTER:Oe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Oe.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=H.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?rn.Attribute:rn.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 B.LESS_THAN_SIGN:{this.state=H.TAG_OPEN;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitCodePoint(t);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case B.AMPERSAND:{this._startCharacterReference();break}case B.LESS_THAN_SIGN:{this.state=H.RCDATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitChars(Qe);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case B.LESS_THAN_SIGN:{this.state=H.RAWTEXT_LESS_THAN_SIGN;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitChars(Qe);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitChars(Qe);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitChars(Qe);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(dn(t))this._createStartTagToken(),this.state=H.TAG_NAME,this._stateTagName(t);else switch(t){case B.EXCLAMATION_MARK:{this.state=H.MARKUP_DECLARATION_OPEN;break}case B.SOLIDUS:{this.state=H.END_TAG_OPEN;break}case B.QUESTION_MARK:{this._err(ne.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=H.BOGUS_COMMENT,this._stateBogusComment(t);break}case B.EOF:{this._err(ne.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ne.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=H.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(dn(t))this._createEndTagToken(),this.state=H.TAG_NAME,this._stateTagName(t);else switch(t){case B.GREATER_THAN_SIGN:{this._err(ne.missingEndTagName),this.state=H.DATA;break}case B.EOF:{this._err(ne.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(ne.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=H.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=H.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this.state=H.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.tagName+=Qe;break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(Vr(t)?Ws(t):t)}}_stateRcdataLessThanSign(t){t===B.SOLIDUS?this.state=H.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=H.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){dn(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 B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=H.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=H.SELF_CLOSING_START_TAG,!1;case B.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===B.SOLIDUS?this.state=H.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=H.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){dn(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 B.SOLIDUS:{this.state=H.SCRIPT_DATA_END_TAG_OPEN;break}case B.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){dn(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===B.HYPHEN_MINUS?(this.state=H.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=H.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===B.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 B.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitChars(Qe);break}case B.EOF:{this._err(ne.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case B.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_ESCAPED,this._emitChars(Qe);break}case B.EOF:{this._err(ne.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.GREATER_THAN_SIGN:{this.state=H.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_ESCAPED,this._emitChars(Qe);break}case B.EOF:{this._err(ne.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===B.SOLIDUS?this.state=H.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:dn(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){dn(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(xt.SCRIPT,!1)&&gd(this.preprocessor.peek(xt.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<xt.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 B.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this._emitChars(Qe);break}case B.EOF:{this._err(ne.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case B.HYPHEN_MINUS:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Qe);break}case B.EOF:{this._err(ne.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.GREATER_THAN_SIGN:{this.state=H.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Qe);break}case B.EOF:{this._err(ne.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=H.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===B.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(xt.SCRIPT,!1)&&gd(this.preprocessor.peek(xt.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<xt.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 B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this.state=H.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case B.EQUALS_SIGN:{this._err(ne.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 B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this._leaveAttrName(),this.state=H.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case B.EQUALS_SIGN:{this._leaveAttrName(),this.state=H.BEFORE_ATTRIBUTE_VALUE;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:{this._err(ne.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.currentAttr.name+=Qe;break}default:this.currentAttr.name+=String.fromCodePoint(Vr(t)?Ws(t):t)}}_stateAfterAttributeName(t){switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:{this.state=H.SELF_CLOSING_START_TAG;break}case B.EQUALS_SIGN:{this.state=H.BEFORE_ATTRIBUTE_VALUE;break}case B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=H.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{this.state=H.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this.state=H.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(ne.missingAttributeValue),this.state=H.DATA,this.emitCurrentTagToken();break}default:this.state=H.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case B.QUOTATION_MARK:{this.state=H.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.currentAttr.value+=Qe;break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case B.APOSTROPHE:{this.state=H.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.currentAttr.value+=Qe;break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=H.BEFORE_ATTRIBUTE_NAME;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=H.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(ne.unexpectedNullCharacter),this.currentAttr.value+=Qe;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:{this._err(ne.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=H.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this._leaveAttrValue(),this.state=H.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=H.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:this._err(ne.missingWhitespaceBetweenAttributes),this.state=H.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case B.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=H.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(ne.eofInTag),this._emitEOFToken();break}default:this._err(ne.unexpectedSolidusInTag),this.state=H.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentComment(n);break}case B.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.data+=Qe;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(xt.DASH_DASH,!0)?(this._createCommentToken(xt.DASH_DASH.length+1),this.state=H.COMMENT_START):this._consumeSequenceIfMatch(xt.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(xt.DOCTYPE.length+1),this.state=H.DOCTYPE):this._consumeSequenceIfMatch(xt.CDATA_START,!0)?this.inForeignNode?this.state=H.CDATA_SECTION:(this._err(ne.cdataInHtmlContent),this._createCommentToken(xt.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=H.BOGUS_COMMENT):this._ensureHibernation()||(this._err(ne.incorrectlyOpenedComment),this._createCommentToken(2),this.state=H.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case B.HYPHEN_MINUS:{this.state=H.COMMENT_START_DASH;break}case B.GREATER_THAN_SIGN:{this._err(ne.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 B.HYPHEN_MINUS:{this.state=H.COMMENT_END;break}case B.GREATER_THAN_SIGN:{this._err(ne.abruptClosingOfEmptyComment),this.state=H.DATA,this.emitCurrentComment(n);break}case B.EOF:{this._err(ne.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 B.HYPHEN_MINUS:{this.state=H.COMMENT_END_DASH;break}case B.LESS_THAN_SIGN:{n.data+="<",this.state=H.COMMENT_LESS_THAN_SIGN;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.data+=Qe;break}case B.EOF:{this._err(ne.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case B.EXCLAMATION_MARK:{n.data+="!",this.state=H.COMMENT_LESS_THAN_SIGN_BANG;break}case B.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=H.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===B.HYPHEN_MINUS?this.state=H.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=H.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===B.HYPHEN_MINUS?this.state=H.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=H.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==B.GREATER_THAN_SIGN&&t!==B.EOF&&this._err(ne.nestedComment),this.state=H.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case B.HYPHEN_MINUS:{this.state=H.COMMENT_END;break}case B.EOF:{this._err(ne.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 B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentComment(n);break}case B.EXCLAMATION_MARK:{this.state=H.COMMENT_END_BANG;break}case B.HYPHEN_MINUS:{n.data+="-";break}case B.EOF:{this._err(ne.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 B.HYPHEN_MINUS:{n.data+="--!",this.state=H.COMMENT_END_DASH;break}case B.GREATER_THAN_SIGN:{this._err(ne.incorrectlyClosedComment),this.state=H.DATA,this.emitCurrentComment(n);break}case B.EOF:{this._err(ne.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=H.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=H.BEFORE_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=H.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case B.EOF:{this._err(ne.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingWhitespaceBeforeDoctypeName),this.state=H.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(Vr(t))this._createDoctypeToken(String.fromCharCode(Ws(t))),this.state=H.DOCTYPE_NAME;else switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.NULL:{this._err(ne.unexpectedNullCharacter),this._createDoctypeToken(Qe),this.state=H.DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this._err(ne.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.EOF:{this._err(ne.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 B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=H.AFTER_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.name+=Qe;break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(Vr(t)?Ws(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(xt.PUBLIC,!1)?this.state=H.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(xt.SYSTEM,!1)?this.state=H.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(ne.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=H.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(ne.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(ne.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(ne.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{n.publicId="",this.state=H.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(ne.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case B.QUOTATION_MARK:{this.state=H.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.publicId+=Qe;break}case B.GREATER_THAN_SIGN:{this._err(ne.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.EOF:{this._err(ne.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 B.APOSTROPHE:{this.state=H.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.publicId+=Qe;break}case B.GREATER_THAN_SIGN:{this._err(ne.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.EOF:{this._err(ne.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 B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=H.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case B.GREATER_THAN_SIGN:{this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.QUOTATION_MARK:{this._err(ne.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(ne.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.QUOTATION_MARK:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=H.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(ne.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(ne.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(ne.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{n.systemId="",this.state=H.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(ne.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.DATA,this.emitCurrentDoctype(n);break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case B.QUOTATION_MARK:{this.state=H.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.systemId+=Qe;break}case B.GREATER_THAN_SIGN:{this._err(ne.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.EOF:{this._err(ne.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 B.APOSTROPHE:{this.state=H.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(ne.unexpectedNullCharacter),n.systemId+=Qe;break}case B.GREATER_THAN_SIGN:{this._err(ne.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.EOF:{this._err(ne.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 B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.EOF:{this._err(ne.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ne.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=H.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=H.DATA;break}case B.NULL:{this._err(ne.unexpectedNullCharacter);break}case B.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case B.RIGHT_SQUARE_BRACKET:{this.state=H.CDATA_SECTION_BRACKET;break}case B.EOF:{this._err(ne.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===B.RIGHT_SQUARE_BRACKET?this.state=H.CDATA_SECTION_END:(this._emitChars("]"),this.state=H.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case B.GREATER_THAN_SIGN:{this.state=H.DATA;break}case B.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(B.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&pd(this.preprocessor.peek(1))?H.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){pd(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===B.SEMICOLON&&this._err(ne.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const pp=new Set([y.DD,y.DT,y.LI,y.OPTGROUP,y.OPTION,y.P,y.RB,y.RP,y.RT,y.RTC]),xd=new Set([...pp,y.CAPTION,y.COLGROUP,y.TBODY,y.TD,y.TFOOT,y.TH,y.THEAD,y.TR]),Ai=new Set([y.APPLET,y.CAPTION,y.HTML,y.MARQUEE,y.OBJECT,y.TABLE,y.TD,y.TEMPLATE,y.TH]),aS=new Set([...Ai,y.OL,y.UL]),oS=new Set([...Ai,y.BUTTON]),bd=new Set([y.ANNOTATION_XML,y.MI,y.MN,y.MO,y.MS,y.MTEXT]),yd=new Set([y.DESC,y.FOREIGN_OBJECT,y.TITLE]),lS=new Set([y.TR,y.TEMPLATE,y.HTML]),cS=new Set([y.TBODY,y.TFOOT,y.THEAD,y.TEMPLATE,y.HTML]),uS=new Set([y.TABLE,y.TEMPLATE,y.HTML]),dS=new Set([y.TD,y.TH]);class hS{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(Qo,ue.HTML)}popUntilTableCellPopped(){this.popUntilPopped(dS,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(uS,ue.HTML)}clearBackToTableBodyContext(){this.clearBackTo(cS,ue.HTML)}clearBackToTableRowContext(){this.clearBackTo(lS,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(yd.has(i))return!1;break}case ue.MATHML:{if(bd.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Ai)}hasInListItemScope(t){return this.hasInDynamicScope(t,aS)}hasInButtonScope(t){return this.hasInDynamicScope(t,oS)}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(Qo.has(n))return!0;if(Ai.has(n))return!1;break}case ue.SVG:{if(yd.has(n))return!1;break}case ue.MATHML:{if(bd.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&&pp.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&xd.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&xd.has(this.currentTagId);)this.pop()}}const Ka=3;var $t;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})($t||($t={}));const vd={type:$t.Marker};class fS{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===$t.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<Ka)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<Ka)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>=Ka&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(vd)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:$t.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:$t.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(vd);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===$t.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===$t.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===$t.Element&&n.element===t)}}const hn={createDocument(){return{nodeName:"#document",mode:Mt.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};hn.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(hn.isTextNode(n)){n.value+=t;return}}hn.appendChild(e,hn.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&hn.isTextNode(r)?r.value+=t:hn.insertBefore(e,hn.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}}},gp="html",mS="about:legacy-compat",pS="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",xp=["+//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//"],gS=[...xp,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],xS=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),bp=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],bS=[...bp,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Ed(e,t){return t.some(n=>e.startsWith(n))}function yS(e){return e.name===gp&&e.publicId===null&&(e.systemId===null||e.systemId===mS)}function vS(e){if(e.name!==gp)return Mt.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===pS)return Mt.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),xS.has(n))return Mt.QUIRKS;let r=t===null?gS:xp;if(Ed(n,r))return Mt.QUIRKS;if(r=t===null?bp:bS,Ed(n,r))return Mt.LIMITED_QUIRKS}return Mt.NO_QUIRKS}const kd={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},ES="definitionurl",kS="definitionURL",TS=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])),wS=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}]]),SS=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])),CS=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 AS(e){const t=e.tagID;return t===y.FONT&&e.attrs.some(({name:r})=>r===Un.COLOR||r===Un.SIZE||r===Un.FACE)||CS.has(t)}function yp(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===ES){e.attrs[t].name=kS;break}}function vp(e){for(let t=0;t<e.attrs.length;t++){const n=TS.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function ic(e){for(let t=0;t<e.attrs.length;t++){const n=wS.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 NS(e){const t=SS.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=wr(e.tagName))}function _S(e,t){return t===ue.MATHML&&(e===y.MI||e===y.MO||e===y.MN||e===y.MS||e===y.MTEXT)}function IS(e,t,n){if(t===ue.MATHML&&e===y.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Un.ENCODING){const i=n[r].value.toLowerCase();return i===kd.TEXT_HTML||i===kd.APPLICATION_XML}}return t===ue.SVG&&(e===y.FOREIGN_OBJECT||e===y.DESC||e===y.TITLE)}function MS(e,t,n,r){return(!r||r===ue.HTML)&&IS(e,t,n)||(!r||r===ue.MATHML)&&_S(e,t)}const RS="hidden",LS=8,PS=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 DS={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Ep=new Set([y.TABLE,y.TBODY,y.TFOOT,y.THEAD,y.TR]),Td={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:hn,onParseError:null};class wd{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={...Td,...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 iS(this.options,this),this.activeFormattingElements=new fS(this.treeAdapter),this.fragmentContextID=r?wr(this.treeAdapter.getTagName(r)):y.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new hS(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={...Td,...n};t??(t=r.treeAdapter.createElement(X.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:DS,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=et.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)===X.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=et.RCDATA;break}case y.STYLE:case y.XMP:case y.IFRAME:case y.NOEMBED:case y.NOFRAMES:case y.NOSCRIPT:{this.tokenizer.state=et.RAWTEXT;break}case y.SCRIPT:{this.tokenizer.state=et.SCRIPT_DATA;break}case y.PLAINTEXT:{this.tokenizer.state=et.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(X.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===Oe.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)===X.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 Oe.CHARACTER:{this.onCharacter(t);break}case Oe.NULL_CHARACTER:{this.onNullCharacter(t);break}case Oe.COMMENT:{this.onComment(t);break}case Oe.DOCTYPE:{this.onDoctype(t);break}case Oe.START_TAG:{this._processStartTag(t);break}case Oe.END_TAG:{this.onEndTag(t);break}case Oe.EOF:{this.onEof(t);break}case Oe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return MS(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===$t.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 Ep.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 tS[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){d3(this,t);return}switch(this.insertionMode){case z.INITIAL:{jr(this,t);break}case z.BEFORE_HTML:{Qr(this,t);break}case z.BEFORE_HEAD:{Jr(this,t);break}case z.IN_HEAD:{Zr(this,t);break}case z.IN_HEAD_NO_SCRIPT:{es(this,t);break}case z.AFTER_HEAD:{ts(this,t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:{Tp(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:{Xa(this,t);break}case z.IN_TABLE_TEXT:{_p(this,t);break}case z.IN_COLUMN_GROUP:{Ni(this,t);break}case z.AFTER_BODY:{_i(this,t);break}case z.AFTER_AFTER_BODY:{li(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){u3(this,t);return}switch(this.insertionMode){case z.INITIAL:{jr(this,t);break}case z.BEFORE_HTML:{Qr(this,t);break}case z.BEFORE_HEAD:{Jr(this,t);break}case z.IN_HEAD:{Zr(this,t);break}case z.IN_HEAD_NO_SCRIPT:{es(this,t);break}case z.AFTER_HEAD:{ts(this,t);break}case z.TEXT:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{Xa(this,t);break}case z.IN_COLUMN_GROUP:{Ni(this,t);break}case z.AFTER_BODY:{_i(this,t);break}case z.AFTER_AFTER_BODY:{li(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){Jo(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:{Jo(this,t);break}case z.IN_TABLE_TEXT:{Fr(this,t);break}case z.AFTER_BODY:{zS(this,t);break}case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{VS(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case z.INITIAL:{$S(this,t);break}case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:{this._err(t,ne.misplacedDoctype);break}case z.IN_TABLE_TEXT:{Fr(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ne.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?h3(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{jr(this,t);break}case z.BEFORE_HTML:{qS(this,t);break}case z.BEFORE_HEAD:{YS(this,t);break}case z.IN_HEAD:{Ut(this,t);break}case z.IN_HEAD_NO_SCRIPT:{XS(this,t);break}case z.AFTER_HEAD:{JS(this,t);break}case z.IN_BODY:{dt(this,t);break}case z.IN_TABLE:{xr(this,t);break}case z.IN_TABLE_TEXT:{Fr(this,t);break}case z.IN_CAPTION:{GC(this,t);break}case z.IN_COLUMN_GROUP:{lc(this,t);break}case z.IN_TABLE_BODY:{ra(this,t);break}case z.IN_ROW:{sa(this,t);break}case z.IN_CELL:{QC(this,t);break}case z.IN_SELECT:{Rp(this,t);break}case z.IN_SELECT_IN_TABLE:{ZC(this,t);break}case z.IN_TEMPLATE:{t3(this,t);break}case z.AFTER_BODY:{r3(this,t);break}case z.IN_FRAMESET:{s3(this,t);break}case z.AFTER_FRAMESET:{a3(this,t);break}case z.AFTER_AFTER_BODY:{l3(this,t);break}case z.AFTER_AFTER_FRAMESET:{c3(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?f3(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{jr(this,t);break}case z.BEFORE_HTML:{WS(this,t);break}case z.BEFORE_HEAD:{GS(this,t);break}case z.IN_HEAD:{KS(this,t);break}case z.IN_HEAD_NO_SCRIPT:{QS(this,t);break}case z.AFTER_HEAD:{ZS(this,t);break}case z.IN_BODY:{na(this,t);break}case z.TEXT:{FC(this,t);break}case z.IN_TABLE:{fs(this,t);break}case z.IN_TABLE_TEXT:{Fr(this,t);break}case z.IN_CAPTION:{KC(this,t);break}case z.IN_COLUMN_GROUP:{XC(this,t);break}case z.IN_TABLE_BODY:{Zo(this,t);break}case z.IN_ROW:{Mp(this,t);break}case z.IN_CELL:{JC(this,t);break}case z.IN_SELECT:{Lp(this,t);break}case z.IN_SELECT_IN_TABLE:{e3(this,t);break}case z.IN_TEMPLATE:{n3(this,t);break}case z.AFTER_BODY:{Dp(this,t);break}case z.IN_FRAMESET:{i3(this,t);break}case z.AFTER_FRAMESET:{o3(this,t);break}case z.AFTER_AFTER_BODY:{li(this,t);break}}}onEof(t){switch(this.insertionMode){case z.INITIAL:{jr(this,t);break}case z.BEFORE_HTML:{Qr(this,t);break}case z.BEFORE_HEAD:{Jr(this,t);break}case z.IN_HEAD:{Zr(this,t);break}case z.IN_HEAD_NO_SCRIPT:{es(this,t);break}case z.AFTER_HEAD:{ts(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:{Ap(this,t);break}case z.TEXT:{BC(this,t);break}case z.IN_TABLE_TEXT:{Fr(this,t);break}case z.IN_TEMPLATE:{Pp(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:{oc(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===B.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:{kp(this,t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{Xa(this,t);break}case z.IN_TABLE_TEXT:{Np(this,t);break}}}}function OS(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):Cp(e,t),n}function jS(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 FS(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>=PS;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=BS(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function BS(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 HS(e,t,n){const r=e.treeAdapter.getTagName(t),i=wr(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 US(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 ac(e,t){for(let n=0;n<LS;n++){const r=OS(e,t);if(!r)break;const i=jS(e,r);if(!i)break;e.activeFormattingElements.bookmark=r;const s=FS(e,i,r.element),a=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(s),a&&HS(e,a,s),US(e,i,r)}}function Jo(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function zS(e,t){e._appendCommentNode(t,e.openElements.items[0])}function VS(e,t){e._appendCommentNode(t,e.document)}function oc(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 $S(e,t){e._setDocumentType(t);const n=t.forceQuirks?Mt.QUIRKS:vS(t);yS(t)||e._err(t,ne.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=z.BEFORE_HTML}function jr(e,t){e._err(t,ne.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Mt.QUIRKS),e.insertionMode=z.BEFORE_HTML,e._processToken(t)}function qS(e,t){t.tagID===y.HTML?(e._insertElement(t,ue.HTML),e.insertionMode=z.BEFORE_HEAD):Qr(e,t)}function WS(e,t){const n=t.tagID;(n===y.HTML||n===y.HEAD||n===y.BODY||n===y.BR)&&Qr(e,t)}function Qr(e,t){e._insertFakeRootElement(),e.insertionMode=z.BEFORE_HEAD,e._processToken(t)}function YS(e,t){switch(t.tagID){case y.HTML:{dt(e,t);break}case y.HEAD:{e._insertElement(t,ue.HTML),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD;break}default:Jr(e,t)}}function GS(e,t){const n=t.tagID;n===y.HEAD||n===y.BODY||n===y.HTML||n===y.BR?Jr(e,t):e._err(t,ne.endTagWithoutMatchingOpenElement)}function Jr(e,t){e._insertFakeElement(X.HEAD,y.HEAD),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD,e._processToken(t)}function Ut(e,t){switch(t.tagID){case y.HTML:{dt(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,et.RCDATA);break}case y.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,et.RAWTEXT):(e._insertElement(t,ue.HTML),e.insertionMode=z.IN_HEAD_NO_SCRIPT);break}case y.NOFRAMES:case y.STYLE:{e._switchToTextParsing(t,et.RAWTEXT);break}case y.SCRIPT:{e._switchToTextParsing(t,et.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,ne.misplacedStartTagForHeadElement);break}default:Zr(e,t)}}function KS(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:{Zr(e,t);break}case y.TEMPLATE:{Kn(e,t);break}default:e._err(t,ne.endTagWithoutMatchingOpenElement)}}function Kn(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==y.TEMPLATE&&e._err(t,ne.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ne.endTagWithoutMatchingOpenElement)}function Zr(e,t){e.openElements.pop(),e.insertionMode=z.AFTER_HEAD,e._processToken(t)}function XS(e,t){switch(t.tagID){case y.HTML:{dt(e,t);break}case y.BASEFONT:case y.BGSOUND:case y.HEAD:case y.LINK:case y.META:case y.NOFRAMES:case y.STYLE:{Ut(e,t);break}case y.NOSCRIPT:{e._err(t,ne.nestedNoscriptInHead);break}default:es(e,t)}}function QS(e,t){switch(t.tagID){case y.NOSCRIPT:{e.openElements.pop(),e.insertionMode=z.IN_HEAD;break}case y.BR:{es(e,t);break}default:e._err(t,ne.endTagWithoutMatchingOpenElement)}}function es(e,t){const n=t.type===Oe.EOF?ne.openElementsLeftAfterEof:ne.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=z.IN_HEAD,e._processToken(t)}function JS(e,t){switch(t.tagID){case y.HTML:{dt(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,ne.abandonedHeadElementChild),e.openElements.push(e.headElement,y.HEAD),Ut(e,t),e.openElements.remove(e.headElement);break}case y.HEAD:{e._err(t,ne.misplacedStartTagForHeadElement);break}default:ts(e,t)}}function ZS(e,t){switch(t.tagID){case y.BODY:case y.HTML:case y.BR:{ts(e,t);break}case y.TEMPLATE:{Kn(e,t);break}default:e._err(t,ne.endTagWithoutMatchingOpenElement)}}function ts(e,t){e._insertFakeElement(X.BODY,y.BODY),e.insertionMode=z.IN_BODY,ta(e,t)}function ta(e,t){switch(t.type){case Oe.CHARACTER:{Tp(e,t);break}case Oe.WHITESPACE_CHARACTER:{kp(e,t);break}case Oe.COMMENT:{Jo(e,t);break}case Oe.START_TAG:{dt(e,t);break}case Oe.END_TAG:{na(e,t);break}case Oe.EOF:{Ap(e,t);break}}}function kp(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function Tp(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function eC(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function tC(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function nC(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 rC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML)}function sC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Qo.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ue.HTML)}function iC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function aC(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 oC(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 lC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),e.tokenizer.state=et.PLAINTEXT}function cC(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 uC(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(X.A);n&&(ac(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 dC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function hC(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(y.NOBR)&&(ac(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ue.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function fC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function mC(e,t){e.treeAdapter.getDocumentMode(e.document)!==Mt.QUIRKS&&e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._insertElement(t,ue.HTML),e.framesetOk=!1,e.insertionMode=z.IN_TABLE}function wp(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ue.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Sp(e){const t=fp(e,Un.TYPE);return t!=null&&t.toLowerCase()===RS}function pC(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ue.HTML),Sp(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function gC(e,t){e._appendElement(t,ue.HTML),t.ackSelfClosing=!0}function xC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._appendElement(t,ue.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function bC(e,t){t.tagName=X.IMG,t.tagID=y.IMG,wp(e,t)}function yC(e,t){e._insertElement(t,ue.HTML),e.skipNextNewLine=!0,e.tokenizer.state=et.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=z.TEXT}function vC(e,t){e.openElements.hasInButtonScope(y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,et.RAWTEXT)}function EC(e,t){e.framesetOk=!1,e._switchToTextParsing(t,et.RAWTEXT)}function Sd(e,t){e._switchToTextParsing(t,et.RAWTEXT)}function kC(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 TC(e,t){e.openElements.currentTagId===y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML)}function wC(e,t){e.openElements.hasInScope(y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ue.HTML)}function SC(e,t){e.openElements.hasInScope(y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(y.RTC),e._insertElement(t,ue.HTML)}function CC(e,t){e._reconstructActiveFormattingElements(),yp(t),ic(t),t.selfClosing?e._appendElement(t,ue.MATHML):e._insertElement(t,ue.MATHML),t.ackSelfClosing=!0}function AC(e,t){e._reconstructActiveFormattingElements(),vp(t),ic(t),t.selfClosing?e._appendElement(t,ue.SVG):e._insertElement(t,ue.SVG),t.ackSelfClosing=!0}function Cd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ue.HTML)}function dt(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:{dC(e,t);break}case y.A:{uC(e,t);break}case y.H1:case y.H2:case y.H3:case y.H4:case y.H5:case y.H6:{sC(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:{rC(e,t);break}case y.LI:case y.DD:case y.DT:{oC(e,t);break}case y.BR:case y.IMG:case y.WBR:case y.AREA:case y.EMBED:case y.KEYGEN:{wp(e,t);break}case y.HR:{xC(e,t);break}case y.RB:case y.RTC:{wC(e,t);break}case y.RT:case y.RP:{SC(e,t);break}case y.PRE:case y.LISTING:{iC(e,t);break}case y.XMP:{vC(e,t);break}case y.SVG:{AC(e,t);break}case y.HTML:{eC(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:{Ut(e,t);break}case y.BODY:{tC(e,t);break}case y.FORM:{aC(e,t);break}case y.NOBR:{hC(e,t);break}case y.MATH:{CC(e,t);break}case y.TABLE:{mC(e,t);break}case y.INPUT:{pC(e,t);break}case y.PARAM:case y.TRACK:case y.SOURCE:{gC(e,t);break}case y.IMAGE:{bC(e,t);break}case y.BUTTON:{cC(e,t);break}case y.APPLET:case y.OBJECT:case y.MARQUEE:{fC(e,t);break}case y.IFRAME:{EC(e,t);break}case y.SELECT:{kC(e,t);break}case y.OPTION:case y.OPTGROUP:{TC(e,t);break}case y.NOEMBED:case y.NOFRAMES:{Sd(e,t);break}case y.FRAMESET:{nC(e,t);break}case y.TEXTAREA:{yC(e,t);break}case y.NOSCRIPT:{e.options.scriptingEnabled?Sd(e,t):Cd(e,t);break}case y.PLAINTEXT:{lC(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:Cd(e,t)}}function NC(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 _C(e,t){e.openElements.hasInScope(y.BODY)&&(e.insertionMode=z.AFTER_BODY,Dp(e,t))}function IC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function MC(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 RC(e){e.openElements.hasInButtonScope(y.P)||e._insertFakeElement(X.P,y.P),e._closePElement()}function LC(e){e.openElements.hasInListItemScope(y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(y.LI),e.openElements.popUntilTagNamePopped(y.LI))}function PC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function DC(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function OC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function jC(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(X.BR,y.BR),e.openElements.pop(),e.framesetOk=!1}function Cp(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 na(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:{ac(e,t);break}case y.P:{RC(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:{IC(e,t);break}case y.LI:{LC(e);break}case y.DD:case y.DT:{PC(e,t);break}case y.H1:case y.H2:case y.H3:case y.H4:case y.H5:case y.H6:{DC(e);break}case y.BR:{jC(e);break}case y.BODY:{NC(e,t);break}case y.HTML:{_C(e,t);break}case y.FORM:{MC(e);break}case y.APPLET:case y.OBJECT:case y.MARQUEE:{OC(e,t);break}case y.TEMPLATE:{Kn(e,t);break}default:Cp(e,t)}}function Ap(e,t){e.tmplInsertionModeStack.length>0?Pp(e,t):oc(e,t)}function FC(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 BC(e,t){e._err(t,ne.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Xa(e,t){if(e.openElements.currentTagId!==void 0&&Ep.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 Oe.CHARACTER:{_p(e,t);break}case Oe.WHITESPACE_CHARACTER:{Np(e,t);break}}else Cs(e,t)}function HC(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_CAPTION}function UC(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_COLUMN_GROUP}function zC(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(X.COLGROUP,y.COLGROUP),e.insertionMode=z.IN_COLUMN_GROUP,lc(e,t)}function VC(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ue.HTML),e.insertionMode=z.IN_TABLE_BODY}function $C(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(X.TBODY,y.TBODY),e.insertionMode=z.IN_TABLE_BODY,ra(e,t)}function qC(e,t){e.openElements.hasInTableScope(y.TABLE)&&(e.openElements.popUntilTagNamePopped(y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function WC(e,t){Sp(t)?e._appendElement(t,ue.HTML):Cs(e,t),t.ackSelfClosing=!0}function YC(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ue.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function xr(e,t){switch(t.tagID){case y.TD:case y.TH:case y.TR:{$C(e,t);break}case y.STYLE:case y.SCRIPT:case y.TEMPLATE:{Ut(e,t);break}case y.COL:{zC(e,t);break}case y.FORM:{YC(e,t);break}case y.TABLE:{qC(e,t);break}case y.TBODY:case y.TFOOT:case y.THEAD:{VC(e,t);break}case y.INPUT:{WC(e,t);break}case y.CAPTION:{HC(e,t);break}case y.COLGROUP:{UC(e,t);break}default:Cs(e,t)}}function fs(e,t){switch(t.tagID){case y.TABLE:{e.openElements.hasInTableScope(y.TABLE)&&(e.openElements.popUntilTagNamePopped(y.TABLE),e._resetInsertionMode());break}case y.TEMPLATE:{Kn(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:Cs(e,t)}}function Cs(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,ta(e,t),e.fosterParentingEnabled=n}function Np(e,t){e.pendingCharacterTokens.push(t)}function _p(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Fr(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Cs(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Ip=new Set([y.CAPTION,y.COL,y.COLGROUP,y.TBODY,y.TD,y.TFOOT,y.TH,y.THEAD,y.TR]);function GC(e,t){const n=t.tagID;Ip.has(n)?e.openElements.hasInTableScope(y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=z.IN_TABLE,xr(e,t)):dt(e,t)}function KC(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&&fs(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:na(e,t)}}function lc(e,t){switch(t.tagID){case y.HTML:{dt(e,t);break}case y.COL:{e._appendElement(t,ue.HTML),t.ackSelfClosing=!0;break}case y.TEMPLATE:{Ut(e,t);break}default:Ni(e,t)}}function XC(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:{Kn(e,t);break}case y.COL:break;default:Ni(e,t)}}function Ni(e,t){e.openElements.currentTagId===y.COLGROUP&&(e.openElements.pop(),e.insertionMode=z.IN_TABLE,e._processToken(t))}function ra(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(X.TR,y.TR),e.insertionMode=z.IN_ROW,sa(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,xr(e,t));break}default:xr(e,t)}}function Zo(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,fs(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:fs(e,t)}}function sa(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,ra(e,t));break}default:xr(e,t)}}function Mp(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,Zo(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,Zo(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:fs(e,t)}}function QC(e,t){const n=t.tagID;Ip.has(n)?(e.openElements.hasInTableScope(y.TD)||e.openElements.hasInTableScope(y.TH))&&(e._closeTableCell(),sa(e,t)):dt(e,t)}function JC(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(),Mp(e,t));break}case y.BODY:case y.CAPTION:case y.COL:case y.COLGROUP:case y.HTML:break;default:na(e,t)}}function Rp(e,t){switch(t.tagID){case y.HTML:{dt(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:{Ut(e,t);break}}}function Lp(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:{Kn(e,t);break}}}function ZC(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)):Rp(e,t)}function e3(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)):Lp(e,t)}function t3(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:{Ut(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,xr(e,t);break}case y.COL:{e.tmplInsertionModeStack[0]=z.IN_COLUMN_GROUP,e.insertionMode=z.IN_COLUMN_GROUP,lc(e,t);break}case y.TR:{e.tmplInsertionModeStack[0]=z.IN_TABLE_BODY,e.insertionMode=z.IN_TABLE_BODY,ra(e,t);break}case y.TD:case y.TH:{e.tmplInsertionModeStack[0]=z.IN_ROW,e.insertionMode=z.IN_ROW,sa(e,t);break}default:e.tmplInsertionModeStack[0]=z.IN_BODY,e.insertionMode=z.IN_BODY,dt(e,t)}}function n3(e,t){t.tagID===y.TEMPLATE&&Kn(e,t)}function Pp(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):oc(e,t)}function r3(e,t){t.tagID===y.HTML?dt(e,t):_i(e,t)}function Dp(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 _i(e,t)}function _i(e,t){e.insertionMode=z.IN_BODY,ta(e,t)}function s3(e,t){switch(t.tagID){case y.HTML:{dt(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:{Ut(e,t);break}}}function i3(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 a3(e,t){switch(t.tagID){case y.HTML:{dt(e,t);break}case y.NOFRAMES:{Ut(e,t);break}}}function o3(e,t){t.tagID===y.HTML&&(e.insertionMode=z.AFTER_AFTER_FRAMESET)}function l3(e,t){t.tagID===y.HTML?dt(e,t):li(e,t)}function li(e,t){e.insertionMode=z.IN_BODY,ta(e,t)}function c3(e,t){switch(t.tagID){case y.HTML:{dt(e,t);break}case y.NOFRAMES:{Ut(e,t);break}}}function u3(e,t){t.chars=Qe,e._insertCharacters(t)}function d3(e,t){e._insertCharacters(t),e.framesetOk=!1}function Op(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 h3(e,t){if(AS(t))Op(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ue.MATHML?yp(t):r===ue.SVG&&(NS(t),vp(t)),ic(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function f3(e,t){if(t.tagID===y.P||t.tagID===y.BR){Op(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}}}X.AREA,X.BASE,X.BASEFONT,X.BGSOUND,X.BR,X.COL,X.EMBED,X.FRAME,X.HR,X.IMG,X.INPUT,X.KEYGEN,X.LINK,X.META,X.PARAM,X.SOURCE,X.TRACK,X.WBR;const m3=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,p3=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Ad={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function jp(e,t){const n=S3(e),r=Bm("type",{handlers:{root:g3,element:x3,text:b3,comment:Bp,doctype:y3,raw:E3},unknown:k3}),i={parser:n?new wd(Ad):wd.getFragmentParser(void 0,Ad),handle(o){r(o,i)},stitches:!1,options:t||{}};r(e,i),Sr(i,Qt());const s=n?i.parser.document:i.parser.getFragment(),a=Cw(s,{file:i.options.file});return i.stitches&&ea(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 Fp(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function g3(e,t){Fp(e.children,t)}function x3(e,t){T3(e,t),Fp(e.children,t),w3(e,t)}function b3(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:Oe.CHARACTER,chars:e.value,location:As(e)};Sr(t,Qt(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function y3(e,t){const n={type:Oe.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:As(e)};Sr(t,Qt(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function v3(e,t){t.stitches=!0;const n=C3(e);if("children"in e&&"children"in n){const r=jp({type:"root",children:e.children},t.options);n.children=r.children}Bp({type:"comment",value:{stitch:n}},t)}function Bp(e,t){const n=e.value,r={type:Oe.COMMENT,data:n,location:As(e)};Sr(t,Qt(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function E3(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,Hp(t,Qt(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(m3,"<$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 k3(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))v3(n,t);else{let r="";throw p3.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 Sr(e,t){Hp(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=et.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 Hp(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 T3(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===et.PLAINTEXT)return;Sr(t,Qt(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:Pn.html;i===Pn.html&&n==="svg"&&(i=Pn.svg);const s=Mw({...e,children:[]},{space:i===Pn.svg?"svg":"html"}),a={type:Oe.START_TAG,tagName:n,tagID:wr(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:As(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function w3(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Bw.includes(n)||t.parser.tokenizer.state===et.PLAINTEXT)return;Sr(t,Gi(e));const r={type:Oe.END_TAG,tagName:n,tagID:wr(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:As(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===et.RCDATA||t.parser.tokenizer.state===et.RAWTEXT||t.parser.tokenizer.state===et.SCRIPT_DATA)&&(t.parser.tokenizer.state=et.DATA)}function S3(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function As(e){const t=Qt(e)||{line:void 0,column:void 0,offset:void 0},n=Gi(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 C3(e){return"children"in e?Yn({...e,children:[]}):Yn(e)}function Up(e){return function(t,n){return jp(t,{...e,file:n})}}const An=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],ns={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...An,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...An],h2:[["className","sr-only"]],img:[...An,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...An,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...An],table:[...An],ul:[...An,["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"]},mn={}.hasOwnProperty;function A3(e,t){let n={type:"root",children:[]};const r={schema:t?{...ns,...t}:ns,stack:[]},i=zp(r,e);return i&&(Array.isArray(i)?i.length===1?n=i[0]:n.children=i:n=i),n}function zp(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return N3(e,n);case"doctype":return _3(e,n);case"element":return I3(e,n);case"root":return M3(e,n);case"text":return R3(e,n)}}}function N3(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 Ns(s,t),s}}function _3(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return Ns(n,t),n}}function I3(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=Vp(e,t.children),i=L3(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&&mn.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 Ns(a,t),a}function M3(e,t){const r={type:"root",children:Vp(e,t.children)};return Ns(r,t),r}function R3(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return Ns(r,t),r}function Vp(e,t){const n=[];if(Array.isArray(t)){const r=t;let i=-1;for(;++i<r.length;){const s=zp(e,r[i]);s&&(Array.isArray(s)?n.push(...s):n.push(s))}}return n}function L3(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,s=r&&mn.call(r,n)?r[n]:void 0,a=r&&mn.call(r,"*")?r["*"]:void 0,o=t&&typeof t=="object"?t:{},l={};let c;for(c in o)if(mn.call(o,c)){const h=o[c];let f=Nd(e,_d(s,c),c,h);f==null&&(f=Nd(e,_d(a,c),c,h)),f!=null&&(l[c]=f)}if(i&&mn.call(i,n)){const h=i[n];for(c in h)mn.call(h,c)&&!mn.call(l,c)&&(l[c]=h[c])}return l}function Nd(e,t,n,r){return t?Array.isArray(r)?P3(e,t,n,r):$p(e,t,n,r):void 0}function P3(e,t,n,r){let i=-1;const s=[];for(;++i<r.length;){const a=$p(e,t,n,r[i]);(typeof a=="number"||typeof a=="string")&&s.push(a)}return s}function $p(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&D3(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 D3(e,t,n){const r=e.schema.protocols&&mn.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 Ns(e,t){const n=am(t);t.data&&(e.data=Yn(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 qp(e){return function(t){return A3(t,e)}}var Ef;const Wp={...ns,protocols:{...ns.protocols,src:[...((Ef=ns.protocols)==null?void 0:Ef.src)??["http","https","mailto"],"data"]}};function O3({retry:e}){const t=Ne();return u.jsxs("div",{className:"text-body text-warning p-4 flex items-start gap-2",children:[u.jsx(an,{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 j3 extends v.Component{constructor(){super(...arguments);ba(this,"state",{error:null});ba(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(O3,{error:this.state.error,retry:this.retry}):this.props.children}}function F3({nodeId:e,onRated:t}){const n=Ne(),[r,i]=v.useState(!1),[s,a]=v.useState(!1),o=async l=>{if(!(r||s)){i(!0);try{await K.recordReview(e,l),a(!0),t==null||t(),jn(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 ms(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 Yp(e,t){const n=Id(e.startContainer,e.startOffset,t,"start"),r=Id(e.endContainer,e.endOffset,t,"end");return n==null||r==null||r<=n?null:{start:n,end:r}}function Id(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=Gp(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=Kp(o[c],n);if(h!=null)return h}const l=n.nodes[0];return l?l.start:null}}return null}function Gp(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=Gp(n,t);if(r!=null)return r}return null}function Kp(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=Kp(r,t);i!=null&&(n=i)}return n}return null}function Xp(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 Qp(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=ms(e),i=[];for(const s of t){const a=B3(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=Xp(r,s.start,s.end);if(!a)continue;const o=H3(a,s.noteId);o&&n.set(s.noteId,o)}return n}function B3(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 H3(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,Jp(e,r)}function Jp(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 Zp="cp-reading-mark",e0="cp-reading";function zn(e){var n;const t=CSS;try{(n=t.highlights)==null||n.delete(e0)}catch{}cc=null,e.querySelectorAll(`.${Zp}`).forEach(r=>{const i=r.parentNode;if(i){for(;r.firstChild;)i.insertBefore(r.firstChild,r);i.removeChild(r)}}),e.normalize()}const U3=/[0-9A-Za-z\u00C0-\u024F\u0370-\u03FF\u0400-\u04FF\u4E00-\u9FFF\u3040-\u30FF\uAC00-\uD7AF]/,z3=`「『(([【<《"'“‘`,V3=`。』」))]】>》"'”’!!??…,,、;;::`;function t0(e){const t=e.codePointAt(0);let n=e;return t>=65281&&t<=65374&&(n=String.fromCharCode(t-65248)),U3.test(n)?n.toLowerCase():null}function $3(e){let t="";const n=[];for(let r=0;r<e.length;r++){const i=t0(e[r]);i!==null&&(t+=i,n.push(r))}return{canon:t,map:n}}function q3(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 Md(e,t,n){const{canon:r,map:i}=$3(e),s=t.trim().split(/\s+/).map(p=>[...p].map(t0).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=q3(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&&z3.includes(e[f-1]);p++)f--;for(let p=0;p<4&&m<e.length&&V3.includes(e[m]);p++)m++;return{start:f,end:m}}const el=new WeakMap;function n0(e){el.delete(e)}function r0(e,t,n){zn(e);const r=t.trim();if(!r)return null;const i=ms(e,n==null?void 0:n.within,{includeMarks:!0}),s=el.get(e)??0;let a=Md(i.text,r,s);if(!a&&s>0&&(a=Md(i.text,r,0)),!a)return null;el.set(e,a.end);const o=Xp(i,a.start,a.end);if(!o)return null;const l=CSS;if(typeof Highlight<"u"&&l.highlights)try{return l.highlights.set(e0,new Highlight(o)),cc=o,o}catch{}const c=document.createElement("span");return c.className=Zp,Jp(o,c)?o:null}let cc=null;function W3(){return cc}let ci=null,tl=null;function Y3(e){ci=e,tl=(e==null?void 0:e.textContent)??null}function G3(){if(K3(ci))return ci;if(tl){for(const e of document.querySelectorAll("mark.lookatstudy-underline"))if(e.textContent===tl)return ci=e,e}return null}function K3(e){return!!e&&e.isConnected}function s0(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 X3=new Set(["。","!","?","!","?",";",";","…"]),Q3=/(?:[\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,J3=new Set(["”",'"',"」","』","》",")","】","])".slice(0,1)]);function i0(e,t){if(t<0||t>=e.length)return"";let n=t;for(;n>0&&!Z3(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 Z3(e){if(/\n\s*$/.test(e))return!0;const t=e.trimEnd();if(!t)return!0;let n=t.length-1;for(;n>=0&&J3.has(t[n]);)n--;if(n<0)return!0;const r=t[n];return X3.has(r)||r==="."||r===`
|
|
502
|
-
`?!0:Q3.test(t)}function a0(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 ia({title:e,onClose:t,children:n}){const r=Ne(),i=v.useRef(null);return vr(i,!0),v.useEffect(()=>{const s=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t]),Bl.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(Pt,{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 eA(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 tA(e,t,n,r,i=24){const s=eA(e,t,n,r,i);return{scale:s,x:(n-e*s)/2,y:(r-t*s)/2}}function nA(e,t,n,r){return{scale:e.scale*t,x:n-(n-e.x)*t,y:r-(r-e.y)*t}}function $r(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 rA(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:$r(nA(e,a,n,r),i.contentW,i.contentH,i.viewW,i.viewH)}const Rd=.05,Ld=4,Ys=1.25;function _s({children:e,grid:t=!0,testid:n}){const r=Ne(),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 k=i.current,N=s.current;return{min:Rd,max:Ld,contentW:(N==null?void 0:N.offsetWidth)??0,contentH:(N==null?void 0:N.offsetHeight)??0,viewW:(k==null?void 0:k.clientWidth)??0,viewH:(k==null?void 0:k.clientHeight)??0}},[]),b=v.useCallback(()=>{const k=x();!k.contentW||!k.viewW||(o(tA(k.contentW,k.contentH,k.viewW,k.viewH)),d.current=!0)},[x]);v.useEffect(()=>{const k=i.current,N=s.current;if(!k||!N)return;const C=()=>{c({w:N.offsetWidth,h:N.offsetHeight}),b()};C();const R=new ResizeObserver(C);return R.observe(N),R.observe(k),()=>R.disconnect()},[b]);const T=v.useCallback((k,N,C)=>{const R=x(),M=N??R.viewW/2,O=C??R.viewH/2;o(L=>rA(L,k,M,O,R)),d.current=!1},[x]),w=v.useCallback(k=>{var R,M;if((M=(R=k.target).closest)!=null&&M.call(R,"[data-testid=canvas-zoom-controls]"))return;const N=k.currentTarget;try{N.setPointerCapture(k.pointerId)}catch{}const C=p.current;if(m.current=k.pointerType,C.pointers.size===0&&f(!0),C.pointers.set(k.pointerId,{x:k.clientX,y:k.clientY}),C.pointers.size===2){const[O,L]=[...C.pointers.values()];C.pinchBase={dist:Math.hypot(O.x-L.x,O.y-L.y),factorAcc:1},C.lastMid={x:(O.x+L.x)/2,y:(O.y+L.y)/2},C.panning=!1}else C.pointers.size===1&&(C.panning=!0,C.moved=!1,C.lastMid={x:k.clientX,y:k.clientY})},[]),A=v.useCallback(k=>{const N=p.current;if(!N.pointers.has(k.pointerId))return;N.pointers.set(k.pointerId,{x:k.clientX,y:k.clientY});const C=i.current;if(!C)return;const R=C.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,T(j,I.x-R.left,I.y-R.top)}if(N.lastMid){const j=I.x-N.lastMid.x,F=I.y-N.lastMid.y,U=x();o(W=>$r({...W,x:W.x+j,y:W.y+F},U.contentW,U.contentH,U.viewW,U.viewH))}N.lastMid=I;return}if(N.panning&&N.lastMid){const M=k.clientX-N.lastMid.x,O=k.clientY-N.lastMid.y;Math.abs(M)+Math.abs(O)>2&&(N.moved=!0);const L=x();o(I=>$r({...I,x:I.x+M,y:I.y+O},L.contentW,L.contentH,L.viewW,L.viewH)),N.lastMid={x:k.clientX,y:k.clientY}}},[x,T]),E=v.useCallback(k=>{const N=p.current,C=N.pointers.size===1;if(N.pointers.delete(k.pointerId),N.pointers.size<2&&(N.pinchBase=null),N.pointers.size===0){if(N.panning=!1,N.lastMid=null,f(!1),C&&!N.moved&&k.pointerType!=="mouse"){const R=performance.now(),M=g.current;if(M&&R-M.t<320&&Math.hypot(k.clientX-M.x,k.clientY-M.y)<32){const O=x();d.current?(o($r({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:k.clientX,y:k.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]),S=v.useCallback(k=>{var C;k.preventDefault();const N=(C=i.current)==null?void 0:C.getBoundingClientRect();N&&T(k.deltaY<0?Ys:1/Ys,k.clientX-N.left,k.clientY-N.top)},[T]),_=v.useCallback(()=>{if(m.current!=="mouse")return;const k=x();d.current?(o($r({x:(k.viewW-k.contentW)/2,y:Math.max(24,(k.viewH-k.contentH)/2),scale:1},k.contentW,k.contentH,k.viewW,k.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:w,onPointerMove:A,onPointerUp:E,onPointerCancel:E,onWheel:S,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:()=>T(1/Ys),disabled:a.scale<=Rd+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(g1,{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:()=>T(Ys),disabled:a.scale>=Ld-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(zi,{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(vs,{className:"w-4 h-4"})})]}),u.jsx("span",{"data-testid":"canvas-natural-size",className:"hidden",children:l?`${l.w}x${l.h}`:""})]})}function jt(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 tr=118;function sA(e){if(jt(e)<=tr)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+=jt(h),c++,l>=jt(e)/2)break;s=e.slice(0,c),a=e.slice(c)}if(jt(s)<=tr&&jt(a)<=tr)return[s,a];const o=l=>{let c="";for(const h of l){if(jt(c+h+"…")>tr)break;c+=h}return c+"…"};return[jt(s)>tr?o(s):s,jt(a)>tr?o(a):a]}function iA(e,t){const n=sA(e),r=t?14:13,i=Math.max(...n.map(l=>jt(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 aA=28,oA=52,Pd=34;function o0(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 F of[...i.get(j)??[]].sort((U,W)=>(c.get(U)??0)-(c.get(W)??0)))m.has(F)||(m.set(F,(m.get(j)??0)+1),h.set(F,j),f.get(j).push(F),I.push(F))}}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 F=f.get(I)??[],U=F.length===0?1:F.reduce((W,D)=>W+x(D),0);return g.set(I,U),U};l&&x(l);const b=new Map,T=(I,j,F)=>{const U=f.get(I)??[];if(U.length===0)return;const W=U.reduce((Z,ee)=>Z+(g.get(ee)??1),0);let D=j;for(const Z of U){const ee=(g.get(Z)??1)/W*F;b.set(Z,D+ee/2),T(Z,D,ee),D+=ee}};l&&T(l,-Math.PI/2,Math.PI*2);const w=new Map;for(const I of e)w.set(I.id,iA(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 U=j.reduce(($,q)=>{var se;return $+(((se=w.get(q))==null?void 0:se.width)??0)+Pd},0)/(Math.PI*2),W=j.map($=>({id:$,a:b.get($)??0})).sort(($,q)=>$.a-q.a);let D=0;if(W.length>1)for(let $=0;$<W.length;$++){const q=W[$],se=W[($+1)%W.length];let te=se.a-q.a;if($===W.length-1&&(te+=Math.PI*2),te<=.01)continue;const G=((((O=w.get(q.id))==null?void 0:O.width)??0)+(((L=w.get(se.id))==null?void 0:L.width)??0))/2+Pd;D=Math.max(D,G/(2*Math.sin(Math.min(Math.PI,te)/2)))}const Z=E.get(I-1)??0,ee=Math.max(...(A.get(I-1)??[]).map($=>{var q;return(((q=w.get($))==null?void 0:q.height)??0)/2}),0),P=Math.max(...j.map($=>{var q;return(((q=w.get($))==null?void 0:q.height)??0)/2})),Q=j.length===1?60:0;E.set(I,Math.max(Z+ee+P+oA,U,D+Q))}const S=new Map;for(const I of e){const j=m.get(I.id)??0,F=E.get(j)??0,U=j===0?0:b.get(I.id)??0;S.set(I.id,{id:I.id,center:{x:F*Math.cos(U),y:F*Math.sin(U)},box:w.get(I.id),degree:o(I.id),depth:j})}let _=0;for(const I of S.values())_=Math.max(_,Math.abs(I.center.x)+I.box.width/2,Math.abs(I.center.y)+I.box.height/2);const k=Math.ceil(2*(_+aA)),N=k/2;for(const I of S.values())I.center={x:I.center.x+N,y:I.center.y+N};const C=[],R=[];for(const I of a){const j=S.get(I.from),F=S.get(I.to);if(!j||!F)continue;const U=Dd(j,F.center),W=Dd(F,j.center),D={x:(U.x+W.x)/2,y:(U.y+W.y)/2},Z=W.x-U.x,ee=W.y-U.y,P=Math.hypot(Z,ee)||1,Q=Math.min(34,Math.max(10,P*.16)),$={x:D.x+ee/P*Q,y:D.y-Z/P*Q};let q={x:(U.x+2*$.x+W.x)/4,y:(U.y+2*$.y+W.y)/4};if(I.label){const se=jt(I.label,12)+14;for(const te of R)if(Math.hypot(q.x-te.pt.x,q.y-te.pt.y)<(se+te.w)/2+6){q={x:q.x+ee/P*22,y:q.y-Z/P*22};break}R.push({pt:q,w:se})}C.push({edge:I,d:`M ${U.x.toFixed(1)} ${U.y.toFixed(1)} Q ${$.x.toFixed(1)} ${$.y.toFixed(1)} ${W.x.toFixed(1)} ${W.y.toFixed(1)}`,labelPt:q})}return{nodes:S,edges:C,rootId:l,width:Math.ceil(k),height:Math.ceil(k)}}function Dd(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 lA(e){return{width:jt(e,12)+16,height:19}}const Gs=.4,Qa=2.5,Ks=.2;function Od({data:e}){const t=v.useMemo(()=>o0(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?lA(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 l0({data:e,variant:t="card"}){const n=e,r=Ne(),i=v.useMemo(()=>o0(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(Gs,+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(Qa,+(p+Ks).toFixed(2))),[]),f=v.useCallback(()=>a(p=>Math.max(Gs,+(p-Ks).toFixed(2))),[]),m=v.useCallback(()=>a(1),[]),d=v.useCallback(p=>{if(!p.ctrlKey&&!p.metaKey)return;p.preventDefault();const g=p.deltaY>0?-Ks:Ks;a(x=>Math.min(Qa,Math.max(Gs,+(x+g).toFixed(2))))},[]);return t==="canvas"?u.jsx("div",{"data-testid":"conceptmap-canvas-content",children:u.jsx(Od,{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(jl,{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<=Gs,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>=Qa,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(vs,{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(Od,{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(an,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]}),o&&u.jsx(ia,{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(_s,{testid:"conceptmap-modal-stage",children:u.jsx(l0,{data:e,variant:"canvas"})})})})]})}function cA(e,t){const{correct:n,total:r}=e,i=r>0&&n===r,s=r>0&&n<r,a=t!=null&&t>=F1,o=t!=null&&t>=B1;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 uA="ls-quiz-progress:";function dA(e){const t=e.questions.map(r=>`${r.prompt}|${(r.options??[]).join("/")}#${r.answer??""}`).join(`
|
|
503
|
-
`);let n=2166136261;for(let r=0;r<t.length;r++)n^=t.charCodeAt(r),n=Math.imul(n,16777619);return`${uA}${(n>>>0).toString(36)}`}function hA(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 fA(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const mA={"explain-wrong":{icon:e1,labelKey:"quiz.action.explainWrong",message:"我刚才有题答错了,帮我讲讲为什么错、正确的思路是什么。"},retry:{icon:Yr,labelKey:"quiz.action.retry",message:"再来一组类似的题巩固一下。"},"go-deeper":{icon:Ro,labelKey:"quiz.action.goDeeper",message:"这组我答得不错,帮我深入讲讲背后的原理和容易混淆的地方。"},"mark-mastered":{icon:Ft,labelKey:"quiz.action.markMastered",message:"这课我觉得掌握了,帮我确认一下——出个综合题检验,通过了就标记为掌握。"},"next-topic":{icon:Io,labelKey:"quiz.action.nextTopic",message:"进入下一个知识点。"}};function pA({data:e,onAnswered:t,quizMastery:n,onPickAction:r,onQuizCompleted:i}){const s=e,a=Ne(),o=v.useMemo(()=>dA(s),[s]),l=v.useMemo(()=>hA(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(()=>{fA(o,{current:c,score:g})},[o,c,g]);const[T,w]=v.useState(!1);if(c>=s.questions.length){const k=!!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})}),T?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:()=>{w(!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=k?cA(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((C,R)=>{const M=mA[C.id],O=M.icon;return u.jsxs("button",{onClick:()=>r==null?void 0:r(M.message),"data-testid":`quiz-action-${C.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)]},C.id)})]})]})}const A=s.questions[c],E=d&&f===A.answer,S=()=>{if(f===null)return;p(!0);const k=f===A.answer;x(N=>({correct:N.correct+(k?1:0),total:N.total+1})),t==null||t(A,f,k),b.current.push({prompt:A.prompt,chosen:A.options[f]??"?",answerText:A.options[A.answer]??"?",correct:k}),jn(k?"correct":"wrong")},_=()=>{c===s.questions.length-1&&i&&!T&&(w(!0),i({title:s.title??"",correct:g.correct,total:g.total,detail:[...b.current]})),h(k=>k+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(Pl,{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((k,N)=>{const C=f===N,R=d&&N===A.answer,M=d&&C&&!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":C?"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)}),k,R&&u.jsx("span",{className:"float-right",children:u.jsx(wt,{className:"w-4 h-4 inline-block"})}),M&&u.jsx("span",{className:"float-right",children:u.jsx(Pt,{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(wt,{className:"w-4 h-4"}):u.jsx(Pt,{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:S,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(an,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:s.warnings.join("; ")})]})]})}function c0({data:e,variant:t="card"}){const n=e,r=Ne(),[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(Pf,{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(vs,{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(an,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]}),i&&u.jsx(ia,{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(_s,{testid:"comparetable-modal-stage",children:u.jsx("div",{className:"p-2 surface-card",children:u.jsx(c0,{data:e,variant:"canvas"})})})})})]})}let ui=null;function gA(){return ui||(ui=yi(()=>import("./mermaid.core-BhIcHd-X.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:xA(),flowchart:{useMaxWidth:!0,htmlLabels:!0,curve:"basis",nodeSpacing:42,rankSpacing:54,padding:10},sequence:{useMaxWidth:!0,boxMargin:8,noteMargin:8,messageMargin:32}}),t})),ui}function xA(){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",()=>{ui=null});async function bA(e,t){const n=await gA();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 Ja=.3,Za=3,Xs=.2;function u0({data:e,variant:t="card"}){const n=e,r=Ne(),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 S=()=>c(_=>_+1);return window.addEventListener("theme-changed",S),()=>window.removeEventListener("theme-changed",S)},[]);const[h,f]=v.useState(null),[m,d]=v.useState(1),[p,g]=v.useState(!1);v.useEffect(()=>{let S=!1;return o({status:"loading"}),f(null),bA(`mmd-${s}`,n.mermaid).then(_=>{S||o({status:"rendered",svg:_})}).catch(_=>{S||(console.error("[MermaidArtifact] render failed:",_),o({status:"error",message:_ instanceof Error?_.message:String(_)}))}),()=>{S=!0}},[n.mermaid,s,l]);const x=`https://mermaid.live/edit#${encodeURIComponent(n.mermaid)}`,b=v.useCallback(()=>d(S=>Math.min(Za,+(S+Xs).toFixed(2))),[]),T=v.useCallback(()=>d(S=>Math.max(Ja,+(S-Xs).toFixed(2))),[]),w=v.useCallback(()=>d(1),[]),A=v.useCallback(S=>{if(!S.ctrlKey&&!S.metaKey)return;S.preventDefault();const _=S.deltaY>0?-Xs:Xs;d(k=>Math.min(Za,Math.max(Ja,+(k+_).toFixed(2))))},[]),E=a.status==="rendered"?u.jsx("div",{ref:S=>{var _;if(S&&!h){const k=S.querySelector("svg");if(k){const N=k.getBoundingClientRect(),C=(_=k.viewBox)==null?void 0:_.baseVal,R=C&&C.width?C.width:N.width,M=C&&C.height?C.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(P1,{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:T,disabled:m<=Ja,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:w,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>=Za,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(vs,{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(an,{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(ia,{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(_s,{testid:"mermaid-modal-stage",children:u.jsx(u0,{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(an,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]})]})}function d0({data:e,variant:t="card"}){const n=e,r=Ne(),[i,s]=v.useState(null),[a,o]=v.useState(!1),l=v.useRef([]),c=v.useRef([]),h=n.code.split(`
|
|
504
|
-
`),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],T=(a?c:l).current[b.lineStart-1];T==null||T.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 T=b+1;return u.jsxs("div",{ref:w=>{g.current[b]=w},className:`flex ${f(T)?"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:T}),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(Af,{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(vs,{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(an,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),u.jsx("span",{children:n.warnings.join("; ")})]}),a&&u.jsx(ia,{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(_s,{testid:"codewalk-modal-stage",children:u.jsx(d0,{data:e,variant:"canvas"})})})})]})}function yA({data:e,onPickAction:t}){const n=e,r=Ne(),[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(r1,{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(wt,{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 uc({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(l0,{data:e,variant:s});case"quiz":return u.jsx(pA,{data:e,onAnswered:t,quizMastery:n,onPickAction:r,onQuizCompleted:i});case"compare_table":return u.jsx(c0,{data:e,variant:s});case"diagram":return u.jsx(u0,{data:e,variant:s});case"code_walkthrough":return u.jsx(d0,{data:e,variant:s});case"guess":return u.jsx(yA,{data:e,onPickAction:r});default:return u.jsx(jd,{data:e})}}function jd({data:e}){var n;const t=Ne();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(Lf,{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 Fd=new WeakMap;let h0=null;function eo(e){h0=e}function vA(){return h0}const f0=1024;function m0(e){let t=Fd.get(e);return t||(t=e.createAnalyser(),t.fftSize=f0,t.smoothingTimeConstant=.55,Fd.set(e,t)),t}function EA(e,t){try{const n=m0(e);t.connect(n),n.connect(e.destination)}catch{try{t.connect(e.destination)}catch{}}}const hr=1024,Bd=512,kA=3500,TA=7500,wA=.3,SA=.16,CA=1400,AA=2800,Qs=70,p0=new Float64Array(hr);for(let e=0;e<hr;e++)p0[e]=.5*(1-Math.cos(2*Math.PI*e/(hr-1)));function NA(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 T=c*s-h*a;h=c*a+h*s,c=T}}}}function _A(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*p0[g]}NA(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>=kA&&x<TA&&(h+=b),x>=Qc.lo&&x<Qc.hi?(f+=b,m+=b*x):x>=Jc.lo&&x<Jc.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 IA(e,t){return e.level<=kx?"closed":e.hfRatio>=wA?"SS":e.hfRatio>=SA&&e.level<.45?"FV":t==="closed"&&e.f2>=CA&&e.f2<=AA?"L":Tx(e.f1,e.f2,e.level)}function MA(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<hr)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=Bd/t;for(let h=0;h+hr<=e.length;h+=Bd){const f=e.subarray(h,h+hr),m=_A(f,t),d=IA(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<=Qs/1e3)l.viseme="closed";else{const h=Math.min(l.dur*.5,Qs/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,Qs/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<Qs/1e3){const m=n[h-1];m.dur+=f.dur,n.splice(h,1)}}return{cues:n,duration:a}}function RA(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 LA(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 g0(){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),T=v.useRef([]),w=v.useRef(0),A=v.useRef(0),E=v.useRef(!1),S=v.useRef(null),_=v.useRef(0),k=()=>{if(!d.current){const L=window.AudioContext??window.webkitAudioContext;d.current=new L}return d.current.resume(),d.current},N=v.useCallback(()=>{E.current&&A.current>=w.current&&!b.current&&(S.current=null,t(null),r(null),s(null))},[]),C=v.useCallback(()=>{const L=d.current;if(!L||b.current)return;const I=p.current.get(x.current);if(!I){N();return}const j=x.current;p.current.delete(j),b.current=!0,s({index:j,total:_.current,text:l.current[j]??""}),x.current+=1;const F=L.createBufferSource();F.buffer=I,EA(L,F),eo({ctx:L,timeline:g.current.get(j)??null,startedAtCtxTime:L.currentTime,analyser:m0(L)}),F.onended=()=>{A.current+=1,b.current=!1,eo(null),C()},T.current.push(F),F.start()},[N]),R=v.useCallback(()=>{for(const L of T.current)try{L.onended=null,L.stop()}catch{}T.current=[],p.current.clear(),g.current.clear(),eo(null),b.current=!1,w.current=0,A.current=0,E.current=!1,S.current=null,x.current=0,_.current=0,l.current=[],o([]),t(null),r(null),s(null)},[]),M=v.useCallback(()=>{R(),window.api.ttsStop().catch(()=>{})},[R]),O=v.useCallback((L,I)=>{if(S.current===L){M();return}R(),window.dispatchEvent(new CustomEvent("lookatstudy-speech-start",{detail:L})),h(null),S.current=L,w.current=0,A.current=0,E.current=!1,x.current=0,_.current=0,t(L),r({index:0,total:0,text:""}),k(),window.api.ttsSpeak(I,L).then(j=>{if(j.ok){j.firstUse&&m(!0);return}R(),j.reason!=="empty-text"&&h(j.reason)}).catch(()=>R())},[M,R]);return v.useEffect(()=>{const L=window.api.on("speech:ttsAudio",F=>{if(F.messageId!==S.current)return;const U=k();w.current+=1,_.current=F.sentenceTotal,r({index:F.sentenceIndex,total:F.sentenceTotal,text:F.sentence??""}),F.sentence!=null&&(l.current[F.sentenceIndex]=F.sentence,o(l.current.slice())),U.decodeAudioData(F.wavBytes).then(W=>{var D;if(F.messageId===S.current){p.current.set(F.sentenceIndex,W);try{const Z=(D=F.visemeCues)!=null&&D.length?RA(F.visemeCues):MA(PA(W),W.sampleRate);Z&&g.current.set(F.sentenceIndex,Z)}catch{}C()}},()=>{F.messageId===S.current&&(w.current-=1,C())})}),I=window.api.on("speech:ttsDone",F=>{F.messageId===S.current&&(E.current=!0,N())}),j=window.api.on("speech:ttsError",()=>R());return()=>{L(),I(),j()}},[N,C,R]),v.useEffect(()=>R,[R]),v.useEffect(()=>{const L=I=>{const j=I.detail;S.current&&j!==S.current&&R()};return window.addEventListener("lookatstudy-speech-start",L),()=>window.removeEventListener("lookatstudy-speech-start",L)},[R]),v.useEffect(()=>{wx(e!==null)},[e]),{speakingMessageId:e,speakingSentence:n,playingSentence:i,streamTexts:a,failReason:c,clearFailReason:()=>h(null),onlineNotice:f,clearOnlineNotice:()=>m(!1),speak:O,stop:M}}function PA(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}const x0=v.createContext(null);let DA=0;const OA={default:4e3,success:4e3,info:4e3,warning:5e3,error:6e3},jA={default:null,success:u.jsx(Ft,{className:"w-4 h-4 text-brand shrink-0"}),error:u.jsx(Mo,{className:"w-4 h-4 text-warning shrink-0"}),warning:u.jsx(an,{className:"w-4 h-4 text-review shrink-0"}),info:u.jsx(u1,{className:"w-4 h-4 text-accent shrink-0"})};function FA({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=++DA,c=(o==null?void 0:o.severity)??"default",h=(o==null?void 0:o.duration)??OA[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(x0.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(BA,{item:a,onAction:()=>{a.action.onClick(),i(a.id)},onDismiss:()=>i(a.id),onExitDone:()=>r(a.id)},a.id))})]})}function BA({item:e,onAction:t,onDismiss:n,onExitDone:r}){const i=Ne(),s=jA[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(Pt,{className:"w-3.5 h-3.5"})})]})}function dc(){const e=v.useContext(x0);return e||{show:()=>{}}}const HA={concept_map:jl,quiz:Pl,compare_table:Pf,diagram:a1,code_walkthrough:Af},UA=new Set(["concept_map","quiz","compare_table","diagram","code_walkthrough"]);function zA(e,t){return UA.has(t)?e(`artifact.type.${t}`):e("artifact.type.unknown")}function VA({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=Ne(),[b,T]=v.useState("content"),w=r??b,A=k=>{T(k),o==null||o()},E=e?t.filter(k=>k.nodeId===e.id):[],S=v.useRef(null);return v.useEffect(()=>{var k;(k=S.current)==null||k.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(so,{label:x("notebook.tab.explain"),icon:Kt,active:w==="content",onClick:()=>A("content"),testid:"tab-content"}),u.jsx(so,{label:x("notebook.tab.notes"),icon:x1,active:w==="notes",onClick:()=>{A("notes"),kf()},testid:"tab-notes",badge:E.length>0?String(E.length):void 0}),u.jsx(so,{label:x("notebook.tab.board"),icon:va,active:w==="board",onClick:()=>A("board"),testid:"tab-board"})]})}),u.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 animate-tab-slide",ref:S,role:"tabpanel",children:w==="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(va,{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(_s,{testid:"board-canvas-stage",children:u.jsx(uc,{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(va,{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:w==="content"?u.jsx($A,{selectedNode:e,contentNotes:E.filter(k=>k.artifactType==="user_note"&&k.sourceAnchor),onQuoteToChat:p,onSaveContentNote:f,locale:g,isReviewing:s,onReviewDone:a}):u.jsx(qA,{items:E,loading:n,selectedNode:e,onRemove:l,onTogglePin:c,onRecordQuizResult:h,onUpdateNoteComment:m,onJumpToSource:d})})})},w)]})}function $A({selectedNode:e,contentNotes:t,onQuoteToChat:n,onSaveContentNote:r,locale:i,isReviewing:s,onReviewDone:a}){const o=Ne(),l=dc(),c=g0();v.useEffect(()=>{if(c.failReason){const M=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(M),{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),[T,w]=v.useState([]),[A,E]=v.useState(null),S=v.useRef(null),_=v.useRef(null);v.useEffect(()=>{if(!e){d(null),b(!1);return}let M=!1;return g(!0),b(!1),K.getNodeContent(e.id,i??void 0).then(O=>{M||d(O)}).catch(()=>{M||(d(null),b(!0))}).finally(()=>{M||g(!1)}),()=>{M=!0}},[e==null?void 0:e.id,i]),v.useEffect(()=>{if(!e){w([]);return}let M=!1;return K.listAssetsByNode(e.id).then(O=>{M||w(O)}).catch(()=>{M||w([])}),()=>{M=!0}},[e==null?void 0:e.id]),v.useEffect(()=>{if(!m||!S.current)return;const M=[];for(const L of t)try{const I=JSON.parse(L.sourceAnchor);if(I.type==="content"){const j=JSON.parse(L.data).text??"";j&&M.push({noteId:L.id,text:j,surrounding:I.surroundingText})}}catch{}const O=setTimeout(()=>{_.current&&Qp(_.current,M)},80);return()=>clearTimeout(O)},[m,t]),v.useEffect(()=>{const M=O=>{var j;const L=O.detail;if(!L)return;const I=(j=_.current)==null?void 0:j.querySelector(`mark[data-note-id="${L}"]`);I&&s0(I)};return window.addEventListener("lookatstudy-jump-to-note",M),()=>window.removeEventListener("lookatstudy-jump-to-note",M)},[]);const k=c.speakingMessageId===f&&c.playingSentence!=null?c.playingSentence.index:null;v.useEffect(()=>{const M=_.current;if(!M)return;if(k==null){zn(M);return}const O=i0(c.streamTexts,k);if(!O)return;k===0&&n0(M);const L=setTimeout(()=>{const I=r0(M,O);if(!I)return;const j=I.startContainer.parentElement??I.startContainer,F=j.getBoundingClientRect(),U=M.closest(".overflow-y-auto"),W=U==null?void 0:U.getBoundingClientRect();(!W||F.top<W.top+48||F.bottom>W.bottom-48)&&j.scrollIntoView({behavior:"smooth",block:"center"})},30);return()=>clearTimeout(L)},[k,c.streamTexts,f]),v.useEffect(()=>{k==null&&_.current&&zn(_.current)},[k]),v.useEffect(()=>()=>{_.current&&zn(_.current)},[]);const N=v.useCallback(()=>{var P;if(!n&&!r)return;const M=window.getSelection(),O=(M==null?void 0:M.toString().trim())??"";if(O.length<2||O.length>500){E(null);return}const L=M==null?void 0:M.getRangeAt(0);if(!L||!((P=S.current)!=null&&P.contains(L.commonAncestorContainer))){E(null);return}const I=L.getBoundingClientRect(),j=S.current.getBoundingClientRect(),F=_.current;let U=null;if(F&&F.contains(L.commonAncestorContainer)){const Q=ms(F);U=Yp(L,Q)}const W=F?ms(F).text:O,D=U?U.start:W.indexOf(O),Z=D>=0?W.slice(Math.max(0,D-30),D+O.length+30):O,ee=a0({left:I.left-j.left,top:I.top-j.top,right:I.right-j.left,bottom:I.bottom-j.top,width:I.width,height:I.height},j.width,n?150:100);E({x:ee.left,y:ee.top,transform:ee.transform,text:O,surrounding:Z,offsets:U??void 0})},[n,r]);v.useEffect(()=>{let M=null,O=null;const L=()=>{M||(M=setTimeout(()=>{var j;M=null,(((j=window.getSelection())==null?void 0:j.toString().trim().length)??0)>=2?(O&&(clearTimeout(O),O=null),N()):O||(O=setTimeout(()=>E(F=>F&&null),250))},80))};return document.addEventListener("selectionchange",L),()=>{document.removeEventListener("selectionchange",L),M&&clearTimeout(M),O&&clearTimeout(O)}},[N]);const C=v.useCallback(()=>{var O;if(!A||!n)return;const M=A.text.length>200?A.text.slice(0,200)+"…":A.text;n(o("notebook.quote.template",{text:M})),E(null),(O=window.getSelection())==null||O.removeAllRanges()},[A,n,o]),R=v.useCallback(()=>{var O,L,I;if(!A||!r||!e)return;const M=A.text.length>200?A.text.slice(0,200)+"…":A.text;r(M,{type:"content",surroundingText:A.surrounding,startOffset:(O=A.offsets)==null?void 0:O.start,endOffset:(L=A.offsets)==null?void 0:L.end}),kf(),setTimeout(()=>{var U;const j=(U=_.current)==null?void 0:U.querySelectorAll("mark.lookatstudy-underline"),F=j&&j.length>0?j[j.length-1]:null;F&&Y3(F)},200),E(null),(I=window.getSelection())==null||I.removeAllRanges()},[A,r,e]);return e?u.jsxs("div",{className:"p-5 relative","data-testid":"node-content",ref:S,onMouseUp:N,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(Fl,{className:"w-4 h-4"}):u.jsx(Of,{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),K.getNodeContent(e.id,i??void 0).then(d).catch(()=>b(!0)).finally(()=>g(!1))},children:o("notebook.content.retry")})]}):m?u.jsx(j3,{fallback:(M,O)=>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?`
|
|
505
|
-
`+o("notebook.content.truncated"):""]}),u.jsx("div",{className:"flex gap-2 mt-2",children:u.jsx("button",{className:"text-caption underline text-accent",onClick:O,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(Pm,{remarkPlugins:[ip],rehypePlugins:[Up,[qp,Wp]],urlTransform:M=>M,components:{a({children:M,...O}){return u.jsx("a",{...O,target:"_blank",rel:"noopener noreferrer",children:M})},img({src:M,alt:O,...L}){return u.jsx(WA,{src:M,alt:O,assets:T,...L})},table({children:M}){return u.jsx("div",{className:"overflow-x-auto my-4",children:u.jsx("table",{children:M})})}},children:m})})},`${e.id}-${i??"orig"}`):u.jsx("div",{className:"text-body text-ink-muted",children:o("notebook.content.empty")}),T.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(c1,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:o("notebook.images.heading",{n:T.length})})]}),u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:T.map(M=>u.jsx(YA,{asset:M},M.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:C,"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(Rf,{className:"w-3 h-3"}),o("notebook.quote.ask")]}),u.jsxs("button",{onClick:R,"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(ls,{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(vi,{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(F3,{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 qA({items:e,loading:t,selectedNode:n,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o}){const l=Ne();if(!n)return u.jsx(Hd,{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(Hd,{message:l("notebook.empty.no_notes_message"),icon:"🧩"}):u.jsxs("div",{className:"p-4 space-y-3","data-testid":"notes-list",children:[u.jsx(to,{title:l("notebook.zone.understand"),icon:u.jsx(jl,{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(no,{hint:l("notebook.zone.understand.empty_hint")}):c.map(g=>u.jsx(ro,{item:g,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o},g.id))}),u.jsx(to,{title:l("notebook.zone.note"),icon:u.jsx(ls,{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(no,{hint:l("notebook.zone.note.empty_hint")}):h.map(g=>u.jsx(ro,{item:g,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o},g.id))}),u.jsx(to,{title:l("notebook.zone.practice"),icon:u.jsx(Pl,{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(no,{hint:l("notebook.zone.practice.empty_hint")}):f.map(g=>u.jsx(ro,{item:g,onRemove:r,onTogglePin:i,onRecordQuizResult:s,onUpdateNoteComment:a,onJumpToSource:o},g.id))})]})}function to({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(Ll,{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 no({hint:e}){return u.jsx("div",{className:"text-center py-3 text-body text-ink-muted",children:e})}function ro({item:e,onRemove:t,onTogglePin:n,onRecordQuizResult:r,onUpdateNoteComment:i,onJumpToSource:s}){const a=Ne(),[o,l]=v.useState(!1),[c,h]=v.useState(e.notes??""),f=v.useCallback((w,A,E)=>{e.nodeId&&K.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 w=e.notes&&e.notes.trim().length>0?e.notes:null,A=()=>{h(w??""),l(!0)},E=()=>{h(w??""),l(!1)},S=()=>{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(k1,{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(w?"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:S,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(wt,{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(Pt,{className:"w-3 h-3"})," ",a("notebook.action.cancel")]})]})]}):w?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:w}),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(ls,{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(ls,{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(Kt,{className:"w-3 h-3"}),a("notebook.source.jump_content")]}):u.jsxs(u.Fragment,{children:[u.jsx(Rf,{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(Lo,{className:"w-3 h-3"})})]})]})]})})}const T=HA[e.artifactType]??Lf;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(T,{className:"w-4 h-4"})}),u.jsx("span",{className:"text-label font-bold text-ink-muted flex-1 truncate",children:e.title??zA(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(lu,{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(lu,{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(Lo,{className:"w-3 h-3"})})]}),u.jsx("div",{className:"text-label",children:g?u.jsx(uc,{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 Hd({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 so({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 WA({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 K.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 YA({asset:e}){const t=Ne(),[n,r]=v.useState(null),[i,s]=v.useState(!1);return v.useEffect(()=>{let a=!1;return K.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(Pt,{className:"w-6 h-6"})})]})]})}function GA(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 K.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 K.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 K.canvasSaveUserNote({...p,courseId:e});return n(x=>[g,...x]),g}catch{return null}},[e]),l=v.useCallback(async(p,g)=>{try{const x=await K.canvasRecordQuizResult(p,g);return x&&n(b=>b.map(T=>T.id===p?x:T)),x}catch{return null}},[]),c=v.useCallback(async(p,g)=>{try{const x=await K.canvasUpdateUserNoteComment(p,g);return x&&n(b=>b.map(T=>T.id===p?x:T)),x}catch{return null}},[]),h=v.useCallback(async p=>{try{await K.canvasDelete(p),n(g=>g.filter(x=>x.id!==p))}catch{}},[]),f=v.useCallback(async p=>{try{const g=await K.canvasTogglePin(p);g&&n(x=>x.map(T=>T.id===p?g:T).sort((T,w)=>w.pinned!==T.pinned?w.pinned-T.pinned:w.createdAt.localeCompare(T.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 Ud={small:16,medium:17,large:18},zd="lookatstudy-font-size",KA="medium";function XA(){const[e,t]=v.useState(()=>{if(typeof localStorage<"u"){const r=localStorage.getItem(zd);if(r&&r in Ud)return r}return KA});v.useEffect(()=>{document.documentElement.style.fontSize=`${Ud[e]}px`,localStorage.setItem(zd,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 io=new Map;function QA({ref_:e,onOpen:t}){const n=Ne(),[r,i]=v.useState(e.previewUrl??(e.file?io.get(e.file)??null:null));return v.useEffect(()=>{if(r||!e.file)return;let s=!1;return(async()=>{const a=io.get(e.file);if(a){s||i(a);return}const o=await K.getAttachmentDataUrl(e.file);o&&!s&&(io.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 JA({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(Pt,{className:"w-4 h-4"})})]})}function ZA({parts:e}){const t=Ne(),[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(QA,{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(ys,{className:"w-3 h-3 shrink-0"}),u.jsx("span",{className:"truncate max-w-[12rem]",children:o.name})]},`${o.name}:${l}`))}),n&&u.jsx(JA,{src:n.src,name:n.name,onClose:()=>r(null)})]})}function eN({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=Ne(),b=dc(),T=g0();v.useEffect(()=>{if(T.failReason){const F=T.failReason==="engine-unavailable"?"chat.speech.engine_unavailable":T.failReason==="azure-key-missing"?"chat.speech.azure_key_missing":T.failReason==="azure-region-missing"?"chat.speech.azure_region_missing":T.failReason==="edge-failed"?"chat.speech.edge_failed":T.failReason==="custom-provider-missing"?"chat.speech.custom_provider_missing":"chat.speech.model_missing";b.show(x(F),{severity:"warning"}),T.clearFailReason()}},[T.failReason,b,x,T]),v.useEffect(()=>{T.onlineNotice&&(b.show(x("chat.speech.edge_disclosed"),{severity:"info"}),T.clearOnlineNotice())},[T.onlineNotice,b,x,T]);const w=v.useCallback((F,U,W)=>{c&&K.recordQuizAnswer(c,W,F.kc).catch(()=>{})},[c]),[A,E]=v.useState(null);v.useEffect(()=>{if(!c){E(null);return}let F=!1;const U=()=>K.getProgress(c).then(D=>{F||E((D==null?void 0:D.mastery)??null)}).catch(()=>{});U();const W=K.on("state:changed",D=>{D==="mastery"&&U()});return()=>{F=!0,W()}},[c]);const S=v.useRef(null),_=v.useRef(!0),[k,N]=v.useState(!1);v.useEffect(()=>{const F=U=>{const W=U.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",F),()=>window.removeEventListener("lookatstudy-highlight-message",F)},[]),v.useEffect(()=>{if(t||!S.current||!m||m.length===0)return;const F=setTimeout(()=>{if(!S.current)return;const U=new Map;for(const W of m)try{const D=JSON.parse(W.sourceAnchor);if(D.type==="chat"&&D.msgId){const Z=JSON.parse(W.data).text??"";if(Z){const ee=U.get(D.msgId)??[];ee.push({noteId:W.id,text:Z}),U.set(D.msgId,ee)}}}catch{}for(const[W,D]of U){const Z=S.current.querySelector(`[data-msg-id="${W}"]`);Z&&Qp(Z,D)}},150);return()=>clearTimeout(F)},[e,m,t]),v.useEffect(()=>{const F=U=>{var Z;const W=U.detail;if(!W)return;const D=(Z=S.current)==null?void 0:Z.querySelector(`mark[data-note-id="${W}"]`);D&&s0(D)};return window.addEventListener("lookatstudy-jump-to-chat-note",F),()=>window.removeEventListener("lookatstudy-jump-to-chat-note",F)},[]);const[C,R]=v.useState(null),M=v.useCallback(()=>{if(!f||!h)return;const F=window.getSelection(),U=(F==null?void 0:F.toString().trim())??"";if(U.length<2||U.length>500){R(null);return}const W=F==null?void 0:F.getRangeAt(0);if(!W){R(null);return}const D=S.current;if(!(D!=null&&D.contains(W.commonAncestorContainer))){R(null);return}let Z=W.commonAncestorContainer,ee=null;for(;Z&&Z!==D;){if(Z instanceof HTMLElement&&Z.dataset.msgId){ee=Z;break}Z=Z.parentNode}if(!ee){R(null);return}const P=ee.dataset.msgId,Q=ms(ee),$=Yp(W,Q),q=W.getBoundingClientRect(),se=D.getBoundingClientRect(),te=a0({left:q.left-se.left,top:q.top-se.top,right:q.right-se.left,bottom:q.bottom-se.top,width:q.width,height:q.height},se.width,110);R({x:te.left,y:te.top,transform:te.transform,text:U,msgId:P,startOffset:$==null?void 0:$.start,endOffset:$==null?void 0:$.end})},[f,h]);v.useEffect(()=>{let F=null,U=null;const W=()=>{F&&clearTimeout(F),F=setTimeout(()=>{var Z;(((Z=window.getSelection())==null?void 0:Z.toString().trim().length)??0)>=2?(U&&(clearTimeout(U),U=null),M()):U||(U=setTimeout(()=>R(ee=>ee&&null),250))},250)};return document.addEventListener("selectionchange",W),()=>{document.removeEventListener("selectionchange",W),F&&clearTimeout(F),U&&clearTimeout(U)}},[M]);const O=v.useCallback(()=>{var U;if(!C||!f)return;const F=C.text.length>200?C.text.slice(0,200)+"…":C.text;f(F,C.msgId,C.startOffset,C.endOffset),R(null),(U=window.getSelection())==null||U.removeAllRanges()},[C,f]),L=v.useCallback(()=>{const F=S.current;if(!F)return;const U=F.scrollHeight-F.scrollTop-F.clientHeight<80;_.current=U,N(W=>W===!U?W:!U)},[]);v.useEffect(()=>{if(!_.current)return;const F=S.current;F&&(F.scrollTop=F.scrollHeight)},[e,t]);const I=e.length>0&&e[e.length-1].role==="user";v.useEffect(()=>{if(!I)return;_.current=!0,N(!1);const F=S.current;F&&(F.scrollTop=F.scrollHeight)},[I]);const j=v.useCallback(()=>{const F=S.current;F&&(F.scrollTop=F.scrollHeight,_.current=!0,N(!1))},[]);return u.jsxs("div",{className:"relative flex-1 min-h-0",children:[u.jsxs("div",{ref:S,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(T1,{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(Ei,{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(F=>u.jsx("div",{className:g?"":"contents",children:u.jsx("div",{className:g&&F.role==="assistant"?"surface-card p-4 rounded-2xl shadow-card":void 0,children:u.jsx(tN,{msg:F,onApplyProposal:n,onRejectProposal:r,onQuizAnswered:w,quizMastery:A,onPickAction:d,onQuizCompleted:p,speakingMessageId:T.speakingMessageId,speakingSentence:T.speakingSentence,playingSentence:T.playingSentence,streamTexts:T.streamTexts,onSpeak:T.speak})})},F.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"})]})]}),k&&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(Ll,{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"})]}),C&&u.jsxs("button",{onClick:O,"data-testid":"save-chat-note-btn",style:{left:C.x,top:C.y,transform:C.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(ls,{className:"w-3 h-3"})," ",x("chat.note.add")]})]})}function Vd(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 tN({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=Ne(),d=v.useRef(null),p=e.parts.map(b=>b.type==="text"?b.text:"").join("").trim(),g=o===e.id,x=g&&c!=null?c.index:null;return v.useEffect(()=>{const b=d.current;if(!b)return;if(x==null){zn(b);return}const T=i0(h??[],x);if(!T)return;x===0&&n0(b);const w=setTimeout(()=>{const A=r0(b,T,{within:'[data-testid="part-text"]'});if(!A)return;const E=A.startContainer.parentElement??A.startContainer,S=E.getBoundingClientRect(),_=b.closest(".overflow-y-auto"),k=_==null?void 0:_.getBoundingClientRect();(!k||S.top<k.top+48||S.bottom>k.bottom-48)&&E.scrollIntoView({behavior:"smooth",block:"center"})},30);return()=>clearTimeout(w)},[x,h]),v.useEffect(()=>{x==null&&d.current&&zn(d.current)},[x]),v.useEffect(()=>()=>{d.current&&zn(d.current)},[]),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(ZA,{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((b,T)=>b.type==="text"?u.jsx("span",{children:b.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((b,T)=>u.jsx(nN,{part:b,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(Fl,{className:"w-3.5 h-3.5"}):u.jsx(Of,{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 nN({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(Pm,{remarkPlugins:[ip],rehypePlugins:[Up,[qp,Wp]],urlTransform:d=>d,components:iN,children:e.text})});if(e.type==="reasoning")return u.jsx(rN,{text:e.text});if(e.type!=="tool-call")return null;const{toolName:c,state:h,output:f,error:m}=e;return u.jsx(sN,{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 rN({text:e}){const t=Ne(),[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 sN({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=Ne(),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(Ft,{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(t1,{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(Mf,{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(wt,{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(uc,{data:n,onQuizAnswered:l,quizMastery:c,onPickAction:h,onQuizCompleted:f})})}const x=oN(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(qn,{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(Es,{className:"w-3.5 h-3.5 text-ink-faint shrink-0"}),u.jsx("span",{className:"text-ink-muted",children:x})]})})}const iN={pre({children:e,...t}){return u.jsx(aN,{...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 aN({children:e,...t}){const n=Ne(),[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(wt,{className:"w-3 h-3 inline"}),n("chat.copied")]}):u.jsxs(u.Fragment,{children:[u.jsx(n1,{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 oN(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 rs={maxPerMessage:4,maxImageBytes:5*1024*1024,maxTextBytes:256*1024},lN=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 $d(e){const t=e.lastIndexOf(".");return t<=0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function cN(e,t,n){return t&&t.startsWith("image/")||["png","jpg","jpeg","webp","gif","bmp"].includes($d(e))?n>rs.maxImageBytes?{ok:!1,reason:"tooLargeImage"}:{ok:!0,kind:"image"}:lN.has($d(e))?n>rs.maxTextBytes?{ok:!1,reason:"tooLargeText"}:{ok:!0,kind:"text"}:{ok:!1,reason:"unsupported"}}function uN(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 dN(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 hN(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 fN(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 ao=16e3;function mN(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),T=v.useRef(null),w=v.useRef(0),A=v.useRef(e);A.current=e;const E=v.useRef(t);E.current=t;const S=v.useRef(!1),_=v.useRef(!1),k=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=[],T.current=null,o(0)},[]),N=v.useCallback(()=>{var ee;const O=g.current,L=x.current,I=((ee=T.current)==null?void 0:ee.hadSpeech())??!1;g.current=[],x.current=[];let j=0;for(const P of O)j+=P.length;if(k(),r(!1),j===0)return;if(!I){f("no-speech");return}const F=hN(O,L);let U=0;for(const P of F)U+=P.length;const W=new Float32Array(U);let D=0;for(const P of F)W.set(P,D),D+=P.length;const Z=uN(W,ao);s(!0),f(null),window.api.asrTranscribe(Z,E.current.locale).then(P=>{P.ok?A.current(P.text):f(P.reason)}).catch(()=>f("asr-failed")).finally(()=>s(!1))},[k]),C=v.useCallback(()=>{b.current&&N()},[N]),R=v.useCallback(()=>{b.current||S.current||(c(null),S.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:ao})}catch{j=new I}m.current=j,d.current=L,b.current=!0,T.current=fN({autoStop:E.current.autoStop!==!1});const F=j.createMediaStreamSource(L),U=j.createScriptProcessor(4096,1,1);p.current=U;const W=j.sampleRate/ao;U.onaudioprocess=Z=>{var se;if(!b.current)return;const ee=Z.inputBuffer.getChannelData(0),P=W===1?new Float32Array(ee):dN(ee,W);g.current.push(P);let Q=0;for(let te=0;te<P.length;te++)Q+=P[te]*P[te];const $=Math.sqrt(Q/P.length);x.current.push($),w.current=w.current*.7+$*.3,o(Math.min(1,w.current*8)),Sx(Math.min(1,w.current*8)),((se=T.current)==null?void 0:se.feed($,performance.now()))==="auto-stop"&&b.current&&N()},F.connect(U);const D=j.createGain();D.gain.value=0,U.connect(D),D.connect(j.destination),r(!0),_.current&&(_.current=!1,N())}catch(L){k(),r(!1),c(L instanceof Error?L.message:String(L))}finally{S.current=!1}})())},[k,N]),M=v.useCallback(()=>{b.current?C():S.current&&(_.current=!0)},[C]);return v.useEffect(()=>()=>{b.current&&k()},[k]),{listening:n,transcribing:i,level:a,startError:l,transcribeError:h,clearTranscribeError:()=>f(null),beginHold:R,endHold:M}}function pN({onGotoSettings:e}){var g;const t=Ne(),[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[T,w,A,E]=await Promise.all([K.getProviderPresets(),K.listCustomProviders(),K.getSetting("active_provider"),K.getSetting("active_model")]),S=A??"glm",_=await Promise.all(T.map(async O=>await K.getSetting(O.apiKeySetting)!=null)),k=new Set;T.forEach((O,L)=>{(_[L]||O.id===S)&&k.add(O.id)});const N=[],C=(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 T)k.has(O.id)&&C(O.id,O.label,O.models);const R=w.filter(O=>O.kind==="llm");for(const O of R)C(O.id,O.label,O.models);const M=E??"";if(M&&!N.some(O=>O.providerId===S&&O.modelId===M)){const O=((x=T.find(L=>L.id===S))==null?void 0:x.label)??((b=R.find(L=>L.id===S))==null?void 0:b.label)??S;N.unshift({providerId:S,providerLabel:O,modelId:M,modelLabel:M,vision:!0,contextWindow:null})}s(N),o(S),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=T=>{var w;T.target instanceof Node&&((w=h.current)==null?void 0:w.contains(T.target))!==!0&&r(!1)},b=T=>{T.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 K.setSetting("active_provider",x.providerId),await K.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("span",{className:"truncate",children:d}),u.jsx(Cf,{className:`w-3 h-3 shrink-0 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 T=b.providerId===a&&b.modelId===l;return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":T,onClick:()=>void m(b),className:`w-full flex items-center gap-1.5 px-3 py-1.5 text-left transition-colors ${T?"text-brand":"text-ink-strong hover:bg-ink/[0.06]"}`,children:[u.jsx(wt,{className:`w-3.5 h-3.5 shrink-0 ${T?"opacity-100":"opacity-0"}`}),u.jsx("span",{className:"flex-1 truncate text-label",children:b.modelLabel}),b.vision&&u.jsx(s1,{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(A1,{className:"w-3.5 h-3.5"}),t("model.picker.manage")]})})]})]})}const nl=5.5,qd=2*Math.PI*nl,nr=["system","node","learner","history","draft"],Wd={system:"bg-accent",node:"bg-brand",learner:"bg-gold",history:"bg-ink/50",draft:"bg-exam"};function gN({info:e,historyTokens:t,draftTokens:n}){const r=Ne(),[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=nr.reduce((m,d)=>m+o[d],0),c=O1(l,e.contextWindow),h=c!==null&&c>=85,f=j1(nr.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}%`:Jn(l)}),"aria-haspopup":"dialog","aria-expanded":i,"data-testid":"composer-context-trigger","data-tooltip":e.contextWindow===null?`${r("context.label")} ~${Jn(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:nl,fill:"none",strokeWidth:"2",className:"stroke-ink/20"}),u.jsx("circle",{cx:"7",cy:"7",r:nl,fill:"none",strokeWidth:"2",stroke:"currentColor",strokeLinecap:"round",strokeDasharray:`${qd*(c??100)/100} ${qd}`,transform:"rotate(-90 7 7)"})]}),c!==null?u.jsxs("span",{children:[c,"%"]}):u.jsxs("span",{children:["~",Jn(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")," ",Jn(l)," / ",Jn(e.contextWindow)]})]}),u.jsx("div",{className:"flex h-2 rounded-full overflow-hidden bg-ink/10 mb-2",role:"img","aria-label":`${c}%`,children:nr.map(m=>f[nr.indexOf(m)]>0?u.jsx("div",{className:Wd[m],style:{width:`${f[nr.indexOf(m)]}%`}},m):null)}),u.jsx("dl",{className:"space-y-1",children:nr.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 ${Wd[m]}`,"aria-hidden":!0}),r(`context.${m}`)]}),u.jsxs("dd",{className:"text-caption text-ink-strong tabular-nums",children:["~",Jn(o[m])]})]},m))})]})]})}const rl={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 xN(e,t,n){if(e==="openai"||e in rl)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 bN(e,t,n){return t==="anthropic"||t==="google"||e==="openai"||e in rl?!0:xN(e,n==null?void 0:n.baseUrl,n==null?void 0:n.model)in rl}const oo=[{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 yN(){const e=Ne(),[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 w=l.current;if(!w)return;const A=w.getBoundingClientRect(),E=A.left-d.current,S=A.right-d.current,_=window.innerWidth;if(p===0){if(E<8&&S<=_-8){h("left"),g(1);return}if(S>_-8&&E>=8){h("right"),g(1);return}g(1)}const k=Math.min(0,_-8-S)+Math.max(0,8-E);k!==d.current&&(d.current=k,m(k))},[t,p]);const x=v.useCallback(async()=>{var w;try{const[A,E,S,_,k]=await Promise.all([K.getSetting("active_provider"),K.getSetting("reasoning_effort"),K.getProviderPresets(),K.listCustomProviders(),K.getSetting("active_model")]),N=A??"glm",C=_.find(O=>O.id===N),R=((w=S.find(O=>O.id===N))==null?void 0:w.protocol)??(C==null?void 0:C.protocol)??"openai-compatible";a(bN(N,R,{baseUrl:C==null?void 0:C.baseUrl,model:k??(C==null?void 0:C.defaultModel)}));const M=E??"";i(M==="fast"||M==="deep"?M:"")}catch{a(!1)}},[]);v.useEffect(()=>{x();const w=()=>void x();return window.addEventListener("llm-config-changed",w),()=>window.removeEventListener("llm-config-changed",w)},[x]),v.useEffect(()=>{if(!t)return;const w=E=>{var S;E.target instanceof Node&&((S=o.current)==null?void 0:S.contains(E.target))!==!0&&n(!1)},A=E=>{E.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",w),document.addEventListener("keydown",A),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("keydown",A)}},[t]);const b=async w=>{if(n(!1),w!==r){i(w);try{await K.setSetting("reasoning_effort",w)}catch{i(r)}}},T=oo.find(w=>w.value===r)??oo[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(Qx,{className:"w-3 h-3 shrink-0"}),u.jsx("span",{className:"truncate",children:e(T.labelKey)}),u.jsx(Cf,{className:`w-3 h-3 shrink-0 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:oo.map(w=>{const A=w.value===r;return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":A,onClick:()=>void b(w.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(wt,{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(w.labelKey)}),u.jsx("span",{className:"block text-caption text-ink-faint",children:e(w.descKey)})]})]},w.value||"auto")})})]})}function vN(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 EN({view:e,level:t,text:n,onTextChange:r,onSend:i,onRerecord:s,errorMessage:a,sendDisabled:o}){const l=Ne(),[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(Wr,{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:vN(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(f1,{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(C1,{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(Yr,{className:"w-3.5 h-3.5"}),l("chat.speech.retry")]})})]})]})}const kN={direct:"soul.direct",guide:"soul.guide",practice:"soul.practice"},TN={direct:Kt,guide:Nf,practice:l1},wN={direct:"soul.direct.desc",guide:"soul.guide.desc",practice:"soul.practice.desc"},SN=["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 Yd=0;function CN({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=Ne(),p=Uf(),[g,x]=v.useState(""),[b,T]=v.useState([]),[w,A]=v.useState(null),[E,S]=v.useState(null),[_,k]=v.useState(!1),N=v.useRef(null),C=v.useRef(0),[R,M]=v.useState(!0);v.useEffect(()=>{K.getSetting("asr_auto_stop").then(le=>M(le!=="0"))},[]);const[O,L]=v.useState(!1);v.useEffect(()=>(Zc(O),()=>Zc(!1)),[O]);const[I,j]=v.useState(""),[F,U]=v.useState(!1),[W,D]=v.useState(null),Z=mN(le=>{j(le),U(!0)},{locale:p,autoStop:R}),ee=Z.startError??Z.transcribeError;v.useEffect(()=>{if(!ee)return;D(d(ee==="no-speech"?"chat.speech.no_speech":ee==="model-missing"?"chat.speech.asr_model_missing":ee==="engine-unavailable"?"chat.speech.engine_unavailable":ee==="custom-provider-missing"?"chat.speech.custom_provider_missing":ee==="groq-key-missing"?"chat.speech.groq_key_missing":ee==="azure-key-missing"?"chat.speech.azure_stt_key_missing":ee==="azure-region-missing"?"chat.speech.azure_stt_region_missing":ee==="mic-insecure-context"?"chat.speech.asr_insecure_context":ee==="mic-unavailable"?"chat.speech.asr_start_fail":"chat.speech.asr_failed")),Z.clearTranscribeError()},[ee,Z,d]);const P=W?"error":Z.listening?"recording":Z.transcribing?"transcribing":F?"review":"idle",Q=(le,Me,Be)=>{Cx(),o(le,Me,Be)},$=v.useCallback(()=>{j(""),U(!1),D(null)},[]),q=v.useCallback(()=>{L(!1),$()},[$]),se=()=>{const le=I.trim();!le||n||!e||(Q(le),q())};v.useEffect(()=>{f&&x(le=>le.trim()?`${le}
|
|
506
|
-
|
|
507
|
-
${f}`:f)},[f]),v.useEffect(()=>{if(!e){S(null);return}let le=!1;(async()=>{try{const Be=await K.getContextUsage(e,p);le||S(Be)}catch{le||S(null)}})();const Me=()=>{K.getContextUsage(e,p).then(Be=>{le||S(Be)}).catch(()=>{})};return window.addEventListener("llm-config-changed",Me),()=>{le=!0,window.removeEventListener("llm-config-changed",Me)}},[e,p]),v.useEffect(()=>{if(!w)return;const le=setTimeout(()=>A(null),3e3);return()=>clearTimeout(le)},[w]);const te=v.useRef(new Set);v.useEffect(()=>()=>{for(const le of te.current)URL.revokeObjectURL(le)},[]);const G=v.useCallback(le=>{T(Me=>{const Be=Me.find(Ue=>Ue.id===le);return Be!=null&&Be.previewUrl&&(URL.revokeObjectURL(Be.previewUrl),te.current.delete(Be.previewUrl)),Me.filter(Ue=>Ue.id!==le)})},[]),Ee=v.useCallback(async le=>{if(le.length===0)return;const Me=rs.maxPerMessage-b.length;if(Me<=0){A(d("chat.attach.tooMany",{n:rs.maxPerMessage}));return}const Be=le.length>Me?le.slice(0,Me):le;le.length>Me&&A(d("chat.attach.tooMany",{n:rs.maxPerMessage}));const Ue=[],ze=[];for(const Re of Be){const ge=cN(Re.name,Re.type,Re.size);if(!ge.ok){A(ge.reason==="unsupported"?d("chat.attach.unsupported",{name:Re.name}):ge.reason==="tooLargeImage"?d("chat.attach.tooLargeImage",{name:Re.name}):d("chat.attach.tooLargeText",{name:Re.name}));continue}if(ge.kind==="image"){if((E==null?void 0:E.visionCapable)===!1){A(d("chat.attach.visionUnsupported"));continue}const J=await new Promise(xe=>{const fe=new FileReader;fe.onload=()=>{const ye=fe.result;xe(typeof ye=="string"?ye.slice(ye.indexOf(",")+1):null)},fe.onerror=()=>xe(null),fe.readAsDataURL(Re)});if(J===null)continue;const ce=URL.createObjectURL(Re);ze.push(ce),Ue.push({id:++Yd,kind:"image",name:Re.name,mime:Re.type||"image/png",size:Re.size,previewUrl:ce,base64:J})}else try{const J=await Re.text();Ue.push({id:++Yd,kind:"text",name:Re.name,mime:Re.type||"text/plain",size:Re.size,text:J})}catch{}}if(Ue.length>0){for(const Re of ze)te.current.add(Re);T(Re=>[...Re,...Ue])}else for(const Re of ze)URL.revokeObjectURL(Re)},[b.length,E==null?void 0:E.visionCapable,d]),ae=le=>{const Me=le.trim();if(n||!e||!Me&&b.length===0)return;const Be=Me||Hl("chat.attach.imageOnlyText"),Ue=b.map(ze=>({kind:ze.kind,name:ze.name,mime:ze.mime,size:ze.size,data:ze.kind==="image"?ze.base64??"":ze.text??"",...ze.kind==="image"&&ze.previewUrl?{previewUrl:ze.previewUrl}:{}}));Q(Be,void 0,Ue.length>0?Ue:void 0),x(""),T([])},ie=()=>ae(g),ke=le=>{n||(Q(le.message,le.label),le.frictionCategory&&(c==null||c(le.frictionCategory,null)))},ve=le=>{const Me=Array.from(le.clipboardData.files??[]);Me.length>0&&(le.preventDefault(),Ee(Me))},Se=le=>{le.dataTransfer.types.includes("Files")&&(le.preventDefault(),C.current+=1,k(!0))},Ve=le=>{le.dataTransfer.types.includes("Files")&&(C.current=Math.max(0,C.current-1),C.current===0&&k(!1))},_e=le=>{le.dataTransfer.types.includes("Files")&&(le.preventDefault(),C.current=0,k(!1),Ee(Array.from(le.dataTransfer.files??[])))},De=v.useMemo(()=>jf(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((le,Me)=>u.jsx("button",{onClick:()=>ke(le),disabled:n,"data-testid":`starter-prompt-${Me}`,"data-tooltip":le.hint??le.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:le.label},Me))}),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:Se,onDragOver:le=>{le.dataTransfer.types.includes("Files")&&le.preventDefault()},onDragLeave:Ve,onDrop:_e,"data-testid":"composer-card",children:O?u.jsxs(u.Fragment,{children:[P!=="idle"&&u.jsx(EN,{view:P,level:Z.level,text:I,onTextChange:j,onSend:se,onRerecord:$,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(Wr,{className:"w-3.5 h-3.5 text-accent"}),d("chat.speech.dictation")]}),u.jsxs("button",{type:"button",onClick:q,"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(d1,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:d("chat.speech.keyboard")})]})]}),u.jsxs("button",{type:"button",onPointerDown:le=>{le.preventDefault(),Z.beginHold()},onPointerUp:Z.endHold,onPointerLeave:Z.endHold,onPointerCancel:Z.endHold,onContextMenu:le=>le.preventDefault(),disabled:!e||P!=="idle","data-testid":Z.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 ${Z.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(Wr,{className:"w-5 h-5"}),Z.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(le=>{const Me=i===le.name,Be=TN[le.name]??Nf,Ue=d(wN[le.name]??"soul.direct.desc");return u.jsxs("button",{onClick:()=>a(le.name),"data-testid":`soul-pill-${le.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 ${Me?"bg-brand/15 text-brand":"text-ink-muted hover:text-ink-strong hover:bg-ink/5"}`,children:[u.jsx(Be,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:d(kN[le.name]??"soul.direct")})]},le.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(le=>le.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(S1,{className:"w-3.5 h-3.5 shrink-0"}),u.jsx("span",{children:d("chat.attach.bridgeChip",{model:E.visionBridgeModel})})]}),b.map(le=>le.kind==="image"?u.jsxs("div",{className:"relative w-16 h-16 shrink-0",children:[u.jsx("img",{src:le.previewUrl,alt:le.name,className:"w-16 h-16 object-cover rounded-lg border border-[var(--border)]"}),u.jsx("button",{type:"button",onClick:()=>G(le.id),"aria-label":d("chat.attach.remove",{name:le.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(Pt,{className:"w-3 h-3"})})]},le.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(ys,{className:"w-3 h-3 shrink-0 text-ink-faint"}),u.jsx("span",{className:"truncate max-w-[10rem]",children:le.name}),u.jsx("button",{type:"button",onClick:()=>G(le.id),"aria-label":d("chat.attach.remove",{name:le.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(Pt,{className:"w-2.5 h-2.5"})})]},le.id))]}),w&&u.jsx("div",{className:"text-caption text-warning pb-1",role:"status","data-testid":"composer-notice",children:w}),u.jsxs("div",{className:"flex gap-2 items-end",children:[u.jsx("textarea",{value:g,onChange:le=>x(le.target.value),onFocus:()=>eu(!0),onBlur:()=>eu(!1),onKeyDown:le=>{le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),ie())},onPaste:ve,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(Fl,{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(Kx,{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:()=>{$(),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(Wr,{className:"w-3.5 h-3.5"})}),u.jsx("button",{type:"button",onClick:()=>{var le;return(le=N.current)==null?void 0:le.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(v1,{className:"w-3 h-3"})}),u.jsx("input",{ref:N,type:"file",multiple:!0,accept:SN,className:"hidden",onChange:le=>{Ee(Array.from(le.target.files??[])),le.target.value=""}}),u.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-0.5",children:[u.jsx(yN,{}),u.jsx(gN,{info:E,historyTokens:m,draftTokens:De}),u.jsx(pN,{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 Gd={viseme:"closed",open:0};function AN(e){const[t,n]=v.useState(Gd);return v.useEffect(()=>{if(!e){n(Gd);return}const r=new Uint8Array(256),i=new Uint8Array(f0/2);let s=0,a="",o=null,l=0;const c=()=>{const h=vA();if(h){let f,m;if(h.timeline&&h.timeline.cues.length>0){const g=Math.max(0,h.ctx.currentTime-h.startedAtCtxTime),x=LA(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=Ax(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=Nx(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 NN=22,_N=35e-5,Kd=.012,Xd=.12,Qd=.3,IN=16.667,lo=12,MN=3.2,Jd=56,rr=.6;function RN(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+Jd;if(m>=p)continue;if(m<1e-4){o-=rr;continue}const g=h/m,x=f/m,b=Math.min(1.6,Math.max(0,1-(m-d)/Jd)),T=i*g+s*x,w=T<0?1+Math.min(1.6,-T/4):1;a+=g*rr*b*w,o+=x*rr*b*w}const l=Math.hypot(a,o);return l>rr*2&&(a=a/l*rr*2,o=o/l*rr*2),{x:a,y:o}}function LN(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 PN(e,t,n,r,i=IN){const s=Math.max(64,i*i),a=sl((n.x-e.x)*Kd-t.x*Xd,Qd),o=sl((n.y-e.y)*Kd-t.y*Xd,Qd);return{fx:a*r/s,fy:o*r/s-r*.001}}function sl(e,t){return e>t?t:e<-t?-t:e}function DN(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,T=x*p+b*g,w=d-m,A=T<0?-T*.9:0;return{nx:p,ny:g,dvx:p*(w*.55+A*.85),dvy:g*(w*.55+A*.85),bfx:-p*A*.02,bfy:-g*A*.02,hitSpeed:-T}}function ON(e,t){return Math.hypot(e,t)<.35?0:sl(e*.06,.5)}function jN(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 FN(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 BN(e){const t=e.radius??NN,{Bodies:n,Body:r,Composite:i,Engine:s}=Ln,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:_N});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,T,w)=>n.rectangle(x,b,T,w,{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 T=x<f;s.update(a,Math.min(33,Math.max(8,d)));let w=!1;if(!T&&p){const M=b!=null&&b.settle?{x:p.x,y:p.y+Math.sin(x*.0012)*2}:LN(p,Math.floor(x/4200),x),O=Math.max(64,d*d),L=PN({x:o.position.x,y:o.position.y},{x:o.velocity.x,y:o.velocity.y},M,o.mass,d),I=RN(o.position.x,o.position.y,t,g,o.velocity.x,o.velocity.y);r.applyForce(o,o.position,{x:L.fx+I.x*o.mass/O,y:L.fy+I.y*o.mass/O}),r.setAngularVelocity(o,o.angularVelocity-o.angle*.06-o.angularVelocity*.08)}{const M=o.velocity,O=Math.hypot(M.x,M.y);O>lo&&r.setVelocity(o,{x:M.x/O*lo,y:M.y/O*lo})}let A=0,E=0,S=0,_=0,k=0;for(const M of g){const O=DN(o.position.x,o.position.y,o.velocity.x,o.velocity.y,t,M.x,M.y,M.vx,M.vy,M.r);O&&(E+=O.nx*Math.min(4,O.dvx),S+=O.ny*Math.min(4,O.dvy),_+=O.dvx*.9,k+=O.dvy*.9,M.isStatic||M.push(O.bfx,O.bfy),O.hitSpeed>A&&(A=O.hitSpeed))}const N=Math.hypot(E,S);N>4&&(E=E/N*4,S=S/N*4);const C=Math.hypot(_,k);C>7&&(_=_/C*7,k=k/C*7),(N>0||C>0)&&(r.setPosition(o,{x:o.position.x+E,y:o.position.y+S}),r.setVelocity(o,{x:o.velocity.x+_,y:o.velocity.y+k})),A>=MN&&!T&&(f=x+900,w=!0);const R=o.position;return 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})),w},dizzyRemaining(d){return Math.max(0,f-d)},throwDizzy(d){f=d+900},dispose(){i.clear(a.world,!1),s.clear(a)}}}const kt={rail:76,chat:96,notebook:120};function Zd(){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 HN(){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 UN({courseId:e}){const t=v.useSyncExternalStore(Tf,_o),n=AN(t.state.talking),r=Ml(),[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),T=v.useRef(t.state.zone),w=v.useRef(!1),A=v.useRef(null),E=v.useRef(0),S=v.useRef(null),_=v.useRef(0),k=v.useRef({pane:"rail",bucket:-1}),N=v.useRef(null),C=v.useRef(null);if(v.useEffect(()=>{var L,I,j;if(l===T.current||(T.current=l,r))return;s(!0),(I=(L=g.current)==null?void 0:L.animate)==null||I.call(L,[{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"}),(j=g.current)==null||j.classList.add("cp-takeoff"),setTimeout(()=>{var F;return(F=g.current)==null?void 0:F.classList.remove("cp-takeoff")},650);const O=[setTimeout(()=>s(!1),950),setTimeout(()=>{var U;const F=g.current;!F||l==="rail"||(_x(),(U=F.animate)==null||U.call(F,[{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 F of O)clearTimeout(F)}},[l,r]),v.useEffect(()=>{if(!e)return;let O=!0;return window.api.getDashboard(e).then(L=>{var U,W;if(!O)return;const I=(U=L==null?void 0:L.frictionByNode)==null?void 0:U[0];if(!(I!=null&&I.nodeId))return;C.current=I.nodeId;const j=su(),F=(W=j.nav)==null?void 0:W.getBoundingClientRect();if(F)for(const{island:D,container:Z}of j.sections.values()){const ee=D.ball(I.nodeId);if(!ee)continue;const P=Z.getBoundingClientRect(),Q=P.left-F.left+ee.body.position.x,$=P.top-F.top+ee.body.position.y;A.current={x:Q,y:Math.max(40,$-92)},E.current=performance.now()+8e3,setTimeout(()=>{O&&ru()},1200);return}}).catch(()=>{}),()=>{O=!1}},[e]),v.useEffect(()=>{const O=L=>{const I=L.detail,j=C.current;I!=="mastery"||!j||!e||window.api.getDashboard(e).then(F=>{var W;((W=F==null?void 0:F.frictionByNode)==null?void 0:W.some(D=>D.nodeId===j))||(C.current=null,E.current=0,Mx())}).catch(()=>{})};return window.addEventListener("companion-state-changed",O),()=>window.removeEventListener("companion-state-changed",O)},[e]),v.useEffect(()=>{const O=I=>{const j=S.current;if(!j)return;const F=performance.now(),U=Math.max(8,F-j.t);S.current={x:I.clientX,y:I.clientY,vx:(I.clientX-j.x)/U*16.7,vy:(I.clientY-j.y)/U*16.7,t:F}},L=()=>{const I=S.current;if(!I)return;S.current=null;const j=Math.hypot(I.vx,I.vy),F=x.current;F&&j>=2.5&&(Ln.Body.setVelocity(F.body,{x:I.vx*.9,y:I.vy*.9}),F.throwDizzy(performance.now())),tu(!1,j)};return window.addEventListener("pointermove",O,{passive:!0}),window.addEventListener("pointerup",L,{passive:!0}),window.addEventListener("pointercancel",L,{passive:!0}),()=>{window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L)}},[]),v.useEffect(()=>{if(!t.enabledLoaded||!t.enabled||t.petMode)return;const O=g.current;if(!O)return;let L=0,I=performance.now(),j=0,F=0,U=0,W=-1e9,D=null,Z=null;const ee=P=>{var Me,Be,Ue,ze,Re;L=requestAnimationFrame(ee);const Q=Math.min(50,P-I);I=P;const $=su(),q=$.nav,se=(q==null?void 0:q.getBoundingClientRect())??null,te=_o().state,G=!!S.current,Ee=!!se&&se.width>40&&($.visible||te.importing);P-W>150&&(W=P,D=((Me=document.querySelector('[data-testid="chat-panel"]'))==null?void 0:Me.getBoundingClientRect())??null,Z=((Be=document.querySelector('[data-testid="notebook-panel"]'))==null?void 0:Be.getBoundingClientRect())??null);const ae=D,ie=Z,ke=Math.floor(P/Lx);if(k.current.bucket!==ke){const ge=[];if(Ee&&ge.push("rail"),ae&&ge.push("chat"),ie&&ge.push("notebook"),k.current={pane:Rx(k.current.pane,ke,ge),bucket:ke},Ee&&te.zone==="roam"){const J=document.querySelector('[data-testid="map-review-badge"]'),ce=!!J&&J.className.includes("bg-review/20");let xe=null;for(const{island:re,container:be}of $.sections.values()){const Ie=re.balls.find(V=>!V.body.isStatic);if(Ie){const V=be.getBoundingClientRect();xe={x:V.left+Ie.body.position.x,y:V.top+Ie.body.position.y};break}}const fe=E.current>P?A.current:null,ye=jx(ke,{hasReview:ce,hasNext:!!xe,hasFriction:!!fe});if(ye==="review"&&J){const re=J.getBoundingClientRect();N.current={kind:ye,until:P+ya,pos:{x:re.right+44,y:re.bottom+64},fired:!1},k.current.pane="rail"}else ye==="inspect"&&xe?(N.current={kind:ye,until:P+ya,pos:{x:xe.x+34,y:xe.y-66},fired:!1},k.current.pane="rail"):ye==="friction"&&fe&&(N.current={kind:ye,until:P+ya,pos:{x:fe.x,y:fe.y},fired:!1},k.current.pane="rail")}}const ve=N.current&&P<N.current.until?N.current:null;N.current&&!ve&&(N.current=null);const Se=W3(),Ve=Se?Se.startContainer.parentElement??null:null;let _e=null,De=k.current.pane;if(G){const ge=S.current;x.current=null,_e={x:ge.x,y:ge.y},U=Math.max(-.5,Math.min(.5,ge.vx*.04)),De=h.current}else if(Ve&&Se){const ge=Ve.closest('[data-testid="notebook-panel"], [data-testid="chat-stream"]'),J=ge==null?void 0:ge.getBoundingClientRect(),ce=Se.getClientRects(),xe=[];for(let V=0;V<ce.length;V++){const we=ce[V];we.width>1&&we.height>1&&xe.push({left:we.left,right:we.right,top:we.top,bottom:we.bottom})}const fe=xe.length?xe[xe.length-1]:null,ye=xe.length?xe[0]:null,re=Se.getBoundingClientRect(),be=!!(ge!=null&&ge.closest('[data-testid="chat-stream"]')),Ie=be?kt.chat:kt.notebook;if(De=be?"chat":"notebook",J&&(fe||re.width>0)){const V=nu({left:re.left,right:re.right,top:re.top,bottom:re.bottom},J,Ie,{first:ye??void 0,last:fe??void 0},xe),we={dir:V.dir,pane:De};if((((Ue=f.current)==null?void 0:Ue.dir)!==we.dir||((ze=f.current)==null?void 0:ze.pane)!==we.pane)&&(f.current=we,o(we)),p.current!==V.occluding&&(p.current=V.occluding,d(V.occluding)),r)_e=V,U=0;else{const je=b.current??{x:V.x,y:V.y};_e=Zt(je,V,Q,Dx,110),U=V.dir==="left"?-.07:V.dir==="right"?.07:0}}}else{f.current!==null&&(f.current=null,o(null)),p.current&&(p.current=!1,d(!1));const ge=te.pose==="writing"?G3():null,J=te.zone,ce=ge?ge.closest('[data-testid="notebook-panel"], [data-testid="chat-stream"]'):null,xe=ge==null?void 0:ge.getBoundingClientRect(),fe=!!(ce&&xe&&xe.width>0);if(ge&&fe){const ye=ce,re=ye.getBoundingClientRect(),be=xe,Ie=!!ye.closest('[data-testid="chat-stream"]');De=Ie?"chat":"notebook";{const V=nu(be,re,Ie?kt.chat:kt.notebook);if(x.current=null,r)_e=V,U=0;else{const we=b.current??{x:V.x,y:V.y};_e=Zt(we,V,Q,Ds),U=.08}}}else if(J==="chat"&&Zd()){x.current=null,De="chat";const ye=Zd();if(r)_e=ye,U=0;else{const re=Px("chat",P),be=b.current??{x:ye.x,y:ye.y};_e=Zt(be,{x:ye.x+re.x,y:ye.y+re.y},Q,Ds),U=Math.max(-.35,Math.min(.35,(_e.x-be.x)*.014))}}else if(J==="notebook"&&ie)if(x.current=null,De="notebook",r)_e=HN()??{x:ie.left+ie.width/2,y:ie.top+120},U=0;else{const ye=Qn(ie,kt.notebook,P),re=b.current??{x:ye.x,y:ye.y};_e=Zt(re,ye,Q,Ds),U=Math.max(-.3,Math.min(.3,(_e.x-re.x)*.012))}else if(Ee&&(J==="rail"||J==="roam"&&(k.current.pane==="rail"||ve))){const ye=se.width,re=se.height;if(De="rail",r)_e={x:se.left+ye*.5,y:se.top+re*.5},U=0;else{if((ye!==j||re!==F)&&(j=ye,F=re,(Re=x.current)==null||Re.resize(ye,re),A.current=null),!x.current){x.current=BN({width:ye,height:re});const Xe=b.current;Xe&&Ln.Body.setPosition(x.current.body,{x:Math.min(ye-30,Math.max(30,Xe.x-se.left)),y:Math.min(re-30,Math.max(30,Xe.y-se.top))})}const be=x.current,Ie=[],V=[];for(const{island:Xe,container:Tn}of $.sections.values()){const wn=Tn.getBoundingClientRect();if(wn.bottom<se.top-120||wn.top>se.bottom+120)continue;const Xn=wn.left-se.left,ln=wn.top-se.top;for(const ht of Xe.balls)Ie.push({x:Xn+ht.body.position.x,y:ln+ht.body.position.y,vx:ht.body.velocity.x,vy:ht.body.velocity.y,r:_t,isStatic:ht.body.isStatic,push:(cn,ha)=>Ln.Body.applyForce(ht.body,ht.body.position,{x:cn,y:ha})}),V.push({x:Xn+ht.body.position.x,y:ln+ht.body.position.y-_t-20});for(const ht of Xe.links)for(const cn of ht.particles)V.push({x:Xn+cn.position.x,y:ln+cn.position.y-8})}const we=J==="roam";let je=A.current,Je=!1;if(ve)je={x:ve.pos.x-se.left,y:ve.pos.y-se.top},ve.fired||(ve.fired=!0,ru());else if(we){const Xe=Qn(se,kt.rail,P);je={x:Xe.x-se.left,y:Xe.y-se.top}}else{if(te.mode==="veil"){const Xe=FN({x:be.body.position.x,y:be.body.position.y},V,220);Xe&&(je=Xe,Je=!0)}(!je||P>E.current)&&(A.current=jN(ye,re,Ie,Math.floor(P/1e3)),E.current=P+3e3,je=A.current)}const Pe=be.step(Q,je,te.mode==="veil"&&!we?[]:Ie,P,{settle:Je});if(Pe&&!w.current&&Ox(),w.current=Pe||be.dizzyRemaining(P)>0,be.dizzyRemaining(P)===0){const Xe=qf($.weather);if(Xe.wind>=.3){const Tn=be.body.mass;Ln.Body.applyForce(be.body,be.body.position,{x:$f(be.body.position.x,be.body.position.y,P)*Xe.wind*Vf*Tn*2.2,y:0})}($.weather==="rain"||$.weather==="storm")&&te.mode!=="veil"&&P>_.current&&(_.current=P+6e3+Math.random()*4e3,O.classList.add("cp-shiver"),setTimeout(()=>O.classList.remove("cp-shiver"),460))}const kn=be.body.position,gt={x:se.left+kn.x,y:se.top+kn.y},_r=b.current??gt;_e=Zt(_r,gt,Q,Ds),U=be.body.angle+ON(be.body.velocity.x,be.body.velocity.y)}}else{x.current=null;const ye=k.current.pane;if(ye==="chat"&&ae){De="chat";const re=Qn(ae,kt.chat,P),be=b.current??{x:re.x,y:re.y};_e=Zt(be,re,Q,Os,140),U=Math.max(-.25,Math.min(.25,(_e.x-be.x)*.01))}else if(ye==="notebook"&&ie){De="notebook";const re=Qn(ie,kt.notebook,P),be=b.current??{x:re.x,y:re.y};_e=Zt(be,re,Q,Os,140),U=Math.max(-.25,Math.min(.25,(_e.x-be.x)*.01))}else if(Ee){De="rail";const re=Qn(se,kt.rail,P),be=b.current??{x:re.x,y:re.y};_e=Zt(be,re,Q,Os,140),U=Math.max(-.25,Math.min(.25,(_e.x-be.x)*.01))}else{De="chat";const re=Qn({left:8,top:8,right:window.innerWidth-8,bottom:window.innerHeight-8},kt.chat,P),be=b.current??{x:re.x,y:re.y};_e=Zt(be,re,Q,Os,140),U=Math.max(-.25,Math.min(.25,(_e.x-be.x)*.008))}}}if(h.current!==De&&(h.current=De,c(De)),!_e){O.style.opacity="0",b.current=null;return}b.current=_e;const le=O.offsetWidth||kt[De];if(O.style.transform=`translate3d(${(_e.x-le/2).toFixed(1)}px, ${(_e.y-le/2).toFixed(1)}px, 0) rotate(${(U*57.2958).toFixed(1)}deg)`,se){const ge=Math.min(1,Math.max(0,1-(_e.y-se.top)/se.height));O.style.setProperty("--cp-alt",ge.toFixed(3))}};return L=requestAnimationFrame(ee),()=>{var P;cancelAnimationFrame(L),(P=x.current)==null||P.dispose(),x.current=null}},[t.enabledLoaded,t.enabled,t.petMode,r]),!t.enabledLoaded||!t.enabled||t.petMode)return null;const R=i?"flying":(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,M=a?kt[a.pane]:kt[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(wf,{form:t.form,expression:t.state.expression,screenKey:t.state.typing?t.state.lastKey:null,coreLit:t.state.correctStreak>=3,noteTick:Date.now()<t.state.noteTickUntil,pose:R,viseme:n.viseme,openScale:n.open,energyRatio:t.energyRatio,streakLit:t.streakLit,size:M,interactive:!0,ariaLabel:"companion",onPoke:Ix,onGrab:(O,L)=>{S.current||(S.current={x:O,y:L,vx:0,vy:0,t:performance.now()},tu(!0))},haloBadge:t.halo,testid:"companion-mascot",keySeq:t.state.keySeq,keySide:t.state.keySide})})}function co(e){return e.length>=200||e.includes("```")?90:60}function zN(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 VN(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 eh(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 $N(e,t){const n=VN(zN(t)),r=eh(e.length,n),i={};for(const s of e)i[s.id]=eh(Math.max(1,s.optionCount),n);return{questionOrder:r,optionPerms:i}}function qN(e,t){const n=e[t];return String(n??t)}function WN({stars:e}){return u.jsx("div",{className:"flex gap-1","aria-label":`${e} stars`,children:[1,2,3].map(t=>u.jsx(M1,{className:`w-7 h-7 ${t<=e?"text-gold fill-gold":"text-ink/20"}`},t))})}function YN({examNode:e,locale:t,onExamCompleted:n,onSessionChange:r,paused:i}){const s=Ne(),[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),[T,w]=v.useState(null),[A,E]=v.useState(""),[S,_]=v.useState(0),[k,N]=v.useState(null),C=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)??[],F=I.length===j.length?I:j.map((P,Q)=>Q);v.useEffect(()=>{let P=!1;return o("loading"),E(""),w(null),c(null),(async()=>{try{const Q=await K.examGetStatus(e.id);if(P)return;c(Q),f(Q.exercises),Q.status==="generating"?o("generating"):Q.status==="failed"?(E(Q.error??s("exam.errorEmpty")),o("failed")):Q.status==="ready"?Q.latestAttempt&&Q.latestAttempt.finishedAt?(w({correctCount:Q.latestAttempt.correctCount,totalCount:Q.latestAttempt.totalCount,stars:Q.latestAttempt.stars,bestStars:Q.bestStars,terminated:Q.latestAttempt.terminated,perQuestion:Q.latestAttempt.perQuestion??[]}),o("result")):o("ready"):(o("generating"),K.examPrepare(e.id,t??null).catch(()=>{}))}catch(Q){P||(E(Q instanceof Error?Q.message:String(Q)),o("failed"))}})(),()=>{P=!0}},[e.id]),v.useEffect(()=>K.on("exam:status",Q=>{Q.nodeId===e.id&&(Q.status==="ready"?K.examGetStatus(e.id).then($=>{c($),f($.exercises),o(q=>q==="generating"?$.latestAttempt?"result":"ready":q)}).catch(()=>{}):Q.status==="failed"?(E(Q.error??s("exam.errorEmpty")),o("failed")):(c($=>$&&{...$,...Q}),o($=>$==="loading"?"generating":$)))}),[e.id]);const U=v.useCallback(async()=>{var P;try{const Q=await K.examStartAttempt(e.id),$=$N(Q.exercises.map(q=>{var se;return{id:q.id,optionCount:((se=q.options)==null?void 0:se.length)??0}}),Q.attemptId);f(Q.exercises),R.current=Q.attemptId,d($),C.current={},g(0),b(null),w(null),M.current=null,o("answering"),_(co(((P=Q.exercises[$.questionOrder[0]])==null?void 0:P.prompt)??""))}catch(Q){E(Q instanceof Error?Q.message:String(Q)),o("failed")}},[e.id]),W=v.useCallback(()=>{N(null),w(null),o("generating"),c(P=>P&&{...P,status:"generating",done:0,total:0}),K.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(Yr,{className:"w-3.5 h-3.5 inline"}),s("exam.regenerate")]}),k&&u.jsx(Vi,{anchorRect:k,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&&(_(co(L.prompt)),b(null),(P=O.current)==null||P.scrollTo({top:0}))},[p,a]),v.useEffect(()=>{if(a!=="answering"||i)return;const P=setInterval(()=>{_(Q=>Q>0?Q-1:0)},1e3);return()=>clearInterval(P)},[a,i]);const Z=v.useCallback(P=>{const Q=L;if(!Q||a!=="answering"||M.current===Q.id)return;M.current=Q.id;const $=P===null?"":qN(F,P),q={...C.current,[Q.id]:$};C.current=q,R.current&&K.examRecordAnswer(e.id,R.current,Q.id,$).catch(()=>{}),p+1<h.length?g(p+1):(o("submitting"),(async()=>{try{const se=await K.examSubmitAttempt(e.id,R.current,q);w({correctCount:se.correctCount,totalCount:se.totalCount,stars:se.stars,bestStars:se.bestStars,terminated:se.terminated,perQuestion:se.perQuestion}),o("result"),n==null||n(),se.stars>=1&&jn("exam-pass")}catch(se){E(se instanceof Error?se.message:String(se)),o("failed")}})())},[L,a,F,p,h.length,e.id,n]),ee=v.useCallback(()=>{x!==null&&Z(x)},[x,Z]);if(v.useEffect(()=>{a!=="answering"||S>0||i||Z(x)},[S,a,i]),v.useEffect(()=>{const P=async()=>{if(R.current)try{await K.examSubmitAttempt(e.id,R.current,C.current,{terminated:!0}),n==null||n()}catch{}},Q=a==="answering"||a==="submitting";return r==null||r(Q?{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(dr,{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,Q=(l==null?void 0:l.total)??0,$=Q>0?Math.round(P/Q*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(dr,{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":$,"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,$)}%`}})}),u.jsx("div",{className:"text-label text-ink-muted tabular-nums mb-6",children:Q>0?s("exam.generating.kcProgress",{done:P,total:Q}):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(Mo,{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"),K.examPrepare(e.id,t??null).catch(()=>{})},children:[u.jsx(Yr,{className:"w-3.5 h-3.5 inline"}),s("exam.failed.retry")]})]});if(a==="ready"&&l){const P=l.exercises.reduce(($,q)=>$+co(q.prompt),0),Q=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(dr,{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:Q})}),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:U,"data-testid":"exam-start-btn",children:[s("exam.start"),u.jsx(Io,{className:"w-4 h-4 inline ml-1"})]}),D]})]})}if(a==="answering"||a==="submitting"){if(!L)return null;const P=S<=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(R1,{className:"w-3.5 h-3.5"}),Math.floor(S/60),":",String(S%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(vi,{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:F.map((Q,$)=>u.jsx("button",{onClick:()=>b($),"data-testid":`exam-option-${$}`,className:`text-left px-4 py-3 rounded-xl border transition-all duration-150 ${x===$?"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[Q]})},Q))}),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:ee,"data-testid":"exam-next-btn",children:[p+1<h.length?s("exam.q.next"):s("exam.q.submit"),u.jsx(Io,{className:"w-3.5 h-3.5 inline ml-1"})]})})]})]})}if(a==="result"&&T){const P=T.totalCount>0?Math.round(T.correctCount/T.totalCount*100):0,Q=new Map;for(const q of T.perQuestion){const se=q.kcTitle??"";if(!se)continue;const te=Q.get(se)??{correct:0,total:0};te.total++,q.correct&&te.correct++,Q.set(se,te)}const $=new Map(h.map(q=>[q.id,q]));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(WN,{stars:T.stars}),u.jsx("div",{className:"text-hero font-extrabold text-ink mt-3",children:s("exam.result.score",{correct:T.correctCount,total:T.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:T.bestStars})}),l&&l.attemptCount>1&&u.jsx("span",{children:s("exam.result.attempts",{n:l.attemptCount})})]})]}),T.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(Mo,{className:"w-4 h-4 text-warning shrink-0"}),u.jsx("span",{className:"text-body text-ink",children:s("exam.terminated.banner")})]}),Q.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:[...Q.entries()].map(([q,se])=>{const G=(se.total>0?se.correct/se.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(vi,{className:"w-3.5 h-3.5 text-accent shrink-0"}),u.jsx("span",{className:"text-body text-ink truncate",children:q})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[G&&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:[se.correct,"/",se.total]})]})]},q)})})]}),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:T.perQuestion.map((q,se)=>{const te=$.get(q.exerciseId),G=q.options??(te==null?void 0:te.options)??null,Ee=q.prompt??(te==null?void 0:te.prompt)??`#${se+1}`,ae=ie=>G&&ie!==""&&G[Number(ie)]!==void 0?G[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:[q.correct?u.jsx(wt,{className:"w-4 h-4 text-brand shrink-0 mt-0.5"}):u.jsx(Pt,{className:`w-4 h-4 shrink-0 mt-0.5 ${q.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:Ee}),u.jsx("div",{className:"text-caption text-ink-muted",children:q.answered?q.correct?u.jsx("span",{className:"text-brand",children:s("exam.result.correctLabel")}):u.jsxs(u.Fragment,{children:[s("exam.result.yourAnswer"),":",ae(q.userAnswer),u.jsx("span",{className:"mx-1",children:"·"}),s("exam.result.correctAnswer"),":",ae(q.correctAnswer)]}):s("exam.result.unanswered")}),q.explanation&&u.jsx("div",{className:"text-caption text-ink-muted mt-1 leading-relaxed",children:q.explanation})]})]})},q.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:U,"data-testid":"exam-retry-btn",children:[u.jsx(Yr,{className:"w-3.5 h-3.5 inline"}),s("exam.retryExam")]}),D]})]})}return null}const GN=[{id:"explain_simple",icon:vi,labelKey:"command.explain_simple",group:"command.group.node",requiresNode:!0},{id:"quiz_3",icon:ys,labelKey:"command.quiz_3",group:"command.group.node",requiresNode:!0},{id:"concept_map",icon:Dl,labelKey:"command.concept_map",group:"command.group.node",requiresNode:!0},{id:"compare_prev",icon:Jx,labelKey:"command.compare_prev",group:"command.group.node",requiresNode:!0},{id:"socratic",icon:Mf,labelKey:"command.socratic",group:"command.group.mode"},{id:"exam_mode",icon:dr,labelKey:"command.exam_mode",group:"command.group.mode"}],KN=["command.group.node","command.group.mode","command.group.nav"];function XN({onClose:e,onPick:t,hasNode:n}){const r=Ne(),[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()},[]),vr(c,!0);const f=GN.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(Ol,{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")}):KN.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 Br="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 Ii({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=Ne(),[c,h]=v.useState(""),[f,m]=v.useState("openai-compatible"),[d,p]=v.useState(""),[g,x]=v.useState(""),[b,T]=v.useState(""),[w,A]=v.useState(!1),[E,S]=v.useState(!1),[_,k]=v.useState(null),N=async()=>{if(!(!d.trim()||!b.trim()||E)){S(!0),k(null);try{const R=s?await s({baseUrl:d.trim(),apiKey:g.trim(),model:b.trim()}):await K.testCustomProvider({label:c||l("settings.custom.test_label"),protocol:f,baseUrl:d.trim(),apiKey:g.trim()||void 0,defaultModel:b.trim()});k({ok:R.ok,detail:R.detail})}catch(R){k({ok:!1,detail:R instanceof Error?R.message:String(R)})}finally{S(!1)}}},C=async()=>{if(!(!c.trim()||!d.trim()||!b.trim()))try{const R=await K.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"?w: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:`${Br} 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:`${Br} 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:`${Br} 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=>T(R.target.value),placeholder:l(i),"data-testid":`${n}-model`,className:`${Br} 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:`${Br} 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:w,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(Ft,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}):u.jsx(qn,{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 C(),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 b0="lookatstudy-theme",th="auto",y0="(prefers-color-scheme: dark)";function uo(){return typeof window>"u"||window.matchMedia(y0).matches?"dark":"light"}function QN(){if(typeof localStorage>"u")return th;const e=localStorage.getItem(b0);return e==="auto"||e==="light"||e==="dark"?e:th}function ho(e){const t=document.documentElement;t.classList.remove("dark","light"),t.classList.add(e),window.dispatchEvent(new CustomEvent("theme-changed",{detail:{resolved:e}}))}function JN(){const[e,t]=v.useState(()=>QN()),[n,r]=v.useState(()=>e==="auto"?uo():e),i=v.useCallback(s=>{t(s),localStorage.setItem(b0,s);const a=s==="auto"?uo():s;r(a),ho(a)},[]);return v.useEffect(()=>{if(e!=="auto")return;const s=window.matchMedia(y0),a=o=>{const l=o.matches?"dark":"light";r(l),ho(l)};return s.addEventListener("change",a),()=>s.removeEventListener("change",a)},[e]),v.useEffect(()=>{const s=e==="auto"?uo():e;r(s),ho(s)},[e]),{mode:e,resolved:n,setMode:i}}const sn="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",Wt="bg-surface-3 text-ink-muted hover:bg-surface-3 hover:bg-surface-3 hover:text-ink-strong",Yt="bg-brand text-white shadow-sm";function Ke(e){return e?"px-4 py-3.5 border-t border-[var(--border-faint)]":"px-4 py-3.5"}function ZN(){const e=Ne(),[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,T]=v.useState(!1),[w,A]=v.useState(!1),[E,S]=v.useState([]),[_,k]=v.useState(!1),[N,C]=v.useState(null),[R,M]=v.useState(null),[O,L]=v.useState(""),[I,j]=v.useState(!1),F=JN(),U=async G=>{if(q)try{await K.updateCustomProvider(q.id,{vision:G}),await D()}catch{}},W=async()=>{k(!0),C(null);try{const G=await K.discoverModels();G.ok&&G.models?S(G.models):C(G.error||e("settings.discover_failed"))}catch(G){C(G instanceof Error?G.message:String(G))}finally{k(!1)}},D=v.useCallback(async()=>{try{const[G,Ee,ae,ie]=await Promise.all([K.getProviderPresets(),K.listCustomProviders(),K.getSetting("active_provider"),K.getSetting("active_model")]);n(G),i(Ee);const ke=ae??"glm";if(a(ke),ke.startsWith("custom-")){const ve=Ee.find(Se=>Se.id===ke);m(ve!=null&&ve.hasApiKey?e("settings.key.configured"):null)}else{const ve=G.find(Se=>Se.id===ke);if(ve){const Se=await K.getSetting(ve.apiKeySetting);m(Se?`${Se.slice(0,4)}…${Se.slice(-4)}`:null)}}if(ke.startsWith("custom-")){const ve=Ee.find(Se=>Se.id===ke);l(ie??(ve==null?void 0:ve.defaultModel)??"")}else{const ve=G.find(Se=>Se.id===ke);l(ie??(ve==null?void 0:ve.defaultModel)??"")}}catch(G){console.error("[SettingsView] load() failed:",G)}},[e]);v.useEffect(()=>{D()},[D]);const Z=async G=>{a(G),x(null),h("");const Ee=t.find(ae=>ae.id===G);if(Ee){const ae=await K.getSetting(Ee.apiKeySetting);m(ae?`${ae.slice(0,4)}…${ae.slice(-4)}`:null),l(o||Ee.defaultModel)}},ee=async()=>{T(!1);try{if(await K.setSetting("active_provider",s),await K.setSetting("active_model",o),c.trim()){const G=t.find(Ee=>Ee.id===s);G&&(await K.setSetting(G.apiKeySetting,c.trim()),m(`${c.trim().slice(0,4)}…${c.trim().slice(-4)}`),h(""))}T(!0),setTimeout(()=>T(!1),2e3),window.dispatchEvent(new Event("llm-config-changed"))}catch{}},P=async()=>{p(!0),x(null);try{const G=await K.testLlmConnection();x(G)}catch(G){x({ok:!1,detail:G instanceof Error?G.message:String(G),errorKind:"unknown"})}finally{p(!1)}},Q=async G=>{await K.setSetting("active_provider",G.id),await K.setSetting("active_model",G.defaultModel),a(G.id),l(G.defaultModel),A(!1),await D(),window.dispatchEvent(new Event("llm-config-changed"))},$=async G=>{try{await K.deleteCustomProvider(G),s===G&&(await K.setSetting("active_provider","glm"),a("glm")),await D()}catch{}},q=s.startsWith("custom-")?r.find(G=>G.id===s):null;v.useEffect(()=>{if(!q)return;const G=q.models.find(Ee=>Ee.id===o);L(G!=null&&G.contextWindow?String(G.contextWindow):"")},[q,o]);const se=async()=>{var ke,ve;if(!q)return;const G=O.trim().replace(/[,\s_]/g,""),Ee=/^(\d+)([km]?)$/i.exec(G);if(G!==""&&!Ee)return;const ae=((ke=Ee==null?void 0:Ee[2])==null?void 0:ke.toLowerCase())==="k"?1e3:((ve=Ee==null?void 0:Ee[2])==null?void 0:ve.toLowerCase())==="m"?1e6:1,ie=G===""||!Ee?null:Math.max(1,Math.round(parseInt(Ee[1],10)*ae));j(!0);try{const Se=q.models.map(Ve=>Ve.id===o?{...Ve,contextWindow:ie}:Ve);await K.updateCustomProvider(q.id,{models:Se}),await D(),window.dispatchEvent(new Event("llm-config-changed"))}catch{}finally{j(!1)}},te=s.startsWith("custom-")?null:t.find(G=>G.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:Ke(!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(G=>u.jsx("button",{onClick:()=>Z(G.id),"data-testid":`provider-card-${G.id}`,"aria-pressed":s===G.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors ${s===G.id?Yt:Wt}`,children:G.label},G.id)),r.filter(G=>G.kind==="llm").map(G=>u.jsxs("button",{onClick:()=>Z(G.id),"data-testid":`provider-card-${G.id}`,"aria-pressed":s===G.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors inline-flex items-center gap-1 ${s===G.id?Yt:Wt}`,children:[u.jsx(Es,{className:"w-3.5 h-3.5","aria-hidden":"true"}),G.label]},G.id)),u.jsxs("button",{onClick:()=>A(G=>!G),"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(zi,{className:"w-3.5 h-3.5","aria-hidden":"true"}),e("settings.add_custom")]})]})]}),w&&u.jsx("div",{className:"px-4 py-3.5 bg-surface-1 border-t border-[var(--border-faint)]",children:u.jsx(Ii,{kind:"llm",testPrefix:"custom",onSaved:G=>void Q(G),onCancel:()=>A(!1)})}),r.length>0&&s.startsWith("custom-")&&u.jsx("div",{className:Ke(!0),children:u.jsx("button",{onClick:G=>{const Ee=G.currentTarget.getBoundingClientRect(),ae=r.find(ie=>ie.id===s);ae&&M({id:ae.id,label:ae.label,rect:Ee})},className:"text-label text-warning hover:underline",children:e("settings.delete_custom")})}),te&&u.jsxs(u.Fragment,{children:[te.baseUrl&&u.jsxs("div",{className:Ke(!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:te.baseUrl})]}),u.jsxs("div",{className:Ke(!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:G=>l(G.target.value),"data-testid":"model-select",className:`${sn} flex-1 px-2.5 py-1.5`,children:[te.models.map(G=>u.jsx("option",{value:G.id,children:G.id},G.id)),s==="openrouter"&&E.map(G=>u.jsx("option",{value:G.id,children:G.id},G.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(w1,{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:Ke(!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(Ft,{className:"w-3.5 h-3.5","aria-hidden":"true"}),f]}),u.jsx("input",{type:"password",value:c,onChange:G=>h(G.target.value),placeholder:e(f?"settings.key.overwrite_ph":"settings.key.paste_ph"),"data-testid":"settings-key-input",className:`${sn} flex-1 px-2.5 py-1.5`}),u.jsx("a",{href:te.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-label text-brand hover:underline whitespace-nowrap",children:e("settings.key.get")})]})]})}),u.jsx("div",{className:Ke(!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(Ft,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(qn,{className:"w-4 h-4","aria-hidden":"true"}),g.detail]})]})})]}),q&&!te&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:Ke(!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:q.baseUrl})]}),u.jsx("div",{className:Ke(!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")}),q.models.length>1?u.jsx("select",{value:o,onChange:G=>l(G.target.value),"data-testid":"model-select-custom",className:`${sn} flex-1 px-2.5 py-1.5`,children:q.models.map(G=>u.jsx("option",{value:G.id,children:G.id},G.id))}):u.jsx("input",{type:"text",value:o,onChange:G=>l(G.target.value),placeholder:e("settings.custom.model_ph"),"data-testid":"model-input-custom",className:`${sn} flex-1 px-2.5 py-1.5 font-mono`})]})}),u.jsxs("div",{className:Ke(!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:G=>L(G.target.value),placeholder:e("settings.custom.windowPh"),"data-testid":"context-window-input",className:`${sn} flex-1 px-2.5 py-1.5 font-mono tabular-nums`}),u.jsx("button",{onClick:se,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:Ke(!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:q.vision,onChange:G=>void U(G.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:Ke(!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(Ft,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(qn,{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(t5,{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(a5,{})})]}),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(n5,{})})]}),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(r5,{})})]}),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:Ke(!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:G,label:Ee})=>u.jsx("button",{onClick:()=>F.setMode(G),"data-testid":`theme-${G}`,"aria-pressed":F.mode===G,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${F.mode===G?Yt:Wt}`,children:Ee},G))}),u.jsx("p",{className:"text-label text-ink-muted mt-2",children:F.mode==="auto"?e("settings.theme.following",{mode:e(`settings.theme.${F.resolved}`)}):null})]}),u.jsxs("div",{className:Ke(!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(G=>u.jsx("button",{onClick:()=>H1(G),"data-testid":`lang-${G}`,"aria-pressed":mr()===G,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${mr()===G?Yt:Wt}`,children:G==="zh-CN"?"中文":"English"},G))})]}),u.jsxs("div",{className:Ke(!0),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:e("settings.row.import_lang")}),u.jsx(e5,{})]})]})]})]}),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:ee,"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(wt,{className:"w-4 h-4","aria-hidden":"true"}),e(b?"settings.saved_text":"settings.footer.save")]})]}),R&&u.jsx(Vi,{anchorRect:R.rect,message:e("settings.delete_custom_confirm",{name:R.label}),danger:!0,confirmLabel:e("action.delete"),testid:"custom-provider-delete-confirm",onConfirm:()=>{$(R.id),M(null)},onCancel:()=>M(null)})]})}function e5(){const[e,t]=v.useState("en"),[n,r]=v.useState(!1);v.useEffect(()=>{K.getSetting("pref_lang").then(a=>{a&&t(a),r(!0)})},[]);const i=async a=>{t(a),await K.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?Yt:Wt}`,children:a.label},a.code))}):null}function t5({activeProvider:e,activeModel:t,presets:n,customProviders:r}){const i=Ne(),[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([K.getSetting("flag_multimodal_import"),K.getSetting("vision_provider_override"),K.getSetting("vision_model_override")]).then(([k,N])=>{a(k==="true"),h(N??""),l(!0)})},[]);const b=async()=>{const k=!s;a(k),await K.setSetting("flag_multimodal_import",String(k))},T=async k=>{await K.setSetting("vision_provider_override",k.id),await K.setSetting("vision_model_override",k.defaultModel),h(k.id),m(!1)},w=async()=>{await K.setSetting("vision_provider_override",""),await K.setSetting("vision_model_override",""),h(""),m(!1)},A=async()=>{if(!d){p(!0),x(null);try{const k=await K.testLlmConnection({vision:!0});x({ok:k.ok,detail:k.detail})}catch(k){x({ok:!1,detail:k instanceof Error?k.message:String(k)})}finally{p(!1)}}},E=r.filter(k=>k.kind==="vision"),S=c.startsWith("custom-")?r.find(k=>k.id===c):null,_=c&&!c.startsWith("custom-")?n.find(k=>k.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(fr,{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:[S&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[u.jsx(Es,{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:S.label}),u.jsx("code",{className:"text-ink-faint font-mono break-all",children:S.defaultModel}),u.jsx("span",{className:"text-ink-faint break-all min-w-0",children:S.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(k=>!k),className:"text-label text-accent hover:underline",children:i("settings.multimodal.replace_custom")}),u.jsx("button",{onClick:()=>void w(),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(Ft,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(qn,{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 w(),className:"text-label text-ink-muted hover:text-ink-strong underline",children:i("settings.multimodal.stop_override")})]}),!S&&!_&&u.jsxs(u.Fragment,{children:[E.map(k=>u.jsxs("button",{onClick:()=>void T(k),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`vision-pick-${k.id}`,children:[u.jsx("span",{className:"text-label font-medium text-ink-strong",children:k.label}),u.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:k.defaultModel})]},k.id)),(f||E.length===0)&&u.jsx(Ii,{kind:"vision",testPrefix:"vision-custom",titleKey:"settings.custom.form_title_vision",modelPhKey:"settings.custom.model_ph_vision",onSaved:k=>void T(k),onCancel:()=>m(!1)}),E.length>0&&u.jsx("button",{onClick:()=>m(k=>!k),className:"text-label text-accent hover:underline",children:i(f?"action.cancel":"settings.custom.new")})]})]})]})]})]}):null}function n5(){const e=Ne(),[t,n]=v.useState(!1),[r,i]=v.useState(!1);v.useEffect(()=>{K.getSetting("flag_memory_system").then(a=>{n(a==="true"),i(!0)})},[]);const s=async()=>{const a=!t;n(a),await K.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(fr,{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 r5(){const e=Ne(),[t,n]=v.useState(!0),[r,i]=v.useState(!1),s=v.useSyncExternalStore(Tf,_o),[a,o]=v.useState(!0),[l,c]=v.useState(!1),h=typeof window<"u"&&!!window.__lookatstudyWeb;v.useEffect(()=>{K.getSetting("companion_enabled").then(g=>{n(g!=="false"&&g!=="0"),i(!0)}),K.getSetting("companion_sfx").then(g=>{o(g!=="false"&&g!=="0")}),K.getSetting("companion_pet_mode").then(g=>{c(g==="1")})},[]);const f=async()=>{const g=!t;n(g),await K.setSetting("companion_enabled",String(g)),window.dispatchEvent(new Event("companion-config-changed"))},m=async()=>{const g=!a;o(g),await K.setSetting("companion_sfx",String(g)),window.dispatchEvent(new Event("companion-config-changed"))},d=async()=>{const g=!l;c(g),await K.setSetting("companion_pet_mode",g?"1":"0"),window.dispatchEvent(new Event("companion-config-changed"))},p=async g=>{g!==s.form&&(await K.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(fr,{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(fr,{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(fr,{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:Fx.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
|
|
508
|
-
${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(wf,{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 fr({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 s5=[{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(女)"}],i5=[{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 a5(){const e=Ne(),[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,T]=v.useState("1.0"),[w,A]=v.useState(""),[E,S]=v.useState("local"),[_,k]=v.useState("asr-whisper-turbo"),[N,C]=v.useState(!0),[R,M]=v.useState([]),[O,L]=v.useState(!1),[I,j]=v.useState(!1),[F,U]=v.useState(!1),[W,D]=v.useState(!1),[Z,ee]=v.useState(!1),[P,Q]=v.useState(null),[$,q]=v.useState(!1),[se,te]=v.useState(null),[G,Ee]=v.useState(null),ae=v.useCallback(()=>{K.listCustomProviders().then(V=>M(V.filter(we=>we.kind==="tts"||we.kind==="asr"))).catch(()=>{})},[]);v.useEffect(()=>{Promise.all([K.getSetting("tts_engine"),K.getSetting("tts_voice_edge"),K.getSetting("tts_sid_local"),K.getSetting("tts_speed"),K.getSetting("tts_custom_voice"),K.getSetting("asr_engine"),K.getSetting("asr_local_model"),K.getSetting("asr_auto_stop")]).then(([V,we,je,Je,Pe,kn,gt,_r])=>{V&&m(V),we&&p(we),je&&x(je),Je&&T(Je),Pe&&A(Pe),kn&&S(kn),(gt==="asr-whisper-turbo"||gt==="asr-whisper-small")&&k(gt),C(_r!=="0")}),ae()},[ae]);const ie=v.useCallback(()=>{window.api.getSpeechModelStatus().then(V=>n(V)).catch(()=>{})},[]);v.useEffect(()=>(ie(),window.api.on("speech:modelProgress",we=>{l({id:we.id,pct:Math.floor(we.progress*100),label:we.currentFile?we.currentFile.split("/").pop()??"":""})})),[ie]);const ke=V=>{a(null),i(V),l({id:V,pct:0,label:""}),window.api.ensureSpeechModel(V).then(()=>{i(null),l(null),ie()}).catch(we=>{i(null),l(null),a(we instanceof Error?we.message:String(we)),ie()})},ve=V=>{i(V),h(null),window.api.deleteSpeechModel(V).then(ie).catch(we=>a(we instanceof Error?we.message:String(we))).finally(()=>i(null))},Se=V=>e(V==="tts-kokoro"?"settings.speech.model.tts":V==="asr-whisper-turbo"?"settings.speech.model.asr_turbo":"settings.speech.model.asr_small"),Ve=V=>e(V==="asr-whisper-turbo"?"settings.speech.model.turbo_short":"settings.speech.model.small_short"),_e=V=>V.startsWith("asr-whisper")?e("settings.speech.license_mit"):e("settings.speech.license"),De=V=>e(V==="ready"?"settings.speech.state.ready":V==="error"?"settings.speech.state.error":"settings.speech.state.absent"),le=V=>{var we;return((we=t.find(je=>je.id===V))==null?void 0:we.state)??"absent"},Me=V=>{m(V),Q(null),K.setSetting("tts_engine",V)},Be=V=>{S(V),te(null),K.setSetting("asr_engine",V)},Ue=R.filter(V=>V.kind==="tts"),ze=R.filter(V=>V.kind==="asr"),Re=f.startsWith("custom-")?Ue.find(V=>V.id===f)??null:null,ge=E.startsWith("custom-")?ze.find(V=>V.id===E)??null:null,J=f==="azure",ce=E==="groq",xe=E==="azure",fe=async()=>{if(!(!Re||Z)){ee(!0),Q(null);try{Q(await K.testCustomTts({providerId:Re.id}))}catch(V){Q({ok:!1,detail:V instanceof Error?V.message:String(V)})}finally{ee(!1)}}},ye=async()=>{if(!(!ge||$)){q(!0),te(null);try{te(await K.testCustomAsr({providerId:ge.id}))}catch(V){te({ok:!1,detail:V instanceof Error?V.message:String(V)})}finally{q(!1)}}},re=async(V,we)=>{Ee(null);try{await K.deleteCustomProvider(V),we==="tts"&&f===V&&Me("edge"),we==="asr"&&E===V&&Be("local"),ae()}catch{}},be=V=>{const we=t.find(Je=>Je.id===V),je=(we==null?void 0:we.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:Se(V)}),u.jsxs("div",{className:"text-caption text-ink-muted",children:[De(je)," · ",_e(V)]}),r===V&&(o==null?void 0:o.id)===V&&u.jsx("div",{className:"mt-1.5 h-1.5 rounded-full bg-ink/[0.08] overflow-hidden","data-testid":`speech-dl-bar-${V}`,children:u.jsx("div",{className:"h-full bg-brand transition-all",style:{width:`${o.pct}%`}})}),r===V&&(o==null?void 0:o.id)===V&&u.jsxs("div",{className:"text-caption text-ink-faint mt-0.5","data-testid":`speech-dl-pct-${V}`,children:[o.pct,"%",o.label?` · ${o.label}`:""]})]}),je==="ready"?c===V?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:()=>ve(V),className:"text-label text-warning hover:underline","data-testid":`speech-del-confirm-${V}`,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(V),disabled:r===V,className:"text-label text-ink-muted hover:text-warning disabled:opacity-40","data-testid":`speech-del-${V}`,children:e("settings.speech.delete")}):u.jsx("button",{onClick:()=>ke(V),disabled:r!=null||je==="downloading",className:"btn-3d-brand px-3 py-1 text-label disabled:opacity-40","data-testid":`speech-dl-${V}`,children:e(r===V||je==="downloading"?"settings.speech.downloading":"settings.speech.download")})]},V)},Ie=(V,we,je,Je,Pe)=>u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[u.jsx(Es,{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:V.label}),u.jsx("code",{className:"text-ink-faint font-mono break-all",children:V.defaultModel}),u.jsx("span",{className:"text-ink-faint break-all min-w-0",children:V.baseUrl}),V.hasApiKey&&u.jsxs("span",{className:"text-brand shrink-0 inline-flex items-center gap-0.5",children:[u.jsx(Ft,{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 Pe(),disabled:je,className:"btn-3d-neutral px-3 py-1 text-label disabled:opacity-40","data-testid":`${we}-custom-test`,children:e(je?"settings.testing":"settings.test")}),G===V.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 re(V.id,we),className:"text-label text-warning hover:underline","data-testid":`${we}-custom-del-confirm`,children:e("settings.speech.delete")}),u.jsx("button",{onClick:()=>Ee(null),className:"text-label text-ink-muted hover:text-ink-strong",children:e("action.cancel")})]}):u.jsx("button",{onClick:()=>Ee(V.id),className:"text-label text-ink-muted hover:text-warning","data-testid":`${we}-custom-del`,children:e("settings.speech.delete")}),Je&&u.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${Je.ok?"text-brand":"text-warning"}`,children:[Je.ok?u.jsx(Ft,{className:"w-4 h-4","aria-hidden":"true"}):u.jsx(qn,{className:"w-4 h-4","aria-hidden":"true"}),Je.detail]})]})]});return u.jsxs("div",{"data-testid":"settings-speech",children:[u.jsxs("div",{className:Ke(!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:()=>{Me("edge"),L(!1),U(!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"?Yt:Wt}`,children:e("settings.speech.engine.edge")}),u.jsxs("button",{onClick:()=>{Me("local"),L(!1),U(!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"?Yt:Wt}`,children:[e("settings.speech.engine.local"),le("tts-kokoro")!=="ready"?` · ${e("settings.speech.state.absent")}`:""]}),u.jsx("button",{onClick:()=>{L(V=>!V),O||U(!1)},"data-testid":"tts-engine-custom","aria-pressed":f.startsWith("custom-")||O,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${f.startsWith("custom-")||O?Yt:Wt}`,children:e("settings.speech.engine.custom")}),J&&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:Ke(!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:V=>{p(V.target.value),K.setSetting("tts_voice_edge",V.target.value)},"data-testid":"tts-voice-select",className:`${sn} w-full min-w-0 px-2.5 py-1.5`,children:s5.map(V=>u.jsx("option",{value:V.id,children:V.label},V.id))})]}),f==="local"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:Ke(!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:V=>{x(V.target.value),K.setSetting("tts_sid_local",V.target.value)},"data-testid":"tts-sid-select",className:`${sn} w-full min-w-0 px-2.5 py-1.5`,children:i5.map(V=>u.jsx("option",{value:V.sid,children:V.label},V.sid))})]}),u.jsx("div",{className:Ke(!1),children:be("tts-kokoro")})]}),O&&u.jsx("div",{className:Ke(!1),children:u.jsxs("div",{className:"space-y-3",children:[Re&&Ie(Re,"tts",Z,P,fe),Re&&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:w,onChange:V=>A(V.target.value),onBlur:()=>void K.setSetting("tts_custom_voice",w.trim()),placeholder:e("settings.speech.custom_voice_ph"),"data-testid":"tts-custom-voice",className:`${sn} w-full min-w-0 px-2.5 py-1.5 font-mono`})]}),!Re&&Ue.map(V=>u.jsxs("button",{onClick:()=>Me(V.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-${V.id}`,children:[u.jsx("span",{className:"text-label font-medium text-ink-strong",children:V.label}),u.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:V.defaultModel})]},V.id)),(F||!Re&&Ue.length===0)&&u.jsx(Ii,{kind:"tts",showProtocol:!1,testPrefix:"tts-custom",titleKey:"settings.custom.form_title_tts",modelPhKey:"settings.custom.model_ph_tts",testOverride:V=>K.testCustomTts({baseUrl:V.baseUrl,apiKey:V.apiKey||void 0,model:V.model}),onSaved:V=>{Me(V.id),U(!1),ae()},onCancel:()=>U(!1)}),(Re||Ue.length>0)&&u.jsx("button",{onClick:()=>U(V=>!V),className:"text-label text-accent hover:underline",children:e(F?"action.cancel":"settings.custom.new")})]})}),u.jsx("div",{className:Ke(!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:V=>T(V.target.value),onPointerUp:()=>void K.setSetting("tts_speed",b),onKeyUp:()=>void K.setSetting("tts_speed",b),"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:Ke(!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:()=>{Be("local"),j(!1),D(!1)},"data-testid":"asr-engine-local","aria-pressed":E==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${E==="local"?Yt:Wt}`,children:e("settings.speech.asr_engine.local")}),u.jsx("button",{onClick:()=>{j(V=>!V),I||D(!1)},"data-testid":"asr-engine-custom","aria-pressed":E.startsWith("custom-")||I,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${E.startsWith("custom-")||I?Yt:Wt}`,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")]}),xe&&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")]})]}),E==="local"?u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.asr_engine.local_note")}):E.startsWith("custom-")&&u.jsx("p",{className:"text-label text-ink-muted mt-2",children:e("settings.speech.asr_engine.custom_note")})]}),E==="local"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:Ke(!1),children:[u.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:e("settings.model")}),u.jsx("select",{value:_,onChange:V=>{k(V.target.value),K.setSetting("asr_local_model",V.target.value)},"data-testid":"asr-model-select",className:`${sn} w-full min-w-0 px-2.5 py-1.5`,children:["asr-whisper-turbo","asr-whisper-small"].map(V=>u.jsxs("option",{value:V,children:[Ve(V)," · ",De(le(V))]},V))})]}),u.jsx("div",{className:Ke(!1),children:be(_)})]}),I&&u.jsx("div",{className:Ke(!1),children:u.jsxs("div",{className:"space-y-3",children:[ge&&Ie(ge,"asr",$,se,ye),!ge&&ze.map(V=>u.jsxs("button",{onClick:()=>Be(V.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-${V.id}`,children:[u.jsx("span",{className:"text-label font-medium text-ink-strong",children:V.label}),u.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:V.defaultModel})]},V.id)),(W||!ge&&ze.length===0)&&u.jsx(Ii,{kind:"asr",showProtocol:!1,testPrefix:"asr-custom",titleKey:"settings.custom.form_title_asr",modelPhKey:"settings.custom.model_ph_asr",testOverride:V=>K.testCustomAsr({baseUrl:V.baseUrl,apiKey:V.apiKey||void 0,model:V.model}),onSaved:V=>{Be(V.id),D(!1),ae()},onCancel:()=>D(!1)}),(ge||ze.length>0)&&u.jsx("button",{onClick:()=>D(V=>!V),className:"text-label text-accent hover:underline",children:e(W?"action.cancel":"settings.custom.new")})]})}),u.jsxs("div",{className:Ke(!0),children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(fr,{checked:N,onChange:()=>{const V=!N;C(V),K.setSetting("asr_auto_stop",V?"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 o5(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 l5=0;const Js=()=>`msg-v2-${++l5}`;function c5(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 u5(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 K.threadGetMessages(e);if(m)return;r(d.map(p=>{const g=c5(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(()=>K.on("chat:part",d=>{const g=a.current;r(x=>{let b=g,T=x;if(!(b&&x.some(E=>E.id===b))){const E=x[x.length-1];E&&E.role==="assistant"?b=E.id:(b=Js(),T=[...x,{id:b,role:"assistant",parts:[]}])}const A=b;return T.map(E=>E.id===A?{...E,parts:o5(E.parts,d)}:E)})}),[]),v.useEffect(()=>K.on("chat:done",(d,p)=>{s(!1),a.current=null,p&&(p.userMessageId||p.assistantMessageId)&&r(g=>{let x=-1,b=-1;for(let T=g.length-1;T>=0&&(g[T].role==="user"&&x===-1&&(x=T),g[T].role==="assistant"&&b===-1&&(b=T),!(x!==-1&&b!==-1));T--);return g.map((T,w)=>w===x&&p.userMessageId?{...T,id:p.userMessageId}:w===b&&p.assistantMessageId?{...T,id:p.assistantMessageId}:T)})}),[]),v.useEffect(()=>K.on("chat:error",d=>{s(!1),a.current=null,r(p=>[...p,{id:Js(),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(),T={id:Js(),role:"user",parts:[...(g??[]).map(w=>({type:"attachment",attachment:{kind:w.kind,name:w.name,mime:w.mime,size:w.size,...w.previewUrl?{previewUrl:w.previewUrl}:{}}})),{type:"text",text:b}],...p?{displayText:p}:{}};r(w=>[...w,T]),s(!0),a.current=null;try{await K.agentChatThread(x,b,p,t??null,g)}catch(w){s(!1),r(A=>[...A,{id:Js(),role:"assistant",parts:[{type:"text",text:`⚠️ ${w instanceof Error?w.message:String(w)}`}]}])}},[e,i,t]),l=v.useCallback(async()=>{if(!(!e||!i)){try{await K.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,Hl(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],T=b[d];return T&&T.type==="tool-call"&&(b[d]={...T,output:{...typeof T.output=="object"&&T.output?T.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 Zs=(e,t=60)=>e.length>t?e.slice(0,t)+"…":e;function d5(e,t){return t("quiz.hook.label",{correct:e.correct,total:e.total})}function h5(e,t){const n=e.detail.map((i,s)=>i.correct?t("quiz.hook.lineOk",{n:s+1,prompt:Zs(i.prompt)}):t("quiz.hook.lineWrong",{n:s+1,prompt:Zs(i.prompt),chosen:Zs(i.chosen,30),answer:Zs(i.answerText,30)})),r=e.title?`《${e.title}》`:"";return t("quiz.hook.message",{title:r,correct:e.correct,total:e.total})+(n.length?`
|
|
509
|
-
`+n.join(`
|
|
510
|
-
`):"")}function f5(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 K.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 K.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 K.threadUpdate(p,g);return x&&(x.status==="archived"?(r(b=>b.filter(T=>T.id!==p)),s(b=>{var w;return b!==p?b:((w=n.filter(A=>A.id!==p)[0])==null?void 0:w.id)??null})):r(b=>b.map(T=>T.id===p?x:T))),x}catch{return null}},[n]),c=v.useCallback(async p=>{try{await K.threadDelete(p),r(g=>g.filter(x=>x.id!==p)),s(g=>{var b;return g!==p?g:((b=n.filter(T=>T.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 T;return x!==p?x:((T=n.filter(w=>w.id!==p)[0])==null?void 0:T.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 m5({threads:e,activeThread:t,focusNodeTitle:n,onPickThread:r,onCreate:i,onRename:s,onArchive:a,onDelete:o}){const l=Ne(),[c,h]=v.useState(null),[f,m]=v.useState(null),[d,p]=v.useState(null),[g,x]=v.useState(""),[b,T]=v.useState(null),w=v.useRef(null);v.useEffect(()=>{const _=k=>{w.current&&!w.current.contains(k.target)&&(h(null),m(null))};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const A=(_,k)=>{_.stopPropagation();const N=_.currentTarget.getBoundingClientRect(),C=Math.max(8,N.right-128),R=N.bottom+4;m({top:R,left:C}),h(c===k?null:k)},E=_=>{p(_.id),x(_.title??""),h(null),m(null)},S=()=>{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 k=_.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 ${k?"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 ${k?"bg-brand opacity-100":"bg-[var(--border)] opacity-0 group-hover:opacity-60"}`}),N?u.jsx("input",{value:g,onChange:C=>x(C.target.value),onKeyDown:C=>{C.key==="Enter"&&S(),C.key==="Escape"&&p(null)},onBlur:S,onClick:C=>C.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 ${k?"font-semibold":"font-normal"}`,"data-tooltip":_.title||l("toast.threadDefault"),children:_.title||l("toast.threadDefault")}),!N&&u.jsx("button",{onClick:C=>A(C,_.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(Ei,{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(zi,{className:"w-3.5 h-3.5"})})]}),c&&f&&(()=>{const _=e.find(k=>k.id===c);return _?u.jsxs("div",{ref:w,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:k=>k.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(I1,{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(Gx,{className:"w-3 h-3"}),l("thread.menu.archive")]}),u.jsxs("button",{onClick:k=>{const N=k.currentTarget.getBoundingClientRect();T({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(Lo,{className:"w-3 h-3"}),l("action.delete")]})]}):null})(),b&&u.jsx(Vi,{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),T(null)},onCancel:()=>T(null)})]})}const p5=1240,g5=920;function x5(e){return e>=p5?1:e>=g5?2:3}function b5(e){return e==="rail"?"rail":"notebook"}function y5(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 v5(e){return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}function E5(){return x5(typeof window>"u"?k5:window.innerWidth)}const k5=99999;function T5(){return v.useSyncExternalStore(v5,E5,()=>1)}const hc=v.createContext({});function fc(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const w5=typeof window<"u",Mi=w5?v.useLayoutEffect:v.useEffect,aa=v.createContext(null);function mc(e,t){e.indexOf(t)===-1&&e.push(t)}function Ri(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Xt=(e,t,n)=>n>t?t:n<e?e:n;let oa=()=>{};const xn={},v0=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),E0=e=>typeof e=="object"&&e!==null,k0=e=>/^0[^.\s]+$/u.test(e);function T0(e){let t;return()=>(t===void 0&&(t=e()),t)}const Lt=e=>e,Is=(...e)=>e.reduce((t,n)=>r=>n(t(r))),ps=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1};class pc{constructor(){this.subscriptions=[]}add(t){return mc(this.subscriptions,t),()=>Ri(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 Ct=e=>e*1e3,Rt=e=>e/1e3,w0=(e,t)=>t?e*(1e3/t):0,S0=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,S5=1e-7,C5=12;function A5(e,t,n,r,i){let s,a,o=0;do a=t+(n-t)/2,s=S0(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>S5&&++o<C5);return a}function Ms(e,t,n,r){if(e===t&&n===r)return Lt;const i=s=>A5(s,0,1,e,n);return s=>s===0||s===1?s:S0(i(s),t,r)}const C0=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,A0=e=>t=>1-e(1-t),N0=Ms(.33,1.53,.69,.99),gc=A0(N0),_0=C0(gc),I0=e=>e>=1?1:(e*=2)<1?.5*gc(e):.5*(2-Math.pow(2,-10*(e-1))),xc=e=>1-Math.sin(Math.acos(e)),M0=A0(xc),R0=C0(xc),N5=Ms(.42,0,1,1),_5=Ms(0,0,.58,1),L0=Ms(.42,0,.58,1),I5=e=>Array.isArray(e)&&typeof e[0]!="number",P0=e=>Array.isArray(e)&&typeof e[0]=="number",M5={linear:Lt,easeIn:N5,easeInOut:L0,easeOut:_5,circIn:xc,circInOut:R0,circOut:M0,backIn:gc,backInOut:_0,backOut:N0,anticipate:I0},R5=e=>typeof e=="string",nh=e=>{if(P0(e)){oa(e.length===4);const[t,n,r,i]=e;return Ms(t,n,r,i)}else if(R5(e))return M5[e];return e},ei=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function L5(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 P5=40;function D0(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=ei.reduce((w,A)=>(w[A]=L5(s),w),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:h,update:f,preRender:m,render:d,postRender:p}=a,g=()=>{const w=xn.useManualTiming,A=w?i.timestamp:performance.now();n=!1,w||(i.delta=r?1e3/60:Math.max(Math.min(A-i.timestamp,P5),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:ei.reduce((w,A)=>{const E=a[A];return w[A]=(S,_=!1,k=!1)=>(n||x(),E.schedule(S,_,k)),w},{}),cancel:w=>{for(let A=0;A<ei.length;A++)a[ei[A]].cancel(w)},state:i,steps:a}}const{schedule:Ye,cancel:bn,state:ot,steps:fo}=D0(typeof requestAnimationFrame<"u"?requestAnimationFrame:Lt,!0);let di;function D5(){di=void 0}const mt={now:()=>(di===void 0&&mt.set(ot.isProcessing||xn.useManualTiming?ot.timestamp:performance.now()),di),set:e=>{di=e,queueMicrotask(D5)}},O0=e=>t=>typeof t=="string"&&t.startsWith(e),j0=O0("--"),O5=O0("var(--"),bc=e=>O5(e)?j5.test(e.split("/*")[0].trim()):!1,j5=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function rh(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Cr={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},gs={...Cr,transform:e=>Xt(0,1,e)},ti={...Cr,default:1},ss=e=>Math.round(e*1e5)/1e5,yc=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function F5(e){return e==null}const B5=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vc=(e,t)=>n=>!!(typeof n=="string"&&B5.test(n)&&n.startsWith(e)||t&&!F5(n)&&Object.prototype.hasOwnProperty.call(n,t)),F0=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,o]=r.match(yc);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},H5=e=>Xt(0,255,e),mo={...Cr,transform:e=>Math.round(H5(e))},Dn={test:vc("rgb","red"),parse:F0("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+mo.transform(e)+", "+mo.transform(t)+", "+mo.transform(n)+", "+ss(gs.transform(r))+")"};function U5(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 il={test:vc("#"),parse:U5,transform:Dn.transform},Rs=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),tn=Rs("deg"),Gt=Rs("%"),Te=Rs("px"),z5=Rs("vh"),V5=Rs("vw"),sh={...Gt,parse:e=>Gt.parse(e)/100,transform:e=>Gt.transform(e*100)},lr={test:vc("hsl","hue"),parse:F0("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Gt.transform(ss(t))+", "+Gt.transform(ss(n))+", "+ss(gs.transform(r))+")"},nt={test:e=>Dn.test(e)||il.test(e)||lr.test(e),parse:e=>Dn.test(e)?Dn.parse(e):lr.test(e)?lr.parse(e):il.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Dn.transform(e):lr.transform(e),getAnimatableNone:e=>{const t=nt.parse(e);return t.alpha=0,nt.transform(t)}},$5=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function q5(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(yc))==null?void 0:t.length)||0)+(((n=e.match($5))==null?void 0:n.length)||0)>0}const B0="number",H0="color",W5="var",Y5="var(",ih="${}",G5=/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 br(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const o=t.replace(G5,l=>(nt.test(l)?(r.color.push(s),i.push(H0),n.push(nt.parse(l))):l.startsWith(Y5)?(r.var.push(s),i.push(W5),n.push(l)):(r.number.push(s),i.push(B0),n.push(parseFloat(l))),++s,ih)).split(ih);return{values:n,split:o,indexes:r,types:i}}function K5(e){return br(e).values}function U0({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===B0?i+=ss(r[s]):a===H0?i+=nt.transform(r[s]):i+=r[s]}return i}}function X5(e){return U0(br(e))}const Q5=e=>typeof e=="number"?0:nt.test(e)?nt.getAnimatableNone(e):e,J5=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:Q5(e);function Z5(e){const t=br(e);return U0(t)(t.values.map((r,i)=>J5(r,t.split[i])))}const Ht={test:q5,parse:K5,createTransformer:X5,getAnimatableNone:Z5};function po(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 e_({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=po(l,o,e+1/3),s=po(l,o,e),a=po(l,o,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function Li(e,t){return n=>n>0?t:e}const We=(e,t,n)=>e+(t-e)*n,go=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},t_=[il,Dn,lr],n_=e=>t_.find(t=>t.test(e));function ah(e){const t=n_(e);if(!t)return!1;let n=t.parse(e);return t===lr&&(n=e_(n)),n}const oh=(e,t)=>{const n=ah(e),r=ah(t);if(!n||!r)return Li(e,t);const i={...n};return s=>(i.red=go(n.red,r.red,s),i.green=go(n.green,r.green,s),i.blue=go(n.blue,r.blue,s),i.alpha=We(n.alpha,r.alpha,s),Dn.transform(i))},al=new Set(["none","hidden"]);function r_(e,t){return al.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function s_(e,t){return n=>We(e,t,n)}function Ec(e){return typeof e=="number"?s_:typeof e=="string"?bc(e)?Li:nt.test(e)?oh:o_:Array.isArray(e)?z0:typeof e=="object"?nt.test(e)?oh:i_:Li}function z0(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>Ec(s)(s,t[a]));return s=>{for(let a=0;a<r;a++)n[a]=i[a](s);return n}}function i_(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ec(e[i])(e[i],t[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function a_(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 o_=(e,t)=>{const n=Ht.createTransformer(t),r=br(e),i=br(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?al.has(e)&&!i.values.length||al.has(t)&&!r.values.length?r_(e,t):Is(z0(a_(r,i),i.values),n):Li(e,t)};function V0(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?We(e,t,n):Ec(e)(e,t)}const l_=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Ye.update(t,n),stop:()=>bn(t),now:()=>ot.isProcessing?ot.timestamp:mt.now()}},$0=(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)})`},Pi=2e4;function kc(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Pi;)t+=n,r=e.next(t);return t>=Pi?1/0:t}function c_(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(kc(r),Pi);return{type:"keyframes",ease:s=>r.next(i*s).value/t,duration:Rt(i)}}const Ze={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 ol(e,t){return e*Math.sqrt(1-t*t)}const u_=12;function d_(e,t,n){let r=n;for(let i=1;i<u_;i++)r=r-e(r)/t(r);return r}const xo=.001;function h_({duration:e=Ze.duration,bounce:t=Ze.bounce,velocity:n=Ze.velocity,mass:r=Ze.mass}){let i,s,a=1-t;a=Xt(Ze.minDamping,Ze.maxDamping,a),e=Xt(Ze.minDuration,Ze.maxDuration,Rt(e)),a<1?(i=c=>{const h=c*a,f=h*e,m=h-n,d=ol(c,a),p=Math.exp(-f);return xo-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=ol(Math.pow(c,2),a);return(-i(c)+xo>0?-1:1)*((m-d)*p)/g}):(i=c=>{const h=Math.exp(-c*e),f=(c-n)*e+1;return-xo+h*f},s=c=>{const h=Math.exp(-c*e),f=(n-c)*(e*e);return h*f});const o=5/e,l=d_(i,s,o);if(e=Ct(e),isNaN(l))return{stiffness:Ze.stiffness,damping:Ze.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:a*2*Math.sqrt(r*c),duration:e}}}const f_=["duration","bounce"],m_=["stiffness","damping","mass"];function lh(e,t){return t.some(n=>e[n]!==void 0)}function p_(e){let t={velocity:Ze.velocity,stiffness:Ze.stiffness,damping:Ze.damping,mass:Ze.mass,isResolvedFromDuration:!1,...e};if(!lh(e,m_)&&lh(e,f_))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*Xt(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Ze.mass,stiffness:i,damping:s}}else{const n=h_({...e,velocity:0});t={...t,...n,mass:Ze.mass},t.isResolvedFromDuration=!0}return t}function Di(e=Ze.visualDuration,t=Ze.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}=p_({...n,velocity:-Rt(n.velocity||0)}),p=m||0,g=c/(2*Math.sqrt(l*h)),x=a-s,b=Rt(Math.sqrt(l/h)),T=Math.abs(x)<5;r||(r=T?Ze.restSpeed.granular:Ze.restSpeed.default),i||(i=T?Ze.restDelta.granular:Ze.restDelta.default);let w,A,E,S,_,k;if(g<1)E=ol(b,g),S=(p+g*b*x)/E,w=C=>{const R=Math.exp(-g*b*C);return a-R*(S*Math.sin(E*C)+x*Math.cos(E*C))},_=g*b*S+x*E,k=g*b*x-S*E,A=C=>Math.exp(-g*b*C)*(_*Math.sin(E*C)+k*Math.cos(E*C));else if(g===1){w=R=>a-Math.exp(-b*R)*(x+(p+b*x)*R);const C=p+b*x;A=R=>Math.exp(-b*R)*(b*C*R-p)}else{const C=b*Math.sqrt(g*g-1);w=L=>{const I=Math.exp(-g*b*L),j=Math.min(C*L,300);return a-I*((p+g*b*x)*Math.sinh(j)+C*x*Math.cosh(j))/C};const R=(p+g*b*x)/C,M=g*b*R-x*C,O=g*b*x-R*C;A=L=>{const I=Math.exp(-g*b*L),j=Math.min(C*L,300);return I*(M*Math.sinh(j)+O*Math.cosh(j))}}const N={calculatedDuration:d&&f||null,velocity:C=>Ct(A(C)),next:C=>{if(!d&&g<1){const M=Math.exp(-g*b*C),O=Math.sin(E*C),L=Math.cos(E*C),I=a-M*(S*O+x*L),j=Ct(M*(_*O+k*L));return o.done=Math.abs(j)<=r&&Math.abs(a-I)<=i,o.value=o.done?a:I,o}const R=w(C);if(d)o.done=C>=f;else{const M=Ct(A(C));o.done=Math.abs(M)<=r&&Math.abs(a-R)<=i}return o.value=o.done?a:R,o},toString:()=>{const C=Math.min(kc(N),Pi),R=$0(M=>N.next(C*M).value,C,30);return C+"ms "+R},toTransition:()=>{}};return N}Di.applyToOptions=e=>{const t=c_(e,100,Di);return e.ease=t.ease,e.duration=Ct(t.duration),e.type="keyframes",e};const g_=5;function q0(e,t,n){const r=Math.max(t-g_,0);return w0(n-e(r),t-r)}function ll({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=k=>o!==void 0&&k<o||l!==void 0&&k>l,p=k=>o===void 0?l:l===void 0||Math.abs(o-k)<Math.abs(l-k)?o:l;let g=n*t;const x=f+g,b=a===void 0?x:a(x);b!==x&&(g=b-f);const T=k=>-g*Math.exp(-k/r),w=k=>b+T(k),A=k=>{const N=T(k),C=w(k);m.done=Math.abs(N)<=c,m.value=m.done?b:C};let E,S;const _=k=>{d(m.value)&&(E=k,S=Di({keyframes:[m.value,p(m.value)],velocity:q0(w,k,m.value),damping:i,stiffness:s,restDelta:c,restSpeed:h}))};return _(0),{calculatedDuration:null,next:k=>{let N=!1;return!S&&E===void 0&&(N=!0,A(k),_(k)),E!==void 0&&k>=E?S.next(k-E):(!N&&A(k),m)}}}function x_(e,t,n){const r=[],i=n||xn.mix||V0,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]||Lt:t;o=Is(l,o)}r.push(o)}return r}function b_(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const s=e.length;if(oa(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=x_(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=ps(e[f],e[f+1],h);return o[f](m)};return n?h=>c(Xt(e[0],e[s-1],h)):c}function y_(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=ps(0,t,r);e.push(We(n,1,i))}}function v_(e){const t=[0];return y_(t,e.length-1),t}function E_(e,t){return e.map(n=>n*t)}function k_(e,t){return e.map(()=>t||L0).splice(0,e.length-1)}function is({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=I5(r)?r.map(nh):nh(r),s={done:!1,value:t[0]},a=E_(n&&n.length===t.length?n:v_(t),e),o=b_(a,t,{ease:Array.isArray(i)?i:k_(t,i)});return{calculatedDuration:e,next:l=>(s.value=o(l),s.done=l>=e,s)}}const T_=e=>e!==null;function la(e,{repeat:t,repeatType:n="loop"},r,i=1){const s=e.filter(T_),o=i<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}const w_={decay:ll,inertia:ll,tween:is,keyframes:is,spring:Di};function W0(e){typeof e.type=="string"&&(e.type=w_[e.type])}class Tc{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 S_=e=>e/100;class Oi extends Tc{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!==mt.now()&&this.tick(mt.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;W0(t);const{type:n=is,repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:a=0}=t;let{keyframes:o}=t;const l=n||is;l!==is&&typeof o[0]!="number"&&(this.mixKeyframes=Is(S_,V0(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=kc(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),T=this.playbackSpeed>=0?b<0:b>i;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let w=this.currentTime,A=r;if(f){const k=Math.min(this.currentTime,i)/o;let N=Math.floor(k),C=k%1;!C&&k>=1&&(C=1),C===1&&N--,N=Math.min(N,f+1),!!(N%2)&&(m==="reverse"?(C=1-C,d&&(C-=d/o)):m==="mirror"&&(A=a)),w=Xt(0,1,C)*o}let E;T?(this.delayState.value=h[0],E=this.delayState):E=A.next(w),s&&!T&&(E.value=s(E.value));let{done:S}=E;!T&&l!==null&&(S=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return _&&p!==ll&&(E.value=la(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 Rt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Rt(t)}get time(){return Rt(this.currentTime)}set time(t){t=Ct(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 q0(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(mt.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Rt(this.currentTime))}play(){var i,s;if(this.isStopped)return;const{driver:t=l_,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(mt.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 C_(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const On=e=>e*180/Math.PI,cl=e=>{const t=On(Math.atan2(e[1],e[0]));return ul(t)},A_={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:cl,rotateZ:cl,skewX:e=>On(Math.atan(e[1])),skewY:e=>On(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ul=e=>(e=e%360,e<0&&(e+=360),e),ch=cl,uh=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),dh=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),N_={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:uh,scaleY:dh,scale:e=>(uh(e)+dh(e))/2,rotateX:e=>ul(On(Math.atan2(e[6],e[5]))),rotateY:e=>ul(On(Math.atan2(-e[2],e[0]))),rotateZ:ch,rotate:ch,skewX:e=>On(Math.atan(e[4])),skewY:e=>On(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function dl(e){return e.includes("scale")?1:0}function hl(e,t){if(!e||e==="none")return dl(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=N_,i=n;else{const o=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=A_,i=o}if(!i)return dl(t);const s=r[t],a=i[1].split(",").map(I_);return typeof s=="function"?s(a):a[s]}const __=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return hl(n,t)};function I_(e){return parseFloat(e.trim())}const Ar=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Nr=new Set([...Ar,"pathRotation"]),hh=e=>e===Cr||e===Te,M_=new Set(["x","y","z"]),R_=Ar.filter(e=>!M_.has(e));function L_(e){const t=[];return R_.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const gn={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})=>hl(t,"x"),y:(e,{transform:t})=>hl(t,"y")};gn.translateX=gn.x;gn.translateY=gn.y;const Vn=new Set;let fl=!1,ml=!1,pl=!1;function Y0(){if(ml){const e=Array.from(Vn).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=L_(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)})}ml=!1,fl=!1,Vn.forEach(e=>e.complete(pl)),Vn.clear()}function G0(){Vn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ml=!0)})}function P_(){pl=!0,G0(),Y0(),pl=!1}class wc{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?(Vn.add(this),fl||(fl=!0,Ye.read(G0),Ye.resolveKeyframes(Y0))):(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])}C_(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Vn.delete(this)}cancel(){this.state==="scheduled"&&(Vn.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const D_=e=>e.startsWith("--");function K0(e,t,n){D_(t)?e.style.setProperty(t,n):e.style[t]=n}const O_={};function X0(e,t){const n=T0(e);return()=>O_[t]??n()}const j_=X0(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Q0=X0(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),qr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,fh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:qr([0,.65,.55,1]),circOut:qr([.55,0,1,.45]),backIn:qr([.31,.01,.66,-.59]),backOut:qr([.33,1.53,.69,.99])};function J0(e,t){if(e)return typeof e=="function"?Q0()?$0(e,t):"ease-out":P0(e)?qr(e):Array.isArray(e)?e.map(n=>J0(n,t)||fh.easeOut):fh[e]}function F_(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=J0(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 Z0(e){return typeof e=="function"&&"applyToOptions"in e}function B_({type:e,...t}){return Z0(e)&&Q0()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class eg extends Tc{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,oa(typeof t.type!="string");const c=B_(t);this.animation=F_(n,r,i,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const h=la(i,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(h),K0(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 Rt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Rt(t)}get time(){return Rt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ct(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&&j_()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Lt):i(this)}}const tg={anticipate:I0,backInOut:_0,circInOut:R0};function H_(e){return e in tg}function U_(e){typeof e.ease=="string"&&H_(e.ease)&&(e.ease=tg[e.ease])}const bo=10;class z_ extends eg{constructor(t){U_(t),W0(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 Oi({...a,autoplay:!1}),l=Math.max(bo,mt.now()-this.startTime),c=Xt(0,bo,l-bo),h=o.sample(l).value,{name:f}=this.options;s&&f&&K0(s,f,h),n.setWithVelocity(o.sample(Math.max(0,l-c)).value,h,c),o.stop()}}const mh=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ht.test(e)||e==="0")&&!e.startsWith("url("));function V_(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 $_(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=mh(i,t),o=mh(s,t);return!a||!o?!1:V_(e)||(n==="spring"||Z0(n))&&r}function gl(e){e.duration=0,e.type="keyframes"}const ng=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),q_=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function W_(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&q_.test(e[t]))return!0;return!1}const Y_=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),G_=T0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function K_(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 G_()&&n&&(ng.has(n)||Y_.has(n)&&W_(o))&&(n!=="transform"||!h)&&!c&&!r&&i!=="mirror"&&s!==0&&a!=="inertia"}const X_=40;class Q_ extends Tc{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=mt.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)||wc;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,T;this.keyframeResolver=void 0;const{name:s,type:a,velocity:o,delay:l,isHandoff:c,onUpdate:h}=r;this.resolvedAt=mt.now();let f=!0;$_(t,s,a,o)||(f=!1,(xn.instantAnimations||!l)&&(h==null||h(la(t,r,n))),t[0]=t[t.length-1],gl(r),r.repeat=0);const d={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>X_?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=f&&!c&&K_(d),g=(T=(b=d.motionValue)==null?void 0:b.owner)==null?void 0:T.current;let x;if(p)try{x=new z_({...d,element:g})}catch{x=new Oi(d)}else x=new Oi(d);x.finished.then(()=>{this.notifyFinished()}).catch(Lt),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(),P_()),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 rg(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 ph=30,J_=e=>!isNaN(parseFloat(e));class Z_{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var s;const i=mt.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=mt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=J_(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(),Ye.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=mt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>ph)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,ph);return w0(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 yr(e,t){return new Z_(e,t)}function sg(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Sc(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?sg(n,e):n}const eI={type:"spring",stiffness:500,damping:25,restSpeed:10},tI=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),nI={type:"keyframes",duration:.8},rI={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sI=(e,{keyframes:t})=>t.length>2?nI:Nr.has(e)?e.startsWith("scale")?tI(t[1]):eI:rI,iI=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function aI(e){for(const t in e)if(!iI.has(t))return!0;return!1}const Cc=(e,t,n,r={},i,s)=>a=>{const o=Sc(r,e)||{},l=o.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Ct(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};aI(o)||Object.assign(h,sI(e,h)),h.duration&&(h.duration=Ct(h.duration)),h.repeatDelay&&(h.repeatDelay=Ct(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let f=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(gl(h),h.delay===0&&(f=!0)),(xn.instantAnimations||xn.skipAnimations||i!=null&&i.shouldSkipAnimations||o.skipAnimations)&&(f=!0,gl(h),h.delay=0),h.allowFlatten=!o.type&&!o.ease,f&&!s&&t.get()!==void 0){const m=la(h.keyframes,o);if(m!==void 0){Ye.update(()=>{h.onUpdate(m),h.onComplete()});return}}return o.isSync?new Oi(h):new Q_(h)},oI=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lI(e){const t=oI.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function ig(e,t,n=1){const[r,i]=lI(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return v0(a)?parseFloat(a):a}return bc(i)?ig(i,t,n+1):i}function gh(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Ac(e,t,n,r){if(typeof t=="function"){const[i,s]=gh(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]=gh(r);t=t(n!==void 0?n:e.custom,i,s)}return t}function $n(e,t,n){const r=e.getProps();return Ac(r,t,n!==void 0?n:r.custom,e)}const ag=new Set(["width","height","top","left","right","bottom",...Ar]),xl=e=>Array.isArray(e);function cI(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,yr(n))}function uI(e){return xl(e)?e[e.length-1]||0:e}function dI(e,t){const n=$n(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const o=uI(s[a]);cI(e,a,o)}}const lt=e=>!!(e&&e.getVelocity);function hI(e){return!!(lt(e)&&e.add)}function bl(e,t){const n=e.getValue("willChange");if(hI(n))return n.add(t);if(!n&&xn.WillChange){const r=new xn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Nc(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const fI="framerAppearId",og="data-"+Nc(fI);function lg(e){return e.props[og]}function mI({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function cg(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:a,...o}=t;const l=e.getDefaultTransition();s=s?sg(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&&mI(m,p))continue;const b={delay:n,...Sc(s||{},p)};h&&(b.skipAnimations=!0);const T=g.get();if(T!==void 0&&!g.isAnimating()&&!Array.isArray(x)&&x===T&&!b.velocity){Ye.update(()=>g.set(x));continue}let w=!1;if(window.MotionHandoffAnimation){const S=lg(e);if(S){const _=window.MotionHandoffAnimation(S,p,Ye);_!==null&&(b.startTime=_,w=!0)}}bl(e,p);const A=c??e.shouldReduceMotion;g.start(Cc(p,g,x,A&&ag.has(p)?{type:!1}:b,e,w));const E=g.animation;E&&f.push(E)}if(a){const p=()=>Ye.update(()=>{a&&dI(e,a)});f.length?Promise.all(f).then(p):p()}return f}function yl(e,t,n={}){var l;const r=$n(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(cg(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:h=0,staggerChildren:f,staggerDirection:m}=i;return pI(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 pI(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(yl(l,t,{...a,delay:n+(typeof r=="function"?0:r)+rg(e.variantChildren,l,r,i,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}function gI(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>yl(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=yl(e,t,n);else{const i=typeof t=="function"?$n(e,t,n.custom):t;r=Promise.all(cg(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const xI={test:e=>e==="auto",parse:e=>e},ug=e=>t=>t.test(e),dg=[Cr,Te,Gt,tn,V5,z5,xI],xh=e=>dg.find(ug(e));function bI(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||k0(e):!0}const yI=new Set(["brightness","contrast","saturate","opacity"]);function vI(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(yc)||[];if(!r)return e;const i=n.replace(r,"");let s=yI.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const EI=/\b([a-z-]*)\(.*?\)/gu,vl={...Ht,getAnimatableNone:e=>{const t=e.match(EI);return t?t.map(vI).join(" "):e}},El={...Ht,getAnimatableNone:e=>{const t=Ht.parse(e);return Ht.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},bh={...Cr,transform:Math.round},kI={rotate:tn,pathRotation:tn,rotateX:tn,rotateY:tn,rotateZ:tn,scale:ti,scaleX:ti,scaleY:ti,scaleZ:ti,skew:tn,skewX:tn,skewY:tn,distance:Te,translateX:Te,translateY:Te,translateZ:Te,x:Te,y:Te,z:Te,perspective:Te,transformPerspective:Te,opacity:gs,originX:sh,originY:sh,originZ:Te},ji={borderWidth:Te,borderTopWidth:Te,borderRightWidth:Te,borderBottomWidth:Te,borderLeftWidth:Te,borderRadius:Te,borderTopLeftRadius:Te,borderTopRightRadius:Te,borderBottomRightRadius:Te,borderBottomLeftRadius:Te,width:Te,maxWidth:Te,height:Te,maxHeight:Te,top:Te,right:Te,bottom:Te,left:Te,inset:Te,insetBlock:Te,insetBlockStart:Te,insetBlockEnd:Te,insetInline:Te,insetInlineStart:Te,insetInlineEnd:Te,padding:Te,paddingTop:Te,paddingRight:Te,paddingBottom:Te,paddingLeft:Te,paddingBlock:Te,paddingBlockStart:Te,paddingBlockEnd:Te,paddingInline:Te,paddingInlineStart:Te,paddingInlineEnd:Te,margin:Te,marginTop:Te,marginRight:Te,marginBottom:Te,marginLeft:Te,marginBlock:Te,marginBlockStart:Te,marginBlockEnd:Te,marginInline:Te,marginInlineStart:Te,marginInlineEnd:Te,fontSize:Te,backgroundPositionX:Te,backgroundPositionY:Te,...kI,zIndex:bh,fillOpacity:gs,strokeOpacity:gs,numOctaves:bh},TI={...ji,color:nt,backgroundColor:nt,outlineColor:nt,fill:nt,stroke:nt,borderColor:nt,borderTopColor:nt,borderRightColor:nt,borderBottomColor:nt,borderLeftColor:nt,filter:vl,WebkitFilter:vl,mask:El,WebkitMask:El},hg=e=>TI[e],wI=new Set([vl,El]);function fg(e,t){let n=hg(e);return wI.has(n)||(n=Ht),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const SI=new Set(["auto","none","0"]);function CI(e,t,n){let r=0,i;for(;r<e.length&&!i;){const s=e[r];typeof s=="string"&&!SI.has(s)&&br(s).values.length&&(i=e[r]),r++}if(i&&n)for(const s of t)e[s]=fg(n,i)}class AI extends wc{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(),bc(f))){const m=ig(f,n.current);m!==void 0&&(t[h]=m),h===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!ag.has(r)||t.length!==2)return;const[i,s]=t,a=xh(i),o=xh(s),l=rh(i),c=rh(s);if(l!==c&&gn[r]){this.needsMeasurement=!0;return}if(a!==o)if(hh(a)&&hh(o))for(let h=0;h<t.length;h++){const f=t[h];typeof f=="string"&&(t[h]=parseFloat(f))}else gn[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||bI(t[i]))&&r.push(i);r.length&&CI(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=gn[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]=gn[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 _c=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function mg(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 kl=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function hi(e){return E0(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Ic}=D0(queueMicrotask,!1),Ot={x:!1,y:!1};function pg(){return Ot.x||Ot.y}function NI(e){return e==="x"||e==="y"?Ot[e]?null:(Ot[e]=!0,()=>{Ot[e]=!1}):Ot.x||Ot.y?null:(Ot.x=Ot.y=!0,()=>{Ot.x=Ot.y=!1})}function gg(e,t){const n=mg(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function _I(e){return!(e.pointerType==="touch"||pg())}function II(e,t,n={}){const[r,i,s]=gg(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(!_I(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 xg=(e,t)=>t?e===t?!0:xg(e,t.parentElement):!1,Mc=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,MI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function RI(e){return MI.has(e.tagName)||e.isContentEditable===!0}const LI=new Set(["INPUT","SELECT","TEXTAREA"]);function PI(e){return LI.has(e.tagName)||e.isContentEditable===!0}const fi=new WeakSet;function yh(e){return t=>{t.key==="Enter"&&e(t)}}function yo(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const DI=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=yh(()=>{if(fi.has(n))return;yo(n,"down");const i=yh(()=>{yo(n,"up")}),s=()=>yo(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 vh(e){return Mc(e)&&!pg()}const Eh=new WeakSet;function OI(e,t,n={}){const[r,i,s]=gg(e,n),a=o=>{const l=o.currentTarget;if(!vh(o)||Eh.has(o))return;fi.add(l),n.stopPropagation&&Eh.add(o);const c=t(l,o),h={...i,capture:!0},f=(p,g)=>{window.removeEventListener("pointerup",m,h),window.removeEventListener("pointercancel",d,h),fi.has(l)&&fi.delete(l),vh(p)&&typeof c=="function"&&c(p,{success:g})},m=p=>{f(p,l===window||l===document||n.useGlobalTarget||xg(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),hi(o)&&(o.addEventListener("focus",c=>DI(c,i)),!RI(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),s}function Rc(e){return E0(e)&&"ownerSVGElement"in e}const mi=new WeakMap;let fn;const bg=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:Rc(r)&&"getBBox"in r?r.getBBox()[t]:r[n],jI=bg("inline","width","offsetWidth"),FI=bg("block","height","offsetHeight");function BI({target:e,borderBoxSize:t}){var n;(n=mi.get(e))==null||n.forEach(r=>{r(e,{get width(){return jI(e,t)},get height(){return FI(e,t)}})})}function HI(e){e.forEach(BI)}function UI(){typeof ResizeObserver>"u"||(fn=new ResizeObserver(HI))}function zI(e,t){fn||UI();const n=mg(e);return n.forEach(r=>{let i=mi.get(r);i||(i=new Set,mi.set(r,i)),i.add(t),fn==null||fn.observe(r)}),()=>{n.forEach(r=>{const i=mi.get(r);i==null||i.delete(t),i!=null&&i.size||fn==null||fn.unobserve(r)})}}const pi=new Set;let cr;function VI(){cr=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};pi.forEach(t=>t(e))},window.addEventListener("resize",cr)}function $I(e){return pi.add(e),cr||VI(),()=>{pi.delete(e),!pi.size&&typeof cr=="function"&&(window.removeEventListener("resize",cr),cr=void 0)}}function kh(e,t){return typeof e=="function"?$I(e):zI(e,t)}function qI(e){return Rc(e)&&e.tagName==="svg"}const WI=[...dg,nt,Ht],YI=e=>WI.find(ug(e)),Th=()=>({translate:0,scale:1,origin:0,originPoint:0}),ur=()=>({x:Th(),y:Th()}),wh=()=>({min:0,max:0}),st=()=>({x:wh(),y:wh()}),GI=new WeakMap;function ca(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function xs(e){return typeof e=="string"||Array.isArray(e)}const Lc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Pc=["initial",...Lc];function ua(e){return ca(e.animate)||Pc.some(t=>xs(e[t]))}function yg(e){return!!(ua(e)||e.variants)}function KI(e,t,n){for(const r in t){const i=t[r],s=n[r];if(lt(i))e.addValue(r,i);else if(lt(s))e.addValue(r,yr(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,yr(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Tl={current:null},vg={current:!1},XI=typeof window<"u";function QI(){if(vg.current=!0,!!XI)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Tl.current=e.matches;e.addEventListener("change",t),t()}else Tl.current=!1}const Sh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Fi={};function Eg(e){Fi=e}function JI(){return Fi}class ZI{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=wc,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=mt.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,Ye.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=ua(n),this.isVariantNode=yg(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&<(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,GI.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:(vg.current||QI(),this.shouldReduceMotion=Tl.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(),bn(this.notifyUpdate),bn(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&&ng.has(t)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:c,duration:h}=n.accelerate,f=new eg({element:this.current,name:t,keyframes:o,times:l,ease:c,duration:Ct(h)}),m=a(f);this.valueSubscriptions.set(t,()=>{m(),f.cancel()});return}const r=Nr.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Ye.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 Fi){const n=Fi[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):st()}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<Sh.length;r++){const i=Sh[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=KI(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=yr(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"&&(v0(r)||k0(r))?r=parseFloat(r):!YI(r)&&Ht.test(n)&&(r=fg(t,n)),this.setBaseTarget(t,lt(r)?r.get():r)),lt(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=Ac(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&&!lt(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(){Ic.render(this.render)}}class kg extends ZI{constructor(){super(...arguments),this.KeyframeResolver=AI}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;lt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class En{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Tg({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function e4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function t4(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 vo(e){return e===void 0||e===1}function wl({scale:e,scaleX:t,scaleY:n}){return!vo(e)||!vo(t)||!vo(n)}function Rn(e){return wl(e)||wg(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function wg(e){return Ch(e.x)||Ch(e.y)}function Ch(e){return e&&e!=="0%"}function Bi(e,t,n){const r=e-n,i=t*r;return n+i}function Ah(e,t,n,r,i){return i!==void 0&&(e=Bi(e,i,r)),Bi(e,n,r)+t}function Sl(e,t=0,n=1,r,i){e.min=Ah(e.min,t,n,r,i),e.max=Ah(e.max,t,n,r,i)}function Sg(e,{x:t,y:n}){Sl(e.x,t.translate,t.scale,t.originPoint),Sl(e.y,n.translate,n.scale,n.originPoint)}const Nh=.999999999999,_h=1.0000000000001;function n4(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&&(qt(e.x,-s.scroll.offset.x),qt(e.y,-s.scroll.offset.y)),a&&(t.x*=a.x.scale,t.y*=a.y.scale,Sg(e,a)),r&&Rn(s.latestValues)&&gi(e,s.latestValues,(o=s.layout)==null?void 0:o.layoutBox))}t.x<_h&&t.x>Nh&&(t.x=1),t.y<_h&&t.y>Nh&&(t.y=1)}function qt(e,t){e.min+=t,e.max+=t}function Ih(e,t,n,r,i=.5){const s=We(e.min,e.max,i);Sl(e,t,n,s,r)}function Mh(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function gi(e,t,n){const r=n??e;Ih(e.x,Mh(t.x,r.x),t.scaleX,t.scale,t.originX),Ih(e.y,Mh(t.y,r.y),t.scaleY,t.scale,t.originY)}function Cg(e,t){return Tg(t4(e.getBoundingClientRect(),t))}function r4(e,t,n){const r=Cg(e,n),{scroll:i}=t;return i&&(qt(r.x,i.offset.x),qt(r.y,i.offset.y)),r}const s4={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},i4=Ar.length;function a4(e,t,n){let r="",i=!0;for(let a=0;a<i4;a++){const o=Ar[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=kl(l,ji[o]);if(!c){i=!1;const f=s4[o]||o;r+=`${f}(${h}) `}n&&(t[o]=h)}}const s=e.pathRotation;return s&&(i=!1,r+=`rotate(${kl(s,ji.pathRotation)}) `),r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function Dc(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(Nr.has(l)){a=!0;continue}else if(j0(l)){i[l]=c;continue}else{const h=kl(c,ji[l]);l.startsWith("origin")?(o=!0,s[l]=h):r[l]=h}}if(t.transform||(a||n?r.transform=a4(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 Ag(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 Rh(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Hr={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Te.test(e))e=parseFloat(e);else return e;const n=Rh(e,t.target.x),r=Rh(e,t.target.y);return`${n}% ${r}%`}},o4={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Ht.parse(e);if(i.length>5)return r;const s=Ht.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=We(o,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=c),typeof i[3+a]=="number"&&(i[3+a]/=c),s(i)}},Cl={borderRadius:{...Hr,applyTo:[..._c]},borderTopLeftRadius:Hr,borderTopRightRadius:Hr,borderBottomLeftRadius:Hr,borderBottomRightRadius:Hr,boxShadow:o4};function Ng(e,{layout:t,layoutId:n}){return Nr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Cl[e]||e==="opacity")}function Oc(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)(lt(r[o])||i&<(i[o])||Ng(o,e)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}function l4(e){return window.getComputedStyle(e)}class c4 extends kg{constructor(){super(...arguments),this.type="html",this.renderInstance=Ag}mount(t){oa(!!t.style),super.mount(t)}readValueFromInstance(t,n){var r;if(Nr.has(n))return(r=this.projection)!=null&&r.isProjecting?dl(n):__(t,n);{const i=l4(t),s=(j0(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Cg(t,n)}build(t,n,r){Dc(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Oc(t,n,r)}}const u4={offset:"stroke-dashoffset",array:"stroke-dasharray"},d4={offset:"strokeDashoffset",array:"strokeDasharray"};function h4(e,t,n=1,r=0,i=!0){e.pathLength=1;const s=i?u4:d4;e[s.offset]=`${-r}`,e[s.array]=`${t} ${n}`}const _g=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Ig(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:a=0,...o},l,c,h){if(Dc(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 _g)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&&h4(f,i,s,a,!1)}const Mg=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"]),Rg=e=>typeof e=="string"&&e.toLowerCase()==="svg";function f4(e,t,n,r){Ag(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Mg.has(i)?i:Nc(i),t.attrs[i])}function Lg(e,t,n){const r=Oc(e,t,n);for(const i in e)if(lt(e[i])||lt(t[i])){const s=Ar.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}class m4 extends kg{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=st}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Nr.has(n)){const r=hg(n);return r&&r.default||0}if(_g.includes(n)){const i=getComputedStyle(t)[n];if(typeof i=="string"&&i)return i.trim()}return n=Mg.has(n)?n:Nc(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Lg(t,n,r)}build(t,n,r){Ig(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){f4(t,n,r,i)}mount(t){this.isSVGTag=Rg(t.tagName),super.mount(t)}}const p4=Pc.length;function Pg(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Pg(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<p4;n++){const r=Pc[n],i=e.props[r];(xs(i)||i===!1)&&(t[r]=i)}return t}function Dg(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 g4=[...Lc].reverse(),x4=Lc.length;function b4(e){return t=>Promise.all(t.map(({animation:n,options:r})=>gI(e,n,r)))}function y4(e){let t=b4(e),n=Lh(),r=!0,i=!1;const s=c=>(h,f)=>{var d;const m=$n(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=Pg(e.parent)||{},m=[],d=new Set;let p={},g=1/0;for(let b=0;b<x4;b++){const T=g4[b],w=n[T],A=h[T]!==void 0?h[T]:f[T],E=xs(A),S=T===c?w.isActive:null;S===!1&&(g=b);let _=A===f[T]&&A!==h[T]&&E;if(_&&(r||i)&&e.manuallyAnimateOnMount&&(_=!1),w.protectedKeys={...p},!w.isActive&&S===null||!A&&!w.prevProp||ca(A)||typeof A=="boolean")continue;if(T==="exit"&&w.isActive&&S!==!0){w.prevResolvedValues&&(p={...p,...w.prevResolvedValues});continue}const k=v4(w.prevProp,A);let N=k||T===c&&w.isActive&&!_&&E||b>g&&E,C=!1;const R=Array.isArray(A)?A:[A];let M=R.reduce(s(T),{});S===!1&&(M={});const{prevResolvedValues:O={}}=w,L={...O,...M},I=U=>{N=!0,d.has(U)&&(C=!0,d.delete(U)),w.needsAnimating[U]=!0;const W=e.getValue(U);W&&(W.liveStyle=!1)};for(const U in L){const W=M[U],D=O[U];if(p.hasOwnProperty(U))continue;let Z=!1;xl(W)&&xl(D)?Z=!Dg(W,D)||k:Z=W!==D,Z?W!=null?I(U):d.add(U):W!==void 0&&d.has(U)?I(U):w.protectedKeys[U]=!0}w.prevProp=A,w.prevResolvedValues=M,w.isActive&&(p={...p,...M}),(r||i)&&e.blockInitialAnimation&&(N=!1);const j=_&&k;N&&(!j||C)&&m.push(...R.map(U=>{const W={type:T};if(typeof U=="string"&&(r||i)&&!j&&e.manuallyAnimateOnMount&&e.parent){const{parent:D}=e,Z=$n(D,U);if(D.enteringChildren&&Z){const{delayChildren:ee}=Z.transition||{};W.delay=rg(D.enteringChildren,e,ee)}}return{animation:U,options:W}}))}if(d.size){const b={};if(typeof h.initial!="boolean"){const T=$n(e,Array.isArray(h.initial)?h.initial[0]:h.initial);T&&T.transition&&(b.transition=T.transition)}d.forEach(T=>{const w=e.getBaseTarget(T),A=e.getValue(T);A&&(A.liveStyle=!0),b[T]=w??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=Lh(),i=!0}}}function v4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Dg(t,e):!1}function Nn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Lh(){return{animate:Nn(!0),whileInView:Nn(),whileHover:Nn(),whileTap:Nn(),whileDrag:Nn(),whileFocus:Nn(),exit:Nn()}}function Al(e,t){e.min=t.min,e.max=t.max}function Dt(e,t){Al(e.x,t.x),Al(e.y,t.y)}function Ph(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Og=1e-4,E4=1-Og,k4=1+Og,jg=.01,T4=0-jg,w4=0+jg;function pt(e){return e.max-e.min}function S4(e,t,n){return Math.abs(e-t)<=n}function Dh(e,t,n,r=.5){e.origin=r,e.originPoint=We(t.min,t.max,e.origin),e.scale=pt(n)/pt(t),e.translate=We(n.min,n.max,e.origin)-e.originPoint,(e.scale>=E4&&e.scale<=k4||isNaN(e.scale))&&(e.scale=1),(e.translate>=T4&&e.translate<=w4||isNaN(e.translate))&&(e.translate=0)}function as(e,t,n,r){Dh(e.x,t.x,n.x,r?r.originX:void 0),Dh(e.y,t.y,n.y,r?r.originY:void 0)}function Oh(e,t,n,r=0){const i=r?We(n.min,n.max,r):n.min;e.min=i+t.min,e.max=e.min+pt(t)}function C4(e,t,n,r){Oh(e.x,t.x,n.x,r==null?void 0:r.x),Oh(e.y,t.y,n.y,r==null?void 0:r.y)}function jh(e,t,n,r=0){const i=r?We(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+pt(t)}function Hi(e,t,n,r){jh(e.x,t.x,n.x,r==null?void 0:r.x),jh(e.y,t.y,n.y,r==null?void 0:r.y)}function Fh(e,t,n,r,i){return e-=t,e=Bi(e,1/n,r),i!==void 0&&(e=Bi(e,1/i,r)),e}function A4(e,t=0,n=1,r=.5,i,s=e,a=e){if(Gt.test(t)&&(t=parseFloat(t),t=We(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=We(s.min,s.max,r);e===s&&(o-=t),e.min=Fh(e.min,t,n,o,i),e.max=Fh(e.max,t,n,o,i)}function Bh(e,t,[n,r,i],s,a){A4(e,t[n],t[r],t[i],t.scale,s,a)}const N4=["x","scaleX","originX"],_4=["y","scaleY","originY"];function Hh(e,t,n,r){Bh(e.x,t,N4,n?n.x:void 0,r?r.x:void 0),Bh(e.y,t,_4,n?n.y:void 0,r?r.y:void 0)}function Uh(e){return e.translate===0&&e.scale===1}function Fg(e){return Uh(e.x)&&Uh(e.y)}function zh(e,t){return e.min===t.min&&e.max===t.max}function I4(e,t){return zh(e.x,t.x)&&zh(e.y,t.y)}function Vh(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Bg(e,t){return Vh(e.x,t.x)&&Vh(e.y,t.y)}function $h(e){return pt(e.x)/pt(e.y)}function qh(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vt(e){return[e("x"),e("y")]}function M4(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 R4=_c.length,Wh=e=>typeof e=="string"?parseFloat(e):e,Yh=e=>typeof e=="number"||Te.test(e);function L4(e,t,n,r,i,s){i?(e.opacity=We(0,n.opacity??1,P4(r)),e.opacityExit=We(t.opacity??1,0,D4(r))):s&&(e.opacity=We(t.opacity??1,n.opacity??1,r));for(let a=0;a<R4;a++){const o=_c[a];let l=Gh(t,o),c=Gh(n,o);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||Yh(l)===Yh(c)?(e[o]=Math.max(We(Wh(l),Wh(c),r),0),(Gt.test(c)||Gt.test(l))&&(e[o]+="%")):e[o]=c}(t.rotate||n.rotate)&&(e.rotate=We(t.rotate||0,n.rotate||0,r))}function Gh(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const P4=Hg(0,.5,M0),D4=Hg(.5,.95,Lt);function Hg(e,t,n){return r=>r<e?0:r>t?1:n(ps(e,t,r))}function O4(e,t,n){const r=lt(e)?e:yr(e);return r.start(Cc("",r,t,n)),r.animation}function bs(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const j4=(e,t)=>e.depth-t.depth;class F4{constructor(){this.children=[],this.isDirty=!1}add(t){mc(this.children,t),this.isDirty=!0}remove(t){Ri(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(j4),this.isDirty=!1,this.children.forEach(t)}}function B4(e,t){const n=mt.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(bn(r),e(s-t))};return Ye.setup(r,!0),()=>bn(r)}function xi(e){return lt(e)?e.get():e}class H4{constructor(){this.members=[]}add(t){mc(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&&(Ri(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Ri(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 bi={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Eo=["","X","Y","Z"],U4=1e3;let z4=0;function ko(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Ug(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=lg(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ye,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Ug(r)}function zg({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},o=t==null?void 0:t()){this.id=z4++,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(q4),this.nodes.forEach(Q4),this.nodes.forEach(J4),this.nodes.forEach(W4)},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 F4)}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=Rc(a)&&!qI(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;Ye.read(()=>{f=window.innerWidth}),e(a,()=>{const d=window.innerWidth;d!==f&&(f=d,this.root.updateBlockedByResize=!0,h&&h(),h=B4(m,250),bi.hasAnimatedSinceResize&&(bi.hasAnimatedSinceResize=!1,this.nodes.forEach(Qh)))})}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()||r6,{onLayoutAnimationStart:g,onLayoutAnimationComplete:x}=c.getProps(),b=!this.targetLayout||!Bg(this.targetLayout,d),T=!f&&m;if(this.options.layoutRoot||this.resumeFrom||T||f&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...Sc(p,"layout"),onPlay:g,onComplete:x};(c.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(h,T,w.path)}else f||Qh(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(),bn(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(Z4),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&&Ug(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(G4),this.nodes.forEach(Kh);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Xh);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(K4),this.nodes.forEach(X4),this.nodes.forEach(V4),this.nodes.forEach($4)):this.nodes.forEach(Xh),this.clearAllSnapshots();const o=mt.now();ot.delta=Xt(0,1e3/60,o-ot.timestamp),ot.timestamp=o,ot.isProcessing=!0,fo.update.process(ot),fo.preRender.process(ot),fo.render.process(ot),ot.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ic.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Y4),this.sharedNodes.forEach(e6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ye.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ye.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!pt(this.snapshot.measuredBox.x)&&!pt(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=st()),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&&!Fg(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,h=c!==this.prevTransformTemplateValue;a&&this.instance&&(o||Rn(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)),s6(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:a}=this.options;if(!a)return st();const o=a.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(i6))){const{scroll:h}=this.root;h&&(qt(o.x,h.offset.x),qt(o.y,h.offset.y))}return o}removeElementScroll(a){var l;const o=st();if(Dt(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&&Dt(o,a),qt(o.x,f.offset.x),qt(o.y,f.offset.y))}return o}applyTransform(a,o=!1,l){var h,f;const c=l||st();Dt(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&&(qt(c.x,-d.scroll.offset.x),qt(c.y,-d.scroll.offset.y)),Rn(d.latestValues)&&gi(c,d.latestValues,(h=d.layout)==null?void 0:h.layoutBox)}return Rn(this.latestValues)&&gi(c,this.latestValues,(f=this.layout)==null?void 0:f.layoutBox),c}removeTransform(a){var l;const o=st();Dt(o,a);for(let c=0;c<this.path.length;c++){const h=this.path[c];if(!Rn(h.latestValues))continue;let f;h.instance&&(wl(h.latestValues)&&h.updateSnapshot(),f=st(),Dt(f,h.measurePageBox())),Hh(o,h.latestValues,(l=h.snapshot)==null?void 0:l.layoutBox,f)}return Rn(this.latestValues)&&Hh(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!==ot.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=ot.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=st(),this.targetWithTransforms=st()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),C4(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Dt(this.target,this.layout.layoutBox),Sg(this.target,this.targetDelta)):Dt(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||wl(this.parent.latestValues)||wg(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=st(),this.relativeTargetOrigin=st(),Hi(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),Dt(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===ot.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;Dt(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;n4(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=st());const{target:d}=a;if(!d){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ph(this.prevProjectionDelta.x,this.projectionDelta.x),Ph(this.prevProjectionDelta.y,this.projectionDelta.y)),as(this.projectionDelta,this.layoutCorrected,d,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!qh(this.projectionDelta.x,this.prevProjectionDelta.x)||!qh(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=ur(),this.projectionDelta=ur(),this.projectionDeltaWithTransform=ur()}setAnimationOrigin(a,o=!1,l){const c=this.snapshot,h=c?c.latestValues:{},f={...this.latestValues},m=ur();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const d=st(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,b=this.getStack(),T=!b||b.members.length<=1,w=!!(x&&!T&&this.options.crossfade===!0&&!this.path.some(n6));this.animationProgress=0;let A;const E=l==null?void 0:l.interpolateProjection(a);this.mixTargetDelta=S=>{const _=S/1e3,k=E==null?void 0:E(_);k?(m.x.translate=k.x,m.x.scale=We(a.x.scale,1,_),m.x.origin=a.x.origin,m.x.originPoint=a.x.originPoint,m.y.translate=k.y,m.y.scale=We(a.y.scale,1,_),m.y.origin=a.y.origin,m.y.originPoint=a.y.originPoint):(Jh(m.x,a.x,_),Jh(m.y,a.y,_)),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Hi(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),t6(this.relativeTarget,this.relativeTargetOrigin,d,_),A&&I4(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=st()),Dt(A,this.relativeTarget)),x&&(this.animationValues=f,L4(f,h,this.latestValues,_,w,T)),k&&k.rotate!==void 0&&(this.animationValues||(this.animationValues=f),this.animationValues.pathRotation=k.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&&(bn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ye.update(()=>{bi.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=yr(0)),this.motionValue.jump(0,!1),this.currentAnimation=O4(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(U4),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&&Vg(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||st();const f=pt(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+f;const m=pt(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+m}Dt(o,l),gi(o,h),as(this.projectionDeltaWithTransform,this.layoutCorrected,o,h)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new H4),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&&ko("z",a,c,this.animationValues);for(let h=0;h<Eo.length;h++)ko(`rotate${Eo[h]}`,a,c,this.animationValues),ko(`skew${Eo[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=xi(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=xi(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Rn(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const h=c.animationValues||c.latestValues;this.applyTransformsToTarget();let f=M4(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 Cl){if(h[p]===void 0)continue;const{correct:g,applyTo:x,isCSSVariable:b}=Cl[p],T=f==="none"?h[p]:g(h[p],c);if(x){const w=x.length;for(let A=0;A<w;A++)a[x[A]]=T}else b?this.options.visualElement.renderState.vars[p]=T:a[p]=T}this.options.layoutId&&(a.pointerEvents=c===this?xi(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(Kh),this.root.sharedNodes.clear()}}}function V4(e){e.updateLayout()}function $4(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")Vt(f=>{const m=a?t.measuredBox[f]:t.layoutBox[f],d=pt(m);m.min=r[f].min,m.max=m.min+d});else if(s==="x"||s==="y"){const f=s==="x"?"y":"x";Al(a?t.measuredBox[f]:t.layoutBox[f],r[f])}else Vg(s,t.layoutBox,r)&&Vt(f=>{const m=a?t.measuredBox[f]:t.layoutBox[f],d=pt(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=ur();as(o,r,t.layoutBox);const l=ur();a?as(l,e.applyTransform(i,!0),t.measuredBox):as(l,r,t.layoutBox);const c=!Fg(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=st();Hi(g,t.layoutBox,m.layoutBox,p);const x=st();Hi(x,r,d.layoutBox,p),Bg(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 q4(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 W4(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Y4(e){e.clearSnapshot()}function Kh(e){e.clearMeasurements()}function G4(e){e.isLayoutDirty=!0,e.updateLayout()}function Xh(e){e.isLayoutDirty=!1}function K4(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function X4(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Qh(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Q4(e){e.resolveTargetDelta()}function J4(e){e.calcProjection()}function Z4(e){e.resetSkewAndRotation()}function e6(e){e.removeLeadSnapshot()}function Jh(e,t,n){e.translate=We(t.translate,0,n),e.scale=We(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Zh(e,t,n,r){e.min=We(t.min,n.min,r),e.max=We(t.max,n.max,r)}function t6(e,t,n,r){Zh(e.x,t.x,n.x,r),Zh(e.y,t.y,n.y,r)}function n6(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const r6={duration:.45,ease:[.4,0,.1,1]},ef=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),tf=ef("applewebkit/")&&!ef("chrome/")?Math.round:Lt;function nf(e){e.min=tf(e.min),e.max=tf(e.max)}function s6(e){nf(e.x),nf(e.y)}function Vg(e,t,n){return e==="position"||e==="preserve-aspect"&&!S4($h(t),$h(n),.2)}function i6(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const a6=zg({attachResizeListener:(e,t)=>bs(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}),To={current:void 0},$g=zg({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!To.current){const e=new a6({});e.mount(window),e.setOptions({layoutScroll:!0}),To.current=e}return To.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),jc=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function rf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function o6(...e){return t=>{let n=!1;const r=e.map(i=>{const s=rf(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():rf(e[i],null)}}}}function l6(...e){return v.useCallback(o6(...e),e)}class c6 extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(hi(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=hi(r)&&r.offsetWidth||0,s=hi(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 u6({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(jc),h=s!==!1?((m=e.props)==null?void 0:m.ref)??(e==null?void 0:e.ref):void 0,f=l6(o,h);return v.useInsertionEffect(()=>{const{width:d,height:p,top:g,left:x,right:b,bottom:T,direction:w}=l.current;if(t||s===!1||!o.current||!d||!p)return;const A=w==="rtl",E=n==="left"?A?`right: ${b}`:`left: ${x}`:A?`left: ${x}`:`right: ${b}`,S=r==="bottom"?`bottom: ${T}`:`top: ${g}`;o.current.dataset.motionPopId=a;const _=document.createElement("style");c&&(_.nonce=c);const k=i??document.head;return k.appendChild(_),_.sheet&&_.sheet.insertRule(`
|
|
511
|
-
[data-motion-pop-id="${a}"] {
|
|
512
|
-
position: absolute !important;
|
|
513
|
-
width: ${d}px !important;
|
|
514
|
-
height: ${p}px !important;
|
|
515
|
-
${E}px !important;
|
|
516
|
-
${S}px !important;
|
|
517
|
-
}
|
|
518
|
-
`),()=>{var N;(N=o.current)==null||N.removeAttribute("data-motion-pop-id"),k.contains(_)&&k.removeChild(_)}},[t]),u.jsx(c6,{isPresent:t,childRef:o,sizeRef:l,pop:s,children:s===!1?e:v.cloneElement(e,{ref:f})})}const d6=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a,anchorX:o,anchorY:l,root:c})=>{const h=fc(h6),f=v.useId(),m=v.useRef(n),d=v.useRef(r);Mi(()=>{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(u6,{pop:a==="popLayout",isPresent:n,anchorX:o,anchorY:l,root:c,children:e}),u.jsx(aa.Provider,{value:g,children:e})};function h6(){return new Map}function qg(e=!0){const t=v.useContext(aa);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 ni=e=>e.key||"";function sf(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const f6=({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]=qg(a),m=v.useMemo(()=>sf(e),[e]),d=a&&!h?[]:m.map(ni),p=v.useRef(!0),g=v.useRef(m),x=fc(()=>new Map),b=v.useRef(new Set),[T,w]=v.useState(m),[A,E]=v.useState(m);Mi(()=>{a&&!h&&!A.length&&(f==null||f())},[h,a,A.length,f]),Mi(()=>{p.current=!1,g.current=m;for(let k=0;k<A.length;k++){const N=ni(A[k]);d.includes(N)?(x.delete(N),b.current.delete(N)):x.get(N)!==!0&&x.set(N,!1)}},[A,d.length,d.join("-")]);const S=[];if(m!==T){let k=[...m];for(let N=0;N<A.length;N++){const C=A[N],R=ni(C);d.includes(R)||(k.splice(N,0,C),S.push(C))}return s==="wait"&&S.length&&(k=S),E(sf(k)),w(m),null}const{forceRender:_}=v.useContext(hc);return u.jsx(u.Fragment,{children:A.map(k=>{const N=ni(k),C=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(d6,{isPresent:C,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:s,root:c,onExitComplete:C?void 0:R,anchorX:o,anchorY:l,children:k},N)})})},Wg=v.createContext({strict:!1}),af={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 of=!1;function m6(){if(of)return;const e={};for(const t in af)e[t]={isEnabled:n=>af[t].some(r=>!!n[r])};Eg(e),of=!0}function Yg(){return m6(),JI()}function p6(e){const t=Yg();for(const n in e)t[n]={...t[n],...e[n]};Eg(t)}const da=v.createContext({});function g6(e,t){if(ua(e)){const{initial:n,animate:r}=e;return{initial:n===!1||xs(n)?n:void 0,animate:xs(r)?r:void 0}}return e.inherit!==!1?t:{}}function x6(e){const{initial:t,animate:n}=g6(e,v.useContext(da));return v.useMemo(()=>({initial:t,animate:n}),[lf(t),lf(n)])}function lf(e){return Array.isArray(e)?e.join(" "):e}const Fc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Gg(e,t,n){for(const r in t)!lt(t[r])&&!Ng(r,n)&&(e[r]=t[r])}function b6({transformTemplate:e},t){return v.useMemo(()=>{const n=Fc();return Dc(n,t,e),Object.assign({},n.vars,n.style)},[t])}function y6(e,t){const n=e.style||{},r={};return Gg(r,n,e),Object.assign(r,b6(e,t)),r}function v6(e,t){const n={},r=y6(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 Kg=()=>({...Fc(),attrs:{}});function E6(e,t,n,r){const i=v.useMemo(()=>{const s=Kg();return Ig(s,t,Rg(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};Gg(s,e.style,e),i.style={...s,...i.style}}return i}const k6=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 Ui(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||k6.has(e)}function T6(e,t){return e.startsWith("on")?!Ui(e):(t==null?void 0:t(e))??!Ui(e)}function w6(e,t,n,r){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||lt(e[s])||(T6(s,r)||n===!0&&Ui(s)||!t&&!Ui(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}const S6=["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 Bc(e){return typeof e!="string"||e.includes("-")?!1:!!(S6.indexOf(e)>-1||/[A-Z]/u.test(e))}function C6(e,t,n,{latestValues:r},i,s=!1,a,o){const c=(a??Bc(e)?E6:v6)(t,r,i,e),h=w6(t,typeof e=="string",s,o),f=e!==v.Fragment?{...h,...c,ref:n}:{},{children:m}=t,d=v.useMemo(()=>lt(m)?m.get():m,[m]);return v.createElement(e,{...f,children:d})}function A6({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:N6(n,r,i,e),renderState:t()}}function N6(e,t,n,r){const i={},s=r(e,{});for(const m in s)i[m]=xi(s[m]);let{initial:a,animate:o}=e;const l=ua(e),c=yg(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"&&!ca(f)){const m=Array.isArray(f)?f:[f];for(let d=0;d<m.length;d++){const p=Ac(e,m[d]);if(p){const{transitionEnd:g,transition:x,...b}=p;for(const T in b){let w=b[T];if(Array.isArray(w)){const A=h?w.length-1:0;w=w[A]}w!==null&&(i[T]=w)}for(const T in g)i[T]=g[T]}}}return i}const Xg=e=>(t,n)=>{const r=v.useContext(da),i=v.useContext(aa),s=()=>A6(e,t,r,i);return n?s():fc(s)},_6=Xg({scrapeMotionValuesFromProps:Oc,createRenderState:Fc}),I6=Xg({scrapeMotionValuesFromProps:Lg,createRenderState:Kg}),M6=Symbol.for("motionComponentSymbol");function R6(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 Qg=v.createContext({});function ar(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function L6(e,t,n,r,i,s){var w,A;const{visualElement:a}=v.useContext(da),o=v.useContext(Wg),l=v.useContext(aa),c=v.useContext(jc),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(Qg);p&&!p.projection&&i&&(p.type==="html"||p.type==="svg")&&P6(m.current,n,i,g);const x=v.useRef(!1);v.useInsertionEffect(()=>{p&&x.current&&p.update(n,l)});const b=n[og],T=v.useRef(!!b&&typeof window<"u"&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,b))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,b)));return Mi(()=>{d.current=!0,p&&(x.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),T.current&&p.animationState&&p.animationState.animateChanges())}),v.useEffect(()=>{p&&(!T.current&&p.animationState&&p.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,b)}),T.current=!1),p.enteringChildren=void 0)}),p}function P6(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:Jg(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||o&&ar(o),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:f,layoutScroll:l,layoutRoot:c,layoutAnchor:h})}function Jg(e){if(e)return e.options.allowProjection!==!1?e.projection:Jg(e.parent)}function wo(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&p6(r);const s=n?n==="svg":Bc(e),a=s?I6:_6;function o(c,h){let f;const m={...v.useContext(jc),...c,layoutId:D6(c)},{isStatic:d,isValidProp:p}=m,g=x6(c),x=a(c,d);if(!d&&typeof window<"u"){O6();const b=j6(m);f=b.MeasureLayout,g.visualElement=L6(e,x,m,i,b.ProjectionNode,s)}return u.jsxs(da.Provider,{value:g,children:[f&&g.visualElement?u.jsx(f,{visualElement:g.visualElement,...m}):null,C6(e,c,R6(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[M6]=e,l}function D6({layoutId:e}){const t=v.useContext(hc).id;return t&&e!==void 0?t+"-"+e:e}function O6(e,t){v.useContext(Wg).strict}function j6(e){const t=Yg(),{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 F6(e,t){if(typeof Proxy>"u")return wo;const n=new Map,r=(s,a)=>wo(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,wo(a,void 0,e,t)),n.get(a))})}const B6=(e,t)=>t.isSVG??Bc(e)?new m4(t):new c4(t,{allowProjection:e!==v.Fragment});class H6 extends En{constructor(t){super(t),t.animationState||(t.animationState=y4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ca(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 U6=0;class z6 extends En{constructor(){super(...arguments),this.id=U6++,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=$n(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 V6={animation:{Feature:H6},exit:{Feature:z6}};function Ls(e){return{point:{x:e.pageX,y:e.pageY}}}const $6=e=>t=>Mc(t)&&e(t,Ls(t));function os(e,t,n,r){return bs(e,t,$6(n),r)}const Zg=({current:e})=>e?e.ownerDocument.defaultView:null,cf=(e,t)=>Math.abs(e-t);function q6(e,t){const n=cf(e.x,t.x),r=cf(e.y,t.y);return Math.sqrt(n**2+r**2)}const uf=new Set(["auto","scroll"]);class ex{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=ri(this.lastRawMoveEventInfo,this.transformPagePoint));const p=So(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=q6(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:b}=p,{timestamp:T}=ot;this.history.push({...b,timestamp:T});const{onStart:w,onMove:A}=this.handlers;g||(w&&w(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=ri(g,this.transformPagePoint),Ye.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:x,onSessionEnd:b,resumeAnimation:T}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&T&&T(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=So(p.type==="pointercancel"?this.lastMoveEventInfo:ri(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(p,w),b&&b(p,w)},!Mc(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=i||window;const l=Ls(t),c=ri(l,this.transformPagePoint),{point:h}=c,{timestamp:f}=ot;this.history=[{...h,timestamp:f}];const{onSessionStart:m}=n;m&&m(t,So(c,this.history));const d={passive:!0,capture:!0};this.removeListeners=Is(os(this.contextWindow,"pointermove",this.handlePointerMove,d),os(this.contextWindow,"pointerup",this.handlePointerUp,d),os(this.contextWindow,"pointercancel",this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(uf.has(r.overflowX)||uf.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),Ye.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),bn(this.updatePoint)}}function ri(e,t){return t?{point:t(e.point)}:e}function df(e,t){return{x:e.x-t.x,y:e.y-t.y}}function So({point:e},t){return{point:e,delta:df(e,tx(t)),offset:df(e,W6(t)),velocity:Y6(t,.1)}}function W6(e){return e[0]}function tx(e){return e[e.length-1]}function Y6(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=tx(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ct(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Ct(t)*2&&(r=e[1]);const s=Rt(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 G6(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?We(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?We(n,e,r.max):Math.min(e,n)),e}function hf(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 K6(e,{top:t,left:n,bottom:r,right:i}){return{x:hf(e.x,n,i),y:hf(e.y,t,r)}}function ff(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 X6(e,t){return{x:ff(e.x,t.x),y:ff(e.y,t.y)}}function Q6(e,t){let n=.5;const r=pt(e),i=pt(t);return i>r?n=ps(t.min,t.max-r,e.min):r>i&&(n=ps(e.min,e.max-i,t.min)),Xt(0,1,n)}function J6(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 Nl=.35;function Z6(e=Nl){return e===!1?e=0:e===!0&&(e=Nl),{x:mf(e,"left","right"),y:mf(e,"top","bottom")}}function mf(e,t,n){return{min:pf(e,t),max:pf(e,n)}}function pf(e,t){return typeof e=="number"?e:e[t]||0}const eM=new WeakMap;class tM{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=st(),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(Ls(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=NI(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),Vt(b=>{let T=this.getAxisMotionValue(b).get()||0;if(Gt.test(T)){const{projection:w}=this.visualElement;if(w&&w.layout){const A=w.layout.layoutBox[b];A&&(T=pt(A)*(parseFloat(T)/100))}}this.originPoint[b]=T}),g&&Ye.update(()=>g(f,m),!1,!0),bl(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=rM(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&&Ye.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 ex(t,{onSessionStart:s,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:r,contextWindow:Zg(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&&Ye.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||!si(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=G6(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&&ar(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=K6(r.layoutBox,t):this.constraints=!1,this.elastic=Z6(n),i!==this.constraints&&!ar(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Vt(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=J6(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ar(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=r4(r,i.root,this.visualElement.getTransformPagePoint());let a=X6(i.layout.layoutBox,s);if(n){const o=n(e4(a));this.hasMutatedConstraints=!!o,o&&(a=Tg(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},c=Vt(h=>{if(!si(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 bl(this.visualElement,t),r.start(Cc(t,r,0,n,this.visualElement,!1))}stopAnimation(){Vt(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){Vt(n=>{const{drag:r}=this.getProps();if(!si(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]-We(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ar(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Vt(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();i[a]=Q6({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(),Vt(a=>{if(!si(a,t,null))return;const o=this.getAxisMotionValue(a),{min:l,max:c}=this.constraints[a];o.set(We(l,c,i[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;eM.set(this.visualElement,this);const t=this.visualElement.current,n=os(t,"pointerdown",c=>{const{drag:h,dragListener:f=!0}=this.getProps(),m=c.target,d=m!==t&&PI(m);h&&f&&!d&&this.start(c)});let r;const i=()=>{const{dragConstraints:c}=this.getProps();ar(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=nM(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,a=s.addEventListener("measure",i);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ye.read(i);const o=bs(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:h})=>{this.isDragging&&h&&(Vt(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=Nl,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:o}}}function gf(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function nM(e,t,n){const r=kh(e,gf(n)),i=kh(t,gf(n));return()=>{r(),i()}}function si(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function rM(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class sM extends En{constructor(t){super(t),this.removeGroupControls=Lt,this.removeListeners=Lt,this.controls=new tM(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Lt}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 Co=e=>(t,n)=>{e&&Ye.update(()=>e(t,n),!1,!0)};class iM extends En{constructor(){super(...arguments),this.removePointerDownListener=Lt}onPointerDown(t){this.session=new ex(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Zg(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Co(t),onStart:Co(n),onMove:Co(r),onEnd:(s,a)=>{delete this.session,i&&Ye.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=os(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 Ao=!1;class aM 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),Ao&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),bi.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}),Ao=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==s?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||Ye.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(),Ic.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;Ao=!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 nx(e){const[t,n]=qg(),r=v.useContext(hc);return u.jsx(aM,{...e,layoutGroup:r,switchLayoutGroup:v.useContext(Qg),isPresent:t,safeToRemove:n})}const oM={pan:{Feature:iM},drag:{Feature:sM,ProjectionNode:$g,MeasureLayout:nx}};function xf(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&&Ye.postRender(()=>s(t,Ls(t)))}class lM extends En{mount(){const{current:t}=this.node;t&&(this.unmount=II(t,(n,r)=>(xf(this.node,r,"Start"),i=>xf(this.node,i,"End"))))}unmount(){}}class cM extends En{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=Is(bs(this.node.current,"focus",()=>this.onFocus()),bs(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function bf(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&&Ye.postRender(()=>s(t,Ls(t)))}class uM extends En{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=OI(t,(i,s)=>(bf(this.node,s,"Start"),(a,{success:o})=>bf(this.node,a,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const _l=new WeakMap,No=new WeakMap,dM=e=>{const t=_l.get(e.target);t&&t(e)},hM=e=>{e.forEach(dM)};function fM({root:e,...t}){const n=e||document;No.has(n)||No.set(n,{});const r=No.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(hM,{root:e,...t})),r[i]}function mM(e,t,n){const r=fM(t);return _l.set(e,n),r.observe(e),()=>{_l.delete(e),r.unobserve(e)}}const pM={some:0,all:1};class gM extends En{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:pM[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=mM(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(xM(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function xM({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const bM={inView:{Feature:gM},tap:{Feature:uM},focus:{Feature:cM},hover:{Feature:lM}},yM={layout:{ProjectionNode:$g,MeasureLayout:nx}},vM={...V6,...bM,...oM,...yM},EM=F6(vM,B6),kM=EM;function TM(e){switch(e){case"correct":return{Icon:Ft,color:"var(--brand)"};case"wrong":return{Icon:qn,color:"var(--warning)"};case"mastery":case"level-up":return{Icon:_f,color:"var(--gold)"};case"unlock":return{Icon:Ro,color:"var(--brand)"};case"streak":return{Icon:If,color:"var(--review)"};case"energy-full":return{Icon:Po,color:"var(--brand)"};case"exam-pass":return{Icon:Xx,color:"var(--exam)"};case"lesson-complete":return{Icon:L1,color:"var(--gold)"};default:return{Icon:Ro,color:"var(--brand)"}}}function wM(){const e=Ml(),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=iu(m=>{var b,T;const d=Bx(m.kind),p=Math.round(d.particles*(m.intensity??1)),g=((b=m.origin)==null?void 0:b.x)??window.innerWidth/2,x=((T=m.origin)==null?void 0:T.y)??window.innerHeight/2;for(let w=0;w<p;w++){const A=Math.PI*2*w/p+Math.random()*.3,E=3+Math.random()*6,S=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:S,maxLife:S,color:d.colors[w%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 iu(l=>{const c=++a;s({kind:l.kind,id:c}),setTimeout(()=>{c===a&&s(null)},600)})},[e]),e?u.jsx(f6,{children:i&&(()=>{const{Icon:a,color:o}=TM(i.kind);return u.jsx(kM.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 yf=["direct","guide","practice"];function SM(){const e=Ne(),[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(Y=>{p(Y instanceof Error?Y.message:String(Y)),console.error(Y)},[]),[x,b]=v.useState([]),[T,w]=v.useState(null),[A,E]=v.useState([]),[S,_]=v.useState(null),[k,N]=v.useState("map"),[C,R]=v.useState(null),[M,O]=v.useState(new Set),[L,I]=v.useState(null),j=v.useRef({active:!1,terminate:null}),[F,U]=v.useState({open:!1,pendingAction:null}),W=v.useRef(null),[D,Z]=v.useState(null),[ee,P]=v.useState(!1),[Q,$]=v.useState(!0),[q,se]=v.useState(!0),te=T5(),[G,Ee]=v.useState("notebook"),[ae,ie]=v.useState("chat"),ke=v.useRef(ae);ke.current=ae;const ve=v.useRef(te);v.useEffect(()=>{ve.current!==te&&(te===1?($(!0),se(!0)):te===2&&ve.current===3&&Ee(b5(ke.current)),ve.current=te)},[te]);const Se=te===3?ae==="rail":te===2?G==="rail":Q,Ve=te===3?ae==="notebook":te===2?G==="notebook":q,_e=te!==3||ae==="chat",De=()=>{te===1?$(Y=>!Y):te===2?Ee(Y=>Y==="rail"?"notebook":"rail"):ie(Y=>Y==="rail"?"chat":"rail")},le=()=>{te===1?se(Y=>!Y):te===2?Ee(Y=>Y==="notebook"?"rail":"notebook"):ie(Y=>Y==="notebook"?"chat":"notebook")},Me=v.useRef(null),Be=Y=>{var me,Ce;if(te!==3)return;const oe=Y.touches[0];Me.current={x:oe.clientX,y:oe.clientY,multi:Y.touches.length>1,noswipe:!!((Ce=(me=Y.target).closest)!=null&&Ce.call(me,"[data-noswipe]"))}},Ue=Y=>{const oe=Me.current;if(Me.current=null,!oe||oe.multi||oe.noswipe||te!==3)return;const me=Y.changedTouches[0],Ce=y5(ke.current,me.clientX-oe.x,me.clientY-oe.y);Ce&&ie(Ce)},[ze,Re]=v.useState(!1),[ge,J]=v.useState(null),[ce,xe]=v.useState([]),fe=f5(f,L),ye=Uf(),re=u5(fe.activeId,ye);v.useEffect(()=>{Hx(re.streaming)},[re.streaming]);const[be,Ie]=v.useState(""),V=v.useCallback(Y=>{Ie(Y)},[]),we=v.useCallback((Y,oe,me)=>{if(Y.type==="content"){if(Z("content"),me){const Ce=$e=>{document.querySelector(`mark[data-note-id="${me}"]`)?window.dispatchEvent(new CustomEvent("lookatstudy-jump-to-note",{detail:me})):$e>0&&setTimeout(()=>Ce($e-1),150)};setTimeout(()=>Ce(10),100)}}else if(Y.threadId!==fe.activeId&&fe.setActiveId(Y.threadId),me){const Ce=$e=>{document.querySelector(`mark[data-note-id="${me}"]`)?window.dispatchEvent(new CustomEvent("lookatstudy-jump-to-chat-note",{detail:me})):$e>0&&setTimeout(()=>Ce($e-1),150)};setTimeout(()=>Ce(10),120)}},[fe]),[je,Je]=v.useState(null);v.useEffect(()=>{if(!L){Je(null);return}let Y=!1;return K.getNodeSummary(L,ye).then(oe=>{Y||Je(oe)}).catch(()=>{Y||Je(null)}),()=>{Y=!0}},[L,ye]);const Pe=v.useMemo(()=>r.find(Y=>Y.id===L)??null,[r,L]),kn=v.useMemo(()=>ce.map(Y=>({...Y,label:e(`starter.${Y.key}.label`),hint:e(`starter.${Y.key}.hint`),message:e(`starter.${Y.key}.message`,{title:(Pe==null?void 0:Pe.title)??""})})),[ce,Pe,e]),gt=v.useRef(null),_r=v.useCallback(()=>{var Y;Pe&&((Y=gt.current)==null||Y.call(gt,e("chat.action.startLearningPrompt",{title:Pe.title}),e("chat.action.startLearning",{title:Pe.title})))},[Pe,e]),Xe=v.useCallback(async()=>{try{const[Y,oe,me,Ce,$e,Et]=await Promise.all([K.listCourses(),K.getStreak(),K.listSouls(),K.getActiveSoul(),K.getXpStatus(),K.getDueReviews()]);n(Y),l(oe),E(me),h($e),_(Ce),O(new Set(Et)),f&&!Y.some(px=>px.id===f)&&(m(null),I(null),i([]),a({}),R(null),b([]),w(null))}catch(Y){p(Y instanceof Error?Y.message:String(Y))}},[f]);v.useEffect(()=>{Xe()},[Xe]);const Tn=v.useCallback(async()=>{try{J(await K.isAgentReady())}catch{J({ready:!1,missing:e("error.checkReadyFailed")})}},[e]);v.useEffect(()=>{Tn();const Y=()=>Tn();return window.addEventListener("llm-config-changed",Y),()=>window.removeEventListener("llm-config-changed",Y)},[Tn]);const wn=v.useRef(0),Xn=v.useRef(0);v.useEffect(()=>{wn.current=(c==null?void 0:c.todayXp)??0},[c]),v.useEffect(()=>{Xn.current=(o==null?void 0:o.currentStreak)??0},[o]);const ln=v.useCallback(async()=>{const Y=r.filter(Ce=>Ce.type==="lesson"||Ce.type==="exam"),oe=await Promise.all(Y.map(async Ce=>{const $e=await K.getProgress(Ce.id);return[Ce.id,$e]})),me={};for(const[Ce,$e]of oe)$e&&(me[Ce]=$e);a(me)},[r]);v.useEffect(()=>K.on("state:changed",oe=>{oe==="xp"?K.getXpStatus().then(me=>{h(me),wn.current<100&&me.todayXp>=100&&jn("energy-full")}).catch(()=>{}):oe==="streak"?K.getStreak().then(me=>{l(me),me.currentStreak>Xn.current&&jn("streak")}).catch(()=>{}):oe==="mastery"&&(jn("mastery"),Xe(),ln())}),[Xe,ln]),v.useEffect(()=>{f&&(K.getCourseLanguages(f).then(b).catch(()=>b([])),K.getCourseLanguage(f).then(w).catch(()=>w(null)))},[f]),v.useEffect(()=>{f&&(K.getCourseTree(f,T??void 0).then(async Y=>{i(Y);const oe=Y.filter($e=>$e.type==="lesson"||$e.type==="exam"),me=await Promise.all(oe.map(async $e=>{const Et=await K.getProgress($e.id);return[$e.id,Et]})),Ce={};for(const[$e,Et]of me)Et&&(Ce[$e]=Et);a(Ce)}).catch(g),K.getDashboard(f).then(R).catch(g))},[f,T,g]),v.useEffect(()=>{if(!L){xe([]);return}K.getStarterPrompts(L).then(xe).catch(()=>xe([]))},[L]),v.useEffect(()=>{const Y=oe=>{if(oe.key==="Escape"&&fe.activeId&&(K.abortAgentChatThread(fe.activeId).catch(()=>{}),P(!1),Re(!1)),(oe.ctrlKey||oe.metaKey)&&oe.key==="k"&&(oe.preventDefault(),Re(me=>!me)),(oe.ctrlKey||oe.metaKey)&&oe.key==="b"&&(oe.preventDefault(),De()),(oe.ctrlKey||oe.metaKey)&&oe.key==="Tab"){if(oe.preventDefault(),j.current.active)return;const me=fe.threads;if(me.length>1){const Ce=me.findIndex(Et=>Et.id===fe.activeId),$e=oe.shiftKey?(Ce-1+me.length)%me.length:(Ce+1)%me.length;fe.setActiveId(me[$e].id)}}(!oe.target||!oe.target.matches("input, textarea, select"))&&(oe.key==="1"&&N("map"),oe.key==="2"&&N("import"),oe.key==="s"&&(oe.ctrlKey||oe.metaKey)&&(oe.preventDefault(),P(!0)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[L]);const ht=v.useCallback(async Y=>{var oe;try{if(Y.type==="exam"){I(Y.id),Z("content");return}if(((oe=s[Y.id])==null?void 0:oe.status)==="locked"){I(null);return}await K.markNodeAttempted(Y.id);const me=await K.getStreak();await ln(),l(me),I(Y.id),Z("content"),xa(!1)}catch(me){g(me)}},[s,ln,g]),cn=v.useCallback(Y=>{if(j.current.active){U({open:!0,pendingAction:Y});return}Y()},[]),ha=v.useCallback(Y=>{if(j.current.active&&Y.id!==L){U({open:!0,pendingAction:()=>void ht(Y)});return}ht(Y)},[ht,L]),sx=v.useCallback(Y=>{j.current=Y},[]),ix=v.useCallback(async()=>{const Y=F.pendingAction;U({open:!1,pendingAction:null});const oe=j.current;if(j.current={active:!1,terminate:null},oe.active&&oe.terminate)try{await oe.terminate()}catch{}Y==null||Y()},[F.pendingAction]);vr(W,F.open),v.useEffect(()=>{if(!F.open)return;const Y=oe=>{oe.key==="Escape"&&U({open:!1,pendingAction:null})};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[F.open]);const ax=async Y=>{try{await K.setActiveSoul(Y),_(Y)}catch(oe){g(oe)}},ox=v.useCallback(async(Y,oe,me)=>{try{await K.applyProposal(Y),re.markProposalStatus(oe,me,!0)}catch(Ce){g(Ce)}},[re,g]),lx=v.useCallback(async(Y,oe,me)=>{try{await K.rejectProposal(Y),re.markProposalStatus(oe,me,!1)}catch(Ce){g(Ce)}},[re,g]),fa=t.find(Y=>Y.id===f),Hc=v.useMemo(()=>{const Y=new Set(r.map(oe=>oe.id));return new Set([...M].filter(oe=>Y.has(oe)))},[M,r]),Ps=Hc.size,cx=v.useMemo(()=>r.filter(Y=>Y.type==="section").sort((Y,oe)=>Y.orderIdx-oe.orderIdx),[r]),ux=v.useMemo(()=>{const Y=yf.map(me=>A.find(Ce=>Ce.name===me)).filter(me=>!!me),oe=A.filter(me=>!yf.includes(me.name));return[...Y,...oe]},[A]),vt=GA(f),Uc=XA(),rt=dc();v.useEffect(()=>K.on("exam:status",oe=>{if(oe.status!=="ready"||oe.nodeId===L)return;const me=r.find(Ce=>Ce.id===oe.nodeId);me&&rt.show(e("exam.ready.toast",{title:me.title}),{duration:4e3})}),[L,r,rt,e]);const dx=v.useCallback(async Y=>{const oe=t.find(me=>me.id===Y);try{await K.deleteCourse(Y),rt.show(e("import.deleted",{title:(oe==null?void 0:oe.title)??Y}),{duration:3e3}),Xe()}catch(me){g(me)}},[t,Xe,g,rt,e]),ma=v.useCallback(async(Y,oe,me)=>{if(!Y.trim()||re.streaming)return;if(!fe.activeId){const $e=await fe.ensureThreadForSend(Y,oe);if($e){re.send(Y,$e,oe,me);return}rt.show(e("toast.threadCreateFailed"));return}const Ce=fe.activeThread;Ce&&!Ce.title&&fe.update(Ce.id,{title:(oe??Y).trim()}),re.send(Y,void 0,oe,me)},[re,fe,rt,e]),zc=v.useRef(re.streaming);zc.current=re.streaming;const hx=v.useCallback(Y=>{const oe=h5(Y,e),me=d5(Y,e),Ce=$e=>{var Et;if(!zc.current){(Et=gt.current)==null||Et.call(gt,oe,me);return}$e>0&&setTimeout(()=>Ce($e-1),2e3)};Ce(10)},[e]);gt.current=ma;const Vc=new Set(["concept_map","diagram","compare_table","code_walkthrough"]),Ir=v.useMemo(()=>{const Y=Vd(re.messages).filter(me=>{var Ce;return Vc.has(((Ce=me.output)==null?void 0:Ce.artifactType)??"")});if(Y.length)return Y[Y.length-1];const oe=vt.items.filter(me=>Vc.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 oe.length?oe[oe.length-1]:null},[re.messages,vt.items]),$c=v.useRef(new Set);v.useEffect(()=>{!Ir||$c.current.has(Ir.id)||($c.current.add(Ir.id),re.streaming&&Z("board"))},[Ir,re.streaming]);const fx=v.useMemo(()=>re.messages.reduce((Y,oe)=>Y+oe.parts.reduce((me,Ce)=>Ce.type==="text"?me+jf(Ce.text):me,0),0),[re.messages]),qc=v.useRef(!1);v.useEffect(()=>{Ps>0&&!qc.current&&(qc.current=!0,rt.show(e("review.nudge",{n:Ps}),{duration:4e3}))},[Ps,rt,e]);const Wc=v.useMemo(()=>Vd(re.messages),[re.messages]),Yc=v.useRef(new Set);v.useEffect(()=>{for(const Y of Wc){const oe=Y.output;if(!oe||!oe.artifactType)continue;const me=`${oe.artifactType}:${JSON.stringify(oe)}`;Yc.current.has(me)||(Yc.current.add(me),vt.save({nodeId:L,artifactType:oe.artifactType,title:oe.title??null,data:oe}),rt.show(e("toast.artifactSaved"),{duration:3e3}))}},[Wc,vt,L,rt,e]),v.useEffect(()=>{k!=="map"&&Z(null)},[k]);const[mx,pa]=v.useState(!1),[ga,xa]=v.useState(!1),Gc=(Pe==null?void 0:Pe.type)==="exam";return v.useEffect(()=>{Gc&&window.dispatchEvent(new CustomEvent("companion-exam-enter"))},[Gc]),v.useEffect(()=>{Ux(ga)},[ga]),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(AM,{streak:o,xp:c,fontSize:Uc.size,onFontBump:Uc.bump,onOpenSettings:()=>P(!0),leftVisible:Se,rightVisible:Ve,onToggleLeft:De,onToggleRight:le,tier:te,bottomBar:te===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:Dl,label:e("pane.map"),testid:"t3-btn-rail"},{k:"chat",icon:p1,label:e("pane.chat"),testid:"t3-btn-chat"},{k:"notebook",icon:E1,label:e("pane.notes"),testid:"t3-btn-notebook"}].map(({k:Y,icon:oe,label:me,testid:Ce})=>u.jsx("button",{role:"tab","aria-selected":ae===Y,"aria-label":me,"data-testid":Ce,"data-tooltip":me,onClick:()=>ie(Y),className:`w-8 h-7 flex items-center justify-center rounded-md transition-colors ${ae===Y?"bg-brand/20 text-brand":"text-ink-muted active:bg-ink/10"}`,children:u.jsx(oe,{className:"w-4 h-4"})},Y))}):void 0}),d&&u.jsx(IM,{message:d,onClose:()=>p(null)}),u.jsxs("div",{className:"flex-1 flex min-h-0 min-w-0",onTouchStart:Be,onTouchEnd:Ue,children:[Se&&u.jsx(Ub,{fullWidth:te===3,view:k,onViewChange:N,courseTitle:(fa==null?void 0:fa.title)??null,courseId:f,courses:t,sections:cx,tree:r,progressMap:s,selectedNodeId:L,dueCount:Ps,dueNodeIds:Hc,overallMastery:(C==null?void 0:C.overallMastery)??0,streak:(o==null?void 0:o.currentStreak)??0,streaming:re.streaming,onJumpNode:Y=>{if(re.streaming)return;const oe=r.find(me=>me.id===Y);oe&&ha(oe),te===3&&ie("chat")},onOpenReview:()=>pa(!0),onSelectCourse:Y=>cn(()=>{m(Y),Xe()}),onDeleteCourse:Y=>cn(()=>{dx(Y)}),onCoursesChanged:()=>{Xe()},availableLanguages:x,currentLocale:T,onLocaleChange:async Y=>{f&&(await K.setCourseLanguage(f,Y),w(Y))}}),u.jsxs(u.Fragment,{children:[_e&&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:te===3?{flex:1}:Ve?{width:"clamp(480px, 36vw, 800px)"}:{flex:1},"data-testid":"chat-panel",children:f?(Pe==null?void 0:Pe.type)==="exam"?u.jsx(YN,{examNode:Pe,locale:ye,onSessionChange:sx,paused:F.open,onExamCompleted:()=>{K.getProgress(Pe.id).then(Y=>{Y&&a(oe=>({...oe,[Pe.id]:Y}))})}}):u.jsxs(u.Fragment,{children:[u.jsx(m5,{threads:fe.threads,activeThread:fe.activeThread,focusNodeTitle:(Pe==null?void 0:Pe.title)??null,onPickThread:Y=>{re.streaming||fe.setActiveId(Y)},onCreate:()=>{re.streaming||(fe.create({title:null}),rt.show(e("toast.threadCreated")))},onRename:(Y,oe)=>{fe.update(Y,{title:oe}),rt.show(e("toast.threadRenamed"))},onArchive:Y=>{fe.update(Y,{status:"archived"}),rt.show(e("toast.threadArchived"),{duration:5e3,action:{label:e("action.undo"),onClick:()=>fe.update(Y,{status:"active"})}})},onDelete:Y=>{const oe=fe.removeWithUndo(Y);oe&&(rt.show(`${e("toast.threadDeleted")}${oe.title?`「${oe.title}」`:""}`,{duration:5e3,action:{label:e("action.undo"),onClick:()=>{fe.restore(oe),rt.show(e("toast.restored"))}}}),setTimeout(()=>{K.threadDelete(oe.id).catch(()=>{})},5500))}}),u.jsx(eN,{messages:re.messages,streaming:re.streaming,onApplyProposal:ox,onRejectProposal:lx,summary:je,onStartLearning:ge!=null&&ge.ready?_r:void 0,agentReady:(ge==null?void 0:ge.ready)??!1,onGotoSettings:()=>P(!0),hasNode:!!Pe,selectedNodeId:L,threadId:fe.activeId,onPickQuizAction:Y=>{ma(Y)},onQuizCompleted:hx,cardMode:te===3,chatNotes:vt.items.filter(Y=>Y.artifactType==="user_note"&&Y.sourceAnchor),onSaveChatNote:(Y,oe,me,Ce)=>{!Pe||!fe.activeId||(vt.saveUserNote({nodeId:Pe.id,text:Y,sourceType:"chat",sourceAnchor:{type:"chat",threadId:fe.activeId,msgId:oe,startOffset:me,endOffset:Ce}}),rt.show(e("toast.noteSaved"),{duration:2e3}))}}),u.jsx(CN,{nodeId:L,agentReady:(ge==null?void 0:ge.ready)??!1,streaming:re.streaming,souls:ux,activeSoul:S,starterPrompts:re.messages.length>0?kn:[],onPickSoul:ax,onSend:ma,onStop:re.stop,onLogFriction:L?(Y,oe)=>{K.logFriction(L,Y,oe),rt.show(e("chat.friction.saved"),{duration:2500})}:void 0,onGotoSettings:()=>P(!0),insertText:be,historyTokens:fx})]}):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")})]})})}),Ve&&u.jsx("main",{className:te===3?"flex-1 min-w-0 bg-surface-2":"flex-1 min-w-[440px] bg-surface-2","data-testid":te===3?"notebook-pane-full":void 0,children:u.jsx(VA,{selectedNode:Pe,items:vt.items,loading:vt.loading,forceTab:D,canvasArtifact:Ir,onUserTabChange:()=>Z(null),onRemove:Y=>{vt.remove(Y),rt.show(e("toast.noteDeleted"))},onTogglePin:Y=>{vt.togglePin(Y)},onRecordQuizResult:(Y,oe)=>{vt.recordQuizResult(Y,oe)},onUpdateNoteComment:(Y,oe)=>{vt.updateUserNoteComment(Y,oe)},onSaveContentNote:(Y,oe)=>{Pe&&(vt.saveUserNote({nodeId:Pe.id,text:Y,sourceType:"content",sourceAnchor:oe}),rt.show(e("toast.noteSaved"),{duration:2e3}))},onJumpToSource:we,onQuoteToChat:V,locale:T,isReviewing:ga,onReviewDone:()=>xa(!1)})})]})]}),ee&&u.jsx(NM,{onClose:()=>P(!1)}),mx&&u.jsx(_M,{onClose:()=>pa(!1),tree:r,dashboard:C,progressMap:s,onPickNode:Y=>{cn(()=>{I(Y),Z("content"),pa(!1),xa(!0)})}}),F.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(an,{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:()=>U({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 ix(),"data-testid":"exam-leave-confirm",children:e("exam.leave.confirm")})]})]})}),ze&&u.jsx(XN,{onClose:()=>Re(!1),onPick:Y=>{Re(!1),CM(Y)},hasNode:!!L}),u.jsx(Jb,{}),u.jsx(wM,{}),u.jsx(UN,{courseId:f})]})}function CM(e){window.dispatchEvent(new CustomEvent("lookatstudy-command",{detail:e}))}function AM({streak:e,xp:t,fontSize:n,onFontBump:r,onOpenSettings:i,leftVisible:s,rightVisible:a,onToggleLeft:o,onToggleRight:l,tier:c,bottomBar:h}){const f=Ne();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(Po,{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(Ei,{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(b1,{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(y1,{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(Po,{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(MM,{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(Ei,{className:"w-4 h-4"})})]})]})})}function NM({onClose:e}){const t=Ne(),n=v.useRef(null);return vr(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(ZN,{})})]})]})}function _M({onClose:e,tree:t,onPickNode:n,dashboard:r,progressMap:i}){const s=Ne(),a=v.useRef(null);vr(a,!0);const[o,l]=v.useState([]);v.useEffect(()=>{K.getAllSrsItems().then(w=>l(w)).catch(()=>l([]))},[]);const c=v.useMemo(()=>new Map(o.map(w=>[w.nodeId,w])),[o]),h=v.useMemo(()=>{const w=new Map(t.map(E=>[E.id,E])),A=o.filter(E=>w.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,S)=>E.orderIdx-S.orderIdx)})),[t]),m=v.useMemo(()=>{const w=new Map;for(const A of(r==null?void 0:r.sections)??[])w.set(A.sectionId,A.avgMastery);return w},[r]),d=v.useMemo(()=>t.filter(w=>{var E;const A=(E=i[w.id])==null?void 0:E.status;return w.type==="lesson"&&(w.world??"study")==="study"&&(A==="in_progress"||A==="mastered")}),[t,i]),[p,g]=v.useState(new Set),x=w=>g(A=>{const E=new Set(A);return E.has(w)?E.delete(w):E.add(w),E}),b=w=>{const A=c.get(w);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},T=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(Kt,{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 w=d[Math.floor(Math.random()*d.length)];w&&n(w.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(_1,{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(w=>w.items.length>0).map(w=>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 ${w.dot}`}),u.jsx("span",{className:"text-label text-ink-muted",children:w.label}),u.jsx("span",{className:"text-label font-extrabold text-ink-strong tabular-nums",children:w.items.length})]},w.label))}),T&&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(w=>{const A=t.find(E=>E.id===w.nodeId);return A?u.jsx("button",{onClick:()=>n(w.nodeId),"data-testid":`review-overdue-${w.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},w.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:w,lessons:A})=>{const E=Math.round((m.get(w.id)??0)*100),S=p.has(w.id),_=A.filter(k=>{var C;const N=(C=i[k.id])==null?void 0:C.status;return N==="in_progress"||N==="mastered"});return u.jsxs("div",{children:[u.jsxs("button",{onClick:()=>x(w.id),className:"w-full flex items-center gap-2 p-2 rounded-lg hover:bg-surface-3 transition-colors",children:[S?u.jsx(Ll,{className:"w-3.5 h-3.5 text-ink-muted shrink-0"}):u.jsx(Zx,{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:w.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,"%"]})]})]}),S&&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(k=>{const N=i[k.id],C=N?Math.round((N.mastery??0)*100):null,R=b(k.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:k.title}),C!==null&&u.jsxs("span",{className:"text-label tabular-nums text-ink-muted shrink-0 w-8 text-right",children:[C,"%"]}),M&&u.jsx("button",{onClick:()=>n(k.id),"data-testid":`review-lesson-${k.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")})]},k.id)})})]},w.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(w=>u.jsxs("button",{onClick:()=>n(w.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:[w.count,"×"]}),u.jsx("span",{className:"text-label text-ink-strong truncate flex-1",children:w.title})]},w.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 IM({message:e,onClose:t}){const n=Ne();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 MM({streak:e}){const t=Ne();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(If,{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(N1,{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 RM({rejected:e}){const t=navigator.language.startsWith("zh"),[n,r]=Rl.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&&yi(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 rx=zx.createRoot(document.getElementById("root"));function LM(){rx.render(u.jsx(Rl.StrictMode,{children:u.jsx(FA,{children:u.jsx(SM,{})})}))}function vf(e){rx.render(u.jsx(Rl.StrictMode,{children:u.jsx(RM,{rejected:e})}))}async function PM(){const{installAppHeight:e}=await yi(async()=>{const{installAppHeight:t}=await import("./app-height-D5bf5z0g.js");return{installAppHeight:t}},[],import.meta.url);if(e(),!window.api){const t=await yi(()=>import("./api-web-DI50TDfG.js"),[],import.meta.url);if(window.addEventListener(t.TOKEN_REJECTED_EVENT,()=>vf(!0)),!t.hasWebToken()){vf(!1);return}try{await t.installWebApi()}catch(n){console.error("[boot] web api 安装失败:",n)}}LM()}PM();export{yi as _};
|