@aiquants/markdown-explorer 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +327 -0
- package/README.md +33 -19
- package/dist/{EditSurface-BPqqykro.cjs → EditSurface-CF82jZQg.cjs} +5 -5
- package/dist/{EditSurface-BmbDSrrw.js → EditSurface-CqHk2R3k.js} +73 -63
- package/dist/ExplorerSplit-D325YGEf.cjs +1 -0
- package/dist/ExplorerSplit-DGH9bckm.js +1500 -0
- package/dist/MultiLayout-CzR7yJ0m.cjs +1 -0
- package/dist/{MultiLayout-DKgZ1sBK.js → MultiLayout-kcZyVnvK.js} +176 -176
- package/dist/NativeScrollBar-UNed10Na.js +62 -0
- package/dist/NativeScrollBar-pUbA4Zq3.cjs +1 -0
- package/dist/TreeLayout-BnIU87HX.js +96 -0
- package/dist/TreeLayout-DtvIpuOe.cjs +1 -0
- package/dist/core/geometry.d.cts +1 -0
- package/dist/core/geometry.d.ts +1 -0
- package/dist/core/labels.d.cts +10 -0
- package/dist/core/labels.d.ts +10 -0
- package/dist/core/location.d.cts +2 -0
- package/dist/core/location.d.ts +2 -0
- package/dist/core/viewSettings.d.cts +2 -0
- package/dist/core/viewSettings.d.ts +2 -0
- package/dist/{dataRoute-DLhQfdoW.js → dataRoute-D6KiSHIc.js} +20 -20
- package/dist/index-BDCbvHDs.cjs +15 -0
- package/dist/{index-CcXMPCRS.js → index-DR31S_-4.js} +2029 -1929
- package/dist/index.cjs +1 -1
- package/dist/index.js +17 -17
- package/dist/{location-perTmwct.js → location-C44b9H1S.js} +291 -278
- package/dist/location-hGLhCCg4.cjs +1 -0
- package/dist/{merge-DZI4pkWI.cjs → merge-BziXxZkE.cjs} +1 -1
- package/dist/{merge-3xGYZqbE.js → merge-C1MWvhCS.js} +1 -1
- package/dist/{sanitizePolicy-By0tKOpZ.js → sanitizePolicy-CwvyPpp5.js} +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +4 -4
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/tapScrollCircle-D_BpaLwY.js +14 -0
- package/dist/tapScrollCircle-DigcJCsu.cjs +1 -0
- package/dist/useSplitPersistence-DCeYbJMx.js +38 -0
- package/dist/useSplitPersistence-QGcvyMAa.cjs +1 -0
- package/docs/behavior/dom-hooks.md +12 -3
- package/docs/behavior/layout.md +73 -23
- package/docs/behavior/localization.md +4 -3
- package/docs/behavior/security.md +2 -1
- package/docs/behavior/url-contract.md +11 -5
- package/package.json +11 -11
- package/dist/ExplorerSplit-CQxr6b0v.cjs +0 -1
- package/dist/ExplorerSplit-DPuXOBqs.js +0 -1493
- package/dist/MultiLayout-TXbet9k3.cjs +0 -1
- package/dist/NativeScrollBar-C1CtjwBm.js +0 -64
- package/dist/NativeScrollBar-UpjxjLlB.cjs +0 -1
- package/dist/TreeLayout-BpazybVQ.js +0 -72
- package/dist/TreeLayout-C0O1OGi4.cjs +0 -1
- package/dist/index-DSkK8iLE.cjs +0 -15
- package/dist/location-BxiJRTyw.cjs +0 -1
- package/dist/tapScrollCircle-Cbf17x8g.cjs +0 -1
- package/dist/tapScrollCircle-DacgW2F_.js +0 -12
- package/dist/useSplitPersistence-Du01PHNg.js +0 -42
- package/dist/useSplitPersistence-pPmE4GTT.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),b=require("./index-BDCbvHDs.cjs"),r=require("react"),M=require("./location-hGLhCCg4.cjs"),Ze=require("@aiquants/directory-tree"),Ve=require("./tapScrollCircle-DigcJCsu.cjs"),bt=require("./storage-DM0EvkVf.cjs"),Ee=require("@aiquants/resize-panels"),vt=require("./useSplitPersistence-QGcvyMAa.cjs"),Rt=require("react-router");function St(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const h=St(r);function yt({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15ZM9 12.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9Z",clipRule:"evenodd"}))}const Ct=h.forwardRef(yt);function kt({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15Zm-6.75-10.5a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25v2.25a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V10.5Z",clipRule:"evenodd"}))}const Tt=h.forwardRef(kt);function Lt({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{d:"M16.5 6a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v7.5a3 3 0 0 0 3 3v-6A4.5 4.5 0 0 1 10.5 6h6Z"}),h.createElement("path",{d:"M18 7.5a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-7.5a3 3 0 0 1-3-3v-7.5a3 3 0 0 1 3-3H18Z"}))}const jt=h.forwardRef(Lt);function Ot({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M3 6a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3V6ZM3 15.75a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2.25Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3v-2.25Z",clipRule:"evenodd"}))}const Nt=h.forwardRef(Ot),At=()=>{const{notices:e}=b.useExplorer(),t=r.use(e);return t.length===0?null:s.jsx("div",{className:"aqmx-explorer-notices",children:t.map(n=>s.jsxs("div",{className:"aqmx-callout","data-aqmx-tone":n.tone,"data-testid":"markdown-explorer-notice","data-aqmx-notice":n.id,children:[s.jsx("p",{className:"aqmx-callout-title",children:n.title}),n.body===void 0?null:s.jsx("p",{className:"aqmx-callout-body",children:n.body}),n.action===void 0?null:s.jsx("a",{className:"aqmx-callout-action",href:n.action.href,children:n.action.label})]},n.id))})};function qt({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M6.912 3a3 3 0 0 0-2.868 2.118l-2.411 7.838a3 3 0 0 0-.133.882V18a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3v-4.162c0-.299-.045-.596-.133-.882l-2.412-7.838A3 3 0 0 0 17.088 3H6.912Zm13.823 9.75-2.213-7.191A1.5 1.5 0 0 0 17.088 4.5H6.912a1.5 1.5 0 0 0-1.434 1.059L3.265 12.75H6.11a3 3 0 0 1 2.684 1.658l.256.513a1.5 1.5 0 0 0 1.342.829h3.218a1.5 1.5 0 0 0 1.342-.83l.256-.512a3 3 0 0 1 2.684-1.658h2.844Z",clipRule:"evenodd"}))}const Pt=h.forwardRef(qt),Te=r.createContext(!0),Ke=r.createContext(null),Xe="\0loop\0",Ue="\0",Mt=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,l=a=>{const o=e.get(a);if(o!==void 0)return o;const f=Object.freeze({type:"loop",name:a.name,path:a.path});return e.set(a,f),f},c=(a,o,f)=>{let p=!1;const u=a.map(m=>{const x=i(m,o,f);return x!==m&&(p=!0),x});if(!p)return a;const d=n.get(a);return d!==void 0&&d.length===u.length&&d.every((m,x)=>m===u[x])?d:(n.set(a,u),u)},i=(a,o,f)=>{if(a.type!=="directory")return a;if(f.has(a.path))return l(a);const p=a.lazy===!0?o(a.path):void 0,u=p?.status==="loaded",d=u?p.entries:a.children;if(d===void 0)return a;f.add(a.path);const m=c(d,o,f);if(f.delete(a.path),!u&&m===a.children)return a;const x=t.get(a);if(x!==void 0&&x.state===p&&x.children===m)return x.grafted;const g={...a,children:m,lazy:u?!1:a.lazy};return t.set(a,{state:p,children:m,grafted:g}),g};return(a,o)=>c(a,o,new Set)},Ft=(e,t)=>`${Xe}${e}${Ue}${t}`,de=e=>e.startsWith(Xe),_t=e=>e.slice(e.lastIndexOf(Ue)+1),re="data-aqmx-path",It=(e,t,n,l,c)=>{const i={aqmxPath:e.path};return e.modifiedAt!==void 0&&(i.aqmxModifiedAt=e.modifiedAt),n&&(i.aqmxOpen=!0),(l==="loading"||l==="failed")&&(i.aqmxChildren=l),{name:e.name,type:e.type,absolutePath:e.path,relativePath:e.path,mimeType:e.mimeType,children:t,label:c,data:i}},Dt=(e,t,n,l)=>{const c=Ft(t,e.path);return{name:n,type:"directory",absolutePath:c,relativePath:c,children:l,data:{aqmxLoop:e.path}}},Ht=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,l=[],c=(o,f,p)=>{const u=o.map(m=>m.type==="loop"?i(m,f,p):a(m,f)),d=n.get(o);return d!==void 0&&d.length===u.length&&d.every((m,x)=>m===u[x])?d:(n.set(o,u),u)},i=(o,f,p)=>{const u=t.get(o);if(u!==void 0&&u.parentKey===p&&u.loopFolderName===f.loopFolderName)return u.row;const d=Dt(o,p,f.loopFolderName(o.name),l);return t.set(o,{row:d,parentKey:p,loopFolderName:f.loopFolderName}),d},a=(o,f)=>{const p=o.type==="directory"?o.children===void 0?l:c(o.children,f,o.path):void 0,u=f.openPaths.has(o.path),d=o.type==="directory"&&o.lazy===!0?f.childrenOf(o.path)?.status:void 0,m=d==="failed"?f.renderFailedFolder:void 0,x=e.get(o);if(x!==void 0&&x.open===u&&x.childrenStatus===d&&x.children===p&&x.renderFailedFolder===m)return x.row;const g=It(o,p,u,d,m===void 0?void 0:m(o));return e.set(o,{row:g,open:u,childrenStatus:d,children:p,renderFailedFolder:m}),g};return(o,f)=>c(o,f,"")},Bt=e=>{if(e===void 0)return;const t=n=>{const l=n.data?.aqmxModifiedAt;return typeof l=="number"?{name:n.name,path:n.absolutePath,type:n.type,modifiedAt:l}:{name:n.name,path:n.absolutePath,type:n.type}};return(n,l)=>e(t(n),t(l))},Ce=(e,t)=>{const n=e.filter(l=>l.type==="directory");return t===void 0?n:n.sort(t)},$t=(e,t)=>{const n=new Map;let l=0;const c=i=>{for(const a of Ce(i,t.compare))if(t.isShownExpanded(a.path)){if(a.lazy!==!0){a.children!==void 0&&c(a.children);continue}n.has(a.path)||(n.set(a.path,t.isDirect(a.path)?"direct":"bulk"),t.childrenOf(a.path)?.status!=="failed"&&(l+=1))}};return c(e),{folders:n,waiting:l}},zt=e=>{const t=new Set,n=l=>{for(const c of l)c.type==="directory"&&(c.lazy===!0&&t.add(c.path),c.children!==void 0&&n(c.children))};return n(e),t},We=(e,t)=>{for(const n of e){if(n.type!=="directory")continue;if(n.path===t)return n;const l=n.children===void 0?null:We(n.children,t);if(l!==null)return l}return null},Zt=(e,t,n,l)=>{let c=e;for(const i of t){const a=c.find(o=>o.type==="directory"&&o.path===i);if(a===void 0)return"missing";if(a.lazy===!0)return l.childrenOf(a.path)?.status==="failed"?"failed":"loading";if(!l.isShownExpanded(a.path))return"loading";c=a.children??[]}return c.some(i=>i.type==="file"&&i.path===n)?"ready":"missing"},Ie=new Set,Vt=(e,t)=>e.has(t)?e:new Set(e).add(t),Kt=(e,t)=>{if(!t.some(l=>e.has(l)))return e;const n=new Set(t);return new Set([...e].filter(l=>!n.has(l)))},Xt=(e,t)=>[...e].every(n=>t.has(n))?e:new Set([...e].filter(n=>t.has(n))),Ut=()=>{const[e,t]=r.useState(Ie),n=r.useCallback(a=>t(o=>Vt(o,a)),[]),l=r.useCallback(a=>t(o=>Kt(o,a)),[]),c=r.useCallback(a=>t(o=>Xt(o,a)),[]),i=r.useCallback(()=>t(Ie),[]);return r.useMemo(()=>({direct:e,markDirect:n,unmarkDirect:l,pruneDirect:c,clearDirect:i}),[e,n,l,c,i])},Wt=e=>({budget:e,handled:new Set,loads:new Set,opened:0,folderLimited:!1,depthLimited:!1,announcedStart:!1,issuedAgainst:null}),Gt=(e,t)=>{const n=[];let l=Ce(t.entries,t.compare);for(let c=1;l.length>0;c+=1){const i=[];for(const a of l){const{path:o}=a;if(t.isShownExpanded(o))e.handled.add(o);else{if(e.handled.has(o))continue;if(e.handled.add(o),a.lazy===!0&&t.childrenOf(o)===void 0){if(c>e.budget.maxDepth){e.depthLimited=!0;continue}if(e.loads.size>=e.budget.maxFolders){e.folderLimited=!0;continue}e.loads.add(o)}n.push(o),e.opened+=1}a.lazy!==!0&&a.children!==void 0&&i.push(...Ce(a.children,t.compare))}l=i}return n},Ge=(e,t)=>e.every(n=>n.type!=="directory"||t(n.path)&&(n.lazy===!0||n.children===void 0||Ge(n.children,t))),Yt=(e,t)=>{if(e.folderLimited)return{kind:"folder-limit",opened:e.opened};if(e.depthLimited)return{kind:"depth-limit",opened:e.opened};let n=0;for(const l of e.loads)t.childrenOf(l)?.status==="failed"&&(n+=1);return{kind:"done",opened:e.opened,failed:n,complete:Ge(t.entries,t.isShownExpanded)}},ye=Object.freeze({state:"idle"}),Qt=e=>{const t=r.useRef(null),n=r.useRef(e),[l,c]=r.useState(ye);r.useLayoutEffect(()=>{n.current=e});const i=r.useCallback(()=>{t.current===null&&(t.current=Wt(n.current.budget),c({state:"running",opened:0}))},[]),a=r.useCallback(()=>{t.current=null,c(ye)},[]),o=r.useCallback(f=>{const p=t.current;if(p===null)return;const u=Gt(p,f);if(u.length>0&&(p.issuedAgainst=f.expanded,n.current.expandMultiple([...u])),!p.announcedStart&&(p.loads.size>0||f.waiting>0)&&(p.announcedStart=!0,n.current.onStart()),u.length===0&&!f.expansionPending&&f.expanded!==p.issuedAgainst&&f.waiting===0){t.current=null;const m=Yt(p,f);c(m.kind==="done"?ye:{state:"stopped",stop:m.kind,opened:m.opened}),n.current.onFinish(m);return}const{opened:d}=p;c(m=>m.state==="running"&&m.opened===d?m:{state:"running",opened:d})},[]);return r.useMemo(()=>({status:l,start:i,end:a,advance:o}),[l,i,a,o])},De=["pointerdown","wheel","touchstart","keydown","focusin"],Jt=8,He={least:Number.POSITIVE_INFINITY,stalled:0},en=({tree:e,container:t,path:n,chain:l,rows:c,cancel:i,displayed:a,placement:o})=>{const f=r.useRef(null),p=r.useRef(!0),u=r.useRef(He),d=r.useRef(null),m=r.useRef(null),x=r.useRef(l),g=r.useRef(o);r.useLayoutEffect(()=>{x.current=l,g.current=o},[l,o]);const E=r.useCallback(()=>{const C=d.current;C!==null&&(d.current=null,C.phase==="asking"?C.controller.abort():x.current?.open(null))},[]),S=r.useCallback(()=>{f.current=null,E()},[E]),L=r.useCallback(()=>{const C=t.current;f.current===null||m.current!==null||C===null||C.getClientRects().length===0||(m.current=requestAnimationFrame(()=>{m.current=null;const O=f.current;if(O===null)return;const j=g.current(O);if(j===0){p.current=!0,d.current?.phase==="opening"&&E();return}if(e.current?.scrollToPath(O,{align:"nearest"})===!0){d.current?.phase==="opening"&&E();const{least:R,stalled:q}=u.current;u.current=j<R?{least:j,stalled:0}:{least:R,stalled:q+1},u.current.stalled<Jt&&L();return}const v=d.current;if(v===null){f.current=null;return}v.phase==="opening"&&x.current?.progress(v.folders,O)!=="loading"&&S()}))},[e,t,E,S]),k=r.useCallback(()=>{p.current=!1,u.current=He,L()},[L]);r.useEffect(()=>{const C=t.current;if(C===null)return;const O=typeof ResizeObserver>"u"?null:new ResizeObserver(k);O?.observe(C);for(const j of De)C.addEventListener(j,S,{passive:!0});return()=>{O?.disconnect();for(const j of De)C.removeEventListener(j,S);m.current!==null&&cancelAnimationFrame(m.current),m.current=null,E()}},[t,k,S,E]);const y=l!==null;r.useEffect(()=>{const C=t.current;if(S(),n===null||C===null||C.contains(C.ownerDocument.activeElement))return;f.current=n;const O=x.current;if(y&&O!==null){const j=new AbortController,v={phase:"asking",controller:j};d.current=v,O.ancestors(n,j.signal).then(R=>{d.current===v&&(R===null?d.current=null:(d.current={phase:"opening",folders:R},x.current?.open(R)),k())})}k()},[n,y,t,S,k]),r.useEffect(()=>{(d.current?.phase==="opening"||f.current!==null&&!p.current)&&k()},[c,k]);const F=r.useRef(i);r.useEffect(()=>{F.current!==i&&(F.current=i,S())},[i,S]);const P=r.useRef(a);r.useEffect(()=>{P.current&&!a&&E(),P.current=a},[a,E])},tn="--aqmx-tree-line",nn=Object.freeze(["(forced-colors: active)","(prefers-color-scheme: dark)"]),rn="data-aqmx-tree-probe",ln=Object.freeze({rowHeight:M.CONTROL_BLOCK_PIXELS,lineColor:null}),an=/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u,on=e=>{const t=an.exec(e);return t===null?e:`#${t.slice(1).map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`},sn=(e,t)=>{const[n,l]=r.useState(ln);return r.useLayoutEffect(()=>{const c=e.current;if(c===null)return;const i=()=>{const f=Math.round(c.getBoundingClientRect().height),p=getComputedStyle(c),u=p.getPropertyValue(tn).trim()===""?null:on(p.color);l(d=>{const m=Number.isFinite(f)&&f>0?f:d.rowHeight;return d.rowHeight===m&&d.lineColor===u?d:{rowHeight:m,lineColor:u}})};i();const a=nn.map(f=>window.matchMedia(f));for(const f of a)f.addEventListener("change",i);const o=typeof ResizeObserver>"u"?null:new ResizeObserver(i);return o?.observe(c),()=>{for(const f of a)f.removeEventListener("change",i);o?.disconnect()}},[e,t]),n},Ye="markdown-explorer-tree-scroll",cn=.5,Qe=(e,t)=>[...e.querySelectorAll(`[role="treeitem"][${re}]`)].find(n=>n.getAttribute(re)===t),un=(e,t)=>{const n=Qe(e,t),l=n?.closest(`[data-testid="${Ye}"]`);if(n===void 0||l===null||l===void 0)return Number.POSITIVE_INFINITY;const c=l.getBoundingClientRect(),i=n.getBoundingClientRect(),a=c.top-i.top,o=i.height>c.height?Math.abs(a):Math.max(0,a)+Math.max(0,i.bottom-c.bottom);return o<=cn?0:o},ke=Object.freeze({testId:Ye,overscanCount:13,callbackThrottleMs:13,scrollBarOptions:Object.freeze({width:8,...b.SCROLL_BAR_CONTROLS,enableArrowButtons:!0,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:Ve.TAP_SCROLL_CIRCLE}),behaviorOptions:Object.freeze({enablePointerDrag:!0})}),dn=Object.freeze({...ke,scrollBarOptions:Object.freeze({...ke.scrollBarOptions,...b.TOUCH_SCROLL_BAR_CONTROLS,tapScrollCircleOptions:Ve.TOUCH_TAP_SCROLL_CIRCLE})}),fn=e=>e?dn:ke,pn={hoverClassName:"",directorySelectedClassName:"",itemSelectedClassName:""},mn={color:"inherit",fontSize:"inherit"},hn={fontSize:"inherit"},xn=new Set,wn=new Map,gn={color:"var(--aqmx-tree-line)"},En=e=>{const t=e instanceof Element?e.closest(`[${re}]`):null;return t===null||t.getAttribute("data-entry-type")!=="file"?null:t.getAttribute(re)},Je=(e,t,n,l)=>n==="folder-limit"?e.expandAllFolderLimit(l,t.maxFolders,e.expandAll):e.expandAllDepthLimit(l,t.maxDepth),bn=(e,t,n)=>n.kind==="done"?e.expandAllDone(n.opened,n.failed,n.complete):Je(e,t,n.kind,n.opened),et=()=>{const{labels:e}=b.useExplorer();return s.jsxs("div",{className:"aqmx-explorer-loading","aria-busy":"true","data-testid":"markdown-explorer-tree-loading",children:[s.jsx("p",{className:"aqmx-explorer-loading-text",children:e.treeLoading}),s.jsxs("div",{className:"aqmx-skeleton","aria-hidden":"true",children:[s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{})]})]})},vn=()=>{const{labels:e}=b.useExplorer();return s.jsxs("div",{className:"aqmx-empty","data-testid":"markdown-explorer-tree-empty",children:[s.jsx(Pt,{className:"aqmx-explorer-empty-icon","aria-hidden":"true"}),s.jsx("p",{className:"aqmx-empty-title",children:e.treeEmptyTitle}),s.jsx("p",{className:"aqmx-explorer-empty-body",children:e.treeEmptyBody})]})},Rn=({name:e,onRetry:t})=>{const{labels:n}=b.useExplorer(),l=r.useId();return s.jsxs("span",{className:"aqmx-explorer-folder-failed",children:[s.jsx("span",{className:"aqmx-explorer-folder-name",children:e}),s.jsx("span",{id:l,className:"aqmx-explorer-folder-error",children:n.folderLoadFailed}),s.jsxs("button",{type:"button",className:"aqmx-explorer-folder-retry","aria-describedby":l,"data-testid":"markdown-explorer-folder-retry",onClick:c=>{c.stopPropagation();const i=c.currentTarget,a=i.ownerDocument.activeElement===i?i.closest('[role="treeitem"]'):null;a instanceof HTMLElement&&b.focusWithoutScroll(a),t()},onKeyDown:c=>{c.key!=="Escape"&&c.stopPropagation()},children:[s.jsx(b.ForwardRef,{className:"aqmx-explorer-folder-retry-icon","aria-hidden":"true"}),s.jsx("span",{className:"aqmx-explorer-folder-retry-text",children:n.retry})]})]})},Sn=({entries:e,version:t,mode:n,sourceId:l,settings:c,reveal:i,openPaths:a,selection:o,onOpenDocument:f,folders:p,onRevealSource:u,expansion:d,onShown:m,marks:x,claimsHeld:g,expandAll:E,revealCancel:S})=>{const{trees:L,documents:k,labels:y,locale:F,theme:P,data:C,config:O,sources:j,reveals:v}=b.useExplorer(),R=r.use(Te),q=r.use(Ke),[_]=r.useState(()=>q?.get(l)),I=fn(b.useCoarsePointer()),$=r.useMemo(()=>_===void 0?I:{...I,initialScrollAnchor:_},[I,_]),[le]=r.useState(Ht),Q=r.useRef(null),{rowHeight:J,lineColor:U}=sn(Q,P),{isExpanded:z,toggle:ee,expandMultiple:A,collapseMultiple:te,expanded:W,isPending:ae}=d,{alwaysExpanded:ne,sortMode:fe,folderPlacement:oe,readmePlacement:me}=c,{direct:pe,markDirect:B,unmarkDirect:se,pruneDirect:he}=x,{running:ce,advance:N}=E,D=r.useRef(null),Z=r.useRef(null);r.useLayoutEffect(()=>{if(q===null)return;const w=D;return()=>{const T=w.current===null?null:w.current.getScrollAnchor();T===null?q.delete(l):q.set(l,T)}},[q,l]);const ie=r.useMemo(()=>M.createEntryComparator({sortMode:fe,folderPlacement:oe,readmePlacement:me}),[fe,oe,me]),st=r.useMemo(()=>Bt(ie),[ie]),V=r.useCallback(w=>L.children(l,w),[L,l]),G=r.useMemo(()=>zt(e),[e]),Y=r.useCallback(w=>!de(w)&&(z(w)||ne&&!G.has(w)),[z,ne,G]),K=r.useRef({shownExpanded:Y,isExpanded:z,unloadedFolders:G,entries:e,childrenOf:V});r.useLayoutEffect(()=>{K.current={shownExpanded:Y,isExpanded:z,unloadedFolders:G,entries:e,childrenOf:V}},[Y,z,G,e,V]);const Ne=r.useCallback(w=>{D.current?.scrollToPath(w,{align:"nearest"}),requestAnimationFrame(()=>{const T=Z.current,H=T===null?void 0:Qe(T,w);H!==void 0&&b.focusWithoutScroll(H)})},[]),ct=r.useCallback(w=>{if(de(w)){Ne(_t(w));return}K.current.isExpanded(w)?se([w]):K.current.unloadedFolders.has(w)&&B(w),ee(w)},[Ne,B,se,ee]),ve=r.useCallback(w=>{const T=w.filter(H=>!de(H));T.length!==0&&(se(T),te(T))},[se,te]),it=r.useCallback(w=>{const T=w.filter(H=>!de(H));T.length!==0&&(T.length<w.length&&T.every(H=>K.current.shownExpanded(H))?ve(T):A(T))},[A,ve]),Ae=r.useCallback(w=>s.jsx(Rn,{name:w.name,onRetry:()=>{B(w.path),L.retryChildren(l,w.path),K.current.shownExpanded(w.path)||A([w.path])}}),[L,l,B,A]),qe=n==="multi"?a:xn,{loopFolderName:Pe}=y,ut=r.useMemo(()=>le(e,{openPaths:qe,childrenOf:V,renderFailedFolder:Ae,loopFolderName:Pe}),[le,e,qe,V,Ae,Pe,t]),dt=b.useIntentPrefetch(k,En),Me=r.useRef([]),xe=r.useCallback(()=>{for(const w of Me.current)K.current.unloadedFolders.has(w)&&B(w)},[B]),{maxDepth:Re}=O.revealDocument,Fe=r.useRef(u);r.useLayoutEffect(()=>{Fe.current=u},[u]);const ft=r.useMemo(()=>({ancestors:async(w,T)=>{const H=v.take(l,w);if(H!==null)return H;if(!v.mayMove(w)){const ue=await C.ancestors(l,w,T);return ue.status!=="ok"||ue.ancestors===null||ue.ancestors.length>Re?null:ue.ancestors}const X=await C.reveal(l,w,T);return X.status!=="ok"||X.source===null||X.ancestors.length>Re?null:X.source===l?X.ancestors:(T.aborted||!j.some(ue=>ue.id===X.source)||(v.move(X.source,w,X.ancestors),Fe.current(X.source)),null)},open:w=>{Me.current=w??[],w!==null&&(xe(),A([...w]))},progress:(w,T)=>Zt(K.current.entries,w,T,{isShownExpanded:K.current.shownExpanded,childrenOf:K.current.childrenOf})}),[C,l,j,v,Re,xe,A]);r.useEffect(()=>xe(),[xe,G]);const pt=r.useMemo(()=>[e,t,W],[e,t,W]),mt=r.useCallback(w=>Z.current===null?Number.POSITIVE_INFINITY:un(Z.current,w),[]);en({tree:D,container:Z,path:i.path,chain:i.openFolders?ft:null,rows:pt,cancel:S,displayed:R,placement:mt});const _e=r.useCallback(w=>pe.has(w),[pe]),we=r.useMemo(()=>$t(e,{isShownExpanded:Y,childrenOf:V,compare:ie,isDirect:_e}),[e,Y,V,ie,_e,t]),ge=R&&g;r.useLayoutEffect(()=>{m(e)},[e,m]),r.useLayoutEffect(()=>()=>m(null),[m]),r.useEffect(()=>L.claimChildren(l,ge?we.folders:wn),[L,l,ge,we]),r.useEffect(()=>he(G),[he,G]),r.useEffect(()=>{ge&&ce&&N({entries:e,isShownExpanded:Y,childrenOf:V,compare:ie,expanded:W,waiting:we.waiting,expansionPending:ae})},[ge,ce,N,e,Y,V,ie,W,we,ae]);const ht=r.useCallback(w=>{const T=w.entry.absolutePath;if(w.isDirectory){if(p===null||de(T)||T===p.current)return;w.isExpanded&&w.preventDefault(),v.settle(T),p.open(T);return}v.settle(T),f(T)},[v,f,p]),{onChange:Se}=o,xt=r.useMemo(()=>Se===null?void 0:(w,T)=>{de(w.absolutePath)||Se({path:w.absolutePath,name:w.name,selected:T})},[Se]),wt=r.useMemo(()=>new Set(o.items),[o.items]),gt=r.useMemo(()=>({entryKindDirectory:y.treeEntryKindDirectory,entryKindFile:y.treeEntryKindFile,scrollUp:y.treeScrollUp,scrollDown:y.treeScrollDown,scrollToTop:y.treeScrollToTop,scrollToBottom:y.treeScrollToBottom}),[y]),Et=U===null?{showTreeLines:!1}:{showTreeLines:c.lines,lineColor:U};return s.jsxs("div",{ref:Z,className:"aqmx-explorer-tree","data-testid":"markdown-explorer-tree",...dt,children:[s.jsx("span",{ref:Q,className:"aqmx-explorer-tree-probe","aria-hidden":"true",[rn]:""}),s.jsx(Ze.DirectoryTree,{ref:D,entries:ut,expansion:{toggle:ct,isExpanded:Y,expandMultiple:it,collapseMultiple:ve,isPending:ae&&!ce,doubleClickAction:c.doubleClickAction},selection:{mode:o.mode,selectedPath:o.shownPath,currentPath:o.shownPath,selectedItems:wt,onEntryClick:ht,onSelectionChange:xt},visual:{className:"aqmx-explorer-tree-view",ariaLabel:y.treeRegion,...Et,showExpandIcons:c.expandIcons,expandIconStyle:gn,showDirectoryIcons:c.directoryIcons,showFileIcons:c.fileIcons,expandIconSize:c.expandIconSize,itemHeight:J,removeRootIndent:c.removeRootIndent,highlightStyles:pn,entryStyle:hn,nameStyle:mn},virtualScroll:$,sort:st,locale:F,labels:gt})]})},yn=({pending:e,status:t})=>{const{labels:n}=b.useExplorer(),l=t.state!=="running",[c,i]=r.useState(0),a=r.useRef(!0);r.useLayoutEffect(()=>{const f=a.current;if(a.current=l,!l||e>0&&!f){i(0);return}if(e>0){i(e);return}if(c===0)return;const p=setTimeout(()=>i(0),0);return()=>clearTimeout(p)},[l,e,c]);const o=l&&e===0?c:e;return o===0&&l?null:s.jsxs("p",{className:"aqmx-explorer-tree-progress","data-testid":"markdown-explorer-tree-progress","data-aqmx-loading":String(o),"data-aqmx-expand-all":t.state,children:[o>0?s.jsx(b.ForwardRef,{className:"aqmx-explorer-tree-progress-icon","aria-hidden":"true"}):null,s.jsx("span",{children:t.state==="running"?n.expandAllProgress(t.opened,o):n.foldersLoading(o)})]})},Cn=({stop:e,opened:t,budget:n})=>{const{labels:l}=b.useExplorer();return s.jsx("p",{className:"aqmx-explorer-expand-all-stop","data-testid":"markdown-explorer-expand-all-stop","data-aqmx-stop":e,children:Je(l,n,e,t)})},kn=({entries:e,...t})=>{const{trees:n}=b.useExplorer(),l=r.useSyncExternalStore(n.subscribe,n.version,n.version),{sourceId:c}=t,[i]=r.useState(Mt),a=r.useMemo(()=>i(e,o=>n.children(c,o)),[i,e,n,c,l]);return a.length===0?s.jsx(vn,{}):s.jsx(Sn,{entries:a,version:l,...t})},Tn=({result:e,onRetry:t,...n})=>{const{renderTreeFailure:l}=b.useExplorer(),c=r.use(e);if(c.status==="deferred")return s.jsx(et,{});if(c.status==="ok")return s.jsx(kn,{entries:c.entries,...n});const i=l?.(c.failure);return s.jsx("div",{className:"aqmx-explorer-tree-message","data-testid":"markdown-explorer-tree-failure","data-aqmx-failure":c.failure.reason,children:i!==void 0?i:s.jsx(b.FailureView,{failure:c.failure,alert:!0,onRetry:t,testId:null})})},Ln=({onControls:e,...t})=>{const{trees:n,storageNamespace:l,labels:c,announcer:i,config:a}=b.useExplorer(),{sourceId:o}=t,f=Ze.useDirectoryTreeState({storageKey:bt.storageKeys(l).treeExpansion(o)});r.useSyncExternalStore(n.subscribe,n.version,n.version);const p=n.read(o),u=r.useCallback(()=>n.retry(o),[n,o]);r.useLayoutEffect(()=>n.open(o),[n,o]);const d=Ut(),{expanded:m,expandMultiple:x,collapseAll:g}=f,[E,S]=r.useState(null),L=E!==m,k=r.useRef(m);r.useLayoutEffect(()=>{k.current=m},[m]);const y=a.expandAll,F=r.useCallback(()=>i.announce(c.expandAllStarted),[i,c]),P=r.useCallback(A=>i.announce(bn(c,y,A)),[i,c,y]),C=Qt({budget:y,expandMultiple:x,onStart:F,onFinish:P}),{status:O,start:j,end:v,advance:R}=C,q=O.state==="running",_=r.useMemo(()=>({running:q,advance:R}),[q,R]),I=r.useRef(null),[$,le]=r.useState(!1),Q=r.useCallback(A=>{I.current=A,le(A!==null)},[]);r.useEffect(()=>n.subscribeChildrenFailures(A=>{const te=A.sourceId===o&&I.current!==null?We(I.current,A.path):null;te!==null&&i.announce({list:c.foldersLoadFailedNamed,item:te.name})}),[n,o,i,c]);const{clearDirect:J}=d,[U,z]=r.useState(0),ee=r.useCallback(()=>{z(A=>A+1),v(),J(),S(k.current),g()},[v,J,g]);return r.useEffect(()=>{e({collapseAll:ee,expandAll:$?j:null,expanding:q})},[e,ee,j,$,q]),r.useEffect(()=>()=>e(null),[e]),r.useEffect(()=>{$||v()},[$,v]),s.jsxs(s.Fragment,{children:[O.state==="stopped"?s.jsx(Cn,{stop:O.stop,opened:O.opened,budget:y}):null,s.jsxs("div",{className:"aqmx-explorer-tree-area",children:[s.jsx(r.Suspense,{fallback:s.jsx(et,{}),children:s.jsx(Tn,{result:p,onRetry:u,expansion:f,onShown:Q,marks:d,claimsHeld:L,expandAll:_,revealCancel:U,...t})}),s.jsx(yn,{pending:n.pendingChildren(o),status:O})]})]})};function jn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Le=h.forwardRef(jn),Be="markdown-explorer-selection-remove",On=({selection:e,onRemove:t,onClear:n,onOpenSelection:l,onLeave:c})=>{const{labels:i}=b.useExplorer(),a=r.useId(),o=r.useRef(null),f=[...e],p=(d,m)=>{if(m.ownerDocument.activeElement===m){const x=o.current===null?[]:[...o.current.querySelectorAll(`[data-testid="${Be}"]`)],g=x.indexOf(m),E=[x[g+1],x[g-1]].find(S=>S!==void 0);E===void 0?c():E.focus()}t(d)},u=()=>{const d=o.current;d!==null&&d.contains(d.ownerDocument.activeElement)&&c(),n()};return s.jsxs("section",{ref:o,className:"aqmx-explorer-tray","aria-labelledby":a,"data-testid":"markdown-explorer-selection-tray",children:[s.jsxs("div",{className:"aqmx-explorer-tray-header",children:[s.jsx("p",{id:a,className:"aqmx-explorer-tray-title",children:i.selectionTitle(f.length)}),s.jsx("button",{type:"button",className:"aqmx-explorer-tray-button","data-testid":"markdown-explorer-selection-clear",onClick:u,children:i.clearSelection})]}),s.jsx("ul",{className:"aqmx-explorer-tray-list",children:f.map(([d,m])=>s.jsxs("li",{className:"aqmx-explorer-tray-item",children:[s.jsx("span",{className:"aqmx-explorer-tray-name",title:d,children:m}),s.jsx("button",{type:"button",className:"aqmx-icon-button aqmx-explorer-tray-remove","aria-label":i.removeFromSelection(m),title:i.removeFromSelection(m),"data-testid":Be,"data-aqmx-path":d,onClick:x=>p(d,x.currentTarget),children:s.jsx(Le,{"aria-hidden":"true"})})]},d))}),l===void 0?null:s.jsx("button",{type:"button",className:"aqmx-explorer-tray-open","data-testid":"markdown-explorer-selection-open",onClick:()=>l(f.map(([d])=>d)),children:i.openSelectionInMulti(f.length)})]})},be=new Map,Nn=(e,t)=>{if(t.selected===e.has(t.path))return e;const n=new Map(e);return t.selected?n.set(t.path,t.name):n.delete(t.path),n},An=(e,t)=>{if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n},tt=r.createContext(null),qn=e=>{const t=r.use(tt);r.useLayoutEffect(()=>{if(t!==null)return t(e),()=>t(!1)},[t,e])};function Pn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M6.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.25 4.81V16.5a.75.75 0 0 1-1.5 0V4.81L3.53 8.03a.75.75 0 0 1-1.06-1.06l4.5-4.5Zm9.53 4.28a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const Mn=h.forwardRef(Pn);function Fn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{d:"M11.25 4.533A9.707 9.707 0 0 0 6 3a9.735 9.735 0 0 0-3.25.555.75.75 0 0 0-.5.707v14.25a.75.75 0 0 0 1 .707A8.237 8.237 0 0 1 6 18.75c1.995 0 3.823.707 5.25 1.886V4.533ZM12.75 20.636A8.214 8.214 0 0 1 18 18.75c.966 0 1.89.166 2.75.47a.75.75 0 0 0 1-.708V4.262a.75.75 0 0 0-.5-.707A9.735 9.735 0 0 0 18 3a9.707 9.707 0 0 0-5.25 1.533v16.103Z"}))}const _n=h.forwardRef(Fn);function In({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))}const Dn=h.forwardRef(In);function Hn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"}))}const Bn=h.forwardRef(Hn);function $n({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M11.47 4.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1-1.06 1.06L12 6.31 8.78 9.53a.75.75 0 0 1-1.06-1.06l3.75-3.75Zm-3.75 9.75a.75.75 0 0 1 1.06 0L12 17.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-3.75 3.75a.75.75 0 0 1-1.06 0l-3.75-3.75a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const zn=h.forwardRef($n);function Zn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M11.078 2.25c-.917 0-1.699.663-1.85 1.567L9.05 4.889c-.02.12-.115.26-.297.348a7.493 7.493 0 0 0-.986.57c-.166.115-.334.126-.45.083L6.3 5.508a1.875 1.875 0 0 0-2.282.819l-.922 1.597a1.875 1.875 0 0 0 .432 2.385l.84.692c.095.078.17.229.154.43a7.598 7.598 0 0 0 0 1.139c.015.2-.059.352-.153.43l-.841.692a1.875 1.875 0 0 0-.432 2.385l.922 1.597a1.875 1.875 0 0 0 2.282.818l1.019-.382c.115-.043.283-.031.45.082.312.214.641.405.985.57.182.088.277.228.297.35l.178 1.071c.151.904.933 1.567 1.85 1.567h1.844c.916 0 1.699-.663 1.85-1.567l.178-1.072c.02-.12.114-.26.297-.349.344-.165.673-.356.985-.57.167-.114.335-.125.45-.082l1.02.382a1.875 1.875 0 0 0 2.28-.819l.923-1.597a1.875 1.875 0 0 0-.432-2.385l-.84-.692c-.095-.078-.17-.229-.154-.43a7.614 7.614 0 0 0 0-1.139c-.016-.2.059-.352.153-.43l.84-.692c.708-.582.891-1.59.433-2.385l-.922-1.597a1.875 1.875 0 0 0-2.282-.818l-1.02.382c-.114.043-.282.031-.449-.083a7.49 7.49 0 0 0-.985-.57c-.183-.087-.277-.227-.297-.348l-.179-1.072a1.875 1.875 0 0 0-1.85-1.567h-1.843ZM12 15.75a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5Z",clipRule:"evenodd"}))}const Vn=h.forwardRef(Zn);function Kn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Xn=h.forwardRef(Kn);function Un({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5H5.625ZM7.5 15a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 7.5 15Zm.75 2.25a.75.75 0 0 0 0 1.5H12a.75.75 0 0 0 0-1.5H8.25Z",clipRule:"evenodd"}),h.createElement("path",{d:"M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"}))}const Wn=h.forwardRef(Un);function Gn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const Yn=h.forwardRef(Gn);function Qn({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{d:"M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"}))}const Jn=h.forwardRef(Qn);function er({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Zm8.25-3.75a.75.75 0 0 1 .75.75v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25H7.5a.75.75 0 0 1 0-1.5h2.25V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const tr=h.forwardRef(er);function nr({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{d:"M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z"}))}const rr=h.forwardRef(nr),lr=Object.freeze({sortMode:Mn,folderPlacement:Yn,readmePlacement:_n,selectionMode:Dn,doubleClickAction:Xn,expandIconSize:tr,alwaysExpanded:b.ForwardRef$2,revealDocument:b.ForwardRef$1,removeRootIndent:Bn,lines:rr,expandIcons:zn,directoryIcons:Jn,fileIcons:Wn}),nt=(e,t)=>{const n=e[t.labelKey];if(typeof n!="string")throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is a ${typeof n}`);return n},ar=({id:e,settings:t,descriptors:n,onAdvance:l,onClose:c,ref:i})=>{const{labels:a}=b.useExplorer(),o=r.useRef([]);r.useEffect(()=>{o.current[0]?.focus()},[]);const f=r.useCallback(u=>{const d=n.length;o.current[(u%d+d)%d]?.focus()},[n.length]),p=r.useCallback((u,d)=>{switch(u.key){case"ArrowDown":u.preventDefault(),f(d+1);break;case"ArrowUp":u.preventDefault(),f(d-1);break;case"Home":u.preventDefault(),f(0);break;case"End":u.preventDefault(),f(n.length-1);break;case"Escape":b.consumeKey(u),c();break;case"Tab":c();break}},[n.length,f,c]);return s.jsx("div",{ref:i,id:e,role:"menu","aria-label":a.treeSettings,className:"aqmx-explorer-menu","data-testid":"markdown-explorer-tree-settings-menu",children:n.map((u,d)=>{const m=lr[u.key],x=nt(a,u),g=M.formatTreeSettingValue(a,t,u.key),E=t[u.key],S=typeof E=="boolean"?{role:"menuitemcheckbox","aria-checked":E,"aria-label":x}:{role:"menuitem","aria-label":`${x}: ${g}`};return s.jsxs("button",{ref:L=>{o.current[d]=L},type:"button",tabIndex:-1,...S,title:`${x}: ${g}`,className:"aqmx-explorer-menu-item","data-testid":"markdown-explorer-tree-settings-item","data-aqmx-setting":u.key,onClick:()=>l(u),onKeyDown:L=>p(L,d),children:[s.jsx(m,{className:"aqmx-explorer-menu-icon","aria-hidden":"true"}),s.jsx("span",{className:"aqmx-explorer-menu-name",children:x}),s.jsx("span",{className:"aqmx-explorer-menu-value",children:g})]},u.key)})})},or=({settings:e,descriptors:t,onAdvance:n})=>{const{labels:l,announcer:c}=b.useExplorer(),[i,a]=r.useState(!1),o=r.useRef(null),f=r.useRef(null),p=r.useRef(null),u=r.useId(),d=r.useCallback(()=>{o.current?.focus(),a(!1)},[]);r.useEffect(()=>{if(!i)return;const g=E=>{E.target instanceof Node&&(o.current?.contains(E.target)===!0||f.current?.contains(E.target)===!0)||(a(!1),p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{p.current=null,(document.activeElement===null||document.activeElement===document.body)&&o.current?.focus()},0))};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[i]),r.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]);const m=r.useCallback(g=>{g.key!=="Escape"||!i||(b.consumeKey(g),d())},[i,d]),x=r.useCallback(g=>{const E=n(g.key);c.announce(l.settingAnnouncement(nt(l,g),M.formatTreeSettingValue(l,E,g.key)))},[c,l,n]);return{trigger:s.jsx("button",{ref:o,type:"button",className:"aqmx-icon-button","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?u:void 0,"aria-label":l.treeSettings,title:l.treeSettings,"data-testid":"markdown-explorer-tree-settings",onClick:()=>a(g=>!g),onKeyDown:m,children:s.jsx(Vn,{"aria-hidden":"true"})}),menu:i?s.jsx(ar,{ref:f,id:u,settings:e,descriptors:t,onAdvance:x,onClose:d}):null}},sr=()=>{const{treeSettings:e}=b.useExplorer();return{settings:r.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot),advance:e.advance}},$e=new Set,cr='[role="tree"] [role="treeitem"][tabindex="0"]',ir="[data-directory-tree-tab-stop]",ur=e=>{const{mode:t,sourceId:n,currentPath:l,openPaths:c,onOpenDocument:i,onSourceChange:a,onRevealSource:o,viewSwitch:f}=e,{labels:p,sources:u,trees:d,documents:m,announcer:x,reveals:g}=b.useExplorer(),{settings:E,advance:S}=sr(),L=r.useMemo(()=>M.visibleTreeSettingDescriptors(t==="tree"),[t]),k=t==="tree"&&E.selectionMode==="multiple";qn(k);const y=e.mode==="tree"?e.tray.onGatheredChange:null,F=e.mode==="tree"?e.onOpenSelection:void 0,P=e.mode==="tree"?e.onOpenFolder:null,C=e.mode==="tree"&&e.currentFolder,O=r.useMemo(()=>P===null?null:{current:l,open:P},[P,l]),j=e.mode==="tree"&&k?e.tray.gathered:be,v=r.useCallback(N=>{const D=S(N);return D.selectionMode!=="multiple"&&y?.(be),D},[S,y]),R=or({settings:E,descriptors:L,onAdvance:v}),q=r.useCallback(N=>y?.(D=>Nn(D,N)),[y]),_=r.useCallback(N=>y?.(D=>An(D,N)),[y]),I=r.useCallback(()=>y?.(be),[y]),$=r.useRef(null),le=r.useCallback(()=>{const N=$.current;if(N===null)return;[cr,ir,'[data-testid="markdown-explorer-tree-settings"]'].map(Z=>N.querySelector(Z)).find(Z=>Z!==null)?.focus()},[]),Q=r.useMemo(()=>new Set(j.keys()),[j]),J=r.useMemo(()=>l===null?$e:new Set([l]),[l]),U=r.useMemo(()=>{if(t==="multi")return{mode:"multiple",items:c,shownPath:null,onChange:null};switch(E.selectionMode){case"single":return{mode:"single",items:J,shownPath:l,onChange:null};case"multiple":return{mode:"multiple",items:Q,shownPath:l,onChange:q};case"none":return{mode:"none",items:$e,shownPath:null,onChange:null}}},[t,c,E.selectionMode,J,l,Q,q]),z=r.useMemo(()=>E.revealDocument?{path:l,openFolders:!C}:{path:U.shownPath,openFolders:!1},[E.revealDocument,l,C,U.shownPath]),ee=r.useCallback(N=>{l!==null&&g.settle(l),a(N)},[l,g,a]),[A,te]=r.useState(null),[W,ae]=r.useState(!1),[ne,fe]=r.useState(null),oe=r.useRef(!1),me=r.useCallback(async()=>{if(!oe.current){oe.current=!0,ae(!0),fe(null);try{const N=await d.refresh(n);if(N.status==="superseded")return;m.invalidate(),N.status==="failed"?fe({sourceId:n,failure:N.failure}):x.announce(p.treeRefreshed)}finally{oe.current=!1,ae(!1)}}},[d,m,n,x,p]),pe=A===null?null:A.expandAll,B=A?.expanding===!0,se=u.find(N=>N.id===n),he=f.target==="multi"?Nt:jt,ce=f.target==="multi"?p.switchToMulti:p.switchToTree;return s.jsxs("nav",{ref:$,"aria-label":p.explorerRegion,className:"aqmx-explorer","data-testid":"markdown-explorer-explorer","data-aqmx-mode":t,children:[s.jsxs("div",{className:"aqmx-explorer-header",children:[u.length>1?s.jsx("select",{className:"aqmx-explorer-source","aria-label":p.sourceLabel,title:se?.label,value:n,onChange:N=>ee(N.currentTarget.value),"data-testid":"markdown-explorer-source-select",children:u.map(N=>s.jsx("option",{value:N.id,children:N.label},N.id))}):null,s.jsxs("div",{className:"aqmx-explorer-actions",children:[s.jsx(b.ExplorerLink,{to:f.href,navigation:"switch-view",className:"aqmx-icon-button","aria-label":ce,title:ce,"data-testid":"markdown-explorer-view-switch","data-aqmx-target":f.target,children:s.jsx(he,{"aria-hidden":"true"})}),s.jsxs("button",{type:"button",className:"aqmx-icon-button aqmx-labelled-button",title:p.refreshTree,"aria-disabled":W,"aria-busy":W,"data-aqmx-busy":W?"true":void 0,"data-testid":"markdown-explorer-refresh",onClick:()=>{me()},children:[s.jsx(b.ForwardRef,{"aria-hidden":"true"}),s.jsx("span",{children:p.refreshTreeLabel})]}),s.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":p.expandAll,title:p.expandAll,"aria-disabled":pe===null||B,"aria-busy":B,"data-aqmx-busy":B?"true":void 0,"data-testid":"markdown-explorer-expand-all",onClick:()=>pe?.(),children:s.jsx(Tt,{"aria-hidden":"true"})}),s.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":p.collapseAll,title:p.collapseAll,"aria-disabled":A===null,"data-testid":"markdown-explorer-collapse-all",onClick:()=>A?.collapseAll(),children:s.jsx(Ct,{"aria-hidden":"true"})}),R.trigger]})]}),s.jsxs("div",{className:"aqmx-explorer-body","data-aqmx-explorer-body":"",children:[ne!==null&&ne.sourceId===n?s.jsx("p",{role:"alert",className:"aqmx-explorer-refresh-failure","data-testid":"markdown-explorer-refresh-failure","data-aqmx-failure":ne.failure.reason,children:p.treeRefreshFailed(b.failureTitleOf(p,ne.failure.reason))}):null,s.jsx(r.Suspense,{fallback:null,children:s.jsx(At,{})}),s.jsx(Ln,{mode:t,sourceId:n,settings:E,reveal:z,openPaths:c,selection:U,onOpenDocument:i,folders:O,onRevealSource:o,onControls:te},n),k&&j.size>0?s.jsx(On,{selection:j,onRemove:_,onClear:I,onOpenSelection:F,onLeave:le}):null,R.menu]})]})};function dr({title:e,titleId:t,...n},l){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},n),e?h.createElement("title",{id:t},e):null,h.createElement("path",{fillRule:"evenodd",d:"M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const rt=h.forwardRef(dr),fr=({explorer:e,toggleRef:t,covered:n,merged:l,onNoticeSlotChange:c,dismissals:i})=>{const{labels:a}=b.useExplorer(),o=Rt.useLocation(),{location:f}=b.useExplorerLocation(),[p,u]=r.useState(!1),[d,m]=r.useState({navigated:o,source:f.source}),[x,g]=r.useState(!1);d.navigated!==o&&(m({navigated:o,source:f.source}),d.source===f.source&&!x&&u(!1));const[E,S]=r.useState(i);E!==i&&(S(i),u(!1));const L=r.useRef(null),k=r.useRef(null),y=r.useRef(null),F=r.useRef(!1),P=r.useId();r.useLayoutEffect(()=>{const R=L.current;R!==null&&(p&&!R.open?(R.showModal(),k.current?.focus()):!p&&R.open&&(R.close(),t.current?.focus()),c(p?y.current:null))},[p,t,c]),r.useLayoutEffect(()=>()=>c(null),[c]);const C=r.useCallback(R=>{R.key!=="Escape"||R.defaultPrevented||(b.consumeKey(R),u(!1))},[]),O=r.useCallback(R=>{F.current=R.target===R.currentTarget},[]),j=r.useCallback(R=>{const q=F.current;F.current=!1,q&&R.target===R.currentTarget&&u(!1)},[]),v=r.useCallback(()=>{u(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"aqmx-sheet-bar",inert:n,"data-testid":"markdown-explorer-sheet-bar","data-aqmx-sheet-bar-merged":l?"true":"false",children:s.jsxs("button",{ref:t,type:"button",className:"aqmx-explorer-toggle",title:l?a.showExplorer:void 0,"aria-haspopup":"dialog","aria-expanded":p,"aria-controls":P,"data-testid":"markdown-explorer-sheet-toggle",onClick:()=>u(!0),children:[s.jsx(rt,{"aria-hidden":"true"}),s.jsx("span",{className:l?"aqmx-sr-only":void 0,children:a.showExplorer})]})}),s.jsx("dialog",{ref:L,id:P,className:"aqmx-sheet","aria-label":a.explorerRegion,"data-testid":"markdown-explorer-sheet",onKeyDown:C,onPointerDown:O,onClick:j,onClose:v,children:s.jsxs("div",{className:"aqmx-sheet-panel",children:[s.jsxs("div",{className:"aqmx-explorer-chrome",children:[s.jsx("div",{ref:y,className:"aqmx-sheet-notice-slot"}),s.jsx("button",{ref:k,type:"button",className:"aqmx-explorer-close","aria-label":a.hideExplorer,title:a.hideExplorer,"data-testid":"markdown-explorer-sheet-close",onClick:()=>u(!1),children:s.jsx(Le,{"aria-hidden":"true"})})]}),s.jsx("div",{className:"aqmx-sheet-body",children:s.jsx(Te,{value:p,children:s.jsx(tt,{value:g,children:e})})}),s.jsx(b.LiveRegion,{holds:p,testId:"markdown-explorer-sheet-announcer"})]})})]})},lt=r.createContext(null),je="aqmx-explorer",at="aqmx-content",Oe='[role="tree"] [role="treeitem"]',pr=`${Oe}[tabindex="0"]`,mr="[data-directory-tree-tab-stop]",hr=(e,t)=>{for(const n of e.querySelectorAll(`[data-panel-id="${je}"] ${Oe}`))if(n.getAttribute(re)===t)return n;return null},ze=(e,t)=>({inlineSize:e>0?e:null,rootFontPixels:t>0?t:M.ASSUMED_ROOT_FONT_PIXELS}),xr=(e,t)=>{const[n,l]=r.useState(()=>ze(0,0));return r.useLayoutEffect(()=>{const c=e.current,i=t.current;if(c===null||i===null)throw new Error("[markdown-explorer] the split frame is not mounted");const a={frame:c.getBoundingClientRect().width,rem:i.getBoundingClientRect().width},o=()=>{const p=ze(a.frame,a.rem);l(u=>u.inlineSize===p.inlineSize&&u.rootFontPixels===p.rootFontPixels?u:p)};o();const f=new ResizeObserver(p=>{for(const u of p){const[d]=u.borderBoxSize;d!==void 0&&(u.target===c&&(a.frame=d.inlineSize),u.target===i&&(a.rem=d.inlineSize))}o()});return f.observe(c),f.observe(i),()=>f.disconnect()},[e,t]),n},ot=e=>`aqmx-split-handle-${e}`,wr=(e,{frameRef:t,sheetToggleRef:n,railToggleRef:l,closeButtonRef:c,handleId:i})=>{const a=r.useRef(!1),o=r.useRef(null),f=r.useRef(!1);r.useLayoutEffect(()=>{const u=t.current;if(u===null)throw new Error("[markdown-explorer] the split frame is not mounted");const d=x=>{const g=x.target instanceof Element?x.target:null;a.current=g!==null&&g.closest(`[data-panel-id="${at}"]`)===null,!f.current&&(o.current=g?.closest(`${Oe}[${re}]`)?.getAttribute(re)??null)},m=x=>{x.relatedTarget instanceof Node&&!u.contains(x.relatedTarget)&&(a.current=!1)};return u.addEventListener("focusin",d),u.addEventListener("focusout",m),()=>{u.removeEventListener("focusin",d),u.removeEventListener("focusout",m)}},[t]);const p=r.useRef(e);r.useLayoutEffect(()=>{const u=p.current;if(u===e)return;p.current=e;const d=t.current;if(d===null||!a.current)return;const m=x=>{const{activeElement:g,body:E}=d.ownerDocument;if(g!==null&&g!==E)return;const S=x.find(L=>L!==null);if(S!=null){f.current=!0;try{S.focus()}finally{f.current=!1}}};if(e==="sheet"){m([n.current]);return}if(e==="rail"){m([l.current]);return}if(u==="rail"){m([c.current]);return}queueMicrotask(()=>{if(p.current!==e||!a.current)return;const x=o.current,g=`[data-panel-id="${je}"]`;m([x===null?null:hr(d,x),d.querySelector(`${g} ${pr}`),d.querySelector(`${g} ${mr}`),d.querySelector(`[data-resize-handle-id="${i}"]`)])})},[e,t,n,l,c,i])},gr=e=>e==="tree"?"treeExplorerHidden":"multiExplorerHidden",Er=({view:e,explorer:t,content:n,contentCoversPage:l=!1,sheetDismissals:c=0,onDraggingChange:i})=>{const{viewSettings:a}=b.useExplorer(),o=r.useRef(null),[f,p]=r.useState(null),u=r.useRef(null),d=r.useRef(null),m=r.useRef(null),x=r.useRef(null),{inlineSize:g,rootFontPixels:E}=xr(o,u),S=gr(e),L=b.useViewSetting(R=>R[S]===!0),k=g!==null&&g<M.explorerSheetBelowPixels(E),y=k?"sheet":L?"rail":"split";wr(y,{frameRef:o,sheetToggleRef:d,railToggleRef:m,closeButtonRef:x,handleId:ot(e)});const F=r.useCallback(()=>a.update({[S]:!0}),[a,S]),P=r.useCallback(()=>a.update({[S]:!1}),[a,S]),[C,O]=r.useState(!1),j=r.useMemo(()=>k?{lane:!l,onBar:O}:null,[k,l]),[v]=r.useState(()=>new Map);return s.jsx(Ke,{value:v,children:s.jsxs("div",{ref:o,className:"aqmx-split-frame","data-aqmx-explorer-mode":y,"data-aqmx-measured":g===null?"false":"true","data-aqmx-content-covers-page":l?"true":"false",children:[s.jsx("span",{ref:u,className:"aqmx-rem-probe","aria-hidden":"true","data-aqmx-rem-probe":""}),k?s.jsx(fr,{explorer:t,toggleRef:d,covered:l,merged:C,onNoticeSlotChange:p,dismissals:c}):null,s.jsxs("div",{className:"aqmx-split-row",children:[y==="rail"?s.jsx(br,{toggleRef:m,covered:l,onOpen:P}):null,s.jsx(lt,{value:k?f:null,children:s.jsx(b.SheetBarContext,{value:j,children:s.jsx(vr,{view:e,mode:y,explorer:t,content:n,contentCoversPage:l,onDraggingChange:i,explorerMinPixels:M.explorerMinPixels(E),closeButtonRef:x,onHide:F})})})]})]})})},br=({toggleRef:e,covered:t,onOpen:n})=>{const{labels:l}=b.useExplorer();return s.jsx("div",{className:"aqmx-split-rail",inert:t,"data-testid":"markdown-explorer-rail",children:s.jsx("button",{ref:e,type:"button",className:"aqmx-explorer-toggle","aria-expanded":!1,"aria-label":l.showExplorer,title:l.showExplorer,"data-testid":"markdown-explorer-rail-toggle",onClick:n,children:s.jsx(rt,{"aria-hidden":"true"})})})},vr=({view:e,mode:t,explorer:n,content:l,contentCoversPage:c,onDraggingChange:i,explorerMinPixels:a,closeButtonRef:o,onHide:f})=>{const{viewSettings:p,labels:u}=b.useExplorer(),m=b.useViewSetting(v=>e==="tree"?v.treeExplorer:v.multiExplorer)??(e==="tree"?M.EXPLORER_DEFAULT_PERCENT:M.EXPLORER_MULTI_DEFAULT_PERCENT),x=r.useRef(!1),[g,E]=r.useState(!1),S=r.useRef(!1),L=r.useRef(i);r.useLayoutEffect(()=>{L.current=i},[i]);const k=vt.useSplitPersistence(r.useCallback(v=>{if(v.length!==2)return;const[R=0,q=0]=v,_=R+q;if(_<=0||R<=0)return;const I=Math.min(M.EXPLORER_MAX_PERCENT,R/_*100);p.update(e==="tree"?{treeExplorer:I}:{multiExplorer:I})},[p,e]));r.useEffect(()=>()=>{x.current&&L.current?.(!1)},[]);const F=b.useCoarsePointer()?M.COARSE_TARGET_PIXELS:M.FINE_TARGET_PIXELS,P=t==="split",C=r.useCallback(()=>{S.current=!1,E(!1),f()},[f]),O=r.useCallback((v,R)=>{const[q=0,_=0]=v;v.length===2&&_>0&&(S.current=q<=0,E(S.current)),k.layoutChanged(v,R),S.current&&R.source==="keyboard"&&C()},[k,C]),j=r.useCallback(v=>{x.current=v,i?.(v),k.draggingChanged(v),!v&&S.current&&C()},[i,k,C]);return s.jsxs(Ee.PanelGroup,{id:`aqmx-split-${e}`,direction:"horizontal",onLayout:O,className:"aqmx-split","data-aqmx-split":e,children:[P?s.jsxs(Ee.Panel,{id:je,defaultSize:{value:m,unit:"percentage"},minSize:{value:a,unit:"pixels"},maxSize:{value:M.EXPLORER_MAX_PERCENT,unit:"percentage"},collapsible:{from:"end"},pixelAdjustPriority:1,inert:c,className:"aqmx-split-explorer",children:[s.jsx("div",{className:"aqmx-explorer-chrome",children:s.jsx("button",{ref:o,type:"button",className:"aqmx-explorer-close","aria-label":u.hideExplorer,title:u.hideExplorer,"data-testid":"markdown-explorer-split-close",onClick:C,children:s.jsx(Le,{"aria-hidden":"true"})})}),s.jsx(Te,{value:!g,children:n})]}):null,P?s.jsx(Ee.PanelResizeHandle,{id:ot(e),thickness:F,indicator:{visible:!0,thickness:M.SPLIT_HANDLE_PIXELS.gripThickness,length:M.SPLIT_HANDLE_PIXELS.gripLength,barThickness:M.SPLIT_HANDLE_PIXELS.barThickness,barLength:M.SPLIT_HANDLE_PIXELS.barLength},title:u.resizeExplorer,"aria-label":u.resizeExplorer,onDragging:j,inert:c,className:"aqmx-split-handle"}):null,s.jsx(Ee.Panel,{id:at,defaultSize:{value:P?100-m:100,unit:"percentage"},contentOverflow:"hidden",className:"aqmx-split-content",...c?{style:{isolation:"auto"}}:{},children:l})]})};exports.EMPTY_SELECTION=be;exports.ExplorerPane=ur;exports.ExplorerSplit=Er;exports.SheetNoticeSlotContext=lt;
|