docusaurus/assets/js/276a1994.c1c4802d.js
2025-04-15 07:34:19 +00:00

5 lines
No EOL
31 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["37251"],{71317:function(e,n,s){s.r(n),s.d(n,{frontMatter:()=>l,default:()=>h,contentTitle:()=>a,assets:()=>c,toc:()=>u,metadata:()=>r});var r=JSON.parse('{"id":"release-process","title":"Release process","description":"Let\'s see how Docusaurus handles versioning, releases and breaking changes.","source":"@site/community/5-release-process.mdx","sourceDirName":".","slug":"/release-process","permalink":"/community/release-process","draft":false,"unlisted":false,"editUrl":"https://github.com/facebook/docusaurus/edit/main/website/community/5-release-process.mdx","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1744702265000,"sidebarPosition":5,"frontMatter":{},"sidebar":"community","previous":{"title":"Canary releases","permalink":"/community/canary"}}'),t=s(85893),i=s(80980),o=s(21143);let l={},a="Release process",c={},u=[{value:"Semantic versioning",id:"semantic-versioning",level:2},{value:"Major versions",id:"major-versions",level:3},{value:"Minor versions",id:"minor-versions",level:3},{value:"Patch versions",id:"patch-versions",level:3},{value:"Versions",id:"versions",level:2},{value:"Stable version",id:"stable-version",level:3},{value:"Next version",id:"next-version",level:3},{value:"Public API surface",id:"public-api-surface",level:2},{value:"Core public API",id:"core-public-api",level:3},{value:"Theming public API",id:"theming-public-api",level:3}];function d(e){let n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"release-process",children:"Release process"})}),"\n",(0,t.jsxs)(n.p,{children:["Let's see how Docusaurus handles ",(0,t.jsx)(n.strong,{children:"versioning, releases and breaking changes"}),"."]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsx)(n.p,{children:"This topic is particularly important for highly customized sites that may have difficulties to upgrade."})}),"\n",(0,t.jsx)(n.h2,{id:"semantic-versioning",children:"Semantic versioning"}),"\n",(0,t.jsxs)(n.p,{children:["Docusaurus versioning is based on the ",(0,t.jsx)(n.code,{children:"major.minor.patch"})," scheme and respects ",(0,t.jsx)(n.a,{href:"https://semver.org/",children:"Semantic Versioning"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"Respecting Semantic Versioning is important for multiple reasons:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["It ",(0,t.jsx)(n.strong,{children:"guarantees simple minor version upgrades"}),", as long as you only use the ",(0,t.jsx)(n.a,{href:"/community/release-process#public-api-surface",children:"public API"})]}),"\n",(0,t.jsx)(n.li,{children:"It follows front-end ecosystem conventions"}),"\n",(0,t.jsx)(n.li,{children:"A new major version is an opportunity to thoroughly document breaking changes"}),"\n",(0,t.jsx)(n.li,{children:"A new major/minor version is an opportunity to communicate new features through a blog post"}),"\n"]}),"\n",(0,t.jsxs)(n.admonition,{type:"note",children:[(0,t.jsxs)(n.p,{children:["Releasing Docusaurus 2.0 took a very long time. From now on, Docusaurus will ",(0,t.jsx)(n.strong,{children:"release new major versions more regularly"}),". In practice, you can expect a new major version every 2\u20134 months."]}),(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html",children:"Major version numbers are not sacred"}),", but we still group breaking changes together and avoid releasing major versions too often."]})]}),"\n",(0,t.jsx)(n.h3,{id:"major-versions",children:"Major versions"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"major"})," version number is incremented on ",(0,t.jsx)(n.strong,{children:"every breaking change"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"Whenever a new major version is released, we publish:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["a blog post with feature highlights, major bug fixes, ",(0,t.jsx)(n.strong,{children:"breaking changes, and upgrade instructions"}),"."]}),"\n",(0,t.jsx)(n.li,{children:"an exhaustive changelog entry"}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["Read our ",(0,t.jsx)(n.a,{href:"#public-api-surface",children:"public API surface"})," section to clearly understand what we consider as a breaking change."]})}),"\n",(0,t.jsx)(n.h3,{id:"minor-versions",children:"Minor versions"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"minor"})," version number is incremented on every significant retro-compatible change."]}),"\n",(0,t.jsx)(n.p,{children:"Whenever a new minor version is released, we publish:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"a blog post with a list of feature highlights and major bug fixes"}),"\n",(0,t.jsx)(n.li,{children:"an exhaustive changelog entry"}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["If you only use our ",(0,t.jsx)(n.a,{href:"#public-api-surface",children:"public API surface"}),", you should be able to upgrade in no time!"]})}),"\n",(0,t.jsx)(n.h3,{id:"patch-versions",children:"Patch versions"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"patch"})," version number is incremented on bugfixes releases."]}),"\n",(0,t.jsx)(n.p,{children:"Whenever a new patch version is released, we publish:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"an exhaustive changelog entry"}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"versions",children:"Versions"}),"\n","\n",(0,t.jsx)(n.p,{children:"The Docusaurus team is usually working on 2 major versions at the same time:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsxs)(n.strong,{children:["Docusaurus ",(0,t.jsx)(o.Fr,{})]}),": the ",(0,t.jsx)(n.strong,{children:"stable"})," version, on the ",(0,t.jsx)(o.Zl,{})," branch"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsxs)(n.strong,{children:["Docusaurus ",(0,t.jsx)(o.CW,{})]}),": the ",(0,t.jsx)(n.strong,{children:"next"})," version, on the ",(0,t.jsx)(o.mq,{})," branch"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(o.Zl,{})," branch is created just before releasing the first v",(0,t.jsx)(o.Fr,{})," release candidate."]})}),"\n",(0,t.jsx)(n.h3,{id:"stable-version",children:"Stable version"}),"\n",(0,t.jsxs)(n.p,{children:["The stable version (v",(0,t.jsx)(o.Fr,{}),", on ",(0,t.jsx)(o.Zl,{}),") is recommended for most Docusaurus users."]}),"\n",(0,t.jsxs)(n.p,{children:["We regularly backport retro-compatible features, bug and security fixes from ",(0,t.jsx)(o.mq,{})," to ",(0,t.jsx)(o.Zl,{})," with ",(0,t.jsx)(n.code,{children:"git cherry-pick"})," to make them available to those not ready for the next version."]}),"\n",(0,t.jsxs)(n.admonition,{type:"info",children:[(0,t.jsxs)(n.p,{children:["After a new stable version has been released, the former stable version will continue to receive support only for ",(0,t.jsx)(n.strong,{children:"major security issues"})," for ",(0,t.jsx)(n.strong,{children:"3 months"}),". Otherwise, all features will be frozen and non-critical bugs will not be fixed."]}),(0,t.jsx)(n.p,{children:"It is recommended to upgrade within that time frame to the new stable version."})]}),"\n",(0,t.jsx)(n.h3,{id:"next-version",children:"Next version"}),"\n",(0,t.jsxs)(n.p,{children:["The next version (v",(0,t.jsx)(o.CW,{}),", on ",(0,t.jsx)(o.mq,{}),") is the version the Docusaurus team is currently working on."]}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(o.mq,{})," branch is the ",(0,t.jsx)(n.strong,{children:"default target branch"})," for all pull requests, including core team and external contributions."]}),"\n",(0,t.jsxs)(n.p,{children:["This version is recommended for ",(0,t.jsx)(n.strong,{children:"early adopters"})," that want to use the latest Docusaurus features as soon as possible. It is also a good way to help us by reporting bugs and giving some feedback."]}),"\n",(0,t.jsx)(n.p,{children:"There are 3 ways to use the next version:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["with an ",(0,t.jsx)(n.code,{children:"alpha"}),", ",(0,t.jsx)(n.code,{children:"beta"})," or ",(0,t.jsx)(n.code,{children:"rc"})," pre-release"]}),"\n",(0,t.jsxs)(n.li,{children:["with the ",(0,t.jsx)(n.code,{children:"@next"})," npm dist tag for the latest pre-release"]}),"\n",(0,t.jsxs)(n.li,{children:["with a ",(0,t.jsx)(n.a,{href:"/community/canary",children:"canary release"})," for the very latest features"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"The next version passes all our automated tests and is used by the Docusaurus site itself. It is relatively safe: don't be afraid to give it a try."})}),"\n",(0,t.jsxs)(n.admonition,{type:"warning",children:[(0,t.jsx)(n.p,{children:"Breaking changes can happen on the next version: detailed upgrade instructions are available in the changelog and pull requests."}),(0,t.jsxs)(n.p,{children:["At the ",(0,t.jsx)(n.code,{children:"beta"})," and ",(0,t.jsx)(n.code,{children:"rc"})," (release candidate) phases, we avoid introducing major breaking changes."]})]}),"\n",(0,t.jsx)(n.h2,{id:"public-api-surface",children:"Public API surface"}),"\n",(0,t.jsxs)(n.p,{children:["Docusaurus commits to respecting Semantic Versioning. This means that whenever changes occur in Docusaurus public APIs and break backward compatibility, we will increment the ",(0,t.jsx)(n.code,{children:"major"})," version number."]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["Docusaurus guarantees public API retro-compatibility across ",(0,t.jsx)(n.code,{children:"minor"})," versions. Unless you use internal APIs, ",(0,t.jsx)(n.code,{children:"minor"})," version upgrades should be easy."]})}),"\n",(0,t.jsx)(n.p,{children:"We will outline what accounts as the public API surface."}),"\n",(0,t.jsx)(n.h3,{id:"core-public-api",children:"Core public API"}),"\n",(0,t.jsx)(n.p,{children:"\u2705 Our public API includes:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"Docusaurus config"}),"\n",(0,t.jsx)(n.li,{children:"Docusaurus client APIs"}),"\n",(0,t.jsx)(n.li,{children:"Docusaurus CLI"}),"\n",(0,t.jsx)(n.li,{children:"Preset options"}),"\n",(0,t.jsx)(n.li,{children:"Plugin options"}),"\n",(0,t.jsx)(n.li,{children:"Plugin lifecycle APIs"}),"\n",(0,t.jsx)(n.li,{children:"Theme config"}),"\n",(0,t.jsx)(n.li,{children:"Core plugins route component props"}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"@docusaurus/types"})," TypeScript types","\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"We still retain the freedom to make types stricter (which may break type-checking)."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["\u274C Our public API ",(0,t.jsx)(n.strong,{children:"excludes"}),":"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Docusaurus config ",(0,t.jsx)(n.code,{children:"future"})]}),"\n",(0,t.jsxs)(n.li,{children:["All features prefixed by ",(0,t.jsx)(n.code,{children:"experimental_"})," or ",(0,t.jsx)(n.code,{children:"unstable_"})]}),"\n",(0,t.jsxs)(n.li,{children:["All features prefixed by ",(0,t.jsx)(n.code,{children:"v<MajorVersion>_"})," (",(0,t.jsx)(n.code,{children:"v6_"})," ",(0,t.jsx)(n.code,{children:"v7_"}),", etc.)"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"For non-theme APIs, any documented API is considered public (and will be stable); any undocumented API is considered internal."})}),"\n",(0,t.jsxs)(n.p,{children:['An API being "stable" means if you increment the patch or minor version of your Docusaurus installation without any other change, running ',(0,t.jsx)(n.code,{children:"docusaurus start"})," or ",(0,t.jsx)(n.code,{children:"docusaurus build"})," should not throw an error."]}),"\n",(0,t.jsx)(n.h3,{id:"theming-public-api",children:"Theming public API"}),"\n",(0,t.jsx)(n.p,{children:"Docusaurus has a very flexible theming system:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"You can use custom CSS"}),"\n",(0,t.jsxs)(n.li,{children:["You can ",(0,t.jsx)(n.a,{href:"/docs/swizzling",children:"swizzle"})," any React theme component"]}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"This system also implicitly creates a very large API surface. To be able to move fast and improve Docusaurus, we can't guarantee retro-compatibility."}),"\n",(0,t.jsx)(n.p,{children:"\u2705 Our public theming API includes:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"/docs/styling-layout#theme-class-names",children:"Theme class names"})}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.a,{href:"/docs/styling-layout#styling-your-site-with-infima",children:"Infima"})," class names and CSS variables"]}),"\n",(0,t.jsxs)(n.li,{children:["React components that are ",(0,t.jsx)(n.a,{href:"/docs/swizzling#what-is-safe-to-swizzle",children:"safe to swizzle"})]}),"\n",(0,t.jsx)(n.li,{children:"The theme user experience"}),"\n",(0,t.jsx)(n.li,{children:"Browser support"}),"\n"]}),"\n",(0,t.jsxs)(n.admonition,{type:"tip",children:[(0,t.jsx)(n.p,{children:"You may not be able to achieve your site customization through this public API."}),(0,t.jsxs)(n.p,{children:["In this case, please ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/docusaurus/discussions/5468",children:"report your customization use case"})," and we will figure out how to expand our public API."]})]}),"\n",(0,t.jsxs)(n.p,{children:["\u274C Our public theming API ",(0,t.jsx)(n.strong,{children:"excludes"}),":"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"The DOM structure"}),"\n",(0,t.jsxs)(n.li,{children:["CSS module class names with a hash suffix (usually targeted with ",(0,t.jsx)(n.code,{children:"[class*='myClassName']"})," selectors)"]}),"\n",(0,t.jsxs)(n.li,{children:["React components that are ",(0,t.jsx)(n.a,{href:"/docs/swizzling#what-is-safe-to-swizzle",children:"unsafe or forbidden to swizzle"})]}),"\n",(0,t.jsxs)(n.li,{children:["React components that import from ",(0,t.jsx)(n.code,{children:"@docusaurus/theme-common/internal"})]}),"\n",(0,t.jsx)(n.li,{children:"The exact visual appearance of the theme"}),"\n"]}),"\n",(0,t.jsxs)(n.admonition,{type:"note",children:[(0,t.jsxs)(n.p,{children:["When ",(0,t.jsx)(n.a,{href:"/docs/swizzling",children:"swizzling"})," safe components, you might encounter components that import undocumented APIs from ",(0,t.jsx)(n.code,{children:"@docusaurus/theme-common"})," (without the ",(0,t.jsx)(n.code,{children:"/internal"})," subpath)."]}),(0,t.jsx)(n.p,{children:'We still maintain retro-compatibility on those APIs (hence they are marked as "safe"), but we don\'t encourage a direct usage.'})]})]})}function h(e={}){let{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},56497:function(e,n,s){s.d(n,{Z:()=>i});var r=s(85893);s(67294);var t=s(71607);function i(e){let{children:n,fallback:s}=e;return(0,t.Z)()?(0,r.jsx)(r.Fragment,{children:n?.()}):s??null}},21143:function(e,n,s){s.d(n,{CW:()=>x,FS:()=>y,Fr:()=>j,Hc:()=>w,I1:()=>m,SR:()=>p,UM:()=>v,Zl:()=>g,mC:()=>d,mq:()=>b,rv:()=>k});var r=s(85893),t=s(67294),i=s(99887),o=s(90158),l=s(77827),a=s(35363),c=s(27817);let u=t.createContext(null);function d(e){let{children:n}=e,[s,i]=(0,t.useState)(null),o=(0,t.useRef)(!0);return(0,t.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]),(0,t.useEffect)(()=>{fetch("https://registry.npmjs.org/@docusaurus/core").then(e=>e.json()).then(e=>{if(!o.current)return;let n=Object.keys(e.versions).at(-1),s=e.time[n];i({name:n,time:s})})},[]),(0,r.jsx)(u.Provider,{value:s,children:n})}function h(){let e=(0,i.J)("default").preferredVersion?.name,n=(0,o.gB)("default"),s=(n.find(e=>"current"!==e.name)??n[0]).name;return e&&"current"!==e?e:s}function m(){let e=(0,t.useContext)(u);return e?(0,r.jsx)("span",{children:(0,r.jsx)(l.Z,{description:"The hint text for the current canary version tag.",values:{canaryVersionName:(0,r.jsx)("b",{children:e.name})},children:"Current: {canaryVersionName}"})}):(0,r.jsx)("span",{children:(0,r.jsx)(l.Z,{description:"An example canary version tag when the actual version can't be fetched.",children:"Example: 0.0.0-4922"})})}function p(){let e=h();return(0,r.jsx)("span",{children:e})}function x(){return(0,r.jsx)("span",{children:3})}function j(){return(0,r.jsx)("span",{children:2})}function f(e){let{branch:n}=e;return(0,r.jsx)(a.Z,{to:`https://github.com/facebook/docusaurus/tree/${n}`,children:(0,r.jsx)("code",{children:n})})}function g(){return(0,r.jsx)(f,{branch:"docusaurus-v2"})}function b(){return(0,r.jsx)(f,{branch:"main"})}function v(e){let{children:n}=e;return(0,t.useContext)(u)?null:n}function y(e){let{children:n}=e;return(0,t.useContext)(u)?n:null}function w(){let e=(0,t.useContext)(u)?.name??"0.0.0-4922",n=h();return(0,r.jsx)(c.Z,{language:"diff",children:`- "@docusaurus/core": "^${n}",
- "@docusaurus/preset-classic": "^${n}",
+ "@docusaurus/core": "${e}",
+ "@docusaurus/preset-classic": "${e}",
`})}function k(){let e=(0,t.useContext)(u)?.time;return e?(0,r.jsx)(l.Z,{values:{time:(0,r.jsx)("b",{children:new Date(e).toLocaleString()})},children:"The latest canary version that's available on npm is published at {time}."}):null}},27817:function(e,n,s){s.d(n,{Z:()=>ex});var r={};s.r(r),s.d(r,{ButtonExample:()=>ed});var t=s(85893),i=s(67294),o=s(71607),l=s(90496),a=s(45245),c=s(26378);function u(){let{prism:e}=(0,c.L)(),{colorMode:n}=(0,a.I)(),s=e.theme,r=e.darkTheme||s;return"dark"===n?r:s}var d=s(55951),h=s(6324),m=s.n(h),p=s(50923);let x=/title=(?<quote>["'])(?<title>.*?)\1/,j=/\{(?<range>[\d,-]+)\}/,f={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},g={...f,lua:{start:"--",end:""},wasm:{start:"\\;\\;",end:""},tex:{start:"%",end:""},vb:{start:"['\u2018\u2019]",end:""},vbnet:{start:"(?:_\\s*)?['\u2018\u2019]",end:""},rem:{start:"[Rr][Ee][Mm]\\b",end:""},f90:{start:"!",end:""},ml:{start:"\\(\\*",end:"\\*\\)"},cobol:{start:"\\*>",end:""}},b=Object.keys(f);function v(e,n){let s=e.map(e=>{let{start:s,end:r}=g[e];return`(?:${s}\\s*(${n.flatMap(e=>[e.line,e.block?.start,e.block?.end].filter(Boolean)).join("|")})\\s*${r})`}).join("|");return RegExp(`^\\s*(?:${s})\\s*$`)}let y=(0,i.createContext)(null);function w(e){let{metadata:n,wordWrap:s,children:r}=e,o=(0,i.useMemo)(()=>({metadata:n,wordWrap:s}),[n,s]);return(0,t.jsx)(y.Provider,{value:o,children:r})}function k(){let e=(0,i.useContext)(y);if(null===e)throw new p.i6("CodeBlockContextProvider");return e}function C(e){let{as:n,...s}=e,r=function(e){let n={color:"--prism-color",backgroundColor:"--prism-background-color"},s={};return Object.entries(e.plain).forEach(e=>{let[r,t]=e,i=n[r];i&&"string"==typeof t&&(s[i]=t)}),s}(u());return(0,t.jsx)(n,{...s,style:r,className:(0,l.Z)(s.className,"codeBlockContainer_jDV4",d.k.common.codeBlock)})}let N={codeBlock:"codeBlock_Gebt",codeBlockStandalone:"codeBlockStandalone_i_cY",codeBlockLines:"codeBlockLines_FJaf",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_FU9Q"};function I(e){let{children:n,className:s}=e;return(0,t.jsx)(C,{as:"pre",tabIndex:0,className:(0,l.Z)(N.codeBlockStandalone,"thin-scrollbar",s),children:(0,t.jsx)("code",{className:N.codeBlockLines,children:n})})}let B={attributes:!0,characterData:!0,childList:!0,subtree:!0};function A(e){let{children:n}=e;return n}var L=s(7316);function P(e){let{line:n,token:s,...r}=e;return(0,t.jsx)("span",{...r})}let T={codeLine:"codeLine_qRmp",codeLineNumber:"codeLineNumber_dS_J",codeLineContent:"codeLineContent_XF5l"};function S(e){let{line:n,classNames:s,showLineNumbers:r,getLineProps:i,getTokenProps:o}=e,a=function(e){let n=1===e.length&&"\n"===e[0].content?e[0]:void 0;return n?[{...n,content:""}]:e}(n),c=i({line:a,className:(0,l.Z)(s,r&&T.codeLine)}),u=a.map((e,n)=>{let s=o({token:e});return(0,t.jsx)(P,{...s,line:a,token:e,children:s.children},n)});return(0,t.jsxs)("span",{...c,children:[r?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:T.codeLineNumber}),(0,t.jsx)("span",{className:T.codeLineContent,children:u})]}):u,(0,t.jsx)("br",{})]})}let Z=i.forwardRef((e,n)=>(0,t.jsx)("pre",{ref:n,tabIndex:0,...e,className:(0,l.Z)(e.className,N.codeBlock,"thin-scrollbar")}));function E(e){let{metadata:n}=k();return(0,t.jsx)("code",{...e,className:(0,l.Z)(e.className,N.codeBlockLines,void 0!==n.lineNumbersStart&&N.codeBlockLinesWithNumbering),style:{...e.style,counterReset:void 0===n.lineNumbersStart?void 0:`line-count ${n.lineNumbersStart-1}`}})}function _(e){let{className:n}=e,{metadata:s,wordWrap:r}=k(),i=u(),{code:o,language:a,lineNumbersStart:c,lineClassNames:d}=s;return(0,t.jsx)(L.y$,{theme:i,code:o,language:a,children:e=>{let{className:s,style:i,tokens:o,getLineProps:a,getTokenProps:u}=e;return(0,t.jsx)(Z,{ref:r.codeBlockRef,className:(0,l.Z)(n,s),style:i,children:(0,t.jsx)(E,{children:o.map((e,n)=>(0,t.jsx)(S,{line:e,getLineProps:a,getTokenProps:u,classNames:d[n],showLineNumbers:void 0!==c},n))})})}})}var z=s(56497),D=s(44771),W=s(77827);function R(e){let{className:n,...s}=e;return(0,t.jsx)("button",{type:"button",...s,className:(0,l.Z)("clean-btn",n)})}function M(e){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,t.jsx)("path",{fill:"currentColor",d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})})}function $(e){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,t.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})}let F={copyButtonCopied:"copyButtonCopied_wDuR",copyButtonIcons:"copyButtonIcons_gMWc",copyButtonIcon:"copyButtonIcon_GXfb",copyButtonSuccessIcon:"copyButtonSuccessIcon_ktUX"};function V(e){let{className:n}=e,{copyCode:s,isCopied:r}=function(){let{metadata:{code:e}}=k(),[n,s]=(0,i.useState)(!1),r=(0,i.useRef)(void 0),t=(0,i.useCallback)(()=>{(0,D.Z)(e),s(!0),r.current=window.setTimeout(()=>{s(!1)},1e3)},[e]);return(0,i.useEffect)(()=>()=>window.clearTimeout(r.current),[]),{copyCode:t,isCopied:n}}();return(0,t.jsx)(R,{"aria-label":r?(0,W.I)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,W.I)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,W.I)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,l.Z)(n,F.copyButton,r&&F.copyButtonCopied),onClick:s,children:(0,t.jsxs)("span",{className:F.copyButtonIcons,"aria-hidden":"true",children:[(0,t.jsx)(M,{className:F.copyButtonIcon}),(0,t.jsx)($,{className:F.copyButtonSuccessIcon})]})})}function O(e){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,t.jsx)("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})})}let H={wordWrapButtonIcon:"wordWrapButtonIcon___5r",wordWrapButtonEnabled:"wordWrapButtonEnabled_nam_"};function q(e){let{className:n}=e,{wordWrap:s}=k();if(!(s.isEnabled||s.isCodeScrollable))return!1;let r=(0,W.I)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,t.jsx)(R,{onClick:()=>s.toggle(),className:(0,l.Z)(n,s.isEnabled&&H.wordWrapButtonEnabled),"aria-label":r,title:r,children:(0,t.jsx)(O,{className:H.wordWrapButtonIcon,"aria-hidden":"true"})})}function U(e){let{className:n}=e;return(0,t.jsx)(z.Z,{children:()=>(0,t.jsxs)("div",{className:(0,l.Z)(n,"buttonGroup_KXnS"),children:[(0,t.jsx)(q,{}),(0,t.jsx)(V,{})]})})}let X={codeBlockContent:"codeBlockContent_cKMj",codeBlockTitle:"codeBlockTitle_U6Q0"};function J(e){let{className:n}=e,{metadata:s}=k();return(0,t.jsxs)(C,{as:"div",className:(0,l.Z)(n,s.className),children:[s.title&&(0,t.jsx)("div",{className:X.codeBlockTitle,children:(0,t.jsx)(A,{children:s.title})}),(0,t.jsxs)("div",{className:X.codeBlockContent,children:[(0,t.jsx)(_,{}),(0,t.jsx)(U,{})]})]})}function Y(e){let n=function(e){let{prism:n}=(0,c.L)();return function(e){var n,s,r;let t=(s=(n={language:e.language,defaultLanguage:e.defaultLanguage,className:e.className}).language??function(e){if(!e)return;let n=e.split(" ").find(e=>e.startsWith("language-"));return n?.replace(/language-/,"")}(n.className)??n.defaultLanguage,s?.toLowerCase()??"text"),{lineClassNames:i,code:o}=function(e,n){let s=e.replace(/\r?\n$/,"");return function(e,n){let{metastring:s,magicComments:r}=n;if(s&&j.test(s)){let n=s.match(j).groups.range;if(0===r.length)throw Error(`A highlight range has been given in code block's metastring (\`\`\` ${s}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);let t=r[0].className;return{lineClassNames:Object.fromEntries(m()(n).filter(e=>e>0).map(e=>[e-1,[t]])),code:e}}return null}(s,{...n})??function(e,n){let{language:s,magicComments:r}=n;if(void 0===s)return{lineClassNames:{},code:e};let t=function(e,n){switch(e){case"js":case"javascript":case"ts":case"typescript":return v(["js","jsBlock"],n);case"jsx":case"tsx":return v(["js","jsBlock","jsx"],n);case"html":return v(["js","jsBlock","html"],n);case"python":case"py":case"bash":return v(["bash"],n);case"markdown":case"md":return v(["html","jsx","bash"],n);case"tex":case"latex":case"matlab":return v(["tex"],n);case"lua":case"haskell":return v(["lua"],n);case"sql":return v(["lua","jsBlock"],n);case"wasm":return v(["wasm"],n);case"vb":case"vba":case"visual-basic":return v(["vb","rem"],n);case"vbnet":return v(["vbnet","rem"],n);case"batch":return v(["rem"],n);case"basic":return v(["rem","f90"],n);case"fsharp":return v(["js","ml"],n);case"ocaml":case"sml":return v(["ml"],n);case"fortran":return v(["f90"],n);case"cobol":return v(["cobol"],n);default:return v(b,n)}}(s,r),i=e.split(/\r?\n/),o=Object.fromEntries(r.map(e=>[e.className,{start:0,range:""}])),l=Object.fromEntries(r.filter(e=>e.line).map(e=>{let{className:n,line:s}=e;return[s,n]})),a=Object.fromEntries(r.filter(e=>e.block).map(e=>{let{className:n,block:s}=e;return[s.start,n]})),c=Object.fromEntries(r.filter(e=>e.block).map(e=>{let{className:n,block:s}=e;return[s.end,n]}));for(let e=0;e<i.length;){let n=i[e].match(t);if(!n){e+=1;continue}let s=n.slice(1).find(e=>void 0!==e);l[s]?o[l[s]].range+=`${e},`:a[s]?o[a[s]].start=e:c[s]&&(o[c[s]].range+=`${o[c[s]].start}-${e-1},`),i.splice(e,1)}let u={};return Object.entries(o).forEach(e=>{let[n,{range:s}]=e;m()(s).forEach(e=>{u[e]??=[],u[e].push(n)})}),{code:i.join("\n"),lineClassNames:u}}(s,{...n})}(e.code,{metastring:e.metastring,magicComments:e.magicComments,language:t}),a=function(e){let{className:n,language:s}=e;return(0,l.Z)(n,s&&!n?.includes(`language-${s}`)&&`language-${s}`)}({className:e.className,language:t}),c=(r=e.metastring,(r?.match(x)?.groups.title??"")||e.title),u=function(e){let{showLineNumbers:n,metastring:s}=e;if("boolean"==typeof n)return n?1:void 0;if("number"==typeof n)return n;let r=s?.split(" ").find(e=>e.startsWith("showLineNumbers"));if(r)return r.startsWith("showLineNumbers=")?parseInt(r.replace("showLineNumbers=",""),10):1}({showLineNumbers:e.showLineNumbers,metastring:e.metastring});return{codeInput:e.code,code:o,className:a,language:t,title:c,lineNumbersStart:u,lineClassNames:i}}({code:e.children,className:e.className,metastring:e.metastring,magicComments:n.magicComments,defaultLanguage:n.defaultLanguage,language:e.language,title:e.title,showLineNumbers:e.showLineNumbers})}(e),s=function(){let[e,n]=(0,i.useState)(!1),[s,r]=(0,i.useState)(!1),t=(0,i.useRef)(null),o=(0,i.useCallback)(()=>{let s=t.current.querySelector("code");e?s.removeAttribute("style"):(s.style.whiteSpace="pre-wrap",s.style.overflowWrap="anywhere"),n(e=>!e)},[t,e]),l=(0,i.useCallback)(()=>{let{scrollWidth:e,clientWidth:n}=t.current;r(e>n||t.current.querySelector("code").hasAttribute("style"))},[t]),[a,c]=(0,i.useState)(),u=(0,i.useCallback)(()=>{c(t.current?.closest("[role=tabpanel][hidden]"))},[t,c]);return(0,i.useEffect)(()=>{u()},[u]),!function(e,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:B,r=(0,p.zX)(n),t=(0,p.Ql)(s);(0,i.useEffect)(()=>{let n=new MutationObserver(r);return e&&n.observe(e,t),()=>n.disconnect()},[e,r,t])}(a,e=>{e.forEach(e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(l(),u())})},{attributes:!0,characterData:!1,childList:!1,subtree:!1}),(0,i.useEffect)(()=>{l()},[e,l]),(0,i.useEffect)(()=>(window.addEventListener("resize",l,{passive:!0}),()=>{window.removeEventListener("resize",l)}),[l]),{codeBlockRef:t,isEnabled:e,isCodeScrollable:s,toggle:o}}();return(0,t.jsx)(w,{metadata:n,wordWrap:s,children:(0,t.jsx)(J,{})})}function G(e){let{children:n,...s}=e,r=(0,o.Z)(),l=i.Children.toArray(n).some(e=>(0,i.isValidElement)(e))?n:Array.isArray(n)?n.join(""):n;return(0,t.jsx)("string"==typeof l?Y:I,{...s,children:l},String(r))}var Q=s(10075);let K=e=>`${e};`;function ee(e){let{code:n,children:s,...r}=e,i=u(),o=r.metastring?.includes("noInline")??!1;return(0,t.jsx)(Q.nu,{noInline:o,theme:i,...r,code:n?.replace(/\n$/,""),transformCode:r.transformCode??K,children:s})}function en(e){let{children:n}=e;return(0,t.jsx)("div",{className:"playgroundContainer_TDLX",children:n})}var es=s(85108),er=s(67490);function et(e){let{children:n}=e;return(0,t.jsx)("div",{className:(0,l.Z)("playgroundHeader_h_Hu"),children:n})}function ei(){return(0,t.jsx)("div",{children:"Loading..."})}function eo(){return(0,t.jsx)(z.Z,{fallback:(0,t.jsx)(ei,{}),children:()=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(er.Z,{fallback:e=>(0,t.jsx)(es.Ac,{...e}),children:(0,t.jsx)(Q.i5,{})}),(0,t.jsx)(Q.IF,{})]})})}function el(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(et,{children:(0,t.jsx)(W.Z,{id:"theme.Playground.result",description:"The result label of the live codeblocks",children:"Result"})}),(0,t.jsx)("div",{className:"playgroundPreview_u2xE",children:(0,t.jsx)(eo,{})})]})}function ea(){let e=(0,o.Z)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(et,{children:(0,t.jsx)(W.Z,{id:"theme.Playground.liveEditor",description:"The live editor label of the live codeblocks",children:"Live Editor"})}),(0,t.jsx)(Q.uz,{className:"playgroundEditor_uqZ4"},String(e))]})}function ec(){let{playgroundPosition:e}=(0,c.L)().liveCodeBlock;return(0,t.jsx)(t.Fragment,{children:"top"===e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(el,{}),(0,t.jsx)(ea,{})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ea,{}),(0,t.jsx)(el,{})]})})}function eu(e){let{children:n,transformCode:s,...r}=e;return(0,t.jsx)(en,{children:(0,t.jsx)(ee,{code:n,...r,children:(0,t.jsx)(ec,{})})})}function ed(e){return(0,t.jsx)("button",{type:"button",...e,style:{backgroundColor:"white",color:"black",border:"solid red",borderRadius:20,padding:10,cursor:"pointer",...e.style}})}let eh={React:i,...i,...r};function em(e){return(0,t.jsx)(eu,{scope:eh,...e})}function ep(e){return e.live?(0,t.jsx)(em,{...e}):(0,t.jsx)(G,{...e})}function ex(e){return(0,t.jsx)(ep,{...e})}}}]);