@aiquants/markdown-explorer 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +20 -2
- package/dist/ExplorerSplit-CWcK1E4I.js +1495 -0
- package/dist/ExplorerSplit-ajN3GSdA.cjs +1 -0
- package/dist/{MultiLayout-8s7q3-Hm.js → MultiLayout-BtWtCzJV.js} +69 -66
- package/dist/MultiLayout-DvkcdO9c.cjs +1 -0
- package/dist/{NativeScrollBar-DqkutcGb.cjs → NativeScrollBar-DbzyQ85y.cjs} +1 -1
- package/dist/{NativeScrollBar-D3VDRQqf.js → NativeScrollBar-apXjIKRW.js} +1 -1
- package/dist/TreeLayout-BcHsv9G8.js +23 -0
- package/dist/TreeLayout-rwhJfLmU.cjs +1 -0
- package/dist/core/contracts.d.cts +13 -0
- package/dist/core/contracts.d.ts +13 -0
- package/dist/{dataRoute-Dl6xmEFs.js → dataRoute-Btg4w3vO.js} +70 -65
- package/dist/dataRoute-DHpu0fg2.cjs +1 -0
- package/dist/{index-Dv9lUZqD.js → index-CIZw73j9.js} +539 -519
- package/dist/index-Cie6WPiM.cjs +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/{location-2QZADLiv.cjs → location-CSIhx-L4.cjs} +1 -1
- package/dist/{location-CaNtUswk.js → location-c1zdeySY.js} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/errors.d.cts +1 -1
- package/dist/server/errors.d.ts +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +597 -589
- package/docs/behavior/security.md +1 -1
- package/docs/behavior/url-contract.md +1 -0
- package/package.json +1 -1
- package/dist/ExplorerSplit-rUVsf5i-.cjs +0 -1
- package/dist/ExplorerSplit-uX2ojZe8.js +0 -1479
- package/dist/MultiLayout-ZK2V9nms.cjs +0 -1
- package/dist/TreeLayout-C7ZNnaOr.js +0 -22
- package/dist/TreeLayout-DkTVgxxb.cjs +0 -1
- package/dist/dataRoute-DYjYBiXF.cjs +0 -1
- package/dist/index-CLe6vRXs.cjs +0 -3
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),u=require("react"),B=require("./location-2QZADLiv.cjs"),k=require("./index-CLe6vRXs.cjs"),ne=require("./ExplorerSplit-rUVsf5i-.cjs"),D=require("@aiquants/drag-drop-panels"),me=require("react-router"),Z=require("./storage-Bkb2Axdi.cjs"),be=require("./dataRoute-DYjYBiXF.cjs"),Be=require("react-dom"),je=require("@aiquants/markdown"),Fe=require("./scrollBarGeometry-C46jBtmM.cjs"),Ve=()=>{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}}},Ce=u.createContext(null),re=()=>{const e=u.use(Ce);if(e===null)throw new Error("[markdown-explorer] multi-view panels must be rendered inside the multi-view stage");return e},Ue=(e,n)=>{const t=e.pendingHashes.get(n);return t===void 0?null:t},$e=0xcbf29ce484222325n,Ge=0x100000001b3n,Ye=(1n<<64n)-1n,We=(1n<<53n)-1n,Ke=new TextEncoder,Je=e=>{let n=$e;for(const t of Ke.encode(e))n=(n^BigInt(t))*Ge&Ye;return Number(n&We)},J=256,Xe=e=>`aqmx-p-${Je(e).toString(36)}`,Pe=(e,n)=>{const t=Xe(e);let o=t;for(let r=2;n.has(o);r+=1)o=`${t}-${String(r)}`;return o},Ze=new Map,Qe=(e,n=Ze)=>{const t=new Set(e.flatMap(r=>n.get(r)??[])),o=new Map;for(const r of e){const s=n.get(r)??Pe(r,t);t.add(s),o.set(r,s)}return o},Le=(e,n,t)=>{const o=e.columnOf.get(n);return o===void 0?void 0:Math.min(t-1,Math.max(0,o))},Me=(e,n)=>{const[t,...o]=B.columnGroups(n.logical,n.visible);if(t===void 0)throw new RangeError("[markdown-explorer] there must be at least one visible column");const r=([a,f])=>e.slice(a,f).reduce((c,g)=>c+g.length,0);let s=t;for(const a of o)r(a)<r(s)&&(s=a);let l=s[0];for(let a=s[0];a<s[1];a+=1)(e[a]?.length??0)<(e[l]?.length??0)&&(l=a);return l},X=(e,n)=>{const t=Array.from({length:n.logical},()=>[]),o=[];for(const r of e.docs){const s=Le(e,r,n.logical);s===void 0?o.push(r):t[s]?.push(r)}for(const r of o)t[Me(t,n)]?.push(r);return t},en=(e,n)=>B.columnGroups(e.length,n).map(([t,o])=>e.slice(t,o).flat()),nn=(e,n,t)=>{const[o,r]=n,s=r-o,l=e.length,a=Array.from({length:s},(d,p)=>{const m=[0];for(const O of e)m.push((m.at(-1)??0)+(t(O)===o+p?1:0));return m}),f=(d,p,m)=>(a[d]?.[m]??0)-(a[d]?.[p]??0),c=Array.from({length:s+1},()=>Array.from({length:l+1},()=>Number.NEGATIVE_INFINITY)),g=Array.from({length:s+1},()=>Array.from({length:l+1},()=>0)),y=c[0];y&&(y[0]=0);for(let d=0;d<s;d+=1)for(let p=0;p<=l;p+=1)for(let m=0;m<=p;m+=1){const O=(c[d]?.[m]??Number.NEGATIVE_INFINITY)+f(d,m,p),x=c[d+1],T=g[d+1];x&&T&&O>(x[p]??Number.NEGATIVE_INFINITY)&&(x[p]=O,T[p]=m)}const L=Array.from({length:s},()=>[]);let E=l;for(let d=s;d>0;d-=1){const p=g[d]?.[E]??0;L[d-1]=e.slice(p,E),E=p}return L},Te=(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}},tn=(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=Le(e,n,t.logical)??Me(r,t);r[s]?.push(n);const l=new Map(e.panelIds);return l.set(n,Pe(n,new Set(l.values()))),{state:{...e,...Te(e,r),panelIds:l},outcome:"opened"}},Re=(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}},on=(e,n,t,o)=>{if(e.hidden.has(n))return{state:Ne(e,n,!1),outcome:"shown"};if(e.docs.includes(n))return{state:Re(e,n),outcome:"closed"};const r=tn(e,n,t,o);return{state:r.state,outcome:r.outcome==="rejected"?"rejected":"opened"}},rn=(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),a=l.get(n);if(a===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);return l.delete(n),l.set(t,a),{state:{docs:e.docs.map(f=>f===n?t:f),maximized:e.maximized===n?t:e.maximized,columnOf:o,hidden:s,panelIds:l},outcome:"navigated"}},Ne=(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}},sn=(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}},ln=(e,n,t)=>{const o=X(e,t),r=new Map;for(const[c,g]of o.entries())for(const y of g)r.set(y,c);const s=new Set(e.docs),l=new Set,a=B.columnGroups(t.logical,t.visible),f=Array.from({length:t.logical},()=>[]);for(const[c,g]of a.entries()){const y=(n[c]??[]).filter(L=>s.has(L)&&!l.has(L));for(const L of y)l.add(L);for(const[L,E]of nn(y,g,d=>r.get(d)).entries())f[g[0]+L]?.push(...E)}for(const c of e.docs)l.has(c)||f[r.get(c)??0]?.push(c);return f.every((c,g)=>c.length===o[g]?.length&&c.every((y,L)=>o[g]?.[L]===y))?e:{...e,...Te(e,f)}},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:Qe(t,e.panelIds)}},fe=(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,F=Object.freeze({columnOf:new Map,hidden:new Set}),cn=(e,n)=>{if(e===null||e==="")return F;let t;try{t=JSON.parse(e)}catch{return F}if(t===null||typeof t!="object"||Array.isArray(t))return F;const o=t;if(o.v!==Ie)return F;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}},an=e=>JSON.stringify({v:Ie,columnOf:[...e.columnOf.entries()].slice(-J),hidden:e.docs.filter(n=>e.hidden.has(n))}),se=(e,n)=>{const t=e.get(n);return t===void 0?be.lastPathSegment(n):t},$=e=>{const n=new Map;for(const[t,o]of e.panelIds)n.set(o,t);return n},pe=e=>{if(!be.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0,80))}`)},un=({config:e,location:n,writeUrl:t,persist:o})=>{const{maxPanels:r,columns:s}=e.multiView,l=k.createEmitter(),a=new Map,f=new Map;let c={layout:Q({docs:n.docs,maximized:n.maximized,stored:F},r),source:n.source,visibleColumns:s,ready:!1,splitDragging:!1,titles:new Map,pendingHashes:new Map},g=!1;const y=i=>g?fe(i,{logical:s,visible:c.visibleColumns}):i,L=(i,v)=>B.explorerHref(e,{view:"multi",source:i,docs:v.docs,maximized:v.maximized});let E=L(n.source,n),d=n.source,p=E;const m=[],O=[];let x=null;const T=()=>{if(!(m.length>0))for(const i of O.splice(0))i()},h=i=>{c={...c,...i},l.emit()},b=()=>{if(!c.ready)return;const i=an(c.layout);i!==x&&(x=i,o(i))},S=(i,v,M)=>{const A=L(i,v);A!==E&&(E=A,d=i,m.push(A),t(A,M))},P=i=>{const v=new Set(i.panelIds.values());for(const C of[...a.keys()])v.has(C)||a.delete(C);for(const C of[...f.keys()])v.has(C)||f.delete(C);const M=new Set(i.docs),A=[...c.titles.keys()].every(C=>M.has(C))?c.titles:new Map([...c.titles].filter(([C])=>M.has(C))),w=[...c.pendingHashes.keys()].every(C=>v.has(C))?c.pendingHashes:new Map([...c.pendingHashes].filter(([C])=>v.has(C)));return{titles:A,pendingHashes:w}},N=i=>i===c.layout?!1:(h({layout:i,...P(i)}),S(d,i,"replace"),b(),!0),I=()=>({logical:s,visible:c.visibleColumns});return{getSnapshot:()=>c,subscribe:l.subscribe,toggle:i=>{pe(i);const{state:v,outcome:M}=on(c.layout,i,I(),r);return N(v),M},close:i=>N(Re(c.layout,i)),navigate:(i,v)=>{pe(v);const{state:M,outcome:A}=rn(c.layout,i,v);if(A!=="navigated")return A;const w=M.panelIds.get(v);return w!==void 0&&(a.delete(w),f.delete(w)),N(M),A},setHidden:(i,v)=>N(Ne(c.layout,i,v)),maximize:i=>N(sn(c.layout,i)),arrange:i=>N(ln(c.layout,i,{logical:s,visible:i.length})),changeSource:i=>{S(i,c.layout,"push")},observeLocation:i=>{const v=L(i.source,i);if(v===E)return m.length=0,p=v,i.source!==c.source&&h({source:i.source}),T(),!1;if(v===p)return!1;p=v;const M=m.indexOf(v);if(M>=0)return m.splice(0,M+1),i.source!==c.source&&h({source:i.source}),T(),!1;m.length=0,E=v,d=i.source;const A=y(Q({docs:i.docs,maximized:i.maximized,stored:{columnOf:c.layout.columnOf,hidden:c.layout.hidden},panelIds:c.layout.panelIds},r));return h({layout:A,source:i.source,...P(A)}),b(),T(),!0},whenUrlRendered:i=>{O.push(i),T()},loadStored:i=>{h({layout:y(Q({docs:c.layout.docs,maximized:c.layout.maximized,stored:i,panelIds:c.layout.panelIds},r)),ready:!0}),b()},setVisibleColumns:i=>{if(!Number.isInteger(i)||i<1||i>s)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(s)}; got ${String(i)}`);g=!0;const v=fe(c.layout,{logical:s,visible:i});i===c.visibleColumns&&v===c.layout||(h({visibleColumns:i,layout:v}),v!==c.layout&&b())},setSplitDragging:i=>{i!==c.splitDragging&&h({splitDragging:i})},setTitle:(i,v)=>{!c.layout.docs.includes(i)||c.titles.get(i)===v||h({titles:new Map(c.titles).set(i,v)})},titleOf:i=>se(c.titles,i),setPendingHash:(i,v)=>{const M=c.pendingHashes.get(i);if(v===null||v===""){if(M===void 0)return;const A=new Map(c.pendingHashes);A.delete(i),h({pendingHashes:A});return}M!==v&&h({pendingHashes:new Map(c.pendingHashes).set(i,v)})},saveReadingPosition:(i,v,M)=>{c.layout.panelIds.get(v)===i&&a.set(i,{doc:v,position:M})},readingPositionOf:(i,v)=>{const M=a.get(i);return M===void 0||M.doc!==v?null:M.position},saveImageView:(i,v,M)=>{f.set(i,{url:v,state:M})},imageViewOf:(i,v)=>{const M=f.get(i);return M===void 0||M.url!==v?null:M.state}}},z=(e,n)=>{const t=()=>n(e.getSnapshot());return u.useSyncExternalStore(e.subscribe,t,t)},dn=e=>{const{config:n,storageNamespace:t}=k.useExplorer(),o=me.useNavigate(),r=u.useRef(o),s=Z.storageKeys(t).multiLayout,[l]=u.useState(()=>un({config:n,location:e,writeUrl:(c,g)=>{r.current(c,k.explorerNavigationOptions(g==="replace"?"browse":"switch-source"))},persist:c=>Z.writeStorage(s,c)}));u.useLayoutEffect(()=>{r.current=o},[o]);const a=me.useLocation(),f=u.useMemo(()=>({location:e,navigated:a}),[e,a]);return u.useLayoutEffect(()=>{l.observeLocation(f.location)},[l,f]),u.useLayoutEffect(()=>{l.loadStored(cn(Z.readStorage(s),n.multiView.columns))},[l,s,n]),l},mn=e=>{const n=e.closest(D.SCROLL_AREA_SELECTOR);if(n===null)throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");return n},fn=({docPath:e,panelId:n,maximized:t,title:o,onContentShown:r})=>{const{store:s,followLink:l,revealInPanel:a}=re(),{announcer:f}=k.useExplorer(),c=z(s,x=>Ue(x,n)),g=u.useCallback((x,T)=>l(n,e,x,T),[l,n,e]),y=u.useCallback(()=>s.setPendingHash(n,null),[s,n]),L=u.useMemo(()=>({read:x=>s.imageViewOf(n,x),save:(x,T)=>s.saveImageView(n,x,T)}),[s,n]),E=u.useCallback((x,T)=>{T.kind!=="failure"&&s.setTitle(x,T.name),r(x)},[s,r]),d=u.useCallback(x=>{s.whenUrlRendered(()=>f.announce(x))},[s,f]),p=u.useMemo(()=>({scrollerOf:mn,reveal:x=>a(n,x)}),[a,n]),m=u.useMemo(()=>({kind:"panel",maximized:t,onDocumentLink:g,pendingHash:c,onHashConsumed:y,announceFailure:d,paneScroll:p}),[t,g,c,y,d,p]),O=u.useMemo(()=>({kind:"panel",documentName:o}),[o]);return R.jsxs(k.ImageViewMemoryContext,{value:L,children:[R.jsx(k.DocumentRefreshBar,{path:e,placement:O}),R.jsx(k.DocumentPane,{path:e,variant:m,onDocumentShown:E})]})},ge=()=>typeof HTMLElement<"u"&&typeof HTMLElement.prototype.showPopover=="function"&&typeof HTMLElement.prototype.hidePopover=="function",le="data-aqmx-column-probe",Y="data-panel-id",te="--aqmx-multi-panel-chrome",j=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,pn=e=>e==="normal"?0:j(e),gn=(e,n)=>{const t=e.querySelector(D.SCROLL_ROOT_SELECTOR)?.firstElementChild,o=e.querySelector(`[${le}]`),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),a=t.clientHeight-j(s.paddingTop)-j(s.paddingBottom);return{plan:{trackInlineSize:l,gap:pn(s.columnGap),minColumnInlineSize:r,logicalColumns:n},stageBlockSize:a}},hn=(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)},W="data-aqmx-panel-frame",he="--aqmx-multi-panel-pinned-block-size",vn=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}},yn=e=>{const n=getComputedStyle(e),t=Number.parseFloat(n.lineHeight);return Number.isFinite(t)?t:Number.parseFloat(n.fontSize)},Sn=(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(D.SCROLL_AREA_SELECTOR);return n instanceof HTMLElement?n:null},Ae=e=>{const n=e.firstElementChild;return n instanceof HTMLElement&&getComputedStyle(n).position==="sticky"?n:null},De=(e,n)=>{const t=n.getBoundingClientRect().top,o=Ae(e);return o===null?t:Math.max(t,o.getBoundingClientRect().bottom)},ve=(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},xn=(e,n)=>{const t=De(e,n),o=[];let r=e;for(let s=ve([...r.children],t);s>=0;s=ve([...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}}},ye=(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-De(e,n)-t.anchor.offset)},wn=Object.freeze(["data-testid","aria-label","title","href","id","name"]),_e=e=>JSON.stringify([e.tagName,...wn.map(n=>e.getAttribute(n))]),En=(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:_e(n)}},On=(e,n,t)=>{let o=e;for(const r of t.path)o=o?.children[r];o instanceof HTMLElement&&_e(o)===t.signature&&k.focusWithoutScroll(o)||n.focus({preventScroll:!0})},bn=(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(D.SCROLL_ROOT_SELECTOR);if(!(r instanceof HTMLElement))return;const s=Sn(e,r,t);(o||Cn(r,s))&&(e.preventDefault(),r.scrollTop+=s)},Cn=(e,n)=>n<0?e.scrollTop>0:n>0?Math.ceil(e.scrollTop+e.clientHeight)<e.scrollHeight:!1,Pn=e=>e.scrollHeight>e.clientHeight,Ln=(e,n,t)=>{let o=Number.NaN,r=Number.NaN;const s=Ae(t),l=()=>{const c=hn(e,n);if(!Number.isFinite(c))return;const g=s===null?0:s.getBoundingClientRect().height;g!==r&&(r=g,t.style.setProperty(he,`${String(g)}px`));const y=c+g;y!==o&&(o=y,e.style.setProperty(te,`${String(y)}px`))};l();let a=null;const f=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{a===null&&(a=requestAnimationFrame(()=>{a=null,l()}))});return f?.observe(e),f?.observe(n),s!==null&&f?.observe(s),()=>{f?.disconnect(),a!==null&&cancelAnimationFrame(a),e.style.removeProperty(te),t.style.removeProperty(he)}},Mn=e=>{const{docPath:n,panelId:t}=vn(e),{store:o,Body:r,maximize:s,focusCarry:l}=re(),a=z(o,d=>d.layout.maximized===n),f=z(o,d=>se(d.titles,n)),c=u.useRef(null),g=u.useRef(null),y=u.useRef(null);u.useEffect(()=>{const d=c.current,p=d===null?null:V(d);if(d===null||p===null||a)return;const m=new Map,O=S=>{const P=m.get(S);if(P!==void 0)return P;const N=yn(S);return m.set(S,N),N},x=S=>bn(S,d,O);let T=!1;const h=()=>{const S=Pn(p);S!==T&&(T=S,S?d.addEventListener("wheel",x,{capture:!0,passive:!1}):d.removeEventListener("wheel",x,{capture:!0}))};h();const b=typeof ResizeObserver>"u"?null:new ResizeObserver(h);return b?.observe(p),b?.observe(d),()=>{b?.disconnect(),d.removeEventListener("wheel",x,{capture:!0})}},[a]),u.useLayoutEffect(()=>{const d=c.current,p=d===null?null:V(d),m=d===null?null:d.closest(`[${Y}]`);if(!(d===null||p===null||!(m instanceof HTMLElement)))return Ln(m,p,d)},[]),u.useLayoutEffect(()=>{const d=c.current,p=d===null?null:V(d);if(d===null||p===null)return;const m=o.readingPositionOf(t,n);g.current=m===null?null:{doc:n,position:m},m!==null&&ye(d,p,m);let O=null;const x=()=>{O===null&&(O=requestAnimationFrame(()=>{O=null;const T=y.current;T!==null&&o.saveReadingPosition(t,T,xn(d,p))}))};return p.addEventListener("scroll",x,{passive:!0}),()=>{p.removeEventListener("scroll",x),O!==null&&cancelAnimationFrame(O)}},[o,t,n]),u.useLayoutEffect(()=>{const d=c.current,p=d===null?null:d.closest(`[${Y}]`);if(d===null||p===null)return;const m=l.take(t);return m!==null&&On(p,d,m),()=>{const O=En(p,p.ownerDocument.activeElement);O!==null&&l.hold(t,O)}},[l,t]);const L=u.useCallback(d=>{const p=c.current,m=p===null?null:V(p);if(p===null||m===null)return;const O=y.current;y.current=d;const x=g.current;g.current=null,x!==null&&x.doc===d?ye(p,m,x.position):O!==null&&O!==d&&(m.scrollTop=0)},[]),E=u.useCallback(()=>s(n),[s,n]);return R.jsx("div",{ref:c,role:"group","aria-label":f,className:"aqmx-multi-panel-frame",tabIndex:-1,"data-aqmx-panel-frame":t,"data-aqmx-maximized":a?"true":"false","data-testid":"markdown-explorer-panel-frame",onDoubleClick:a?void 0:E,children:R.jsx(r,{docPath:n,panelId:t,maximized:a,title:f,onContentShown:L})})},Tn=u.memo(Mn),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},Se=e=>Object.fromEntries(D.generateColumnIds(e).map(n=>[n,[]])),Rn=(e,n)=>{const t=en(X(e,n),n.visible);return Object.fromEntries(t.map((o,r)=>[D.generateColumnId(r),o.map(s=>G(e,s))]))},Nn=(e,n)=>{const t=$(e);return D.sortColumnIds(Object.keys(n)).map(o=>(n[o]??[]).flatMap(r=>{const s=t.get(r);return s===void 0?[]:[s]}))},In=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}),An="--aqmx-multi-stage-bar-gutter",Dn=Object.freeze({[An]:`${String(Fe.NATIVE_SCROLL_BAR_WIDTH)}px`}),_n=Object.freeze({blockSize:"100%"}),kn=Object.freeze({[D.NO_PANEL_DRAG_ATTRIBUTE]:"",style:Object.freeze({display:"flex"})}),zn=e=>R.jsx("div",{...kn,children:R.jsx(k.LazyNativeScrollBar,{scroller:e,withCircle:!0})}),Hn=({props:e,children:n})=>R.jsx(je.HostedScrollArea,{scrollerProps:{...e,style:_n},renderScrollBar:zn,children:n}),qn=e=>R.jsx(k.LazyNativeScrollBar,{scroller:e,withCircle:!1}),ie="--aqmx-stage-block",Bn="--aqmx-multi-panel-body-floor",jn=`calc(var(${ie}) * ${String(B.PANEL_MIN_BLOCK_RATIO)})`,Fn=`max(calc(var(${ie}) * ${String(B.PANEL_MAX_BLOCK_RATIO)}), calc(var(${te}) + var(${Bn})))`,Vn=(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,a)=>r[a]===l)})},xe=["keydown","pointerdown","wheel","touchstart"],U=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)}},Un=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)=>{U.get(e)?.();const o=e.querySelector(`[${Y}="${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 y=r?.isConnected===!0?r:o;y!==o&&y.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"}),s=Un(y)};if(l(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(l);we(a,o,o.closest(D.SCROLL_ROOT_SELECTOR)),r!==null&&we(a,r,o);const{ownerDocument:f}=e,c=y=>{const L=y.target===f?f.scrollingElement:y.target;if(!(L instanceof Element))return;const E=s.get(L);E!==void 0&&(L.scrollTop!==E.top||L.scrollLeft!==E.left)&&g()},g=()=>{a.disconnect();for(const y of xe)f.removeEventListener(y,g,!0);f.removeEventListener("scroll",c,!0),U.get(e)===g&&U.delete(e)};for(const y of xe)f.addEventListener(y,g,{capture:!0,passive:!0});f.addEventListener("scroll",c,{capture:!0,passive:!0}),U.set(e,g)},ke=(e,n)=>{const t=e.querySelector(`[${W}="${n}"]`);return t instanceof HTMLElement?(K(e,n,null),t.focus({preventScroll:!0}),!0):!1},ce=(e,n)=>{const t=e.querySelector(`[${Y}="${n}"]`);return t instanceof HTMLElement&&t.contains(e.ownerDocument.activeElement)},Ee=(e,n)=>{if(!ce(e,n))return null;const t=[...e.querySelectorAll(`[${W}]`)].map(l=>l.getAttribute(W)),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"}},Oe=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&(n.kind==="panel"&&ke(t,n.panelId)||t.focus({preventScroll:!0}))})},ze=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&ke(t,n)})},$n=(e,n,t)=>{requestAnimationFrame(()=>{const o=e.current;if(o===null)return;const{activeElement:r,body:s}=o.ownerDocument;if(K(o,n,t&&ce(o,n)?r:null),!t||r!==null&&r!==s&&r.isConnected)return;const l=o.querySelector(`[${W}="${n}"]`);l instanceof HTMLElement&&l.focus({preventScroll:!0})})},Gn=({store:e,stageRef:n})=>{const{config:t,labels:o,announcer:r}=k.useExplorer(),{maximize:s}=re(),l=t.multiView.columns,a=z(e,w=>w.layout),f=z(e,w=>w.visibleColumns),c=z(e,w=>w.titles),g=z(e,w=>w.layout.maximized!==null||w.splitDragging),[y,L]=u.useState(!1),[E]=u.useState(()=>Se(f)),d=u.useMemo(()=>In(o),[o]),p=u.useCallback(w=>{e.arrange(Nn(e.getSnapshot().layout,w))},[e]),m=D.useDragDropColumns({initialColumnPanels:E,initialPanelVisibility:{},debugConfig:D.DEFAULT_DEBUG_CONFIG,onColumnPanelsChange:p}),{columnPanels:O,setColumnPanels:x}=m,T=u.useRef(g),h=u.useRef(O);u.useLayoutEffect(()=>{T.current=g,h.current=O},[g,O]);const b=u.useCallback(w=>{const C=n.current;if(C===null)return;const{plan:q,stageBlockSize:_}=gn(C,l);if(Number.isFinite(_)&&_>0&&C.style.setProperty(ie,`${String(_)}px`),T.current&&!w)return;const H=B.replanVisibleColumns(e.getSnapshot().visibleColumns,q);H!==null&&e.setVisibleColumns(H)},[e,n,l]);u.useLayoutEffect(()=>{b(!0),L(!0)},[b]),u.useEffect(()=>{const w=n.current;if(w===null||typeof ResizeObserver>"u")return;let C=null;const q=new ResizeObserver(()=>{C===null&&(C=requestAnimationFrame(()=>{C=null,b(!1)}))}),_=w.querySelector(D.SCROLL_ROOT_SELECTOR)?.firstElementChild,H=w.querySelector(`[${le}]`);return _ instanceof Element&&q.observe(_),H instanceof Element&&q.observe(H),()=>{q.disconnect(),C!==null&&cancelAnimationFrame(C)}},[n,b]),u.useEffect(()=>{g||b(!1)},[g,b]);const S=u.useMemo(()=>y?Rn(a,{logical:l,visible:f}):Se(f),[y,a,l,f]);u.useLayoutEffect(()=>{Vn(h.current,S)||x(S)},[S,x]);const P=u.useMemo(()=>D.sortColumnIds(Object.keys(O)).map(w=>({id:w,key:w,className:"aqmx-multi-column"})),[O]),N=u.useMemo(()=>a.docs.map(w=>{const C=G(a,w);return{id:C,component:Tn,title:se(c,w),props:{docPath:w,panelId:C},minHeight:jn,maxHeight:Fn}}),[a,c]),I=u.useMemo(()=>Object.fromEntries(a.docs.map(w=>[G(a,w),!a.hidden.has(w)])),[a]),i=a.maximized===null?null:G(a,a.maximized),v=u.useCallback(w=>{const{layout:C}=e.getSnapshot();for(const[q,_]of $(C)){const H=w[q];if(H===void 0||H!==C.hidden.has(_))continue;const ae=e.titleOf(_);if(H){if(!e.setHidden(_,!1))continue;r.announce(o.panelShown(ae)),ze(n,q);continue}const ue=n.current,de=ue===null?null:Ee(ue,q);e.setHidden(_,!0)&&(r.announce(o.panelHidden(ae)),de!==null&&Oe(n,de))}},[e,n,r,o]),M=u.useCallback(w=>{const C=$(e.getSnapshot().layout).get(w);if(C===void 0)return;const q=e.titleOf(C),_=n.current,H=_===null?null:Ee(_,w);e.close(C)&&(r.announce(o.panelClosed(q)),H!==null&&Oe(n,H))},[e,n,r,o]),A=u.useCallback(w=>{if(w===null){s(null);return}const C=$(e.getSnapshot().layout).get(w);C!==void 0&&s(C)},[e,s]);return R.jsx("div",{className:"aqmx-multi-layout","aria-busy":!y,children:R.jsx(D.DragDropLayout,{columns:P,panels:N,columnPanels:O,onColumnPanelsChange:p,panelVisibility:I,onPanelVisibilityChange:v,dragState:m.dragState,dragOverPosition:m.dragOverPosition,originalPanelPosition:m.originalPanelPosition,dragModes:m.dragModes,debugConfig:D.DEFAULT_DEBUG_CONFIG,panelSizes:m.panelSizes,customDrag:m.customDrag,setPanelRef:m.setPanelRef,onDragStart:m.handleDragStart,onDragEnd:m.handleDragEnd,onPlaceholderDragEnter:m.handlePlaceholderDragEnter,onPlaceholderDragLeave:m.handlePlaceholderDragLeave,onDragOverWithInsert:m.handleDragOverWithInsert,onDropWithInsert:m.handleDropWithInsert,onColumnDragLeave:m.handleColumnDragLeave,onPanelMouseDown:m.handleMouseDown,onPanelSizeInfoClick:m.handlePanelSizeInfoClick,onToggleDragMode:m.toggleDragMode,onPanelClose:M,onPanelMaximizeChange:A,maximizedPanel:i,dragHandle:"header",labels:d,panelClassName:"aqmx-multi-panel",renderPanelScrollArea:Hn,renderStageScrollBar:qn})})},ee={blockStart:"--aqmx-multi-toast-block-start",inlineEnd:"--aqmx-multi-toast-inline-end",room:"--aqmx-multi-toast-room"},Yn=(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 a=n.ownerDocument.elementsFromPoint(s,l),f=a.findIndex(g=>n.contains(g)),c=a.findIndex(g=>e.contains(g));return f!==-1&&c!==-1&&c<f}))},Wn=(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()}},Kn=({store:e,body:n,limitNotice:t,onLimitNoticeCovered:o,ref:r})=>{const{config:s,labels:l,announcer:a}=k.useExplorer(),f=u.useRef(null),c=u.useRef(null),g=z(e,h=>h.ready),y=z(e,h=>h.layout.docs.length>0),L=z(e,h=>h.visibleColumns),E=u.use(ne.SheetNoticeSlotContext),d=u.useCallback(h=>{const{layout:b}=e.getSnapshot(),S=b.maximized,P=h===null&&S!==null?b.panelIds.get(S):void 0,N=f.current,I=P!==void 0&&N!==null&&ce(N,P);e.maximize(h)&&(h!==null?a.announce(l.panelMaximized(e.titleOf(h))):S!==null&&a.announce(l.panelRestored(e.titleOf(S))),P!==void 0&&$n(f,P,I))},[e,a,l]),p=u.useCallback((h,b,S,P)=>{if(S===b){e.setPendingHash(h,P);return}const N=e.navigate(b,S);if(N==="navigated"){e.setPendingHash(h,P);return}if(N!=="existing")return;const{layout:I}=e.getSnapshot(),i=I.panelIds.get(S);i!==void 0&&(a.announce(l.panelAlreadyOpen(e.titleOf(S))),I.maximized===null?e.setHidden(S,!1):d(S),e.setPendingHash(i,P),ze(f,i))},[e,a,l,d]);u.useLayoutEffect(()=>{if(t===null||E!==null||!ge())return;const h=c.current,b=f.current;if(h===null||b===null)throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");return Wn(h,b)},[t,E]),u.useEffect(()=>{const h=c.current;if(t===null||h===null)return;const{ownerDocument:b}=h;let S=null;const P=N=>{const I=N.target;I instanceof Element&&(S!==null&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{S=null,b.activeElement===I&&h.isConnected&&Yn(h,I)&&o()}))};return b.addEventListener("focusin",P,!0),()=>{b.removeEventListener("focusin",P,!0),S!==null&&cancelAnimationFrame(S)}},[t,E,o]),u.useImperativeHandle(r,()=>({bringIntoView:h=>{requestAnimationFrame(()=>{const b=f.current,S=e.getSnapshot().layout.panelIds.get(h);b!==null&&S!==void 0&&K(b,S,null)})}}),[e]),u.useEffect(()=>{const h=f.current;return()=>{h!==null&&U.get(h)?.()}},[]);const m=u.useCallback((h,b)=>{const S=f.current;S!==null&&K(S,h,b)},[]),[O]=u.useState(Ve),x=u.useMemo(()=>({store:e,Body:n,followLink:p,maximize:d,revealInPanel:m,focusCarry:O}),[e,n,p,d,m,O]),T=u.useMemo(()=>Array.from({length:s.multiView.columns},(h,b)=>D.generateColumnId(b)),[s]);return R.jsxs("section",{ref:f,className:"aqmx-multi-stage",style:Dn,tabIndex:-1,"aria-label":l.multiRegion,"aria-busy":y&&!g,"data-testid":"markdown-explorer-stage","data-aqmx-visible-columns":L,children:[R.jsx("span",{className:"aqmx-multi-probe","aria-hidden":"true",[le]:""}),y?g?R.jsx(Ce,{value:x,children:R.jsx(Gn,{store:e,stageRef:f})}):R.jsx("div",{className:"aqmx-multi-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-stage-skeleton",children:T.map(h=>R.jsxs("div",{className:"aqmx-skeleton aqmx-multi-skeleton-column",children:[R.jsx("span",{}),R.jsx("span",{}),R.jsx("span",{})]},h))}):R.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-multi-empty",children:R.jsx("p",{className:"aqmx-empty-title",children:l.multiEmpty})}),t===null?null:E!==null?Be.createPortal(R.jsx("div",{ref:c,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t}),E):R.jsx("div",{ref:c,popover:ge()?"manual":void 0,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t})]})},He=3e3,qe=(e,n)=>{if(n!==null)return n;const[t]=e;return t===void 0?null:t},oe=(e,n,t)=>{const o=new Set(e),r=n.filter(l=>!o.has(l)),s=r.length>0?r.at(-1):t!==null&&n.includes(t)?t:n.at(-1);return s===void 0?null:s},Jn=(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)}`)}}},Xn=({location:e})=>{const{config:n,labels:t,announcer:o}=k.useExplorer(),r=dn(e),s=z(r,P=>P.layout.docs),l=z(r,P=>P.layout.maximized),a=z(r,P=>P.source),[f,c]=u.useState(()=>({docs:s,latest:oe([],s,null)}));f.docs!==s&&c({docs:s,latest:oe(f.docs,s,f.latest)});const g=l!==null?l:f.latest,[y,L]=u.useState(!1),E=u.useRef(null),[d,p]=u.useState(0),m=u.useRef(null),O=u.useRef(null);u.useLayoutEffect(()=>{const P=m.current;m.current=null,P!==null&&(r.whenUrlRendered(()=>o.announce(P.announcement)),O.current?.bringIntoView(P.doc))}),u.useEffect(()=>()=>{E.current!==null&&clearTimeout(E.current)},[]);const x=u.useCallback(()=>{E.current!==null&&clearTimeout(E.current),L(!0),E.current=setTimeout(()=>{E.current=null,L(!1)},He)},[]),T=u.useCallback(()=>{E.current!==null&&clearTimeout(E.current),E.current=null,L(!1)},[]),h=u.useCallback(P=>{const N=r.titleOf(P),I=r.toggle(P);I==="rejected"&&x();const i=I==="rejected"?t.panelLimit(n.multiView.maxPanels):Jn(t,I,N);if(I==="shown"){m.current={doc:P,announcement:i},p(v=>v+1);return}r.whenUrlRendered(()=>{o.announce(i),I==="opened"&&O.current?.bringIntoView(P)})},[r,x,o,t,n]),b=u.useMemo(()=>new Set(s),[s]),S=u.useMemo(()=>({href:B.explorerHref(n,{view:"tree",source:a,doc:qe(s,l)}),target:"tree"}),[n,a,s,l]);return R.jsx(ne.ExplorerSplit,{view:"multi",explorer:R.jsx(ne.ExplorerPane,{mode:"multi",sourceId:a,currentPath:g,openPaths:b,onOpenDocument:h,onSourceChange:r.changeSource,viewSwitch:S}),content:R.jsx(Kn,{ref:O,store:r,body:fn,limitNotice:y?t.panelLimit(n.multiView.maxPanels):null,onLimitNoticeCovered:T}),contentCoversPage:l!==null,sheetDismissals:d,onDraggingChange:r.setSplitDragging})};exports.MultiLayout=Xn;exports.PANEL_LIMIT_NOTICE_MS=He;exports.latestOpenedDocument=oe;exports.treeSwitchDocument=qe;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as s, jsxs as S } from "react/jsx-runtime";
|
|
2
|
-
import { useState as f, useMemo as i, useCallback as u } from "react";
|
|
3
|
-
import { e as a, c as g } from "./location-CaNtUswk.js";
|
|
4
|
-
import { u as P, a as D, D as b, P as C, b as N } from "./index-Dv9lUZqD.js";
|
|
5
|
-
import { E as O, a as T, b as M } from "./ExplorerSplit-uX2ojZe8.js";
|
|
6
|
-
const _ = /* @__PURE__ */ new Set(), q = ({ location: l }) => {
|
|
7
|
-
const { config: e } = P(), r = D(), { source: t, doc: o, overrides: n } = l, [m, p] = f(O), d = i(() => ({ gathered: m, onGatheredChange: p }), [m]), h = u((c) => r(a(e, { view: "tree", source: t, doc: c, overrides: n }), "browse"), [r, e, t, n]), v = u((c) => r(a(e, { view: "tree", source: c, doc: o, overrides: n }), "switch-source"), [r, e, o, n]), w = u((c) => r(a(e, { view: "multi", source: t, docs: g(e, c) }), "switch-view"), [r, e, t]), E = i(() => ({ href: a(e, { view: "multi", source: t, docs: o === null ? [] : [o] }), target: "multi" }), [e, t, o]), x = i(() => ({ kind: "page", view: "tree", overrides: n, embed: {} }), [n]);
|
|
8
|
-
return /* @__PURE__ */ s(
|
|
9
|
-
T,
|
|
10
|
-
{
|
|
11
|
-
view: "tree",
|
|
12
|
-
explorer: /* @__PURE__ */ s(M, { mode: "tree", sourceId: t, currentPath: o, openPaths: _, onOpenDocument: h, onSourceChange: v, viewSwitch: E, tray: d, onOpenSelection: w }),
|
|
13
|
-
content: /* @__PURE__ */ S("div", { className: "aqmx-document-column aqmx-tree-document", children: [
|
|
14
|
-
o === null ? null : /* @__PURE__ */ s(b, { path: o, placement: C }),
|
|
15
|
-
/* @__PURE__ */ s(N, { path: o, variant: x })
|
|
16
|
-
] })
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
q as TreeLayout
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),r=require("react"),u=require("./location-2QZADLiv.cjs"),i=require("./index-CLe6vRXs.cjs"),l=require("./ExplorerSplit-rUVsf5i-.cjs"),g=new Set,f=({location:p})=>{const{config:e}=i.useExplorer(),n=i.useExplorerNavigate(),{source:o,doc:t,overrides:c}=p,[m,d]=r.useState(l.EMPTY_SELECTION),x=r.useMemo(()=>({gathered:m,onGatheredChange:d}),[m]),h=r.useCallback(s=>n(u.explorerHref(e,{view:"tree",source:o,doc:s,overrides:c}),"browse"),[n,e,o,c]),v=r.useCallback(s=>n(u.explorerHref(e,{view:"tree",source:s,doc:t,overrides:c}),"switch-source"),[n,e,t,c]),S=r.useCallback(s=>n(u.explorerHref(e,{view:"multi",source:o,docs:u.canonicalMultiDocuments(e,s)}),"switch-view"),[n,e,o]),w=r.useMemo(()=>({href:u.explorerHref(e,{view:"multi",source:o,docs:t===null?[]:[t]}),target:"multi"}),[e,o,t]),E=r.useMemo(()=>({kind:"page",view:"tree",overrides:c,embed:{}}),[c]);return a.jsx(l.ExplorerSplit,{view:"tree",explorer:a.jsx(l.ExplorerPane,{mode:"tree",sourceId:o,currentPath:t,openPaths:g,onOpenDocument:h,onSourceChange:v,viewSwitch:w,tray:x,onOpenSelection:S}),content:a.jsxs("div",{className:"aqmx-document-column aqmx-tree-document",children:[t===null?null:a.jsx(i.DocumentRefreshBar,{path:t,placement:i.PAGE_DOCUMENT_REFRESH}),a.jsx(i.DocumentPane,{path:t,variant:E})]})})};exports.TreeLayout=f;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const y=Object.freeze([".env*","*.env","*.env.*","*.env~*","*.env-*","*.env_*","*.env#*",".git",".git-credentials",".svn",".hg","node_modules","secrets",".secrets","secrets.json","secrets.yml","secrets.yaml","secrets.toml","secrets.ini","secrets.txt",".ssh",".aws",".gnupg",".docker",".kube",".terraform",".npmrc",".yarnrc",".yarnrc.yml",".netrc","_netrc",".pypirc",".pgpass",".my.cnf",".htpasswd",".vault-token","id_rsa*","id_dsa*","id_ecdsa*","id_ed25519*","*.pem","*.key","*.p8","*.p12","*.pfx","*.ppk","*.jks","*.keystore","*.kdbx","*credentials*.json","service-account*.json","*.tfstate","*.tfstate.*","*.tfvars","*.tfvars.json",".*_history","fish_history"]),D=/[\u0000-\u001f\u007f]/u,x=/\p{Cs}/u,N=e=>{const t=e.split("/").filter(n=>n!=="").at(-1);return t===void 0?e:t},d=e=>e.length>0&&e.length<=4096&&!x.test(e)&&!D.test(e)&&!e.includes("\\"),A=e=>e.normalize("NFKC").toUpperCase().toLowerCase(),C=/(?:%[0-9A-Fa-f]{2})+/gu,U=new TextDecoder("utf-8"),H=/[/\\]/u,k=e=>e.replace(C,t=>U.decode(Uint8Array.from(t.slice(1).split("%").map(n=>Number.parseInt(n,16))))),X=e=>{const t=[e];let n=e;for(let r=0;r<3&&n.includes("%");r+=1){const o=k(n);if(o===n)break;t.push(o),n=o}return t.map(A)},j=e=>{if(typeof e!="string"||e.trim()===""||e.includes("/")||e.includes("\\"))throw new RangeError(`[markdown-explorer] a deny pattern must be one non-blank path segment; got ${JSON.stringify(e)}`);const t=A(e).split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${t}$`,"su")},f=e=>{if(!Array.isArray(e))throw new RangeError("[markdown-explorer] deny rules must be an array of segment patterns");const t=e.map(j),n=o=>o!==""&&t.some(s=>s.test(o)),r=o=>o!==""&&X(o).some(s=>n(s)||s.split(H).some(n));return{deniesPath:o=>o.split("/").some(r),deniesName:r}},w=f(y),I=Object.freeze({deniesPath:()=>!1,deniesName:()=>!1}),$=e=>e===void 0?w:e===!1?I:f(e),v=(e,t)=>f(e).deniesPath(t),p=Object.freeze(["unauthorized","forbidden","not-found","not-configured","invalid","too-large","unsupported","failed"]),z=Object.freeze(["file","directory"]),F=Object.freeze(["video","audio","pdf"]),M=Object.freeze(["info","warning","danger"]),V=Object.freeze(["markdown","text","image","media","file","failure"]),m=Object.freeze({min:1,max:6}),G=1e4,l=e=>typeof e=="string"&&/^\/(?![/\\])[\x21-\x7E]*$/u.test(e),Y=Object.freeze(["http:","https:","mailto:"]),K=/^[a-z0-9-]{1,64}$/u,J="https://relative.invalid/",_=64,c=(e,t)=>typeof t=="string"&&e.includes(t),a=e=>typeof e=="string"?JSON.stringify(e.length>_?`${e.slice(0,_)}…`:e):typeof e,O=e=>c(p,e),Q=e=>c(z,e),g=e=>c(F,e),B=e=>c(M,e),W=e=>c(V,e),R=e=>typeof e=="string"&&K.test(e),q=(e,t)=>{if(typeof e!="string")return!1;try{return t.includes(new URL(e,J).protocol)}catch{return!1}},u=e=>{if(e===null||typeof e!="object")return"a failure must be an object";const{reason:t,code:n}=e;return O(t)?n!==void 0&&!R(n)?`a failure code must be 1 to 64 lowercase letters, digits or hyphens; got ${a(n)}`:null:`unknown failure reason ${a(t)}`},T=e=>{if(e===null||typeof e!="object")return"an entry must be an object";const{name:t,path:n,type:r,mimeType:o,children:s,lazy:i}=e;return typeof t!="string"||t===""?"an entry needs a non-empty name":typeof n!="string"||!d(n)?"an entry needs an acceptable path":Q(r)?o!==void 0&&typeof o!="string"?"an entry mimeType must be a string":i!==void 0&&typeof i!="boolean"?"an entry lazy flag must be a boolean":s!==void 0&&!Array.isArray(s)?"entry children must be an array":r==="file"&&(s!==void 0||i===!0)?"a file entry cannot have children or be lazy":i===!0&&Array.isArray(s)&&s.length>0?"a lazy directory must not list children":null:`an entry type must be "file" or "directory"; got ${a(r)}`},h=e=>{if(T(e)!==null)return!1;const{children:t}=e;return t===void 0||t.every(h)},L=e=>{if(e===null||typeof e!="object")return!1;const{status:t,entries:n,failure:r}=e;return t==="ok"?Array.isArray(n)&&n.every(h):t==="error"&&u(r)===null},Z=e=>{if(e===null||typeof e!="object")return!1;const{status:t,ancestors:n,failure:r}=e;return t==="ok"?n===null||Array.isArray(n)&&n.every(o=>typeof o=="string"&&d(o))&&new Set(n).size===n.length:t==="error"&&u(r)===null},ee=e=>{if(e===null||typeof e!="object")return!1;const{status:t,loadedAt:n}=e;return t==="ok"&&!(Number.isSafeInteger(n)&&n>=0)?!1:L(e)},te=e=>{if(e===null||typeof e!="object")return"a heading must be an object";const{text:t,depth:n,id:r}=e;return typeof t!="string"||typeof r!="string"?"a heading needs text and id strings":typeof n!="number"||!Number.isInteger(n)||n<m.min||n>m.max?`a heading depth must be an integer in 1..6; got ${String(n)}`:null},P=e=>{if(e===null||typeof e!="object")return"a document must be an object";const t=e,{kind:n}=t;if(!W(n))return`unknown document kind ${a(n)}`;if(n==="failure")return u(t.failure);if(typeof t.name!="string")return"a document needs a name string";switch(n){case"markdown":{const{htmlContent:r,headings:o}=t;if(typeof r!="string"||!Array.isArray(o))return"a markdown document needs htmlContent and headings";for(const s of o){const i=te(s);if(i!==null)return i}return null}case"text":return typeof t.text!="string"||typeof t.truncated!="boolean"?"a text document needs text and truncated":l(t.url)?null:"a text document needs a root-relative url";case"image":return l(t.url)?null:"an image document needs a root-relative url";case"media":return l(t.url)?g(t.mediaType)?null:`unknown media type ${a(t.mediaType)}`:"a media document needs a root-relative url";case"file":return l(t.url)?null:"a file document needs a root-relative url"}},ne=e=>P(e)===null,re=(e,t)=>({kind:"failure",failure:b(e,t)}),b=(e,t)=>R(t)?{reason:e,code:t}:{reason:e},oe=Object.freeze(["tree","children","ancestors","document","refresh","asset","link-card"]),E=Object.freeze({source:"source",path:"path",version:"v"}),se="asset",ie="link-card",ae=(e,t,n)=>{const r=`${e}/${se}?${E.path}=${encodeURIComponent(t)}`;return n===null?r:`${r}&${E.version}=${encodeURIComponent(n)}`},ce=e=>`${e}/${ie}`,le="X-Markdown-Explorer-Scope",ue="X-Markdown-Explorer",Ee="refresh",de=e=>oe.includes(e),S=Object.freeze({invalid:400,unauthorized:401,forbidden:403,"not-found":404,"too-large":413,"not-configured":500,unsupported:500,failed:500}),fe=e=>{const[t,...n]=p.filter(r=>S[r]===e);return t!==void 0&&n.length===0?t:"failed"};exports.DEFAULT_DENIED_PATH_SEGMENTS=y;exports.EXPLORER_DATA_QUERY=E;exports.EXPLORER_FAILURE_REASONS=p;exports.EXPLORER_FAILURE_STATUS=S;exports.EXPLORER_LINK_PROTOCOLS=Y;exports.EXPLORER_MAX_HEADINGS=G;exports.EXPLORER_REFRESH_HEADER=ue;exports.EXPLORER_REFRESH_HEADER_VALUE=Ee;exports.EXPLORER_SCOPE_HEADER=le;exports.MAX_DOCUMENT_PATH_LENGTH=4096;exports.documentViolation=P;exports.entryViolation=T;exports.explorerAssetHref=ae;exports.explorerLinkCardEndpoint=ce;exports.failureDocument=re;exports.failureOf=b;exports.failureReasonOfStatus=fe;exports.failureViolation=u;exports.isAcceptableDocumentPath=d;exports.isAcceptableUrl=q;exports.isDeniedPath=v;exports.isExplorerAncestorsResult=Z;exports.isExplorerChildrenResult=L;exports.isExplorerDataOperation=de;exports.isExplorerDocument=ne;exports.isExplorerFailureCode=R;exports.isExplorerFailureReason=O;exports.isExplorerMediaType=g;exports.isExplorerNoticeTone=B;exports.isExplorerTreeResult=ee;exports.lastPathSegment=N;exports.resolvePathRules=$;
|
package/dist/index-CLe6vRXs.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),i=require("react"),U=require("react-router"),_=require("./location-2QZADLiv.cjs"),J=require("@aiquants/markdown"),F=require("./dataRoute-DYjYBiXF.cjs"),jt=require("@aiquants/markdown/viewer-settings"),W=require("./storage-Bkb2Axdi.cjs");function Nt(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 R=Nt(i),Se=Object.freeze(["en","ja"]),tt="en",nt=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"])}),Pt=/\{(\w+)\}/gu,rt={explorerRegion:"Explorer",sourceLabel:"Source",refreshTreeLabel:"Refresh tree",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}`,refreshDocumentLabel:"Refresh document",refreshDocument:"Reload the document from the source",refreshDocumentNamed:e=>`Refresh ${e}`,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",settingFolderPlacement:"Folders",folderPlacementMixed:"Mixed",folderPlacementFirst:"First",folderPlacementLast:"Last",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",settingRevealDocument:"Reveal the open document",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",viewerEmbeddedVideo:"embedded video",viewerEmbeddedPost:"embedded post",viewerEmbeddedFrame:"Embedded content",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"},Dt={explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,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:"名前の降順",settingFolderPlacement:"フォルダーの位置",folderPlacementMixed:"混ぜる",folderPlacementFirst:"先に",folderPlacementLast:"後に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRevealDocument:"開いた文書をツリーで表示",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:"再試行",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",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:"ここへパネルをドロップ"},ot=Object.freeze({en:Object.freeze(rt),ja:Object.freeze(Dt)}),Oe=Object.freeze(Object.keys(rt)),$t=new Set(Oe),Ft=e=>$t.has(e),se=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,st=e=>{if(e===void 0)return tt;if(Se.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${Se.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${se(e)}`)},ye=(e,t)=>{const n=ot[st(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${se(t)}`);if(!_.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${se(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!Ft(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${Oe.join(", ")}`);const a=r[s];if(a===void 0)continue;const d=typeof n[s];if(typeof a!==d)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${d}; got ${se(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const m=nt[s];if(typeof a=="string"&&m!==void 0){for(const[,h]of a.matchAll(Pt))if(!m.includes(h??""))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(h)}}; it accepts ${m.map(g=>`{${g}}`).join(", ")}`)}o[s]=a}return Object.freeze(o)},_t=(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),s=Object.keys(r);return o.length===s.length&&s.every(a=>Object.hasOwn(n,a)&&Object.is(n[a],r[a]))},Re=Object.freeze(["light","dark"]),qt=e=>{if(e===void 0)return"light";if(Re.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Re.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},lt=i.createContext(null),D=()=>{const e=i.use(lt);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},Q=e=>{const{viewSettings:t}=D(),n=()=>e(t.getSnapshot());return i.useSyncExternalStore(t.subscribe,n,n)},de=()=>{const{config:e}=D(),t=U.useParams()["*"],[n]=U.useSearchParams(),r=n.toString();return i.useMemo(()=>_.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])};function Bt({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 zt=R.forwardRef(Bt),Ce=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})}),Ht=e=>Ce[e],ue=()=>{const e=U.useNavigate();return i.useCallback((t,n)=>{e(t,Ce[n])},[e])},it=({navigation:e,...t})=>c.jsx(U.Link,{...t,...Ce[e]}),at={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"]},te=(e,t)=>e[at[t][0]],ct=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=D(),s=te(o,e.reason),a=o[at[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:s}),c.jsx("p",{className:"aqmx-callout-body",children:a}),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]})},Me=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},dt=(e,t)=>{const n=i.useRef(null),r=i.useRef(null),o=i.useRef(null),s=i.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);i.useEffect(()=>s,[s]);const a=i.useCallback(h=>{if(r.current!==h)return;const g=o.current;if(g!==null){g.then(()=>a(h));return}e.prefetch(h);const p=e.peek(h);if(p?.status!=="pending")return;const x=Promise.allSettled([p.promise]);o.current=x,x.then(()=>{o.current===x&&(o.current=null)})},[e]),d=i.useCallback(h=>{const g=t(h);g!==r.current&&(s(),g!==null&&(r.current=g,n.current=window.setTimeout(()=>{n.current=null,a(g)},_.PREFETCH_DWELL_MS)))},[s,t,a]),m=i.useCallback(h=>{t(h)!==r.current&&s()},[s,t]);return i.useMemo(()=>({onPointerOver:h=>d(h.target),onPointerOut:h=>m(h.relatedTarget),onFocus:h=>d(h.target),onBlur:h=>m(h.relatedTarget)}),[d,m])},It=i.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-DqkutcGb.cjs")).then(e=>({default:e.NativeScrollBar})));class Ut extends i.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.",t)}render(){return this.state.failed?null:this.props.children}}const ut=({scroller:e,withCircle:t})=>c.jsx(Ut,{children:c.jsx(i.Suspense,{fallback:null,children:c.jsx(It,{scroller:e,withCircle:t})})}),ft=e=>c.jsx(ut,{scroller:e,withCircle:!0}),ne=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},mt=()=>{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 s=!1;return()=>{if(s)return;s=!0;const a=e.get(o);if(a!==void 0&&a>1){e.set(o,a-1);return}e.delete(o),r(o)}},isHeld:o=>e.has(o),resumes:o=>t.delete(o),heldKeys:()=>[...e.keys()]}},ie=(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((s,a)=>ie(s,t[a]));const n=e,r=t,o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(s=>Object.hasOwn(r,s)&&ie(n[s],r[s]))},ee=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},gt=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),re=e=>e.status==="fulfilled"?e.value:void 0,Zt=55e3,$e=Object.freeze({status:"deferred"}),Fe=Object.freeze({status:"refreshed"}),Ee=Object.freeze({status:"superseded"}),ae=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,pt=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",Vt=({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=mt(),o=ne(),s=new WeakSet;let a=0;const d=o.emit,m=()=>(a+=1,a),h=()=>{if(!(n.size<=t))for(const f of[...n.keys()]){if(n.size<=t)return;r.isHeld(f)||n.delete(f)}},g=(f,w)=>{n.delete(f),n.set(f,w)},p=f=>performance.now()-f.validatedAt>=Zt,x=(f,w,S)=>{const b=n.get(f),y=ae(b?.snapshot),P=S||b?.refreshPending===!0,I=ee(e.document(f,{refresh:P}).then(z=>({status:"loaded",document:z}))),M={snapshot:{status:"pending",promise:I,previous:y},validatedAt:performance.now(),opened:w,background:null,refreshPending:!1,seeded:void 0,stamp:m()};return g(f,M),h(),I.then(z=>{n.get(f)===M&&(M.snapshot=z,M.stamp=m(),d())}),M},T=(f,w,S,b,y,P)=>{w.background===S&&(w.background=null,!(n.get(f)!==w||w.snapshot!==b)&&(y.kind==="failure"&&b.document.kind!=="failure"||(w.validatedAt=P,w.stamp=m(),ie(b.document,y)||(w.snapshot={status:"loaded",document:y}),d())))},k=async(f,w)=>{const S=w.snapshot;if(S.status!=="loaded")return null;const b={};w.background=b;const y=performance.now(),P=e.document(f,{refresh:w.refreshPending});w.refreshPending=!1;const I=await P,M=w.background===b&&n.get(f)===w&&w.snapshot===S;return T(f,w,b,S,I,y),M?I:null},L=(f,w)=>{const{snapshot:S}=w;return S.status==="pending"?!1:S.status==="loaded"&&S.document.kind!=="failure"?(k(f,w),!1):(S.status==="loaded"&&s.add(S),x(f,!0,!1),!0)},A=f=>{const w=r.hold(f);let S=!1;return()=>{if(S)return;S=!0,w();const b=n.get(f);b!==void 0&&g(f,b),h()}};return{peek:f=>n.get(f)?.snapshot,peekSeeded:f=>n.get(f)?.seeded,answerStampOf:f=>n.get(f)?.stamp,prefetch:f=>{const w=n.get(f);w!==void 0&&w.snapshot.status!=="deferred"||(x(f,!1,!1),d())},open:f=>{const w=r.resumes(f),S=A(f),b=n.get(f);if(b===void 0||b.snapshot.status==="deferred")return x(f,!0,!1),d(),S;if(g(f,b),w)return S;const{snapshot:y}=b;return y.status==="pending"?(b.opened=!0,S):y.document.kind==="failure"?(b.opened||p(b)?(s.add(y),x(f,!0,!1),d()):b.opened=!0,S):(b.opened=!0,b.background===null&&p(b)&&k(f,b),S)},retain:A,retry:f=>{const w=n.get(f);w===void 0||w.snapshot.status!=="loaded"||w.snapshot.document.kind!=="failure"||(x(f,!0,!1),d())},seed:(f,w)=>{const S=performance.now(),b=ee(w.then(z=>z===null?$e:{status:"loaded",document:z},()=>$e)),y=n.get(f);if(y!==void 0&&y.snapshot.status==="loaded"){const z=y.snapshot,j={};y.background=j,b.then(q=>{if(q.status==="loaded"){T(f,y,j,z,q.document,S);return}y.background===j&&(y.background=null)});return}const P=y!==void 0&&y.snapshot.status==="pending"?y.snapshot.previous:null,I={status:"pending",promise:b,previous:P},M={snapshot:I,validatedAt:S,opened:y?.opened===!0,background:null,refreshPending:y?.refreshPending===!0,seeded:I,stamp:m()};g(f,M),h(),b.then(z=>{n.get(f)===M&&(z.status==="deferred"&&r.isHeld(f)?x(f,M.opened,!1):(M.snapshot=z,M.stamp=m()),d())})},invalidate:()=>{let f=!1;for(const[w,S]of[...n]){if(S.validatedAt=Number.NEGATIVE_INFINITY,S.opened=!0,S.refreshPending=!0,!r.isHeld(w))continue;const{snapshot:b}=S;if(b.status!=="pending"){L(w,S)&&(f=!0);continue}b.promise.then(()=>{n.get(w)===S&&S.refreshPending&&r.isHeld(w)&&L(w,S)&&d()})}f&&d()},refresh:async f=>{const w=n.get(f);if(w!==void 0&&pt(w.snapshot)){w.refreshPending=!0;const b=await k(f,w);return b===null?Ee:b.kind==="failure"?{status:"failed",failure:b.failure}:Fe}const S=x(f,!0,!0);return d(),S.snapshot.status!=="pending"?Ee:(await S.snapshot.promise,n.get(f)===S?Fe:Ee)},clear:()=>{n.clear();for(const f of r.heldKeys())x(f,!0,!1);d()},subscribe:o.subscribe,noteFailureShown:f=>s.has(f)?!1:(s.add(f),!0)}},ce=i.createContext("fill"),Gt=Object.freeze({blockSize:"100%"}),fe=({scrollerProps:e,children:t})=>i.use(ce)==="content"?c.jsx(J.HostedScrollArea,{scrollerProps:e,children:t}):c.jsx(J.HostedScrollArea,{scrollerProps:{...e,style:Gt},rowClassName:"aqmx-document-scroll-row",renderScrollBar:ft,children:t});function Wt({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Kt=R.forwardRef(Wt);function Xt({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Yt=R.forwardRef(Xt),me=({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(Yt,{})}),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(Kt,{})})]})};function Jt({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Qt=R.forwardRef(Jt),en=Object.freeze({className:"aqmx-document-stage"}),tn=({document:e})=>{const{labels:t}=D();return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[c.jsx(me,{name:e.name,url:e.url,icon:c.jsx(Qt,{})}),c.jsx(fe,{scrollerProps:en,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})]})})]})},je="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",nn=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},rn=/(%[0-9A-Fa-f]{2})/u,Ne=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(rn).flatMap((r,o)=>o%2===1?[Number.parseInt(r.slice(1),16)]:[...t.encode(r)]);return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(Uint8Array.from(n))},ht=e=>`#${encodeURIComponent(e)}`,on=e=>{if(e==="#")return!0;const t=Ne(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},wt=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},sn="http://www.w3.org/1999/xhtml",_e=(e,t)=>{if(t==="")return null;const n=wt(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===sn&&r.getAttribute("name")===t)return r;return null},vt=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=_e(e,t.slice(1));if(n!==null)return n;const r=Ne(t);return r===null?null:_e(e,r)},qe=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"},ln=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"},an=(e,t)=>{const n=t.closest(je),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&qe(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:a}=e.ownerDocument;for(let d=e.parentElement;d!==null&&d!==s;d=d.parentElement)if(qe(d)&&d.scrollHeight>d.clientHeight&&d.clientHeight<o)return d;return a instanceof Element&&ln(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},cn=Object.freeze({scrollerOf:an,reveal:e=>{e.scrollIntoView(ke)}}),ke=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),dn=(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")}}},un=(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),s=Number.parseFloat(r),a=t.getBoundingClientRect(),d=a.height+s+Number.parseFloat(o)>e.clientHeight;if(!d&&Math.abs(a.top-s-n)<1){t.scrollIntoView(ke);return}e.scrollBy({top:d?a.top-n-e.clientHeight:a.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(ke)},fn=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(je)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},Be=(e,t,n)=>{if(e===null)return null;const r=vt(e,t);return r===null?(on(t)&&fn(e,n),null):(dn(e,r),un(n.scrollerOf(e,r),r),n.reveal(r),r)};function mn({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 gn=R.forwardRef(mn);function pn({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 hn=R.forwardRef(pn);function wn({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 vn=R.forwardRef(wn);function En({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 xn=R.forwardRef(En),Te="data-aqmx-key-repeat",Ae=Object.freeze({[Te]:"allow"}),bn=`[${Te}="${Ae[Te]}"]`,Sn=()=>{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(bn)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},le=Object.freeze([1/_.GOLDEN_RATIO**2,1/_.GOLDEN_RATIO,1,_.GOLDEN_RATIO,_.GOLDEN_RATIO**2]),ze=Object.freeze({mode:"fit"}),yn=1,Rn=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),Et=i.createContext(null),kn=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=yn?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,He=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<le.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?le.findIndex(o=>o>t):le.findLastIndex(o=>o<t);return r===-1?null:r},Ie=(e,t,n)=>{if(e.mode==="level"){const o=He(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=He(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},Tn=e=>{const t=le[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},Ue=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},An=({document:e})=>{const{labels:t}=D(),n=i.use(Et),[r]=i.useState(()=>n===null?null:n.read(e.url)),[o,s]=i.useState(r===null?ze:r.zoom),[a,d]=i.useState(r===null?null:r.reported),[m,h]=i.useState(null),g=i.useRef(null),p=i.useCallback(O=>{const{naturalWidth:f,naturalHeight:w}=O;d(S=>Ue(S,f,w))},[]),x=i.useCallback(O=>{g.current=O,!(O===null||!O.complete)&&(O.naturalWidth>0||O.naturalHeight>0?p(O):O.decode().then(()=>p(O),()=>{}))},[p]);i.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),i.useLayoutEffect(()=>{const O=g.current;if(O===null||a===null||o.mode!=="fit")return;const f=()=>h(S=>Ue(S,O.clientWidth,O.clientHeight));if(f(),typeof ResizeObserver>"u")return;const w=new ResizeObserver(f);return w.observe(O),()=>w.disconnect()},[a,o.mode]);const T=a===null||m===null?null:kn(a,m),k=Ie(o,T,-1),L=Ie(o,T,1),A=o.mode==="level"?Tn(o.index):null,$=o.mode==="level"&&A!==null?{width:`${o.base.width*A}px`,height:`${o.base.height*A}px`}:void 0;return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[c.jsxs(me,{name:e.name,url:e.url,icon:c.jsx(xn,{}),children:[c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":k===null,onClick:()=>{k!==null&&s(k)},...Ae,children:c.jsx(hn,{})}),c.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:A===null?t.imageFitLevel:t.imageZoomLevel(Math.round(A*100))}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":L===null,onClick:()=>{L!==null&&s(L)},...Ae,children:c.jsx(vn,{})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(ze),children:c.jsx(gn,{})})]}),c.jsx(fe,{scrollerProps:Rn,children:c.jsx("img",{ref:x,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:$,onLoad:O=>p(O.currentTarget),"data-testid":"markdown-explorer-image"})})]})},xt=i.createContext(null),ge=i.createContext(void 0),bt=i.createContext(null),pe=()=>{const e=i.use(xt);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},Ln=()=>{const e=i.use(bt);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},he=(e,t,n,r)=>t.kind==="panel"?_.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?_.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):_.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),On=({children:e})=>{const{config:t}=D(),n=pe(),r=de(),o=r.kind==="location"?r.location.source:void 0,s=U.useHref(he(t,n.navigation,o,n.currentPath));return c.jsx(ge,{value:o,children:c.jsx(bt,{value:s,children:e})})},Cn='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',Mn=e=>{const t=e instanceof Element?e.closest(Cn):null;return t===null?null:t.getAttribute("data-doc-path")},we=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,jn=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:d,children:m})=>{const h=U.useHref(e),g=p=>{if(we(p)){if(p.preventDefault(),t===d.currentPath&&n!==""){d.scrollWithin(n);return}a(t,n)}};return c.jsx("a",{...s,href:h,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:g,children:m})},Nn=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=D(),d=pe(),m=i.use(ge),h=nn(e),{navigation:g}=d,p=`${he(a,g,m,t)}${h}`,x=n===!1?"false":void 0;return g.kind==="page"?c.jsx(it,{...o,to:p,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":x,children:s}):c.jsx(jn,{to:p,docPath:t,fragment:h,exists:x,className:r,attributes:o,onDocumentLink:g.onDocumentLink,scope:d,children:s})},Pn=({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,")"]})]})},Dn=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=D(),a=i.use(ge),d=U.useHref(`${he(s,r.navigation,a,r.currentPath)}${e}`),m=h=>{we(h)&&(h.preventDefault(),r.scrollWithin(e))};return c.jsx("a",{...n,href:d,className:t,onClick:m,children:o})},$n=({href:e,className:t,attributes:n,children:r})=>{const o=pe();if(o.navigation.kind==="page"){const s=a=>{if(!we(a))return;const d=a.currentTarget;e==="#"?o.followEmptyFragment(a.nativeEvent):d.href===d.ownerDocument.URL&&o.followSameUrlJump(e,a.nativeEvent)};return c.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return c.jsx(Dn,{href:e,className:t,attributes:n,scope:o,children:r})},Fn=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!F.isAcceptableDocumentPath(n)?c.jsx(Pn,{className:o,attributes:s,children:a}):c.jsx(Nn,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?c.jsx($n,{href:e,className:o,attributes:s,children:a}):c.jsx("a",{...s,href:e,className:o,children:a}),_n=()=>{const{config:e}=D(),t=pe(),n=i.use(ge),r=ue();return i.useCallback((o,s)=>{if(!we(s))return!0;s.preventDefault();const a=ht(o.id),{navigation:d}=t;return d.kind==="panel"||Ne(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${he(e,d,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},qn=()=>{const e=Ln();return i.useCallback(t=>`${e}${ht(t.id)}`,[e])};function Bn({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 zn=R.forwardRef(Bn);function Hn({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 In=R.forwardRef(Hn);function Un({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Zn=R.forwardRef(Un),Vn=Object.freeze({className:"aqmx-document-stage"}),Gn=e=>{switch(e){case"video":return c.jsx(In,{});case"audio":return c.jsx(Zn,{});case"pdf":return c.jsx(zn,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},Wn=({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)}`)}}},Kn=({document:e})=>c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[c.jsx(me,{name:e.name,url:e.url,icon:Gn(e.mediaType)}),c.jsx(fe,{scrollerProps:Vn,children:c.jsx(Wn,{document:e})})]}),Xn=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,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame}),St=(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},yt=(e,t)=>e!==void 0?e:t!==void 0?t:jt.DEFAULT_CONTENT_ALIGN,Yn=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),Jn=(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"?_.explorerHref(e,{view:"single",source:t.source,doc:t.doc,overrides:r,embed:t.embed}):_.explorerHref(e,{view:"tree",source:t.source,doc:t.doc,overrides:r})},Pe=({kind:e,label:t,stale:n,busy:r,frameRef:o,intent:s,children:a})=>{const d=i.use(ce);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",...s,children:[n?c.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,a]})},Qn=()=>{const{labels:e}=D();return c.jsx(Pe,{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})})})},Rt=({label:e})=>{const{labels:t}=D();return c.jsxs(Pe,{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:Yn.map(n=>c.jsx("span",{},n))}),c.jsx("p",{className:"aqmx-sr-only",children:t.documentLoading})]})},er=({path:e,document:t,viewer:n})=>{const{reportMathDiagnostics:r}=D(),o=i.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),s=_n(),a=qn(),d=i.useMemo(()=>r===void 0?void 0:m=>r(e,m),[r,e]);return c.jsx("div",{className:"aqmx-document-viewer",children:c.jsx(J.MarkdownViewer,{...n,onHeadingSelect:s,headingHref:a,onMathDiagnostics:d,parseResult:o,content:null})})},tr=({document:e,viewer:t})=>{const{labels:n}=D();return c.jsxs(c.Fragment,{children:[c.jsx(me,{name:e.name,url:e.url,icon:c.jsx(zt,{})}),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(J.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},nr=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),rr=({path:e,document:t,viewer:n,onRetry:r})=>{switch(t.kind){case"markdown":return c.jsx(er,{path:e,document:t,viewer:n});case"text":return c.jsx(tr,{document:t,viewer:n});case"image":return c.jsx(An,{document:t});case"media":return c.jsx(Kn,{document:t});case"file":return c.jsx(tn,{document:t});case"failure":return c.jsx(fe,{scrollerProps:nr,children:c.jsx(ct,{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)}`)}}},or='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',sr=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:vt(e,n),r===void 0?null:wt(e,r.id),e.querySelector(je),e.querySelector(or)];for(const s of o)if(s instanceof HTMLElement&&Me(s))return s;return null},Ze=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&Me(t)},lr=e=>{const t=i.useRef(!1);return i.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 s=!1,a;const d=x=>{s=!(x.target instanceof Node&&n.contains(x.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},m=x=>{t.current=x.target instanceof Node&&n.contains(x.target)},h=x=>{x.relatedTarget===null&&s&&(t.current=!1)},g=()=>{const{activeElement:x,body:T}=r;x!==null&&x!==T&&(t.current=n.contains(x))},p=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",d,!0),o.addEventListener("mousedown",d,!0),o.addEventListener("focusin",m,!0),o.addEventListener("blur",g),o.addEventListener("focus",p),n.addEventListener("focusout",h),()=>{clearTimeout(a),o.removeEventListener("pointerdown",d,!0),o.removeEventListener("mousedown",d,!0),o.removeEventListener("focusin",m,!0),o.removeEventListener("blur",g),o.removeEventListener("focus",p),n.removeEventListener("focusout",h)}},[e]),t},ir=({path:e,snapshot:t,stale:n,viewer:r,regionLabel:o,navigation:s,fragment:a,paneScroll:d,announces:m,announceFailure:h,onDocumentShown:g})=>{const{labels:p,announcer:x,documents:T}=D(),{document:k}=t,L=i.useRef(null),A=i.useRef(null),$=i.useRef(null),O=i.useRef(0),f=lr(L),w=i.useRef({path:e,document:k}),S=i.useRef(null),b=i.useCallback(l=>{const u=L.current,v=Be(u,l,d);u!==null&&v!==null&&Ze(u,v,f.current)},[d,f]),y=i.useCallback((l,u)=>{const v=O.current;setTimeout(()=>{!u.defaultPrevented&&O.current===v&&b(l)},0)},[b]),P=i.useCallback(l=>{setTimeout(()=>{l.defaultPrevented||b("#")},0)},[b]),I=i.useMemo(()=>({navigation:s,currentPath:e,scrollWithin:b,followSameUrlJump:y,followEmptyFragment:P}),[s,e,b,y,P]),M=i.useCallback(()=>T.retry(e),[T,e]),z=dt(T,Mn),j=i.useEffectEvent((l,u)=>{const v=A.current;if(v!==null&&v.path===l&&v.snapshot===u)return;A.current={path:l,snapshot:u};const E=u.document;if(E.kind==="failure"){T.noteFailureShown(u)&&h(p.documentFailed(F.lastPathSegment(l),te(p,E.failure.reason)));return}g?.(l,E),m&&(v===null||v.path!==l||v.snapshot.document.kind==="failure")&&x.announce(p.documentShown(E.name))});i.useEffect(()=>{j(e,t)},[e,t]);const q=i.useEffectEvent(()=>{a.kind==="panel"&&a.consume()}),K=i.useEffectEvent(l=>{const u=L.current;if(u===null||!f.current)return null;const{activeElement:v,body:E}=u.ownerDocument;return v!==null&&v!==E?null:sr(u,k,l)}),Y=i.useEffectEvent(l=>{const u=L.current;u!==null&&Ze(u,l,f.current)}),Z=i.useEffectEvent(l=>d.reveal(l)),ve=i.useEffectEvent(l=>Be(L.current,l,d));return i.useEffect(()=>{if(n)return;const l=w.current.path!==e,u=l||w.current.document!==k;w.current={path:e,document:k};const v=S.current!==e;S.current=e;let E=null;a.kind==="page"?$.current!==a.navigation&&($.current=a.navigation,O.current+=1,E=a.fragment):a.fragment!==null&&(E=a.fragment,q());const C=()=>{const N=E===null?null:ve(E);if(!u){N!==null&&Y(N);return}const B=K(a.fragment);l&&N===null&&B!==null&&Z(B)};v?queueMicrotask(C):C()},[a,e,k,n]),c.jsx(Pe,{kind:k.kind,label:o(e,k),stale:n,busy:n,frameRef:L,intent:z,children:c.jsx(xt,{value:I,children:c.jsx(On,{children:c.jsx(rr,{path:e,document:k,viewer:r,onRetry:M},e)})})})},De=Object.freeze({kind:"skeleton"}),ar=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=ae(t);if(s!==null)return{kind:"document",path:e,snapshot:s,stale:!0};if(o&&t?.status==="pending")return{kind:"streaming",path:e,promise:t.promise};const a=n===null||n===e?null:ae(r);return n===null||a===null?De:{kind:"document",path:n,snapshot:a,stale:!0}},cr=(e,t)=>t.status==="deferred"?De:{kind:"document",path:e,snapshot:t,stale:!1},dr=({requestedPath:e,content:t,...n})=>{const r=t.kind==="streaming"?cr(t.path,i.use(t.promise)):t;return r.kind!=="document"?c.jsx(Rt,{label:n.regionLabel(e,null)}):c.jsx(ir,{path:r.path,snapshot:r.snapshot,stale:r.stale,...n})},kt=({path:e,display:t,navigation:n,fragment:r,paneScroll:o,announces:s,announceFailure:a,onDocumentShown:d})=>{const{config:m,labels:h,theme:g,documents:p}=D(),x=J.useMarkdownToolbarState(),T=i.useRef(!1);i.useLayoutEffect(()=>{T.current=!0},[]);const[k,L]=i.useState(null),A=i.useCallback(()=>e===null?void 0:p.peek(e),[p,e]),$=i.useSyncExternalStore(p.subscribe,A,A),O=i.useCallback(()=>k===null?void 0:p.peek(k),[p,k]),f=i.useSyncExternalStore(p.subscribe,O,O);i.useLayoutEffect(()=>e===null?void 0:p.open(e),[p,e]),i.useLayoutEffect(()=>k===null?void 0:p.retain(k),[p,k]);const w=e===null?De:ar(e,$,k,f,!T.current),S=e===null?null:w.kind==="document"&&!w.stale?w.path:k;S!==k&&L(S);const b=i.useMemo(()=>Xn(h),[h]),y=i.useMemo(()=>[...m.iframeHosts],[m]),P=n.kind==="panel",I=i.useMemo(()=>({labels:b,emptyMessage:h.documentEmpty,theme:g,availableStyles:m.documentStyles,iFrameAllowedDomains:y,embeds:m.embeds,linkComponent:Fn,toolbar:x,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%)`,renderScrollBar:P?void 0:ft}),[b,h.documentEmpty,g,m.documentStyles,y,m.embeds,x,t,P]),M=i.useCallback((j,q)=>P?q===null||q.kind==="failure"?F.lastPathSegment(j):q.name:h.documentRegion,[P,h.documentRegion]),z=P?"content":"fill";return e===null?c.jsx(ce,{value:z,children:c.jsx(Qn,{})}):c.jsx(ce,{value:z,children:c.jsx(i.Suspense,{fallback:c.jsx(Rt,{label:M(e,null)}),children:c.jsx(dr,{requestedPath:e,content:w,viewer:I,regionLabel:M,navigation:n,fragment:r,paneScroll:o,announces:s,announceFailure:a,onDocumentShown:d})})})},ur=({path:e,variant:t,onDocumentShown:n})=>{const{config:r,viewSettings:o,announcer:s}=D(),a=Q(y=>y.style),d=Q(y=>y.align),m=ue(),h=U.useLocation(),g=de(),{view:p,overrides:x,embed:T}=t,k=i.useCallback(y=>{if(g.kind!=="location")return;const P=Jn(r,g.location,y);P!==null&&m(P,"browse")},[r,m,g]),L=i.useCallback(y=>{o.update({style:y}),k("style")},[o,k]),A=i.useCallback(y=>{o.update({align:y}),k("align")},[o,k]),$=St(r,x.style,a),O=yt(x.align,d),f=i.useMemo(()=>({style:$,onStyleChange:L,align:O,onAlignChange:A,showToc:T.showToc!==!1,showStyle:T.showStyle!==!1,showAlign:T.showAlign!==!1,padding:T.padding,width:T.width,maxWidth:T.maxWidth}),[$,L,O,A,T]),w=i.useMemo(()=>({kind:"page",view:p,overrides:x,embed:T}),[p,x,T]),S=i.useMemo(()=>({kind:"page",fragment:h.hash,navigation:h}),[h]),b=i.useCallback(y=>s.announce(y),[s]);return c.jsx(kt,{path:e,display:f,navigation:w,fragment:S,paneScroll:cn,announces:!0,announceFailure:b,onDocumentShown:n})},fr=({path:e,variant:t,onDocumentShown:n})=>{const{config:r,viewSettings:o}=D(),s=Q(w=>w.style),a=Q(w=>w.align),[d,m]=i.useState(()=>St(r,void 0,s)),h=yt(void 0,a),g=i.useCallback(w=>o.update({align:w}),[o]),{maximized:p,onDocumentLink:x,pendingHash:T,onHashConsumed:k,announceFailure:L,paneScroll:A}=t,$=i.useMemo(()=>({style:d,onStyleChange:m,align:h,onAlignChange:g,showToc:p,showStyle:p,showAlign:p,padding:void 0,width:void 0,maxWidth:void 0}),[d,h,g,p]),O=i.useMemo(()=>({kind:"panel",onDocumentLink:x}),[x]),f=i.useMemo(()=>({kind:"panel",fragment:T,consume:k}),[T,k]);return c.jsx(kt,{path:e,display:$,navigation:O,fragment:f,paneScroll:A,announces:!1,announceFailure:L,onDocumentShown:n})},Tt=({path:e,variant:t,onDocumentShown:n})=>t.kind==="page"?c.jsx(ur,{path:e,variant:t,onDocumentShown:n}):c.jsx(fr,{path:e,variant:t,onDocumentShown:n});function mr({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 At=R.forwardRef(mr),gr=new Set,pr=(e,t)=>{const{documents:n,announcer:r,labels:o}=D(),s=i.useCallback(()=>n.peek(e),[n,e]),a=i.useCallback(()=>n.peekSeeded(e),[n,e]),d=i.useSyncExternalStore(n.subscribe,s,a),m=i.useCallback(()=>n.answerStampOf(e),[n,e]),h=i.useSyncExternalStore(n.subscribe,m,m),[g]=i.useState(()=>new Set),[p,x]=i.useState(gr),[T,k]=i.useState(null);T!==null&&T.path!==e&&k(null);const L=i.useRef(null);i.useLayoutEffect(()=>(L.current=e,()=>{L.current=null}),[e]);const A=i.useCallback(()=>{const f=e,w=n.peek(f);if(g.has(f)||w?.status==="pending")return;const S=t&&!pt(w);g.add(f),x(new Set(g)),k(null),(async()=>{try{const b=await n.refresh(f);if(L.current!==f||b.status==="superseded")return;if(b.status==="failed"){k({path:f,failure:b.failure,stamp:n.answerStampOf(f)}),r.announce(o.documentRefreshFailed(te(o,b.failure.reason)));return}const y=ae(n.peek(f));if(S||y===null||y.document.kind==="failure")return;r.announce(o.documentRefreshed(y.document.name))}finally{g.delete(f),x(new Set(g))}})()},[e,t,g,n,r,o]),$=p.has(e),O=T!==null&&T.path===e&&T.stamp===h?T.failure:null;return{refreshing:$,unavailable:$||d?.status==="pending",failure:O,refresh:A}},Lt=Object.freeze({kind:"page"}),hr=e=>{e.stopPropagation()},Ot=({path:e,placement:t})=>{const{labels:n}=D(),{refreshing:r,unavailable:o,failure:s,refresh:a}=pr(e,t.kind==="page"),d=t.kind==="panel"?n.refreshDocumentNamed(t.documentName):null;return c.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar",children:[c.jsx("div",{className:"aqmx-document-refresh-row",children:c.jsxs("button",{type:"button",className:d===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:d===null?n.refreshDocument:d,"aria-label":d===null?void 0:d,"aria-disabled":o,"aria-busy":r,"data-aqmx-busy":r?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:a,onDoubleClick:hr,children:[c.jsx(At,{"aria-hidden":"true"}),d===null?c.jsx("span",{children:n.refreshDocumentLabel}):null]})}),s===null?null:c.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":s.reason,children:n.documentRefreshFailed(te(n,s.reason))})]})},wr=({location:e})=>{const t=e.doc,n=i.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]);return c.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",children:[c.jsx(Ot,{path:t,placement:Lt}),c.jsx(Tt,{path:t,variant:n})]})},Ct=({holds:e,testId:t})=>{const{labels:n,announcer:r}=D(),o=i.useId();i.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const s=i.useCallback(()=>r.shownIn(o),[r,o]),a=i.useSyncExternalStore(r.subscribe,s,s);return c.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":t,children:a.length>1?n.announcementSequence(a):a[0]})},X=Object.freeze([]),Ve=e=>{const t=new Set;let n=X,r=[],o=!1;const s=[],a=g=>{n=g;for(const p of[...t])p()},d=()=>s.at(-1)?.region,m=g=>{const p=d();g(),d()!==p&&n!==X&&a(X)},h=()=>{o=!1;const g=r.map(p=>"sentence"in p?p.sentence:p.list(p.items));r=[],a(Object.freeze(g))};return{announce:g=>{if(typeof g=="string")r.push({sentence:g});else{const p=r.find(x=>"list"in x&&x.list===g.list);p!==void 0&&"items"in p?p.items.push(g.item):r.push({list:g.list,items:[g.item]})}o||(o=!0,n!==X&&a(X),e.request(h))},subscribe:g=>(t.add(g),()=>{t.delete(g)}),claim:g=>{const p={region:g};return m(()=>s.push(p)),()=>m(()=>{const x=s.indexOf(p);x!==-1&&s.splice(x,1)})},shownIn:g=>d()===g?n:X}},Ge=Object.freeze({status:"cancelled"}),vr=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(F.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return F.failureOf(n,r)},Er=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((d,m)=>globalThis.fetch(d,m)),o=(d,m)=>`${e}/${d}?${new URLSearchParams(m).toString()}`,s=async(d,m,h,g)=>{let p;try{p=await r(d,{credentials:"same-origin",...m,headers:{Accept:"application/json",...m.headers}})}catch{return g({reason:"failed"})}p.status===401&&t(null);const x=p.headers.get(F.EXPLORER_SCOPE_HEADER);x!==null&&t(x);let T;try{T=await p.json()}catch{return g({reason:F.failureReasonOfStatus(p.status)})}let k;try{k=h(T)}catch{k=!1}if(k)return T;const L=vr(T);return g(L!==null?L:{reason:p.status===200?"failed":F.failureReasonOfStatus(p.status)})},a={[F.EXPLORER_REFRESH_HEADER]:F.EXPLORER_REFRESH_HEADER_VALUE};return{tree:d=>s(o("tree",{[F.EXPLORER_DATA_QUERY.source]:d}),{method:"GET"},F.isExplorerTreeResult,m=>({status:"error",failure:m})),children:async(d,m,h)=>{const g=await s(o("children",{[F.EXPLORER_DATA_QUERY.source]:d,[F.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:h},F.isExplorerChildrenResult,p=>({status:"error",failure:p}));return h.aborted?Ge:g},ancestors:async(d,m,h)=>{const g=await s(o("ancestors",{[F.EXPLORER_DATA_QUERY.source]:d,[F.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:h},F.isExplorerAncestorsResult,p=>({status:"error",failure:p}));return h.aborted?Ge:g},document:(d,{refresh:m})=>s(o("document",{[F.EXPLORER_DATA_QUERY.path]:d}),m?{method:"GET",headers:a}:{method:"GET"},F.isExplorerDocument,h=>F.failureDocument(h.reason,h.code)),refresh:d=>s(o("refresh",{[F.EXPLORER_DATA_QUERY.source]:d}),{method:"POST",headers:a},F.isExplorerTreeResult,m=>({status:"error",failure:m}))}},xr=e=>{const t=W.readStorage(e);if(t===null)return _.NO_TREE_SETTING_CHANGES;try{return _.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),_.NO_TREE_SETTING_CHANGES}},We=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=xr(e);n={changes:s,settings:_.applyTreeSettingChanges(t,s)}}return n},o=ne();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:s=>{const{changes:a,settings:d}=r(),m=_.recordTreeSettingChange(a,s,_.advanceTreeSetting(d,s)[s],t);return n={changes:m,settings:_.applyTreeSettingChanges(t,m)},o.emit(),W.writeStorage(e,_.serializeTreeSettingChanges(m)),n.settings}}},br=Object.freeze({status:"refreshed"}),Sr=Object.freeze({status:"superseded"}),Le=Object.freeze({status:"deferred"}),yr=gt(Le),Mt=4,Rr=Mt-1,Ke=Object.freeze({status:"loading"}),kr=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),Tr=e=>{const t=new Map,n=mt(),r=new Map,o=new Map,s=new Map,a=new Map,d=ne(),m=new Set;let h=0,g=0;const p={direct:null,bulk:null},x=new Set;let T=!1,k=0;const L=()=>{k+=1,d.emit()},A=l=>o.get(l)??0,$=l=>{let u=a.get(l);return u===void 0&&(u={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(l,u)),u},O=(l,u,v)=>{l.inFlight.delete(u),h-=1,v.lane==="bulk"&&(g-=1)},f=l=>{const u=a.get(l);if(u!==void 0){for(const[v,E]of[...u.inFlight])O(u,v,E),E.controller.abort();u.direct.clear(),u.bulk.clear(),u.unclaimed.clear()}},w=l=>{const u=A(l)+1;return o.set(l,u),f(l),u},S=(l,u)=>{const v=re(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},b=l=>{let u=r.get(l);return u===void 0&&(u=new Map,r.set(l,u)),u},y=l=>{const u=[...a.keys()],v=p[l],E=v===null?0:u.indexOf(v)+1;for(let C=0;C<u.length;C+=1){const N=u[(E+C)%u.length],B=N===void 0?void 0:a.get(N);if(!(N===void 0||B===void 0)){for(const H of B[l])if((B.claims.get(H)??0)!==0)return B[l].delete(H),p[l]=N,{sourceId:N,path:H}}}return null},P=(l,u,v,E)=>{const C=a.get(l);if(C===void 0||C.inFlight.get(u)!==v)return;O(C,u,v);const N=(C.claims.get(u)??0)>0,B=b(l);if(E.status==="ok"?B.set(u,{status:"loaded",entries:E.entries}):E.status==="error"&&N?B.set(u,{status:"failed",failure:E.failure}):B.delete(u),L(),E.status==="error"&&N){const H={sourceId:l,path:u,failure:E.failure};for(const V of[...m])V(H)}M()},I=(l,u,v)=>{const E={controller:new AbortController,lane:v};$(l).inFlight.set(u,E),h+=1,v==="bulk"&&(g+=1),e.children(l,u,E.controller.signal).then(C=>P(l,u,E,C),()=>P(l,u,E,kr))},M=()=>{for(;h<Mt;){const l=y("direct");if(l!==null){I(l.sourceId,l.path,"direct");continue}const u=g<Rr?y("bulk"):null;if(u===null)return;I(u.sourceId,u.path,"bulk")}},z=(l,u,v)=>{if(!(u.direct.delete(v)||u.bulk.delete(v))){const C=u.inFlight.get(v);if(C===void 0)return!1;O(u,v,C),C.controller.abort()}return r.get(l)?.delete(v),!0},j=()=>{T=!1;let l=!1;for(const u of x){const v=$(u);for(const E of v.unclaimed)(v.claims.get(E)??0)===0&&z(u,v,E)&&(l=!0);v.unclaimed.clear()}x.clear(),l&&(L(),M())},q=(l,u)=>{t.set(l,S(ee(e.tree(l)),u))},K=(l,u,v)=>{w(l);const E=S(gt(u),v);return t.set(l,E),r.delete(l),L(),M(),E},Y=(l,u,v,E)=>{if(v!==A(l)||t.get(l)!==u)return;const C=re(u.promise);if(!(E.status!=="ok"||C?.status!=="ok"||u.loadedAt===null||E.loadedAt<=u.loadedAt)){if(ie(C.entries,E.entries)){u.loadedAt=E.loadedAt;return}K(l,E,u.opened)}},Z=(l,u)=>{const v=t.get(l);return v!==void 0&&re(v.promise)?.status===u},ve=(l,u)=>{u.stale=!1;const v=A(l);e.tree(l).then(E=>Y(l,u,v,E))};return{read:l=>t.get(l)?.promise??yr,open:l=>{const u=n.resumes(l),v=n.hold(l),E=t.get(l);return E===void 0||Z(l,"deferred")?(q(l,!0),L()):u||(E.opened&&Z(l,"error")?(q(l,!0),L()):(E.opened=!0,E.stale&&Z(l,"ok")&&ve(l,E))),v},retry:l=>{Z(l,"error")&&(q(l,!0),L())},seed:(l,u)=>{const v=u.then(N=>N===null?Le:N,()=>Le),E=t.get(l);if(E!==void 0&&Z(l,"ok")){const N=A(l);v.then(B=>Y(l,E,N,B));return}w(l);const C=S(ee(v),E?.opened===!0);t.set(l,C),r.delete(l),M(),v.then(N=>{t.get(l)===C&&(N.status==="deferred"&&n.isHeld(l)&&q(l,C.opened),L())})},refresh:async l=>{const u=(s.get(l)??0)+1;s.set(l,u);const v=await e.refresh(l);if(s.get(l)!==u)return Sr;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 N=K(l,v,!0);if(E!==void 0&&E.promise.status==="pending"){const B=A(l);E.promise.then(H=>Y(l,N,B,H))}}for(const[N,B]of t)N!==l&&re(B.promise)?.status==="ok"&&(B.stale=!0);return br},children:(l,u)=>r.get(l)?.get(u),claimChildren:(l,u)=>{const v=$(l),E=b(l);let C=!1,N=!1;for(const[H,V]of u)v.claims.set(H,(v.claims.get(H)??0)+1),E.get(H)===void 0?(E.set(H,Ke),v[V].add(H),C=!0,N=!0):V==="direct"&&v.bulk.delete(H)&&(v.direct.add(H),N=!0);C&&L(),N&&M();let B=!1;return()=>{if(!B){B=!0;for(const H of u.keys()){const V=(v.claims.get(H)??0)-1;V>0?v.claims.set(H,V):(v.claims.delete(H),v.unclaimed.add(H))}x.add(l),!T&&(T=!0,queueMicrotask(j))}}},retryChildren:(l,u)=>{const v=r.get(l);if(v===void 0||v.get(u)?.status!=="failed")return;const E=$(l);if((E.claims.get(u)??0)>0){v.set(u,Ke),E.direct.add(u),L(),M();return}v.delete(u),L()},pendingChildren:l=>{const u=a.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(),...a.keys()]))w(l);for(const[l,u]of s)s.set(l,u+1);t.clear(),r.clear(),L()},subscribeChildrenFailures:l=>(m.add(l),()=>{m.delete(l)}),subscribe:d.subscribe,version:()=>k}},Ar=(e,t)=>{let n=e;const r=ne();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},Lr=1;let oe=0,G=null;const Or=()=>{const{documentElement:e,body:t}=document;oe===0&&(G={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"),oe+=1;let n=!1;return()=>{n||(n=!0,oe-=1,!(oe>0||G===null)&&(e.style.overflow=G.htmlOverflow,t.style.overflow=G.bodyOverflow,e.style.scrollbarGutter=G.htmlGutter,t.style.scrollbarGutter=G.bodyGutter,G=null))}},Cr=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],Xe=1,Ye=e=>e.getClientRects().length>0,xe="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.",Mr=e=>{if(!Ye(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+Lr)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. ${xe}`;if(t.height<Xe)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. ${xe}`;for(const{selector:r,name:o}of Cr)for(const s of e.querySelectorAll(r)){if(!Ye(s))continue;const a=s.getBoundingClientRect().height;if(a<Xe)return`[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${xe}`}return null},jr=e=>{let t=!1;const n=()=>{if(t)return;const o=Mr(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)}},Nr=(e,t)=>{i.useEffect(()=>e?Or():void 0,[e]),i.useEffect(()=>{const n=t.current;if(!(!e||n===null))return jr(n)},[e,t])},Je='[data-testid="markdown-explorer-view-switch"]',Pr=[{control:Je,successors:[Je,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],Dr=e=>{for(const t of Pr){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},$r=(e,t)=>{const n=i.useRef(null);i.useEffect(()=>{const o=d=>{const m=e.current;n.current=m!==null&&d instanceof Element&&m.contains(d)?Dr(d):null},s=d=>o(d.target);o(document.activeElement);const a=d=>{const m=d.target;d.relatedTarget!==null||!(m instanceof Element)||queueMicrotask(()=>{n.current?.element===m&&m.isConnected&&document.activeElement!==m&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a)}},[e]);const r=i.useRef(t);i.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const m=document.activeElement;if(m!==null&&m!==document.body&&m!==o.element)return!0;const h=e.current;if(h===null)return!0;for(const g of o.control.successors)for(const p of h.querySelectorAll(g))if(p!==o.element&&(p.focus({preventScroll:!0}),document.activeElement===p))return!0;return!1};if(s())return;const a=e.current;if(a===null)return;const d=new MutationObserver(()=>{s()&&d.disconnect()});return d.observe(a,{childList:!0,subtree:!0}),()=>d.disconnect()},[t,e])},Fr=i.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-DkTVgxxb.cjs")).then(e=>({default:e.TreeLayout}))),_r=i.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-ZK2V9nms.cjs")).then(e=>({default:e.MultiLayout}))),qr=64,Qe={request:e=>{requestAnimationFrame(e)}},et=e=>{e.documents.clear(),e.trees.clear()},be=(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]=i.useState(()=>({overrides:t,locale:e,labels:ye(e,t)}));if(n.locale===e&&_t(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:ye(e,t)};return r(o),o.labels},zr=(e,t,n)=>{const[r,o]=i.useState(()=>({scope:t,store:We(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:We(e,n)};return o(s),s.store},Hr=e=>{const[t,n]=i.useState(()=>({scope:e,announcer:Ve(Qe)}));if(t.scope===e)return t.announcer;const r={scope:e,announcer:Ve(Qe)};return n(r),r.announcer},Ir=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:d,lockDocumentScroll:m=!1,onMathDiagnostics:h})=>{W.assertStorageNamespace(n);const g=st(r),p=qt(s),x=Br(g,o),{revalidate:T}=U.useRevalidator(),k=i.useRef(()=>{}),L=U.useHref(t.dataPath),[A]=i.useState(()=>{const j=Er({dataPath:L,onScope:K=>k.current(K)}),q={documents:Vt({client:j,capacity:Math.max(qr,t.multiView.maxPanels*2)}),trees:Tr(j)};return be(q,e),W.syncStorageScope(n,e.scope),{data:j,...q,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(A.aligned.pageData!==e||A.aligned.storageNamespace!==n){const j=A.aligned.pageData;A.aligned.pageData=e,A.aligned.storageNamespace=n,j!==e&&(j.scope!==e.scope?A.aligned.pendingReader=e:be(A,e)),W.syncStorageScope(n,e.scope)}const $=zr(W.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);i.useLayoutEffect(()=>{const j=A.aligned.pendingReader;j!==null&&(A.aligned.pendingReader=null,et(A),be(A,j))},[e,A]),i.useLayoutEffect(()=>{let j=!1;return k.current=q=>{q===e.scope||j||(j=!0,q!==null&&(et(A),W.clearExplorerStorage(n)),T())},()=>{k.current=()=>{}}},[e,T,A,n]);const O=i.useRef(t.settingsCookie);i.useLayoutEffect(()=>{O.current=t.settingsCookie},[t.settingsCookie]);const[f]=i.useState(()=>Ar(e.settings,j=>{document.cookie=_.viewSettingsCookieString(O.current,j,window.location.protocol==="https:")})),w=Hr(e.scope),S=i.useMemo(()=>ee(e.notices.catch(()=>[])),[e.notices]),b=e.sources.map(j=>j.id).join(`
|
|
2
|
-
`),y=i.useMemo(()=>_.withExplorerSources(t,b.split(`
|
|
3
|
-
`)),[t,b]),P=i.useRef(h);i.useLayoutEffect(()=>{P.current=h},[h]);const[I]=i.useState(()=>(j,q)=>{P.current?.(j,q)}),M=h===void 0?void 0:I,z=i.useMemo(()=>({config:y,labels:x,locale:g,theme:p,storageNamespace:n,scope:e.scope,sources:e.sources,notices:S,documents:A.documents,trees:A.trees,data:A.data,viewSettings:f,treeSettings:$,announcer:w,renderTreeFailure:d,reportMathDiagnostics:M}),[y,x,g,p,n,e.scope,e.sources,S,A,f,$,w,d,M]);return c.jsx(lt,{value:z,children:c.jsx(Zr,{renderFrame:a,lockDocumentScroll:m},e.scope)})},Ur=({ref:e,theme:t,view:n,children:r})=>{const[o]=i.useState(Sn);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})},Zr=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=D(),o=de(),{hash:s}=U.useLocation(),a=ue(),d=i.useRef(null);Nr(t,d),i.useLayoutEffect(()=>{o.kind==="redirect"&&a(`${o.href}${s}`,"browse")},[o,s,a]);const{location:m}=o,h=m.view;$r(d,h);const g=m.view==="tree"?c.jsx(i.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(Fr,{location:m})}):m.view==="multi"?c.jsx(i.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(_r,{location:m})}):c.jsx(wr,{location:m}),p=c.jsxs(Ur,{ref:d,theme:n,view:h,children:[g,c.jsx(Ct,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?p:e({view:h,children:p})},Vr=({currentUrl:e,nextUrl:t,formMethod:n,defaultShouldRevalidate:r})=>n===void 0&&e.href===t.href&&r;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=tt;exports.DocumentPane=Tt;exports.DocumentRefreshBar=Ot;exports.EXPLORER_THEMES=Re;exports.ExplorerLink=it;exports.FailureView=ct;exports.ForwardRef=At;exports.ImageViewMemoryContext=Et;exports.LazyNativeScrollBar=ut;exports.LiveRegion=Ct;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=ot;exports.MARKDOWN_EXPLORER_LABEL_KEYS=Oe;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=nt;exports.MARKDOWN_EXPLORER_LOCALES=Se;exports.MarkdownExplorer=Ir;exports.PAGE_DOCUMENT_REFRESH=Lt;exports.createEmitter=ne;exports.explorerNavigationOptions=Ht;exports.failureTitleOf=te;exports.focusWithoutScroll=Me;exports.resolveMarkdownExplorerLabels=ye;exports.shouldRevalidateExplorer=Vr;exports.useExplorer=D;exports.useExplorerLocation=de;exports.useExplorerNavigate=ue;exports.useIntentPrefetch=dt;exports.useViewSetting=Q;
|