@aiquants/markdown-explorer 0.1.0 → 0.2.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.md +31 -13
  3. package/dist/{ExplorerSplit-BESGFcu6.cjs → ExplorerSplit-D2plJRRe.cjs} +1 -1
  4. package/dist/{ExplorerSplit-DwEFmvQM.js → ExplorerSplit-DB37U7Kh.js} +3 -3
  5. package/dist/MultiLayout-DCPDu1-l.js +909 -0
  6. package/dist/MultiLayout-UyWxs6Xy.cjs +1 -0
  7. package/dist/TreeLayout-BoyFelK2.js +22 -0
  8. package/dist/TreeLayout-CLWbWjOc.cjs +1 -0
  9. package/dist/core/config.d.cts +6 -0
  10. package/dist/core/config.d.ts +6 -0
  11. package/dist/core/labels.d.cts +6 -1
  12. package/dist/core/labels.d.ts +6 -1
  13. package/dist/{index-BgkZ9ATV.js → index-BfuAu2GV.js} +947 -901
  14. package/dist/index-Cx3-jSna.cjs +3 -0
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +2 -2
  17. package/dist/location-Oo21lTyV.cjs +1 -0
  18. package/dist/{location-Cb2Ak55B.js → location-fVl2R1ee.js} +154 -141
  19. package/dist/sanitizeWorker.cjs +1 -1
  20. package/dist/sanitizeWorker.js +196 -206
  21. package/dist/server.cjs +1 -1
  22. package/dist/server.js +1 -1
  23. package/dist/styles/markdown-explorer.css +1 -1
  24. package/docs/behavior/dom-hooks.md +4 -4
  25. package/docs/behavior/layout.md +21 -9
  26. package/docs/behavior/localization.md +4 -3
  27. package/docs/behavior/security.md +7 -3
  28. package/docs/behavior/url-contract.md +8 -2
  29. package/package.json +5 -5
  30. package/dist/MultiLayout-DxPiARsv.js +0 -896
  31. package/dist/MultiLayout-r_qx1Mfz.cjs +0 -1
  32. package/dist/TreeLayout-9-20bbSM.cjs +0 -1
  33. package/dist/TreeLayout-CW7lgV_e.js +0 -19
  34. package/dist/index-y9tVvDW7.cjs +0 -3
  35. package/dist/location-DWHQYntR.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react/jsx-runtime"),u=require("react"),F=require("./location-DWHQYntR.cjs"),q=require("./index-y9tVvDW7.cjs"),ne=require("./ExplorerSplit-BESGFcu6.cjs"),k=require("@aiquants/drag-drop-panels"),Ee=require("./dataRoute-CKbdwkQ7.cjs"),de=require("react-router"),Z=require("./storage-Bkb2Axdi.cjs"),ze=require("react-dom"),He=0xcbf29ce484222325n,qe=0x100000001b3n,Fe=(1n<<64n)-1n,je=(1n<<53n)-1n,Be=new TextEncoder,Ve=e=>{let n=He;for(const t of Be.encode(e))n=(n^BigInt(t))*qe&Fe;return Number(n&je)},J=256,$e=e=>`aqmx-p-${Ve(e).toString(36)}`,be=(e,n)=>{const t=$e(e);let o=t;for(let r=2;n.has(o);r+=1)o=`${t}-${String(r)}`;return o},Ue=new Map,Ge=(e,n=Ue)=>{const t=new Set(e.flatMap(r=>n.get(r)??[])),o=new Map;for(const r of e){const s=n.get(r)??be(r,t);t.add(s),o.set(r,s)}return o},Ce=(e,n,t)=>{const o=e.columnOf.get(n);return o===void 0?void 0:Math.min(t-1,Math.max(0,o))},Oe=(e,n)=>{const[t,...o]=F.columnGroups(n.logical,n.visible);if(t===void 0)throw new RangeError("[markdown-explorer] there must be at least one visible column");const r=([d,g])=>e.slice(d,g).reduce((i,p)=>i+p.length,0);let s=t;for(const d of o)r(d)<r(s)&&(s=d);let l=s[0];for(let d=s[0];d<s[1];d+=1)(e[d]?.length??0)<(e[l]?.length??0)&&(l=d);return l},X=(e,n)=>{const t=Array.from({length:n.logical},()=>[]),o=[];for(const r of e.docs){const s=Ce(e,r,n.logical);s===void 0?o.push(r):t[s]?.push(r)}for(const r of o)t[Oe(t,n)]?.push(r);return t},We=(e,n)=>F.columnGroups(e.length,n).map(([t,o])=>e.slice(t,o).flat()),Ye=(e,n,t)=>{const[o,r]=n,s=r-o,l=e.length,d=Array.from({length:s},(m,h)=>{const c=[0];for(const w of e)c.push((c.at(-1)??0)+(t(w)===o+h?1:0));return c}),g=(m,h,c)=>(d[m]?.[c]??0)-(d[m]?.[h]??0),i=Array.from({length:s+1},()=>Array.from({length:l+1},()=>Number.NEGATIVE_INFINITY)),p=Array.from({length:s+1},()=>Array.from({length:l+1},()=>0)),S=i[0];S&&(S[0]=0);for(let m=0;m<s;m+=1)for(let h=0;h<=l;h+=1)for(let c=0;c<=h;c+=1){const w=(i[m]?.[c]??Number.NEGATIVE_INFINITY)+g(m,c,h),P=i[m+1],T=p[m+1];P&&T&&w>(P[h]??Number.NEGATIVE_INFINITY)&&(P[h]=w,T[h]=c)}const O=Array.from({length:s},()=>[]);let C=l;for(let m=s;m>0;m-=1){const h=p[m]?.[C]??0;O[m-1]=e.slice(h,C),C=h}return O},Me=(e,n)=>{const t=n.flat(),o=new Map(e.columnOf);for(const[r,s]of n.entries())for(const l of s)o.delete(l),o.set(l,r);for(const r of o.keys()){if(o.size<=J)break;o.delete(r)}return{docs:t,columnOf:o}},Ke=(e,n,t,o)=>{if(e.docs.includes(n))return{state:e,outcome:"existing"};if(e.docs.length>=o)return{state:e,outcome:"rejected"};const r=X(e,t),s=Ce(e,n,t.logical)??Oe(r,t);r[s]?.push(n);const l=new Map(e.panelIds);return l.set(n,be(n,new Set(l.values()))),{state:{...e,...Me(e,r),panelIds:l},outcome:"opened"}},Pe=(e,n)=>{if(!e.docs.includes(n))return e;const t=new Set(e.hidden);t.delete(n);const o=new Map(e.panelIds);return o.delete(n),{...e,docs:e.docs.filter(r=>r!==n),hidden:t,panelIds:o,maximized:e.maximized===n?null:e.maximized}},Je=(e,n,t,o)=>{if(e.hidden.has(n))return{state:Le(e,n,!1),outcome:"shown"};if(e.docs.includes(n))return{state:Pe(e,n),outcome:"closed"};const r=Ke(e,n,t,o);return{state:r.state,outcome:r.outcome==="rejected"?"rejected":"opened"}},Xe=(e,n,t)=>{if(n===t||!e.docs.includes(n))return{state:e,outcome:"ignored"};if(e.docs.includes(t))return{state:e,outcome:"existing"};const o=new Map(e.columnOf),r=o.get(n);r!==void 0&&(o.delete(t),o.set(t,r));const s=new Set(e.hidden);s.delete(n);const l=new Map(e.panelIds),d=l.get(n);if(d===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);return l.delete(n),l.set(t,d),{state:{docs:e.docs.map(g=>g===n?t:g),maximized:e.maximized===n?t:e.maximized,columnOf:o,hidden:s,panelIds:l},outcome:"navigated"}},Le=(e,n,t)=>{if(!e.docs.includes(n)||e.hidden.has(n)===t)return e;const o=new Set(e.hidden);return t?o.add(n):o.delete(n),{...e,hidden:o,maximized:t&&e.maximized===n?null:e.maximized}},Ze=(e,n)=>{if(e.maximized===n||n!==null&&!e.docs.includes(n))return e;if(n===null||!e.hidden.has(n))return{...e,maximized:n};const t=new Set(e.hidden);return t.delete(n),{...e,maximized:n,hidden:t}},Qe=(e,n,t)=>{const o=X(e,t),r=new Map;for(const[i,p]of o.entries())for(const S of p)r.set(S,i);const s=new Set(e.docs),l=new Set,d=F.columnGroups(t.logical,t.visible),g=Array.from({length:t.logical},()=>[]);for(const[i,p]of d.entries()){const S=(n[i]??[]).filter(O=>s.has(O)&&!l.has(O));for(const O of S)l.add(O);for(const[O,C]of Ye(S,p,m=>r.get(m)).entries())g[p[0]+O]?.push(...C)}for(const i of e.docs)l.has(i)||g[r.get(i)??0]?.push(i);return g.every((i,p)=>i.length===o[p]?.length&&i.every((S,O)=>o[p]?.[O]===S))?e:{...e,...Me(e,g)}},Q=(e,n)=>{const t=[...new Set(e.docs)].slice(0,n),o=new Set(t),r=e.maximized!==null&&o.has(e.maximized)?e.maximized:null;return{docs:t,maximized:r,columnOf:e.stored.columnOf,hidden:new Set([...e.stored.hidden].filter(s=>o.has(s)&&s!==r)),panelIds:Ge(t,e.panelIds)}},me=(e,n)=>{if(e.docs.every(o=>e.columnOf.has(o)))return e;const t=new Map(e.columnOf);for(const[o,r]of X(e,n).entries())for(const s of r)t.delete(s),t.set(s,o);for(const o of t.keys()){if(t.size<=J)break;t.delete(o)}return{...e,columnOf:t}},Ie=1,B=Object.freeze({columnOf:new Map,hidden:new Set}),en=(e,n)=>{if(e===null||e==="")return B;let t;try{t=JSON.parse(e)}catch{return B}if(t===null||typeof t!="object"||Array.isArray(t))return B;const o=t;if(o.v!==Ie)return B;const r=new Map;if(Array.isArray(o.columnOf))for(const l of o.columnOf.slice(-J))Array.isArray(l)&&l.length===2&&typeof l[0]=="string"&&l[0]!==""&&Number.isInteger(l[1])&&l[1]>=0&&l[1]<n&&(r.delete(l[0]),r.set(l[0],l[1]));const s=new Set(Array.isArray(o.hidden)?o.hidden.filter(l=>typeof l=="string"&&l!==""):[]);return{columnOf:r,hidden:s}},nn=e=>JSON.stringify({v:Ie,columnOf:[...e.columnOf.entries()].slice(-J),hidden:e.docs.filter(n=>e.hidden.has(n))}),oe=(e,n)=>{const t=e.get(n);return t===void 0?Ee.lastPathSegment(n):t},U=e=>{const n=new Map;for(const[t,o]of e.panelIds)n.set(o,t);return n},fe=e=>{if(!Ee.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0,80))}`)},tn=({config:e,location:n,writeUrl:t,persist:o})=>{const{maxPanels:r,columns:s}=e.multiView,l=q.createEmitter(),d=new Map,g=new Map;let i={layout:Q({docs:n.docs,maximized:n.maximized,stored:B},r),source:n.source,visibleColumns:s,ready:!1,splitDragging:!1,titles:new Map,pendingHashes:new Map},p=!1;const S=a=>p?me(a,{logical:s,visible:i.visibleColumns}):a,O=(a,y)=>F.explorerHref(e,{view:"multi",source:a,docs:y.docs,maximized:y.maximized});let C=O(n.source,n),m=n.source,h=C;const c=[],w=[];let P=null;const T=()=>{if(!(c.length>0))for(const a of w.splice(0))a()},f=a=>{i={...i,...a},l.emit()},E=()=>{if(!i.ready)return;const a=nn(i.layout);a!==P&&(P=a,o(a))},v=(a,y,M)=>{const R=O(a,y);R!==C&&(C=R,m=a,c.push(R),t(R,M))},L=a=>{const y=new Set(a.panelIds.values());for(const b of[...d.keys()])y.has(b)||d.delete(b);for(const b of[...g.keys()])y.has(b)||g.delete(b);const M=new Set(a.docs),R=[...i.titles.keys()].every(b=>M.has(b))?i.titles:new Map([...i.titles].filter(([b])=>M.has(b))),x=[...i.pendingHashes.keys()].every(b=>y.has(b))?i.pendingHashes:new Map([...i.pendingHashes].filter(([b])=>y.has(b)));return{titles:R,pendingHashes:x}},N=a=>a===i.layout?!1:(f({layout:a,...L(a)}),v(m,a,"replace"),E(),!0),_=()=>({logical:s,visible:i.visibleColumns});return{getSnapshot:()=>i,subscribe:l.subscribe,toggle:a=>{fe(a);const{state:y,outcome:M}=Je(i.layout,a,_(),r);return N(y),M},close:a=>N(Pe(i.layout,a)),navigate:(a,y)=>{fe(y);const{state:M,outcome:R}=Xe(i.layout,a,y);if(R!=="navigated")return R;const x=M.panelIds.get(y);return x!==void 0&&(d.delete(x),g.delete(x)),N(M),R},setHidden:(a,y)=>N(Le(i.layout,a,y)),maximize:a=>N(Ze(i.layout,a)),arrange:a=>N(Qe(i.layout,a,{logical:s,visible:a.length})),changeSource:a=>{v(a,i.layout,"push")},observeLocation:a=>{const y=O(a.source,a);if(y===C)return c.length=0,h=y,a.source!==i.source&&f({source:a.source}),T(),!1;if(y===h)return!1;h=y;const M=c.indexOf(y);if(M>=0)return c.splice(0,M+1),a.source!==i.source&&f({source:a.source}),T(),!1;c.length=0,C=y,m=a.source;const R=S(Q({docs:a.docs,maximized:a.maximized,stored:{columnOf:i.layout.columnOf,hidden:i.layout.hidden},panelIds:i.layout.panelIds},r));return f({layout:R,source:a.source,...L(R)}),E(),T(),!0},whenUrlRendered:a=>{w.push(a),T()},loadStored:a=>{f({layout:S(Q({docs:i.layout.docs,maximized:i.layout.maximized,stored:a,panelIds:i.layout.panelIds},r)),ready:!0}),E()},setVisibleColumns:a=>{if(!Number.isInteger(a)||a<1||a>s)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(s)}; got ${String(a)}`);p=!0;const y=me(i.layout,{logical:s,visible:a});a===i.visibleColumns&&y===i.layout||(f({visibleColumns:a,layout:y}),y!==i.layout&&E())},setSplitDragging:a=>{a!==i.splitDragging&&f({splitDragging:a})},setTitle:(a,y)=>{!i.layout.docs.includes(a)||i.titles.get(a)===y||f({titles:new Map(i.titles).set(a,y)})},titleOf:a=>oe(i.titles,a),setPendingHash:(a,y)=>{const M=i.pendingHashes.get(a);if(y===null||y===""){if(M===void 0)return;const R=new Map(i.pendingHashes);R.delete(a),f({pendingHashes:R});return}M!==y&&f({pendingHashes:new Map(i.pendingHashes).set(a,y)})},saveReadingPosition:(a,y,M)=>{i.layout.panelIds.get(y)===a&&d.set(a,{doc:y,position:M})},readingPositionOf:(a,y)=>{const M=d.get(a);return M===void 0||M.doc!==y?null:M.position},saveImageView:(a,y,M)=>{g.set(a,{url:y,state:M})},imageViewOf:(a,y)=>{const M=g.get(a);return M===void 0||M.url!==y?null:M.state}}},on=()=>{const e=new Map;return{hold:(n,t)=>{e.set(n,t),queueMicrotask(()=>{e.get(n)===t&&e.delete(n)})},take:n=>{const t=e.get(n);return e.delete(n),t===void 0?null:t}}},Ne=u.createContext(null),re=()=>{const e=u.use(Ne);if(e===null)throw new Error("[markdown-explorer] multi-view panels must be rendered inside the multi-view stage");return e},rn=(e,n)=>{const t=e.pendingHashes.get(n);return t===void 0?null:t},se="data-aqmx-column-probe",W="data-panel-id",te="--aqmx-multi-panel-chrome",j=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,sn=e=>e==="normal"?0:j(e),ln=(e,n)=>{const t=e.querySelector(k.SCROLL_ROOT_SELECTOR)?.firstElementChild,o=e.querySelector(`[${se}]`),r=o instanceof HTMLElement?o.getBoundingClientRect().width:Number.NaN;if(!(t instanceof HTMLElement))return{plan:{trackInlineSize:Number.NaN,gap:Number.NaN,minColumnInlineSize:r,logicalColumns:n},stageBlockSize:Number.NaN};const s=getComputedStyle(t),l=t.clientWidth-j(s.paddingLeft)-j(s.paddingRight),d=t.clientHeight-j(s.paddingTop)-j(s.paddingBottom);return{plan:{trackInlineSize:l,gap:sn(s.columnGap),minColumnInlineSize:r,logicalColumns:n},stageBlockSize:d}},an=(e,n)=>{if(e.getClientRects().length===0)return Number.NaN;const t=getComputedStyle(e);return n.getBoundingClientRect().top-e.getBoundingClientRect().top+j(t.paddingBottom)+j(t.borderBottomWidth)},A=(e,n)=>{const t=()=>n(e.getSnapshot());return u.useSyncExternalStore(e.subscribe,t,t)},cn=e=>{const{config:n,storageNamespace:t}=q.useExplorer(),o=de.useNavigate(),r=u.useRef(o),s=Z.storageKeys(t).multiLayout,[l]=u.useState(()=>tn({config:n,location:e,writeUrl:(i,p)=>{r.current(i,q.explorerNavigationOptions(p==="replace"?"browse":"switch-source"))},persist:i=>Z.writeStorage(s,i)}));u.useLayoutEffect(()=>{r.current=o},[o]);const d=de.useLocation(),g=u.useMemo(()=>({location:e,navigated:d}),[e,d]);return u.useLayoutEffect(()=>{l.observeLocation(g.location)},[l,g]),u.useLayoutEffect(()=>{l.loadStored(en(Z.readStorage(s),n.multiView.columns))},[l,s,n]),l},Te="[data-aqdd-scroll-area]",Y="data-aqmx-panel-frame",un=e=>{const{docPath:n,panelId:t}=e;if(typeof n!="string"||typeof t!="string")throw new TypeError("[markdown-explorer] a multi-view panel needs string docPath and panelId props");return{docPath:n,panelId:t}},dn=e=>{const n=getComputedStyle(e),t=Number.parseFloat(n.lineHeight);return Number.isFinite(t)?t:Number.parseFloat(n.fontSize)},mn=(e,n,t)=>e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*n.clientHeight:e.deltaMode!==WheelEvent.DOM_DELTA_LINE?e.deltaY:e.deltaY*t(n),V=e=>{const n=e.closest(Te);return n instanceof HTMLElement?n:null},pe=(e,n)=>{let t=0,o=e.length;for(;t<o;){const r=t+o>>>1;(e[r]?.getBoundingClientRect().bottom??Number.NEGATIVE_INFINITY)>n?o=r:t=r+1}return t<e.length?t:-1},fn=(e,n)=>{const t=n.getBoundingClientRect().top,o=[];let r=e;for(let s=pe([...r.children],t);s>=0;s=pe([...r.children],t)){const l=r.children[s];if(l===void 0)break;o.push(s),r=l}return{scrollTop:n.scrollTop,anchor:o.length===0?null:{path:o,offset:r.getBoundingClientRect().top-t}}},ge=(e,n,t)=>{if(n.scrollTop=t.scrollTop,t.anchor===null)return;let o=e;for(const r of t.anchor.path)o=o?.children[r];o!==void 0&&(n.scrollTop+=o.getBoundingClientRect().top-n.getBoundingClientRect().top-t.anchor.offset)},pn=Object.freeze(["data-testid","aria-label","title","href","id","name"]),Re=e=>JSON.stringify([e.tagName,...pn.map(n=>e.getAttribute(n))]),gn=(e,n)=>{if(n===null||!e.contains(n))return null;const t=[];for(let o=n;o!==e;){const r=o.parentElement;if(r===null)return null;t.unshift([...r.children].indexOf(o)),o=r}return{path:t,signature:Re(n)}},hn=(e,n,t)=>{let o=e;for(const r of t.path)o=o?.children[r];o instanceof HTMLElement&&Re(o)===t.signature&&q.focusWithoutScroll(o)||n.focus({preventScroll:!0})},vn=(e,n,t)=>{if(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;const o=e.ctrlKey||e.metaKey,r=o?V(n):n.closest(k.SCROLL_ROOT_SELECTOR);if(!(r instanceof HTMLElement))return;const s=mn(e,r,t);(o||yn(r,s))&&(e.preventDefault(),r.scrollTop+=s)},yn=(e,n)=>n<0?e.scrollTop>0:n>0?Math.ceil(e.scrollTop+e.clientHeight)<e.scrollHeight:!1,wn=e=>e.scrollHeight>e.clientHeight,xn=(e,n)=>{let t=Number.NaN;const o=()=>{const l=an(e,n);!Number.isFinite(l)||l===t||(t=l,e.style.setProperty(te,`${String(l)}px`))};o();let r=null;const s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{r===null&&(r=requestAnimationFrame(()=>{r=null,o()}))});return s?.observe(e),s?.observe(n),()=>{s?.disconnect(),r!==null&&cancelAnimationFrame(r),e.style.removeProperty(te)}},Sn=e=>{const{docPath:n,panelId:t}=un(e),{store:o,Body:r,maximize:s,focusCarry:l}=re(),d=A(o,m=>m.layout.maximized===n),g=A(o,m=>oe(m.titles,n)),i=u.useRef(null),p=u.useRef(null),S=u.useRef(null);u.useEffect(()=>{const m=i.current,h=m===null?null:V(m);if(m===null||h===null||d)return;const c=new Map,w=v=>{const L=c.get(v);if(L!==void 0)return L;const N=dn(v);return c.set(v,N),N},P=v=>vn(v,m,w);let T=!1;const f=()=>{const v=wn(h);v!==T&&(T=v,v?m.addEventListener("wheel",P,{capture:!0,passive:!1}):m.removeEventListener("wheel",P,{capture:!0}))};f();const E=typeof ResizeObserver>"u"?null:new ResizeObserver(f);return E?.observe(h),E?.observe(m),()=>{E?.disconnect(),m.removeEventListener("wheel",P,{capture:!0})}},[d]),u.useLayoutEffect(()=>{const m=i.current,h=m===null?null:V(m),c=m===null?null:m.closest(`[${W}]`);if(!(h===null||!(c instanceof HTMLElement)))return xn(c,h)},[]),u.useLayoutEffect(()=>{const m=i.current,h=m===null?null:V(m);if(m===null||h===null)return;const c=o.readingPositionOf(t,n);p.current=c===null?null:{doc:n,position:c},c!==null&&ge(m,h,c);let w=null;const P=()=>{w===null&&(w=requestAnimationFrame(()=>{w=null;const T=S.current;T!==null&&o.saveReadingPosition(t,T,fn(m,h))}))};return h.addEventListener("scroll",P,{passive:!0}),()=>{h.removeEventListener("scroll",P),w!==null&&cancelAnimationFrame(w)}},[o,t,n]),u.useLayoutEffect(()=>{const m=i.current,h=m===null?null:m.closest(`[${W}]`);if(m===null||h===null)return;const c=l.take(t);return c!==null&&hn(h,m,c),()=>{const w=gn(h,h.ownerDocument.activeElement);w!==null&&l.hold(t,w)}},[l,t]);const O=u.useCallback(m=>{const h=i.current,c=h===null?null:V(h);if(h===null||c===null)return;const w=S.current;S.current=m;const P=p.current;p.current=null,P!==null&&P.doc===m?ge(h,c,P.position):w!==null&&w!==m&&(c.scrollTop=0)},[]),C=u.useCallback(()=>s(n),[s,n]);return I.jsx("div",{ref:i,role:"group","aria-label":g,className:"aqmx-multi-panel-frame",tabIndex:-1,"data-aqmx-panel-frame":t,"data-aqmx-maximized":d?"true":"false","data-testid":"markdown-explorer-panel-frame",onDoubleClick:d?void 0:C,children:I.jsx(r,{docPath:n,panelId:t,maximized:d,onContentShown:O})})},En=u.memo(Sn),bn=e=>{const n=e.closest(Te);if(n===null)throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");return n},Cn=({docPath:e,panelId:n,maximized:t,onContentShown:o})=>{const{store:r,followLink:s,revealInPanel:l}=re(),{announcer:d}=q.useExplorer(),g=A(r,c=>rn(c,n)),i=u.useCallback((c,w)=>s(n,e,c,w),[s,n,e]),p=u.useCallback(()=>r.setPendingHash(n,null),[r,n]),S=u.useMemo(()=>({read:c=>r.imageViewOf(n,c),save:(c,w)=>r.saveImageView(n,c,w)}),[r,n]),O=u.useCallback((c,w)=>{w.kind!=="failure"&&r.setTitle(c,w.name),o(c)},[r,o]),C=u.useCallback(c=>{r.whenUrlRendered(()=>d.announce(c))},[r,d]),m=u.useMemo(()=>({scrollerOf:bn,reveal:c=>l(n,c)}),[l,n]),h=u.useMemo(()=>({kind:"panel",maximized:t,onDocumentLink:i,pendingHash:g,onHashConsumed:p,announceFailure:C,paneScroll:m}),[t,i,g,p,C,m]);return I.jsx(q.ImageViewMemoryContext,{value:S,children:I.jsx(q.DocumentPane,{path:e,variant:h,onDocumentShown:O})})},he=()=>typeof HTMLElement<"u"&&typeof HTMLElement.prototype.showPopover=="function"&&typeof HTMLElement.prototype.hidePopover=="function",G=(e,n)=>{const t=e.panelIds.get(n);if(t===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);return t},ve=e=>Object.fromEntries(k.generateColumnIds(e).map(n=>[n,[]])),On=(e,n)=>{const t=We(X(e,n),n.visible);return Object.fromEntries(t.map((o,r)=>[k.generateColumnId(r),o.map(s=>G(e,s))]))},Mn=(e,n)=>{const t=U(e);return k.sortColumnIds(Object.keys(n)).map(o=>(n[o]??[]).flatMap(r=>{const s=t.get(r);return s===void 0?[]:[s]}))},Pn=e=>({switchToCustomDragMode:e.panelSwitchToCustomDrag,switchToNormalDragMode:e.panelSwitchToNormalDrag,hidePanel:e.panelHide,maximizePanel:e.panelMaximize,restorePanel:e.panelRestore,closePanel:e.panelClose,movePanelToPreviousColumn:e.panelMovePreviousColumn,movePanelToNextColumn:e.panelMoveNextColumn,movePanelUp:e.panelMoveUp,movePanelDown:e.panelMoveDown,customDragModeBadge:e.panelCustomDragBadge,panelMoved:e.panelMoved,panelMoveUnavailable:e.panelMoveUnavailable,panelDragStarted:e.panelDragStarted,panelDragCancelled:e.panelDragCancelled,hiddenPanels:e.hiddenPanelsTitle,hiddenPanelBadge:e.hiddenPanelBadge,hiddenPanelNotice:e.hiddenPanelNotice,emptyColumn:e.multiColumnEmpty,dropZone:e.multiColumnRegion,dropHere:e.panelDropHere}),le="--aqmx-stage-block",Ln="--aqmx-multi-panel-body-floor",In=`calc(var(${le}) * ${String(F.PANEL_MIN_BLOCK_RATIO)})`,Nn=`max(calc(var(${le}) * ${String(F.PANEL_MAX_BLOCK_RATIO)}), calc(var(${te}) + var(${Ln})))`,Tn=(e,n)=>{const t=Object.entries(e);return t.length!==Object.keys(n).length?!1:t.every(([o,r])=>{const s=n[o];return s!==void 0&&s.length===r.length&&s.every((l,d)=>r[d]===l)})},ye=["keydown","pointerdown","wheel","touchstart"],$=new WeakMap,we=(e,n,t)=>{for(let o=n;o!==null&&o!==t;o=o.parentElement){e.observe(o);for(let r=o.previousElementSibling;r!==null;r=r.previousElementSibling)e.observe(r)}},Rn=e=>{const n=new Map;for(let t=e.parentElement;t!==null;t=t.parentElement)n.set(t,{top:t.scrollTop,left:t.scrollLeft});return n},K=(e,n,t)=>{$.get(e)?.();const o=e.querySelector(`[${W}="${n}"]`);if(!(o instanceof HTMLElement))return;const r=t!==null&&o.contains(t)?t:null;let s=new Map;const l=()=>{if(!o.isConnected)return;o.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"});const S=r?.isConnected===!0?r:o;S!==o&&S.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"}),s=Rn(S)};if(l(),typeof ResizeObserver>"u")return;const d=new ResizeObserver(l);we(d,o,o.closest(k.SCROLL_ROOT_SELECTOR)),r!==null&&we(d,r,o);const{ownerDocument:g}=e,i=S=>{const O=S.target===g?g.scrollingElement:S.target;if(!(O instanceof Element))return;const C=s.get(O);C!==void 0&&(O.scrollTop!==C.top||O.scrollLeft!==C.left)&&p()},p=()=>{d.disconnect();for(const S of ye)g.removeEventListener(S,p,!0);g.removeEventListener("scroll",i,!0),$.get(e)===p&&$.delete(e)};for(const S of ye)g.addEventListener(S,p,{capture:!0,passive:!0});g.addEventListener("scroll",i,{capture:!0,passive:!0}),$.set(e,p)},De=(e,n)=>{const t=e.querySelector(`[${Y}="${n}"]`);return t instanceof HTMLElement?(K(e,n,null),t.focus({preventScroll:!0}),!0):!1},ie=(e,n)=>{const t=e.querySelector(`[${W}="${n}"]`);return t instanceof HTMLElement&&t.contains(e.ownerDocument.activeElement)},xe=(e,n)=>{if(!ie(e,n))return null;const t=[...e.querySelectorAll(`[${Y}]`)].map(l=>l.getAttribute(Y)),o=t.indexOf(n),r=t[o+1];if(o>=0&&typeof r=="string")return{kind:"panel",panelId:r};const s=t[o-1];return o>0&&typeof s=="string"?{kind:"panel",panelId:s}:{kind:"stage"}},Se=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&(n.kind==="panel"&&De(t,n.panelId)||t.focus({preventScroll:!0}))})},ke=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&De(t,n)})},Dn=(e,n,t)=>{requestAnimationFrame(()=>{const o=e.current;if(o===null)return;const{activeElement:r,body:s}=o.ownerDocument;if(K(o,n,t&&ie(o,n)?r:null),!t||r!==null&&r!==s&&r.isConnected)return;const l=o.querySelector(`[${Y}="${n}"]`);l instanceof HTMLElement&&l.focus({preventScroll:!0})})},kn=({store:e,stageRef:n})=>{const{config:t,labels:o,announcer:r}=q.useExplorer(),{maximize:s}=re(),l=t.multiView.columns,d=A(e,x=>x.layout),g=A(e,x=>x.visibleColumns),i=A(e,x=>x.titles),p=A(e,x=>x.layout.maximized!==null||x.splitDragging),[S,O]=u.useState(!1),[C]=u.useState(()=>ve(g)),m=u.useMemo(()=>Pn(o),[o]),h=u.useCallback(x=>{e.arrange(Mn(e.getSnapshot().layout,x))},[e]),c=k.useDragDropColumns({initialColumnPanels:C,initialPanelVisibility:{},debugConfig:k.DEFAULT_DEBUG_CONFIG,onColumnPanelsChange:h}),{columnPanels:w,setColumnPanels:P}=c,T=u.useRef(p),f=u.useRef(w);u.useLayoutEffect(()=>{T.current=p,f.current=w},[p,w]);const E=u.useCallback(x=>{const b=n.current;if(b===null)return;const{plan:H,stageBlockSize:D}=ln(b,l);if(Number.isFinite(D)&&D>0&&b.style.setProperty(le,`${String(D)}px`),T.current&&!x)return;const z=F.replanVisibleColumns(e.getSnapshot().visibleColumns,H);z!==null&&e.setVisibleColumns(z)},[e,n,l]);u.useLayoutEffect(()=>{E(!0),O(!0)},[E]),u.useEffect(()=>{const x=n.current;if(x===null||typeof ResizeObserver>"u")return;let b=null;const H=new ResizeObserver(()=>{b===null&&(b=requestAnimationFrame(()=>{b=null,E(!1)}))}),D=x.querySelector(k.SCROLL_ROOT_SELECTOR)?.firstElementChild,z=x.querySelector(`[${se}]`);return D instanceof Element&&H.observe(D),z instanceof Element&&H.observe(z),()=>{H.disconnect(),b!==null&&cancelAnimationFrame(b)}},[n,E]),u.useEffect(()=>{p||E(!1)},[p,E]);const v=u.useMemo(()=>S?On(d,{logical:l,visible:g}):ve(g),[S,d,l,g]);u.useLayoutEffect(()=>{Tn(f.current,v)||P(v)},[v,P]);const L=u.useMemo(()=>k.sortColumnIds(Object.keys(w)).map(x=>({id:x,key:x,className:"aqmx-multi-column"})),[w]),N=u.useMemo(()=>d.docs.map(x=>{const b=G(d,x);return{id:b,component:En,title:oe(i,x),props:{docPath:x,panelId:b},minHeight:In,maxHeight:Nn}}),[d,i]),_=u.useMemo(()=>Object.fromEntries(d.docs.map(x=>[G(d,x),!d.hidden.has(x)])),[d]),a=d.maximized===null?null:G(d,d.maximized),y=u.useCallback(x=>{const{layout:b}=e.getSnapshot();for(const[H,D]of U(b)){const z=x[H];if(z===void 0||z!==b.hidden.has(D))continue;const ae=e.titleOf(D);if(z){if(!e.setHidden(D,!1))continue;r.announce(o.panelShown(ae)),ke(n,H);continue}const ce=n.current,ue=ce===null?null:xe(ce,H);e.setHidden(D,!0)&&(r.announce(o.panelHidden(ae)),ue!==null&&Se(n,ue))}},[e,n,r,o]),M=u.useCallback(x=>{const b=U(e.getSnapshot().layout).get(x);if(b===void 0)return;const H=e.titleOf(b),D=n.current,z=D===null?null:xe(D,x);e.close(b)&&(r.announce(o.panelClosed(H)),z!==null&&Se(n,z))},[e,n,r,o]),R=u.useCallback(x=>{if(x===null){s(null);return}const b=U(e.getSnapshot().layout).get(x);b!==void 0&&s(b)},[e,s]);return I.jsx("div",{className:"aqmx-multi-layout","aria-busy":!S,children:I.jsx(k.DragDropLayout,{columns:L,panels:N,columnPanels:w,onColumnPanelsChange:h,panelVisibility:_,onPanelVisibilityChange:y,dragState:c.dragState,dragOverPosition:c.dragOverPosition,originalPanelPosition:c.originalPanelPosition,dragModes:c.dragModes,debugConfig:k.DEFAULT_DEBUG_CONFIG,panelSizes:c.panelSizes,customDrag:c.customDrag,setPanelRef:c.setPanelRef,onDragStart:c.handleDragStart,onDragEnd:c.handleDragEnd,onPlaceholderDragEnter:c.handlePlaceholderDragEnter,onPlaceholderDragLeave:c.handlePlaceholderDragLeave,onDragOverWithInsert:c.handleDragOverWithInsert,onDropWithInsert:c.handleDropWithInsert,onColumnDragLeave:c.handleColumnDragLeave,onPanelMouseDown:c.handleMouseDown,onPanelSizeInfoClick:c.handlePanelSizeInfoClick,onToggleDragMode:c.toggleDragMode,onPanelClose:M,onPanelMaximizeChange:R,maximizedPanel:a,dragHandle:"header",labels:m,panelClassName:"aqmx-multi-panel"})})},ee={blockStart:"--aqmx-multi-toast-block-start",inlineEnd:"--aqmx-multi-toast-inline-end",room:"--aqmx-multi-toast-room"},An=(e,n)=>{const t=n.getBoundingClientRect(),o=[t.left+1,t.left+t.width/2,t.right-1],r=[t.top+1,t.top+t.height/2,t.bottom-1];return o.some(s=>r.some(l=>{const d=n.ownerDocument.elementsFromPoint(s,l),g=d.findIndex(p=>n.contains(p)),i=d.findIndex(p=>e.contains(p));return g!==-1&&i!==-1&&i<g}))},_n=(e,n)=>{const t=n.getBoundingClientRect(),o=n.ownerDocument.documentElement.clientWidth,r=getComputedStyle(n).direction==="rtl";return e.style.setProperty(ee.blockStart,`${String(t.top)}px`),e.style.setProperty(ee.inlineEnd,`${String(r?t.left:o-t.right)}px`),e.style.setProperty(ee.room,`${String(t.width)}px`),e.showPopover(),()=>{e.isConnected&&e.hidePopover()}},zn=({store:e,body:n,limitNotice:t,onLimitNoticeCovered:o,ref:r})=>{const{config:s,labels:l,announcer:d}=q.useExplorer(),g=u.useRef(null),i=u.useRef(null),p=A(e,f=>f.ready),S=A(e,f=>f.layout.docs.length>0),O=A(e,f=>f.visibleColumns),C=u.use(ne.SheetNoticeSlotContext),m=u.useCallback(f=>{const{layout:E}=e.getSnapshot(),v=E.maximized,L=f===null&&v!==null?E.panelIds.get(v):void 0,N=g.current,_=L!==void 0&&N!==null&&ie(N,L);e.maximize(f)&&(f!==null?d.announce(l.panelMaximized(e.titleOf(f))):v!==null&&d.announce(l.panelRestored(e.titleOf(v))),L!==void 0&&Dn(g,L,_))},[e,d,l]),h=u.useCallback((f,E,v,L)=>{if(v===E){e.setPendingHash(f,L);return}const N=e.navigate(E,v);if(N==="navigated"){e.setPendingHash(f,L);return}if(N!=="existing")return;const{layout:_}=e.getSnapshot(),a=_.panelIds.get(v);a!==void 0&&(d.announce(l.panelAlreadyOpen(e.titleOf(v))),_.maximized===null?e.setHidden(v,!1):m(v),e.setPendingHash(a,L),ke(g,a))},[e,d,l,m]);u.useLayoutEffect(()=>{if(t===null||C!==null||!he())return;const f=i.current,E=g.current;if(f===null||E===null)throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");return _n(f,E)},[t,C]),u.useEffect(()=>{const f=i.current;if(t===null||f===null)return;const{ownerDocument:E}=f;let v=null;const L=N=>{const _=N.target;_ instanceof Element&&(v!==null&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=null,E.activeElement===_&&f.isConnected&&An(f,_)&&o()}))};return E.addEventListener("focusin",L,!0),()=>{E.removeEventListener("focusin",L,!0),v!==null&&cancelAnimationFrame(v)}},[t,C,o]),u.useImperativeHandle(r,()=>({bringIntoView:f=>{requestAnimationFrame(()=>{const E=g.current,v=e.getSnapshot().layout.panelIds.get(f);E!==null&&v!==void 0&&K(E,v,null)})}}),[e]),u.useEffect(()=>{const f=g.current;return()=>{f!==null&&$.get(f)?.()}},[]);const c=u.useCallback((f,E)=>{const v=g.current;v!==null&&K(v,f,E)},[]),[w]=u.useState(on),P=u.useMemo(()=>({store:e,Body:n,followLink:h,maximize:m,revealInPanel:c,focusCarry:w}),[e,n,h,m,c,w]),T=u.useMemo(()=>Array.from({length:s.multiView.columns},(f,E)=>k.generateColumnId(E)),[s]);return I.jsxs("section",{ref:g,className:"aqmx-multi-stage",tabIndex:-1,"aria-label":l.multiRegion,"aria-busy":S&&!p,"data-testid":"markdown-explorer-stage","data-aqmx-visible-columns":O,children:[I.jsx("span",{className:"aqmx-multi-probe","aria-hidden":"true",[se]:""}),S?p?I.jsx(Ne,{value:P,children:I.jsx(kn,{store:e,stageRef:g})}):I.jsx("div",{className:"aqmx-multi-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-stage-skeleton",children:T.map(f=>I.jsxs("div",{className:"aqmx-skeleton aqmx-multi-skeleton-column",children:[I.jsx("span",{}),I.jsx("span",{}),I.jsx("span",{})]},f))}):I.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-multi-empty",children:I.jsx("p",{className:"aqmx-empty-title",children:l.multiEmpty})}),t===null?null:C!==null?ze.createPortal(I.jsx("div",{ref:i,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t}),C):I.jsx("div",{ref:i,popover:he()?"manual":void 0,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t})]})},Ae=3e3,_e=(e,n)=>{if(n!==null)return n;const[t]=e;return t===void 0?null:t},Hn=(e,n,t)=>{switch(n){case"opened":return e.panelOpened(t);case"shown":return e.panelShown(t);case"closed":return e.panelClosed(t);default:{const o=n;throw new RangeError(`[markdown-explorer] unknown toggle outcome ${JSON.stringify(o)}`)}}},qn=({location:e})=>{const{config:n,labels:t,announcer:o}=q.useExplorer(),r=cn(e),s=A(r,f=>f.layout.docs),l=A(r,f=>f.layout.maximized),d=A(r,f=>f.source),[g,i]=u.useState(!1),p=u.useRef(null),[S,O]=u.useState(0),C=u.useRef(null),m=u.useRef(null);u.useLayoutEffect(()=>{const f=C.current;C.current=null,f!==null&&(r.whenUrlRendered(()=>o.announce(f.announcement)),m.current?.bringIntoView(f.doc))}),u.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]);const h=u.useCallback(()=>{p.current!==null&&clearTimeout(p.current),i(!0),p.current=setTimeout(()=>{p.current=null,i(!1)},Ae)},[]),c=u.useCallback(()=>{p.current!==null&&clearTimeout(p.current),p.current=null,i(!1)},[]),w=u.useCallback(f=>{const E=r.titleOf(f),v=r.toggle(f);v==="rejected"&&h();const L=v==="rejected"?t.panelLimit(n.multiView.maxPanels):Hn(t,v,E);if(v==="shown"){C.current={doc:f,announcement:L},O(N=>N+1);return}r.whenUrlRendered(()=>{o.announce(L),v==="opened"&&m.current?.bringIntoView(f)})},[r,h,o,t,n]),P=u.useMemo(()=>new Set(s),[s]),T=u.useMemo(()=>({href:F.explorerHref(n,{view:"tree",source:d,doc:_e(s,l)}),target:"tree"}),[n,d,s,l]);return I.jsx(ne.ExplorerSplit,{view:"multi",explorer:I.jsx(ne.ExplorerPane,{mode:"multi",sourceId:d,currentPath:null,openPaths:P,onOpenDocument:w,onSourceChange:r.changeSource,viewSwitch:T}),content:I.jsx(zn,{ref:m,store:r,body:Cn,limitNotice:g?t.panelLimit(n.multiView.maxPanels):null,onLimitNoticeCovered:c}),contentCoversPage:l!==null,sheetDismissals:S,onDraggingChange:r.setSplitDragging})};exports.MultiLayout=qn;exports.PANEL_LIMIT_NOTICE_MS=Ae;exports.treeSwitchDocument=_e;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),r=require("react"),i=require("./location-DWHQYntR.cjs"),a=require("./index-y9tVvDW7.cjs"),l=require("./ExplorerSplit-BESGFcu6.cjs"),E=new Set,b=({location:d})=>{const{config:e}=a.useExplorer(),n=a.useExplorerNavigate(),{source:o,doc:t,overrides:c}=d,[p,x]=r.useState(l.EMPTY_SELECTION),m=r.useMemo(()=>({gathered:p,onGatheredChange:x}),[p]),h=r.useCallback(s=>n(i.explorerHref(e,{view:"tree",source:o,doc:s,overrides:c}),"browse"),[n,e,o,c]),v=r.useCallback(s=>n(i.explorerHref(e,{view:"tree",source:s,doc:t,overrides:c}),"switch-source"),[n,e,t,c]),w=r.useCallback(s=>n(i.explorerHref(e,{view:"multi",source:o,docs:i.canonicalMultiDocuments(e,s)}),"switch-view"),[n,e,o]),S=r.useMemo(()=>({href:i.explorerHref(e,{view:"multi",source:o,docs:t===null?[]:[t]}),target:"multi"}),[e,o,t]),g=r.useMemo(()=>({kind:"page",view:"tree",overrides:c,embed:{}}),[c]);return u.jsx(l.ExplorerSplit,{view:"tree",explorer:u.jsx(l.ExplorerPane,{mode:"tree",sourceId:o,currentPath:t,openPaths:E,onOpenDocument:h,onSourceChange:v,viewSwitch:S,tray:m,onOpenSelection:w}),content:u.jsx(a.DocumentPane,{path:t,variant:g})})};exports.TreeLayout=b;
@@ -1,19 +0,0 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { useState as f, useMemo as i, useCallback as u } from "react";
3
- import { e as s, c as x } from "./location-Cb2Ak55B.js";
4
- import { u as E, a as P, D } from "./index-BgkZ9ATV.js";
5
- import { E as b, a as C, b as O } from "./ExplorerSplit-DwEFmvQM.js";
6
- const T = /* @__PURE__ */ new Set(), H = ({ location: p }) => {
7
- const { config: e } = E(), r = P(), { source: o, doc: t, overrides: n } = p, [m, l] = f(b), h = i(() => ({ gathered: m, onGatheredChange: l }), [m]), w = u((c) => r(s(e, { view: "tree", source: o, doc: c, overrides: n }), "browse"), [r, e, o, n]), d = u((c) => r(s(e, { view: "tree", source: c, doc: t, overrides: n }), "switch-source"), [r, e, t, n]), v = u((c) => r(s(e, { view: "multi", source: o, docs: x(e, c) }), "switch-view"), [r, e, o]), S = i(() => ({ href: s(e, { view: "multi", source: o, docs: t === null ? [] : [t] }), target: "multi" }), [e, o, t]), g = i(() => ({ kind: "page", view: "tree", overrides: n, embed: {} }), [n]);
8
- return /* @__PURE__ */ a(
9
- C,
10
- {
11
- view: "tree",
12
- explorer: /* @__PURE__ */ a(O, { mode: "tree", sourceId: o, currentPath: t, openPaths: T, onOpenDocument: w, onSourceChange: d, viewSwitch: S, tray: h, onOpenSelection: v }),
13
- content: /* @__PURE__ */ a(D, { path: t, variant: g })
14
- }
15
- );
16
- };
17
- export {
18
- H as TreeLayout
19
- };
@@ -1,3 +0,0 @@
1
- "use strict";const c=require("react/jsx-runtime"),a=require("react"),U=require("react-router"),F=require("./location-DWHQYntR.cjs"),Oe=require("@aiquants/markdown"),H=require("./dataRoute-CKbdwkQ7.cjs"),yt=require("@aiquants/markdown/viewer-settings"),K=require("./storage-Bkb2Axdi.cjs");function Rt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=Rt(a),xe=Object.freeze(["en","ja"]),Qe="en",et=Object.freeze({panelMoved:Object.freeze(["title","column","position"]),panelMoveUnavailable:Object.freeze(["title","move"]),panelDragStarted:Object.freeze(["title"]),panelDragCancelled:Object.freeze(["title"]),multiColumnRegion:Object.freeze(["column"])}),kt=/\{(\w+)\}/gu,tt={explorerRegion:"Explorer",sourceLabel:"Source",refresh:"Refresh",refreshTree:"Reload the tree and the open documents from the source",treeRefreshed:"Reloaded the tree from the source",treeRefreshFailed:e=>`Could not reload the tree: ${e}`,refreshDocument:"Reload the document from the source",documentRefreshed:e=>`Reloaded ${e}`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,expandAll:"Expand all folders",collapseAll:"Collapse all folders",treeSettings:"Tree settings",switchToMulti:"Open in the multi-panel view",switchToTree:"Open in the tree view",resizeExplorer:"Resize the explorer",showExplorer:"Show the explorer",hideExplorer:"Close the explorer",treeRegion:"Documents",treeLoading:"Loading the tree…",treeEmptyTitle:"Nothing to show",treeEmptyBody:"This source has no documents you can open.",folderLoadFailed:"This folder could not be loaded.",loopFolderName:e=>`${e} (already open above)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("en",{type:"conjunction"}).format(e)} could not be loaded`,foldersLoading:e=>e===1?"Loading 1 folder…":`Loading ${String(e)} folders…`,expandAllStarted:"Opening all folders…",expandAllProgress:(e,t)=>`Opening all folders (${String(e)} opened, ${String(t)} loading)…`,expandAllDone:(e,t,n)=>{const r=`Opened ${String(e)} ${e===1?"folder":"folders"}`;return t>0?`${r}; ${String(t)} could not be loaded`:n?e===0?"All folders are already open":`${r}; every folder is open`:r},expandAllFolderLimit:(e,t,n)=>`Opened ${String(e)} ${e===1?"folder":"folders"} and stopped at the limit of ${String(t)} ${t===1?"folder":"folders"} to load. Choose "${n}" again to continue`,expandAllDepthLimit:(e,t)=>`Opened ${String(e)} ${e===1?"folder":"folders"}; folders more than ${String(t)} ${t===1?"level":"levels"} deep stay closed`,treeEntryKindDirectory:"directory",treeEntryKindFile:"file",treeScrollUp:"Scroll up",treeScrollDown:"Scroll down",treeScrollToTop:"Top",treeScrollToBottom:"Bottom",selectionTitle:e=>`Selected (${String(e)})`,clearSelection:"Clear the selection",openSelectionInMulti:e=>`Open ${String(e)} in panels`,removeFromSelection:e=>`Remove ${e} from the selection`,settingSortMode:"Sort order",sortNative:"Source order",sortAscending:"Name A→Z",sortDescending:"Name Z→A",settingDirectoriesFirst:"Folders first",settingSelectionMode:"Selection",selectionSingle:"Single",selectionMultiple:"Multiple",selectionNone:"Off",settingDoubleClick:"Double-click",doubleClickRecursive:"Expand all levels",doubleClickToggle:"Toggle",settingExpandIconSize:"Expander size",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"Always expanded",settingRemoveRootIndent:"No root indent",settingTreeLines:"Tree lines",settingExpandIcons:"Expanders",settingDirectoryIcons:"Folder icons",settingFileIcons:"File icons",settingOn:"On",settingOff:"Off",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"Document",documentEmpty:"Select a document in the explorer.",documentLoading:"Loading the document…",documentShown:e=>`Showing ${e}`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[.!?]$/u.test(t)?t:`${t}.`).join(" "),textTruncated:"Only the beginning of this file is shown.",inertLink:"This link points outside the source and cannot be opened.",failureUnauthorizedTitle:"Your session has expired",failureUnauthorizedBody:"Reload the page to sign in again.",failureForbiddenTitle:"Access denied",failureForbiddenBody:"You do not have permission to open this.",failureNotFoundTitle:"Not found",failureNotFoundBody:"It may have been moved or deleted.",failureNotConfiguredTitle:"This source is not set up",failureNotConfiguredBody:"Ask your administrator to configure it.",failureInvalidTitle:"Invalid address",failureInvalidBody:"The document path in this address cannot be used.",failureTooLargeTitle:"Too large to display",failureTooLargeBody:"This file exceeds the size that can be displayed.",failureUnsupportedTitle:"Cannot be displayed",failureUnsupportedBody:"This type of file cannot be shown here.",failureFailedTitle:"Something went wrong",failureFailedBody:"Try again in a moment.",retry:"Try again",reloadPage:"Reload the page",imageZoomIn:"Zoom in",imageZoomOut:"Zoom out",imageFit:"Fit to the view",imageFitLevel:"Fit",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"Open in a new tab",download:"Download",mediaUnsupported:"Your browser cannot play this file.",fileNotShown:"This file cannot be shown here. Download it to open it.",viewerLoading:"Loading data...",viewerErrorPrefix:"Error: ",viewerStyleTitle:"Display Style",viewerSelectStyle:"Select display style",viewerPinStyle:"Pin style selector",viewerUnpinStyle:"Unpin style selector",viewerErrorTitle:"An error occurred",viewerMissingImage:"Image not found",viewerOpenToc:"Open table of contents",viewerTocTitle:"Table of contents",viewerPinToc:"Pin table of contents",viewerUnpinToc:"Unpin table of contents",viewerSelectAlign:"Select alignment",viewerAlignTitle:"Alignment",viewerPinAlign:"Pin alignment selector",viewerUnpinAlign:"Unpin alignment selector",viewerAlignLeft:"Align left",viewerAlignCenter:"Align center",viewerAlignRight:"Align right",viewerMermaidInteractionMode:"Mouse interaction mode",viewerMermaidModeNone:"No interaction",viewerMermaidModeZoom:"Zoom only",viewerMermaidModePan:"Pan only (drag)",viewerMermaidModePanShift:"Pan only (Shift+drag)",viewerMermaidModeBoth:"Zoom and pan (drag)",viewerMermaidModeBothShift:"Zoom and pan (Shift+drag)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",viewerMermaidRetry:"Try again",multiRegion:"Panels",multiEmpty:"Select documents in the explorer to open them side by side.",panelLimit:e=>`You can open up to ${String(e)} panels at once.`,panelOpened:e=>`Opened ${e}`,panelClosed:e=>`Closed ${e}`,panelAlreadyOpen:e=>`${e} is already open`,panelHidden:e=>`Hid ${e}`,panelShown:e=>`Showed ${e}`,panelMaximized:e=>`Maximized ${e}`,panelRestored:e=>`Restored ${e} to its size`,panelHide:"Hide the panel",panelMaximize:"Maximize the panel",panelRestore:"Restore the panel to its size",panelClose:"Close the panel",panelSwitchToCustomDrag:"Switch to the custom drag mode",panelSwitchToNormalDrag:"Back to the normal drag mode",panelCustomDragBadge:"Custom",panelMovePreviousColumn:"Move to the previous column",panelMoveNextColumn:"Move to the next column",panelMoveUp:"Move up",panelMoveDown:"Move down",panelMoved:"Moved {title} to column {column}, position {position}",panelMoveUnavailable:"{move} is not available for {title}",panelDragStarted:"Picked up {title}",panelDragCancelled:"Kept {title} where it was",hiddenPanelsTitle:"Hidden panels:",hiddenPanelBadge:"Hidden",hiddenPanelNotice:"This panel is hidden",multiColumnEmpty:"This column is empty",multiColumnRegion:"Column {column}",panelDropHere:"Drop the panel here"},Tt={explorerRegion:"エクスプローラー",sourceLabel:"ソース",refresh:"更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocument:"ソースから文書を読み込み直す",documentRefreshed:e=>`${e} を読み込み直しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,expandAll:"すべてのフォルダーを展開",collapseAll:"すべてのフォルダーを折りたたむ",treeSettings:"ツリーの設定",switchToMulti:"マルチビューで開く",switchToTree:"ツリービューで開く",resizeExplorer:"エクスプローラーの幅を変更",showExplorer:"エクスプローラーを開く",hideExplorer:"エクスプローラーを閉じる",treeRegion:"文書の一覧",treeLoading:"ツリーを読み込み中…",treeEmptyTitle:"表示できるファイルがありません",treeEmptyBody:"このソースには開ける文書がありません。",folderLoadFailed:"このフォルダーを読み込めませんでした。",loopFolderName:e=>`${e} (上の階層で開いています)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("ja",{type:"conjunction"}).format(e)} を読み込めませんでした`,foldersLoading:e=>`フォルダーを ${String(e)} 件読み込み中…`,expandAllStarted:"すべてのフォルダーを展開しています…",expandAllProgress:(e,t)=>`すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,expandAllDone:(e,t,n)=>{const r=`${String(e)} 件のフォルダーを展開しました`;return t>0?`${r}。うち ${String(t)} 件は読み込めませんでした`:n?e===0?"すべてのフォルダーが既に開いています":`${r}。すべてのフォルダーが開いています`:r},expandAllFolderLimit:(e,t,n)=>`${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,expandAllDepthLimit:(e,t)=>`${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,treeEntryKindDirectory:"ディレクトリ",treeEntryKindFile:"ファイル",treeScrollUp:"上へスクロール",treeScrollDown:"下へスクロール",treeScrollToTop:"先頭へ",treeScrollToBottom:"末尾へ",selectionTitle:e=>`選択中 (${String(e)})`,clearSelection:"選択を解除",openSelectionInMulti:e=>`${String(e)} 件をパネルで開く`,removeFromSelection:e=>`${e} を選択から外す`,settingSortMode:"並び順",sortNative:"取得順",sortAscending:"名前の昇順",sortDescending:"名前の降順",settingDirectoriesFirst:"フォルダーを先に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRemoveRootIndent:"最上位の字下げなし",settingTreeLines:"ツリーの線",settingExpandIcons:"展開アイコン",settingDirectoryIcons:"フォルダーのアイコン",settingFileIcons:"ファイルのアイコン",settingOn:"オン",settingOff:"オフ",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"文書",documentEmpty:"エクスプローラーで文書を選んでください。",documentLoading:"文書を読み込み中…",documentShown:e=>`${e} を表示しています`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[。!?]$/u.test(t)?t:`${t}。`).join(""),textTruncated:"このファイルは先頭だけを表示しています。",inertLink:"リンク先がソースの外にあるため開けません。",failureUnauthorizedTitle:"セッションの有効期限が切れました",failureUnauthorizedBody:"ページを再読み込みして、もう一度サインインしてください。",failureForbiddenTitle:"アクセスが許可されていません",failureForbiddenBody:"これを開く権限がありません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",reloadPage:"ページを再読み込み",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",mediaUnsupported:"このブラウザではこのファイルを再生できません。",fileNotShown:"このファイルはここでは表示できません。ダウンロードして開いてください。",viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示スタイル",viewerSelectStyle:"表示スタイルを選択",viewerPinStyle:"スタイル選択をピン留め",viewerUnpinStyle:"スタイル選択のピン留めを解除",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",viewerMermaidRetry:"再試行",multiRegion:"パネル",multiEmpty:"エクスプローラーで文書を選ぶと、ここに並べて開きます。",panelLimit:e=>`同時に開けるのは ${String(e)} パネルまでです。`,panelOpened:e=>`${e} を開きました`,panelClosed:e=>`${e} を閉じました`,panelAlreadyOpen:e=>`${e} は既に開いています`,panelHidden:e=>`${e} を隠しました`,panelShown:e=>`${e} を表示しました`,panelMaximized:e=>`${e} を最大化しました`,panelRestored:e=>`${e} を元のサイズに戻しました`,panelHide:"パネルを隠す",panelMaximize:"パネルを最大化",panelRestore:"パネルを元のサイズに戻す",panelClose:"パネルを閉じる",panelSwitchToCustomDrag:"カスタムのドラッグの方式に切り替え",panelSwitchToNormalDrag:"通常のドラッグの方式に戻す",panelCustomDragBadge:"カスタム",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ"},nt=Object.freeze({en:Object.freeze(tt),ja:Object.freeze(Tt)}),Ce=Object.freeze(Object.keys(tt)),At=new Set(Ce),Lt=e=>At.has(e),re=e=>e===null?"null":typeof e=="string"?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):typeof e=="function"?"a function":Array.isArray(e)?"an array":typeof e,rt=e=>{if(e===void 0)return Qe;if(xe.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${xe.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${re(e)}`)},be=(e,t)=>{const n=nt[rt(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${re(t)}`);if(!F.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${re(t)}`);const r=t,o={...n};for(const i of Object.keys(r)){if(!Lt(i))throw new RangeError(`[markdown-explorer] labels.${i} is not a known label key; expected one of ${Ce.join(", ")}`);const s=r[i];if(s===void 0)continue;const d=typeof n[i];if(typeof s!==d)throw new TypeError(`[markdown-explorer] labels.${i} must be a ${d}; got ${re(s)}`);if(typeof s=="string"&&s.trim()==="")throw new RangeError(`[markdown-explorer] labels.${i} must be a non-blank string`);const g=et[i];if(typeof s=="string"&&g!==void 0){for(const[,w]of s.matchAll(kt))if(!g.includes(w??""))throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(w)}}; it accepts ${g.map(m=>`{${m}}`).join(", ")}`)}o[i]=s}return Object.freeze(o)},Ot=(e,t)=>{if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const n=e,r=t,o=Object.keys(n),i=Object.keys(r);return o.length===i.length&&i.every(s=>Object.hasOwn(n,s)&&Object.is(n[s],r[s]))},Se=Object.freeze(["light","dark"]),Ct=e=>{if(e===void 0)return"light";if(Se.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Se.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},ot=a.createContext(null),D=()=>{const e=a.use(ot);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},J=e=>{const{viewSettings:t}=D(),n=()=>e(t.getSnapshot());return a.useSyncExternalStore(t.subscribe,n,n)},ie=()=>{const{config:e}=D(),t=U.useParams()["*"],[n]=U.useSearchParams(),r=n.toString();return a.useMemo(()=>F.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])};function Mt({title:e,titleId:t,...n},r){return y.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:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",clipRule:"evenodd"}))}const st=y.forwardRef(Mt);function jt({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"}))}const Nt=y.forwardRef(jt),Me=Object.freeze({browse:Object.freeze({replace:!0,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-source":Object.freeze({replace:!1,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-view":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1}),"follow-link":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1})}),$t=e=>Me[e],ae=()=>{const e=U.useNavigate();return a.useCallback((t,n)=>{e(t,Me[n])},[e])},lt=({navigation:e,...t})=>c.jsx(U.Link,{...t,...Me[e]}),it={unauthorized:["failureUnauthorizedTitle","failureUnauthorizedBody"],forbidden:["failureForbiddenTitle","failureForbiddenBody"],"not-found":["failureNotFoundTitle","failureNotFoundBody"],"not-configured":["failureNotConfiguredTitle","failureNotConfiguredBody"],invalid:["failureInvalidTitle","failureInvalidBody"],"too-large":["failureTooLargeTitle","failureTooLargeBody"],unsupported:["failureUnsupportedTitle","failureUnsupportedBody"],failed:["failureFailedTitle","failureFailedBody"]},ce=(e,t)=>e[it[t][0]],at=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=D(),i=ce(o,e.reason),s=o[it[e.reason][1]],d=e.reason==="unauthorized"||e.reason==="forbidden"||e.reason==="failed"?"danger":"warning";return c.jsxs("div",{className:"aqmx-callout",role:t?"alert":void 0,"data-aqmx-tone":d,"data-testid":r===null?void 0:r,"data-aqmx-failure":r===null?void 0:e.reason,children:[c.jsx("p",{className:"aqmx-callout-title",children:i}),c.jsx("p",{className:"aqmx-callout-body",children:s}),e.reason==="unauthorized"?c.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:()=>window.location.reload(),children:o.reloadPage}):n!==void 0&&e.reason==="failed"?c.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:n,children:o.retry}):null]})},je=e=>{const t=e.ownerDocument;if(e.focus({preventScroll:!0}),t.activeElement===e)return!0;if(e.hasAttribute("tabindex"))return!1;if(e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),t.activeElement!==e)return e.removeAttribute("tabindex"),!1;const n=()=>{t.activeElement!==e&&(e.removeAttribute("tabindex"),e.removeEventListener("blur",n))};return e.addEventListener("blur",n),!0},ct=(e,t)=>{const n=a.useRef(null),r=a.useRef(null),o=a.useRef(null),i=a.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);a.useEffect(()=>i,[i]);const s=a.useCallback(w=>{if(r.current!==w)return;const m=o.current;if(m!==null){m.then(()=>s(w));return}e.prefetch(w);const p=e.peek(w);if(p?.status!=="pending")return;const S=Promise.allSettled([p.promise]);o.current=S,S.then(()=>{o.current===S&&(o.current=null)})},[e]),d=a.useCallback(w=>{const m=t(w);m!==r.current&&(i(),m!==null&&(r.current=m,n.current=window.setTimeout(()=>{n.current=null,s(m)},F.PREFETCH_DWELL_MS)))},[i,t,s]),g=a.useCallback(w=>{t(w)!==r.current&&i()},[i,t]);return a.useMemo(()=>({onPointerOver:w=>d(w.target),onPointerOut:w=>g(w.relatedTarget),onFocus:w=>d(w.target),onBlur:w=>g(w.relatedTarget)}),[d,g])},ee=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},ut=()=>{const e=new Map,t=new Set;let n=!1;const r=o=>{t.add(o),!n&&(n=!0,queueMicrotask(()=>{n=!1,t.clear()}))};return{hold:o=>{e.set(o,(e.get(o)??0)+1);let i=!1;return()=>{if(i)return;i=!0;const s=e.get(o);if(s!==void 0&&s>1){e.set(o,s-1);return}e.delete(o),r(o)}},isHeld:o=>e.has(o),resumes:o=>t.delete(o),heldKeys:()=>[...e.keys()]}},se=(e,t)=>{if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t))return!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length?!1:e.every((i,s)=>se(i,t[s]));const n=e,r=t,o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(i=>Object.hasOwn(r,i)&&se(n[i],r[i]))},Q=e=>{const t=e;return t.status===void 0&&(t.status="pending",e.then(n=>{t.status="fulfilled",t.value=n},n=>{t.status="rejected",t.reason=n})),t},dt=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),te=e=>e.status==="fulfilled"?e.value:void 0,Dt=55e3,Pe=Object.freeze({status:"deferred"}),Fe=Object.freeze({status:"refreshed"}),we=Object.freeze({status:"superseded"}),le=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,Pt=({client:e,capacity:t})=>{if(!Number.isInteger(t)||t<1)throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);const n=new Map,r=ut(),o=ee(),i=new WeakSet,s=o.emit,d=()=>{if(!(n.size<=t))for(const f of[...n.keys()]){if(n.size<=t)return;r.isHeld(f)||n.delete(f)}},g=(f,h)=>{n.delete(f),n.set(f,h)},w=f=>performance.now()-f.validatedAt>=Dt,m=(f,h,b)=>{const x=n.get(f),A=le(x?.snapshot),j=b||x?.refreshPending===!0,O=Q(e.document(f,{refresh:j}).then(P=>({status:"loaded",document:P}))),N={snapshot:{status:"pending",promise:O,previous:A},validatedAt:performance.now(),opened:h,background:null,refreshPending:!1,seeded:void 0};return g(f,N),d(),O.then(P=>{n.get(f)===N&&(N.snapshot=P,s())}),N},p=(f,h,b,x,A,j)=>{h.background===b&&(h.background=null,!(n.get(f)!==h||h.snapshot!==x)&&(A.kind==="failure"&&x.document.kind!=="failure"||(h.validatedAt=j,!se(x.document,A)&&(h.snapshot={status:"loaded",document:A},s()))))},S=async(f,h)=>{const b=h.snapshot;if(b.status!=="loaded")return null;const x={};h.background=x;const A=performance.now(),j=e.document(f,{refresh:h.refreshPending});h.refreshPending=!1;const O=await j,N=h.background===x&&n.get(f)===h&&h.snapshot===b;return p(f,h,x,b,O,A),N?O:null},T=(f,h)=>{const{snapshot:b}=h;return b.status==="pending"?!1:b.status==="loaded"&&b.document.kind!=="failure"?(S(f,h),!1):(b.status==="loaded"&&i.add(b),m(f,!0,!1),!0)},R=f=>{const h=r.hold(f);let b=!1;return()=>{if(b)return;b=!0,h();const x=n.get(f);x!==void 0&&g(f,x),d()}};return{peek:f=>n.get(f)?.snapshot,peekSeeded:f=>n.get(f)?.seeded,prefetch:f=>{const h=n.get(f);h!==void 0&&h.snapshot.status!=="deferred"||(m(f,!1,!1),s())},open:f=>{const h=r.resumes(f),b=R(f),x=n.get(f);if(x===void 0||x.snapshot.status==="deferred")return m(f,!0,!1),s(),b;if(g(f,x),h)return b;const{snapshot:A}=x;return A.status==="pending"?(x.opened=!0,b):A.document.kind==="failure"?(x.opened||w(x)?(i.add(A),m(f,!0,!1),s()):x.opened=!0,b):(x.opened=!0,x.background===null&&w(x)&&S(f,x),b)},retain:R,retry:f=>{const h=n.get(f);h===void 0||h.snapshot.status!=="loaded"||h.snapshot.document.kind!=="failure"||(m(f,!0,!1),s())},seed:(f,h)=>{const b=performance.now(),x=Q(h.then(P=>P===null?Pe:{status:"loaded",document:P},()=>Pe)),A=n.get(f);if(A!==void 0&&A.snapshot.status==="loaded"){const P=A.snapshot,B={};A.background=B,x.then(I=>{if(I.status==="loaded"){p(f,A,B,P,I.document,b);return}A.background===B&&(A.background=null)});return}const j=A!==void 0&&A.snapshot.status==="pending"?A.snapshot.previous:null,O={status:"pending",promise:x,previous:j},N={snapshot:O,validatedAt:b,opened:A?.opened===!0,background:null,refreshPending:A?.refreshPending===!0,seeded:O};g(f,N),d(),x.then(P=>{n.get(f)===N&&(P.status==="deferred"&&r.isHeld(f)?m(f,N.opened,!1):N.snapshot=P,s())})},invalidate:()=>{let f=!1;for(const[h,b]of[...n]){if(b.validatedAt=Number.NEGATIVE_INFINITY,b.opened=!0,b.refreshPending=!0,!r.isHeld(h))continue;const{snapshot:x}=b;if(x.status!=="pending"){T(h,b)&&(f=!0);continue}x.promise.then(()=>{n.get(h)===b&&b.refreshPending&&r.isHeld(h)&&T(h,b)&&s()})}f&&s()},refresh:async f=>{const h=n.get(f);if(h!==void 0&&h.snapshot.status==="loaded"&&h.snapshot.document.kind!=="failure"){h.refreshPending=!0;const x=await S(f,h);return x===null?we:x.kind==="failure"?{status:"failed",failure:x.failure}:Fe}const b=m(f,!0,!0);return s(),b.snapshot.status!=="pending"?we:(await b.snapshot.promise,n.get(f)===b?Fe:we)},clear:()=>{n.clear();for(const f of r.heldKeys())m(f,!0,!1);s()},subscribe:o.subscribe,noteFailureShown:f=>i.has(f)?!1:(i.add(f),!0)}};function Ft({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z"}),y.createElement("path",{d:"M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"}))}const _t=y.forwardRef(Ft);function qt({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",clipRule:"evenodd"}),y.createElement("path",{fillRule:"evenodd",d:"M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",clipRule:"evenodd"}))}const Ht=y.forwardRef(qt),ue=({name:e,url:t,icon:n,children:r})=>{const{labels:o}=D();return c.jsxs("div",{className:"aqmx-document-toolbar",children:[c.jsx("span",{className:"aqmx-document-file-icon","aria-hidden":"true",children:n}),c.jsx("span",{className:"aqmx-document-title",title:e,"data-testid":"markdown-explorer-file-name",children:e}),r,c.jsx("a",{className:"aqmx-icon-button",href:t,target:"_blank",rel:"noopener noreferrer","aria-label":o.openInNewTab,title:o.openInNewTab,"data-testid":"markdown-explorer-file-open",children:c.jsx(Ht,{})}),c.jsx("a",{className:"aqmx-icon-button",href:t,download:e,"aria-label":o.download,title:o.download,"data-testid":"markdown-explorer-file-download",children:c.jsx(_t,{})})]})};function Bt({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm4.75 6.75a.75.75 0 0 1 1.5 0v2.546l.943-1.048a.75.75 0 0 1 1.114 1.004l-2.25 2.5a.75.75 0 0 1-1.114 0l-2.25-2.5a.75.75 0 1 1 1.114-1.004l.943 1.048V8.75Z",clipRule:"evenodd"}))}const zt=y.forwardRef(Bt),It=({document:e})=>{const{labels:t}=D();return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[c.jsx(ue,{name:e.name,url:e.url,icon:c.jsx(zt,{})}),c.jsx("div",{className:"aqmx-document-stage",children:c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-file-not-shown",children:[c.jsx("p",{className:"aqmx-callout-body",children:t.fileNotShown}),c.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-file-not-shown-download",children:t.download})]})})]})},Ne="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",Ut=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},de=e=>{if(!e.startsWith("#")||e.length===1)return null;try{return decodeURIComponent(e.slice(1))}catch{return null}},ft=e=>`#${encodeURIComponent(e)}`,Zt=e=>{if(e==="#")return!0;const t=de(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},ye=(e,t)=>{for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Vt=(e,t)=>{const n=e===null?null:de(t);return e===null||n===null?null:ye(e,n)},_e=e=>{const{body:t,documentElement:n}=e.ownerDocument;if(e===t){const o=getComputedStyle(n);if(o.overflowX==="visible"&&o.overflowY==="visible")return!1}const{overflowY:r}=getComputedStyle(e);return r==="auto"||r==="scroll"},Wt=e=>{const{body:t,documentElement:n}=e,r=getComputedStyle(n),o=r.overflowX==="visible"&&r.overflowY==="visible"&&t!==null?getComputedStyle(t).overflowY:r.overflowY;return o!=="hidden"&&o!=="clip"},Kt=(e,t)=>{const n=t.closest(Ne),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&_e(r))return r;const o=e.getBoundingClientRect().height,{documentElement:i,scrollingElement:s}=e.ownerDocument;for(let d=e.parentElement;d!==null&&d!==i;d=d.parentElement)if(_e(d)&&d.scrollHeight>d.clientHeight&&d.clientHeight<o)return d;return s instanceof Element&&Wt(e.ownerDocument)&&s.scrollHeight>s.clientHeight&&s.clientHeight<o?s:r},Gt=Object.freeze({scrollerOf:Kt,reveal:e=>{e.scrollIntoView(Re)}}),Re=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),Xt=(e,t)=>{for(let n=t;n!==null&&n!==e;n=n.parentElement){const r=n.parentElement;if(r instanceof HTMLDetailsElement&&n!==r.querySelector(":scope > summary")&&(r.open=!0),n.getAttribute("hidden")?.toLowerCase()==="until-found"){if(n.dispatchEvent(new Event("beforematch",{bubbles:!0})),!n.isConnected)return;n.removeAttribute("hidden")}}},Yt=(e,t)=>{if(t.getClientRects().length===0)return;const n=e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,{scrollMarginTop:r,scrollMarginBottom:o}=getComputedStyle(t),i=Number.parseFloat(r),s=t.getBoundingClientRect(),d=s.height+i+Number.parseFloat(o)>e.clientHeight;if(!d&&Math.abs(s.top-i-n)<1){t.scrollIntoView(Re);return}e.scrollBy({top:d?s.top-n-e.clientHeight:s.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(Re)},Jt=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(Ne)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},qe=(e,t,n)=>{if(e===null)return null;const r=Vt(e,t);return r===null?(Zt(t)&&Jt(e,n),null):(Xt(e,r),Yt(n.scrollerOf(e,r),r),n.reveal(r),r)};function Qt({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"}))}const en=y.forwardRef(Qt);function tn({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"}),y.createElement("path",{fillRule:"evenodd",d:"M9 2a7 7 0 1 0 4.391 12.452l3.329 3.328a.75.75 0 1 0 1.06-1.06l-3.328-3.329A7 7 0 0 0 9 2ZM3.5 9a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",clipRule:"evenodd"}))}const nn=y.forwardRef(tn);function rn({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M9 6a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0v-1.5h-1.5a.75.75 0 0 1 0-1.5h1.5v-1.5A.75.75 0 0 1 9 6Z"}),y.createElement("path",{fillRule:"evenodd",d:"M2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Zm7-5.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11Z",clipRule:"evenodd"}))}const on=y.forwardRef(rn);function sn({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.219a.75.75 0 0 0-1.06 0l-1.91 1.909.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.091a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",clipRule:"evenodd"}))}const ln=y.forwardRef(sn),ke="data-aqmx-key-repeat",Te=Object.freeze({[ke]:"allow"}),an=`[${ke}="${Te[ke]}"]`,cn=()=>{let e=null;return{onKeyDownCapture:t=>{if(t.key==="Enter"){if(!t.repeat){e=t.target instanceof Element?t.target:null;return}e!==null&&t.target===e&&e.closest(an)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},oe=Object.freeze([1/F.GOLDEN_RATIO**2,1/F.GOLDEN_RATIO,1,F.GOLDEN_RATIO,F.GOLDEN_RATIO**2]),He=Object.freeze({mode:"fit"}),un=1,mt=a.createContext(null),dn=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=un?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,Be=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<oe.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?oe.findIndex(o=>o>t):oe.findLastIndex(o=>o<t);return r===-1?null:r},ze=(e,t,n)=>{if(e.mode==="level"){const o=Be(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=Be(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},fn=e=>{const t=oe[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},Ie=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},mn=({document:e})=>{const{labels:t}=D(),n=a.use(mt),[r]=a.useState(()=>n===null?null:n.read(e.url)),[o,i]=a.useState(r===null?He:r.zoom),[s,d]=a.useState(r===null?null:r.reported),[g,w]=a.useState(null),m=a.useRef(null),p=a.useCallback(h=>{const{naturalWidth:b,naturalHeight:x}=h;d(A=>Ie(A,b,x))},[]),S=a.useCallback(h=>{m.current=h,!(h===null||!h.complete)&&(h.naturalWidth>0||h.naturalHeight>0?p(h):h.decode().then(()=>p(h),()=>{}))},[p]);a.useEffect(()=>{n!==null&&s!==null&&n.save(e.url,{zoom:o,reported:s})},[n,e.url,o,s]),a.useLayoutEffect(()=>{const h=m.current;if(h===null||s===null||o.mode!=="fit")return;const b=()=>w(A=>Ie(A,h.clientWidth,h.clientHeight));if(b(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(b);return x.observe(h),()=>x.disconnect()},[s,o.mode]);const T=s===null||g===null?null:dn(s,g),R=ze(o,T,-1),L=ze(o,T,1),k=o.mode==="level"?fn(o.index):null,f=o.mode==="level"&&k!==null?{width:`${o.base.width*k}px`,height:`${o.base.height*k}px`}:void 0;return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[c.jsxs(ue,{name:e.name,url:e.url,icon:c.jsx(ln,{}),children:[c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":R===null,onClick:()=>{R!==null&&i(R)},...Te,children:c.jsx(nn,{})}),c.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:k===null?t.imageFitLevel:t.imageZoomLevel(Math.round(k*100))}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":L===null,onClick:()=>{L!==null&&i(L)},...Te,children:c.jsx(on,{})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>i(He),children:c.jsx(en,{})})]}),c.jsx("div",{className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas",children:c.jsx("img",{ref:S,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:f,onLoad:h=>p(h.currentTarget),"data-testid":"markdown-explorer-image"})})]})},gt=a.createContext(null),fe=a.createContext(void 0),ht=a.createContext(null),me=()=>{const e=a.use(gt);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},gn=()=>{const e=a.use(ht);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},ge=(e,t,n,r)=>t.kind==="panel"?F.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?F.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):F.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),hn=({children:e})=>{const{config:t}=D(),n=me(),r=ie(),o=r.kind==="location"?r.location.source:void 0,i=U.useHref(ge(t,n.navigation,o,n.currentPath));return c.jsx(fe,{value:o,children:c.jsx(ht,{value:i,children:e})})},pn='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',wn=e=>{const t=e instanceof Element?e.closest(pn):null;return t===null?null:t.getAttribute("data-doc-path")},he=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,vn=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:i,onDocumentLink:s,scope:d,children:g})=>{const w=U.useHref(e),m=p=>{if(he(p)){if(p.preventDefault(),t===d.currentPath&&n!==""){d.scrollWithin(n);return}s(t,n)}};return c.jsx("a",{...i,href:w,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:m,children:g})},En=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:i})=>{const{config:s}=D(),d=me(),g=a.use(fe),w=Ut(e),{navigation:m}=d,p=`${ge(s,m,g,t)}${w}`,S=n===!1?"false":void 0;return m.kind==="page"?c.jsx(lt,{...o,to:p,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":S,children:i}):c.jsx(vn,{to:p,docPath:t,fragment:w,exists:S,className:r,attributes:o,onDocumentLink:m.onDocumentLink,scope:d,children:i})},xn=({className:e,attributes:t,children:n})=>{const{labels:r}=D();return c.jsxs("a",{...t,className:e===void 0?"aqmx-document-inert-link":`${e} aqmx-document-inert-link`,title:r.inertLink,"data-link-kind":"doc","data-doc-exists":"false",children:[n,c.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},bn=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:i}=D(),s=a.use(fe),d=U.useHref(`${ge(i,r.navigation,s,r.currentPath)}${e}`),g=w=>{he(w)&&(w.preventDefault(),r.scrollWithin(e))};return c.jsx("a",{...n,href:d,className:t,onClick:g,children:o})},Sn=({href:e,className:t,attributes:n,children:r})=>{const o=me();if(o.navigation.kind==="page"){const i=s=>{if(!he(s))return;const d=s.currentTarget;e==="#"?o.followEmptyFragment(s.nativeEvent):d.href===d.ownerDocument.URL&&o.followSameUrlJump(e,s.nativeEvent)};return c.jsx("a",{...n,href:e,className:t,onClick:i,children:r})}return c.jsx(bn,{href:e,className:t,attributes:n,scope:o,children:r})},yn=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:i,children:s})=>t==="doc"?n===void 0||!H.isAcceptableDocumentPath(n)?c.jsx(xn,{className:o,attributes:i,children:s}):c.jsx(En,{href:e,docPath:n,docExists:r,className:o,attributes:i,children:s}):e.startsWith("#")?c.jsx(Sn,{href:e,className:o,attributes:i,children:s}):c.jsx("a",{...i,href:e,className:o,children:s}),Rn=()=>{const{config:e}=D(),t=me(),n=a.use(fe),r=ae();return a.useCallback((o,i)=>{if(!he(i)||(i.preventDefault(),o.id===""))return!0;const s=ft(o.id),{navigation:d}=t;return d.kind==="panel"||de(i.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(s),!0):(r(`${ge(e,d,n,t.currentPath)}${s}`,"follow-link"),!0)},[e,t,n,r])},kn=()=>{const e=gn();return a.useCallback(t=>t.id===""?e:`${e}${ft(t.id)}`,[e])};function Tn({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"}))}const An=y.forwardRef(Tn);function Ln({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M1 4.75C1 3.784 1.784 3 2.75 3h14.5c.966 0 1.75.784 1.75 1.75v10.515a1.75 1.75 0 0 1-1.75 1.75h-1.5c-.078 0-.155-.005-.23-.015H4.48c-.075.01-.152.015-.23.015h-1.5A1.75 1.75 0 0 1 1 15.265V4.75Zm16.5 7.385V11.01a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25Zm0 2.005a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .108.069.2.165.235h1.585a.25.25 0 0 0 .25-.25v-1.11Zm-15 1.11v-1.11a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.164.235H2.75a.25.25 0 0 1-.25-.25Zm2-4.24v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V11.01a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25Zm13-2.005V7.88a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25ZM4.25 7.63a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V7.88a.25.25 0 0 1 .25-.25h1.5Zm0-3.13a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5Zm11.5 1.625a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5Zm-9 3.125a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"}))}const On=y.forwardRef(Ln);function Cn({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M17.721 1.599a.75.75 0 0 1 .279.583v11.29a2.25 2.25 0 0 1-1.774 2.2l-2.041.44a2.216 2.216 0 0 1-.938-4.332l2.662-.577a.75.75 0 0 0 .591-.733V6.112l-8 1.73v7.684a2.25 2.25 0 0 1-1.774 2.2l-2.042.44a2.216 2.216 0 1 1-.935-4.331l2.659-.573A.75.75 0 0 0 7 12.529V4.236a.75.75 0 0 1 .591-.733l9.5-2.054a.75.75 0 0 1 .63.15Z",clipRule:"evenodd"}))}const Mn=y.forwardRef(Cn),jn=e=>{switch(e){case"video":return c.jsx(On,{});case"audio":return c.jsx(Mn,{});case"pdf":return c.jsx(An,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},Nn=({document:e})=>{const{labels:t}=D();switch(e.mediaType){case"video":return c.jsx("video",{className:"aqmx-document-video",src:e.url,controls:!0,preload:"metadata","aria-label":e.name,"data-testid":"markdown-explorer-media-player",children:t.mediaUnsupported});case"audio":return c.jsx("audio",{className:"aqmx-document-audio",src:e.url,controls:!0,preload:"metadata","aria-label":e.name,"data-testid":"markdown-explorer-media-player",children:t.mediaUnsupported});case"pdf":return c.jsx("iframe",{className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`)}}},$n=({document:e})=>c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[c.jsx(ue,{name:e.name,url:e.url,icon:jn(e.mediaType)}),c.jsx("div",{className:"aqmx-document-stage",children:c.jsx(Nn,{document:e})})]}),Dn=e=>({loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,defaultErrorTitle:e.viewerErrorTitle,missingImage:e.viewerMissingImage,openTocAria:e.viewerOpenToc,tocTitle:e.viewerTocTitle,pinTocAria:e.viewerPinToc,unpinTocAria:e.viewerUnpinToc,selectAlignAria:e.viewerSelectAlign,alignTitle:e.viewerAlignTitle,pinAlignAria:e.viewerPinAlign,unpinAlignAria:e.viewerUnpinAlign,alignLeft:e.viewerAlignLeft,alignCenter:e.viewerAlignCenter,alignRight:e.viewerAlignRight,mermaidInteractionMode:e.viewerMermaidInteractionMode,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidRetry:e.viewerMermaidRetry}),pt=(e,t,n)=>{if(t!==void 0)return t;if(n!==void 0)return n;const[r]=e.documentStyles;if(r===void 0)throw new Error("[markdown-explorer] the configuration has no document style");return r.name},wt=(e,t)=>e!==void 0?e:t!==void 0?t:yt.DEFAULT_CONTENT_ALIGN,Pn=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),Fn=(e,t,n)=>{if(t.view==="multi"||t.overrides[n]===void 0)return null;const r=n==="style"?{align:t.overrides.align}:{style:t.overrides.style};return t.view==="single"?F.explorerHref(e,{view:"single",source:t.source,doc:t.doc,overrides:r,embed:t.embed}):F.explorerHref(e,{view:"tree",source:t.source,doc:t.doc,overrides:r})},Ae=a.createContext("fill"),$e=({kind:e,label:t,stale:n,busy:r,frameRef:o,intent:i,children:s})=>{const d=a.use(Ae);return c.jsxs("section",{ref:o,role:"region","aria-label":t,"aria-busy":r,"data-testid":"markdown-explorer-document","data-aqmx-document-kind":e,"data-aqmx-document-flow":d,className:"aqmx-document",...i,children:[n?c.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,s]})},_n=()=>{const{labels:e}=D();return c.jsx($e,{kind:"empty",label:e.documentRegion,stale:!1,busy:!1,children:c.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:c.jsx("p",{className:"aqmx-empty-title",children:e.documentEmpty})})})},vt=({label:e})=>{const{labels:t}=D();return c.jsxs($e,{kind:"loading",label:e,stale:!1,busy:!0,children:[c.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-document-skeleton",children:Pn.map(n=>c.jsx("span",{},n))}),c.jsx("p",{className:"aqmx-sr-only",children:t.documentLoading})]})},qn=({path:e,document:t,viewer:n})=>{const{reportMathDiagnostics:r}=D(),o=a.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),i=Rn(),s=kn(),d=a.useMemo(()=>r===void 0?void 0:g=>r(e,g),[r,e]);return c.jsx("div",{className:"aqmx-document-viewer",children:c.jsx(Oe.MarkdownViewer,{...n,onHeadingSelect:i,headingHref:s,onMathDiagnostics:d,parseResult:o,content:null})})},Hn=({document:e,viewer:t})=>{const{labels:n}=D();return c.jsxs(c.Fragment,{children:[c.jsx(ue,{name:e.name,url:e.url,icon:c.jsx(Nt,{})}),e.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-text-truncated",children:n.textTruncated}):null,c.jsx("div",{className:"aqmx-document-viewer",children:c.jsx(Oe.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},Bn=({path:e,document:t,viewer:n,onRetry:r})=>{switch(t.kind){case"markdown":return c.jsx(qn,{path:e,document:t,viewer:n});case"text":return c.jsx(Hn,{document:t,viewer:n});case"image":return c.jsx(mn,{document:t});case"media":return c.jsx($n,{document:t});case"file":return c.jsx(It,{document:t});case"failure":return c.jsx("div",{className:"aqmx-document-failure","data-aqmx-document-scroller":"",children:c.jsx(at,{failure:t.failure,alert:!1,onRetry:r,testId:"markdown-explorer-document-failure"})});default:{const o=t;throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(o)}`)}}},zn='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',In=(e,t,n)=>{const r=n===null?null:de(n),[o]=t.kind==="markdown"?t.headings:[],i=[r===null?null:ye(e,r),o===void 0?null:ye(e,o.id),e.querySelector(Ne),e.querySelector(zn)];for(const s of i)if(s instanceof HTMLElement&&je(s))return s;return null},Ue=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,i=r===null||r===o;t instanceof HTMLElement&&n&&(i||e.contains(r))&&je(t)},Un=e=>{const t=a.useRef(!1);return a.useLayoutEffect(()=>{const n=e.current;if(n===null)throw new Error("[markdown-explorer] the document region is not mounted");const r=n.ownerDocument,o=r.defaultView;if(o===null)throw new Error("[markdown-explorer] the document region's document has no window");let i=!1,s;const d=S=>{i=!(S.target instanceof Node&&n.contains(S.target)),i&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(s),s=setTimeout(()=>{i=!1},0)},g=S=>{t.current=S.target instanceof Node&&n.contains(S.target)},w=S=>{S.relatedTarget===null&&i&&(t.current=!1)},m=()=>{const{activeElement:S,body:T}=r;S!==null&&S!==T&&(t.current=n.contains(S))},p=()=>{i&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",d,!0),o.addEventListener("mousedown",d,!0),o.addEventListener("focusin",g,!0),o.addEventListener("blur",m),o.addEventListener("focus",p),n.addEventListener("focusout",w),()=>{clearTimeout(s),o.removeEventListener("pointerdown",d,!0),o.removeEventListener("mousedown",d,!0),o.removeEventListener("focusin",g,!0),o.removeEventListener("blur",m),o.removeEventListener("focus",p),n.removeEventListener("focusout",w)}},[e]),t},Zn=({path:e,snapshot:t,stale:n,viewer:r,regionLabel:o,navigation:i,fragment:s,paneScroll:d,announces:g,announceFailure:w,onDocumentShown:m})=>{const{labels:p,announcer:S,documents:T}=D(),{document:R}=t,L=a.useRef(null),k=a.useRef(null),f=a.useRef(null),h=a.useRef(0),b=Un(L),x=a.useRef({path:e,document:R}),A=a.useRef(null),j=a.useCallback(l=>{const u=L.current,v=qe(u,l,d);u!==null&&v!==null&&Ue(u,v,b.current)},[d,b]),O=a.useCallback((l,u)=>{const v=h.current;setTimeout(()=>{!u.defaultPrevented&&h.current===v&&j(l)},0)},[j]),N=a.useCallback(l=>{setTimeout(()=>{l.defaultPrevented||j("#")},0)},[j]),P=a.useMemo(()=>({navigation:i,currentPath:e,scrollWithin:j,followSameUrlJump:O,followEmptyFragment:N}),[i,e,j,O,N]),B=a.useCallback(()=>T.retry(e),[T,e]),I=ct(T,wn),$=a.useEffectEvent((l,u)=>{const v=k.current;if(v!==null&&v.path===l&&v.snapshot===u)return;k.current={path:l,snapshot:u};const E=u.document;if(E.kind==="failure"){T.noteFailureShown(u)&&w(p.documentFailed(H.lastPathSegment(l),ce(p,E.failure.reason)));return}m?.(l,E),g&&(v===null||v.path!==l||v.snapshot.document.kind==="failure")&&S.announce(p.documentShown(E.name))});a.useEffect(()=>{$(e,t)},[e,t]);const z=a.useEffectEvent(()=>{s.kind==="panel"&&s.consume()}),G=a.useEffectEvent(l=>{const u=L.current;if(u===null||!b.current)return null;const{activeElement:v,body:E}=u.ownerDocument;return v!==null&&v!==E?null:In(u,R,l)}),Y=a.useEffectEvent(l=>{const u=L.current;u!==null&&Ue(u,l,b.current)}),Z=a.useEffectEvent(l=>d.reveal(l)),pe=a.useEffectEvent(l=>qe(L.current,l,d));return a.useEffect(()=>{if(n)return;const l=x.current.path!==e,u=l||x.current.document!==R;x.current={path:e,document:R};const v=A.current!==e;A.current=e;let E=null;s.kind==="page"?f.current!==s.navigation&&(f.current=s.navigation,h.current+=1,E=s.fragment):s.fragment!==null&&(E=s.fragment,z());const C=()=>{const M=E===null?null:pe(E);if(!u){M!==null&&Y(M);return}const _=G(s.fragment);l&&M===null&&_!==null&&Z(_)};v?queueMicrotask(C):C()},[s,e,R,n]),c.jsx($e,{kind:R.kind,label:o(e,R),stale:n,busy:n,frameRef:L,intent:I,children:c.jsx(gt,{value:P,children:c.jsx(hn,{children:c.jsx(Bn,{path:e,document:R,viewer:r,onRetry:B},e)})})})},De=Object.freeze({kind:"skeleton"}),Vn=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const i=le(t);if(i!==null)return{kind:"document",path:e,snapshot:i,stale:!0};if(o&&t?.status==="pending")return{kind:"streaming",path:e,promise:t.promise};const s=n===null||n===e?null:le(r);return n===null||s===null?De:{kind:"document",path:n,snapshot:s,stale:!0}},Wn=(e,t)=>t.status==="deferred"?De:{kind:"document",path:e,snapshot:t,stale:!1},Kn=({requestedPath:e,content:t,...n})=>{const r=t.kind==="streaming"?Wn(t.path,a.use(t.promise)):t;return r.kind!=="document"?c.jsx(vt,{label:n.regionLabel(e,null)}):c.jsx(Zn,{path:r.path,snapshot:r.snapshot,stale:r.stale,...n})},Et=({path:e,display:t,navigation:n,fragment:r,paneScroll:o,announces:i,announceFailure:s,onDocumentShown:d})=>{const{config:g,labels:w,theme:m,documents:p}=D(),S=Oe.useMarkdownToolbarState(),T=a.useRef(!1);a.useLayoutEffect(()=>{T.current=!0},[]);const[R,L]=a.useState(null),k=a.useCallback(()=>e===null?void 0:p.peek(e),[p,e]),f=a.useSyncExternalStore(p.subscribe,k,k),h=a.useCallback(()=>R===null?void 0:p.peek(R),[p,R]),b=a.useSyncExternalStore(p.subscribe,h,h);a.useLayoutEffect(()=>e===null?void 0:p.open(e),[p,e]),a.useLayoutEffect(()=>R===null?void 0:p.retain(R),[p,R]);const x=e===null?De:Vn(e,f,R,b,!T.current),A=e===null?null:x.kind==="document"&&!x.stale?x.path:R;A!==R&&L(A);const j=a.useMemo(()=>Dn(w),[w]),O=a.useMemo(()=>[...g.iframeHosts],[g]),N=a.useMemo(()=>({labels:j,emptyMessage:w.documentEmpty,theme:m,availableStyles:g.documentStyles,iFrameAllowedDomains:O,linkComponent:yn,toolbar:S,style:t.style,onStyleChange:t.onStyleChange,align:t.align,onAlignChange:t.onAlignChange,showToc:t.showToc,showStyle:t.showStyle,showAlign:t.showAlign,padding:t.padding,width:t.width===void 0?void 0:`min(${t.width}, 100%)`,maxWidth:t.maxWidth===void 0?void 0:`min(${t.maxWidth}, 100%)`}),[j,w.documentEmpty,m,g.documentStyles,O,S,t]),P=n.kind==="panel",B=a.useCallback(($,z)=>P?z===null||z.kind==="failure"?H.lastPathSegment($):z.name:w.documentRegion,[P,w.documentRegion]),I=P?"content":"fill";return e===null?c.jsx(Ae,{value:I,children:c.jsx(_n,{})}):c.jsx(Ae,{value:I,children:c.jsx(a.Suspense,{fallback:c.jsx(vt,{label:B(e,null)}),children:c.jsx(Kn,{requestedPath:e,content:x,viewer:N,regionLabel:B,navigation:n,fragment:r,paneScroll:o,announces:i,announceFailure:s,onDocumentShown:d})})})},Gn=({path:e,variant:t,onDocumentShown:n})=>{const{config:r,viewSettings:o,announcer:i}=D(),s=J(O=>O.style),d=J(O=>O.align),g=ae(),w=U.useLocation(),m=ie(),{view:p,overrides:S,embed:T}=t,R=a.useCallback(O=>{if(m.kind!=="location")return;const N=Fn(r,m.location,O);N!==null&&g(N,"browse")},[r,g,m]),L=a.useCallback(O=>{o.update({style:O}),R("style")},[o,R]),k=a.useCallback(O=>{o.update({align:O}),R("align")},[o,R]),f=pt(r,S.style,s),h=wt(S.align,d),b=a.useMemo(()=>({style:f,onStyleChange:L,align:h,onAlignChange:k,showToc:T.showToc!==!1,showStyle:T.showStyle!==!1,showAlign:T.showAlign!==!1,padding:T.padding,width:T.width,maxWidth:T.maxWidth}),[f,L,h,k,T]),x=a.useMemo(()=>({kind:"page",view:p,overrides:S,embed:T}),[p,S,T]),A=a.useMemo(()=>({kind:"page",fragment:w.hash,navigation:w}),[w]),j=a.useCallback(O=>i.announce(O),[i]);return c.jsx(Et,{path:e,display:b,navigation:x,fragment:A,paneScroll:Gt,announces:!0,announceFailure:j,onDocumentShown:n})},Xn=({path:e,variant:t,onDocumentShown:n})=>{const{config:r,viewSettings:o}=D(),i=J(x=>x.style),s=J(x=>x.align),[d,g]=a.useState(()=>pt(r,void 0,i)),w=wt(void 0,s),m=a.useCallback(x=>o.update({align:x}),[o]),{maximized:p,onDocumentLink:S,pendingHash:T,onHashConsumed:R,announceFailure:L,paneScroll:k}=t,f=a.useMemo(()=>({style:d,onStyleChange:g,align:w,onAlignChange:m,showToc:p,showStyle:p,showAlign:p,padding:void 0,width:void 0,maxWidth:void 0}),[d,w,m,p]),h=a.useMemo(()=>({kind:"panel",onDocumentLink:S}),[S]),b=a.useMemo(()=>({kind:"panel",fragment:T,consume:R}),[T,R]);return c.jsx(Et,{path:e,display:f,navigation:h,fragment:b,paneScroll:k,announces:!1,announceFailure:L,onDocumentShown:n})},xt=({path:e,variant:t,onDocumentShown:n})=>t.kind==="page"?c.jsx(Gn,{path:e,variant:t,onDocumentShown:n}):c.jsx(Xn,{path:e,variant:t,onDocumentShown:n}),Yn=({location:e})=>{const{labels:t,documents:n,announcer:r}=D(),o=e.doc,i=a.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),s=a.useCallback(()=>n.peek(o),[n,o]),d=a.useCallback(()=>n.peekSeeded(o),[n,o]),g=a.useSyncExternalStore(n.subscribe,s,d),[w,m]=a.useState(!1),[p,S]=a.useState(null),T=a.useRef(!1),R=w||g?.status==="pending",L=a.useCallback(async()=>{if(!(T.current||R)){T.current=!0,m(!0),S(null);try{const k=await n.refresh(o);if(k.status==="failed"){S({path:o,failure:k.failure});return}if(k.status==="superseded")return;const f=le(n.peek(o));if(f===null||f.document.kind==="failure")return;r.announce(t.documentRefreshed(f.document.name))}finally{T.current=!1,m(!1)}}},[R,n,o,r,t]);return c.jsxs("div",{className:"aqmx-single","data-testid":"markdown-explorer-single",children:[c.jsx("div",{className:"aqmx-single-toolbar","data-testid":"markdown-explorer-single-toolbar",children:c.jsxs("button",{type:"button",className:"aqmx-icon-button aqmx-labelled-button",title:t.refreshDocument,"aria-disabled":R,"aria-busy":w,"data-aqmx-busy":w?"true":void 0,"data-testid":"markdown-explorer-single-refresh",onClick:()=>{L()},children:[c.jsx(st,{"aria-hidden":"true"}),c.jsx("span",{children:t.refresh})]})}),p!==null&&p.path===o?c.jsx("p",{role:"alert",className:"aqmx-single-refresh-failure","data-testid":"markdown-explorer-single-refresh-failure","data-aqmx-failure":p.failure.reason,children:t.documentRefreshFailed(ce(t,p.failure.reason))}):null,c.jsx(xt,{path:o,variant:i})]})},bt=({holds:e,testId:t})=>{const{labels:n,announcer:r}=D(),o=a.useId();a.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const i=a.useCallback(()=>r.shownIn(o),[r,o]),s=a.useSyncExternalStore(r.subscribe,i,i);return c.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":t,children:s.length>1?n.announcementSequence(s):s[0]})},X=Object.freeze([]),Ze=e=>{const t=new Set;let n=X,r=[],o=!1;const i=[],s=m=>{n=m;for(const p of[...t])p()},d=()=>i.at(-1)?.region,g=m=>{const p=d();m(),d()!==p&&n!==X&&s(X)},w=()=>{o=!1;const m=r.map(p=>"sentence"in p?p.sentence:p.list(p.items));r=[],s(Object.freeze(m))};return{announce:m=>{if(typeof m=="string")r.push({sentence:m});else{const p=r.find(S=>"list"in S&&S.list===m.list);p!==void 0&&"items"in p?p.items.push(m.item):r.push({list:m.list,items:[m.item]})}o||(o=!0,n!==X&&s(X),e.request(w))},subscribe:m=>(t.add(m),()=>{t.delete(m)}),claim:m=>{const p={region:m};return g(()=>i.push(p)),()=>g(()=>{const S=i.indexOf(p);S!==-1&&i.splice(S,1)})},shownIn:m=>d()===m?n:X}},Jn=Object.freeze({status:"cancelled"}),Qn=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(H.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return H.failureOf(n,r)},er=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((d,g)=>globalThis.fetch(d,g)),o=(d,g)=>`${e}/${d}?${new URLSearchParams(g).toString()}`,i=async(d,g,w,m)=>{let p;try{p=await r(d,{credentials:"same-origin",...g,headers:{Accept:"application/json",...g.headers}})}catch{return m({reason:"failed"})}p.status===401&&t(null);const S=p.headers.get(H.EXPLORER_SCOPE_HEADER);S!==null&&t(S);let T;try{T=await p.json()}catch{return m({reason:H.failureReasonOfStatus(p.status)})}let R;try{R=w(T)}catch{R=!1}if(R)return T;const L=Qn(T);return m(L!==null?L:{reason:p.status===200?"failed":H.failureReasonOfStatus(p.status)})},s={[H.EXPLORER_REFRESH_HEADER]:H.EXPLORER_REFRESH_HEADER_VALUE};return{tree:d=>i(o("tree",{[H.EXPLORER_DATA_QUERY.source]:d}),{method:"GET"},H.isExplorerTreeResult,g=>({status:"error",failure:g})),children:async(d,g,w)=>{const m=await i(o("children",{[H.EXPLORER_DATA_QUERY.source]:d,[H.EXPLORER_DATA_QUERY.path]:g}),{method:"GET",signal:w},H.isExplorerChildrenResult,p=>({status:"error",failure:p}));return w.aborted?Jn:m},document:(d,{refresh:g})=>i(o("document",{[H.EXPLORER_DATA_QUERY.path]:d}),g?{method:"GET",headers:s}:{method:"GET"},H.isExplorerDocument,w=>H.failureDocument(w.reason,w.code)),refresh:d=>i(o("refresh",{[H.EXPLORER_DATA_QUERY.source]:d}),{method:"POST",headers:s},H.isExplorerTreeResult,g=>({status:"error",failure:g}))}},tr=e=>{const t=K.readStorage(e);if(t===null)return F.NO_TREE_SETTING_CHANGES;try{return F.readTreeSettingChanges(JSON.parse(t))}catch(n){return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`,n),F.NO_TREE_SETTING_CHANGES}},Ve=(e,t)=>{let n=null;const r=()=>{if(n===null){const i=tr(e);n={changes:i,settings:F.applyTreeSettingChanges(t,i)}}return n},o=ee();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:i=>{const{changes:s,settings:d}=r(),g=F.recordTreeSettingChange(s,i,F.advanceTreeSetting(d,i)[i],t);return n={changes:g,settings:F.applyTreeSettingChanges(t,g)},o.emit(),K.writeStorage(e,F.serializeTreeSettingChanges(g)),n.settings}}},nr=Object.freeze({status:"refreshed"}),rr=Object.freeze({status:"superseded"}),Le=Object.freeze({status:"deferred"}),or=dt(Le),St=4,sr=St-1,We=Object.freeze({status:"loading"}),lr=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),ir=e=>{const t=new Map,n=ut(),r=new Map,o=new Map,i=new Map,s=new Map,d=ee(),g=new Set;let w=0,m=0;const p={direct:null,bulk:null},S=new Set;let T=!1,R=0;const L=()=>{R+=1,d.emit()},k=l=>o.get(l)??0,f=l=>{let u=s.get(l);return u===void 0&&(u={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},s.set(l,u)),u},h=(l,u,v)=>{l.inFlight.delete(u),w-=1,v.lane==="bulk"&&(m-=1)},b=l=>{const u=s.get(l);if(u!==void 0){for(const[v,E]of[...u.inFlight])h(u,v,E),E.controller.abort();u.direct.clear(),u.bulk.clear(),u.unclaimed.clear()}},x=l=>{const u=k(l)+1;return o.set(l,u),b(l),u},A=(l,u)=>{const v=te(l),E={promise:l,opened:u,stale:!1,loadedAt:v?.status==="ok"?v.loadedAt:null};return l.status==="pending"&&l.then(C=>{C.status==="ok"&&(E.loadedAt=C.loadedAt)}),E},j=l=>{let u=r.get(l);return u===void 0&&(u=new Map,r.set(l,u)),u},O=l=>{const u=[...s.keys()],v=p[l],E=v===null?0:u.indexOf(v)+1;for(let C=0;C<u.length;C+=1){const M=u[(E+C)%u.length],_=M===void 0?void 0:s.get(M);if(!(M===void 0||_===void 0)){for(const q of _[l])if((_.claims.get(q)??0)!==0)return _[l].delete(q),p[l]=M,{sourceId:M,path:q}}}return null},N=(l,u,v,E)=>{const C=s.get(l);if(C===void 0||C.inFlight.get(u)!==v)return;h(C,u,v);const M=(C.claims.get(u)??0)>0,_=j(l);if(E.status==="ok"?_.set(u,{status:"loaded",entries:E.entries}):E.status==="error"&&M?_.set(u,{status:"failed",failure:E.failure}):_.delete(u),L(),E.status==="error"&&M){const q={sourceId:l,path:u,failure:E.failure};for(const V of[...g])V(q)}B()},P=(l,u,v)=>{const E={controller:new AbortController,lane:v};f(l).inFlight.set(u,E),w+=1,v==="bulk"&&(m+=1),e.children(l,u,E.controller.signal).then(C=>N(l,u,E,C),()=>N(l,u,E,lr))},B=()=>{for(;w<St;){const l=O("direct");if(l!==null){P(l.sourceId,l.path,"direct");continue}const u=m<sr?O("bulk"):null;if(u===null)return;P(u.sourceId,u.path,"bulk")}},I=(l,u,v)=>{if(!(u.direct.delete(v)||u.bulk.delete(v))){const C=u.inFlight.get(v);if(C===void 0)return!1;h(u,v,C),C.controller.abort()}return r.get(l)?.delete(v),!0},$=()=>{T=!1;let l=!1;for(const u of S){const v=f(u);for(const E of v.unclaimed)(v.claims.get(E)??0)===0&&I(u,v,E)&&(l=!0);v.unclaimed.clear()}S.clear(),l&&(L(),B())},z=(l,u)=>{t.set(l,A(Q(e.tree(l)),u))},G=(l,u,v)=>{x(l);const E=A(dt(u),v);return t.set(l,E),r.delete(l),L(),B(),E},Y=(l,u,v,E)=>{if(v!==k(l)||t.get(l)!==u)return;const C=te(u.promise);if(!(E.status!=="ok"||C?.status!=="ok"||u.loadedAt===null||E.loadedAt<=u.loadedAt)){if(se(C.entries,E.entries)){u.loadedAt=E.loadedAt;return}G(l,E,u.opened)}},Z=(l,u)=>{const v=t.get(l);return v!==void 0&&te(v.promise)?.status===u},pe=(l,u)=>{u.stale=!1;const v=k(l);e.tree(l).then(E=>Y(l,u,v,E))};return{read:l=>t.get(l)?.promise??or,open:l=>{const u=n.resumes(l),v=n.hold(l),E=t.get(l);return E===void 0||Z(l,"deferred")?(z(l,!0),L()):u||(E.opened&&Z(l,"error")?(z(l,!0),L()):(E.opened=!0,E.stale&&Z(l,"ok")&&pe(l,E))),v},retry:l=>{Z(l,"error")&&(z(l,!0),L())},seed:(l,u)=>{const v=u.then(M=>M===null?Le:M,()=>Le),E=t.get(l);if(E!==void 0&&Z(l,"ok")){const M=k(l);v.then(_=>Y(l,E,M,_));return}x(l);const C=A(Q(v),E?.opened===!0);t.set(l,C),r.delete(l),B(),v.then(M=>{t.get(l)===C&&(M.status==="deferred"&&n.isHeld(l)&&z(l,C.opened),L())})},refresh:async l=>{const u=(i.get(l)??0)+1;i.set(l,u);const v=await e.refresh(l);if(i.get(l)!==u)return rr;if(v.status==="error")return{status:"failed",failure:v.failure};const E=t.get(l);if(!(E!==void 0&&E.loadedAt!==null&&Z(l,"ok")&&E.loadedAt>v.loadedAt)){const M=G(l,v,!0);if(E!==void 0&&E.promise.status==="pending"){const _=k(l);E.promise.then(q=>Y(l,M,_,q))}}for(const[M,_]of t)M!==l&&te(_.promise)?.status==="ok"&&(_.stale=!0);return nr},children:(l,u)=>r.get(l)?.get(u),claimChildren:(l,u)=>{const v=f(l),E=j(l);let C=!1,M=!1;for(const[q,V]of u)v.claims.set(q,(v.claims.get(q)??0)+1),E.get(q)===void 0?(E.set(q,We),v[V].add(q),C=!0,M=!0):V==="direct"&&v.bulk.delete(q)&&(v.direct.add(q),M=!0);C&&L(),M&&B();let _=!1;return()=>{if(!_){_=!0;for(const q of u.keys()){const V=(v.claims.get(q)??0)-1;V>0?v.claims.set(q,V):(v.claims.delete(q),v.unclaimed.add(q))}S.add(l),!T&&(T=!0,queueMicrotask($))}}},retryChildren:(l,u)=>{const v=r.get(l);if(v===void 0||v.get(u)?.status!=="failed")return;const E=f(l);if((E.claims.get(u)??0)>0){v.set(u,We),E.direct.add(u),L(),B();return}v.delete(u),L()},pendingChildren:l=>{const u=s.get(l);return u===void 0?0:u.direct.size+u.bulk.size+u.inFlight.size},clear:()=>{for(const l of new Set([...t.keys(),...r.keys(),...o.keys(),...s.keys()]))x(l);for(const[l,u]of i)i.set(l,u+1);t.clear(),r.clear(),L()},subscribeChildrenFailures:l=>(g.add(l),()=>{g.delete(l)}),subscribe:d.subscribe,version:()=>R}},ar=(e,t)=>{let n=e;const r=ee();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},cr=1;let ne=0,W=null;const ur=()=>{const{documentElement:e,body:t}=document;ne===0&&(W={htmlOverflow:e.style.overflow,bodyOverflow:t.style.overflow,htmlGutter:e.style.scrollbarGutter,bodyGutter:t.style.scrollbarGutter},e.style.overflow="hidden",t.style.overflow="hidden",e.style.scrollbarGutter="auto",t.style.scrollbarGutter="auto"),ne+=1;let n=!1;return()=>{n||(n=!0,ne-=1,!(ne>0||W===null)&&(e.style.overflow=W.htmlOverflow,t.style.overflow=W.bodyOverflow,e.style.scrollbarGutter=W.htmlGutter,t.style.scrollbarGutter=W.bodyGutter,W=null))}},dr=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],Ke=1,Ge=e=>e.getClientRects().length>0,ve="Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.",fr=e=>{if(!Ge(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+cr)return`[markdown-explorer] the explorer ends ${String(Math.round(t.bottom))}px down a ${String(n)}px viewport while lockDocumentScroll stops the page from scrolling, so the rest cannot be reached. ${ve}`;if(t.height<Ke)return`[markdown-explorer] the explorer collapsed to ${String(Math.round(t.height))}px while lockDocumentScroll stops the page from scrolling, so nothing can be read. ${ve}`;for(const{selector:r,name:o}of dr)for(const i of e.querySelectorAll(r)){if(!Ge(i))continue;const s=i.getBoundingClientRect().height;if(s<Ke)return`[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(s))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${ve}`}return null},mr=e=>{let t=!1;const n=()=>{if(t)return;const o=fr(e);o!==null&&(t=!0,console.error(o))},r=typeof ResizeObserver>"u"?null:new ResizeObserver(n);return r?.observe(e),window.addEventListener("resize",n),n(),()=>{r?.disconnect(),window.removeEventListener("resize",n)}},gr=(e,t)=>{a.useEffect(()=>e?ur():void 0,[e]),a.useEffect(()=>{const n=t.current;if(!(!e||n===null))return mr(n)},[e,t])},Xe='[data-testid="markdown-explorer-view-switch"]',hr=[{control:Xe,successors:[Xe,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],pr=e=>{for(const t of hr){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},wr=(e,t)=>{const n=a.useRef(null);a.useEffect(()=>{const o=d=>{const g=e.current;n.current=g!==null&&d instanceof Element&&g.contains(d)?pr(d):null},i=d=>o(d.target);o(document.activeElement);const s=d=>{const g=d.target;d.relatedTarget!==null||!(g instanceof Element)||queueMicrotask(()=>{n.current?.element===g&&g.isConnected&&document.activeElement!==g&&(n.current=null)})};return document.addEventListener("focusin",i),document.addEventListener("focusout",s),()=>{document.removeEventListener("focusin",i),document.removeEventListener("focusout",s)}},[e]);const r=a.useRef(t);a.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const i=()=>{const g=document.activeElement;if(g!==null&&g!==document.body&&g!==o.element)return!0;const w=e.current;if(w===null)return!0;for(const m of o.control.successors)for(const p of w.querySelectorAll(m))if(p!==o.element&&(p.focus({preventScroll:!0}),document.activeElement===p))return!0;return!1};if(i())return;const s=e.current;if(s===null)return;const d=new MutationObserver(()=>{i()&&d.disconnect()});return d.observe(s,{childList:!0,subtree:!0}),()=>d.disconnect()},[t,e])},vr=a.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-9-20bbSM.cjs")).then(e=>({default:e.TreeLayout}))),Er=a.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-r_qx1Mfz.cjs")).then(e=>({default:e.MultiLayout}))),xr=64,Ye={request:e=>{requestAnimationFrame(e)}},Je=e=>{e.documents.clear(),e.trees.clear()},Ee=(e,t)=>{t.tree!==null&&e.trees.seed(t.tree.sourceId,t.tree.result);for(const{path:n,document:r}of t.documents)e.documents.seed(n,r)},br=(e,t)=>{const[n,r]=a.useState(()=>({overrides:t,locale:e,labels:be(e,t)}));if(n.locale===e&&Ot(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:be(e,t)};return r(o),o.labels},Sr=(e,t,n)=>{const[r,o]=a.useState(()=>({scope:t,store:Ve(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const i={scope:t,store:Ve(e,n)};return o(i),i.store},yr=e=>{const[t,n]=a.useState(()=>({scope:e,announcer:Ze(Ye)}));if(t.scope===e)return t.announcer;const r={scope:e,announcer:Ze(Ye)};return n(r),r.announcer},Rr=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:i,renderFrame:s,renderTreeFailure:d,lockDocumentScroll:g=!1,onMathDiagnostics:w})=>{K.assertStorageNamespace(n);const m=rt(r),p=Ct(i),S=br(m,o),{revalidate:T}=U.useRevalidator(),R=a.useRef(()=>{}),L=U.useHref(t.dataPath),[k]=a.useState(()=>{const $=er({dataPath:L,onScope:G=>R.current(G)}),z={documents:Pt({client:$,capacity:Math.max(xr,t.multiView.maxPanels*2)}),trees:ir($)};return Ee(z,e),K.syncStorageScope(n,e.scope),{data:$,...z,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(k.aligned.pageData!==e||k.aligned.storageNamespace!==n){const $=k.aligned.pageData;k.aligned.pageData=e,k.aligned.storageNamespace=n,$!==e&&($.scope!==e.scope?k.aligned.pendingReader=e:Ee(k,e)),K.syncStorageScope(n,e.scope)}const f=Sr(K.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);a.useLayoutEffect(()=>{const $=k.aligned.pendingReader;$!==null&&(k.aligned.pendingReader=null,Je(k),Ee(k,$))},[e,k]),a.useLayoutEffect(()=>{let $=!1;return R.current=z=>{z===e.scope||$||($=!0,z!==null&&(Je(k),K.clearExplorerStorage(n)),T())},()=>{R.current=()=>{}}},[e,T,k,n]);const h=a.useRef(t.settingsCookie);a.useLayoutEffect(()=>{h.current=t.settingsCookie},[t.settingsCookie]);const[b]=a.useState(()=>ar(e.settings,$=>{document.cookie=F.viewSettingsCookieString(h.current,$,window.location.protocol==="https:")})),x=yr(e.scope),A=a.useMemo(()=>Q(e.notices.catch(()=>[])),[e.notices]),j=e.sources.map($=>$.id).join(`
2
- `),O=a.useMemo(()=>F.withExplorerSources(t,j.split(`
3
- `)),[t,j]),N=a.useRef(w);a.useLayoutEffect(()=>{N.current=w},[w]);const[P]=a.useState(()=>($,z)=>{N.current?.($,z)}),B=w===void 0?void 0:P,I=a.useMemo(()=>({config:O,labels:S,locale:m,theme:p,storageNamespace:n,scope:e.scope,sources:e.sources,notices:A,documents:k.documents,trees:k.trees,data:k.data,viewSettings:b,treeSettings:f,announcer:x,renderTreeFailure:d,reportMathDiagnostics:B}),[O,S,m,p,n,e.scope,e.sources,A,k,b,f,x,d,B]);return c.jsx(ot,{value:I,children:c.jsx(Tr,{renderFrame:s,lockDocumentScroll:g},e.scope)})},kr=({ref:e,theme:t,view:n,children:r})=>{const[o]=a.useState(cn);return c.jsx("div",{ref:e,className:"aqmx-root","data-aqmx-theme":t,"data-aqmx-view":n,"data-testid":"markdown-explorer",onKeyDownCapture:o.onKeyDownCapture,onKeyUpCapture:o.onKeyUpCapture,onBlurCapture:o.onBlurCapture,children:r})},Tr=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=D(),o=ie(),i=ae(),s=a.useRef(null);gr(t,s),a.useLayoutEffect(()=>{o.kind==="redirect"&&i(o.href,"browse")},[o,i]);const{location:d}=o,g=d.view;wr(s,g);const w=d.view==="tree"?c.jsx(a.Suspense,{fallback:c.jsx("section",{className:"aqmx-split-fallback","aria-label":r.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading"}),children:c.jsx(vr,{location:d})}):d.view==="multi"?c.jsx(a.Suspense,{fallback:c.jsx("section",{className:"aqmx-stage-fallback","aria-label":r.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading"}),children:c.jsx(Er,{location:d})}):c.jsx(Yn,{location:d}),m=c.jsxs(kr,{ref:s,theme:n,view:g,children:[w,c.jsx(bt,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?m:e({view:g,children:m})},Ar=({currentUrl:e,nextUrl:t,formMethod:n,defaultShouldRevalidate:r})=>n===void 0&&e.href===t.href&&r;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=Qe;exports.DocumentPane=xt;exports.EXPLORER_THEMES=Se;exports.ExplorerLink=lt;exports.FailureView=at;exports.ForwardRef=st;exports.ImageViewMemoryContext=mt;exports.LiveRegion=bt;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=nt;exports.MARKDOWN_EXPLORER_LABEL_KEYS=Ce;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=et;exports.MARKDOWN_EXPLORER_LOCALES=xe;exports.MarkdownExplorer=Rr;exports.createEmitter=ee;exports.explorerNavigationOptions=$t;exports.failureTitleOf=ce;exports.focusWithoutScroll=je;exports.resolveMarkdownExplorerLabels=be;exports.shouldRevalidateExplorer=Ar;exports.useExplorer=D;exports.useExplorerLocation=ie;exports.useExplorerNavigate=ae;exports.useIntentPrefetch=ct;exports.useViewSetting=J;
@@ -1 +0,0 @@
1
- "use strict";const h=require("@aiquants/markdown/viewer-settings"),$=require("./dataRoute-CKbdwkQ7.cjs"),v=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},I=new Intl.Collator("en",{numeric:!0,sensitivity:"variant"}),L=Object.freeze({sortMode:"native",directoriesFirst:!1,selectionMode:"single",doubleClickAction:"recursive",expandIconSize:8,alwaysExpanded:!1,removeRootIndent:!1,lines:!0,expandIcons:!0,directoryIcons:!0,fileIcons:!0}),ae=[!0,!1],ce=(e,t)=>t?e.settingOn:e.settingOff,g=(e,t)=>({key:e,labelKey:t,values:ae,formatValue:ce,requiresItemSelection:!1}),w=Object.freeze([{key:"sortMode",labelKey:"settingSortMode",values:["native","asc","desc"],formatValue:(e,t)=>t==="native"?e.sortNative:t==="asc"?e.sortAscending:e.sortDescending,requiresItemSelection:!1},g("directoriesFirst","settingDirectoriesFirst"),{key:"selectionMode",labelKey:"settingSelectionMode",values:["single","multiple","none"],formatValue:(e,t)=>t==="single"?e.selectionSingle:t==="multiple"?e.selectionMultiple:e.selectionNone,requiresItemSelection:!0},{key:"doubleClickAction",labelKey:"settingDoubleClick",values:["recursive","toggle"],formatValue:(e,t)=>t==="recursive"?e.doubleClickRecursive:e.doubleClickToggle,requiresItemSelection:!1},{key:"expandIconSize",labelKey:"settingExpandIconSize",values:[8,13,5],formatValue:(e,t)=>e.expandIconSizeValue(t),requiresItemSelection:!1},g("alwaysExpanded","settingAlwaysExpanded"),g("removeRootIndent","settingRemoveRootIndent"),g("lines","settingTreeLines"),g("expandIcons","settingExpandIcons"),g("directoryIcons","settingDirectoryIcons"),g("fileIcons","settingFileIcons")]),le=e=>e?w:w.filter(t=>!t.requiresItemSelection),U=e=>{const t=w.find(r=>r.key===e);if(t===void 0)throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);return t},de=(e,t)=>{const r=U(t).values,n=r[(r.indexOf(e[t])+1)%r.length];return{...e,[t]:n}},ue=(e,t,r)=>U(r).formatValue(e,t[r]),X=2,P=Object.freeze({}),C=(e,t)=>Object.freeze(Object.fromEntries(w.filter(r=>t(r,e[r.key])).map(r=>[r.key,e[r.key]]))),me=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return P;const t=e;return t.version!==X||t.settings===null||typeof t.settings!="object"||Array.isArray(t.settings)?P:C(t.settings,(r,n)=>r.values.includes(n))},fe=(e,t)=>{const r=C(t,(n,o)=>o!==void 0&&o!==e[n.key]);return Object.keys(r).length===0?e:Object.freeze({...e,...r})},ge=(e,t,r,n)=>C({...e,[t]:r},(o,i)=>i!==void 0&&!(o.key===t&&i===n[t])),Ee=e=>JSON.stringify({version:X,settings:e}),we=e=>{if(e.sortMode==="native"&&!e.directoriesFirst)return;const t=e.sortMode==="desc"?-1:1;return(r,n)=>{if(e.directoriesFirst&&r.type!==n.type)return r.type==="directory"?-1:1;if(e.sortMode==="native")return 0;const o=I.compare(r.name,n.name);return t*(o!==0?o:I.compare(r.path,n.path))}},u=(1+Math.sqrt(5))/2,Se=100/u**3,pe=100/u**4,D=100/u**2,G=13,he=16,_e=Object.freeze({gripThickness:5,gripLength:34,barThickness:2,barLength:21}),ye=Object.freeze([89,144,233,377]),Oe=34,Te=44,xe=24,Ne=1/u,Ae=1/u**3,Re="40ch",be=e=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`)},W=e=>(be(e),G*e),Ie=e=>W(e)*u**2,Le=233,Pe=ye[0],z=(e,t)=>{if(!Number.isFinite(t)||t<0)throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`)},Me=({trackInlineSize:e,gap:t,minColumnInlineSize:r,logicalColumns:n})=>{if(z("trackInlineSize",e),z("gap",t),!Number.isFinite(r)||r<=0)throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);if(!Number.isInteger(n)||n<1)throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(n)}`);const o=Math.floor((e+t)/(r+t));return Math.min(n,Math.max(1,o))},ke=(e,t)=>{const{trackInlineSize:r,gap:n,minColumnInlineSize:o,logicalColumns:i}=t;if(!([r,n,o].every(Number.isFinite)&&r>0&&n>=0&&o>0))return e;const s=Me(t);if(e===null||s===e)return s;const l=Math.min(i,Math.max(1,e));if(s>l){const x=(l+1)*o+l*n+n/u;return r>=x?s:l}return r>=l*o+(l-1)*n?l:s},$e=(e,t)=>{if(!(Number.isInteger(e)&&Number.isInteger(t))||t<1||t>e)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);return Array.from({length:t},(r,n)=>[Math.floor(n*e/t),Math.floor((n+1)*e/t)])},ve=31536e3,Ce=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u,De=e=>{if(typeof e!="string"||!Ce.test(e))throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`)},j=e=>typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=D,ze=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))return{};const r=e,{treeExplorer:n,multiExplorer:o,style:i,align:a}=r;return{...j(n)?{treeExplorer:n}:{},...j(o)?{multiExplorer:o}:{},...typeof i=="string"&&t.includes(i)?{style:i}:{},...typeof a=="string"&&h.CONTENT_ALIGNS.includes(a)?{align:a}:{}}},je=(e,t)=>{if(e!==null)for(const r of e.split(";")){const n=r.indexOf("=");if(!(n<0)&&r.slice(0,n).trim()===t)return r.slice(n+1).trim()}},Fe=(e,t)=>{if(e===void 0||e==="")return{};try{return ze(JSON.parse(decodeURIComponent(e)),t)}catch{return{}}},O=100,Ve=Math.floor(D*O)/O,Ue=e=>{const t=r=>Math.min(Ve,Math.max(1,Math.round(r*O))/O);return encodeURIComponent(JSON.stringify({...e.treeExplorer===void 0?{}:{treeExplorer:t(e.treeExplorer)},...e.multiExplorer===void 0?{}:{multiExplorer:t(e.multiExplorer)},...e.style===void 0?{}:{style:e.style},...e.align===void 0?{}:{align:e.align}}))},Xe=(e,t,r)=>`${e}=${Ue(t)}; Path=/; Max-Age=${String(ve)}; SameSite=Lax${r?"; Secure":""}`,M=Object.freeze({tree:"tree",multi:"multi",single:"single"}),J=Object.freeze({default:12,min:1,max:64}),H=Object.freeze({default:4,min:1,max:6}),q=Object.freeze({default:500,min:1,max:1e4}),B=Object.freeze({default:16,min:1,max:64}),Ge=/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u,We=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,Je=/^[a-z0-9][a-z0-9-]*$/u,He=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u,F=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);if(!Ge.test(t)||t.split("/").some(r=>r==="."||r===".."))throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`)},E=e=>typeof e=="string"?JSON.stringify(e):typeof e=="bigint"?`${String(e)}n`:Object.is(e,-0)?"-0":typeof e=="function"?"a function":Array.isArray(e)?"an array":e!==null&&typeof e=="object"?v(e)?"a plain object":`a non-plain object (${Object.prototype.toString.call(e)})`:String(e),T=(e,t,r)=>{if(t===void 0)return[];if(!v(t))throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${E(t)}`);const n=Object.entries(t);for(const[o]of n)if(!r.includes(o))throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);return n.filter(([,o])=>o!==void 0)},qe=e=>{const t={...M};for(const[r,n]of T("views",e,Object.keys(M)))t[r]=n;for(const[r,n]of Object.entries(t))if(typeof n!="string"||!We.test(n))throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);return Object.freeze(t)},y=(e,t,r)=>{if(t===void 0)return r.default;if(typeof t!="number"||!Number.isInteger(t)||t<r.min||t>r.max)throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${E(t)}`);return t},Be=e=>{const t=new Map(T("defaultTreeSettings",e,w.map(n=>n.key)));if(t.size===0)return L;const r={...L};for(const n of w){if(!t.has(n.key))continue;const o=t.get(n.key),i=n.values;if(!i.includes(o))throw new RangeError(`[markdown-explorer] defaultTreeSettings.${n.key} must be one of ${i.map(E).join(", ")}; got ${E(o)}`);r[n.key]=o}return Object.freeze(r)},Ke=e=>{if(e===null||typeof e!="object")throw new TypeError("[markdown-explorer] the explorer configuration must be an object");F("basePath",e.basePath),F("dataPath",e.dataPath);const t=qe(e.views);if(new Set([t.tree,t.multi,t.single]).size!==3)throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);if(e.dataPath===e.basePath)throw new RangeError("[markdown-explorer] dataPath must differ from basePath");if(e.dataPath.startsWith(`${e.basePath}/`)){const s=e.dataPath.slice(e.basePath.length+1).split("/")[0];if(s===t.tree||s===t.multi||s===t.single)throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`)}De(e.settingsCookie);const r=e.iframeHosts??[];if(!Array.isArray(r)||r.some(s=>typeof s!="string"||!He.test(s)))throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);const n=Object.fromEntries(T("multiView",e.multiView,["maxPanels","columns"])),o=Object.fromEntries(T("expandAll",e.expandAll,["maxFolders","maxDepth"])),i=e.documentStyles??h.DEFAULT_MARKDOWN_STYLES;if(!Array.isArray(i)||i.length===0)throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");const a=new Set;for(const s of i){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name.trim()===""||typeof s.className!="string")throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");if(a.has(s.name))throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(s.name)} repeats`);a.add(s.name)}return Object.freeze({basePath:e.basePath,dataPath:e.dataPath,settingsCookie:e.settingsCookie,views:t,multiView:Object.freeze({maxPanels:y("multiView.maxPanels",n.maxPanels,J),columns:y("multiView.columns",n.columns,H)}),expandAll:Object.freeze({maxFolders:y("expandAll.maxFolders",o.maxFolders,q),maxDepth:y("expandAll.maxDepth",o.maxDepth,B)}),documentStyles:Object.freeze(i.map(s=>Object.freeze({name:s.name,className:s.className}))),iframeHosts:Object.freeze([...new Set(r)]),defaultTreeSettings:Be(e.defaultTreeSettings)})},K=e=>typeof e=="string"&&Je.test(e),Ze=(e,t)=>{if(e===null||typeof e!="object")throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${E(e)}`);if(!Array.isArray(t)||t.length===0)throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${E(t)}`);for(const r of t)if(!K(r))throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${E(r)}`);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);return Object.freeze({...e,sourceIds:Object.freeze([...t])})},Ye=e=>e.documentStyles.map(t=>t.name),c=Object.freeze({source:"source",doc:"doc",maximized:"maximized",style:"style",align:"align",showToc:"showToc",showStyle:"showStyle",showAlign:"showAlign",padding:"padding",width:"width",maxWidth:"maxWidth"}),V=".data",Z=256,Y=/^\d+(?:\.\d+)?$/u,k=/^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u,Q=Object.freeze(["showToc","showStyle","showAlign"]),Qe=e=>{const t=encodeURIComponent(e.replaceAll("%","%25"));return t.endsWith(V)?`${t.slice(0,-V.length)}%2Edata`:t},et=e=>e.replaceAll("%25","%"),ee=e=>{const{sourceIds:t}=e;if(t===void 0)throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");return t},tt=(e,t,r)=>{const n=r.getAll(c.source);if(n.length===0)return t;const[o]=n;return n.length>1||o===void 0||o===t||!e.includes(o)?null:o},rt=(e,t)=>{const r=t.get(c.style),n=t.get(c.align);return{...r!==null&&e.documentStyles.some(o=>o.name===r)?{style:r}:{},...n!==null&&h.CONTENT_ALIGNS.includes(n)?{align:n}:{}}},te=e=>Number.isFinite(e)&&e>=0&&e<=Z&&Y.test(String(e)),nt=e=>{const t=e.get(c.padding),r=t!==null&&Y.test(t)?Number(t):Number.NaN,n=e.get(c.width),o=e.get(c.maxWidth);return{...e.get(c.showToc)==="false"?{showToc:!1}:{},...e.get(c.showStyle)==="false"?{showStyle:!1}:{},...e.get(c.showAlign)==="false"?{showAlign:!1}:{},...te(r)?{padding:r}:{},...n!==null&&k.test(n)?{width:n}:{},...o!==null&&k.test(o)?{maxWidth:o}:{}}},re=(e,t)=>[...new Set(t.filter($.isAcceptableDocumentPath))].slice(0,e.multiView.maxPanels),ot=(e,t,r)=>{for(const n of t)ne(n);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] multi-view documents must each appear once; got ${String(t.length)} with repeats`);if(t.length>e.multiView.maxPanels)throw new RangeError(`[markdown-explorer] the multi view opens at most ${String(e.multiView.maxPanels)} documents; got ${String(t.length)}`);if(r!==null&&!t.includes(r))throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(r.slice(0,80))}`)},ne=e=>{if(!$.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0,80))}`);return e},it=(e,t)=>{if(t.style!==void 0&&!e.documentStyles.some(r=>r.name===t.style))throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map(r=>JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);if(t.align!==void 0&&!h.CONTENT_ALIGNS.includes(t.align))throw new RangeError(`[markdown-explorer] overrides.align must be one of ${h.CONTENT_ALIGNS.join(", ")}; got ${JSON.stringify(t.align)}`)},st=e=>{for(const t of Q)if(e[t]!==void 0&&typeof e[t]!="boolean")throw new RangeError(`[markdown-explorer] embed.${t} must be a boolean; got ${JSON.stringify(e[t])}`);if(e.padding!==void 0&&!te(e.padding))throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(Z)} px in plain decimal digits; got ${String(e.padding)}`);for(const t of["width","maxWidth"]){const r=e[t];if(r!==void 0&&!k.test(r))throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`)}},oe=(e,t)=>{const r=new URLSearchParams;let n=`${e.basePath}/${e.views[t.view]}`;if(t.view==="multi"){const i=t.docs??[],a=t.maximized??null;ot(e,i,a);for(const s of i)r.append(c.doc,s);a!==null&&r.set(c.maximized,a)}else t.doc!==void 0&&t.doc!==null&&(n+=`/${Qe(ne(t.doc))}`);if(t.source!==void 0){const i=ee(e);if(!i.includes(t.source))throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${i.join(", ")}`);t.source!==i[0]&&r.set(c.source,t.source)}if(t.view!=="multi"&&t.overrides!==void 0&&(it(e,t.overrides),t.overrides.style!==void 0&&r.set(c.style,t.overrides.style),t.overrides.align!==void 0&&r.set(c.align,t.overrides.align)),t.view==="single"&&t.embed!==void 0){const{embed:i}=t;st(i);for(const a of Q)i[a]===!1&&r.set(c[a],"false");i.padding!==void 0&&r.set(c.padding,String(i.padding)),i.width!==void 0&&r.set(c.width,i.width),i.maxWidth!==void 0&&r.set(c.maxWidth,i.maxWidth)}const o=r.toString();return o===""?n:`${n}?${o}`},at=(e,t)=>Object.keys(e.views).find(r=>e.views[r]===t),ct=(e,t,r)=>{const n=ee(e),[o]=n;if(o===void 0)throw new RangeError("[markdown-explorer] the configuration has no source");const i=tt(n,o,r),a=i===null?o:i,s=d=>({kind:"redirect",href:oe(e,d),location:d}),l=()=>s({view:"tree",source:a,doc:null,overrides:{}});if(t===void 0||t==="")return l();const S=t.indexOf("/"),x=S<0?t:t.slice(0,S),N=S<0?null:t.slice(S+1),m=at(e,x);if(m===void 0)return l();if(m==="multi"){const d=r.getAll(c.doc),p=re(e,d),A=r.getAll(c.maximized),[R]=A,b=A.length===1&&R!==void 0&&p.includes(R)?R:null;return N===null&&i!==null&&p.length===d.length&&p.every((ie,se)=>ie===d[se])&&(A.length===0||b!==null)?{kind:"location",location:{view:"multi",source:a,docs:p,maximized:b}}:s({view:"multi",source:a,docs:p,maximized:b})}const f=N===null?null:et(N);if(f!==null&&!$.isAcceptableDocumentPath(f))return l();const _=rt(e,r);if(m==="single"){if(f===null)return l();const d=nt(r);return i===null?s({view:m,source:a,doc:f,overrides:_,embed:d}):{kind:"location",location:{view:m,source:a,doc:f,overrides:_,embed:d}}}return i===null?s({view:m,source:a,doc:f,overrides:_}):{kind:"location",location:{view:m,source:a,doc:f,overrides:_}}};exports.ASSUMED_ROOT_FONT_PIXELS=he;exports.COARSE_TARGET_PIXELS=Te;exports.COLUMN_MIN_MEASURE=Re;exports.CONTROL_BLOCK_PIXELS=Oe;exports.DEFAULT_TREE_SETTINGS=L;exports.DEFAULT_VIEW_SLUGS=M;exports.EXPAND_ALL_DEPTH_LIMITS=B;exports.EXPAND_ALL_FOLDER_LIMITS=q;exports.EXPLORER_DEFAULT_PERCENT=Se;exports.EXPLORER_MAX_PERCENT=D;exports.EXPLORER_MIN_REM=G;exports.EXPLORER_MULTI_DEFAULT_PERCENT=pe;exports.EXPLORER_WIDTH_PERSIST_DELAY_MS=Le;exports.FINE_TARGET_PIXELS=xe;exports.GOLDEN_RATIO=u;exports.MULTI_VIEW_COLUMN_LIMITS=H;exports.MULTI_VIEW_PANEL_LIMITS=J;exports.NAME_COLLATOR=I;exports.NO_TREE_SETTING_CHANGES=P;exports.PANEL_MAX_BLOCK_RATIO=Ne;exports.PANEL_MIN_BLOCK_RATIO=Ae;exports.PREFETCH_DWELL_MS=Pe;exports.SPLIT_HANDLE_PIXELS=_e;exports.advanceTreeSetting=de;exports.applyTreeSettingChanges=fe;exports.canonicalMultiDocuments=re;exports.columnGroups=$e;exports.createEntryComparator=we;exports.defineExplorerConfig=Ke;exports.documentStyleNames=Ye;exports.explorerHref=oe;exports.explorerMinPixels=W;exports.explorerSheetBelowPixels=Ie;exports.formatTreeSettingValue=ue;exports.isExplorerSourceId=K;exports.isPlainObject=v;exports.parseViewSettings=Fe;exports.readCookieValue=je;exports.readTreeSettingChanges=me;exports.recordTreeSettingChange=ge;exports.replanVisibleColumns=ke;exports.resolveExplorerLocation=ct;exports.serializeTreeSettingChanges=Ee;exports.viewSettingsCookieString=Xe;exports.visibleTreeSettingDescriptors=le;exports.withExplorerSources=Ze;