docusaurus/assets/js/bdab9796.c4ffd378.js
2024-10-11 14:05:13 +00:00

1 line
No EOL
14 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["77235"],{37793:function(e,t,n){n.r(t),n.d(t,{metadata:()=>l,contentTitle:()=>d,default:()=>p,assets:()=>u,toc:()=>v,frontMatter:()=>s});var l=JSON.parse('{"id":"toc/toc-test-bad","title":"toc-test-bad","description":"Test the TOC behavior of a real-world MD doc with invalid headings","source":"@site/_dogfooding/_docs tests/toc/toc-test-bad.mdx","sourceDirName":"toc","slug":"/toc/toc-test-bad","permalink":"/tests/docs/toc/toc-test-bad","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedBy":"S\xe9bastien Lorber","lastUpdatedAt":1728655362000,"frontMatter":{"toc_min_heading_level":2,"toc_max_heading_level":6},"sidebar":"sidebar","previous":{"title":"toc-_-_","permalink":"/tests/docs/toc/toc-_-_"},"next":{"title":"toc-test-good","permalink":"/tests/docs/toc/toc-test-good"}}'),r=n("24246"),o=n("80980"),i=n("14522"),a=n("78596"),c=n("57589");let s={toc_min_heading_level:2,toc_max_heading_level:6},d=void 0,u={},v=[{value:"lvl 6",id:"lvl-6",level:6},{value:"lvl 5",id:"lvl-5",level:5},{value:"lvl 4",id:"lvl-4",level:4},{value:"lvl 5",id:"lvl-5-1",level:5},{value:"lvl 4",id:"lvl-4-1",level:4},{value:"lvl 3",id:"lvl-3",level:3},{value:"lvl 2",id:"lvl-2",level:2},{value:"lvl 2",id:"lvl-2-1",level:2},{value:"lvl 3",id:"lvl-3-1",level:3},{value:"lvl 4",id:"lvl-4-2",level:4},{value:"lvl 5",id:"lvl-5-2",level:5},{value:"lvl 6",id:"lvl-6-1",level:6},{value:"lvl 2",id:"lvl-2-2",level:2},{value:"lvl 3",id:"lvl-3-2",level:3},{value:"lvl 4",id:"lvl-4-3",level:4},{value:"lvl 5",id:"lvl-5-3",level:5},{value:"lvl 6",id:"lvl-6-2",level:6}];function f(e){let t={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",hr:"hr",p:"p",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.p,{children:"Test the TOC behavior of a real-world MD doc with invalid headings"}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"BAD HEADINGS:"}),"\n",(0,r.jsx)(t.h6,{id:"lvl-6",children:"lvl 6"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5",children:"lvl 5"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4",children:"lvl 4"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5-1",children:"lvl 5"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4-1",children:"lvl 4"}),"\n",(0,r.jsx)(t.h3,{id:"lvl-3",children:"lvl 3"}),"\n",(0,r.jsx)(t.h2,{id:"lvl-2",children:"lvl 2"}),"\n",(0,r.jsx)(t.h1,{id:"lvl-1",children:"lvl 1"}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"GOOD HEADINGS:"}),"\n",(0,r.jsx)(t.h2,{id:"lvl-2-1",children:"lvl 2"}),"\n",(0,r.jsx)(t.h3,{id:"lvl-3-1",children:"lvl 3"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4-2",children:"lvl 4"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5-2",children:"lvl 5"}),"\n",(0,r.jsx)(t.h6,{id:"lvl-6-1",children:"lvl 6"}),"\n",(0,r.jsx)(t.h2,{id:"lvl-2-2",children:"lvl 2"}),"\n",(0,r.jsx)(t.h3,{id:"lvl-3-2",children:"lvl 3"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4-3",children:"lvl 4"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5-3",children:"lvl 5"}),"\n",(0,r.jsx)(t.h6,{id:"lvl-6-2",children:"lvl 6"}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"INLINE:"}),"\n","\n","\n",(0,r.jsx)(i.Z,{children:(0,r.jsx)(a.Z,{toc:v,minHeadingLevel:2,maxHeadingLevel:6})}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"COLLAPSIBLE:"}),"\n","\n",(0,r.jsx)(i.Z,{children:(0,r.jsx)(c.Z,{toc:v,minHeadingLevel:2,maxHeadingLevel:6})})]})}function p(e={}){let{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(f,{...e})}):f(e)}p.displayName="MDXContent(_dogfooding/_docs tests/toc/toc-test-bad.mdx)"},57589:function(e,t,n){n.d(t,{Z:()=>u});var l=n("24246");n("27378");var r=n("90496"),o=n("97812"),i=n("89477"),a=n("77827");let c={tocCollapsibleButton:"tocCollapsibleButton_IbtT",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_Nor3"};function s(e){var t,n,o=e.collapsed,i=function(e,t){if(null==e)return{};var n,l,r=function(e,t){if(null==e)return{};var n,l,r={},o=Object.keys(e);for(l=0;l<o.length;l++)n=o[l],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(l=0;l<o.length;l++){if(n=o[l],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}}return r}(e,["collapsed"]);return(0,l.jsx)("button",(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},l=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),l.forEach(function(t){var l,r,o;l=e,r=t,o=n[t],r in l?Object.defineProperty(l,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[r]=o})}return e}({type:"button"},i),n=(n={className:(0,r.Z)("clean-btn",c.tocCollapsibleButton,!o&&c.tocCollapsibleButtonExpanded,i.className),children:(0,l.jsx)(a.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);n.push.apply(n,l)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}let d={tocCollapsible:"tocCollapsible_BEWm",tocCollapsibleContent:"tocCollapsibleContent_FG8F",tocCollapsibleExpanded:"tocCollapsibleExpanded_FzA_"};function u(e){var t=e.toc,n=e.className,a=e.minHeadingLevel,c=e.maxHeadingLevel,u=(0,o.u)({initialState:!0}),v=u.collapsed,f=u.toggleCollapsed;return(0,l.jsxs)("div",{className:(0,r.Z)(d.tocCollapsible,!v&&d.tocCollapsibleExpanded,n),children:[(0,l.jsx)(s,{collapsed:v,onClick:f}),(0,l.jsx)(o.z,{lazy:!0,className:d.tocCollapsibleContent,collapsed:v,children:(0,l.jsx)(i.Z,{toc:t,minHeadingLevel:a,maxHeadingLevel:c})})]})}},78596:function(e,t,n){n.d(t,{Z:()=>i});var l=n("24246");n("27378");var r=n("89477");let o="tableOfContentsInline_2sru";function i(e){var t=e.toc,n=e.minHeadingLevel,i=e.maxHeadingLevel;return(0,l.jsx)("div",{className:o,children:(0,l.jsx)(r.Z,{toc:t,minHeadingLevel:n,maxHeadingLevel:i,className:"table-of-contents",linkClassName:null})})}},89477:function(e,t,n){n.d(t,{Z:()=>v});var l=n("24246"),r=n("27378"),o=n("26378");function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=Array(t);n<t;n++)l[n]=e[n];return l}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},l=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),l.forEach(function(t){var l,r,o;l=e,r=t,o=n[t],r in l?Object.defineProperty(l,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[r]=o})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);n.push.apply(n,l)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function s(e){var t=e.getBoundingClientRect();return t.top===t.bottom?s(e.parentNode):t}var d=n("35363");let u=r.memo(function e(t){var n=t.toc,r=t.className,o=t.linkClassName,i=t.isChild;return n.length?(0,l.jsx)("ul",{className:i?void 0:r,children:n.map(function(t){return(0,l.jsxs)("li",{children:[(0,l.jsx)(d.Z,{to:"#".concat(t.id),className:null!=o?o:void 0,dangerouslySetInnerHTML:{__html:t.value}}),(0,l.jsx)(e,{isChild:!0,toc:t.children,className:r,linkClassName:o})]},t.id)})}):null});function v(e){var t,n,d,v,f,p,b,m,h,g=e.toc,j=e.className,y=e.linkClassName,O=void 0===y?"table-of-contents__link":y,x=e.linkActiveClassName,w=void 0===x?void 0:x,C=e.minHeadingLevel,L=e.maxHeadingLevel,N=function(e,t){if(null==e)return{};var n,l,r=function(e,t){if(null==e)return{};var n,l,r={},o=Object.keys(e);for(l=0;l<o.length;l++)n=o[l],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(l=0;l<o.length;l++){if(n=o[l],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}}return r}(e,["toc","className","linkClassName","linkActiveClassName","minHeadingLevel","maxHeadingLevel"]),P=(0,o.L)(),H=null!=C?C:P.tableOfContents.minHeadingLevel,_=null!=L?L:P.tableOfContents.maxHeadingLevel;var S=(n=(t={toc:g,minHeadingLevel:H,maxHeadingLevel:_}).toc,d=t.minHeadingLevel,v=t.maxHeadingLevel,(0,r.useMemo)(function(){var e,t,l;return function e(t){var n=t.toc,l=t.minHeadingLevel,r=t.maxHeadingLevel;return n.flatMap(function(t){var n,o=e({toc:t.children,minHeadingLevel:l,maxHeadingLevel:r});return(n=t).level>=l&&n.level<=r?[c(a({},t),{children:o})]:o})}({toc:(e=n.map(function(e){return c(a({},e),{parentIndex:-1,children:[]})}),t=Array(7).fill(-1),e.forEach(function(e,n){var l,r,o=t.slice(2,e.level);e.parentIndex=(r=Math).max.apply(r,function(e){if(Array.isArray(e))return i(e)}(l=o)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}}(l)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),t[e.level]=n}),l=[],e.forEach(function(t){var n=t.parentIndex,r=function(e,t){if(null==e)return{};var n,l,r=function(e,t){if(null==e)return{};var n,l,r={},o=Object.keys(e);for(l=0;l<o.length;l++)n=o[l],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(l=0;l<o.length;l++){if(n=o[l],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}}return r}(t,["parentIndex"]);n>=0?e[n].children.push(r):l.push(r)}),l),minHeadingLevel:d,maxHeadingLevel:v})},[n,d,v]));return f=(0,r.useMemo)(function(){if(O&&w)return{linkClassName:O,linkActiveClassName:w,minHeadingLevel:H,maxHeadingLevel:_}},[O,w,H,_]),p=(0,r.useRef)(void 0),h=(b=(0,r.useRef)(0),m=(0,o.L)().navbar.hideOnScroll,(0,r.useEffect)(function(){b.current=m?0:document.querySelector(".navbar").clientHeight},[m]),b),(0,r.useEffect)(function(){var e=function(e,t){t?(p.current&&p.current!==e&&p.current.classList.remove(l),e.classList.add(l),p.current=e):e.classList.remove(l)},t=function(){var t,l=(t=n,Array.from(document.getElementsByClassName(t))),i=function(e,t){var n,l,r,o=t.anchorTopOffset,i=e.find(function(e){return s(e).top>=o});if(i){;return(l=s(i)).top>0&&l.bottom<window.innerHeight/2?i:null!==(n=e[e.indexOf(i)-1])&&void 0!==n?n:null}return null!==(r=e[e.length-1])&&void 0!==r?r:null}(function(e){for(var t=e.minHeadingLevel,n=e.maxHeadingLevel,l=[],r=t;r<=n;r+=1)l.push("h".concat(r,".anchor"));return Array.from(document.querySelectorAll(l.join()))}({minHeadingLevel:r,maxHeadingLevel:o}),{anchorTopOffset:h.current}),a=l.find(function(e){var t;return i&&i.id===decodeURIComponent((t=e).href.substring(t.href.indexOf("#")+1))});l.forEach(function(t){e(t,t===a)})};if(!f)return function(){};var n=f.linkClassName,l=f.linkActiveClassName,r=f.minHeadingLevel,o=f.maxHeadingLevel;return document.addEventListener("scroll",t),document.addEventListener("resize",t),t(),function(){document.removeEventListener("scroll",t),document.removeEventListener("resize",t)}},[f,h]),(0,l.jsx)(u,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},l=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),l.forEach(function(t){var l,r,o;l=e,r=t,o=n[t],r in l?Object.defineProperty(l,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[r]=o})}return e}({toc:S,className:void 0===j?"table-of-contents table-of-contents__left-border":j,linkClassName:O},N))}},14522:function(e,t,n){n.d(t,{Z:()=>f});var l=n("24246");n("27378");var r=n("90496");let o="browserWindow_my1Q",i="browserWindowHeader_jXSR",a="buttons_uHc7",c="browserWindowAddressBar_Pd8y",s="dot_giz1",d="browserWindowMenuIcon_Vhuh",u="bar_rrRL",v="browserWindowBody_Idgs";function f(e){var t,n,f=e.children,p=e.minHeight,b=e.url,m=e.style,h=e.bodyStyle;return(0,l.jsxs)("div",{className:o,style:(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},l=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),l.forEach(function(t){var l,r,o;l=e,r=t,o=n[t],r in l?Object.defineProperty(l,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[r]=o})}return e}({},m),n=(n={minHeight:p},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);n.push.apply(n,l)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),children:[(0,l.jsxs)("div",{className:i,children:[(0,l.jsxs)("div",{className:a,children:[(0,l.jsx)("span",{className:s,style:{background:"#f25f58"}}),(0,l.jsx)("span",{className:s,style:{background:"#fbbe3c"}}),(0,l.jsx)("span",{className:s,style:{background:"#58cb42"}})]}),(0,l.jsx)("div",{className:(0,r.Z)(c,"text--truncate"),children:void 0===b?"http://localhost:3000":b}),(0,l.jsx)("div",{className:d,children:(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:u}),(0,l.jsx)("span",{className:u}),(0,l.jsx)("span",{className:u})]})})]}),(0,l.jsx)("div",{className:v,style:h,children:f})]})}},80980:function(e,t,n){n.d(t,{Z:function(){return a},a:function(){return i}});var l=n(27378);let r={},o=l.createContext(r);function i(e){let t=l.useContext(o);return l.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),l.createElement(o.Provider,{value:t},e.children)}}}]);