colonynote 1.0.0-beta.12 → 1.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/bin/colonynote.js +1 -2
  2. package/dist/client/assets/{_baseUniq-T-svP185.js → _baseUniq-9Pn_qMNx.js} +1 -1
  3. package/dist/client/assets/{arc-DPGp6UO-.js → arc-CwgOuPiQ.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-Q4EWVU46-BjON9QCG.js → architectureDiagram-Q4EWVU46-DH8zBsFD.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-DXYQGD6D-BLoDfE0P.js → blockDiagram-DXYQGD6D-Rinexrq-.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AHTNJAMY-fQ1soS6G.js → c4Diagram-AHTNJAMY-DUJE4tY8.js} +1 -1
  7. package/dist/client/assets/channel-BJqbnDhj.js +1 -0
  8. package/dist/client/assets/{chunk-4BX2VUAB-BQI2dXlO.js → chunk-4BX2VUAB-CVubEDEM.js} +1 -1
  9. package/dist/client/assets/{chunk-4TB4RGXK-B0FuCAMO.js → chunk-4TB4RGXK-GtceFh5R.js} +1 -1
  10. package/dist/client/assets/{chunk-55IACEB6-SbmoW08H.js → chunk-55IACEB6-BvQuQjO3.js} +1 -1
  11. package/dist/client/assets/{chunk-EDXVE4YY-BTkJGdcb.js → chunk-EDXVE4YY-DwTEXUMb.js} +1 -1
  12. package/dist/client/assets/{chunk-FMBD7UC4-2RG66CzU.js → chunk-FMBD7UC4-CP_VCEId.js} +1 -1
  13. package/dist/client/assets/{chunk-OYMX7WX6-B7irjINX.js → chunk-OYMX7WX6-DekTZ61_.js} +1 -1
  14. package/dist/client/assets/{chunk-QZHKN3VN-rsXCL0TK.js → chunk-QZHKN3VN-DaQazFvi.js} +1 -1
  15. package/dist/client/assets/{chunk-YZCP3GAM-ArKVHPRF.js → chunk-YZCP3GAM-DkNfaXLf.js} +1 -1
  16. package/dist/client/assets/classDiagram-6PBFFD2Q-DvENVsHG.js +1 -0
  17. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DvENVsHG.js +1 -0
  18. package/dist/client/assets/clone-Ge_jPAPG.js +1 -0
  19. package/dist/client/assets/{cose-bilkent-S5V4N54A-DVBMSGze.js → cose-bilkent-S5V4N54A-Db3Okii7.js} +1 -1
  20. package/dist/client/assets/{dagre-KV5264BT-COm1avIi.js → dagre-KV5264BT-CWRMd3SH.js} +1 -1
  21. package/dist/client/assets/{diagram-5BDNPKRD-BHzIKztM.js → diagram-5BDNPKRD-8TiBcRv9.js} +1 -1
  22. package/dist/client/assets/{diagram-G4DWMVQ6-D1JhDGDX.js → diagram-G4DWMVQ6-Djb_aFKY.js} +1 -1
  23. package/dist/client/assets/{diagram-MMDJMWI5-q28BYReU.js → diagram-MMDJMWI5-DhCslint.js} +1 -1
  24. package/dist/client/assets/{diagram-TYMM5635-BoK9AqHX.js → diagram-TYMM5635-DhePsl7z.js} +1 -1
  25. package/dist/client/assets/{erDiagram-SMLLAGMA-ogyu4HEv.js → erDiagram-SMLLAGMA-COaIktX_.js} +1 -1
  26. package/dist/client/assets/{flowDiagram-DWJPFMVM-DAdHTFWv.js → flowDiagram-DWJPFMVM-BiDAMluS.js} +1 -1
  27. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-DrS8W1v-.js → ganttDiagram-T4ZO3ILL-Dl4AW2On.js} +1 -1
  28. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-DtK9J5bd.js → gitGraphDiagram-UUTBAWPF-Dohcub9p.js} +1 -1
  29. package/dist/client/assets/{graph-BO_7TUSR.js → graph-C0KifbR6.js} +1 -1
  30. package/dist/client/assets/{index-BE_qBo7x.js → index-Dl1nQm2g.js} +8 -8
  31. package/dist/client/assets/index-G934YbUs.css +1 -0
  32. package/dist/client/assets/{infoDiagram-42DDH7IO-C-F87kp2.js → infoDiagram-42DDH7IO-BZjLv6IH.js} +1 -1
  33. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DpaZPVt0.js → ishikawaDiagram-UXIWVN3A-rnfc72_m.js} +1 -1
  34. package/dist/client/assets/{journeyDiagram-VCZTEJTY-DLdy6qU_.js → journeyDiagram-VCZTEJTY-DcW9mUFI.js} +1 -1
  35. package/dist/client/assets/{kanban-definition-6JOO6SKY-Cw72R2rP.js → kanban-definition-6JOO6SKY-BgEOJRmr.js} +1 -1
  36. package/dist/client/assets/{layout-CVdqBmBb.js → layout-BQJpJX3E.js} +1 -1
  37. package/dist/client/assets/{linear-BZWegF8q.js → linear-4R4_f67K.js} +1 -1
  38. package/dist/client/assets/{min-Bc431PrS.js → min-B78pX87t.js} +1 -1
  39. package/dist/client/assets/{mindmap-definition-QFDTVHPH-DPQMmeL4.js → mindmap-definition-QFDTVHPH-C34BXoiK.js} +1 -1
  40. package/dist/client/assets/{pieDiagram-DEJITSTG-QjO816qL.js → pieDiagram-DEJITSTG-ijiNKQ8e.js} +1 -1
  41. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-BDxYyK8x.js → quadrantDiagram-34T5L4WZ-CZtSib2Y.js} +1 -1
  42. package/dist/client/assets/{requirementDiagram-MS252O5E-CTRbkAm3.js → requirementDiagram-MS252O5E-BN-J-8AJ.js} +1 -1
  43. package/dist/client/assets/{sankeyDiagram-XADWPNL6-s1VkzWAg.js → sankeyDiagram-XADWPNL6-CWP-qBhv.js} +1 -1
  44. package/dist/client/assets/{sequenceDiagram-FGHM5R23-UyatbRZw.js → sequenceDiagram-FGHM5R23-BnJnhdS6.js} +1 -1
  45. package/dist/client/assets/{stateDiagram-FHFEXIEX-ClKORA1p.js → stateDiagram-FHFEXIEX-DN4fDIGN.js} +1 -1
  46. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-D6Qg_ItE.js +1 -0
  47. package/dist/client/assets/{timeline-definition-GMOUNBTQ-BaJ6GkFx.js → timeline-definition-GMOUNBTQ-Ds6_LT-T.js} +1 -1
  48. package/dist/client/assets/{vennDiagram-DHZGUBPP-C2I2hokK.js → vennDiagram-DHZGUBPP-BrbuTJAI.js} +1 -1
  49. package/dist/client/assets/{wardley-RL74JXVD-BaYnW9zG.js → wardley-RL74JXVD-BsQbbPRZ.js} +1 -1
  50. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-lI3b3rv0.js → wardleyDiagram-NUSXRM2D-BH6aFYai.js} +1 -1
  51. package/dist/client/assets/{xychartDiagram-5P7HB3ND-gAPYB-k3.js → xychartDiagram-5P7HB3ND-BwK9W_yy.js} +1 -1
  52. package/dist/client/index.html +2 -2
  53. package/package.json +1 -1
  54. package/dist/client/assets/channel-MqQDOUgw.js +0 -1
  55. package/dist/client/assets/classDiagram-6PBFFD2Q-CZdm6ATq.js +0 -1
  56. package/dist/client/assets/classDiagram-v2-HSJHXN6E-CZdm6ATq.js +0 -1
  57. package/dist/client/assets/clone-CxH2cmrL.js +0 -1
  58. package/dist/client/assets/index-DpiDy0Bm.css +0 -1
  59. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Cf33alPP.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-KV5264BT-COm1avIi.js","assets/graph-BO_7TUSR.js","assets/_baseUniq-T-svP185.js","assets/layout-CVdqBmBb.js","assets/min-Bc431PrS.js","assets/clone-CxH2cmrL.js","assets/cose-bilkent-S5V4N54A-DVBMSGze.js","assets/cytoscape.esm-DxGcaOPV.js","assets/c4Diagram-AHTNJAMY-fQ1soS6G.js","assets/chunk-YZCP3GAM-ArKVHPRF.js","assets/flowDiagram-DWJPFMVM-DAdHTFWv.js","assets/chunk-FMBD7UC4-2RG66CzU.js","assets/chunk-55IACEB6-SbmoW08H.js","assets/chunk-EDXVE4YY-BTkJGdcb.js","assets/channel-MqQDOUgw.js","assets/erDiagram-SMLLAGMA-ogyu4HEv.js","assets/gitGraphDiagram-UUTBAWPF-DtK9J5bd.js","assets/chunk-4BX2VUAB-BQI2dXlO.js","assets/chunk-QZHKN3VN-rsXCL0TK.js","assets/wardley-RL74JXVD-BaYnW9zG.js","assets/ganttDiagram-T4ZO3ILL-DrS8W1v-.js","assets/linear-BZWegF8q.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-C-F87kp2.js","assets/pieDiagram-DEJITSTG-QjO816qL.js","assets/arc-DPGp6UO-.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-34T5L4WZ-BDxYyK8x.js","assets/xychartDiagram-5P7HB3ND-gAPYB-k3.js","assets/requirementDiagram-MS252O5E-CTRbkAm3.js","assets/sequenceDiagram-FGHM5R23-UyatbRZw.js","assets/classDiagram-6PBFFD2Q-CZdm6ATq.js","assets/chunk-4TB4RGXK-B0FuCAMO.js","assets/classDiagram-v2-HSJHXN6E-CZdm6ATq.js","assets/stateDiagram-FHFEXIEX-ClKORA1p.js","assets/chunk-OYMX7WX6-B7irjINX.js","assets/stateDiagram-v2-QKLJ7IA2-Cf33alPP.js","assets/journeyDiagram-VCZTEJTY-DLdy6qU_.js","assets/timeline-definition-GMOUNBTQ-BaJ6GkFx.js","assets/mindmap-definition-QFDTVHPH-DPQMmeL4.js","assets/kanban-definition-6JOO6SKY-Cw72R2rP.js","assets/sankeyDiagram-XADWPNL6-s1VkzWAg.js","assets/diagram-TYMM5635-BoK9AqHX.js","assets/diagram-MMDJMWI5-q28BYReU.js","assets/blockDiagram-DXYQGD6D-BLoDfE0P.js","assets/diagram-5BDNPKRD-BHzIKztM.js","assets/architectureDiagram-Q4EWVU46-BjON9QCG.js","assets/diagram-G4DWMVQ6-D1JhDGDX.js","assets/wardleyDiagram-NUSXRM2D-lI3b3rv0.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-KV5264BT-CWRMd3SH.js","assets/graph-C0KifbR6.js","assets/_baseUniq-9Pn_qMNx.js","assets/layout-BQJpJX3E.js","assets/min-B78pX87t.js","assets/clone-Ge_jPAPG.js","assets/cose-bilkent-S5V4N54A-Db3Okii7.js","assets/cytoscape.esm-DxGcaOPV.js","assets/c4Diagram-AHTNJAMY-DUJE4tY8.js","assets/chunk-YZCP3GAM-DkNfaXLf.js","assets/flowDiagram-DWJPFMVM-BiDAMluS.js","assets/chunk-FMBD7UC4-CP_VCEId.js","assets/chunk-55IACEB6-BvQuQjO3.js","assets/chunk-EDXVE4YY-DwTEXUMb.js","assets/channel-BJqbnDhj.js","assets/erDiagram-SMLLAGMA-COaIktX_.js","assets/gitGraphDiagram-UUTBAWPF-Dohcub9p.js","assets/chunk-4BX2VUAB-CVubEDEM.js","assets/chunk-QZHKN3VN-DaQazFvi.js","assets/wardley-RL74JXVD-BsQbbPRZ.js","assets/ganttDiagram-T4ZO3ILL-Dl4AW2On.js","assets/linear-4R4_f67K.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-BZjLv6IH.js","assets/pieDiagram-DEJITSTG-ijiNKQ8e.js","assets/arc-CwgOuPiQ.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-34T5L4WZ-CZtSib2Y.js","assets/xychartDiagram-5P7HB3ND-BwK9W_yy.js","assets/requirementDiagram-MS252O5E-BN-J-8AJ.js","assets/sequenceDiagram-FGHM5R23-BnJnhdS6.js","assets/classDiagram-6PBFFD2Q-DvENVsHG.js","assets/chunk-4TB4RGXK-GtceFh5R.js","assets/classDiagram-v2-HSJHXN6E-DvENVsHG.js","assets/stateDiagram-FHFEXIEX-DN4fDIGN.js","assets/chunk-OYMX7WX6-DekTZ61_.js","assets/stateDiagram-v2-QKLJ7IA2-D6Qg_ItE.js","assets/journeyDiagram-VCZTEJTY-DcW9mUFI.js","assets/timeline-definition-GMOUNBTQ-Ds6_LT-T.js","assets/mindmap-definition-QFDTVHPH-C34BXoiK.js","assets/kanban-definition-6JOO6SKY-BgEOJRmr.js","assets/sankeyDiagram-XADWPNL6-CWP-qBhv.js","assets/diagram-TYMM5635-DhePsl7z.js","assets/diagram-MMDJMWI5-DhCslint.js","assets/blockDiagram-DXYQGD6D-Rinexrq-.js","assets/diagram-5BDNPKRD-8TiBcRv9.js","assets/architectureDiagram-Q4EWVU46-DH8zBsFD.js","assets/diagram-G4DWMVQ6-Djb_aFKY.js","assets/wardleyDiagram-NUSXRM2D-BH6aFYai.js"])))=>i.map(i=>d[i]);
2
2
  var $z=Object.defineProperty;var zz=(t,e,r)=>e in t?$z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Kt=(t,e,r)=>zz(t,typeof e!="symbol"?e+"":e,r);function jz(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function dh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Qxe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var tx={exports:{}},ed={},rx={exports:{}},Tt={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -218,7 +218,7 @@ Error generating stack: `+A.message+`
218
218
  *
219
219
  * This source code is licensed under the ISC license.
220
220
  * See the LICENSE file in the root directory of this source tree.
221
- */const H7=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],W7=Xt("zoom-out",H7);let si=null,UC=new Set,VC="disconnected",GC=new Set;function ox(t){VC=t,GC.forEach(e=>e(t))}function KC(){if((si==null?void 0:si.readyState)===WebSocket.OPEN||(si==null?void 0:si.readyState)===WebSocket.CONNECTING)return;const e=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;ox("connecting");const r=new WebSocket(e);si=r,r.onopen=()=>{ox("connected")},r.onclose=()=>{si=null,ox("disconnected"),setTimeout(()=>KC(),3e3)},r.onerror=()=>{r.close()},r.onmessage=n=>{try{const i=JSON.parse(n.data);UC.forEach(s=>s(i))}catch{}}}function q7(t){const[e,r]=B.useState(VC);B.useEffect(()=>(UC.add(t),GC.add(r),r(VC),(!si||si.readyState!==WebSocket.OPEN&&si.readyState!==WebSocket.CONNECTING)&&KC(),()=>{UC.delete(t),GC.delete(r)}),[t]);const n=B.useCallback(()=>{si&&(si.close(),si=null),KC()},[]);return{status:e,reconnect:n}}function U7(t={}){const[e,r]=B.useState(""),[n,i]=B.useState(null),[s,o]=B.useState("idle"),a=B.useRef(null),l=B.useRef(""),c=B.useRef(null),h=B.useRef(void 0),d=B.useRef(t);d.current=t;const g=B.useCallback(async(C,v)=>{var _,M;h.current=v;try{const L=v?`/api/files${C}?root=${encodeURIComponent(v)}`:`/api/files${C}`,N=await fetch(L);if(!N.ok)throw new Error("Failed to load file");const E=await N.text();r(E),i(C),l.current=E,o("idle")}catch(L){(M=(_=d.current).onError)==null||M.call(_,L instanceof Error?L:new Error("Unknown error"),C)}},[]),p=B.useCallback(async(C,v=n,_)=>{var N,E,O,I,$,j;if(!v)return;const M=_??h.current,L=`${v}:${Date.now()}`;c.current=L,o("saving"),(E=(N=d.current).onSaveStart)==null||E.call(N,v,L);try{const ie=M?`/api/files${v}?root=${encodeURIComponent(M)}`:`/api/files${v}`;if(!(await fetch(ie,{method:"POST",body:C})).ok)throw new Error("Failed to save");o("saved"),l.current=C,(I=(O=d.current).onSave)==null||I.call(O,v)}catch(ie){o("error"),(j=($=d.current).onError)==null||j.call($,ie instanceof Error?ie:new Error("Unknown error"),v)}},[n]),m=B.useCallback((C,v=300)=>{r(C),o("idle"),a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{p(C)},v)},[p]),y=e!==l.current,x=B.useCallback(()=>c.current,[]);return{content:e,path:n,status:s,isDirty:y,load:g,save:p,updateContent:m,setContent:r,setPath:i,getSaveSession:x}}const V7="modulepreload",G7=function(t){return"/"+t},iT={},Bt=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(h=>Promise.resolve(h).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(r.map(c=>{if(c=G7(c),c in iT)return;iT[c]=!0;const h=c.endsWith(".css"),d=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":V7,h||(g.as="script"),g.crossOrigin="",g.href=c,l&&g.setAttribute("nonce",l),document.head.appendChild(g),h)return new Promise((p,m)=>{g.addEventListener("load",p),g.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var We;function cn(t,e,r){const n=typeof r,i=typeof t;if(n!=="undefined"){if(i!=="undefined"){if(r){if(i==="function"&&n===i)return function(a){return t(r(a))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var s=new Map(r);for(var o of t)s.set(o[0],o[1]);return s}if(e===Set){o=new Set(r);for(s of t.values())o.add(s);return o}}}return t}return r}return i==="undefined"?e:t}function Xc(t,e){return typeof t>"u"?e:t}function Br(){return Object.create(null)}function ms(t){return typeof t=="string"}function Jd(t){return typeof t=="object"}function ef(t,e){if(ms(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}const K7=/[^\p{L}\p{N}]+/u,Y7=/(\d{3})/g,X7=/(\D)(\d{3})/g,Z7=/(\d{3})(\D)/g,sT=/[\u0300-\u036f]/g;function tf(t={}){if(!this||this.constructor!==tf)return new tf(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}We=tf.prototype;We.assign=function(t){this.normalize=cn(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let i="";n=!e,e||(i+="\\p{Z}"),r.letter&&(i+="\\p{L}"),r.number&&(i+="\\p{N}",n=!!e),r.symbol&&(i+="\\p{S}"),r.punctuation&&(i+="\\p{P}"),r.control&&(i+="\\p{C}"),(r=r.char)&&(i+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+i+"]+","u")}catch{this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=cn(t.numeric,n)}else{try{this.split=cn(this.split,K7)}catch{this.split=/\s+/}this.numeric=cn(t.numeric,cn(this.numeric,!0))}if(this.prepare=cn(t.prepare,null,this.prepare),this.finalize=cn(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:cn(r&&new Set(r),null,this.filter),this.dedupe=cn(t.dedupe,!0,this.dedupe),this.matcher=cn((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=cn((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=cn((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=cn(t.replacer,null,this.replacer),this.minlength=cn(t.minlength,1,this.minlength),this.maxlength=cn(t.maxlength,1024,this.maxlength),this.rtl=cn(t.rtl,!1,this.rtl),(this.cache=r=cn(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const i of this.matcher.keys())this.h+=(this.h?"|":"")+i;if(this.stemmer)for(const i of this.stemmer.keys())this.A+=(this.A?"|":"")+i;return this};We.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&Xl(this),this};We.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&Xl(this),this};We.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&Xl(this),this)};We.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&Xl(this),this)};We.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&Xl(this),this)};We.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(Xl,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=sT?t.normalize("NFKD").replace(sT,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(X7,"$1 $2").replace(Z7,"$1 $2").replace(Y7,"$1 "));const r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n=[],i=Br(),s,o,a=this.split||this.split===""?t.split(this.split):[t];for(let c=0,h,d;c<a.length;c++)if((h=d=a[c])&&!(h.length<this.minlength||h.length>this.maxlength)){if(e){if(i[h])continue;i[h]=1}else{if(s===h)continue;s=h}if(r)n.push(h);else if(!this.filter||(typeof this.filter=="function"?this.filter(h):!this.filter.has(h))){if(this.cache&&h.length<=this.I)if(this.F){var l=this.D.get(h);if(l||l===""){l&&n.push(l);continue}}else this.F=setTimeout(Xl,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let g;for(;g!==h&&h.length>2;)g=h,h=h.replace(this.K,p=>this.stemmer.get(p))}if(h&&(this.mapper||this.dedupe&&h.length>1)){l="";for(let g=0,p="",m,y;g<h.length;g++)m=h.charAt(g),m===p&&this.dedupe||((y=this.mapper&&this.mapper.get(m))||y===""?y===p&&this.dedupe||!(p=y)||(l+=y):l+=p=m);h=l}if(this.matcher&&h.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),h=h.replace(this.J,g=>this.matcher.get(g))),h&&this.replacer)for(l=0;h&&l<this.replacer.length;l+=2)h=h.replace(this.replacer[l],this.replacer[l+1]);if(this.cache&&d.length<=this.I&&(this.D.set(d,h),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),h){if(h!==d)if(e){if(i[h])continue;i[h]=1}else{if(o===h)continue;o=h}n.push(h)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};function Xl(t){t.F=null,t.B.clear(),t.D.clear()}function Qv(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new mc);let i=this.cache.get(t+n);if(!i){const s=r&&r.cache;s&&(r.cache=!1),i=this.search(t,e,r),s&&(r.cache=s),this.cache.set(t+n,i)}return i}function mc(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}mc.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};mc.prototype.get=function(t){const e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};mc.prototype.remove=function(t){for(const e of this.cache){const r=e[0];e[1].includes(t)&&this.cache.delete(r)}};mc.prototype.clear=function(){this.cache.clear(),this.h=""};const oT={normalize:!1,numeric:!1,dedupe:!1},dg={},ax=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),aT=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),lT=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],cT={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var yL={Exact:oT,Default:dg,Normalize:dg,LatinBalance:{mapper:ax},LatinAdvanced:{mapper:ax,matcher:aT,replacer:lT},LatinExtra:{mapper:ax,replacer:lT.concat([/(?!^)[aeo]/g,""]),matcher:aT},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),i=cT[n];for(let s=1,o;s<e.length&&(o=e.charAt(s),o==="h"||o==="w"||!(o=cT[o])||o===i||(n+=o,i=o,n.length!==4));s++);t[r]=n}}},CJK:{split:""},LatinExact:oT,LatinDefault:dg,LatinSimple:dg};function uT(t,e,r,n){let i=[];for(let s=0,o;s<t.index.length;s++)if(o=t.index[s],e>=o.length)e-=o.length;else{e=o[n?"splice":"slice"](e,r);const a=e.length;if(a&&(i=i.length?i.concat(e):e,r-=a,n&&(t.length-=a),!r))break;e=0}return i}function Uu(t){if(!this||this.constructor!==Uu)return new Uu(t);this.index=t?[t]:[],this.length=t?t.length:0;const e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(i){e.index[e.index.length-1].push(i),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(i){let s=0;for(let o=0,a,l;o<e.index.length;o++){if(a=e.index[o],l=a.indexOf(i),l>=0)return s+l;s+=a.length}return-1};if(n==="includes")return function(i){for(let s=0;s<e.index.length;s++)if(e.index[s].includes(i))return!0;return!1};if(n==="slice")return function(i,s){return uT(e,i||0,s||e.length,!1)};if(n==="splice")return function(i,s){return uT(e,i||0,s||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/2**31|0])&&r[n]},set(r,n,i){return r=n/2**31|0,(e.index[r]||(e.index[r]=[]))[n]=i,e.length++,!0}})}Uu.prototype.clear=function(){this.index.length=0};Uu.prototype.push=function(){};function ys(t=8){if(!this||this.constructor!==ys)return new ys(t);this.index=Br(),this.h=[],this.size=0,t>32?(this.B=xL,this.A=BigInt(t)):(this.B=bL,this.A=t)}ys.prototype.get=function(t){const e=this.index[this.B(t)];return e&&e.get(t)};ys.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};function Cs(t=8){if(!this||this.constructor!==Cs)return new Cs(t);this.index=Br(),this.h=[],this.size=0,t>32?(this.B=xL,this.A=BigInt(t)):(this.B=bL,this.A=t)}Cs.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};We=ys.prototype;We.has=Cs.prototype.has=function(t){const e=this.index[this.B(t)];return e&&e.has(t)};We.delete=Cs.prototype.delete=function(t){const e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};We.clear=Cs.prototype.clear=function(){this.index=Br(),this.h=[],this.size=0};We.values=Cs.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};We.keys=Cs.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};We.entries=Cs.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};function bL(t){let e=2**this.A-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let i=0;i<t.length;i++)r=(r*n^t.charCodeAt(i))&e;return this.A===32?r+2**31:r}function xL(t){let e=BigInt(2)**this.A-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let i=0;i<t.length;i++)r=(r*n^BigInt(t.charCodeAt(i)))&e;return r}let Zc,td;async function Q7(t){t=t.data;var e=t.task;const r=t.id;let n=t.args;switch(e){case"init":td=t.options||{},(e=t.factory)?(Function("return "+e)()(self),Zc=new self.FlexSearch.Index(td),delete self.FlexSearch):Zc=new Ks(td),postMessage({id:r});break;default:let i;e==="export"&&(n[1]?(n[0]=td.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=await td.import.call(Zc,n[0]),Zc.import(n[0],t)):((i=n&&Zc[e].apply(Zc,n))&&i.then&&(i=await i),i&&i.await&&(i=await i.await),e==="search"&&i.result&&(i=i.result)),postMessage(e==="search"?{id:r,msg:i}:{id:r})}}function Jv(t){Qc.call(t,"add"),Qc.call(t,"append"),Qc.call(t,"search"),Qc.call(t,"update"),Qc.call(t,"remove"),Qc.call(t,"searchCache")}let YC,hT,om;function J7(){YC=om=0}function Qc(t){this[t+"Async"]=function(){const e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),YC?om||(om=Date.now()-hT>=this.priority*this.priority*3):(YC=setTimeout(J7,0),hT=Date.now()),om){const s=this;return new Promise(o=>{setTimeout(function(){o(s[t+"Async"].apply(s,e))},0)})}const i=this[t].apply(this,e);return r=i.then?i:new Promise(s=>s(i)),n&&r.then(n),r}}let Na=0;function Vu(t={},e){function r(a){function l(c){c=c.data||c;const h=c.id,d=h&&s.h[h];d&&(d(c.msg),delete s.h[h])}if(this.worker=a,this.h=Br(),this.worker)return i?this.worker.on("message",l):this.worker.onmessage=l,t.config?new Promise(function(c){Na>1e9&&(Na=0),s.h[++Na]=function(){c(s)},s.worker.postMessage({id:Na,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==Vu)return new Vu(t);let n=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;n&&(n=n.toString());const i=typeof window>"u",s=this,o=ej(n,i,t.worker);return o.then?o.then(function(a){return r.call(s,a)}):r.call(this,o)}Ja("add");Ja("append");Ja("search");Ja("update");Ja("remove");Ja("clear");Ja("export");Ja("import");Vu.prototype.searchCache=Qv;Jv(Vu.prototype);function Ja(t){Vu.prototype[t]=function(){const e=this,r=[].slice.call(arguments);var n=r[r.length-1];let i;return typeof n=="function"&&(i=n,r.pop()),n=new Promise(function(s){t==="export"&&typeof r[0]=="function"&&(r[0]=null),Na>1e9&&(Na=0),e.h[++Na]=s,e.worker.postMessage({task:t,id:Na,args:r})}),i?(n.then(i),this):n}}function ej(t,e,r){return e?typeof module<"u"?new(require("worker_threads")).Worker(__dirname+"/worker/node.js"):Bt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).then(function(n){return new n.Worker(import.meta.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Q7.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}Zl.prototype.add=function(t,e,r){if(Jd(t)&&(e=t,t=ef(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let a=0,l;a<this.field.length;a++){l=this.B[a];var n=this.index.get(this.field[a]);if(typeof l=="function"){var i=l(e);i&&n.add(t,i,r,!0)}else i=l.G,(!i||i(e))&&(l.constructor===String?l=[""+l]:ms(l)&&(l=[l]),ZC(e,l,this.D,0,n,t,l[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];i=this.tag.get(this.F[n]);let a=Br();if(typeof s=="function"){if(s=s(e),!s)continue}else{var o=s.G;if(o&&!o(e))continue;s.constructor===String&&(s=""+s),s=ef(e,s)}if(i&&s){ms(s)&&(s=[s]);for(let l=0,c,h;l<s.length;l++)if(c=s[l],!a[c]&&(a[c]=1,(o=i.get(c))?h=o:i.set(c,h=[]),!r||!h.includes(t))){if(h.length===2**31-1){if(o=new Uu(h),this.fastupdate)for(let d of this.reg.values())d.includes(h)&&(d[d.indexOf(h)]=o);i.set(c,h=o)}h.push(t),this.fastupdate&&((o=this.reg.get(t))?o.push(h):this.reg.set(t,[h]))}}}if(this.store&&(!r||!this.store.has(t))){let a;if(this.h){a=Br();for(let l=0,c;l<this.h.length;l++){if(c=this.h[l],(r=c.G)&&!r(e))continue;let h;if(typeof c=="function"){if(h=c(e),!h)continue;c=[c.O]}else if(ms(c)||c.constructor===String){a[c]=e[c];continue}XC(e,a,c,0,c[0],h)}}this.store.set(t,a||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};function XC(t,e,r,n,i,s){if(t=t[i],n===r.length-1)e[i]=s||t;else if(t)if(t.constructor===Array)for(e=e[i]=Array(t.length),i=0;i<t.length;i++)XC(t,e,r,n,i);else e=e[i]||(e[i]=Br()),i=r[++n],XC(t,e,r,n,i)}function ZC(t,e,r,n,i,s,o,a){if(t=t[o])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)i.add(s,t[e],!0,!0);return}t=t.join(" ")}i.add(s,t,a,!0)}else if(t.constructor===Array)for(o=0;o<t.length;o++)ZC(t,e,r,n,i,s,o,a);else o=e[++n],ZC(t,e,r,n,i,s,o,a)}function e2(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?ku.call(this,t):t;let i=[];for(let s=0,o,a;s<t.length;s++)if((o=t[s])&&(a=o.length)){if(r){if(r>=a){r-=a;continue}o=o.slice(r,r+e),a=o.length,r=0}if(a>e&&(o=o.slice(0,e),a=e),!i.length&&a>=e)return n?ku.call(this,o):o;if(i.push(o),e-=a,!e)break}return i=i.length>1?[].concat.apply([],i):i[0],n?ku.call(this,i):i}function Cy(t,e,r,n){var i=n[0];if(i[0]&&i[0].query)return t[e].apply(t,i);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||i.suggest))return n.length>1&&(i=n[n.length-1]),(n=i.resolve)?t.await||t.result:t;let s=[],o=0,a=0,l,c,h,d,g;for(e=0;e<n.length;e++)if(i=n[e]){var p=void 0;if(i.constructor===lr)p=i.await||i.result;else if(i.then||i.constructor===Array)p=i;else{o=i.limit||0,a=i.offset||0,h=i.suggest,c=i.resolve,l=((d=i.highlight||t.highlight)||i.enrich)&&c,p=i.queue;let m=i.async||p,y=i.index,x=i.query;if(y?t.index||(t.index=y):y=t.index,x||i.tag){const C=i.field||i.pluck;if(C&&(!x||t.query&&!d||(t.query=x,t.field=C,t.highlight=d),y=y.index.get(C)),p&&(g||t.await)){g=1;let v;const _=t.C.length,M=new Promise(function(L){v=L});(function(L,N){M.h=function(){N.index=null,N.resolve=!1;let E=m?L.searchAsync(N):L.search(N);return E.then?E.then(function(O){return t.C[_]=O=O.result||O,v(O),O}):(E=E.result||E,v(E),E)}})(y,Object.assign({},i)),t.C.push(M),s[e]=M;continue}else i.resolve=!1,i.index=null,p=m?y.searchAsync(i):y.search(i),i.resolve=c,i.index=y}else if(i.and)p=fg(i,"and",y);else if(i.or)p=fg(i,"or",y);else if(i.not)p=fg(i,"not",y);else if(i.xor)p=fg(i,"xor",y);else continue}p.await?(g=1,p=p.await):p.then?(g=1,p=p.then(function(m){return m.result||m})):p=p.result||p,s[e]=p}if(g&&!t.await&&(t.await=new Promise(function(m){t.return=m})),g){const m=Promise.all(s).then(function(y){for(let x=0;x<t.C.length;x++)if(t.C[x]===m){t.C[x]=function(){return r.call(t,y,o,a,l,c,h,d)};break}t2(t)});t.C.push(m)}else if(t.await)t.C.push(function(){return r.call(t,s,o,a,l,c,h,d)});else return r.call(t,s,o,a,l,c,h,d);return c?t.await||t.result:t}function fg(t,e,r){t=t[e];const n=t[0]||t;return n.index||(n.index=r),r=new lr(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}lr.prototype.or=function(){return Cy(this,"or",tj,arguments)};function tj(t,e,r,n,i,s,o){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=CL(t,e,r,!1,this.h),r=0)),i&&(this.await=null),i?this.resolve(e,r,n,o):this}lr.prototype.and=function(){return Cy(this,"and",rj,arguments)};function rj(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;let a;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let l=0;for(let c=0,h,d;c<t.length;c++)if((h=t[c])&&(d=h.length))l<d&&(l=d);else if(!s){l=0;break}l?(this.result=Om(t,l,e,r,s,this.h,i),a=!0):this.result=[]}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}lr.prototype.xor=function(){return Cy(this,"xor",nj,arguments)};function nj(t,e,r,n,i,s,o){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{s=r;var a=this.h;const l=[],c=Br();let h=0;for(let d=0,g;d<t.length;d++)if(g=t[d]){h<g.length&&(h=g.length);for(let p=0,m;p<g.length;p++)if(m=g[p])for(let y=0,x;y<m.length;y++)x=m[y],c[x]=c[x]?2:1}for(let d=0,g,p=0;d<h;d++)for(let m=0,y;m<t.length;m++)if((y=t[m])&&(g=y[d])){for(let x=0,C;x<g.length;x++)if(C=g[x],c[C]===1)if(s)s--;else if(i){if(l.push(C),l.length===e){t=l;break e}}else{const v=d+(m?a:0);if(l[v]||(l[v]=[]),l[v].push(C),++p===e){t=l;break e}}}t=l}this.result=t,a=!0}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}lr.prototype.not=function(){return Cy(this,"not",ij,arguments)};function ij(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;if(t.length&&this.result.length){e:{s=r;var a=[];t=new Set(t.flat().flat());for(let l=0,c,h=0;l<this.result.length;l++)if(c=this.result[l]){for(let d=0,g;d<c.length;d++)if(g=c[d],!t.has(g)){if(s)s--;else if(i){if(a.push(g),a.length===e){t=a;break e}}else if(a[l]||(a[l]=[]),a[l].push(g),++h===e){t=a;break e}}}t=a}this.result=t,a=!0}return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}function am(t,e,r,n,i){let s,o,a;typeof i=="string"?(s=i,i=""):s=i.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let l=i&&i.boundary,c=!i||i.clip!==!1,h=i&&i.merge&&a&&o&&new RegExp(a+" "+o,"g");i=i&&i.ellipsis;var d=0;if(typeof i=="object"){var g=i.template;d=g.length-2,i=i.pattern}typeof i!="string"&&(i=i===!1?"":"..."),d&&(i=g.replace("$1",i)),g=i.length-d;let p,m;typeof l=="object"&&(p=l.before,p===0&&(p=-1),m=l.after,m===0&&(m=-1),l=l.total||9e5),d=new Map;for(let Q=0,F,K,U;Q<e.length;Q++){let P;if(n)P=e,U=n;else{var y=e[Q];if(U=y.field,!U)continue;P=y.result}K=r.get(U),F=K.encoder,y=d.get(F),typeof y!="string"&&(y=F.encode(t),d.set(F,y));for(let z=0;z<P.length;z++){var x=P[z].doc;if(!x||(x=ef(x,U),!x))continue;var C=x.trim().split(/\s+/);if(!C.length)continue;x="";var v=[];let oe=[];for(var _=-1,M=-1,L=0,N=0;N<C.length;N++){var E=C[N],O=F.encode(E);O=O.length>1?O.join(" "):O[0];let re;if(O&&E){for(var I=E.length,$=(F.split?E.replace(F.split,""):E).length-O.length,j="",ie=0,J=0;J<y.length;J++){var G=y[J];if(G){var H=G.length;H+=$<0?0:$,ie&&H<=ie||(G=O.indexOf(G),G>-1&&(j=(G?E.substring(0,G):"")+o+E.substring(G,G+H)+a+(G+H<I?E.substring(G+H):""),ie=H,re=!0))}}j&&(l&&(_<0&&(_=x.length+(x?1:0)),M=x.length+(x?1:0)+j.length,L+=I,oe.push(v.length),v.push({match:j})),x+=(x?" ":"")+j)}if(!re)E=C[N],x+=(x?" ":"")+E,l&&v.push({text:E});else if(l&&L>=l)break}if(L=oe.length*(s.length-2),p||m||l&&x.length-L>l)if(L=l+L-g*2,N=M-_,p>0&&(N+=p),m>0&&(N+=m),N<=L)C=p?_-(p>0?p:0):_-((L-N)/2|0),v=m?M+(m>0?m:0):C+L,c||(C>0&&x.charAt(C)!==" "&&x.charAt(C-1)!==" "&&(C=x.indexOf(" ",C),C<0&&(C=0)),v<x.length&&x.charAt(v-1)!==" "&&x.charAt(v)!==" "&&(v=x.lastIndexOf(" ",v),v<M?v=M:++v)),x=(C?i:"")+x.substring(C,v)+(v<x.length?i:"");else{for(M=[],_={},L={},N={},E={},O={},j=$=I=0,J=ie=1;;){var V=void 0;for(let re=0,ee;re<oe.length;re++){if(ee=oe[re],j)if($!==j){if(N[re+1])continue;if(ee+=j,_[ee]){I-=g,L[re+1]=1,N[re+1]=1;continue}if(ee>=v.length-1){if(ee>=v.length){N[re+1]=1,ee>=C.length&&(L[re+1]=1);continue}I-=g}if(x=v[ee].text,H=m&&O[re])if(H>0){if(x.length>H)if(N[re+1]=1,c)x=x.substring(0,H);else continue;(H-=x.length)||(H=-1),O[re]=H}else{N[re+1]=1;continue}if(I+x.length+1<=l)x=" "+x,M[re]+=x;else if(c)V=l-I-1,V>0&&(x=" "+x.substring(0,V),M[re]+=x),N[re+1]=1;else{N[re+1]=1;continue}}else{if(N[re])continue;if(ee-=$,_[ee]){I-=g,N[re]=1,L[re]=1;continue}if(ee<=0){if(ee<0){N[re]=1,L[re]=1;continue}I-=g}if(x=v[ee].text,H=p&&E[re])if(H>0){if(x.length>H)if(N[re]=1,c)x=x.substring(x.length-H);else continue;(H-=x.length)||(H=-1),E[re]=H}else{N[re]=1;continue}if(I+x.length+1<=l)x+=" ",M[re]=x+M[re];else if(c)V=x.length+1-(l-I),V>=0&&V<x.length&&(x=x.substring(V)+" ",M[re]=x+M[re]),N[re]=1;else{N[re]=1;continue}}else{x=v[ee].match,p&&(E[re]=p),m&&(O[re]=m),re&&I++;let fe;if(ee?!re&&g&&(I+=g):(L[re]=1,N[re]=1),ee>=C.length-1||ee<v.length-1&&v[ee+1].match?fe=1:g&&(I+=g),I-=s.length-2,!re||I+x.length<=l)M[re]=x;else{V=ie=J=L[re]=0;break}fe&&(L[re+1]=1,N[re+1]=1)}I+=x.length,V=_[ee]=1}if(V)$===j?j++:$++;else{if($===j?ie=0:J=0,!ie&&!J)break;ie?($++,j=$):j++}}x="";for(let re=0,ee;re<M.length;re++)ee=(L[re]?re?" ":"":(re&&!i?" ":"")+i)+M[re],x+=ee;i&&!L[M.length]&&(x+=i)}h&&(x=x.replace(h," ")),P[z].highlight=x}if(n)break}return e}function lr(t,e){if(!this||this.constructor!==lr)return new lr(t,e);let r=0,n,i,s,o,a,l;if(t&&t.index){const c=t;if(e=c.index,r=c.boost||0,i=c.query){s=c.field||c.pluck,o=c.highlight;const h=c.resolve;t=c.async||c.queue,c.resolve=!1,c.index=null,t=t?e.searchAsync(c):e.search(c),c.resolve=h,c.index=e,t=t.result||t}else t=[]}if(t&&t.then){const c=this;t=t.then(function(h){c.C[0]=c.result=h.result||h,t2(c)}),n=[t],t=[],a=new Promise(function(h){l=h})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=a||null,this.return=l||null,this.highlight=o||null,this.query=i||"",this.field=s||""}We=lr.prototype;We.limit=function(t){if(this.await){const e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){const e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};We.offset=function(t){if(this.await){const e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){const e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};We.boost=function(t){if(this.await){const e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};function t2(t,e){let r=t.result;var n=t.await;t.await=null;for(let i=0,s;i<t.C.length;i++)if(s=t.C[i]){if(typeof s=="function")r=s(),t.C[i]=r=r.result||r,i--;else if(s.h)r=s.h(),t.C[i]=r=r.result||r,i--;else if(s.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}We.resolve=function(t,e,r,n,i){let s=this.await?t2(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(t,e,r,n,i)})}return s.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),s=i?r?ku.call(this.index,s):s:e2.call(this.index,s,t||100,e,r)),this.finalize(s,n)};We.finalize=function(t,e){if(t.then){const n=this;return t.then(function(i){return n.finalize(i,e)})}e&&t.length&&this.query&&(t=am(this.query,t,this.index.index,this.field,e));const r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};function Om(t,e,r,n,i,s,o){const a=t.length;let l=[],c,h;c=Br();for(let d=0,g,p,m,y;d<e;d++)for(let x=0;x<a;x++)if(m=t[x],d<m.length&&(g=m[d]))for(let C=0;C<g.length;C++){if(p=g[C],(h=c[p])?c[p]++:(h=0,c[p]=1),y=l[h]||(l[h]=[]),!o){let v=d+(x||!i?0:s||0);y=y[v]||(y[v]=[])}if(y.push(p),o&&r&&h===a-1&&y.length-n===r)return n?y.slice(n):y}if(t=l.length)if(i)l=l.length>1?CL(l,r,n,o,s):(l=l[0])&&r&&l.length>r||n?l.slice(n,r+n):l;else{if(t<a)return[];if(l=l[t-1],r||n)if(o)(l.length>r||n)&&(l=l.slice(n,r+n));else{i=[];for(let d=0,g;d<l.length;d++)if(g=l[d]){if(n&&g.length>n)n-=g.length;else if((r&&g.length>r||n)&&(g=g.slice(n,r+n),r-=g.length,n&&(n-=g.length)),i.push(g),!r)break}l=i}}return l}function CL(t,e,r,n,i){const s=[],o=Br();let a;var l=t.length;let c;if(n){for(i=l-1;i>=0;i--)if(c=(n=t[i])&&n.length){for(l=0;l<c;l++)if(a=n[l],!o[a]){if(o[a]=1,r)r--;else if(s.push(a),s.length===e)return s}}}else for(let h=l-1,d,g=0;h>=0;h--){d=t[h];for(let p=0;p<d.length;p++)if(c=(n=d[p])&&n.length){for(let m=0;m<c;m++)if(a=n[m],!o[a])if(o[a]=1,r)r--;else{let y=(p+(h<l-1&&i||0))/(h+1)|0;if((s[y]||(s[y]=[])).push(a),++g===e)return s}}}return s}function sj(t,e,r,n,i){const s=Br(),o=[];for(let a=0,l;a<e.length;a++){l=e[a];for(let c=0;c<l.length;c++)s[l[c]]=1}if(i){for(let a=0,l;a<t.length;a++)if(l=t[a],s[l]){if(n)n--;else if(o.push(l),s[l]=0,r&&--r===0)break}}else for(let a=0,l,c;a<t.result.length;a++)for(l=t.result[a],e=0;e<l.length;e++)c=l[e],s[c]&&((o[a]||(o[a]=[])).push(c),s[c]=0);return o}Zl.prototype.search=function(t,e,r,n){r||(!e&&Jd(t)?(r=t,t=""):Jd(e)&&(r=e,e=0));let i=[];var s=[];let o,a,l,c,h,d,g=0,p=!0,m;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,o=r.pluck,a=r.merge,c=r.boost,d=o||r.field||(d=r.index)&&(d.index?null:d);var y=this.tag&&r.tag;l=r.suggest,p=r.resolve!==!1,h=r.cache,m=p&&this.store&&r.highlight;var x=!!m||p&&this.store&&r.enrich;e=r.limit||e;var C=r.offset||0;if(e||(e=p?100:0),y&&(!this.db||!n)){y.constructor!==Array&&(y=[y]);var v=[];for(let E=0,O;E<y.length;E++)if(O=y[E],O.field&&O.tag){var _=O.tag;if(_.constructor===Array)for(var M=0;M<_.length;M++)v.push(O.field,_[M]);else v.push(O.field,_)}else{_=Object.keys(O);for(let I=0,$,j;I<_.length;I++)if($=_[I],j=O[$],j.constructor===Array)for(M=0;M<j.length;M++)v.push($,j[M]);else v.push($,j)}if(y=v,!t){if(s=[],v.length)for(y=0;y<v.length;y+=2){if(this.db){if(n=this.index.get(v[y]),!n)continue;s.push(n=n.db.tag(v[y+1],e,C,x))}else n=oj.call(this,v[y],v[y+1],e,C,x);i.push(p?{field:v[y],tag:v[y+1],result:n}:[n])}if(s.length){const E=this;return Promise.all(s).then(function(O){for(let I=0;I<O.length;I++)p?i[I].result=O[I]:i[I]=O[I];return p?i:new lr(i.length>1?Om(i,1,0,0,l,c):i[0],E)})}return p?i:new lr(i.length>1?Om(i,1,0,0,l,c):i[0],this)}}p||o||!(d=d||this.field)||(ms(d)?o=d:(d.constructor===Array&&d.length===1&&(d=d[0]),o=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||(d=this.field);let L;v=(this.worker||this.db)&&!n&&[];for(let E=0,O,I,$;E<d.length;E++){if(I=d[E],this.db&&this.tag&&!this.B[E])continue;let j;if(ms(I)||(j=I,I=j.field,t=j.query||t,e=Xc(j.limit,e),C=Xc(j.offset,C),l=Xc(j.suggest,l),m=p&&this.store&&Xc(j.highlight,m),x=!!m||p&&this.store&&Xc(j.enrich,x),h=Xc(j.cache,h)),n)O=n[E];else{_=j||r||{},M=_.enrich;var N=this.index.get(I);if(y&&(this.db&&(_.tag=y,_.field=d,L=N.db.support_tag_search),!L&&M&&(_.enrich=!1),L||(_.limit=0,_.offset=0)),O=h?N.searchCache(t,y&&!L?0:e,_):N.search(t,y&&!L?0:e,_),y&&!L&&(_.limit=e,_.offset=C),M&&(_.enrich=M),v){v[E]=O;continue}}if($=(O=O.result||O)&&O.length,y&&$){if(_=[],M=0,this.db&&n){if(!L)for(N=d.length;N<n.length;N++){let ie=n[N];if(ie&&ie.length)M++,_.push(ie);else if(!l)return p?i:new lr(i,this)}}else for(let ie=0,J,G;ie<y.length;ie+=2){if(J=this.tag.get(y[ie]),!J){if(l)continue;return p?i:new lr(i,this)}if(G=(J=J&&J.get(y[ie+1]))&&J.length)M++,_.push(J);else if(!l)return p?i:new lr(i,this)}if(M){if(O=sj(O,_,e,C,p),$=O.length,!$&&!l)return p?O:new lr(O,this);M--}}if($)s[g]=I,i.push(O),g++;else if(d.length===1)return p?i:new lr(i,this)}if(v){if(this.db&&y&&y.length&&!L)for(x=0;x<y.length;x+=2){if(s=this.index.get(y[x]),!s){if(l)continue;return p?i:new lr(i,this)}v.push(s.db.tag(y[x+1],e,C,!1))}const E=this;return Promise.all(v).then(function(O){return r&&(r.resolve=p),O.length&&(O=E.search(t,e,r,O)),O})}if(!g)return p?i:new lr(i,this);if(o&&(!x||!this.store))return i=i[0],p?i:new lr(i,this);for(v=[],C=0;C<s.length;C++){if(y=i[C],x&&y.length&&typeof y[0].doc>"u"&&(this.db?v.push(y=this.index.get(this.field[0]).db.enrich(y)):y=ku.call(this,y)),o)return p?m?am(t,y,this.index,o,m):y:new lr(y,this);i[C]={field:s[C],result:y}}if(x&&this.db&&v.length){const E=this;return Promise.all(v).then(function(O){for(let I=0;I<O.length;I++)i[I].result=O[I];return m&&(i=am(t,i,E.index,o,m)),a?dT(i):i})}return m&&(i=am(t,i,this.index,o,m)),a?dT(i):i};function dT(t){const e=[],r=Br(),n=Br();for(let i=0,s,o,a,l,c,h,d;i<t.length;i++){s=t[i],o=s.field,a=s.result;for(let g=0;g<a.length;g++)c=a[g],typeof c!="object"?c={id:l=c}:l=c.id,(h=r[l])?h.push(o):(c.field=r[l]=[o],e.push(c)),(d=c.highlight)&&(h=n[l],h||(n[l]=h={},c.highlight=h),h[o]=d)}return e}function oj(t,e,r,n,i){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),i&&(t=ku.call(this,t))),t):[]):[]}function ku(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);const e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function Zl(t){if(!this||this.constructor!==Zl)return new Zl(t);const e=t.document||t.doc||t;let r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&Dm(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new Cs(n):new Set:n?new ys(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new ys(n):new Map:null,this.cache=(r=t.cache||null)&&new mc(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=aj.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let i=0,s,o;i<r.length;i++){if(s=r[i],o=s.field||s,!o)throw Error("The tag field from the document descriptor is undefined.");s.custom?this.A[i]=s.custom:(this.A[i]=Dm(o,this.D),s.filter&&(typeof this.A[i]=="string"&&(this.A[i]=new String(this.A[i])),this.A[i].G=s.filter)),this.F[i]=o,this.tag.set(o,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(const i of this.index.values())i.then&&t.push(i);if(t.length){const i=this;return Promise.all(t).then(function(s){let o=0;for(const a of i.index.entries()){const l=a[0];let c=a[1];c.then&&(c=s[o],i.index.set(l,c),o++)}return i})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}We=Zl.prototype;We.mount=function(t){let e=this.field;if(this.tag)for(let s=0,o;s<this.F.length;s++){o=this.F[s];var r=void 0;this.index.set(o,r=new Ks({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(o),r.tag=this.tag.get(o)}r=[];const n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let s=0,o,a;s<e.length;s++){n.field=a=e[s],o=this.index.get(a);const l=new t.constructor(t.id,n);l.id=t.id,r[s]=l.mount(o),o.document=!0,s?o.bypass=!0:o.store=this.store}const i=this;return this.db=Promise.all(r).then(function(){i.db=!0})};We.commit=async function(){const t=[];for(const e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()};We.destroy=function(){const t=[];for(const e of this.index.values())t.push(e.destroy());return Promise.all(t)};function aj(t,e){const r=new Map;let n=e.index||e.field||e;ms(n)&&(n=[n]);for(let s=0,o,a;s<n.length;s++){if(o=n[s],ms(o)||(a=o,o=o.field),a=Jd(a)?Object.assign({},t,a):t,this.worker){var i=void 0;i=(i=a.encoder)&&i.encode?i:new tf(typeof i=="string"?yL[i]:i||{}),i=new Vu(a,i),r.set(o,i)}this.worker||r.set(o,new Ks(a,this.reg)),a.custom?this.B[s]=a.custom:(this.B[s]=Dm(o,this.D),a.filter&&(typeof this.B[s]=="string"&&(this.B[s]=new String(this.B[s])),this.B[s].G=a.filter)),this.field[s]=o}if(this.h){t=e.store,ms(t)&&(t=[t]);for(let s=0,o,a;s<t.length;s++)o=t[s],a=o.field||o,o.custom?(this.h[s]=o.custom,o.custom.O=a):(this.h[s]=Dm(a,this.D),o.filter&&(typeof this.h[s]=="string"&&(this.h[s]=new String(this.h[s])),this.h[s].G=o.filter))}return r}function Dm(t,e){const r=t.split(":");let n=0;for(let i=0;i<r.length;i++)t=r[i],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}We.append=function(t,e){return this.add(t,e,!0)};We.update=function(t,e){return this.remove(t).add(t,e)};We.remove=function(t){Jd(t)&&(t=ef(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];const i=n[1],s=i.indexOf(t);s>-1&&(i.length>1?i.splice(s,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};We.clear=function(){const t=[];for(const e of this.index.values()){const r=e.clear();r.then&&t.push(r)}if(this.tag)for(const e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};We.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};We.cleanup=function(){for(const t of this.index.values())t.cleanup();return this};We.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};We.set=function(t,e){return typeof t=="object"&&(e=t,t=ef(e,this.key)),this.store.set(t,e),this};We.searchCache=Qv;We.export=lj;We.import=cj;Jv(Zl.prototype);function r2(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(const i of t.entries())n.push(i),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function n2(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function kL(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(const i of t.entries())n.push([i[0],r2(i[1])[0]||[]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function vL(t,e){e||(e=new Map);for(let r=0,n,i;r<t.length;r++)n=t[r],i=e.get(n[0]),e.set(n[0],n2(n[1],i));return e}function wL(t){let e=[],r=[];for(const n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function _L(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function Rm(t,e,r,n,i,s,o=0){const a=n&&n.constructor===Array;var l=a?n.shift():n;if(!l)return this.export(t,e,i,s+1);if((l=t((e?e+".":"")+(o+1)+"."+r,JSON.stringify(l)))&&l.then){const c=this;return l.then(function(){return Rm.call(c,t,e,r,a?n:null,i,s,o+1)})}return Rm.call(this,t,e,r,a?n:null,i,s,o+1)}function lj(t,e,r=0,n=0){if(r<this.field.length){const o=this.field[r];if((e=this.index.get(o).export(t,o,r,n=1))&&e.then){const a=this;return e.then(function(){return a.export(t,o,r+1)})}return this.export(t,o,r+1)}let i,s;switch(n){case 0:i="reg",s=wL(this.reg),e=null;break;case 1:i="tag",s=this.tag&&kL(this.tag,this.reg.size),e=null;break;case 2:i="doc",s=this.store&&r2(this.store),e=null;break;default:return}return Rm.call(this,t,e,i,s||null,r,n)}function cj(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();const n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=_L(e,this.reg);for(let i=0,s;i<this.field.length;i++)s=this.index.get(this.field[i]),s.fastupdate=!1,s.reg=this.reg;if(this.worker){e=[];for(const i of this.index.values())e.push(i.import(t));return Promise.all(e)}break;case"tag":this.tag=vL(e,this.tag);break;case"doc":this.store=n2(e,this.store)}}}function fT(t,e){let r="";for(const n of t.entries()){t=n[0];const i=n[1];let s="";for(let o=0,a;o<i.length;o++){a=i[o]||[""];let l="";for(let c=0;c<a.length;c++)l+=(l?",":"")+(e==="string"?'"'+a[c]+'"':a[c]);l="["+l+"]",s+=(s?",":"")+l}s='["'+t+'",['+s+"]]",r+=(r?",":"")+s}return r}Ks.prototype.remove=function(t,e){const r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,i,s;n<r.length;n++)if((i=r[n])&&(s=i.length))if(i[s-1]===t)i.pop();else{const o=i.indexOf(t);o>=0&&i.splice(o,1)}}else rf(this.map,t),this.depth&&rf(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&SL(this)),this.cache&&this.cache.remove(t),this};function rf(t,e){let r=0;var n=typeof e>"u";if(t.constructor===Array){for(let i=0,s,o,a;i<t.length;i++)if((s=t[i])&&s.length){if(n)return 1;if(o=s.indexOf(e),o>=0){if(s.length>1)return s.splice(o,1),1;if(delete t[i],r)return 1;a=1}else{if(a)return 1;r++}}}else for(let i of t.entries())n=i[0],rf(i[1],e)?r++:t.delete(n);return r}const uj={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Ks.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);const c=e.length;if(c){const h=Br(),d=Br(),g=this.resolution;for(let p=0;p<c;p++){let m=e[this.rtl?c-1-p:p];var i=m.length;if(i&&(n||!d[m])){var s=this.score?this.score(e,m,p,null,0):pg(g,c,p),o="";switch(this.tokenize){case"tolerant":if(bo(this,d,m,s,t,r),i>2){for(let y=1,x,C,v,_;y<i-1;y++)x=m.charAt(y),C=m.charAt(y+1),v=m.substring(0,y)+C,_=m.substring(y+2),o=v+x+_,bo(this,d,o,s,t,r),o=v+_,bo(this,d,o,s,t,r);bo(this,d,m.substring(0,m.length-1),s,t,r)}break;case"full":if(i>2){for(let y=0,x;y<i;y++)for(s=i;s>y;s--){o=m.substring(y,s),x=this.rtl?i-1-y:y;var a=this.score?this.score(e,m,p,o,x):pg(g,c,p,i,x);bo(this,d,o,a,t,r)}break}case"bidirectional":case"reverse":if(i>1){for(a=i-1;a>0;a--){o=m[this.rtl?i-1-a:a]+o;var l=this.score?this.score(e,m,p,o,a):pg(g,c,p,i,a);bo(this,d,o,l,t,r)}o=""}case"forward":if(i>1){for(a=0;a<i;a++)o+=m[this.rtl?i-1-a:a],bo(this,d,o,s,t,r);break}default:if(bo(this,d,m,s,t,r),n&&c>1&&p<c-1)for(i=this.N,o=m,s=Math.min(n+1,this.rtl?p+1:c-p),a=1;a<s;a++){m=e[this.rtl?c-1-p-a:p+a],l=this.bidirectional&&m>o;const y=this.score?this.score(e,o,p,m,a-1):pg(i+(c/2>i?0:1),c,p,s-1,a-1);bo(this,h,l?o:m,y,t,r,l?m:o)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&SL(this)),this};function bo(t,e,r,n,i,s,o){let a,l;if(!(a=e[r])||o&&!a[o]){if(o?(e=a||(e[r]=Br()),e[o]=1,l=t.ctx,(a=l.get(o))?l=a:l.set(o,l=t.keystore?new ys(t.keystore):new Map)):(l=t.map,e[r]=1),(a=l.get(r))?l=a:l.set(r,l=a=[]),s){for(let c=0,h;c<a.length;c++)if((h=a[c])&&h.includes(i)){if(c<=n)return;h.splice(h.indexOf(i),1),t.fastupdate&&(e=t.reg.get(i))&&e.splice(e.indexOf(h),1);break}}if(l=l[n]||(l[n]=[]),l.push(i),l.length===2**31-1){if(e=new Uu(l),t.fastupdate)for(let c of t.reg.values())c.includes(l)&&(c[c.indexOf(l)]=e);a[n]=l=e}t.fastupdate&&((n=t.reg.get(i))?n.push(l):t.reg.set(i,[l]))}}function pg(t,e,r,n,i){return r&&t>1?e+(n||0)<=t?r+(i||0):(t-1)/(e+(n||0))*(r+(i||0))+1|0:0}Ks.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],i,s,o,a=0,l,c,h,d,g;r&&(t=r.query||t,e=r.limit||e,a=r.offset||0,s=r.context,o=r.suggest,g=(l=r.resolve)&&r.enrich,h=r.boost,d=r.resolution,c=this.db&&r.tag),typeof l>"u"&&(l=this.resolve),s=this.depth&&s!==!1;let p=this.encoder.encode(t,!s);if(i=p.length,e=e||(l?100:0),i===1)return gT.call(this,p[0],"",e,a,l,g,c);if(i===2&&s&&!o)return gT.call(this,p[1],p[0],e,a,l,g,c);let m=Br(),y=0,x;if(s&&(x=p[0],y=1),d||d===0||(d=x?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,p,e,a,o,l,g,c),r!==!1))return r;const C=this;return(async function(){for(let v,_;y<i;y++){if((_=p[y])&&!m[_]){if(m[_]=1,v=await QC(C,_,x,0,0,!1,!1),v=mT(v,n,o,d)){n=v;break}x&&(o&&v&&n.length||(x=_))}o&&x&&y===i-1&&!n.length&&(d=C.resolution,x="",y=-1,m=Br())}return pT(n,d,e,a,o,h,l)})()}for(let C,v;y<i;y++){if((v=p[y])&&!m[v]){if(m[v]=1,C=QC(this,v,x,0,0,!1,!1),C=mT(C,n,o,d)){n=C;break}x&&(o&&C&&n.length||(x=v))}o&&x&&y===i-1&&!n.length&&(d=this.resolution,x="",y=-1,m=Br())}return pT(n,d,e,a,o,h,l)};function pT(t,e,r,n,i,s,o){let a=t.length,l=t;if(a>1)l=Om(t,e,r,n,i,s,o);else if(a===1)return o?e2.call(null,t[0],r,n):new lr(t[0],this);return o?l:new lr(l,this)}function gT(t,e,r,n,i,s,o){return t=QC(this,t,e,r,n,i,s,o),this.db?t.then(function(a){return i?a||[]:new lr(a,this)}):t&&t.length?i?e2.call(this,t,r,n):new lr(t,this):i?[]:new lr([],this)}function mT(t,e,r,n){let i=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let s=0,o;s<n;s++)(o=t[s])&&(i[s]=o);if(i.length){e.push(i);return}}if(!r)return i}function QC(t,e,r,n,i,s,o,a){let l;return r&&(l=t.bidirectional&&e>r)&&(l=r,r=e,e=l),t.db?t.db.get(e,r,n,i,s,o,a):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function Ks(t,e){if(!this||this.constructor!==Ks)return new Ks(t);if(t){var r=ms(t)?t:t.preset;r&&(t=Object.assign({},uj[r],t))}else t={};r=t.context;const n=r===!0?{depth:1}:r||{},i=ms(t.encoder)?yL[t.encoder]:t.encode||t.encoder||{};this.encoder=i.encode?i:typeof i=="object"?new tf(i):{encode:i},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new ys(r):new Map,this.ctx=r?new ys(r):new Map,this.reg=e||(this.fastupdate?r?new ys(r):new Map:r?new Cs(r):new Set),this.N=n.resolution||3,this.rtl=i.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new mc(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}We=Ks.prototype;We.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};We.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};We.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function SL(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}We.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};We.append=function(t,e){return this.add(t,e,!0)};We.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};We.update=function(t,e){const r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};We.cleanup=function(){return this.fastupdate?(rf(this.map),this.depth&&rf(this.ctx),this):this};We.searchCache=Qv;We.export=function(t,e,r=0,n=0){let i,s;switch(n){case 0:i="reg",s=wL(this.reg);break;case 1:i="cfg",s=null;break;case 2:i="map",s=r2(this.map,this.reg.size);break;case 3:i="ctx",s=kL(this.ctx,this.reg.size);break;default:return}return Rm.call(this,t,e,i,s,r,n)};We.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=_L(e,this.reg);break;case"map":this.map=n2(e,this.map);break;case"ctx":this.ctx=vL(e,this.ctx)}};We.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let s;for(var i of this.reg.keys())s||(s=typeof i),e+=(e?",":"")+(s==="string"?'"'+i+'"':i);e="index.reg=new Set(["+e+"]);",r=fT(this.map,s),r="index.map=new Map(["+r+"]);";for(const o of this.ctx.entries()){i=o[0];let a=fT(o[1],s);a="new Map(["+a+"])",a='["'+i+'",'+a+"]",n+=(n?",":"")+a}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Jv(Ks.prototype);const EL=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Im=["map","ctx","tag","reg","cfg"],Ol=Br();function JC(t,e={}){if(!this||this.constructor!==JC)return new JC(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}We=JC.prototype;We.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};We.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),Ol[t.id]||(Ol[t.id]=[]),Ol[t.id].push(t.field);const e=EL.open(t.id,1);return e.onupgradeneeded=function(){const r=t.db=this.result;for(let n=0,i;n<Im.length;n++){i=Im[n];for(let s=0,o;s<Ol[t.id].length;s++)o=Ol[t.id][s],r.objectStoreNames.contains(i+(i!=="reg"&&o?":"+o:""))||r.createObjectStore(i+(i!=="reg"&&o?":"+o:""))}},t.db=el(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};We.close=function(){this.db&&this.db.close(),this.db=null};We.destroy=function(){const t=EL.deleteDatabase(this.id);return el(t)};We.clear=function(){const t=[];for(let r=0,n;r<Im.length;r++){n=Im[r];for(let i=0,s;i<Ol[this.id].length;i++)s=Ol[this.id][i],t.push(n+(n!=="reg"&&s?":"+s:""))}const e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return el(e)};We.get=function(t,e,r=0,n=0,i=!0,s=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);const o=this;return el(t).then(function(a){let l=[];if(!a||!a.length)return l;if(i){if(!r&&!n&&a.length===1)return a[0];for(let c=0,h;c<a.length;c++)if((h=a[c])&&h.length){if(n>=h.length){n-=h.length;continue}const d=r?n+Math.min(h.length-n,r):h.length;for(let g=n;g<d;g++)l.push(h[g]);if(n=0,l.length===r)break}return s?o.enrich(l):l}return a})};We.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);const i=this;return el(t).then(function(s){return!s||!s.length||r>=s.length?[]:!e&&!r?s:(s=s.slice(r,r+e),n?i.enrich(s):s)})};We.enrich=function(t){typeof t!="object"&&(t=[t]);const e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=el(e.get(t[n]));return Promise.all(r).then(function(n){for(let i=0;i<n.length;i++)n[i]={id:t[i],doc:n[i]?JSON.parse(n[i]):null};return n})};We.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),el(t).then(function(e){return!!e})};We.search=null;We.info=function(){};We.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let i=this.db.transaction(t,e);this.h[t+":"+e]=n=i.objectStore(t);const s=r.call(this,n);return this.h[t+":"+e]=null,el(i).finally(function(){return s})};We.commit=async function(t){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,i;n<e.length;n++)i=e[n],i.del&&r.push(i.del);r.length&&await this.remove(r),t.reg.size&&(await this.transaction("map","readwrite",function(n){for(const i of t.map){const s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;var l;if(a&&a.length){const c=Math.max(a.length,o.length);for(let h=0,d,g;h<c;h++)if((g=o[h])&&g.length){if((d=a[h])&&d.length)for(l=0;l<g.length;l++)d.push(g[l]);else a[h]=g;l=1}}else a=o,l=1;l&&n.put(a,s)})}}),await this.transaction("ctx","readwrite",function(n){for(const i of t.ctx){const s=i[0],o=i[1];for(const a of o){const l=a[0],c=a[1];c.length&&(n.get(s+":"+l).onsuccess=function(){let h=this.result;var d;if(h&&h.length){const g=Math.max(h.length,c.length);for(let p=0,m,y;p<g;p++)if((y=c[p])&&y.length){if((m=h[p])&&m.length)for(d=0;d<y.length;d++)m.push(y[d]);else h[p]=y;d=1}}else h=c,d=1;d&&n.put(h,s+":"+l)})}}}),t.store?await this.transaction("reg","readwrite",function(n){for(const i of t.store){const s=i[0],o=i[1];n.put(typeof o=="object"?JSON.stringify(o):1,s)}}):t.bypass||await this.transaction("reg","readwrite",function(n){for(const i of t.reg.keys())n.put(1,i)}),t.tag&&await this.transaction("tag","readwrite",function(n){for(const i of t.tag){const s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;a=a&&a.length?a.concat(o):o,n.put(a,s)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};function lx(t,e,r){const n=t.value;let i,s=0;for(let o=0,a;o<n.length;o++){if(a=r?n:n[o]){for(let l=0,c,h;l<e.length;l++)if(h=e[l],c=a.indexOf(h),c>=0)if(i=1,a.length>1)a.splice(c,1);else{n[o]=[];break}s+=a.length}if(r)break}s?i&&t.update(n):t.delete(),t.continue()}We.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){const r=this.result;r&&lx(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){const r=this.result;r&&lx(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){const r=this.result;r&&lx(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};function el(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}const hj={Document:Zl};function dj(t){const e=[];function r(n){n.type==="file"&&e.push(n.path),n.children&&n.children.forEach(r)}return t.forEach(r),e}function TL(){const[t,e]=B.useState(!1),r=B.useRef(null),n=B.useRef(new Map),i=B.useCallback(()=>(r.current||(r.current=new hj.Document({document:{id:"path",index:["name","content"],store:["path","name","content"]},tokenize:"forward",resolution:9})),r.current),[]),s=B.useCallback(async c=>{e(!0);try{const h=i();n.current.clear();const d=dj(c);if(d.length===0){e(!1);return}const g=d.join(","),p=await fetch(`/api/files/content?paths=${encodeURIComponent(g)}`);if(!p.ok)throw new Error("Failed to fetch file contents");const m=await p.json();for(const y of m.files){const x={path:y.path,name:y.name,content:y.content.slice(0,1e5)};n.current.set(y.path,x),h.add(x)}}catch(h){console.error("Failed to build search index:",h)}finally{e(!1)}},[i]),o=B.useCallback(c=>{if(!c.trim()||!r.current)return[];const h=r.current,d=[],g=new Set,p=h.search(c,{field:"name",limit:5,enrich:!0});for(const y of p)for(const x of y.result){const C=n.current.get(String(x.id));C&&!g.has(C.path)&&(g.add(C.path),d.push({path:C.path,name:C.name,source:"name"}))}const m=h.search(c,{field:"content",limit:10,enrich:!0});for(const y of m)for(const x of y.result){const C=n.current.get(String(x.id));if(C&&!g.has(C.path)){g.add(C.path);let v;const _=C.content.toLowerCase(),M=c.toLowerCase(),L=_.indexOf(M);if(L!==-1){const N=Math.max(0,L-30),E=Math.min(C.content.length,L+c.length+30);v=(N>0?"...":"")+C.content.slice(N,E)+(E<C.content.length?"...":"")}d.push({path:C.path,name:C.name,matchedContent:v,source:"content"})}}return d},[]),a=B.useCallback((c,h,d)=>{if(!r.current)return;const g={path:c,name:h,content:d.slice(0,1e5)};n.current.set(c,g),r.current.update(g)},[]),l=B.useCallback(c=>{r.current&&(n.current.delete(c),r.current.remove(c))},[]);return{buildIndex:s,search:o,updateIndex:a,removeFromIndex:l,isIndexing:t}}function AL(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=AL(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function ML(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=AL(t))&&(n&&(n+=" "),n+=e);return n}const fj=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},pj=(t,e)=>({classGroupId:t,validator:e}),NL=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),Fm="-",yT=[],gj="arbitrary..",mj=t=>{const e=bj(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return yj(o);const a=o.split(Fm),l=a[0]===""&&a.length>1?1:0;return LL(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=r[o];return l?c?fj(c,l):l:c||yT}return r[o]||yT}}},LL=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],s=r.nextPart.get(i);if(s){const c=LL(t,e+1,s);if(c)return c}const o=r.validators;if(o===null)return;const a=e===0?t.join(Fm):t.slice(e).join(Fm),l=o.length;for(let c=0;c<l;c++){const h=o[c];if(h.validator(a))return h.classGroupId}},yj=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?gj+n:void 0})(),bj=t=>{const{theme:e,classGroups:r}=t;return xj(r,e)},xj=(t,e)=>{const r=NL();for(const n in t){const i=t[n];i2(i,r,n,e)}return r},i2=(t,e,r,n)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];Cj(o,e,r,n)}},Cj=(t,e,r,n)=>{if(typeof t=="string"){kj(t,e,r);return}if(typeof t=="function"){vj(t,e,r,n);return}wj(t,e,r,n)},kj=(t,e,r)=>{const n=t===""?e:BL(e,t);n.classGroupId=r},vj=(t,e,r,n)=>{if(_j(t)){i2(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(pj(r,t))},wj=(t,e,r,n)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];i2(l,BL(e,a),r,n)}},BL=(t,e)=>{let r=t;const n=e.split(Fm),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=r.nextPart.get(o);a||(a=NL(),r.nextPart.set(o,a)),r=a}return r},_j=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Sj=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},ek="!",bT=":",Ej=[],xT=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),Tj=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const s=[];let o=0,a=0,l=0,c;const h=i.length;for(let y=0;y<h;y++){const x=i[y];if(o===0&&a===0){if(x===bT){s.push(i.slice(l,y)),l=y+1;continue}if(x==="/"){c=y;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const d=s.length===0?i:i.slice(l);let g=d,p=!1;d.endsWith(ek)?(g=d.slice(0,-1),p=!0):d.startsWith(ek)&&(g=d.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return xT(s,p,g,m)};if(e){const i=e+bT,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):xT(Ej,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},Aj=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},Mj=t=>({cache:Sj(t.cacheSize),parseClassName:Tj(t),sortModifiers:Aj(t),...mj(t)}),Nj=/\s+/,Lj=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(Nj);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:d,modifiers:g,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:y}=r(h);if(d){l=h+(l.length>0?" "+l:l);continue}let x=!!y,C=n(x?m.substring(0,y):m);if(!C){if(!x){l=h+(l.length>0?" "+l:l);continue}if(C=n(m),!C){l=h+(l.length>0?" "+l:l);continue}x=!1}const v=g.length===0?"":g.length===1?g[0]:s(g).join(":"),_=p?v+ek:v,M=_+C;if(o.indexOf(M)>-1)continue;o.push(M);const L=i(C,x);for(let N=0;N<L.length;++N){const E=L[N];o.push(_+E)}l=h+(l.length>0?" "+l:l)}return l},Bj=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=OL(r))&&(i&&(i+=" "),i+=n);return i},OL=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=OL(t[n]))&&(r&&(r+=" "),r+=e);return r},Oj=(t,...e)=>{let r,n,i,s;const o=l=>{const c=e.reduce((h,d)=>d(h),t());return r=Mj(c),n=r.cache.get,i=r.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const h=Lj(l,r);return i(l,h),h};return s=o,(...l)=>s(Bj(...l))},Dj=[],Wr=t=>{const e=r=>r[t]||Dj;return e.isThemeGetter=!0,e},DL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,RL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rj=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ij=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Fj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$j=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ga=t=>Rj.test(t),Et=t=>!!t&&!Number.isNaN(Number(t)),ma=t=>!!t&&Number.isInteger(Number(t)),cx=t=>t.endsWith("%")&&Et(t.slice(0,-1)),xo=t=>Ij.test(t),IL=()=>!0,jj=t=>Fj.test(t)&&!Pj.test(t),s2=()=>!1,Hj=t=>$j.test(t),Wj=t=>zj.test(t),qj=t=>!He(t)&&!qe(t),Uj=t=>tl(t,$L,s2),He=t=>DL.test(t),El=t=>tl(t,zL,jj),CT=t=>tl(t,Jj,Et),Vj=t=>tl(t,HL,IL),Gj=t=>tl(t,jL,s2),kT=t=>tl(t,FL,s2),Kj=t=>tl(t,PL,Wj),gg=t=>tl(t,WL,Hj),qe=t=>RL.test(t),rd=t=>yc(t,zL),Yj=t=>yc(t,jL),vT=t=>yc(t,FL),Xj=t=>yc(t,$L),Zj=t=>yc(t,PL),mg=t=>yc(t,WL,!0),Qj=t=>yc(t,HL,!0),tl=(t,e,r)=>{const n=DL.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},yc=(t,e,r=!1)=>{const n=RL.exec(t);return n?n[1]?e(n[1]):r:!1},FL=t=>t==="position"||t==="percentage",PL=t=>t==="image"||t==="url",$L=t=>t==="length"||t==="size"||t==="bg-size",zL=t=>t==="length",Jj=t=>t==="number",jL=t=>t==="family-name",HL=t=>t==="number"||t==="weight",WL=t=>t==="shadow",eH=()=>{const t=Wr("color"),e=Wr("font"),r=Wr("text"),n=Wr("font-weight"),i=Wr("tracking"),s=Wr("leading"),o=Wr("breakpoint"),a=Wr("container"),l=Wr("spacing"),c=Wr("radius"),h=Wr("shadow"),d=Wr("inset-shadow"),g=Wr("text-shadow"),p=Wr("drop-shadow"),m=Wr("blur"),y=Wr("perspective"),x=Wr("aspect"),C=Wr("ease"),v=Wr("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...M(),qe,He],N=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],O=()=>[qe,He,l],I=()=>[ga,"full","auto",...O()],$=()=>[ma,"none","subgrid",qe,He],j=()=>["auto",{span:["full",ma,qe,He]},ma,qe,He],ie=()=>[ma,"auto",qe,He],J=()=>["auto","min","max","fr",qe,He],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...O()],Q=()=>[ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],F=()=>[ga,"screen","full","dvw","lvw","svw","min","max","fit",...O()],K=()=>[ga,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],U=()=>[t,qe,He],P=()=>[...M(),vT,kT,{position:[qe,He]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],oe=()=>["auto","cover","contain",Xj,Uj,{size:[qe,He]}],re=()=>[cx,rd,El],ee=()=>["","none","full",c,qe,He],fe=()=>["",Et,rd,El],Se=()=>["solid","dashed","dotted","double"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ee=()=>[Et,cx,vT,kT],xe=()=>["","none",m,qe,He],$e=()=>["none",Et,qe,He],xt=()=>["none",Et,qe,He],Ct=()=>[Et,qe,He],Je=()=>[ga,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xo],breakpoint:[xo],color:[IL],container:[xo],"drop-shadow":[xo],ease:["in","out","in-out"],font:[qj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xo],shadow:[xo],spacing:["px",Et],text:[xo],"text-shadow":[xo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ga,He,qe,x]}],container:["container"],columns:[{columns:[Et,He,qe,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[ma,"auto",qe,He]}],basis:[{basis:[ga,"full","auto",a,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Et,ga,"auto","initial","none",He]}],grow:[{grow:["",Et,qe,He]}],shrink:[{shrink:["",Et,qe,He]}],order:[{order:[ma,"first","last","none",qe,He]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[a,"screen",...Q()]}],"min-w":[{"min-w":[a,"screen","none",...Q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",r,rd,El]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Qj,Vj]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",cx,He]}],"font-family":[{font:[Yj,Gj,e]}],"font-features":[{"font-features":[He]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,qe,He]}],"line-clamp":[{"line-clamp":[Et,"none",qe,CT]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",qe,He]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,He]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Et,"from-font","auto",qe,El]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Et,"auto",qe,He]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,He]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",qe,He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ma,qe,He],radial:["",qe,He],conic:[ma,qe,He]},Zj,Kj]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-bs":[{"border-bs":fe()}],"border-w-be":[{"border-be":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":fe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Et,qe,He]}],"outline-w":[{outline:["",Et,rd,El]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",h,mg,gg]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",d,mg,gg]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Et,El]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",g,mg,gg]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Et,qe,He]}],"mix-blend":[{"mix-blend":[...Me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Et]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ee()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":Ee()}],"mask-image-t-to-pos":[{"mask-t-to":Ee()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":Ee()}],"mask-image-r-to-pos":[{"mask-r-to":Ee()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":Ee()}],"mask-image-b-to-pos":[{"mask-b-to":Ee()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":Ee()}],"mask-image-l-to-pos":[{"mask-l-to":Ee()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":Ee()}],"mask-image-x-to-pos":[{"mask-x-to":Ee()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":Ee()}],"mask-image-y-to-pos":[{"mask-y-to":Ee()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[qe,He]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ee()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[Et]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ee()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,He]}],filter:[{filter:["","none",qe,He]}],blur:[{blur:xe()}],brightness:[{brightness:[Et,qe,He]}],contrast:[{contrast:[Et,qe,He]}],"drop-shadow":[{"drop-shadow":["","none",p,mg,gg]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Et,qe,He]}],"hue-rotate":[{"hue-rotate":[Et,qe,He]}],invert:[{invert:["",Et,qe,He]}],saturate:[{saturate:[Et,qe,He]}],sepia:[{sepia:["",Et,qe,He]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,He]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Et,qe,He]}],"backdrop-contrast":[{"backdrop-contrast":[Et,qe,He]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Et,qe,He]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Et,qe,He]}],"backdrop-invert":[{"backdrop-invert":["",Et,qe,He]}],"backdrop-opacity":[{"backdrop-opacity":[Et,qe,He]}],"backdrop-saturate":[{"backdrop-saturate":[Et,qe,He]}],"backdrop-sepia":[{"backdrop-sepia":["",Et,qe,He]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,He]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Et,"initial",qe,He]}],ease:[{ease:["linear","initial",C,qe,He]}],delay:[{delay:[Et,qe,He]}],animate:[{animate:["none",v,qe,He]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,qe,He]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:$e()}],"rotate-x":[{"rotate-x":$e()}],"rotate-y":[{"rotate-y":$e()}],"rotate-z":[{"rotate-z":$e()}],scale:[{scale:xt()}],"scale-x":[{"scale-x":xt()}],"scale-y":[{"scale-y":xt()}],"scale-z":[{"scale-z":xt()}],"scale-3d":["scale-3d"],skew:[{skew:Ct()}],"skew-x":[{"skew-x":Ct()}],"skew-y":[{"skew-y":Ct()}],transform:[{transform:[qe,He,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Je()}],"translate-x":[{"translate-x":Je()}],"translate-y":[{"translate-y":Je()}],"translate-z":[{"translate-z":Je()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",qe,He]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",qe,He]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Et,rd,El,CT]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},tH=Oj(eH);function Ue(...t){return tH(ML(t))}const fh=B.forwardRef(({className:t,type:e,...r},n)=>T.jsx("input",{type:e,className:Ue("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));fh.displayName="Input";function wT(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Wa(...t){return e=>{let r=!1;const n=t.map(i=>{const s=wT(i,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():wT(t[i],null)}}}}function Nn(...t){return B.useCallback(Wa(...t),t)}var rH=Symbol.for("react.lazy"),Pm=Xv[" use ".trim().toString()];function nH(t){return typeof t=="object"&&t!==null&&"then"in t}function qL(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===rH&&"_payload"in t&&nH(t._payload)}function UL(t){const e=iH(t),r=B.forwardRef((n,i)=>{let{children:s,...o}=n;qL(s)&&typeof Pm=="function"&&(s=Pm(s._payload));const a=B.Children.toArray(s),l=a.find(oH);if(l){const c=l.props.children,h=a.map(d=>d===l?B.Children.count(c)>1?B.Children.only(null):B.isValidElement(c)?c.props.children:null:d);return T.jsx(e,{...o,ref:i,children:B.isValidElement(c)?B.cloneElement(c,void 0,h):null})}return T.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}var o2=UL("Slot");function iH(t){const e=B.forwardRef((r,n)=>{let{children:i,...s}=r;if(qL(i)&&typeof Pm=="function"&&(i=Pm(i._payload)),B.isValidElement(i)){const o=lH(i),a=aH(s,i.props);return i.type!==B.Fragment&&(a.ref=n?Wa(n,o):o),B.cloneElement(i,a)}return B.Children.count(i)>1?B.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var sH=Symbol("radix.slottable");function oH(t){return B.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===sH}function aH(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function lH(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const _T=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ST=ML,a2=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ST(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const h=r==null?void 0:r[c],d=s==null?void 0:s[c];if(h===null)return null;const g=_T(h)||_T(d);return i[c][g]}),a=r&&Object.entries(r).reduce((c,h)=>{let[d,g]=h;return g===void 0||(c[d]=g),c},{}),l=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,h)=>{let{class:d,className:g,...p}=h;return Object.entries(p).every(m=>{let[y,x]=m;return Array.isArray(x)?x.includes({...s,...a}[y]):{...s,...a}[y]===x})?[...c,d,g]:c},[]);return ST(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)},l2=a2("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Dt({className:t,variant:e,size:r,asChild:n=!1,...i}){const s=n?o2:"button";return T.jsx(s,{className:Ue(l2({variant:e,size:r,className:t})),...i})}function mn(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function cH(t,e){const r=B.createContext(e),n=s=>{const{children:o,...a}=s,l=B.useMemo(()=>a,Object.values(a));return T.jsx(r.Provider,{value:l,children:o})};n.displayName=t+"Provider";function i(s){const o=B.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[n,i]}function ky(t,e=[]){let r=[];function n(s,o){const a=B.createContext(o),l=r.length;r=[...r,o];const c=d=>{var C;const{scope:g,children:p,...m}=d,y=((C=g==null?void 0:g[t])==null?void 0:C[l])||a,x=B.useMemo(()=>m,Object.values(m));return T.jsx(y.Provider,{value:x,children:p})};c.displayName=s+"Provider";function h(d,g){var y;const p=((y=g==null?void 0:g[t])==null?void 0:y[l])||a,m=B.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,h]}const i=()=>{const s=r.map(o=>B.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return B.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,uH(i,...e)]}function uH(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return B.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}var Ql=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},hH=Xv[" useInsertionEffect ".trim().toString()]||Ql;function VL({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,o]=dH({defaultProp:e,onChange:r}),a=t!==void 0,l=a?t:i;{const h=B.useRef(t!==void 0);B.useEffect(()=>{const d=h.current;d!==a&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=a},[a,n])}const c=B.useCallback(h=>{var d;if(a){const g=fH(h)?h(t):h;g!==t&&((d=o.current)==null||d.call(o,g))}else s(h)},[a,t,s,o]);return[l,c]}function dH({defaultProp:t,onChange:e}){const[r,n]=B.useState(t),i=B.useRef(r),s=B.useRef(e);return hH(()=>{s.current=e},[e]),B.useEffect(()=>{var o;i.current!==r&&((o=s.current)==null||o.call(s,r),i.current=r)},[r,i]),[r,n,s]}function fH(t){return typeof t=="function"}var c2=dL();const GL=dh(c2);function KL(t){const e=pH(t),r=B.forwardRef((n,i)=>{const{children:s,...o}=n,a=B.Children.toArray(s),l=a.find(mH);if(l){const c=l.props.children,h=a.map(d=>d===l?B.Children.count(c)>1?B.Children.only(null):B.isValidElement(c)?c.props.children:null:d);return T.jsx(e,{...o,ref:i,children:B.isValidElement(c)?B.cloneElement(c,void 0,h):null})}return T.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function pH(t){const e=B.forwardRef((r,n)=>{const{children:i,...s}=r;if(B.isValidElement(i)){const o=bH(i),a=yH(s,i.props);return i.type!==B.Fragment&&(a.ref=n?Wa(n,o):o),B.cloneElement(i,a)}return B.Children.count(i)>1?B.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var YL=Symbol("radix.slottable");function gH(t){const e=({children:r})=>T.jsx(T.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=YL,e}function mH(t){return B.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===YL}function yH(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function bH(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var xH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yn=xH.reduce((t,e)=>{const r=KL(`Primitive.${e}`),n=B.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function CH(t,e){t&&c2.flushSync(()=>t.dispatchEvent(e))}function kH(t,e){return B.useReducer((r,n)=>e[r][n]??r,t)}var zo=t=>{const{present:e,children:r}=t,n=vH(e),i=typeof r=="function"?r({present:n.isPresent}):B.Children.only(r),s=Nn(n.ref,wH(i));return typeof r=="function"||n.isPresent?B.cloneElement(i,{ref:s}):null};zo.displayName="Presence";function vH(t){const[e,r]=B.useState(),n=B.useRef(null),i=B.useRef(t),s=B.useRef("none"),o=t?"mounted":"unmounted",[a,l]=kH(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const c=yg(n.current);s.current=a==="mounted"?c:"none"},[a]),Ql(()=>{const c=n.current,h=i.current;if(h!==t){const g=s.current,p=yg(c);t?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(h&&g!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Ql(()=>{if(e){let c;const h=e.ownerDocument.defaultView??window,d=p=>{const y=yg(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&y&&(l("ANIMATION_END"),!i.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",c=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},g=p=>{p.target===e&&(s.current=yg(n.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{h.clearTimeout(c),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:B.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function yg(t){return(t==null?void 0:t.animationName)||"none"}function wH(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var _H=Xv[" useId ".trim().toString()]||(()=>{}),SH=0;function Vs(t){const[e,r]=B.useState(_H());return Ql(()=>{r(n=>n??String(SH++))},[t]),t||(e?`radix-${e}`:"")}var vy="Collapsible",[EH]=ky(vy),[TH,u2]=EH(vy),XL=B.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=VL({prop:n,defaultProp:i??!1,onChange:o,caller:vy});return T.jsx(TH,{scope:r,disabled:s,contentId:Vs(),open:l,onOpenToggle:B.useCallback(()=>c(h=>!h),[c]),children:T.jsx(yn.div,{"data-state":d2(l),"data-disabled":s?"":void 0,...a,ref:e})})});XL.displayName=vy;var ZL="CollapsibleTrigger",QL=B.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,i=u2(ZL,r);return T.jsx(yn.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":d2(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:e,onClick:mn(t.onClick,i.onOpenToggle)})});QL.displayName=ZL;var h2="CollapsibleContent",JL=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=u2(h2,t.__scopeCollapsible);return T.jsx(zo,{present:r||i.open,children:({present:s})=>T.jsx(AH,{...n,ref:e,present:s})})});JL.displayName=h2;var AH=B.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:i,...s}=t,o=u2(h2,r),[a,l]=B.useState(n),c=B.useRef(null),h=Nn(e,c),d=B.useRef(0),g=d.current,p=B.useRef(0),m=p.current,y=o.open||a,x=B.useRef(y),C=B.useRef(void 0);return B.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),Ql(()=>{const v=c.current;if(v){C.current=C.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();d.current=_.height,p.current=_.width,x.current||(v.style.transitionDuration=C.current.transitionDuration,v.style.animationName=C.current.animationName),l(n)}},[o.open,n]),T.jsx(yn.div,{"data-state":d2(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...s,ref:h,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:y&&i})});function d2(t){return t?"open":"closed"}var MH=XL,eB=JL;const NH=MH,LH=QL,tB=B.forwardRef(({className:t,children:e,...r},n)=>T.jsx(eB,{ref:n,className:Ue("overflow-hidden","data-[state=closed]:h-0 data-[state=open]:h-auto","transition-[height] duration-200 ease-out",t),...r,children:e}));tB.displayName=eB.displayName;B.createContext(void 0);const BH=({className:t,...e})=>T.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ue("relative flex w-full min-w-0 flex-col p-2",t),...e}),OH=({className:t,asChild:e=!1,...r})=>{const n=e?o2:"div";return T.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:Ue("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t),...r})},DH=({className:t,...e})=>T.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Ue("w-full text-sm",t),...e}),RH=({className:t,...e})=>T.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ue("flex w-full min-w-0 flex-col gap-1",t),...e}),lm=({className:t,...e})=>T.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ue("group/menu-item relative",t),...e}),IH=a2("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),ET=({asChild:t=!1,isActive:e=!1,variant:r="default",size:n="default",tooltip:i,className:s,...o})=>{const a=t?o2:"button";return T.jsx(a,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":e,className:Ue(IH({variant:r,size:n}),s),...o})},FH=({className:t,...e})=>T.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:Ue("ml-3 flex min-w-0 flex-col gap-1 border-l border-sidebar-border pl-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...e});function Gi(t){const e=B.useRef(t);return B.useEffect(()=>{e.current=t}),B.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function PH(t,e=globalThis==null?void 0:globalThis.document){const r=Gi(t);B.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var $H="DismissableLayer",tk="dismissableLayer.update",zH="dismissableLayer.pointerDownOutside",jH="dismissableLayer.focusOutside",TT,rB=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nB=B.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=B.useContext(rB),[h,d]=B.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=B.useState({}),m=Nn(e,E=>d(E)),y=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),C=y.indexOf(x),v=h?y.indexOf(h):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,M=v>=C,L=qH(E=>{const O=E.target,I=[...c.branches].some($=>$.contains(O));!M||I||(i==null||i(E),o==null||o(E),E.defaultPrevented||a==null||a())},g),N=UH(E=>{const O=E.target;[...c.branches].some($=>$.contains(O))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},g);return PH(E=>{v===c.layers.size-1&&(n==null||n(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},g),B.useEffect(()=>{if(h)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(TT=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(h)),c.layers.add(h),AT(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=TT)}},[h,g,r,c]),B.useEffect(()=>()=>{h&&(c.layers.delete(h),c.layersWithOutsidePointerEventsDisabled.delete(h),AT())},[h,c]),B.useEffect(()=>{const E=()=>p({});return document.addEventListener(tk,E),()=>document.removeEventListener(tk,E)},[]),T.jsx(yn.div,{...l,ref:m,style:{pointerEvents:_?M?"auto":"none":void 0,...t.style},onFocusCapture:mn(t.onFocusCapture,N.onFocusCapture),onBlurCapture:mn(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:mn(t.onPointerDownCapture,L.onPointerDownCapture)})});nB.displayName=$H;var HH="DismissableLayerBranch",WH=B.forwardRef((t,e)=>{const r=B.useContext(rB),n=B.useRef(null),i=Nn(e,n);return B.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),T.jsx(yn.div,{...t,ref:i})});WH.displayName=HH;function qH(t,e=globalThis==null?void 0:globalThis.document){const r=Gi(t),n=B.useRef(!1),i=B.useRef(()=>{});return B.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){iB(zH,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function UH(t,e=globalThis==null?void 0:globalThis.document){const r=Gi(t),n=B.useRef(!1);return B.useEffect(()=>{const i=s=>{s.target&&!n.current&&iB(jH,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function AT(){const t=new CustomEvent(tk);document.dispatchEvent(t)}function iB(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?CH(i,s):i.dispatchEvent(s)}var ux="focusScope.autoFocusOnMount",hx="focusScope.autoFocusOnUnmount",MT={bubbles:!1,cancelable:!0},VH="FocusScope",sB=B.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=B.useState(null),c=Gi(i),h=Gi(s),d=B.useRef(null),g=Nn(e,y=>l(y)),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(n){let y=function(_){if(p.paused||!a)return;const M=_.target;a.contains(M)?d.current=M:ba(d.current,{select:!0})},x=function(_){if(p.paused||!a)return;const M=_.relatedTarget;M!==null&&(a.contains(M)||ba(d.current,{select:!0}))},C=function(_){if(document.activeElement===document.body)for(const L of _)L.removedNodes.length>0&&ba(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",x);const v=new MutationObserver(C);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),v.disconnect()}}},[n,a,p.paused]),B.useEffect(()=>{if(a){LT.add(p);const y=document.activeElement;if(!a.contains(y)){const C=new CustomEvent(ux,MT);a.addEventListener(ux,c),a.dispatchEvent(C),C.defaultPrevented||(GH(QH(oB(a)),{select:!0}),document.activeElement===y&&ba(a))}return()=>{a.removeEventListener(ux,c),setTimeout(()=>{const C=new CustomEvent(hx,MT);a.addEventListener(hx,h),a.dispatchEvent(C),C.defaultPrevented||ba(y??document.body,{select:!0}),a.removeEventListener(hx,h),LT.remove(p)},0)}}},[a,c,h,p]);const m=B.useCallback(y=>{if(!r&&!n||p.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,C=document.activeElement;if(x&&C){const v=y.currentTarget,[_,M]=KH(v);_&&M?!y.shiftKey&&C===M?(y.preventDefault(),r&&ba(_,{select:!0})):y.shiftKey&&C===_&&(y.preventDefault(),r&&ba(M,{select:!0})):C===v&&y.preventDefault()}},[r,n,p.paused]);return T.jsx(yn.div,{tabIndex:-1,...o,ref:g,onKeyDown:m})});sB.displayName=VH;function GH(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(ba(n,{select:e}),document.activeElement!==r)return}function KH(t){const e=oB(t),r=NT(e,t),n=NT(e.reverse(),t);return[r,n]}function oB(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function NT(t,e){for(const r of t)if(!YH(r,{upTo:e}))return r}function YH(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function XH(t){return t instanceof HTMLInputElement&&"select"in t}function ba(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&XH(t)&&e&&t.select()}}var LT=ZH();function ZH(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=BT(t,e),t.unshift(e)},remove(e){var r;t=BT(t,e),(r=t[0])==null||r.resume()}}}function BT(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function QH(t){return t.filter(e=>e.tagName!=="A")}var JH="Portal",aB=B.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=B.useState(!1);Ql(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?GL.createPortal(T.jsx(yn.div,{...n,ref:e}),o):null});aB.displayName=JH;var dx=0;function eW(){B.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??OT()),document.body.insertAdjacentElement("beforeend",t[1]??OT()),dx++,()=>{dx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),dx--}},[])}function OT(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ws=function(){return Ws=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Ws.apply(this,arguments)};function lB(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function tW(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var cm="right-scroll-bar-position",um="width-before-scroll-bar",rW="with-scroll-bars-hidden",nW="--removed-body-scroll-bar-size";function fx(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function iW(t,e){var r=B.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=e,r.facade}var sW=typeof window<"u"?B.useLayoutEffect:B.useEffect,DT=new WeakMap;function oW(t,e){var r=iW(null,function(n){return t.forEach(function(i){return fx(i,n)})});return sW(function(){var n=DT.get(r);if(n){var i=new Set(n),s=new Set(t),o=r.current;i.forEach(function(a){s.has(a)||fx(a,null)}),s.forEach(function(a){i.has(a)||fx(a,o)})}DT.set(r,t)},[t]),r}function aW(t){return t}function lW(t,e){e===void 0&&(e=aW);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var o=e(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var l=function(){var h=o;o=[],h.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),r={push:function(h){o.push(h),c()},filter:function(h){return o=o.filter(h),r}}}};return i}function cW(t){t===void 0&&(t={});var e=lW(null);return e.options=Ws({async:!0,ssr:!1},t),e}var cB=function(t){var e=t.sideCar,r=lB(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return B.createElement(n,Ws({},r))};cB.isSideCarExport=!0;function uW(t,e){return t.useMedium(e),cB}var uB=cW(),px=function(){},wy=B.forwardRef(function(t,e){var r=B.useRef(null),n=B.useState({onScrollCapture:px,onWheelCapture:px,onTouchMoveCapture:px}),i=n[0],s=n[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,h=t.enabled,d=t.shards,g=t.sideCar,p=t.noRelative,m=t.noIsolation,y=t.inert,x=t.allowPinchZoom,C=t.as,v=C===void 0?"div":C,_=t.gapMode,M=lB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=g,N=oW([r,e]),E=Ws(Ws({},M),i);return B.createElement(B.Fragment,null,h&&B.createElement(L,{sideCar:uB,removeScrollBar:c,shards:d,noRelative:p,noIsolation:m,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:_}),o?B.cloneElement(B.Children.only(a),Ws(Ws({},E),{ref:N})):B.createElement(v,Ws({},E,{className:l,ref:N}),a))});wy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wy.classNames={fullWidth:um,zeroRight:cm};var hW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function dW(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=hW();return e&&t.setAttribute("nonce",e),t}function fW(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function pW(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var gW=function(){var t=0,e=null;return{add:function(r){t==0&&(e=dW())&&(fW(e,r),pW(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},mW=function(){var t=gW();return function(e,r){B.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},hB=function(){var t=mW(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},yW={left:0,top:0,right:0,gap:0},gx=function(t){return parseInt(t||"",10)||0},bW=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[gx(r),gx(n),gx(i)]},xW=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return yW;var e=bW(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},CW=hB(),vu="data-scroll-locked",kW=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),`
221
+ */const H7=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],W7=Xt("zoom-out",H7);let si=null,UC=new Set,VC="disconnected",GC=new Set;function ox(t){VC=t,GC.forEach(e=>e(t))}function KC(){if((si==null?void 0:si.readyState)===WebSocket.OPEN||(si==null?void 0:si.readyState)===WebSocket.CONNECTING)return;const e=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;ox("connecting");const r=new WebSocket(e);si=r,r.onopen=()=>{ox("connected")},r.onclose=()=>{si=null,ox("disconnected"),setTimeout(()=>KC(),3e3)},r.onerror=()=>{r.close()},r.onmessage=n=>{try{const i=JSON.parse(n.data);UC.forEach(s=>s(i))}catch{}}}function q7(t){const[e,r]=B.useState(VC);B.useEffect(()=>(UC.add(t),GC.add(r),r(VC),(!si||si.readyState!==WebSocket.OPEN&&si.readyState!==WebSocket.CONNECTING)&&KC(),()=>{UC.delete(t),GC.delete(r)}),[t]);const n=B.useCallback(()=>{si&&(si.close(),si=null),KC()},[]);return{status:e,reconnect:n}}function U7(t={}){const[e,r]=B.useState(""),[n,i]=B.useState(null),[s,o]=B.useState("idle"),a=B.useRef(null),l=B.useRef(""),c=B.useRef(null),h=B.useRef(void 0),d=B.useRef(t);d.current=t;const g=B.useCallback(async(C,v)=>{var _,M;h.current=v;try{const L=v?`/api/files${C}?root=${encodeURIComponent(v)}`:`/api/files${C}`,N=await fetch(L);if(!N.ok)throw new Error("Failed to load file");const E=await N.text();r(E),i(C),l.current=E,o("idle")}catch(L){(M=(_=d.current).onError)==null||M.call(_,L instanceof Error?L:new Error("Unknown error"),C)}},[]),p=B.useCallback(async(C,v=n,_)=>{var N,E,O,I,$,j;if(!v)return;const M=_??h.current,L=`${v}:${Date.now()}`;c.current=L,o("saving"),(E=(N=d.current).onSaveStart)==null||E.call(N,v,L);try{const ie=M?`/api/files${v}?root=${encodeURIComponent(M)}`:`/api/files${v}`;if(!(await fetch(ie,{method:"POST",body:C})).ok)throw new Error("Failed to save");o("saved"),l.current=C,(I=(O=d.current).onSave)==null||I.call(O,v)}catch(ie){o("error"),(j=($=d.current).onError)==null||j.call($,ie instanceof Error?ie:new Error("Unknown error"),v)}},[n]),m=B.useCallback((C,v=300)=>{r(C),o("idle"),a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{p(C)},v)},[p]),y=e!==l.current,x=B.useCallback(()=>c.current,[]);return{content:e,path:n,status:s,isDirty:y,load:g,save:p,updateContent:m,setContent:r,setPath:i,getSaveSession:x}}const V7="modulepreload",G7=function(t){return"/"+t},iT={},Bt=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(h=>Promise.resolve(h).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(r.map(c=>{if(c=G7(c),c in iT)return;iT[c]=!0;const h=c.endsWith(".css"),d=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":V7,h||(g.as="script"),g.crossOrigin="",g.href=c,l&&g.setAttribute("nonce",l),document.head.appendChild(g),h)return new Promise((p,m)=>{g.addEventListener("load",p),g.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var qe;function cn(t,e,r){const n=typeof r,i=typeof t;if(n!=="undefined"){if(i!=="undefined"){if(r){if(i==="function"&&n===i)return function(a){return t(r(a))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var s=new Map(r);for(var o of t)s.set(o[0],o[1]);return s}if(e===Set){o=new Set(r);for(s of t.values())o.add(s);return o}}}return t}return r}return i==="undefined"?e:t}function Xc(t,e){return typeof t>"u"?e:t}function Br(){return Object.create(null)}function ms(t){return typeof t=="string"}function Jd(t){return typeof t=="object"}function ef(t,e){if(ms(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}const K7=/[^\p{L}\p{N}]+/u,Y7=/(\d{3})/g,X7=/(\D)(\d{3})/g,Z7=/(\d{3})(\D)/g,sT=/[\u0300-\u036f]/g;function tf(t={}){if(!this||this.constructor!==tf)return new tf(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}qe=tf.prototype;qe.assign=function(t){this.normalize=cn(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let i="";n=!e,e||(i+="\\p{Z}"),r.letter&&(i+="\\p{L}"),r.number&&(i+="\\p{N}",n=!!e),r.symbol&&(i+="\\p{S}"),r.punctuation&&(i+="\\p{P}"),r.control&&(i+="\\p{C}"),(r=r.char)&&(i+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+i+"]+","u")}catch{this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=cn(t.numeric,n)}else{try{this.split=cn(this.split,K7)}catch{this.split=/\s+/}this.numeric=cn(t.numeric,cn(this.numeric,!0))}if(this.prepare=cn(t.prepare,null,this.prepare),this.finalize=cn(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:cn(r&&new Set(r),null,this.filter),this.dedupe=cn(t.dedupe,!0,this.dedupe),this.matcher=cn((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=cn((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=cn((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=cn(t.replacer,null,this.replacer),this.minlength=cn(t.minlength,1,this.minlength),this.maxlength=cn(t.maxlength,1024,this.maxlength),this.rtl=cn(t.rtl,!1,this.rtl),(this.cache=r=cn(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const i of this.matcher.keys())this.h+=(this.h?"|":"")+i;if(this.stemmer)for(const i of this.stemmer.keys())this.A+=(this.A?"|":"")+i;return this};qe.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&Xl(this),this};qe.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&Xl(this),this};qe.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&Xl(this),this)};qe.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&Xl(this),this)};qe.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&Xl(this),this)};qe.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(Xl,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=sT?t.normalize("NFKD").replace(sT,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(X7,"$1 $2").replace(Z7,"$1 $2").replace(Y7,"$1 "));const r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n=[],i=Br(),s,o,a=this.split||this.split===""?t.split(this.split):[t];for(let c=0,h,d;c<a.length;c++)if((h=d=a[c])&&!(h.length<this.minlength||h.length>this.maxlength)){if(e){if(i[h])continue;i[h]=1}else{if(s===h)continue;s=h}if(r)n.push(h);else if(!this.filter||(typeof this.filter=="function"?this.filter(h):!this.filter.has(h))){if(this.cache&&h.length<=this.I)if(this.F){var l=this.D.get(h);if(l||l===""){l&&n.push(l);continue}}else this.F=setTimeout(Xl,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let g;for(;g!==h&&h.length>2;)g=h,h=h.replace(this.K,p=>this.stemmer.get(p))}if(h&&(this.mapper||this.dedupe&&h.length>1)){l="";for(let g=0,p="",m,y;g<h.length;g++)m=h.charAt(g),m===p&&this.dedupe||((y=this.mapper&&this.mapper.get(m))||y===""?y===p&&this.dedupe||!(p=y)||(l+=y):l+=p=m);h=l}if(this.matcher&&h.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),h=h.replace(this.J,g=>this.matcher.get(g))),h&&this.replacer)for(l=0;h&&l<this.replacer.length;l+=2)h=h.replace(this.replacer[l],this.replacer[l+1]);if(this.cache&&d.length<=this.I&&(this.D.set(d,h),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),h){if(h!==d)if(e){if(i[h])continue;i[h]=1}else{if(o===h)continue;o=h}n.push(h)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};function Xl(t){t.F=null,t.B.clear(),t.D.clear()}function Qv(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new mc);let i=this.cache.get(t+n);if(!i){const s=r&&r.cache;s&&(r.cache=!1),i=this.search(t,e,r),s&&(r.cache=s),this.cache.set(t+n,i)}return i}function mc(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}mc.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};mc.prototype.get=function(t){const e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};mc.prototype.remove=function(t){for(const e of this.cache){const r=e[0];e[1].includes(t)&&this.cache.delete(r)}};mc.prototype.clear=function(){this.cache.clear(),this.h=""};const oT={normalize:!1,numeric:!1,dedupe:!1},dg={},ax=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),aT=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),lT=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],cT={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var yL={Exact:oT,Default:dg,Normalize:dg,LatinBalance:{mapper:ax},LatinAdvanced:{mapper:ax,matcher:aT,replacer:lT},LatinExtra:{mapper:ax,replacer:lT.concat([/(?!^)[aeo]/g,""]),matcher:aT},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),i=cT[n];for(let s=1,o;s<e.length&&(o=e.charAt(s),o==="h"||o==="w"||!(o=cT[o])||o===i||(n+=o,i=o,n.length!==4));s++);t[r]=n}}},CJK:{split:""},LatinExact:oT,LatinDefault:dg,LatinSimple:dg};function uT(t,e,r,n){let i=[];for(let s=0,o;s<t.index.length;s++)if(o=t.index[s],e>=o.length)e-=o.length;else{e=o[n?"splice":"slice"](e,r);const a=e.length;if(a&&(i=i.length?i.concat(e):e,r-=a,n&&(t.length-=a),!r))break;e=0}return i}function Uu(t){if(!this||this.constructor!==Uu)return new Uu(t);this.index=t?[t]:[],this.length=t?t.length:0;const e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(i){e.index[e.index.length-1].push(i),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(i){let s=0;for(let o=0,a,l;o<e.index.length;o++){if(a=e.index[o],l=a.indexOf(i),l>=0)return s+l;s+=a.length}return-1};if(n==="includes")return function(i){for(let s=0;s<e.index.length;s++)if(e.index[s].includes(i))return!0;return!1};if(n==="slice")return function(i,s){return uT(e,i||0,s||e.length,!1)};if(n==="splice")return function(i,s){return uT(e,i||0,s||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/2**31|0])&&r[n]},set(r,n,i){return r=n/2**31|0,(e.index[r]||(e.index[r]=[]))[n]=i,e.length++,!0}})}Uu.prototype.clear=function(){this.index.length=0};Uu.prototype.push=function(){};function ys(t=8){if(!this||this.constructor!==ys)return new ys(t);this.index=Br(),this.h=[],this.size=0,t>32?(this.B=xL,this.A=BigInt(t)):(this.B=bL,this.A=t)}ys.prototype.get=function(t){const e=this.index[this.B(t)];return e&&e.get(t)};ys.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};function Cs(t=8){if(!this||this.constructor!==Cs)return new Cs(t);this.index=Br(),this.h=[],this.size=0,t>32?(this.B=xL,this.A=BigInt(t)):(this.B=bL,this.A=t)}Cs.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};qe=ys.prototype;qe.has=Cs.prototype.has=function(t){const e=this.index[this.B(t)];return e&&e.has(t)};qe.delete=Cs.prototype.delete=function(t){const e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};qe.clear=Cs.prototype.clear=function(){this.index=Br(),this.h=[],this.size=0};qe.values=Cs.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};qe.keys=Cs.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};qe.entries=Cs.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};function bL(t){let e=2**this.A-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let i=0;i<t.length;i++)r=(r*n^t.charCodeAt(i))&e;return this.A===32?r+2**31:r}function xL(t){let e=BigInt(2)**this.A-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let i=0;i<t.length;i++)r=(r*n^BigInt(t.charCodeAt(i)))&e;return r}let Zc,td;async function Q7(t){t=t.data;var e=t.task;const r=t.id;let n=t.args;switch(e){case"init":td=t.options||{},(e=t.factory)?(Function("return "+e)()(self),Zc=new self.FlexSearch.Index(td),delete self.FlexSearch):Zc=new Ks(td),postMessage({id:r});break;default:let i;e==="export"&&(n[1]?(n[0]=td.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=await td.import.call(Zc,n[0]),Zc.import(n[0],t)):((i=n&&Zc[e].apply(Zc,n))&&i.then&&(i=await i),i&&i.await&&(i=await i.await),e==="search"&&i.result&&(i=i.result)),postMessage(e==="search"?{id:r,msg:i}:{id:r})}}function Jv(t){Qc.call(t,"add"),Qc.call(t,"append"),Qc.call(t,"search"),Qc.call(t,"update"),Qc.call(t,"remove"),Qc.call(t,"searchCache")}let YC,hT,om;function J7(){YC=om=0}function Qc(t){this[t+"Async"]=function(){const e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),YC?om||(om=Date.now()-hT>=this.priority*this.priority*3):(YC=setTimeout(J7,0),hT=Date.now()),om){const s=this;return new Promise(o=>{setTimeout(function(){o(s[t+"Async"].apply(s,e))},0)})}const i=this[t].apply(this,e);return r=i.then?i:new Promise(s=>s(i)),n&&r.then(n),r}}let Na=0;function Vu(t={},e){function r(a){function l(c){c=c.data||c;const h=c.id,d=h&&s.h[h];d&&(d(c.msg),delete s.h[h])}if(this.worker=a,this.h=Br(),this.worker)return i?this.worker.on("message",l):this.worker.onmessage=l,t.config?new Promise(function(c){Na>1e9&&(Na=0),s.h[++Na]=function(){c(s)},s.worker.postMessage({id:Na,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==Vu)return new Vu(t);let n=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;n&&(n=n.toString());const i=typeof window>"u",s=this,o=ej(n,i,t.worker);return o.then?o.then(function(a){return r.call(s,a)}):r.call(this,o)}Ja("add");Ja("append");Ja("search");Ja("update");Ja("remove");Ja("clear");Ja("export");Ja("import");Vu.prototype.searchCache=Qv;Jv(Vu.prototype);function Ja(t){Vu.prototype[t]=function(){const e=this,r=[].slice.call(arguments);var n=r[r.length-1];let i;return typeof n=="function"&&(i=n,r.pop()),n=new Promise(function(s){t==="export"&&typeof r[0]=="function"&&(r[0]=null),Na>1e9&&(Na=0),e.h[++Na]=s,e.worker.postMessage({task:t,id:Na,args:r})}),i?(n.then(i),this):n}}function ej(t,e,r){return e?typeof module<"u"?new(require("worker_threads")).Worker(__dirname+"/worker/node.js"):Bt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).then(function(n){return new n.Worker(import.meta.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Q7.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}Zl.prototype.add=function(t,e,r){if(Jd(t)&&(e=t,t=ef(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let a=0,l;a<this.field.length;a++){l=this.B[a];var n=this.index.get(this.field[a]);if(typeof l=="function"){var i=l(e);i&&n.add(t,i,r,!0)}else i=l.G,(!i||i(e))&&(l.constructor===String?l=[""+l]:ms(l)&&(l=[l]),ZC(e,l,this.D,0,n,t,l[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];i=this.tag.get(this.F[n]);let a=Br();if(typeof s=="function"){if(s=s(e),!s)continue}else{var o=s.G;if(o&&!o(e))continue;s.constructor===String&&(s=""+s),s=ef(e,s)}if(i&&s){ms(s)&&(s=[s]);for(let l=0,c,h;l<s.length;l++)if(c=s[l],!a[c]&&(a[c]=1,(o=i.get(c))?h=o:i.set(c,h=[]),!r||!h.includes(t))){if(h.length===2**31-1){if(o=new Uu(h),this.fastupdate)for(let d of this.reg.values())d.includes(h)&&(d[d.indexOf(h)]=o);i.set(c,h=o)}h.push(t),this.fastupdate&&((o=this.reg.get(t))?o.push(h):this.reg.set(t,[h]))}}}if(this.store&&(!r||!this.store.has(t))){let a;if(this.h){a=Br();for(let l=0,c;l<this.h.length;l++){if(c=this.h[l],(r=c.G)&&!r(e))continue;let h;if(typeof c=="function"){if(h=c(e),!h)continue;c=[c.O]}else if(ms(c)||c.constructor===String){a[c]=e[c];continue}XC(e,a,c,0,c[0],h)}}this.store.set(t,a||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};function XC(t,e,r,n,i,s){if(t=t[i],n===r.length-1)e[i]=s||t;else if(t)if(t.constructor===Array)for(e=e[i]=Array(t.length),i=0;i<t.length;i++)XC(t,e,r,n,i);else e=e[i]||(e[i]=Br()),i=r[++n],XC(t,e,r,n,i)}function ZC(t,e,r,n,i,s,o,a){if(t=t[o])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)i.add(s,t[e],!0,!0);return}t=t.join(" ")}i.add(s,t,a,!0)}else if(t.constructor===Array)for(o=0;o<t.length;o++)ZC(t,e,r,n,i,s,o,a);else o=e[++n],ZC(t,e,r,n,i,s,o,a)}function e2(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?ku.call(this,t):t;let i=[];for(let s=0,o,a;s<t.length;s++)if((o=t[s])&&(a=o.length)){if(r){if(r>=a){r-=a;continue}o=o.slice(r,r+e),a=o.length,r=0}if(a>e&&(o=o.slice(0,e),a=e),!i.length&&a>=e)return n?ku.call(this,o):o;if(i.push(o),e-=a,!e)break}return i=i.length>1?[].concat.apply([],i):i[0],n?ku.call(this,i):i}function Cy(t,e,r,n){var i=n[0];if(i[0]&&i[0].query)return t[e].apply(t,i);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||i.suggest))return n.length>1&&(i=n[n.length-1]),(n=i.resolve)?t.await||t.result:t;let s=[],o=0,a=0,l,c,h,d,g;for(e=0;e<n.length;e++)if(i=n[e]){var p=void 0;if(i.constructor===lr)p=i.await||i.result;else if(i.then||i.constructor===Array)p=i;else{o=i.limit||0,a=i.offset||0,h=i.suggest,c=i.resolve,l=((d=i.highlight||t.highlight)||i.enrich)&&c,p=i.queue;let m=i.async||p,y=i.index,x=i.query;if(y?t.index||(t.index=y):y=t.index,x||i.tag){const C=i.field||i.pluck;if(C&&(!x||t.query&&!d||(t.query=x,t.field=C,t.highlight=d),y=y.index.get(C)),p&&(g||t.await)){g=1;let v;const _=t.C.length,M=new Promise(function(L){v=L});(function(L,N){M.h=function(){N.index=null,N.resolve=!1;let E=m?L.searchAsync(N):L.search(N);return E.then?E.then(function(O){return t.C[_]=O=O.result||O,v(O),O}):(E=E.result||E,v(E),E)}})(y,Object.assign({},i)),t.C.push(M),s[e]=M;continue}else i.resolve=!1,i.index=null,p=m?y.searchAsync(i):y.search(i),i.resolve=c,i.index=y}else if(i.and)p=fg(i,"and",y);else if(i.or)p=fg(i,"or",y);else if(i.not)p=fg(i,"not",y);else if(i.xor)p=fg(i,"xor",y);else continue}p.await?(g=1,p=p.await):p.then?(g=1,p=p.then(function(m){return m.result||m})):p=p.result||p,s[e]=p}if(g&&!t.await&&(t.await=new Promise(function(m){t.return=m})),g){const m=Promise.all(s).then(function(y){for(let x=0;x<t.C.length;x++)if(t.C[x]===m){t.C[x]=function(){return r.call(t,y,o,a,l,c,h,d)};break}t2(t)});t.C.push(m)}else if(t.await)t.C.push(function(){return r.call(t,s,o,a,l,c,h,d)});else return r.call(t,s,o,a,l,c,h,d);return c?t.await||t.result:t}function fg(t,e,r){t=t[e];const n=t[0]||t;return n.index||(n.index=r),r=new lr(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}lr.prototype.or=function(){return Cy(this,"or",tj,arguments)};function tj(t,e,r,n,i,s,o){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=CL(t,e,r,!1,this.h),r=0)),i&&(this.await=null),i?this.resolve(e,r,n,o):this}lr.prototype.and=function(){return Cy(this,"and",rj,arguments)};function rj(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;let a;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let l=0;for(let c=0,h,d;c<t.length;c++)if((h=t[c])&&(d=h.length))l<d&&(l=d);else if(!s){l=0;break}l?(this.result=Om(t,l,e,r,s,this.h,i),a=!0):this.result=[]}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}lr.prototype.xor=function(){return Cy(this,"xor",nj,arguments)};function nj(t,e,r,n,i,s,o){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{s=r;var a=this.h;const l=[],c=Br();let h=0;for(let d=0,g;d<t.length;d++)if(g=t[d]){h<g.length&&(h=g.length);for(let p=0,m;p<g.length;p++)if(m=g[p])for(let y=0,x;y<m.length;y++)x=m[y],c[x]=c[x]?2:1}for(let d=0,g,p=0;d<h;d++)for(let m=0,y;m<t.length;m++)if((y=t[m])&&(g=y[d])){for(let x=0,C;x<g.length;x++)if(C=g[x],c[C]===1)if(s)s--;else if(i){if(l.push(C),l.length===e){t=l;break e}}else{const v=d+(m?a:0);if(l[v]||(l[v]=[]),l[v].push(C),++p===e){t=l;break e}}}t=l}this.result=t,a=!0}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}lr.prototype.not=function(){return Cy(this,"not",ij,arguments)};function ij(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;if(t.length&&this.result.length){e:{s=r;var a=[];t=new Set(t.flat().flat());for(let l=0,c,h=0;l<this.result.length;l++)if(c=this.result[l]){for(let d=0,g;d<c.length;d++)if(g=c[d],!t.has(g)){if(s)s--;else if(i){if(a.push(g),a.length===e){t=a;break e}}else if(a[l]||(a[l]=[]),a[l].push(g),++h===e){t=a;break e}}}t=a}this.result=t,a=!0}return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}function am(t,e,r,n,i){let s,o,a;typeof i=="string"?(s=i,i=""):s=i.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let l=i&&i.boundary,c=!i||i.clip!==!1,h=i&&i.merge&&a&&o&&new RegExp(a+" "+o,"g");i=i&&i.ellipsis;var d=0;if(typeof i=="object"){var g=i.template;d=g.length-2,i=i.pattern}typeof i!="string"&&(i=i===!1?"":"..."),d&&(i=g.replace("$1",i)),g=i.length-d;let p,m;typeof l=="object"&&(p=l.before,p===0&&(p=-1),m=l.after,m===0&&(m=-1),l=l.total||9e5),d=new Map;for(let Q=0,F,K,U;Q<e.length;Q++){let P;if(n)P=e,U=n;else{var y=e[Q];if(U=y.field,!U)continue;P=y.result}K=r.get(U),F=K.encoder,y=d.get(F),typeof y!="string"&&(y=F.encode(t),d.set(F,y));for(let z=0;z<P.length;z++){var x=P[z].doc;if(!x||(x=ef(x,U),!x))continue;var C=x.trim().split(/\s+/);if(!C.length)continue;x="";var v=[];let oe=[];for(var _=-1,M=-1,L=0,N=0;N<C.length;N++){var E=C[N],O=F.encode(E);O=O.length>1?O.join(" "):O[0];let re;if(O&&E){for(var I=E.length,$=(F.split?E.replace(F.split,""):E).length-O.length,j="",ie=0,J=0;J<y.length;J++){var G=y[J];if(G){var H=G.length;H+=$<0?0:$,ie&&H<=ie||(G=O.indexOf(G),G>-1&&(j=(G?E.substring(0,G):"")+o+E.substring(G,G+H)+a+(G+H<I?E.substring(G+H):""),ie=H,re=!0))}}j&&(l&&(_<0&&(_=x.length+(x?1:0)),M=x.length+(x?1:0)+j.length,L+=I,oe.push(v.length),v.push({match:j})),x+=(x?" ":"")+j)}if(!re)E=C[N],x+=(x?" ":"")+E,l&&v.push({text:E});else if(l&&L>=l)break}if(L=oe.length*(s.length-2),p||m||l&&x.length-L>l)if(L=l+L-g*2,N=M-_,p>0&&(N+=p),m>0&&(N+=m),N<=L)C=p?_-(p>0?p:0):_-((L-N)/2|0),v=m?M+(m>0?m:0):C+L,c||(C>0&&x.charAt(C)!==" "&&x.charAt(C-1)!==" "&&(C=x.indexOf(" ",C),C<0&&(C=0)),v<x.length&&x.charAt(v-1)!==" "&&x.charAt(v)!==" "&&(v=x.lastIndexOf(" ",v),v<M?v=M:++v)),x=(C?i:"")+x.substring(C,v)+(v<x.length?i:"");else{for(M=[],_={},L={},N={},E={},O={},j=$=I=0,J=ie=1;;){var V=void 0;for(let re=0,ee;re<oe.length;re++){if(ee=oe[re],j)if($!==j){if(N[re+1])continue;if(ee+=j,_[ee]){I-=g,L[re+1]=1,N[re+1]=1;continue}if(ee>=v.length-1){if(ee>=v.length){N[re+1]=1,ee>=C.length&&(L[re+1]=1);continue}I-=g}if(x=v[ee].text,H=m&&O[re])if(H>0){if(x.length>H)if(N[re+1]=1,c)x=x.substring(0,H);else continue;(H-=x.length)||(H=-1),O[re]=H}else{N[re+1]=1;continue}if(I+x.length+1<=l)x=" "+x,M[re]+=x;else if(c)V=l-I-1,V>0&&(x=" "+x.substring(0,V),M[re]+=x),N[re+1]=1;else{N[re+1]=1;continue}}else{if(N[re])continue;if(ee-=$,_[ee]){I-=g,N[re]=1,L[re]=1;continue}if(ee<=0){if(ee<0){N[re]=1,L[re]=1;continue}I-=g}if(x=v[ee].text,H=p&&E[re])if(H>0){if(x.length>H)if(N[re]=1,c)x=x.substring(x.length-H);else continue;(H-=x.length)||(H=-1),E[re]=H}else{N[re]=1;continue}if(I+x.length+1<=l)x+=" ",M[re]=x+M[re];else if(c)V=x.length+1-(l-I),V>=0&&V<x.length&&(x=x.substring(V)+" ",M[re]=x+M[re]),N[re]=1;else{N[re]=1;continue}}else{x=v[ee].match,p&&(E[re]=p),m&&(O[re]=m),re&&I++;let fe;if(ee?!re&&g&&(I+=g):(L[re]=1,N[re]=1),ee>=C.length-1||ee<v.length-1&&v[ee+1].match?fe=1:g&&(I+=g),I-=s.length-2,!re||I+x.length<=l)M[re]=x;else{V=ie=J=L[re]=0;break}fe&&(L[re+1]=1,N[re+1]=1)}I+=x.length,V=_[ee]=1}if(V)$===j?j++:$++;else{if($===j?ie=0:J=0,!ie&&!J)break;ie?($++,j=$):j++}}x="";for(let re=0,ee;re<M.length;re++)ee=(L[re]?re?" ":"":(re&&!i?" ":"")+i)+M[re],x+=ee;i&&!L[M.length]&&(x+=i)}h&&(x=x.replace(h," ")),P[z].highlight=x}if(n)break}return e}function lr(t,e){if(!this||this.constructor!==lr)return new lr(t,e);let r=0,n,i,s,o,a,l;if(t&&t.index){const c=t;if(e=c.index,r=c.boost||0,i=c.query){s=c.field||c.pluck,o=c.highlight;const h=c.resolve;t=c.async||c.queue,c.resolve=!1,c.index=null,t=t?e.searchAsync(c):e.search(c),c.resolve=h,c.index=e,t=t.result||t}else t=[]}if(t&&t.then){const c=this;t=t.then(function(h){c.C[0]=c.result=h.result||h,t2(c)}),n=[t],t=[],a=new Promise(function(h){l=h})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=a||null,this.return=l||null,this.highlight=o||null,this.query=i||"",this.field=s||""}qe=lr.prototype;qe.limit=function(t){if(this.await){const e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){const e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};qe.offset=function(t){if(this.await){const e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){const e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};qe.boost=function(t){if(this.await){const e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};function t2(t,e){let r=t.result;var n=t.await;t.await=null;for(let i=0,s;i<t.C.length;i++)if(s=t.C[i]){if(typeof s=="function")r=s(),t.C[i]=r=r.result||r,i--;else if(s.h)r=s.h(),t.C[i]=r=r.result||r,i--;else if(s.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}qe.resolve=function(t,e,r,n,i){let s=this.await?t2(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(t,e,r,n,i)})}return s.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),s=i?r?ku.call(this.index,s):s:e2.call(this.index,s,t||100,e,r)),this.finalize(s,n)};qe.finalize=function(t,e){if(t.then){const n=this;return t.then(function(i){return n.finalize(i,e)})}e&&t.length&&this.query&&(t=am(this.query,t,this.index.index,this.field,e));const r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};function Om(t,e,r,n,i,s,o){const a=t.length;let l=[],c,h;c=Br();for(let d=0,g,p,m,y;d<e;d++)for(let x=0;x<a;x++)if(m=t[x],d<m.length&&(g=m[d]))for(let C=0;C<g.length;C++){if(p=g[C],(h=c[p])?c[p]++:(h=0,c[p]=1),y=l[h]||(l[h]=[]),!o){let v=d+(x||!i?0:s||0);y=y[v]||(y[v]=[])}if(y.push(p),o&&r&&h===a-1&&y.length-n===r)return n?y.slice(n):y}if(t=l.length)if(i)l=l.length>1?CL(l,r,n,o,s):(l=l[0])&&r&&l.length>r||n?l.slice(n,r+n):l;else{if(t<a)return[];if(l=l[t-1],r||n)if(o)(l.length>r||n)&&(l=l.slice(n,r+n));else{i=[];for(let d=0,g;d<l.length;d++)if(g=l[d]){if(n&&g.length>n)n-=g.length;else if((r&&g.length>r||n)&&(g=g.slice(n,r+n),r-=g.length,n&&(n-=g.length)),i.push(g),!r)break}l=i}}return l}function CL(t,e,r,n,i){const s=[],o=Br();let a;var l=t.length;let c;if(n){for(i=l-1;i>=0;i--)if(c=(n=t[i])&&n.length){for(l=0;l<c;l++)if(a=n[l],!o[a]){if(o[a]=1,r)r--;else if(s.push(a),s.length===e)return s}}}else for(let h=l-1,d,g=0;h>=0;h--){d=t[h];for(let p=0;p<d.length;p++)if(c=(n=d[p])&&n.length){for(let m=0;m<c;m++)if(a=n[m],!o[a])if(o[a]=1,r)r--;else{let y=(p+(h<l-1&&i||0))/(h+1)|0;if((s[y]||(s[y]=[])).push(a),++g===e)return s}}}return s}function sj(t,e,r,n,i){const s=Br(),o=[];for(let a=0,l;a<e.length;a++){l=e[a];for(let c=0;c<l.length;c++)s[l[c]]=1}if(i){for(let a=0,l;a<t.length;a++)if(l=t[a],s[l]){if(n)n--;else if(o.push(l),s[l]=0,r&&--r===0)break}}else for(let a=0,l,c;a<t.result.length;a++)for(l=t.result[a],e=0;e<l.length;e++)c=l[e],s[c]&&((o[a]||(o[a]=[])).push(c),s[c]=0);return o}Zl.prototype.search=function(t,e,r,n){r||(!e&&Jd(t)?(r=t,t=""):Jd(e)&&(r=e,e=0));let i=[];var s=[];let o,a,l,c,h,d,g=0,p=!0,m;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,o=r.pluck,a=r.merge,c=r.boost,d=o||r.field||(d=r.index)&&(d.index?null:d);var y=this.tag&&r.tag;l=r.suggest,p=r.resolve!==!1,h=r.cache,m=p&&this.store&&r.highlight;var x=!!m||p&&this.store&&r.enrich;e=r.limit||e;var C=r.offset||0;if(e||(e=p?100:0),y&&(!this.db||!n)){y.constructor!==Array&&(y=[y]);var v=[];for(let E=0,O;E<y.length;E++)if(O=y[E],O.field&&O.tag){var _=O.tag;if(_.constructor===Array)for(var M=0;M<_.length;M++)v.push(O.field,_[M]);else v.push(O.field,_)}else{_=Object.keys(O);for(let I=0,$,j;I<_.length;I++)if($=_[I],j=O[$],j.constructor===Array)for(M=0;M<j.length;M++)v.push($,j[M]);else v.push($,j)}if(y=v,!t){if(s=[],v.length)for(y=0;y<v.length;y+=2){if(this.db){if(n=this.index.get(v[y]),!n)continue;s.push(n=n.db.tag(v[y+1],e,C,x))}else n=oj.call(this,v[y],v[y+1],e,C,x);i.push(p?{field:v[y],tag:v[y+1],result:n}:[n])}if(s.length){const E=this;return Promise.all(s).then(function(O){for(let I=0;I<O.length;I++)p?i[I].result=O[I]:i[I]=O[I];return p?i:new lr(i.length>1?Om(i,1,0,0,l,c):i[0],E)})}return p?i:new lr(i.length>1?Om(i,1,0,0,l,c):i[0],this)}}p||o||!(d=d||this.field)||(ms(d)?o=d:(d.constructor===Array&&d.length===1&&(d=d[0]),o=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||(d=this.field);let L;v=(this.worker||this.db)&&!n&&[];for(let E=0,O,I,$;E<d.length;E++){if(I=d[E],this.db&&this.tag&&!this.B[E])continue;let j;if(ms(I)||(j=I,I=j.field,t=j.query||t,e=Xc(j.limit,e),C=Xc(j.offset,C),l=Xc(j.suggest,l),m=p&&this.store&&Xc(j.highlight,m),x=!!m||p&&this.store&&Xc(j.enrich,x),h=Xc(j.cache,h)),n)O=n[E];else{_=j||r||{},M=_.enrich;var N=this.index.get(I);if(y&&(this.db&&(_.tag=y,_.field=d,L=N.db.support_tag_search),!L&&M&&(_.enrich=!1),L||(_.limit=0,_.offset=0)),O=h?N.searchCache(t,y&&!L?0:e,_):N.search(t,y&&!L?0:e,_),y&&!L&&(_.limit=e,_.offset=C),M&&(_.enrich=M),v){v[E]=O;continue}}if($=(O=O.result||O)&&O.length,y&&$){if(_=[],M=0,this.db&&n){if(!L)for(N=d.length;N<n.length;N++){let ie=n[N];if(ie&&ie.length)M++,_.push(ie);else if(!l)return p?i:new lr(i,this)}}else for(let ie=0,J,G;ie<y.length;ie+=2){if(J=this.tag.get(y[ie]),!J){if(l)continue;return p?i:new lr(i,this)}if(G=(J=J&&J.get(y[ie+1]))&&J.length)M++,_.push(J);else if(!l)return p?i:new lr(i,this)}if(M){if(O=sj(O,_,e,C,p),$=O.length,!$&&!l)return p?O:new lr(O,this);M--}}if($)s[g]=I,i.push(O),g++;else if(d.length===1)return p?i:new lr(i,this)}if(v){if(this.db&&y&&y.length&&!L)for(x=0;x<y.length;x+=2){if(s=this.index.get(y[x]),!s){if(l)continue;return p?i:new lr(i,this)}v.push(s.db.tag(y[x+1],e,C,!1))}const E=this;return Promise.all(v).then(function(O){return r&&(r.resolve=p),O.length&&(O=E.search(t,e,r,O)),O})}if(!g)return p?i:new lr(i,this);if(o&&(!x||!this.store))return i=i[0],p?i:new lr(i,this);for(v=[],C=0;C<s.length;C++){if(y=i[C],x&&y.length&&typeof y[0].doc>"u"&&(this.db?v.push(y=this.index.get(this.field[0]).db.enrich(y)):y=ku.call(this,y)),o)return p?m?am(t,y,this.index,o,m):y:new lr(y,this);i[C]={field:s[C],result:y}}if(x&&this.db&&v.length){const E=this;return Promise.all(v).then(function(O){for(let I=0;I<O.length;I++)i[I].result=O[I];return m&&(i=am(t,i,E.index,o,m)),a?dT(i):i})}return m&&(i=am(t,i,this.index,o,m)),a?dT(i):i};function dT(t){const e=[],r=Br(),n=Br();for(let i=0,s,o,a,l,c,h,d;i<t.length;i++){s=t[i],o=s.field,a=s.result;for(let g=0;g<a.length;g++)c=a[g],typeof c!="object"?c={id:l=c}:l=c.id,(h=r[l])?h.push(o):(c.field=r[l]=[o],e.push(c)),(d=c.highlight)&&(h=n[l],h||(n[l]=h={},c.highlight=h),h[o]=d)}return e}function oj(t,e,r,n,i){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),i&&(t=ku.call(this,t))),t):[]):[]}function ku(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);const e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function Zl(t){if(!this||this.constructor!==Zl)return new Zl(t);const e=t.document||t.doc||t;let r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&Dm(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new Cs(n):new Set:n?new ys(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new ys(n):new Map:null,this.cache=(r=t.cache||null)&&new mc(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=aj.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let i=0,s,o;i<r.length;i++){if(s=r[i],o=s.field||s,!o)throw Error("The tag field from the document descriptor is undefined.");s.custom?this.A[i]=s.custom:(this.A[i]=Dm(o,this.D),s.filter&&(typeof this.A[i]=="string"&&(this.A[i]=new String(this.A[i])),this.A[i].G=s.filter)),this.F[i]=o,this.tag.set(o,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(const i of this.index.values())i.then&&t.push(i);if(t.length){const i=this;return Promise.all(t).then(function(s){let o=0;for(const a of i.index.entries()){const l=a[0];let c=a[1];c.then&&(c=s[o],i.index.set(l,c),o++)}return i})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}qe=Zl.prototype;qe.mount=function(t){let e=this.field;if(this.tag)for(let s=0,o;s<this.F.length;s++){o=this.F[s];var r=void 0;this.index.set(o,r=new Ks({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(o),r.tag=this.tag.get(o)}r=[];const n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let s=0,o,a;s<e.length;s++){n.field=a=e[s],o=this.index.get(a);const l=new t.constructor(t.id,n);l.id=t.id,r[s]=l.mount(o),o.document=!0,s?o.bypass=!0:o.store=this.store}const i=this;return this.db=Promise.all(r).then(function(){i.db=!0})};qe.commit=async function(){const t=[];for(const e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()};qe.destroy=function(){const t=[];for(const e of this.index.values())t.push(e.destroy());return Promise.all(t)};function aj(t,e){const r=new Map;let n=e.index||e.field||e;ms(n)&&(n=[n]);for(let s=0,o,a;s<n.length;s++){if(o=n[s],ms(o)||(a=o,o=o.field),a=Jd(a)?Object.assign({},t,a):t,this.worker){var i=void 0;i=(i=a.encoder)&&i.encode?i:new tf(typeof i=="string"?yL[i]:i||{}),i=new Vu(a,i),r.set(o,i)}this.worker||r.set(o,new Ks(a,this.reg)),a.custom?this.B[s]=a.custom:(this.B[s]=Dm(o,this.D),a.filter&&(typeof this.B[s]=="string"&&(this.B[s]=new String(this.B[s])),this.B[s].G=a.filter)),this.field[s]=o}if(this.h){t=e.store,ms(t)&&(t=[t]);for(let s=0,o,a;s<t.length;s++)o=t[s],a=o.field||o,o.custom?(this.h[s]=o.custom,o.custom.O=a):(this.h[s]=Dm(a,this.D),o.filter&&(typeof this.h[s]=="string"&&(this.h[s]=new String(this.h[s])),this.h[s].G=o.filter))}return r}function Dm(t,e){const r=t.split(":");let n=0;for(let i=0;i<r.length;i++)t=r[i],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}qe.append=function(t,e){return this.add(t,e,!0)};qe.update=function(t,e){return this.remove(t).add(t,e)};qe.remove=function(t){Jd(t)&&(t=ef(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];const i=n[1],s=i.indexOf(t);s>-1&&(i.length>1?i.splice(s,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};qe.clear=function(){const t=[];for(const e of this.index.values()){const r=e.clear();r.then&&t.push(r)}if(this.tag)for(const e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};qe.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};qe.cleanup=function(){for(const t of this.index.values())t.cleanup();return this};qe.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};qe.set=function(t,e){return typeof t=="object"&&(e=t,t=ef(e,this.key)),this.store.set(t,e),this};qe.searchCache=Qv;qe.export=lj;qe.import=cj;Jv(Zl.prototype);function r2(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(const i of t.entries())n.push(i),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function n2(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function kL(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(const i of t.entries())n.push([i[0],r2(i[1])[0]||[]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function vL(t,e){e||(e=new Map);for(let r=0,n,i;r<t.length;r++)n=t[r],i=e.get(n[0]),e.set(n[0],n2(n[1],i));return e}function wL(t){let e=[],r=[];for(const n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function _L(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function Rm(t,e,r,n,i,s,o=0){const a=n&&n.constructor===Array;var l=a?n.shift():n;if(!l)return this.export(t,e,i,s+1);if((l=t((e?e+".":"")+(o+1)+"."+r,JSON.stringify(l)))&&l.then){const c=this;return l.then(function(){return Rm.call(c,t,e,r,a?n:null,i,s,o+1)})}return Rm.call(this,t,e,r,a?n:null,i,s,o+1)}function lj(t,e,r=0,n=0){if(r<this.field.length){const o=this.field[r];if((e=this.index.get(o).export(t,o,r,n=1))&&e.then){const a=this;return e.then(function(){return a.export(t,o,r+1)})}return this.export(t,o,r+1)}let i,s;switch(n){case 0:i="reg",s=wL(this.reg),e=null;break;case 1:i="tag",s=this.tag&&kL(this.tag,this.reg.size),e=null;break;case 2:i="doc",s=this.store&&r2(this.store),e=null;break;default:return}return Rm.call(this,t,e,i,s||null,r,n)}function cj(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();const n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=_L(e,this.reg);for(let i=0,s;i<this.field.length;i++)s=this.index.get(this.field[i]),s.fastupdate=!1,s.reg=this.reg;if(this.worker){e=[];for(const i of this.index.values())e.push(i.import(t));return Promise.all(e)}break;case"tag":this.tag=vL(e,this.tag);break;case"doc":this.store=n2(e,this.store)}}}function fT(t,e){let r="";for(const n of t.entries()){t=n[0];const i=n[1];let s="";for(let o=0,a;o<i.length;o++){a=i[o]||[""];let l="";for(let c=0;c<a.length;c++)l+=(l?",":"")+(e==="string"?'"'+a[c]+'"':a[c]);l="["+l+"]",s+=(s?",":"")+l}s='["'+t+'",['+s+"]]",r+=(r?",":"")+s}return r}Ks.prototype.remove=function(t,e){const r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,i,s;n<r.length;n++)if((i=r[n])&&(s=i.length))if(i[s-1]===t)i.pop();else{const o=i.indexOf(t);o>=0&&i.splice(o,1)}}else rf(this.map,t),this.depth&&rf(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&SL(this)),this.cache&&this.cache.remove(t),this};function rf(t,e){let r=0;var n=typeof e>"u";if(t.constructor===Array){for(let i=0,s,o,a;i<t.length;i++)if((s=t[i])&&s.length){if(n)return 1;if(o=s.indexOf(e),o>=0){if(s.length>1)return s.splice(o,1),1;if(delete t[i],r)return 1;a=1}else{if(a)return 1;r++}}}else for(let i of t.entries())n=i[0],rf(i[1],e)?r++:t.delete(n);return r}const uj={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Ks.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);const c=e.length;if(c){const h=Br(),d=Br(),g=this.resolution;for(let p=0;p<c;p++){let m=e[this.rtl?c-1-p:p];var i=m.length;if(i&&(n||!d[m])){var s=this.score?this.score(e,m,p,null,0):pg(g,c,p),o="";switch(this.tokenize){case"tolerant":if(bo(this,d,m,s,t,r),i>2){for(let y=1,x,C,v,_;y<i-1;y++)x=m.charAt(y),C=m.charAt(y+1),v=m.substring(0,y)+C,_=m.substring(y+2),o=v+x+_,bo(this,d,o,s,t,r),o=v+_,bo(this,d,o,s,t,r);bo(this,d,m.substring(0,m.length-1),s,t,r)}break;case"full":if(i>2){for(let y=0,x;y<i;y++)for(s=i;s>y;s--){o=m.substring(y,s),x=this.rtl?i-1-y:y;var a=this.score?this.score(e,m,p,o,x):pg(g,c,p,i,x);bo(this,d,o,a,t,r)}break}case"bidirectional":case"reverse":if(i>1){for(a=i-1;a>0;a--){o=m[this.rtl?i-1-a:a]+o;var l=this.score?this.score(e,m,p,o,a):pg(g,c,p,i,a);bo(this,d,o,l,t,r)}o=""}case"forward":if(i>1){for(a=0;a<i;a++)o+=m[this.rtl?i-1-a:a],bo(this,d,o,s,t,r);break}default:if(bo(this,d,m,s,t,r),n&&c>1&&p<c-1)for(i=this.N,o=m,s=Math.min(n+1,this.rtl?p+1:c-p),a=1;a<s;a++){m=e[this.rtl?c-1-p-a:p+a],l=this.bidirectional&&m>o;const y=this.score?this.score(e,o,p,m,a-1):pg(i+(c/2>i?0:1),c,p,s-1,a-1);bo(this,h,l?o:m,y,t,r,l?m:o)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&SL(this)),this};function bo(t,e,r,n,i,s,o){let a,l;if(!(a=e[r])||o&&!a[o]){if(o?(e=a||(e[r]=Br()),e[o]=1,l=t.ctx,(a=l.get(o))?l=a:l.set(o,l=t.keystore?new ys(t.keystore):new Map)):(l=t.map,e[r]=1),(a=l.get(r))?l=a:l.set(r,l=a=[]),s){for(let c=0,h;c<a.length;c++)if((h=a[c])&&h.includes(i)){if(c<=n)return;h.splice(h.indexOf(i),1),t.fastupdate&&(e=t.reg.get(i))&&e.splice(e.indexOf(h),1);break}}if(l=l[n]||(l[n]=[]),l.push(i),l.length===2**31-1){if(e=new Uu(l),t.fastupdate)for(let c of t.reg.values())c.includes(l)&&(c[c.indexOf(l)]=e);a[n]=l=e}t.fastupdate&&((n=t.reg.get(i))?n.push(l):t.reg.set(i,[l]))}}function pg(t,e,r,n,i){return r&&t>1?e+(n||0)<=t?r+(i||0):(t-1)/(e+(n||0))*(r+(i||0))+1|0:0}Ks.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],i,s,o,a=0,l,c,h,d,g;r&&(t=r.query||t,e=r.limit||e,a=r.offset||0,s=r.context,o=r.suggest,g=(l=r.resolve)&&r.enrich,h=r.boost,d=r.resolution,c=this.db&&r.tag),typeof l>"u"&&(l=this.resolve),s=this.depth&&s!==!1;let p=this.encoder.encode(t,!s);if(i=p.length,e=e||(l?100:0),i===1)return gT.call(this,p[0],"",e,a,l,g,c);if(i===2&&s&&!o)return gT.call(this,p[1],p[0],e,a,l,g,c);let m=Br(),y=0,x;if(s&&(x=p[0],y=1),d||d===0||(d=x?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,p,e,a,o,l,g,c),r!==!1))return r;const C=this;return(async function(){for(let v,_;y<i;y++){if((_=p[y])&&!m[_]){if(m[_]=1,v=await QC(C,_,x,0,0,!1,!1),v=mT(v,n,o,d)){n=v;break}x&&(o&&v&&n.length||(x=_))}o&&x&&y===i-1&&!n.length&&(d=C.resolution,x="",y=-1,m=Br())}return pT(n,d,e,a,o,h,l)})()}for(let C,v;y<i;y++){if((v=p[y])&&!m[v]){if(m[v]=1,C=QC(this,v,x,0,0,!1,!1),C=mT(C,n,o,d)){n=C;break}x&&(o&&C&&n.length||(x=v))}o&&x&&y===i-1&&!n.length&&(d=this.resolution,x="",y=-1,m=Br())}return pT(n,d,e,a,o,h,l)};function pT(t,e,r,n,i,s,o){let a=t.length,l=t;if(a>1)l=Om(t,e,r,n,i,s,o);else if(a===1)return o?e2.call(null,t[0],r,n):new lr(t[0],this);return o?l:new lr(l,this)}function gT(t,e,r,n,i,s,o){return t=QC(this,t,e,r,n,i,s,o),this.db?t.then(function(a){return i?a||[]:new lr(a,this)}):t&&t.length?i?e2.call(this,t,r,n):new lr(t,this):i?[]:new lr([],this)}function mT(t,e,r,n){let i=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let s=0,o;s<n;s++)(o=t[s])&&(i[s]=o);if(i.length){e.push(i);return}}if(!r)return i}function QC(t,e,r,n,i,s,o,a){let l;return r&&(l=t.bidirectional&&e>r)&&(l=r,r=e,e=l),t.db?t.db.get(e,r,n,i,s,o,a):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function Ks(t,e){if(!this||this.constructor!==Ks)return new Ks(t);if(t){var r=ms(t)?t:t.preset;r&&(t=Object.assign({},uj[r],t))}else t={};r=t.context;const n=r===!0?{depth:1}:r||{},i=ms(t.encoder)?yL[t.encoder]:t.encode||t.encoder||{};this.encoder=i.encode?i:typeof i=="object"?new tf(i):{encode:i},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new ys(r):new Map,this.ctx=r?new ys(r):new Map,this.reg=e||(this.fastupdate?r?new ys(r):new Map:r?new Cs(r):new Set),this.N=n.resolution||3,this.rtl=i.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new mc(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}qe=Ks.prototype;qe.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};qe.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};qe.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function SL(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}qe.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};qe.append=function(t,e){return this.add(t,e,!0)};qe.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};qe.update=function(t,e){const r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};qe.cleanup=function(){return this.fastupdate?(rf(this.map),this.depth&&rf(this.ctx),this):this};qe.searchCache=Qv;qe.export=function(t,e,r=0,n=0){let i,s;switch(n){case 0:i="reg",s=wL(this.reg);break;case 1:i="cfg",s=null;break;case 2:i="map",s=r2(this.map,this.reg.size);break;case 3:i="ctx",s=kL(this.ctx,this.reg.size);break;default:return}return Rm.call(this,t,e,i,s,r,n)};qe.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=_L(e,this.reg);break;case"map":this.map=n2(e,this.map);break;case"ctx":this.ctx=vL(e,this.ctx)}};qe.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let s;for(var i of this.reg.keys())s||(s=typeof i),e+=(e?",":"")+(s==="string"?'"'+i+'"':i);e="index.reg=new Set(["+e+"]);",r=fT(this.map,s),r="index.map=new Map(["+r+"]);";for(const o of this.ctx.entries()){i=o[0];let a=fT(o[1],s);a="new Map(["+a+"])",a='["'+i+'",'+a+"]",n+=(n?",":"")+a}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Jv(Ks.prototype);const EL=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Im=["map","ctx","tag","reg","cfg"],Ol=Br();function JC(t,e={}){if(!this||this.constructor!==JC)return new JC(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}qe=JC.prototype;qe.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};qe.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),Ol[t.id]||(Ol[t.id]=[]),Ol[t.id].push(t.field);const e=EL.open(t.id,1);return e.onupgradeneeded=function(){const r=t.db=this.result;for(let n=0,i;n<Im.length;n++){i=Im[n];for(let s=0,o;s<Ol[t.id].length;s++)o=Ol[t.id][s],r.objectStoreNames.contains(i+(i!=="reg"&&o?":"+o:""))||r.createObjectStore(i+(i!=="reg"&&o?":"+o:""))}},t.db=el(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};qe.close=function(){this.db&&this.db.close(),this.db=null};qe.destroy=function(){const t=EL.deleteDatabase(this.id);return el(t)};qe.clear=function(){const t=[];for(let r=0,n;r<Im.length;r++){n=Im[r];for(let i=0,s;i<Ol[this.id].length;i++)s=Ol[this.id][i],t.push(n+(n!=="reg"&&s?":"+s:""))}const e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return el(e)};qe.get=function(t,e,r=0,n=0,i=!0,s=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);const o=this;return el(t).then(function(a){let l=[];if(!a||!a.length)return l;if(i){if(!r&&!n&&a.length===1)return a[0];for(let c=0,h;c<a.length;c++)if((h=a[c])&&h.length){if(n>=h.length){n-=h.length;continue}const d=r?n+Math.min(h.length-n,r):h.length;for(let g=n;g<d;g++)l.push(h[g]);if(n=0,l.length===r)break}return s?o.enrich(l):l}return a})};qe.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);const i=this;return el(t).then(function(s){return!s||!s.length||r>=s.length?[]:!e&&!r?s:(s=s.slice(r,r+e),n?i.enrich(s):s)})};qe.enrich=function(t){typeof t!="object"&&(t=[t]);const e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=el(e.get(t[n]));return Promise.all(r).then(function(n){for(let i=0;i<n.length;i++)n[i]={id:t[i],doc:n[i]?JSON.parse(n[i]):null};return n})};qe.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),el(t).then(function(e){return!!e})};qe.search=null;qe.info=function(){};qe.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let i=this.db.transaction(t,e);this.h[t+":"+e]=n=i.objectStore(t);const s=r.call(this,n);return this.h[t+":"+e]=null,el(i).finally(function(){return s})};qe.commit=async function(t){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,i;n<e.length;n++)i=e[n],i.del&&r.push(i.del);r.length&&await this.remove(r),t.reg.size&&(await this.transaction("map","readwrite",function(n){for(const i of t.map){const s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;var l;if(a&&a.length){const c=Math.max(a.length,o.length);for(let h=0,d,g;h<c;h++)if((g=o[h])&&g.length){if((d=a[h])&&d.length)for(l=0;l<g.length;l++)d.push(g[l]);else a[h]=g;l=1}}else a=o,l=1;l&&n.put(a,s)})}}),await this.transaction("ctx","readwrite",function(n){for(const i of t.ctx){const s=i[0],o=i[1];for(const a of o){const l=a[0],c=a[1];c.length&&(n.get(s+":"+l).onsuccess=function(){let h=this.result;var d;if(h&&h.length){const g=Math.max(h.length,c.length);for(let p=0,m,y;p<g;p++)if((y=c[p])&&y.length){if((m=h[p])&&m.length)for(d=0;d<y.length;d++)m.push(y[d]);else h[p]=y;d=1}}else h=c,d=1;d&&n.put(h,s+":"+l)})}}}),t.store?await this.transaction("reg","readwrite",function(n){for(const i of t.store){const s=i[0],o=i[1];n.put(typeof o=="object"?JSON.stringify(o):1,s)}}):t.bypass||await this.transaction("reg","readwrite",function(n){for(const i of t.reg.keys())n.put(1,i)}),t.tag&&await this.transaction("tag","readwrite",function(n){for(const i of t.tag){const s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;a=a&&a.length?a.concat(o):o,n.put(a,s)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};function lx(t,e,r){const n=t.value;let i,s=0;for(let o=0,a;o<n.length;o++){if(a=r?n:n[o]){for(let l=0,c,h;l<e.length;l++)if(h=e[l],c=a.indexOf(h),c>=0)if(i=1,a.length>1)a.splice(c,1);else{n[o]=[];break}s+=a.length}if(r)break}s?i&&t.update(n):t.delete(),t.continue()}qe.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){const r=this.result;r&&lx(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){const r=this.result;r&&lx(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){const r=this.result;r&&lx(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};function el(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}const hj={Document:Zl};function dj(t){const e=[];function r(n){n.type==="file"&&e.push(n.path),n.children&&n.children.forEach(r)}return t.forEach(r),e}function TL(){const[t,e]=B.useState(!1),r=B.useRef(null),n=B.useRef(new Map),i=B.useCallback(()=>(r.current||(r.current=new hj.Document({document:{id:"path",index:["name","content"],store:["path","name","content"]},tokenize:"forward",resolution:9})),r.current),[]),s=B.useCallback(async c=>{e(!0);try{const h=i();n.current.clear();const d=dj(c);if(d.length===0){e(!1);return}const g=d.join(","),p=await fetch(`/api/files/content?paths=${encodeURIComponent(g)}`);if(!p.ok)throw new Error("Failed to fetch file contents");const m=await p.json();for(const y of m.files){const x={path:y.path,name:y.name,content:y.content.slice(0,1e5)};n.current.set(y.path,x),h.add(x)}}catch(h){console.error("Failed to build search index:",h)}finally{e(!1)}},[i]),o=B.useCallback(c=>{if(!c.trim()||!r.current)return[];const h=r.current,d=[],g=new Set,p=h.search(c,{field:"name",limit:5,enrich:!0});for(const y of p)for(const x of y.result){const C=n.current.get(String(x.id));C&&!g.has(C.path)&&(g.add(C.path),d.push({path:C.path,name:C.name,source:"name"}))}const m=h.search(c,{field:"content",limit:10,enrich:!0});for(const y of m)for(const x of y.result){const C=n.current.get(String(x.id));if(C&&!g.has(C.path)){g.add(C.path);let v;const _=C.content.toLowerCase(),M=c.toLowerCase(),L=_.indexOf(M);if(L!==-1){const N=Math.max(0,L-30),E=Math.min(C.content.length,L+c.length+30);v=(N>0?"...":"")+C.content.slice(N,E)+(E<C.content.length?"...":"")}d.push({path:C.path,name:C.name,matchedContent:v,source:"content"})}}return d},[]),a=B.useCallback((c,h,d)=>{if(!r.current)return;const g={path:c,name:h,content:d.slice(0,1e5)};n.current.set(c,g),r.current.update(g)},[]),l=B.useCallback(c=>{r.current&&(n.current.delete(c),r.current.remove(c))},[]);return{buildIndex:s,search:o,updateIndex:a,removeFromIndex:l,isIndexing:t}}function AL(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=AL(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function ML(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=AL(t))&&(n&&(n+=" "),n+=e);return n}const fj=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},pj=(t,e)=>({classGroupId:t,validator:e}),NL=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),Fm="-",yT=[],gj="arbitrary..",mj=t=>{const e=bj(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return yj(o);const a=o.split(Fm),l=a[0]===""&&a.length>1?1:0;return LL(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=r[o];return l?c?fj(c,l):l:c||yT}return r[o]||yT}}},LL=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],s=r.nextPart.get(i);if(s){const c=LL(t,e+1,s);if(c)return c}const o=r.validators;if(o===null)return;const a=e===0?t.join(Fm):t.slice(e).join(Fm),l=o.length;for(let c=0;c<l;c++){const h=o[c];if(h.validator(a))return h.classGroupId}},yj=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?gj+n:void 0})(),bj=t=>{const{theme:e,classGroups:r}=t;return xj(r,e)},xj=(t,e)=>{const r=NL();for(const n in t){const i=t[n];i2(i,r,n,e)}return r},i2=(t,e,r,n)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];Cj(o,e,r,n)}},Cj=(t,e,r,n)=>{if(typeof t=="string"){kj(t,e,r);return}if(typeof t=="function"){vj(t,e,r,n);return}wj(t,e,r,n)},kj=(t,e,r)=>{const n=t===""?e:BL(e,t);n.classGroupId=r},vj=(t,e,r,n)=>{if(_j(t)){i2(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(pj(r,t))},wj=(t,e,r,n)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];i2(l,BL(e,a),r,n)}},BL=(t,e)=>{let r=t;const n=e.split(Fm),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=r.nextPart.get(o);a||(a=NL(),r.nextPart.set(o,a)),r=a}return r},_j=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Sj=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},ek="!",bT=":",Ej=[],xT=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),Tj=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const s=[];let o=0,a=0,l=0,c;const h=i.length;for(let y=0;y<h;y++){const x=i[y];if(o===0&&a===0){if(x===bT){s.push(i.slice(l,y)),l=y+1;continue}if(x==="/"){c=y;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const d=s.length===0?i:i.slice(l);let g=d,p=!1;d.endsWith(ek)?(g=d.slice(0,-1),p=!0):d.startsWith(ek)&&(g=d.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return xT(s,p,g,m)};if(e){const i=e+bT,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):xT(Ej,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},Aj=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},Mj=t=>({cache:Sj(t.cacheSize),parseClassName:Tj(t),sortModifiers:Aj(t),...mj(t)}),Nj=/\s+/,Lj=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(Nj);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:d,modifiers:g,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:y}=r(h);if(d){l=h+(l.length>0?" "+l:l);continue}let x=!!y,C=n(x?m.substring(0,y):m);if(!C){if(!x){l=h+(l.length>0?" "+l:l);continue}if(C=n(m),!C){l=h+(l.length>0?" "+l:l);continue}x=!1}const v=g.length===0?"":g.length===1?g[0]:s(g).join(":"),_=p?v+ek:v,M=_+C;if(o.indexOf(M)>-1)continue;o.push(M);const L=i(C,x);for(let N=0;N<L.length;++N){const E=L[N];o.push(_+E)}l=h+(l.length>0?" "+l:l)}return l},Bj=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=OL(r))&&(i&&(i+=" "),i+=n);return i},OL=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=OL(t[n]))&&(r&&(r+=" "),r+=e);return r},Oj=(t,...e)=>{let r,n,i,s;const o=l=>{const c=e.reduce((h,d)=>d(h),t());return r=Mj(c),n=r.cache.get,i=r.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const h=Lj(l,r);return i(l,h),h};return s=o,(...l)=>s(Bj(...l))},Dj=[],Wr=t=>{const e=r=>r[t]||Dj;return e.isThemeGetter=!0,e},DL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,RL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rj=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ij=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Fj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$j=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ga=t=>Rj.test(t),Et=t=>!!t&&!Number.isNaN(Number(t)),ma=t=>!!t&&Number.isInteger(Number(t)),cx=t=>t.endsWith("%")&&Et(t.slice(0,-1)),xo=t=>Ij.test(t),IL=()=>!0,jj=t=>Fj.test(t)&&!Pj.test(t),s2=()=>!1,Hj=t=>$j.test(t),Wj=t=>zj.test(t),qj=t=>!He(t)&&!Ue(t),Uj=t=>tl(t,$L,s2),He=t=>DL.test(t),El=t=>tl(t,zL,jj),CT=t=>tl(t,Jj,Et),Vj=t=>tl(t,HL,IL),Gj=t=>tl(t,jL,s2),kT=t=>tl(t,FL,s2),Kj=t=>tl(t,PL,Wj),gg=t=>tl(t,WL,Hj),Ue=t=>RL.test(t),rd=t=>yc(t,zL),Yj=t=>yc(t,jL),vT=t=>yc(t,FL),Xj=t=>yc(t,$L),Zj=t=>yc(t,PL),mg=t=>yc(t,WL,!0),Qj=t=>yc(t,HL,!0),tl=(t,e,r)=>{const n=DL.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},yc=(t,e,r=!1)=>{const n=RL.exec(t);return n?n[1]?e(n[1]):r:!1},FL=t=>t==="position"||t==="percentage",PL=t=>t==="image"||t==="url",$L=t=>t==="length"||t==="size"||t==="bg-size",zL=t=>t==="length",Jj=t=>t==="number",jL=t=>t==="family-name",HL=t=>t==="number"||t==="weight",WL=t=>t==="shadow",eH=()=>{const t=Wr("color"),e=Wr("font"),r=Wr("text"),n=Wr("font-weight"),i=Wr("tracking"),s=Wr("leading"),o=Wr("breakpoint"),a=Wr("container"),l=Wr("spacing"),c=Wr("radius"),h=Wr("shadow"),d=Wr("inset-shadow"),g=Wr("text-shadow"),p=Wr("drop-shadow"),m=Wr("blur"),y=Wr("perspective"),x=Wr("aspect"),C=Wr("ease"),v=Wr("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...M(),Ue,He],N=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],O=()=>[Ue,He,l],I=()=>[ga,"full","auto",...O()],$=()=>[ma,"none","subgrid",Ue,He],j=()=>["auto",{span:["full",ma,Ue,He]},ma,Ue,He],ie=()=>[ma,"auto",Ue,He],J=()=>["auto","min","max","fr",Ue,He],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...O()],Q=()=>[ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],F=()=>[ga,"screen","full","dvw","lvw","svw","min","max","fit",...O()],K=()=>[ga,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],U=()=>[t,Ue,He],P=()=>[...M(),vT,kT,{position:[Ue,He]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],oe=()=>["auto","cover","contain",Xj,Uj,{size:[Ue,He]}],re=()=>[cx,rd,El],ee=()=>["","none","full",c,Ue,He],fe=()=>["",Et,rd,El],Se=()=>["solid","dashed","dotted","double"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ee=()=>[Et,cx,vT,kT],xe=()=>["","none",m,Ue,He],$e=()=>["none",Et,Ue,He],xt=()=>["none",Et,Ue,He],Ct=()=>[Et,Ue,He],Je=()=>[ga,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xo],breakpoint:[xo],color:[IL],container:[xo],"drop-shadow":[xo],ease:["in","out","in-out"],font:[qj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xo],shadow:[xo],spacing:["px",Et],text:[xo],"text-shadow":[xo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ga,He,Ue,x]}],container:["container"],columns:[{columns:[Et,He,Ue,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[ma,"auto",Ue,He]}],basis:[{basis:[ga,"full","auto",a,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Et,ga,"auto","initial","none",He]}],grow:[{grow:["",Et,Ue,He]}],shrink:[{shrink:["",Et,Ue,He]}],order:[{order:[ma,"first","last","none",Ue,He]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[a,"screen",...Q()]}],"min-w":[{"min-w":[a,"screen","none",...Q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",r,rd,El]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Qj,Vj]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",cx,He]}],"font-family":[{font:[Yj,Gj,e]}],"font-features":[{"font-features":[He]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ue,He]}],"line-clamp":[{"line-clamp":[Et,"none",Ue,CT]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",Ue,He]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ue,He]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Et,"from-font","auto",Ue,El]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Et,"auto",Ue,He]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue,He]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ue,He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ma,Ue,He],radial:["",Ue,He],conic:[ma,Ue,He]},Zj,Kj]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-bs":[{"border-bs":fe()}],"border-w-be":[{"border-be":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":fe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Et,Ue,He]}],"outline-w":[{outline:["",Et,rd,El]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",h,mg,gg]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",d,mg,gg]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Et,El]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",g,mg,gg]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Et,Ue,He]}],"mix-blend":[{"mix-blend":[...Me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Et]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ee()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":Ee()}],"mask-image-t-to-pos":[{"mask-t-to":Ee()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":Ee()}],"mask-image-r-to-pos":[{"mask-r-to":Ee()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":Ee()}],"mask-image-b-to-pos":[{"mask-b-to":Ee()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":Ee()}],"mask-image-l-to-pos":[{"mask-l-to":Ee()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":Ee()}],"mask-image-x-to-pos":[{"mask-x-to":Ee()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":Ee()}],"mask-image-y-to-pos":[{"mask-y-to":Ee()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ue,He]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ee()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[Et]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ee()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ue,He]}],filter:[{filter:["","none",Ue,He]}],blur:[{blur:xe()}],brightness:[{brightness:[Et,Ue,He]}],contrast:[{contrast:[Et,Ue,He]}],"drop-shadow":[{"drop-shadow":["","none",p,mg,gg]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Et,Ue,He]}],"hue-rotate":[{"hue-rotate":[Et,Ue,He]}],invert:[{invert:["",Et,Ue,He]}],saturate:[{saturate:[Et,Ue,He]}],sepia:[{sepia:["",Et,Ue,He]}],"backdrop-filter":[{"backdrop-filter":["","none",Ue,He]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Et,Ue,He]}],"backdrop-contrast":[{"backdrop-contrast":[Et,Ue,He]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Et,Ue,He]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Et,Ue,He]}],"backdrop-invert":[{"backdrop-invert":["",Et,Ue,He]}],"backdrop-opacity":[{"backdrop-opacity":[Et,Ue,He]}],"backdrop-saturate":[{"backdrop-saturate":[Et,Ue,He]}],"backdrop-sepia":[{"backdrop-sepia":["",Et,Ue,He]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ue,He]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Et,"initial",Ue,He]}],ease:[{ease:["linear","initial",C,Ue,He]}],delay:[{delay:[Et,Ue,He]}],animate:[{animate:["none",v,Ue,He]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Ue,He]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:$e()}],"rotate-x":[{"rotate-x":$e()}],"rotate-y":[{"rotate-y":$e()}],"rotate-z":[{"rotate-z":$e()}],scale:[{scale:xt()}],"scale-x":[{"scale-x":xt()}],"scale-y":[{"scale-y":xt()}],"scale-z":[{"scale-z":xt()}],"scale-3d":["scale-3d"],skew:[{skew:Ct()}],"skew-x":[{"skew-x":Ct()}],"skew-y":[{"skew-y":Ct()}],transform:[{transform:[Ue,He,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Je()}],"translate-x":[{"translate-x":Je()}],"translate-y":[{"translate-y":Je()}],"translate-z":[{"translate-z":Je()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ue,He]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ue,He]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Et,rd,El,CT]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},tH=Oj(eH);function We(...t){return tH(ML(t))}const fh=B.forwardRef(({className:t,type:e,...r},n)=>T.jsx("input",{type:e,className:We("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));fh.displayName="Input";function wT(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Wa(...t){return e=>{let r=!1;const n=t.map(i=>{const s=wT(i,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():wT(t[i],null)}}}}function Nn(...t){return B.useCallback(Wa(...t),t)}var rH=Symbol.for("react.lazy"),Pm=Xv[" use ".trim().toString()];function nH(t){return typeof t=="object"&&t!==null&&"then"in t}function qL(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===rH&&"_payload"in t&&nH(t._payload)}function UL(t){const e=iH(t),r=B.forwardRef((n,i)=>{let{children:s,...o}=n;qL(s)&&typeof Pm=="function"&&(s=Pm(s._payload));const a=B.Children.toArray(s),l=a.find(oH);if(l){const c=l.props.children,h=a.map(d=>d===l?B.Children.count(c)>1?B.Children.only(null):B.isValidElement(c)?c.props.children:null:d);return T.jsx(e,{...o,ref:i,children:B.isValidElement(c)?B.cloneElement(c,void 0,h):null})}return T.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}var o2=UL("Slot");function iH(t){const e=B.forwardRef((r,n)=>{let{children:i,...s}=r;if(qL(i)&&typeof Pm=="function"&&(i=Pm(i._payload)),B.isValidElement(i)){const o=lH(i),a=aH(s,i.props);return i.type!==B.Fragment&&(a.ref=n?Wa(n,o):o),B.cloneElement(i,a)}return B.Children.count(i)>1?B.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var sH=Symbol("radix.slottable");function oH(t){return B.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===sH}function aH(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function lH(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const _T=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ST=ML,a2=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ST(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const h=r==null?void 0:r[c],d=s==null?void 0:s[c];if(h===null)return null;const g=_T(h)||_T(d);return i[c][g]}),a=r&&Object.entries(r).reduce((c,h)=>{let[d,g]=h;return g===void 0||(c[d]=g),c},{}),l=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,h)=>{let{class:d,className:g,...p}=h;return Object.entries(p).every(m=>{let[y,x]=m;return Array.isArray(x)?x.includes({...s,...a}[y]):{...s,...a}[y]===x})?[...c,d,g]:c},[]);return ST(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)},l2=a2("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Dt({className:t,variant:e,size:r,asChild:n=!1,...i}){const s=n?o2:"button";return T.jsx(s,{className:We(l2({variant:e,size:r,className:t})),...i})}function mn(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function cH(t,e){const r=B.createContext(e),n=s=>{const{children:o,...a}=s,l=B.useMemo(()=>a,Object.values(a));return T.jsx(r.Provider,{value:l,children:o})};n.displayName=t+"Provider";function i(s){const o=B.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[n,i]}function ky(t,e=[]){let r=[];function n(s,o){const a=B.createContext(o),l=r.length;r=[...r,o];const c=d=>{var C;const{scope:g,children:p,...m}=d,y=((C=g==null?void 0:g[t])==null?void 0:C[l])||a,x=B.useMemo(()=>m,Object.values(m));return T.jsx(y.Provider,{value:x,children:p})};c.displayName=s+"Provider";function h(d,g){var y;const p=((y=g==null?void 0:g[t])==null?void 0:y[l])||a,m=B.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,h]}const i=()=>{const s=r.map(o=>B.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return B.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,uH(i,...e)]}function uH(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return B.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}var Ql=globalThis!=null&&globalThis.document?B.useLayoutEffect:()=>{},hH=Xv[" useInsertionEffect ".trim().toString()]||Ql;function VL({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,o]=dH({defaultProp:e,onChange:r}),a=t!==void 0,l=a?t:i;{const h=B.useRef(t!==void 0);B.useEffect(()=>{const d=h.current;d!==a&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=a},[a,n])}const c=B.useCallback(h=>{var d;if(a){const g=fH(h)?h(t):h;g!==t&&((d=o.current)==null||d.call(o,g))}else s(h)},[a,t,s,o]);return[l,c]}function dH({defaultProp:t,onChange:e}){const[r,n]=B.useState(t),i=B.useRef(r),s=B.useRef(e);return hH(()=>{s.current=e},[e]),B.useEffect(()=>{var o;i.current!==r&&((o=s.current)==null||o.call(s,r),i.current=r)},[r,i]),[r,n,s]}function fH(t){return typeof t=="function"}var c2=dL();const GL=dh(c2);function KL(t){const e=pH(t),r=B.forwardRef((n,i)=>{const{children:s,...o}=n,a=B.Children.toArray(s),l=a.find(mH);if(l){const c=l.props.children,h=a.map(d=>d===l?B.Children.count(c)>1?B.Children.only(null):B.isValidElement(c)?c.props.children:null:d);return T.jsx(e,{...o,ref:i,children:B.isValidElement(c)?B.cloneElement(c,void 0,h):null})}return T.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function pH(t){const e=B.forwardRef((r,n)=>{const{children:i,...s}=r;if(B.isValidElement(i)){const o=bH(i),a=yH(s,i.props);return i.type!==B.Fragment&&(a.ref=n?Wa(n,o):o),B.cloneElement(i,a)}return B.Children.count(i)>1?B.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var YL=Symbol("radix.slottable");function gH(t){const e=({children:r})=>T.jsx(T.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=YL,e}function mH(t){return B.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===YL}function yH(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function bH(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var xH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yn=xH.reduce((t,e)=>{const r=KL(`Primitive.${e}`),n=B.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function CH(t,e){t&&c2.flushSync(()=>t.dispatchEvent(e))}function kH(t,e){return B.useReducer((r,n)=>e[r][n]??r,t)}var zo=t=>{const{present:e,children:r}=t,n=vH(e),i=typeof r=="function"?r({present:n.isPresent}):B.Children.only(r),s=Nn(n.ref,wH(i));return typeof r=="function"||n.isPresent?B.cloneElement(i,{ref:s}):null};zo.displayName="Presence";function vH(t){const[e,r]=B.useState(),n=B.useRef(null),i=B.useRef(t),s=B.useRef("none"),o=t?"mounted":"unmounted",[a,l]=kH(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B.useEffect(()=>{const c=yg(n.current);s.current=a==="mounted"?c:"none"},[a]),Ql(()=>{const c=n.current,h=i.current;if(h!==t){const g=s.current,p=yg(c);t?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(h&&g!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Ql(()=>{if(e){let c;const h=e.ownerDocument.defaultView??window,d=p=>{const y=yg(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&y&&(l("ANIMATION_END"),!i.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",c=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},g=p=>{p.target===e&&(s.current=yg(n.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{h.clearTimeout(c),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:B.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function yg(t){return(t==null?void 0:t.animationName)||"none"}function wH(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var _H=Xv[" useId ".trim().toString()]||(()=>{}),SH=0;function Vs(t){const[e,r]=B.useState(_H());return Ql(()=>{r(n=>n??String(SH++))},[t]),t||(e?`radix-${e}`:"")}var vy="Collapsible",[EH]=ky(vy),[TH,u2]=EH(vy),XL=B.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=VL({prop:n,defaultProp:i??!1,onChange:o,caller:vy});return T.jsx(TH,{scope:r,disabled:s,contentId:Vs(),open:l,onOpenToggle:B.useCallback(()=>c(h=>!h),[c]),children:T.jsx(yn.div,{"data-state":d2(l),"data-disabled":s?"":void 0,...a,ref:e})})});XL.displayName=vy;var ZL="CollapsibleTrigger",QL=B.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,i=u2(ZL,r);return T.jsx(yn.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":d2(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:e,onClick:mn(t.onClick,i.onOpenToggle)})});QL.displayName=ZL;var h2="CollapsibleContent",JL=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=u2(h2,t.__scopeCollapsible);return T.jsx(zo,{present:r||i.open,children:({present:s})=>T.jsx(AH,{...n,ref:e,present:s})})});JL.displayName=h2;var AH=B.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:i,...s}=t,o=u2(h2,r),[a,l]=B.useState(n),c=B.useRef(null),h=Nn(e,c),d=B.useRef(0),g=d.current,p=B.useRef(0),m=p.current,y=o.open||a,x=B.useRef(y),C=B.useRef(void 0);return B.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),Ql(()=>{const v=c.current;if(v){C.current=C.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();d.current=_.height,p.current=_.width,x.current||(v.style.transitionDuration=C.current.transitionDuration,v.style.animationName=C.current.animationName),l(n)}},[o.open,n]),T.jsx(yn.div,{"data-state":d2(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...s,ref:h,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:y&&i})});function d2(t){return t?"open":"closed"}var MH=XL,eB=JL;const NH=MH,LH=QL,tB=B.forwardRef(({className:t,children:e,...r},n)=>T.jsx(eB,{ref:n,className:We("overflow-hidden","data-[state=closed]:h-0 data-[state=open]:h-auto","transition-[height] duration-200 ease-out",t),...r,children:e}));tB.displayName=eB.displayName;B.createContext(void 0);const BH=({className:t,...e})=>T.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:We("relative flex w-full min-w-0 flex-col p-2",t),...e}),OH=({className:t,asChild:e=!1,...r})=>{const n=e?o2:"div";return T.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:We("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t),...r})},DH=({className:t,...e})=>T.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:We("w-full text-sm",t),...e}),RH=({className:t,...e})=>T.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:We("flex w-full min-w-0 flex-col gap-1",t),...e}),lm=({className:t,...e})=>T.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:We("group/menu-item relative",t),...e}),IH=a2("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),ET=({asChild:t=!1,isActive:e=!1,variant:r="default",size:n="default",tooltip:i,className:s,...o})=>{const a=t?o2:"button";return T.jsx(a,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":e,className:We(IH({variant:r,size:n}),s),...o})},FH=({className:t,...e})=>T.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:We("ml-3 flex min-w-0 flex-col gap-1 border-l border-sidebar-border pl-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...e});function Gi(t){const e=B.useRef(t);return B.useEffect(()=>{e.current=t}),B.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function PH(t,e=globalThis==null?void 0:globalThis.document){const r=Gi(t);B.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var $H="DismissableLayer",tk="dismissableLayer.update",zH="dismissableLayer.pointerDownOutside",jH="dismissableLayer.focusOutside",TT,rB=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nB=B.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=B.useContext(rB),[h,d]=B.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=B.useState({}),m=Nn(e,E=>d(E)),y=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),C=y.indexOf(x),v=h?y.indexOf(h):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,M=v>=C,L=qH(E=>{const O=E.target,I=[...c.branches].some($=>$.contains(O));!M||I||(i==null||i(E),o==null||o(E),E.defaultPrevented||a==null||a())},g),N=UH(E=>{const O=E.target;[...c.branches].some($=>$.contains(O))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},g);return PH(E=>{v===c.layers.size-1&&(n==null||n(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},g),B.useEffect(()=>{if(h)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(TT=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(h)),c.layers.add(h),AT(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=TT)}},[h,g,r,c]),B.useEffect(()=>()=>{h&&(c.layers.delete(h),c.layersWithOutsidePointerEventsDisabled.delete(h),AT())},[h,c]),B.useEffect(()=>{const E=()=>p({});return document.addEventListener(tk,E),()=>document.removeEventListener(tk,E)},[]),T.jsx(yn.div,{...l,ref:m,style:{pointerEvents:_?M?"auto":"none":void 0,...t.style},onFocusCapture:mn(t.onFocusCapture,N.onFocusCapture),onBlurCapture:mn(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:mn(t.onPointerDownCapture,L.onPointerDownCapture)})});nB.displayName=$H;var HH="DismissableLayerBranch",WH=B.forwardRef((t,e)=>{const r=B.useContext(rB),n=B.useRef(null),i=Nn(e,n);return B.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),T.jsx(yn.div,{...t,ref:i})});WH.displayName=HH;function qH(t,e=globalThis==null?void 0:globalThis.document){const r=Gi(t),n=B.useRef(!1),i=B.useRef(()=>{});return B.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){iB(zH,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function UH(t,e=globalThis==null?void 0:globalThis.document){const r=Gi(t),n=B.useRef(!1);return B.useEffect(()=>{const i=s=>{s.target&&!n.current&&iB(jH,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function AT(){const t=new CustomEvent(tk);document.dispatchEvent(t)}function iB(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?CH(i,s):i.dispatchEvent(s)}var ux="focusScope.autoFocusOnMount",hx="focusScope.autoFocusOnUnmount",MT={bubbles:!1,cancelable:!0},VH="FocusScope",sB=B.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=B.useState(null),c=Gi(i),h=Gi(s),d=B.useRef(null),g=Nn(e,y=>l(y)),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(n){let y=function(_){if(p.paused||!a)return;const M=_.target;a.contains(M)?d.current=M:ba(d.current,{select:!0})},x=function(_){if(p.paused||!a)return;const M=_.relatedTarget;M!==null&&(a.contains(M)||ba(d.current,{select:!0}))},C=function(_){if(document.activeElement===document.body)for(const L of _)L.removedNodes.length>0&&ba(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",x);const v=new MutationObserver(C);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),v.disconnect()}}},[n,a,p.paused]),B.useEffect(()=>{if(a){LT.add(p);const y=document.activeElement;if(!a.contains(y)){const C=new CustomEvent(ux,MT);a.addEventListener(ux,c),a.dispatchEvent(C),C.defaultPrevented||(GH(QH(oB(a)),{select:!0}),document.activeElement===y&&ba(a))}return()=>{a.removeEventListener(ux,c),setTimeout(()=>{const C=new CustomEvent(hx,MT);a.addEventListener(hx,h),a.dispatchEvent(C),C.defaultPrevented||ba(y??document.body,{select:!0}),a.removeEventListener(hx,h),LT.remove(p)},0)}}},[a,c,h,p]);const m=B.useCallback(y=>{if(!r&&!n||p.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,C=document.activeElement;if(x&&C){const v=y.currentTarget,[_,M]=KH(v);_&&M?!y.shiftKey&&C===M?(y.preventDefault(),r&&ba(_,{select:!0})):y.shiftKey&&C===_&&(y.preventDefault(),r&&ba(M,{select:!0})):C===v&&y.preventDefault()}},[r,n,p.paused]);return T.jsx(yn.div,{tabIndex:-1,...o,ref:g,onKeyDown:m})});sB.displayName=VH;function GH(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(ba(n,{select:e}),document.activeElement!==r)return}function KH(t){const e=oB(t),r=NT(e,t),n=NT(e.reverse(),t);return[r,n]}function oB(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function NT(t,e){for(const r of t)if(!YH(r,{upTo:e}))return r}function YH(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function XH(t){return t instanceof HTMLInputElement&&"select"in t}function ba(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&XH(t)&&e&&t.select()}}var LT=ZH();function ZH(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=BT(t,e),t.unshift(e)},remove(e){var r;t=BT(t,e),(r=t[0])==null||r.resume()}}}function BT(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function QH(t){return t.filter(e=>e.tagName!=="A")}var JH="Portal",aB=B.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=B.useState(!1);Ql(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?GL.createPortal(T.jsx(yn.div,{...n,ref:e}),o):null});aB.displayName=JH;var dx=0;function eW(){B.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??OT()),document.body.insertAdjacentElement("beforeend",t[1]??OT()),dx++,()=>{dx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),dx--}},[])}function OT(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ws=function(){return Ws=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Ws.apply(this,arguments)};function lB(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function tW(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var cm="right-scroll-bar-position",um="width-before-scroll-bar",rW="with-scroll-bars-hidden",nW="--removed-body-scroll-bar-size";function fx(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function iW(t,e){var r=B.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=e,r.facade}var sW=typeof window<"u"?B.useLayoutEffect:B.useEffect,DT=new WeakMap;function oW(t,e){var r=iW(null,function(n){return t.forEach(function(i){return fx(i,n)})});return sW(function(){var n=DT.get(r);if(n){var i=new Set(n),s=new Set(t),o=r.current;i.forEach(function(a){s.has(a)||fx(a,null)}),s.forEach(function(a){i.has(a)||fx(a,o)})}DT.set(r,t)},[t]),r}function aW(t){return t}function lW(t,e){e===void 0&&(e=aW);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var o=e(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var l=function(){var h=o;o=[],h.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),r={push:function(h){o.push(h),c()},filter:function(h){return o=o.filter(h),r}}}};return i}function cW(t){t===void 0&&(t={});var e=lW(null);return e.options=Ws({async:!0,ssr:!1},t),e}var cB=function(t){var e=t.sideCar,r=lB(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return B.createElement(n,Ws({},r))};cB.isSideCarExport=!0;function uW(t,e){return t.useMedium(e),cB}var uB=cW(),px=function(){},wy=B.forwardRef(function(t,e){var r=B.useRef(null),n=B.useState({onScrollCapture:px,onWheelCapture:px,onTouchMoveCapture:px}),i=n[0],s=n[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,h=t.enabled,d=t.shards,g=t.sideCar,p=t.noRelative,m=t.noIsolation,y=t.inert,x=t.allowPinchZoom,C=t.as,v=C===void 0?"div":C,_=t.gapMode,M=lB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=g,N=oW([r,e]),E=Ws(Ws({},M),i);return B.createElement(B.Fragment,null,h&&B.createElement(L,{sideCar:uB,removeScrollBar:c,shards:d,noRelative:p,noIsolation:m,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:_}),o?B.cloneElement(B.Children.only(a),Ws(Ws({},E),{ref:N})):B.createElement(v,Ws({},E,{className:l,ref:N}),a))});wy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wy.classNames={fullWidth:um,zeroRight:cm};var hW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function dW(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=hW();return e&&t.setAttribute("nonce",e),t}function fW(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function pW(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var gW=function(){var t=0,e=null;return{add:function(r){t==0&&(e=dW())&&(fW(e,r),pW(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},mW=function(){var t=gW();return function(e,r){B.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},hB=function(){var t=mW(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},yW={left:0,top:0,right:0,gap:0},gx=function(t){return parseInt(t||"",10)||0},bW=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[gx(r),gx(n),gx(i)]},xW=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return yW;var e=bW(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},CW=hB(),vu="data-scroll-locked",kW=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),`
222
222
  .`.concat(rW,` {
223
223
  overflow: hidden `).concat(n,`;
224
224
  padding-right: `).concat(a,"px ").concat(n,`;
@@ -262,13 +262,13 @@ Error generating stack: `+A.message+`
262
262
 
263
263
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
264
264
 
265
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return B.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},YW="DialogDescriptionWarning",XW=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${OB(YW).contentName}}.`;return B.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Rf=xB,ZW=kB,If=wB,bc=_B,xc=SB,ph=TB,Ff=MB,Pf=LB;const m2=Rf,QW=a2("fixed z-50 gap-4 bg-background p-6 shadow-lg",{variants:{side:{top:"inset-x-0 top-0 border-b",bottom:"inset-x-0 bottom-0 border-t",left:"inset-y-0 left-0 h-full w-[280px] border-r",right:"inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"}},defaultVariants:{side:"right"}}),DB=B.forwardRef(({className:t,...e},r)=>T.jsx(bc,{className:Ue("fixed inset-0 z-50 bg-black/80 animate-fade-in",t),...e,ref:r}));DB.displayName=bc.displayName;const Sy=B.forwardRef(({side:t="right",className:e,children:r,noClose:n,...i},s)=>{const o=t==="bottom"?"animate-slide-in-bottom":"animate-slide-in-right";return T.jsxs(If,{children:[T.jsx(DB,{}),T.jsxs(xc,{ref:s,className:Ue(QW({side:t}),o,e),...i,children:[!n&&T.jsxs(Pf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[T.jsx(qu,{className:"size-4"}),T.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]})});Sy.displayName=xc.displayName;const Ey=({className:t,...e})=>T.jsx("div",{className:Ue("flex flex-col space-y-2 text-center sm:text-left",t),...e});Ey.displayName="SheetHeader";const Ty=B.forwardRef(({className:t,...e},r)=>T.jsx(ph,{ref:r,className:Ue("text-lg font-semibold text-foreground",t),...e}));Ty.displayName=ph.displayName;const y2=B.forwardRef(({className:t,...e},r)=>T.jsx(Ff,{ref:r,className:Ue("text-sm text-muted-foreground",t),...e}));y2.displayName=Ff.displayName;var RB="AlertDialog",[JW]=ky(RB,[bB]),jo=bB(),IB=t=>{const{__scopeAlertDialog:e,...r}=t,n=jo(e);return T.jsx(Rf,{...n,...r,modal:!0})};IB.displayName=RB;var eq="AlertDialogTrigger",tq=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(ZW,{...i,...n,ref:e})});tq.displayName=eq;var rq="AlertDialogPortal",FB=t=>{const{__scopeAlertDialog:e,...r}=t,n=jo(e);return T.jsx(If,{...n,...r})};FB.displayName=rq;var nq="AlertDialogOverlay",PB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(bc,{...i,...n,ref:e})});PB.displayName=nq;var wu="AlertDialogContent",[iq,sq]=JW(wu),oq=gH("AlertDialogContent"),$B=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...i}=t,s=jo(r),o=B.useRef(null),a=Nn(e,o),l=B.useRef(null);return T.jsx(GW,{contentName:wu,titleName:zB,docsSlug:"alert-dialog",children:T.jsx(iq,{scope:r,cancelRef:l,children:T.jsxs(xc,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:mn(i.onOpenAutoFocus,c=>{var h;c.preventDefault(),(h=l.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[T.jsx(oq,{children:n}),T.jsx(lq,{contentRef:o})]})})})});$B.displayName=wu;var zB="AlertDialogTitle",jB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(ph,{...i,...n,ref:e})});jB.displayName=zB;var HB="AlertDialogDescription",WB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(Ff,{...i,...n,ref:e})});WB.displayName=HB;var aq="AlertDialogAction",qB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(Pf,{...i,...n,ref:e})});qB.displayName=aq;var UB="AlertDialogCancel",VB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:i}=sq(UB,r),s=jo(r),o=Nn(e,i);return T.jsx(Pf,{...s,...n,ref:o})});VB.displayName=UB;var lq=({contentRef:t})=>{const e=`\`${wu}\` requires a description for the component to be accessible for screen reader users.
265
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return B.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},YW="DialogDescriptionWarning",XW=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${OB(YW).contentName}}.`;return B.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Rf=xB,ZW=kB,If=wB,bc=_B,xc=SB,ph=TB,Ff=MB,Pf=LB;const m2=Rf,QW=a2("fixed z-50 gap-4 bg-background p-6 shadow-lg",{variants:{side:{top:"inset-x-0 top-0 border-b",bottom:"inset-x-0 bottom-0 border-t",left:"inset-y-0 left-0 h-full w-[280px] border-r",right:"inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"}},defaultVariants:{side:"right"}}),DB=B.forwardRef(({className:t,...e},r)=>T.jsx(bc,{className:We("fixed inset-0 z-50 bg-black/80 animate-fade-in",t),...e,ref:r}));DB.displayName=bc.displayName;const Sy=B.forwardRef(({side:t="right",className:e,children:r,noClose:n,...i},s)=>{const o=t==="bottom"?"animate-slide-in-bottom":"animate-slide-in-right";return T.jsxs(If,{children:[T.jsx(DB,{}),T.jsxs(xc,{ref:s,className:We(QW({side:t}),o,e),...i,children:[!n&&T.jsxs(Pf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[T.jsx(qu,{className:"size-4"}),T.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]})});Sy.displayName=xc.displayName;const Ey=({className:t,...e})=>T.jsx("div",{className:We("flex flex-col space-y-2 text-center sm:text-left",t),...e});Ey.displayName="SheetHeader";const Ty=B.forwardRef(({className:t,...e},r)=>T.jsx(ph,{ref:r,className:We("text-lg font-semibold text-foreground",t),...e}));Ty.displayName=ph.displayName;const y2=B.forwardRef(({className:t,...e},r)=>T.jsx(Ff,{ref:r,className:We("text-sm text-muted-foreground",t),...e}));y2.displayName=Ff.displayName;var RB="AlertDialog",[JW]=ky(RB,[bB]),jo=bB(),IB=t=>{const{__scopeAlertDialog:e,...r}=t,n=jo(e);return T.jsx(Rf,{...n,...r,modal:!0})};IB.displayName=RB;var eq="AlertDialogTrigger",tq=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(ZW,{...i,...n,ref:e})});tq.displayName=eq;var rq="AlertDialogPortal",FB=t=>{const{__scopeAlertDialog:e,...r}=t,n=jo(e);return T.jsx(If,{...n,...r})};FB.displayName=rq;var nq="AlertDialogOverlay",PB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(bc,{...i,...n,ref:e})});PB.displayName=nq;var wu="AlertDialogContent",[iq,sq]=JW(wu),oq=gH("AlertDialogContent"),$B=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...i}=t,s=jo(r),o=B.useRef(null),a=Nn(e,o),l=B.useRef(null);return T.jsx(GW,{contentName:wu,titleName:zB,docsSlug:"alert-dialog",children:T.jsx(iq,{scope:r,cancelRef:l,children:T.jsxs(xc,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:mn(i.onOpenAutoFocus,c=>{var h;c.preventDefault(),(h=l.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[T.jsx(oq,{children:n}),T.jsx(lq,{contentRef:o})]})})})});$B.displayName=wu;var zB="AlertDialogTitle",jB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(ph,{...i,...n,ref:e})});jB.displayName=zB;var HB="AlertDialogDescription",WB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(Ff,{...i,...n,ref:e})});WB.displayName=HB;var aq="AlertDialogAction",qB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,i=jo(r);return T.jsx(Pf,{...i,...n,ref:e})});qB.displayName=aq;var UB="AlertDialogCancel",VB=B.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:i}=sq(UB,r),s=jo(r),o=Nn(e,i);return T.jsx(Pf,{...s,...n,ref:o})});VB.displayName=UB;var lq=({contentRef:t})=>{const e=`\`${wu}\` requires a description for the component to be accessible for screen reader users.
266
266
 
267
267
  You can add a description to the \`${wu}\` by passing a \`${HB}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
268
268
 
269
269
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${wu}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
270
270
 
271
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return B.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},cq=IB,uq=FB,GB=PB,KB=$B,YB=qB,XB=VB,ZB=jB,QB=WB;const JB=cq,hq=uq,eO=B.forwardRef(({className:t,...e},r)=>T.jsx(GB,{className:Ue("fixed inset-0 z-50 bg-black/80 animate-fade-in",t),...e,ref:r}));eO.displayName=GB.displayName;const b2=B.forwardRef(({className:t,...e},r)=>T.jsxs(hq,{children:[T.jsx(eO,{}),T.jsx(KB,{ref:r,className:Ue("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 animate-zoom-in sm:rounded-lg",t),...e})]}));b2.displayName=KB.displayName;const x2=({className:t,...e})=>T.jsx("div",{className:Ue("flex flex-col space-y-2 text-center sm:text-left",t),...e});x2.displayName="AlertDialogHeader";const C2=({className:t,...e})=>T.jsx("div",{className:Ue("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});C2.displayName="AlertDialogFooter";const k2=B.forwardRef(({className:t,...e},r)=>T.jsx(ZB,{ref:r,className:Ue("text-lg font-semibold",t),...e}));k2.displayName=ZB.displayName;const v2=B.forwardRef(({className:t,id:e,...r},n)=>T.jsx(QB,{ref:n,id:e,className:Ue("text-sm text-muted-foreground",t),...r}));v2.displayName=QB.displayName;const w2=B.forwardRef(({className:t,...e},r)=>T.jsx(YB,{ref:r,className:Ue(l2(),t),...e}));w2.displayName=YB.displayName;const _2=B.forwardRef(({className:t,...e},r)=>T.jsx(XB,{ref:r,className:Ue(l2({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));_2.displayName=XB.displayName;function $T({item:t,currentDir:e,onRenameRequest:r,onMoveRequest:n,onCopyRequest:i,onDelete:s,onCreateRequest:o}){const[a,l]=B.useState(!1),[c,h]=B.useState(!1),[d,g]=B.useState(!1);B.useEffect(()=>{const x=()=>g(window.innerWidth<768);return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]),B.useEffect(()=>{l(!!t)},[t]);const p=()=>{l(!1)},m=()=>{h(!0)},y=()=>{t&&s(t.path),h(!1),p()};return t?T.jsxs(T.Fragment,{children:[T.jsx(m2,{open:a,onOpenChange:p,children:T.jsxs(Sy,{side:d?"bottom":"right",className:Ue("p-0",!d&&"w-[200px] sm:w-[240px]"),children:[T.jsx(Ey,{className:"p-4 border-b",children:T.jsxs(Ty,{className:"text-sm font-normal flex items-center gap-2",children:[t.type==="directory"?T.jsx(Li,{className:"size-4"}):T.jsx(Fo,{className:"size-4"}),T.jsx("span",{className:"truncate",children:t.name})]})}),T.jsxs("div",{className:"p-2",children:[T.jsxs("div",{className:"flex gap-1 mb-2",children:[T.jsxs(Dt,{variant:"outline",size:"sm",className:"flex-1 gap-1",onClick:()=>{o==null||o(!1,t.type==="directory"?t.path:e),p()},children:[T.jsx(WC,{className:"size-4"}),"新建文件"]}),T.jsxs(Dt,{variant:"outline",size:"sm",className:"flex-1 gap-1",onClick:()=>{o==null||o(!0,t.type==="directory"?t.path:e),p()},children:[T.jsx(WC,{className:"size-4"}),"新建文件夹"]})]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm",onClick:()=>{r(t),p()},children:[T.jsx(A7,{className:"size-4"}),"重命名"]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm",onClick:()=>{n(t),p()},children:[T.jsx(p7,{className:"size-4"}),"移动到"]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm",onClick:()=>{i==null||i(t),p()},children:[T.jsx(l7,{className:"size-4"}),"复制到"]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm text-destructive hover:text-destructive",onClick:m,children:[T.jsx(mL,{className:"size-4"}),"删除"]})]})]})}),T.jsx(JB,{open:c,onOpenChange:h,children:T.jsxs(b2,{children:[T.jsxs(x2,{children:[T.jsx(k2,{children:"确认删除"}),T.jsx(v2,{children:t.type==="directory"&&t.childrenCount&&t.childrenCount>0?T.jsxs("span",{className:"text-destructive font-medium",children:["文件夹「",t.name,"」包含 ",t.childrenCount," 个项目,删除后将全部删除且无法恢复。确定要继续吗?"]}):T.jsxs(T.Fragment,{children:["确定要删除「",t.name,"」吗?此操作无法撤销。"]})})]}),T.jsxs(C2,{children:[T.jsx(_2,{children:"取消"}),T.jsx(w2,{onClick:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})]}):null}function tO({node:t,activePath:e,expandedPaths:r,setExpandedPaths:n,onSelect:i,onDelete:s,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onExpand:c,editingType:h,onEditingChange:d,onCreateSubmit:g,onCreateRequest:p,currentDir:m,activeRoot:y}){var j,ie;const[x,C]=B.useState(""),[v,_]=B.useState(null),M=B.useRef(null),L=t.type==="directory",N=t.path===e&&t.rootPath===y,E=r.has(t.path);L&&t.children&&t.children.length>0;const O=((j=t.children)==null?void 0:j.length)||0;B.useEffect(()=>{h&&t.path===m&&setTimeout(()=>{var J;(J=M.current)==null||J.focus()},50)},[h,m]);const I=()=>{x.trim()&&g&&(g(x.trim(),h==="directory"),C(""),d==null||d(null))},$=()=>{x.trim()&&g?I():(C(""),d==null||d(null))};return L?T.jsx(lm,{className:"sidebar-menu-item",children:T.jsxs(NH,{className:"group/collapsible",open:E,onOpenChange:J=>{J&&c&&c(t.path),n(G=>{const H=new Set(G);return J?H.add(t.path):H.delete(t.path),H})},children:[T.jsxs("div",{className:"flex items-center relative",children:[T.jsx(LH,{asChild:!0,children:T.jsxs(ET,{isActive:N,className:"data-[active=true]:bg-transparent flex-1 pr-8",children:[T.jsx(Zv,{className:Ue("size-4 shrink-0 transition-transform",E&&"rotate-90")}),T.jsx(Li,{className:"size-4 shrink-0"}),T.jsx("span",{className:"flex-1 whitespace-nowrap",children:t.name})]})}),T.jsx("button",{"data-sidebar":"menu-action",onClick:()=>_({path:t.path,name:t.name,type:"directory",childrenCount:O}),className:"sidebar-menu-item-action absolute right-1 top-1/2 -translate-y-1/2 size-6 flex items-center justify-center rounded-md hover:bg-accent z-10",children:T.jsx(nT,{className:"size-3.5"})})]}),T.jsx($T,{item:v,currentDir:m,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onDelete:s,onCreateRequest:p}),T.jsx(tB,{children:T.jsxs(FH,{children:[(ie=t.children)==null?void 0:ie.map(J=>T.jsx(tO,{node:J,activePath:e,expandedPaths:r,setExpandedPaths:n,onSelect:i,onDelete:s,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onExpand:c,editingType:h,onEditingChange:d,onCreateSubmit:g,onCreateRequest:p,currentDir:m,activeRoot:y},J.path)),h&&t.path===m&&T.jsx(lm,{className:"px-2",children:T.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[h==="directory"?T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Fo,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx(fh,{ref:M,id:`create-input-${t.path}`,placeholder:h==="directory"?"文件夹名称":"文件名称",value:x,onChange:J=>C(J.target.value),onKeyDown:J=>{J.key==="Enter"?I():J.key==="Escape"&&(C(""),d==null||d(null))},onBlur:$,className:"h-7 text-sm",autoFocus:!0})]})})]})})]})}):T.jsxs(lm,{className:"sidebar-menu-item",children:[T.jsxs(ET,{isActive:N,className:"data-[active=true]:bg-sidebar-accent pr-8",onClick:()=>i(t.path,"file",y||void 0),children:[T.jsx(pL,{className:"size-4 shrink-0"}),T.jsx("span",{className:"flex-1 whitespace-nowrap",children:t.name})]}),T.jsx("button",{"data-sidebar":"menu-action",onClick:J=>{J.stopPropagation(),_({path:t.path,name:t.name,type:"file"})},className:"sidebar-menu-item-action absolute right-1 top-1/2 -translate-y-1/2 size-6 flex items-center justify-center rounded-md hover:bg-accent z-10",children:T.jsx(nT,{className:"size-3.5"})}),T.jsx($T,{item:v,currentDir:m,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onDelete:s,onCreateRequest:p})]})}const dq=({activeRoot:t})=>{const e=(t==null?void 0:t.split("/").pop())||"根目录";return T.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground text-sm text-center p-6",children:[T.jsx(Li,{className:"size-12 mb-4 opacity-50"}),T.jsxs("div",{className:"mb-2",children:["根目录「",e,"」暂无文件"]}),T.jsx("p",{className:"text-xs",children:"点击上方「新建文件」按钮创建第一个文件"})]})},fq=B.memo(function({files:e,activePath:r,activeRoot:n,currentDir:i,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x}){const[C,v]=B.useState(""),_=B.useRef(null);B.useEffect(()=>{p&&_.current&&_.current.focus()},[p]);const M=()=>{C.trim()&&y&&(y(C.trim(),p==="directory"),v(""),m&&m(null))},L=O=>{O.key==="Enter"?M():O.key==="Escape"&&(v(""),m&&m(null))},N=()=>{C.trim()&&y?M():(v(""),m&&m(null))},E=i?i.split("/").filter(Boolean).join(" / "):"根目录";return e.length===0&&!p?T.jsx("div",{className:"flex-1 overflow-y-auto",children:T.jsx(dq,{activeRoot:n})}):T.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-auto",children:T.jsxs("div",{className:"min-w-max",children:[T.jsxs(BH,{children:[T.jsxs("div",{className:"flex items-center justify-between px-2",children:[T.jsx(OH,{children:"Files"}),T.jsxs("div",{className:"flex gap-1",children:[T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>x==null?void 0:x(!1,""),title:"新建文件",children:T.jsx(Fo,{className:"size-4"})}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>x==null?void 0:x(!0,""),title:"新建文件夹",children:T.jsx(Li,{className:"size-4"})})]})]}),T.jsx(DH,{children:T.jsxs(RH,{children:[e.map(O=>T.jsx(tO,{node:O,activePath:r,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x,currentDir:i,activeRoot:n},O.path)),p&&(i===""||i==="/")&&T.jsx(lm,{className:"sidebar-menu-item",children:T.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 w-full",children:[p==="directory"?T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Fo,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx(fh,{id:"root-create-input",placeholder:p==="directory"?"文件夹名称":"文件名称",value:C,onChange:O=>v(O.target.value),onKeyDown:L,onBlur:N,className:"h-7 text-sm",autoFocus:!0})]})})]})})]}),p&&T.jsxs("div",{className:"px-4 py-2 text-xs text-muted-foreground border-t",children:["位置: ",E]})]})})});var yx={exports:{}},bx={};/**
271
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return B.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},cq=IB,uq=FB,GB=PB,KB=$B,YB=qB,XB=VB,ZB=jB,QB=WB;const JB=cq,hq=uq,eO=B.forwardRef(({className:t,...e},r)=>T.jsx(GB,{className:We("fixed inset-0 z-50 bg-black/80 animate-fade-in",t),...e,ref:r}));eO.displayName=GB.displayName;const b2=B.forwardRef(({className:t,...e},r)=>T.jsxs(hq,{children:[T.jsx(eO,{}),T.jsx(KB,{ref:r,className:We("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 animate-zoom-in sm:rounded-lg",t),...e})]}));b2.displayName=KB.displayName;const x2=({className:t,...e})=>T.jsx("div",{className:We("flex flex-col space-y-2 text-center sm:text-left",t),...e});x2.displayName="AlertDialogHeader";const C2=({className:t,...e})=>T.jsx("div",{className:We("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});C2.displayName="AlertDialogFooter";const k2=B.forwardRef(({className:t,...e},r)=>T.jsx(ZB,{ref:r,className:We("text-lg font-semibold",t),...e}));k2.displayName=ZB.displayName;const v2=B.forwardRef(({className:t,id:e,...r},n)=>T.jsx(QB,{ref:n,id:e,className:We("text-sm text-muted-foreground",t),...r}));v2.displayName=QB.displayName;const w2=B.forwardRef(({className:t,...e},r)=>T.jsx(YB,{ref:r,className:We(l2(),t),...e}));w2.displayName=YB.displayName;const _2=B.forwardRef(({className:t,...e},r)=>T.jsx(XB,{ref:r,className:We(l2({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));_2.displayName=XB.displayName;function $T({item:t,currentDir:e,onRenameRequest:r,onMoveRequest:n,onCopyRequest:i,onDelete:s,onCreateRequest:o}){const[a,l]=B.useState(!1),[c,h]=B.useState(!1),[d,g]=B.useState(!1);B.useEffect(()=>{const x=()=>g(window.innerWidth<768);return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]),B.useEffect(()=>{l(!!t)},[t]);const p=()=>{l(!1)},m=()=>{h(!0)},y=()=>{t&&s(t.path),h(!1),p()};return t?T.jsxs(T.Fragment,{children:[T.jsx(m2,{open:a,onOpenChange:p,children:T.jsxs(Sy,{side:d?"bottom":"right",className:We("p-0",!d&&"w-[200px] sm:w-[240px]"),children:[T.jsx(Ey,{className:"p-4 border-b",children:T.jsxs(Ty,{className:"text-sm font-normal flex items-center gap-2",children:[t.type==="directory"?T.jsx(Li,{className:"size-4"}):T.jsx(Fo,{className:"size-4"}),T.jsx("span",{className:"truncate",children:t.name})]})}),T.jsxs("div",{className:"p-2",children:[T.jsxs("div",{className:"flex gap-1 mb-2",children:[T.jsxs(Dt,{variant:"outline",size:"sm",className:"flex-1 gap-1",onClick:()=>{o==null||o(!1,t.type==="directory"?t.path:e),p()},children:[T.jsx(WC,{className:"size-4"}),"新建文件"]}),T.jsxs(Dt,{variant:"outline",size:"sm",className:"flex-1 gap-1",onClick:()=>{o==null||o(!0,t.type==="directory"?t.path:e),p()},children:[T.jsx(WC,{className:"size-4"}),"新建文件夹"]})]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm",onClick:()=>{r(t),p()},children:[T.jsx(A7,{className:"size-4"}),"重命名"]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm",onClick:()=>{n(t),p()},children:[T.jsx(p7,{className:"size-4"}),"移动到"]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm",onClick:()=>{i==null||i(t),p()},children:[T.jsx(l7,{className:"size-4"}),"复制到"]}),T.jsxs(Dt,{variant:"ghost",className:"w-full justify-start gap-2 text-sm text-destructive hover:text-destructive",onClick:m,children:[T.jsx(mL,{className:"size-4"}),"删除"]})]})]})}),T.jsx(JB,{open:c,onOpenChange:h,children:T.jsxs(b2,{children:[T.jsxs(x2,{children:[T.jsx(k2,{children:"确认删除"}),T.jsx(v2,{children:t.type==="directory"&&t.childrenCount&&t.childrenCount>0?T.jsxs("span",{className:"text-destructive font-medium",children:["文件夹「",t.name,"」包含 ",t.childrenCount," 个项目,删除后将全部删除且无法恢复。确定要继续吗?"]}):T.jsxs(T.Fragment,{children:["确定要删除「",t.name,"」吗?此操作无法撤销。"]})})]}),T.jsxs(C2,{children:[T.jsx(_2,{children:"取消"}),T.jsx(w2,{onClick:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})]}):null}function tO({node:t,activePath:e,expandedPaths:r,setExpandedPaths:n,onSelect:i,onDelete:s,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onExpand:c,editingType:h,onEditingChange:d,onCreateSubmit:g,onCreateRequest:p,currentDir:m,activeRoot:y}){var j,ie;const[x,C]=B.useState(""),[v,_]=B.useState(null),M=B.useRef(null),L=t.type==="directory",N=t.path===e&&t.rootPath===y,E=r.has(t.path);L&&t.children&&t.children.length>0;const O=((j=t.children)==null?void 0:j.length)||0;B.useEffect(()=>{h&&t.path===m&&setTimeout(()=>{var J;(J=M.current)==null||J.focus()},50)},[h,m]);const I=()=>{x.trim()&&g&&(g(x.trim(),h==="directory"),C(""),d==null||d(null))},$=()=>{x.trim()&&g?I():(C(""),d==null||d(null))};return L?T.jsx(lm,{className:"sidebar-menu-item",children:T.jsxs(NH,{className:"group/collapsible",open:E,onOpenChange:J=>{J&&c&&c(t.path),n(G=>{const H=new Set(G);return J?H.add(t.path):H.delete(t.path),H})},children:[T.jsxs("div",{className:"flex items-center relative",children:[T.jsx(LH,{asChild:!0,children:T.jsxs(ET,{isActive:N,className:"data-[active=true]:bg-transparent flex-1 pr-8",children:[T.jsx(Zv,{className:We("size-4 shrink-0 transition-transform",E&&"rotate-90")}),T.jsx(Li,{className:"size-4 shrink-0"}),T.jsx("span",{className:"flex-1 whitespace-nowrap",children:t.name})]})}),T.jsx("button",{"data-sidebar":"menu-action",onClick:()=>_({path:t.path,name:t.name,type:"directory",childrenCount:O}),className:"sidebar-menu-item-action absolute right-1 top-1/2 -translate-y-1/2 size-6 flex items-center justify-center rounded-md hover:bg-accent z-10",children:T.jsx(nT,{className:"size-3.5"})})]}),T.jsx($T,{item:v,currentDir:m,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onDelete:s,onCreateRequest:p}),T.jsx(tB,{children:T.jsxs(FH,{children:[(ie=t.children)==null?void 0:ie.map(J=>T.jsx(tO,{node:J,activePath:e,expandedPaths:r,setExpandedPaths:n,onSelect:i,onDelete:s,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onExpand:c,editingType:h,onEditingChange:d,onCreateSubmit:g,onCreateRequest:p,currentDir:m,activeRoot:y},J.path)),h&&t.path===m&&T.jsx(lm,{className:"px-2",children:T.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[h==="directory"?T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Fo,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx(fh,{ref:M,id:`create-input-${t.path}`,placeholder:h==="directory"?"文件夹名称":"文件名称",value:x,onChange:J=>C(J.target.value),onKeyDown:J=>{J.key==="Enter"?I():J.key==="Escape"&&(C(""),d==null||d(null))},onBlur:$,className:"h-7 text-sm",autoFocus:!0})]})})]})})]})}):T.jsxs(lm,{className:"sidebar-menu-item",children:[T.jsxs(ET,{isActive:N,className:"data-[active=true]:bg-sidebar-accent pr-8",onClick:()=>i(t.path,"file",y||void 0),children:[T.jsx(pL,{className:"size-4 shrink-0"}),T.jsx("span",{className:"flex-1 whitespace-nowrap",children:t.name})]}),T.jsx("button",{"data-sidebar":"menu-action",onClick:J=>{J.stopPropagation(),_({path:t.path,name:t.name,type:"file"})},className:"sidebar-menu-item-action absolute right-1 top-1/2 -translate-y-1/2 size-6 flex items-center justify-center rounded-md hover:bg-accent z-10",children:T.jsx(nT,{className:"size-3.5"})}),T.jsx($T,{item:v,currentDir:m,onRenameRequest:o,onMoveRequest:a,onCopyRequest:l,onDelete:s,onCreateRequest:p})]})}const dq=({activeRoot:t})=>{const e=(t==null?void 0:t.split("/").pop())||"根目录";return T.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground text-sm text-center p-6",children:[T.jsx(Li,{className:"size-12 mb-4 opacity-50"}),T.jsxs("div",{className:"mb-2",children:["根目录「",e,"」暂无文件"]}),T.jsx("p",{className:"text-xs",children:"点击上方「新建文件」按钮创建第一个文件"})]})},fq=B.memo(function({files:e,activePath:r,activeRoot:n,currentDir:i,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x}){const[C,v]=B.useState(""),_=B.useRef(null);B.useEffect(()=>{p&&_.current&&_.current.focus()},[p]);const M=()=>{C.trim()&&y&&(y(C.trim(),p==="directory"),v(""),m&&m(null))},L=O=>{O.key==="Enter"?M():O.key==="Escape"&&(v(""),m&&m(null))},N=()=>{C.trim()&&y?M():(v(""),m&&m(null))},E=i?i.split("/").filter(Boolean).join(" / "):"根目录";return e.length===0&&!p?T.jsx("div",{className:"flex-1 overflow-y-auto",children:T.jsx(dq,{activeRoot:n})}):T.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-auto",children:T.jsxs("div",{className:"min-w-max",children:[T.jsxs(BH,{children:[T.jsxs("div",{className:"flex items-center justify-between px-2",children:[T.jsx(OH,{children:"Files"}),T.jsxs("div",{className:"flex gap-1",children:[T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>x==null?void 0:x(!1,""),title:"新建文件",children:T.jsx(Fo,{className:"size-4"})}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>x==null?void 0:x(!0,""),title:"新建文件夹",children:T.jsx(Li,{className:"size-4"})})]})]}),T.jsx(DH,{children:T.jsxs(RH,{children:[e.map(O=>T.jsx(tO,{node:O,activePath:r,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x,currentDir:i,activeRoot:n},O.path)),p&&(i===""||i==="/")&&T.jsx(lm,{className:"sidebar-menu-item",children:T.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 w-full",children:[p==="directory"?T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Fo,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx(fh,{id:"root-create-input",placeholder:p==="directory"?"文件夹名称":"文件名称",value:C,onChange:O=>v(O.target.value),onKeyDown:L,onBlur:N,className:"h-7 text-sm",autoFocus:!0})]})})]})})]}),p&&T.jsxs("div",{className:"px-4 py-2 text-xs text-muted-foreground border-t",children:["位置: ",E]})]})})});var yx={exports:{}},bx={};/**
272
272
  * @license React
273
273
  * use-sync-external-store-shim.production.js
274
274
  *
@@ -760,8 +760,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
760
760
  L0,20`)},"requirement_arrow"),p0e=S((t,e,r)=>{const n=br(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
761
761
  L20,10
762
762
  M20,10
763
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),g0e=S((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),m0e=S((t,e,r)=>{const n=br(),{themeVariables:i}=n,{strokeWidth:s}=i,o=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),y0e={extension:Yme,composition:Xme,aggregation:Zme,dependency:Qme,lollipop:Jme,point:e0e,circle:t0e,cross:r0e,barb:n0e,barbNeo:i0e,only_one:s0e,zero_or_one:o0e,one_or_more:a0e,zero_or_more:l0e,only_one_neo:c0e,zero_or_one_neo:u0e,one_or_more_neo:h0e,zero_or_more_neo:d0e,requirement_arrow:f0e,requirement_contains:g0e,requirement_arrow_neo:p0e,requirement_contains_neo:m0e},b0e=Kme,x0e={common:Yf,getConfig:br,insertCluster:mme,insertEdge:Gme,insertEdgeLabel:jme,insertMarkers:b0e,insertNode:M8,interpolateToCurve:t_,labelHelper:ut,log:ge,positionEdgeLabel:Hme},Bf={},O8=S(t=>{for(const e of t)Bf[e.name]=e},"registerLayoutLoaders"),C0e=S(()=>{O8([{name:"dagre",loader:S(async()=>await Bt(()=>import("./dagre-KV5264BT-COm1avIi.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:S(async()=>await Bt(()=>import("./cose-bilkent-S5V4N54A-DVBMSGze.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");C0e();var OCe=S(async(t,e)=>{if(!(t.layoutAlgorithm in Bf))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);if(t.diagramId)for(const h of t.nodes){const d=h.domId||h.id;h.domId=`${t.diagramId}-${d}`}const r=Bf[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=s,c=e.attr("id");if(e.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),o){const h=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",a).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return n.render(t,e,x0e,{algorithm:r.algorithm})},"render"),DCe=S((t="",{fallback:e="dagre"}={})=>{if(t in Bf)return t;if(e in Bf)return ge.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),D8="comm",R8="rule",I8="decl",k0e="@import",v0e="@namespace",w0e="@keyframes",_0e="@layer",F8=Math.abs,v_=String.fromCharCode;function P8(t){return t.trim()}function Nm(t,e,r){return t.replace(e,r)}function S0e(t,e,r){return t.indexOf(e,r)}function Mu(t,e){return t.charCodeAt(e)|0}function lh(t,e,r){return t.slice(e,r)}function Hs(t){return t.length}function E0e(t){return t.length}function im(t,e){return e.push(t),t}var gb=1,ch=1,$8=0,Qi=0,Ir=0,kh="";function w_(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:gb,column:ch,length:o,return:"",siblings:a}}function T0e(){return Ir}function A0e(){return Ir=Qi>0?Mu(kh,--Qi):0,ch--,Ir===10&&(ch=1,gb--),Ir}function xs(){return Ir=Qi<$8?Mu(kh,Qi++):0,ch++,Ir===10&&(ch=1,gb++),Ir}function Ia(){return Mu(kh,Qi)}function Lm(){return Qi}function mb(t,e){return lh(kh,t,e)}function Of(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function M0e(t){return gb=ch=1,$8=Hs(kh=t),Qi=0,[]}function N0e(t){return kh="",t}function RC(t){return P8(mb(Qi-1,Pv(t===91?t+2:t===40?t+1:t)))}function L0e(t){for(;(Ir=Ia())&&Ir<33;)xs();return Of(t)>2||Of(Ir)>3?"":" "}function B0e(t,e){for(;--e&&xs()&&!(Ir<48||Ir>102||Ir>57&&Ir<65||Ir>70&&Ir<97););return mb(t,Lm()+(e<6&&Ia()==32&&xs()==32))}function Pv(t){for(;xs();)switch(Ir){case t:return Qi;case 34:case 39:t!==34&&t!==39&&Pv(Ir);break;case 40:t===41&&Pv(t);break;case 92:xs();break}return Qi}function O0e(t,e){for(;xs()&&t+Ir!==57;)if(t+Ir===84&&Ia()===47)break;return"/*"+mb(e,Qi-1)+"*"+v_(t===47?t:xs())}function D0e(t){for(;!Of(Ia());)xs();return mb(t,Qi)}function R0e(t){return N0e(Bm("",null,null,null,[""],t=M0e(t),0,[0],t))}function Bm(t,e,r,n,i,s,o,a,l){for(var c=0,h=0,d=o,g=0,p=0,m=0,y=1,x=1,C=1,v=0,_="",M=i,L=s,N=n,E=_;x;)switch(m=v,v=xs()){case 40:if(m!=108&&Mu(E,d-1)==58){S0e(E+=Nm(RC(v),"&","&\f"),"&\f",F8(c?a[c-1]:0))!=-1&&(C=-1);break}case 34:case 39:case 91:E+=RC(v);break;case 9:case 10:case 13:case 32:E+=L0e(m);break;case 92:E+=B0e(Lm()-1,7);continue;case 47:switch(Ia()){case 42:case 47:im(I0e(O0e(xs(),Lm()),e,r,l),l),(Of(m||1)==5||Of(Ia()||1)==5)&&Hs(E)&&lh(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*y:a[c++]=Hs(E)*C;case 125*y:case 59:case 0:switch(v){case 0:case 125:x=0;case 59+h:C==-1&&(E=Nm(E,/\f/g,"")),p>0&&(Hs(E)-d||y===0&&m===47)&&im(p>32?XN(E+";",n,r,d-1,l):XN(Nm(E," ","")+";",n,r,d-2,l),l);break;case 59:E+=";";default:if(im(N=YN(E,e,r,c,h,i,a,_,M=[],L=[],d,s),s),v===123)if(h===0)Bm(E,e,N,N,M,s,d,a,L);else{switch(g){case 99:if(Mu(E,3)===110)break;case 108:if(Mu(E,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Bm(t,N,N,n&&im(YN(t,N,N,0,0,i,a,_,i,M=[],d,L),L),i,L,d,a,n?M:L):Bm(E,N,N,N,[""],L,0,a,L)}}c=h=p=0,y=C=1,_=E="",d=o;break;case 58:d=1+Hs(E),p=m;default:if(y<1){if(v==123)--y;else if(v==125&&y++==0&&A0e()==125)continue}switch(E+=v_(v),v*y){case 38:C=h>0?1:(E+="\f",-1);break;case 44:a[c++]=(Hs(E)-1)*C,C=1;break;case 64:Ia()===45&&(E+=RC(xs())),g=Ia(),h=d=Hs(_=E+=D0e(Lm())),v++;break;case 45:m===45&&Hs(E)==2&&(y=0)}}return s}function YN(t,e,r,n,i,s,o,a,l,c,h,d){for(var g=i-1,p=i===0?s:[""],m=E0e(p),y=0,x=0,C=0;y<n;++y)for(var v=0,_=lh(t,g+1,g=F8(x=o[y])),M=t;v<m;++v)(M=P8(x>0?p[v]+" "+_:Nm(_,/&\f/g,p[v])))&&(l[C++]=M);return w_(t,e,r,i===0?R8:a,l,c,h,d)}function I0e(t,e,r,n){return w_(t,e,r,D8,v_(T0e()),lh(t,2,-2),0,n)}function XN(t,e,r,n,i){return w_(t,e,r,I8,lh(t,0,n),lh(t,n+1,-1),n,i)}function $v(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function F0e(t,e,r,n){switch(t.type){case _0e:if(t.children.length)break;case k0e:case v0e:case I8:return t.return=t.return||t.value;case D8:return"";case w0e:return t.return=t.value+"{"+$v(t.children,n)+"}";case R8:if(!Hs(t.value=t.props.join(",")))return""}return Hs(r=$v(t.children,n))?t.return=t.value+"{"+r+"}":""}var P0e=lF(Object.keys,Object),$0e=Object.prototype,z0e=$0e.hasOwnProperty;function j0e(t){if(!ob(t))return P0e(t);var e=[];for(var r in Object(t))z0e.call(t,r)&&r!="constructor"&&e.push(r);return e}var zv=_c(oo,"DataView"),jv=_c(oo,"Promise"),Hv=_c(oo,"Set"),Wv=_c(oo,"WeakMap"),ZN="[object Map]",H0e="[object Object]",QN="[object Promise]",JN="[object Set]",eL="[object WeakMap]",tL="[object DataView]",W0e=wc(zv),q0e=wc(Nf),U0e=wc(jv),V0e=wc(Hv),G0e=wc(Wv),Bl=yh;(zv&&Bl(new zv(new ArrayBuffer(1)))!=tL||Nf&&Bl(new Nf)!=ZN||jv&&Bl(jv.resolve())!=QN||Hv&&Bl(new Hv)!=JN||Wv&&Bl(new Wv)!=eL)&&(Bl=function(t){var e=yh(t),r=e==H0e?t.constructor:void 0,n=r?wc(r):"";if(n)switch(n){case W0e:return tL;case q0e:return ZN;case U0e:return QN;case V0e:return JN;case G0e:return eL}return e});var K0e="[object Map]",Y0e="[object Set]",X0e=Object.prototype,Z0e=X0e.hasOwnProperty;function rL(t){if(t==null)return!0;if(ab(t)&&(oy(t)||typeof t=="string"||typeof t.splice=="function"||Jw(t)||e_(t)||sy(t)))return!t.length;var e=Bl(t);if(e==K0e||e==Y0e)return!t.size;if(ob(t))return!j0e(t).length;for(var r in t)if(Z0e.call(t,r))return!1;return!0}var z8="c4",Q0e=S(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),J0e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./c4Diagram-AHTNJAMY-fQ1soS6G.js");return{diagram:e}},__vite__mapDeps([8,9]));return{id:z8,diagram:t}},"loader"),eye={id:z8,detector:Q0e,loader:J0e},tye=eye,j8="flowchart",rye=S((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),nye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-DAdHTFWv.js");return{diagram:e}},__vite__mapDeps([10,11,9,12,13,14]));return{id:j8,diagram:t}},"loader"),iye={id:j8,detector:rye,loader:nye},sye=iye,H8="flowchart-v2",oye=S((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),aye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-DAdHTFWv.js");return{diagram:e}},__vite__mapDeps([10,11,9,12,13,14]));return{id:H8,diagram:t}},"loader"),lye={id:H8,detector:oye,loader:aye},cye=lye,W8="er",uye=S(t=>/^\s*erDiagram/.test(t),"detector"),hye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./erDiagram-SMLLAGMA-ogyu4HEv.js");return{diagram:e}},__vite__mapDeps([15,12,13,14]));return{id:W8,diagram:t}},"loader"),dye={id:W8,detector:uye,loader:hye},fye=dye,q8="gitGraph",pye=S(t=>/^\s*gitGraph/.test(t),"detector"),gye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-UUTBAWPF-DtK9J5bd.js");return{diagram:e}},__vite__mapDeps([16,17,18,19,4,2]));return{id:q8,diagram:t}},"loader"),mye={id:q8,detector:pye,loader:gye},yye=mye,U8="gantt",bye=S(t=>/^\s*gantt/.test(t),"detector"),xye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./ganttDiagram-T4ZO3ILL-DrS8W1v-.js");return{diagram:e}},__vite__mapDeps([20,21,22,23]));return{id:U8,diagram:t}},"loader"),Cye={id:U8,detector:bye,loader:xye},kye=Cye,V8="info",vye=S(t=>/^\s*info/.test(t),"detector"),wye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./infoDiagram-42DDH7IO-C-F87kp2.js");return{diagram:e}},__vite__mapDeps([24,19,4,2]));return{id:V8,diagram:t}},"loader"),_ye={id:V8,detector:vye,loader:wye},G8="pie",Sye=S(t=>/^\s*pie/.test(t),"detector"),Eye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./pieDiagram-DEJITSTG-QjO816qL.js");return{diagram:e}},__vite__mapDeps([25,17,19,4,2,26,27,22]));return{id:G8,diagram:t}},"loader"),Tye={id:G8,detector:Sye,loader:Eye},K8="quadrantChart",Aye=S(t=>/^\s*quadrantChart/.test(t),"detector"),Mye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./quadrantDiagram-34T5L4WZ-BDxYyK8x.js");return{diagram:e}},__vite__mapDeps([28,21,22,23]));return{id:K8,diagram:t}},"loader"),Nye={id:K8,detector:Aye,loader:Mye},Lye=Nye,Y8="xychart",Bye=S(t=>/^\s*xychart(-beta)?/.test(t),"detector"),Oye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./xychartDiagram-5P7HB3ND-gAPYB-k3.js");return{diagram:e}},__vite__mapDeps([29,22,27,21,23]));return{id:Y8,diagram:t}},"loader"),Dye={id:Y8,detector:Bye,loader:Oye},Rye=Dye,X8="requirement",Iye=S(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),Fye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./requirementDiagram-MS252O5E-CTRbkAm3.js");return{diagram:e}},__vite__mapDeps([30,12,13]));return{id:X8,diagram:t}},"loader"),Pye={id:X8,detector:Iye,loader:Fye},$ye=Pye,Z8="sequence",zye=S(t=>/^\s*sequenceDiagram/.test(t),"detector"),jye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./sequenceDiagram-FGHM5R23-UyatbRZw.js");return{diagram:e}},__vite__mapDeps([31,9,18]));return{id:Z8,diagram:t}},"loader"),Hye={id:Z8,detector:zye,loader:jye},Wye=Hye,Q8="class",qye=S((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),Uye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./classDiagram-6PBFFD2Q-CZdm6ATq.js");return{diagram:e}},__vite__mapDeps([32,33,11,9,12,13]));return{id:Q8,diagram:t}},"loader"),Vye={id:Q8,detector:qye,loader:Uye},Gye=Vye,J8="classDiagram",Kye=S((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),Yye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./classDiagram-v2-HSJHXN6E-CZdm6ATq.js");return{diagram:e}},__vite__mapDeps([34,33,11,9,12,13]));return{id:J8,diagram:t}},"loader"),Xye={id:J8,detector:Kye,loader:Yye},Zye=Xye,e$="state",Qye=S((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),Jye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./stateDiagram-FHFEXIEX-ClKORA1p.js");return{diagram:e}},__vite__mapDeps([35,36,12,13,1,2,3,4]));return{id:e$,diagram:t}},"loader"),ebe={id:e$,detector:Qye,loader:Jye},tbe=ebe,t$="stateDiagram",rbe=S((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),nbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-QKLJ7IA2-Cf33alPP.js");return{diagram:e}},__vite__mapDeps([37,36,12,13]));return{id:t$,diagram:t}},"loader"),ibe={id:t$,detector:rbe,loader:nbe},sbe=ibe,r$="journey",obe=S(t=>/^\s*journey/.test(t),"detector"),abe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./journeyDiagram-VCZTEJTY-DLdy6qU_.js");return{diagram:e}},__vite__mapDeps([38,11,9,26]));return{id:r$,diagram:t}},"loader"),lbe={id:r$,detector:obe,loader:abe},cbe=lbe,ube=S((t,e,r)=>{ge.debug(`rendering svg for syntax error
764
- `);const n=Oue(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),TI(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),n$={draw:ube},hbe=n$,dbe={db:{},renderer:n$,parser:{parse:S(()=>{},"parse")}},fbe=dbe,i$="flowchart-elk",pbe=S((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),gbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-DAdHTFWv.js");return{diagram:e}},__vite__mapDeps([10,11,9,12,13,14]));return{id:i$,diagram:t}},"loader"),mbe={id:i$,detector:pbe,loader:gbe},ybe=mbe,s$="timeline",bbe=S(t=>/^\s*timeline/.test(t),"detector"),xbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./timeline-definition-GMOUNBTQ-BaJ6GkFx.js");return{diagram:e}},__vite__mapDeps([39,26]));return{id:s$,diagram:t}},"loader"),Cbe={id:s$,detector:bbe,loader:xbe},kbe=Cbe,o$="mindmap",vbe=S(t=>/^\s*mindmap/.test(t),"detector"),wbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./mindmap-definition-QFDTVHPH-DPQMmeL4.js");return{diagram:e}},__vite__mapDeps([40,12,13]));return{id:o$,diagram:t}},"loader"),_be={id:o$,detector:vbe,loader:wbe},Sbe=_be,a$="kanban",Ebe=S(t=>/^\s*kanban/.test(t),"detector"),Tbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./kanban-definition-6JOO6SKY-Cw72R2rP.js");return{diagram:e}},__vite__mapDeps([41,11]));return{id:a$,diagram:t}},"loader"),Abe={id:a$,detector:Ebe,loader:Tbe},Mbe=Abe,l$="sankey",Nbe=S(t=>/^\s*sankey(-beta)?/.test(t),"detector"),Lbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./sankeyDiagram-XADWPNL6-s1VkzWAg.js");return{diagram:e}},__vite__mapDeps([42,27,22]));return{id:l$,diagram:t}},"loader"),Bbe={id:l$,detector:Nbe,loader:Lbe},Obe=Bbe,c$="packet",Dbe=S(t=>/^\s*packet(-beta)?/.test(t),"detector"),Rbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-TYMM5635-BoK9AqHX.js");return{diagram:e}},__vite__mapDeps([43,17,19,4,2]));return{id:c$,diagram:t}},"loader"),Ibe={id:c$,detector:Dbe,loader:Rbe},u$="radar",Fbe=S(t=>/^\s*radar-beta/.test(t),"detector"),Pbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-MMDJMWI5-q28BYReU.js");return{diagram:e}},__vite__mapDeps([44,17,19,4,2]));return{id:u$,diagram:t}},"loader"),$be={id:u$,detector:Fbe,loader:Pbe},h$="block",zbe=S(t=>/^\s*block(-beta)?/.test(t),"detector"),jbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./blockDiagram-DXYQGD6D-BLoDfE0P.js");return{diagram:e}},__vite__mapDeps([45,11,5,1,2,14]));return{id:h$,diagram:t}},"loader"),Hbe={id:h$,detector:zbe,loader:jbe},Wbe=Hbe,d$="treeView",qbe=S(t=>/^\s*treeView-beta/.test(t),"detector"),Ube=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-5BDNPKRD-BHzIKztM.js");return{diagram:e}},__vite__mapDeps([46,17,18,19,4,2]));return{id:d$,diagram:t}},"loader"),Vbe={id:d$,detector:qbe,loader:Ube},Gbe=Vbe,f$="architecture",Kbe=S(t=>/^\s*architecture/.test(t),"detector"),Ybe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./architectureDiagram-Q4EWVU46-BjON9QCG.js");return{diagram:e}},__vite__mapDeps([47,17,19,4,2,7]));return{id:f$,diagram:t}},"loader"),Xbe={id:f$,detector:Kbe,loader:Ybe},Zbe=Xbe,p$="ishikawa",Qbe=S(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),Jbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-UXIWVN3A-DpaZPVt0.js");return{diagram:e}},[]);return{id:p$,diagram:t}},"loader"),e1e={id:p$,detector:Qbe,loader:Jbe},g$="venn",t1e=S(t=>/^\s*venn-beta/.test(t),"detector"),r1e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./vennDiagram-DHZGUBPP-C2I2hokK.js");return{diagram:e}},[]);return{id:g$,diagram:t}},"loader"),n1e={id:g$,detector:t1e,loader:r1e},i1e=n1e,m$="treemap",s1e=S(t=>/^\s*treemap/.test(t),"detector"),o1e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-G4DWMVQ6-D1JhDGDX.js");return{diagram:e}},__vite__mapDeps([48,13,17,19,4,2,23,27,22]));return{id:m$,diagram:t}},"loader"),a1e={id:m$,detector:s1e,loader:o1e},y$="wardley-beta",l1e=S(t=>/^\s*wardley-beta/i.test(t),"detector"),c1e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./wardleyDiagram-NUSXRM2D-lI3b3rv0.js");return{diagram:e}},__vite__mapDeps([49,17,19,4,2]));return{id:y$,diagram:t}},"loader"),u1e={id:y$,detector:l1e,loader:c1e},h1e=u1e,nL=!1,yb=S(()=>{nL||(nL=!0,j0("error",fbe,t=>t.toLowerCase().trim()==="error"),j0("---",{db:{clear:S(()=>{},"clear")},styles:{},renderer:{draw:S(()=>{},"draw")},parser:{parse:S(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:S(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Gk(ybe,Sbe,Zbe),Gk(tye,Mbe,Zye,Gye,fye,kye,_ye,Tye,$ye,Wye,cye,sye,kbe,yye,sbe,tbe,cbe,Lye,Obe,Ibe,Rye,Wbe,Gbe,$be,e1e,a1e,i1e,h1e))},"addDiagrams"),d1e=S(async()=>{ge.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(ac).map(async([r,{detector:n,loader:i}])=>{if(i)try{Zk(r)}catch{try{const{diagram:s,id:o}=await i();j0(o,s,n)}catch(s){throw ge.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ac[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){ge.error(`Failed to load ${e.length} external diagrams`);for(const r of e)ge.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),f1e="graphics-document document";function b$(t,e){t.attr("role",f1e),e!==""&&t.attr("aria-roledescription",e)}S(b$,"setA11yDiagramInfo");function x$(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}S(x$,"addSVGa11yTitleDescription");var Yl,qv=(Yl=class{constructor(e,r,n,i,s){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(e,r={}){var c,h;const n=br(),i=Sw(e,n);e=Ipe(e)+`
763
+ L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),g0e=S((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),m0e=S((t,e,r)=>{const n=br(),{themeVariables:i}=n,{strokeWidth:s}=i,o=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),y0e={extension:Yme,composition:Xme,aggregation:Zme,dependency:Qme,lollipop:Jme,point:e0e,circle:t0e,cross:r0e,barb:n0e,barbNeo:i0e,only_one:s0e,zero_or_one:o0e,one_or_more:a0e,zero_or_more:l0e,only_one_neo:c0e,zero_or_one_neo:u0e,one_or_more_neo:h0e,zero_or_more_neo:d0e,requirement_arrow:f0e,requirement_contains:g0e,requirement_arrow_neo:p0e,requirement_contains_neo:m0e},b0e=Kme,x0e={common:Yf,getConfig:br,insertCluster:mme,insertEdge:Gme,insertEdgeLabel:jme,insertMarkers:b0e,insertNode:M8,interpolateToCurve:t_,labelHelper:ut,log:ge,positionEdgeLabel:Hme},Bf={},O8=S(t=>{for(const e of t)Bf[e.name]=e},"registerLayoutLoaders"),C0e=S(()=>{O8([{name:"dagre",loader:S(async()=>await Bt(()=>import("./dagre-KV5264BT-CWRMd3SH.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:S(async()=>await Bt(()=>import("./cose-bilkent-S5V4N54A-Db3Okii7.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");C0e();var OCe=S(async(t,e)=>{if(!(t.layoutAlgorithm in Bf))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);if(t.diagramId)for(const h of t.nodes){const d=h.domId||h.id;h.domId=`${t.diagramId}-${d}`}const r=Bf[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=s,c=e.attr("id");if(e.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),o){const h=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",a).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return n.render(t,e,x0e,{algorithm:r.algorithm})},"render"),DCe=S((t="",{fallback:e="dagre"}={})=>{if(t in Bf)return t;if(e in Bf)return ge.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),D8="comm",R8="rule",I8="decl",k0e="@import",v0e="@namespace",w0e="@keyframes",_0e="@layer",F8=Math.abs,v_=String.fromCharCode;function P8(t){return t.trim()}function Nm(t,e,r){return t.replace(e,r)}function S0e(t,e,r){return t.indexOf(e,r)}function Mu(t,e){return t.charCodeAt(e)|0}function lh(t,e,r){return t.slice(e,r)}function Hs(t){return t.length}function E0e(t){return t.length}function im(t,e){return e.push(t),t}var gb=1,ch=1,$8=0,Qi=0,Ir=0,kh="";function w_(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:gb,column:ch,length:o,return:"",siblings:a}}function T0e(){return Ir}function A0e(){return Ir=Qi>0?Mu(kh,--Qi):0,ch--,Ir===10&&(ch=1,gb--),Ir}function xs(){return Ir=Qi<$8?Mu(kh,Qi++):0,ch++,Ir===10&&(ch=1,gb++),Ir}function Ia(){return Mu(kh,Qi)}function Lm(){return Qi}function mb(t,e){return lh(kh,t,e)}function Of(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function M0e(t){return gb=ch=1,$8=Hs(kh=t),Qi=0,[]}function N0e(t){return kh="",t}function RC(t){return P8(mb(Qi-1,Pv(t===91?t+2:t===40?t+1:t)))}function L0e(t){for(;(Ir=Ia())&&Ir<33;)xs();return Of(t)>2||Of(Ir)>3?"":" "}function B0e(t,e){for(;--e&&xs()&&!(Ir<48||Ir>102||Ir>57&&Ir<65||Ir>70&&Ir<97););return mb(t,Lm()+(e<6&&Ia()==32&&xs()==32))}function Pv(t){for(;xs();)switch(Ir){case t:return Qi;case 34:case 39:t!==34&&t!==39&&Pv(Ir);break;case 40:t===41&&Pv(t);break;case 92:xs();break}return Qi}function O0e(t,e){for(;xs()&&t+Ir!==57;)if(t+Ir===84&&Ia()===47)break;return"/*"+mb(e,Qi-1)+"*"+v_(t===47?t:xs())}function D0e(t){for(;!Of(Ia());)xs();return mb(t,Qi)}function R0e(t){return N0e(Bm("",null,null,null,[""],t=M0e(t),0,[0],t))}function Bm(t,e,r,n,i,s,o,a,l){for(var c=0,h=0,d=o,g=0,p=0,m=0,y=1,x=1,C=1,v=0,_="",M=i,L=s,N=n,E=_;x;)switch(m=v,v=xs()){case 40:if(m!=108&&Mu(E,d-1)==58){S0e(E+=Nm(RC(v),"&","&\f"),"&\f",F8(c?a[c-1]:0))!=-1&&(C=-1);break}case 34:case 39:case 91:E+=RC(v);break;case 9:case 10:case 13:case 32:E+=L0e(m);break;case 92:E+=B0e(Lm()-1,7);continue;case 47:switch(Ia()){case 42:case 47:im(I0e(O0e(xs(),Lm()),e,r,l),l),(Of(m||1)==5||Of(Ia()||1)==5)&&Hs(E)&&lh(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*y:a[c++]=Hs(E)*C;case 125*y:case 59:case 0:switch(v){case 0:case 125:x=0;case 59+h:C==-1&&(E=Nm(E,/\f/g,"")),p>0&&(Hs(E)-d||y===0&&m===47)&&im(p>32?XN(E+";",n,r,d-1,l):XN(Nm(E," ","")+";",n,r,d-2,l),l);break;case 59:E+=";";default:if(im(N=YN(E,e,r,c,h,i,a,_,M=[],L=[],d,s),s),v===123)if(h===0)Bm(E,e,N,N,M,s,d,a,L);else{switch(g){case 99:if(Mu(E,3)===110)break;case 108:if(Mu(E,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Bm(t,N,N,n&&im(YN(t,N,N,0,0,i,a,_,i,M=[],d,L),L),i,L,d,a,n?M:L):Bm(E,N,N,N,[""],L,0,a,L)}}c=h=p=0,y=C=1,_=E="",d=o;break;case 58:d=1+Hs(E),p=m;default:if(y<1){if(v==123)--y;else if(v==125&&y++==0&&A0e()==125)continue}switch(E+=v_(v),v*y){case 38:C=h>0?1:(E+="\f",-1);break;case 44:a[c++]=(Hs(E)-1)*C,C=1;break;case 64:Ia()===45&&(E+=RC(xs())),g=Ia(),h=d=Hs(_=E+=D0e(Lm())),v++;break;case 45:m===45&&Hs(E)==2&&(y=0)}}return s}function YN(t,e,r,n,i,s,o,a,l,c,h,d){for(var g=i-1,p=i===0?s:[""],m=E0e(p),y=0,x=0,C=0;y<n;++y)for(var v=0,_=lh(t,g+1,g=F8(x=o[y])),M=t;v<m;++v)(M=P8(x>0?p[v]+" "+_:Nm(_,/&\f/g,p[v])))&&(l[C++]=M);return w_(t,e,r,i===0?R8:a,l,c,h,d)}function I0e(t,e,r,n){return w_(t,e,r,D8,v_(T0e()),lh(t,2,-2),0,n)}function XN(t,e,r,n,i){return w_(t,e,r,I8,lh(t,0,n),lh(t,n+1,-1),n,i)}function $v(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function F0e(t,e,r,n){switch(t.type){case _0e:if(t.children.length)break;case k0e:case v0e:case I8:return t.return=t.return||t.value;case D8:return"";case w0e:return t.return=t.value+"{"+$v(t.children,n)+"}";case R8:if(!Hs(t.value=t.props.join(",")))return""}return Hs(r=$v(t.children,n))?t.return=t.value+"{"+r+"}":""}var P0e=lF(Object.keys,Object),$0e=Object.prototype,z0e=$0e.hasOwnProperty;function j0e(t){if(!ob(t))return P0e(t);var e=[];for(var r in Object(t))z0e.call(t,r)&&r!="constructor"&&e.push(r);return e}var zv=_c(oo,"DataView"),jv=_c(oo,"Promise"),Hv=_c(oo,"Set"),Wv=_c(oo,"WeakMap"),ZN="[object Map]",H0e="[object Object]",QN="[object Promise]",JN="[object Set]",eL="[object WeakMap]",tL="[object DataView]",W0e=wc(zv),q0e=wc(Nf),U0e=wc(jv),V0e=wc(Hv),G0e=wc(Wv),Bl=yh;(zv&&Bl(new zv(new ArrayBuffer(1)))!=tL||Nf&&Bl(new Nf)!=ZN||jv&&Bl(jv.resolve())!=QN||Hv&&Bl(new Hv)!=JN||Wv&&Bl(new Wv)!=eL)&&(Bl=function(t){var e=yh(t),r=e==H0e?t.constructor:void 0,n=r?wc(r):"";if(n)switch(n){case W0e:return tL;case q0e:return ZN;case U0e:return QN;case V0e:return JN;case G0e:return eL}return e});var K0e="[object Map]",Y0e="[object Set]",X0e=Object.prototype,Z0e=X0e.hasOwnProperty;function rL(t){if(t==null)return!0;if(ab(t)&&(oy(t)||typeof t=="string"||typeof t.splice=="function"||Jw(t)||e_(t)||sy(t)))return!t.length;var e=Bl(t);if(e==K0e||e==Y0e)return!t.size;if(ob(t))return!j0e(t).length;for(var r in t)if(Z0e.call(t,r))return!1;return!0}var z8="c4",Q0e=S(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),J0e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./c4Diagram-AHTNJAMY-DUJE4tY8.js");return{diagram:e}},__vite__mapDeps([8,9]));return{id:z8,diagram:t}},"loader"),eye={id:z8,detector:Q0e,loader:J0e},tye=eye,j8="flowchart",rye=S((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),nye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-BiDAMluS.js");return{diagram:e}},__vite__mapDeps([10,11,9,12,13,14]));return{id:j8,diagram:t}},"loader"),iye={id:j8,detector:rye,loader:nye},sye=iye,H8="flowchart-v2",oye=S((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),aye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-BiDAMluS.js");return{diagram:e}},__vite__mapDeps([10,11,9,12,13,14]));return{id:H8,diagram:t}},"loader"),lye={id:H8,detector:oye,loader:aye},cye=lye,W8="er",uye=S(t=>/^\s*erDiagram/.test(t),"detector"),hye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./erDiagram-SMLLAGMA-COaIktX_.js");return{diagram:e}},__vite__mapDeps([15,12,13,14]));return{id:W8,diagram:t}},"loader"),dye={id:W8,detector:uye,loader:hye},fye=dye,q8="gitGraph",pye=S(t=>/^\s*gitGraph/.test(t),"detector"),gye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-UUTBAWPF-Dohcub9p.js");return{diagram:e}},__vite__mapDeps([16,17,18,19,4,2]));return{id:q8,diagram:t}},"loader"),mye={id:q8,detector:pye,loader:gye},yye=mye,U8="gantt",bye=S(t=>/^\s*gantt/.test(t),"detector"),xye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./ganttDiagram-T4ZO3ILL-Dl4AW2On.js");return{diagram:e}},__vite__mapDeps([20,21,22,23]));return{id:U8,diagram:t}},"loader"),Cye={id:U8,detector:bye,loader:xye},kye=Cye,V8="info",vye=S(t=>/^\s*info/.test(t),"detector"),wye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./infoDiagram-42DDH7IO-BZjLv6IH.js");return{diagram:e}},__vite__mapDeps([24,19,4,2]));return{id:V8,diagram:t}},"loader"),_ye={id:V8,detector:vye,loader:wye},G8="pie",Sye=S(t=>/^\s*pie/.test(t),"detector"),Eye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./pieDiagram-DEJITSTG-ijiNKQ8e.js");return{diagram:e}},__vite__mapDeps([25,17,19,4,2,26,27,22]));return{id:G8,diagram:t}},"loader"),Tye={id:G8,detector:Sye,loader:Eye},K8="quadrantChart",Aye=S(t=>/^\s*quadrantChart/.test(t),"detector"),Mye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./quadrantDiagram-34T5L4WZ-CZtSib2Y.js");return{diagram:e}},__vite__mapDeps([28,21,22,23]));return{id:K8,diagram:t}},"loader"),Nye={id:K8,detector:Aye,loader:Mye},Lye=Nye,Y8="xychart",Bye=S(t=>/^\s*xychart(-beta)?/.test(t),"detector"),Oye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./xychartDiagram-5P7HB3ND-BwK9W_yy.js");return{diagram:e}},__vite__mapDeps([29,22,27,21,23]));return{id:Y8,diagram:t}},"loader"),Dye={id:Y8,detector:Bye,loader:Oye},Rye=Dye,X8="requirement",Iye=S(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),Fye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./requirementDiagram-MS252O5E-BN-J-8AJ.js");return{diagram:e}},__vite__mapDeps([30,12,13]));return{id:X8,diagram:t}},"loader"),Pye={id:X8,detector:Iye,loader:Fye},$ye=Pye,Z8="sequence",zye=S(t=>/^\s*sequenceDiagram/.test(t),"detector"),jye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./sequenceDiagram-FGHM5R23-BnJnhdS6.js");return{diagram:e}},__vite__mapDeps([31,9,18]));return{id:Z8,diagram:t}},"loader"),Hye={id:Z8,detector:zye,loader:jye},Wye=Hye,Q8="class",qye=S((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),Uye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./classDiagram-6PBFFD2Q-DvENVsHG.js");return{diagram:e}},__vite__mapDeps([32,33,11,9,12,13]));return{id:Q8,diagram:t}},"loader"),Vye={id:Q8,detector:qye,loader:Uye},Gye=Vye,J8="classDiagram",Kye=S((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),Yye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./classDiagram-v2-HSJHXN6E-DvENVsHG.js");return{diagram:e}},__vite__mapDeps([34,33,11,9,12,13]));return{id:J8,diagram:t}},"loader"),Xye={id:J8,detector:Kye,loader:Yye},Zye=Xye,e$="state",Qye=S((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),Jye=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./stateDiagram-FHFEXIEX-DN4fDIGN.js");return{diagram:e}},__vite__mapDeps([35,36,12,13,1,2,3,4]));return{id:e$,diagram:t}},"loader"),ebe={id:e$,detector:Qye,loader:Jye},tbe=ebe,t$="stateDiagram",rbe=S((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),nbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-QKLJ7IA2-D6Qg_ItE.js");return{diagram:e}},__vite__mapDeps([37,36,12,13]));return{id:t$,diagram:t}},"loader"),ibe={id:t$,detector:rbe,loader:nbe},sbe=ibe,r$="journey",obe=S(t=>/^\s*journey/.test(t),"detector"),abe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./journeyDiagram-VCZTEJTY-DcW9mUFI.js");return{diagram:e}},__vite__mapDeps([38,11,9,26]));return{id:r$,diagram:t}},"loader"),lbe={id:r$,detector:obe,loader:abe},cbe=lbe,ube=S((t,e,r)=>{ge.debug(`rendering svg for syntax error
764
+ `);const n=Oue(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),TI(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),n$={draw:ube},hbe=n$,dbe={db:{},renderer:n$,parser:{parse:S(()=>{},"parse")}},fbe=dbe,i$="flowchart-elk",pbe=S((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),gbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-BiDAMluS.js");return{diagram:e}},__vite__mapDeps([10,11,9,12,13,14]));return{id:i$,diagram:t}},"loader"),mbe={id:i$,detector:pbe,loader:gbe},ybe=mbe,s$="timeline",bbe=S(t=>/^\s*timeline/.test(t),"detector"),xbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./timeline-definition-GMOUNBTQ-Ds6_LT-T.js");return{diagram:e}},__vite__mapDeps([39,26]));return{id:s$,diagram:t}},"loader"),Cbe={id:s$,detector:bbe,loader:xbe},kbe=Cbe,o$="mindmap",vbe=S(t=>/^\s*mindmap/.test(t),"detector"),wbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./mindmap-definition-QFDTVHPH-C34BXoiK.js");return{diagram:e}},__vite__mapDeps([40,12,13]));return{id:o$,diagram:t}},"loader"),_be={id:o$,detector:vbe,loader:wbe},Sbe=_be,a$="kanban",Ebe=S(t=>/^\s*kanban/.test(t),"detector"),Tbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./kanban-definition-6JOO6SKY-BgEOJRmr.js");return{diagram:e}},__vite__mapDeps([41,11]));return{id:a$,diagram:t}},"loader"),Abe={id:a$,detector:Ebe,loader:Tbe},Mbe=Abe,l$="sankey",Nbe=S(t=>/^\s*sankey(-beta)?/.test(t),"detector"),Lbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./sankeyDiagram-XADWPNL6-CWP-qBhv.js");return{diagram:e}},__vite__mapDeps([42,27,22]));return{id:l$,diagram:t}},"loader"),Bbe={id:l$,detector:Nbe,loader:Lbe},Obe=Bbe,c$="packet",Dbe=S(t=>/^\s*packet(-beta)?/.test(t),"detector"),Rbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-TYMM5635-DhePsl7z.js");return{diagram:e}},__vite__mapDeps([43,17,19,4,2]));return{id:c$,diagram:t}},"loader"),Ibe={id:c$,detector:Dbe,loader:Rbe},u$="radar",Fbe=S(t=>/^\s*radar-beta/.test(t),"detector"),Pbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-MMDJMWI5-DhCslint.js");return{diagram:e}},__vite__mapDeps([44,17,19,4,2]));return{id:u$,diagram:t}},"loader"),$be={id:u$,detector:Fbe,loader:Pbe},h$="block",zbe=S(t=>/^\s*block(-beta)?/.test(t),"detector"),jbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./blockDiagram-DXYQGD6D-Rinexrq-.js");return{diagram:e}},__vite__mapDeps([45,11,5,1,2,14]));return{id:h$,diagram:t}},"loader"),Hbe={id:h$,detector:zbe,loader:jbe},Wbe=Hbe,d$="treeView",qbe=S(t=>/^\s*treeView-beta/.test(t),"detector"),Ube=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-5BDNPKRD-8TiBcRv9.js");return{diagram:e}},__vite__mapDeps([46,17,18,19,4,2]));return{id:d$,diagram:t}},"loader"),Vbe={id:d$,detector:qbe,loader:Ube},Gbe=Vbe,f$="architecture",Kbe=S(t=>/^\s*architecture/.test(t),"detector"),Ybe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./architectureDiagram-Q4EWVU46-DH8zBsFD.js");return{diagram:e}},__vite__mapDeps([47,17,19,4,2,7]));return{id:f$,diagram:t}},"loader"),Xbe={id:f$,detector:Kbe,loader:Ybe},Zbe=Xbe,p$="ishikawa",Qbe=S(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),Jbe=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-UXIWVN3A-rnfc72_m.js");return{diagram:e}},[]);return{id:p$,diagram:t}},"loader"),e1e={id:p$,detector:Qbe,loader:Jbe},g$="venn",t1e=S(t=>/^\s*venn-beta/.test(t),"detector"),r1e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./vennDiagram-DHZGUBPP-BrbuTJAI.js");return{diagram:e}},[]);return{id:g$,diagram:t}},"loader"),n1e={id:g$,detector:t1e,loader:r1e},i1e=n1e,m$="treemap",s1e=S(t=>/^\s*treemap/.test(t),"detector"),o1e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./diagram-G4DWMVQ6-Djb_aFKY.js");return{diagram:e}},__vite__mapDeps([48,13,17,19,4,2,23,27,22]));return{id:m$,diagram:t}},"loader"),a1e={id:m$,detector:s1e,loader:o1e},y$="wardley-beta",l1e=S(t=>/^\s*wardley-beta/i.test(t),"detector"),c1e=S(async()=>{const{diagram:t}=await Bt(async()=>{const{diagram:e}=await import("./wardleyDiagram-NUSXRM2D-BH6aFYai.js");return{diagram:e}},__vite__mapDeps([49,17,19,4,2]));return{id:y$,diagram:t}},"loader"),u1e={id:y$,detector:l1e,loader:c1e},h1e=u1e,nL=!1,yb=S(()=>{nL||(nL=!0,j0("error",fbe,t=>t.toLowerCase().trim()==="error"),j0("---",{db:{clear:S(()=>{},"clear")},styles:{},renderer:{draw:S(()=>{},"draw")},parser:{parse:S(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:S(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Gk(ybe,Sbe,Zbe),Gk(tye,Mbe,Zye,Gye,fye,kye,_ye,Tye,$ye,Wye,cye,sye,kbe,yye,sbe,tbe,cbe,Lye,Obe,Ibe,Rye,Wbe,Gbe,$be,e1e,a1e,i1e,h1e))},"addDiagrams"),d1e=S(async()=>{ge.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(ac).map(async([r,{detector:n,loader:i}])=>{if(i)try{Zk(r)}catch{try{const{diagram:s,id:o}=await i();j0(o,s,n)}catch(s){throw ge.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ac[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){ge.error(`Failed to load ${e.length} external diagrams`);for(const r of e)ge.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),f1e="graphics-document document";function b$(t,e){t.attr("role",f1e),e!==""&&t.attr("aria-roledescription",e)}S(b$,"setA11yDiagramInfo");function x$(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}S(x$,"addSVGa11yTitleDescription");var Yl,qv=(Yl=class{constructor(e,r,n,i,s){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(e,r={}){var c,h;const n=br(),i=Sw(e,n);e=Ipe(e)+`
765
765
  `;try{Zk(i)}catch{const d=Qse(i);if(!d)throw new fI(`Diagram ${i} not found.`);const{id:g,diagram:p}=await d();j0(g,p)}const{db:s,parser:o,renderer:a,init:l}=Zk(i);return o.parser&&(o.parser.yy=s),(c=s.clear)==null||c.call(s),l==null||l(n),r.title&&((h=s.setDiagramTitle)==null||h.call(s,r.title)),await o.parse(e),new Yl(i,e,s,o,a)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},S(Yl,"Diagram"),Yl),iL=[],p1e=S(()=>{iL.forEach(t=>{t()}),iL=[]},"attachFunctions"),g1e=S(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function C$(t){const e=t.match(dI);if(!e)return{text:t,metadata:{}};let r=zhe(e[1],{schema:$he})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}S(C$,"extractFrontMatter");var m1e=S(t=>t.replace(/\r\n?/g,`
766
766
  `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),y1e=S(t=>{const{text:e,metadata:r}=C$(t),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:e}},"processFrontmatter"),b1e=S(t=>{const e=ps.detectInit(t)??{},r=ps.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:n})=>n==="wrap"):(r==null?void 0:r.type)==="wrap"&&(e.wrap=!0),{text:wpe(t),directive:e}},"processDirectives");function __(t){const e=m1e(t),r=y1e(e),n=b1e(r.text),i=o_(r.config,n.directive);return t=g1e(n.text),{code:t,title:r.title,config:i}}S(__,"preprocessDiagram");function k$(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}S(k$,"toBase64");var x1e=5e4,C1e="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",k1e="sandbox",v1e="loose",w1e="http://www.w3.org/2000/svg",_1e="http://www.w3.org/1999/xlink",S1e="http://www.w3.org/1999/xhtml",E1e="100%",T1e="100%",A1e="border:0;margin:0;",M1e="margin:0",N1e="allow-top-navigation-by-user-activation allow-popups",L1e='The "iframe" tag is not supported by your browser.',B1e=["foreignobject"],O1e=["dominant-baseline"];function S_(t){const e=__(t);return $0(),Eoe(e.config??{}),e}S(S_,"processAndSetConfigs");async function v$(t,e){yb();try{const{code:r,config:n}=S_(t);return{diagramType:(await _$(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}S(v$,"parse");var sL=S((t,e,r=[])=>`
767
767
  .${t} ${e} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),D1e=S((t,e=new Map)=>{let r="";if(t.themeCSS!==void 0&&(r+=`
@@ -771,8 +771,8 @@ ${t.themeCSS}`),t.fontFamily!==void 0&&(r+=`
771
771
  ${L1e}
772
772
  </iframe>`},"putIntoIFrame"),oL=S((t,e,r,n,i)=>{const s=t.append("div");s.attr("id",r),n&&s.attr("style",n);const o=s.append("svg").attr("id",e).attr("width","100%").attr("xmlns",w1e);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function Uv(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}S(Uv,"sandboxedIframe");var P1e=S((t,e,r,n)=>{var i,s,o;(i=t.getElementById(e))==null||i.remove(),(s=t.getElementById(r))==null||s.remove(),(o=t.getElementById(n))==null||o.remove()},"removeExistingElements"),$1e=S(async function(t,e,r){var ie,J,G,H,V,Q;yb();const n=S_(e);e=n.code;const i=br();ge.debug(i),e.length>((i==null?void 0:i.maxTextSize)??x1e)&&(e=C1e);const s="#"+t,o="i"+t,a="#"+o,l="d"+t,c="#"+l,h=S(()=>{const K=St(g?a:c).node();K&&"remove"in K&&K.remove()},"removeTempElements");let d=St("body");const g=i.securityLevel===k1e,p=i.securityLevel===v1e,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),g){const F=Uv(St(r),o);d=St(F.nodes()[0].contentDocument.body),d.node().style.margin=0}else d=St(r);oL(d,t,l,`font-family: ${m}`,_1e)}else{if(P1e(document,t,l,o),g){const F=Uv(St("body"),o);d=St(F.nodes()[0].contentDocument.body),d.node().style.margin=0}else d=St("body");oL(d,t,l)}let y,x;try{y=await qv.fromText(e,{title:n.title})}catch(F){if(i.suppressErrorRendering)throw h(),F;y=await qv.fromText("error"),x=F}const C=d.select(c).node(),v=y.type,_=C.firstChild,M=_.firstChild,L=(J=(ie=y.renderer).getClasses)==null?void 0:J.call(ie,e,y),N=R1e(i,v,L,s),E=document.createElement("style");E.innerHTML=N,_.insertBefore(E,M);try{await y.renderer.draw(e,t,"11.14.0",y)}catch(F){throw i.suppressErrorRendering?h():hbe.draw(e,t,"11.14.0"),F}const O=d.select(`${c} svg`),I=(H=(G=y.db).getAccTitle)==null?void 0:H.call(G),$=(Q=(V=y.db).getAccDescription)==null?void 0:Q.call(V);S$(v,O,I,$),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",S1e);let j=d.select(c).node().innerHTML;if(ge.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),j=I1e(j,g,Wo(i.arrowMarkerAbsolute)),g){const F=d.select(c+" svg").node();j=F1e(j,F)}else p||(j=rh.sanitize(j,{ADD_TAGS:B1e,ADD_ATTR:O1e,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(p1e(),x)throw x;return h(),{diagramType:v,svg:j,bindFunctions:y.db.bindFunctions}},"render");function w$(t={}){var n;const e=Ur({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),_oe(e),e!=null&&e.theme&&e.theme in Do?e.themeVariables=Do[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=Do.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?woe(e):bI();_w(r.logLevel),yb()}S(w$,"initialize");var _$=S((t,e={})=>{const{code:r}=__(t);return qv.fromText(r,e)},"getDiagramFromText");function S$(t,e,r,n){b$(e,t),x$(e,r,n,e.attr("id"))}S(S$,"addA11yInfo");var pc=Object.freeze({render:$1e,parse:v$,getDiagramFromText:_$,initialize:w$,getConfig:br,setConfig:xI,getSiteConfig:bI,updateSiteConfig:Soe,reset:S(()=>{$0()},"reset"),globalReset:S(()=>{$0(nh)},"globalReset"),defaultConfig:nh});_w(br().logLevel);$0(br());var z1e=S((t,e,r)=>{ge.warn(t),s_(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),E$=S(async function(t={querySelector:".mermaid"}){try{await j1e(t)}catch(e){if(s_(e)&&ge.error(e.str),Ni.parseError&&Ni.parseError(e),!t.suppressErrors)throw ge.error("Use the suppressErrors option to suppress these errors"),e}},"run"),j1e=S(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=pc.getConfig();ge.debug(`${t?"":"No "}Callback function found`);let i;if(r)i=r;else if(e)i=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");ge.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(ge.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),pc.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new ps.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(ge.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${s.next()}`;o=l.innerHTML,o=HF(ps.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const h=ps.detectInit(o);h&&ge.debug("Detected early reinit: ",h);try{const{svg:d,bindFunctions:g}=await N$(c,o,l);l.innerHTML=d,t&&await t(c),g&&g(l)}catch(d){z1e(d,a,Ni.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),T$=S(function(t){pc.initialize(t)},"initialize"),H1e=S(async function(t,e,r){ge.warn("mermaid.init is deprecated. Please use run instead."),t&&T$(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await E$(n)},"init"),W1e=S(async(t,{lazyLoad:e=!0}={})=>{yb(),Gk(...t),e===!1&&await d1e()},"registerExternalDiagrams"),A$=S(function(){if(Ni.startOnLoad){const{startOnLoad:t}=pc.getConfig();t&&Ni.run().catch(e=>ge.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",A$,!1);var q1e=S(function(t){Ni.parseError=t},"setParseErrorHandler"),yy=[],IC=!1,M$=S(async()=>{if(!IC){for(IC=!0;yy.length>0;){const t=yy.shift();if(t)try{await t()}catch(e){ge.error("Error executing queue",e)}}IC=!1}},"executeQueue"),U1e=S(async(t,e)=>new Promise((r,n)=>{const i=S(()=>new Promise((s,o)=>{pc.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;ge.error("Error parsing",a),(l=Ni.parseError)==null||l.call(Ni,a),o(a),n(a)})}),"performCall");yy.push(i),M$().catch(n)}),"parse"),N$=S((t,e,r)=>new Promise((n,i)=>{const s=S(()=>new Promise((o,a)=>{pc.render(t,e,r).then(l=>{o(l),n(l)},l=>{var c;ge.error("Error parsing",l),(c=Ni.parseError)==null||c.call(Ni,l),a(l),i(l)})}),"performCall");yy.push(s),M$().catch(i)}),"render"),V1e=S(()=>Object.keys(ac).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),Ni={startOnLoad:!0,mermaidAPI:pc,parse:U1e,render:N$,init:H1e,run:E$,registerExternalDiagrams:W1e,registerLayoutLoaders:O8,initialize:T$,parseError:void 0,contentLoaded:A$,setParseErrorHandler:q1e,detectType:Sw,registerIconPacks:Wge,getRegisteredDiagramsMetadata:V1e},uh=Ni;/*! Check if previously processed *//*!
773
773
  * Wait for document loaded before starting the execution
774
- */var G1e=B.createContext(void 0);function K1e(t){const e=B.useContext(G1e);return t||e||"ltr"}function Y1e(t,[e,r]){return Math.min(r,Math.max(e,t))}function X1e(t,e){return B.useReducer((r,n)=>e[r][n]??r,t)}var E_="ScrollArea",[L$]=ky(E_),[Z1e,Ji]=L$(E_),B$=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=B.useState(null),[c,h]=B.useState(null),[d,g]=B.useState(null),[p,m]=B.useState(null),[y,x]=B.useState(null),[C,v]=B.useState(0),[_,M]=B.useState(0),[L,N]=B.useState(!1),[E,O]=B.useState(!1),I=Nn(e,j=>l(j)),$=K1e(i);return T.jsx(Z1e,{scope:r,type:n,dir:$,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:h,content:d,onContentChange:g,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:L,onScrollbarXEnabledChange:N,scrollbarY:y,onScrollbarYChange:x,scrollbarYEnabled:E,onScrollbarYEnabledChange:O,onCornerWidthChange:v,onCornerHeightChange:M,children:T.jsx(yn.div,{dir:$,...o,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});B$.displayName=E_;var O$="ScrollAreaViewport",D$=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Ji(O$,r),a=B.useRef(null),l=Nn(e,a,o.onViewportChange);return T.jsxs(T.Fragment,{children:[T.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),T.jsx(yn.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:T.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});D$.displayName=O$;var ao="ScrollAreaScrollbar",T_=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ji(ao,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return B.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?T.jsx(Q1e,{...n,ref:e,forceMount:r}):i.type==="scroll"?T.jsx(J1e,{...n,ref:e,forceMount:r}):i.type==="auto"?T.jsx(R$,{...n,ref:e,forceMount:r}):i.type==="always"?T.jsx(A_,{...n,ref:e}):null});T_.displayName=ao;var Q1e=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ji(ao,t.__scopeScrollArea),[s,o]=B.useState(!1);return B.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},h=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",h),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",h)}}},[i.scrollArea,i.scrollHideDelay]),T.jsx(zo,{present:r||s,children:T.jsx(R$,{"data-state":s?"visible":"hidden",...n,ref:e})})}),J1e=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ji(ao,t.__scopeScrollArea),s=t.orientation==="horizontal",o=xb(()=>l("SCROLL_END"),100),[a,l]=X1e("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return B.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),B.useEffect(()=>{const c=i.viewport,h=s?"scrollLeft":"scrollTop";if(c){let d=c[h];const g=()=>{const p=c[h];d!==p&&(l("SCROLL"),o()),d=p};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,s,l,o]),T.jsx(zo,{present:r||a!=="hidden",children:T.jsx(A_,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:mn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:mn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),R$=B.forwardRef((t,e)=>{const r=Ji(ao,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=B.useState(!1),a=t.orientation==="horizontal",l=xb(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?c:h)}},10);return hh(r.viewport,l),hh(r.content,l),T.jsx(zo,{present:n||s,children:T.jsx(A_,{"data-state":s?"visible":"hidden",...i,ref:e})})}),A_=B.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Ji(ao,t.__scopeScrollArea),s=B.useRef(null),o=B.useRef(0),[a,l]=B.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=z$(a.viewport,a.content),h={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:g=>o.current=g};function d(g,p){return sxe(g,o.current,a,p)}return r==="horizontal"?T.jsx(exe,{...h,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollLeft,p=aL(g,a,i.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollLeft=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollLeft=d(g,i.dir))}}):r==="vertical"?T.jsx(txe,{...h,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollTop,p=aL(g,a);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollTop=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollTop=d(g))}}):null}),exe=B.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ji(ao,t.__scopeScrollArea),[o,a]=B.useState(),l=B.useRef(null),c=Nn(e,l,s.onScrollbarXChange);return B.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),T.jsx(F$,{"data-orientation":"horizontal",...i,ref:c,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":bb(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,d)=>{if(s.viewport){const g=s.viewport.scrollLeft+h.deltaX;t.onWheelScroll(g),H$(g,d)&&h.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:xy(o.paddingLeft),paddingEnd:xy(o.paddingRight)}})}})}),txe=B.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ji(ao,t.__scopeScrollArea),[o,a]=B.useState(),l=B.useRef(null),c=Nn(e,l,s.onScrollbarYChange);return B.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),T.jsx(F$,{"data-orientation":"vertical",...i,ref:c,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":bb(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,d)=>{if(s.viewport){const g=s.viewport.scrollTop+h.deltaY;t.onWheelScroll(g),H$(g,d)&&h.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:xy(o.paddingTop),paddingEnd:xy(o.paddingBottom)}})}})}),[rxe,I$]=L$(ao),F$=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:h,onResize:d,...g}=t,p=Ji(ao,r),[m,y]=B.useState(null),x=Nn(e,I=>y(I)),C=B.useRef(null),v=B.useRef(""),_=p.viewport,M=n.content-n.viewport,L=Gi(h),N=Gi(l),E=xb(d,10);function O(I){if(C.current){const $=I.clientX-C.current.left,j=I.clientY-C.current.top;c({x:$,y:j})}}return B.useEffect(()=>{const I=$=>{const j=$.target;(m==null?void 0:m.contains(j))&&L($,M)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[_,m,M,L]),B.useEffect(N,[n,N]),hh(m,E),hh(p.content,E),T.jsx(rxe,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:Gi(s),onThumbPointerUp:Gi(o),onThumbPositionChange:N,onThumbPointerDown:Gi(a),children:T.jsx(yn.div,{...g,ref:x,style:{position:"absolute",...g.style},onPointerDown:mn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),C.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),O(I))}),onPointerMove:mn(t.onPointerMove,O),onPointerUp:mn(t.onPointerUp,I=>{const $=I.target;$.hasPointerCapture(I.pointerId)&&$.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),C.current=null})})})}),by="ScrollAreaThumb",P$=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=I$(by,t.__scopeScrollArea);return T.jsx(zo,{present:r||i.hasThumb,children:T.jsx(nxe,{ref:e,...n})})}),nxe=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Ji(by,r),o=I$(by,r),{onThumbPositionChange:a}=o,l=Nn(e,d=>o.onThumbChange(d)),c=B.useRef(void 0),h=xb(()=>{c.current&&(c.current(),c.current=void 0)},100);return B.useEffect(()=>{const d=s.viewport;if(d){const g=()=>{if(h(),!c.current){const p=oxe(d,a);c.current=p,a()}};return a(),d.addEventListener("scroll",g),()=>d.removeEventListener("scroll",g)}},[s.viewport,h,a]),T.jsx(yn.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:mn(t.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),m=d.clientX-p.left,y=d.clientY-p.top;o.onThumbPointerDown({x:m,y})}),onPointerUp:mn(t.onPointerUp,o.onThumbPointerUp)})});P$.displayName=by;var M_="ScrollAreaCorner",$$=B.forwardRef((t,e)=>{const r=Ji(M_,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?T.jsx(ixe,{...t,ref:e}):null});$$.displayName=M_;var ixe=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Ji(M_,r),[s,o]=B.useState(0),[a,l]=B.useState(0),c=!!(s&&a);return hh(i.scrollbarX,()=>{var d;const h=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(h),l(h)}),hh(i.scrollbarY,()=>{var d;const h=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(h),o(h)}),c?T.jsx(yn.div,{...n,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function xy(t){return t?parseInt(t,10):0}function z$(t,e){const r=t/e;return isNaN(r)?0:r}function bb(t){const e=z$(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function sxe(t,e,r,n="ltr"){const i=bb(r),s=i/2,o=e||s,a=i-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,h=r.content-r.viewport,d=n==="ltr"?[0,h]:[h*-1,0];return j$([l,c],d)(t)}function aL(t,e,r="ltr"){const n=bb(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-n,l=r==="ltr"?[0,o]:[o*-1,0],c=Y1e(t,l);return j$([0,o],[0,a])(c)}function j$(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function H$(t,e){return t>0&&t<e}var oxe=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&e(),r=s,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function xb(t,e){const r=Gi(t),n=B.useRef(0);return B.useEffect(()=>()=>window.clearTimeout(n.current),[]),B.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function hh(t,e){const r=Gi(e);Ql(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var W$=B$,axe=D$,lxe=$$;const Cb=B.forwardRef(({className:t,children:e,...r},n)=>T.jsxs(W$,{ref:n,className:Ue("relative overflow-hidden",t),...r,children:[T.jsx(axe,{className:"h-full w-full rounded-[inherit]",children:e}),T.jsx(q$,{}),T.jsx(lxe,{})]}));Cb.displayName=W$.displayName;const q$=B.forwardRef(({className:t,orientation:e="vertical",...r},n)=>T.jsx(T_,{ref:n,orientation:e,className:Ue("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:T.jsx(P$,{className:"relative flex-1 rounded-full bg-border"})}));q$.displayName=T_.displayName;const U$=()=>document.documentElement.classList.contains("dark");uh.initialize({startOnLoad:!1,theme:U$()?"dark":"default",suppressErrorRendering:!0});const cxe=B.memo(function({svgContent:e,error:r,isLoading:n}){return T.jsx("div",{className:"mermaid-fullscreen-chart",children:r?T.jsx("div",{className:"mermaid-error",children:r}):n?T.jsx("div",{className:"mermaid-loading",children:"渲染中..."}):e?T.jsx("div",{className:"mermaid-fullscreen-svg-container",dangerouslySetInnerHTML:{__html:e}}):null})});function uxe({source:t,open:e,onOpenChange:r}){const[n,i]=B.useState(!1),[s,o]=B.useState(""),[a,l]=B.useState(""),[c,h]=B.useState(!1),[d,g]=B.useState(1),[p,m]=B.useState({x:0,y:0}),[y,x]=B.useState(!1),C=B.useRef({x:0,y:0,posX:0,posY:0}),[v,_]=B.useState(null),M=B.useRef(null),L=B.useRef(null),N=B.useRef(`mermaid-fullscreen-${Math.random().toString(36).substr(2,9)}`);B.useEffect(()=>{if(!e||!t)return;let K=!1;h(!0),l(""),g(1),m({x:0,y:0});const U=U$()?"dark":"default";return uh.initialize({startOnLoad:!1,theme:U,suppressErrorRendering:!0}),uh.render(N.current,t).then(({svg:P})=>{K||(o(P),h(!1))}).catch(P=>{K||(l(P.message||"Mermaid render error"),h(!1))}),()=>{K=!0}},[e,t]);const E=K=>{const U=K[0].clientX-K[1].clientX,P=K[0].clientY-K[1].clientY;return Math.sqrt(U*U+P*P)},O=B.useCallback(K=>{K.preventDefault();const U=K.deltaY>0?-.1:.1;g(P=>Math.min(Math.max(P+U,.5),5))},[]),I=B.useCallback(K=>{d<=1||(x(!0),C.current={x:K.clientX,y:K.clientY,posX:p.x,posY:p.y})},[d,p]),$=B.useCallback(K=>{if(!y)return;const U=K.clientX-C.current.x,P=K.clientY-C.current.y;m({x:C.current.posX+U,y:C.current.posY+P})},[y]),j=B.useCallback(()=>{x(!1)},[]),ie=B.useCallback(()=>{g(1),m({x:0,y:0})},[]),J=B.useCallback(K=>{if(K.touches.length===2){K.preventDefault();const U=E(K.touches);_({x:0,y:0,distance:U})}else K.touches.length===1&&d>1&&(x(!0),M.current={x:K.touches[0].clientX,y:K.touches[0].clientY})},[d]),G=B.useCallback(K=>{if(K.touches.length===2&&v){K.preventDefault();const U=E(K.touches),P=(U-v.distance)/200;g(z=>Math.min(Math.max(z+P,.5),5)),_({x:0,y:0,distance:U})}else if(K.touches.length===1&&y&&M.current){const U=K.touches[0].clientX-M.current.x,P=K.touches[0].clientY-M.current.y;m(z=>({x:z.x+U,y:z.y+P})),M.current={x:K.touches[0].clientX,y:K.touches[0].clientY}}},[v,y]),H=B.useCallback(K=>{K.touches.length<2&&_(null),K.touches.length===0&&(x(!1),M.current=null)},[]),V=B.useCallback(()=>{g(K=>Math.min(K+.25,5))},[]),Q=B.useCallback(()=>{g(K=>Math.max(K-.25,.5))},[]),F=B.useCallback(()=>{g(1),m({x:0,y:0})},[]);return T.jsx(Rf,{open:e,onOpenChange:r,children:T.jsxs(If,{children:[T.jsx(bc,{className:"fixed inset-0 z-50 bg-black/80 animate-fade-in"}),T.jsxs(xc,{className:"mermaid-fullscreen-dialog",style:{position:"fixed",left:0,top:0,right:0,bottom:0,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",transform:"none",borderRadius:0,margin:0,padding:0,zIndex:51},children:[T.jsx(ph,{className:"sr-only",children:"Mermaid 图表全屏预览"}),T.jsxs("div",{className:"mermaid-fullscreen-header",children:[T.jsx("div",{className:"mermaid-fullscreen-controls",children:T.jsxs(Dt,{variant:"ghost",size:"sm",onClick:()=>i(!n),className:"gap-2",children:[n?T.jsx(HC,{className:"size-4"}):T.jsx(jC,{className:"size-4"}),n?"隐藏源码":"显示源码"]})}),T.jsxs(Pf,{className:"rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[T.jsx(qu,{className:"size-4"}),T.jsx("span",{className:"sr-only",children:"关闭"})]})]}),T.jsxs("div",{className:"mermaid-fullscreen-body",children:[T.jsxs("div",{ref:L,className:"mermaid-fullscreen-content",style:{cursor:d>1?y?"grabbing":"grab":"default",width:"100%",height:"100%",touchAction:"none"},onWheel:O,onMouseDown:I,onMouseMove:$,onMouseUp:j,onMouseLeave:j,onDoubleClick:ie,onTouchStart:J,onTouchMove:G,onTouchEnd:H,children:[T.jsx("div",{style:{transform:`translate(${p.x}px, ${p.y}px) scale(${d})`,transformOrigin:"center center",transition:y?"none":"transform 0.1s ease-out",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:T.jsx(cxe,{svgContent:s,error:a,isLoading:c})}),T.jsxs("div",{className:"mermaid-fullscreen-zoom-controls",children:[T.jsx("button",{onClick:V,title:"放大",children:T.jsx(j7,{className:"size-4"})}),T.jsx("button",{onClick:Q,title:"缩小",children:T.jsx(W7,{className:"size-4"})}),T.jsx("button",{onClick:F,title:"重置",children:T.jsx(O7,{className:"size-4"})})]})]}),n&&T.jsx("div",{className:"mermaid-fullscreen-source-panel",children:T.jsx(Cb,{className:"h-full",children:T.jsx("pre",{className:"mermaid-fullscreen-source-code",children:t})})})]})]})]})})}const V$=()=>document.documentElement.classList.contains("dark");uh.initialize({startOnLoad:!1,theme:V$()?"dark":"default",suppressErrorRendering:!0});const hxe=mse(pse);function dxe({node:t,updateAttributes:e,selected:r}){const n=t.attrs.language==="mermaid",[i,s]=B.useState(""),[o,a]=B.useState(""),[l,c]=B.useState(!1),[h,d]=B.useState(0),g=B.useMemo(()=>`mermaid-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[]),p=t.textContent;return B.useEffect(()=>{const m=()=>{d(y=>y+1)};return window.addEventListener("theme-change",m),()=>window.removeEventListener("theme-change",m)},[]),B.useEffect(()=>{if(!n){s(""),a("");return}if(!p){s(""),a("");return}let m=!1;return(()=>{const x=V$()?"dark":"default";uh.initialize({startOnLoad:!1,theme:x,suppressErrorRendering:!0})})(),uh.render(g,p).then(({svg:x})=>{m||(s(x),a(""))}).catch(x=>{m||(a(x.message||"Mermaid render error"),s(""))}),()=>{m=!0}},[n,p,g,h]),T.jsxs(_X,{className:`code-block-wrapper ${r?"selected":""}`,children:[T.jsxs("div",{className:"code-block-header",children:[T.jsxs("select",{contentEditable:!1,value:t.attrs.language||"",onChange:m=>e({language:m.target.value}),children:[T.jsx("option",{value:"",children:"Plain Text"}),T.jsx("option",{value:"mermaid",children:"Mermaid"}),T.jsx("option",{value:"javascript",children:"JavaScript"}),T.jsx("option",{value:"typescript",children:"TypeScript"}),T.jsx("option",{value:"html",children:"HTML"}),T.jsx("option",{value:"css",children:"CSS"}),T.jsx("option",{value:"python",children:"Python"}),T.jsx("option",{value:"java",children:"Java"}),T.jsx("option",{value:"cpp",children:"C++"}),T.jsx("option",{value:"go",children:"Go"}),T.jsx("option",{value:"rust",children:"Rust"}),T.jsx("option",{value:"json",children:"JSON"}),T.jsx("option",{value:"markdown",children:"Markdown"}),T.jsx("option",{value:"bash",children:"Bash"})]}),n&&T.jsx("button",{className:"mermaid-fullscreen-btn",contentEditable:!1,onClick:()=>c(!0),title:"全屏预览",children:T.jsx(v7,{className:"size-4"})})]}),n?T.jsx("div",{className:"mermaid-preview",contentEditable:!1,children:o?T.jsxs("div",{className:"mermaid-error",children:["Mermaid Error: ",o]}):i?T.jsx("div",{className:"mermaid-svg-container",dangerouslySetInnerHTML:{__html:i}}):T.jsx("div",{className:"mermaid-loading",children:"渲染中..."})}):T.jsx("pre",{className:"code-block",children:T.jsx("code",{children:T.jsx(wX,{})})}),n&&T.jsx(uxe,{source:p,open:l,onOpenChange:m=>c(m)})]})}const fxe=yQ.extend({addNodeView(){return NX(dxe)}}).configure({lowlight:hxe});function pxe({value:t,onChange:e,mode:r,placeholder:n,readOnly:i,path:s,onLinkClick:o}){const a=B.useRef(!1),l=B.useRef(t),c=vX({extensions:[uQ.configure({codeBlock:!1,link:!1,underline:!1}),fxe,bQ.configure({placeholder:n||"在这里输入 Markdown..."}),gre.configure({html:!0,transformPastedText:!0,transformCopiedText:!0}),j6.configure({resizable:!0}),z6,$6,P6,HR,jR.configure({nested:!0}),NR.configure({openOnClick:!1}),Sne,Ane.configure({multicolor:!0}),WR,Gne],content:t,editable:!i&&r==="wysiwyg",onUpdate:({editor:h})=>{if(!a.current)try{const g=h.storage.markdown,p=g&&typeof g.getMarkdown=="function"?g.getMarkdown():h.getText();p!==l.current&&(l.current=p,e(p))}catch(d){console.error("Failed to get markdown:",d);const g=h.getText();g!==l.current&&(l.current=g,e(g))}}});return B.useEffect(()=>{if(!c||a.current)return;let h="";try{const m=c.storage.markdown;h=m&&typeof m.getMarkdown=="function"?m.getMarkdown():c.getText()}catch{h=c.getText()}if(h===t){l.current=t;return}const{from:d,to:g}=c.state.selection;a.current=!0,c.commands.setContent(t),l.current=t,requestAnimationFrame(()=>{a.current=!1;try{const p=c.state.doc.content.size,m=Math.min(d,p),y=Math.min(g,p);m>=0&&y>=0&&c.commands.setTextSelection({from:m,to:y})}catch{c.commands.setTextSelection({from:0,to:0})}})},[c,t]),B.useEffect(()=>{c&&c.setEditable(!i&&r==="wysiwyg")},[c,i,r]),B.useEffect(()=>{if(!s||!o)return;const h=d=>{const p=d.target.closest("a");if(!p)return;const m=document.querySelector(".tiptap-editor");if(!m||!m.contains(p))return;d.preventDefault(),d.stopPropagation();const y=p.getAttribute("href");if(!y||y.startsWith("http://")||y.startsWith("https://")||y.startsWith("mailto:")||y.startsWith("#"))return;const x=s.substring(0,s.lastIndexOf("/"));let C=y;if(y.startsWith("./"))C=x+y.slice(1);else if(y.startsWith("../")){let v=x,_=y.slice(3);for(;_.startsWith("../");){const M=v.lastIndexOf("/");if(M<=0)break;v=v.substring(0,M),_=_.slice(3)}_.startsWith("../")?C=y:C=v+"/"+_}else y.startsWith("/")||(C=x+"/"+y);C=decodeURIComponent(C),o(C)};return document.addEventListener("click",h,!0),()=>document.removeEventListener("click",h,!0)},[s,o]),r==="source"?T.jsx("textarea",{className:"editor-textarea",value:t,onChange:h=>e(h.target.value),placeholder:n||"在这里输入 Markdown...",readOnly:i,spellCheck:!1}):T.jsx("div",{className:"tiptap-editor-wrapper",children:T.jsx(fR,{editor:c,className:"tiptap-editor"})})}const gxe=B.memo(function({visible:e,onClose:r,onCreate:n,currentDir:i}){const[s,o]=B.useState(""),[a,l]=B.useState(!1);B.useEffect(()=>{e&&o("")},[e]);const c=()=>{s.trim()&&(n(s.trim(),a,i),o(""),r())},h=p=>{p||r()},d=p=>{p.key==="Enter"&&c()},g=i?i.split("/").filter(Boolean).join(" / "):"根目录";return T.jsx(m2,{open:e,onOpenChange:h,children:T.jsxs(Sy,{side:"bottom",className:"rounded-t-2xl",noClose:!0,children:[T.jsxs(Ey,{className:"text-left",children:[T.jsx(Ty,{children:"新建"}),T.jsxs(y2,{children:["位置: ",g]})]}),T.jsxs("div",{className:"space-y-4 mt-4",children:[T.jsxs("div",{className:"flex gap-2",children:[T.jsxs(Dt,{variant:a?"outline":"default",onClick:()=>l(!1),className:"flex-1 h-11",children:[T.jsx(Fo,{className:"size-4 mr-2"}),"Markdown"]}),T.jsxs(Dt,{variant:a?"default":"outline",onClick:()=>l(!0),className:"flex-1 h-11",children:[T.jsx(Li,{className:"size-4 mr-2"}),"文件夹"]})]}),T.jsx(fh,{placeholder:a?"文件夹名称":"文件名称 (自动添加 .md)",value:s,onChange:p=>o(p.target.value),onKeyDown:d,className:"h-11",autoFocus:!0}),T.jsxs("div",{className:"flex gap-2 justify-end pt-2",children:[T.jsx(Dt,{variant:"outline",onClick:r,children:"取消"}),T.jsx(Dt,{onClick:c,children:"创建"})]})]})]})})});function mxe({open:t,onOpenChange:e,files:r,onSelect:n}){const[i,s]=B.useState(""),[o,a]=B.useState([]),[l,c]=B.useState(0),[h,d]=B.useState(!1),g=B.useRef(null),{buildIndex:p,search:m,isIndexing:y}=TL(),x=B.useRef(!1);B.useEffect(()=>{d(window.innerWidth<768)},[]),B.useEffect(()=>{t&&!x.current?(p(r),x.current=!0):t&&x.current&&p(r)},[t,r,p]),B.useEffect(()=>{t?setTimeout(()=>{var _;return(_=g.current)==null?void 0:_.focus()},100):(s(""),a([]),c(0))},[t]),B.useEffect(()=>{if(!i.trim()){a([]),c(0);return}const _=setTimeout(()=>{const M=m(i);a(M),c(0)},150);return()=>clearTimeout(_)},[i,m]);const C=B.useCallback(_=>{n(_),e(!1)},[n,e]),v=B.useCallback(_=>{_.key==="ArrowDown"?(_.preventDefault(),c(M=>Math.min(M+1,o.length-1))):_.key==="ArrowUp"?(_.preventDefault(),c(M=>Math.max(M-1,0))):_.key==="Enter"&&o.length>0?(_.preventDefault(),C(o[l].path)):_.key==="Escape"&&e(!1)},[o,l,C,e]);return B.useEffect(()=>{const _=M=>{M.key==="Escape"&&t&&e(!1)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[t,e]),t?T.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-sm",children:[T.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[h&&T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>e(!1),children:T.jsx(n7,{className:"size-5"})}),T.jsxs("div",{className:"relative flex-1",children:[T.jsx(Cu,{className:"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),T.jsx(fh,{ref:g,type:"text",placeholder:"搜索文件或内容...",value:i,onChange:_=>s(_.target.value),onKeyDown:v,className:"pl-9 pr-20"}),!i&&T.jsx("span",{className:"absolute right-10 top-1/2 -translate-y-1/2 text-xs text-muted-foreground pointer-events-none",children:"⌘K"}),i&&T.jsx("button",{onClick:()=>s(""),className:"absolute right-3 top-1/2 -translate-y-1/2",children:T.jsx(qu,{className:"size-4 text-muted-foreground hover:text-foreground"})})]}),T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>e(!1),children:T.jsx(qu,{className:"size-5"})})]}),T.jsxs("div",{className:"flex-1 overflow-y-auto",children:[y&&T.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[T.jsx(C7,{className:"size-5 mr-2 animate-spin"}),T.jsx("span",{className:"text-sm",children:"正在建立索引..."})]}),!y&&i&&o.length===0&&T.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[T.jsx(Cu,{className:"size-10 mb-3 opacity-50"}),T.jsx("span",{className:"text-sm",children:"未找到相关结果"})]}),!y&&!i&&T.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[T.jsx(Cu,{className:"size-10 mb-3 opacity-50"}),T.jsx("span",{className:"text-sm",children:"输入关键词搜索文件名或内容"})]}),o.length>0&&T.jsx("div",{className:"py-2",children:o.map((_,M)=>T.jsxs("button",{onClick:()=>C(_.path),className:Ue("w-full px-4 py-3 flex items-start gap-3 text-left hover:bg-accent transition-colors",M===l&&"bg-accent"),children:[T.jsx(Fo,{className:"size-5 mt-0.5 text-muted-foreground shrink-0"}),T.jsxs("div",{className:"flex-1 min-w-0",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("span",{className:"font-medium truncate",children:_.name}),_.source==="name"&&T.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:"文件名"})]}),_.matchedContent&&T.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:_.matchedContent}),T.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:_.path})]})]},_.path))})]}),o.length>0&&T.jsxs("div",{className:"px-4 py-2 border-t border-border text-xs text-muted-foreground flex items-center justify-between",children:[T.jsxs("span",{children:[o.length," 个结果"]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("span",{className:"px-1.5 py-0.5 rounded bg-accent",children:"↑↓"}),T.jsx("span",{children:"选择"}),T.jsx("span",{className:"px-1.5 py-0.5 rounded bg-accent",children:"Enter"}),T.jsx("span",{children:"打开"})]})]})]}):null}const kb=Rf,yxe=If,G$=B.forwardRef(({className:t,...e},r)=>T.jsx(bc,{ref:r,className:Ue("fixed inset-0 z-50 bg-black/80 animate-fade-in",t),...e}));G$.displayName=bc.displayName;const sp=B.forwardRef(({className:t,children:e,...r},n)=>T.jsxs(yxe,{children:[T.jsx(G$,{}),T.jsxs(xc,{ref:n,className:Ue("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 animate-zoom-in rounded-lg max-h-[calc(100vh-2rem)] overflow-y-auto",t),...r,children:[e,T.jsxs(Pf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[T.jsx(qu,{className:"size-4"}),T.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));sp.displayName=xc.displayName;const op=({className:t,...e})=>T.jsx("div",{className:Ue("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});op.displayName="DialogHeader";const vb=({className:t,...e})=>T.jsx("div",{className:Ue("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});vb.displayName="DialogFooter";const ap=B.forwardRef(({className:t,...e},r)=>T.jsx(ph,{ref:r,className:Ue("text-lg font-semibold leading-none tracking-tight",t),...e}));ap.displayName=ph.displayName;const lp=B.forwardRef(({className:t,...e},r)=>T.jsx(Ff,{ref:r,className:Ue("text-sm text-muted-foreground",t),...e}));lp.displayName=Ff.displayName;function bxe({open:t,onOpenChange:e,item:r,onRename:n}){const[i,s]=B.useState("");B.useEffect(()=>{r&&s(r.type==="directory"?r.name:r.name.replace(/\.md$/,""))},[r]);const o=()=>{r&&i.trim()&&(n(r.path,i.trim()),e(!1))};return r?T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[400px]",children:[T.jsxs(op,{children:[T.jsx(ap,{children:"重命名"}),T.jsxs(lp,{children:["输入新的名称来重命名「",r.name,"」"]})]}),T.jsxs("div",{className:"flex items-center gap-2 py-2",children:[r.type==="directory"?T.jsx(Li,{className:"size-5 shrink-0 text-muted-foreground"}):T.jsx(pL,{className:"size-5 shrink-0 text-muted-foreground"}),T.jsx(fh,{value:i,onChange:a=>s(a.target.value),onKeyDown:a=>{a.key==="Enter"&&o()},autoFocus:!0})]}),T.jsxs(vb,{children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:o,disabled:!i.trim(),children:"确定"})]})]})}):null}function K$({node:t,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o}){if(t.type!=="directory")return null;const a=n.has(t.path),l=e===t.path,c=t.path===s||s.startsWith(t.path+"/"),h=t.children&&t.children.length>0;return T.jsxs("div",{className:"select-none",children:[T.jsxs("div",{className:Ue("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",l&&"bg-accent",c&&"opacity-50 pointer-events-none"),onClick:()=>!c&&r(t.path),children:[T.jsx("button",{onClick:d=>{d.stopPropagation(),h&&!c&&i(t.path)},className:Ue("size-5 flex items-center justify-center rounded hover:bg-black/10 dark:hover:bg-white/10",(!h||c)&&"invisible"),children:T.jsx(Zv,{className:Ue("size-3.5 transition-transform",a&&"rotate-90")})}),a?T.jsx(gL,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm truncate flex-1",children:t.name}),l&&T.jsx("span",{className:"text-xs text-muted-foreground",children:"移动到这里"})]}),a&&h&&T.jsx("div",{className:"ml-4",children:t.children.map(d=>T.jsx(K$,{node:d,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o},d.path))})]})}function xxe({open:t,onOpenChange:e,item:r,groups:n,onMove:i}){const[s,o]=B.useState(""),[a,l]=B.useState(null),[c,h]=B.useState(null),[d,g]=B.useState(new Set);B.useEffect(()=>{var v;if(r&&t){const _=r.path.substring(0,r.path.lastIndexOf("/"));o(_||"/");const M=n.find(N=>N.files.some(E=>E.path===r.path)),L=(M==null?void 0:M.root.path)||((v=n[0])==null?void 0:v.root.path)||null;l(L),h(L)}},[r,t,n]);const p=v=>{g(_=>{const M=new Set(_);return M.has(v)?M.delete(v):M.add(v),M})},m=()=>{if(r&&s!==null&&a!==null&&c!==null){const v=r.path.split("/").pop()||"",_=s==="/"?`/${v}`:`${s}/${v}`;(_!==r.path||c!==a)&&i(r.path,_,c,a),e(!1)}};if(!r)return null;const y=n.find(v=>v.root.path===a),x=(y==null?void 0:y.files)||[],C=s?s==="/"?"根目录":s.split("/").filter(Boolean).join(" / "):"";return T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[480px] max-h-[80vh] flex flex-col",children:[T.jsxs(op,{children:[T.jsx(ap,{children:"移动到"}),T.jsxs(lp,{children:["选择要将「",r.name,"」移动到的目标位置"]})]}),T.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-muted-foreground",children:[T.jsx(Fo,{className:"size-4 shrink-0"}),T.jsx("span",{className:"truncate",children:r.name})]}),n.length>1&&T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"目标根目录"}),T.jsx("select",{value:a||"",onChange:v=>{l(v.target.value),o("/"),g(new Set)},className:"w-full px-3 py-2 text-sm border rounded-md bg-background",children:n.map(v=>T.jsx("option",{value:v.root.path,children:v.root.path.split("/").pop()||v.root.path},v.root.path))})]}),T.jsx(Cb,{className:"flex-1 max-h-[300px] border rounded-md p-2",children:T.jsxs("div",{className:"space-y-0.5",children:[T.jsxs("div",{className:Ue("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",s==="/"&&"bg-accent"),onClick:()=>o("/"),children:[T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm",children:"根目录"}),s==="/"&&T.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"移动到这里"})]}),x.map(v=>T.jsx(K$,{node:v,selectedPath:s,onSelect:o,expandedPaths:d,onToggleExpand:p,currentItemPath:r.path,rootPath:a||""},v.path))]})}),T.jsxs("div",{className:"text-xs text-muted-foreground py-2",children:["目标位置: ",T.jsx("span",{className:"font-medium text-foreground",children:C})]}),T.jsxs(vb,{children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:m,disabled:s===null,children:"移动"})]})]})})}function Y$({node:t,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o}){if(t.type!=="directory")return null;const a=n.has(t.path),l=e===t.path,c=t.path===s||s.startsWith(t.path+"/"),h=t.children&&t.children.length>0;return T.jsxs("div",{className:"select-none",children:[T.jsxs("div",{className:Ue("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",l&&"bg-accent",c&&"opacity-50 pointer-events-none"),onClick:()=>!c&&r(t.path),children:[T.jsx("button",{onClick:d=>{d.stopPropagation(),h&&!c&&i(t.path)},className:Ue("size-5 flex items-center justify-center rounded hover:bg-black/10 dark:hover:bg-white/10",(!h||c)&&"invisible"),children:T.jsx(Zv,{className:Ue("size-3.5 transition-transform",a&&"rotate-90")})}),a?T.jsx(gL,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm truncate flex-1",children:t.name}),l&&T.jsx("span",{className:"text-xs text-muted-foreground",children:"复制到这里"})]}),a&&h&&T.jsx("div",{className:"ml-4",children:t.children.map(d=>T.jsx(Y$,{node:d,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o},d.path))})]})}function Cxe({open:t,onOpenChange:e,item:r,groups:n,onCopy:i}){const[s,o]=B.useState(""),[a,l]=B.useState(null),[c,h]=B.useState(null),[d,g]=B.useState(new Set);B.useEffect(()=>{var v;if(r&&t){const _=r.path.substring(0,r.path.lastIndexOf("/"));o(_||"/");const M=n.find(N=>N.files.some(E=>E.path===r.path)),L=(M==null?void 0:M.root.path)||((v=n[0])==null?void 0:v.root.path)||null;l(L),h(L)}},[r,t,n]);const p=v=>{g(_=>{const M=new Set(_);return M.has(v)?M.delete(v):M.add(v),M})},m=()=>{if(r&&s!==null&&a!==null&&c!==null){const v=r.path.split("/").pop()||"",_=s==="/"?`/${v}`:`${s}/${v}`;i(r.path,_,c,a),e(!1)}};if(!r)return null;const y=n.find(v=>v.root.path===a),x=(y==null?void 0:y.files)||[],C=s?s==="/"?"根目录":s.split("/").filter(Boolean).join(" / "):"";return T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[480px] max-h-[80vh] flex flex-col",children:[T.jsxs(op,{children:[T.jsx(ap,{children:"复制到"}),T.jsxs(lp,{children:["选择要将「",r.name,"」复制到的目标位置"]})]}),T.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-muted-foreground",children:[T.jsx(Fo,{className:"size-4 shrink-0"}),T.jsx("span",{className:"truncate",children:r.name})]}),n.length>1&&T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"目标根目录"}),T.jsx("select",{value:a||"",onChange:v=>{l(v.target.value),o("/"),g(new Set)},className:"w-full px-3 py-2 text-sm border rounded-md bg-background",children:n.map(v=>T.jsx("option",{value:v.root.path,children:v.root.path.split("/").pop()||v.root.path},v.root.path))})]}),T.jsx(Cb,{className:"flex-1 max-h-[300px] border rounded-md p-2",children:T.jsxs("div",{className:"space-y-0.5",children:[T.jsxs("div",{className:Ue("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",s==="/"&&"bg-accent"),onClick:()=>o("/"),children:[T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm",children:"根目录"}),s==="/"&&T.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"复制到这里"})]}),x.map(v=>T.jsx(Y$,{node:v,selectedPath:s,onSelect:o,expandedPaths:d,onToggleExpand:p,currentItemPath:r.path,rootPath:a||""},v.path))]})}),T.jsxs("div",{className:"text-xs text-muted-foreground py-2",children:["目标位置: ",T.jsx("span",{className:"font-medium text-foreground",children:C})]}),T.jsxs(vb,{children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:m,disabled:s===null,children:"复制"})]})]})})}const Vv=B.forwardRef(({className:t,checked:e,onCheckedChange:r,onClick:n,...i},s)=>{const o=a=>{n==null||n(a),r&&r(!e)};return T.jsx("button",{type:"button",role:"switch","aria-checked":e,"data-state":e?"checked":"unchecked",ref:s,onClick:o,className:Ue("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...i,children:T.jsx("span",{"data-state":e?"checked":"unchecked",className:Ue("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});Vv.displayName="Switch";var lL=1,kxe=.9,vxe=.8,wxe=.17,FC=.1,PC=.999,_xe=.9999,Sxe=.99,Exe=/[\\\/_+.#"@\[\(\{&]/,Txe=/[\\\/_+.#"@\[\(\{&]/g,Axe=/[\s-]/,X$=/[\s-]/g;function Gv(t,e,r,n,i,s,o){if(s===e.length)return i===t.length?lL:Sxe;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=n.charAt(s),c=r.indexOf(l,i),h=0,d,g,p,m;c>=0;)d=Gv(t,e,r,n,c+1,s+1,o),d>h&&(c===i?d*=lL:Exe.test(t.charAt(c-1))?(d*=vxe,p=t.slice(i,c-1).match(Txe),p&&i>0&&(d*=Math.pow(PC,p.length))):Axe.test(t.charAt(c-1))?(d*=kxe,m=t.slice(i,c-1).match(X$),m&&i>0&&(d*=Math.pow(PC,m.length))):(d*=wxe,i>0&&(d*=Math.pow(PC,c-i))),t.charAt(c)!==e.charAt(s)&&(d*=_xe)),(d<FC&&r.charAt(c-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(c-1)!==n.charAt(s))&&(g=Gv(t,e,r,n,c+1,s+2,o),g*FC>d&&(d=g*FC)),d>h&&(h=d),c=r.indexOf(l,c+1);return o[a]=h,h}function cL(t){return t.toLowerCase().replace(X$," ")}function Mxe(t,e,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,Gv(t,e,cL(t),cL(e),0,0,{})}var Nxe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],al=Nxe.reduce((t,e)=>{const r=UL(`Primitive.${e}`),n=B.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),vd='[cmdk-group=""]',$C='[cmdk-group-items=""]',Lxe='[cmdk-group-heading=""]',Z$='[cmdk-item=""]',uL=`${Z$}:not([aria-disabled="true"])`,Kv="cmdk-item-select",mu="data-value",Bxe=(t,e,r)=>Mxe(t,e,r),Q$=B.createContext(void 0),cp=()=>B.useContext(Q$),J$=B.createContext(void 0),N_=()=>B.useContext(J$),e9=B.createContext(void 0),t9=B.forwardRef((t,e)=>{let r=yu(()=>{var z,oe;return{search:"",value:(oe=(z=t.value)!=null?z:t.defaultValue)!=null?oe:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=yu(()=>new Set),i=yu(()=>new Map),s=yu(()=>new Map),o=yu(()=>new Set),a=r9(t),{label:l,children:c,value:h,onValueChange:d,filter:g,shouldFilter:p,loop:m,disablePointerSelection:y=!1,vimBindings:x=!0,...C}=t,v=Vs(),_=Vs(),M=Vs(),L=B.useRef(null),N=Wxe();gc(()=>{if(h!==void 0){let z=h.trim();r.current.value=z,E.emit()}},[h]),gc(()=>{N(6,J)},[]);let E=B.useMemo(()=>({subscribe:z=>(o.current.add(z),()=>o.current.delete(z)),snapshot:()=>r.current,setState:(z,oe,re)=>{var ee,fe,Se,Me;if(!Object.is(r.current[z],oe)){if(r.current[z]=oe,z==="search")ie(),$(),N(1,j);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ee=document.getElementById(M);Ee?Ee.focus():(ee=document.getElementById(v))==null||ee.focus()}if(N(7,()=>{var Ee;r.current.selectedItemId=(Ee=G())==null?void 0:Ee.id,E.emit()}),re||N(5,J),((fe=a.current)==null?void 0:fe.value)!==void 0){let Ee=oe??"";(Me=(Se=a.current).onValueChange)==null||Me.call(Se,Ee);return}}E.emit()}},emit:()=>{o.current.forEach(z=>z())}}),[]),O=B.useMemo(()=>({value:(z,oe,re)=>{var ee;oe!==((ee=s.current.get(z))==null?void 0:ee.value)&&(s.current.set(z,{value:oe,keywords:re}),r.current.filtered.items.set(z,I(oe,re)),N(2,()=>{$(),E.emit()}))},item:(z,oe)=>(n.current.add(z),oe&&(i.current.has(oe)?i.current.get(oe).add(z):i.current.set(oe,new Set([z]))),N(3,()=>{ie(),$(),r.current.value||j(),E.emit()}),()=>{s.current.delete(z),n.current.delete(z),r.current.filtered.items.delete(z);let re=G();N(4,()=>{ie(),(re==null?void 0:re.getAttribute("id"))===z&&j(),E.emit()})}),group:z=>(i.current.has(z)||i.current.set(z,new Set),()=>{s.current.delete(z),i.current.delete(z)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:v,inputId:M,labelId:_,listInnerRef:L}),[]);function I(z,oe){var re,ee;let fe=(ee=(re=a.current)==null?void 0:re.filter)!=null?ee:Bxe;return z?fe(z,r.current.search,oe):0}function $(){if(!r.current.search||a.current.shouldFilter===!1)return;let z=r.current.filtered.items,oe=[];r.current.filtered.groups.forEach(ee=>{let fe=i.current.get(ee),Se=0;fe.forEach(Me=>{let Ee=z.get(Me);Se=Math.max(Ee,Se)}),oe.push([ee,Se])});let re=L.current;H().sort((ee,fe)=>{var Se,Me;let Ee=ee.getAttribute("id"),xe=fe.getAttribute("id");return((Se=z.get(xe))!=null?Se:0)-((Me=z.get(Ee))!=null?Me:0)}).forEach(ee=>{let fe=ee.closest($C);fe?fe.appendChild(ee.parentElement===fe?ee:ee.closest(`${$C} > *`)):re.appendChild(ee.parentElement===re?ee:ee.closest(`${$C} > *`))}),oe.sort((ee,fe)=>fe[1]-ee[1]).forEach(ee=>{var fe;let Se=(fe=L.current)==null?void 0:fe.querySelector(`${vd}[${mu}="${encodeURIComponent(ee[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function j(){let z=H().find(re=>re.getAttribute("aria-disabled")!=="true"),oe=z==null?void 0:z.getAttribute(mu);E.setState("value",oe||void 0)}function ie(){var z,oe,re,ee;if(!r.current.search||a.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let fe=0;for(let Se of n.current){let Me=(oe=(z=s.current.get(Se))==null?void 0:z.value)!=null?oe:"",Ee=(ee=(re=s.current.get(Se))==null?void 0:re.keywords)!=null?ee:[],xe=I(Me,Ee);r.current.filtered.items.set(Se,xe),xe>0&&fe++}for(let[Se,Me]of i.current)for(let Ee of Me)if(r.current.filtered.items.get(Ee)>0){r.current.filtered.groups.add(Se);break}r.current.filtered.count=fe}function J(){var z,oe,re;let ee=G();ee&&(((z=ee.parentElement)==null?void 0:z.firstChild)===ee&&((re=(oe=ee.closest(vd))==null?void 0:oe.querySelector(Lxe))==null||re.scrollIntoView({block:"nearest"})),ee.scrollIntoView({block:"nearest"}))}function G(){var z;return(z=L.current)==null?void 0:z.querySelector(`${Z$}[aria-selected="true"]`)}function H(){var z;return Array.from(((z=L.current)==null?void 0:z.querySelectorAll(uL))||[])}function V(z){let oe=H()[z];oe&&E.setState("value",oe.getAttribute(mu))}function Q(z){var oe;let re=G(),ee=H(),fe=ee.findIndex(Me=>Me===re),Se=ee[fe+z];(oe=a.current)!=null&&oe.loop&&(Se=fe+z<0?ee[ee.length-1]:fe+z===ee.length?ee[0]:ee[fe+z]),Se&&E.setState("value",Se.getAttribute(mu))}function F(z){let oe=G(),re=oe==null?void 0:oe.closest(vd),ee;for(;re&&!ee;)re=z>0?jxe(re,vd):Hxe(re,vd),ee=re==null?void 0:re.querySelector(uL);ee?E.setState("value",ee.getAttribute(mu)):Q(z)}let K=()=>V(H().length-1),U=z=>{z.preventDefault(),z.metaKey?K():z.altKey?F(1):Q(1)},P=z=>{z.preventDefault(),z.metaKey?V(0):z.altKey?F(-1):Q(-1)};return B.createElement(al.div,{ref:e,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:z=>{var oe;(oe=C.onKeyDown)==null||oe.call(C,z);let re=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||re))switch(z.key){case"n":case"j":{x&&z.ctrlKey&&U(z);break}case"ArrowDown":{U(z);break}case"p":case"k":{x&&z.ctrlKey&&P(z);break}case"ArrowUp":{P(z);break}case"Home":{z.preventDefault(),V(0);break}case"End":{z.preventDefault(),K();break}case"Enter":{z.preventDefault();let ee=G();if(ee){let fe=new Event(Kv);ee.dispatchEvent(fe)}}}}},B.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:Uxe},l),wb(t,z=>B.createElement(J$.Provider,{value:E},B.createElement(Q$.Provider,{value:O},z))))}),Oxe=B.forwardRef((t,e)=>{var r,n;let i=Vs(),s=B.useRef(null),o=B.useContext(e9),a=cp(),l=r9(t),c=(n=(r=l.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;gc(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let h=n9(i,s,[t.value,t.children,s],t.keywords),d=N_(),g=Qa(N=>N.value&&N.value===h.current),p=Qa(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);B.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(Kv,m),()=>N.removeEventListener(Kv,m)},[p,t.onSelect,t.disabled]);function m(){var N,E;y(),(E=(N=l.current).onSelect)==null||E.call(N,h.current)}function y(){d.setState("value",h.current,!0)}if(!p)return null;let{disabled:x,value:C,onSelect:v,forceMount:_,keywords:M,...L}=t;return B.createElement(al.div,{ref:Wa(s,e),...L,id:i,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!g,"data-disabled":!!x,"data-selected":!!g,onPointerMove:x||a.getDisablePointerSelection()?void 0:y,onClick:x?void 0:m},t.children)}),Dxe=B.forwardRef((t,e)=>{let{heading:r,children:n,forceMount:i,...s}=t,o=Vs(),a=B.useRef(null),l=B.useRef(null),c=Vs(),h=cp(),d=Qa(p=>i||h.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);gc(()=>h.group(o),[]),n9(o,a,[t.value,t.heading,l]);let g=B.useMemo(()=>({id:o,forceMount:i}),[i]);return B.createElement(al.div,{ref:Wa(a,e),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},r&&B.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),wb(t,p=>B.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},B.createElement(e9.Provider,{value:g},p))))}),Rxe=B.forwardRef((t,e)=>{let{alwaysRender:r,...n}=t,i=B.useRef(null),s=Qa(o=>!o.search);return!r&&!s?null:B.createElement(al.div,{ref:Wa(i,e),...n,"cmdk-separator":"",role:"separator"})}),Ixe=B.forwardRef((t,e)=>{let{onValueChange:r,...n}=t,i=t.value!=null,s=N_(),o=Qa(c=>c.search),a=Qa(c=>c.selectedItemId),l=cp();return B.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),B.createElement(al.input,{ref:e,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),r==null||r(c.target.value)}})}),Fxe=B.forwardRef((t,e)=>{let{children:r,label:n="Suggestions",...i}=t,s=B.useRef(null),o=B.useRef(null),a=Qa(c=>c.selectedItemId),l=cp();return B.useEffect(()=>{if(o.current&&s.current){let c=o.current,h=s.current,d,g=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let p=c.offsetHeight;h.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(d),g.unobserve(c)}}},[]),B.createElement(al.div,{ref:Wa(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":n,id:l.listId},wb(t,c=>B.createElement("div",{ref:Wa(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),Pxe=B.forwardRef((t,e)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:s,container:o,...a}=t;return B.createElement(Rf,{open:r,onOpenChange:n},B.createElement(If,{container:o},B.createElement(bc,{"cmdk-overlay":"",className:i}),B.createElement(xc,{"aria-label":t.label,"cmdk-dialog":"",className:s},B.createElement(t9,{ref:e,...a}))))}),$xe=B.forwardRef((t,e)=>Qa(r=>r.filtered.count===0)?B.createElement(al.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),zxe=B.forwardRef((t,e)=>{let{progress:r,children:n,label:i="Loading...",...s}=t;return B.createElement(al.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},wb(t,o=>B.createElement("div",{"aria-hidden":!0},o)))}),pi=Object.assign(t9,{List:Fxe,Item:Oxe,Input:Ixe,Group:Dxe,Separator:Rxe,Dialog:Pxe,Empty:$xe,Loading:zxe});function jxe(t,e){let r=t.nextElementSibling;for(;r;){if(r.matches(e))return r;r=r.nextElementSibling}}function Hxe(t,e){let r=t.previousElementSibling;for(;r;){if(r.matches(e))return r;r=r.previousElementSibling}}function r9(t){let e=B.useRef(t);return gc(()=>{e.current=t}),e}var gc=typeof window>"u"?B.useEffect:B.useLayoutEffect;function yu(t){let e=B.useRef();return e.current===void 0&&(e.current=t()),e}function Qa(t){let e=N_(),r=()=>t(e.snapshot());return B.useSyncExternalStore(e.subscribe,r,r)}function n9(t,e,r,n=[]){let i=B.useRef(),s=cp();return gc(()=>{var o;let a=(()=>{var c;for(let h of r){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(c=h.current.textContent)==null?void 0:c.trim():i.current}})(),l=n.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(mu,a),i.current=a}),i}var Wxe=()=>{let[t,e]=B.useState(),r=yu(()=>new Map);return gc(()=>{r.current.forEach(n=>n()),r.current=new Map},[t]),(n,i)=>{r.current.set(n,i),e({})}};function qxe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function wb({asChild:t,children:e},r){return t&&B.isValidElement(e)?B.cloneElement(qxe(e),{ref:e.ref},r(e.props.children)):r(e)}var Uxe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const i9=B.forwardRef(({className:t,...e},r)=>T.jsx(pi,{ref:r,className:Ue("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));i9.displayName=pi.displayName;const s9=B.forwardRef(({className:t,...e},r)=>T.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[T.jsx(Cu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),T.jsx(pi.Input,{ref:r,className:Ue("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));s9.displayName=pi.Input.displayName;const o9=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.List,{ref:r,className:Ue("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));o9.displayName=pi.List.displayName;const Yv=B.forwardRef((t,e)=>T.jsx(pi.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Yv.displayName=pi.Empty.displayName;const Vxe=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.Group,{ref:r,className:Ue("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Vxe.displayName=pi.Group.displayName;const Gxe=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.Separator,{ref:r,className:Ue("-mx-1 h-px bg-border",t),...e}));Gxe.displayName=pi.Separator.displayName;const a9=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.Item,{ref:r,className:Ue("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...e}));a9.displayName=pi.Item.displayName;const Kxe=B.memo(function({value:e,onChange:r,placeholder:n="输入路径...",disabled:i=!1,className:s}){const[o,a]=B.useState(!1),[l,c]=B.useState(e),[h,d]=B.useState([]),[g,p]=B.useState(-1),[m,y]=B.useState(!1),[x,C]=B.useState(()=>typeof window>"u"?!1:window.innerWidth<768),v=B.useRef(null),_=B.useRef(null),M=B.useRef(null);B.useEffect(()=>{const I=()=>C(window.innerWidth<768);return I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]),B.useEffect(()=>{c(e)},[e]);const L=B.useCallback(async I=>{if(!I.trim()){d([]),a(!1);return}y(!0);try{const $=await fetch(`/api/files/roots/search?q=${encodeURIComponent(I)}`);if(!$.ok)throw new Error("Search failed");const j=await $.json();d(j.matches.map(ie=>({path:ie}))),a(!0),p(-1)}catch($){console.error("Failed to search paths:",$),d([])}finally{y(!1)}},[]);B.useEffect(()=>(_.current&&clearTimeout(_.current),_.current=window.setTimeout(()=>{L(l)},150),()=>{_.current&&clearTimeout(_.current)}),[l,L]);const N=B.useCallback(I=>{if(!(!o||h.length===0))switch(I.key){case"ArrowDown":I.preventDefault(),p($=>$<h.length-1?$+1:$);break;case"ArrowUp":I.preventDefault(),p($=>$>0?$-1:$);break;case"Enter":if(I.preventDefault(),g>=0&&g<h.length){const $=h[g].path;r($),c($),a(!1),p(-1)}break;case"Escape":I.preventDefault(),a(!1),p(-1);break}},[o,h,g,r]),E=B.useCallback(I=>{r(I),c(I),a(!1),p(-1)},[r]),O=B.useCallback(I=>{c(I),r(I)},[r]);return B.useEffect(()=>{const I=$=>{M.current&&!M.current.contains($.target)&&(a(!1),p(-1))};if(o)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[o]),T.jsx("div",{ref:M,className:Ue("relative",s),children:T.jsxs(i9,{className:Ue("rounded-lg border shadow-md",x&&"w-full"),onKeyDown:N,children:[T.jsx(s9,{ref:v,value:l,placeholder:n,disabled:i,onValueChange:O,className:Ue(x&&"h-12 text-base")}),o&&T.jsx(o9,{className:Ue("absolute top-full left-0 right-0 z-50 mt-1 bg-popover border rounded-md shadow-lg",x&&"max-h-[200px]"),children:m?T.jsx(Yv,{children:"搜索中..."}):h.length===0?T.jsx(Yv,{children:"未找到匹配路径"}):h.map((I,$)=>T.jsx(a9,{value:I.path,onSelect:()=>E(I.path),className:Ue("cursor-pointer",$===g&&"bg-accent"),children:T.jsx("span",{className:Ue("truncate",x&&"text-sm"),children:I.path})},I.path))})]})})});function Yxe({open:t,onOpenChange:e}){const[r,n]=B.useState({showHiddenFiles:!1,allowedExtensions:".md,.markdown,.mdown,.mkdn,.mkd,.mdwn,.mkdown,.ron",themeMode:"system",ignore:{enableIgnoreFiles:!0,ignoreFileNames:".colonynoteignore, .gitignore",patterns:""}}),[i,s]=B.useState({roots:[],newRootPath:"",loading:!1,error:null}),[o,a]=B.useState(!1),[l,c]=B.useState(null),[h,d]=B.useState([]),[g,p]=B.useState(()=>typeof window>"u"?!1:window.innerWidth<768),m=()=>{const N=localStorage.getItem("colonynote-theme");return N==="light"||N==="dark"||N==="system"?N:"system"},y=N=>{localStorage.setItem("colonynote-theme",N),N==="system"?(localStorage.removeItem("colonynote-theme"),window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")):N==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),window.dispatchEvent(new CustomEvent("theme-change"))},x=()=>{const N=m();n(E=>({...E,themeMode:N}))};B.useEffect(()=>{const N=()=>p(window.innerWidth<768);return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),B.useEffect(()=>{x()},[t]),B.useEffect(()=>{t&&(fetch("/api/files/config").then(N=>N.json()).then(N=>{var E,O,I;n({showHiddenFiles:N.showHiddenFiles??!1,allowedExtensions:(N.allowedExtensions||[]).join(","),themeMode:m(),ignore:{enableIgnoreFiles:((E=N.ignore)==null?void 0:E.enableIgnoreFiles)??!0,ignoreFileNames:(((O=N.ignore)==null?void 0:O.ignoreFileNames)||[".colonynoteignore",".gitignore"]).join(", "),patterns:(((I=N.ignore)==null?void 0:I.patterns)||[]).join(`
774
+ */var G1e=B.createContext(void 0);function K1e(t){const e=B.useContext(G1e);return t||e||"ltr"}function Y1e(t,[e,r]){return Math.min(r,Math.max(e,t))}function X1e(t,e){return B.useReducer((r,n)=>e[r][n]??r,t)}var E_="ScrollArea",[L$]=ky(E_),[Z1e,Ji]=L$(E_),B$=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=B.useState(null),[c,h]=B.useState(null),[d,g]=B.useState(null),[p,m]=B.useState(null),[y,x]=B.useState(null),[C,v]=B.useState(0),[_,M]=B.useState(0),[L,N]=B.useState(!1),[E,O]=B.useState(!1),I=Nn(e,j=>l(j)),$=K1e(i);return T.jsx(Z1e,{scope:r,type:n,dir:$,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:h,content:d,onContentChange:g,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:L,onScrollbarXEnabledChange:N,scrollbarY:y,onScrollbarYChange:x,scrollbarYEnabled:E,onScrollbarYEnabledChange:O,onCornerWidthChange:v,onCornerHeightChange:M,children:T.jsx(yn.div,{dir:$,...o,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});B$.displayName=E_;var O$="ScrollAreaViewport",D$=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Ji(O$,r),a=B.useRef(null),l=Nn(e,a,o.onViewportChange);return T.jsxs(T.Fragment,{children:[T.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),T.jsx(yn.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:T.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});D$.displayName=O$;var ao="ScrollAreaScrollbar",T_=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ji(ao,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return B.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?T.jsx(Q1e,{...n,ref:e,forceMount:r}):i.type==="scroll"?T.jsx(J1e,{...n,ref:e,forceMount:r}):i.type==="auto"?T.jsx(R$,{...n,ref:e,forceMount:r}):i.type==="always"?T.jsx(A_,{...n,ref:e}):null});T_.displayName=ao;var Q1e=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ji(ao,t.__scopeScrollArea),[s,o]=B.useState(!1);return B.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},h=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",h),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",h)}}},[i.scrollArea,i.scrollHideDelay]),T.jsx(zo,{present:r||s,children:T.jsx(R$,{"data-state":s?"visible":"hidden",...n,ref:e})})}),J1e=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ji(ao,t.__scopeScrollArea),s=t.orientation==="horizontal",o=xb(()=>l("SCROLL_END"),100),[a,l]=X1e("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return B.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),B.useEffect(()=>{const c=i.viewport,h=s?"scrollLeft":"scrollTop";if(c){let d=c[h];const g=()=>{const p=c[h];d!==p&&(l("SCROLL"),o()),d=p};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,s,l,o]),T.jsx(zo,{present:r||a!=="hidden",children:T.jsx(A_,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:mn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:mn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),R$=B.forwardRef((t,e)=>{const r=Ji(ao,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=B.useState(!1),a=t.orientation==="horizontal",l=xb(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?c:h)}},10);return hh(r.viewport,l),hh(r.content,l),T.jsx(zo,{present:n||s,children:T.jsx(A_,{"data-state":s?"visible":"hidden",...i,ref:e})})}),A_=B.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Ji(ao,t.__scopeScrollArea),s=B.useRef(null),o=B.useRef(0),[a,l]=B.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=z$(a.viewport,a.content),h={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:g=>o.current=g};function d(g,p){return sxe(g,o.current,a,p)}return r==="horizontal"?T.jsx(exe,{...h,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollLeft,p=aL(g,a,i.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollLeft=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollLeft=d(g,i.dir))}}):r==="vertical"?T.jsx(txe,{...h,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollTop,p=aL(g,a);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollTop=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollTop=d(g))}}):null}),exe=B.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ji(ao,t.__scopeScrollArea),[o,a]=B.useState(),l=B.useRef(null),c=Nn(e,l,s.onScrollbarXChange);return B.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),T.jsx(F$,{"data-orientation":"horizontal",...i,ref:c,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":bb(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,d)=>{if(s.viewport){const g=s.viewport.scrollLeft+h.deltaX;t.onWheelScroll(g),H$(g,d)&&h.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:xy(o.paddingLeft),paddingEnd:xy(o.paddingRight)}})}})}),txe=B.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ji(ao,t.__scopeScrollArea),[o,a]=B.useState(),l=B.useRef(null),c=Nn(e,l,s.onScrollbarYChange);return B.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),T.jsx(F$,{"data-orientation":"vertical",...i,ref:c,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":bb(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,d)=>{if(s.viewport){const g=s.viewport.scrollTop+h.deltaY;t.onWheelScroll(g),H$(g,d)&&h.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:xy(o.paddingTop),paddingEnd:xy(o.paddingBottom)}})}})}),[rxe,I$]=L$(ao),F$=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:h,onResize:d,...g}=t,p=Ji(ao,r),[m,y]=B.useState(null),x=Nn(e,I=>y(I)),C=B.useRef(null),v=B.useRef(""),_=p.viewport,M=n.content-n.viewport,L=Gi(h),N=Gi(l),E=xb(d,10);function O(I){if(C.current){const $=I.clientX-C.current.left,j=I.clientY-C.current.top;c({x:$,y:j})}}return B.useEffect(()=>{const I=$=>{const j=$.target;(m==null?void 0:m.contains(j))&&L($,M)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[_,m,M,L]),B.useEffect(N,[n,N]),hh(m,E),hh(p.content,E),T.jsx(rxe,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:Gi(s),onThumbPointerUp:Gi(o),onThumbPositionChange:N,onThumbPointerDown:Gi(a),children:T.jsx(yn.div,{...g,ref:x,style:{position:"absolute",...g.style},onPointerDown:mn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),C.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),O(I))}),onPointerMove:mn(t.onPointerMove,O),onPointerUp:mn(t.onPointerUp,I=>{const $=I.target;$.hasPointerCapture(I.pointerId)&&$.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),C.current=null})})})}),by="ScrollAreaThumb",P$=B.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=I$(by,t.__scopeScrollArea);return T.jsx(zo,{present:r||i.hasThumb,children:T.jsx(nxe,{ref:e,...n})})}),nxe=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Ji(by,r),o=I$(by,r),{onThumbPositionChange:a}=o,l=Nn(e,d=>o.onThumbChange(d)),c=B.useRef(void 0),h=xb(()=>{c.current&&(c.current(),c.current=void 0)},100);return B.useEffect(()=>{const d=s.viewport;if(d){const g=()=>{if(h(),!c.current){const p=oxe(d,a);c.current=p,a()}};return a(),d.addEventListener("scroll",g),()=>d.removeEventListener("scroll",g)}},[s.viewport,h,a]),T.jsx(yn.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:mn(t.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),m=d.clientX-p.left,y=d.clientY-p.top;o.onThumbPointerDown({x:m,y})}),onPointerUp:mn(t.onPointerUp,o.onThumbPointerUp)})});P$.displayName=by;var M_="ScrollAreaCorner",$$=B.forwardRef((t,e)=>{const r=Ji(M_,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?T.jsx(ixe,{...t,ref:e}):null});$$.displayName=M_;var ixe=B.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Ji(M_,r),[s,o]=B.useState(0),[a,l]=B.useState(0),c=!!(s&&a);return hh(i.scrollbarX,()=>{var d;const h=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(h),l(h)}),hh(i.scrollbarY,()=>{var d;const h=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(h),o(h)}),c?T.jsx(yn.div,{...n,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function xy(t){return t?parseInt(t,10):0}function z$(t,e){const r=t/e;return isNaN(r)?0:r}function bb(t){const e=z$(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function sxe(t,e,r,n="ltr"){const i=bb(r),s=i/2,o=e||s,a=i-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,h=r.content-r.viewport,d=n==="ltr"?[0,h]:[h*-1,0];return j$([l,c],d)(t)}function aL(t,e,r="ltr"){const n=bb(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-n,l=r==="ltr"?[0,o]:[o*-1,0],c=Y1e(t,l);return j$([0,o],[0,a])(c)}function j$(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function H$(t,e){return t>0&&t<e}var oxe=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&e(),r=s,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function xb(t,e){const r=Gi(t),n=B.useRef(0);return B.useEffect(()=>()=>window.clearTimeout(n.current),[]),B.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function hh(t,e){const r=Gi(e);Ql(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var W$=B$,axe=D$,lxe=$$;const Cb=B.forwardRef(({className:t,children:e,...r},n)=>T.jsxs(W$,{ref:n,className:We("relative overflow-hidden",t),...r,children:[T.jsx(axe,{className:"h-full w-full rounded-[inherit]",children:e}),T.jsx(q$,{}),T.jsx(lxe,{})]}));Cb.displayName=W$.displayName;const q$=B.forwardRef(({className:t,orientation:e="vertical",...r},n)=>T.jsx(T_,{ref:n,orientation:e,className:We("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:T.jsx(P$,{className:"relative flex-1 rounded-full bg-border"})}));q$.displayName=T_.displayName;const U$=()=>document.documentElement.classList.contains("dark");uh.initialize({startOnLoad:!1,theme:U$()?"dark":"default",suppressErrorRendering:!0});const cxe=B.memo(function({svgContent:e,error:r,isLoading:n}){return T.jsx("div",{className:"mermaid-fullscreen-chart",children:r?T.jsx("div",{className:"mermaid-error",children:r}):n?T.jsx("div",{className:"mermaid-loading",children:"渲染中..."}):e?T.jsx("div",{className:"mermaid-fullscreen-svg-container",dangerouslySetInnerHTML:{__html:e}}):null})});function uxe({source:t,open:e,onOpenChange:r}){const[n,i]=B.useState(!1),[s,o]=B.useState(""),[a,l]=B.useState(""),[c,h]=B.useState(!1),[d,g]=B.useState(1),[p,m]=B.useState({x:0,y:0}),[y,x]=B.useState(!1),C=B.useRef({x:0,y:0,posX:0,posY:0}),[v,_]=B.useState(null),M=B.useRef(null),L=B.useRef(null),N=B.useRef(`mermaid-fullscreen-${Math.random().toString(36).substr(2,9)}`);B.useEffect(()=>{if(!e||!t)return;let K=!1;h(!0),l(""),g(1),m({x:0,y:0});const U=U$()?"dark":"default";return uh.initialize({startOnLoad:!1,theme:U,suppressErrorRendering:!0}),uh.render(N.current,t).then(({svg:P})=>{K||(o(P),h(!1))}).catch(P=>{K||(l(P.message||"Mermaid render error"),h(!1))}),()=>{K=!0}},[e,t]);const E=K=>{const U=K[0].clientX-K[1].clientX,P=K[0].clientY-K[1].clientY;return Math.sqrt(U*U+P*P)},O=B.useCallback(K=>{K.preventDefault();const U=K.deltaY>0?-.1:.1;g(P=>Math.min(Math.max(P+U,.5),5))},[]),I=B.useCallback(K=>{d<=1||(x(!0),C.current={x:K.clientX,y:K.clientY,posX:p.x,posY:p.y})},[d,p]),$=B.useCallback(K=>{if(!y)return;const U=K.clientX-C.current.x,P=K.clientY-C.current.y;m({x:C.current.posX+U,y:C.current.posY+P})},[y]),j=B.useCallback(()=>{x(!1)},[]),ie=B.useCallback(()=>{g(1),m({x:0,y:0})},[]),J=B.useCallback(K=>{if(K.touches.length===2){K.preventDefault();const U=E(K.touches);_({x:0,y:0,distance:U})}else K.touches.length===1&&d>1&&(x(!0),M.current={x:K.touches[0].clientX,y:K.touches[0].clientY})},[d]),G=B.useCallback(K=>{if(K.touches.length===2&&v){K.preventDefault();const U=E(K.touches),P=(U-v.distance)/200;g(z=>Math.min(Math.max(z+P,.5),5)),_({x:0,y:0,distance:U})}else if(K.touches.length===1&&y&&M.current){const U=K.touches[0].clientX-M.current.x,P=K.touches[0].clientY-M.current.y;m(z=>({x:z.x+U,y:z.y+P})),M.current={x:K.touches[0].clientX,y:K.touches[0].clientY}}},[v,y]),H=B.useCallback(K=>{K.touches.length<2&&_(null),K.touches.length===0&&(x(!1),M.current=null)},[]),V=B.useCallback(()=>{g(K=>Math.min(K+.25,5))},[]),Q=B.useCallback(()=>{g(K=>Math.max(K-.25,.5))},[]),F=B.useCallback(()=>{g(1),m({x:0,y:0})},[]);return T.jsx(Rf,{open:e,onOpenChange:r,children:T.jsxs(If,{children:[T.jsx(bc,{className:"fixed inset-0 z-50 bg-black/80 animate-fade-in"}),T.jsxs(xc,{className:"mermaid-fullscreen-dialog",style:{position:"fixed",left:0,top:0,right:0,bottom:0,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",transform:"none",borderRadius:0,margin:0,padding:0,zIndex:51},children:[T.jsx(ph,{className:"sr-only",children:"Mermaid 图表全屏预览"}),T.jsxs("div",{className:"mermaid-fullscreen-header",children:[T.jsx("div",{className:"mermaid-fullscreen-controls",children:T.jsxs(Dt,{variant:"ghost",size:"sm",onClick:()=>i(!n),className:"gap-2",children:[n?T.jsx(HC,{className:"size-4"}):T.jsx(jC,{className:"size-4"}),n?"隐藏源码":"显示源码"]})}),T.jsxs(Pf,{className:"rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[T.jsx(qu,{className:"size-4"}),T.jsx("span",{className:"sr-only",children:"关闭"})]})]}),T.jsxs("div",{className:"mermaid-fullscreen-body",children:[T.jsxs("div",{ref:L,className:"mermaid-fullscreen-content",style:{cursor:d>1?y?"grabbing":"grab":"default",width:"100%",height:"100%",touchAction:"none"},onWheel:O,onMouseDown:I,onMouseMove:$,onMouseUp:j,onMouseLeave:j,onDoubleClick:ie,onTouchStart:J,onTouchMove:G,onTouchEnd:H,children:[T.jsx("div",{style:{transform:`translate(${p.x}px, ${p.y}px) scale(${d})`,transformOrigin:"center center",transition:y?"none":"transform 0.1s ease-out",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:T.jsx(cxe,{svgContent:s,error:a,isLoading:c})}),T.jsxs("div",{className:"mermaid-fullscreen-zoom-controls",children:[T.jsx("button",{onClick:V,title:"放大",children:T.jsx(j7,{className:"size-4"})}),T.jsx("button",{onClick:Q,title:"缩小",children:T.jsx(W7,{className:"size-4"})}),T.jsx("button",{onClick:F,title:"重置",children:T.jsx(O7,{className:"size-4"})})]})]}),n&&T.jsx("div",{className:"mermaid-fullscreen-source-panel",children:T.jsx(Cb,{className:"h-full",children:T.jsx("pre",{className:"mermaid-fullscreen-source-code",children:t})})})]})]})]})})}const V$=()=>document.documentElement.classList.contains("dark");uh.initialize({startOnLoad:!1,theme:V$()?"dark":"default",suppressErrorRendering:!0});const hxe=mse(pse);function dxe({node:t,updateAttributes:e,selected:r}){const n=t.attrs.language==="mermaid",[i,s]=B.useState(""),[o,a]=B.useState(""),[l,c]=B.useState(!1),[h,d]=B.useState(0),g=B.useMemo(()=>`mermaid-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[]),p=t.textContent;return B.useEffect(()=>{const m=()=>{d(y=>y+1)};return window.addEventListener("theme-change",m),()=>window.removeEventListener("theme-change",m)},[]),B.useEffect(()=>{if(!n){s(""),a("");return}if(!p){s(""),a("");return}let m=!1;return(()=>{const x=V$()?"dark":"default";uh.initialize({startOnLoad:!1,theme:x,suppressErrorRendering:!0})})(),uh.render(g,p).then(({svg:x})=>{m||(s(x),a(""))}).catch(x=>{m||(a(x.message||"Mermaid render error"),s(""))}),()=>{m=!0}},[n,p,g,h]),T.jsxs(_X,{className:`code-block-wrapper ${r?"selected":""}`,children:[T.jsxs("div",{className:"code-block-header",children:[T.jsxs("select",{contentEditable:!1,value:t.attrs.language||"",onChange:m=>e({language:m.target.value}),children:[T.jsx("option",{value:"",children:"Plain Text"}),T.jsx("option",{value:"mermaid",children:"Mermaid"}),T.jsx("option",{value:"javascript",children:"JavaScript"}),T.jsx("option",{value:"typescript",children:"TypeScript"}),T.jsx("option",{value:"html",children:"HTML"}),T.jsx("option",{value:"css",children:"CSS"}),T.jsx("option",{value:"python",children:"Python"}),T.jsx("option",{value:"java",children:"Java"}),T.jsx("option",{value:"cpp",children:"C++"}),T.jsx("option",{value:"go",children:"Go"}),T.jsx("option",{value:"rust",children:"Rust"}),T.jsx("option",{value:"json",children:"JSON"}),T.jsx("option",{value:"markdown",children:"Markdown"}),T.jsx("option",{value:"bash",children:"Bash"})]}),n&&T.jsx("button",{className:"mermaid-fullscreen-btn",contentEditable:!1,onClick:()=>c(!0),title:"全屏预览",children:T.jsx(v7,{className:"size-4"})})]}),n?T.jsx("div",{className:"mermaid-preview",contentEditable:!1,children:o?T.jsxs("div",{className:"mermaid-error",children:["Mermaid Error: ",o]}):i?T.jsx("div",{className:"mermaid-svg-container",dangerouslySetInnerHTML:{__html:i}}):T.jsx("div",{className:"mermaid-loading",children:"渲染中..."})}):T.jsx("pre",{className:"code-block",children:T.jsx("code",{children:T.jsx(wX,{})})}),n&&T.jsx(uxe,{source:p,open:l,onOpenChange:m=>c(m)})]})}const fxe=yQ.extend({addNodeView(){return NX(dxe)}}).configure({lowlight:hxe});function pxe({value:t,onChange:e,mode:r,placeholder:n,readOnly:i,path:s,onLinkClick:o}){const a=B.useRef(!1),l=B.useRef(t),c=vX({extensions:[uQ.configure({codeBlock:!1,link:!1,underline:!1}),fxe,bQ.configure({placeholder:n||"在这里输入 Markdown..."}),gre.configure({html:!0,transformPastedText:!0,transformCopiedText:!0}),j6.configure({resizable:!0}),z6,$6,P6,HR,jR.configure({nested:!0}),NR.configure({openOnClick:!1}),Sne,Ane.configure({multicolor:!0}),WR,Gne],content:t,editable:!i&&r==="wysiwyg",onUpdate:({editor:h})=>{if(!a.current)try{const g=h.storage.markdown,p=g&&typeof g.getMarkdown=="function"?g.getMarkdown():h.getText();p!==l.current&&(l.current=p,e(p))}catch(d){console.error("Failed to get markdown:",d);const g=h.getText();g!==l.current&&(l.current=g,e(g))}}});return B.useEffect(()=>{if(!c||a.current)return;let h="";try{const m=c.storage.markdown;h=m&&typeof m.getMarkdown=="function"?m.getMarkdown():c.getText()}catch{h=c.getText()}if(h===t){l.current=t;return}const{from:d,to:g}=c.state.selection;a.current=!0,c.commands.setContent(t),l.current=t,requestAnimationFrame(()=>{a.current=!1;try{const p=c.state.doc.content.size,m=Math.min(d,p),y=Math.min(g,p);m>=0&&y>=0&&c.commands.setTextSelection({from:m,to:y})}catch{c.commands.setTextSelection({from:0,to:0})}})},[c,t]),B.useEffect(()=>{c&&c.setEditable(!i&&r==="wysiwyg")},[c,i,r]),B.useEffect(()=>{if(!s||!o)return;const h=d=>{const p=d.target.closest("a");if(!p)return;const m=document.querySelector(".tiptap-editor");if(!m||!m.contains(p))return;d.preventDefault(),d.stopPropagation();const y=p.getAttribute("href");if(!y||y.startsWith("http://")||y.startsWith("https://")||y.startsWith("mailto:")||y.startsWith("#"))return;const x=s.substring(0,s.lastIndexOf("/"));let C=y;if(y.startsWith("./"))C=x+y.slice(1);else if(y.startsWith("../")){let v=x,_=y.slice(3);for(;_.startsWith("../");){const M=v.lastIndexOf("/");if(M<=0)break;v=v.substring(0,M),_=_.slice(3)}_.startsWith("../")?C=y:C=v+"/"+_}else y.startsWith("/")||(C=x+"/"+y);C=decodeURIComponent(C),o(C)};return document.addEventListener("click",h,!0),()=>document.removeEventListener("click",h,!0)},[s,o]),r==="source"?T.jsx("textarea",{className:"editor-textarea",value:t,onChange:h=>e(h.target.value),placeholder:n||"在这里输入 Markdown...",readOnly:i,spellCheck:!1}):T.jsx("div",{className:"tiptap-editor-wrapper",children:T.jsx(fR,{editor:c,className:"tiptap-editor"})})}const gxe=B.memo(function({visible:e,onClose:r,onCreate:n,currentDir:i}){const[s,o]=B.useState(""),[a,l]=B.useState(!1);B.useEffect(()=>{e&&o("")},[e]);const c=()=>{s.trim()&&(n(s.trim(),a,i),o(""),r())},h=p=>{p||r()},d=p=>{p.key==="Enter"&&c()},g=i?i.split("/").filter(Boolean).join(" / "):"根目录";return T.jsx(m2,{open:e,onOpenChange:h,children:T.jsxs(Sy,{side:"bottom",className:"rounded-t-2xl",noClose:!0,children:[T.jsxs(Ey,{className:"text-left",children:[T.jsx(Ty,{children:"新建"}),T.jsxs(y2,{children:["位置: ",g]})]}),T.jsxs("div",{className:"space-y-4 mt-4",children:[T.jsxs("div",{className:"flex gap-2",children:[T.jsxs(Dt,{variant:a?"outline":"default",onClick:()=>l(!1),className:"flex-1 h-11",children:[T.jsx(Fo,{className:"size-4 mr-2"}),"Markdown"]}),T.jsxs(Dt,{variant:a?"default":"outline",onClick:()=>l(!0),className:"flex-1 h-11",children:[T.jsx(Li,{className:"size-4 mr-2"}),"文件夹"]})]}),T.jsx(fh,{placeholder:a?"文件夹名称":"文件名称 (自动添加 .md)",value:s,onChange:p=>o(p.target.value),onKeyDown:d,className:"h-11",autoFocus:!0}),T.jsxs("div",{className:"flex gap-2 justify-end pt-2",children:[T.jsx(Dt,{variant:"outline",onClick:r,children:"取消"}),T.jsx(Dt,{onClick:c,children:"创建"})]})]})]})})});function mxe({open:t,onOpenChange:e,files:r,onSelect:n}){const[i,s]=B.useState(""),[o,a]=B.useState([]),[l,c]=B.useState(0),[h,d]=B.useState(!1),g=B.useRef(null),{buildIndex:p,search:m,isIndexing:y}=TL(),x=B.useRef(!1);B.useEffect(()=>{d(window.innerWidth<768)},[]),B.useEffect(()=>{t&&!x.current?(p(r),x.current=!0):t&&x.current&&p(r)},[t,r,p]),B.useEffect(()=>{t?setTimeout(()=>{var _;return(_=g.current)==null?void 0:_.focus()},100):(s(""),a([]),c(0))},[t]),B.useEffect(()=>{if(!i.trim()){a([]),c(0);return}const _=setTimeout(()=>{const M=m(i);a(M),c(0)},150);return()=>clearTimeout(_)},[i,m]);const C=B.useCallback(_=>{n(_),e(!1)},[n,e]),v=B.useCallback(_=>{_.key==="ArrowDown"?(_.preventDefault(),c(M=>Math.min(M+1,o.length-1))):_.key==="ArrowUp"?(_.preventDefault(),c(M=>Math.max(M-1,0))):_.key==="Enter"&&o.length>0?(_.preventDefault(),C(o[l].path)):_.key==="Escape"&&e(!1)},[o,l,C,e]);return B.useEffect(()=>{const _=M=>{M.key==="Escape"&&t&&e(!1)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[t,e]),t?T.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-sm",children:[T.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[h&&T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>e(!1),children:T.jsx(n7,{className:"size-5"})}),T.jsxs("div",{className:"relative flex-1",children:[T.jsx(Cu,{className:"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),T.jsx(fh,{ref:g,type:"text",placeholder:"搜索文件或内容...",value:i,onChange:_=>s(_.target.value),onKeyDown:v,className:"pl-9 pr-20"}),!i&&T.jsx("span",{className:"absolute right-10 top-1/2 -translate-y-1/2 text-xs text-muted-foreground pointer-events-none",children:"⌘K"}),i&&T.jsx("button",{onClick:()=>s(""),className:"absolute right-3 top-1/2 -translate-y-1/2",children:T.jsx(qu,{className:"size-4 text-muted-foreground hover:text-foreground"})})]}),T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>e(!1),children:T.jsx(qu,{className:"size-5"})})]}),T.jsxs("div",{className:"flex-1 overflow-y-auto",children:[y&&T.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[T.jsx(C7,{className:"size-5 mr-2 animate-spin"}),T.jsx("span",{className:"text-sm",children:"正在建立索引..."})]}),!y&&i&&o.length===0&&T.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[T.jsx(Cu,{className:"size-10 mb-3 opacity-50"}),T.jsx("span",{className:"text-sm",children:"未找到相关结果"})]}),!y&&!i&&T.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[T.jsx(Cu,{className:"size-10 mb-3 opacity-50"}),T.jsx("span",{className:"text-sm",children:"输入关键词搜索文件名或内容"})]}),o.length>0&&T.jsx("div",{className:"py-2",children:o.map((_,M)=>T.jsxs("button",{onClick:()=>C(_.path),className:We("w-full px-4 py-3 flex items-start gap-3 text-left hover:bg-accent transition-colors",M===l&&"bg-accent"),children:[T.jsx(Fo,{className:"size-5 mt-0.5 text-muted-foreground shrink-0"}),T.jsxs("div",{className:"flex-1 min-w-0",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("span",{className:"font-medium truncate",children:_.name}),_.source==="name"&&T.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary",children:"文件名"})]}),_.matchedContent&&T.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:_.matchedContent}),T.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:_.path})]})]},_.path))})]}),o.length>0&&T.jsxs("div",{className:"px-4 py-2 border-t border-border text-xs text-muted-foreground flex items-center justify-between",children:[T.jsxs("span",{children:[o.length," 个结果"]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("span",{className:"px-1.5 py-0.5 rounded bg-accent",children:"↑↓"}),T.jsx("span",{children:"选择"}),T.jsx("span",{className:"px-1.5 py-0.5 rounded bg-accent",children:"Enter"}),T.jsx("span",{children:"打开"})]})]})]}):null}const kb=Rf,yxe=If,G$=B.forwardRef(({className:t,...e},r)=>T.jsx(bc,{ref:r,className:We("fixed inset-0 z-50 bg-black/80 animate-fade-in",t),...e}));G$.displayName=bc.displayName;const sp=B.forwardRef(({className:t,children:e,...r},n)=>T.jsxs(yxe,{children:[T.jsx(G$,{}),T.jsxs(xc,{ref:n,className:We("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 animate-zoom-in rounded-lg max-h-[calc(100vh-2rem)] overflow-y-auto",t),...r,children:[e,T.jsxs(Pf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[T.jsx(qu,{className:"size-4"}),T.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));sp.displayName=xc.displayName;const op=({className:t,...e})=>T.jsx("div",{className:We("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});op.displayName="DialogHeader";const vb=({className:t,...e})=>T.jsx("div",{className:We("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});vb.displayName="DialogFooter";const ap=B.forwardRef(({className:t,...e},r)=>T.jsx(ph,{ref:r,className:We("text-lg font-semibold leading-none tracking-tight",t),...e}));ap.displayName=ph.displayName;const lp=B.forwardRef(({className:t,...e},r)=>T.jsx(Ff,{ref:r,className:We("text-sm text-muted-foreground",t),...e}));lp.displayName=Ff.displayName;function bxe({open:t,onOpenChange:e,item:r,onRename:n}){const[i,s]=B.useState("");B.useEffect(()=>{r&&s(r.type==="directory"?r.name:r.name.replace(/\.md$/,""))},[r]);const o=()=>{r&&i.trim()&&(n(r.path,i.trim()),e(!1))};return r?T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[400px]",children:[T.jsxs(op,{children:[T.jsx(ap,{children:"重命名"}),T.jsxs(lp,{children:["输入新的名称来重命名「",r.name,"」"]})]}),T.jsxs("div",{className:"flex items-center gap-2 py-2",children:[r.type==="directory"?T.jsx(Li,{className:"size-5 shrink-0 text-muted-foreground"}):T.jsx(pL,{className:"size-5 shrink-0 text-muted-foreground"}),T.jsx(fh,{value:i,onChange:a=>s(a.target.value),onKeyDown:a=>{a.key==="Enter"&&o()},autoFocus:!0})]}),T.jsxs(vb,{children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:o,disabled:!i.trim(),children:"确定"})]})]})}):null}function K$({node:t,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o}){if(t.type!=="directory")return null;const a=n.has(t.path),l=e===t.path,c=t.path===s||s.startsWith(t.path+"/"),h=t.children&&t.children.length>0;return T.jsxs("div",{className:"select-none",children:[T.jsxs("div",{className:We("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",l&&"bg-accent",c&&"opacity-50 pointer-events-none"),onClick:()=>!c&&r(t.path),children:[T.jsx("button",{onClick:d=>{d.stopPropagation(),h&&!c&&i(t.path)},className:We("size-5 flex items-center justify-center rounded hover:bg-black/10 dark:hover:bg-white/10",(!h||c)&&"invisible"),children:T.jsx(Zv,{className:We("size-3.5 transition-transform",a&&"rotate-90")})}),a?T.jsx(gL,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm truncate flex-1",children:t.name}),l&&T.jsx("span",{className:"text-xs text-muted-foreground",children:"移动到这里"})]}),a&&h&&T.jsx("div",{className:"ml-4",children:t.children.map(d=>T.jsx(K$,{node:d,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o},d.path))})]})}function xxe({open:t,onOpenChange:e,item:r,groups:n,onMove:i}){const[s,o]=B.useState(""),[a,l]=B.useState(null),[c,h]=B.useState(null),[d,g]=B.useState(new Set);B.useEffect(()=>{var v;if(r&&t){const _=r.path.substring(0,r.path.lastIndexOf("/"));o(_||"/");const M=n.find(N=>N.files.some(E=>E.path===r.path)),L=(M==null?void 0:M.root.path)||((v=n[0])==null?void 0:v.root.path)||null;l(L),h(L)}},[r,t,n]);const p=v=>{g(_=>{const M=new Set(_);return M.has(v)?M.delete(v):M.add(v),M})},m=()=>{if(r&&s!==null&&a!==null&&c!==null){const v=r.path.split("/").pop()||"",_=s==="/"?`/${v}`:`${s}/${v}`;(_!==r.path||c!==a)&&i(r.path,_,c,a),e(!1)}};if(!r)return null;const y=n.find(v=>v.root.path===a),x=(y==null?void 0:y.files)||[],C=s?s==="/"?"根目录":s.split("/").filter(Boolean).join(" / "):"";return T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[480px] max-h-[80vh] flex flex-col",children:[T.jsxs(op,{children:[T.jsx(ap,{children:"移动到"}),T.jsxs(lp,{children:["选择要将「",r.name,"」移动到的目标位置"]})]}),T.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-muted-foreground",children:[T.jsx(Fo,{className:"size-4 shrink-0"}),T.jsx("span",{className:"truncate",children:r.name})]}),n.length>1&&T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"目标根目录"}),T.jsx("select",{value:a||"",onChange:v=>{l(v.target.value),o("/"),g(new Set)},className:"w-full px-3 py-2 text-sm border rounded-md bg-background",children:n.map(v=>T.jsx("option",{value:v.root.path,children:v.root.path.split("/").pop()||v.root.path},v.root.path))})]}),T.jsx(Cb,{className:"flex-1 max-h-[300px] border rounded-md p-2",children:T.jsxs("div",{className:"space-y-0.5",children:[T.jsxs("div",{className:We("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",s==="/"&&"bg-accent"),onClick:()=>o("/"),children:[T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm",children:"根目录"}),s==="/"&&T.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"移动到这里"})]}),x.map(v=>T.jsx(K$,{node:v,selectedPath:s,onSelect:o,expandedPaths:d,onToggleExpand:p,currentItemPath:r.path,rootPath:a||""},v.path))]})}),T.jsxs("div",{className:"text-xs text-muted-foreground py-2",children:["目标位置: ",T.jsx("span",{className:"font-medium text-foreground",children:C})]}),T.jsxs(vb,{children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:m,disabled:s===null,children:"移动"})]})]})})}function Y$({node:t,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o}){if(t.type!=="directory")return null;const a=n.has(t.path),l=e===t.path,c=t.path===s||s.startsWith(t.path+"/"),h=t.children&&t.children.length>0;return T.jsxs("div",{className:"select-none",children:[T.jsxs("div",{className:We("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",l&&"bg-accent",c&&"opacity-50 pointer-events-none"),onClick:()=>!c&&r(t.path),children:[T.jsx("button",{onClick:d=>{d.stopPropagation(),h&&!c&&i(t.path)},className:We("size-5 flex items-center justify-center rounded hover:bg-black/10 dark:hover:bg-white/10",(!h||c)&&"invisible"),children:T.jsx(Zv,{className:We("size-3.5 transition-transform",a&&"rotate-90")})}),a?T.jsx(gL,{className:"size-4 shrink-0 text-muted-foreground"}):T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm truncate flex-1",children:t.name}),l&&T.jsx("span",{className:"text-xs text-muted-foreground",children:"复制到这里"})]}),a&&h&&T.jsx("div",{className:"ml-4",children:t.children.map(d=>T.jsx(Y$,{node:d,selectedPath:e,onSelect:r,expandedPaths:n,onToggleExpand:i,currentItemPath:s,rootPath:o},d.path))})]})}function Cxe({open:t,onOpenChange:e,item:r,groups:n,onCopy:i}){const[s,o]=B.useState(""),[a,l]=B.useState(null),[c,h]=B.useState(null),[d,g]=B.useState(new Set);B.useEffect(()=>{var v;if(r&&t){const _=r.path.substring(0,r.path.lastIndexOf("/"));o(_||"/");const M=(E,O)=>E.some(I=>I.path===O?!0:I.children&&I.children.length>0?M(I.children,O):!1),L=n.find(E=>M(E.files,r.path)),N=(L==null?void 0:L.root.path)||((v=n[0])==null?void 0:v.root.path)||null;l(N),h(N)}},[r,t,n]);const p=v=>{g(_=>{const M=new Set(_);return M.has(v)?M.delete(v):M.add(v),M})},m=()=>{if(r&&s!==null&&a!==null&&c!==null){const v=r.path.split("/").pop()||"",_=s==="/"?`/${v}`:`${s}/${v}`;i(r.path,_,c,a),e(!1)}};if(!r)return null;const y=n.find(v=>v.root.path===a),x=(y==null?void 0:y.files)||[],C=s?s==="/"?"根目录":s.split("/").filter(Boolean).join(" / "):"";return T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[480px] max-h-[80vh] flex flex-col",children:[T.jsxs(op,{children:[T.jsx(ap,{children:"复制到"}),T.jsxs(lp,{children:["选择要将「",r.name,"」复制到的目标位置"]})]}),T.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-muted-foreground",children:[T.jsx(Fo,{className:"size-4 shrink-0"}),T.jsx("span",{className:"truncate",children:r.name})]}),n.length>1&&T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"目标根目录"}),T.jsx("select",{value:a||"",onChange:v=>{l(v.target.value),o("/"),g(new Set)},className:"w-full px-3 py-2 text-sm border rounded-md bg-background",children:n.map(v=>T.jsx("option",{value:v.root.path,children:v.root.path.split("/").pop()||v.root.path},v.root.path))})]}),T.jsx(Cb,{className:"flex-1 max-h-[300px] border rounded-md p-2",children:T.jsxs("div",{className:"space-y-0.5",children:[T.jsxs("div",{className:We("flex items-center gap-1 py-1.5 px-2 rounded-md cursor-pointer hover:bg-accent",s==="/"&&"bg-accent"),onClick:()=>o("/"),children:[T.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground"}),T.jsx("span",{className:"text-sm",children:"根目录"}),s==="/"&&T.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"复制到这里"})]}),x.map(v=>T.jsx(Y$,{node:v,selectedPath:s,onSelect:o,expandedPaths:d,onToggleExpand:p,currentItemPath:r.path,rootPath:a||""},v.path))]})}),T.jsxs("div",{className:"text-xs text-muted-foreground py-2",children:["目标位置: ",T.jsx("span",{className:"font-medium text-foreground",children:C})]}),T.jsxs(vb,{children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:m,disabled:s===null,children:"复制"})]})]})})}const Vv=B.forwardRef(({className:t,checked:e,onCheckedChange:r,onClick:n,...i},s)=>{const o=a=>{n==null||n(a),r&&r(!e)};return T.jsx("button",{type:"button",role:"switch","aria-checked":e,"data-state":e?"checked":"unchecked",ref:s,onClick:o,className:We("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...i,children:T.jsx("span",{"data-state":e?"checked":"unchecked",className:We("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});Vv.displayName="Switch";var lL=1,kxe=.9,vxe=.8,wxe=.17,FC=.1,PC=.999,_xe=.9999,Sxe=.99,Exe=/[\\\/_+.#"@\[\(\{&]/,Txe=/[\\\/_+.#"@\[\(\{&]/g,Axe=/[\s-]/,X$=/[\s-]/g;function Gv(t,e,r,n,i,s,o){if(s===e.length)return i===t.length?lL:Sxe;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=n.charAt(s),c=r.indexOf(l,i),h=0,d,g,p,m;c>=0;)d=Gv(t,e,r,n,c+1,s+1,o),d>h&&(c===i?d*=lL:Exe.test(t.charAt(c-1))?(d*=vxe,p=t.slice(i,c-1).match(Txe),p&&i>0&&(d*=Math.pow(PC,p.length))):Axe.test(t.charAt(c-1))?(d*=kxe,m=t.slice(i,c-1).match(X$),m&&i>0&&(d*=Math.pow(PC,m.length))):(d*=wxe,i>0&&(d*=Math.pow(PC,c-i))),t.charAt(c)!==e.charAt(s)&&(d*=_xe)),(d<FC&&r.charAt(c-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(c-1)!==n.charAt(s))&&(g=Gv(t,e,r,n,c+1,s+2,o),g*FC>d&&(d=g*FC)),d>h&&(h=d),c=r.indexOf(l,c+1);return o[a]=h,h}function cL(t){return t.toLowerCase().replace(X$," ")}function Mxe(t,e,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,Gv(t,e,cL(t),cL(e),0,0,{})}var Nxe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],al=Nxe.reduce((t,e)=>{const r=UL(`Primitive.${e}`),n=B.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),vd='[cmdk-group=""]',$C='[cmdk-group-items=""]',Lxe='[cmdk-group-heading=""]',Z$='[cmdk-item=""]',uL=`${Z$}:not([aria-disabled="true"])`,Kv="cmdk-item-select",mu="data-value",Bxe=(t,e,r)=>Mxe(t,e,r),Q$=B.createContext(void 0),cp=()=>B.useContext(Q$),J$=B.createContext(void 0),N_=()=>B.useContext(J$),e9=B.createContext(void 0),t9=B.forwardRef((t,e)=>{let r=yu(()=>{var z,oe;return{search:"",value:(oe=(z=t.value)!=null?z:t.defaultValue)!=null?oe:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=yu(()=>new Set),i=yu(()=>new Map),s=yu(()=>new Map),o=yu(()=>new Set),a=r9(t),{label:l,children:c,value:h,onValueChange:d,filter:g,shouldFilter:p,loop:m,disablePointerSelection:y=!1,vimBindings:x=!0,...C}=t,v=Vs(),_=Vs(),M=Vs(),L=B.useRef(null),N=Wxe();gc(()=>{if(h!==void 0){let z=h.trim();r.current.value=z,E.emit()}},[h]),gc(()=>{N(6,J)},[]);let E=B.useMemo(()=>({subscribe:z=>(o.current.add(z),()=>o.current.delete(z)),snapshot:()=>r.current,setState:(z,oe,re)=>{var ee,fe,Se,Me;if(!Object.is(r.current[z],oe)){if(r.current[z]=oe,z==="search")ie(),$(),N(1,j);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ee=document.getElementById(M);Ee?Ee.focus():(ee=document.getElementById(v))==null||ee.focus()}if(N(7,()=>{var Ee;r.current.selectedItemId=(Ee=G())==null?void 0:Ee.id,E.emit()}),re||N(5,J),((fe=a.current)==null?void 0:fe.value)!==void 0){let Ee=oe??"";(Me=(Se=a.current).onValueChange)==null||Me.call(Se,Ee);return}}E.emit()}},emit:()=>{o.current.forEach(z=>z())}}),[]),O=B.useMemo(()=>({value:(z,oe,re)=>{var ee;oe!==((ee=s.current.get(z))==null?void 0:ee.value)&&(s.current.set(z,{value:oe,keywords:re}),r.current.filtered.items.set(z,I(oe,re)),N(2,()=>{$(),E.emit()}))},item:(z,oe)=>(n.current.add(z),oe&&(i.current.has(oe)?i.current.get(oe).add(z):i.current.set(oe,new Set([z]))),N(3,()=>{ie(),$(),r.current.value||j(),E.emit()}),()=>{s.current.delete(z),n.current.delete(z),r.current.filtered.items.delete(z);let re=G();N(4,()=>{ie(),(re==null?void 0:re.getAttribute("id"))===z&&j(),E.emit()})}),group:z=>(i.current.has(z)||i.current.set(z,new Set),()=>{s.current.delete(z),i.current.delete(z)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:v,inputId:M,labelId:_,listInnerRef:L}),[]);function I(z,oe){var re,ee;let fe=(ee=(re=a.current)==null?void 0:re.filter)!=null?ee:Bxe;return z?fe(z,r.current.search,oe):0}function $(){if(!r.current.search||a.current.shouldFilter===!1)return;let z=r.current.filtered.items,oe=[];r.current.filtered.groups.forEach(ee=>{let fe=i.current.get(ee),Se=0;fe.forEach(Me=>{let Ee=z.get(Me);Se=Math.max(Ee,Se)}),oe.push([ee,Se])});let re=L.current;H().sort((ee,fe)=>{var Se,Me;let Ee=ee.getAttribute("id"),xe=fe.getAttribute("id");return((Se=z.get(xe))!=null?Se:0)-((Me=z.get(Ee))!=null?Me:0)}).forEach(ee=>{let fe=ee.closest($C);fe?fe.appendChild(ee.parentElement===fe?ee:ee.closest(`${$C} > *`)):re.appendChild(ee.parentElement===re?ee:ee.closest(`${$C} > *`))}),oe.sort((ee,fe)=>fe[1]-ee[1]).forEach(ee=>{var fe;let Se=(fe=L.current)==null?void 0:fe.querySelector(`${vd}[${mu}="${encodeURIComponent(ee[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function j(){let z=H().find(re=>re.getAttribute("aria-disabled")!=="true"),oe=z==null?void 0:z.getAttribute(mu);E.setState("value",oe||void 0)}function ie(){var z,oe,re,ee;if(!r.current.search||a.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let fe=0;for(let Se of n.current){let Me=(oe=(z=s.current.get(Se))==null?void 0:z.value)!=null?oe:"",Ee=(ee=(re=s.current.get(Se))==null?void 0:re.keywords)!=null?ee:[],xe=I(Me,Ee);r.current.filtered.items.set(Se,xe),xe>0&&fe++}for(let[Se,Me]of i.current)for(let Ee of Me)if(r.current.filtered.items.get(Ee)>0){r.current.filtered.groups.add(Se);break}r.current.filtered.count=fe}function J(){var z,oe,re;let ee=G();ee&&(((z=ee.parentElement)==null?void 0:z.firstChild)===ee&&((re=(oe=ee.closest(vd))==null?void 0:oe.querySelector(Lxe))==null||re.scrollIntoView({block:"nearest"})),ee.scrollIntoView({block:"nearest"}))}function G(){var z;return(z=L.current)==null?void 0:z.querySelector(`${Z$}[aria-selected="true"]`)}function H(){var z;return Array.from(((z=L.current)==null?void 0:z.querySelectorAll(uL))||[])}function V(z){let oe=H()[z];oe&&E.setState("value",oe.getAttribute(mu))}function Q(z){var oe;let re=G(),ee=H(),fe=ee.findIndex(Me=>Me===re),Se=ee[fe+z];(oe=a.current)!=null&&oe.loop&&(Se=fe+z<0?ee[ee.length-1]:fe+z===ee.length?ee[0]:ee[fe+z]),Se&&E.setState("value",Se.getAttribute(mu))}function F(z){let oe=G(),re=oe==null?void 0:oe.closest(vd),ee;for(;re&&!ee;)re=z>0?jxe(re,vd):Hxe(re,vd),ee=re==null?void 0:re.querySelector(uL);ee?E.setState("value",ee.getAttribute(mu)):Q(z)}let K=()=>V(H().length-1),U=z=>{z.preventDefault(),z.metaKey?K():z.altKey?F(1):Q(1)},P=z=>{z.preventDefault(),z.metaKey?V(0):z.altKey?F(-1):Q(-1)};return B.createElement(al.div,{ref:e,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:z=>{var oe;(oe=C.onKeyDown)==null||oe.call(C,z);let re=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||re))switch(z.key){case"n":case"j":{x&&z.ctrlKey&&U(z);break}case"ArrowDown":{U(z);break}case"p":case"k":{x&&z.ctrlKey&&P(z);break}case"ArrowUp":{P(z);break}case"Home":{z.preventDefault(),V(0);break}case"End":{z.preventDefault(),K();break}case"Enter":{z.preventDefault();let ee=G();if(ee){let fe=new Event(Kv);ee.dispatchEvent(fe)}}}}},B.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:Uxe},l),wb(t,z=>B.createElement(J$.Provider,{value:E},B.createElement(Q$.Provider,{value:O},z))))}),Oxe=B.forwardRef((t,e)=>{var r,n;let i=Vs(),s=B.useRef(null),o=B.useContext(e9),a=cp(),l=r9(t),c=(n=(r=l.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;gc(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let h=n9(i,s,[t.value,t.children,s],t.keywords),d=N_(),g=Qa(N=>N.value&&N.value===h.current),p=Qa(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);B.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(Kv,m),()=>N.removeEventListener(Kv,m)},[p,t.onSelect,t.disabled]);function m(){var N,E;y(),(E=(N=l.current).onSelect)==null||E.call(N,h.current)}function y(){d.setState("value",h.current,!0)}if(!p)return null;let{disabled:x,value:C,onSelect:v,forceMount:_,keywords:M,...L}=t;return B.createElement(al.div,{ref:Wa(s,e),...L,id:i,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!g,"data-disabled":!!x,"data-selected":!!g,onPointerMove:x||a.getDisablePointerSelection()?void 0:y,onClick:x?void 0:m},t.children)}),Dxe=B.forwardRef((t,e)=>{let{heading:r,children:n,forceMount:i,...s}=t,o=Vs(),a=B.useRef(null),l=B.useRef(null),c=Vs(),h=cp(),d=Qa(p=>i||h.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);gc(()=>h.group(o),[]),n9(o,a,[t.value,t.heading,l]);let g=B.useMemo(()=>({id:o,forceMount:i}),[i]);return B.createElement(al.div,{ref:Wa(a,e),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},r&&B.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),wb(t,p=>B.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},B.createElement(e9.Provider,{value:g},p))))}),Rxe=B.forwardRef((t,e)=>{let{alwaysRender:r,...n}=t,i=B.useRef(null),s=Qa(o=>!o.search);return!r&&!s?null:B.createElement(al.div,{ref:Wa(i,e),...n,"cmdk-separator":"",role:"separator"})}),Ixe=B.forwardRef((t,e)=>{let{onValueChange:r,...n}=t,i=t.value!=null,s=N_(),o=Qa(c=>c.search),a=Qa(c=>c.selectedItemId),l=cp();return B.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),B.createElement(al.input,{ref:e,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),r==null||r(c.target.value)}})}),Fxe=B.forwardRef((t,e)=>{let{children:r,label:n="Suggestions",...i}=t,s=B.useRef(null),o=B.useRef(null),a=Qa(c=>c.selectedItemId),l=cp();return B.useEffect(()=>{if(o.current&&s.current){let c=o.current,h=s.current,d,g=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let p=c.offsetHeight;h.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(d),g.unobserve(c)}}},[]),B.createElement(al.div,{ref:Wa(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":n,id:l.listId},wb(t,c=>B.createElement("div",{ref:Wa(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),Pxe=B.forwardRef((t,e)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:s,container:o,...a}=t;return B.createElement(Rf,{open:r,onOpenChange:n},B.createElement(If,{container:o},B.createElement(bc,{"cmdk-overlay":"",className:i}),B.createElement(xc,{"aria-label":t.label,"cmdk-dialog":"",className:s},B.createElement(t9,{ref:e,...a}))))}),$xe=B.forwardRef((t,e)=>Qa(r=>r.filtered.count===0)?B.createElement(al.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),zxe=B.forwardRef((t,e)=>{let{progress:r,children:n,label:i="Loading...",...s}=t;return B.createElement(al.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},wb(t,o=>B.createElement("div",{"aria-hidden":!0},o)))}),pi=Object.assign(t9,{List:Fxe,Item:Oxe,Input:Ixe,Group:Dxe,Separator:Rxe,Dialog:Pxe,Empty:$xe,Loading:zxe});function jxe(t,e){let r=t.nextElementSibling;for(;r;){if(r.matches(e))return r;r=r.nextElementSibling}}function Hxe(t,e){let r=t.previousElementSibling;for(;r;){if(r.matches(e))return r;r=r.previousElementSibling}}function r9(t){let e=B.useRef(t);return gc(()=>{e.current=t}),e}var gc=typeof window>"u"?B.useEffect:B.useLayoutEffect;function yu(t){let e=B.useRef();return e.current===void 0&&(e.current=t()),e}function Qa(t){let e=N_(),r=()=>t(e.snapshot());return B.useSyncExternalStore(e.subscribe,r,r)}function n9(t,e,r,n=[]){let i=B.useRef(),s=cp();return gc(()=>{var o;let a=(()=>{var c;for(let h of r){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(c=h.current.textContent)==null?void 0:c.trim():i.current}})(),l=n.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(mu,a),i.current=a}),i}var Wxe=()=>{let[t,e]=B.useState(),r=yu(()=>new Map);return gc(()=>{r.current.forEach(n=>n()),r.current=new Map},[t]),(n,i)=>{r.current.set(n,i),e({})}};function qxe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function wb({asChild:t,children:e},r){return t&&B.isValidElement(e)?B.cloneElement(qxe(e),{ref:e.ref},r(e.props.children)):r(e)}var Uxe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const i9=B.forwardRef(({className:t,...e},r)=>T.jsx(pi,{ref:r,className:We("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));i9.displayName=pi.displayName;const s9=B.forwardRef(({className:t,...e},r)=>T.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[T.jsx(Cu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),T.jsx(pi.Input,{ref:r,className:We("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));s9.displayName=pi.Input.displayName;const o9=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.List,{ref:r,className:We("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));o9.displayName=pi.List.displayName;const Yv=B.forwardRef((t,e)=>T.jsx(pi.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Yv.displayName=pi.Empty.displayName;const Vxe=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.Group,{ref:r,className:We("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Vxe.displayName=pi.Group.displayName;const Gxe=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.Separator,{ref:r,className:We("-mx-1 h-px bg-border",t),...e}));Gxe.displayName=pi.Separator.displayName;const a9=B.forwardRef(({className:t,...e},r)=>T.jsx(pi.Item,{ref:r,className:We("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...e}));a9.displayName=pi.Item.displayName;const Kxe=B.memo(function({value:e,onChange:r,placeholder:n="输入路径...",disabled:i=!1,className:s}){const[o,a]=B.useState(!1),[l,c]=B.useState(e),[h,d]=B.useState([]),[g,p]=B.useState(-1),[m,y]=B.useState(!1),[x,C]=B.useState(()=>typeof window>"u"?!1:window.innerWidth<768),v=B.useRef(null),_=B.useRef(null),M=B.useRef(null);B.useEffect(()=>{const I=()=>C(window.innerWidth<768);return I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]),B.useEffect(()=>{c(e)},[e]);const L=B.useCallback(async I=>{if(!I.trim()){d([]),a(!1);return}y(!0);try{const $=await fetch(`/api/files/roots/search?q=${encodeURIComponent(I)}`);if(!$.ok)throw new Error("Search failed");const j=await $.json();d(j.matches.map(ie=>({path:ie}))),a(!0),p(-1)}catch($){console.error("Failed to search paths:",$),d([])}finally{y(!1)}},[]);B.useEffect(()=>(_.current&&clearTimeout(_.current),_.current=window.setTimeout(()=>{L(l)},150),()=>{_.current&&clearTimeout(_.current)}),[l,L]);const N=B.useCallback(I=>{if(!(!o||h.length===0))switch(I.key){case"ArrowDown":I.preventDefault(),p($=>$<h.length-1?$+1:$);break;case"ArrowUp":I.preventDefault(),p($=>$>0?$-1:$);break;case"Enter":if(I.preventDefault(),g>=0&&g<h.length){const $=h[g].path;r($),c($),a(!1),p(-1)}break;case"Escape":I.preventDefault(),a(!1),p(-1);break}},[o,h,g,r]),E=B.useCallback(I=>{r(I),c(I),a(!1),p(-1)},[r]),O=B.useCallback(I=>{c(I),r(I)},[r]);return B.useEffect(()=>{const I=$=>{M.current&&!M.current.contains($.target)&&(a(!1),p(-1))};if(o)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[o]),T.jsx("div",{ref:M,className:We("relative",s),children:T.jsxs(i9,{className:We("rounded-lg border shadow-md",x&&"w-full"),onKeyDown:N,children:[T.jsx(s9,{ref:v,value:l,placeholder:n,disabled:i,onValueChange:O,className:We(x&&"h-12 text-base")}),o&&T.jsx(o9,{className:We("absolute top-full left-0 right-0 z-50 mt-1 bg-popover border rounded-md shadow-lg",x&&"max-h-[200px]"),children:m?T.jsx(Yv,{children:"搜索中..."}):h.length===0?T.jsx(Yv,{children:"未找到匹配路径"}):h.map((I,$)=>T.jsx(a9,{value:I.path,onSelect:()=>E(I.path),className:We("cursor-pointer",$===g&&"bg-accent"),children:T.jsx("span",{className:We("truncate",x&&"text-sm"),children:I.path})},I.path))})]})})});function Yxe({open:t,onOpenChange:e}){const[r,n]=B.useState({showHiddenFiles:!1,allowedExtensions:".md,.markdown,.mdown,.mkdn,.mkd,.mdwn,.mkdown,.ron",themeMode:"system",ignore:{enableIgnoreFiles:!0,ignoreFileNames:".colonynoteignore, .gitignore",patterns:""}}),[i,s]=B.useState({roots:[],newRootPath:"",loading:!1,error:null}),[o,a]=B.useState(!1),[l,c]=B.useState(null),[h,d]=B.useState([]),[g,p]=B.useState(()=>typeof window>"u"?!1:window.innerWidth<768),m=()=>{const N=localStorage.getItem("colonynote-theme");return N==="light"||N==="dark"||N==="system"?N:"system"},y=N=>{localStorage.setItem("colonynote-theme",N),N==="system"?(localStorage.removeItem("colonynote-theme"),window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")):N==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),window.dispatchEvent(new CustomEvent("theme-change"))},x=()=>{const N=m();n(E=>({...E,themeMode:N}))};B.useEffect(()=>{const N=()=>p(window.innerWidth<768);return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),B.useEffect(()=>{x()},[t]),B.useEffect(()=>{t&&(fetch("/api/files/config").then(N=>N.json()).then(N=>{var E,O,I;n({showHiddenFiles:N.showHiddenFiles??!1,allowedExtensions:(N.allowedExtensions||[]).join(","),themeMode:m(),ignore:{enableIgnoreFiles:((E=N.ignore)==null?void 0:E.enableIgnoreFiles)??!0,ignoreFileNames:(((O=N.ignore)==null?void 0:O.ignoreFileNames)||[".colonynoteignore",".gitignore"]).join(", "),patterns:(((I=N.ignore)==null?void 0:I.patterns)||[]).join(`
775
775
  `)}}),c(null)}).catch(()=>{c("Failed to load settings")}),fetch("/api/files/roots").then(N=>N.json()).then(N=>{s(E=>({...E,roots:N.roots||[],error:null}))}).catch(()=>{s(N=>({...N,error:"Failed to load roots"}))}),fetch("/api/files").then(N=>N.json()).then(N=>{if(N.groups){const E=N.groups.filter(O=>O.error).map(O=>({path:O.root.path,error:O.error}));d(E)}}).catch(()=>{}))},[t]);const C=B.useCallback(async()=>{a(!0),c(null);try{const N=r.allowedExtensions.split(",").map($=>$.trim()).filter($=>$.startsWith(".")),E=r.ignore.ignoreFileNames.split(",").map($=>$.trim()).filter(Boolean),O=r.ignore.patterns.split(`
776
776
  `).map($=>$.trim()).filter(Boolean);if(!(await fetch("/api/files/config",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({showHiddenFiles:r.showHiddenFiles,allowedExtensions:N,ignore:{enableIgnoreFiles:r.ignore.enableIgnoreFiles,ignoreFileNames:E,patterns:O}})})).ok)throw new Error("Failed to save settings");e(!1),window.dispatchEvent(new CustomEvent("config-changed"))}catch{c("Failed to save settings")}finally{a(!1)}},[r,e]),v=B.useCallback(async()=>{if(i.newRootPath.trim()){s(N=>({...N,loading:!0,error:null}));try{const N=await fetch("/api/files/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i.newRootPath})}),E=await N.json();if(!N.ok)throw new Error(E.error||"Failed to add root");s(O=>({...O,roots:[...O.roots,E.root],newRootPath:"",loading:!1})),window.dispatchEvent(new CustomEvent("config-changed"))}catch(N){const E=N instanceof Error?N.message:"Failed to add root";s(O=>({...O,loading:!1,error:E}))}}},[i.newRootPath]),_=B.useCallback(async N=>{s(E=>({...E,loading:!0,error:null}));try{const E=await fetch(`/api/files/roots?path=${encodeURIComponent(N)}`,{method:"DELETE"});if(!E.ok){const O=await E.json();throw new Error(O.error||"Failed to remove root")}s(O=>({...O,roots:O.roots.filter(I=>I.path!==N),loading:!1})),window.dispatchEvent(new CustomEvent("config-changed"))}catch(E){const O=E instanceof Error?E.message:"Failed to remove root";s(I=>({...I,loading:!1,error:O}))}},[]),M=B.useCallback(async N=>{s(E=>({...E,loading:!0,error:null}));try{const O=await(await fetch("/api/files")).json();if(O.groups){const I=O.groups.filter(j=>j.error).map(j=>({path:j.root.path,error:j.error}));d(I);const $=I.find(j=>j.path===N);$?s(j=>({...j,loading:!1,error:`Still inaccessible: ${$.error}`})):(s(j=>({...j,loading:!1})),window.dispatchEvent(new CustomEvent("config-changed")))}}catch(E){const O=E instanceof Error?E.message:"Failed to retry";s(I=>({...I,loading:!1,error:O}))}},[]),L=T.jsxs(T.Fragment,{children:[T.jsxs("div",{className:"grid gap-6 py-4",children:[T.jsxs("div",{className:"space-y-3",children:[T.jsx("div",{className:"text-sm font-medium leading-none",children:"主题"}),T.jsxs("div",{className:"flex rounded-lg border border-border overflow-hidden",children:[T.jsxs("button",{type:"button",onClick:()=>{y("light"),n(N=>({...N,themeMode:"light"}))},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm transition-colors ${r.themeMode==="light"?"bg-primary text-primary-foreground":"bg-background hover:bg-accent hover:text-accent-foreground"}`,children:[T.jsx(F7,{className:"size-4"}),"浅色"]}),T.jsxs("button",{type:"button",onClick:()=>{y("dark"),n(N=>({...N,themeMode:"dark"}))},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm transition-colors ${r.themeMode==="dark"?"bg-primary text-primary-foreground":"bg-background hover:bg-accent hover:text-accent-foreground"}`,children:[T.jsx(E7,{className:"size-4"}),"深色"]}),T.jsxs("button",{type:"button",onClick:()=>{y("system"),n(N=>({...N,themeMode:"system"}))},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm transition-colors ${r.themeMode==="system"?"bg-primary text-primary-foreground":"bg-background hover:bg-accent hover:text-accent-foreground"}`,children:[T.jsx(_7,{className:"size-4"}),"跟随系统"]})]})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"space-y-0.5",children:[T.jsx("label",{htmlFor:"show-hidden",className:"text-sm font-medium leading-none",children:"显示隐藏文件"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"显示以 . 开头的文件和文件夹"})]}),T.jsx(Vv,{id:"show-hidden",checked:r.showHiddenFiles,onCheckedChange:N=>n(E=>({...E,showHiddenFiles:N}))})]}),T.jsxs("div",{className:"space-y-2",children:[T.jsx("label",{htmlFor:"extensions",className:"text-sm font-medium leading-none",children:"文件扩展名"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"允许的文件扩展名,用逗号分隔"}),T.jsx("textarea",{id:"extensions",value:r.allowedExtensions,onChange:N=>n(E=>({...E,allowedExtensions:N.target.value})),placeholder:".md,.markdown,.mdown,.mkdn,.mkd,.mdwn,.mkdown,.ron",rows:3,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-4",children:[T.jsx("div",{className:"text-sm font-medium",children:"忽略设置"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"space-y-0.5",children:[T.jsx("label",{htmlFor:"enable-ignore",className:"text-sm font-medium leading-none",children:"启用忽略文件"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"自动加载 .colonynoteignore 和 .gitignore"})]}),T.jsx(Vv,{id:"enable-ignore",checked:r.ignore.enableIgnoreFiles,onCheckedChange:N=>n(E=>({...E,ignore:{...E.ignore,enableIgnoreFiles:N}}))})]}),T.jsxs("div",{className:"space-y-2",children:[T.jsx("label",{htmlFor:"ignore-names",className:"text-sm font-medium leading-none",children:"忽略文件名"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"要查找的忽略文件名称,用逗号分隔"}),T.jsx("input",{id:"ignore-names",value:r.ignore.ignoreFileNames,onChange:N=>n(E=>({...E,ignore:{...E.ignore,ignoreFileNames:N.target.value}})),placeholder:".colonynoteignore, .gitignore",className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})]}),T.jsxs("div",{className:"space-y-2",children:[T.jsx("label",{htmlFor:"ignore-patterns",className:"text-sm font-medium leading-none",children:"全局忽略模式"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"每行一个模式,支持 glob 语法(如 node_modules/, *.log)"}),T.jsx("textarea",{id:"ignore-patterns",value:r.ignore.patterns,onChange:N=>n(E=>({...E,ignore:{...E.ignore,patterns:N.target.value}})),placeholder:`node_modules/
777
777
  dist/
778
- *.log`,rows:4,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-4",children:[T.jsx("div",{className:"text-sm font-medium",children:"文档根目录管理"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"添加或删除文档根目录。修改后页面将刷新。"}),i.roots.length>0&&T.jsxs("div",{className:"space-y-2",children:[T.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"当前根目录"}),T.jsx("div",{className:"space-y-1",children:i.roots.map(N=>{const E=h.find(O=>O.path===N.path);return T.jsxs("div",{className:Ue("flex items-center justify-between gap-2 p-2 rounded-md border bg-background",E?"border-destructive/50 bg-destructive/5":"border-border"),children:[T.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[E?T.jsx(zC,{className:"size-4 text-destructive shrink-0"}):T.jsx(Li,{className:"size-4 text-muted-foreground shrink-0"}),T.jsxs("div",{className:"flex flex-col min-w-0",children:[T.jsx("span",{className:Ue("text-sm truncate max-w-[180px] md:max-w-[260px]",E&&"text-destructive"),title:N.path,children:N.path}),E&&T.jsx("span",{className:"text-xs text-destructive truncate max-w-[180px] md:max-w-[260px]",children:E.error})]})]}),T.jsxs("div",{className:"flex gap-1 shrink-0",children:[E&&T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>M(N.path),disabled:i.loading,title:"重试",children:T.jsx(L7,{className:Ue("size-4",i.loading&&"animate-spin")})}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>_(N.path),disabled:i.loading,title:"删除",children:T.jsx(mL,{className:"size-4 text-destructive"})})]})]},N.path)})})]}),T.jsxs("div",{className:"space-y-2",children:[T.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"添加新根目录"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx(Kxe,{value:i.newRootPath,onChange:N=>s(E=>({...E,newRootPath:N,error:null})),placeholder:"输入或搜索路径...",disabled:i.loading,className:"flex-1"}),T.jsx(Dt,{onClick:v,disabled:i.loading||!i.newRootPath.trim(),size:"icon",className:"size-10",children:T.jsx(WC,{className:"size-4"})})]})]}),i.error&&T.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md border border-destructive/50 bg-destructive/10",children:[T.jsx(zC,{className:"size-4 text-destructive shrink-0"}),T.jsx("p",{className:"text-sm text-destructive",children:i.error})]})]}),l&&T.jsx("p",{className:"text-sm text-destructive",children:l})]}),T.jsxs("div",{className:"flex justify-end gap-2",children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:C,disabled:o,children:o?"保存中...":"保存"})]})]});return g?T.jsx(m2,{open:t,onOpenChange:e,children:T.jsxs(Sy,{side:"bottom",className:"h-[85vh] flex flex-col",children:[T.jsxs(Ey,{className:"flex-shrink-0",children:[T.jsxs(Ty,{className:"flex items-center gap-2",children:[T.jsx(qC,{className:"size-5"}),"设置"]}),T.jsx(y2,{children:"配置编辑器显示选项。修改后页面将刷新。"})]}),T.jsx("div",{className:"flex-1 overflow-y-auto",children:L})]})}):T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[425px]",children:[T.jsxs(op,{children:[T.jsxs(ap,{className:"flex items-center gap-2",children:[T.jsx(qC,{className:"size-5"}),"设置"]}),T.jsx(lp,{children:"配置编辑器显示选项。修改后页面将刷新。"})]}),L]})})}const hL=B.memo(function({groups:e,activePath:r,activeRoot:n,currentDir:i,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x,onSettingsOpen:C,onClose:v,onRootChange:_}){const M=e.find(N=>N.root.path===n),L=(M==null?void 0:M.files)||[];return T.jsxs("div",{className:"flex flex-col h-full",children:[T.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[v&&T.jsx(Dt,{variant:"ghost",size:"icon",onClick:v,title:"关闭",className:"md:hidden",children:T.jsx(qu,{className:"size-4"})}),T.jsx("img",{src:"/logo.png",alt:"logo",className:"size-8 shrink-0"}),T.jsx("span",{className:"font-semibold text-sm",children:"ColonyNote"})]}),T.jsx("div",{className:"flex gap-1",children:T.jsx(Dt,{variant:"ghost",size:"icon",onClick:C,title:"设置",children:T.jsx(qC,{className:"size-4"})})})]}),e.length>1&&T.jsx("div",{className:"flex gap-1 px-4 py-2 border-b border-border shrink-0 overflow-x-auto scrollbar-hide",children:e.map(N=>T.jsxs(Dt,{variant:n===N.root.path?"default":"ghost",size:"sm",onClick:()=>_==null?void 0:_(N.root.path),className:Ue("whitespace-nowrap relative group",N.error&&"border-destructive text-destructive hover:text-destructive"),title:N.error||N.root.path,children:[N.error&&T.jsx(zC,{className:"size-3 mr-1 text-destructive shrink-0"}),T.jsx("span",{className:"truncate max-w-[100px] md:max-w-[150px] min-w-0 flex-shrink-0",children:N.root.path.split("/").pop()||N.root.path}),T.jsx("span",{className:"hidden md:block absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-popover text-popover-foreground text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-50",children:N.error?`${N.root.path} (${N.error})`:N.root.path})]},N.root.path))}),T.jsx(fq,{files:L,activePath:r,activeRoot:n,currentDir:i,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x})]})});function Xxe(){const[t,e]=B.useState([]),[r,n]=B.useState(null),[i,s]=B.useState(!1),[o,a]=B.useState(!1),[l,c]=B.useState(!1),[h,d]=B.useState(!1),[g,p]=B.useState(!1),[m,y]=B.useState(!1),[x,C]=B.useState(null),[v,_]=B.useState(null),[M,L]=B.useState(null),[N,E]=B.useState(()=>typeof window>"u"?!1:window.innerWidth<768),[O,I]=B.useState("wysiwyg"),[$,j]=B.useState(""),[ie,J]=B.useState(new Set),G=B.useRef(new Map),[H,V]=B.useState(null),[Q,F]=B.useState(!1),[K,U]=B.useState(null),[P,z]=B.useState(!1),[oe,re]=B.useState(!1),[ee,fe]=B.useState(()=>{if(typeof window>"u")return 260;const de=localStorage.getItem("sidebar-width");return de?parseInt(de,10):260}),Se=B.useRef(!1),Me=B.useRef(!1),Ee=B.useRef(null),xe=B.useRef(new Map),$e=B.useRef(new Map),xt=5e3,{content:Ct,path:Je,status:Ot,load:pt,updateContent:sn,save:cr,setPath:On,setContent:bn}=U7({onSaveStart:(de,we)=>{re(!0);const Le=xe.current.get(de)||new Set;Le.add(we),xe.current.set(de,Le),$e.current.set(de,Date.now())},onSave:de=>{re(!1);const we=de||Je;we&&setTimeout(()=>{if(xe.current.get(we)){const it=Date.now()-xt,q=$e.current.get(we);q&&q<it&&(xe.current.delete(we),$e.current.delete(we))}},xt)},onError:(de,we)=>{re(!1);const Le=we||Je;Le&&(xe.current.delete(Le),$e.current.delete(Le)),console.error(de)}}),{updateIndex:Kn,removeFromIndex:es}=TL();B.useEffect(()=>{const de=()=>E(window.innerWidth<768);return de(),window.addEventListener("resize",de),()=>window.removeEventListener("resize",de)},[]),B.useEffect(()=>{const de=we=>{(we.metaKey||we.ctrlKey)&&we.key==="k"&&(we.preventDefault(),c(!0))};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[]),B.useEffect(()=>{if(!Je)return;const de=Je.split("/").filter(Boolean),we=[];for(let Le=0;Le<de.length-1;Le++)we.push("/"+de.slice(0,Le+1).join("/"));we.length>0&&J(Le=>{const tt=new Set(Le);return we.forEach(it=>tt.add(it)),tt})},[Je]);const ur=B.useCallback(async()=>{var de;if(!Me.current){Me.current=!0;try{const Le=await(await fetch("/api/files/")).json();if(e(Le.groups||[]),!r&&((de=Le.groups)==null?void 0:de.length)>0){const tt=decodeURIComponent(window.location.hash.slice(1)),it=tt.indexOf(":"),q=it>0?tt.substring(0,it):null;if(q){const le=Le.groups.some(he=>he.root.path===q);n(le?q:Le.groups[0].root.path)}else n(Le.groups[0].root.path)}}catch(we){console.error("Failed to fetch files:",we)}finally{Me.current=!1}}},[r]);B.useEffect(()=>{ur()},[ur]),B.useEffect(()=>{const de=async()=>{var we,Le,tt,it;try{const le=await(await fetch("/api/files/")).json();e(le.groups||[]),!((we=le.groups)==null?void 0:we.some(ze=>ze.root.path===r))&&r?(On(null),bn(""),window.location.hash="",n(((tt=(Le=le.groups)==null?void 0:Le[0])==null?void 0:tt.root.path)||null)):!r&&((it=le.groups)==null?void 0:it.length)>0&&n(le.groups[0].root.path)}catch(q){console.error("Failed to fetch files on config change:",q)}};return window.addEventListener("config-changed",de),()=>window.removeEventListener("config-changed",de)},[r]),q7(B.useCallback(de=>{if(de.type==="file:change"){const we=de.path,Le=de.rootPath;if(!we||Le&&r&&Le!==r)return;const tt=xe.current.get(we),it=$e.current.get(we),q=Date.now();if(tt&&tt.size>0||it&&q-it<xt)return;Je&&we===Je&&(U(we),F(!0)),de.event==="unlink"?es(we):fetch(`/api/files/content?paths=${encodeURIComponent(we)}`).then(le=>le.json()).then(le=>{if(le.files&&le.files[0]){const he=le.files[0];Kn(he.path,he.name,he.content)}}).catch(console.error),ur()}},[ur,Je,Kn,es,r]));const $r=B.useCallback((de,we,Le)=>{if(we==="file"){const tt=de.split("/").filter(Boolean),it=[];for(let he=0;he<tt.length-1;he++)it.push("/"+tt.slice(0,he+1).join("/"));it.length>0&&J(he=>{const ze=new Set(he);return it.forEach(Pt=>ze.add(Pt)),ze});const q=Le||r;pt(de,q||void 0),window.location.hash=q?`${q}:${de}`:de;const le=de.substring(0,de.lastIndexOf("/"));j(le),s(!1)}else j(de)},[pt,r]),Yn=B.useCallback(de=>{j(de)},[]),zr=B.useCallback(de=>{if(V(de),$){const we=$.split("/").filter(Boolean),Le=new Set;for(let tt=0;tt<we.length;tt++)Le.add("/"+we.slice(0,tt+1).join("/"));J(tt=>{const it=new Set(tt);return Le.forEach(q=>it.add(q)),it})}},[$]),xr=B.useCallback(async(de,we)=>{try{const Le=we?de:`${de}.md`;await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"create",parentPath:$,name:Le,isDirectory:we,root:r})}),V(null),ur()}catch(Le){console.error("Failed to create:",Le)}},[r,$,ur]),Xn=B.useCallback((de,we)=>{V(de?"directory":"file"),j(we);const Le=we.split("/").filter(Boolean),tt=new Set;for(let it=0;it<Le.length;it++)tt.add("/"+Le.slice(0,it+1).join("/"));J(it=>{const q=new Set(it);return tt.forEach(le=>q.add(le)),q})},[]);B.useEffect(()=>{const de=()=>{const we=decodeURIComponent(window.location.hash.slice(1));if(we&&Ee.current!==we){Ee.current=we;const Le=we.indexOf(":");let tt,it;Le>0?(tt=we.substring(0,Le),it=we.substring(Le+1)):it=we,pt(it,tt),tt&&n(tt);const q=it.substring(0,it.lastIndexOf("/"));j(q);const le=[];let he=it;for(;he.includes("/");)he=he.substring(0,he.lastIndexOf("/")),he&&le.push(he);J(ze=>{const Pt=new Set(ze);return le.forEach(Ut=>Pt.add(Ut)),Pt})}};return de(),window.addEventListener("hashchange",de),()=>window.removeEventListener("hashchange",de)},[pt]);const Ts=B.useCallback(async de=>{try{const we=r?`/api/files${de}?root=${encodeURIComponent(r)}`:`/api/files${de}`;await fetch(we,{method:"DELETE"}),Je&&(Je===de||Je.startsWith(de+"/"))&&(Ee.current=null,window.location.hash="",On(null),bn(""),F(!1),U(null)),ur()}catch(we){console.error("Failed to delete:",we)}},[ur,Je,r]),Di=B.useCallback(async(de,we)=>{try{const Le=de.substring(0,de.lastIndexOf("/")),tt=de.split("/").pop()||"",it=de,q=!tt.includes("."),le=q?we:`${we}.md`,he=Le?`${Le}/${le}`:`/${le}`;if(await fetch("/api/files",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:it,newPath:he,isDirectory:q,sourceRoot:r,targetRoot:r})}),Je&&(Je===de||Je.startsWith(de+"/"))){const ze=Je.replace(de,he);Ee.current=null,window.location.hash=ze,pt(ze),j(Le||"")}ur()}catch(Le){console.error("Failed to rename:",Le)}},[Je,pt,ur]),gi=B.useCallback(async(de,we,Le,tt)=>{try{const it=de.split("/").pop()||"",q=de.substring(0,de.lastIndexOf("/")),le=!it.includes(".");if(await fetch("/api/files",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:de,newPath:we,isDirectory:le,sourceRoot:Le,targetRoot:tt})}),Je&&(Je===de||Je.startsWith(de+"/"))){const he=Je.replace(de,we);Ee.current=null,window.location.hash=he,pt(he),j(we.substring(0,we.lastIndexOf("/")))}ur()}catch(it){console.error("Failed to move:",it)}},[Je,pt,ur]),Go=B.useCallback(async(de,we,Le,tt)=>{try{await fetch("/api/files/copy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourcePath:de,targetPath:we,sourceRoot:Le,targetRoot:tt})}),ur()}catch(it){console.error("Failed to copy:",it)}},[ur]),ts=B.useCallback(async(de,we,Le)=>{try{const tt=we?de:`${de}.md`;await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"create",parentPath:Le,name:tt,isDirectory:we,root:r})}),ur()}catch(tt){console.error("Failed to create:",tt)}},[r,ur]);B.useCallback(()=>{Je&&Ct&&cr(Ct,Je,r??void 0)},[cr,Ct,Je,r]);const mi=B.useCallback(()=>{I(de=>de==="wysiwyg"?"source":"wysiwyg")},[]),xn=B.useCallback(de=>{r&&G.current.set(r,new Set(ie)),n(de);const we=G.current.get(de);J(we??new Set),j("")},[r,ie]),Zn=B.useCallback(de=>{de.preventDefault(),Se.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);B.useEffect(()=>{const de=Le=>{if(!Se.current)return;const tt=Math.max(200,Math.min(600,Le.clientX));fe(tt)},we=()=>{Se.current&&(Se.current=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("sidebar-width",ee.toString()))};return window.addEventListener("mousemove",de),window.addEventListener("mouseup",we),()=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",we)}},[ee]);const Dn=Je?Je.split("/").pop():null,yi=t.flatMap(de=>de.files);return B.useEffect(()=>{document.title=Dn?`${Dn} - ColonyNote`:"ColonyNote"},[Dn]),T.jsxs("div",{className:"flex flex-col h-full",children:[N&&T.jsxs("header",{className:"flex items-center px-4 py-3 border-b border-border bg-background md:hidden",children:[T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>s(!0),className:"size-11 min-h-11 min-w-11",children:T.jsx(b7,{className:"size-5"})}),T.jsx("div",{className:"flex-1 text-base font-semibold text-center truncate mx-4",children:Dn||"ColonyNote"}),T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>c(!0),className:"size-11 min-h-11 min-w-11",children:T.jsx(Cu,{className:"size-5"})}),T.jsx(Dt,{variant:"ghost",size:"icon",onClick:mi,title:O==="wysiwyg"?"源码模式":"所见即所得",className:"size-11 min-h-11 min-w-11",children:O==="wysiwyg"?T.jsx(jC,{className:"size-5"}):T.jsx(HC,{className:"size-5"})})]}),T.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[N&&T.jsxs(T.Fragment,{children:[i&&T.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 animate-fade-in",onClick:()=>s(!1)}),T.jsx("aside",{className:Ue("fixed z-50 inset-0 w-full bg-sidebar p-0 transition-transform duration-150",i?"translate-x-0":"-translate-x-full"),children:T.jsx(hL,{groups:t,activePath:Je,activeRoot:r,currentDir:$,expandedPaths:ie,setExpandedPaths:J,onSelect:$r,onDelete:Ts,onRenameRequest:de=>{C(de),d(!0)},onMoveRequest:de=>{_(de),p(!0)},onCopyRequest:de=>{L(de),y(!0)},onExpand:Yn,editingType:H,onEditingChange:zr,onCreateSubmit:xr,onCreateRequest:Xn,onSettingsOpen:()=>z(!0),onClose:()=>s(!1),onRootChange:xn})})]}),!N&&T.jsxs("div",{className:"hidden md:flex shrink-0",children:[T.jsx("aside",{style:{width:ee},className:"flex flex-col border-r border-border bg-sidebar",children:T.jsx(hL,{groups:t,activePath:Je,activeRoot:r,currentDir:$,expandedPaths:ie,setExpandedPaths:J,onSelect:$r,onDelete:Ts,onRenameRequest:de=>{C(de),d(!0)},onMoveRequest:de=>{_(de),p(!0)},onCopyRequest:de=>{L(de),y(!0)},onExpand:Yn,editingType:H,onEditingChange:zr,onCreateSubmit:xr,onCreateRequest:Xn,onSettingsOpen:()=>z(!0),onRootChange:xn})}),T.jsx("div",{onMouseDown:Zn,className:"w-4 -ml-2 cursor-col-resize flex items-center justify-center group z-10",title:"拖动调整侧边栏宽度",children:T.jsx("div",{className:"w-1 h-8 rounded-full bg-border group-hover:bg-primary/50 transition-colors"})})]}),T.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden",children:[!N&&Je&&T.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border text-xs text-muted-foreground",children:[T.jsx("span",{children:Dn}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("span",{className:Ue("px-2 py-0.5 rounded text-xs",Ot==="saving"&&"text-yellow-600 bg-yellow-50 dark:text-yellow-400 dark:bg-yellow-950",Ot==="saved"&&"text-green-600 bg-green-50 dark:text-green-400 dark:bg-green-950",Ot==="error"&&"text-red-600 bg-red-50 dark:text-red-400 dark:bg-red-950"),children:Ot==="saving"?"保存中...":Ot==="saved"?"已保存":Ot==="error"?"保存失败":""}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>c(!0),title:"搜索",children:T.jsx(Cu,{className:"size-4"})}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:mi,title:O==="wysiwyg"?"源码模式":"所见即所得",children:O==="wysiwyg"?T.jsx(jC,{className:"size-4"}):T.jsx(HC,{className:"size-4"})})]})]}),T.jsx("div",{className:"flex flex-1 overflow-hidden",children:Je?T.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[N&&T.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border text-xs text-muted-foreground",children:[T.jsx("span",{children:O==="wysiwyg"?"所见即所得":"源码"}),T.jsx("span",{className:Ue("px-2 py-0.5 rounded text-xs",Ot==="saving"&&"text-yellow-600 bg-yellow-50 dark:text-yellow-400 dark:bg-yellow-950",Ot==="saved"&&"text-green-600 bg-green-50 dark:text-green-400 dark:bg-green-950"),children:Ot==="saving"?"保存中...":Ot==="saved"?"已保存":""})]}),T.jsx("div",{className:"flex-1 overflow-hidden",children:T.jsx(pxe,{value:Ct,onChange:sn,mode:O,path:Je,onLinkClick:de=>$r(de,"file")},`${Je}-${O}`)})]}):T.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground text-sm text-center p-6 flex-1",children:[T.jsx(Fo,{className:"size-12 mb-4 opacity-50"}),T.jsx("div",{children:"选择一个文件开始编辑"})]})})]})]}),T.jsx(gxe,{visible:o,onClose:()=>{a(!1),V(null)},onCreate:ts,currentDir:$}),T.jsx(mxe,{open:l,onOpenChange:c,files:yi,onSelect:de=>$r(de,"file")}),T.jsx(bxe,{open:h,onOpenChange:d,item:x,onRename:(de,we)=>{C(null),d(!1),Di(de,we)}}),T.jsx(xxe,{open:g,onOpenChange:p,item:v,groups:t,onMove:(de,we,Le,tt)=>{_(null),p(!1),gi(de,we,Le,tt)}}),T.jsx(Cxe,{open:m,onOpenChange:y,item:M,groups:t,onCopy:(de,we,Le,tt)=>{L(null),y(!1),Go(de,we,Le,tt)}}),T.jsx(JB,{open:Q,onOpenChange:F,children:T.jsxs(b2,{children:[T.jsxs(x2,{children:[T.jsx(k2,{children:"文件已更新"}),T.jsx(v2,{children:"当前文件已被外部修改。是否刷新内容?"})]}),T.jsxs(C2,{children:[T.jsx(_2,{onClick:()=>{U(null)},children:"忽略"}),T.jsx(w2,{onClick:()=>{K&&pt(K),U(null)},children:"刷新"})]})]})}),T.jsx(Yxe,{open:P,onOpenChange:z})]})}Xz.createRoot(document.getElementById("root")).render(T.jsx(Io.StrictMode,{children:T.jsx(Xxe,{})}));export{AI as $,cCe as A,ja as B,vse as C,br as D,eae as E,o_ as F,yI as G,Ape as H,Oue as I,$he as J,ioe as K,Cf as L,aCe as M,lb as N,Doe as O,EI as P,SM as Q,_ue as R,av as S,Tpe as T,Kf as U,Ss as V,ue as W,ce as X,Hoe as Y,xpe as Z,S as _,Koe as a,hN as a$,Cue as a0,UM as a1,qM as a2,bCe as a3,fCe as a4,mCe as a5,gCe as a6,hCe as a7,Pw as a8,yCe as a9,Hme as aA,jme as aB,Uge as aC,aI as aD,kue as aE,oCe as aF,ab as aG,oy as aH,bF as aI,dh as aJ,rp as aK,Wge as aL,Hge as aM,Dw as aN,Sa as aO,wf as aP,PM as aQ,ece as aR,Gfe as aS,mF as aT,cF as aU,Zde as aV,ny as aW,Qde as aX,ep as aY,Bl as aZ,Hfe as a_,dCe as aa,su as ab,CCe as ac,xCe as ad,pCe as ae,mme as af,M8 as ag,LCe as ah,jhe as ai,Gn as aj,Uo as ak,gd as al,a_ as am,_F as an,dc as ao,AF as ap,yt as aq,Zs as ar,Ve as as,b0e as at,NCe as au,BCe as av,ACe as aw,Xe as ax,MCe as ay,Gme as az,Goe as b,vc as b0,Jde as b1,Jw as b2,Xde as b3,rfe as b4,bh as b5,Vfe as b6,gpe as b7,afe as b8,lpe as b9,oN as bA,e_ as bB,hF as bC,Hv as bD,Qxe as bE,Bt as bF,Zw as ba,rL as bb,Ye as bc,MF as bd,ci as be,Gle as bf,Ow as bg,HI as bh,Zf as bi,UI as bj,uCe as bk,kse as bl,ppe as bm,ape as bn,mpe as bo,nb as bp,Kde as bq,Qw as br,gF as bs,bpe as bt,yh as bu,Jfe as bv,j0e as bw,Jf as bx,sy as by,sl as bz,zt as c,St as d,TI as e,Ur as f,Xoe as g,$o as h,ks as i,qhe as j,Yf as k,ge as l,EF as m,lCe as n,DCe as o,Zoe as p,Qoe as q,OCe as r,Yoe as s,zhe as t,ps as u,Ime as v,Lpe as w,kCe as x,rh as y,Voe as z};
778
+ *.log`,rows:4,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-4",children:[T.jsx("div",{className:"text-sm font-medium",children:"文档根目录管理"}),T.jsx("p",{className:"text-xs text-muted-foreground",children:"添加或删除文档根目录。修改后页面将刷新。"}),i.roots.length>0&&T.jsxs("div",{className:"space-y-2",children:[T.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"当前根目录"}),T.jsx("div",{className:"space-y-1",children:i.roots.map(N=>{const E=h.find(O=>O.path===N.path);return T.jsxs("div",{className:We("flex items-center justify-between gap-2 p-2 rounded-md border bg-background",E?"border-destructive/50 bg-destructive/5":"border-border",N.isCli&&"border-primary/30 bg-primary/5"),children:[T.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[E?T.jsx(zC,{className:"size-4 text-destructive shrink-0"}):T.jsx(Li,{className:We("size-4 shrink-0",N.isCli?"text-primary":"text-muted-foreground")}),T.jsxs("div",{className:"flex flex-col min-w-0",children:[T.jsx("span",{className:We("text-sm truncate max-w-[180px] md:max-w-[260px]",E&&"text-destructive"),title:N.path,children:N.path}),N.isCli&&T.jsx("span",{className:"text-xs text-primary truncate max-w-[180px] md:max-w-[260px]",children:"CLI 启动参数"}),E&&T.jsx("span",{className:"text-xs text-destructive truncate max-w-[180px] md:max-w-[260px]",children:E.error})]})]}),T.jsxs("div",{className:"flex gap-1 shrink-0",children:[E&&T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>M(N.path),disabled:i.loading,title:"重试",children:T.jsx(L7,{className:We("size-4",i.loading&&"animate-spin")})}),!N.isCli&&T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>_(N.path),disabled:i.loading,title:"删除",children:T.jsx(mL,{className:"size-4 text-destructive"})})]})]},N.path)})})]}),T.jsxs("div",{className:"space-y-2",children:[T.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"添加新根目录"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx(Kxe,{value:i.newRootPath,onChange:N=>s(E=>({...E,newRootPath:N,error:null})),placeholder:"输入或搜索路径...",disabled:i.loading,className:"flex-1"}),T.jsx(Dt,{onClick:v,disabled:i.loading||!i.newRootPath.trim(),size:"icon",className:"size-10",children:T.jsx(WC,{className:"size-4"})})]})]}),i.error&&T.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md border border-destructive/50 bg-destructive/10",children:[T.jsx(zC,{className:"size-4 text-destructive shrink-0"}),T.jsx("p",{className:"text-sm text-destructive",children:i.error})]})]}),l&&T.jsx("p",{className:"text-sm text-destructive",children:l})]}),T.jsxs("div",{className:"flex justify-end gap-2",children:[T.jsx(Dt,{variant:"outline",onClick:()=>e(!1),children:"取消"}),T.jsx(Dt,{onClick:C,disabled:o,children:o?"保存中...":"保存"})]})]});return g?T.jsx(m2,{open:t,onOpenChange:e,children:T.jsxs(Sy,{side:"bottom",className:"h-[85vh] flex flex-col",children:[T.jsxs(Ey,{className:"flex-shrink-0",children:[T.jsxs(Ty,{className:"flex items-center gap-2",children:[T.jsx(qC,{className:"size-5"}),"设置"]}),T.jsx(y2,{children:"配置编辑器显示选项。修改后页面将刷新。"})]}),T.jsx("div",{className:"flex-1 overflow-y-auto",children:L})]})}):T.jsx(kb,{open:t,onOpenChange:e,children:T.jsxs(sp,{className:"sm:max-w-[425px]",children:[T.jsxs(op,{children:[T.jsxs(ap,{className:"flex items-center gap-2",children:[T.jsx(qC,{className:"size-5"}),"设置"]}),T.jsx(lp,{children:"配置编辑器显示选项。修改后页面将刷新。"})]}),L]})})}const hL=B.memo(function({groups:e,activePath:r,activeRoot:n,currentDir:i,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x,onSettingsOpen:C,onClose:v,onRootChange:_}){const M=e.find(N=>N.root.path===n),L=(M==null?void 0:M.files)||[];return T.jsxs("div",{className:"flex flex-col h-full",children:[T.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[v&&T.jsx(Dt,{variant:"ghost",size:"icon",onClick:v,title:"关闭",className:"md:hidden",children:T.jsx(qu,{className:"size-4"})}),T.jsx("img",{src:"/logo.png",alt:"logo",className:"size-8 shrink-0"}),T.jsx("span",{className:"font-semibold text-sm",children:"ColonyNote"})]}),T.jsx("div",{className:"flex gap-1",children:T.jsx(Dt,{variant:"ghost",size:"icon",onClick:C,title:"设置",children:T.jsx(qC,{className:"size-4"})})})]}),e.length>1&&T.jsx("div",{className:"flex gap-1 px-4 py-2 border-b border-border shrink-0 overflow-x-auto scrollbar-hide",children:e.map(N=>T.jsxs(Dt,{variant:n===N.root.path?"default":"ghost",size:"sm",onClick:()=>_==null?void 0:_(N.root.path),className:We("whitespace-nowrap relative group",N.error&&"border-destructive text-destructive hover:text-destructive"),title:N.error||N.root.path,children:[N.error&&T.jsx(zC,{className:"size-3 mr-1 text-destructive shrink-0"}),T.jsx("span",{className:"truncate max-w-[100px] md:max-w-[150px] min-w-0 flex-shrink-0",children:N.root.path.split("/").pop()||N.root.path}),T.jsx("span",{className:"hidden md:block absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-popover text-popover-foreground text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-50",children:N.error?`${N.root.path} (${N.error})`:N.root.path})]},N.root.path))}),T.jsx(fq,{files:L,activePath:r,activeRoot:n,currentDir:i,expandedPaths:s,setExpandedPaths:o,onSelect:a,onDelete:l,onRenameRequest:c,onMoveRequest:h,onCopyRequest:d,onExpand:g,editingType:p,onEditingChange:m,onCreateSubmit:y,onCreateRequest:x})]})});function Xxe(){const[t,e]=B.useState([]),[r,n]=B.useState(null),[i,s]=B.useState(!1),[o,a]=B.useState(!1),[l,c]=B.useState(!1),[h,d]=B.useState(!1),[g,p]=B.useState(!1),[m,y]=B.useState(!1),[x,C]=B.useState(null),[v,_]=B.useState(null),[M,L]=B.useState(null),[N,E]=B.useState(()=>typeof window>"u"?!1:window.innerWidth<768),[O,I]=B.useState("wysiwyg"),[$,j]=B.useState(""),[ie,J]=B.useState(new Set),G=B.useRef(new Map),[H,V]=B.useState(null),[Q,F]=B.useState(!1),[K,U]=B.useState(null),[P,z]=B.useState(!1),[oe,re]=B.useState(!1),[ee,fe]=B.useState(()=>{if(typeof window>"u")return 260;const de=localStorage.getItem("sidebar-width");return de?parseInt(de,10):260}),Se=B.useRef(!1),Me=B.useRef(!1),Ee=B.useRef(null),xe=B.useRef(new Map),$e=B.useRef(new Map),xt=5e3,{content:Ct,path:Je,status:Ot,load:pt,updateContent:sn,save:cr,setPath:On,setContent:bn}=U7({onSaveStart:(de,we)=>{re(!0);const Le=xe.current.get(de)||new Set;Le.add(we),xe.current.set(de,Le),$e.current.set(de,Date.now())},onSave:de=>{re(!1);const we=de||Je;we&&setTimeout(()=>{if(xe.current.get(we)){const it=Date.now()-xt,q=$e.current.get(we);q&&q<it&&(xe.current.delete(we),$e.current.delete(we))}},xt)},onError:(de,we)=>{re(!1);const Le=we||Je;Le&&(xe.current.delete(Le),$e.current.delete(Le)),console.error(de)}}),{updateIndex:Kn,removeFromIndex:es}=TL();B.useEffect(()=>{const de=()=>E(window.innerWidth<768);return de(),window.addEventListener("resize",de),()=>window.removeEventListener("resize",de)},[]),B.useEffect(()=>{const de=we=>{(we.metaKey||we.ctrlKey)&&we.key==="k"&&(we.preventDefault(),c(!0))};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[]),B.useEffect(()=>{if(!Je)return;const de=Je.split("/").filter(Boolean),we=[];for(let Le=0;Le<de.length-1;Le++)we.push("/"+de.slice(0,Le+1).join("/"));we.length>0&&J(Le=>{const tt=new Set(Le);return we.forEach(it=>tt.add(it)),tt})},[Je]);const ur=B.useCallback(async()=>{var de;if(!Me.current){Me.current=!0;try{const Le=await(await fetch("/api/files/")).json();if(e(Le.groups||[]),!r&&((de=Le.groups)==null?void 0:de.length)>0){const tt=decodeURIComponent(window.location.hash.slice(1)),it=tt.indexOf(":"),q=it>0?tt.substring(0,it):null;if(q){const le=Le.groups.some(he=>he.root.path===q);n(le?q:Le.groups[0].root.path)}else n(Le.groups[0].root.path)}}catch(we){console.error("Failed to fetch files:",we)}finally{Me.current=!1}}},[r]);B.useEffect(()=>{ur()},[ur]),B.useEffect(()=>{const de=async()=>{var we,Le,tt,it;try{const le=await(await fetch("/api/files/")).json();e(le.groups||[]),!((we=le.groups)==null?void 0:we.some(ze=>ze.root.path===r))&&r?(On(null),bn(""),window.location.hash="",n(((tt=(Le=le.groups)==null?void 0:Le[0])==null?void 0:tt.root.path)||null)):!r&&((it=le.groups)==null?void 0:it.length)>0&&n(le.groups[0].root.path)}catch(q){console.error("Failed to fetch files on config change:",q)}};return window.addEventListener("config-changed",de),()=>window.removeEventListener("config-changed",de)},[r]),q7(B.useCallback(de=>{if(de.type==="file:change"){const we=de.path,Le=de.rootPath;if(!we||Le&&r&&Le!==r)return;const tt=xe.current.get(we),it=$e.current.get(we),q=Date.now();if(tt&&tt.size>0||it&&q-it<xt)return;Je&&we===Je&&(U(we),F(!0)),de.event==="unlink"?es(we):fetch(`/api/files/content?paths=${encodeURIComponent(we)}`).then(le=>le.json()).then(le=>{if(le.files&&le.files[0]){const he=le.files[0];Kn(he.path,he.name,he.content)}}).catch(console.error),ur()}},[ur,Je,Kn,es,r]));const $r=B.useCallback((de,we,Le)=>{if(we==="file"){const tt=de.split("/").filter(Boolean),it=[];for(let he=0;he<tt.length-1;he++)it.push("/"+tt.slice(0,he+1).join("/"));it.length>0&&J(he=>{const ze=new Set(he);return it.forEach(Pt=>ze.add(Pt)),ze});const q=Le||r;pt(de,q||void 0),window.location.hash=q?`${q}:${de}`:de;const le=de.substring(0,de.lastIndexOf("/"));j(le),s(!1)}else j(de)},[pt,r]),Yn=B.useCallback(de=>{j(de)},[]),zr=B.useCallback(de=>{if(V(de),$){const we=$.split("/").filter(Boolean),Le=new Set;for(let tt=0;tt<we.length;tt++)Le.add("/"+we.slice(0,tt+1).join("/"));J(tt=>{const it=new Set(tt);return Le.forEach(q=>it.add(q)),it})}},[$]),xr=B.useCallback(async(de,we)=>{try{const Le=we?de:`${de}.md`;await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"create",parentPath:$,name:Le,isDirectory:we,root:r})}),V(null),ur()}catch(Le){console.error("Failed to create:",Le)}},[r,$,ur]),Xn=B.useCallback((de,we)=>{V(de?"directory":"file"),j(we);const Le=we.split("/").filter(Boolean),tt=new Set;for(let it=0;it<Le.length;it++)tt.add("/"+Le.slice(0,it+1).join("/"));J(it=>{const q=new Set(it);return tt.forEach(le=>q.add(le)),q})},[]);B.useEffect(()=>{const de=()=>{const we=decodeURIComponent(window.location.hash.slice(1));if(we&&Ee.current!==we){Ee.current=we;const Le=we.indexOf(":");let tt,it;Le>0?(tt=we.substring(0,Le),it=we.substring(Le+1)):it=we,pt(it,tt),tt&&n(tt);const q=it.substring(0,it.lastIndexOf("/"));j(q);const le=[];let he=it;for(;he.includes("/");)he=he.substring(0,he.lastIndexOf("/")),he&&le.push(he);J(ze=>{const Pt=new Set(ze);return le.forEach(Ut=>Pt.add(Ut)),Pt})}};return de(),window.addEventListener("hashchange",de),()=>window.removeEventListener("hashchange",de)},[pt]);const Ts=B.useCallback(async de=>{try{const we=r?`/api/files${de}?root=${encodeURIComponent(r)}`:`/api/files${de}`;await fetch(we,{method:"DELETE"}),Je&&(Je===de||Je.startsWith(de+"/"))&&(Ee.current=null,window.location.hash="",On(null),bn(""),F(!1),U(null)),ur()}catch(we){console.error("Failed to delete:",we)}},[ur,Je,r]),Di=B.useCallback(async(de,we)=>{try{const Le=de.substring(0,de.lastIndexOf("/")),tt=de.split("/").pop()||"",it=de,q=!tt.includes("."),le=q?we:`${we}.md`,he=Le?`${Le}/${le}`:`/${le}`;if(await fetch("/api/files",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:it,newPath:he,isDirectory:q,sourceRoot:r,targetRoot:r})}),Je&&(Je===de||Je.startsWith(de+"/"))){const ze=Je.replace(de,he);Ee.current=null,window.location.hash=ze,pt(ze),j(Le||"")}ur()}catch(Le){console.error("Failed to rename:",Le)}},[Je,pt,ur]),gi=B.useCallback(async(de,we,Le,tt)=>{try{const it=de.split("/").pop()||"",q=de.substring(0,de.lastIndexOf("/")),le=!it.includes(".");if(await fetch("/api/files",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:de,newPath:we,isDirectory:le,sourceRoot:Le,targetRoot:tt})}),Je&&(Je===de||Je.startsWith(de+"/"))){const he=Je.replace(de,we);Ee.current=null,window.location.hash=he,pt(he),j(we.substring(0,we.lastIndexOf("/")))}ur()}catch(it){console.error("Failed to move:",it)}},[Je,pt,ur]),Go=B.useCallback(async(de,we,Le,tt)=>{try{await fetch("/api/files/copy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourcePath:de,targetPath:we,sourceRoot:Le,targetRoot:tt})}),ur()}catch(it){console.error("Failed to copy:",it)}},[ur]),ts=B.useCallback(async(de,we,Le)=>{try{const tt=we?de:`${de}.md`;await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"create",parentPath:Le,name:tt,isDirectory:we,root:r})}),ur()}catch(tt){console.error("Failed to create:",tt)}},[r,ur]);B.useCallback(()=>{Je&&Ct&&cr(Ct,Je,r??void 0)},[cr,Ct,Je,r]);const mi=B.useCallback(()=>{I(de=>de==="wysiwyg"?"source":"wysiwyg")},[]),xn=B.useCallback(de=>{r&&G.current.set(r,new Set(ie)),n(de);const we=G.current.get(de);J(we??new Set),j("")},[r,ie]),Zn=B.useCallback(de=>{de.preventDefault(),Se.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);B.useEffect(()=>{const de=Le=>{if(!Se.current)return;const tt=Math.max(200,Math.min(600,Le.clientX));fe(tt)},we=()=>{Se.current&&(Se.current=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("sidebar-width",ee.toString()))};return window.addEventListener("mousemove",de),window.addEventListener("mouseup",we),()=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",we)}},[ee]);const Dn=Je?Je.split("/").pop():null,yi=t.flatMap(de=>de.files);return B.useEffect(()=>{document.title=Dn?`${Dn} - ColonyNote`:"ColonyNote"},[Dn]),T.jsxs("div",{className:"flex flex-col h-full",children:[N&&T.jsxs("header",{className:"flex items-center px-4 py-3 border-b border-border bg-background md:hidden",children:[T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>s(!0),className:"size-11 min-h-11 min-w-11",children:T.jsx(b7,{className:"size-5"})}),T.jsx("div",{className:"flex-1 text-base font-semibold text-center truncate mx-4",children:Dn||"ColonyNote"}),T.jsx(Dt,{variant:"ghost",size:"icon",onClick:()=>c(!0),className:"size-11 min-h-11 min-w-11",children:T.jsx(Cu,{className:"size-5"})}),T.jsx(Dt,{variant:"ghost",size:"icon",onClick:mi,title:O==="wysiwyg"?"源码模式":"所见即所得",className:"size-11 min-h-11 min-w-11",children:O==="wysiwyg"?T.jsx(jC,{className:"size-5"}):T.jsx(HC,{className:"size-5"})})]}),T.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[N&&T.jsxs(T.Fragment,{children:[i&&T.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 animate-fade-in",onClick:()=>s(!1)}),T.jsx("aside",{className:We("fixed z-50 inset-0 w-full bg-sidebar p-0 transition-transform duration-150",i?"translate-x-0":"-translate-x-full"),children:T.jsx(hL,{groups:t,activePath:Je,activeRoot:r,currentDir:$,expandedPaths:ie,setExpandedPaths:J,onSelect:$r,onDelete:Ts,onRenameRequest:de=>{C(de),d(!0)},onMoveRequest:de=>{_(de),p(!0)},onCopyRequest:de=>{L(de),y(!0)},onExpand:Yn,editingType:H,onEditingChange:zr,onCreateSubmit:xr,onCreateRequest:Xn,onSettingsOpen:()=>z(!0),onClose:()=>s(!1),onRootChange:xn})})]}),!N&&T.jsxs("div",{className:"hidden md:flex shrink-0",children:[T.jsx("aside",{style:{width:ee},className:"flex flex-col border-r border-border bg-sidebar",children:T.jsx(hL,{groups:t,activePath:Je,activeRoot:r,currentDir:$,expandedPaths:ie,setExpandedPaths:J,onSelect:$r,onDelete:Ts,onRenameRequest:de=>{C(de),d(!0)},onMoveRequest:de=>{_(de),p(!0)},onCopyRequest:de=>{L(de),y(!0)},onExpand:Yn,editingType:H,onEditingChange:zr,onCreateSubmit:xr,onCreateRequest:Xn,onSettingsOpen:()=>z(!0),onRootChange:xn})}),T.jsx("div",{onMouseDown:Zn,className:"w-4 -ml-2 cursor-col-resize flex items-center justify-center group z-10",title:"拖动调整侧边栏宽度",children:T.jsx("div",{className:"w-1 h-8 rounded-full bg-border group-hover:bg-primary/50 transition-colors"})})]}),T.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden",children:[!N&&Je&&T.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border text-xs text-muted-foreground",children:[T.jsx("span",{children:Dn}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("span",{className:We("px-2 py-0.5 rounded text-xs",Ot==="saving"&&"text-yellow-600 bg-yellow-50 dark:text-yellow-400 dark:bg-yellow-950",Ot==="saved"&&"text-green-600 bg-green-50 dark:text-green-400 dark:bg-green-950",Ot==="error"&&"text-red-600 bg-red-50 dark:text-red-400 dark:bg-red-950"),children:Ot==="saving"?"保存中...":Ot==="saved"?"已保存":Ot==="error"?"保存失败":""}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>c(!0),title:"搜索",children:T.jsx(Cu,{className:"size-4"})}),T.jsx(Dt,{variant:"ghost",size:"icon",className:"size-8",onClick:mi,title:O==="wysiwyg"?"源码模式":"所见即所得",children:O==="wysiwyg"?T.jsx(jC,{className:"size-4"}):T.jsx(HC,{className:"size-4"})})]})]}),T.jsx("div",{className:"flex flex-1 overflow-hidden",children:Je?T.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[N&&T.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border text-xs text-muted-foreground",children:[T.jsx("span",{children:O==="wysiwyg"?"所见即所得":"源码"}),T.jsx("span",{className:We("px-2 py-0.5 rounded text-xs",Ot==="saving"&&"text-yellow-600 bg-yellow-50 dark:text-yellow-400 dark:bg-yellow-950",Ot==="saved"&&"text-green-600 bg-green-50 dark:text-green-400 dark:bg-green-950"),children:Ot==="saving"?"保存中...":Ot==="saved"?"已保存":""})]}),T.jsx("div",{className:"flex-1 overflow-hidden",children:T.jsx(pxe,{value:Ct,onChange:sn,mode:O,path:Je,onLinkClick:de=>$r(de,"file")},`${Je}-${O}`)})]}):T.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground text-sm text-center p-6 flex-1",children:[T.jsx(Fo,{className:"size-12 mb-4 opacity-50"}),T.jsx("div",{children:"选择一个文件开始编辑"})]})})]})]}),T.jsx(gxe,{visible:o,onClose:()=>{a(!1),V(null)},onCreate:ts,currentDir:$}),T.jsx(mxe,{open:l,onOpenChange:c,files:yi,onSelect:de=>$r(de,"file")}),T.jsx(bxe,{open:h,onOpenChange:d,item:x,onRename:(de,we)=>{C(null),d(!1),Di(de,we)}}),T.jsx(xxe,{open:g,onOpenChange:p,item:v,groups:t,onMove:(de,we,Le,tt)=>{_(null),p(!1),gi(de,we,Le,tt)}}),T.jsx(Cxe,{open:m,onOpenChange:y,item:M,groups:t,onCopy:(de,we,Le,tt)=>{L(null),y(!1),Go(de,we,Le,tt)}}),T.jsx(JB,{open:Q,onOpenChange:F,children:T.jsxs(b2,{children:[T.jsxs(x2,{children:[T.jsx(k2,{children:"文件已更新"}),T.jsx(v2,{children:"当前文件已被外部修改。是否刷新内容?"})]}),T.jsxs(C2,{children:[T.jsx(_2,{onClick:()=>{U(null)},children:"忽略"}),T.jsx(w2,{onClick:()=>{K&&pt(K),U(null)},children:"刷新"})]})]})}),T.jsx(Yxe,{open:P,onOpenChange:z})]})}Xz.createRoot(document.getElementById("root")).render(T.jsx(Io.StrictMode,{children:T.jsx(Xxe,{})}));export{AI as $,cCe as A,ja as B,vse as C,br as D,eae as E,o_ as F,yI as G,Ape as H,Oue as I,$he as J,ioe as K,Cf as L,aCe as M,lb as N,Doe as O,EI as P,SM as Q,_ue as R,av as S,Tpe as T,Kf as U,Ss as V,ue as W,ce as X,Hoe as Y,xpe as Z,S as _,Koe as a,hN as a$,Cue as a0,UM as a1,qM as a2,bCe as a3,fCe as a4,mCe as a5,gCe as a6,hCe as a7,Pw as a8,yCe as a9,Hme as aA,jme as aB,Uge as aC,aI as aD,kue as aE,oCe as aF,ab as aG,oy as aH,bF as aI,dh as aJ,rp as aK,Wge as aL,Hge as aM,Dw as aN,Sa as aO,wf as aP,PM as aQ,ece as aR,Gfe as aS,mF as aT,cF as aU,Zde as aV,ny as aW,Qde as aX,ep as aY,Bl as aZ,Hfe as a_,dCe as aa,su as ab,CCe as ac,xCe as ad,pCe as ae,mme as af,M8 as ag,LCe as ah,jhe as ai,Gn as aj,Uo as ak,gd as al,a_ as am,_F as an,dc as ao,AF as ap,yt as aq,Zs as ar,Ve as as,b0e as at,NCe as au,BCe as av,ACe as aw,Xe as ax,MCe as ay,Gme as az,Goe as b,vc as b0,Jde as b1,Jw as b2,Xde as b3,rfe as b4,bh as b5,Vfe as b6,gpe as b7,afe as b8,lpe as b9,oN as bA,e_ as bB,hF as bC,Hv as bD,Qxe as bE,Bt as bF,Zw as ba,rL as bb,Ye as bc,MF as bd,ci as be,Gle as bf,Ow as bg,HI as bh,Zf as bi,UI as bj,uCe as bk,kse as bl,ppe as bm,ape as bn,mpe as bo,nb as bp,Kde as bq,Qw as br,gF as bs,bpe as bt,yh as bu,Jfe as bv,j0e as bw,Jf as bx,sy as by,sl as bz,zt as c,St as d,TI as e,Ur as f,Xoe as g,$o as h,ks as i,qhe as j,Yf as k,ge as l,EF as m,lCe as n,DCe as o,Zoe as p,Qoe as q,OCe as r,Yoe as s,zhe as t,ps as u,Ime as v,Lpe as w,kCe as x,rh as y,Voe as z};