Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
diff --git a/404.html b/404.html index cef0d5320..8b593f2a0 100644 --- a/404.html +++ b/404.html @@ -2,7 +2,7 @@
- +We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
["'])(?.*?)\1/,p=/\{(? [\d,-]+)\}/,b={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},f={...b,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:""}},h=Object.keys(b);function g(e,t){const n=e.map((e=>{const{start:n,end:o}=f[e];return`(?:${n}\\s*(${t.flatMap((e=>[e.line,e.block?.start,e.block?.end].filter(Boolean))).join("|")})\\s*${o})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function k(e,t){let n=e.replace(/\n$/,"");const{language:o,magicComments:s,metastring:c}=t;if(c&&p.test(c)){const e=c.match(p).groups.range;if(0===s.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${c}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=s[0].className,o=d()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(o),code:n}}if(void 0===o)return{lineClassNames:{},code:n};const r=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return g(["js","jsBlock"],t);case"jsx":case"tsx":return g(["js","jsBlock","jsx"],t);case"html":return g(["js","jsBlock","html"],t);case"python":case"py":case"bash":return g(["bash"],t);case"markdown":case"md":return g(["html","jsx","bash"],t);case"tex":case"latex":case"matlab":return g(["tex"],t);case"lua":case"haskell":case"sql":return g(["lua"],t);case"wasm":return g(["wasm"],t);case"vb":case"vba":case"visual-basic":return g(["vb","rem"],t);case"vbnet":return g(["vbnet","rem"],t);case"batch":return g(["rem"],t);case"basic":return g(["rem","f90"],t);case"fsharp":return g(["js","ml"],t);case"ocaml":case"sml":return g(["ml"],t);case"fortran":return g(["f90"],t);case"cobol":return g(["cobol"],t);default:return g(h,t)}}(o,s),a=n.split("\n"),l=Object.fromEntries(s.map((e=>[e.className,{start:0,range:""}]))),i=Object.fromEntries(s.filter((e=>e.line)).map((e=>{let{className:t,line:n}=e;return[n,t]}))),u=Object.fromEntries(s.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.start,t]}))),m=Object.fromEntries(s.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.end,t]})));for(let d=0;d void 0!==e));i[t]?l[i[t]].range+=`${d},`:u[t]?l[u[t]].start=d:m[t]&&(l[m[t]].range+=`${l[m[t]].start}-${d-1},`),a.splice(d,1)}n=a.join("\n");const b={};return Object.entries(l).forEach((e=>{let[t,{range:n}]=e;d()(n).forEach((e=>{b[e]??=[],b[e].push(t)}))})),{lineClassNames:b,code:n}}const x={codeBlockContainer:"codeBlockContainer_Ckt0"};var B=n(74848);function j(e){let{as:t,...n}=e;const o=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((e=>{let[o,s]=e;const c=t[o];c&&"string"==typeof s&&(n[c]=s)})),n}(l());return(0,B.jsx)(t,{...n,style:o,className:(0,c.A)(n.className,x.codeBlockContainer,i.G.common.codeBlock)})}const y={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function v(e){let{children:t,className:n}=e;return(0,B.jsx)(j,{as:"pre",tabIndex:0,className:(0,c.A)(y.codeBlockStandalone,"thin-scrollbar",n),children:(0,B.jsx)("code",{className:y.codeBlockLines,children:t})})}var C=n(89532);const N={attributes:!0,characterData:!0,childList:!0,subtree:!0};function w(e,t){const[n,s]=(0,o.useState)(),c=(0,o.useCallback)((()=>{s(e.current?.closest("[role=tabpanel][hidden]"))}),[e,s]);(0,o.useEffect)((()=>{c()}),[c]),function(e,t,n){void 0===n&&(n=N);const s=(0,C._q)(t),c=(0,C.Be)(n);(0,o.useEffect)((()=>{const t=new MutationObserver(s);return e&&t.observe(e,c),()=>t.disconnect()}),[e,s,c])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),c())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}var E=n(71765);const L={codeLine:"codeLine_lJS_",codeLineNumber:"codeLineNumber_Tfdd",codeLineContent:"codeLineContent_feaV"};function A(e){let{line:t,classNames:n,showLineNumbers:o,getLineProps:s,getTokenProps:r}=e;1===t.length&&"\n"===t[0].content&&(t[0].content="");const a=s({line:t,className:(0,c.A)(n,o&&L.codeLine)}),l=t.map(((e,t)=>(0,B.jsx)("span",{...r({token:e,key:t})},t)));return(0,B.jsxs)("span",{...a,children:[o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{className:L.codeLineNumber}),(0,B.jsx)("span",{className:L.codeLineContent,children:l})]}):l,(0,B.jsx)("br",{})]})}var _=n(21312);function S(e){return(0,B.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,B.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 T(e){return(0,B.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,B.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})}const I={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function $(e){let{code:t,className:n}=e;const[s,r]=(0,o.useState)(!1),a=(0,o.useRef)(void 0),l=(0,o.useCallback)((()=>{!function(e,t){let{target:n=document.body}=void 0===t?{}:t;if("string"!=typeof e)throw new TypeError(`Expected parameter \`text\` to be a \`string\`, got \`${typeof e}\`.`);const o=document.createElement("textarea"),s=document.activeElement;o.value=e,o.setAttribute("readonly",""),o.style.contain="strict",o.style.position="absolute",o.style.left="-9999px",o.style.fontSize="12pt";const c=document.getSelection(),r=c.rangeCount>0&&c.getRangeAt(0);n.append(o),o.select(),o.selectionStart=0,o.selectionEnd=e.length;let a=!1;try{a=document.execCommand("copy")}catch{}o.remove(),r&&(c.removeAllRanges(),c.addRange(r)),s&&s.focus()}(t),r(!0),a.current=window.setTimeout((()=>{r(!1)}),1e3)}),[t]);return(0,o.useEffect)((()=>()=>window.clearTimeout(a.current)),[]),(0,B.jsx)("button",{type:"button","aria-label":s?(0,_.T)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,_.T)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,_.T)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,c.A)("clean-btn",n,I.copyButton,s&&I.copyButtonCopied),onClick:l,children:(0,B.jsxs)("span",{className:I.copyButtonIcons,"aria-hidden":"true",children:[(0,B.jsx)(S,{className:I.copyButtonIcon}),(0,B.jsx)(T,{className:I.copyButtonSuccessIcon})]})})}function W(e){return(0,B.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,B.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"})})}const M={wordWrapButtonIcon:"wordWrapButtonIcon_Bwma",wordWrapButtonEnabled:"wordWrapButtonEnabled_EoeP"};function H(e){let{className:t,onClick:n,isEnabled:o}=e;const s=(0,_.T)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,B.jsx)("button",{type:"button",onClick:n,className:(0,c.A)("clean-btn",t,o&&M.wordWrapButtonEnabled),"aria-label":s,title:s,children:(0,B.jsx)(W,{className:M.wordWrapButtonIcon,"aria-hidden":"true"})})}function R(e){let{children:t,className:n="",metastring:s,title:r,showLineNumbers:i,language:u}=e;const{prism:{defaultLanguage:d,magicComments:p}}=(0,a.p)(),b=function(e){return e?.toLowerCase()}(u??function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return t?.replace(/language-/,"")}(n)??d),f=l(),h=function(){const[e,t]=(0,o.useState)(!1),[n,s]=(0,o.useState)(!1),c=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const n=c.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[c,e]),a=(0,o.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=c.current,n=e>t||c.current.querySelector("code").hasAttribute("style");s(n)}),[c]);return w(c,a),(0,o.useEffect)((()=>{a()}),[e,a]),(0,o.useEffect)((()=>(window.addEventListener("resize",a,{passive:!0}),()=>{window.removeEventListener("resize",a)})),[a]),{codeBlockRef:c,isEnabled:e,isCodeScrollable:n,toggle:r}}(),g=function(e){return e?.match(m)?.groups.title??""}(s)||r,{lineClassNames:x,code:v}=k(t,{metastring:s,language:b,magicComments:p}),C=i??function(e){return Boolean(e?.includes("showLineNumbers"))}(s);return(0,B.jsxs)(j,{as:"div",className:(0,c.A)(n,b&&!n.includes(`language-${b}`)&&`language-${b}`),children:[g&&(0,B.jsx)("div",{className:y.codeBlockTitle,children:g}),(0,B.jsxs)("div",{className:y.codeBlockContent,children:[(0,B.jsx)(E.f4,{theme:f,code:v,language:b??"text",children:e=>{let{className:t,style:n,tokens:o,getLineProps:s,getTokenProps:r}=e;return(0,B.jsx)("pre",{tabIndex:0,ref:h.codeBlockRef,className:(0,c.A)(t,y.codeBlock,"thin-scrollbar"),style:n,children:(0,B.jsx)("code",{className:(0,c.A)(y.codeBlockLines,C&&y.codeBlockLinesWithNumbering),children:o.map(((e,t)=>(0,B.jsx)(A,{line:e,getLineProps:s,getTokenProps:r,classNames:x[t],showLineNumbers:C},t)))})})}}),(0,B.jsxs)("div",{className:y.buttonGroup,children:[(h.isEnabled||h.isCodeScrollable)&&(0,B.jsx)(H,{className:y.codeButton,onClick:()=>h.toggle(),isEnabled:h.isEnabled}),(0,B.jsx)($,{className:y.codeButton,code:v})]})]})]})}function V(e){let{children:t,...n}=e;const c=(0,s.A)(),r=function(e){return o.Children.toArray(e).some((e=>(0,o.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),a="string"==typeof r?R:v;return(0,B.jsx)(a,{...n,children:r},String(c))}},18426:(e,t)=>{function n(e){let t,n=[];for(let o of e.split(",").map((e=>e.trim())))if(/^-?\d+$/.test(o))n.push(parseInt(o,10));else if(t=o.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,o,s,c]=t;if(o&&c){o=parseInt(o),c=parseInt(c);const e=o {"use strict";n.d(t,{R:()=>r,x:()=>a});var o=n(96540);const s={},c=o.createContext(s);function r(e){const t=o.useContext(c);return o.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(s):e.components||s:r(e.components),o.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/15394.6afebeb8.js b/assets/js/15394.6afebeb8.js new file mode 100644 index 000000000..38a9ba978 --- /dev/null +++ b/assets/js/15394.6afebeb8.js @@ -0,0 +1 @@ +(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[15394],{21432:(e,t,n)=>{"use strict";n.d(t,{A:()=>V});var o=n(96540),s=n(92303),c=n(34164),r=n(95293),a=n(6342);function l(){const{prism:e}=(0,a.p)(),{colorMode:t}=(0,r.G)(),n=e.theme,o=e.darkTheme||n;return"dark"===t?o:n}var i=n(17559),u=n(18426),d=n.n(u);const m=/title=(? ["'])(?.*?)\1/,p=/\{(? [\d,-]+)\}/,b={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},f={...b,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:""}},h=Object.keys(b);function g(e,t){const n=e.map((e=>{const{start:n,end:o}=f[e];return`(?:${n}\\s*(${t.flatMap((e=>[e.line,e.block?.start,e.block?.end].filter(Boolean))).join("|")})\\s*${o})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function k(e,t){let n=e.replace(/\n$/,"");const{language:o,magicComments:s,metastring:c}=t;if(c&&p.test(c)){const e=c.match(p).groups.range;if(0===s.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${c}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=s[0].className,o=d()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(o),code:n}}if(void 0===o)return{lineClassNames:{},code:n};const r=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return g(["js","jsBlock"],t);case"jsx":case"tsx":return g(["js","jsBlock","jsx"],t);case"html":return g(["js","jsBlock","html"],t);case"python":case"py":case"bash":return g(["bash"],t);case"markdown":case"md":return g(["html","jsx","bash"],t);case"tex":case"latex":case"matlab":return g(["tex"],t);case"lua":case"haskell":case"sql":return g(["lua"],t);case"wasm":return g(["wasm"],t);case"vb":case"vba":case"visual-basic":return g(["vb","rem"],t);case"vbnet":return g(["vbnet","rem"],t);case"batch":return g(["rem"],t);case"basic":return g(["rem","f90"],t);case"fsharp":return g(["js","ml"],t);case"ocaml":case"sml":return g(["ml"],t);case"fortran":return g(["f90"],t);case"cobol":return g(["cobol"],t);default:return g(h,t)}}(o,s),a=n.split("\n"),l=Object.fromEntries(s.map((e=>[e.className,{start:0,range:""}]))),i=Object.fromEntries(s.filter((e=>e.line)).map((e=>{let{className:t,line:n}=e;return[n,t]}))),u=Object.fromEntries(s.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.start,t]}))),m=Object.fromEntries(s.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.end,t]})));for(let d=0;d void 0!==e));i[t]?l[i[t]].range+=`${d},`:u[t]?l[u[t]].start=d:m[t]&&(l[m[t]].range+=`${l[m[t]].start}-${d-1},`),a.splice(d,1)}n=a.join("\n");const b={};return Object.entries(l).forEach((e=>{let[t,{range:n}]=e;d()(n).forEach((e=>{b[e]??=[],b[e].push(t)}))})),{lineClassNames:b,code:n}}const x={codeBlockContainer:"codeBlockContainer_Ckt0"};var B=n(74848);function j(e){let{as:t,...n}=e;const o=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((e=>{let[o,s]=e;const c=t[o];c&&"string"==typeof s&&(n[c]=s)})),n}(l());return(0,B.jsx)(t,{...n,style:o,className:(0,c.A)(n.className,x.codeBlockContainer,i.G.common.codeBlock)})}const y={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function v(e){let{children:t,className:n}=e;return(0,B.jsx)(j,{as:"pre",tabIndex:0,className:(0,c.A)(y.codeBlockStandalone,"thin-scrollbar",n),children:(0,B.jsx)("code",{className:y.codeBlockLines,children:t})})}var C=n(89532);const N={attributes:!0,characterData:!0,childList:!0,subtree:!0};function w(e,t){const[n,s]=(0,o.useState)(),c=(0,o.useCallback)((()=>{s(e.current?.closest("[role=tabpanel][hidden]"))}),[e,s]);(0,o.useEffect)((()=>{c()}),[c]),function(e,t,n){void 0===n&&(n=N);const s=(0,C._q)(t),c=(0,C.Be)(n);(0,o.useEffect)((()=>{const t=new MutationObserver(s);return e&&t.observe(e,c),()=>t.disconnect()}),[e,s,c])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),c())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}var E=n(71765);const L={codeLine:"codeLine_lJS_",codeLineNumber:"codeLineNumber_Tfdd",codeLineContent:"codeLineContent_feaV"};function A(e){let{line:t,classNames:n,showLineNumbers:o,getLineProps:s,getTokenProps:r}=e;1===t.length&&"\n"===t[0].content&&(t[0].content="");const a=s({line:t,className:(0,c.A)(n,o&&L.codeLine)}),l=t.map(((e,t)=>(0,B.jsx)("span",{...r({token:e})},t)));return(0,B.jsxs)("span",{...a,children:[o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{className:L.codeLineNumber}),(0,B.jsx)("span",{className:L.codeLineContent,children:l})]}):l,(0,B.jsx)("br",{})]})}var _=n(21312);function S(e){return(0,B.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,B.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 T(e){return(0,B.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,B.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})}const I={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function $(e){let{code:t,className:n}=e;const[s,r]=(0,o.useState)(!1),a=(0,o.useRef)(void 0),l=(0,o.useCallback)((()=>{!function(e,t){let{target:n=document.body}=void 0===t?{}:t;if("string"!=typeof e)throw new TypeError(`Expected parameter \`text\` to be a \`string\`, got \`${typeof e}\`.`);const o=document.createElement("textarea"),s=document.activeElement;o.value=e,o.setAttribute("readonly",""),o.style.contain="strict",o.style.position="absolute",o.style.left="-9999px",o.style.fontSize="12pt";const c=document.getSelection(),r=c.rangeCount>0&&c.getRangeAt(0);n.append(o),o.select(),o.selectionStart=0,o.selectionEnd=e.length;let a=!1;try{a=document.execCommand("copy")}catch{}o.remove(),r&&(c.removeAllRanges(),c.addRange(r)),s&&s.focus()}(t),r(!0),a.current=window.setTimeout((()=>{r(!1)}),1e3)}),[t]);return(0,o.useEffect)((()=>()=>window.clearTimeout(a.current)),[]),(0,B.jsx)("button",{type:"button","aria-label":s?(0,_.T)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,_.T)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,_.T)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,c.A)("clean-btn",n,I.copyButton,s&&I.copyButtonCopied),onClick:l,children:(0,B.jsxs)("span",{className:I.copyButtonIcons,"aria-hidden":"true",children:[(0,B.jsx)(S,{className:I.copyButtonIcon}),(0,B.jsx)(T,{className:I.copyButtonSuccessIcon})]})})}function W(e){return(0,B.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,B.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"})})}const M={wordWrapButtonIcon:"wordWrapButtonIcon_Bwma",wordWrapButtonEnabled:"wordWrapButtonEnabled_EoeP"};function H(e){let{className:t,onClick:n,isEnabled:o}=e;const s=(0,_.T)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,B.jsx)("button",{type:"button",onClick:n,className:(0,c.A)("clean-btn",t,o&&M.wordWrapButtonEnabled),"aria-label":s,title:s,children:(0,B.jsx)(W,{className:M.wordWrapButtonIcon,"aria-hidden":"true"})})}function R(e){let{children:t,className:n="",metastring:s,title:r,showLineNumbers:i,language:u}=e;const{prism:{defaultLanguage:d,magicComments:p}}=(0,a.p)(),b=function(e){return e?.toLowerCase()}(u??function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return t?.replace(/language-/,"")}(n)??d),f=l(),h=function(){const[e,t]=(0,o.useState)(!1),[n,s]=(0,o.useState)(!1),c=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const n=c.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[c,e]),a=(0,o.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=c.current,n=e>t||c.current.querySelector("code").hasAttribute("style");s(n)}),[c]);return w(c,a),(0,o.useEffect)((()=>{a()}),[e,a]),(0,o.useEffect)((()=>(window.addEventListener("resize",a,{passive:!0}),()=>{window.removeEventListener("resize",a)})),[a]),{codeBlockRef:c,isEnabled:e,isCodeScrollable:n,toggle:r}}(),g=function(e){return e?.match(m)?.groups.title??""}(s)||r,{lineClassNames:x,code:v}=k(t,{metastring:s,language:b,magicComments:p}),C=i??function(e){return Boolean(e?.includes("showLineNumbers"))}(s);return(0,B.jsxs)(j,{as:"div",className:(0,c.A)(n,b&&!n.includes(`language-${b}`)&&`language-${b}`),children:[g&&(0,B.jsx)("div",{className:y.codeBlockTitle,children:g}),(0,B.jsxs)("div",{className:y.codeBlockContent,children:[(0,B.jsx)(E.f4,{theme:f,code:v,language:b??"text",children:e=>{let{className:t,style:n,tokens:o,getLineProps:s,getTokenProps:r}=e;return(0,B.jsx)("pre",{tabIndex:0,ref:h.codeBlockRef,className:(0,c.A)(t,y.codeBlock,"thin-scrollbar"),style:n,children:(0,B.jsx)("code",{className:(0,c.A)(y.codeBlockLines,C&&y.codeBlockLinesWithNumbering),children:o.map(((e,t)=>(0,B.jsx)(A,{line:e,getLineProps:s,getTokenProps:r,classNames:x[t],showLineNumbers:C},t)))})})}}),(0,B.jsxs)("div",{className:y.buttonGroup,children:[(h.isEnabled||h.isCodeScrollable)&&(0,B.jsx)(H,{className:y.codeButton,onClick:()=>h.toggle(),isEnabled:h.isEnabled}),(0,B.jsx)($,{className:y.codeButton,code:v})]})]})]})}function V(e){let{children:t,...n}=e;const c=(0,s.A)(),r=function(e){return o.Children.toArray(e).some((e=>(0,o.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),a="string"==typeof r?R:v;return(0,B.jsx)(a,{...n,children:r},String(c))}},18426:(e,t)=>{function n(e){let t,n=[];for(let o of e.split(",").map((e=>e.trim())))if(/^-?\d+$/.test(o))n.push(parseInt(o,10));else if(t=o.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,o,s,c]=t;if(o&&c){o=parseInt(o),c=parseInt(c);const e=o {"use strict";n.d(t,{R:()=>r,x:()=>a});var o=n(96540);const s={},c=o.createContext(s);function r(e){const t=o.useContext(c);return o.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(s):e.components||s:r(e.components),o.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/183053be.df7e8c57.js b/assets/js/183053be.df7e8c57.js deleted file mode 100644 index d57384ce9..000000000 --- a/assets/js/183053be.df7e8c57.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[14530],{55836:s=>{s.exports=JSON.parse('{"label":"images","permalink":"/blog/tags/images","allTagsPath":"/blog/tags","count":2,"unlisted":false}')}}]); \ No newline at end of file diff --git a/assets/js/19f0fe09.21b4eefb.js b/assets/js/19f0fe09.21b4eefb.js new file mode 100644 index 000000000..16089f673 --- /dev/null +++ b/assets/js/19f0fe09.21b4eefb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[17393],{71244:t=>{t.exports=JSON.parse('{"tag":{"label":"wrapper","permalink":"/blog/tags/wrapper","allTagsPath":"/blog/tags","count":1,"unlisted":false},"listMetadata":{"permalink":"/blog/tags/wrapper","page":1,"postsPerPage":9,"totalPages":1,"totalCount":1,"blogDescription":"Tutorials and articles about Eightshift development kit","blogTitle":"Tutorials and articles about Eightshift development kit"}}')}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.02d466ff.js b/assets/js/1a4e3797.02d466ff.js new file mode 100644 index 000000000..c5e9a78b8 --- /dev/null +++ b/assets/js/1a4e3797.02d466ff.js @@ -0,0 +1,2 @@ +/*! For license information please see 1a4e3797.02d466ff.js.LICENSE.txt */ +(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[62138],{72733:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,s,a,c,o,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i(s=this._events[e]))return!1;if(r(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),s.apply(this,c)}else if(n(s))for(c=Array.prototype.slice.call(arguments,1),a=(u=s.slice()).length,o=0;o0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,s,a,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(i=this._events[e]).length,s=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(c=a;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){s=c;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},74103:(e,t,r)=>{"use strict";var n=r(36571),i=r(19127),s=r(33371),a=r(67691);function c(e,t,r,i){return new n(e,t,r,i)}c.version=r(16938),c.AlgoliaSearchHelper=n,c.SearchParameters=s,c.RecommendParameters=i,c.SearchResults=a,e.exports=c},46732:(e,t,r)=>{"use strict";var n=r(72733);function i(e,t,r){this.main=e,this.fn=t,this.recommendFn=r,this.lastResults=null,this.lastRecommendResults=null}r(73014)(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},i.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},e.exports=i},19127:e=>{"use strict";function t(e){e=e||{},this.params=e.params||[]}t.prototype={constructor:t,addParams:function(e){var r=this.params.slice(),n=this.params.findIndex((function(t){return t.$$id===e.$$id}));return-1!==n?r.splice(n,1,e):r.push(e),new t({params:r})},removeParams:function(e){return new t({params:this.params.filter((function(t){return t.$$id!==e}))})},addFrequentlyBoughtTogether:function(e){return this.addParams(Object.assign({},e,{model:"bought-together"}))},addRelatedProducts:function(e){return this.addParams(Object.assign({},e,{model:"related-products"}))},addTrendingItems:function(e){return this.addParams(Object.assign({},e,{model:"trending-items"}))},addTrendingFacets:function(e){return this.addParams(Object.assign({},e,{model:"trending-facets"}))},addLookingSimilar:function(e){return this.addParams(Object.assign({},e,{model:"looking-similar"}))},_buildQueries:function(e){return this.params.map((function(t){var r=Object.assign({},t,{indexName:e});return delete r.$$id,r}))}},e.exports=t},44054:(e,t,r)=>{"use strict";var n=r(29110),i=r(40317),s=r(21383),a={addRefinement:function(e,t,r){if(a.isRefined(e,t,r))return e;var i=""+r,s=e[t]?e[t].concat(i):[i],c={};return c[t]=s,n({},c,e)},removeRefinement:function(e,t,r){if(void 0===r)return a.clearRefinement(e,(function(e,r){return t===r}));var n=""+r;return a.clearRefinement(e,(function(e,r){return t===r&&n===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,r)?a.removeRefinement(e,t,r):a.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return i(e)?{}:e;if("string"==typeof t)return s(e,[t]);if("function"==typeof t){var n=!1,a=Object.keys(e).reduce((function(i,s){var a=e[s]||[],c=a.filter((function(e){return!t(e,s,r)}));return c.length!==a.length&&(n=!0),i[s]=c,i}),{});return n?a:e}},isRefined:function(e,t,r){var n=Boolean(e[t])&&e[t].length>0;if(void 0===r||!n)return n;var i=""+r;return-1!==e[t].indexOf(i)}};e.exports=a},33371:(e,t,r)=>{"use strict";var n=r(29110),i=r(20849),s=r(14843),a=r(44728),c=r(40317),o=r(21383),u=r(17507),h=r(72208),f=r(44054);function l(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return l(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var n=-1!==m.PARAMETERS.indexOf(e),i=void 0!==t[e];!n&&i&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var n=e[r];if("string"==typeof n){var i=parseFloat(n);t[r]=isNaN(i)?n:i}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach((function(e){var i=n[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=i}))})),t.numericRefinements=r}return a(e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&c(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):c(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:f.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:f.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:f.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:f.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var n=u(r);if(this.isNumericRefined(e,t,n))return this;var i=a({},this.numericRefinements);return i[e]=a({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(n)):i[e][t]=[n],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var n=r;return void 0!==n?this.isNumericRefined(e,t,n)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t&&l(r.val,u(n))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return c(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return o(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,n=Object.keys(r).reduce((function(n,i){var s=r[i],a={};return s=s||{},Object.keys(s).forEach((function(r){var n=s[r]||[],c=[];n.forEach((function(t){e({val:t,op:r},i,"numeric")||c.push(t)})),c.length!==n.length&&(t=!0),a[r]=c})),n[i]=a,n}),{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:f.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:f.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:f.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:f.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:f.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:f.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:f.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:f.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:f.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),i={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?i[e]=[]:i[e]=[t.slice(0,t.lastIndexOf(r))]:i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},i,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&f.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!n)return n;var s,a,c=u(r),o=void 0!==(s=this.numericRefinements[e][t],a=c,i(s,(function(e){return l(e,a)})));return n&&o},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=s(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return s(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0}))).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(n){var i=r[n];-1===e.indexOf(n)&&void 0!==i&&(t[n]=i)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,n=m._parseNumbers(e),i=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),s=Object.keys(n).reduce((function(e,t){var r=void 0!==e[t],i=void 0!==n[t];return r&&!i?o(e,[t]):(i&&(e[t]=n[t]),e)}),i);return new this.constructor(s)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return i(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},76673:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var n=e.hierarchicalFacets[r],u=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",h=e._getHierarchicalFacetSeparator(n),f=e._getHierarchicalRootPath(n),l=e._getHierarchicalShowParentLevel(n),m=s(e._getHierarchicalFacetSortBy(n)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,n,s){return function(u,h,f){var l=u;if(f>0){var m=0;for(l=u;m {"use strict";var n=r(78965),i=r(29110),s=r(2909),a=r(20849),c=r(43917),o=r(7577),u=r(44728),h=r(38601),f=s.escapeFacetValue,l=s.unescapeFacetValue,m=r(76673);function d(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function p(e,t,r){t&&t[r]&&(e.stats=t[r])}function g(e,t,r){var s=t[0];this._rawResults=t;var o=this;Object.keys(s).forEach((function(e){o[e]=s[e]}));var h=u({persistHierarchicalRootCount:!1},r);Object.keys(h).forEach((function(e){o[e]=h[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var f=e.getRefinedDisjunctiveFacets(),g=d(e.facets),v=d(e.disjunctiveFacets),y=1,R=s.facets||{};Object.keys(R).forEach((function(t){var r,n,i=R[t],u=(r=e.hierarchicalFacets,n=t,a(r,(function(e){return(e.attributes||[]).indexOf(n)>-1})));if(u){var h=u.attributes.indexOf(t),f=c(e.hierarchicalFacets,(function(e){return e.name===u.name}));o.hierarchicalFacets[f][h]={attribute:t,data:i,exhaustive:s.exhaustiveFacetsCount}}else{var l,m=-1!==e.disjunctiveFacets.indexOf(t),d=-1!==e.facets.indexOf(t);m&&(l=v[t],o.disjunctiveFacets[l]={name:t,data:i,exhaustive:s.exhaustiveFacetsCount},p(o.disjunctiveFacets[l],s.facets_stats,t)),d&&(l=g[t],o.facets[l]={name:t,data:i,exhaustive:s.exhaustiveFacetsCount},p(o.facets[l],s.facets_stats,t))}})),this.hierarchicalFacets=n(this.hierarchicalFacets),f.forEach((function(r){var n=t[y],a=n&&n.facets?n.facets:{},h=e.getHierarchicalFacetByName(r);Object.keys(a).forEach((function(t){var r,f=a[t];if(h){r=c(e.hierarchicalFacets,(function(e){return e.name===h.name}));var m=c(o.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===m)return;o.hierarchicalFacets[r][m].data=u({},o.hierarchicalFacets[r][m].data,f)}else{r=v[t];var d=s.facets&&s.facets[t]||{};o.disjunctiveFacets[r]={name:t,data:i({},f,d),exhaustive:n.exhaustiveFacetsCount},p(o.disjunctiveFacets[r],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(n){!o.disjunctiveFacets[r].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(l(n))>-1&&(o.disjunctiveFacets[r].data[n]=0)}))}})),y++})),e.getRefinedHierarchicalFacets().forEach((function(r){var n=e.getHierarchicalFacetByName(r),s=e._getHierarchicalFacetSeparator(n),a=e.getHierarchicalRefinement(r);0===a.length||a[0].split(s).length<2||t.slice(y).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var u=r[t],h=c(e.hierarchicalFacets,(function(e){return e.name===n.name})),f=c(o.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==f){var l={};if(a.length>0&&!o.persistHierarchicalRootCount){var m=a[0].split(s)[0];l[m]=o.hierarchicalFacets[h][f].data[m]}o.hierarchicalFacets[h][f].data=i(l,u,o.hierarchicalFacets[h][f].data)}})),y++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],n=g[t];o.facets[n]={name:t,data:R[t],exhaustive:s.exhaustiveFacetsCount},r.forEach((function(e){o.facets[n]=o.facets[n]||{name:t},o.facets[n].data=o.facets[n].data||{},o.facets[n].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(m(e)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=e}function v(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=a(e.facets,r);return n?Object.keys(n.data).map((function(r){var i=f(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var i=a(e.disjunctiveFacets,r);return i?Object.keys(i.data).map((function(r){var n=f(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}})):[]}if(e._state.isHierarchicalFacet(t)){var s=a(e.hierarchicalFacets,r);if(!s)return s;var c=e._state.getHierarchicalFacetByName(t),o=e._state._getHierarchicalFacetSeparator(c),u=l(e._state.getHierarchicalRefinement(t)[0]||"");0===u.indexOf(c.rootPath)&&(u=u.replace(c.rootPath+o,""));var h=u.split(o);return h.unshift(t),y(s,h,0),s}}function y(e,t,r){e.isRefined=e.name===(t[r]&&t[r].trim()),e.data&&e.data.forEach((function(e){y(e,t,r+1)}))}function R(e,t,r,n){if(n=n||0,Array.isArray(t))return e(t,r[n]);if(!t.data||0===t.data.length)return t;var s=t.data.map((function(t){return R(e,t,r,n+1)})),a=e(s,r[n]);return i({data:a},t)}function F(e,t){var r=a(e,(function(e){return e.name===t}));return r&&r.stats}function b(e,t,r,n,i){var s=a(i,(function(e){return e.name===r})),c=s&&s.data&&s.data[n]?s.data[n]:0,o=s&&s.exhaustive||!1;return{type:t,attributeName:r,name:n,count:c,exhaustive:o}}g.prototype.getFacetByName=function(e){function t(t){return t.name===e}return a(this.facets,t)||a(this.disjunctiveFacets,t)||a(this.hierarchicalFacets,t)},g.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],g.prototype.getFacetValues=function(e,t){var r=v(this,e);if(r){var n,s=i({},t,{sortBy:g.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),a=this;if(Array.isArray(r))n=[e];else n=a._state.getHierarchicalFacetByName(r.name).attributes;return R((function(e,t){if(s.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(a,t);if(r)return function(e,t){var r=[],n=[],i=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name;void 0!==i[t]?r[i[t]]=e:n.push(e)})),r=r.filter((function(e){return e}));var s,a=t.sortRemainingBy;return"hidden"===a?r:(s="alpha"===a?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(h(n,s[0],s[1])))}(e,r)}if(Array.isArray(s.sortBy)){var n=o(s.sortBy,g.DEFAULT_SORT);return h(e,n[0],n[1])}if("function"==typeof s.sortBy)return function(e,t){return t.sort(e)}(s.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,n)}},g.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?F(this.facets,e):this._state.isDisjunctiveFacet(e)?F(this.disjunctiveFacets,e):void 0},g.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(n){e.facetsRefinements[n].forEach((function(i){r.push(b(e,"facet",n,i,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(n){e.facetsExcludes[n].forEach((function(i){r.push(b(e,"exclude",n,i,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(n){e.disjunctiveFacetsRefinements[n].forEach((function(i){r.push(b(e,"disjunctive",n,i,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(n){e.hierarchicalFacetsRefinements[n].forEach((function(i){r.push(function(e,t,r,n){var i=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(i),c=r.split(s),o=a(n,(function(e){return e.name===t})),u=c.reduce((function(e,t){var r=e&&a(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),o),h=u&&u.count||0,f=u&&u.exhaustive||!1,l=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:l,count:h,exhaustive:f}}(e,n,i,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t];Object.keys(n).forEach((function(e){n[e].forEach((function(n){r.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=g},36571:(e,t,r)=>{"use strict";var n=r(72733),i=r(46732),s=r(2909).escapeFacetValue,a=r(73014),c=r(44728),o=r(40317),u=r(21383),h=r(19127),f=r(49228),l=r(33371),m=r(67691),d=r(16938);function p(e,t,r,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+d+")"),this.setClient(e);var i=r||{};i.index=t,this.state=l.make(i),this.recommendState=new h({params:i.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=n}function g(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function v(){return this.state.page}a(p,n),p.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},p.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},p.prototype.recommend=function(){return this._recommend(),this},p.prototype.getQuery=function(){var e=this.state;return f._getHitsSearchParams(e)},p.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,n=f._getQueries(r.index,r),i=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(n).then((function(e){return i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),{content:new m(r,e.results),state:r,_originalResponse:e}}),(function(e){throw i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),e}));this.client.search(n).then((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(null,new m(r,e.results),r)})).catch((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(e,null,r)}))},p.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var n=r.getModifiedState(t),i=c({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:u(f._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,i)},p.prototype.searchForFacetValues=function(e,t,r,n){var i="function"==typeof this.client.searchForFacetValues,a="function"==typeof this.client.initIndex;if(!i&&!a&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(n||{}),o=c.isDisjunctiveFacet(e),u=f.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var h,l=this;return i?h=this.client.searchForFacetValues([{indexName:c.index,params:u}]):a?h=this.client.initIndex(c.index).searchForFacetValues(u):(delete u.facetName,h=this.client.search([{type:"facet",facet:e,indexName:c.index,params:u}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),h.then((function(t){return l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=s(t.value),t.isRefined=o?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),e}))},p.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},p.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},p.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},p.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},p.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},p.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},p.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},p.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},p.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},p.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},p.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},p.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},p.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},p.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},p.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},p.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},p.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},p.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},p.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},p.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},p.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},p.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},p.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},p.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},p.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},p.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},p.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},p.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},p.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},p.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},p.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},p.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},p.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},p.prototype.setCurrentPage=g,p.prototype.setPage=g,p.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},p.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},p.prototype.setState=function(e){return this._change({state:l.make(e),isPageReset:!1}),this},p.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new l(e),this},p.prototype.hasRefinements=function(e){return!!o(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},p.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},p.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},p.prototype.hasTag=function(e){return this.state.isTagRefined(e)},p.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},p.prototype.getIndex=function(){return this.state.index},p.prototype.getCurrentPage=v,p.prototype.getPage=v,p.prototype.getTags=function(){return this.state.tagRefinements},p.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var n=r[e];t.push({value:n,operator:e,type:"numeric"})})),t},p.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},p.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},p.prototype._search=function(e){var t=this.state,r=[],n=[];e.onlyWithDerivedHelpers||(n=f._getQueries(t.index,t),r.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var i=this.derivedHelpers.map((function(e){var n=e.getModifiedState(t),i=n.index?f._getQueries(n.index,n):[];return r.push({state:n,queriesCount:i.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),i})),s=Array.prototype.concat.apply(n,i),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,r,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(c){this.emit("error",{error:c})}},p.prototype._recommend=function(){var e=this.state,t=this.recommendState,r=this.getIndex(),n=[{state:t,index:r,helper:this}];this.emit("fetch",{recommend:{state:t,results:this.lastRecommendResults}});var i=this.derivedHelpers.map((function(t){var r=t.getModifiedState(e).index;if(!r)return[];var i=t.getModifiedRecommendState(new h);return n.push({state:i,index:r,helper:t}),t.emit("fetch",{recommend:{state:i,results:t.lastRecommendResults}}),i._buildQueries(r)})),s=Array.prototype.concat.apply(this.recommendState._buildQueries(r),i);if(0!==s.length)if(s.length>0&&void 0===this.client.getRecommendations)console.warn("Please update algoliasearch/lite to the latest version in order to use recommendations widgets.");else{var a=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(s).then(this._dispatchRecommendResponse.bind(this,a,n)).catch(this._dispatchRecommendError.bind(this,a))}catch(c){this.emit("error",{error:c})}}},p.prototype._dispatchAlgoliaResponse=function(e,t,r){var n=this;if(!(t 0},p.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},p.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},p.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},p.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+d+")"),this.client=e),this},p.prototype.getClient=function(){return this.client},p.prototype.derive=function(e,t){var r=new i(this,e,t);return this.derivedHelpers.push(r),r},p.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},p.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=p},78965:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},29110:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},2909:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},20849:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r {"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r {"use strict";var n=r(20849);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var i=t.split(":"),s=n(r,(function(e){return e[0]===i[0]}));return i.length>1||!s?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)}),[[],[]])}},73014:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},14843:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,n){return t.indexOf(r)>-1&&e.indexOf(r)===n}))}},44728:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,n){if(e===n)return e;for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"__proto__"!==i&&"constructor"!==i){var s=n[i],a=e[i];void 0!==a&&void 0===s||(t(a)&&t(s)?e[i]=r(a,s):e[i]="object"==typeof(c=s)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var n=1,i=arguments.length;n{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},21383:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n =0||(i[r]=e[r]);return i}},38601:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=void 0!==t,s=null===t;if(!s&&e>t||n&&i||!r)return 1;if(!n&&e =n.length?s:"desc"===n[i]?-s:s}return e.index-r.index})),i.map((function(e){return e.value}))}},17507:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},49228:(e,t,r)=>{"use strict";var n=r(44728);function i(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})}var s={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(n){r.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})})),t.getRefinedHierarchicalFacets().forEach((function(n){var i=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(i);if(a.length>0&&a[0].split(c).length>1){var o=a[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:i.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);o.forEach((function(n,a){var c=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a);function u(e){return i.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!u(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||u(t)||e.push(t),e}),[]),f=o[a-1];c.facetFilters=a>0?h.concat(f.attribute+":"+f.value):h.length>0?h:void 0,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)).sort(),r=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),o={facets:t.indexOf("*")>-1?["*"]:t,tagFilters:c};return r.length>0&&(o.facetFilters=r),a.length>0&&(o.numericFilters=a),i(n({},e.getQueryParams(),o))},_getDisjunctiveFacetSearchParams:function(e,t,r){var a=s._getFacetFilters(e,t,r),c=s._getNumericFilters(e,t),o=s._getTagFilters(e),u={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};o.length>0&&(u.tagFilters=o);var h=e.getHierarchicalFacetByName(t);return u.facets=h?s._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(u.numericFilters=c),a.length>0&&(u.facetFilters=a),i(n({},e.getQueryParams(),u))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(n){var i=e.numericRefinements[n]||{};Object.keys(i).forEach((function(e){var s=i[e]||[];t!==n&&s.forEach((function(t){if(Array.isArray(t)){var i=t.map((function(t){return n+e+t}));r.push(i)}else r.push(n+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var n=[],i=e.facetsRefinements||{};Object.keys(i).sort().forEach((function(e){(i[e]||[]).slice().sort().forEach((function(t){n.push(e+":"+t)}))}));var s=e.facetsExcludes||{};Object.keys(s).sort().forEach((function(e){(s[e]||[]).sort().forEach((function(t){n.push(e+":-"+t)}))}));var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).sort().forEach((function(e){var r=a[e]||[];if(e!==t&&r&&0!==r.length){var i=[];r.slice().sort().forEach((function(t){i.push(e+":"+t)})),n.push(i)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach((function(i){var s=(c[i]||[])[0];if(void 0!==s){var a,o,u=e.getHierarchicalFacetByName(i),h=e._getHierarchicalFacetSeparator(u),f=e._getHierarchicalRootPath(u);if(t===i){if(-1===s.indexOf(h)||!f&&!0===r||f&&f.split(h).length===s.split(h).length)return;f?(o=f.split(h).length-1,s=f):(o=s.split(h).length-2,s=s.slice(0,s.lastIndexOf(h))),a=u.attributes[o]}else o=s.split(h).length-1,a=u.attributes[o];a&&n.push([a+":"+s])}})),n},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var n=e.getHierarchicalRefinement(r.name)[0];if(!n)return t.push(r.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(r),s=n.split(i).length,a=r.attributes.slice(0,s+1);return t.concat(a)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var n=e._getHierarchicalFacetSeparator(t);if(!0===r){var i=e._getHierarchicalRootPath(t),s=0;return i&&(s=i.split(n).length),[t.attributes[s]]}var a=(e.getHierarchicalRefinement(t.name)[0]||"").split(n).length-1;return t.attributes.slice(0,a+1)},getSearchForFacetQuery:function(e,t,r,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,o={facetQuery:t,facetName:e};return"number"==typeof r&&(o.maxFacetHits=r),i(n({},s._getHitsSearchParams(c),o))}};e.exports=s},72208:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},16938:e=>{"use strict";e.exports="3.19.0"},83643:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n =0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n =0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,s=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,s=e}finally{try{n||null==c.return||c.return()}finally{if(i)throw s}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t 2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){c();var t=JSON.stringify(e);return s()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],s=t[1];return Promise.all([n,s||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var i=s();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(i)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=s();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=s(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,i).catch((function(){return c({caches:t}).get(e,n,i)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);var a=n(),c=i&&i.miss||function(){return Promise.resolve()};return a.then((function(e){return c(e)})).then((function(){return a}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function u(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function f(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n 0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,g=2,v=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function R(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var F="GET",b="POST";function j(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===v&&Date.now()-e.lastUpdate<=12e4}(e)})),i=[].concat(s(r),s(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:i.length>0?i.map((function(e){return R(e)})):t}}))}function P(e,t,n,i){var a=[],c=function(e,t){if(e.method!==F&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,i),o=function(e,t){var n=r(r({},e.headers),t.headers),i={};return Object.keys(n).forEach((function(e){var t=n[e];i[e.toLowerCase()]=t})),i}(e,i),u=n.method,h=n.method!==F?{}:r(r({},n.data),i.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),h),i.queryParameters),l=0,m=function t(r,s){var h=r.pop();if(void 0===h)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:O(a)};var m={data:c,headers:o,method:u,url:x(h,n.path,f),connectTimeout:s(l,e.timeouts.connect),responseTimeout:s(l,i.timeout)},d=function(e){var t={request:m,response:e,host:h,triesLeft:r.length};return a.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var i=d(n);return n.isTimedOut&&l++,Promise.all([e.logger.info("Retryable failure",w(i)),e.hostsCache.set(h,y(h,n.isTimedOut?v:g))]).then((function(){return t(r,s)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,i=r;try{i=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(i,n,t)}(e,O(a))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&!~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return j(e.hostsCache,t).then((function(e){return m(s(e.statelessHosts).reverse(),e.getTimeout)}))}function _(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function x(e,t,r){var n=E(r),i="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(i+="?".concat(n)),i}function E(e){return Object.keys(e).map((function(t){return f("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function O(e){return e.map((function(e){return w(e)}))}function w(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var S=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===l.WithinHeaders?n:{}},queryParameters:function(){return e===l.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:l.WithinHeaders,t,e.apiKey),s=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,s=e.requestsCache,a=e.responsesCache,c=e.timeouts,o=e.userAgent,u=e.hosts,h=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:s,responsesCache:a,timeouts:c,userAgent:o,headers:e.headers,queryParameters:h,hosts:u.map((function(e){return R(e)})),read:function(e,t){var r=m(t,f.timeouts.read),n=function(){return P(f,f.hosts.filter((function(e){return!!(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var s={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(s,(function(){return f.requestsCache.get(s,(function(){return f.requestsCache.set(s,n()).then((function(e){return Promise.all([f.requestsCache.delete(s),e])}),(function(e){return Promise.all([f.requestsCache.delete(s),Promise.reject(e)])})).then((function(e){var t=i(e,2);return t[0],t[1]}))}))}),{miss:function(e){return f.responsesCache.set(s,e)}})},write:function(e,t){return P(f,f.hosts.filter((function(e){return!!(e.accept&d.Write)})),e,m(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(u([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:s,appId:t,addAlgoliaAgent:function(e,t){s.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([s.requestsCache.clear(),s.responsesCache.clear()]).then((function(){}))}},e.methods)},A=function(e){return function(t,r){return t.method===F?e.transporter.read(t,r):e.transporter.write(t,r)}},N=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},T=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{params:E(e.params||{})})}));return e.transporter.read({method:b,path:"1/indexes/*/queries",data:{requests:i},cacheable:!0},n)}},H=function(e){return function(t,i){return Promise.all(t.map((function(t){var s=t.params,a=s.facetName,c=s.facetQuery,o=n(s,["facetName","facetQuery"]);return N(e)(t.indexName,{methods:{searchForFacetValues:I}}).searchForFacetValues(a,c,r(r({},i),o))})))}},Q=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},C=function(e){return function(t,r){return e.transporter.read({method:b,path:f("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},I=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},k=1,D=2,q=3,L=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:b,path:"1/indexes/*/recommendations",data:{requests:i},cacheable:!0},n)}};function V(e,t,n){var i,s={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,i=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},s=i(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=i(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(i=q,{debug:function(e,t){return k>=i&&console.debug(e,t),Promise.resolve()},info:function(e,t){return D>=i&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:o(),requestsCache:o({serializable:!1}),hostsCache:c({caches:[a({key:"".concat("4.23.3","-").concat(e)}),o()]}),userAgent:_("4.23.3").add({segment:"Browser",version:"lite"}),authMode:l.WithinQueryParameters};return S(r(r(r({},s),n),{},{methods:{search:T,searchForFacetValues:H,multipleQueries:T,multipleSearchForFacetValues:H,customRequest:A,initIndex:function(e){return function(t){return N(e)(t,{methods:{search:C,searchForFacetValues:I,findAnswers:Q}})}},getRecommendations:L}}))}return V.version="4.23.3",V}()},53465:(e,t,r)=>{"use strict";r.d(t,{W:()=>u});var n=r(96540),i=r(44586);const s=["zero","one","two","few","many","other"];function a(e){return s.filter((t=>e.includes(t)))}const c={locale:"en",pluralForms:a(["one","other"]),select:e=>1===e?"one":"other"};function o(){const{i18n:{currentLocale:e}}=(0,i.A)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:a(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),c}}),[e])}function u(){const e=o();return{selectMessage:(t,r)=>function(e,t,r){const n=e.split("|");if(1===n.length)return n[0];n.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const i=r.select(t),s=r.pluralForms.indexOf(i);return n[Math.min(s,n.length-1)]}(r,t,e)}}},74604:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>w});var n=r(96540),i=r(34164),s=r(74103),a=r.n(s),c=r(83643),o=r.n(c),u=r(38193),h=r(5260),f=r(28774),l=r(44070),m=r(53465),d=r(24255),p=r(89532),g=r(45500),v=r(20481),y=r(21312),R=r(44586),F=r(38126),b=r(51062),j=r(49641),P=r(51107);const _={searchQueryInput:"searchQueryInput_u2C7",searchVersionInput:"searchVersionInput_m0Ui",searchResultsColumn:"searchResultsColumn_JPFH",algoliaLogo:"algoliaLogo_rT1R",algoliaLogoPathFill:"algoliaLogoPathFill_WdUC",searchResultItem:"searchResultItem_Tv2o",searchResultItemHeading:"searchResultItemHeading_KbCB",searchResultItemPath:"searchResultItemPath_lhe1",searchResultItemSummary:"searchResultItemSummary_AEaO",searchQueryColumn:"searchQueryColumn_RTkw",searchVersionColumn:"searchVersionColumn_ypXd",searchLogoColumn:"searchLogoColumn_rJIA",loadingSpinner:"loadingSpinner_XVxU","loading-spin":"loading-spin_vzvp",loader:"loader_vvXV"};var x=r(74848);function E(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return(0,x.jsx)("div",{className:(0,i.A)("col","col--3","padding-left--none",_.searchVersionColumn),children:r.map((e=>{let[n,i]=e;const s=r.length>1?`${n}: `:"";return(0,x.jsx)("select",{onChange:e=>t.setSearchVersion(n,e.target.value),defaultValue:t.searchVersions[n],className:_.searchVersionInput,children:i.versions.map(((e,t)=>(0,x.jsx)("option",{label:`${s}${e.label}`,value:e.name},t)))},n)}))})}function O(){const{i18n:{currentLocale:e}}=(0,R.A)(),{algolia:{appId:t,apiKey:r,indexName:s}}=(0,F.c)(),c=(0,b.C)(),g=function(){const{selectMessage:e}=(0,m.W)();return t=>e(t,(0,y.T)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),O=function(){const e=(0,l.Gy)(),[t,r]=(0,n.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return{...e,[r]:n.versions[0].name}}),{}))),i=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:i,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),[w,S]=(0,d.b)(),A={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[N,T]=(0,n.useReducer)(((e,t)=>{switch(t.type){case"reset":return A;case"loading":return{...e,loading:!0};case"update":return w!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),A),H=o()(t,r),Q=a()(H,s,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:["language","docusaurus_tag"]});Q.on("result",(e=>{let{results:{query:t,hits:r,page:n,nbHits:i,nbPages:s}}=e;if(""===t||!Array.isArray(r))return void T({type:"reset"});const a=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),o=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:n={}}=e;const i=Object.keys(r).map((e=>a(r[e].value)));return{title:i.pop(),url:c(t),summary:n.content?`${a(n.content.value)}...`:"",breadcrumbs:i}}));T({type:"update",value:{items:o,query:t,totalResults:i,totalPages:s,lastPage:n,hasMore:s>n+1,loading:!1}})}));const[C,I]=(0,n.useState)(null),k=(0,n.useRef)(0),D=(0,n.useRef)(u.A.canUseIntersectionObserver&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&k.current>r&&T({type:"advance"}),k.current=r}),{threshold:1})),q=()=>w?(0,y.T)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:w}):(0,y.T)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),L=(0,p._q)((function(t){void 0===t&&(t=0),Q.addDisjunctiveFacetRefinement("docusaurus_tag","default"),Q.addDisjunctiveFacetRefinement("language",e),Object.entries(O.searchVersions).forEach((e=>{let[t,r]=e;Q.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)})),Q.setQuery(w).setPage(t).search()}));return(0,n.useEffect)((()=>{if(!C)return;const e=D.current;return e?(e.observe(C),()=>e.unobserve(C)):()=>!0}),[C]),(0,n.useEffect)((()=>{T({type:"reset"}),w&&(T({type:"loading"}),setTimeout((()=>{L()}),300))}),[w,O.searchVersions,L]),(0,n.useEffect)((()=>{N.lastPage&&0!==N.lastPage&&L(N.lastPage)}),[L,N.lastPage]),(0,x.jsxs)(j.A,{children:[(0,x.jsxs)(h.A,{children:[(0,x.jsx)("title",{children:(0,v.s)(q())}),(0,x.jsx)("meta",{property:"robots",content:"noindex, follow"})]}),(0,x.jsxs)("div",{className:"container margin-vert--lg",children:[(0,x.jsx)(P.A,{as:"h1",children:q()}),(0,x.jsxs)("form",{className:"row",onSubmit:e=>e.preventDefault(),children:[(0,x.jsx)("div",{className:(0,i.A)("col",_.searchQueryColumn,{"col--9":O.versioningEnabled,"col--12":!O.versioningEnabled}),children:(0,x.jsx)("input",{type:"search",name:"q",className:_.searchQueryInput,placeholder:(0,y.T)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,y.T)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>S(e.target.value),value:w,autoComplete:"off",autoFocus:!0})}),O.versioningEnabled&&(0,x.jsx)(E,{docsSearchVersionsHelpers:O})]}),(0,x.jsxs)("div",{className:"row",children:[(0,x.jsx)("div",{className:(0,i.A)("col","col--8",_.searchResultsColumn),children:!!N.totalResults&&g(N.totalResults)}),(0,x.jsx)("div",{className:(0,i.A)("col","col--4","text--right",_.searchLogoColumn),children:(0,x.jsx)(f.A,{to:"https://www.algolia.com/","aria-label":(0,y.T)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"}),children:(0,x.jsx)("svg",{viewBox:"0 0 168 24",className:_.algoliaLogo,children:(0,x.jsxs)("g",{fill:"none",children:[(0,x.jsx)("path",{className:_.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),(0,x.jsx)("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),(0,x.jsx)("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})]})})})})]}),N.items.length>0?(0,x.jsx)("main",{children:N.items.map(((e,t)=>{let{title:r,url:n,summary:s,breadcrumbs:a}=e;return(0,x.jsxs)("article",{className:_.searchResultItem,children:[(0,x.jsx)(P.A,{as:"h2",className:_.searchResultItemHeading,children:(0,x.jsx)(f.A,{to:n,dangerouslySetInnerHTML:{__html:r}})}),a.length>0&&(0,x.jsx)("nav",{"aria-label":"breadcrumbs",children:(0,x.jsx)("ul",{className:(0,i.A)("breadcrumbs",_.searchResultItemPath),children:a.map(((e,t)=>(0,x.jsx)("li",{className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}},t)))})}),s&&(0,x.jsx)("p",{className:_.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}})]},t)}))}):[w&&!N.loading&&(0,x.jsx)("p",{children:(0,x.jsx)(y.A,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result",children:"No results were found"})},"no-results"),!!N.loading&&(0,x.jsx)("div",{className:_.loadingSpinner},"spinner")],N.hasMore&&(0,x.jsx)("div",{className:_.loader,ref:I,children:(0,x.jsx)(y.A,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results",children:"Fetching new results..."})})]})]})}function w(){return(0,x.jsx)(g.e3,{className:"search-page-wrapper",children:(0,x.jsx)(O,{})})}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.02d466ff.js.LICENSE.txt b/assets/js/1a4e3797.02d466ff.js.LICENSE.txt new file mode 100644 index 000000000..92dc1757f --- /dev/null +++ b/assets/js/1a4e3797.02d466ff.js.LICENSE.txt @@ -0,0 +1 @@ +/*! algoliasearch-lite.umd.js | 4.23.3 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ diff --git a/assets/js/1a4e3797.ad4bdf33.js b/assets/js/1a4e3797.ad4bdf33.js deleted file mode 100644 index 956d947bb..000000000 --- a/assets/js/1a4e3797.ad4bdf33.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 1a4e3797.ad4bdf33.js.LICENSE.txt */ -(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[62138],{72733:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,s,a,c,u,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i(s=this._events[e]))return!1;if(r(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),s.apply(this,c)}else if(n(s))for(c=Array.prototype.slice.call(arguments,1),a=(o=s.slice()).length,u=0;u0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,s,a,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(i=this._events[e]).length,s=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(c=a;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){s=c;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},74103:(e,t,r)=>{"use strict";var n=r(36571),i=r(33371),s=r(67691);function a(e,t,r,i){return new n(e,t,r,i)}a.version=r(16938),a.AlgoliaSearchHelper=n,a.SearchParameters=i,a.SearchResults=s,e.exports=a},46732:(e,t,r)=>{"use strict";var n=r(72733);function i(e,t){this.main=e,this.fn=t,this.lastResults=null}r(73014)(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},e.exports=i},44054:(e,t,r)=>{"use strict";var n=r(29110),i=r(40317),s=r(21383),a={addRefinement:function(e,t,r){if(a.isRefined(e,t,r))return e;var i=""+r,s=e[t]?e[t].concat(i):[i],c={};return c[t]=s,n({},c,e)},removeRefinement:function(e,t,r){if(void 0===r)return a.clearRefinement(e,(function(e,r){return t===r}));var n=""+r;return a.clearRefinement(e,(function(e,r){return t===r&&n===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,r)?a.removeRefinement(e,t,r):a.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return i(e)?{}:e;if("string"==typeof t)return s(e,[t]);if("function"==typeof t){var n=!1,a=Object.keys(e).reduce((function(i,s){var a=e[s]||[],c=a.filter((function(e){return!t(e,s,r)}));return c.length!==a.length&&(n=!0),i[s]=c,i}),{});return n?a:e}},isRefined:function(e,t,r){var n=Boolean(e[t])&&e[t].length>0;if(void 0===r||!n)return n;var i=""+r;return-1!==e[t].indexOf(i)}};e.exports=a},33371:(e,t,r)=>{"use strict";var n=r(29110),i=r(20849),s=r(14843),a=r(44728),c=r(40317),u=r(21383),o=r(17507),h=r(72208),f=r(44054);function l(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return l(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var n=-1!==m.PARAMETERS.indexOf(e),i=void 0!==t[e];!n&&i&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var n=e[r];if("string"==typeof n){var i=parseFloat(n);t[r]=isNaN(i)?n:i}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach((function(e){var i=n[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=i}))})),t.numericRefinements=r}return a(e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&c(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):c(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:f.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:f.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:f.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:f.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var n=o(r);if(this.isNumericRefined(e,t,n))return this;var i=a({},this.numericRefinements);return i[e]=a({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(n)):i[e][t]=[n],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var n=r;return void 0!==n?this.isNumericRefined(e,t,n)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t&&l(r.val,o(n))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return c(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return u(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,n=Object.keys(r).reduce((function(n,i){var s=r[i],a={};return s=s||{},Object.keys(s).forEach((function(r){var n=s[r]||[],c=[];n.forEach((function(t){e({val:t,op:r},i,"numeric")||c.push(t)})),c.length!==n.length&&(t=!0),a[r]=c})),n[i]=a,n}),{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:f.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:f.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:f.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:f.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:f.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:f.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:f.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:f.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:f.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),i={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?i[e]=[]:i[e]=[t.slice(0,t.lastIndexOf(r))]:i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},i,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&f.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!n)return n;var s,a,c=o(r),u=void 0!==(s=this.numericRefinements[e][t],a=c,i(s,(function(e){return l(e,a)})));return n&&u},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=s(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return s(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0}))).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(n){var i=r[n];-1===e.indexOf(n)&&void 0!==i&&(t[n]=i)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,n=m._parseNumbers(e),i=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),s=Object.keys(n).reduce((function(e,t){var r=void 0!==e[t],i=void 0!==n[t];return r&&!i?u(e,[t]):(i&&(e[t]=n[t]),e)}),i);return new this.constructor(s)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return i(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},76673:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var n=e.hierarchicalFacets[r],o=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",h=e._getHierarchicalFacetSeparator(n),f=e._getHierarchicalRootPath(n),l=e._getHierarchicalShowParentLevel(n),m=s(e._getHierarchicalFacetSortBy(n)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,n,s){return function(o,h,f){var l=o;if(f>0){var m=0;for(l=o;m {"use strict";var n=r(78965),i=r(29110),s=r(2909),a=r(20849),c=r(43917),u=r(7577),o=r(44728),h=r(38601),f=s.escapeFacetValue,l=s.unescapeFacetValue,m=r(76673);function d(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function p(e,t,r){t&&t[r]&&(e.stats=t[r])}function v(e,t,r){var s=t[0];this._rawResults=t;var u=this;Object.keys(s).forEach((function(e){u[e]=s[e]}));var h=o({persistHierarchicalRootCount:!1},r);Object.keys(h).forEach((function(e){u[e]=h[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var f=e.getRefinedDisjunctiveFacets(),v=d(e.facets),g=d(e.disjunctiveFacets),y=1,R=s.facets||{};Object.keys(R).forEach((function(t){var r,n,i=R[t],o=(r=e.hierarchicalFacets,n=t,a(r,(function(e){return(e.attributes||[]).indexOf(n)>-1})));if(o){var h=o.attributes.indexOf(t),f=c(e.hierarchicalFacets,(function(e){return e.name===o.name}));u.hierarchicalFacets[f][h]={attribute:t,data:i,exhaustive:s.exhaustiveFacetsCount}}else{var l,m=-1!==e.disjunctiveFacets.indexOf(t),d=-1!==e.facets.indexOf(t);m&&(l=g[t],u.disjunctiveFacets[l]={name:t,data:i,exhaustive:s.exhaustiveFacetsCount},p(u.disjunctiveFacets[l],s.facets_stats,t)),d&&(l=v[t],u.facets[l]={name:t,data:i,exhaustive:s.exhaustiveFacetsCount},p(u.facets[l],s.facets_stats,t))}})),this.hierarchicalFacets=n(this.hierarchicalFacets),f.forEach((function(r){var n=t[y],a=n&&n.facets?n.facets:{},h=e.getHierarchicalFacetByName(r);Object.keys(a).forEach((function(t){var r,f=a[t];if(h){r=c(e.hierarchicalFacets,(function(e){return e.name===h.name}));var m=c(u.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===m)return;u.hierarchicalFacets[r][m].data=o({},u.hierarchicalFacets[r][m].data,f)}else{r=g[t];var d=s.facets&&s.facets[t]||{};u.disjunctiveFacets[r]={name:t,data:i({},f,d),exhaustive:n.exhaustiveFacetsCount},p(u.disjunctiveFacets[r],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(n){!u.disjunctiveFacets[r].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(l(n))>-1&&(u.disjunctiveFacets[r].data[n]=0)}))}})),y++})),e.getRefinedHierarchicalFacets().forEach((function(r){var n=e.getHierarchicalFacetByName(r),s=e._getHierarchicalFacetSeparator(n),a=e.getHierarchicalRefinement(r);0===a.length||a[0].split(s).length<2||t.slice(y).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var o=r[t],h=c(e.hierarchicalFacets,(function(e){return e.name===n.name})),f=c(u.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==f){var l={};if(a.length>0&&!u.persistHierarchicalRootCount){var m=a[0].split(s)[0];l[m]=u.hierarchicalFacets[h][f].data[m]}u.hierarchicalFacets[h][f].data=i(l,o,u.hierarchicalFacets[h][f].data)}})),y++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],n=v[t];u.facets[n]={name:t,data:R[t],exhaustive:s.exhaustiveFacetsCount},r.forEach((function(e){u.facets[n]=u.facets[n]||{name:t},u.facets[n].data=u.facets[n].data||{},u.facets[n].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(m(e)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=e}function g(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=a(e.facets,r);return n?Object.keys(n.data).map((function(r){var i=f(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var i=a(e.disjunctiveFacets,r);return i?Object.keys(i.data).map((function(r){var n=f(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}})):[]}if(e._state.isHierarchicalFacet(t)){var s=a(e.hierarchicalFacets,r);if(!s)return s;var c=e._state.getHierarchicalFacetByName(t),u=e._state._getHierarchicalFacetSeparator(c),o=l(e._state.getHierarchicalRefinement(t)[0]||"");0===o.indexOf(c.rootPath)&&(o=o.replace(c.rootPath+u,""));var h=o.split(u);return h.unshift(t),y(s,h,0),s}}function y(e,t,r){e.isRefined=e.name===(t[r]&&t[r].trim()),e.data&&e.data.forEach((function(e){y(e,t,r+1)}))}function R(e,t,r,n){if(n=n||0,Array.isArray(t))return e(t,r[n]);if(!t.data||0===t.data.length)return t;var s=t.data.map((function(t){return R(e,t,r,n+1)})),a=e(s,r[n]);return i({data:a},t)}function F(e,t){var r=a(e,(function(e){return e.name===t}));return r&&r.stats}function b(e,t,r,n,i){var s=a(i,(function(e){return e.name===r})),c=s&&s.data&&s.data[n]?s.data[n]:0,u=s&&s.exhaustive||!1;return{type:t,attributeName:r,name:n,count:c,exhaustive:u}}v.prototype.getFacetByName=function(e){function t(t){return t.name===e}return a(this.facets,t)||a(this.disjunctiveFacets,t)||a(this.hierarchicalFacets,t)},v.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],v.prototype.getFacetValues=function(e,t){var r=g(this,e);if(r){var n,s=i({},t,{sortBy:v.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),a=this;if(Array.isArray(r))n=[e];else n=a._state.getHierarchicalFacetByName(r.name).attributes;return R((function(e,t){if(s.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(a,t);if(r)return function(e,t){var r=[],n=[],i=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name;void 0!==i[t]?r[i[t]]=e:n.push(e)})),r=r.filter((function(e){return e}));var s,a=t.sortRemainingBy;return"hidden"===a?r:(s="alpha"===a?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(h(n,s[0],s[1])))}(e,r)}if(Array.isArray(s.sortBy)){var n=u(s.sortBy,v.DEFAULT_SORT);return h(e,n[0],n[1])}if("function"==typeof s.sortBy)return function(e,t){return t.sort(e)}(s.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,n)}},v.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?F(this.facets,e):this._state.isDisjunctiveFacet(e)?F(this.disjunctiveFacets,e):void 0},v.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(n){e.facetsRefinements[n].forEach((function(i){r.push(b(e,"facet",n,i,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(n){e.facetsExcludes[n].forEach((function(i){r.push(b(e,"exclude",n,i,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(n){e.disjunctiveFacetsRefinements[n].forEach((function(i){r.push(b(e,"disjunctive",n,i,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(n){e.hierarchicalFacetsRefinements[n].forEach((function(i){r.push(function(e,t,r,n){var i=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(i),c=r.split(s),u=a(n,(function(e){return e.name===t})),o=c.reduce((function(e,t){var r=e&&a(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),u),h=o&&o.count||0,f=o&&o.exhaustive||!1,l=o&&o.path||"";return{type:"hierarchical",attributeName:t,name:l,count:h,exhaustive:f}}(e,n,i,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t];Object.keys(n).forEach((function(e){n[e].forEach((function(n){r.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=v},36571:(e,t,r)=>{"use strict";var n=r(72733),i=r(46732),s=r(2909).escapeFacetValue,a=r(73014),c=r(44728),u=r(40317),o=r(21383),h=r(49228),f=r(33371),l=r(67691),m=r(16938);function d(e,t,r,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+m+")"),this.setClient(e);var i=r||{};i.index=t,this.state=f.make(i),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._searchResultsOptions=n}function p(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function v(){return this.state.page}a(d,n),d.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},d.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},d.prototype.getQuery=function(){var e=this.state;return h._getHitsSearchParams(e)},d.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,n=h._getQueries(r.index,r),i=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(n).then((function(e){return i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),{content:new l(r,e.results),state:r,_originalResponse:e}}),(function(e){throw i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),e}));this.client.search(n).then((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(null,new l(r,e.results),r)})).catch((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(e,null,r)}))},d.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var n=r.getModifiedState(t),i=c({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:o(h._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,i)},d.prototype.searchForFacetValues=function(e,t,r,n){var i="function"==typeof this.client.searchForFacetValues,a="function"==typeof this.client.initIndex;if(!i&&!a&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(n||{}),u=c.isDisjunctiveFacet(e),o=h.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var f,l=this;return i?f=this.client.searchForFacetValues([{indexName:c.index,params:o}]):a?f=this.client.initIndex(c.index).searchForFacetValues(o):(delete o.facetName,f=this.client.search([{type:"facet",facet:e,indexName:c.index,params:o}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),f.then((function(t){return l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=s(t.value),t.isRefined=u?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),e}))},d.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},d.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},d.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},d.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},d.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},d.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},d.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},d.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},d.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},d.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},d.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},d.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},d.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},d.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},d.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},d.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},d.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},d.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},d.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},d.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},d.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},d.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},d.prototype.setCurrentPage=p,d.prototype.setPage=p,d.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},d.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},d.prototype.setState=function(e){return this._change({state:f.make(e),isPageReset:!1}),this},d.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new f(e),this},d.prototype.hasRefinements=function(e){return!!u(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},d.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},d.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},d.prototype.hasTag=function(e){return this.state.isTagRefined(e)},d.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},d.prototype.getIndex=function(){return this.state.index},d.prototype.getCurrentPage=v,d.prototype.getPage=v,d.prototype.getTags=function(){return this.state.tagRefinements},d.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var n=r[e];t.push({value:n,operator:e,type:"numeric"})})),t},d.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},d.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},d.prototype._search=function(e){var t=this.state,r=[],n=[];e.onlyWithDerivedHelpers||(n=h._getQueries(t.index,t),r.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var i=this.derivedHelpers.map((function(e){var n=e.getModifiedState(t),i=n.index?h._getQueries(n.index,n):[];return r.push({state:n,queriesCount:i.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),i})),s=Array.prototype.concat.apply(n,i),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,r,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(c){this.emit("error",{error:c})}},d.prototype._dispatchAlgoliaResponse=function(e,t,r){var n=this;if(!(t 0},d.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},d.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},d.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+m+")"),this.client=e),this},d.prototype.getClient=function(){return this.client},d.prototype.derive=function(e){var t=new i(this,e);return this.derivedHelpers.push(t),t},d.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},d.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=d},78965:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},29110:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},2909:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},20849:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r {"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r {"use strict";var n=r(20849);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var i=t.split(":"),s=n(r,(function(e){return e[0]===i[0]}));return i.length>1||!s?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)}),[[],[]])}},73014:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},14843:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,n){return t.indexOf(r)>-1&&e.indexOf(r)===n}))}},44728:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,n){if(e===n)return e;for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"__proto__"!==i&&"constructor"!==i){var s=n[i],a=e[i];void 0!==a&&void 0===s||(t(a)&&t(s)?e[i]=r(a,s):e[i]="object"==typeof(c=s)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var n=1,i=arguments.length;n{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},21383:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n =0||(i[r]=e[r]);return i}},38601:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=void 0!==t,s=null===t;if(!s&&e>t||n&&i||!r)return 1;if(!n&&e =n.length?s:"desc"===n[i]?-s:s}return e.index-r.index})),i.map((function(e){return e.value}))}},17507:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},49228:(e,t,r)=>{"use strict";var n=r(44728);function i(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})}var s={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(n){r.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})})),t.getRefinedHierarchicalFacets().forEach((function(n){var i=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(i);if(a.length>0&&a[0].split(c).length>1){var u=a[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:i.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);u.forEach((function(n,a){var c=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a);function o(e){return i.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!o(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||o(t)||e.push(t),e}),[]),f=u[a-1];c.facetFilters=a>0?h.concat(f.attribute+":"+f.value):h.length>0?h:void 0,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)).sort(),r=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),u={facets:t.indexOf("*")>-1?["*"]:t,tagFilters:c};return r.length>0&&(u.facetFilters=r),a.length>0&&(u.numericFilters=a),i(n({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,r){var a=s._getFacetFilters(e,t,r),c=s._getNumericFilters(e,t),u=s._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var h=e.getHierarchicalFacetByName(t);return o.facets=h?s._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(o.numericFilters=c),a.length>0&&(o.facetFilters=a),i(n({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(n){var i=e.numericRefinements[n]||{};Object.keys(i).forEach((function(e){var s=i[e]||[];t!==n&&s.forEach((function(t){if(Array.isArray(t)){var i=t.map((function(t){return n+e+t}));r.push(i)}else r.push(n+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var n=[],i=e.facetsRefinements||{};Object.keys(i).sort().forEach((function(e){(i[e]||[]).slice().sort().forEach((function(t){n.push(e+":"+t)}))}));var s=e.facetsExcludes||{};Object.keys(s).sort().forEach((function(e){(s[e]||[]).sort().forEach((function(t){n.push(e+":-"+t)}))}));var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).sort().forEach((function(e){var r=a[e]||[];if(e!==t&&r&&0!==r.length){var i=[];r.slice().sort().forEach((function(t){i.push(e+":"+t)})),n.push(i)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach((function(i){var s=(c[i]||[])[0];if(void 0!==s){var a,u,o=e.getHierarchicalFacetByName(i),h=e._getHierarchicalFacetSeparator(o),f=e._getHierarchicalRootPath(o);if(t===i){if(-1===s.indexOf(h)||!f&&!0===r||f&&f.split(h).length===s.split(h).length)return;f?(u=f.split(h).length-1,s=f):(u=s.split(h).length-2,s=s.slice(0,s.lastIndexOf(h))),a=o.attributes[u]}else u=s.split(h).length-1,a=o.attributes[u];a&&n.push([a+":"+s])}})),n},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var n=e.getHierarchicalRefinement(r.name)[0];if(!n)return t.push(r.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(r),s=n.split(i).length,a=r.attributes.slice(0,s+1);return t.concat(a)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var n=e._getHierarchicalFacetSeparator(t);if(!0===r){var i=e._getHierarchicalRootPath(t),s=0;return i&&(s=i.split(n).length),[t.attributes[s]]}var a=(e.getHierarchicalRefinement(t.name)[0]||"").split(n).length-1;return t.attributes.slice(0,a+1)},getSearchForFacetQuery:function(e,t,r,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,u={facetQuery:t,facetName:e};return"number"==typeof r&&(u.maxFacetHits=r),i(n({},s._getHitsSearchParams(c),u))}};e.exports=s},72208:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},16938:e=>{"use strict";e.exports="3.16.3"},83643:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n =0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n =0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,s=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,s=e}finally{try{n||null==c.return||c.return()}finally{if(i)throw s}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t 2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){c();var t=JSON.stringify(e);return s()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],s=t[1];return Promise.all([n,s||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var i=s();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(i)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=s();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=s(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,i).catch((function(){return c({caches:t}).get(e,n,i)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);var a=n(),c=i&&i.miss||function(){return Promise.resolve()};return a.then((function(e){return c(e)})).then((function(){return a}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function o(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function f(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n 0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,v=2,g=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function R(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var F="GET",b="POST";function j(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===g&&Date.now()-e.lastUpdate<=12e4}(e)})),i=[].concat(s(r),s(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:i.length>0?i.map((function(e){return R(e)})):t}}))}function P(e,t,n,i){var a=[],c=function(e,t){if(e.method!==F&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,i),u=function(e,t){var n=r(r({},e.headers),t.headers),i={};return Object.keys(n).forEach((function(e){var t=n[e];i[e.toLowerCase()]=t})),i}(e,i),o=n.method,h=n.method!==F?{}:r(r({},n.data),i.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),h),i.queryParameters),l=0,m=function t(r,s){var h=r.pop();if(void 0===h)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:O(a)};var m={data:c,headers:u,method:o,url:_(h,n.path,f),connectTimeout:s(l,e.timeouts.connect),responseTimeout:s(l,i.timeout)},d=function(e){var t={request:m,response:e,host:h,triesLeft:r.length};return a.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var i=d(n);return n.isTimedOut&&l++,Promise.all([e.logger.info("Retryable failure",w(i)),e.hostsCache.set(h,y(h,n.isTimedOut?g:v))]).then((function(){return t(r,s)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,i=r;try{i=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(i,n,t)}(e,O(a))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&!~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return j(e.hostsCache,t).then((function(e){return m(s(e.statelessHosts).reverse(),e.getTimeout)}))}function x(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function _(e,t,r){var n=E(r),i="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(i+="?".concat(n)),i}function E(e){return Object.keys(e).map((function(t){return f("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function O(e){return e.map((function(e){return w(e)}))}function w(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var A=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===l.WithinHeaders?n:{}},queryParameters:function(){return e===l.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:l.WithinHeaders,t,e.apiKey),s=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,s=e.requestsCache,a=e.responsesCache,c=e.timeouts,u=e.userAgent,o=e.hosts,h=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:s,responsesCache:a,timeouts:c,userAgent:u,headers:e.headers,queryParameters:h,hosts:o.map((function(e){return R(e)})),read:function(e,t){var r=m(t,f.timeouts.read),n=function(){return P(f,f.hosts.filter((function(e){return!!(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var s={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(s,(function(){return f.requestsCache.get(s,(function(){return f.requestsCache.set(s,n()).then((function(e){return Promise.all([f.requestsCache.delete(s),e])}),(function(e){return Promise.all([f.requestsCache.delete(s),Promise.reject(e)])})).then((function(e){var t=i(e,2);return t[0],t[1]}))}))}),{miss:function(e){return f.responsesCache.set(s,e)}})},write:function(e,t){return P(f,f.hosts.filter((function(e){return!!(e.accept&d.Write)})),e,m(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(o([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:s,appId:t,addAlgoliaAgent:function(e,t){s.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([s.requestsCache.clear(),s.responsesCache.clear()]).then((function(){}))}},e.methods)},N=function(e){return function(t,r){return t.method===F?e.transporter.read(t,r):e.transporter.write(t,r)}},H=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},S=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{params:E(e.params||{})})}));return e.transporter.read({method:b,path:"1/indexes/*/queries",data:{requests:i},cacheable:!0},n)}},T=function(e){return function(t,i){return Promise.all(t.map((function(t){var s=t.params,a=s.facetName,c=s.facetQuery,u=n(s,["facetName","facetQuery"]);return H(e)(t.indexName,{methods:{searchForFacetValues:D}}).searchForFacetValues(a,c,r(r({},i),u))})))}},Q=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},C=function(e){return function(t,r){return e.transporter.read({method:b,path:f("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},D=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},I=1,k=2,q=3;function V(e,t,n){var i,s={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,i=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},s=i(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=i(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(i=q,{debug:function(e,t){return I>=i&&console.debug(e,t),Promise.resolve()},info:function(e,t){return k>=i&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:c({caches:[a({key:"".concat("4.22.1","-").concat(e)}),u()]}),userAgent:x("4.22.1").add({segment:"Browser",version:"lite"}),authMode:l.WithinQueryParameters};return A(r(r(r({},s),n),{},{methods:{search:S,searchForFacetValues:T,multipleQueries:S,multipleSearchForFacetValues:T,customRequest:N,initIndex:function(e){return function(t){return H(e)(t,{methods:{search:C,searchForFacetValues:D,findAnswers:Q}})}}}}))}return V.version="4.22.1",V}()},53465:(e,t,r)=>{"use strict";r.d(t,{W:()=>o});var n=r(96540),i=r(44586);const s=["zero","one","two","few","many","other"];function a(e){return s.filter((t=>e.includes(t)))}const c={locale:"en",pluralForms:a(["one","other"]),select:e=>1===e?"one":"other"};function u(){const{i18n:{currentLocale:e}}=(0,i.A)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:a(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),c}}),[e])}function o(){const e=u();return{selectMessage:(t,r)=>function(e,t,r){const n=e.split("|");if(1===n.length)return n[0];n.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const i=r.select(t),s=r.pluralForms.indexOf(i);return n[Math.min(s,n.length-1)]}(r,t,e)}}},74604:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>w});var n=r(96540),i=r(34164),s=r(74103),a=r.n(s),c=r(83643),u=r.n(c),o=r(38193),h=r(5260),f=r(28774),l=r(44070),m=r(53465),d=r(24255),p=r(89532),v=r(69024),g=r(20481),y=r(21312),R=r(44586),F=r(38126),b=r(51062),j=r(49641),P=r(51107);const x={searchQueryInput:"searchQueryInput_u2C7",searchVersionInput:"searchVersionInput_m0Ui",searchResultsColumn:"searchResultsColumn_JPFH",algoliaLogo:"algoliaLogo_rT1R",algoliaLogoPathFill:"algoliaLogoPathFill_WdUC",searchResultItem:"searchResultItem_Tv2o",searchResultItemHeading:"searchResultItemHeading_KbCB",searchResultItemPath:"searchResultItemPath_lhe1",searchResultItemSummary:"searchResultItemSummary_AEaO",searchQueryColumn:"searchQueryColumn_RTkw",searchVersionColumn:"searchVersionColumn_ypXd",searchLogoColumn:"searchLogoColumn_rJIA",loadingSpinner:"loadingSpinner_XVxU","loading-spin":"loading-spin_vzvp",loader:"loader_vvXV"};var _=r(74848);function E(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return(0,_.jsx)("div",{className:(0,i.A)("col","col--3","padding-left--none",x.searchVersionColumn),children:r.map((e=>{let[n,i]=e;const s=r.length>1?`${n}: `:"";return(0,_.jsx)("select",{onChange:e=>t.setSearchVersion(n,e.target.value),defaultValue:t.searchVersions[n],className:x.searchVersionInput,children:i.versions.map(((e,t)=>(0,_.jsx)("option",{label:`${s}${e.label}`,value:e.name},t)))},n)}))})}function O(){const{i18n:{currentLocale:e}}=(0,R.A)(),{algolia:{appId:t,apiKey:r,indexName:s}}=(0,F.c)(),c=(0,b.C)(),v=function(){const{selectMessage:e}=(0,m.W)();return t=>e(t,(0,y.T)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),O=function(){const e=(0,l.Gy)(),[t,r]=(0,n.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return{...e,[r]:n.versions[0].name}}),{}))),i=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:i,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),[w,A]=(0,d.b)(),N={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[H,S]=(0,n.useReducer)(((e,t)=>{switch(t.type){case"reset":return N;case"loading":return{...e,loading:!0};case"update":return w!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),N),T=u()(t,r),Q=a()(T,s,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:["language","docusaurus_tag"]});Q.on("result",(e=>{let{results:{query:t,hits:r,page:n,nbHits:i,nbPages:s}}=e;if(""===t||!Array.isArray(r))return void S({type:"reset"});const a=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),u=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:n={}}=e;const i=Object.keys(r).map((e=>a(r[e].value)));return{title:i.pop(),url:c(t),summary:n.content?`${a(n.content.value)}...`:"",breadcrumbs:i}}));S({type:"update",value:{items:u,query:t,totalResults:i,totalPages:s,lastPage:n,hasMore:s>n+1,loading:!1}})}));const[C,D]=(0,n.useState)(null),I=(0,n.useRef)(0),k=(0,n.useRef)(o.A.canUseIntersectionObserver&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&I.current>r&&S({type:"advance"}),I.current=r}),{threshold:1})),q=()=>w?(0,y.T)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:w}):(0,y.T)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),V=(0,p._q)((function(t){void 0===t&&(t=0),Q.addDisjunctiveFacetRefinement("docusaurus_tag","default"),Q.addDisjunctiveFacetRefinement("language",e),Object.entries(O.searchVersions).forEach((e=>{let[t,r]=e;Q.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)})),Q.setQuery(w).setPage(t).search()}));return(0,n.useEffect)((()=>{if(!C)return;const e=k.current;return e?(e.observe(C),()=>e.unobserve(C)):()=>!0}),[C]),(0,n.useEffect)((()=>{S({type:"reset"}),w&&(S({type:"loading"}),setTimeout((()=>{V()}),300))}),[w,O.searchVersions,V]),(0,n.useEffect)((()=>{H.lastPage&&0!==H.lastPage&&V(H.lastPage)}),[V,H.lastPage]),(0,_.jsxs)(j.A,{children:[(0,_.jsxs)(h.A,{children:[(0,_.jsx)("title",{children:(0,g.s)(q())}),(0,_.jsx)("meta",{property:"robots",content:"noindex, follow"})]}),(0,_.jsxs)("div",{className:"container margin-vert--lg",children:[(0,_.jsx)(P.A,{as:"h1",children:q()}),(0,_.jsxs)("form",{className:"row",onSubmit:e=>e.preventDefault(),children:[(0,_.jsx)("div",{className:(0,i.A)("col",x.searchQueryColumn,{"col--9":O.versioningEnabled,"col--12":!O.versioningEnabled}),children:(0,_.jsx)("input",{type:"search",name:"q",className:x.searchQueryInput,placeholder:(0,y.T)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,y.T)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>A(e.target.value),value:w,autoComplete:"off",autoFocus:!0})}),O.versioningEnabled&&(0,_.jsx)(E,{docsSearchVersionsHelpers:O})]}),(0,_.jsxs)("div",{className:"row",children:[(0,_.jsx)("div",{className:(0,i.A)("col","col--8",x.searchResultsColumn),children:!!H.totalResults&&v(H.totalResults)}),(0,_.jsx)("div",{className:(0,i.A)("col","col--4","text--right",x.searchLogoColumn),children:(0,_.jsx)(f.A,{to:"https://www.algolia.com/","aria-label":(0,y.T)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"}),children:(0,_.jsx)("svg",{viewBox:"0 0 168 24",className:x.algoliaLogo,children:(0,_.jsxs)("g",{fill:"none",children:[(0,_.jsx)("path",{className:x.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),(0,_.jsx)("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),(0,_.jsx)("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})]})})})})]}),H.items.length>0?(0,_.jsx)("main",{children:H.items.map(((e,t)=>{let{title:r,url:n,summary:s,breadcrumbs:a}=e;return(0,_.jsxs)("article",{className:x.searchResultItem,children:[(0,_.jsx)(P.A,{as:"h2",className:x.searchResultItemHeading,children:(0,_.jsx)(f.A,{to:n,dangerouslySetInnerHTML:{__html:r}})}),a.length>0&&(0,_.jsx)("nav",{"aria-label":"breadcrumbs",children:(0,_.jsx)("ul",{className:(0,i.A)("breadcrumbs",x.searchResultItemPath),children:a.map(((e,t)=>(0,_.jsx)("li",{className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}},t)))})}),s&&(0,_.jsx)("p",{className:x.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}})]},t)}))}):[w&&!H.loading&&(0,_.jsx)("p",{children:(0,_.jsx)(y.A,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result",children:"No results were found"})},"no-results"),!!H.loading&&(0,_.jsx)("div",{className:x.loadingSpinner},"spinner")],H.hasMore&&(0,_.jsx)("div",{className:x.loader,ref:D,children:(0,_.jsx)(y.A,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results",children:"Fetching new results..."})})]})]})}function w(){return(0,_.jsx)(v.e3,{className:"search-page-wrapper",children:(0,_.jsx)(O,{})})}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.ad4bdf33.js.LICENSE.txt b/assets/js/1a4e3797.ad4bdf33.js.LICENSE.txt deleted file mode 100644 index 9caab8b19..000000000 --- a/assets/js/1a4e3797.ad4bdf33.js.LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -/*! algoliasearch-lite.umd.js | 4.22.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ diff --git a/assets/js/1ead2ae5.c7cf0a94.js b/assets/js/1ead2ae5.c7cf0a94.js new file mode 100644 index 000000000..3c797579f --- /dev/null +++ b/assets/js/1ead2ae5.c7cf0a94.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[61315],{26710:t=>{t.exports=JSON.parse('{"tag":{"label":"block","permalink":"/blog/tags/block","allTagsPath":"/blog/tags","count":2,"unlisted":false},"listMetadata":{"permalink":"/blog/tags/block","page":1,"postsPerPage":9,"totalPages":1,"totalCount":2,"blogDescription":"Tutorials and articles about Eightshift development kit","blogTitle":"Tutorials and articles about Eightshift development kit"}}')}}]); \ No newline at end of file diff --git a/assets/js/2067e39b.8048a327.js b/assets/js/2067e39b.8048a327.js deleted file mode 100644 index 3ee9d541d..000000000 --- a/assets/js/2067e39b.8048a327.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[28801],{61733:t=>{t.exports=JSON.parse('{"permalink":"/blog/tags/taxonomy","page":1,"postsPerPage":9,"totalPages":1,"totalCount":1,"blogDescription":"Tutorials and articles about Eightshift development kit","blogTitle":"Tutorials and articles about Eightshift development kit"}')}}]); \ No newline at end of file diff --git a/assets/js/2176bd9e.c5f85e4e.js b/assets/js/2176bd9e.c5f85e4e.js deleted file mode 100644 index edce2d794..000000000 --- a/assets/js/2176bd9e.c5f85e4e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[66131],{27058:t=>{t.exports=JSON.parse('{"permalink":"/blog/tags/fonts","page":1,"postsPerPage":9,"totalPages":1,"totalCount":1,"blogDescription":"Tutorials and articles about Eightshift development kit","blogTitle":"Tutorials and articles about Eightshift development kit"}')}}]); \ No newline at end of file diff --git a/assets/js/23271.4b6b167e.js b/assets/js/23271.4b6b167e.js new file mode 100644 index 000000000..c25d3eefd --- /dev/null +++ b/assets/js/23271.4b6b167e.js @@ -0,0 +1,8 @@ +/*! For license information please see 23271.4b6b167e.js.LICENSE.txt */ +"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[23271],{23271:(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{QH:()=>startPlaygroundWeb,XT:()=>installTheme,gT:()=>wpCLI$1});var vt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},se=(e,t,r)=>(vt(e,t,"read from private field"),r?r.call(e):t.get(e)),ee=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},fe=(e,t,r,n)=>(vt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ae=(e,t,r)=>(vt(e,t,"access private method"),r);const currentJsRuntime=typeof process<"u"&&"node"===(null==(e=process.release)?void 0:e.name)?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE";var e;if("NODE"===currentJsRuntime){let e=function(e){return new Promise((function(t,r){e.onload=e.onerror=function(n){e.onload=e.onerror=null,"load"===n.type?t(e.result):r(new Error("Failed to read the blob/file"))}}))},t=function(){const e=new Uint8Array([1,2,3,4]),t=new File([e],"test").stream();try{return t.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class e extends Blob{constructor(e,t,r){let n;super(e),null!=r&&r.lastModified&&(n=new Date),(!n||isNaN(n.getFullYear()))&&(n=new Date),this.lastModifiedDate=n,this.lastModified=n.getMilliseconds(),this.name=t||""}}global.File=e}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const t=new FileReader;return t.readAsArrayBuffer(this),e(t)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const t=new FileReader;return t.readAsText(this),e(t)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let e=0;const t=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:524288,async pull(r){const n=r.byobRequest.view,o=await t.slice(e,e+n.byteLength).arrayBuffer(),s=new Uint8Array(o);new Uint8Array(n.buffer).set(s);const i=s.byteLength;r.byobRequest.respond(i),e+=i,e>=t.size&&r.close()}})})}if("NODE"===currentJsRuntime&&typeof CustomEvent>"u"){class e extends Event{constructor(e,t={}){super(e,t),this.detail=t.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const wpContentFilesExcludedFromExport=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"],SleepFinished=Symbol("SleepFinished");function sleep(e){return new Promise((t=>{setTimeout((()=>t(SleepFinished)),e)}))}class AcquireTimeoutError extends Error{constructor(){super("Acquiring lock timed out")}}class Semaphore{constructor({concurrency:e,timeout:t}){this._running=0,this.concurrency=e,this.timeout=t,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;){if(!(this._running>=this.concurrency)){this._running++;let e=!1;return()=>{e||(e=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}{const e=new Promise((e=>{this.queue.push(e)}));void 0!==this.timeout?await Promise.race([e,sleep(this.timeout)]).then((e=>{if(e===SleepFinished)throw new AcquireTimeoutError})):await e}}}async run(e){const t=await this.acquire();try{return await e()}finally{t()}}}function joinPaths(...e){let t=e.join("/");const r="/"===t[0],n="/"===t.substring(t.length-1);return t=normalizePath(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function dirname(e){if("/"===e)return"/";const t=(e=normalizePath(e)).lastIndexOf("/");return-1===t?"":0===t?"/":e.substr(0,t)}function normalizePath(e){const t="/"===e[0];return(t?"/":"")+(e=normalizePathsArray(e.split("/").filter((e=>!!e)),!t).join("/")).replace(/\/$/,"")}function normalizePathsArray(e,t){let r=0;for(let n=e.length-1;n>=0;n--){const t=e[n];"."===t?e.splice(n,1):".."===t?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e}function splitShellCommand$1(e){let t=0,r="";const n=[];let o="";for(let s=0;s {let i=[];if(r.length)i=[t,...r];else if("string"==typeof t)i=splitShellCommand$1(t);else{if(!Array.isArray(t))throw new Error("Invalid command ",t);i=t}try{await e(i,s,n)}catch(a){o.emit("error",a),"object"==typeof a&&null!==a&&"message"in a&&"string"==typeof a.message&&s.stderr(a.message),s.exit(1)}o.emit("spawn",!0)})),o}}class EventEmitter{constructor(){this.listeners={}}emit(e,t){this.listeners[e]&&this.listeners[e].forEach((function(e){e(t)}))}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}}class ProcessApi extends EventEmitter{constructor(e){super(),this.childProcess=e,this.exited=!1,this.stdinData=[],e.on("stdin",(e=>{this.stdinData?this.stdinData.push(e.slice()):this.emit("stdin",e)}))}stdout(e){"string"==typeof e&&(e=(new TextEncoder).encode(e)),this.childProcess.stdout.emit("data",e)}stdoutEnd(){this.childProcess.stdout.emit("end",{})}stderr(e){"string"==typeof e&&(e=(new TextEncoder).encode(e)),this.childProcess.stderr.emit("data",e)}stderrEnd(){this.childProcess.stderr.emit("end",{})}exit(e){this.exited||(this.exited=!0,this.childProcess.emit("exit",e))}flushStdin(){if(this.stdinData)for(let e=0;e {t.emit("stdin",e)}}}}function randomString(e=36,t="!@#$%^&*()_+=-[]/.,<>?"){const r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+t;let n="";for(let o=e;o>0;--o)n+=r[Math.floor(Math.random()*r.length)];return n}function randomFilename(){return randomString(36,"-_")}function phpVar(e){return`json_decode(base64_decode('${stringToBase64(JSON.stringify(e))}'), true)`}function phpVars(e){const t={};for(const r in e)t[r]=phpVar(e[r]);return t}function stringToBase64(e){return bytesToBase64((new TextEncoder).encode(e))}function bytesToBase64(e){const t=String.fromCodePoint(...e);return btoa(t)}const activatePlugin=async(e,{pluginPath:t,pluginName:r},n)=>{null==n||n.tracker.setCaption(`Activating ${r||t}`);const o=await e.documentRoot;await e.run({code:` 'Administrator') )[0]->ID );\n\n$plugin_path = ${phpVar(t)};\n\nif (!is_dir($plugin_path)) {\n\tactivate_plugin($plugin_path);\n\tdie();\n}\n\nforeach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {\n\t$info = get_plugin_data( $file, false, false );\n\tif ( ! empty( $info['Name'] ) ) {\n\t\tactivate_plugin( $file );\n\t\tdie();\n\t}\n}\n\n// If we got here, the plugin was not found.\nexit(1);\n`})},activateTheme=async(e,{themeFolderName:t},r)=>{null==r||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot;await e.run({code:` 'Administrator') )[0]->ID );\n\nswitch_theme( ${phpVar(t)} );\n`})},runPHP=async(e,{code:t})=>await e.run({code:t}),runPHPWithOptions=async(e,{options:t})=>await e.run(t),rm=async(e,{path:t})=>{await e.unlink(t)},runSql=async(e,{sql:t},r)=>{null==r||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${randomFilename()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const o=phpVars({docroot:await e.documentRoot,sqlFilename:n}),s=await e.run({code:`query($buffer);\n\t\t\t$buffer = '';\n\t\t}\n\t`});return await rm(e,{path:n}),s},logToConsole=(e,...t)=>{switch(e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},prepareLogMessage=(e,...t)=>["object"==typeof e?JSON.stringify(e):e,...t.map((e=>JSON.stringify(e)))].join(" "),logs=[],addToLogArray=e=>{logs.push(e)},logToMemory=e=>{if(!0===e.raw)addToLogArray(e.message);else{const t=formatLogEntry("object"==typeof e.message?prepareLogMessage(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");addToLogArray(t)}};class Logger extends EventTarget{constructor(e=[]){super(),this.handlers=e,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(logToMemory)?[...logs]:(this.error("Logs aren't stored because the logToMemory handler isn't registered.\n\t\t\t\tIf you're using a custom logger instance, make sure to register logToMemory handler.\n\t\t\t"),[])}logMessage(e,...t){for(const r of this.handlers)r(e,...t)}log(e,...t){this.logMessage({message:e,severity:void 0,prefix:"JavaScript",raw:!1},...t)}debug(e,...t){this.logMessage({message:e,severity:"Debug",prefix:"JavaScript",raw:!1},...t)}info(e,...t){this.logMessage({message:e,severity:"Info",prefix:"JavaScript",raw:!1},...t)}warn(e,...t){this.logMessage({message:e,severity:"Warn",prefix:"JavaScript",raw:!1},...t)}error(e,...t){this.logMessage({message:e,severity:"Error",prefix:"JavaScript",raw:!1},...t)}}const logger=new Logger([logToMemory,logToConsole]),formatLogEntry=(e,t,r)=>{const n=new Date;return`[${new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-")+" "+new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n)}] ${r} ${t}: ${e}`};let lastPHPLogLength=0;const errorLogPath="/wordpress/wp-content/debug.log",getRequestPhpErrorLog=async e=>await e.fileExists(errorLogPath)?await e.readFileAsText(errorLogPath):"",collectPhpLogs=(e,t)=>{t.addEventListener("request.end",(async()=>{const r=await getRequestPhpErrorLog(t);if(r.length>lastPHPLogLength){const t=r.substring(lastPHPLogLength);e.logMessage({message:t,raw:!0}),lastPHPLogLength=r.length}})),t.addEventListener("request.error",(t=>{t.error&&(e.logMessage({message:`${t.error.message} ${t.error.stack}`,severity:"Fatal",prefix:"request"===t.source?"PHP":"WASM Crash"}),e.dispatchEvent(new CustomEvent(e.fatalErrorEvent,{detail:{logs:e.getLogs(),source:t.source}})))}))},request=async(e,{request:t})=>{logger.warn('Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.');const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw logger.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},rewriteWpConfigToDefineConstants=" false,\n * 'WP_DEBUG_LOG' => true,\n * 'SAVEQUERIES' => true,\n * 'NEW_CONSTANT' => \"new constant\",\n * ];\n * \n * ```php\n * 2 ? 'WP_DEBUG' : 'FOO', true);\n // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n $open_parenthesis = 0;\n while ($token = array_pop($tokens)) {\n $buffer[] = $token;\n if ($token === \"(\" || $token === \"[\" || $token === \"{\") {\n ++$open_parenthesis;\n } elseif ($token === \")\" || $token === \"]\" || $token === \"}\") {\n --$open_parenthesis;\n } elseif ($token === \",\" && $open_parenthesis === 0) {\n break;\n }\n\n // Don't capture the comma as a part of the constant name\n $name_buffer[] = $token;\n }\n\n // Capture everything until the closing parenthesis\n // define(\"WP_DEBUG\", true);\n // ^^^^^^\n $open_parenthesis = 0;\n $is_second_argument = true;\n while ($token = array_pop($tokens)) {\n $buffer[] = $token;\n if ($token === \")\" && $open_parenthesis === 0) {\n // Final parenthesis of the define call.\n break;\n } else if ($token === \"(\" || $token === \"[\" || $token === \"{\") {\n ++$open_parenthesis;\n } elseif ($token === \")\" || $token === \"]\" || $token === \"}\") {\n --$open_parenthesis;\n } elseif ($token === \",\" && $open_parenthesis === 0) {\n // This define call has more than 2 arguments! The third one is the\n // boolean value indicating $is_case_insensitive. Let's continue capturing\n // to $third_arg_buffer.\n $is_second_argument = false;\n }\n if ($is_second_argument) {\n $value_buffer[] = $token;\n } else {\n $third_arg_buffer[] = $token;\n }\n }\n\n // Capture until the semicolon\n // define(\"WP_DEBUG\", true) ;\n // ^^^\n while ($token = array_pop($tokens)) {\n $buffer[] = $token;\n if ($token === \";\") {\n break;\n }\n }\n\n // Decide whether $name_buffer is a constant name or an expression\n $name_token = null;\n $name_token_index = $token;\n $name_is_literal = true;\n foreach ($name_buffer as $k => $token) {\n if (is_array($token)) {\n if ($token[0] === T_WHITESPACE || $token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT) {\n continue;\n } else if ($token[0] === T_STRING || $token[0] === T_CONSTANT_ENCAPSED_STRING) {\n $name_token = $token;\n $name_token_index = $k;\n } else {\n $name_is_literal = false;\n break;\n }\n } else if ($token !== \"(\" && $token !== \")\") {\n $name_is_literal = false;\n break;\n }\n }\n\n // We can't handle expressions as constant names. Let's wrap that define\n // call in an if(!defined()) statement, just in case it collides with\n // a constant name.\n if (!$name_is_literal) {\n // Ensure the defined expression is not already accounted for\n foreach ($defined_expressions as $defined_expression) {\n if ($defined_expression === stringify_tokens(skip_whitespace($name_buffer))) {\n $output = array_merge($output, $buffer);\n continue 2;\n }\n }\n $output = array_merge(\n $output,\n [\"if(!defined(\"],\n $name_buffer,\n [\")) {\\n \"],\n ['define('],\n $name_buffer,\n [','],\n $value_buffer,\n $third_arg_buffer,\n [\");\"],\n [\"\\n}\\n\"]\n );\n continue;\n }\n\n // Yay, we have a literal constant name in the buffer now. Let's\n // get its value:\n $name = eval('return ' . $name_token[1] . ';');\n\n // If the constant name is not in the list of constants we're looking,\n // we can ignore it.\n if (!array_key_exists($name, $constants)) {\n $output = array_merge($output, $buffer);\n continue;\n }\n\n // We now have a define() call that defines a constant we're looking for.\n // Let's rewrite its value to the one \n $output = array_merge(\n $output,\n ['define('],\n $name_buffer,\n [','],\n [var_export($constants[$name], true)],\n $third_arg_buffer,\n [\");\"]\n );\n\n // Remove the constant from the list so we can process any remaining\n // constants later.\n unset($constants[$name]);\n } while (count($tokens));\n\n // Add any constants that weren't found in the file\n if (count($constants)) {\n $prepend = [\n \" $value) {\n $prepend = array_merge(\n $prepend,\n [\n \"define(\",\n var_export($name, true),\n ',',\n var_export($value, true),\n \");\\n\"\n ]\n );\n }\n $prepend[] = \"?>\";\n $output = array_merge(\n $prepend,\n $output\n );\n }\n\n // Translate the output tokens back into a string\n return stringify_tokens($output);\n}\n\nfunction stringify_tokens($tokens) {\n $output = '';\n foreach ($tokens as $token) {\n if (is_array($token)) {\n $output .= $token[1];\n } else {\n $output .= $token;\n }\n }\n return $output;\n}\n\nfunction skip_whitespace($tokens) {\n $output = [];\n foreach ($tokens as $token) {\n if (is_array($token) && ($token[0] === T_WHITESPACE || $token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT)) {\n continue;\n }\n $output[] = $token;\n }\n return $output;\n}\n",defineWpConfigConsts=async(e,{consts:t,method:r="rewrite-wp-config"})=>{switch(r){case"define-before-run":await defineBeforeRun(e,t);break;case"rewrite-wp-config":{const r=joinPaths(await e.documentRoot,"/wp-config.php"),n=await e.readFileAsText(r),o=await rewriteDefineCalls(e,n,t);await e.writeFile(r,o);break}default:throw new Error(`Invalid method: ${r}`)}};async function defineBeforeRun(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function rewriteDefineCalls(e,t,r){await e.writeFile("/tmp/code.php",t);const n=phpVars({consts:r});return await e.run({code:`${rewriteWpConfigToDefineConstants}\n\t$wp_config_path = '/tmp/code.php';\n\t$wp_config = file_get_contents($wp_config_path);\n\t$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});\n\tfile_put_contents($wp_config_path, $new_wp_config);\n\t`}),await e.readFileAsText("/tmp/code.php")}const login=async(e,{username:t="admin",password:r="password"}={},n)=>{var o,s,i;null==n||n.tracker.setCaption((null==n?void 0:n.initialCaption)||"Logging in"),await e.request({url:"/wp-login.php"});const a=await e.request({url:"/wp-login.php",method:"POST",body:{log:t,pwd:r,rememberme:"forever"}});if(null==(i=null==(s=null==(o=a.headers)?void 0:o.location)?void 0:s[0])||!i.includes("/wp-admin/"))throw logger.warn("WordPress response was",{response:a,text:a.text}),new Error(`Failed to log in as ${t} with password ${r}`)},setSiteOptions=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({code:` $value) {\n\t\t\tupdate_option($name, $value);\n\t\t}\n\t\techo "Success";\n\t\t`})},updateUserMeta=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({code:` $value) {\n\t\t\tupdate_user_meta(${phpVar(r)}, $name, $value);\n\t\t}\n\t\t`})};function isURLScoped(e){return e.pathname.startsWith("/scope:")}function getURLScope(e){return isURLScoped(e)?e.pathname.split("/")[1].split(":")[1]:null}const enableMultisite=async e=>{var t;await defineWpConfigConsts(e,{consts:{WP_ALLOW_MULTISITE:1}});const r=new URL(await e.absoluteUrl);if(""!==r.port){let e=`The current host is ${r.host}, but WordPress multisites do not support custom ports.`;throw"localhost"===r.hostname&&(e+=" For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."),new Error(e)}const n=r.pathname.replace(/\/$/,"")+"/",o=`${r.protocol}//${r.hostname}${n}`;await setSiteOptions(e,{options:{siteurl:o,home:o}}),await login(e,{});const s=await e.documentRoot,i=(await e.run({code:` 'Administrator') )[0] );\n\nrequire_once(${phpVar(s)} . "/wp-admin/includes/plugin.php");\n$plugins_root = ${phpVar(s)} . "/wp-content/plugins";\n$plugins = glob($plugins_root . "/*");\n\n$deactivated_plugins = [];\nforeach($plugins as $plugin_path) {\n\tif (!is_dir($plugin_path)) {\n\t\tdeactivate_plugins($plugin_path);\n\t\tcontinue;\n\t}\n\t// Find plugin entry file\n\tforeach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {\n\t\t$info = get_plugin_data( $file, false, false );\n\t\tif ( ! empty( $info['Name'] ) ) {\n\t\t\tdeactivate_plugins( $file );\n\t\t\t$deactivated_plugins[] = substr($file, strlen($plugins_root) + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n}\necho json_encode($deactivated_plugins);\n`})).json,a=null==(t=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))?void 0:t[1],c=await request(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:jsonToUrlEncoded({_wpnonce:a,_wp_http_referer:n+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(200!==c.httpStatusCode)throw logger.warn("WordPress response was",{response:c,text:c.text,headers:c.headers}),new Error(`Failed to enable multisite. Response code was ${c.httpStatusCode}`);await defineWpConfigConsts(e,{consts:{SUNRISE:"on",MULTISITE:!0,SUBDOMAIN_INSTALL:!1,SITE_ID_CURRENT_SITE:1,BLOG_ID_CURRENT_SITE:1,DOMAIN_CURRENT_SITE:r.hostname,PATH_CURRENT_SITE:n}});const l=new URL(await e.absoluteUrl),d=isURLScoped(l)?"scope:"+getURLScope(l):null;await e.writeFile(joinPaths(s,"/wp-content/sunrise.php"),`encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}const cp=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},mv=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},mkdir=async(e,{path:t})=>{await e.mkdir(t)},rmdir=async(e,{path:t})=>{await e.rmdir(t)},writeFile=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),await e.writeFile(t,r)},defineSiteUrl=async(e,{siteUrl:t})=>{await defineWpConfigConsts(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},importWxr=async(e,{file:t},r)=>{var n;null==(n=null==r?void 0:r.tracker)||n.setCaption("Importing content"),await writeFile(e,{path:"/tmp/import.wxr",data:t});const o=await e.documentRoot;await e.run({code:` 'Administrator') )[0];\n\t\t$importer = new WXR_Importer( array(\n\t\t\t'fetch_attachments' => true,\n\t\t\t'default_author' => $admin_id\n\t\t) );\n\t\t$logger = new WP_Importer_Logger_CLI();\n\t\t$importer->set_logger( $logger );\n\n\t\t// Slashes from the imported content are lost if we don't call wp_slash here.\n\t\tadd_action( 'wp_insert_post_data', function( $data ) {\n\t\t\treturn wp_slash($data);\n\t\t});\n\n\t\t$result = $importer->import( '/tmp/import.wxr' );\n\t\t`})},zipFunctions="open($output, ZipArchive::CREATE);\n if ($res === TRUE) {\n $directories = array(\n $root . '/'\n );\n while (sizeof($directories)) {\n $current_dir = array_pop($directories);\n\n if ($handle = opendir($current_dir)) {\n while (false !== ($entry = readdir($handle))) {\n if ($entry == '.' || $entry == '..') {\n continue;\n }\n\n $entry = join_paths($current_dir, $entry);\n if (in_array($entry, $excludePaths)) {\n continue;\n }\n\n if (is_dir($entry)) {\n $directory_path = $entry . '/';\n array_push($directories, $directory_path);\n } else if (is_file($entry)) {\n $zip->addFile($entry, substr($entry, strlen($zip_root)));\n }\n }\n closedir($handle);\n }\n }\n foreach ($additionalPaths as $disk_path => $zip_path) {\n $zip->addFile($disk_path, $zip_path);\n }\n $zip->close();\n chmod($output, 0777);\n }\n}\n\nfunction join_paths()\n{\n $paths = array();\n\n foreach (func_get_args() as $arg) {\n if ($arg !== '') {\n $paths[] = $arg;\n }\n }\n\n return preg_replace('#/+#', '/', join('/', $paths));\n}\n\nfunction unzip($zipPath, $extractTo, $overwrite = true)\n{\n if (!is_dir($extractTo)) {\n mkdir($extractTo, 0777, true);\n }\n $zip = new ZipArchive;\n $res = $zip->open($zipPath);\n if ($res === TRUE) {\n $zip->extractTo($extractTo);\n $zip->close();\n chmod($extractTo, 0777);\n }\n}\n\n\nfunction delTree($dir)\n{\n $files = array_diff(scandir($dir), array('.', '..'));\n foreach ($files as $file) {\n (is_dir(\"$dir/$file\")) ? delTree(\"$dir/$file\") : unlink(\"$dir/$file\");\n }\n return rmdir($dir);\n}\n";async function runPhpWithZipFunctions(e,t){return await e.run({code:zipFunctions+t})}const tmpPath="/tmp/file.zip",unzip=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)await e.writeFile(tmpPath,await e.readFileAsBuffer(r)),logger.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else{if(!t)throw new Error("Either zipPath or zipFile must be provided");await e.writeFile(tmpPath,new Uint8Array(await t.arrayBuffer()))}const o=phpVars({zipPath:tmpPath,extractToPath:n});await runPhpWithZipFunctions(e,`unzip(${o.zipPath}, ${o.extractToPath});`),e.fileExists(tmpPath)&&await e.unlink(tmpPath)},importWordPressFiles=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let o=joinPaths("/tmp","import");await e.mkdir(o),await unzip(e,{zipFile:t,extractToPath:o}),o=joinPaths(o,r);const s=joinPaths(o,"wp-content"),i=joinPaths(n,"wp-content");for(const d of wpContentFilesExcludedFromExport){const t=joinPaths(s,d);await removePath(e,t);const r=joinPaths(i,d);await e.fileExists(r)&&(await e.mkdir(dirname(t)),await e.mv(r,t))}const a=joinPaths(o,"wp-content","database");await e.fileExists(a)||await e.mv(joinPaths(n,"wp-content","database"),a);const c=await e.listFiles(o);for(const d of c)await removePath(e,joinPaths(n,d)),await e.mv(joinPaths(o,d),joinPaths(n,d));await e.rmdir(o),await defineSiteUrl(e,{siteUrl:await e.absoluteUrl});const l=phpVar(joinPaths(n,"wp-admin","upgrade.php"));await e.run({code:`!e.endsWith("/__MACOSX")));const i=1===s.length&&await e.isDir(s[0]);let c,l="";i?(l=s[0],c=s[0].split("/").pop()):(l=a,c=o);const d=`${t}/${c}`;if(await e.fileExists(d)){if(!await e.isDir(d))throw new Error(`Cannot install asset ${c} to ${d} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`);if("overwrite"!==n){if("skip"===n)return{assetFolderPath:d,assetFolderName:c};throw new Error(`Cannot install asset ${c} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`)}await e.rmdir(d,{recursive:!0})}return await e.mv(l,d),{assetFolderPath:d,assetFolderName:c}}finally{await e.rmdir(i,{recursive:!0})}}function zipNameToHumanName(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const installPlugin=async(e,{pluginZipFile:t,ifAlreadyInstalled:r,options:n={}},o)=>{const s=zipNameToHumanName(t.name.split("/").pop()||"plugin.zip");null==o||o.tracker.setCaption(`Installing the ${s} plugin`);const{assetFolderPath:i}=await installAsset(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});(!("activate"in n)||n.activate)&&await activatePlugin(e,{pluginPath:i,pluginName:s},o)},installTheme=async(e,{themeZipFile:t,ifAlreadyInstalled:r,options:n={}},o)=>{const s=zipNameToHumanName(t.name);null==o||o.tracker.setCaption(`Installing the ${s} theme`);const{assetFolderName:i}=await installAsset(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});(!("activate"in n)||n.activate)&&await activateTheme(e,{themeFolderName:i},o)},runWpInstallationWizard=async(e,{options:t})=>{await e.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:t.adminPassword||"admin",admin_password:t.adminPassword||"password",admin_password2:t.adminPassword||"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}})},zipWpContent=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,o=joinPaths(n,"wp-content");let s=wpContentFilesExcludedFromExport;t&&(s=s.filter((e=>!e.startsWith("themes/twenty"))).filter((e=>"mu-plugins/sqlite-database-integration"!==e)));const i=phpVars({zipPath:r,wpContentPath:o,documentRoot:n,exceptPaths:s.map((e=>joinPaths(n,"wp-content",e))),additionalPaths:t?{[joinPaths(n,"wp-config.php")]:"wp-config.php"}:{}});await runPhpWithZipFunctions(e,`zipDir(${i.wpContentPath}, ${i.zipPath}, array(\n\t\t\t'exclude_paths' => ${i.exceptPaths},\n\t\t\t'zip_root' => ${i.documentRoot},\n\t\t\t'additional_paths' => ${i.additionalPaths}\n\t\t));`);const a=await e.readFileAsBuffer(r);return e.unlink(r),a},wpCLI$1=async(e,{command:t,wpCliPath:r="/tmp/wp-cli.phar"})=>{if(!await e.fileExists(r))throw new Error(`wp-cli.phar not found at ${r}`);let n;if("string"==typeof t?n=splitShellCommand(t=t.trim()):n=t,"wp"!==n.shift())throw new Error('The first argument must be "wp".');await e.writeFile("/tmp/stdout",""),await e.writeFile("/tmp/stderr",""),await e.writeFile("/wordpress/run-cli.php",`this.notifyProgress())),r.addEventListener("done",(()=>{this.done&&this.notifyDone()})),r}fillSlowly({stopBeforeFinishing:e=!0}={}){if(this._isFilling)return;this._isFilling=!0;const t=this._fillTime/100;this._fillInterval=setInterval((()=>{this.set(this._selfProgress+1),e&&this._selfProgress>=99&&clearInterval(this._fillInterval)}),t)}set(e){this._selfProgress=Math.min(e,100),this.notifyProgress(),this._selfProgress+PROGRESS_EPSILON>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let e=this._subTrackers.length-1;e>=0;e--)if(!this._subTrackers[e].done){const t=this._subTrackers[e].caption;if(t)return t}return this._selfCaption}setCaption(e){this._selfCaption=e,this.notifyProgress()}get done(){return this.progress+PROGRESS_EPSILON>=100}get progress(){if(this._selfDone)return 100;const e=this._subTrackers.reduce(((e,t)=>e+t.progress*t.weight),this._selfProgress*this._selfWeight);return Math.round(1e4*e)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=e=>{this.set(e)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=e=>{this.set(e.detail.loaded/e.detail.total*100)}),this._loadingListener}pipe(e){e.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",(t=>{e.setProgress({progress:t.detail.progress,caption:t.detail.caption})})),this.addEventListener("done",(()=>{e.setLoaded()}))}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}notifyProgress(){const e=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return e.progress},get caption(){return e.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const kError=Symbol("error"),kMessage=Symbol("message");class ErrorEvent2 extends Event{constructor(e,t={}){super(e),this[kError]=void 0===t.error?null:t.error,this[kMessage]=void 0===t.message?"":t.message}get error(){return this[kError]}get message(){return this[kMessage]}}Object.defineProperty(ErrorEvent2.prototype,"error",{enumerable:!0}),Object.defineProperty(ErrorEvent2.prototype,"message",{enumerable:!0});const ErrorEvent="function"==typeof globalThis.ErrorEvent?globalThis.ErrorEvent:ErrorEvent2;function isExitCodeZero(e){return e instanceof Error&&("exitCode"in e&&0===(null==e?void 0:e.exitCode)||"ExitStatus"===(null==e?void 0:e.name)&&"status"in e&&0===e.status)}class UnhandledRejectionsTarget extends EventTarget{constructor(){super(...arguments),this.listenersCount=0}addEventListener(e,t){++this.listenersCount,super.addEventListener(e,t)}removeEventListener(e,t){--this.listenersCount,super.removeEventListener(e,t)}hasListeners(){return this.listenersCount>0}}function improveWASMErrorReporting(e){e.asm={...e.asm};const t=new UnhandledRejectionsTarget;for(const r in e.asm)if("function"==typeof e.asm[r]){const n=e.asm[r];e.asm[r]=function(...r){var o;try{return n(...r)}catch(s){if(!(s instanceof Error))throw s;const r=clarifyErrorMessage(s,null==(o=e.lastAsyncifyStackSource)?void 0:o.stack);if(e.lastAsyncifyStackSource&&(s.cause=e.lastAsyncifyStackSource),t.hasListeners())return void t.dispatchEvent(new ErrorEvent("error",{error:s,message:r}));throw isExitCodeZero(s)||showCriticalErrorBox(r),s}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if("unreachable"===e.message){let r=UNREACHABLE_ERROR;t||(r+="\n\nThis stack trace is lacking. For a better one initialize \nthe PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).\n\n"),functionsMaybeMissingFromAsyncify=extractPHPFunctionsFromStack(t||e.stack||"");for(const e of functionsMaybeMissingFromAsyncify)r+=` * ${e}\n`;return r}return e.message}const UNREACHABLE_ERROR="\n\"unreachable\" WASM instruction executed.\n\nThe typical reason is a PHP function missing from the ASYNCIFY_ONLY\nlist when building PHP.wasm.\n\nYou will need to file a new issue in the WordPress Playground repository\nand paste this error message there:\n\nhttps://github.com/WordPress/wordpress-playground/issues/new\n\nIf you're a core developer, the typical fix is to:\n\n* Isolate a minimal reproduction of the error\n* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository\n* Run 'npm run fix-asyncify'\n* Commit the changes, push to the repo, release updated NPM packages\n\nBelow is a list of all the PHP functions found in the stack trace to\nhelp with the minimal reproduction. If they're all already listed in\nthe Dockerfile, you'll need to trigger this error again with long stack\ntraces enabled. In node.js, you can do it using the --stack-trace-limit=100\nCLI option: \n\n",redBg="\x1b[41m",bold="\x1b[1m",reset="\x1b[0m",eol="\x1b[K";let logged=!1;function showCriticalErrorBox(e){if(!logged&&(logged=!0,null==e||!e.trim().startsWith("Program terminated with exit"))){logger.log(`${redBg}\n${eol}\n${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split("\n"))logger.log(`${eol} ${t} `);logger.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split("\n").slice(1).map((e=>{const t=e.trim().substring(3).split(" ");return{fn:t.length>=2?t[0]:" ",isWasm:e.includes("wasm://")}})).filter((({fn:e,isWasm:t})=>t&&!e.startsWith("dynCall_")&&!e.startsWith("invoke_"))).map((({fn:e})=>e));return Array.from(new Set(t))}catch{return[]}}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);const responseTexts={500:"Internal Server Error",502:"Bad Gateway",404:"Not Found",403:"Forbidden",401:"Unauthorized",400:"Bad Request",301:"Moved Permanently",302:"Found",307:"Temporary Redirect",308:"Permanent Redirect",204:"No Content",201:"Created",200:"OK"};class PHPResponse{constructor(e,t,r,n="",o=0){this.httpStatusCode=e,this.headers=t,this.bytes=r,this.exitCode=o,this.errors=n}static forHttpCode(e,t=""){return new PHPResponse(e,{},(new TextEncoder).encode(t||responseTexts[e]||""))}static fromRawData(e){return new PHPResponse(e.httpStatusCode,e.headers,e.bytes,e.errors,e.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return(new TextDecoder).decode(this.bytes)}}const SupportedPHPVersions=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],LatestSupportedPHPVersion=SupportedPHPVersions[0],SupportedPHPVersionsList=SupportedPHPVersions,SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList,light:[]},FileErrorCodes={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function getEmscriptenFsError(e){const t="object"==typeof e?null==e?void 0:e.errno:null;if(t in FileErrorCodes)return FileErrorCodes[t]}function rethrowFileSystemError(e=""){return function(t,r,n){const o=n.value;n.value=function(...t){try{return o.apply(this,t)}catch(r){const n="object"==typeof r?null==r?void 0:r.errno:null;if(n in FileErrorCodes){const o=FileErrorCodes[n],s="string"==typeof t[0]?t[0]:null,i=null!==s?e.replaceAll("{path}",s):e;throw new Error(`${i}: ${o}`,{cause:r})}throw r}}}}const loadedRuntimes=new Map;function getLoadedRuntime(e){return loadedRuntimes.get(e)}!function(){var e;typeof process<"u"&&"node"===(null==(e=process.release)?void 0:e.name)||(typeof window<"u"||typeof WorkerGlobalScope<"u"&&(self,WorkerGlobalScope))}();var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var o,s=n>1?void 0:n?__getOwnPropDesc(t,r):t,i=e.length-1;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");class PHPExecutionFailureError extends Error{constructor(e,t,r){super(e),this.response=t,this.source=r}}var Ne,Ve,xe,ve,Ee,Pe,He,st,jt,it,At,ot,Dt,at,Ft,ct,Mt,lt,Lt,dt,qt,ut,Ut,pt,Vt,ft,xt,ht,Ht,mt,zt,gt,Wt,_t,Bt,yt,Gt;class BasePHP{constructor(e){ee(this,st),ee(this,it),ee(this,ot),ee(this,at),ee(this,ct),ee(this,lt),ee(this,dt),ee(this,ut),ee(this,pt),ee(this,ft),ee(this,ht),ee(this,mt),ee(this,gt),ee(this,_t),ee(this,yt),ee(this,Ne,void 0),ee(this,Ve,void 0),ee(this,xe,void 0),ee(this,ve,void 0),ee(this,Ee,void 0),ee(this,Pe,void 0),ee(this,He,void 0),fe(this,Ne,[]),fe(this,ve,!1),fe(this,Ee,null),fe(this,Pe,new Map),fe(this,He,[]),this.semaphore=new Semaphore({concurrency:1}),void 0!==e&&this.initializeRuntime(e)}addEventListener(e,t){se(this,Pe).has(e)||se(this,Pe).set(e,new Set),se(this,Pe).get(e).add(t)}removeEventListener(e,t){var r;null==(r=se(this,Pe).get(e))||r.delete(t)}dispatchEvent(e){const t=se(this,Pe).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){se(this,He).push(e)}async setSpawnHandler(handler){"string"==typeof handler&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.internalUrlToPath(e)}initializeRuntime(e){if(this[__private__dont__use])throw new Error("PHP runtime already initialized.");const t=getLoadedRuntime(e);if(!t)throw new Error("Invalid PHP runtime id.");this[__private__dont__use]=t,t.onMessage=async e=>{for(const t of se(this,He)){const r=await t(e);if(r)return r}return""},fe(this,Ee,improveWASMErrorReporting(t)),this.dispatchEvent({type:"runtime.initialized"})}async setSapiName(e){if(0!==this[__private__dont__use].ccall("wasm_set_sapi_name",NUMBER,[STRING],[e]))throw new Error("Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?");fe(this,xe,e)}setPhpIniPath(e){if(se(this,ve))throw new Error("Cannot set PHP ini path after calling run().");fe(this,Ve,e),this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[e])}setPhpIniEntry(e,t){if(se(this,ve))throw new Error("Cannot set PHP ini entries after calling run().");se(this,Ne).push([e,t])}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e){if(logger.warn("PHP.request() is deprecated. Please use new PHPRequestHandler() instead."),!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e)}async run(e){const t=await this.semaphore.acquire();let r;try{if(se(this,ve)||(ae(this,it,At).call(this),fe(this,ve,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);ae(this,ht,Ht).call(this,e.scriptPath||""),ae(this,at,Ft).call(this,e.relativeUri||""),ae(this,ut,Ut).call(this,e.method||"GET");const t=normalizeHeaders(e.headers||{}),n=t.host||"example.com:443",o=ae(this,dt,qt).call(this,n,e.protocol||"http");ae(this,ct,Mt).call(this,n),ae(this,lt,Lt).call(this,o),ae(this,pt,Vt).call(this,t),e.body&&(r=ae(this,ft,xt).call(this,e.body)),"string"==typeof e.code&&ae(this,_t,Bt).call(this," ?>"+e.code);const s=ae(this,st,jt).call(this,e.$_SERVER,t,o);for(const e in s)ae(this,mt,zt).call(this,e,s[e]);const i=e.env||{};for(const e in i)ae(this,gt,Wt).call(this,e,i[e]);const a=await ae(this,yt,Gt).call(this);if(0!==a.exitCode){logger.warn("PHP.run() output was:",a.text);const e=new PHPExecutionFailureError(`PHP.run() failed with exit code ${a.exitCode} and the following output: `+a.errors,a,"request");throw logger.error(e),e}return a}catch(n){throw this.dispatchEvent({type:"request.error",error:n,source:n.source??"php-wasm"}),n}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/consts.json")&&this.readFileAsText("/internal/consts.json")||"{}")}catch{}this.writeFile("/internal/consts.json",JSON.stringify({...r,[e]:t}))}mkdir(e){this[__private__dont__use].FS.mkdirTree(e)}mkdirTree(e){this.mkdir(e)}readFileAsText(e){return(new TextDecoder).decode(this.readFileAsBuffer(e))}readFileAsBuffer(e){return this[__private__dont__use].FS.readFile(e)}writeFile(e,t){this[__private__dont__use].FS.writeFile(e,t)}unlink(e){this[__private__dont__use].FS.unlink(e)}mv(e,t){try{this[__private__dont__use].FS.rename(e,t)}catch(r){const n=getEmscriptenFsError(r);throw n?new Error(`Could not move ${e} to ${t}: ${n}`,{cause:r}):r}}rmdir(e,t={recursive:!0}){null!=t&&t.recursive&&this.listFiles(e).forEach((r=>{const n=`${e}/${r}`;this.isDir(n)?this.rmdir(n,t):this.unlink(n)})),this[__private__dont__use].FS.rmdir(e)}listFiles(e,t={prependPath:!1}){if(!this.fileExists(e))return[];try{const r=this[__private__dont__use].FS.readdir(e).filter((e=>"."!==e&&".."!==e));if(t.prependPath){const t=e.replace(/\/$/,"");return r.map((e=>`${t}/${e}`))}return r}catch(r){return logger.error(r,{path:e}),[]}}isDir(e){return!!this.fileExists(e)&&this[__private__dont__use].FS.isDir(this[__private__dont__use].FS.lookupPath(e).node.mode)}fileExists(e){try{return this[__private__dont__use].FS.lookupPath(e),!0}catch{return!1}}hotSwapPHPRuntime(e,t){const r=this[__private__dont__use].FS;try{this.exit()}catch{}this.initializeRuntime(e),se(this,Ve)&&this.setPhpIniPath(se(this,Ve)),se(this,xe)&&this.setSapiName(se(this,xe)),t&©FS(r,this[__private__dont__use].FS,t)}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}fe(this,ve,!1),fe(this,Ee,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}[Symbol.dispose](){se(this,ve)&&this.exit(0)}}function normalizeHeaders(e){const t={};for(const r in e)t[r.toLowerCase()]=e[r];return t}function copyFS(e,t,r){let n;try{n=e.lookupPath(r)}catch{return}if(!("contents"in n.node))return;if(!e.isDir(n.node.mode))return void t.writeFile(r,e.readFile(r));t.mkdirTree(r);const o=e.readdir(r).filter((e=>"."!==e&&".."!==e));for(const s of o)copyFS(e,t,joinPaths(r,s))}Ne=new WeakMap,Ve=new WeakMap,xe=new WeakMap,ve=new WeakMap,Ee=new WeakMap,Pe=new WeakMap,He=new WeakMap,st=new WeakSet,jt=function(e,t,r){const n={...e||{}};n.HTTPS=n.HTTPS||443===r?"on":"off";for(const o in t){let e="HTTP_";["content-type","content-length"].includes(o.toLowerCase())&&(e=""),n[`${e}${o.toUpperCase().replace(/-/g,"_")}`]=t[o]}return n},it=new WeakSet,At=function(){if(this.setPhpIniEntry("auto_prepend_file","/internal/consts.php"),this.fileExists("/internal/consts.php")||this.writeFile("/internal/consts.php"," $value) {\n\t\t\t\t\t\tif (!defined($const) && is_scalar($value)) {\n\t\t\t\t\t\t\tdefine($const, $value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}"),se(this,Ne).length>0){const e=se(this,Ne).map((([e,t])=>`${e}=${t}`)).join("\n")+"\n\n";this[__private__dont__use].ccall("wasm_set_phpini_entries",null,[STRING],[e])}this[__private__dont__use].ccall("php_wasm_init",null,[],[])},ot=new WeakSet,Dt=function(){const e="/internal/headers.json";if(!this.fileExists(e))throw new Error("SAPI Error: Could not find response headers file.");const t=JSON.parse(this.readFileAsText(e)),r={};for(const n of t.headers){if(!n.includes(": "))continue;const e=n.indexOf(": "),t=n.substring(0,e).toLowerCase(),o=n.substring(e+2);t in r||(r[t]=[]),r[t].push(o)}return{headers:r,httpStatusCode:t.status}},at=new WeakSet,Ft=function(e){if(this[__private__dont__use].ccall("wasm_set_request_uri",null,[STRING],[e]),e.includes("?")){const t=e.substring(e.indexOf("?")+1);this[__private__dont__use].ccall("wasm_set_query_string",null,[STRING],[t])}},ct=new WeakSet,Mt=function(e){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e])},lt=new WeakSet,Lt=function(e){this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[e])},dt=new WeakSet,qt=function(e,t){let r;try{r=parseInt(new URL(e).port,10)}catch{}return(!r||isNaN(r)||80===r)&&(r="https"===t?443:80),r},ut=new WeakSet,Ut=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},pt=new WeakSet,Vt=function(e){e.cookie&&this[__private__dont__use].ccall("wasm_set_cookies",null,[STRING],[e.cookie]),e["content-type"]&&this[__private__dont__use].ccall("wasm_set_content_type",null,[STRING],[e["content-type"]]),e["content-length"]&&this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[parseInt(e["content-length"],10)])},ft=new WeakSet,xt=function(e){let t,r;"string"==typeof e?(logger.warn("Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"),r=this[__private__dont__use].lengthBytesUTF8(e),t=r+1):(r=e.byteLength,t=e.byteLength);const n=this[__private__dont__use].malloc(t);if(!n)throw new Error("Could not allocate memory for the request body.");return"string"==typeof e?this[__private__dont__use].stringToUTF8(e,n,t+1):this[__private__dont__use].HEAPU8.set(e,n),this[__private__dont__use].ccall("wasm_set_request_body",null,[NUMBER],[n]),this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[r]),n},ht=new WeakSet,Ht=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},mt=new WeakSet,zt=function(e,t){this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,t])},gt=new WeakSet,Wt=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},_t=new WeakSet,Bt=function(e){this[__private__dont__use].ccall("wasm_set_php_code",null,[STRING],[e])},yt=new WeakSet,Gt=async function(){var e;let t,r;try{t=await new Promise(((e,t)=>{var n;r=e=>{logger.error(e),logger.error(e.error);const r=new Error("Rethrown");r.cause=e.error,r.betterMessage=e.message,t(r)},null==(n=se(this,Ee))||n.addEventListener("error",r);const o=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return o instanceof Promise?o.then(e,t):e(o)}))}catch(s){for(const n in this)"function"==typeof this[n]&&(this[n]=()=>{throw new Error("PHP runtime has crashed \u2013 see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const e=s,t="betterMessage"in e?e.betterMessage:e.message,r=new Error(t);throw r.cause=e,logger.error(r),r}finally{null==(e=se(this,Ee))||e.removeEventListener("error",r)}const{headers:n,httpStatusCode:o}=ae(this,ot,Dt).call(this);return new PHPResponse(0===t?o:500,n,this.readFileAsBuffer("/internal/stdout"),this.readFileAsText("/internal/stderr"),t)},__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdir",1),__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdirTree",1),__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsText",1),__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsBuffer",1),__decorateClass([rethrowFileSystemError('Could not write to "{path}"')],BasePHP.prototype,"writeFile",1),__decorateClass([rethrowFileSystemError('Could not unlink "{path}"')],BasePHP.prototype,"unlink",1),__decorateClass([rethrowFileSystemError('Could not remove directory "{path}"')],BasePHP.prototype,"rmdir",1),__decorateClass([rethrowFileSystemError('Could not list files in "{path}"')],BasePHP.prototype,"listFiles",1),__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"isDir",1),__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"fileExists",1);const ResourceTypes=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function isFileReference(e){return e&&"object"==typeof e&&"string"==typeof e.resource&&ResourceTypes.includes(e.resource)}class Resource{static create(e,{semaphore:t,progress:r}){let n;switch(e.resource){case"vfs":n=new VFSResource(e,r);break;case"literal":n=new LiteralResource(e,r);break;case"wordpress.org/themes":n=new CoreThemeResource(e,r);break;case"wordpress.org/plugins":n=new CorePluginResource(e,r);break;case"url":n=new UrlResource(e,r);break;default:throw new Error(`Invalid resource: ${e}`)}return n=new CachedResource(n),t&&(n=new SemaphoreResource(n,t)),n}setPlayground(e){this.playground=e}get isAsync(){return!1}}class VFSResource extends Resource{constructor(e,t){super(),this.resource=e,this.progress=t}async resolve(){var e;const t=await this.playground.readFileAsBuffer(this.resource.path);return null==(e=this.progress)||e.set(100),new File([t],this.name)}get name(){return this.resource.path.split("/").pop()||""}}class LiteralResource extends Resource{constructor(e,t){super(),this.resource=e,this.progress=t}async resolve(){var e;return null==(e=this.progress)||e.set(100),new File([this.resource.contents],this.resource.name)}get name(){return this.resource.name}}class FetchResource extends Resource{constructor(e){super(),this.progress=e}async resolve(){var e,t;null==(e=this.progress)||e.setCaption(this.caption);const r=this.getURL();try{let e=await fetch(r);if(!e.ok)throw new Error(`Could not download "${r}"`);if(e=await cloneResponseMonitorProgress(e,(null==(t=this.progress)?void 0:t.loadingListener)??noop),200!==e.status)throw new Error(`Could not download "${r}"`);return new File([await e.blob()],this.name)}catch(n){throw new Error(`Could not download "${r}".\n\t\t\t\tCheck if the URL is correct and the server is reachable.\n\t\t\t\tIf the url is reachable, the server might be blocking the request.\n\t\t\t\tCheck the console and network for more information.\n\n\t\t\t\t## Does the console shows an error about "No 'Access-Control-Allow-Origin' header"?\n\n\t\t\t\tThis means the server where your file is hosted does not allow requests from other sites\n\t\t\t\t(cross-origin requests, or CORS).\tYou will need to move it to another server that allows\n\t\t\t\tcross-origin file downloads. You can learn more about CORS at\n\t\t\t\thttps://developer.mozilla.org/en-US/docs/Web/HTTP/CORS.\n\n\t\t\t\tIf you're loading a file from https://github.com/, there's an easy fix \u2013 you can load it from\n\t\t\t\traw.githubusercontent.com instead. Here's how to do that:\n\n\t\t\t\t1. Start with the original GitHub URL for the file. For example:\n\t\t\t\t'''\n\t\t\t\thttps://github.com/username/repository/blob/branch/filename\n\t\t\t\t'''\n\t\t\t\t2. Replace 'github.com' with 'raw.githubusercontent.com'.\n\t\t\t\t3. Remove the '/blob/' part of the URL.\n\n\t\t\t\tThe resulting URL should look like this:\n\t\t\t\t'''\n\t\t\t\thttps://raw.githubusercontent.com/username/repository/branch/filename\n\t\t\t\t'''\n\n\t\t\t\tError:\n\t\t\t\t${n}`)}}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const noop=()=>{};class UrlResource extends FetchResource{constructor(e,t){super(t),this.resource=e}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class CoreThemeResource extends FetchResource{constructor(e,t){super(t),this.resource=e}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${toDirectoryZipName(this.resource.slug)}`}}class CorePluginResource extends FetchResource{constructor(e,t){super(t),this.resource=e}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${toDirectoryZipName(this.resource.slug)}`}}function toDirectoryZipName(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class DecoratedResource extends Resource{constructor(e){super(),this.resource=e}async resolve(){return this.resource.resolve()}async setPlayground(e){return this.resource.setPlayground(e)}get progress(){return this.resource.progress}set progress(e){this.resource.progress=e}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class CachedResource extends DecoratedResource{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class SemaphoreResource extends DecoratedResource{constructor(e,t){super(e),this.semaphore=t}async resolve(){return this.isAsync?this.semaphore.run((()=>super.resolve())):super.resolve()}}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ajv$1={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o {if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(o,s,i={},a){let c=t.nil;for(const l in o){const d=o[l];if(!d)continue;const p=i[l]=i[l]||new Map;d.forEach((o=>{if(p.has(o))return;p.set(o,n.Started);let i=s(o);if(i){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${i};${this.opts._n}`}else{if(!(i=null==a?void 0:a(o)))throw new r(o);c=t._`${c}${i}${this.opts._n}`}p.set(o,n.Completed)}))}return c}}}(scope),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=code$1,r=scope;var n=code$1;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=scope;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class i extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=x(this.rhs,e,r),this}get names(){return R(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends a{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class u extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=x(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(C(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>T(e,t.names)),{})}}class f extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class g extends f{}g.kind="else";class y extends f{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(N(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=x(this.condition,e,t),this}get names(){const e=super.names;return R(e,this.condition),this.else&&T(e,this.else.names),e}}y.kind="if";class _ extends f{}_.kind="for";class $ extends _{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=x(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}}class v extends _{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=R(super.names,this.from);return R(e,this.to)}}class w extends _{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=x(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}}class b extends f{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class P extends h{render(e){return"return "+super.render(e)}}P.kind="return";class E extends f{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}}class S extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}S.kind="catch";class k extends f{render(e){return"finally"+super.render(e)}}k.kind="finally";function T(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function R(e,r){return r instanceof t._CodeOrName?T(e,r.names):e}function x(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some((e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str]))?new t._Code(e._items.reduce(((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e)),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function C(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${A(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new i(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new a(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new u(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new $(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const i=this._scope.toName(e);return this._for(new v(s,i,t,n),(()=>o(i)))}forOf(e,n,o,s=r.varKinds.const){const i=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,(r=>{this.var(i,t._`${e}[${r}]`),o(i)}))}return this._for(new w("of",s,i,n),(()=>o(i)))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const i=this._scope.toName(e);return this._for(new w("in",s,i,n),(()=>o(i)))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new P;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new S(e),t(e)}return r&&(this._currNode=n.finally=new k,this.code(r)),this._endBlockNode(S,k)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new b(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=N;const j=I(e.operators.AND);e.and=function(...e){return e.reduce(j)};const O=I(e.operators.OR);function I(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${A(r)} ${e} ${A(n)}`}function A(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(O)}}(codegen);var util={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;const t=codegen,r=code$1;function n(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||"boolean"==typeof t)return;const o=n.RULES.keywords;for(const s in t)o[s]||h(e,`unknown keyword: "${s}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function s(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:e,mergeToName:r,mergeValues:n,resultToName:o}){return(s,i,a,c)=>{const l=void 0===a?i:a instanceof t.Name?(i instanceof t.Name?e(s,i,a):r(s,i,a),a):i instanceof t.Name?(r(s,a,i),i):n(i,a);return c!==t.Name||l instanceof t.Name?l:o(s,l)}}function c(e,r){if(!0===r)return e.var("props",!0);const n=e.var("props",t._`{}`);return void 0!==r&&l(e,n,r),n}function l(e,r,n){Object.keys(n).forEach((n=>e.assign(t._`${r}${(0,t.getProperty)(n)}`,!0)))}e.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:r},n,o,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return t._`${n}`}return t._`${e}${r}${(0,t.getProperty)(o)}`},e.unescapeFragment=function(e){return i(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(s(e))},e.escapeJsonPointer=s,e.unescapeJsonPointer=i,e.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},e.mergeEvaluated={props:a({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,(()=>{e.if(t._`${r} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,t._`${n} || {}`).code(t._`Object.assign(${n}, ${r})`)))})),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,(()=>{!0===r?e.assign(n,!0):(e.assign(n,t._`${n} || {}`),l(e,n,r))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:c}),items:a({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,(()=>e.assign(n,t._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`))),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,(()=>e.assign(n,!0===r||t._`${n} > ${r} ? ${n} : ${r}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=c,e.setEvaluated=l;const d={};var p,u;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:d[t.code]||(d[t.code]=new r._Code(t.code))})},(u=p=e.Type||(e.Type={}))[u.Num=0]="Num",u[u.Str=1]="Str",e.getErrorPath=function(e,r,n){if(e instanceof t.Name){const o=r===p.Num;return n?o?t._`"[" + ${e} + "]"`:t._`"['" + ${e} + "']"`:o?t._`"/" + ${e}`:t._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,t.getProperty)(e).toString():"/"+s(e)},e.checkStrictMode=h}(util);var names$1={};Object.defineProperty(names$1,"__esModule",{value:!0});const codegen_1$t=codegen,names={data:new codegen_1$t.Name("data"),valCxt:new codegen_1$t.Name("valCxt"),instancePath:new codegen_1$t.Name("instancePath"),parentData:new codegen_1$t.Name("parentData"),parentDataProperty:new codegen_1$t.Name("parentDataProperty"),rootData:new codegen_1$t.Name("rootData"),dynamicAnchors:new codegen_1$t.Name("dynamicAnchors"),vErrors:new codegen_1$t.Name("vErrors"),errors:new codegen_1$t.Name("errors"),this:new codegen_1$t.Name("this"),self:new codegen_1$t.Name("self"),scope:new codegen_1$t.Name("scope"),json:new codegen_1$t.Name("json"),jsonPos:new codegen_1$t.Name("jsonPos"),jsonLen:new codegen_1$t.Name("jsonLen"),jsonPart:new codegen_1$t.Name("jsonPart")};names$1.default=names,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=codegen,r=util,n=names$1;function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,t._`[${o}]`)),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,i,c){const{it:l}=r,{gen:d,compositeRule:p,allErrors:u}=l,h=a(r,n,i);c??(p||u)?o(d,h):s(l,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,i){const{it:c}=t,{gen:l,compositeRule:d,allErrors:p}=c;o(l,a(t,r,i)),d||p||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,(()=>e.if(r,(()=>e.assign(t._`${n.default.vErrors}.length`,r)),(()=>e.assign(n.default.vErrors,null)))))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:i,it:a}){if(void 0===i)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",i,n.default.errors,(i=>{e.const(c,t._`${n.default.vErrors}[${i}]`),e.if(t._`${c}.instancePath === undefined`,(()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,a.errorPath)))),e.assign(t._`${c}.schemaPath`,t.str`${a.errSchemaPath}/${r}`),a.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))}))};const i={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function a(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:a}=e,d=[c(a,o),l(e,o)];return function(e,{params:r,message:o},s){const{keyword:a,data:c,schemaValue:l,it:d}=e,{opts:p,propertyName:u,topSchemaRef:h,schemaPath:f}=d;s.push([i.keyword,a],[i.params,"function"==typeof r?r(e):r||t._`{}`]),p.messages&&s.push([i.message,"function"==typeof o?o(e):o]),p.verbose&&s.push([i.schema,l],[i.parentSchema,t._`${h}${f}`],[n.default.data,c]),u&&s.push([i.propertyName,u])}(e,r,d),s.object(...d)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function l({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let a=s?n:t.str`${n}/${e}`;return o&&(a=t.str`${a}${(0,r.getErrorPath)(o,r.Type.Str)}`),[i.schemaPath,a]}}(errors),Object.defineProperty(boolSchema,"__esModule",{value:!0}),boolSchema.boolOrEmptySchema=boolSchema.topBoolOrEmptySchema=void 0;const errors_1$2=errors,codegen_1$s=codegen,names_1$6=names$1,boolError={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:n}=e;!1===r?falseSchemaError(e,!1):"object"==typeof r&&!0===r.$async?t.return(names_1$6.default.data):(t.assign(codegen_1$s._`${n}.errors`,null),t.return(!0))}function boolOrEmptySchema(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),falseSchemaError(e)):r.var(t,!0)}function falseSchemaError(e,t){const{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,errors_1$2.reportError)(o,boolError,void 0,t)}boolSchema.topBoolOrEmptySchema=topBoolOrEmptySchema,boolSchema.boolOrEmptySchema=boolOrEmptySchema;var dataType={},rules={};Object.defineProperty(rules,"__esModule",{value:!0}),rules.getRules=rules.isJSONType=void 0;const _jsonTypes=["string","number","integer","boolean","null","object","array"],jsonTypes=new Set(_jsonTypes);function isJSONType(e){return"string"==typeof e&&jsonTypes.has(e)}function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}rules.isJSONType=isJSONType,rules.getRules=getRules;var applicability={};function schemaHasRulesForType({schema:e,self:t},r){const n=t.RULES.types[r];return n&&!0!==n&&shouldUseGroup(e,n)}function shouldUseGroup(e,t){return t.rules.some((t=>shouldUseRule(e,t)))}function shouldUseRule(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}Object.defineProperty(applicability,"__esModule",{value:!0}),applicability.shouldUseRule=applicability.shouldUseGroup=applicability.schemaHasRulesForType=void 0,applicability.schemaHasRulesForType=schemaHasRulesForType,applicability.shouldUseGroup=shouldUseGroup,applicability.shouldUseRule=shouldUseRule,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=rules,r=applicability,n=errors,o=codegen,s=util;var i,a;function c(e){const r=Array.isArray(e)?e:e?[e]:[];if(r.every(t.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=i=e.DataType||(e.DataType={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",e.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=c,e.coerceAndCheckDataType=function(e,t){const{gen:n,data:s,opts:a}=e,c=function(e,t){return t?e.filter((e=>l.has(e)||"array"===t&&"array"===e)):[]}(t,a.coerceTypes),d=t.length>0&&!(0===c.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(d){const r=p(t,s,a.strictNumbers,i.Wrong);n.if(r,(()=>{c.length?function(e,t,r){const{gen:n,data:s,opts:i}=e,a=n.let("dataType",o._`typeof ${s}`),c=n.let("coerced",o._`undefined`);"array"===i.coerceTypes&&n.if(o._`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,(()=>n.assign(s,o._`${s}[0]`).assign(a,o._`typeof ${s}`).if(p(t,s,i.strictNumbers),(()=>n.assign(c,s))))),n.if(o._`${c} !== undefined`);for(const o of r)(l.has(o)||"array"===o&&"array"===i.coerceTypes)&&d(o);function d(e){switch(e){case"string":return void n.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(c,o._`"" + ${s}`).elseIf(o._`${s} === null`).assign(c,o._`""`);case"number":return void n.elseIf(o._`${a} == "boolean" || ${s} === null + || (${a} == "string" && ${s} && ${s} == +${s})`).assign(c,o._`+${s}`);case"integer":return void n.elseIf(o._`${a} === "boolean" || ${s} === null + || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(c,o._`+${s}`);case"boolean":return void n.elseIf(o._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(c,!1).elseIf(o._`${s} === "true" || ${s} === 1`).assign(c,!0);case"null":return n.elseIf(o._`${s} === "" || ${s} === 0 || ${s} === false`),void n.assign(c,null);case"array":n.elseIf(o._`${a} === "string" || ${a} === "number" + || ${a} === "boolean" || ${s} === null`).assign(c,o._`[${s}]`)}}n.else(),h(e),n.endIf(),n.if(o._`${c} !== undefined`,(()=>{n.assign(s,c),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${r}]`,n)))}(e,c)}))}(e,t,c):h(e)}))}return d};const l=new Set(["string","number","integer","boolean","null"]);function d(e,t,r,n=i.Correct){const s=n===i.Correct?o.operators.EQ:o.operators.NEQ;let a;switch(e){case"null":return o._`${t} ${s} null`;case"array":a=o._`Array.isArray(${t})`;break;case"object":a=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=c(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=c();break;default:return o._`typeof ${t} ${s} ${e}`}return n===i.Correct?a:(0,o.not)(a);function c(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,r?o._`isFinite(${t})`:o.nil)}}function p(e,t,r,n){if(1===e.length)return d(e[0],t,r,n);let i;const a=(0,s.toHash)(e);if(a.array&&a.object){const e=o._`typeof ${t} != "object"`;i=a.null?e:o._`!${t} || ${e}`,delete a.null,delete a.array,delete a.object}else i=o.nil;a.number&&delete a.integer;for(const s in a)i=(0,o.and)(i,d(s,t,r,n));return i}e.checkDataType=d,e.checkDataTypes=p;const u={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:r,schema:n}=e,o=(0,s.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}(e);(0,n.reportError)(t,u)}e.reportTypeError=h}(dataType);var defaults={};Object.defineProperty(defaults,"__esModule",{value:!0}),defaults.assignDefaults=void 0;const codegen_1$r=codegen,util_1$p=util;function assignDefaults(e,t){const{properties:r,items:n}=e.schema;if("object"===t&&r)for(const o in r)assignDefault(e,o,r[o].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,r)=>assignDefault(e,r,t.default)))}function assignDefault(e,t,r){const{gen:n,compositeRule:o,data:s,opts:i}=e;if(void 0===r)return;const a=codegen_1$r._`${s}${(0,codegen_1$r.getProperty)(t)}`;if(o)return void(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${a}`);let c=codegen_1$r._`${a} === undefined`;"empty"===i.useDefaults&&(c=codegen_1$r._`${c} || ${a} === null || ${a} === ""`),n.if(c,codegen_1$r._`${a} = ${(0,codegen_1$r.stringify)(r)}`)}defaults.assignDefaults=assignDefaults;var keyword={},code={};Object.defineProperty(code,"__esModule",{value:!0}),code.validateUnion=code.validateArray=code.usePattern=code.callValidateCode=code.schemaProperties=code.allSchemaProperties=code.noPropertyInData=code.propertyInData=code.isOwnProperty=code.hasPropFunc=code.reportMissingProp=code.checkMissingProp=code.checkReportMissingProp=void 0;const codegen_1$q=codegen,util_1$o=util,names_1$5=names$1,util_2$1=util;function checkReportMissingProp(e,t){const{gen:r,data:n,it:o}=e;r.if(noPropertyInData(r,n,t,o.opts.ownProperties),(()=>{e.setParams({missingProperty:codegen_1$q._`${t}`},!0),e.error()}))}function checkMissingProp({gen:e,data:t,it:{opts:r}},n,o){return(0,codegen_1$q.or)(...n.map((n=>(0,codegen_1$q.and)(noPropertyInData(e,t,n,r.ownProperties),codegen_1$q._`${o} = ${n}`))))}function reportMissingProp(e,t){e.setParams({missingProperty:t},!0),e.error()}function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:codegen_1$q._`Object.prototype.hasOwnProperty`})}function isOwnProperty(e,t,r){return codegen_1$q._`${hasPropFunc(e)}.call(${t}, ${r})`}function propertyInData(e,t,r,n){const o=codegen_1$q._`${t}${(0,codegen_1$q.getProperty)(r)} !== undefined`;return n?codegen_1$q._`${o} && ${isOwnProperty(e,t,r)}`:o}function noPropertyInData(e,t,r,n){const o=codegen_1$q._`${t}${(0,codegen_1$q.getProperty)(r)} === undefined`;return n?(0,codegen_1$q.or)(o,(0,codegen_1$q.not)(isOwnProperty(e,t,r))):o}function allSchemaProperties(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}function schemaProperties(e,t){return allSchemaProperties(t).filter((r=>!(0,util_1$o.alwaysValidSchema)(e,t[r])))}function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,l){const d=l?codegen_1$q._`${e}, ${t}, ${n}${o}`:t,p=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,s)],[names_1$5.default.parentData,i.parentData],[names_1$5.default.parentDataProperty,i.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];i.opts.dynamicRef&&p.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const u=codegen_1$q._`${d}, ${r.object(...p)}`;return c!==codegen_1$q.nil?codegen_1$q._`${a}.call(${c}, ${u})`:codegen_1$q._`${a}(${u})`}code.checkReportMissingProp=checkReportMissingProp,code.checkMissingProp=checkMissingProp,code.reportMissingProp=reportMissingProp,code.hasPropFunc=hasPropFunc,code.isOwnProperty=isOwnProperty,code.propertyInData=propertyInData,code.noPropertyInData=noPropertyInData,code.allSchemaProperties=allSchemaProperties,code.schemaProperties=schemaProperties,code.callValidateCode=callValidateCode;const newRegExp=codegen_1$q._`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:codegen_1$q._`${"new RegExp"===o.code?newRegExp:(0,util_2$1.useFunc)(e,o)}(${r}, ${n})`})}function validateArray(e){const{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return i((()=>t.assign(e,!1))),e}return t.var(s,!0),i((()=>t.break())),s;function i(o){const i=t.const("len",codegen_1$q._`${r}.length`);t.forRange("i",0,i,(r=>{e.subschema({keyword:n,dataProp:r,dataPropType:util_1$o.Type.Num},s),t.if((0,codegen_1$q.not)(s),o)}))}}function validateUnion(e){const{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((e=>(0,util_1$o.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const s=t.let("valid",!1),i=t.name("_valid");t.block((()=>r.forEach(((r,o)=>{const a=e.subschema({keyword:n,schemaProp:o,compositeRule:!0},i);t.assign(s,codegen_1$q._`${s} || ${i}`),e.mergeValidEvaluated(a,i)||t.if((0,codegen_1$q.not)(s))})))),e.result(s,(()=>e.reset()),(()=>e.error(!0)))}code.usePattern=usePattern,code.validateArray=validateArray,code.validateUnion=validateUnion,Object.defineProperty(keyword,"__esModule",{value:!0}),keyword.validateKeywordUsage=keyword.validSchemaType=keyword.funcKeywordCode=keyword.macroKeywordCode=void 0;const codegen_1$p=codegen,names_1$4=names$1,code_1$9=code,errors_1$1=errors;function macroKeywordCode(e,t){const{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=useKeyword(r,n,a);!1!==i.opts.validateSchema&&i.self.validateSchema(a,!0);const l=r.name("valid");e.subschema({schema:a,schemaPath:codegen_1$p.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,(()=>e.error(!0)))}function funcKeywordCode(e,t){var r;const{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;checkAsyncKeyword(c,t);const l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,d=useKeyword(n,o,l),p=n.let("valid");function u(r=(t.async?codegen_1$p._`await `:codegen_1$p.nil)){const o=c.opts.passContext?names_1$4.default.this:names_1$4.default.self,s=!("compile"in t&&!a||!1===t.schema);n.assign(p,codegen_1$p._`${r}${(0,code_1$9.callValidateCode)(e,d,o,s)}`,t.modifying)}function h(e){var r;n.if((0,codegen_1$p.not)(null!==(r=t.valid)&&void 0!==r?r:p),e)}e.block$data(p,(function(){if(!1===t.errors)u(),t.modifying&&modifyData(e),h((()=>e.error()));else{const r=t.async?function(){const e=n.let("ruleErrs",null);return n.try((()=>u(codegen_1$p._`await `)),(t=>n.assign(p,!1).if(codegen_1$p._`${t} instanceof ${c.ValidationError}`,(()=>n.assign(e,codegen_1$p._`${t}.errors`)),(()=>n.throw(t))))),e}():function(){const e=codegen_1$p._`${d}.errors`;return n.assign(e,null),u(codegen_1$p.nil),e}();t.modifying&&modifyData(e),h((()=>addErrs(e,r)))}})),e.ok(null!==(r=t.valid)&&void 0!==r?r:p)}function modifyData(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,(()=>t.assign(r,codegen_1$p._`${n.parentData}[${n.parentDataProperty}]`)))}function addErrs(e,t){const{gen:r}=e;r.if(codegen_1$p._`Array.isArray(${t})`,(()=>{r.assign(names_1$4.default.vErrors,codegen_1$p._`${names_1$4.default.vErrors} === null ? ${t} : ${names_1$4.default.vErrors}.concat(${t})`).assign(names_1$4.default.errors,codegen_1$p._`${names_1$4.default.vErrors}.length`),(0,errors_1$1.extendErrors)(e)}),(()=>e.error()))}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,codegen_1$p.stringify)(r)})}function validSchemaType(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&typeof e>"u"))}function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const i=o.dependencies;if(null!=i&&i.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}keyword.macroKeywordCode=macroKeywordCode,keyword.funcKeywordCode=funcKeywordCode,keyword.validSchemaType=validSchemaType,keyword.validateKeywordUsage=validateKeywordUsage;var subschema={};Object.defineProperty(subschema,"__esModule",{value:!0}),subschema.extendSubschemaMode=subschema.extendSubschemaData=subschema.getSubschema=void 0;const codegen_1$o=codegen,util_1$n=util;function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(void 0!==t&&void 0!==n)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const n=e.schema[t];return void 0===r?{schema:n,schemaPath:codegen_1$o._`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:n[r],schemaPath:codegen_1$o._`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}${(0,codegen_1$o.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,util_1$n.escapeFragment)(r)}`}}if(void 0!==n){if(void 0===o||void 0===s||void 0===i)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(void 0!==o&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=t;if(void 0!==r){const{errorPath:o,dataPathArr:s,opts:i}=t;c(a.let("data",codegen_1$o._`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0)),e.errorPath=codegen_1$o.str`${o}${(0,util_1$n.getErrorPath)(r,n,i.jsPropertySyntax)}`,e.parentDataProperty=codegen_1$o._`${r}`,e.dataPathArr=[...s,e.parentDataProperty]}if(void 0!==o){c(o instanceof codegen_1$o.Name?o:a.let("data",o,!0)),void 0!==i&&(e.propertyName=i)}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}s&&(e.dataTypes=s)}function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}subschema.getSubschema=getSubschema,subschema.extendSubschemaData=extendSubschemaData,subschema.extendSubschemaMode=extendSubschemaMode;var resolve$1={},fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!=o--;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r},jsonSchemaTraverse={exports:{}},traverse$1=jsonSchemaTraverse.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),_traverse(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function _traverse(e,t,r,n,o,s,i,a,c,l){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var d in t(n,o,s,i,a,c,l),n){var p=n[d];if(Array.isArray(p)){if(d in traverse$1.arrayKeywords)for(var u=0;u t+=countKeys(e))),t===1/0))return 1/0}return t}function getFullPath(e,t="",r){!1!==r&&(t=normalizeId(t));const n=e.parse(t);return _getFullPath(e,n)}function _getFullPath(e,t){return e.serialize(t).split("#")[0]+"#"}resolve$1.getFullPath=getFullPath,resolve$1._getFullPath=_getFullPath;const TRAILING_SLASH_HASH=/#\/?$/;function normalizeId(e){return e?e.replace(TRAILING_SLASH_HASH,""):""}function resolveUrl(e,t,r){return r=normalizeId(r),e.resolve(t,r)}resolve$1.normalizeId=normalizeId,resolve$1.resolveUrl=resolveUrl;const ANCHOR=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,o=normalizeId(e[r]||t),s={"":o},i=getFullPath(n,o,!1),a={},c=new Set;return traverse(e,{allKeys:!0},((e,t,n,o)=>{if(void 0===o)return;const p=i+t;let u=s[o];function h(t){const r=this.opts.uriResolver.resolve;if(t=normalizeId(u?r(u,t):t),c.has(t))throw d(t);c.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?l(e,n.schema,t):t!==normalizeId(p)&&("#"===t[0]?(l(e,a[t],t),a[t]=e):this.refs[t]=p),t}function f(e){if("string"==typeof e){if(!ANCHOR.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[r]&&(u=h.call(this,e[r])),f.call(this,e.$anchor),f.call(this,e.$dynamicAnchor),s[t]=u})),a;function l(e,t,r){if(void 0!==t&&!equal$2(e,t))throw d(r)}function d(e){return new Error(`reference "${e}" resolves to more than one schema`)}}resolve$1.getSchemaRefs=getSchemaRefs,Object.defineProperty(validate,"__esModule",{value:!0}),validate.getData=validate.KeywordCxt=validate.validateFunctionCode=void 0;const boolSchema_1=boolSchema,dataType_1$1=dataType,applicability_1=applicability,dataType_2=dataType,defaults_1=defaults,keyword_1=keyword,subschema_1=subschema,codegen_1$n=codegen,names_1$3=names$1,resolve_1$2=resolve$1,util_1$l=util,errors_1=errors;function validateFunctionCode(e){isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))?topSchemaObjCode(e):validateFunction(e,(()=>(0,boolSchema_1.topBoolOrEmptySchema)(e)))}function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,codegen_1$n._`${names_1$3.default.data}, ${names_1$3.default.valCxt}`,n.$async,(()=>{e.code(codegen_1$n._`"use strict"; ${funcSourceUrl(r,o)}`),destructureValCxtES5(e,o),e.code(s)})):e.func(t,codegen_1$n._`${names_1$3.default.data}, ${destructureValCxt(o)}`,n.$async,(()=>e.code(funcSourceUrl(r,o)).code(s)))}function destructureValCxt(e){return codegen_1$n._`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${e.dynamicRef?codegen_1$n._`, ${names_1$3.default.dynamicAnchors}={}`:codegen_1$n.nil}}={}`}function destructureValCxtES5(e,t){e.if(names_1$3.default.valCxt,(()=>{e.var(names_1$3.default.instancePath,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`),e.var(names_1$3.default.parentData,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`),e.var(names_1$3.default.parentDataProperty,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`),e.var(names_1$3.default.rootData,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`)}),(()=>{e.var(names_1$3.default.instancePath,codegen_1$n._`""`),e.var(names_1$3.default.parentData,codegen_1$n._`undefined`),e.var(names_1$3.default.parentDataProperty,codegen_1$n._`undefined`),e.var(names_1$3.default.rootData,names_1$3.default.data),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,codegen_1$n._`{}`)}))}function topSchemaObjCode(e){const{schema:t,opts:r,gen:n}=e;validateFunction(e,(()=>{r.$comment&&t.$comment&&commentKeyword(e),checkNoDefault(e),n.let(names_1$3.default.vErrors,null),n.let(names_1$3.default.errors,0),r.unevaluated&&resetEvaluated(e),typeAndKeywords(e),returnResults(e)}))}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",codegen_1$n._`${r}.evaluated`),t.if(codegen_1$n._`${e.evaluated}.dynamicProps`,(()=>t.assign(codegen_1$n._`${e.evaluated}.props`,codegen_1$n._`undefined`))),t.if(codegen_1$n._`${e.evaluated}.dynamicItems`,(()=>t.assign(codegen_1$n._`${e.evaluated}.items`,codegen_1$n._`undefined`)))}function funcSourceUrl(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?codegen_1$n._`/*# sourceURL=${r} */`:codegen_1$n.nil}function subschemaCode(e,t){isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))?subSchemaObjCode(e,t):(0,boolSchema_1.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function isSchemaObj(e){return"boolean"!=typeof e.schema}function subSchemaObjCode(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&commentKeyword(e),updateContext(e),checkAsyncSchema(e);const s=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,s),n.var(t,codegen_1$n._`${s} === ${names_1$3.default.errors}`)}function checkKeywords(e){(0,util_1$l.checkUnknownRules)(e),checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],!1,t);const r=(0,dataType_1$1.getSchemaTypes)(e.schema);schemaKeywords(e,r,!(0,dataType_1$1.coerceAndCheckDataType)(e,r),t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function checkNoDefault(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,util_1$l.checkStrictMode)(e,"default is ignored in the schema root")}function updateContext(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,resolve_1$2.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(codegen_1$n._`${names_1$3.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=codegen_1$n.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(codegen_1$n._`${names_1$3.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(codegen_1$n._`${names_1$3.default.errors} === 0`,(()=>t.return(names_1$3.default.data)),(()=>t.throw(codegen_1$n._`new ${o}(${names_1$3.default.vErrors})`))):(t.assign(codegen_1$n._`${n}.errors`,names_1$3.default.vErrors),s.unevaluated&&assignEvaluated(e),t.return(codegen_1$n._`${names_1$3.default.errors} === 0`))}function assignEvaluated({gen:e,evaluated:t,props:r,items:n}){r instanceof codegen_1$n.Name&&e.assign(codegen_1$n._`${t}.props`,r),n instanceof codegen_1$n.Name&&e.assign(codegen_1$n._`${t}.items`,n)}function schemaKeywords(e,t,r,n){const{gen:o,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:d}=l;function p(l){(0,applicability_1.shouldUseGroup)(s,l)&&(l.type?(o.if((0,dataType_2.checkDataType)(l.type,i,c.strictNumbers)),iterateKeywords(e,l),1===t.length&&t[0]===l.type&&r&&(o.else(),(0,dataType_2.reportTypeError)(e)),o.endIf()):iterateKeywords(e,l),a||o.if(codegen_1$n._`${names_1$3.default.errors} === ${n||0}`))}!s.$ref||!c.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(s,d)?(c.jtd||checkStrictTypes(e,t),o.block((()=>{for(const e of d.rules)p(e);p(d.post)}))):o.block((()=>keywordCode(e,"$ref",d.all.$ref.definition)))}function iterateKeywords(e,t){const{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,defaults_1.assignDefaults)(e,t.type),r.block((()=>{for(const r of t.rules)(0,applicability_1.shouldUseRule)(n,r)&&keywordCode(e,r.keyword,r.definition,t.type)}))}function checkStrictTypes(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(checkContextTypes(e,t),e.opts.allowUnionTypes||checkMultipleTypes(e,t),checkKeywordTypes(e,e.dataTypes))}function checkContextTypes(e,t){if(t.length){if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{includesType(e.dataTypes,t)||strictTypesError(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),narrowSchemaTypes(e,t)}}function checkMultipleTypes(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&strictTypesError(e,"use allowUnionTypes to allow union type keyword")}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const n in r){const o=r[n];if("object"==typeof o&&(0,applicability_1.shouldUseRule)(e.schema,o)){const{type:r}=o.definition;r.length&&!r.some((e=>hasApplicableType(t,e)))&&strictTypesError(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}function hasApplicableType(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function includesType(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function narrowSchemaTypes(e,t){const r=[];for(const n of e.dataTypes)includesType(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}function strictTypesError(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,util_1$l.checkStrictMode)(e,t,e.opts.strictTypes)}validate.validateFunctionCode=validateFunctionCode;class KeywordCxt{constructor(e,t,r){if((0,keyword_1.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,util_1$l.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",getData(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,keyword_1.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",names_1$3.default.errors))}result(e,t,r){this.failResult((0,codegen_1$n.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,codegen_1$n.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(codegen_1$n._`${t} !== undefined && (${(0,codegen_1$n.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?errors_1.reportExtraError:errors_1.reportError)(this,this.def.error,t)}$dataError(){(0,errors_1.reportError)(this,this.def.$dataError||errors_1.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,errors_1.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=codegen_1$n.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=codegen_1$n.nil,t=codegen_1$n.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,codegen_1$n.or)(codegen_1$n._`${n} === undefined`,t)),e!==codegen_1$n.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==codegen_1$n.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return(0,codegen_1$n.or)(function(){if(r.length){if(!(t instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return codegen_1$n._`${(0,dataType_2.checkDataTypes)(e,t,o.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return codegen_1$n._`!${r}(${t})`}return codegen_1$n.nil}())}subschema(e,t){const r=(0,subschema_1.getSubschema)(this.it,e);(0,subschema_1.extendSubschemaData)(r,this.it,e),(0,subschema_1.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return subschemaCode(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=util_1$l.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=util_1$l.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,codegen_1$n.Name))),!0}}function keywordCode(e,t,r,n){const o=new KeywordCxt(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,keyword_1.funcKeywordCode)(o,r):"macro"in r?(0,keyword_1.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,keyword_1.funcKeywordCode)(o,r)}validate.KeywordCxt=KeywordCxt;const JSON_POINTER=/^\/(?:[^~]|~0|~1)*$/,RELATIVE_JSON_POINTER=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return names_1$3.default.rootData;if("/"===e[0]){if(!JSON_POINTER.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=names_1$3.default.rootData}else{const i=RELATIVE_JSON_POINTER.exec(e);if(!i)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+i[1];if(o=i[2],"#"===o){if(a>=t)throw new Error(c("property/index",a));return n[t-a]}if(a>t)throw new Error(c("data",a));if(s=r[t-a],!o)return s}let i=s;const a=o.split("/");for(const l of a)l&&(s=codegen_1$n._`${s}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(l))}`,i=codegen_1$n._`${i} && ${s}`);return i;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}validate.getData=getData;var validation_error={};Object.defineProperty(validation_error,"__esModule",{value:!0});class ValidationError extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}validation_error.default=ValidationError;var ref_error={};Object.defineProperty(ref_error,"__esModule",{value:!0});const resolve_1$1=resolve$1;class MissingRefError extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,resolve_1$1.resolveUrl)(e,t,r),this.missingSchema=(0,resolve_1$1.normalizeId)((0,resolve_1$1.getFullPath)(e,this.missingRef))}}ref_error.default=MissingRefError;var compile={};Object.defineProperty(compile,"__esModule",{value:!0}),compile.resolveSchema=compile.getCompilingSchema=compile.resolveRef=compile.compileSchema=compile.SchemaEnv=void 0;const codegen_1$m=codegen,validation_error_1=validation_error,names_1$2=names$1,resolve_1=resolve$1,util_1$k=util,validate_1$1=validate;class SchemaEnv{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,resolve_1.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s});let a;e.$async&&(a=i.scopeValue("Error",{ref:validation_error_1.default,code:codegen_1$m._`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const l={gen:i,allErrors:this.opts.allErrors,data:names_1$2.default.data,parentData:names_1$2.default.parentData,parentDataProperty:names_1$2.default.parentDataProperty,dataNames:[names_1$2.default.data],dataPathArr:[codegen_1$m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:codegen_1$m.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:codegen_1$m._`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);const t=i.toString();d=`${i.scopeRefs(names_1$2.default.scope)}return ${t}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const r=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:c,validateCode:t,scopeValues:i._values}),this.opts.unevaluated){const{props:e,items:t}=l;r.evaluated={props:e instanceof codegen_1$m.Name?void 0:e,items:t instanceof codegen_1$m.Name?void 0:t,dynamicProps:e instanceof codegen_1$m.Name,dynamicItems:t instanceof codegen_1$m.Name},r.source&&(r.source.evaluated=(0,codegen_1$m.stringify)(r.evaluated))}return e.validate=r,e}catch(p){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),p}finally{this._compilations.delete(e)}}function resolveRef(e,t,r){var n;r=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r);const o=e.refs[r];if(o)return o;let s=resolve.call(this,e,r);if(void 0===s){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:i}=this.opts;o&&(s=new SchemaEnv({schema:o,schemaId:i,root:e,baseId:t}))}return void 0!==s?e.refs[r]=inlineOrCompile.call(this,s):void 0}function inlineOrCompile(e){return(0,resolve_1.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations)if(sameSchemaEnv(t,e))return t}function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t),n=(0,resolve_1._getFullPath)(this.opts.uriResolver,r);let o=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return getJsonPointer.call(this,r,e);const s=(0,resolve_1.normalizeId)(n),i=this.refs[s]||this.schemas[s];if("string"==typeof i){const t=resolveSchema.call(this,e,i);return"object"!=typeof(null==t?void 0:t.schema)?void 0:getJsonPointer.call(this,r,t)}if("object"==typeof(null==i?void 0:i.schema)){if(i.validate||compileSchema.call(this,i),s===(0,resolve_1.normalizeId)(t)){const{schema:t}=i,{schemaId:r}=this.opts,n=t[r];return n&&(o=(0,resolve_1.resolveUrl)(this.opts.uriResolver,o,n)),new SchemaEnv({schema:t,schemaId:r,root:e,baseId:o})}return getJsonPointer.call(this,r,i)}}compile.SchemaEnv=SchemaEnv,compile.compileSchema=compileSchema,compile.resolveRef=resolveRef,compile.getCompilingSchema=getCompilingSchema,compile.resolveSchema=resolveSchema;const PREVENT_SCOPE_CHANGE=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:n}){var o;if("/"!==(null===(o=e.fragment)||void 0===o?void 0:o[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,util_1$k.unescapeFragment)(a)];if(void 0===e)return;const n="object"==typeof(r=e)&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(a)&&n&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,n))}let s;if("boolean"!=typeof r&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const e=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=resolveSchema.call(this,n,e)}const{schemaId:i}=this.opts;return s=s||new SchemaEnv({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema?s:void 0}const $id$1="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description="Meta-schema for $data reference (JSON AnySchema extension proposal)",type$1="object",required$1=["$data"],properties$2={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties$1=!1,require$$9={$id:$id$1,description:description,type:type$1,required:required$1,properties:properties$2,additionalProperties:additionalProperties$1};var uri$1={},uri_all={exports:{}},t;t=uri_all.exports,function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r 1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,o=1;o = 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=h-f,k=Math.floor,T=String.fromCharCode;function R(e){throw new RangeError(E[e])}function x(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}function C(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+x((e=e.replace(P,".")).split("."),t).join(".")}function N(e){for(var t=[],r=0,n=e.length;r =55296&&o<=56319&&r >1,e+=k(e/t);e>S*m>>1;n+=h)e=k(e/S);return k(n+(S+1)*e/(e+g))},A=function(e){var t=[],r=e.length,n=0,o=$,s=_,i=e.lastIndexOf(v);i<0&&(i=0);for(var a=0;a=128&&R("not-basic"),t.push(e.charCodeAt(a));for(var c=i>0?i+1:0;c =r&&R("invalid-input");var g=j(e.charCodeAt(c++));(g>=h||g>k((u-n)/d))&&R("overflow"),n+=g*d;var y=p<=s?f:p>=s+m?m:p-s;if(g k(u/w)&&R("overflow"),d*=w}var b=t.length+1;s=I(n-l,b,0==l),k(n/b)>u-o&&R("overflow"),o+=k(n/b),n%=b,t.splice(n++,0,o)}return String.fromCodePoint.apply(String,t)},F=function(e){var t=[],r=(e=N(e)).length,n=$,o=0,s=_,i=!0,a=!1,c=void 0;try{for(var l,d=e[Symbol.iterator]();!(i=(l=d.next()).done);i=!0){var p=l.value;p<128&&t.push(T(p))}}catch(B){a=!0,c=B}finally{try{!i&&d.return&&d.return()}finally{if(a)throw c}}var g=t.length,y=g;for(g&&t.push(v);y =n&&C k((u-o)/j)&&R("overflow"),o+=(w-n)*j,n=w;var A=!0,F=!1,D=void 0;try{for(var M,q=e[Symbol.iterator]();!(A=(M=q.next()).done);A=!0){var L=M.value;if(L u&&R("overflow"),L==n){for(var U=o,H=h;;H+=h){var V=H<=s?f:H>=s+m?m:H-s;if(U >6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function H(e){for(var t="",r=0,n=e.length;r =194&&o<224){if(n-r>=6){var s=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&o)<<6|63&s)}else t+=e.substr(r,6);r+=6}else if(o>=224){if(n-r>=9){var i=parseInt(e.substr(r+4,2),16),a=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function V(e,t){function r(e){var r=H(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,U).replace(t.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,U).replace(t.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,U).replace(t.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,U).replace(t.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,U).replace(t.PCT_ENCODED,o)),e}function W(e){return e.replace(/^0*(.*)/,"$1")||"0"}function z(e,t){var r=e.match(t.IPV4ADDRESS)||[],n=d(r,2)[1];return n?n.split(".").map(W).join("."):e}function B(e,t){var r=e.match(t.IPV6ADDRESS)||[],n=d(r,3),o=n[1],s=n[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),a=d(i,2),c=a[0],l=a[1],p=l?l.split(":").map(W):[],u=c.split(":").map(W),h=t.IPV4ADDRESS.test(u[u.length-1]),f=h?7:8,m=u.length-f,g=Array(f),y=0;y 1){var v=g.slice(0,_.index),w=g.slice(_.index+_.length);$=v.join(":")+"::"+w.join(":")}else $=g.join(":");return s&&($+="%"+s),$}return e}var G=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,K=void 0==="".match(/(){0}/)[1];function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?l:c;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var o=e.match(G);if(o){K?(r.scheme=o[1],r.userinfo=o[3],r.host=o[4],r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=o[7],r.fragment=o[8],isNaN(r.port)&&(r.port=o[5])):(r.scheme=o[1]||void 0,r.userinfo=-1!==e.indexOf("@")?o[3]:void 0,r.host=-1!==e.indexOf("//")?o[4]:void 0,r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=-1!==e.indexOf("?")?o[7]:void 0,r.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),r.host&&(r.host=B(z(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var s=L[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||s&&s.unicodeSupport)V(r,n);else{if(r.host&&(t.domainHost||s&&s.domainHost))try{r.host=q.toASCII(r.host.replace(n.PCT_ENCODED,H).toLowerCase())}catch(i){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+i}V(r,c)}s&&s.parse&&s.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function Z(e,t){var r=!1!==t.iri?l:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(B(z(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),("number"==typeof e.port||"string"==typeof e.port)&&(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var Y=/^\.\.?\//,Q=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(Y))e=e.replace(Y,"");else if(e.match(Q))e=e.replace(Q,"/");else if(e.match(X))e=e.replace(X,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(ee);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?l:c,n=[],o=L[(t.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,t),e.host&&!r.IPV6ADDRESS.test(e.host)&&(t.domainHost||o&&o.domainHost))try{e.host=t.iri?q.toUnicode(e.host):q.toASCII(e.host.replace(r.PCT_ENCODED,H).toLowerCase())}catch(a){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+a}V(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var s=Z(e,t);if(void 0!==s&&("suffix"!==t.reference&&n.push("//"),n.push(s),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var i=e.path;!t.absolutePath&&(!o||!o.absolutePath)&&(i=te(i)),void 0===s&&(i=i.replace(/^\/\//,"/%2F")),n.push(i)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=J(re(e,r),r),t=J(re(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=te(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=te(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=te(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function oe(e,t,r){var n=i({scheme:"null"},r);return re(ne(J(e,n),J(t,n),n,!0),n)}function se(e,t){return"string"==typeof e?e=re(J(e,t),t):"object"===n(e)&&(e=J(re(e,t),t)),e}function ie(e,t,r){return"string"==typeof e?e=re(J(e,r),r):"object"===n(e)&&(e=re(e,r)),"string"==typeof t?t=re(J(t,r),r):"object"===n(t)&&(t=re(t,r)),e===t}function ae(e,t){return e&&e.toString().replace(t&&t.iri?l.ESCAPE:c.ESCAPE,U)}function ce(e,t){return e&&e.toString().replace(t&&t.iri?l.PCT_ENCODED:c.PCT_ENCODED,H)}var le={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return(e.port===(r?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}},de={scheme:"https",domainHost:le.domainHost,parse:le.parse,serialize:le.serialize};function pe(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var ue={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=pe(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if((e.port===(pe(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),n=d(r,2),o=n[0],s=n[1];e.path=o&&"/"!==o?o:void 0,e.query=s,e.resourceName=void 0}return e.fragment=void 0,e}},he={scheme:"wss",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize},fe={},me="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ye=r(r("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+r("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+r("%"+ge+ge)),_e="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",$e=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),ve="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",we=new RegExp(me,"g"),be=new RegExp(ye,"g"),Pe=new RegExp(t("[^]",_e,"[\\.]",'[\\"]',$e),"g"),Ee=new RegExp(t("[^]",me,ve),"g"),Se=Ee;function ke(e){var t=H(e);return t.match(we)?t:e}var Te={scheme:"mailto",parse:function(e,t){var r=e,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var o=!1,s={},i=r.query.split("&"),a=0,c=i.length;a new RegExp(e,t);h.code="new RegExp";const f=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function _(e){var t,r,n,o,s,i,a,c,l,d,p,f,m,g,y,_,$,v,w,b,P,E,S,k,T;const R=e.strict,x=null===(t=e.code)||void 0===t?void 0:t.optimize,C=!0===x||void 0===x?1:x||0,N=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,j=null!==(o=e.uriResolver)&&void 0!==o?o:u.default;return{strictSchema:null===(i=null!==(s=e.strictSchema)&&void 0!==s?s:R)||void 0===i||i,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:R)||void 0===c||c,strictTypes:null!==(d=null!==(l=e.strictTypes)&&void 0!==l?l:R)&&void 0!==d?d:"log",strictTuples:null!==(f=null!==(p=e.strictTuples)&&void 0!==p?p:R)&&void 0!==f?f:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:R)&&void 0!==g&&g,code:e.code?{...e.code,optimize:C,regExp:N}:{optimize:C,regExp:N},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(_=e.loopEnum)&&void 0!==_?_:200,meta:null===($=e.meta)||void 0===$||$,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(P=e.addUsedSchema)||void 0===P||P,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(k=e.unicodeRegExp)||void 0===k||k,int32range:null===(T=e.int32range)||void 0===T||T,uriResolver:j}}class ${constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,..._(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return k;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),v.call(this,g,e,"NOT SUPPORTED"),v.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&P.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=p;"id"===r&&(n={...p},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),i.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await l.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new i.SchemaEnv({schema:{},schemaId:r});if(t=i.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(R.call(this,r,t),!t)return(0,d.eachItem)(r,(e=>x.call(this,e))),this;N.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===n.type.length?e=>x.call(this,e,n):e=>n.type.forEach((t=>x.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=O(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];(!t||t.test(r))&&("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:a}=this.opts;if("object"==typeof e)s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(s||r);const d=c.getSchemaRefs.call(this,e,r);return l=new i.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:d}),this._cache.set(l.schema,l),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),n&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=t}}}function v(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function P(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function S(){const e={...this.opts};for(const t of f)delete e[t];return e}e.default=$,$.ValidationError=n.default,$.MissingRefError=o.default;const k={log(){},warn(){},error(){}};const T=/^[a-z_$][a-z0-9_$:-]*$/i;function R(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!T.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function x(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let i=o?s.post:s.rules.find((({type:e})=>e===r));if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?C.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function C(e,t,r){const n=e.rules.findIndex((e=>e.keyword===r));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,j]}}}(core$2);var draft7={},core$1={},id={};Object.defineProperty(id,"__esModule",{value:!0});const def$s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};id.default=def$s;var ref={};Object.defineProperty(ref,"__esModule",{value:!0}),ref.callRef=ref.getValidate=void 0;const ref_error_1=ref_error,code_1$8=code,codegen_1$l=codegen,names_1$1=names$1,compile_1$1=compile,util_1$j=util,def$r={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:l}=s;if(("#"===r||"#/"===r)&&o===l.baseId)return function(){if(s===l)return callRef(e,i,s,s.$async);const r=t.scopeValue("root",{ref:l});return callRef(e,codegen_1$l._`${r}.validate`,l,l.$async)}();const d=compile_1$1.resolveRef.call(c,l,o,r);if(void 0===d)throw new ref_error_1.default(n.opts.uriResolver,o,r);return d instanceof compile_1$1.SchemaEnv?function(t){const r=getValidate(e,t);callRef(e,r,t,t.$async)}(d):function(n){const o=t.scopeValue("schema",!0===a.code.source?{ref:n,code:(0,codegen_1$l.stringify)(n)}:{ref:n}),s=t.name("valid"),i=e.subschema({schema:n,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:o,errSchemaPath:r},s);e.mergeEvaluated(i),e.ok(s)}(d)}};function getValidate(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):codegen_1$l._`${r.scopeValue("wrapper",{ref:t})}.validate`}function callRef(e,t,r,n){const{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?names_1$1.default.this:codegen_1$l.nil;function d(e){const t=codegen_1$l._`${e}.errors`;o.assign(names_1$1.default.vErrors,codegen_1$l._`${names_1$1.default.vErrors} === null ? ${t} : ${names_1$1.default.vErrors}.concat(${t})`),o.assign(names_1$1.default.errors,codegen_1$l._`${names_1$1.default.vErrors}.length`)}function p(e){var t;if(!s.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==s.props)if(n&&!n.dynamicProps)void 0!==n.props&&(s.props=util_1$j.mergeEvaluated.props(o,n.props,s.props));else{const t=o.var("props",codegen_1$l._`${e}.evaluated.props`);s.props=util_1$j.mergeEvaluated.props(o,t,s.props,codegen_1$l.Name)}if(!0!==s.items)if(n&&!n.dynamicItems)void 0!==n.items&&(s.items=util_1$j.mergeEvaluated.items(o,n.items,s.items));else{const t=o.var("items",codegen_1$l._`${e}.evaluated.items`);s.items=util_1$j.mergeEvaluated.items(o,t,s.items,codegen_1$l.Name)}}n?function(){if(!a.$async)throw new Error("async schema referenced by sync schema");const r=o.let("valid");o.try((()=>{o.code(codegen_1$l._`await ${(0,code_1$8.callValidateCode)(e,t,l)}`),p(t),i||o.assign(r,!0)}),(e=>{o.if(codegen_1$l._`!(${e} instanceof ${s.ValidationError})`,(()=>o.throw(e))),d(e),i||o.assign(r,!1)})),e.ok(r)}():e.result((0,code_1$8.callValidateCode)(e,t,l),(()=>p(t)),(()=>d(t)))}ref.getValidate=getValidate,ref.callRef=callRef,ref.default=def$r,Object.defineProperty(core$1,"__esModule",{value:!0});const id_1=id,ref_1=ref,core=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",id_1.default,ref_1.default];core$1.default=core;var validation$1={},limitNumber={};Object.defineProperty(limitNumber,"__esModule",{value:!0});const codegen_1$k=codegen,ops=codegen_1$k.operators,KWDs={maximum:{okStr:"<=",ok:ops.LTE,fail:ops.GT},minimum:{okStr:">=",ok:ops.GTE,fail:ops.LT},exclusiveMaximum:{okStr:"<",ok:ops.LT,fail:ops.GTE},exclusiveMinimum:{okStr:">",ok:ops.GT,fail:ops.LTE}},error$i={message:({keyword:e,schemaCode:t})=>codegen_1$k.str`must be ${KWDs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>codegen_1$k._`{comparison: ${KWDs[e].okStr}, limit: ${t}}`},def$q={keyword:Object.keys(KWDs),type:"number",schemaType:"number",$data:!0,error:error$i,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(codegen_1$k._`${r} ${KWDs[t].fail} ${n} || isNaN(${r})`)}};limitNumber.default=def$q;var multipleOf={};Object.defineProperty(multipleOf,"__esModule",{value:!0});const codegen_1$j=codegen,error$h={message:({schemaCode:e})=>codegen_1$j.str`must be multiple of ${e}`,params:({schemaCode:e})=>codegen_1$j._`{multipleOf: ${e}}`},def$p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:error$h,code(e){const{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?codegen_1$j._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:codegen_1$j._`${i} !== parseInt(${i})`;e.fail$data(codegen_1$j._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};multipleOf.default=def$p;var limitLength={},ucs2length$1={};function ucs2length(e){const t=e.length;let r,n=0,o=0;for(;o =55296&&r<=56319&&o codegen_1$i._`{limit: ${e}}`},def$o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:error$g,code(e){const{keyword:t,data:r,schemaCode:n,it:o}=e,s="maxLength"===t?codegen_1$i.operators.GT:codegen_1$i.operators.LT,i=!1===o.opts.unicode?codegen_1$i._`${r}.length`:codegen_1$i._`${(0,util_1$i.useFunc)(e.gen,ucs2length_1.default)}(${r})`;e.fail$data(codegen_1$i._`${i} ${s} ${n}`)}};limitLength.default=def$o;var pattern={};Object.defineProperty(pattern,"__esModule",{value:!0});const code_1$7=code,codegen_1$h=codegen,error$f={message:({schemaCode:e})=>codegen_1$h.str`must match pattern "${e}"`,params:({schemaCode:e})=>codegen_1$h._`{pattern: ${e}}`},def$n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:error$f,code(e){const{data:t,$data:r,schema:n,schemaCode:o,it:s}=e,i=s.opts.unicodeRegExp?"u":"",a=r?codegen_1$h._`(new RegExp(${o}, ${i}))`:(0,code_1$7.usePattern)(e,n);e.fail$data(codegen_1$h._`!${a}.test(${t})`)}};pattern.default=def$n;var limitProperties={};Object.defineProperty(limitProperties,"__esModule",{value:!0});const codegen_1$g=codegen,error$e={message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return codegen_1$g.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>codegen_1$g._`{limit: ${e}}`},def$m={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:error$e,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxProperties"===t?codegen_1$g.operators.GT:codegen_1$g.operators.LT;e.fail$data(codegen_1$g._`Object.keys(${r}).length ${o} ${n}`)}};limitProperties.default=def$m;var required={};Object.defineProperty(required,"__esModule",{value:!0});const code_1$6=code,codegen_1$f=codegen,util_1$h=util,error$d={message:({params:{missingProperty:e}})=>codegen_1$f.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>codegen_1$f._`{missingProperty: ${e}}`},def$l={keyword:"required",type:"object",schemaType:"array",$data:!0,error:error$d,code(e){const{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&0===r.length)return;const c=r.length>=a.loopRequired;if(i.allErrors?function(){if(c||s)e.block$data(codegen_1$f.nil,l);else for(const t of r)(0,code_1$6.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(c||s){const r=t.let("valid",!0);e.block$data(r,(()=>function(r,s){e.setParams({missingProperty:r}),t.forOf(r,n,(()=>{t.assign(s,(0,code_1$6.propertyInData)(t,o,r,a.ownProperties)),t.if((0,codegen_1$f.not)(s),(()=>{e.error(),t.break()}))}),codegen_1$f.nil)}(i,r))),e.ok(r)}else t.if((0,code_1$6.checkMissingProp)(e,r,i)),(0,code_1$6.reportMissingProp)(e,i),t.else()}(),a.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${i.schemaEnv.baseId+i.errSchemaPath}" (strictRequired)`;(0,util_1$h.checkStrictMode)(i,t,i.opts.strictRequired)}}function l(){t.forOf("prop",n,(r=>{e.setParams({missingProperty:r}),t.if((0,code_1$6.noPropertyInData)(t,o,r,a.ownProperties),(()=>e.error()))}))}}};required.default=def$l;var limitItems={};Object.defineProperty(limitItems,"__esModule",{value:!0});const codegen_1$e=codegen,error$c={message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return codegen_1$e.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>codegen_1$e._`{limit: ${e}}`},def$k={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:error$c,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxItems"===t?codegen_1$e.operators.GT:codegen_1$e.operators.LT;e.fail$data(codegen_1$e._`${r}.length ${o} ${n}`)}};limitItems.default=def$k;var uniqueItems={},equal$1={};Object.defineProperty(equal$1,"__esModule",{value:!0});const equal=fastDeepEqual;equal.code='require("ajv/dist/runtime/equal").default',equal$1.default=equal,Object.defineProperty(uniqueItems,"__esModule",{value:!0});const dataType_1=dataType,codegen_1$d=codegen,util_1$g=util,equal_1$2=equal$1,error$b={message:({params:{i:e,j:t}})=>codegen_1$d.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>codegen_1$d._`{i: ${e}, j: ${t}}`},def$j={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:error$b,code(e){const{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;const c=t.let("valid"),l=s.items?(0,dataType_1.getSchemaTypes)(s.items):[];function d(n,o){const s=t.name("item"),i=(0,dataType_1.checkDataTypes)(l,s,a.opts.strictNumbers,dataType_1.DataType.Wrong),d=t.const("indices",codegen_1$d._`{}`);t.for(codegen_1$d._`;${n}--;`,(()=>{t.let(s,codegen_1$d._`${r}[${n}]`),t.if(i,codegen_1$d._`continue`),l.length>1&&t.if(codegen_1$d._`typeof ${s} == "string"`,codegen_1$d._`${s} += "_"`),t.if(codegen_1$d._`typeof ${d}[${s}] == "number"`,(()=>{t.assign(o,codegen_1$d._`${d}[${s}]`),e.error(),t.assign(c,!1).break()})).code(codegen_1$d._`${d}[${s}] = ${n}`)}))}function p(n,o){const s=(0,util_1$g.useFunc)(t,equal_1$2.default),i=t.name("outer");t.label(i).for(codegen_1$d._`;${n}--;`,(()=>t.for(codegen_1$d._`${o} = ${n}; ${o}--;`,(()=>t.if(codegen_1$d._`${s}(${r}[${n}], ${r}[${o}])`,(()=>{e.error(),t.assign(c,!1).break(i)}))))))}e.block$data(c,(function(){const n=t.let("i",codegen_1$d._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(c,!0),t.if(codegen_1$d._`${n} > 1`,(()=>(l.length>0&&!l.some((e=>"object"===e||"array"===e))?d:p)(n,o)))}),codegen_1$d._`${i} === false`),e.ok(c)}};uniqueItems.default=def$j;var _const={};Object.defineProperty(_const,"__esModule",{value:!0});const codegen_1$c=codegen,util_1$f=util,equal_1$1=equal$1,error$a={message:"must be equal to constant",params:({schemaCode:e})=>codegen_1$c._`{allowedValue: ${e}}`},def$i={keyword:"const",$data:!0,error:error$a,code(e){const{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&"object"==typeof s?e.fail$data(codegen_1$c._`!${(0,util_1$f.useFunc)(t,equal_1$1.default)}(${r}, ${o})`):e.fail(codegen_1$c._`${s} !== ${r}`)}};_const.default=def$i;var _enum={};Object.defineProperty(_enum,"__esModule",{value:!0});const codegen_1$b=codegen,util_1$e=util,equal_1=equal$1,error$9={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>codegen_1$b._`{allowedValues: ${e}}`},def$h={keyword:"enum",schemaType:"array",$data:!0,error:error$9,code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&0===o.length)throw new Error("enum must have non-empty array");const a=o.length>=i.opts.loopEnum;let c;const l=()=>c??(c=(0,util_1$e.useFunc)(t,equal_1.default));let d;if(a||n)d=t.let("valid"),e.block$data(d,(function(){t.assign(d,!1),t.forOf("v",s,(e=>t.if(codegen_1$b._`${l()}(${r}, ${e})`,(()=>t.assign(d,!0).break()))))}));else{if(!Array.isArray(o))throw new Error("ajv implementation error");const e=t.const("vSchema",s);d=(0,codegen_1$b.or)(...o.map(((t,n)=>function(e,t){const n=o[t];return"object"==typeof n&&null!==n?codegen_1$b._`${l()}(${r}, ${e}[${t}])`:codegen_1$b._`${r} === ${n}`}(e,n))))}e.pass(d)}};_enum.default=def$h,Object.defineProperty(validation$1,"__esModule",{value:!0});const limitNumber_1=limitNumber,multipleOf_1=multipleOf,limitLength_1=limitLength,pattern_1=pattern,limitProperties_1=limitProperties,required_1=required,limitItems_1=limitItems,uniqueItems_1=uniqueItems,const_1=_const,enum_1=_enum,validation=[limitNumber_1.default,multipleOf_1.default,limitLength_1.default,pattern_1.default,limitProperties_1.default,required_1.default,limitItems_1.default,uniqueItems_1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},const_1.default,enum_1.default];validation$1.default=validation;var applicator={},additionalItems={};Object.defineProperty(additionalItems,"__esModule",{value:!0}),additionalItems.validateAdditionalItems=void 0;const codegen_1$a=codegen,util_1$d=util,error$8={message:({params:{len:e}})=>codegen_1$a.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>codegen_1$a._`{limit: ${e}}`},def$g={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:error$8,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?validateAdditionalItems(e,n):(0,util_1$d.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;const a=r.const("len",codegen_1$a._`${o}.length`);if(!1===n)e.setParams({len:t.length}),e.pass(codegen_1$a._`${a} <= ${t.length}`);else if("object"==typeof n&&!(0,util_1$d.alwaysValidSchema)(i,n)){const n=r.var("valid",codegen_1$a._`${a} <= ${t.length}`);r.if((0,codegen_1$a.not)(n),(()=>function(n){r.forRange("i",t.length,a,(t=>{e.subschema({keyword:s,dataProp:t,dataPropType:util_1$d.Type.Num},n),i.allErrors||r.if((0,codegen_1$a.not)(n),(()=>r.break()))}))}(n))),e.ok(n)}}additionalItems.validateAdditionalItems=validateAdditionalItems,additionalItems.default=def$g;var prefixItems={},items={};Object.defineProperty(items,"__esModule",{value:!0}),items.validateTuple=void 0;const codegen_1$9=codegen,util_1$c=util,code_1$5=code,def$f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=!0,!(0,util_1$c.alwaysValidSchema)(r,t)&&e.ok((0,code_1$5.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;(function(e){const{opts:n,errSchemaPath:o}=a,s=r.length,c=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(n.strictTuples&&!c){const e=`"${i}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,util_1$c.checkStrictMode)(a,e,n.strictTuples)}})(o),a.opts.unevaluated&&r.length&&!0!==a.items&&(a.items=util_1$c.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),l=n.const("len",codegen_1$9._`${s}.length`);r.forEach(((t,r)=>{(0,util_1$c.alwaysValidSchema)(a,t)||(n.if(codegen_1$9._`${l} > ${r}`,(()=>e.subschema({keyword:i,schemaProp:r,dataProp:r},c))),e.ok(c))}))}items.validateTuple=validateTuple,items.default=def$f,Object.defineProperty(prefixItems,"__esModule",{value:!0});const items_1$1=items,def$e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,items_1$1.validateTuple)(e,"items")};prefixItems.default=def$e;var items2020={};Object.defineProperty(items2020,"__esModule",{value:!0});const codegen_1$8=codegen,util_1$b=util,code_1$4=code,additionalItems_1$1=additionalItems,error$7={message:({params:{len:e}})=>codegen_1$8.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>codegen_1$8._`{limit: ${e}}`},def$d={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:error$7,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,util_1$b.alwaysValidSchema)(n,t)&&(o?(0,additionalItems_1$1.validateAdditionalItems)(e,o):e.ok((0,code_1$4.validateArray)(e)))}};items2020.default=def$d;var contains={};Object.defineProperty(contains,"__esModule",{value:!0});const codegen_1$7=codegen,util_1$a=util,error$6={message:({params:{min:e,max:t}})=>void 0===t?codegen_1$7.str`must contain at least ${e} valid item(s)`:codegen_1$7.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?codegen_1$7._`{minContains: ${e}}`:codegen_1$7._`{minContains: ${e}, maxContains: ${t}}`},def$c={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:error$6,code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;let i,a;const{minContains:c,maxContains:l}=n;s.opts.next?(i=void 0===c?1:c,a=l):i=1;const d=t.const("len",codegen_1$7._`${o}.length`);if(e.setParams({min:i,max:a}),void 0===a&&0===i)return void(0,util_1$a.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&i>a)return(0,util_1$a.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,util_1$a.alwaysValidSchema)(s,r)){let t=codegen_1$7._`${d} >= ${i}`;return void 0!==a&&(t=codegen_1$7._`${t} && ${d} <= ${a}`),void e.pass(t)}s.items=!0;const p=t.name("valid");function u(){const e=t.name("_valid"),r=t.let("count",0);h(e,(()=>t.if(e,(()=>function(e){t.code(codegen_1$7._`${e}++`),void 0===a?t.if(codegen_1$7._`${e} >= ${i}`,(()=>t.assign(p,!0).break())):(t.if(codegen_1$7._`${e} > ${a}`,(()=>t.assign(p,!1).break())),1===i?t.assign(p,!0):t.if(codegen_1$7._`${e} >= ${i}`,(()=>t.assign(p,!0))))}(r)))))}function h(r,n){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:util_1$a.Type.Num,compositeRule:!0},r),n()}))}void 0===a&&1===i?h(p,(()=>t.if(p,(()=>t.break())))):0===i?(t.let(p,!0),void 0!==a&&t.if(codegen_1$7._`${o}.length > 0`,u)):(t.let(p,!1),u()),e.result(p,(()=>e.reset()))}};contains.default=def$c;var dependencies={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=codegen,r=util,n=code;e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e}, + missingProperty: ${o}, + depsCount: ${r}, + deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),i(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:i}=e;if(0===Object.keys(r).length)return;const a=o.let("missing");for(const c in r){const l=r[c];if(0===l.length)continue;const d=(0,n.propertyInData)(o,s,c,i.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),i.allErrors?o.if(d,(()=>{for(const t of l)(0,n.checkReportMissingProp)(e,t)})):(o.if(t._`${d} && (${(0,n.checkMissingProp)(e,l,a)})`),(0,n.reportMissingProp)(e,a),o.else())}}function i(e,t=e.schema){const{gen:o,data:s,keyword:i,it:a}=e,c=o.name("valid");for(const l in t)(0,r.alwaysValidSchema)(a,t[l])||(o.if((0,n.propertyInData)(o,s,l,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:i,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(()=>o.var(c,!0))),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=i,e.default=o}(dependencies);var propertyNames={};Object.defineProperty(propertyNames,"__esModule",{value:!0});const codegen_1$6=codegen,util_1$9=util,error$5={message:"property name must be valid",params:({params:e})=>codegen_1$6._`{propertyName: ${e.propertyName}}`},def$b={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:error$5,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,util_1$9.alwaysValidSchema)(o,r))return;const s=t.name("valid");t.forIn("key",n,(r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),t.if((0,codegen_1$6.not)(s),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(s)}};propertyNames.default=def$b;var additionalProperties={};Object.defineProperty(additionalProperties,"__esModule",{value:!0});const code_1$3=code,codegen_1$5=codegen,names_1=names$1,util_1$8=util,error$4={message:"must NOT have additional properties",params:({params:e})=>codegen_1$5._`{additionalProperty: ${e.additionalProperty}}`},def$a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:error$4,code(e){const{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=i;if(i.props=!0,"all"!==c.removeAdditional&&(0,util_1$8.alwaysValidSchema)(i,r))return;const l=(0,code_1$3.allSchemaProperties)(n.properties),d=(0,code_1$3.allSchemaProperties)(n.patternProperties);function p(e){t.code(codegen_1$5._`delete ${o}[${e}]`)}function u(n){if("all"===c.removeAdditional||c.removeAdditional&&!1===r)p(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(a||t.break());if("object"==typeof r&&!(0,util_1$8.alwaysValidSchema)(i,r)){const r=t.name("valid");"failing"===c.removeAdditional?(h(n,r,!1),t.if((0,codegen_1$5.not)(r),(()=>{e.reset(),p(n)}))):(h(n,r),a||t.if((0,codegen_1$5.not)(r),(()=>t.break())))}}}function h(t,r,n){const o={keyword:"additionalProperties",dataProp:t,dataPropType:util_1$8.Type.Str};!1===n&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(o,r)}t.forIn("key",o,(r=>{l.length||d.length?t.if(function(r){let o;if(l.length>8){const e=(0,util_1$8.schemaRefOrVal)(i,n.properties,"properties");o=(0,code_1$3.isOwnProperty)(t,e,r)}else o=l.length?(0,codegen_1$5.or)(...l.map((e=>codegen_1$5._`${r} === ${e}`))):codegen_1$5.nil;return d.length&&(o=(0,codegen_1$5.or)(o,...d.map((t=>codegen_1$5._`${(0,code_1$3.usePattern)(e,t)}.test(${r})`)))),(0,codegen_1$5.not)(o)}(r),(()=>u(r))):u(r)})),e.ok(codegen_1$5._`${s} === ${names_1.default.errors}`)}};additionalProperties.default=def$a;var properties$1={};Object.defineProperty(properties$1,"__esModule",{value:!0});const validate_1=validate,code_1$2=code,util_1$7=util,additionalProperties_1$1=additionalProperties,def$9={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;"all"===s.opts.removeAdditional&&void 0===n.additionalProperties&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(s,additionalProperties_1$1.default,"additionalProperties"));const i=(0,code_1$2.allSchemaProperties)(r);for(const p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&!0!==s.props&&(s.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(i),s.props));const a=i.filter((e=>!(0,util_1$7.alwaysValidSchema)(s,r[e])));if(0===a.length)return;const c=t.name("valid");for(const p of a)l(p)?d(p):(t.if((0,code_1$2.propertyInData)(t,o,p,s.opts.ownProperties)),d(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function l(e){return s.opts.useDefaults&&!s.compositeRule&&void 0!==r[e].default}function d(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}};properties$1.default=def$9;var patternProperties={};Object.defineProperty(patternProperties,"__esModule",{value:!0});const code_1$1=code,codegen_1$4=codegen,util_1$6=util,util_2=util,def$8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,code_1$1.allSchemaProperties)(r),c=a.filter((e=>(0,util_1$6.alwaysValidSchema)(s,r[e])));if(0===a.length||c.length===a.length&&(!s.opts.unevaluated||!0===s.props))return;const l=i.strictSchema&&!i.allowMatchingProperties&&o.properties,d=t.name("valid");!0!==s.props&&!(s.props instanceof codegen_1$4.Name)&&(s.props=(0,util_2.evaluatedPropsToName)(t,s.props));const{props:p}=s;function u(e){for(const t in l)new RegExp(e).test(t)&&(0,util_1$6.checkStrictMode)(s,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function h(r){t.forIn("key",n,(n=>{t.if(codegen_1$4._`${(0,code_1$1.usePattern)(e,r)}.test(${n})`,(()=>{const o=c.includes(r);o||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:util_2.Type.Str},d),s.opts.unevaluated&&!0!==p?t.assign(codegen_1$4._`${p}[${n}]`,!0):!o&&!s.allErrors&&t.if((0,codegen_1$4.not)(d),(()=>t.break()))}))}))}!function(){for(const e of a)l&&u(e),s.allErrors?h(e):(t.var(d,!0),h(e),t.if(d))}()}};patternProperties.default=def$8;var not={};Object.defineProperty(not,"__esModule",{value:!0});const util_1$5=util,def$7={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,util_1$5.alwaysValidSchema)(n,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};not.default=def$7;var anyOf={};Object.defineProperty(anyOf,"__esModule",{value:!0});const code_1=code,def$6={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:code_1.validateUnion,error:{message:"must match a schema in anyOf"}};anyOf.default=def$6;var oneOf={};Object.defineProperty(oneOf,"__esModule",{value:!0});const codegen_1$3=codegen,util_1$4=util,error$3={message:"must match exactly one schema in oneOf",params:({params:e})=>codegen_1$3._`{passingSchemas: ${e.passing}}`},def$5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:error$3,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block((function(){s.forEach(((r,n)=>{let s;(0,util_1$4.alwaysValidSchema)(o,r)?t.var(c,!0):s=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&t.if(codegen_1$3._`${c} && ${i}`).assign(i,!1).assign(a,codegen_1$3._`[${a}, ${n}]`).else(),t.if(c,(()=>{t.assign(i,!0),t.assign(a,n),s&&e.mergeEvaluated(s,codegen_1$3.Name)}))}))})),e.result(i,(()=>e.reset()),(()=>e.error(!0)))}};oneOf.default=def$5;var allOf={};Object.defineProperty(allOf,"__esModule",{value:!0});const util_1$3=util,def$4={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach(((t,r)=>{if((0,util_1$3.alwaysValidSchema)(n,t))return;const s=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(s)}))}};allOf.default=def$4;var _if={};Object.defineProperty(_if,"__esModule",{value:!0});const codegen_1$2=codegen,util_1$2=util,error$2={message:({params:e})=>codegen_1$2.str`must match "${e.ifClause}" schema`,params:({params:e})=>codegen_1$2._`{failingKeyword: ${e.ifClause}}`},def$3={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:error$2,code(e){const{gen:t,parentSchema:r,it:n}=e;void 0===r.then&&void 0===r.else&&(0,util_1$2.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const o=hasSchema(n,"then"),s=hasSchema(n,"else");if(!o&&!s)return;const i=t.let("valid",!0),a=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(t)}(),e.reset(),o&&s){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(a,c("then",r),c("else",r))}else o?t.if(a,c("then")):t.if((0,codegen_1$2.not)(a),c("else"));function c(r,n){return()=>{const o=e.subschema({keyword:r},a);t.assign(i,a),e.mergeValidEvaluated(o,i),n?t.assign(n,codegen_1$2._`${r}`):e.setParams({ifClause:r})}}e.pass(i,(()=>e.error(!0)))}};function hasSchema(e,t){const r=e.schema[t];return void 0!==r&&!(0,util_1$2.alwaysValidSchema)(e,r)}_if.default=def$3;var thenElse={};Object.defineProperty(thenElse,"__esModule",{value:!0});const util_1$1=util,def$2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,util_1$1.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};thenElse.default=def$2,Object.defineProperty(applicator,"__esModule",{value:!0});const additionalItems_1=additionalItems,prefixItems_1=prefixItems,items_1=items,items2020_1=items2020,contains_1=contains,dependencies_1=dependencies,propertyNames_1=propertyNames,additionalProperties_1=additionalProperties,properties_1=properties$1,patternProperties_1=patternProperties,not_1=not,anyOf_1=anyOf,oneOf_1=oneOf,allOf_1=allOf,if_1=_if,thenElse_1=thenElse;function getApplicator(e=!1){const t=[not_1.default,anyOf_1.default,oneOf_1.default,allOf_1.default,if_1.default,thenElse_1.default,propertyNames_1.default,additionalProperties_1.default,dependencies_1.default,properties_1.default,patternProperties_1.default];return e?t.push(prefixItems_1.default,items2020_1.default):t.push(additionalItems_1.default,items_1.default),t.push(contains_1.default),t}applicator.default=getApplicator;var format$2={},format$1={};Object.defineProperty(format$1,"__esModule",{value:!0});const codegen_1$1=codegen,error$1={message:({schemaCode:e})=>codegen_1$1.str`must match format "${e}"`,params:({schemaCode:e})=>codegen_1$1._`{format: ${e}}`},def$1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:error$1,code(e,t){const{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:d,self:p}=a;c.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),s=r.const("fDef",codegen_1$1._`${o}[${i}]`),a=r.let("fType"),l=r.let("format");r.if(codegen_1$1._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,(()=>r.assign(a,codegen_1$1._`${s}.type || "string"`).assign(l,codegen_1$1._`${s}.validate`)),(()=>r.assign(a,codegen_1$1._`"string"`).assign(l,s))),e.fail$data((0,codegen_1$1.or)(!1===c.strictSchema?codegen_1$1.nil:codegen_1$1._`${i} && !${l}`,function(){const e=d.$async?codegen_1$1._`(${s}.async ? await ${l}(${n}) : ${l}(${n}))`:codegen_1$1._`${l}(${n})`,r=codegen_1$1._`(typeof ${l} == "function" ? ${e} : ${l}.test(${n}))`;return codegen_1$1._`${l} && ${l} !== true && ${a} === ${t} && !${r}`}()))}():function(){const o=p.formats[s];if(!o)return void function(){if(!1===c.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===o)return;const[i,a,u]=function(e){const t=e instanceof RegExp?(0,codegen_1$1.regexpCode)(e):c.code.formats?codegen_1$1._`${c.code.formats}${(0,codegen_1$1.getProperty)(s)}`:void 0,n=r.scopeValue("formats",{key:s,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,n]:[e.type||"string",e.validate,codegen_1$1._`${n}.validate`]}(o);i===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!d.$async)throw new Error("async format in sync schema");return codegen_1$1._`await ${u}(${n})`}return"function"==typeof a?codegen_1$1._`${u}(${n})`:codegen_1$1._`${u}.test(${n})`}())}())}};format$1.default=def$1,Object.defineProperty(format$2,"__esModule",{value:!0});const format_1$1=format$1,format=[format_1$1.default];format$2.default=format;var metadata={};Object.defineProperty(metadata,"__esModule",{value:!0}),metadata.contentVocabulary=metadata.metadataVocabulary=void 0,metadata.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],metadata.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(draft7,"__esModule",{value:!0});const core_1=core$1,validation_1=validation$1,applicator_1=applicator,format_1=format$2,metadata_1=metadata,draft7Vocabularies=[core_1.default,validation_1.default,(0,applicator_1.default)(),format_1.default,metadata_1.metadataVocabulary,metadata_1.contentVocabulary];draft7.default=draft7Vocabularies;var discriminator={},types={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))}(types),Object.defineProperty(discriminator,"__esModule",{value:!0});const codegen_1=codegen,types_1=types,compile_1=compile,util_1=util,error={message:({params:{discrError:e,tagName:t}})=>e===types_1.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>codegen_1._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},def={keyword:"discriminator",type:"object",schemaType:"object",error:error,code(e){const{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=n.propertyName;if("string"!=typeof a)throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),l=t.const("tag",codegen_1._`${r}${(0,codegen_1.getProperty)(a)}`);function d(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,codegen_1.Name),n}t.if(codegen_1._`typeof ${l} == "string"`,(()=>function(){const r=function(){var e;const t={},r=c(o);let n=!0;for(let o=0;o e.error(!1,{discrError:types_1.DiscrError.Tag,tag:l,tagName:a}))),e.ok(c)}};discriminator.default=def;const $schema$1="http://json-schema.org/draft-07/schema#",$id="http://json-schema.org/draft-07/schema#",title="Core schema meta-schema",definitions$1={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type=["object","boolean"],properties={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},require$$3={$schema:$schema$1,$id:$id,title:title,definitions:definitions$1,type:type,properties:properties,default:!0};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=core$2,n=draft7,o=discriminator,s=require$$3,i=["/properties"],a="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(e,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var d=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var u=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(ajv$1,ajv$1.exports);var ajvExports=ajv$1.exports;const Ajv=getDefaultExportFromCjs(ajvExports),$schema="http://json-schema.org/schema",$ref="#/definitions/Blueprint",definitions={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",enum:["kitchen-sink","light"]},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:"The method of defining the constants. Possible values are:\n\n- rewrite-wp-config: Default. Rewrites the wp-config.php file to explicitly call define() with the requested name and value. This method alters the file on the disk, but it doesn't conflict with existing define() calls in wp-config.php.\n- define-before-run: Defines the constant before running the requested script. It doesn't alter any files on the disk, but constants defined this way may conflict with existing define() calls in wp-config.php."},virtualize:{type:"boolean",deprecated:"This option is noop and will be removed in a future version.\nThis option is only kept in here to avoid breaking Blueprint schema validation\nfor existing apps using this option."}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWxr"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1}]}}],description:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},blueprintSchema={$schema:$schema,$ref:$ref,definitions:definitions},{wpCLI:wpCLI,...otherStepHandlers}=allStepHandlers,keyedStepHandlers={...otherStepHandlers,"wp-cli":wpCLI,importFile:otherStepHandlers.importWxr};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=(()=>{})}={}){var o,s,i,a,c,l,d;e={...e,steps:(e.steps||[]).filter(isStepDefinition).filter(isStepStillSupported)};for(const _ of e.steps)"object"==typeof _&&"importFile"===_.step&&(_.step="importWxr",logger.warn('The "importFile" step is deprecated. Use "importWxr" instead.'));if(e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const t=e.plugins.map((e=>"string"==typeof e?e.startsWith("https://")?{resource:"url",url:e}:{resource:"wordpress.org/plugins",slug:e}:e)).map((e=>({step:"installPlugin",pluginZipFile:e})));e.steps.unshift(...t)}e.login&&e.steps.push({step:"login",...!0===e.login?{username:"admin",password:"password"}:e.login}),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles||(e.phpExtensionBundles=[]),0===e.phpExtensionBundles.length&&e.phpExtensionBundles.push("kitchen-sink");const p=null==(o=e.steps)?void 0:o.findIndex((e=>"object"==typeof e&&"wp-cli"===(null==e?void 0:e.step)));void 0!==p&&p>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter((e=>"light"!==e)),logger.warn("The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),null==(s=e.steps)||s.splice(p,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const u=null==(i=e.steps)?void 0:i.findIndex((e=>"object"==typeof e&&"importWxr"===(null==e?void 0:e.step)));void 0!==u&&u>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter((e=>"light"!==e)),logger.warn("The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),null==(a=e.steps)||a.splice(u,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:h,errors:f}=validateBlueprint(e);if(!h){const e=new Error(`Invalid blueprint: ${f[0].message} at ${f[0].instancePath}`);throw e.errors=f,e}const m=e.steps||[],g=m.reduce(((e,t)=>{var r;return e+((null==(r=t.progress)?void 0:r.weight)||1)}),0),y=m.map((e=>compileStep(e,{semaphore:r,rootProgressTracker:t,totalProgressWeight:g})));return{versions:{php:compileVersion(null==(c=e.preferredVersions)?void 0:c.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:(null==(l=e.preferredVersions)?void 0:l.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:(null==(d=e.features)?void 0:d.networking)??!1},run:async r=>{try{for(const{resources:e}of y)for(const t of e)t.setPlayground(r),t.isAsync&&t.resolve();for(const[e,{run:t,step:s}]of Object.entries(y))try{const e=await t(r);n(e,s)}catch(o){throw logger.error(o),new Error(`Error when executing the blueprint step #${e} (${JSON.stringify(s)}) ${o instanceof Error?`: ${o.message}`:o}`,{cause:o})}}finally{try{await r.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const ajv=new Ajv({discriminator:!0});let blueprintValidator;function validateBlueprint(e){var t;blueprintValidator=ajv.compile(blueprintSchema);const r=blueprintValidator(e);if(r)return{valid:r};const n=new Set;for(const o of blueprintValidator.errors)o.schemaPath.startsWith("#/properties/steps/items/anyOf")||n.add(o.instancePath);return{valid:r,errors:null==(t=blueprintValidator.errors)?void 0:t.filter((e=>!(e.schemaPath.startsWith("#/properties/steps/items/anyOf")&&n.has(e.instancePath))))}}function compileVersion(e,t,r){return e&&t.includes(e)?e:r}function compilePHPExtensions(e,t){const r=SupportedPHPExtensionsList.filter((t=>e.includes(t))),n=t.flatMap((e=>e in SupportedPHPExtensionBundles?SupportedPHPExtensionBundles[e]:[]));return Array.from(new Set([...r,...n]))}function isStepDefinition(e){return!("object"!=typeof e||!e)}function isStepStillSupported(e){return"setPhpIniEntry"!==e.step||(logger.warn('The "setPhpIniEntry" Blueprint is no longer supported and you can remove it from your Blueprint.'),!1)}function compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var o;const s=r.stage(((null==(o=e.progress)?void 0:o.weight)||1)/n),i={};for(const d of Object.keys(e)){let r=e[d];isFileReference(r)&&(r=Resource.create(r,{semaphore:t})),i[d]=r}const a=getResources(i),c=getResources(i).filter((e=>e.isAsync)),l=1/(c.length+1);for(const d of c)d.progress=s.stage(l);return{run:async t=>{var r;try{return s.fillSlowly(),await keyedStepHandlers[e.step](t,await resolveArguments(i),{tracker:s,initialCaption:null==(r=e.progress)?void 0:r.caption})}finally{s.finish()}},step:e,resources:a}}function getResources(e){const t=[];for(const r in e){const n=e[r];n instanceof Resource&&t.push(n)}return t}async function resolveArguments(e){const t={};for(const r in e){const n=e[r];t[r]=n instanceof Resource?await n.resolve():n}return t}async function runBlueprintSteps(e,t){await e.run(t)}function setPluginProxyURL(){}const proxyMarker=Symbol("Comlink.proxy"),createEndpoint=Symbol("Comlink.endpoint"),releaseProxy=Symbol("Comlink.releaseProxy"),finalizer=Symbol("Comlink.finalizer"),throwMarker=Symbol("Comlink.thrown"),isObject=e=>"object"==typeof e&&null!==e||"function"==typeof e,proxyTransferHandler={canHandle:e=>isObject(e)&&e[proxyMarker],serialize(e){const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize:e=>(e.start(),wrap(e))},throwTransferHandler={canHandle:e=>isObject(e)&&throwMarker in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},transferHandlers=new Map([["proxy",proxyTransferHandler],["throw",throwTransferHandler]]);function isAllowedOrigin(e,t){for(const r of e)if(t===r||"*"===r||r instanceof RegExp&&r.test(t))return!0;return!1}function expose(e,t=globalThis,r=["*"]){t.addEventListener("message",(function n(o){if(!o||!o.data)return;if(!isAllowedOrigin(r,o.origin))return void console.warn(`Invalid origin '${o.origin}' for comlink proxy`);const{id:s,type:i,path:a}=Object.assign({path:[]},o.data),c=(o.data.argumentList||[]).map(fromWireValue);let l;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),r=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":l=r;break;case"SET":t[a.slice(-1)[0]]=fromWireValue(o.data.value),l=!0;break;case"APPLY":l=r.apply(t,c);break;case"CONSTRUCT":l=proxy(new r(...c));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;expose(e,r),l=transfer(t,[t])}break;case"RELEASE":l=void 0;break;default:return}}catch(d){l={value:d,[throwMarker]:0}}Promise.resolve(l).catch((e=>({value:e,[throwMarker]:0}))).then((r=>{const[o,a]=toWireValue(r);t.postMessage(Object.assign(Object.assign({},o),{id:s}),a),"RELEASE"===i&&(t.removeEventListener("message",n),closeEndPoint(t),finalizer in e&&"function"==typeof e[finalizer]&&e[finalizer]())})).catch((e=>{const[r,n]=toWireValue({value:new TypeError("Unserializable return value"),[throwMarker]:0});t.postMessage(Object.assign(Object.assign({},r),{id:s}),n)}))})),t.start&&t.start()}function isMessagePort(e){return"MessagePort"===e.constructor.name}function closeEndPoint(e){isMessagePort(e)&&e.close()}function wrap(e,t){return createProxy(e,[],t)}function throwIfProxyReleased(e){if(e)throw new Error("Proxy has been released and is not useable")}function releaseEndpoint(e){return requestResponseMessage(e,{type:"RELEASE"}).then((()=>{closeEndPoint(e)}))}const proxyCounter=new WeakMap,proxyFinalizers="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(proxyCounter.get(e)||0)-1;proxyCounter.set(e,t),0===t&&releaseEndpoint(e)}));function registerProxy(e,t){const r=(proxyCounter.get(t)||0)+1;proxyCounter.set(t,r),proxyFinalizers&&proxyFinalizers.register(e,t,e)}function unregisterProxy(e){proxyFinalizers&&proxyFinalizers.unregister(e)}function createProxy(e,t=[],r=function(){}){let n=!1;const o=new Proxy(r,{get(r,s){if(throwIfProxyReleased(n),s===releaseProxy)return()=>{unregisterProxy(o),releaseEndpoint(e),n=!0};if("then"===s){if(0===t.length)return{then:()=>o};const r=requestResponseMessage(e,{type:"GET",path:t.map((e=>e.toString()))}).then(fromWireValue);return r.then.bind(r)}return createProxy(e,[...t,s])},set(r,o,s){throwIfProxyReleased(n);const[i,a]=toWireValue(s);return requestResponseMessage(e,{type:"SET",path:[...t,o].map((e=>e.toString())),value:i},a).then(fromWireValue)},apply(r,o,s){throwIfProxyReleased(n);const i=t[t.length-1];if(i===createEndpoint)return requestResponseMessage(e,{type:"ENDPOINT"}).then(fromWireValue);if("bind"===i)return createProxy(e,t.slice(0,-1));const[a,c]=processArguments(s);return requestResponseMessage(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(fromWireValue)},construct(r,o){throwIfProxyReleased(n);const[s,i]=processArguments(o);return requestResponseMessage(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},i).then(fromWireValue)}});return registerProxy(o,e),o}function myFlat(e){return Array.prototype.concat.apply([],e)}function processArguments(e){const t=e.map(toWireValue);return[t.map((e=>e[0])),myFlat(t.map((e=>e[1])))]}const transferCache=new WeakMap;function transfer(e,t){return transferCache.set(e,t),e}function proxy(e){return Object.assign(e,{[proxyMarker]:!0})}function windowEndpoint(e,t=globalThis,r="*"){return{postMessage:(t,n)=>e.postMessage(t,r,n),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function toWireValue(e){for(const[t,r]of transferHandlers)if(r.canHandle(e)){const[n,o]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},o]}return[{type:"RAW",value:e},transferCache.get(e)||[]]}function fromWireValue(e){switch(e.type){case"HANDLER":return transferHandlers.get(e.name).deserialize(e.value);case"RAW":return e.value}}function requestResponseMessage(e,t,r){return new Promise((n=>{const o=generateUUID();e.addEventListener("message",(function t(r){!r.data||!r.data.id||r.data.id!==o||(e.removeEventListener("message",t),n(r.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)}))}function generateUUID(){return new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-")}function consumeAPI(e,t=void 0){setupTransferHandlers();const r=wrap(e instanceof Worker?e:windowEndpoint(e,t)),n=proxyClone(r);return new Proxy(n,{get:(e,t)=>"isConnected"===t?async()=>{for(;;)try{await runWithTimeout(r.isConnected(),200);break}catch{}}:r[t]})}async function runWithTimeout(e,t){return new Promise(((r,n)=>{setTimeout(n,t),e.then(r)}))}let isTransferHandlersSetup=!1;function setupTransferHandlers(){if(isTransferHandlersSetup)return;isTransferHandlersSetup=!0,transferHandlers.set("EVENT",{canHandle:e=>e instanceof CustomEvent,serialize:e=>[{detail:e.detail},[]],deserialize:e=>e}),transferHandlers.set("FUNCTION",{canHandle:e=>"function"==typeof e,serialize(e){logger.debug("[Comlink][Performance] Proxying a function");const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize:e=>(e.start(),wrap(e))}),transferHandlers.set("PHPResponse",{canHandle:e=>"object"==typeof e&&null!==e&&"headers"in e&&"bytes"in e&&"errors"in e&&"exitCode"in e&&"httpStatusCode"in e,serialize:e=>[e.toRawData(),[]],deserialize:e=>PHPResponse.fromRawData(e)});const e=transferHandlers.get("throw"),t=null==e?void 0:e.serialize;e.serialize=({value:e})=>{const r=t({value:e});return e.response&&(r[0].value.response=e.response),e.source&&(r[0].value.source=e.source),r}}function proxyClone(e){return new Proxy(e,{get(e,t){switch(typeof e[t]){case"function":return(...r)=>e[t](...r);case"object":return null===e[t]?e[t]:proxyClone(e[t]);case"undefined":case"number":case"string":return e[t];default:return proxy(e[t])}}})}async function startPlaygroundWeb({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new ProgressTracker,disableProgressBar:o,onBlueprintStepCompleted:s,onClientConnected:i=(()=>{}),sapiName:a}){if(assertValidRemote(r),allowStorageAccessByUserActivation(e),r=setQueryParams(r,{progressbar:!o}),n.setCaption("Preparing WordPress"),!t){const t=await doStartPlaygroundWeb(e,setQueryParams(r,{"php-extension":"kitchen-sink"}),n);return i(t),t}const c=compileBlueprint(t,{progress:n.stage(.5),onStepCompleted:s}),l=await doStartPlaygroundWeb(e,setQueryParams(r,{php:c.versions.php,wp:c.versions.wp,"sapi-name":a,"php-extension":c.phpExtensions,networking:c.features.networking?"yes":"no"}),n);return collectPhpLogs(logger,l),i(l),await runBlueprintSteps(c,l),n.finish(),l}function allowStorageAccessByUserActivation(e){var t,r;null!=(t=e.sandbox)&&t.length&&(null==(r=e.sandbox)||!r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function doStartPlaygroundWeb(e,t,r){await new Promise((r=>{e.src=t,e.addEventListener("load",r,!1)}));const n=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);await n.isConnected(),r.pipe(n);const o=r.stage();return await n.onDownloadProgress(o.loadingListener),await n.isReady(),o.finish(),n}const officialRemoteOrigin="https://playground.wordpress.net";function assertValidRemote(e){const t=new URL(e,officialRemoteOrigin);if((t.origin===officialRemoteOrigin||"localhost"===t.hostname)&&"/remote.html"!==t.pathname)throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${officialRemoteOrigin}/remote.html.`)}function setQueryParams(e,t){const r=new URL(e,officialRemoteOrigin),n=new URLSearchParams(r.search);for(const[o,s]of Object.entries(t))if(null!=s&&!1!==s)if(Array.isArray(s))for(const e of s)n.append(o,e.toString());else n.set(o,s.toString());return r.search=n.toString(),r.toString()}async function connectPlayground(e,t){if(logger.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),null!=t&&t.loadRemote)return startPlaygroundWeb({iframe:e,remoteUrl:t.loadRemote});const r=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);return await r.isConnected(),r}}}]); \ No newline at end of file diff --git a/assets/js/23271.9dc8a4dd.js.LICENSE.txt b/assets/js/23271.4b6b167e.js.LICENSE.txt similarity index 100% rename from assets/js/23271.9dc8a4dd.js.LICENSE.txt rename to assets/js/23271.4b6b167e.js.LICENSE.txt diff --git a/assets/js/23271.9dc8a4dd.js b/assets/js/23271.9dc8a4dd.js deleted file mode 100644 index 0737d9a97..000000000 --- a/assets/js/23271.9dc8a4dd.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! For license information please see 23271.9dc8a4dd.js.LICENSE.txt */ -"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[23271],{23271:(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{QH:()=>startPlaygroundWeb,XT:()=>installTheme,gT:()=>wpCLI$1});var Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},H=(e,t,r)=>(Nt(e,t,"read from private field"),r?r.call(e):t.get(e)),Q=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},te=(e,t,r,n)=>(Nt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ce=(e,t,r)=>(Nt(e,t,"access private method"),r);const currentJsRuntime=typeof process<"u"&&"node"===(null==(e=process.release)?void 0:e.name)?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE";var e;if("NODE"===currentJsRuntime){let e=function(e){return new Promise((function(t,r){e.onload=e.onerror=function(n){e.onload=e.onerror=null,"load"===n.type?t(e.result):r(new Error("Failed to read the blob/file"))}}))},t=function(){const e=new Uint8Array([1,2,3,4]),t=new File([e],"test").stream();try{return t.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class e extends Blob{constructor(e,t,r){let n;super(e),null!=r&&r.lastModified&&(n=new Date),(!n||isNaN(n.getFullYear()))&&(n=new Date),this.lastModifiedDate=n,this.lastModified=n.getMilliseconds(),this.name=t||""}}global.File=e}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const t=new FileReader;return t.readAsArrayBuffer(this),e(t)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const t=new FileReader;return t.readAsText(this),e(t)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let e=0;const t=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:524288,async pull(r){const n=r.byobRequest.view,o=await t.slice(e,e+n.byteLength).arrayBuffer(),s=new Uint8Array(o);new Uint8Array(n.buffer).set(s);const i=s.byteLength;r.byobRequest.respond(i),e+=i,e>=t.size&&r.close()}})})}if("NODE"===currentJsRuntime&&typeof CustomEvent>"u"){class e extends Event{constructor(e,t={}){super(e,t),this.detail=t.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const wpContentFilesExcludedFromExport=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/export-wxz.php","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"];class Semaphore{constructor({concurrency:e}){this._running=0,this.concurrency=e,this.queue=[]}get running(){return this._running}async acquire(){for(;;){if(!(this._running>=this.concurrency)){this._running++;let e=!1;return()=>{e||(e=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}await new Promise((e=>this.queue.push(e)))}}async run(e){const t=await this.acquire();try{return await e()}finally{t()}}}function joinPaths(...e){let t=e.join("/");const r="/"===t[0],n="/"===t.substring(t.length-1);return t=normalizePath(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function dirname(e){if("/"===e)return"/";const t=(e=normalizePath(e)).lastIndexOf("/");return-1===t?"":0===t?"/":e.substr(0,t)}function normalizePath(e){const t="/"===e[0];return(t?"/":"")+(e=normalizePathsArray(e.split("/").filter((e=>!!e)),!t).join("/")).replace(/\/$/,"")}function normalizePathsArray(e,t){let r=0;for(let n=e.length-1;n>=0;n--){const t=e[n];"."===t?e.splice(n,1):".."===t?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e}function splitShellCommand$1(e){let t=0,r="";const n=[];let o="";for(let s=0;s {let i=[];if(r.length)i=[t,...r];else if("string"==typeof t)i=splitShellCommand$1(t);else{if(!Array.isArray(t))throw new Error("Invalid command ",t);i=t}await e(i,s,n),o.emit("spawn",!0)})),o}}class EventEmitter{constructor(){this.listeners={}}emit(e,t){this.listeners[e]&&this.listeners[e].forEach((function(e){e(t)}))}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}}class ProcessApi extends EventEmitter{constructor(e){super(),this.childProcess=e,this.exited=!1,this.stdinData=[],e.on("stdin",(e=>{this.stdinData?this.stdinData.push(e.slice()):this.emit("stdin",e)}))}stdout(e){"string"==typeof e&&(e=(new TextEncoder).encode(e)),this.childProcess.stdout.emit("data",e)}stdoutEnd(){this.childProcess.stdout.emit("end",{})}stderr(e){"string"==typeof e&&(e=(new TextEncoder).encode(e)),this.childProcess.stderr.emit("data",e)}stderrEnd(){this.childProcess.stderr.emit("end",{})}exit(e){this.exited||(this.exited=!0,this.childProcess.emit("exit",e))}flushStdin(){if(this.stdinData)for(let e=0;e {t.emit("stdin",e)}}}}function randomString(e=36,t="!@#$%^&*()_+=-[]/.,<>?"){const r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+t;let n="";for(let o=e;o>0;--o)n+=r[Math.floor(Math.random()*r.length)];return n}function randomFilename(){return randomString(36,"-_")}function phpVar(e){return`json_decode(base64_decode('${stringToBase64(JSON.stringify(e))}'), true)`}function phpVars(e){const t={};for(const r in e)t[r]=phpVar(e[r]);return t}function stringToBase64(e){return bytesToBase64((new TextEncoder).encode(e))}function bytesToBase64(e){const t=String.fromCodePoint(...e);return btoa(t)}const activatePlugin=async(e,{pluginPath:t,pluginName:r},n)=>{null==n||n.tracker.setCaption(`Activating ${r||t}`);const o=await e.documentRoot;await e.run({throwOnError:!0,code:` 'Administrator') )[0] );\n\n$plugin_path = ${phpVar(t)};\n\nif (!is_dir($plugin_path)) {\n\tactivate_plugin($plugin_path);\n\tdie();\n}\n\nforeach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {\n\t$info = get_plugin_data( $file, false, false );\n\tif ( ! empty( $info['Name'] ) ) {\n\t\tactivate_plugin( $file );\n\t\tdie();\n\t}\n}\n\n// If we got here, the plugin was not found.\nexit(1);\n`})},activateTheme=async(e,{themeFolderName:t},r)=>{null==r||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot;await e.run({throwOnError:!0,code:` 'Administrator') )[0] );\n\nswitch_theme( ${phpVar(t)} );\n`})},runPHP=async(e,{code:t})=>await e.run({code:t,throwOnError:!0}),runPHPWithOptions=async(e,{options:t})=>await e.run(t),rm=async(e,{path:t})=>{await e.unlink(t)},runSql=async(e,{sql:t},r)=>{null==r||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${randomFilename()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const o=phpVars({docroot:await e.documentRoot,sqlFilename:n}),s=await e.run({code:`query($buffer);\n\t\t\t$buffer = '';\n\t\t}\n\t`});return await rm(e,{path:n}),s},setPhpIniEntry=async(e,{key:t,value:r})=>{await e.setPhpIniEntry(t,r)},request=async(e,{request:t})=>{const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw console.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},rewriteWpConfigToDefineConstants=" false,\n * 'WP_DEBUG_LOG' => true,\n * 'SAVEQUERIES' => true,\n * 'NEW_CONSTANT' => \"new constant\",\n * ];\n * \n * ```php\n * 2 ? 'WP_DEBUG' : 'FOO', true);\n // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n $open_parenthesis = 0;\n while ($token = array_pop($tokens)) {\n $buffer[] = $token;\n if ($token === \"(\" || $token === \"[\" || $token === \"{\") {\n ++$open_parenthesis;\n } elseif ($token === \")\" || $token === \"]\" || $token === \"}\") {\n --$open_parenthesis;\n } elseif ($token === \",\" && $open_parenthesis === 0) {\n break;\n }\n\n // Don't capture the comma as a part of the constant name\n $name_buffer[] = $token;\n }\n\n // Capture everything until the closing parenthesis\n // define(\"WP_DEBUG\", true);\n // ^^^^^^\n $open_parenthesis = 0;\n $is_second_argument = true;\n while ($token = array_pop($tokens)) {\n $buffer[] = $token;\n if ($token === \")\" && $open_parenthesis === 0) {\n // Final parenthesis of the define call.\n break;\n } else if ($token === \"(\" || $token === \"[\" || $token === \"{\") {\n ++$open_parenthesis;\n } elseif ($token === \")\" || $token === \"]\" || $token === \"}\") {\n --$open_parenthesis;\n } elseif ($token === \",\" && $open_parenthesis === 0) {\n // This define call has more than 2 arguments! The third one is the\n // boolean value indicating $is_case_insensitive. Let's continue capturing\n // to $third_arg_buffer.\n $is_second_argument = false;\n }\n if ($is_second_argument) {\n $value_buffer[] = $token;\n } else {\n $third_arg_buffer[] = $token;\n }\n }\n\n // Capture until the semicolon\n // define(\"WP_DEBUG\", true) ;\n // ^^^\n while ($token = array_pop($tokens)) {\n $buffer[] = $token;\n if ($token === \";\") {\n break;\n }\n }\n\n // Decide whether $name_buffer is a constant name or an expression\n $name_token = null;\n $name_token_index = $token;\n $name_is_literal = true;\n foreach ($name_buffer as $k => $token) {\n if (is_array($token)) {\n if ($token[0] === T_WHITESPACE || $token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT) {\n continue;\n } else if ($token[0] === T_STRING || $token[0] === T_CONSTANT_ENCAPSED_STRING) {\n $name_token = $token;\n $name_token_index = $k;\n } else {\n $name_is_literal = false;\n break;\n }\n } else if ($token !== \"(\" && $token !== \")\") {\n $name_is_literal = false;\n break;\n }\n }\n\n // We can't handle expressions as constant names. Let's wrap that define\n // call in an if(!defined()) statement, just in case it collides with\n // a constant name.\n if (!$name_is_literal) {\n // Ensure the defined expression is not already accounted for\n foreach ($defined_expressions as $defined_expression) {\n if ($defined_expression === stringify_tokens(skip_whitespace($name_buffer))) {\n $output = array_merge($output, $buffer);\n continue 2;\n }\n }\n $output = array_merge(\n $output,\n [\"if(!defined(\"],\n $name_buffer,\n [\")) {\\n \"],\n ['define('],\n $name_buffer,\n [','],\n $value_buffer,\n $third_arg_buffer,\n [\");\"],\n [\"\\n}\\n\"]\n );\n continue;\n }\n\n // Yay, we have a literal constant name in the buffer now. Let's\n // get its value:\n $name = eval('return ' . $name_token[1] . ';');\n\n // If the constant name is not in the list of constants we're looking,\n // we can ignore it.\n if (!array_key_exists($name, $constants)) {\n $output = array_merge($output, $buffer);\n continue;\n }\n\n // We now have a define() call that defines a constant we're looking for.\n // Let's rewrite its value to the one \n $output = array_merge(\n $output,\n ['define('],\n $name_buffer,\n [','],\n [var_export($constants[$name], true)],\n $third_arg_buffer,\n [\");\"]\n );\n\n // Remove the constant from the list so we can process any remaining\n // constants later.\n unset($constants[$name]);\n } while (count($tokens));\n\n // Add any constants that weren't found in the file\n if (count($constants)) {\n $prepend = [\n \" $value) {\n $prepend = array_merge(\n $prepend,\n [\n \"define(\",\n var_export($name, true),\n ',',\n var_export($value, true),\n \");\\n\"\n ]\n );\n }\n $prepend[] = \"?>\";\n $output = array_merge(\n $prepend,\n $output\n );\n }\n\n // Translate the output tokens back into a string\n return stringify_tokens($output);\n}\n\nfunction stringify_tokens($tokens) {\n $output = '';\n foreach ($tokens as $token) {\n if (is_array($token)) {\n $output .= $token[1];\n } else {\n $output .= $token;\n }\n }\n return $output;\n}\n\nfunction skip_whitespace($tokens) {\n $output = [];\n foreach ($tokens as $token) {\n if (is_array($token) && ($token[0] === T_WHITESPACE || $token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT)) {\n continue;\n }\n $output[] = $token;\n }\n return $output;\n}\n",defineWpConfigConsts=async(e,{consts:t,method:r="rewrite-wp-config"})=>{switch(r){case"define-before-run":await defineBeforeRun(e,t);break;case"rewrite-wp-config":{const r=joinPaths(await e.documentRoot,"/wp-config.php"),n=await e.readFileAsText(r),o=await rewriteDefineCalls(e,n,t);await e.writeFile(r,o);break}default:throw new Error(`Invalid method: ${r}`)}};async function defineBeforeRun(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function rewriteDefineCalls(e,t,r){await e.writeFile("/tmp/code.php",t);const n=phpVars({consts:r});return await e.run({throwOnError:!0,code:`${rewriteWpConfigToDefineConstants}\n\t$wp_config_path = '/tmp/code.php';\n\t$wp_config = file_get_contents($wp_config_path);\n\t$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});\n\tfile_put_contents($wp_config_path, $new_wp_config);\n\t`}),await e.readFileAsText("/tmp/code.php")}const login=async(e,{username:t="admin",password:r="password"}={},n)=>{var o,s,i;null==n||n.tracker.setCaption((null==n?void 0:n.initialCaption)||"Logging in"),await e.request({url:"/wp-login.php"});const a=await e.request({url:"/wp-login.php",method:"POST",body:{log:t,pwd:r,rememberme:"forever"}});if(null==(i=null==(s=null==(o=a.headers)?void 0:o.location)?void 0:s[0])||!i.includes("/wp-admin/"))throw console.warn("WordPress response was",{response:a,text:a.text}),new Error(`Failed to log in as ${t} with password ${r}`)},setSiteOptions=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({throwOnError:!0,code:` $value) {\n\t\t\tupdate_option($name, $value);\n\t\t}\n\t\techo "Success";\n\t\t`})},updateUserMeta=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({throwOnError:!0,code:` $value) {\n\t\t\tupdate_user_meta(${phpVar(r)}, $name, $value);\n\t\t}\n\t\t`})};function isURLScoped(e){return e.pathname.startsWith("/scope:")}function getURLScope(e){return isURLScoped(e)?e.pathname.split("/")[1].split(":")[1]:null}const enableMultisite=async e=>{var t;await defineWpConfigConsts(e,{consts:{WP_ALLOW_MULTISITE:1}});const r=new URL(await e.absoluteUrl);if(""!==r.port){let e=`The current host is ${r.host}, but WordPress multisites do not support custom ports.`;throw"localhost"===r.hostname&&(e+=" For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."),new Error(e)}const n=r.pathname.replace(/\/$/,"")+"/",o=`${r.protocol}//${r.hostname}${n}`;await setSiteOptions(e,{options:{siteurl:o,home:o}}),await login(e,{});const s=await e.documentRoot,i=(await e.run({throwOnError:!0,code:` 'Administrator') )[0] );\n\nrequire_once(${phpVar(s)} . "/wp-admin/includes/plugin.php");\n$plugins_root = ${phpVar(s)} . "/wp-content/plugins";\n$plugins = glob($plugins_root . "/*");\n\n$deactivated_plugins = [];\nforeach($plugins as $plugin_path) {\n\tif (!is_dir($plugin_path)) {\n\t\tdeactivate_plugins($plugin_path);\n\t\tcontinue;\n\t}\n\t// Find plugin entry file\n\tforeach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {\n\t\t$info = get_plugin_data( $file, false, false );\n\t\tif ( ! empty( $info['Name'] ) ) {\n\t\t\tdeactivate_plugins( $file );\n\t\t\t$deactivated_plugins[] = substr($file, strlen($plugins_root) + 1);\n\t\t\tbreak;\n\t\t}\n\t}\n}\necho json_encode($deactivated_plugins);\n`})).json,a=null==(t=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))?void 0:t[1],c=await request(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:jsonToUrlEncoded({_wpnonce:a,_wp_http_referer:n+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(200!==c.httpStatusCode)throw console.warn("WordPress response was",{response:c,text:c.text,headers:c.headers}),new Error(`Failed to enable multisite. Response code was ${c.httpStatusCode}`);await defineWpConfigConsts(e,{consts:{SUNRISE:"on",MULTISITE:!0,SUBDOMAIN_INSTALL:!1,SITE_ID_CURRENT_SITE:1,BLOG_ID_CURRENT_SITE:1,DOMAIN_CURRENT_SITE:r.hostname,PATH_CURRENT_SITE:n}});const l=new URL(await e.absoluteUrl),d=isURLScoped(l)?"scope:"+getURLScope(l):null;await e.writeFile(joinPaths(s,"/wp-content/sunrise.php"),`encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}const cp=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},mv=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},mkdir=async(e,{path:t})=>{await e.mkdir(t)},rmdir=async(e,{path:t})=>{await e.rmdir(t)},writeFile=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),await e.writeFile(t,r)},defineSiteUrl=async(e,{siteUrl:t})=>{await defineWpConfigConsts(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},importFile=async(e,{file:t},r)=>{var n,o;null==(n=null==r?void 0:r.tracker)||n.setCaption("Importing content");const s=null==(o=DOM(await e.request({url:"/wp-admin/admin.php?import=wordpress"})).getElementById("import-upload-form"))?void 0:o.getAttribute("action"),i=await e.request({url:`/wp-admin/${s}`,method:"POST",body:{import:t}}),a=DOM(i).querySelector("#wpbody-content form");if(!a)throw console.log(i.text),new Error("Could not find an importer form in response. See the response text above for details.");const c=getFormData(a);c.fetch_attachments="1";for(const d in c)if(d.startsWith("user_map[")){c["user_new["+d.slice(9,-1)+"]"]="1"}const l=await e.request({url:a.action,method:"POST",body:c});if(!l.text.includes("All done."))throw console.warn("WordPress response was: ",{text:l.text,errors:l.errors}),new Error("Import failed, see console for details.")};function DOM(e){return(new DOMParser).parseFromString(e.text,"text/html")}function getFormData(e){return Object.fromEntries(new FormData(e).entries())}const zipFunctions="open($output, ZipArchive::CREATE);\n if ($res === TRUE) {\n $directories = array(\n $root . '/'\n );\n while (sizeof($directories)) {\n $current_dir = array_pop($directories);\n\n if ($handle = opendir($current_dir)) {\n while (false !== ($entry = readdir($handle))) {\n if ($entry == '.' || $entry == '..') {\n continue;\n }\n\n $entry = join_paths($current_dir, $entry);\n if (in_array($entry, $excludePaths)) {\n continue;\n }\n\n if (is_dir($entry)) {\n $directory_path = $entry . '/';\n array_push($directories, $directory_path);\n } else if (is_file($entry)) {\n $zip->addFile($entry, substr($entry, strlen($zip_root)));\n }\n }\n closedir($handle);\n }\n }\n foreach ($additionalPaths as $disk_path => $zip_path) {\n $zip->addFile($disk_path, $zip_path);\n }\n $zip->close();\n chmod($output, 0777);\n }\n}\n\nfunction join_paths()\n{\n $paths = array();\n\n foreach (func_get_args() as $arg) {\n if ($arg !== '') {\n $paths[] = $arg;\n }\n }\n\n return preg_replace('#/+#', '/', join('/', $paths));\n}\n\nfunction unzip($zipPath, $extractTo, $overwrite = true)\n{\n if (!is_dir($extractTo)) {\n mkdir($extractTo, 0777, true);\n }\n $zip = new ZipArchive;\n $res = $zip->open($zipPath);\n if ($res === TRUE) {\n $zip->extractTo($extractTo);\n $zip->close();\n chmod($extractTo, 0777);\n }\n}\n\n\nfunction delTree($dir)\n{\n $files = array_diff(scandir($dir), array('.', '..'));\n foreach ($files as $file) {\n (is_dir(\"$dir/$file\")) ? delTree(\"$dir/$file\") : unlink(\"$dir/$file\");\n }\n return rmdir($dir);\n}\n";async function runPhpWithZipFunctions(e,t){return await e.run({throwOnError:!0,code:zipFunctions+t})}const tmpPath="/tmp/file.zip",unzip=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)await e.writeFile(tmpPath,await e.readFileAsBuffer(r)),console.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else{if(!t)throw new Error("Either zipPath or zipFile must be provided");await e.writeFile(tmpPath,new Uint8Array(await t.arrayBuffer()))}const o=phpVars({zipPath:tmpPath,extractToPath:n});await runPhpWithZipFunctions(e,`unzip(${o.zipPath}, ${o.extractToPath});`),e.fileExists(tmpPath)&&await e.unlink(tmpPath)},importWordPressFiles=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let o=joinPaths("/tmp","import");await e.mkdir(o),await unzip(e,{zipFile:t,extractToPath:o}),o=joinPaths(o,r);const s=joinPaths(o,"wp-content"),i=joinPaths(n,"wp-content");for(const d of wpContentFilesExcludedFromExport){const t=joinPaths(s,d);await removePath(e,t);const r=joinPaths(i,d);await e.fileExists(r)&&(await e.mkdir(dirname(t)),await e.mv(r,t))}const a=joinPaths(o,"wp-content","database");await e.fileExists(a)||await e.mv(joinPaths(n,"wp-content","database"),a);const c=await e.listFiles(o);for(const d of c)await removePath(e,joinPaths(n,d)),await e.mv(joinPaths(o,d),joinPaths(n,d));await e.rmdir(o),await defineSiteUrl(e,{siteUrl:await e.absoluteUrl});const l=phpVar(joinPaths(n,"wp-admin","upgrade.php"));await e.run({throwOnError:!0,code:`!e.endsWith("/__MACOSX")));const s=1===o.length&&await e.isDir(o[0]);let a,c="";s?(c=o[0],a=o[0].split("/").pop()):(c=i,a=n);const l=`${t}/${a}`;return await e.mv(c,l),{assetFolderPath:l,assetFolderName:a}}finally{await e.rmdir(s,{recursive:!0})}}function zipNameToHumanName(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const installPlugin=async(e,{pluginZipFile:t,options:r={}},n)=>{const o=zipNameToHumanName(t.name.split("/").pop()||"plugin.zip");null==n||n.tracker.setCaption(`Installing the ${o} plugin`);const{assetFolderPath:s}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});(!("activate"in r)||r.activate)&&await activatePlugin(e,{pluginPath:s,pluginName:o},n)},installTheme=async(e,{themeZipFile:t,options:r={}},n)=>{const o=zipNameToHumanName(t.name);null==n||n.tracker.setCaption(`Installing the ${o} theme`);const{assetFolderName:s}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});(!("activate"in r)||r.activate)&&await activateTheme(e,{themeFolderName:s},n)},runWpInstallationWizard=async(e,{options:t})=>{await e.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:t.adminPassword||"admin",admin_password:t.adminPassword||"password",admin_password2:t.adminPassword||"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}})},zipWpContent=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,o=joinPaths(n,"wp-content");let s=wpContentFilesExcludedFromExport;t&&(s=s.filter((e=>!e.startsWith("themes/twenty"))).filter((e=>"mu-plugins/sqlite-database-integration"!==e)));const i=phpVars({zipPath:r,wpContentPath:o,documentRoot:n,exceptPaths:s.map((e=>joinPaths(n,"wp-content",e))),additionalPaths:t?{[joinPaths(n,"wp-config.php")]:"wp-config.php"}:{}});await runPhpWithZipFunctions(e,`zipDir(${i.wpContentPath}, ${i.zipPath}, array(\n\t\t\t'exclude_paths' => ${i.exceptPaths},\n\t\t\t'zip_root' => ${i.documentRoot},\n\t\t\t'additional_paths' => ${i.additionalPaths}\n\t\t));`);const a=await e.readFileAsBuffer(r);return e.unlink(r),a},wpCLI$1=async(e,{command:t,wpCliPath:r="/tmp/wp-cli.phar"})=>{if(!await e.fileExists(r))throw new Error(`wp-cli.phar not found at ${r}`);let n;if("string"==typeof t?n=splitShellCommand(t=t.trim()):n=t,"wp"!==n.shift())throw new Error('The first argument must be "wp".');await e.writeFile("/tmp/stdout",""),await e.writeFile("/tmp/stderr",""),await e.writeFile("/wordpress/run-cli.php",`this.notifyProgress())),r.addEventListener("done",(()=>{this.done&&this.notifyDone()})),r}fillSlowly({stopBeforeFinishing:e=!0}={}){if(this._isFilling)return;this._isFilling=!0;const t=this._fillTime/100;this._fillInterval=setInterval((()=>{this.set(this._selfProgress+1),e&&this._selfProgress>=99&&clearInterval(this._fillInterval)}),t)}set(e){this._selfProgress=Math.min(e,100),this.notifyProgress(),this._selfProgress+PROGRESS_EPSILON>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let e=this._subTrackers.length-1;e>=0;e--)if(!this._subTrackers[e].done){const t=this._subTrackers[e].caption;if(t)return t}return this._selfCaption}setCaption(e){this._selfCaption=e,this.notifyProgress()}get done(){return this.progress+PROGRESS_EPSILON>=100}get progress(){if(this._selfDone)return 100;const e=this._subTrackers.reduce(((e,t)=>e+t.progress*t.weight),this._selfProgress*this._selfWeight);return Math.round(1e4*e)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=e=>{this.set(e)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=e=>{this.set(e.detail.loaded/e.detail.total*100)}),this._loadingListener}pipe(e){e.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",(t=>{e.setProgress({progress:t.detail.progress,caption:t.detail.caption})})),this.addEventListener("done",(()=>{e.setLoaded()}))}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}notifyProgress(){const e=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return e.progress},get caption(){return e.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const kError=Symbol("error"),kMessage=Symbol("message");class ErrorEvent2 extends Event{constructor(e,t={}){super(e),this[kError]=void 0===t.error?null:t.error,this[kMessage]=void 0===t.message?"":t.message}get error(){return this[kError]}get message(){return this[kMessage]}}Object.defineProperty(ErrorEvent2.prototype,"error",{enumerable:!0}),Object.defineProperty(ErrorEvent2.prototype,"message",{enumerable:!0});const ErrorEvent="function"==typeof globalThis.ErrorEvent?globalThis.ErrorEvent:ErrorEvent2;function isExitCodeZero(e){return e instanceof Error&&("exitCode"in e&&0===(null==e?void 0:e.exitCode)||"ExitStatus"===(null==e?void 0:e.name)&&"status"in e&&0===e.status)}class UnhandledRejectionsTarget extends EventTarget{constructor(){super(...arguments),this.listenersCount=0}addEventListener(e,t){++this.listenersCount,super.addEventListener(e,t)}removeEventListener(e,t){--this.listenersCount,super.removeEventListener(e,t)}hasListeners(){return this.listenersCount>0}}function improveWASMErrorReporting(e){e.asm={...e.asm};const t=new UnhandledRejectionsTarget;for(const r in e.asm)if("function"==typeof e.asm[r]){const n=e.asm[r];e.asm[r]=function(...r){var o;try{return n(...r)}catch(s){if(!(s instanceof Error))throw s;const r=clarifyErrorMessage(s,null==(o=e.lastAsyncifyStackSource)?void 0:o.stack);if(e.lastAsyncifyStackSource&&(s.cause=e.lastAsyncifyStackSource),t.hasListeners())return void t.dispatchEvent(new ErrorEvent("error",{error:s,message:r}));throw isExitCodeZero(s)||showCriticalErrorBox(r),s}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if("unreachable"===e.message){let r=UNREACHABLE_ERROR;t||(r+="\n\nThis stack trace is lacking. For a better one initialize \nthe PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).\n\n"),functionsMaybeMissingFromAsyncify=extractPHPFunctionsFromStack(t||e.stack||"");for(const e of functionsMaybeMissingFromAsyncify)r+=` * ${e}\n`;return r}return e.message}const UNREACHABLE_ERROR="\n\"unreachable\" WASM instruction executed.\n\nThe typical reason is a PHP function missing from the ASYNCIFY_ONLY\nlist when building PHP.wasm.\n\nYou will need to file a new issue in the WordPress Playground repository\nand paste this error message there:\n\nhttps://github.com/WordPress/wordpress-playground/issues/new\n\nIf you're a core developer, the typical fix is to:\n\n* Isolate a minimal reproduction of the error\n* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository\n* Run 'npm run fix-asyncify'\n* Commit the changes, push to the repo, release updated NPM packages\n\nBelow is a list of all the PHP functions found in the stack trace to\nhelp with the minimal reproduction. If they're all already listed in\nthe Dockerfile, you'll need to trigger this error again with long stack\ntraces enabled. In node.js, you can do it using the --stack-trace-limit=100\nCLI option: \n\n",redBg="\x1b[41m",bold="\x1b[1m",reset="\x1b[0m",eol="\x1b[K";let logged=!1;function showCriticalErrorBox(e){if(!logged&&(logged=!0,null==e||!e.trim().startsWith("Program terminated with exit"))){console.log(`${redBg}\n${eol}\n${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split("\n"))console.log(`${eol} ${t} `);console.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split("\n").slice(1).map((e=>{const t=e.trim().substring(3).split(" ");return{fn:t.length>=2?t[0]:" ",isWasm:e.includes("wasm://")}})).filter((({fn:e,isWasm:t})=>t&&!e.startsWith("dynCall_")&&!e.startsWith("invoke_"))).map((({fn:e})=>e));return Array.from(new Set(t))}catch{return[]}}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);class PHPResponse{constructor(e,t,r,n="",o=0){this.httpStatusCode=e,this.headers=t,this.bytes=r,this.exitCode=o,this.errors=n}static fromRawData(e){return new PHPResponse(e.httpStatusCode,e.headers,e.bytes,e.errors,e.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return(new TextDecoder).decode(this.bytes)}}const SupportedPHPVersions=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],LatestSupportedPHPVersion=SupportedPHPVersions[0],SupportedPHPVersionsList=SupportedPHPVersions,SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList};var Ae,Ge;class PHPBrowser{constructor(e,t={}){Q(this,Ae,void 0),Q(this,Ge,void 0),this.requestHandler=e,te(this,Ae,{}),te(this,Ge,{handleRedirects:!1,maxRedirects:4,...t})}async request(e,t=0){const r=await this.requestHandler.request({...e,headers:{...e.headers,cookie:this.serializeCookies()}});if(r.headers["set-cookie"]&&this.setCookies(r.headers["set-cookie"]),H(this,Ge).handleRedirects&&r.headers.location&&t e+t.length),0),i=new Uint8Array(s);let a=0;for(const c of o)i.set("string"==typeof c?n.encode(c):c,a),a+=c.length;return{bytes:i,contentType:r}}function fileToUint8Array(e){return new Promise((t=>{const r=new FileReader;r.onload=()=>{t(new Uint8Array(r.result))},r.readAsArrayBuffer(e)}))}var Pe,Ke,dt,De,Je,ve,Qe,Fe,mt,zt,_t,Wt,gt,Bt;class PHPRequestHandler{constructor(e,t={}){Q(this,mt),Q(this,_t),Q(this,gt),Q(this,Pe,void 0),Q(this,Ke,void 0),Q(this,dt,void 0),Q(this,De,void 0),Q(this,Je,void 0),Q(this,ve,void 0),Q(this,Qe,void 0),Q(this,Fe,void 0),te(this,Fe,new Semaphore({concurrency:1}));const{documentRoot:r="/www/",absoluteUrl:n=("object"==typeof location?null==location?void 0:location.href:"")}=t;this.php=e,te(this,Pe,r);const o=new URL(n);te(this,dt,o.hostname),te(this,De,o.port?Number(o.port):"https:"===o.protocol?443:80),te(this,Ke,(o.protocol||"").replace(":",""));const s=443!==H(this,De)&&80!==H(this,De);te(this,Je,[H(this,dt),s?`:${H(this,De)}`:""].join("")),te(this,ve,o.pathname.replace(/\/+$/,"")),te(this,Qe,[`${H(this,Ke)}://`,H(this,Je),H(this,ve)].join(""))}pathToInternalUrl(e){return`${this.absoluteUrl}${e}`}internalUrlToPath(e){const t=new URL(e);return t.pathname.startsWith(H(this,ve))&&(t.pathname=t.pathname.slice(H(this,ve).length)),toRelativeUrl(t)}get isRequestRunning(){return H(this,Fe).running>0}get absoluteUrl(){return H(this,Qe)}get documentRoot(){return H(this,Pe)}async request(e){const t=e.url.startsWith("http://")||e.url.startsWith("https://"),r=new URL(e.url,t?void 0:DEFAULT_BASE_URL),n=removePathPrefix(r.pathname,H(this,ve)),o=`${H(this,Pe)}${n}`;return seemsLikeAPHPRequestHandlerPath(o)?await ce(this,_t,Wt).call(this,e,r):ce(this,mt,zt).call(this,o)}}function inferMimeType(e){switch(e.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}function seemsLikeAPHPRequestHandlerPath(e){return seemsLikeAPHPFile(e)||seemsLikeADirectoryRoot(e)}function seemsLikeAPHPFile(e){return e.endsWith(".php")||e.includes(".php/")}function seemsLikeADirectoryRoot(e){return!e.split("/").pop().includes(".")}Pe=new WeakMap,Ke=new WeakMap,dt=new WeakMap,De=new WeakMap,Je=new WeakMap,ve=new WeakMap,Qe=new WeakMap,Fe=new WeakMap,mt=new WeakSet,zt=function(e){if(!this.php.fileExists(e))return new PHPResponse(404,{"x-file-type":["static"]},(new TextEncoder).encode("404 File not found"));const t=this.php.readFileAsBuffer(e);return new PHPResponse(200,{"content-length":[`${t.byteLength}`],"content-type":[inferMimeType(e)],"accept-ranges":["bytes"],"cache-control":["public, max-age=0"]},t)},_t=new WeakSet,Wt=async function(e,t){var r,n;if(H(this,Fe).running>0&&"php"===(null==(r=e.headers)?void 0:r["x-request-issuer"]))return console.warn("Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."),new PHPResponse(502,{},(new TextEncoder).encode("502 Bad Gateway"));const o=await H(this,Fe).acquire();try{this.php.addServerGlobalEntry("REMOTE_ADDR","127.0.0.1"),this.php.addServerGlobalEntry("DOCUMENT_ROOT",H(this,Pe)),this.php.addServerGlobalEntry("HTTPS",H(this,Qe).startsWith("https://")?"on":"");let r="GET";const o={host:H(this,Je),...normalizeHeaders(e.headers||{})};let s,i=e.body;if("object"==typeof i&&!(i instanceof Uint8Array)){r="POST";const{bytes:e,contentType:t}=await encodeAsMultipart(i);i=e,o["content-type"]=t}try{let r=t.pathname;if(null!=(n=e.headers)&&n["x-rewrite-url"])try{r=new URL(e.headers["x-rewrite-url"]).pathname}catch{}s=ce(this,gt,Bt).call(this,r)}catch{return new PHPResponse(404,{},(new TextEncoder).encode("404 File not found"))}return await this.php.run({relativeUri:ensurePathPrefix(toRelativeUrl(t),H(this,ve)),protocol:H(this,Ke),method:e.method||r,body:i,scriptPath:s,headers:o})}finally{o()}},gt=new WeakSet,Bt=function(e){let t=removePathPrefix(e,H(this,ve));t.includes(".php")?t=t.split(".php")[0]+".php":this.php.isDir(`${H(this,Pe)}${t}`)?(t.endsWith("/")||(t=`${t}/`),t=`${t}index.php`):t="/index.php";const r=`${H(this,Pe)}${t}`;if(this.php.fileExists(r))return r;throw new Error(`File not found: ${r}`)};const FileErrorCodes={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function getEmscriptenFsError(e){const t="object"==typeof e?null==e?void 0:e.errno:null;if(t in FileErrorCodes)return FileErrorCodes[t]}function rethrowFileSystemError(e=""){return function(t,r,n){const o=n.value;n.value=function(...t){try{return o.apply(this,t)}catch(r){const n="object"==typeof r?null==r?void 0:r.errno:null;if(n in FileErrorCodes){const o=FileErrorCodes[n],s="string"==typeof t[0]?t[0]:null,i=null!==s?e.replaceAll("{path}",s):e;throw new Error(`${i}: ${o}`,{cause:r})}throw r}}}}const loadedRuntimes=new Map;function getLoadedRuntime(e){return loadedRuntimes.get(e)}!function(){var e;typeof process<"u"&&"node"===(null==(e=process.release)?void 0:e.name)||(typeof window<"u"||typeof WorkerGlobalScope<"u"&&(self,WorkerGlobalScope))}();var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var o,s=n>1?void 0:n?__getOwnPropDesc(t,r):t,i=e.length-1;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");var Me,Ze,Ye,Ee,Re,Te,be,Xe,$t,Gt,yt,Kt,vt,Jt,wt,Qt,Pt,Zt,Et,Yt,bt,Xt,St,er,Rt,tr,Tt,rr,kt,nr,Ct,sr;class BasePHP{constructor(e,t){Q(this,$t),Q(this,yt),Q(this,vt),Q(this,wt),Q(this,Pt),Q(this,Et),Q(this,bt),Q(this,St),Q(this,Rt),Q(this,Tt),Q(this,kt),Q(this,Ct),Q(this,Me,void 0),Q(this,Ze,void 0),Q(this,Ye,void 0),Q(this,Ee,void 0),Q(this,Re,void 0),Q(this,Te,void 0),Q(this,be,void 0),Q(this,Xe,void 0),te(this,Me,[]),te(this,Ee,!1),te(this,Re,null),te(this,Te,{}),te(this,be,new Map),te(this,Xe,[]),this.semaphore=new Semaphore({concurrency:1}),void 0!==e&&this.initializeRuntime(e),t&&(this.requestHandler=new PHPBrowser(new PHPRequestHandler(this,t)))}addEventListener(e,t){H(this,be).has(e)||H(this,be).set(e,new Set),H(this,be).get(e).add(t)}removeEventListener(e,t){var r;null==(r=H(this,be).get(e))||r.delete(t)}dispatchEvent(e){const t=H(this,be).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){H(this,Xe).push(e)}async setSpawnHandler(handler){"string"==typeof handler&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.requestHandler.internalUrlToPath(e)}initializeRuntime(e){if(this[__private__dont__use])throw new Error("PHP runtime already initialized.");const t=getLoadedRuntime(e);if(!t)throw new Error("Invalid PHP runtime id.");this[__private__dont__use]=t,t.onMessage=async e=>{for(const t of H(this,Xe)){const r=await t(e);if(r)return r}return""},te(this,Re,improveWASMErrorReporting(t)),this.dispatchEvent({type:"runtime.initialized"})}async setSapiName(e){if(0!==this[__private__dont__use].ccall("wasm_set_sapi_name",NUMBER,[STRING],[e]))throw new Error("Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?");te(this,Ye,e)}setPhpIniPath(e){if(H(this,Ee))throw new Error("Cannot set PHP ini path after calling run().");te(this,Ze,e),this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[e])}setPhpIniEntry(e,t){if(H(this,Ee))throw new Error("Cannot set PHP ini entries after calling run().");H(this,Me).push([e,t])}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e,t){if(!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e,t)}async run(e){const t=await this.semaphore.acquire();let r;try{if(H(this,Ee)||(ce(this,$t,Gt).call(this),te(this,Ee,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);ce(this,St,er).call(this,e.scriptPath||""),ce(this,vt,Jt).call(this,e.relativeUri||""),ce(this,Pt,Zt).call(this,e.method||"GET");const t=normalizeHeaders(e.headers||{}),n=t.host||"example.com:443";ce(this,wt,Qt).call(this,n,e.protocol||"http"),ce(this,Et,Yt).call(this,t),e.body&&(r=ce(this,bt,Xt).call(this,e.body)),"string"==typeof e.code&&ce(this,kt,nr).call(this," ?>"+e.code),ce(this,Rt,tr).call(this);const o=e.env||{};for(const e in o)ce(this,Tt,rr).call(this,e,o[e]);const s=await ce(this,Ct,sr).call(this);if(e.throwOnError&&0!==s.exitCode){const e={stdout:s.text,stderr:s.errors};console.warn("PHP.run() output was:",e);const t=new Error(`PHP.run() failed with exit code ${s.exitCode} and the following output: `+s.errors);throw t.output=e,console.error(t),t}return s}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}addServerGlobalEntry(e,t){H(this,Te)[e]=t}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/consts.json")&&this.readFileAsText("/internal/consts.json")||"{}")}catch{}this.writeFile("/internal/consts.json",JSON.stringify({...r,[e]:t}))}mkdir(e){this[__private__dont__use].FS.mkdirTree(e)}mkdirTree(e){this.mkdir(e)}readFileAsText(e){return(new TextDecoder).decode(this.readFileAsBuffer(e))}readFileAsBuffer(e){return this[__private__dont__use].FS.readFile(e)}writeFile(e,t){this[__private__dont__use].FS.writeFile(e,t)}unlink(e){this[__private__dont__use].FS.unlink(e)}mv(e,t){try{this[__private__dont__use].FS.rename(e,t)}catch(r){const n=getEmscriptenFsError(r);throw n?new Error(`Could not move ${e} to ${t}: ${n}`,{cause:r}):r}}rmdir(e,t={recursive:!0}){null!=t&&t.recursive&&this.listFiles(e).forEach((r=>{const n=`${e}/${r}`;this.isDir(n)?this.rmdir(n,t):this.unlink(n)})),this[__private__dont__use].FS.rmdir(e)}listFiles(e,t={prependPath:!1}){if(!this.fileExists(e))return[];try{const r=this[__private__dont__use].FS.readdir(e).filter((e=>"."!==e&&".."!==e));if(t.prependPath){const t=e.replace(/\/$/,"");return r.map((e=>`${t}/${e}`))}return r}catch(r){return console.error(r,{path:e}),[]}}isDir(e){return!!this.fileExists(e)&&this[__private__dont__use].FS.isDir(this[__private__dont__use].FS.lookupPath(e).node.mode)}fileExists(e){try{return this[__private__dont__use].FS.lookupPath(e),!0}catch{return!1}}hotSwapPHPRuntime(e){const t=this[__private__dont__use].FS;try{this.exit()}catch{}if(this.initializeRuntime(e),H(this,Ze)&&this.setPhpIniPath(H(this,Ze)),H(this,Ye)&&this.setSapiName(H(this,Ye)),this.requestHandler){const e=this.documentRoot;copyFS(t,this[__private__dont__use].FS,e)}}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}te(this,Ee,!1),te(this,Re,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}}function normalizeHeaders(e){const t={};for(const r in e)t[r.toLowerCase()]=e[r];return t}function copyFS(e,t,r){let n;try{n=e.lookupPath(r)}catch{return}if(!("contents"in n.node))return;if(!e.isDir(n.node.mode))return void t.writeFile(r,e.readFile(r));t.mkdirTree(r);const o=e.readdir(r).filter((e=>"."!==e&&".."!==e));for(const s of o)copyFS(e,t,joinPaths(r,s))}Me=new WeakMap,Ze=new WeakMap,Ye=new WeakMap,Ee=new WeakMap,Re=new WeakMap,Te=new WeakMap,be=new WeakMap,Xe=new WeakMap,$t=new WeakSet,Gt=function(){if(this.setPhpIniEntry("auto_prepend_file","/internal/consts.php"),this.fileExists("/internal/consts.php")||this.writeFile("/internal/consts.php"," $value) {\n\t\t\t\t\t\tif (!defined($const) && is_scalar($value)) {\n\t\t\t\t\t\t\tdefine($const, $value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}"),H(this,Me).length>0){const e=H(this,Me).map((([e,t])=>`${e}=${t}`)).join("\n")+"\n\n";this[__private__dont__use].ccall("wasm_set_phpini_entries",null,[STRING],[e])}this[__private__dont__use].ccall("php_wasm_init",null,[],[])},yt=new WeakSet,Kt=function(){const e="/internal/headers.json";if(!this.fileExists(e))throw new Error("SAPI Error: Could not find response headers file.");const t=JSON.parse(this.readFileAsText(e)),r={};for(const n of t.headers){if(!n.includes(": "))continue;const e=n.indexOf(": "),t=n.substring(0,e).toLowerCase(),o=n.substring(e+2);t in r||(r[t]=[]),r[t].push(o)}return{headers:r,httpStatusCode:t.status}},vt=new WeakSet,Jt=function(e){if(this[__private__dont__use].ccall("wasm_set_request_uri",null,[STRING],[e]),e.includes("?")){const t=e.substring(e.indexOf("?")+1);this[__private__dont__use].ccall("wasm_set_query_string",null,[STRING],[t])}},wt=new WeakSet,Qt=function(e,t){let r;this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e]);try{r=parseInt(new URL(e).port,10)}catch{}(!r||isNaN(r)||80===r)&&(r="https"===t?443:80),this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[r]),("https"===t||!t&&443===r)&&this.addServerGlobalEntry("HTTPS","on")},Pt=new WeakSet,Zt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},Et=new WeakSet,Yt=function(e){e.cookie&&this[__private__dont__use].ccall("wasm_set_cookies",null,[STRING],[e.cookie]),e["content-type"]&&this[__private__dont__use].ccall("wasm_set_content_type",null,[STRING],[e["content-type"]]),e["content-length"]&&this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[parseInt(e["content-length"],10)]);for(const t in e){let r="HTTP_";["content-type","content-length"].includes(t.toLowerCase())&&(r=""),this.addServerGlobalEntry(`${r}${t.toUpperCase().replace(/-/g,"_")}`,e[t])}},bt=new WeakSet,Xt=function(e){let t,r;"string"==typeof e?(console.warn("Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"),r=this[__private__dont__use].lengthBytesUTF8(e),t=r+1):(r=e.byteLength,t=e.byteLength);const n=this[__private__dont__use].malloc(t);if(!n)throw new Error("Could not allocate memory for the request body.");return"string"==typeof e?this[__private__dont__use].stringToUTF8(e,n,t+1):this[__private__dont__use].HEAPU8.set(e,n),this[__private__dont__use].ccall("wasm_set_request_body",null,[NUMBER],[n]),this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[r]),n},St=new WeakSet,er=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},Rt=new WeakSet,tr=function(){for(const e in H(this,Te))this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,H(this,Te)[e]])},Tt=new WeakSet,rr=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},kt=new WeakSet,nr=function(e){this[__private__dont__use].ccall("wasm_set_php_code",null,[STRING],[e])},Ct=new WeakSet,sr=async function(){var e;let t,r;try{t=await new Promise(((e,t)=>{var n;r=e=>{console.error(e),console.error(e.error);const r=new Error("Rethrown");r.cause=e.error,r.betterMessage=e.message,t(r)},null==(n=H(this,Re))||n.addEventListener("error",r);const o=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return o instanceof Promise?o.then(e,t):e(o)}))}catch(s){for(const n in this)"function"==typeof this[n]&&(this[n]=()=>{throw new Error("PHP runtime has crashed \u2013 see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const e=s,t="betterMessage"in e?e.betterMessage:e.message,r=new Error(t);throw r.cause=e,console.error(r),r}finally{null==(e=H(this,Re))||e.removeEventListener("error",r),te(this,Te,{})}const{headers:n,httpStatusCode:o}=ce(this,yt,Kt).call(this);return new PHPResponse(o,n,this.readFileAsBuffer("/internal/stdout"),this.readFileAsText("/internal/stderr"),t)},__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdir",1),__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdirTree",1),__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsText",1),__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsBuffer",1),__decorateClass([rethrowFileSystemError('Could not write to "{path}"')],BasePHP.prototype,"writeFile",1),__decorateClass([rethrowFileSystemError('Could not unlink "{path}"')],BasePHP.prototype,"unlink",1),__decorateClass([rethrowFileSystemError('Could not remove directory "{path}"')],BasePHP.prototype,"rmdir",1),__decorateClass([rethrowFileSystemError('Could not list files in "{path}"')],BasePHP.prototype,"listFiles",1),__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"isDir",1),__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"fileExists",1);const ResourceTypes=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function isFileReference(e){return e&&"object"==typeof e&&"string"==typeof e.resource&&ResourceTypes.includes(e.resource)}class Resource{static create(e,{semaphore:t,progress:r}){let n;switch(e.resource){case"vfs":n=new VFSResource(e,r);break;case"literal":n=new LiteralResource(e,r);break;case"wordpress.org/themes":n=new CoreThemeResource(e,r);break;case"wordpress.org/plugins":n=new CorePluginResource(e,r);break;case"url":n=new UrlResource(e,r);break;default:throw new Error(`Invalid resource: ${e}`)}return n=new CachedResource(n),t&&(n=new SemaphoreResource(n,t)),n}setPlayground(e){this.playground=e}get isAsync(){return!1}}class VFSResource extends Resource{constructor(e,t){super(),this.resource=e,this.progress=t}async resolve(){var e;const t=await this.playground.readFileAsBuffer(this.resource.path);return null==(e=this.progress)||e.set(100),new File([t],this.name)}get name(){return this.resource.path.split("/").pop()||""}}class LiteralResource extends Resource{constructor(e,t){super(),this.resource=e,this.progress=t}async resolve(){var e;return null==(e=this.progress)||e.set(100),new File([this.resource.contents],this.resource.name)}get name(){return this.resource.name}}class FetchResource extends Resource{constructor(e){super(),this.progress=e}async resolve(){var e,t;null==(e=this.progress)||e.setCaption(this.caption);const r=this.getURL();let n=await fetch(r);if(n=await cloneResponseMonitorProgress(n,(null==(t=this.progress)?void 0:t.loadingListener)??noop),200!==n.status)throw new Error(`Could not download "${r}"`);return new File([await n.blob()],this.name)}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const noop=()=>{};class UrlResource extends FetchResource{constructor(e,t){super(t),this.resource=e}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class CoreThemeResource extends FetchResource{constructor(e,t){super(t),this.resource=e}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${toDirectoryZipName(this.resource.slug)}`}}class CorePluginResource extends FetchResource{constructor(e,t){super(t),this.resource=e}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${toDirectoryZipName(this.resource.slug)}`}}function toDirectoryZipName(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class DecoratedResource extends Resource{constructor(e){super(),this.resource=e}async resolve(){return this.resource.resolve()}async setPlayground(e){return this.resource.setPlayground(e)}get progress(){return this.resource.progress}set progress(e){this.resource.progress=e}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class CachedResource extends DecoratedResource{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class SemaphoreResource extends DecoratedResource{constructor(e,t){super(e),this.semaphore=t}async resolve(){return this.isAsync?this.semaphore.run((()=>super.resolve())):super.resolve()}}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ajv$1={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o {if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(o,s,i={},a){let c=t.nil;for(const l in o){const d=o[l];if(!d)continue;const p=i[l]=i[l]||new Map;d.forEach((o=>{if(p.has(o))return;p.set(o,n.Started);let i=s(o);if(i){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${i};${this.opts._n}`}else{if(!(i=null==a?void 0:a(o)))throw new r(o);c=t._`${c}${i}${this.opts._n}`}p.set(o,n.Completed)}))}return c}}}(scope),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=code$1,r=scope;var n=code$1;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=scope;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class i extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=C(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=C(this.rhs,e,r),this}get names(){return R(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends a{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class u extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=C(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(x(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>T(e,t.names)),{})}}class f extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class g extends f{}g.kind="else";class y extends f{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(j(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=C(this.condition,e,t),this}get names(){const e=super.names;return R(e,this.condition),this.else&&T(e,this.else.names),e}}y.kind="if";class _ extends f{}_.kind="for";class $ extends _{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=C(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}}class v extends _{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=R(super.names,this.from);return R(e,this.to)}}class w extends _{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=C(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}}class b extends f{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class P extends h{render(e){return"return "+super.render(e)}}P.kind="return";class E extends f{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}}class S extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}S.kind="catch";class k extends f{render(e){return"finally"+super.render(e)}}k.kind="finally";function T(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function R(e,r){return r instanceof t._CodeOrName?T(e,r.names):e}function C(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some((e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str]))?new t._Code(e._items.reduce(((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e)),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function x(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function j(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${A(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new i(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new a(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new u(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new $(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const i=this._scope.toName(e);return this._for(new v(s,i,t,n),(()=>o(i)))}forOf(e,n,o,s=r.varKinds.const){const i=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,(r=>{this.var(i,t._`${e}[${r}]`),o(i)}))}return this._for(new w("of",s,i,n),(()=>o(i)))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const i=this._scope.toName(e);return this._for(new w("in",s,i,n),(()=>o(i)))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new P;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new S(e),t(e)}return r&&(this._currNode=n.finally=new k,this.code(r)),this._endBlockNode(S,k)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new b(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=j;const N=I(e.operators.AND);e.and=function(...e){return e.reduce(N)};const O=I(e.operators.OR);function I(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${A(r)} ${e} ${A(n)}`}function A(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(O)}}(codegen);var util={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;const t=codegen,r=code$1;function n(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||"boolean"==typeof t)return;const o=n.RULES.keywords;for(const s in t)o[s]||h(e,`unknown keyword: "${s}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function s(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:e,mergeToName:r,mergeValues:n,resultToName:o}){return(s,i,a,c)=>{const l=void 0===a?i:a instanceof t.Name?(i instanceof t.Name?e(s,i,a):r(s,i,a),a):i instanceof t.Name?(r(s,a,i),i):n(i,a);return c!==t.Name||l instanceof t.Name?l:o(s,l)}}function c(e,r){if(!0===r)return e.var("props",!0);const n=e.var("props",t._`{}`);return void 0!==r&&l(e,n,r),n}function l(e,r,n){Object.keys(n).forEach((n=>e.assign(t._`${r}${(0,t.getProperty)(n)}`,!0)))}e.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:r},n,o,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return t._`${n}`}return t._`${e}${r}${(0,t.getProperty)(o)}`},e.unescapeFragment=function(e){return i(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(s(e))},e.escapeJsonPointer=s,e.unescapeJsonPointer=i,e.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},e.mergeEvaluated={props:a({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,(()=>{e.if(t._`${r} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,t._`${n} || {}`).code(t._`Object.assign(${n}, ${r})`)))})),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,(()=>{!0===r?e.assign(n,!0):(e.assign(n,t._`${n} || {}`),l(e,n,r))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:c}),items:a({mergeNames:(e,r,n)=>e.if(t._`${n} !== true && ${r} !== undefined`,(()=>e.assign(n,t._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`))),mergeToName:(e,r,n)=>e.if(t._`${n} !== true`,(()=>e.assign(n,!0===r||t._`${n} > ${r} ? ${n} : ${r}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=c,e.setEvaluated=l;const d={};var p,u;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:d[t.code]||(d[t.code]=new r._Code(t.code))})},(u=p=e.Type||(e.Type={}))[u.Num=0]="Num",u[u.Str=1]="Str",e.getErrorPath=function(e,r,n){if(e instanceof t.Name){const o=r===p.Num;return n?o?t._`"[" + ${e} + "]"`:t._`"['" + ${e} + "']"`:o?t._`"/" + ${e}`:t._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,t.getProperty)(e).toString():"/"+s(e)},e.checkStrictMode=h}(util);var names$1={};Object.defineProperty(names$1,"__esModule",{value:!0});const codegen_1$t=codegen,names={data:new codegen_1$t.Name("data"),valCxt:new codegen_1$t.Name("valCxt"),instancePath:new codegen_1$t.Name("instancePath"),parentData:new codegen_1$t.Name("parentData"),parentDataProperty:new codegen_1$t.Name("parentDataProperty"),rootData:new codegen_1$t.Name("rootData"),dynamicAnchors:new codegen_1$t.Name("dynamicAnchors"),vErrors:new codegen_1$t.Name("vErrors"),errors:new codegen_1$t.Name("errors"),this:new codegen_1$t.Name("this"),self:new codegen_1$t.Name("self"),scope:new codegen_1$t.Name("scope"),json:new codegen_1$t.Name("json"),jsonPos:new codegen_1$t.Name("jsonPos"),jsonLen:new codegen_1$t.Name("jsonLen"),jsonPart:new codegen_1$t.Name("jsonPart")};names$1.default=names,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=codegen,r=util,n=names$1;function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,t._`[${o}]`)),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,i,c){const{it:l}=r,{gen:d,compositeRule:p,allErrors:u}=l,h=a(r,n,i);c??(p||u)?o(d,h):s(l,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,i){const{it:c}=t,{gen:l,compositeRule:d,allErrors:p}=c;o(l,a(t,r,i)),d||p||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,(()=>e.if(r,(()=>e.assign(t._`${n.default.vErrors}.length`,r)),(()=>e.assign(n.default.vErrors,null)))))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:i,it:a}){if(void 0===i)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",i,n.default.errors,(i=>{e.const(c,t._`${n.default.vErrors}[${i}]`),e.if(t._`${c}.instancePath === undefined`,(()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,a.errorPath)))),e.assign(t._`${c}.schemaPath`,t.str`${a.errSchemaPath}/${r}`),a.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))}))};const i={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function a(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:a}=e,d=[c(a,o),l(e,o)];return function(e,{params:r,message:o},s){const{keyword:a,data:c,schemaValue:l,it:d}=e,{opts:p,propertyName:u,topSchemaRef:h,schemaPath:f}=d;s.push([i.keyword,a],[i.params,"function"==typeof r?r(e):r||t._`{}`]),p.messages&&s.push([i.message,"function"==typeof o?o(e):o]),p.verbose&&s.push([i.schema,l],[i.parentSchema,t._`${h}${f}`],[n.default.data,c]),u&&s.push([i.propertyName,u])}(e,r,d),s.object(...d)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function l({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let a=s?n:t.str`${n}/${e}`;return o&&(a=t.str`${a}${(0,r.getErrorPath)(o,r.Type.Str)}`),[i.schemaPath,a]}}(errors),Object.defineProperty(boolSchema,"__esModule",{value:!0}),boolSchema.boolOrEmptySchema=boolSchema.topBoolOrEmptySchema=void 0;const errors_1$2=errors,codegen_1$s=codegen,names_1$6=names$1,boolError={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:n}=e;!1===r?falseSchemaError(e,!1):"object"==typeof r&&!0===r.$async?t.return(names_1$6.default.data):(t.assign(codegen_1$s._`${n}.errors`,null),t.return(!0))}function boolOrEmptySchema(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),falseSchemaError(e)):r.var(t,!0)}function falseSchemaError(e,t){const{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,errors_1$2.reportError)(o,boolError,void 0,t)}boolSchema.topBoolOrEmptySchema=topBoolOrEmptySchema,boolSchema.boolOrEmptySchema=boolOrEmptySchema;var dataType={},rules={};Object.defineProperty(rules,"__esModule",{value:!0}),rules.getRules=rules.isJSONType=void 0;const _jsonTypes=["string","number","integer","boolean","null","object","array"],jsonTypes=new Set(_jsonTypes);function isJSONType(e){return"string"==typeof e&&jsonTypes.has(e)}function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}rules.isJSONType=isJSONType,rules.getRules=getRules;var applicability={};function schemaHasRulesForType({schema:e,self:t},r){const n=t.RULES.types[r];return n&&!0!==n&&shouldUseGroup(e,n)}function shouldUseGroup(e,t){return t.rules.some((t=>shouldUseRule(e,t)))}function shouldUseRule(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}Object.defineProperty(applicability,"__esModule",{value:!0}),applicability.shouldUseRule=applicability.shouldUseGroup=applicability.schemaHasRulesForType=void 0,applicability.schemaHasRulesForType=schemaHasRulesForType,applicability.shouldUseGroup=shouldUseGroup,applicability.shouldUseRule=shouldUseRule,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=rules,r=applicability,n=errors,o=codegen,s=util;var i,a;function c(e){const r=Array.isArray(e)?e:e?[e]:[];if(r.every(t.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=i=e.DataType||(e.DataType={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",e.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=c,e.coerceAndCheckDataType=function(e,t){const{gen:n,data:s,opts:a}=e,c=function(e,t){return t?e.filter((e=>l.has(e)||"array"===t&&"array"===e)):[]}(t,a.coerceTypes),d=t.length>0&&!(0===c.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(d){const r=p(t,s,a.strictNumbers,i.Wrong);n.if(r,(()=>{c.length?function(e,t,r){const{gen:n,data:s,opts:i}=e,a=n.let("dataType",o._`typeof ${s}`),c=n.let("coerced",o._`undefined`);"array"===i.coerceTypes&&n.if(o._`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,(()=>n.assign(s,o._`${s}[0]`).assign(a,o._`typeof ${s}`).if(p(t,s,i.strictNumbers),(()=>n.assign(c,s))))),n.if(o._`${c} !== undefined`);for(const o of r)(l.has(o)||"array"===o&&"array"===i.coerceTypes)&&d(o);function d(e){switch(e){case"string":return void n.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(c,o._`"" + ${s}`).elseIf(o._`${s} === null`).assign(c,o._`""`);case"number":return void n.elseIf(o._`${a} == "boolean" || ${s} === null - || (${a} == "string" && ${s} && ${s} == +${s})`).assign(c,o._`+${s}`);case"integer":return void n.elseIf(o._`${a} === "boolean" || ${s} === null - || (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(c,o._`+${s}`);case"boolean":return void n.elseIf(o._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(c,!1).elseIf(o._`${s} === "true" || ${s} === 1`).assign(c,!0);case"null":return n.elseIf(o._`${s} === "" || ${s} === 0 || ${s} === false`),void n.assign(c,null);case"array":n.elseIf(o._`${a} === "string" || ${a} === "number" - || ${a} === "boolean" || ${s} === null`).assign(c,o._`[${s}]`)}}n.else(),h(e),n.endIf(),n.if(o._`${c} !== undefined`,(()=>{n.assign(s,c),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${r}]`,n)))}(e,c)}))}(e,t,c):h(e)}))}return d};const l=new Set(["string","number","integer","boolean","null"]);function d(e,t,r,n=i.Correct){const s=n===i.Correct?o.operators.EQ:o.operators.NEQ;let a;switch(e){case"null":return o._`${t} ${s} null`;case"array":a=o._`Array.isArray(${t})`;break;case"object":a=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=c(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=c();break;default:return o._`typeof ${t} ${s} ${e}`}return n===i.Correct?a:(0,o.not)(a);function c(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,r?o._`isFinite(${t})`:o.nil)}}function p(e,t,r,n){if(1===e.length)return d(e[0],t,r,n);let i;const a=(0,s.toHash)(e);if(a.array&&a.object){const e=o._`typeof ${t} != "object"`;i=a.null?e:o._`!${t} || ${e}`,delete a.null,delete a.array,delete a.object}else i=o.nil;a.number&&delete a.integer;for(const s in a)i=(0,o.and)(i,d(s,t,r,n));return i}e.checkDataType=d,e.checkDataTypes=p;const u={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:r,schema:n}=e,o=(0,s.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}(e);(0,n.reportError)(t,u)}e.reportTypeError=h}(dataType);var defaults={};Object.defineProperty(defaults,"__esModule",{value:!0}),defaults.assignDefaults=void 0;const codegen_1$r=codegen,util_1$p=util;function assignDefaults(e,t){const{properties:r,items:n}=e.schema;if("object"===t&&r)for(const o in r)assignDefault(e,o,r[o].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,r)=>assignDefault(e,r,t.default)))}function assignDefault(e,t,r){const{gen:n,compositeRule:o,data:s,opts:i}=e;if(void 0===r)return;const a=codegen_1$r._`${s}${(0,codegen_1$r.getProperty)(t)}`;if(o)return void(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${a}`);let c=codegen_1$r._`${a} === undefined`;"empty"===i.useDefaults&&(c=codegen_1$r._`${c} || ${a} === null || ${a} === ""`),n.if(c,codegen_1$r._`${a} = ${(0,codegen_1$r.stringify)(r)}`)}defaults.assignDefaults=assignDefaults;var keyword={},code={};Object.defineProperty(code,"__esModule",{value:!0}),code.validateUnion=code.validateArray=code.usePattern=code.callValidateCode=code.schemaProperties=code.allSchemaProperties=code.noPropertyInData=code.propertyInData=code.isOwnProperty=code.hasPropFunc=code.reportMissingProp=code.checkMissingProp=code.checkReportMissingProp=void 0;const codegen_1$q=codegen,util_1$o=util,names_1$5=names$1,util_2$1=util;function checkReportMissingProp(e,t){const{gen:r,data:n,it:o}=e;r.if(noPropertyInData(r,n,t,o.opts.ownProperties),(()=>{e.setParams({missingProperty:codegen_1$q._`${t}`},!0),e.error()}))}function checkMissingProp({gen:e,data:t,it:{opts:r}},n,o){return(0,codegen_1$q.or)(...n.map((n=>(0,codegen_1$q.and)(noPropertyInData(e,t,n,r.ownProperties),codegen_1$q._`${o} = ${n}`))))}function reportMissingProp(e,t){e.setParams({missingProperty:t},!0),e.error()}function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:codegen_1$q._`Object.prototype.hasOwnProperty`})}function isOwnProperty(e,t,r){return codegen_1$q._`${hasPropFunc(e)}.call(${t}, ${r})`}function propertyInData(e,t,r,n){const o=codegen_1$q._`${t}${(0,codegen_1$q.getProperty)(r)} !== undefined`;return n?codegen_1$q._`${o} && ${isOwnProperty(e,t,r)}`:o}function noPropertyInData(e,t,r,n){const o=codegen_1$q._`${t}${(0,codegen_1$q.getProperty)(r)} === undefined`;return n?(0,codegen_1$q.or)(o,(0,codegen_1$q.not)(isOwnProperty(e,t,r))):o}function allSchemaProperties(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}function schemaProperties(e,t){return allSchemaProperties(t).filter((r=>!(0,util_1$o.alwaysValidSchema)(e,t[r])))}function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,l){const d=l?codegen_1$q._`${e}, ${t}, ${n}${o}`:t,p=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,s)],[names_1$5.default.parentData,i.parentData],[names_1$5.default.parentDataProperty,i.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];i.opts.dynamicRef&&p.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const u=codegen_1$q._`${d}, ${r.object(...p)}`;return c!==codegen_1$q.nil?codegen_1$q._`${a}.call(${c}, ${u})`:codegen_1$q._`${a}(${u})`}code.checkReportMissingProp=checkReportMissingProp,code.checkMissingProp=checkMissingProp,code.reportMissingProp=reportMissingProp,code.hasPropFunc=hasPropFunc,code.isOwnProperty=isOwnProperty,code.propertyInData=propertyInData,code.noPropertyInData=noPropertyInData,code.allSchemaProperties=allSchemaProperties,code.schemaProperties=schemaProperties,code.callValidateCode=callValidateCode;const newRegExp=codegen_1$q._`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:codegen_1$q._`${"new RegExp"===o.code?newRegExp:(0,util_2$1.useFunc)(e,o)}(${r}, ${n})`})}function validateArray(e){const{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return i((()=>t.assign(e,!1))),e}return t.var(s,!0),i((()=>t.break())),s;function i(o){const i=t.const("len",codegen_1$q._`${r}.length`);t.forRange("i",0,i,(r=>{e.subschema({keyword:n,dataProp:r,dataPropType:util_1$o.Type.Num},s),t.if((0,codegen_1$q.not)(s),o)}))}}function validateUnion(e){const{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((e=>(0,util_1$o.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const s=t.let("valid",!1),i=t.name("_valid");t.block((()=>r.forEach(((r,o)=>{const a=e.subschema({keyword:n,schemaProp:o,compositeRule:!0},i);t.assign(s,codegen_1$q._`${s} || ${i}`),e.mergeValidEvaluated(a,i)||t.if((0,codegen_1$q.not)(s))})))),e.result(s,(()=>e.reset()),(()=>e.error(!0)))}code.usePattern=usePattern,code.validateArray=validateArray,code.validateUnion=validateUnion,Object.defineProperty(keyword,"__esModule",{value:!0}),keyword.validateKeywordUsage=keyword.validSchemaType=keyword.funcKeywordCode=keyword.macroKeywordCode=void 0;const codegen_1$p=codegen,names_1$4=names$1,code_1$9=code,errors_1$1=errors;function macroKeywordCode(e,t){const{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=useKeyword(r,n,a);!1!==i.opts.validateSchema&&i.self.validateSchema(a,!0);const l=r.name("valid");e.subschema({schema:a,schemaPath:codegen_1$p.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,(()=>e.error(!0)))}function funcKeywordCode(e,t){var r;const{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;checkAsyncKeyword(c,t);const l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,d=useKeyword(n,o,l),p=n.let("valid");function u(r=(t.async?codegen_1$p._`await `:codegen_1$p.nil)){const o=c.opts.passContext?names_1$4.default.this:names_1$4.default.self,s=!("compile"in t&&!a||!1===t.schema);n.assign(p,codegen_1$p._`${r}${(0,code_1$9.callValidateCode)(e,d,o,s)}`,t.modifying)}function h(e){var r;n.if((0,codegen_1$p.not)(null!==(r=t.valid)&&void 0!==r?r:p),e)}e.block$data(p,(function(){if(!1===t.errors)u(),t.modifying&&modifyData(e),h((()=>e.error()));else{const r=t.async?function(){const e=n.let("ruleErrs",null);return n.try((()=>u(codegen_1$p._`await `)),(t=>n.assign(p,!1).if(codegen_1$p._`${t} instanceof ${c.ValidationError}`,(()=>n.assign(e,codegen_1$p._`${t}.errors`)),(()=>n.throw(t))))),e}():function(){const e=codegen_1$p._`${d}.errors`;return n.assign(e,null),u(codegen_1$p.nil),e}();t.modifying&&modifyData(e),h((()=>addErrs(e,r)))}})),e.ok(null!==(r=t.valid)&&void 0!==r?r:p)}function modifyData(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,(()=>t.assign(r,codegen_1$p._`${n.parentData}[${n.parentDataProperty}]`)))}function addErrs(e,t){const{gen:r}=e;r.if(codegen_1$p._`Array.isArray(${t})`,(()=>{r.assign(names_1$4.default.vErrors,codegen_1$p._`${names_1$4.default.vErrors} === null ? ${t} : ${names_1$4.default.vErrors}.concat(${t})`).assign(names_1$4.default.errors,codegen_1$p._`${names_1$4.default.vErrors}.length`),(0,errors_1$1.extendErrors)(e)}),(()=>e.error()))}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,codegen_1$p.stringify)(r)})}function validSchemaType(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&typeof e>"u"))}function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const i=o.dependencies;if(null!=i&&i.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}keyword.macroKeywordCode=macroKeywordCode,keyword.funcKeywordCode=funcKeywordCode,keyword.validSchemaType=validSchemaType,keyword.validateKeywordUsage=validateKeywordUsage;var subschema={};Object.defineProperty(subschema,"__esModule",{value:!0}),subschema.extendSubschemaMode=subschema.extendSubschemaData=subschema.getSubschema=void 0;const codegen_1$o=codegen,util_1$n=util;function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(void 0!==t&&void 0!==n)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const n=e.schema[t];return void 0===r?{schema:n,schemaPath:codegen_1$o._`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:n[r],schemaPath:codegen_1$o._`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}${(0,codegen_1$o.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,util_1$n.escapeFragment)(r)}`}}if(void 0!==n){if(void 0===o||void 0===s||void 0===i)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(void 0!==o&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=t;if(void 0!==r){const{errorPath:o,dataPathArr:s,opts:i}=t;c(a.let("data",codegen_1$o._`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0)),e.errorPath=codegen_1$o.str`${o}${(0,util_1$n.getErrorPath)(r,n,i.jsPropertySyntax)}`,e.parentDataProperty=codegen_1$o._`${r}`,e.dataPathArr=[...s,e.parentDataProperty]}if(void 0!==o){c(o instanceof codegen_1$o.Name?o:a.let("data",o,!0)),void 0!==i&&(e.propertyName=i)}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}s&&(e.dataTypes=s)}function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}subschema.getSubschema=getSubschema,subschema.extendSubschemaData=extendSubschemaData,subschema.extendSubschemaMode=extendSubschemaMode;var resolve$1={},fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!=o--;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r},jsonSchemaTraverse={exports:{}},traverse$1=jsonSchemaTraverse.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),_traverse(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function _traverse(e,t,r,n,o,s,i,a,c,l){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var d in t(n,o,s,i,a,c,l),n){var p=n[d];if(Array.isArray(p)){if(d in traverse$1.arrayKeywords)for(var u=0;u t+=countKeys(e))),t===1/0))return 1/0}return t}function getFullPath(e,t="",r){!1!==r&&(t=normalizeId(t));const n=e.parse(t);return _getFullPath(e,n)}function _getFullPath(e,t){return e.serialize(t).split("#")[0]+"#"}resolve$1.getFullPath=getFullPath,resolve$1._getFullPath=_getFullPath;const TRAILING_SLASH_HASH=/#\/?$/;function normalizeId(e){return e?e.replace(TRAILING_SLASH_HASH,""):""}function resolveUrl(e,t,r){return r=normalizeId(r),e.resolve(t,r)}resolve$1.normalizeId=normalizeId,resolve$1.resolveUrl=resolveUrl;const ANCHOR=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,o=normalizeId(e[r]||t),s={"":o},i=getFullPath(n,o,!1),a={},c=new Set;return traverse(e,{allKeys:!0},((e,t,n,o)=>{if(void 0===o)return;const p=i+t;let u=s[o];function h(t){const r=this.opts.uriResolver.resolve;if(t=normalizeId(u?r(u,t):t),c.has(t))throw d(t);c.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?l(e,n.schema,t):t!==normalizeId(p)&&("#"===t[0]?(l(e,a[t],t),a[t]=e):this.refs[t]=p),t}function f(e){if("string"==typeof e){if(!ANCHOR.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[r]&&(u=h.call(this,e[r])),f.call(this,e.$anchor),f.call(this,e.$dynamicAnchor),s[t]=u})),a;function l(e,t,r){if(void 0!==t&&!equal$2(e,t))throw d(r)}function d(e){return new Error(`reference "${e}" resolves to more than one schema`)}}resolve$1.getSchemaRefs=getSchemaRefs,Object.defineProperty(validate,"__esModule",{value:!0}),validate.getData=validate.KeywordCxt=validate.validateFunctionCode=void 0;const boolSchema_1=boolSchema,dataType_1$1=dataType,applicability_1=applicability,dataType_2=dataType,defaults_1=defaults,keyword_1=keyword,subschema_1=subschema,codegen_1$n=codegen,names_1$3=names$1,resolve_1$2=resolve$1,util_1$l=util,errors_1=errors;function validateFunctionCode(e){isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))?topSchemaObjCode(e):validateFunction(e,(()=>(0,boolSchema_1.topBoolOrEmptySchema)(e)))}function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,codegen_1$n._`${names_1$3.default.data}, ${names_1$3.default.valCxt}`,n.$async,(()=>{e.code(codegen_1$n._`"use strict"; ${funcSourceUrl(r,o)}`),destructureValCxtES5(e,o),e.code(s)})):e.func(t,codegen_1$n._`${names_1$3.default.data}, ${destructureValCxt(o)}`,n.$async,(()=>e.code(funcSourceUrl(r,o)).code(s)))}function destructureValCxt(e){return codegen_1$n._`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${e.dynamicRef?codegen_1$n._`, ${names_1$3.default.dynamicAnchors}={}`:codegen_1$n.nil}}={}`}function destructureValCxtES5(e,t){e.if(names_1$3.default.valCxt,(()=>{e.var(names_1$3.default.instancePath,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`),e.var(names_1$3.default.parentData,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`),e.var(names_1$3.default.parentDataProperty,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`),e.var(names_1$3.default.rootData,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,codegen_1$n._`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`)}),(()=>{e.var(names_1$3.default.instancePath,codegen_1$n._`""`),e.var(names_1$3.default.parentData,codegen_1$n._`undefined`),e.var(names_1$3.default.parentDataProperty,codegen_1$n._`undefined`),e.var(names_1$3.default.rootData,names_1$3.default.data),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,codegen_1$n._`{}`)}))}function topSchemaObjCode(e){const{schema:t,opts:r,gen:n}=e;validateFunction(e,(()=>{r.$comment&&t.$comment&&commentKeyword(e),checkNoDefault(e),n.let(names_1$3.default.vErrors,null),n.let(names_1$3.default.errors,0),r.unevaluated&&resetEvaluated(e),typeAndKeywords(e),returnResults(e)}))}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",codegen_1$n._`${r}.evaluated`),t.if(codegen_1$n._`${e.evaluated}.dynamicProps`,(()=>t.assign(codegen_1$n._`${e.evaluated}.props`,codegen_1$n._`undefined`))),t.if(codegen_1$n._`${e.evaluated}.dynamicItems`,(()=>t.assign(codegen_1$n._`${e.evaluated}.items`,codegen_1$n._`undefined`)))}function funcSourceUrl(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?codegen_1$n._`/*# sourceURL=${r} */`:codegen_1$n.nil}function subschemaCode(e,t){isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))?subSchemaObjCode(e,t):(0,boolSchema_1.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function isSchemaObj(e){return"boolean"!=typeof e.schema}function subSchemaObjCode(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&commentKeyword(e),updateContext(e),checkAsyncSchema(e);const s=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,s),n.var(t,codegen_1$n._`${s} === ${names_1$3.default.errors}`)}function checkKeywords(e){(0,util_1$l.checkUnknownRules)(e),checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],!1,t);const r=(0,dataType_1$1.getSchemaTypes)(e.schema);schemaKeywords(e,r,!(0,dataType_1$1.coerceAndCheckDataType)(e,r),t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function checkNoDefault(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,util_1$l.checkStrictMode)(e,"default is ignored in the schema root")}function updateContext(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,resolve_1$2.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(codegen_1$n._`${names_1$3.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=codegen_1$n.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(codegen_1$n._`${names_1$3.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(codegen_1$n._`${names_1$3.default.errors} === 0`,(()=>t.return(names_1$3.default.data)),(()=>t.throw(codegen_1$n._`new ${o}(${names_1$3.default.vErrors})`))):(t.assign(codegen_1$n._`${n}.errors`,names_1$3.default.vErrors),s.unevaluated&&assignEvaluated(e),t.return(codegen_1$n._`${names_1$3.default.errors} === 0`))}function assignEvaluated({gen:e,evaluated:t,props:r,items:n}){r instanceof codegen_1$n.Name&&e.assign(codegen_1$n._`${t}.props`,r),n instanceof codegen_1$n.Name&&e.assign(codegen_1$n._`${t}.items`,n)}function schemaKeywords(e,t,r,n){const{gen:o,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:d}=l;function p(l){(0,applicability_1.shouldUseGroup)(s,l)&&(l.type?(o.if((0,dataType_2.checkDataType)(l.type,i,c.strictNumbers)),iterateKeywords(e,l),1===t.length&&t[0]===l.type&&r&&(o.else(),(0,dataType_2.reportTypeError)(e)),o.endIf()):iterateKeywords(e,l),a||o.if(codegen_1$n._`${names_1$3.default.errors} === ${n||0}`))}!s.$ref||!c.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(s,d)?(c.jtd||checkStrictTypes(e,t),o.block((()=>{for(const e of d.rules)p(e);p(d.post)}))):o.block((()=>keywordCode(e,"$ref",d.all.$ref.definition)))}function iterateKeywords(e,t){const{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,defaults_1.assignDefaults)(e,t.type),r.block((()=>{for(const r of t.rules)(0,applicability_1.shouldUseRule)(n,r)&&keywordCode(e,r.keyword,r.definition,t.type)}))}function checkStrictTypes(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(checkContextTypes(e,t),e.opts.allowUnionTypes||checkMultipleTypes(e,t),checkKeywordTypes(e,e.dataTypes))}function checkContextTypes(e,t){if(t.length){if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{includesType(e.dataTypes,t)||strictTypesError(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),narrowSchemaTypes(e,t)}}function checkMultipleTypes(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&strictTypesError(e,"use allowUnionTypes to allow union type keyword")}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const n in r){const o=r[n];if("object"==typeof o&&(0,applicability_1.shouldUseRule)(e.schema,o)){const{type:r}=o.definition;r.length&&!r.some((e=>hasApplicableType(t,e)))&&strictTypesError(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}function hasApplicableType(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function includesType(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function narrowSchemaTypes(e,t){const r=[];for(const n of e.dataTypes)includesType(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}function strictTypesError(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,util_1$l.checkStrictMode)(e,t,e.opts.strictTypes)}validate.validateFunctionCode=validateFunctionCode;class KeywordCxt{constructor(e,t,r){if((0,keyword_1.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,util_1$l.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",getData(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,keyword_1.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",names_1$3.default.errors))}result(e,t,r){this.failResult((0,codegen_1$n.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,codegen_1$n.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(codegen_1$n._`${t} !== undefined && (${(0,codegen_1$n.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?errors_1.reportExtraError:errors_1.reportError)(this,this.def.error,t)}$dataError(){(0,errors_1.reportError)(this,this.def.$dataError||errors_1.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,errors_1.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=codegen_1$n.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=codegen_1$n.nil,t=codegen_1$n.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,codegen_1$n.or)(codegen_1$n._`${n} === undefined`,t)),e!==codegen_1$n.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==codegen_1$n.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return(0,codegen_1$n.or)(function(){if(r.length){if(!(t instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return codegen_1$n._`${(0,dataType_2.checkDataTypes)(e,t,o.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return codegen_1$n._`!${r}(${t})`}return codegen_1$n.nil}())}subschema(e,t){const r=(0,subschema_1.getSubschema)(this.it,e);(0,subschema_1.extendSubschemaData)(r,this.it,e),(0,subschema_1.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return subschemaCode(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=util_1$l.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=util_1$l.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,codegen_1$n.Name))),!0}}function keywordCode(e,t,r,n){const o=new KeywordCxt(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,keyword_1.funcKeywordCode)(o,r):"macro"in r?(0,keyword_1.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,keyword_1.funcKeywordCode)(o,r)}validate.KeywordCxt=KeywordCxt;const JSON_POINTER=/^\/(?:[^~]|~0|~1)*$/,RELATIVE_JSON_POINTER=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return names_1$3.default.rootData;if("/"===e[0]){if(!JSON_POINTER.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=names_1$3.default.rootData}else{const i=RELATIVE_JSON_POINTER.exec(e);if(!i)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+i[1];if(o=i[2],"#"===o){if(a>=t)throw new Error(c("property/index",a));return n[t-a]}if(a>t)throw new Error(c("data",a));if(s=r[t-a],!o)return s}let i=s;const a=o.split("/");for(const l of a)l&&(s=codegen_1$n._`${s}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(l))}`,i=codegen_1$n._`${i} && ${s}`);return i;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}validate.getData=getData;var validation_error={};Object.defineProperty(validation_error,"__esModule",{value:!0});class ValidationError extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}validation_error.default=ValidationError;var ref_error={};Object.defineProperty(ref_error,"__esModule",{value:!0});const resolve_1$1=resolve$1;class MissingRefError extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,resolve_1$1.resolveUrl)(e,t,r),this.missingSchema=(0,resolve_1$1.normalizeId)((0,resolve_1$1.getFullPath)(e,this.missingRef))}}ref_error.default=MissingRefError;var compile={};Object.defineProperty(compile,"__esModule",{value:!0}),compile.resolveSchema=compile.getCompilingSchema=compile.resolveRef=compile.compileSchema=compile.SchemaEnv=void 0;const codegen_1$m=codegen,validation_error_1=validation_error,names_1$2=names$1,resolve_1=resolve$1,util_1$k=util,validate_1$1=validate;class SchemaEnv{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,resolve_1.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s});let a;e.$async&&(a=i.scopeValue("Error",{ref:validation_error_1.default,code:codegen_1$m._`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const l={gen:i,allErrors:this.opts.allErrors,data:names_1$2.default.data,parentData:names_1$2.default.parentData,parentDataProperty:names_1$2.default.parentDataProperty,dataNames:[names_1$2.default.data],dataPathArr:[codegen_1$m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:codegen_1$m.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:codegen_1$m._`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);const t=i.toString();d=`${i.scopeRefs(names_1$2.default.scope)}return ${t}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const r=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:c,validateCode:t,scopeValues:i._values}),this.opts.unevaluated){const{props:e,items:t}=l;r.evaluated={props:e instanceof codegen_1$m.Name?void 0:e,items:t instanceof codegen_1$m.Name?void 0:t,dynamicProps:e instanceof codegen_1$m.Name,dynamicItems:t instanceof codegen_1$m.Name},r.source&&(r.source.evaluated=(0,codegen_1$m.stringify)(r.evaluated))}return e.validate=r,e}catch(p){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),p}finally{this._compilations.delete(e)}}function resolveRef(e,t,r){var n;r=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r);const o=e.refs[r];if(o)return o;let s=resolve.call(this,e,r);if(void 0===s){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:i}=this.opts;o&&(s=new SchemaEnv({schema:o,schemaId:i,root:e,baseId:t}))}return void 0!==s?e.refs[r]=inlineOrCompile.call(this,s):void 0}function inlineOrCompile(e){return(0,resolve_1.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations)if(sameSchemaEnv(t,e))return t}function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t),n=(0,resolve_1._getFullPath)(this.opts.uriResolver,r);let o=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return getJsonPointer.call(this,r,e);const s=(0,resolve_1.normalizeId)(n),i=this.refs[s]||this.schemas[s];if("string"==typeof i){const t=resolveSchema.call(this,e,i);return"object"!=typeof(null==t?void 0:t.schema)?void 0:getJsonPointer.call(this,r,t)}if("object"==typeof(null==i?void 0:i.schema)){if(i.validate||compileSchema.call(this,i),s===(0,resolve_1.normalizeId)(t)){const{schema:t}=i,{schemaId:r}=this.opts,n=t[r];return n&&(o=(0,resolve_1.resolveUrl)(this.opts.uriResolver,o,n)),new SchemaEnv({schema:t,schemaId:r,root:e,baseId:o})}return getJsonPointer.call(this,r,i)}}compile.SchemaEnv=SchemaEnv,compile.compileSchema=compileSchema,compile.resolveRef=resolveRef,compile.getCompilingSchema=getCompilingSchema,compile.resolveSchema=resolveSchema;const PREVENT_SCOPE_CHANGE=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:n}){var o;if("/"!==(null===(o=e.fragment)||void 0===o?void 0:o[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,util_1$k.unescapeFragment)(a)];if(void 0===e)return;const n="object"==typeof(r=e)&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(a)&&n&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,n))}let s;if("boolean"!=typeof r&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const e=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=resolveSchema.call(this,n,e)}const{schemaId:i}=this.opts;return s=s||new SchemaEnv({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema?s:void 0}const $id$1="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description="Meta-schema for $data reference (JSON AnySchema extension proposal)",type$1="object",required$1=["$data"],properties$2={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties$1=!1,require$$9={$id:$id$1,description:description,type:type$1,required:required$1,properties:properties$2,additionalProperties:additionalProperties$1};var uri$1={},uri_all={exports:{}},t;t=uri_all.exports,function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r 1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,o=1;o = 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=h-f,k=Math.floor,T=String.fromCharCode;function R(e){throw new RangeError(E[e])}function C(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}function x(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+C((e=e.replace(P,".")).split("."),t).join(".")}function j(e){for(var t=[],r=0,n=e.length;r =55296&&o<=56319&&r >1,e+=k(e/t);e>S*m>>1;n+=h)e=k(e/S);return k(n+(S+1)*e/(e+g))},A=function(e){var t=[],r=e.length,n=0,o=$,s=_,i=e.lastIndexOf(v);i<0&&(i=0);for(var a=0;a=128&&R("not-basic"),t.push(e.charCodeAt(a));for(var c=i>0?i+1:0;c =r&&R("invalid-input");var g=N(e.charCodeAt(c++));(g>=h||g>k((u-n)/d))&&R("overflow"),n+=g*d;var y=p<=s?f:p>=s+m?m:p-s;if(g k(u/w)&&R("overflow"),d*=w}var b=t.length+1;s=I(n-l,b,0==l),k(n/b)>u-o&&R("overflow"),o+=k(n/b),n%=b,t.splice(n++,0,o)}return String.fromCodePoint.apply(String,t)},F=function(e){var t=[],r=(e=j(e)).length,n=$,o=0,s=_,i=!0,a=!1,c=void 0;try{for(var l,d=e[Symbol.iterator]();!(i=(l=d.next()).done);i=!0){var p=l.value;p<128&&t.push(T(p))}}catch(B){a=!0,c=B}finally{try{!i&&d.return&&d.return()}finally{if(a)throw c}}var g=t.length,y=g;for(g&&t.push(v);y =n&&x k((u-o)/N)&&R("overflow"),o+=(w-n)*N,n=w;var A=!0,F=!1,D=void 0;try{for(var M,q=e[Symbol.iterator]();!(A=(M=q.next()).done);A=!0){var H=M.value;if(H u&&R("overflow"),H==n){for(var L=o,U=h;;U+=h){var W=U<=s?f:U>=s+m?m:U-s;if(L >6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function U(e){for(var t="",r=0,n=e.length;r =194&&o<224){if(n-r>=6){var s=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&o)<<6|63&s)}else t+=e.substr(r,6);r+=6}else if(o>=224){if(n-r>=9){var i=parseInt(e.substr(r+4,2),16),a=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function W(e,t){function r(e){var r=U(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,L).replace(t.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,L).replace(t.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,L).replace(t.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,L).replace(t.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,L).replace(t.PCT_ENCODED,o)),e}function V(e){return e.replace(/^0*(.*)/,"$1")||"0"}function z(e,t){var r=e.match(t.IPV4ADDRESS)||[],n=d(r,2)[1];return n?n.split(".").map(V).join("."):e}function B(e,t){var r=e.match(t.IPV6ADDRESS)||[],n=d(r,3),o=n[1],s=n[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),a=d(i,2),c=a[0],l=a[1],p=l?l.split(":").map(V):[],u=c.split(":").map(V),h=t.IPV4ADDRESS.test(u[u.length-1]),f=h?7:8,m=u.length-f,g=Array(f),y=0;y 1){var v=g.slice(0,_.index),w=g.slice(_.index+_.length);$=v.join(":")+"::"+w.join(":")}else $=g.join(":");return s&&($+="%"+s),$}return e}var G=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,K=void 0==="".match(/(){0}/)[1];function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?l:c;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var o=e.match(G);if(o){K?(r.scheme=o[1],r.userinfo=o[3],r.host=o[4],r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=o[7],r.fragment=o[8],isNaN(r.port)&&(r.port=o[5])):(r.scheme=o[1]||void 0,r.userinfo=-1!==e.indexOf("@")?o[3]:void 0,r.host=-1!==e.indexOf("//")?o[4]:void 0,r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=-1!==e.indexOf("?")?o[7]:void 0,r.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),r.host&&(r.host=B(z(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var s=H[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||s&&s.unicodeSupport)W(r,n);else{if(r.host&&(t.domainHost||s&&s.domainHost))try{r.host=q.toASCII(r.host.replace(n.PCT_ENCODED,U).toLowerCase())}catch(i){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+i}W(r,c)}s&&s.parse&&s.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function J(e,t){var r=!1!==t.iri?l:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(B(z(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),("number"==typeof e.port||"string"==typeof e.port)&&(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var Z=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(Z))e=e.replace(Z,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(ee);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?l:c,n=[],o=H[(t.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,t),e.host&&!r.IPV6ADDRESS.test(e.host)&&(t.domainHost||o&&o.domainHost))try{e.host=t.iri?q.toUnicode(e.host):q.toASCII(e.host.replace(r.PCT_ENCODED,U).toLowerCase())}catch(a){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+a}W(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var s=J(e,t);if(void 0!==s&&("suffix"!==t.reference&&n.push("//"),n.push(s),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var i=e.path;!t.absolutePath&&(!o||!o.absolutePath)&&(i=te(i)),void 0===s&&(i=i.replace(/^\/\//,"/%2F")),n.push(i)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=Q(re(e,r),r),t=Q(re(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=te(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=te(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=te(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function oe(e,t,r){var n=i({scheme:"null"},r);return re(ne(Q(e,n),Q(t,n),n,!0),n)}function se(e,t){return"string"==typeof e?e=re(Q(e,t),t):"object"===n(e)&&(e=Q(re(e,t),t)),e}function ie(e,t,r){return"string"==typeof e?e=re(Q(e,r),r):"object"===n(e)&&(e=re(e,r)),"string"==typeof t?t=re(Q(t,r),r):"object"===n(t)&&(t=re(t,r)),e===t}function ae(e,t){return e&&e.toString().replace(t&&t.iri?l.ESCAPE:c.ESCAPE,L)}function ce(e,t){return e&&e.toString().replace(t&&t.iri?l.PCT_ENCODED:c.PCT_ENCODED,U)}var le={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return(e.port===(r?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}},de={scheme:"https",domainHost:le.domainHost,parse:le.parse,serialize:le.serialize};function pe(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var ue={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=pe(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if((e.port===(pe(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),n=d(r,2),o=n[0],s=n[1];e.path=o&&"/"!==o?o:void 0,e.query=s,e.resourceName=void 0}return e.fragment=void 0,e}},he={scheme:"wss",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize},fe={},me="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ye=r(r("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+r("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+r("%"+ge+ge)),_e="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",$e=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),ve="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",we=new RegExp(me,"g"),be=new RegExp(ye,"g"),Pe=new RegExp(t("[^]",_e,"[\\.]",'[\\"]',$e),"g"),Ee=new RegExp(t("[^]",me,ve),"g"),Se=Ee;function ke(e){var t=U(e);return t.match(we)?t:e}var Te={scheme:"mailto",parse:function(e,t){var r=e,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var o=!1,s={},i=r.query.split("&"),a=0,c=i.length;a new RegExp(e,t);h.code="new RegExp";const f=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function _(e){var t,r,n,o,s,i,a,c,l,d,p,f,m,g,y,_,$,v,w,b,P,E,S,k,T;const R=e.strict,C=null===(t=e.code)||void 0===t?void 0:t.optimize,x=!0===C||void 0===C?1:C||0,j=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,N=null!==(o=e.uriResolver)&&void 0!==o?o:u.default;return{strictSchema:null===(i=null!==(s=e.strictSchema)&&void 0!==s?s:R)||void 0===i||i,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:R)||void 0===c||c,strictTypes:null!==(d=null!==(l=e.strictTypes)&&void 0!==l?l:R)&&void 0!==d?d:"log",strictTuples:null!==(f=null!==(p=e.strictTuples)&&void 0!==p?p:R)&&void 0!==f?f:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:R)&&void 0!==g&&g,code:e.code?{...e.code,optimize:x,regExp:j}:{optimize:x,regExp:j},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(_=e.loopEnum)&&void 0!==_?_:200,meta:null===($=e.meta)||void 0===$||$,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(P=e.addUsedSchema)||void 0===P||P,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(k=e.unicodeRegExp)||void 0===k||k,int32range:null===(T=e.int32range)||void 0===T||T,uriResolver:N}}class ${constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,..._(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return k;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),v.call(this,g,e,"NOT SUPPORTED"),v.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&P.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=p;"id"===r&&(n={...p},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),i.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await l.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new i.SchemaEnv({schema:{},schemaId:r});if(t=i.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(R.call(this,r,t),!t)return(0,d.eachItem)(r,(e=>C.call(this,e))),this;j.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===n.type.length?e=>C.call(this,e,n):e=>n.type.forEach((t=>C.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=O(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];(!t||t.test(r))&&("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:a}=this.opts;if("object"==typeof e)s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(s||r);const d=c.getSchemaRefs.call(this,e,r);return l=new i.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:d}),this._cache.set(l.schema,l),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),n&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=t}}}function v(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function P(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function S(){const e={...this.opts};for(const t of f)delete e[t];return e}e.default=$,$.ValidationError=n.default,$.MissingRefError=o.default;const k={log(){},warn(){},error(){}};const T=/^[a-z_$][a-z0-9_$:-]*$/i;function R(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!T.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function C(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let i=o?s.post:s.rules.find((({type:e})=>e===r));if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?x.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function x(e,t,r){const n=e.rules.findIndex((e=>e.keyword===r));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,N]}}}(core$2);var draft7={},core$1={},id={};Object.defineProperty(id,"__esModule",{value:!0});const def$s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};id.default=def$s;var ref={};Object.defineProperty(ref,"__esModule",{value:!0}),ref.callRef=ref.getValidate=void 0;const ref_error_1=ref_error,code_1$8=code,codegen_1$l=codegen,names_1$1=names$1,compile_1$1=compile,util_1$j=util,def$r={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:l}=s;if(("#"===r||"#/"===r)&&o===l.baseId)return function(){if(s===l)return callRef(e,i,s,s.$async);const r=t.scopeValue("root",{ref:l});return callRef(e,codegen_1$l._`${r}.validate`,l,l.$async)}();const d=compile_1$1.resolveRef.call(c,l,o,r);if(void 0===d)throw new ref_error_1.default(n.opts.uriResolver,o,r);return d instanceof compile_1$1.SchemaEnv?function(t){const r=getValidate(e,t);callRef(e,r,t,t.$async)}(d):function(n){const o=t.scopeValue("schema",!0===a.code.source?{ref:n,code:(0,codegen_1$l.stringify)(n)}:{ref:n}),s=t.name("valid"),i=e.subschema({schema:n,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:o,errSchemaPath:r},s);e.mergeEvaluated(i),e.ok(s)}(d)}};function getValidate(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):codegen_1$l._`${r.scopeValue("wrapper",{ref:t})}.validate`}function callRef(e,t,r,n){const{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?names_1$1.default.this:codegen_1$l.nil;function d(e){const t=codegen_1$l._`${e}.errors`;o.assign(names_1$1.default.vErrors,codegen_1$l._`${names_1$1.default.vErrors} === null ? ${t} : ${names_1$1.default.vErrors}.concat(${t})`),o.assign(names_1$1.default.errors,codegen_1$l._`${names_1$1.default.vErrors}.length`)}function p(e){var t;if(!s.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==s.props)if(n&&!n.dynamicProps)void 0!==n.props&&(s.props=util_1$j.mergeEvaluated.props(o,n.props,s.props));else{const t=o.var("props",codegen_1$l._`${e}.evaluated.props`);s.props=util_1$j.mergeEvaluated.props(o,t,s.props,codegen_1$l.Name)}if(!0!==s.items)if(n&&!n.dynamicItems)void 0!==n.items&&(s.items=util_1$j.mergeEvaluated.items(o,n.items,s.items));else{const t=o.var("items",codegen_1$l._`${e}.evaluated.items`);s.items=util_1$j.mergeEvaluated.items(o,t,s.items,codegen_1$l.Name)}}n?function(){if(!a.$async)throw new Error("async schema referenced by sync schema");const r=o.let("valid");o.try((()=>{o.code(codegen_1$l._`await ${(0,code_1$8.callValidateCode)(e,t,l)}`),p(t),i||o.assign(r,!0)}),(e=>{o.if(codegen_1$l._`!(${e} instanceof ${s.ValidationError})`,(()=>o.throw(e))),d(e),i||o.assign(r,!1)})),e.ok(r)}():e.result((0,code_1$8.callValidateCode)(e,t,l),(()=>p(t)),(()=>d(t)))}ref.getValidate=getValidate,ref.callRef=callRef,ref.default=def$r,Object.defineProperty(core$1,"__esModule",{value:!0});const id_1=id,ref_1=ref,core=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",id_1.default,ref_1.default];core$1.default=core;var validation$1={},limitNumber={};Object.defineProperty(limitNumber,"__esModule",{value:!0});const codegen_1$k=codegen,ops=codegen_1$k.operators,KWDs={maximum:{okStr:"<=",ok:ops.LTE,fail:ops.GT},minimum:{okStr:">=",ok:ops.GTE,fail:ops.LT},exclusiveMaximum:{okStr:"<",ok:ops.LT,fail:ops.GTE},exclusiveMinimum:{okStr:">",ok:ops.GT,fail:ops.LTE}},error$i={message:({keyword:e,schemaCode:t})=>codegen_1$k.str`must be ${KWDs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>codegen_1$k._`{comparison: ${KWDs[e].okStr}, limit: ${t}}`},def$q={keyword:Object.keys(KWDs),type:"number",schemaType:"number",$data:!0,error:error$i,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(codegen_1$k._`${r} ${KWDs[t].fail} ${n} || isNaN(${r})`)}};limitNumber.default=def$q;var multipleOf={};Object.defineProperty(multipleOf,"__esModule",{value:!0});const codegen_1$j=codegen,error$h={message:({schemaCode:e})=>codegen_1$j.str`must be multiple of ${e}`,params:({schemaCode:e})=>codegen_1$j._`{multipleOf: ${e}}`},def$p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:error$h,code(e){const{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?codegen_1$j._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:codegen_1$j._`${i} !== parseInt(${i})`;e.fail$data(codegen_1$j._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};multipleOf.default=def$p;var limitLength={},ucs2length$1={};function ucs2length(e){const t=e.length;let r,n=0,o=0;for(;o =55296&&r<=56319&&o codegen_1$i._`{limit: ${e}}`},def$o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:error$g,code(e){const{keyword:t,data:r,schemaCode:n,it:o}=e,s="maxLength"===t?codegen_1$i.operators.GT:codegen_1$i.operators.LT,i=!1===o.opts.unicode?codegen_1$i._`${r}.length`:codegen_1$i._`${(0,util_1$i.useFunc)(e.gen,ucs2length_1.default)}(${r})`;e.fail$data(codegen_1$i._`${i} ${s} ${n}`)}};limitLength.default=def$o;var pattern={};Object.defineProperty(pattern,"__esModule",{value:!0});const code_1$7=code,codegen_1$h=codegen,error$f={message:({schemaCode:e})=>codegen_1$h.str`must match pattern "${e}"`,params:({schemaCode:e})=>codegen_1$h._`{pattern: ${e}}`},def$n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:error$f,code(e){const{data:t,$data:r,schema:n,schemaCode:o,it:s}=e,i=s.opts.unicodeRegExp?"u":"",a=r?codegen_1$h._`(new RegExp(${o}, ${i}))`:(0,code_1$7.usePattern)(e,n);e.fail$data(codegen_1$h._`!${a}.test(${t})`)}};pattern.default=def$n;var limitProperties={};Object.defineProperty(limitProperties,"__esModule",{value:!0});const codegen_1$g=codegen,error$e={message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return codegen_1$g.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>codegen_1$g._`{limit: ${e}}`},def$m={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:error$e,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxProperties"===t?codegen_1$g.operators.GT:codegen_1$g.operators.LT;e.fail$data(codegen_1$g._`Object.keys(${r}).length ${o} ${n}`)}};limitProperties.default=def$m;var required={};Object.defineProperty(required,"__esModule",{value:!0});const code_1$6=code,codegen_1$f=codegen,util_1$h=util,error$d={message:({params:{missingProperty:e}})=>codegen_1$f.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>codegen_1$f._`{missingProperty: ${e}}`},def$l={keyword:"required",type:"object",schemaType:"array",$data:!0,error:error$d,code(e){const{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&0===r.length)return;const c=r.length>=a.loopRequired;if(i.allErrors?function(){if(c||s)e.block$data(codegen_1$f.nil,l);else for(const t of r)(0,code_1$6.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(c||s){const r=t.let("valid",!0);e.block$data(r,(()=>function(r,s){e.setParams({missingProperty:r}),t.forOf(r,n,(()=>{t.assign(s,(0,code_1$6.propertyInData)(t,o,r,a.ownProperties)),t.if((0,codegen_1$f.not)(s),(()=>{e.error(),t.break()}))}),codegen_1$f.nil)}(i,r))),e.ok(r)}else t.if((0,code_1$6.checkMissingProp)(e,r,i)),(0,code_1$6.reportMissingProp)(e,i),t.else()}(),a.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${i.schemaEnv.baseId+i.errSchemaPath}" (strictRequired)`;(0,util_1$h.checkStrictMode)(i,t,i.opts.strictRequired)}}function l(){t.forOf("prop",n,(r=>{e.setParams({missingProperty:r}),t.if((0,code_1$6.noPropertyInData)(t,o,r,a.ownProperties),(()=>e.error()))}))}}};required.default=def$l;var limitItems={};Object.defineProperty(limitItems,"__esModule",{value:!0});const codegen_1$e=codegen,error$c={message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return codegen_1$e.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>codegen_1$e._`{limit: ${e}}`},def$k={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:error$c,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxItems"===t?codegen_1$e.operators.GT:codegen_1$e.operators.LT;e.fail$data(codegen_1$e._`${r}.length ${o} ${n}`)}};limitItems.default=def$k;var uniqueItems={},equal$1={};Object.defineProperty(equal$1,"__esModule",{value:!0});const equal=fastDeepEqual;equal.code='require("ajv/dist/runtime/equal").default',equal$1.default=equal,Object.defineProperty(uniqueItems,"__esModule",{value:!0});const dataType_1=dataType,codegen_1$d=codegen,util_1$g=util,equal_1$2=equal$1,error$b={message:({params:{i:e,j:t}})=>codegen_1$d.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>codegen_1$d._`{i: ${e}, j: ${t}}`},def$j={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:error$b,code(e){const{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;const c=t.let("valid"),l=s.items?(0,dataType_1.getSchemaTypes)(s.items):[];function d(n,o){const s=t.name("item"),i=(0,dataType_1.checkDataTypes)(l,s,a.opts.strictNumbers,dataType_1.DataType.Wrong),d=t.const("indices",codegen_1$d._`{}`);t.for(codegen_1$d._`;${n}--;`,(()=>{t.let(s,codegen_1$d._`${r}[${n}]`),t.if(i,codegen_1$d._`continue`),l.length>1&&t.if(codegen_1$d._`typeof ${s} == "string"`,codegen_1$d._`${s} += "_"`),t.if(codegen_1$d._`typeof ${d}[${s}] == "number"`,(()=>{t.assign(o,codegen_1$d._`${d}[${s}]`),e.error(),t.assign(c,!1).break()})).code(codegen_1$d._`${d}[${s}] = ${n}`)}))}function p(n,o){const s=(0,util_1$g.useFunc)(t,equal_1$2.default),i=t.name("outer");t.label(i).for(codegen_1$d._`;${n}--;`,(()=>t.for(codegen_1$d._`${o} = ${n}; ${o}--;`,(()=>t.if(codegen_1$d._`${s}(${r}[${n}], ${r}[${o}])`,(()=>{e.error(),t.assign(c,!1).break(i)}))))))}e.block$data(c,(function(){const n=t.let("i",codegen_1$d._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(c,!0),t.if(codegen_1$d._`${n} > 1`,(()=>(l.length>0&&!l.some((e=>"object"===e||"array"===e))?d:p)(n,o)))}),codegen_1$d._`${i} === false`),e.ok(c)}};uniqueItems.default=def$j;var _const={};Object.defineProperty(_const,"__esModule",{value:!0});const codegen_1$c=codegen,util_1$f=util,equal_1$1=equal$1,error$a={message:"must be equal to constant",params:({schemaCode:e})=>codegen_1$c._`{allowedValue: ${e}}`},def$i={keyword:"const",$data:!0,error:error$a,code(e){const{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&"object"==typeof s?e.fail$data(codegen_1$c._`!${(0,util_1$f.useFunc)(t,equal_1$1.default)}(${r}, ${o})`):e.fail(codegen_1$c._`${s} !== ${r}`)}};_const.default=def$i;var _enum={};Object.defineProperty(_enum,"__esModule",{value:!0});const codegen_1$b=codegen,util_1$e=util,equal_1=equal$1,error$9={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>codegen_1$b._`{allowedValues: ${e}}`},def$h={keyword:"enum",schemaType:"array",$data:!0,error:error$9,code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&0===o.length)throw new Error("enum must have non-empty array");const a=o.length>=i.opts.loopEnum;let c;const l=()=>c??(c=(0,util_1$e.useFunc)(t,equal_1.default));let d;if(a||n)d=t.let("valid"),e.block$data(d,(function(){t.assign(d,!1),t.forOf("v",s,(e=>t.if(codegen_1$b._`${l()}(${r}, ${e})`,(()=>t.assign(d,!0).break()))))}));else{if(!Array.isArray(o))throw new Error("ajv implementation error");const e=t.const("vSchema",s);d=(0,codegen_1$b.or)(...o.map(((t,n)=>function(e,t){const n=o[t];return"object"==typeof n&&null!==n?codegen_1$b._`${l()}(${r}, ${e}[${t}])`:codegen_1$b._`${r} === ${n}`}(e,n))))}e.pass(d)}};_enum.default=def$h,Object.defineProperty(validation$1,"__esModule",{value:!0});const limitNumber_1=limitNumber,multipleOf_1=multipleOf,limitLength_1=limitLength,pattern_1=pattern,limitProperties_1=limitProperties,required_1=required,limitItems_1=limitItems,uniqueItems_1=uniqueItems,const_1=_const,enum_1=_enum,validation=[limitNumber_1.default,multipleOf_1.default,limitLength_1.default,pattern_1.default,limitProperties_1.default,required_1.default,limitItems_1.default,uniqueItems_1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},const_1.default,enum_1.default];validation$1.default=validation;var applicator={},additionalItems={};Object.defineProperty(additionalItems,"__esModule",{value:!0}),additionalItems.validateAdditionalItems=void 0;const codegen_1$a=codegen,util_1$d=util,error$8={message:({params:{len:e}})=>codegen_1$a.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>codegen_1$a._`{limit: ${e}}`},def$g={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:error$8,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?validateAdditionalItems(e,n):(0,util_1$d.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;const a=r.const("len",codegen_1$a._`${o}.length`);if(!1===n)e.setParams({len:t.length}),e.pass(codegen_1$a._`${a} <= ${t.length}`);else if("object"==typeof n&&!(0,util_1$d.alwaysValidSchema)(i,n)){const n=r.var("valid",codegen_1$a._`${a} <= ${t.length}`);r.if((0,codegen_1$a.not)(n),(()=>function(n){r.forRange("i",t.length,a,(t=>{e.subschema({keyword:s,dataProp:t,dataPropType:util_1$d.Type.Num},n),i.allErrors||r.if((0,codegen_1$a.not)(n),(()=>r.break()))}))}(n))),e.ok(n)}}additionalItems.validateAdditionalItems=validateAdditionalItems,additionalItems.default=def$g;var prefixItems={},items={};Object.defineProperty(items,"__esModule",{value:!0}),items.validateTuple=void 0;const codegen_1$9=codegen,util_1$c=util,code_1$5=code,def$f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=!0,!(0,util_1$c.alwaysValidSchema)(r,t)&&e.ok((0,code_1$5.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;(function(e){const{opts:n,errSchemaPath:o}=a,s=r.length,c=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(n.strictTuples&&!c){const e=`"${i}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,util_1$c.checkStrictMode)(a,e,n.strictTuples)}})(o),a.opts.unevaluated&&r.length&&!0!==a.items&&(a.items=util_1$c.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),l=n.const("len",codegen_1$9._`${s}.length`);r.forEach(((t,r)=>{(0,util_1$c.alwaysValidSchema)(a,t)||(n.if(codegen_1$9._`${l} > ${r}`,(()=>e.subschema({keyword:i,schemaProp:r,dataProp:r},c))),e.ok(c))}))}items.validateTuple=validateTuple,items.default=def$f,Object.defineProperty(prefixItems,"__esModule",{value:!0});const items_1$1=items,def$e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,items_1$1.validateTuple)(e,"items")};prefixItems.default=def$e;var items2020={};Object.defineProperty(items2020,"__esModule",{value:!0});const codegen_1$8=codegen,util_1$b=util,code_1$4=code,additionalItems_1$1=additionalItems,error$7={message:({params:{len:e}})=>codegen_1$8.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>codegen_1$8._`{limit: ${e}}`},def$d={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:error$7,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,util_1$b.alwaysValidSchema)(n,t)&&(o?(0,additionalItems_1$1.validateAdditionalItems)(e,o):e.ok((0,code_1$4.validateArray)(e)))}};items2020.default=def$d;var contains={};Object.defineProperty(contains,"__esModule",{value:!0});const codegen_1$7=codegen,util_1$a=util,error$6={message:({params:{min:e,max:t}})=>void 0===t?codegen_1$7.str`must contain at least ${e} valid item(s)`:codegen_1$7.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?codegen_1$7._`{minContains: ${e}}`:codegen_1$7._`{minContains: ${e}, maxContains: ${t}}`},def$c={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:error$6,code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;let i,a;const{minContains:c,maxContains:l}=n;s.opts.next?(i=void 0===c?1:c,a=l):i=1;const d=t.const("len",codegen_1$7._`${o}.length`);if(e.setParams({min:i,max:a}),void 0===a&&0===i)return void(0,util_1$a.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&i>a)return(0,util_1$a.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,util_1$a.alwaysValidSchema)(s,r)){let t=codegen_1$7._`${d} >= ${i}`;return void 0!==a&&(t=codegen_1$7._`${t} && ${d} <= ${a}`),void e.pass(t)}s.items=!0;const p=t.name("valid");function u(){const e=t.name("_valid"),r=t.let("count",0);h(e,(()=>t.if(e,(()=>function(e){t.code(codegen_1$7._`${e}++`),void 0===a?t.if(codegen_1$7._`${e} >= ${i}`,(()=>t.assign(p,!0).break())):(t.if(codegen_1$7._`${e} > ${a}`,(()=>t.assign(p,!1).break())),1===i?t.assign(p,!0):t.if(codegen_1$7._`${e} >= ${i}`,(()=>t.assign(p,!0))))}(r)))))}function h(r,n){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:util_1$a.Type.Num,compositeRule:!0},r),n()}))}void 0===a&&1===i?h(p,(()=>t.if(p,(()=>t.break())))):0===i?(t.let(p,!0),void 0!==a&&t.if(codegen_1$7._`${o}.length > 0`,u)):(t.let(p,!1),u()),e.result(p,(()=>e.reset()))}};contains.default=def$c;var dependencies={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=codegen,r=util,n=code;e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e}, - missingProperty: ${o}, - depsCount: ${r}, - deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),i(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:i}=e;if(0===Object.keys(r).length)return;const a=o.let("missing");for(const c in r){const l=r[c];if(0===l.length)continue;const d=(0,n.propertyInData)(o,s,c,i.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),i.allErrors?o.if(d,(()=>{for(const t of l)(0,n.checkReportMissingProp)(e,t)})):(o.if(t._`${d} && (${(0,n.checkMissingProp)(e,l,a)})`),(0,n.reportMissingProp)(e,a),o.else())}}function i(e,t=e.schema){const{gen:o,data:s,keyword:i,it:a}=e,c=o.name("valid");for(const l in t)(0,r.alwaysValidSchema)(a,t[l])||(o.if((0,n.propertyInData)(o,s,l,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:i,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(()=>o.var(c,!0))),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=i,e.default=o}(dependencies);var propertyNames={};Object.defineProperty(propertyNames,"__esModule",{value:!0});const codegen_1$6=codegen,util_1$9=util,error$5={message:"property name must be valid",params:({params:e})=>codegen_1$6._`{propertyName: ${e.propertyName}}`},def$b={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:error$5,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,util_1$9.alwaysValidSchema)(o,r))return;const s=t.name("valid");t.forIn("key",n,(r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),t.if((0,codegen_1$6.not)(s),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(s)}};propertyNames.default=def$b;var additionalProperties={};Object.defineProperty(additionalProperties,"__esModule",{value:!0});const code_1$3=code,codegen_1$5=codegen,names_1=names$1,util_1$8=util,error$4={message:"must NOT have additional properties",params:({params:e})=>codegen_1$5._`{additionalProperty: ${e.additionalProperty}}`},def$a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:error$4,code(e){const{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=i;if(i.props=!0,"all"!==c.removeAdditional&&(0,util_1$8.alwaysValidSchema)(i,r))return;const l=(0,code_1$3.allSchemaProperties)(n.properties),d=(0,code_1$3.allSchemaProperties)(n.patternProperties);function p(e){t.code(codegen_1$5._`delete ${o}[${e}]`)}function u(n){if("all"===c.removeAdditional||c.removeAdditional&&!1===r)p(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(a||t.break());if("object"==typeof r&&!(0,util_1$8.alwaysValidSchema)(i,r)){const r=t.name("valid");"failing"===c.removeAdditional?(h(n,r,!1),t.if((0,codegen_1$5.not)(r),(()=>{e.reset(),p(n)}))):(h(n,r),a||t.if((0,codegen_1$5.not)(r),(()=>t.break())))}}}function h(t,r,n){const o={keyword:"additionalProperties",dataProp:t,dataPropType:util_1$8.Type.Str};!1===n&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(o,r)}t.forIn("key",o,(r=>{l.length||d.length?t.if(function(r){let o;if(l.length>8){const e=(0,util_1$8.schemaRefOrVal)(i,n.properties,"properties");o=(0,code_1$3.isOwnProperty)(t,e,r)}else o=l.length?(0,codegen_1$5.or)(...l.map((e=>codegen_1$5._`${r} === ${e}`))):codegen_1$5.nil;return d.length&&(o=(0,codegen_1$5.or)(o,...d.map((t=>codegen_1$5._`${(0,code_1$3.usePattern)(e,t)}.test(${r})`)))),(0,codegen_1$5.not)(o)}(r),(()=>u(r))):u(r)})),e.ok(codegen_1$5._`${s} === ${names_1.default.errors}`)}};additionalProperties.default=def$a;var properties$1={};Object.defineProperty(properties$1,"__esModule",{value:!0});const validate_1=validate,code_1$2=code,util_1$7=util,additionalProperties_1$1=additionalProperties,def$9={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;"all"===s.opts.removeAdditional&&void 0===n.additionalProperties&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(s,additionalProperties_1$1.default,"additionalProperties"));const i=(0,code_1$2.allSchemaProperties)(r);for(const p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&!0!==s.props&&(s.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(i),s.props));const a=i.filter((e=>!(0,util_1$7.alwaysValidSchema)(s,r[e])));if(0===a.length)return;const c=t.name("valid");for(const p of a)l(p)?d(p):(t.if((0,code_1$2.propertyInData)(t,o,p,s.opts.ownProperties)),d(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function l(e){return s.opts.useDefaults&&!s.compositeRule&&void 0!==r[e].default}function d(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}};properties$1.default=def$9;var patternProperties={};Object.defineProperty(patternProperties,"__esModule",{value:!0});const code_1$1=code,codegen_1$4=codegen,util_1$6=util,util_2=util,def$8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,code_1$1.allSchemaProperties)(r),c=a.filter((e=>(0,util_1$6.alwaysValidSchema)(s,r[e])));if(0===a.length||c.length===a.length&&(!s.opts.unevaluated||!0===s.props))return;const l=i.strictSchema&&!i.allowMatchingProperties&&o.properties,d=t.name("valid");!0!==s.props&&!(s.props instanceof codegen_1$4.Name)&&(s.props=(0,util_2.evaluatedPropsToName)(t,s.props));const{props:p}=s;function u(e){for(const t in l)new RegExp(e).test(t)&&(0,util_1$6.checkStrictMode)(s,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function h(r){t.forIn("key",n,(n=>{t.if(codegen_1$4._`${(0,code_1$1.usePattern)(e,r)}.test(${n})`,(()=>{const o=c.includes(r);o||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:util_2.Type.Str},d),s.opts.unevaluated&&!0!==p?t.assign(codegen_1$4._`${p}[${n}]`,!0):!o&&!s.allErrors&&t.if((0,codegen_1$4.not)(d),(()=>t.break()))}))}))}!function(){for(const e of a)l&&u(e),s.allErrors?h(e):(t.var(d,!0),h(e),t.if(d))}()}};patternProperties.default=def$8;var not={};Object.defineProperty(not,"__esModule",{value:!0});const util_1$5=util,def$7={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,util_1$5.alwaysValidSchema)(n,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};not.default=def$7;var anyOf={};Object.defineProperty(anyOf,"__esModule",{value:!0});const code_1=code,def$6={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:code_1.validateUnion,error:{message:"must match a schema in anyOf"}};anyOf.default=def$6;var oneOf={};Object.defineProperty(oneOf,"__esModule",{value:!0});const codegen_1$3=codegen,util_1$4=util,error$3={message:"must match exactly one schema in oneOf",params:({params:e})=>codegen_1$3._`{passingSchemas: ${e.passing}}`},def$5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:error$3,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block((function(){s.forEach(((r,n)=>{let s;(0,util_1$4.alwaysValidSchema)(o,r)?t.var(c,!0):s=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&t.if(codegen_1$3._`${c} && ${i}`).assign(i,!1).assign(a,codegen_1$3._`[${a}, ${n}]`).else(),t.if(c,(()=>{t.assign(i,!0),t.assign(a,n),s&&e.mergeEvaluated(s,codegen_1$3.Name)}))}))})),e.result(i,(()=>e.reset()),(()=>e.error(!0)))}};oneOf.default=def$5;var allOf={};Object.defineProperty(allOf,"__esModule",{value:!0});const util_1$3=util,def$4={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach(((t,r)=>{if((0,util_1$3.alwaysValidSchema)(n,t))return;const s=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(s)}))}};allOf.default=def$4;var _if={};Object.defineProperty(_if,"__esModule",{value:!0});const codegen_1$2=codegen,util_1$2=util,error$2={message:({params:e})=>codegen_1$2.str`must match "${e.ifClause}" schema`,params:({params:e})=>codegen_1$2._`{failingKeyword: ${e.ifClause}}`},def$3={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:error$2,code(e){const{gen:t,parentSchema:r,it:n}=e;void 0===r.then&&void 0===r.else&&(0,util_1$2.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const o=hasSchema(n,"then"),s=hasSchema(n,"else");if(!o&&!s)return;const i=t.let("valid",!0),a=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(t)}(),e.reset(),o&&s){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(a,c("then",r),c("else",r))}else o?t.if(a,c("then")):t.if((0,codegen_1$2.not)(a),c("else"));function c(r,n){return()=>{const o=e.subschema({keyword:r},a);t.assign(i,a),e.mergeValidEvaluated(o,i),n?t.assign(n,codegen_1$2._`${r}`):e.setParams({ifClause:r})}}e.pass(i,(()=>e.error(!0)))}};function hasSchema(e,t){const r=e.schema[t];return void 0!==r&&!(0,util_1$2.alwaysValidSchema)(e,r)}_if.default=def$3;var thenElse={};Object.defineProperty(thenElse,"__esModule",{value:!0});const util_1$1=util,def$2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,util_1$1.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};thenElse.default=def$2,Object.defineProperty(applicator,"__esModule",{value:!0});const additionalItems_1=additionalItems,prefixItems_1=prefixItems,items_1=items,items2020_1=items2020,contains_1=contains,dependencies_1=dependencies,propertyNames_1=propertyNames,additionalProperties_1=additionalProperties,properties_1=properties$1,patternProperties_1=patternProperties,not_1=not,anyOf_1=anyOf,oneOf_1=oneOf,allOf_1=allOf,if_1=_if,thenElse_1=thenElse;function getApplicator(e=!1){const t=[not_1.default,anyOf_1.default,oneOf_1.default,allOf_1.default,if_1.default,thenElse_1.default,propertyNames_1.default,additionalProperties_1.default,dependencies_1.default,properties_1.default,patternProperties_1.default];return e?t.push(prefixItems_1.default,items2020_1.default):t.push(additionalItems_1.default,items_1.default),t.push(contains_1.default),t}applicator.default=getApplicator;var format$2={},format$1={};Object.defineProperty(format$1,"__esModule",{value:!0});const codegen_1$1=codegen,error$1={message:({schemaCode:e})=>codegen_1$1.str`must match format "${e}"`,params:({schemaCode:e})=>codegen_1$1._`{format: ${e}}`},def$1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:error$1,code(e,t){const{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:d,self:p}=a;c.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),s=r.const("fDef",codegen_1$1._`${o}[${i}]`),a=r.let("fType"),l=r.let("format");r.if(codegen_1$1._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,(()=>r.assign(a,codegen_1$1._`${s}.type || "string"`).assign(l,codegen_1$1._`${s}.validate`)),(()=>r.assign(a,codegen_1$1._`"string"`).assign(l,s))),e.fail$data((0,codegen_1$1.or)(!1===c.strictSchema?codegen_1$1.nil:codegen_1$1._`${i} && !${l}`,function(){const e=d.$async?codegen_1$1._`(${s}.async ? await ${l}(${n}) : ${l}(${n}))`:codegen_1$1._`${l}(${n})`,r=codegen_1$1._`(typeof ${l} == "function" ? ${e} : ${l}.test(${n}))`;return codegen_1$1._`${l} && ${l} !== true && ${a} === ${t} && !${r}`}()))}():function(){const o=p.formats[s];if(!o)return void function(){if(!1===c.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===o)return;const[i,a,u]=function(e){const t=e instanceof RegExp?(0,codegen_1$1.regexpCode)(e):c.code.formats?codegen_1$1._`${c.code.formats}${(0,codegen_1$1.getProperty)(s)}`:void 0,n=r.scopeValue("formats",{key:s,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,n]:[e.type||"string",e.validate,codegen_1$1._`${n}.validate`]}(o);i===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!d.$async)throw new Error("async format in sync schema");return codegen_1$1._`await ${u}(${n})`}return"function"==typeof a?codegen_1$1._`${u}(${n})`:codegen_1$1._`${u}.test(${n})`}())}())}};format$1.default=def$1,Object.defineProperty(format$2,"__esModule",{value:!0});const format_1$1=format$1,format=[format_1$1.default];format$2.default=format;var metadata={};Object.defineProperty(metadata,"__esModule",{value:!0}),metadata.contentVocabulary=metadata.metadataVocabulary=void 0,metadata.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],metadata.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(draft7,"__esModule",{value:!0});const core_1=core$1,validation_1=validation$1,applicator_1=applicator,format_1=format$2,metadata_1=metadata,draft7Vocabularies=[core_1.default,validation_1.default,(0,applicator_1.default)(),format_1.default,metadata_1.metadataVocabulary,metadata_1.contentVocabulary];draft7.default=draft7Vocabularies;var discriminator={},types={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))}(types),Object.defineProperty(discriminator,"__esModule",{value:!0});const codegen_1=codegen,types_1=types,compile_1=compile,util_1=util,error={message:({params:{discrError:e,tagName:t}})=>e===types_1.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>codegen_1._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},def={keyword:"discriminator",type:"object",schemaType:"object",error:error,code(e){const{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=n.propertyName;if("string"!=typeof a)throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),l=t.const("tag",codegen_1._`${r}${(0,codegen_1.getProperty)(a)}`);function d(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,codegen_1.Name),n}t.if(codegen_1._`typeof ${l} == "string"`,(()=>function(){const r=function(){var e;const t={},r=c(o);let n=!0;for(let o=0;o e.error(!1,{discrError:types_1.DiscrError.Tag,tag:l,tagName:a}))),e.ok(c)}};discriminator.default=def;const $schema$1="http://json-schema.org/draft-07/schema#",$id="http://json-schema.org/draft-07/schema#",title="Core schema meta-schema",definitions$1={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type=["object","boolean"],properties={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},require$$3={$schema:$schema$1,$id:$id,title:title,definitions:definitions$1,type:type,properties:properties,default:!0};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=core$2,n=draft7,o=discriminator,s=require$$3,i=["/properties"],a="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(e,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var d=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var u=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(ajv$1,ajv$1.exports);var ajvExports=ajv$1.exports;const Ajv=getDefaultExportFromCjs(ajvExports),$schema="http://json-schema.org/schema",$ref="#/definitions/Blueprint",definitions={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what."},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",const:"kitchen-sink"},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:"The method of defining the constants. Possible values are:\n\n- rewrite-wp-config: Default. Rewrites the wp-config.php file to explicitly call define() with the requested name and value. This method alters the file on the disk, but it doesn't conflict with existing define() calls in wp-config.php.\n- define-before-run: Defines the constant before running the requested script. It doesn't alter any files on the disk, but constants defined this way may conflict with existing define() calls in wp-config.php."},virtualize:{type:"boolean",deprecated:"This option is noop and will be removed in a future version.\nThis option is only kept in here to avoid breaking Blueprint schema validation\nfor existing apps using this option."}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importFile"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setPhpIniEntry"},key:{type:"string",description:'Entry name e.g. "display_errors"'},value:{type:"string",description:'Entry value as a string e.g. "1"'}},required:["key","step","value"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},files:{type:"object",additionalProperties:{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1},description:"Uploaded files"},body:{type:"string",description:"Request body without the files."},formData:{type:"object",additionalProperties:{},description:"Form data. If set, the request body will be ignored and the content-type header will be set to `application/x-www-form-urlencoded`."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{type:"string",description:"Request body without the files."},fileInfos:{type:"array",items:{$ref:"#/definitions/FileInfo"},description:"Uploaded files."},code:{type:"string",description:"The code snippet to eval instead of a php file."},throwOnError:{type:"boolean",description:"Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."}},additionalProperties:!1},FileInfo:{type:"object",properties:{key:{type:"string"},name:{type:"string"},type:{type:"string"},data:{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}},required:["key","name","type","data"],additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},blueprintSchema={$schema:$schema,$ref:$ref,definitions:definitions},{wpCLI:wpCLI,...otherStepHandlers}=allStepHandlers,keyedStepHandlers={...otherStepHandlers,"wp-cli":wpCLI};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=(()=>{})}={}){var o,s,i,a,c;if((e={...e,steps:(e.steps||[]).filter(isStepDefinition)}).constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const t=e.plugins.map((e=>"string"==typeof e?e.startsWith("https://")?{resource:"url",url:e}:{resource:"wordpress.org/plugins",slug:e}:e)).map((e=>({step:"installPlugin",pluginZipFile:e})));e.steps.unshift(...t)}e.login&&e.steps.push({step:"login",...!0===e.login?{username:"admin",password:"password"}:e.login});const l=null==(o=e.steps)?void 0:o.findIndex((e=>"object"==typeof e&&"wp-cli"===(null==e?void 0:e.step)));void 0!==l&&l>-1&&(e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles.includes("kitchen-sink")||(e.phpExtensionBundles.push("kitchen-sink"),console.warn("The WP-CLI step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),null==(s=e.steps)||s.splice(l,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const{valid:d,errors:p}=validateBlueprint(e);if(!d){const e=new Error(`Invalid blueprint: ${p[0].message} at ${p[0].instancePath}`);throw e.errors=p,e}const u=e.steps||[],h=u.reduce(((e,t)=>{var r;return e+((null==(r=t.progress)?void 0:r.weight)||1)}),0),f=u.map((e=>compileStep(e,{semaphore:r,rootProgressTracker:t,totalProgressWeight:h})));return{versions:{php:compileVersion(null==(i=e.preferredVersions)?void 0:i.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:(null==(a=e.preferredVersions)?void 0:a.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:(null==(c=e.features)?void 0:c.networking)??!1},run:async r=>{try{for(const{resources:e}of f)for(const t of e)t.setPlayground(r),t.isAsync&&t.resolve();for(const[e,{run:t,step:s}]of Object.entries(f))try{const e=await t(r);n(e,s)}catch(o){throw console.error(o),new Error(`Error when executing the blueprint step #${e} (${JSON.stringify(s)}) ${o instanceof Error?`: ${o.message}`:o}`,{cause:o})}}finally{try{await r.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const ajv=new Ajv({discriminator:!0});let blueprintValidator;function validateBlueprint(e){var t;blueprintValidator=ajv.compile(blueprintSchema);const r=blueprintValidator(e);if(r)return{valid:r};const n=new Set;for(const o of blueprintValidator.errors)o.schemaPath.startsWith("#/properties/steps/items/anyOf")||n.add(o.instancePath);return{valid:r,errors:null==(t=blueprintValidator.errors)?void 0:t.filter((e=>!(e.schemaPath.startsWith("#/properties/steps/items/anyOf")&&n.has(e.instancePath))))}}function compileVersion(e,t,r){return e&&t.includes(e)?e:r}function compilePHPExtensions(e,t){const r=SupportedPHPExtensionsList.filter((t=>e.includes(t))),n=t.flatMap((e=>e in SupportedPHPExtensionBundles?SupportedPHPExtensionBundles[e]:[]));return Array.from(new Set([...r,...n]))}function isStepDefinition(e){return!("object"!=typeof e||!e)}function compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var o;const s=r.stage(((null==(o=e.progress)?void 0:o.weight)||1)/n),i={};for(const d of Object.keys(e)){let r=e[d];isFileReference(r)&&(r=Resource.create(r,{semaphore:t})),i[d]=r}const a=getResources(i),c=getResources(i).filter((e=>e.isAsync)),l=1/(c.length+1);for(const d of c)d.progress=s.stage(l);return{run:async t=>{var r;try{return s.fillSlowly(),await keyedStepHandlers[e.step](t,await resolveArguments(i),{tracker:s,initialCaption:null==(r=e.progress)?void 0:r.caption})}finally{s.finish()}},step:e,resources:a}}function getResources(e){const t=[];for(const r in e){const n=e[r];n instanceof Resource&&t.push(n)}return t}async function resolveArguments(e){const t={};for(const r in e){const n=e[r];t[r]=n instanceof Resource?await n.resolve():n}return t}async function runBlueprintSteps(e,t){await e.run(t)}function setPluginProxyURL(){}const proxyMarker=Symbol("Comlink.proxy"),createEndpoint=Symbol("Comlink.endpoint"),releaseProxy=Symbol("Comlink.releaseProxy"),finalizer=Symbol("Comlink.finalizer"),throwMarker=Symbol("Comlink.thrown"),isObject=e=>"object"==typeof e&&null!==e||"function"==typeof e,proxyTransferHandler={canHandle:e=>isObject(e)&&e[proxyMarker],serialize(e){const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize:e=>(e.start(),wrap(e))},throwTransferHandler={canHandle:e=>isObject(e)&&throwMarker in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},transferHandlers=new Map([["proxy",proxyTransferHandler],["throw",throwTransferHandler]]);function isAllowedOrigin(e,t){for(const r of e)if(t===r||"*"===r||r instanceof RegExp&&r.test(t))return!0;return!1}function expose(e,t=globalThis,r=["*"]){t.addEventListener("message",(function n(o){if(!o||!o.data)return;if(!isAllowedOrigin(r,o.origin))return void console.warn(`Invalid origin '${o.origin}' for comlink proxy`);const{id:s,type:i,path:a}=Object.assign({path:[]},o.data),c=(o.data.argumentList||[]).map(fromWireValue);let l;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),r=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":l=r;break;case"SET":t[a.slice(-1)[0]]=fromWireValue(o.data.value),l=!0;break;case"APPLY":l=r.apply(t,c);break;case"CONSTRUCT":l=proxy(new r(...c));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;expose(e,r),l=transfer(t,[t])}break;case"RELEASE":l=void 0;break;default:return}}catch(d){l={value:d,[throwMarker]:0}}Promise.resolve(l).catch((e=>({value:e,[throwMarker]:0}))).then((r=>{const[o,a]=toWireValue(r);t.postMessage(Object.assign(Object.assign({},o),{id:s}),a),"RELEASE"===i&&(t.removeEventListener("message",n),closeEndPoint(t),finalizer in e&&"function"==typeof e[finalizer]&&e[finalizer]())})).catch((e=>{const[r,n]=toWireValue({value:new TypeError("Unserializable return value"),[throwMarker]:0});t.postMessage(Object.assign(Object.assign({},r),{id:s}),n)}))})),t.start&&t.start()}function isMessagePort(e){return"MessagePort"===e.constructor.name}function closeEndPoint(e){isMessagePort(e)&&e.close()}function wrap(e,t){return createProxy(e,[],t)}function throwIfProxyReleased(e){if(e)throw new Error("Proxy has been released and is not useable")}function releaseEndpoint(e){return requestResponseMessage(e,{type:"RELEASE"}).then((()=>{closeEndPoint(e)}))}const proxyCounter=new WeakMap,proxyFinalizers="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(proxyCounter.get(e)||0)-1;proxyCounter.set(e,t),0===t&&releaseEndpoint(e)}));function registerProxy(e,t){const r=(proxyCounter.get(t)||0)+1;proxyCounter.set(t,r),proxyFinalizers&&proxyFinalizers.register(e,t,e)}function unregisterProxy(e){proxyFinalizers&&proxyFinalizers.unregister(e)}function createProxy(e,t=[],r=function(){}){let n=!1;const o=new Proxy(r,{get(r,s){if(throwIfProxyReleased(n),s===releaseProxy)return()=>{unregisterProxy(o),releaseEndpoint(e),n=!0};if("then"===s){if(0===t.length)return{then:()=>o};const r=requestResponseMessage(e,{type:"GET",path:t.map((e=>e.toString()))}).then(fromWireValue);return r.then.bind(r)}return createProxy(e,[...t,s])},set(r,o,s){throwIfProxyReleased(n);const[i,a]=toWireValue(s);return requestResponseMessage(e,{type:"SET",path:[...t,o].map((e=>e.toString())),value:i},a).then(fromWireValue)},apply(r,o,s){throwIfProxyReleased(n);const i=t[t.length-1];if(i===createEndpoint)return requestResponseMessage(e,{type:"ENDPOINT"}).then(fromWireValue);if("bind"===i)return createProxy(e,t.slice(0,-1));const[a,c]=processArguments(s);return requestResponseMessage(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(fromWireValue)},construct(r,o){throwIfProxyReleased(n);const[s,i]=processArguments(o);return requestResponseMessage(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},i).then(fromWireValue)}});return registerProxy(o,e),o}function myFlat(e){return Array.prototype.concat.apply([],e)}function processArguments(e){const t=e.map(toWireValue);return[t.map((e=>e[0])),myFlat(t.map((e=>e[1])))]}const transferCache=new WeakMap;function transfer(e,t){return transferCache.set(e,t),e}function proxy(e){return Object.assign(e,{[proxyMarker]:!0})}function windowEndpoint(e,t=globalThis,r="*"){return{postMessage:(t,n)=>e.postMessage(t,r,n),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function toWireValue(e){for(const[t,r]of transferHandlers)if(r.canHandle(e)){const[n,o]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},o]}return[{type:"RAW",value:e},transferCache.get(e)||[]]}function fromWireValue(e){switch(e.type){case"HANDLER":return transferHandlers.get(e.name).deserialize(e.value);case"RAW":return e.value}}function requestResponseMessage(e,t,r){return new Promise((n=>{const o=generateUUID();e.addEventListener("message",(function t(r){!r.data||!r.data.id||r.data.id!==o||(e.removeEventListener("message",t),n(r.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)}))}function generateUUID(){return new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-")}function consumeAPI(e,t=void 0){setupTransferHandlers();const r=wrap(e instanceof Worker?e:windowEndpoint(e,t)),n=proxyClone(r);return new Proxy(n,{get:(e,t)=>"isConnected"===t?async()=>{for(;;)try{await runWithTimeout(r.isConnected(),200);break}catch{}}:r[t]})}async function runWithTimeout(e,t){return new Promise(((r,n)=>{setTimeout(n,t),e.then(r)}))}let isTransferHandlersSetup=!1;function setupTransferHandlers(){isTransferHandlersSetup||(isTransferHandlersSetup=!0,transferHandlers.set("EVENT",{canHandle:e=>e instanceof CustomEvent,serialize:e=>[{detail:e.detail},[]],deserialize:e=>e}),transferHandlers.set("FUNCTION",{canHandle:e=>"function"==typeof e,serialize(e){console.debug("[Comlink][Performance] Proxying a function");const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize:e=>(e.start(),wrap(e))}),transferHandlers.set("PHPResponse",{canHandle:e=>"object"==typeof e&&null!==e&&"headers"in e&&"bytes"in e&&"errors"in e&&"exitCode"in e&&"httpStatusCode"in e,serialize:e=>[e.toRawData(),[]],deserialize:e=>PHPResponse.fromRawData(e)}))}function proxyClone(e){return new Proxy(e,{get(e,t){switch(typeof e[t]){case"function":return(...r)=>e[t](...r);case"object":return null===e[t]?e[t]:proxyClone(e[t]);case"undefined":case"number":case"string":return e[t];default:return proxy(e[t])}}})}class Logger{constructor(e){this.LOG_PREFIX="Playground",this.windowConnected=!1,this.lastPHPLogLength=0,this.errorLogPath="/wordpress/wp-content/debug.log",e&&(this.errorLogPath=e)}async getRequestPhpErrorLog(e){return await e.fileExists(this.errorLogPath)?await e.readFileAsText(this.errorLogPath):""}logWindowError(e){this.log(`${e.message} in ${e.filename} on line ${e.lineno}:${e.colno}`,"fatal")}logUnhandledRejection(e){this.log(`${e.reason.stack}`,"fatal")}addWindowErrorListener(){this.windowConnected||typeof window>"u"||(window.addEventListener("error",this.logWindowError.bind(this)),window.addEventListener("unhandledrejection",this.logUnhandledRejection.bind(this)),window.addEventListener("rejectionhandled",this.logUnhandledRejection.bind(this)),this.windowConnected=!0)}addPlaygroundRequestEndListener(e){e.addEventListener("request.end",(async()=>{const t=await this.getRequestPhpErrorLog(e);t.length>this.lastPHPLogLength&&(this.logRaw(t.substring(this.lastPHPLogLength)),this.lastPHPLogLength=t.length)}))}formatLogDate(e){return new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(e).replace(/ /g,"-")+" "+new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(e)}formatMessage(e,t){return`[${this.formatLogDate(new Date)}] ${this.LOG_PREFIX} ${t}: ${e}`}log(e,t){void 0===t&&(t="info");const r=this.formatMessage(e,t);this.logRaw(r)}logRaw(e){console.debug(e)}}const logger=new Logger;function collectPhpLogs(e,t){e.addPlaygroundRequestEndListener(t)}async function startPlaygroundWeb({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new ProgressTracker,disableProgressBar:o,onBlueprintStepCompleted:s,sapiName:i}){if(assertValidRemote(r),allowStorageAccessByUserActivation(e),r=setQueryParams(r,{progressbar:!o}),n.setCaption("Preparing WordPress"),!t)return doStartPlaygroundWeb(e,r,n);const a=compileBlueprint(t,{progress:n.stage(.5),onStepCompleted:s}),c=await doStartPlaygroundWeb(e,setQueryParams(r,{php:a.versions.php,wp:a.versions.wp,"sapi-name":i,"php-extension":a.phpExtensions,networking:a.features.networking?"yes":"no"}),n);return collectPhpLogs(logger,c),await runBlueprintSteps(a,c),n.finish(),c}function allowStorageAccessByUserActivation(e){var t,r;null!=(t=e.sandbox)&&t.length&&(null==(r=e.sandbox)||!r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function doStartPlaygroundWeb(e,t,r){await new Promise((r=>{e.src=t,e.addEventListener("load",r,!1)}));const n=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);await n.isConnected(),r.pipe(n);const o=r.stage();return await n.onDownloadProgress(o.loadingListener),await n.isReady(),o.finish(),n}const officialRemoteOrigin="https://playground.wordpress.net";function assertValidRemote(e){const t=new URL(e,officialRemoteOrigin);if((t.origin===officialRemoteOrigin||"localhost"===t.hostname)&&"/remote.html"!==t.pathname)throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${officialRemoteOrigin}/remote.html.`)}function setQueryParams(e,t){const r=new URL(e,officialRemoteOrigin),n=new URLSearchParams(r.search);for(const[o,s]of Object.entries(t))if(null!=s&&!1!==s)if(Array.isArray(s))for(const e of s)n.append(o,e.toString());else n.set(o,s.toString());return r.search=n.toString(),r.toString()}async function connectPlayground(e,t){if(console.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),null!=t&&t.loadRemote)return startPlaygroundWeb({iframe:e,remoteUrl:t.loadRemote});const r=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);return await r.isConnected(),r}}}]); \ No newline at end of file diff --git a/assets/js/23da3c05.70bf51d0.js b/assets/js/23da3c05.70bf51d0.js deleted file mode 100644 index c70574176..000000000 --- a/assets/js/23da3c05.70bf51d0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[20272],{57668:t=>{t.exports=JSON.parse('{"permalink":"/blog/tags/theme-options","page":1,"postsPerPage":9,"totalPages":1,"totalCount":1,"blogDescription":"Tutorials and articles about Eightshift development kit","blogTitle":"Tutorials and articles about Eightshift development kit"}')}}]); \ No newline at end of file diff --git a/assets/js/25003e4f.317e2114.js b/assets/js/25003e4f.317e2114.js new file mode 100644 index 000000000..8b06a15b8 --- /dev/null +++ b/assets/js/25003e4f.317e2114.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_eightshift_docs=self.webpackChunk_eightshift_docs||[]).push([[22838],{4351:e=>{e.exports=JSON.parse('{"archive":{"blogPosts":[{"id":"using-post-templates","metadata":{"permalink":"/blog/using-post-templates","source":"@site/blog/2024-03-28-using-post-templates.md","title":"Using post templates","description":"Explaining post templates and how to use them.","date":"2024-03-28T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"templates","permalink":"/blog/tags/templates"}],"readingTime":5.05,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Using post templates","description":"Explaining post templates and how to use them.","slug":"using-post-templates","authors":"obradovic","date":"2024-03-28T00:00:00.000Z","tags":["eightshift","boilerplate","templates"],"hide_table_of_contents":false},"unlisted":false,"nextItem":{"title":"Using inner blocks","permalink":"/blog/using-inner-blocks"}},"content":"Sometimes you need your posts to follow a specific structure, or you simply want to provide a good starting point for the editors. This blog post will cover what post templates are, how to set them up, and what options they offer.\\n\x3c!--truncate--\x3e\\n\\nA simple use case of post templates can be a review or a testimonial. For example, if you want each review to be a separate post and to use a single Quote block.\\n\\nIf you don\u2019t have the new post type registered, you can refer to one of the previous blog posts which explains how to [register Custom Post Types](/blog/using-cpts-and-taxonomies). Once the new post type is registered, you can set the `template_lock` argument.\\n\\n## Template locking options\\n\\nThe best way to lock the template is by adding the `template_lock` argument into a `return` statement from the `getPostTypeArguments` method in your post type class.\\n\\n```php\\nreturn [\\n\\t// ...\\n\\t\'template_lock\' => \'all\',\\n];\\n```\\n\\nThere are a few ways of locking the template:\\n\\n- `all` - blocks can\u2019t be inserted, removed, or moved around. Content can be edited for existing blocks\\n- `insert` - you can\u2019t insert or remove blocks, but you can move them around\\n\\n:::note\\nIt\u2019s not mandatory to use `template_lock` if you\u2019re using post templates. You can leave it out and have it fully unlocked to give the editors the freedom to modify the proposed template.\\n:::\\n\\nAdditionally, you can lock each block separately by adding the following attributes:\\n```json\\n\\"lock\\": {\\n\\t\\"remove\\": true,\\n\\t\\"move\\": true,\\n}\\n```\\n\\n## Adding a template\\n\\nA recommended approach for adding a post template is to add a service class. For this example, the post type is **Review**, so the WP-CLI command for creating a new service class looks like this:\\n\\n```bash\\nwp boilerplate create service-example --folder=Templates --file_name=ReviewTemplate\\n```\\n\\nIf you\u2019re adding a template for another post type, create a separate class, but include it in the same namespace (folder). That way you\u2019ll have a much better overview of the templates in the project.\\n\\nHere\u2019s an example of how to add a single Quote block as a template:\\n\\n```php\\n/**\\n * Register Review Template.\\n *\\n * @return void\\n */\\npublic function registerReviewTemplate(): void\\n{\\n\\t$reviewPostType = \\\\get_post_type_object(ReviewPostType::POST_TYPE_SLUG);\\n\\n\\t$reviewPostType->template = [\\n\\t\\t[\\n\\t\\t\\t\'eightshift-boilerplate/quote\',\\n\\t\\t\\t[\\n\\t\\t\\t\\t\'wrapperSimple\' => true,\\n\\t\\t\\t\\t\'quoteQuoteParagraphContent\' => \'Content placeholder\',\\n\\t\\t\\t\\t\'quoteQuoteAuthorContent\' => \'Author name placeholder\',\\n\\t\\t\\t]\\n\\t\\t],\\n\\t];\\n}\\n```\\n\\nTo assign a post template, you need to get the post type object and then update the `template` property. Alternatively, you can also lock the post template in this method with the `template_lock` property, but it\u2019s much cleaner to do it during custom post type registration.\\n\\nDon\u2019t forget to register your method with `add_action`:\\n\\n```php\\n\\\\add_action(\'init\', [$this, \'registerReviewTemplate\'], 20);\\n```\\n\\n## Building complex layouts\\n\\nAs you can see from the previous example, you can set any attribute you want, including wrapper-related options. The easiest way to add a complex post template is by building it in the Gutenberg editor first, then switching to Code Editor and copying the content. This will have to be rewritten in PHP to make it work, and here\u2019s how to do it. Let\u2019s say the code for the blocks looks like this:\\n\\n```\\n\x3c!-- wp:eightshift-boilerplate/paragraph {\\"paragraphParagraphContent\\":\\"Placeholder text\\"} /--\x3e\\n\\n\x3c!-- wp:eightshift-boilerplate/cta-modal {\\"ctaModalButtonContent\\":\\"Apply now!\\",\\"ctaModalEndDateHide\\":true} --\x3e\\n\x3c!-- wp:eightshift-boilerplate/heading {\\"wrapperUseShowControl\\":false,\\"wrapperSimpleShowControl\\":false,\\"wrapperSimple\\":true,\\"wrapperAnchorId\\":\\"apply-now\\",\\"headingHeadingContent\\":\\"Application form\\",\\"headingHeadingSize\\":\\"h4:bold\\",\\"headingAlign\\":\\"center\\"} /--\x3e\\n\\n\x3c!-- wp:eightshift-forms/forms /--\x3e\\n\x3c!-- /wp:eightshift-boilerplate/cta-modal --\x3e\\n```\\n\\nThis is how it looks when you rewrite it in PHP.\\n\\n```php\\n$eventPostType->template = [ // array that holds all blocks.\\n\\t[ // array that holds a Paragraph block.\\n\\t\\t\'eightshift-boilerplate/paragraph\', // full block name.\\n\\t\\t[ // array that holds block attributes.\\n\\t\\t\\t\'paragraphParagraphContent\' => \'Placeholder text\',\\n\\t\\t]\\n\\t],\\n\\t[ // array that holds a CTA Modal block.\\n\\t\\t\'eightshift-boilerplate/cta-modal\',\\n\\t\\t[ // array that holds block attributes.\\n\\t\\t\\t\'ctaModalEndDateHide\' => true,\\n\\t\\t\\t\'ctaModalButtonContent\' => \'Apply now!\',\\n\\t\\t\\t\'ctaModalButtonAlign\' => \'center\',\\n\\t\\t],\\n\\t\\t[ // array of inner blocks for a CTA Modal block.\\n\\t\\t\\t[\\n\\t\\t\\t\\t\'eightshift-boilerplate/heading\',\\n\\t\\t\\t\\t[\\n\\t\\t\\t\\t\\t\'wrapperAnchorId\' => \'apply-now\',\\n\\t\\t\\t\\t\\t\'headingHeadingContent\' => \'Application form\',\\n\\t\\t\\t\\t\\t\'headingHeadingSize\' => \'h4:bold\',\\n\\t\\t\\t\\t\\t\'headingAlign\' => \'center\'\\n\\t\\t\\t\\t]\\n\\t\\t\\t],\\n\\t\\t\\t[\\n\\t\\t\\t\\t\'eightshift-forms/forms\',\\n\\t\\t\\t\\t[] // not passing any attributes, so we just include an empty array.\\n\\t\\t\\t]\\n\\t\\t]\\n\\t]\\n];\\n```\\n\\nThe comments were added above for an easier understanding of the structure. So, to summarize:\\n\\n- the `template` property is an array that holds all blocks\\n- each block is a separate array that accepts three values in the following order: block name (string), block attributes (array), and inner blocks (array)\\n- the process of adding inner blocks is the same as for adding blocks to the main content\\n\\n## Editor options for unlocking the templates\\n\\nEven though the templates can be locked, some blocks can still be unlocked. This can be done by selecting a block and clicking on a lock icon. When locking or unlocking a block in this way, you can toggle two options, the ones already mentioned at the end of the [Template locking options](#template-locking-options) section:\\n\\n- **Disable movement** - disable moving the block around\\n- **Prevent removal** - prevents the block from being deleted\\n\\nThat way, even if you lock the template, some modifications can still be made to the template. Please note, that once you remove a block from the locked template, you can\u2019t add it again because the button for adding blocks is disabled.\\n\\n## Suggestions for using post templates\\n\\nPost templates offer a great way to streamline the process of adding content for specific post types and making the look and feel of the same post types more uniform. There are lots of ways to use them, so here are some suggestions to give you ideas:\\n\\n**Posts/news articles** - a news article needs a title, an image, author information, and some content.\\n\\n**Events** - you can put the important information at the top with a few accordions, then follow up with some content and add a CTA button at the bottom that opens a modal with an application form.\\n\\n**Reviews** - use a single quote block for displaying user reviews. To make it work with the Featured Content block, you can modify the Featured Content block to render the Reviews CPT content directly, instead of rendering cards."},{"id":"using-inner-blocks","metadata":{"permalink":"/blog/using-inner-blocks","source":"@site/blog/2024-03-07-using-inner-blocks.md","title":"Using inner blocks","description":"Various tips and useful features for your project included in Eightshift DevKit.","date":"2024-03-07T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"inner blocks","permalink":"/blog/tags/inner-blocks"}],"readingTime":4.71,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Using inner blocks","description":"Various tips and useful features for your project included in Eightshift DevKit.","slug":"using-inner-blocks","authors":"obradovic","date":"2024-03-07T00:00:00.000Z","tags":["eightshift","boilerplate","inner blocks"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Using post templates","permalink":"/blog/using-post-templates"},"nextItem":{"title":"Tips & useful features","permalink":"/blog/tips-useful-features"}},"content":"InnerBlocks in WordPress enable the creation of nested block structures within the Gutenberg editor, allowing for the development of more complex and customizable content layouts.\\n\x3c!--truncate--\x3e\\n\\n## Why use inner blocks?\\n\\nUse of inner blocks allows for more flexibility when building content. Let\u2019s say you\u2019re building a simple two-column layout with image on one side and content on the other side. You can define the components that will be used (e.g. header, paragraph, list, button) and then just toggle the ones you don\u2019t need.\\n\\nThis approach works perfectly fine when you have a strict layout and don\u2019t need larger content structure variations. Using inner blocks may introduce a bit more complexity - both for developers and content editors, but ultimately gives the editors much more freedom.\\n\\nAnother example where inner blocks are used is the Carousel block. Using inner blocks allows you to add as many slides as you\'d like in your carousel. Let\u2019s not forget about Columns and Group blocks. These also use inner blocks.\\n\\n## Adding inner block support\\n\\nThe example used in this blog post is a two-column Card that was made for a project. First thing that needs to be updated is the ***manifest.json*** file. For the sake of simplicity and not having too much code, the parts that aren\u2019t related to the inner blocks have been removed.\\n\\n```json\\n{\\n\\t\\"hasInnerBlocks\\": true,\\n\\t\\"innerBlocksDependency\\": [\\n\\t\\t\\"heading\\",\\n\\t\\t\\"paragraph\\"\\n\\t],\\n\\t\\"attributes\\": {\\n\\t\\t\\"cardTwoColumnAllowedBlocks\\": {\\n\\t\\t\\t\\"type\\": \\"array\\",\\n\\t\\t\\t\\"items\\": {\\n\\t\\t\\t\\t\\"type\\": \\"string\\"\\n\\t\\t\\t},\\n\\t\\t\\t\\"default\\": [\\n\\t\\t\\t\\t\\"eightshift-boilerplate/paragraph\\",\\n\\t\\t\\t\\t\\"eightshift-boilerplate/heading\\",\\n\\t\\t\\t\\t\\"eightshift-boilerplate/button\\",\\n\\t\\t\\t\\t\\"eightshift-boilerplate/lists\\"\\n\\t\\t\\t]\\n\\t\\t}\\n\\t}\\n}\\n```\\n\\nThe `hasInnerBlocks` key defines that this block supports inner blocks. The `innerBlocksDependency` is generally used to output block dependencies when adding a block via CLI, but it can also be used to add inner blocks automatically. You can see an example of using it in the Columns block `editor.js` file.\\n\\nIn case we need to limit which blocks can be added inside inner blocks, we can do so with an attribute. Usually, the attribute is named `{blockName}AllowedBlocks`. Set the default value as an array of strings that represent block names you want to allow.\\n\\nPlease note that the block names must include the block namespace! (`eightshift-boilerplate` by default, check in Global manifest)\\n\\nNow you need to pass the allowed blocks attribute into the `InnerBlocks` component In the `{block-name}-editor.js` file. Here\u2019s an example of the code related only to the inner blocks:\\n\\n```jsx\\nimport { InnerBlocks } from \'@wordpress/block-editor\';\\nimport { BlockInserter } from \'@eightshift/frontend-libs/scripts\';\\n\\nexport const CardTwoColumnEditor = ({ attributes, setAttributes, clientId }) => {\\n\\n\\tconst {\\n\\t\\tcardTwoColumnAllowedBlocks,\\n\\t} = attributes;\\n\\n\\treturn (\\n\\t\\t \\n\\t\\t\\t\\n\\t);\\n};\\n```\\n\\nThe `InnerBlocks` component comes from Gutenberg. In order to limit the allowed blocks, we need to pass the list of allowed inner blocks to the `allowedBlocks` attribute. If your inner blocks should be laid out horizontally in the editor, instead of vertically, you can pass `orientation=\'horizontal\'`.\\n\\n`renderAppender` prop allows passing a custom block insert button. Due to relatively frequent changes in Gutenberg, a custom `BlockInserter` element is available in Frontend libs as a replacement, and can be passed to `InnerBlocks`.\\n\\nFinally, to render the inner blocks in PHP, you need to add the following:\\n\\n```php\\n\\n```\\n\\nAnd that\u2019s it! Your block now supports inner blocks.\\n\\n:::note\\nA block can have only one set of inner blocks.\\n:::\\n\\n## Overriding inner block attributes\\n\\nInner blocks behave like regular blocks, which means they also have a wrapper by default. This may not always be desired and manually removing wrapper or adding custom wrapper settings on each inner block can be tedious. That\u2019s why Eightshift DevKit offers few helpers that allow you to override inner block attributes.\\n\\nBoth of these helpers go to your `{block-name}-block.js` file.\\n\\n### overrideInnerBlockAttributes\\n\\nThis helper allows you to set the attributes on all inner blocks by passing them as a third parameter. The example below shows how to disable the wrapper and hide wrapper controls.\\n\\n```jsx\\nimport { useSelect } from \'@wordpress/data\';\\nimport { overrideInnerBlockAttributes } from \'@eightshift/frontend-libs/scripts\';\\n\\nexport const Accordion = (props) => {\\n\\t// Set these attributes to all inner blocks once inserted in DOM.\\n\\tuseSelect((select) => {\\n\\t\\toverrideInnerBlockAttributes(\\n\\t\\t\\tselect,\\n\\t\\t\\tprops.clientId,\\n\\t\\t\\t{\\n\\t\\t\\t\\twrapperUse: false,\\n\\t\\t\\t\\twrapperNoControls: true,\\n\\t\\t\\t},\\n\\t\\t);\\n\\t});\\n\\n\\treturn (\\n\\t\\t// ...\\n\\t);\\n};\\n```\\n\\nKeep in mind this helper allows you to set any attribute that the inner block supports, so you can even set a larger paragraph size and a different color, for example.\\n\\n### useBlockProps and useInnerBlocksProps\\n\\nIn case the default `InnerBlocks` limits your styling and/or layout options too much, you can opt into the newer block prop hooks to implement inner blocks as well!\\n\\nImport the `useBlockProps` and `useInnerBlocksProps` hooks, configure them just like regular InnerBlocks, and spread the params into an element of your choice (`div` is recommended).\\n\\nIn code, it looks something like this:\\n\\n```jsx\\nimport { useBlockProps, useInnerBlocksProps } from \'@wordpress/block-editor\';\\n\\nexport const DemoEditor = (props) => {\\n\\tconst blockProps = useBlockProps();\\n\\tconst innerBlocksProps = useInnerBlocksProps(blockProps, {\\n\\t\\tallowedBlocks: demoAllowedBlocks,\\n\\t\\trenderAppender: () =>}\\n\\t\\t\\t/>\\n\\t\\t ,\\n\\t});\\n\\n\\treturn (\\n\\t\\t // Do whatever you want with this.\\n\\t);\\n};\\n```\\n\\n## Conclusion\\n\\nThe best way to understand how inner blocks work is to try to build your own block that supports inner blocks and try out various options and see what kind of results you\u2019ll get. If you ever get stuck, you can refer to the official [Eightshift DevKit documentation](https://eightshift.com/docs/welcome) or check the blocks that already have inner blocks support. These blocks are:\\n\\n- accordion\\n- accordion item\\n- columns\\n- column\\n- carousel\\n- group"},{"id":"tips-useful-features","metadata":{"permalink":"/blog/tips-useful-features","source":"@site/blog/2024-02-29-tips-useful-features.md","title":"Tips & useful features","description":"Various tips and useful features for your project included in Eightshift DevKit.","date":"2024-02-29T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"blocks","permalink":"/blog/tags/blocks"},{"label":"plugins","permalink":"/blog/tags/plugins"},{"label":"colors","permalink":"/blog/tags/colors"},{"label":"images","permalink":"/blog/tags/images"},{"label":"classes","permalink":"/blog/tags/classes"}],"readingTime":5.665,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Tips & useful features","description":"Various tips and useful features for your project included in Eightshift DevKit.","slug":"tips-useful-features","authors":"obradovic","date":"2024-02-29T00:00:00.000Z","tags":["eightshift","boilerplate","blocks","plugins","colors","images","classes"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Using inner blocks","permalink":"/blog/using-inner-blocks"},"nextItem":{"title":"Making your project multilingual","permalink":"/blog/making-your-project-multilingual"}},"content":"Eightshift DevKit has lots of features that can make your development experience easier. These are mostly minor features which can\u2019t be a blog post of its own, so they\u2019ll be listed here. This isn\u2019t a complete list, so there may be a part 2 in the future.\\n\x3c!--truncate--\x3e\\n\\n## Using only Eightshift blocks\\n\\nIf you want to remove the default Gutenberg blocks and use only Eightshift blocks, it\u2019s as easy as adding the following code in your **_src/Blocks/Blocks.php_** file:\\n\\n```php\\n// Limits the usage of only custom project blocks.\\n\\\\add_filter(\'allowed_block_types_all\', [$this, \'getAllBlocksList\'], 10, 2);\\n```\\n\\n## ModifyAdminAppearance class\\n\\nWhen you have multiple environments (local, staging, production ...), you may accidentally change something on the wrong environment if you mix up your tabs. The `ModifyAdminAppearance` class changes your WP Admin color scheme depending on the environment type defined with the `WP_ENVIRONMENT_TYPE` constant. That way it\u2019s much easier to differentiate on which environment you are when you\'re in WP Admin.\\n\\nNow when you get a call from the client asking you why the blog post they published isn\u2019t visible on the site, the first question you can ask is: \u201cWhat color is the admin area?\u201d \ud83d\ude04\\n\\nTo add it into your project, use the following WP-CLI command:\\n\\n```bash\\nwp boilerplate create modify-admin-appearance\\n```\\n\\nAfter adding this class to your project, all you have to do is define the proper environment type in the `WP_ENVIRONMENT_TYPE` constant in ***wp-config.php.***\\n\\nThe supported values are:\\n\\n- local\\n- development\\n- staging\\n- production\\n\\n![Different color schemes in WP Admin depending on the environment](/img/blog/modify-admin-appearance.webp)\\n\\nIf you want to change any of the colors, you can do so by modifying the values in `COLOR_SCHEMES` array inside `ModifyAdminAppearance` class. For the full list of available color schemes, you can navigate to **_wp-admin/css/colors_**. The subfolders here represent the color schemes you can use. For example, if you want to change production environment color scheme to `coffee`, you would do it like this:\\n\\n```php\\n/**\\n * List of admin color schemes.\\n *\\n * @var array \\n */\\npublic const COLOR_SCHEMES = [\\n\\t\'development\' => \'fresh\',\\n\\t\'local\' => \'fresh\',\\n\\t\'staging\' => \'blue\',\\n\\t\'production\' => \'coffee\',\\n];\\n```\\n\\n## EscapedView class\\n\\nThis class can be used to define which tags and attributes are escaped or allowed in your project. To add the class into your project, use the following WP-CLI command:\\n\\n```bash\\nwp boilerplate create escaped-view\\n```\\n\\nHere\u2019s an example how to define the allowed tags so `wp_kses` doesn\u2019t remove them:\\n\\n```php\\n\\t/**\\n\\t * Add tags to allowed HTML list.\\n\\t *\\n\\t * @param array > $tags Allowed tags.\\n\\t *\\n\\t * @return array >\\n\\t */\\n\\tpublic function ksesAllowedHtml($tags): array\\n\\t{\\n\\t\\t$tags[\'source\'] = [\\n\\t\\t\\t\'src\' => [],\\n\\t\\t\\t\'type\' => [],\\n\\t\\t];\\n\\n\\t\\t$tags[\'video\'] = [\\n\\t\\t\\t\'muted\' => [],\\n\\t\\t\\t\'src\' => [],\\n\\t\\t\\t\'autoplay\' => [],\\n\\t\\t\\t// ...\\n\\t\\t];\\n\\n\\t\\t$tags[\'div\'][\'data-*\'] = true;\\n\\n\\t\\treturn \\\\array_merge(\\n\\t\\t\\t$tags,\\n\\t\\t\\tstatic::SVG,\\n\\t\\t\\tstatic::FORM,\\n\\t\\t\\tstatic::IFRAME\\n\\t\\t);\\n\\t}\\n```\\n\\n:::caution\\nPlease be wary of the attributes you allow, as this could expose your website to cross-site scripting (XSS) and similar attacks!\\n:::\\n\\nDon\u2019t forget to add this to the `register` method:\\n\\n```php\\n\\\\add_filter(\'wp_kses_allowed_html\', [$this, \'ksesAllowedHtml\'], 20, 1);\\n```\\n\\n## Media class\\n\\nTo add the Media class to your project, use the following WP-CLI command:\\n\\n```bash\\nwp boilerplate create media\\n```\\n\\nYou can use the Media class to define new media sizes or allow uploads of the mime types that are not allowed by default.\\n\\n```php\\n\\t/**\\n\\t * Allow additional types for uploads in media.\\n\\t *\\n\\t * @param array $mimes Load all mimes types.\\n\\t *\\n\\t * @return array Return original and updated.\\n\\t */\\n\\tpublic function enableMimeTypes(array $mimes): array\\n\\t{\\n\\t\\t$mimes[\'svg\'] = \'image/svg+xml\';\\n\\t\\t$mimes[\'zip\'] = \'application/zip\';\\n\\t\\t$mimes[\'json\'] = \'application/json\';\\n\\n\\t\\treturn $mimes;\\n\\t}\\n```\\n\\nAnd register the filter:\\n\\n```php\\n\\\\add_filter(\'upload_mimes\', [$this, \'enableMimeTypes\']);\\n```\\n\\nThis class also supports converting your media into **_WebP_** format, but more on that below.\\n\\n## Automatic WebP conversion\\n\\nThe WebP file format is becoming more and more popular, with its smaller file sizes and better compression, it is a preferred replacement for .jpg and .png formats. Eightshift DevKit supports converting your existing files to WebP format.\\n\\nIf you already have the Media class in your project, you need to run this WP-CLI command:\\n\\n```bash\\nwp boilerplate create webp-media-column\\n```\\n\\nThis command will add a new column in your ***List view*** in Media Library that shows if the media is converted to WebP or not.\\n\\n![WebP column in Media Library](/img/blog/webp-column.webp)\\n\\nTo enable and convert existing media to WebP, run the following commands:\\n\\n```bash\\nwp boilerplate run use-webp-media\\nwp boilerplate run regenerate-media\\n```\\n\\nAfter running these commands, you\u2019ll have your images converted to WebP. Some formats like `svg` will not be converted, this is intended.\\n\\nPlease note that the original files will not be deleted and you\u2019ll have to add additional logic to your Image component for replacing the URLs.\\n\\nHere\u2019s a simple example how to do it:\\n\\n```php\\n// Check if webP is used from admin.\\n$isWebPUsed = Components::isWebPMediaUsed();\\n\\n// If webP is used override the url for large.\\nif ($isWebPUsed) {\\n\\t$sourceWebPLarge = Components::getWebPMedia($imageUrl[\'large\'], Media::WEBP_ALLOWED_EXT);\\n\\n\\tif ($sourceWebPLarge) {\\n\\t\\t$imageUrl[\'large\'] = $sourceWebPLarge[\'src\'];\\n\\t}\\n}\\n```\\n\\n## Dynamic cookies for WP Rocket\\n\\nThis is quite useful when you have a GDPR plugin and you have to take the cookie value into consideration when serving the cached version of the site.\\n\\nTo add the GDPR cookie to the list of dynamic cookies, create a new class called Rocket with the following WP-CLI command:\\n\\n```bash\\nwp boilerplate create service-example --folder=Plugins/Rocket --file_name=Rocket\\n```\\n\\nAdd the following method to the Rocket class:\\n\\n```php\\n\\t/**\\n\\t * List all dynamic cookies that will create new cached version.\\n\\t *\\n\\t * @param array $items Items from the admin.\\n\\t *\\n\\t * @return array \\n\\t */\\n\\tpublic function dynamicCookiesList(array $items): array\\n\\t{\\n\\t\\t$items[] = \'gdpr\';\\n\\n\\t\\treturn $items;\\n\\t}\\n```\\n\\nFinally, add the following filter to the `register` method:\\n\\n```php\\n\\\\add_filter(\'rocket_cache_dynamic_cookies\', [$this, \'dynamicCookiesList\']);\\n```\\n\\n## Yoast SEO helper\\n\\nThe content generated by Eightshift blocks may be difficult for Yoast SEO to interpret, but there is a Yoast SEO helper included in our DevKit that fixes the issue and makes the content readable to Yoast SEO. By default, Yoast SEO can\'t read the content from custom dynamic blocks, so this helper tells it how to parse the content from the blocks.\\n\\nTo enable this, you have to add the following in **_src/Blocks/assets/scripts/application-blocks-editor.js_**:\\n\\n```jsx\\nimport { yoastSeo } from \'@eightshift/frontend-libs/scripts/plugins\';\\n\\n// ...\\n\\nyoastSeo();\\n```\\n\\n## Linters and Coding Standards checks\\n\\nEightshift DevKit includes coding standards checks that will help you improve your code quality.\\n\\nTo run these commands, you have to be in the theme root folder. Here\u2019s the list:\\n\\n- `npm run lintStyle` - check your CSS files with StyleLint\\n- `npm run lintJs` - check your JS files with ESLint\\n- `composer test:standards` - check PHP coding standards errors with PHPCS\\n- `composer test:types` - runs PHPStan static code analysis"},{"id":"making-your-project-multilingual","metadata":{"permalink":"/blog/making-your-project-multilingual","source":"@site/blog/2024-02-01-making-your-project-multilingual.md","title":"Making your project multilingual","description":"Examples of using I18n in a project","date":"2024-02-01T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"i18n","permalink":"/blog/tags/i-18-n"},{"label":"multilingual","permalink":"/blog/tags/multilingual"}],"readingTime":5.75,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Making your project multilingual","description":"Examples of using I18n in a project","slug":"making-your-project-multilingual","authors":"obradovic","date":"2024-02-01T00:00:00.000Z","tags":["eightshift","boilerplate","i18n","multilingual"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Tips & useful features","permalink":"/blog/tips-useful-features"},"nextItem":{"title":"How to use the Wrapper as a standalone component","permalink":"/blog/wrapper-as-a-standalone-component"}},"content":"Tools like Google Translate can automatically translate websites with reasonable quality. However, users will have a much better experience if you add support for multiple languages in your project and manage the translations yourself.\\n\x3c!--truncate--\x3e\\n\\n## Making strings translatable in PHP\\nA good practice is to use one of the I18n (internationalization) functions for your hardcoded strings, even if your website starts with a single language. This way, you can add multilingual support more easily later.\\n\\nIf you\'ve worked on a multilanguage-capable project, you most likely came across `__()` and `_e()` functions. The main difference between the `__()` and `_e()` is that `__()` returns the value, while `_e()` echoes it. Both functions take two arguments: the first one is the string to be translated, and the second one is the textdomain that identifies the translation file.\\n\\n> Textdomain is usually your project name written in kebab-case.\\n\\nWhile WordPress functions like `__()` and `_e()` will definitely do the job, it is much better to use the variants of these functions that also escape the output. These are `esc_html__()` and `esc_html_e()`. There are also a few more functions for I18n you can use, but to keep it simple, we\'ll just mention these two for now.\\n\\nHere is an example of using one of these functions:\\n```php\\n\\n```\\n\\n## Making strings translatable in JS\\nTo translate the strings in the Block editor or options, you will first have to import the function from the `@wordpress/i18n` library.\\n```jsx\\nimport { __ } from \'@wordpress/i18n\';\\n```\\nTo output your string, simply use it like this:\\n```jsx\\n{__(\'Icon position\', \'project-name\')}\\n```\\n\\nAlternative functions you can use are:\\n- `_n` for singular/plural forms\\n- `_nx` for singular/plural forms with _gettext_ context\\n- `_x` for a translated string with a _gettext_ context\\n\\nYou can refer to the [block editor handbook](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/) for more information on these functions.\\n\\n## The I18n class\\nThe easiest way to add I18n support to a project created with Eightshift boilerplate is by using the WP-CLI command:\\n```bash\\nwp boilerplate create i18n\\n```\\n\\nThis command generated a new class inside the `src/I18n` folder. This class instructs WordPress to look for translations in `src/I18n/languages` with the textdomain defined as your project name. The next step is generating .po and .mo files that are used for translation.\\n\\n## Generating .pot file\\nYou can create a `.pot` (_Portable object template_) file by using WP-CLI. Run the following command in your project root:\\n```bash\\nwp i18n make-pot\\n```\\n\\nAlternatively, you can use tools like [Poedit](https://poedit.net/) to generate a `.pot` file and generate translations from it later.\\n\\n## Translating with Poedit\\nOnce you have the `.pot` file, you can use Poedit to generate `.po` and `.mo` files that are used for translating hardcoded strings in your project. When generating the files, you can choose for which locale you\'re creating the translation for. For example, if you are creating a translation for the German language, your files should be named `de_DE.po` and `de_DE.mo`.\\n\\nAfter generating the files, go to **Translation -> Properties** and navigate to the **Sources Paths** tab. Set the _Base path_ to the theme folder path. In _Excluded paths_ you can add folders like `node_modules`, `vendor`, and `public` to exclude external packages.\\n\\nIn the _Sources keywords_ tab you can set additional functions for use in your project for translations. Commonly used functions are:\\n- `_e` for translating a string and echoing it\\n- `__` for returning a translated string\\n- `esc_html__` for returning a translated string which is escaped in a way it\'s safe to use within HTML\\n- `esc_html_e` for echoing a translated string which is escaped in a way it\'s safe to use within HTML\\n- `esc_attr__` for returning a translated string which is escaped in a way it\'s safe to use within an attribute\\n- `esc_html_x` for returning a translated string which is escaped in a way it\'s safe to use within HTML, with a _gettext_ context\\n- `_n` for returning a translated string in a singular or plural form, based on the supplied number\\n\\n> If you\'re missing a string in your `.po` file be sure to check which function is used for translation for that string, and that the function is added to _Sources keywords_.\\n\\nAfter updating the settings, click on _Update from source code_ option to get the updated list of strings to translate.\\n\\nThe translation process is simple. The left column represents the source text, and the right column the translation. When you have finished translating the strings, copy the `.po` and `.mo` files to the `src/I18n/languages` folder.\\n\\n## JS translations\\nThe process of translating strings in JS has a couple of extra steps.\\n\\nIn order to translate strings in JS (e.g. Block editor strings), you will have to generate translation file. To do this, navigate to your `src/I18n/languages` folder and use the following WP-CLI command:\\n```bash\\nwp i18n make-json --no-purge\\n```\\n\\nThis will generate a `.json` file for each JS file present. The strings are extracted from `.po` files, so you\'ll already have the translations added. The `--no-purge` flag is used to keep the existing translations in the `.po` file.\\n\\nThe method used for setting the script translations is `setScriptTranslations()` from the `I18n` class.\\n\\nThe default way this works in Eightshift DevKit is that you need to have a single `.json` file with all the JS translations. If needed, you can either modify this method to read from multiple files, or just merge all the `.json` files into one.\\n\\nIf using the default setup (everything in one file) follow this naming structure: `{textdomain}-{locale}-{handle}.json`.\\n\\nFor example, if your _textdomain_ is `project-name` and your locale is `de_DE`, your file should be named `project-name-de_DE-project-name-block-editor-scripts.json`.\\n\\n> The block-related translations depend on the language the user has set in WP admin.\\n\\n## Enabling languages and content translation\\nIf the website itself needs to support content in multiple languages, a plugin is a good option.\\n\\n The most common multi-language plugins are:\\n- **WPML** - one of the most popular plugins on the market. It is a paid plugin, but offers a lot of advanced options.\\n- **Polylang** - a free plugin (also has a paid _Pro_ version).\\n\\n> Explore other options as well, you might find a plugin that is a better fit for your project than WPML or Polylang.\\n\\nMost of the translation work will be done through the editor, since you\'ll need to translate the content on posts and pages.\\n\\n## Additional resources\\nInternationalization (_I18n_) and Localization (_L10n_) are very broad topics, so it\'s impossible to cover everything in a single blog post.\\n\\nIf you wish to know about the core I18n functionalities, or a bit more about how it is used in the Eightshift DevKit, here are a few resources which you may find interesting:\\n- [WordPress Codex - I18n for WordPress Developers](https://codex.wordpress.org/I18n_for_WordPress_Developers)\\n- [Eightshift Development kit documentation - Tips & Tricks](https://eightshift.com/docs/basics/tips-tricks/#internationalization-i18n-and-localization-l10n)\\n- [Infinum WordPress Handbook - Localization](https://infinum.com/handbook/wordpress/translations/localization)"},{"id":"wrapper-as-a-standalone-component","metadata":{"permalink":"/blog/wrapper-as-a-standalone-component","source":"@site/blog/2023-09-05-wrapper-as-a-standalone-component.md","title":"How to use the Wrapper as a standalone component","description":"Explains the process of using the Wrapper component in WordPress templates.","date":"2023-09-05T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"wrapper","permalink":"/blog/tags/wrapper"},{"label":"components","permalink":"/blog/tags/components"}],"readingTime":3.205,"hasTruncateMarker":true,"authors":[{"name":"Ivan Kancijan","title":"WordPress Engineer","url":"https://github.com/kancijan","imageURL":"https://avatars.githubusercontent.com/u/135589039?v=4","key":"kancijan"}],"frontMatter":{"title":"How to use the Wrapper as a standalone component","description":"Explains the process of using the Wrapper component in WordPress templates.","slug":"wrapper-as-a-standalone-component","authors":"kancijan","date":"2023-09-05T00:00:00.000Z","tags":["eightshift","boilerplate","wrapper","components"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Making your project multilingual","permalink":"/blog/making-your-project-multilingual"},"nextItem":{"title":"Working with custom queries","permalink":"/blog/working-with-custom-queries"}},"content":"As one of the most powerful features in the Eightshift DevKit, the Wrapper is a part of every Eightshift block in the Gutenberg editor, but what about WordPress templates?\\n\x3c!--truncate--\x3e\\n\\n:::note\\n[Wrapper](https://eightshift.com/docs/basics/blocks-wrapper/) is designed to be the ultimate top-level component that controls how your block behaves in the website layout. It is a sort of a \'section\' in traditional builders. By default, you can control a whole lot of stuff, but there is an option to add custom attributes and tailor the Wrapper to the needs of your project.\\n:::\\n\\n## What are WordPress templates?\\n\\nBefore the days of [Full Site Editing](https://developer.wordpress.org/block-editor/getting-started/full-site-editing/) in WordPress, we used [template files](https://developer.wordpress.org/themes/basics/template-hierarchy/) to add custom layouts to a blog page or post archives.\\n\\n:::note\\nWhile Full-site editing (FSE) _is_ supported in Eightshift Libs, a couple of modifications have to be done in your project to make it work.\\n:::\\n\\nDepending on your setup, you might still use those as they are still a core part of WordPress themes.\\n\\n## Usage in templates\\n\\nThanks to the `Components` helper, we can easily `render()` any component in our template. \\n\\n:::note\\nInterested in how to use components in a block? Take a look at [our docs](https://eightshift.com/docs/basics/blocks-component-in-block#i-have-a-component-that-i-want-to-use-manually).\\n:::\\n\\nFor this example, we\'ll use `index.php`, as you already have it in your theme. If not, use the code below:\\n\\n```php\\n true,\\n\\t\\t\'wrapperManualContent\' => \'\',\\n\\t],\\n\\t\'\',\\n\\ttrue\\n);\\n```\\n:::note\\nSetting the `$useComponentDefaults` to `true` will save you the trouble of setting a lot of additional properties by using default values defined in your manifest.\\n:::\\n\\n### Wrapper output\\n\\nNow that we have a working Wrapper component in our template, it\'s time to display posts in the loop.\\n\\nLet\'s use the [Card](https://infinum.github.io/eightshift-frontend-libs/storybook/?path=/story/components-card--editor) from the Frontend Libs as it\'s the perfect component to display post details and pass it to the `wrapperManualContent`.\\n\\nTo make the Card component look even better, we\'ll use some of the powerful properties the Wrapper component has to offer and add spacing between each item.\\n\\n```php\\n\'wrapperSpacingTopLarge\' => 50,\\n\'wrapperSpacingBottomLarge\' => 50,\\n```\\n\\n:::note\\nFor the list of all available properties, look at the Wrapper\'s `manifest.json`.\\n:::\\n\\n### Final result\\n\\n```php\\n true,\\n\\t\\t\\t\\t\'wrapperManualContent\' => Components::render(\'card\', [\\n\\t\\t\\t\\t\\t\'introContent\' => sprintf(__(\'On %1$s by %2$s\', \'eightshift\'), get_the_date(), get_the_author_meta(\'display_name\')),\\n\\t\\t\\t\\t\\t\'headingContent\' => get_the_title(),\\n\\t\\t\\t\\t\\t\'paragraphContent\' => apply_filters(\'the_content\', get_the_excerpt()),\\n\\t\\t\\t\\t\\t\'buttonContent\' => __(\'View more\', \'eightshift\'),\\n\\t\\t\\t\\t\\t\'buttonUrl\' => get_permalink(),\\n\\t\\t\\t\\t]),\\n\\t\\t\\t\\t\'wrapperSpacingTopLarge\' => 50,\\n\\t\\t\\t\\t\'wrapperSpacingBottomLarge\' => 50,\\n\\t\\t\\t],\\n\\t\\t\\t\'\',\\n\\t\\t\\ttrue\\n\\t\\t);\\n\\t}\\n}\\n\\nget_footer();\\n```\\n![Wrapper with content](/img/blog/wrapper-content.png)\\n\\n## Conclusion\\n\\nAlthough the Wrapper is (usually) not intended to be used as a standalone component, there is a nice benefit to having a time-saving, out-of-the-box solution for displaying content in a grid already defined in your project."},{"id":"working-with-custom-queries","metadata":{"permalink":"/blog/working-with-custom-queries","source":"@site/blog/2023-08-03-adding-custom-query.md","title":"Working with custom queries","description":"Explains the process of registering a new service class, adding a custom query and using it in a block.","date":"2023-08-01T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"service","permalink":"/blog/tags/service"},{"label":"class","permalink":"/blog/tags/class"},{"label":"query","permalink":"/blog/tags/query"}],"readingTime":3.995,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Working with custom queries","description":"Explains the process of registering a new service class, adding a custom query and using it in a block.","slug":"working-with-custom-queries","authors":"obradovic","date":"2023-08-01T00:00:00.000Z","tags":["eightshift","boilerplate","service","class","query"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"How to use the Wrapper as a standalone component","permalink":"/blog/wrapper-as-a-standalone-component"},"nextItem":{"title":"Using multiple same components","permalink":"/blog/multiple-same-components"}},"content":"Eightshift DevKit offers some blocks with query logic out of the box, but what is the best approach when you need to add a custom query to a block you\u2019ve been working on?\\n\x3c!--truncate--\x3e\\n\\n## Usage in built-in blocks\\n\\nOne of the Eightshift blocks that already uses `WP_Query` is the ***Featured Content*** block. In that block, you can see the query logic is inside the block. However, there is a much better way to do it. The reason it was done like this was to simplify this block and to have an already functioning block available with one WP-CLI command.\\n\\nA much better approach would be to separate the query logic from the block. Other than following the MVC architecture more closely, this will also make the query logic more reusable. To do this, we\u2019re gonna create a service class.\\n\\n## What are Service classes?\\n\\n*Put simply, a Service is any PHP object that performs some sort of \\"global\\" task. - Symfony docs*\\n\\nIf you take a look at the `ServiceInterface` interface, you\u2019ll notice it only contains the `register()` method. This method holds action and filter hooks for that class. Other than hooking into existing actions and filters, this method can be used to register our own filters which can be used in blocks or other classes.\\n\\nBasically, whenever you need to hook into actions or filters, you should use a Service class for that.\\n\\n## Creating a new service class\\n\\nCreating a new service class in your project is as simple as using the following WP-CLI command:\\n\\n```bash\\nwp boilerplate create service-example --folder=CustomQuery --file_name=CustomQuery\\n```\\n\\nOnce this new class is generated, you can add a new public method that will contain the query logic. We want our method to accept three optional arguments:\\n\\n- ID of the category\\n- number of posts per page\\n- number of the current page\\n\\nHaving the category ID optional will allow for one more use case, and that is fetching the latest posts regardless of category. By default, WordPress sorts the posts by publish date, from newest to oldest.\\n\\n```php\\n/**\\n * Get posts by category ID.\\n *\\n * @param int $categoryId Category ID.\\n * @param int $postsPerPage Number of posts per page.\\n * @param int $currentPage Current page number.\\n *\\n * @return WP_Query Query object.\\n */\\npublic function getPostsByCategory($categoryId = null, $postsPerPage = 3, $currentPage = 1): WP_Query\\n{\\n\\t$postArgs = [\\n\\t\\t\'post_type\' => \'post\',\\n\\t\\t\'cat\' => $categoryId,\\n\\t\\t\'posts_per_page\' => $postsPerPage,\\n\\t\\t\'paged\' => $currentPage,\\n\\t];\\n\\n\\treturn new WP_Query($postArgs);\\n}\\n```\\n\\nTo use this method, we can add it as a filter. The filter name should be added as a constant for easier maintenance. Inside the `register()` method, add the following:\\n\\n```php\\n\\\\add_filter(self::GET_POSTS_BY_CATEGORY, [$this, \'getPostsByCategory\'], 10, 3);\\n```\\n\\n## Using the new filter\\n\\n:::note\\nEven if you register a filter for a method that doesn\u2019t accept any arguments, when calling `apply_filters`, you must pass at least 1 parameter. In those cases, simply add `null` as a parameter.\\n:::\\n\\nHere are some examples how you can use the filter:\\n\\n```php\\n// Get 3 latest posts, regardless of category.\\n$allLatestPosts = apply_filters(CustomQuery::GET_POSTS_BY_CATEGORY, null);\\n\\n// Get 10 latest posts from the News category. News category ID is 2.\\n$latestNews = apply_filters(CustomQuery::GET_POSTS_BY_CATEGORY, 2, 10);\\n\\n// Get another page of News category.\\n$pagedNews = apply_filters(CustomQuery::GET_POSTS_BY_CATEGORY, 2, 10, $currentPage);\\n```\\n\\nThe above example shows multiple use cases. The first two examples could be used in a simple block that displays only the selected number of the latest posts. The last example may be used in a REST route for a load more functionality or in a block with classic pagination.\\n\\nNow you can do a regular query loop in your block to display the posts:\\n\\n```php\\nif ($latestNews->have_posts()) {\\n\\twhile ($latestNews->have_posts()) {\\n\\t\\t$latestNews->the_post();\\n\\t\\t// render the card here with the Components::render helper.\\n\\t}\\n}\\nwp_reset_postdata();\\n```\\n\\n:::caution Important\\nDon\'t forget to add `wp_reset_postdata()` after looping through the custom query!\\n:::\\n\\n## Prepare only the data you need\\n\\nIf you would like to improve this even further, you can run the `have_posts()` loop inside the class and save only the data you need to render to an array. This makes the logic even more separated from the view and all you have to do in a block is loop through the array and populate the component attributes with the values from the array.\\n\\n```php\\n$postData = [];\\n\\nif ($queryData->have_posts()) {\\n\\twhile($queryData->have_posts()) {\\n\\t\\t$queryData->the_post();\\n\\n\\t\\t$postData[] = [\\n\\t\\t\\t\'id\' => get_the_ID(),\\n\\t\\t\\t\'title\' => get_the_title(),\\n\\t\\t\\t\'url\' => get_permalink(),\\n\\t\\t\\t\'image\' => get_the_post_thumbnail_url(),\\n\\t\\t\\t\'date\' => get_the_time(\'d.m.Y.\'),\\n\\t\\t\\t\'excerpt\' => get_the_excerpt(),\\n\\t\\t];\\n\\t}\\n}\\n\\nwp_reset_postdata();\\n\\nreturn $postData;\\n```\\n\\n## Best practices for queries\\n\\nIt\u2019s important to have query optimisation in mind. Some queries may be a lot slower and you have to see if there is any way to follow the [best practices for database queries](https://infinum.com/handbook/wordpress/coding-standards/php-coding-standards/database-queries)."},{"id":"multiple-same-components","metadata":{"permalink":"/blog/multiple-same-components","source":"@site/blog/2023-06-12-multiple-same-components.md","title":"Using multiple same components","description":"Explains how to use multiple same components inside","date":"2023-06-12T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"components","permalink":"/blog/tags/components"},{"label":"blocks","permalink":"/blog/tags/blocks"}],"readingTime":6.305,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Using multiple same components","description":"Explains how to use multiple same components inside","slug":"multiple-same-components","authors":"obradovic","date":"2023-06-12T00:00:00.000Z","tags":["eightshift","boilerplate","components","blocks"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Working with custom queries","permalink":"/blog/working-with-custom-queries"},"nextItem":{"title":"Block Patterns","permalink":"/blog/block-patterns"}},"content":"From time to time, you may need to create a block or a more complex component that uses more than one instance of the same component. In this blog post, we\'ll explain how this works in a bit more detail.\\n\x3c!--truncate--\x3e\\n\\nAn example of this use case is the Card component, which uses two heading components. You may get the general idea by just going through the code and trying to reverse-engineer it, but this example will give you a much better understanding of how it works and how to use it. First, let\'s cover some basics.\\n\\n## Manifest and attributes\\nThe way multiple same components work is by having a different key. Here is an example of the Card component:\\n\\n```json\\n\\"components\\": {\\n\\t\\"image\\": \\"image\\",\\n\\t\\"intro\\": \\"heading\\",\\n\\t\\"heading\\": \\"heading\\",\\n\\t\\"paragraph\\": \\"paragraph\\",\\n\\t\\"button\\": \\"button\\"\\n},\\n```\\nAs you can see, one heading component has the `intro` key, while the other one has the `heading` key. That way the **intro** heading component is being referred to as `intro` so there is no mixup with the attribute values between the two heading blocks. This can be seen when setting the default attributes:\\n\\n```json\\n\\"cardIntroSize\\": {\\n\\t\\"type\\": \\"string\\",\\n\\t\\"default\\": \\"tiny\\"\\n},\\n\\"cardHeadingSize\\": {\\n\\t\\"type\\": \\"string\\",\\n\\t\\"default\\": \\"big\\"\\n}\\n```\\n\\n## The \\"props\\" Helper\\nThis method does all the heavy lifting for us. It replaces the default attribute names with the ones we provide. There is both the PHP and JS version of it.\\n\\n```php\\nComponents::render(\'heading\', Components::props(\'intro\', $attributes, [\\n\\t\'selectorClass\' => \'intro\',\\n\\t\'blockClass\' => $componentClass\\n]))\\n```\\n\\n```js\\n\\n \\n\\n```\\n\\nIf you `var_dump` the props helper, you\u2019ll notice the `prefix` key, which is built from the names of the blocks and components used hierarchically. For example, when looking at a regular Heading component in the Card block, the prefix will be:\\n\\n`cardCardHeading` - first is the Card block name, then the Card component name and finally Heading component name.\\n\\nThe Heading component that is called Intro then has the prefix `cardCardIntro`. This prefix is then added to the attribute name, which then finally results in `cardCardHeadingSize` and `cardCardIntroSize` attributes, for example.\\n\\nWhile at first glance it seems strange to have this naming scheme, it actually allows us to figure out the hierarchy just by looking at the attribute name.\\n\\n## A step-by-step example\\n\\nThe block we\'ll be creating as an example will be a block which we can use for some sort of comparison or listing pros and cons. To create it, we will need the following:\\n- two `Heading` components\\n- two `List` components\\n\\nThe easiest way to create a new block is by using the boilerplate command\\n\\n`wp boilerplate blocks use-block --name=example`\\n\\nOnce the new block is added to your project, rename it. Also, don\u2019t forget to update all file names and imports in JS.\\n\\nWe should start with `manifest.json`, where we define the components we\'ll use and set the default attributes. For now, just define the components and their keys:\\n\\n```json\\n\\"components\\": {\\n\\t\\"heading\\": \\"heading\\",\\n\\t\\"lists\\": \\"lists\\",\\n\\t\\"secondaryHeading\\": \\"heading\\",\\n\\t\\"secondaryLists\\": \\"lists\\"\\n}\\n```\\n\\nThe first section has the default key names, while the \\"duplicates\\" have different key names.\\n\\nAfter manifest, we can move to the JS part. As this is a fairly simple block without any advanced options or layouts, we need to add two `HeadingEditor` components and two `ListsEditor` components. To make styling easier, we can separate them in two `div` elements. When you\u2019re finished, your code should look like this:\\n\\n```jsx\\nimport React from \'react\';\\nimport { __ } from \'@wordpress/i18n\';\\nimport { HeadingEditor } from \'../../../components/heading/components/heading-editor\';\\nimport { ListsEditor } from \'../../../components/lists/components/lists-editor\';\\n\\nimport { props, selector } from \'@eightshift/frontend-libs/scripts\';\\n\\nexport const ComparisonEditor = ({ attributes, setAttributes }) => {\\n\\tconst {\\n\\t\\tblockClass,\\n\\t} = attributes;\\n\\n\\tconst comparisonPrimaryClass = selector(blockClass, blockClass, \'primary\');\\n\\n\\tconst comparisonSecondaryClass = selector(blockClass, blockClass, \'secondary\');\\n\\n\\treturn (\\n\\t\\t \\n\\t\\t\\t\\n\\t);\\n};\\n```\\n\\nNote how we defined the different names with the `props` helper. Additionally, we set the selector class for easier targeting of components when styling.\\n\\nNext, we can add the options. Again, the `props` helper does all the heavy lifting for us. This is how the code should look after adding all component options:\\n\\n```jsx\\nimport React from \'react\';\\nimport { __ } from \'@wordpress/i18n\';\\nimport { props, getOptions } from \'@eightshift/frontend-libs/scripts\';\\nimport { HeadingOptions } from \'../../../components/heading/components/heading-options\';\\nimport { ListsOptions } from \'../../../components/lists/components/lists-options\';\\nimport { PanelBody } from \'@wordpress/components\';\\nimport manifest from \'../manifest.json\';\\n\\nexport const ComparisonOptions = ({ attributes, setAttributes }) => {\\n\\treturn (\\n\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\n\\n\\t\\t\\t\\t \\n\\t\\t\\t \\n\\t\\t\\t\\t\\n\\t\\t\\n\\n\\t\\t\\t\\t \\n\\t\\t\\t \\n\\t\\t\\t \\n\\t);\\n};\\n```\\n\\nAdding the PHP part should be simple, but here is the code for reference:\\n\\n```php\\n\\n\\n\\n\\n\\t\\t\\t \\n\\n\\t\\t\\t \\n\\n\\t\\t\\t \\n\\t\\t \\">\\n\\t\\n\\t\\n```\\n\\nThe block should work properly now, but the two lists look the same. To make a difference between the two, we can change the default list colors in the manifest. If we don\u2019t have the colors we want already available in the project, first we need to add them to the global manifest.\\n\\nFor a detailed explanation on how to add new colors to your project, you can read a previous blog post about [modifying blocks](/blog/modifying-blocks-color-theme#adding-new-colors-to-your-project).\\n\\nNow we have to add these new colors to the Lists component `manifest.json`. In `options` key, find the `listsColor` and add your new colors.\\n\\nWhen the new colors are added to the Lists component, we can set these new colors as defaults by adding the following attributes in `manifest.json` of our Comparison block:\\n\\n```json\\n\\"comparisonListsColor\\": {\\n\\t\\"type\\": \\"string\\",\\n\\t\\"default\\": \\"green-haze\\"\\n},\\n\\"comparisonSecondaryListsColor\\": {\\n\\t\\"type\\": \\"string\\",\\n\\t\\"default\\": \\"milano-red\\"\\n}\\n```\\n\\nThe first list will now have green bullet points, and the second one will have red bullet points.\\n\\n![Comparison block](/img/blog/comparison-block.webp)\\n\\nNotice again how the attribute name is structured - current block name (**comparison**), component name (**Lists** or **SecondaryLists**), attribute (**Color**).\\n\\nIf you\u2019re ever in doubt of what is the exact attribute name, you can always `var_dump` the `props` helper for that component and you will see the full attribute names as the keys.\\n\\n```\\nArray\\n(\\n [prefix] => comparisonSecondaryLists\\n // ...\\n [comparisonSecondaryListsOrdered] => ul\\n [comparisonSecondaryListsSize] => body:regular\\n [comparisonSecondaryListsColor] => milano-red\\n [comparisonSecondaryListsColorOnlyMarker] =>\\n [comparisonSecondaryListsUse] => 1\\n // ...\\n)\\n```\\n\\n### Conclusion\\n\\nAlthough this was a simple example, we covered the most important things to have in mind when using multiple same components in a block. For additional practice, you can add some more attributes or go through some of our pre-made blocks which use multiple same components. Some components/blocks you can look into are `Card` and `Quote`."},{"id":"block-patterns","metadata":{"permalink":"/blog/block-patterns","source":"@site/blog/2022-12-22-block-patterns.md","title":"Block Patterns","description":"Intro to block patterns and examples how to use them","date":"2023-03-01T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"block","permalink":"/blog/tags/block"},{"label":"patterns","permalink":"/blog/tags/patterns"}],"readingTime":3.95,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Block Patterns","description":"Intro to block patterns and examples how to use them","slug":"block-patterns","authors":"obradovic","date":"2023-03-01T00:00:00.000Z","tags":["eightshift","boilerplate","block","patterns"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Using multiple same components","permalink":"/blog/multiple-same-components"},"nextItem":{"title":"Using Custom Post Types and Taxonomies","permalink":"/blog/using-cpts-and-taxonomies"}},"content":"Although Block Patterns may be similar to Block Variations, there are some differences between the two. This blog post will cover what Block Patterns are and how to use them.\\n\x3c!--truncate--\x3e\\n\\n## What are Block Patterns and why use them?\\nBlock Patterns are predefined block layouts which allow you to add content faster and make it look more consistent. The basic idea is to have a ready-made template which consists of multiple blocks, that have options predefined, and all you have to do is add content to these blocks.\\n\\nThey can be used in multiple ways. You can create sections composed of few blocks which you can then easily insert anywhere on the site. You can also create complex page layouts which could be used for writing blog posts, for example.\\n\\n## Technical differences\\nAs explained in the [Eightshift Development kit documentation](https://eightshift.com/docs/basics/blocks-patterns), the main difference between variations and patterns are:\\n- variations provide data using `manifest.json`, while patterns are registered using PHP\\n- variations appear in the editor in the same tab as blocks, while patterns appear in their own tab\\n\\n\\n## Registering Block Patterns\\nTo make registering new block patterns easier, there is a WP-CLI command which will help you create a new block pattern. For this example, the block pattern we\'re making is called **Intro**. To get started, run this WP-CLI command:\\n```shell\\nwp boilerplate blocks create-block-pattern --title=intro\\n```\\n\\nAfter generating the block pattern class, there are a few more adjustments you should make to it. For starters, you should update these methods:\\n- `getName()` - change the return value to `eightshift-boilerplate/intro-pattern`\\n- `getDescription()` - add any description you like\\n\\nOnce these values are updated, you can make the layout you\'ll use as a Block Pattern. The easiest way to do it is to build your layout in the editor, switch to `Code Editor`, copy the code and paste in inside your `getContent()` method. Your pattern should now be available to use. For this example, we can create a simple pattern which consists of a Heading block and a Paragraph block.\\n\\n![Option to switch to Code Editor](/img/blog/code-editor.webp)\\n\\n```php\\nprotected function getContent(): string\\n{\\n\\treturn \'\x3c!-- wp:eightshift-boilerplate/heading {\\"headingHeadingContent\\":\\"Post title goes here\\",\\"headingHeadingSize\\":\\"big\\"} /--\x3e\\n\\t\x3c!-- wp:eightshift-boilerplate/paragraph {\\"paragraphParagraphContent\\":\\"\\\\u003cem\\\\u003ePost intro goes here\\\\u003c/em\\\\u003e\\"} /--\x3e\';\\n}\\n```\\n\\n### Managing Pattern Categories\\n\\nTo make managing block patterns easier, we can group them into categories. To start, we need a service class. This class will be used to register our custom categories and remove core categories. The fastest way to add it to our project is by using the following WP-CLI command:\\n```shell\\nwp boilerplate create service-example --folder=BlockPatterns --file_name=ManagePatternCategories\\n```\\n\\nNow that we have our service class, we\'ll add methods for removing core patterns and pattern categories. First, the method for removing core categories.\\n```php\\n/**\\n * Unregisters core block pattern categories.\\n *\\n * @return void\\n */\\npublic function removeCoreCategories()\\n{\\n\\t\\\\unregister_block_pattern_category(\'buttons\');\\n\\t\\\\unregister_block_pattern_category(\'columns\');\\n\\t\\\\unregister_block_pattern_category(\'gallery\');\\n\\t\\\\unregister_block_pattern_category(\'header\');\\n\\t\\\\unregister_block_pattern_category(\'text\');\\n}\\n```\\nThe second method will remove all core patterns\\n\\n```php\\n/**\\n * Removes support for core block patterns.\\n *\\n * @return void\\n */\\npublic function removeBlockPatternsCore()\\n{\\n\\t\\\\remove_theme_support(\'core-block-patterns\');\\n}\\n```\\n\\nFor these methods to work, we need to add them to the `register()` method of our service class. Add the following actions:\\n```php\\n\\\\add_action(\'init\', [$this, \'removeCoreCategories\'], 40);\\n\\\\add_action(\'after_setup_theme\', [$this, \'removeBlockPatternsCore\'], 20);\\n```\\n\\nIf you try searching for patterns in your editor, you\'ll notice they are no longer available. Now we can move on to adding our block pattern categories. The best approach is to define the pattern category names as constants inside your class. In this example, we will add two categories: **Templates** and **Sections**. We can add the following code inside our class:\\n```php\\nclass ManagePatternCategories implements ServiceInterface\\n{\\n\\tpublic const TEMPLATES_CATEGORY = \'templates-category\';\\n\\tpublic const SECTIONS_CATEGORY = \'sections-category\';\\n\\n\\t// Removed parts of code for better readability.\\n\\n\\t/**\\n\\t * Registers new pattern categories.\\n\\t *\\n\\t * @return void\\n\\t */\\n\\tpublic function addCategories()\\n\\t{\\n\\t\\t\\\\register_block_pattern_category(self::TEMPLATES_CATEGORY, [\\n\\t\\t\\t\'label\' => \\\\esc_html__(\'Templates\', \'es-blog\'),\\n\\t\\t]);\\n\\n\\t\\t\\\\register_block_pattern_category(self::SECTIONS_CATEGORY, [\\n\\t\\t\\t\'label\' => \\\\esc_html__(\'Sections\', \'es-blog\'),\\n\\t\\t]);\\n\\t}\\n}\\n```\\n\\nFinally, return to your Intro Pattern class and update the `getCategories()` method:\\n```php\\nprotected function getCategories(): array\\n{\\n\\treturn [\\n\\t\\tManagePatternCategories::SECTIONS_CATEGORY\\n\\t];\\n}\\n```\\n\\nIn editor, in the Pattern tab, you should now see your new pattern category and the Intro Pattern.\\n\\n![New pattern category and block pattern](/img/blog/block-pattern-example.webp)\\n\\n## Things to keep in mind\\nBlock patterns add layout and content which you can then modify at will per instance. These instances are not synchronised with the codebase so it becomes an issue if you\'ve already used a pattern on multiple places on the site and then notice you\'ve missed something in the pattern configuration phase. Fixing the pattern in the codebase will apply the changes on all newly added instances, but you will have to fix the misconfigured instances manually."},{"id":"using-cpts-and-taxonomies","metadata":{"permalink":"/blog/using-cpts-and-taxonomies","source":"@site/blog/2022-12-13-using-cpts-and-taxonomies.md","title":"Using Custom Post Types and Taxonomies","description":"How to register and use custom post types and taxonomies with Eightshift Dev Kit","date":"2022-12-13T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"cpt","permalink":"/blog/tags/cpt"},{"label":"custom post type","permalink":"/blog/tags/custom-post-type"},{"label":"taxonomy","permalink":"/blog/tags/taxonomy"},{"label":"taxonomies","permalink":"/blog/tags/taxonomies"},{"label":"terms","permalink":"/blog/tags/terms"}],"readingTime":4.115,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Using Custom Post Types and Taxonomies","description":"How to register and use custom post types and taxonomies with Eightshift Dev Kit","slug":"using-cpts-and-taxonomies","authors":"obradovic","date":"2022-12-13T00:00:00.000Z","tags":["eightshift","boilerplate","cpt","custom post type","taxonomy","taxonomies","terms"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Block Patterns","permalink":"/blog/block-patterns"},"nextItem":{"title":"Block Variations","permalink":"/blog/block-variations"}},"content":"WordPress offers two default ways to group content by content type - using posts or pages. Posts and pages are registered as default post types in the WordPress app. But sometimes, that is not enough. That\'s where custom post types (CPT) and custom taxonomies come in. This blog post will cover the basics of registering CPTs and taxonomies using Eightshift Dev Kit.\\n\\n\x3c!--truncate--\x3e\\n## Why should you use CPTs?\\nThe great thing about WordPress is how extensible it is. With projects becoming more complex, the need for additional post types and taxonomies increases. Sure, you can cram everything into default posts or pages, but this can become very chaotic. Using custom post types allows you to manage your content much better. You can separate events and projects from news articles for instance.\\n\\nPost `category` and `tag` are taxonomies - a grouping you can further separate by terms belonging to that taxonomy. WordPress, since version 2.3.0 offers a way to register your own, custom taxonomies.\\n\\n## Registering Custom Post Types\\nFor this exercise, we\'ll create a new post type called `Projects`. To make the process of registering new CPTs as easy as possible, we\'ll use a WP-CLI command to create our CPT with the following command:\\n\\n```bash\\nwp boilerplate create post-type --label=\'Project\' --plural_label=\'Projects\' --slug=\'project\' --rewrite_url=\'project\' --rest_endpoint_slug=\'projects\'\\n```\\n\\n:::tip\\nIf your new CPT is not working, try flushing rewrite rules by re-saving the settings in **Settings -> Permalinks** or by using `wp cache flush` CLI command\\n:::\\n\\nYour new post type is registered and ready to use! Easy, right?\\n\\nSometimes all these parameters can be a bit confusing, so here\'s a quick reference of best practices when setting these parameters:\\n\\n| Parameter | Singular/Plural | Writing style | Example |\\n|--------------------|-----------------|---------------|----------|\\n| label | Singular | Regular | Project |\\n| plural_label | Plural | Regular | Projects |\\n| slug | Singular | kebab-case | project |\\n| rewrite_url | Singular | kebab-case | project |\\n| rest_endpoint_slug | Plural | kebab-case | projects |\\n\\nThere is a reason for this naming convention. For example:\\n- `slug` is attached to a single custom post type in the database, which is why it is written in singular\\n- `rest_endpoint_slug` is used to fetch a collection of posts from that custom post type, which is why it should be written in plural\\n\\n## Registering Taxonomies\\nNow that we have the new custom post type, we need a way to group the projects. We\'ll create a custom taxonomy called `Project Technology`. As with the CPT registration, the easiest way to register taxonomies is by using the following WP-CLI command:\\n\\n```bash\\nwp boilerplate create taxonomy --label=\'Project Technology\' --plural_label=\'Project Technologies\' --slug=\'project-technology\' --rest_endpoint_slug=\'project-technologies\' --post_type_slug=\'project\'\\n```\\n\\nSimilar suggestions apply to the parameters when naming taxonomies as well. Be sure to write the correct post type slug for which you are registering this new taxonomy!\\n\\n## Structure\\nWhen checking your codebase after adding these new custom post types and taxonomies, you\'ll notice the post types are located inside the `src/CustomPostType` folder, and the taxonomies are located inside the `src/CustomTaxonomy` folder. Following the **Single Responsibility Principle**, each post type or taxonomy is in a separate class.\\n\\n## Modifying options\\nOur custom post type and taxonomy are ready to use, but we still want to make some changes. For starters, we want another icon and for the Projects to be located below the Posts in the WordPress admin menu. In `src/CustomPostType/ProjectPostType.php`, find the `MENU_POSITION` constant and change it to `5`. The lower the number, the higher it will be in the menu.\\n\\nNext, we want to update the icon representing the new post type in the menu. These icons are named dashicons. Change the `MENU_ICON` constant to `dashicons-clipboard`. If you want another icon for your CPT, here is the list of [available dashicons](https://developer.wordpress.org/resource/dashicons/). Finally, we want to remove the author and comments. In `getPostTypeArguments()` method, find the key `supports` in the return value and remove `author` and `comments` from the array.\\n\\n## Clashing slugs\\nSomething that can happen when working on your project is that you have the same slugs for your custom post type and your page, for example. Let\'s say you have a page with a slug `project`, and a custom post type with a slug `project`. When trying to access the page, you\'ll keep getting the Project CPT archive. To fix it, you have to change one of the slugs or write a custom redirection rule (which we don\'t recommend, as the redirections are tricky to handle in WordPress).\\n\\n## Further reading\\nFor the best overview of all the options you have when registering your custom post type or taxonomy, we recommend checking the official WordPress docs for the [register_post_type()](https://developer.wordpress.org/reference/functions/register_post_type/) and [register_taxonomy()](https://developer.wordpress.org/reference/functions/register_taxonomy/) functions.\\n\\nIf you would like to know more about taxonomies and terms, along with how they are stored in the database, you can read more about it in the [Categories, Tags, & Custom Taxonomies](https://developer.wordpress.org/themes/basics/categories-tags-custom-taxonomies/) page of the WordPress docs."},{"id":"block-variations","metadata":{"permalink":"/blog/block-variations","source":"@site/blog/2022-09-07-block-variations.md","title":"Block Variations","description":"Intro to block variations and examples of how to use them","date":"2022-09-07T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"block","permalink":"/blog/tags/block"},{"label":"variations","permalink":"/blog/tags/variations"}],"readingTime":3.035,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Block Variations","description":"Intro to block variations and examples of how to use them","slug":"block-variations","authors":"obradovic","date":"2022-09-07T00:00:00.000Z","tags":["eightshift","boilerplate","block","variations"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Using Custom Post Types and Taxonomies","permalink":"/blog/using-cpts-and-taxonomies"},"nextItem":{"title":"How to use ACF in your project","permalink":"/blog/acf-in-a-project"}},"content":"Let\'s picture the following scenario: You just created a block with many options and now you want multiple versions of that block available with pre-set options. That\'s where variations come in handy!\\n\x3c!--truncate--\x3e\\n\\n## What are variations?\\n\\nBlock variations allow us to override default block attributes. We can select a variation from the block list with all preset options instead of manually setting them.\\n\\n:::note\\nYou cannot add new attributes in variations. Only attributes that exist in the parent block can be used.\\n:::\\n\\nFor example, we have a `Card` block. If we want to use it for something like downloading PDF files, we may not need image or paragraph components. A simple text that describes type of the file, title of the file and a download button are all we need in this case.\\n\\nOur new card should consist of the following components:\\n- intro\\n- heading\\n- button\\n\\n## How to register a block variation?\\n\\nThe process of registering block variations is fairly simple. In order to register a block variation, go to **src/Blocks/variations**, add a new folder, and let\'s call it `card-resource`. Inside that folder, all you need to do is add a `manifest.json` file. It is also recommended to add a `docs` folder in which you can add a readme file and storybook file.\\n\\nInside your `manifest.json` file, add the attributes to define the new default attributes for this variation. Here is an example:\\n\\n```json\\n{\\n\\t\\"$schema\\": \\"https://raw.githubusercontent.com/infinum/eightshift-frontend-libs/develop/schemas/variation.json\\",\\n\\t\\"parentName\\": \\"card\\",\\n\\t\\"name\\": \\"card-resource\\",\\n\\t\\"title\\": \\"Card Resource\\",\\n\\t\\"description\\" : \\"Card variation without image and paragraph\\",\\n\\t\\"icon\\": {\\n\\t\\t\\"src\\": \\"es-card\\"\\n\\t},\\n\\t\\"attributes\\": {\\n\\t\\t\\"cardCardImageUse\\": false,\\n\\t\\t\\"cardCardParagraphUse\\": false,\\n\\t\\t\\"cardCardHeadingSize\\": \\"regular\\",\\n\\t\\t\\"cardCardButtonColor\\": \\"blue\\"\\n\\t},\\n\\t\\"scope\\": [\\n\\t\\t\\"inserter\\"\\n\\t]\\n}\\n```\\n\\nAfter adding this code, your new block variation should now be visible in the block list. It\'s that easy!\\n\\n![Variation of the Card block](/img/blog/card-resource.webp)\\n\\n## Providing inner block data\\nOther than overriding default attributes with variations, you can do much more with Eightshift Development kit. If you have a block that uses inner blocks, you can even provide inner block data.\\n\\nThe following example is very basic, but it will give you an idea of how to provide inner block data. It can easily be reproduced with our `Carousel` block if you want to try it yourself.\\n\\n:::note\\nIf you don\'t have Carousel block in your project yet, you can add it with the following WP-CLI command: `wp boilerplate blocks use-block --name=\\"carousel\\"`\\n:::\\n\\nOnce you have the `Carousel` block up and running, create a variation called `Carousel Loop`. For this variation, we want the following:\\n- loop\\n- pagination\\n- two images per slide\\n\\nWe will also add some placeholder images so you can immediately test the Carousel block variation. Here is the code you can add to the `manifest.json` file for that variation.\\n```json\\n{\\n\\t\\"$schema\\": \\"https://raw.githubusercontent.com/infinum/eightshift-frontend-libs/develop/schemas/variation.json\\",\\n\\t\\"parentName\\": \\"carousel\\",\\n\\t\\"name\\": \\"carousel-loop\\",\\n\\t\\"title\\": \\"Carousel Loop\\",\\n\\t\\"description\\" : \\"Carousel block variation with loop and pagination enabled, along with multiple image blocks with placeholders. Displays two images per slide.\\",\\n\\t\\"icon\\": {\\n\\t\\t\\"src\\": \\"es-card\\"\\n\\t},\\n\\t\\"attributes\\": {\\n\\t\\t\\"carouselIsLoop\\": true,\\n\\t\\t\\"carouselShowPagination\\": true,\\n\\t\\t\\"carouselShowItems\\": 2\\n\\t},\\n\\t\\"innerBlocks\\": [\\n\\t\\t{\\n\\t\\t\\t\\"name\\": \\"eightshift-boilerplate/image\\",\\n\\t\\t\\t\\"attributes\\": {\\n\\t\\t\\t\\t\\"imageImageFull\\":true,\\n\\t\\t\\t\\t\\"imageImageUrl\\": \\"https://loremflickr.com/400/400\\"\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\"name\\": \\"eightshift-boilerplate/image\\",\\n\\t\\t\\t\\"attributes\\": {\\n\\t\\t\\t\\t\\"imageImageFull\\":true,\\n\\t\\t\\t\\t\\"imageImageUrl\\": \\"https://loremflickr.com/400/400\\"\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\"name\\": \\"eightshift-boilerplate/image\\",\\n\\t\\t\\t\\"attributes\\": {\\n\\t\\t\\t\\t\\"imageImageFull\\":true,\\n\\t\\t\\t\\t\\"imageImageUrl\\": \\"https://loremflickr.com/400/400\\"\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\"name\\": \\"eightshift-boilerplate/image\\",\\n\\t\\t\\t\\"attributes\\": {\\n\\t\\t\\t\\t\\"imageImageFull\\":true,\\n\\t\\t\\t\\t\\"imageImageUrl\\": \\"https://loremflickr.com/400/400\\"\\n\\t\\t\\t}\\n\\t\\t}\\n\\t],\\n\\t\\"scope\\": [\\n\\t\\t\\"inserter\\"\\n\\t]\\n}\\n```\\n\\nAfter adding this code, you should see the `Carousel Loop` variation in your block list. After adding it in the editor, the `Carousel` attributes will be already set to the ones you provided, as well as two images that are added as inner blocks.\\n\\n![Block list with variations](/img/blog/block-list-variations.webp)"},{"id":"acf-in-a-project","metadata":{"permalink":"/blog/acf-in-a-project","source":"@site/blog/2022-05-10-acf-in-a-project.md","title":"How to use ACF in your project","description":"Example of using ACF plugin in your project","date":"2022-05-17T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"acf","permalink":"/blog/tags/acf"},{"label":"advanced custom fields","permalink":"/blog/tags/advanced-custom-fields"},{"label":"theme options","permalink":"/blog/tags/theme-options"}],"readingTime":5.485,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"How to use ACF in your project","description":"Example of using ACF plugin in your project","slug":"acf-in-a-project","authors":"obradovic","date":"2022-05-17T00:00:00.000Z","tags":["eightshift","boilerplate","acf","advanced custom fields","theme options"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Block Variations","permalink":"/blog/block-variations"},"nextItem":{"title":"Using assets in a project","permalink":"/blog/using-assets"}},"content":"If you\'ve worked with WordPress for a long time, you\'ve heard of the **_Advanced Custom Fields_** plugin (**_ACF_** for short). While the use of blocks has simplified content editing, thus making meta fields less of a necessity, there are still cases in which meta fields are very useful.\\n\x3c!--truncate--\x3e\\n\\n## Ways of registering ACF fields\\n\\nThere are multiple approaches to ACF field registration. The easiest way to register fields is using the WP admin interface, but this approach has a few drawbacks. If you have many fields, this can impact performance because you are registering fields dynamically (information about registered fields is stored in the database). Another drawback is if you have multiple environments (e.g. local, staging, production), you\'ll have to export the fields and import them to other environments.\\n\\nOther ways of registering ACF fields are either via PHP (code) or by reading from a JSON file. We prefer to use PHP because you can use OPcache to speed up field registration even more. If you are using Git, this approach is even better because you can commit the PHP code used for registering fields for easier portability across different environments. For that reason, Eightshift Development kit already has some goodies which will make field registration a breeze.\\n\\n## Exporting PHP code\\n\\nThe approach we use for registering ACF fields is by adding those fields first through the WP Admin ACF interface. As an example, We\'ll add a field group called **_Intro_**, which will contain one text field of the same name. That field group will be displayed only on posts. You can add a few more fields, but for the sake of simplicity, we\'ll only use one field.\\n\\nWhen you define all the fields you need, save them and go to `Custom Fields -> Tools`. Here you will see an option to **_Export Field Groups_**. Simply select the field groups which you want to export and select **_Generate PHP_**.\\n\\n![ACF PHP code export](/img/blog/acf-generate-php.webp)\\n\\nThis will generate a PHP code snippet that you can use in your theme. Now you may be wondering, where exactly should that code go?\\n\\n## CustomMeta class\\n\\nThose ACF goodies in Eightshift Development kit we talked about earlier? Let us introduce you to one of them. We have a WP CLI command which we can use to generate a CustomMeta class where we can add our field groups. The command is `wp boilerplate create acf-meta`. This command has one required parameter, and that is `name`. To create a class that we will use for registering our custom fields, we\'ll use the following command:\\n\\n```bash\\nwp boilerplate create acf-meta --name=intro\\n```\\n\\nThis command will generate a **_CustomMeta_** folder inside **_src_** folder and add a new file called **_IntroAcfMeta.php_**. Inside that file, you should see the following method:\\n```php\\npublic function fields(): void\\n{\\n\\tif (function_exists(\'acf_add_local_field_group\')) {\\n\\t\\t\\\\acf_add_local_field_group([]);\\n\\t}\\n}\\n```\\n\\nGo back to your PHP code export for ACF fields and select everything inside the `acf_add_local_field_group()` function and paste it into your function. To make it in line with our coding standards, we have to do the following:\\n- replace `array()` with `[]`\\n- make every label translatable and escaped - use `esc_html__()`\\n- instead of hardcoding the field name, replace it with a class constant\\n\\nAfter all these changes, your code should look like this:\\n\\n```php\\nclass IntroAcfMeta extends AbstractAcfMeta\\n{\\n\\n\\t/**\\n\\t * Intro field name.\\n\\t */\\n\\tpublic const INTRO_FIELD_NAME = \'intro\';\\n\\n\\t/**\\n\\t * Render acf fields.\\n\\t *\\n\\t * @return void\\n\\t */\\n\\tpublic function fields(): void\\n\\t{\\n\\t\\tif (function_exists(\'acf_add_local_field_group\')) {\\n\\t\\t\\t\\\\acf_add_local_field_group([\\n\\t\\t\\t\\t\'key\' => \'group_6269300acefda\',\\n\\t\\t\\t\\t\'title\' => \\\\esc_html__(\'Intro\', \'eightshift-theme\'),\\n\\t\\t\\t\\t\'fields\' => [\\n\\t\\t\\t\\t\\t[\\n\\t\\t\\t\\t\\t\\t\'key\' => \'field_6269300f8029b\',\\n\\t\\t\\t\\t\\t\\t\'label\' => \\\\esc_html__(\'Intro\', \'eightshift-theme\'),\\n\\t\\t\\t\\t\\t\\t\'name\' => self::INTRO_FIELD_NAME,\\n\\t\\t\\t\\t\\t\\t\'type\' => \'text\',\\n\\t\\t\\t\\t\\t\\t// ...\\n\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t]\\n\\t\\t\\t\\t// ...\\n\\t\\t\\t]);\\n\\t\\t}\\n\\t}\\n}\\n```\\n\\nThe final step is to go back to the Custom Fields in WP admin and either delete or deactivate your field group from there, to prevent registering the fields twice. After adding field definitions in PHP and removing them in WP admin, your field should be visible when editing posts.\\n\\n## Using get_field()\\n\\nTo fetch the saved meta value, we use ACF\'s `get_field()` function, but here are a few tips that could improve your code quality. First, you should check if that function exists. That way, if ACF is deactivated on your site for whatever reason, your site won\'t break. The second tip is to use a class constant instead of hardcoding the field name. With these practices in mind, your code should look like this:\\n\\n```php\\nuse YourNamespace\\\\CustomMeta\\\\IntroAcfMeta;\\n\\n// ...\\n\\nif (function_exists(\'get_field\')) {\\n\\t$introText = get_field(IntroAcfMeta::INTRO_FIELD_NAME, $postId);\\n}\\n```\\n\\n:::tip\\nIt\'s better to use class constants because if you decide to change the field name, you will have to change it only in one place.\\n:::\\n\\n## Theme Options\\n\\nACF\'s Options page has a wide array of uses and it\'s very likely that you\'ll need some sort of Theme Options in your project. To make the implementation of Theme Options a bit easier, we have a CLI command which generates the `ThemeOptions` class in your project. Just use the following command:\\n\\n```bash\\nwp boilerplate create theme-options\\n```\\n\\nThis command generates a class with two methods. The first one, `createThemeOptionsPage()` creates a Theme Options page and adds it to the WP Admin sidebar. The second one, `registerThemeOptions()`, is what registers the fields you will have in Theme Options. Here is an example how Theme Options look after being created using `wp boilerplate`:\\n\\n![ACF Theme Options](/img/blog/acf-theme-options.webp)\\n\\nTo add fields to your Theme Options, follow the steps from the **_Exporting PHP code_** section of this post and add the fields inside the `\'fields\' => []` array.\\n## Tip - create a helper class\\n\\nIn this blog post, we covered the whole process of registering and using ACF fields in your project. But, if you are using a lot of ACF fields, wrapping each `get_field()` function with a `function_exists()` conditional may become tedious at some point. For that reason, it may be a good idea to create a helper class that you can use for ACF functions.\\n\\nI won\'t cover the whole process in detail, but I\'ll give you some general pointers.\\n\\n- when registering plugin-related classes, use the `Plugins` namespace. In this case, you should have namespace `YourNamespace\\\\Plugins\\\\Acf`\\n- inside that namespace, you can create a class called `AcfHelper`\\n- add a method `getField` which accepts the same arguments as the `get_field()` function\\n- add a method `getThemeOption` which only accepts one argument, the field name, and the second argument is hardcoded\\n- use early returns in your methods\\n```php\\nif (!function_exists(\'get_field\')) {\\n\\treturn \'\';\\n}\\n```"},{"id":"using-assets","metadata":{"permalink":"/blog/using-assets","source":"@site/blog/2022-04-25-using-assets.md","title":"Using assets in a project","description":"Step-by-step guide on how to add assets like images or icons to your theme.","date":"2022-04-28T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"assets","permalink":"/blog/tags/assets"},{"label":"images","permalink":"/blog/tags/images"},{"label":"icons","permalink":"/blog/tags/icons"}],"readingTime":3.945,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Using assets in a project","description":"Step-by-step guide on how to add assets like images or icons to your theme.","slug":"using-assets","authors":"obradovic","date":"2022-04-28T00:00:00.000Z","tags":["eightshift","boilerplate","assets","images","icons"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"How to use ACF in your project","permalink":"/blog/acf-in-a-project"},"nextItem":{"title":"Adding fonts","permalink":"/blog/adding-fonts"}},"content":"Previously, we went through the process of adding fonts to your project. While the process of adding additional assets like images or icons has some similarities to adding fonts, it also has its unique steps. In this post, we\'ll cover multiple ways of adding assets and using them on your site.\\n\x3c!--truncate--\x3e\\n\\n## Adding images\\n\\nSimilar to fonts, there is also a dedicated folder for adding images that will be used in a theme. The location of this folder is **_assets/images_**. The procedure to add images is even simpler than fonts, which you can read about in [Adding fonts](/blog/adding-fonts) blog post. Just follow these steps to add a new image:\\n- add the image in inside **_assets/images_** folder\\n- include it in **_assets/images/index.js_**\\n- run `npm start` to rebuild assets\\n\\nThe new image will now be available in the **_public_** folder. The use case for this is adding a favicon or a logo to your project. To use this image in one of your templates or blocks, you have to add the following in your **_php_** file:\\n\\n```php\\nuse YourNamespace\\\\Manifest\\\\Manifest;\\n// ...\\n\\napply_filters(Manifest::MANIFEST_ITEM, \'logo.svg\');\\n```\\n\\nThe filter we are using is called `manifest-item` and we use it to get the URL of the asset from the **_public_** folder. You can read more about this in [our documentation](/docs/basics/manifest).\\n\\nYou can see how this is being used for rendering both favicon and header logo in your theme\'s **_header.php_** file.\\n\\n:::tip\\nDon\'t hardcode the filter name in the `apply_filters` function. Always call it via class constants.\\n:::\\n\\nFor better organization, you can add additional folders (e.g. **_icons_**, **_placeholders_**) inside the **_assets/images_** folder. Here\'s an example of how to include them:\\n\\n```js\\n// Icons\\nimport \'./icons/upload.svg\';\\n\\n// Placeholders\\nimport \'./placeholders/post.png\';\\nimport \'./placeholders/page.png\';\\n```\\n\\n## Using SVG files from manifest\\n\\nIf you recall from a previous blog post about [Modifying Blocks](/blog/modifying-blocks-color-theme), you might have already seen an alternative approach to including SVG files in your block or component.\\n\\n:::info :es-hide-title:\\nIf you don\'t have it in your project, be sure to read our blog post about adding blocks and components by using [WP CLI](/blog/adding-blocks-wpcli).\\n:::\\n\\nOpen **_src/Blocks/components/quote/manifest.json_** and you\'ll see that the icon used by the component is defined inside `resources` as a key-value pair. Key represents the name that we will use to fetch the icon, while the value is SVG code.\\n\\n```json\\n\\"resources\\": {\\n\\t\\"icon\\": \\"\\"\\n}\\n```\\n\\nIn order to make the minification of SVG files as easy as possible, our teammate Goran made an awesome tool called [SVG2WP](https://svg-2-wp.goranalkovic.com/). Some of the options include making attributes JSX compatible, or replacing the color value with `currentColor`, which can then be used to change the SVG color through CSS.\\n\\nYou\'ve already seen the use of `currentColor` in the above-mentioned blog post, where we\'ve modified the color of the SVG.\\n\\nThe output of the icon on frontend is very simple. In the Quote component, it was done the following way:\\n```php\\n\\n\\n\\">\\n\\t\\n\\n```\\n\\nAn excellent example, where you can see in even more detail how SVGs are being used, is our `icon` component. It isn\'t included in Eightshift theme by default, so you have to add it to your project with WP CLI. To include it in your project, use the following command:\\n\\n```bash\\nwp boilerplate blocks use-component --name=icon\\n```\\n\\nIf you include the Icon component inside a block, you will have the option to choose between multiple icons defined in the manifest. Another way to render SVGs from the Icon component is by using the `Components::render` helper method:\\n\\n```php\\necho Components::render(\\n\\t\'icon\',\\n\\t[\\n\\t\\t\'blockClass\' => $componentClass,\\n\\t\\t\'iconName\' => \'download\',\\n\\t]\\n);\\n```\\n\\nHere are some examples of icons available out-of-the-box in our Icon component:\\n\\n![Icon component](/img/blog/icon-component.webp)\\n\\n## Using icons for editor and block options\\n\\nWhen developing your blocks and adding new options, you may need to add icons to improve the user experience. We have many icons already available for use. You can see the full list in our [Storybook](/devkit-components) under `UI icons` and `Block icons` section. We already added the icon when adding a new Color Theme option for the Quote block. Here is the simplified version:\\n```jsx\\nimport { ColorPaletteCustom, IconLabel, icons } from \'@eightshift/frontend-libs/scripts\';\\n\\nreturn (\\n\\t\\">\\n\\t\\t\\n\\t\\n\\t\\">\\n\\t\\t\\n\\t\\n}\\n\\t\\t// ...\\n\\t/>\\n);\\n```\\n\\nThis was the end result when we were adding a new option in our Quote block:\\n\\n![Color Theme Options](/img/blog/color-theme-options.webp)\\n\\n## Conclusion\\n\\nAs you could see in this blog post, there are multiple ways of adding assets to a project. It all depends on how these will be used and what the scope of their use will be."},{"id":"adding-fonts","metadata":{"permalink":"/blog/adding-fonts","source":"@site/blog/2022-04-08-adding-fonts.md","title":"Adding fonts","description":"An intro to adding fonts to your project.","date":"2022-04-12T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"fonts","permalink":"/blog/tags/fonts"}],"readingTime":6.005,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Adding fonts","description":"An intro to adding fonts to your project.","slug":"adding-fonts","authors":"obradovic","date":"2022-04-12T00:00:00.000Z","tags":["eightshift","boilerplate","fonts"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Using assets in a project","permalink":"/blog/using-assets"},"nextItem":{"title":"Modifying blocks - Color Theme","permalink":"/blog/modifying-blocks-color-theme"}},"content":"Every project is unique. Logo, colors, fonts, etc. are what define the visual identity of your website. In this post, we\'ll cover adding fonts to a project.\\n\x3c!--truncate--\x3e\\n\\n## Importing fonts into your project\\n[Our documentation](/docs/basics/fonts) covers the necessary steps to add a font to your project, but here we\'ll cover the process in a bit more detail. To start, we need a font (or two). For this example, I\'ll use **_Source Sans Pro_** and **_Noto Serif_** which I\'ve downloaded from [Google Fonts](https://fonts.google.com/). They are in the `.ttf` format (you may find some which are `.otf`, which will work in the same way), so you need to convert them to `.woff` and `.woff2`. Whatever approach you use is okay - we recommend the following tools:\\n- [Convertio](https://convertio.co/ttf-woff/)\\n- [Cloud Convert](https://cloudconvert.com/ttf-to-woff)\\n- [Everything Fonts](https://everythingfonts.com/ttf-to-woff)\\n- [Transfonter](https://transfonter.org/)\\n\\n:::caution Warning\\nMake sure you have the proper license for the fonts you are converting.\\n:::\\n\\nFonts should go inside your theme\'s **_/assets/fonts_** folder. Copy the fonts you want to use there. You will also notice that this folder contains an **_index.js_** file, used to import fonts into your project. Here\'s an example of how I imported my fonts:\\n```js\\n// SourceSansPro WOFF\\nimport \'./SourceSansPro-Bold.woff\';\\nimport \'./SourceSansPro-BoldItalic.woff\';\\nimport \'./SourceSansPro-Italic.woff\';\\nimport \'./SourceSansPro-Regular.woff\';\\nimport \'./SourceSansPro-Light.woff\';\\nimport \'./SourceSansPro-LightItalic.woff\';\\n\\n// SourceSansPro WOFF2\\nimport \'./SourceSansPro-Bold.woff2\';\\nimport \'./SourceSansPro-BoldItalic.woff2\';\\nimport \'./SourceSansPro-Italic.woff2\';\\nimport \'./SourceSansPro-Regular.woff2\';\\nimport \'./SourceSansPro-Light.woff2\';\\nimport \'./SourceSansPro-LightItalic.woff2\';\\n\\n// NotoSerif WOFF\\nimport \'./NotoSerif-Bold.woff\';\\nimport \'./NotoSerif-BoldItalic.woff\';\\nimport \'./NotoSerif-Italic.woff\';\\nimport \'./NotoSerif-Regular.woff\';\\n\\n// NotoSerif WOFF2\\nimport \'./NotoSerif-Bold.woff2\';\\nimport \'./NotoSerif-BoldItalic.woff2\';\\nimport \'./NotoSerif-Italic.woff2\';\\nimport \'./NotoSerif-Regular.woff2\';\\n```\\n\\n:::tip\\nIf you don\'t need to support IE11, don\'t include `.woff` files. This will save you some bandwidth.\\n:::\\n\\nTo add these fonts as your base font and secondary font, go to the global manifest located in **_/src/Blocks_** and add the following inside `globalVariables`:\\n```json\\n\\"globalVariables\\": {\\n\\t// ...\\n\\t\\"baseFont\\": \\"SourceSansPro\\",\\n\\t\\"secondaryFont\\": \\"NotoSerif\\",\\n\\t// ...\\n}\\n```\\n\\nNext, you can create a new file called **__typography.scss_** inside your **_/assets/styles/parts/utils/_** folder and add the following:\\n\\n```scss\\n@include font-face(global-settings(baseFont), \'SourceSansPro-Light\', 300);\\n@include font-face(global-settings(baseFont), \'SourceSansPro-LightItalic\', 300, italic);\\n@include font-face(global-settings(baseFont), \'SourceSansPro-Regular\', 400);\\n@include font-face(global-settings(baseFont), \'SourceSansPro-Italic\', 400, italic);\\n@include font-face(global-settings(baseFont), \'SourceSansPro-Bold\', 700);\\n@include font-face(global-settings(baseFont), \'SourceSansPro-BoldItalic\', 700, italic);\\n\\n@include font-face(global-settings(secondaryFont), \'NotoSerif-Bold\', 700);\\n@include font-face(global-settings(secondaryFont), \'NotoSerif-BoldItalic\', 700, italic);\\n@include font-face(global-settings(secondaryFont), \'NotoSerif-Italic\', 400, italic);\\n@include font-face(global-settings(secondaryFont), \'NotoSerif-Regular\', 400);\\n```\\nIf you would like to know more about the `font-face` mixin, you can take a look at our [Sass documentation](/docs/basics/library).\\n\\nBecause this is a new file, we have to include it. You can do that inside **_/assets/styles/parts/\\\\_shared.scss_** file:\\n```scss\\n// Project specific.\\n@import \'utils/shared-variables\';\\n@import \'utils/typography\';\\n```\\n\\nRun `npm start` to rebuild your **_public_** folder and assets. If you did everything correctly, your build should pass and you will see your fonts inside the **_public_** folder.\\n\\n## Using only one font in a block\\n\\nThere are multiple ways of using fonts in a block. The simplest use case is if you have only one font you want to use for that specific block. In this case, we want the Heading block to only use _Noto Serif_.\\n\\nTo make our secondary font available for use, we need to first define it as a CSS variable. We can do that in **_/assets/styles/parts/utils/\\\\_shared-variables.scss_**. The base font is already defined there, so all we need to do is add our secondary font definition below it.\\n\\nTo make things a bit more consistent, we may also want to rename `--global-font-family` CSS variable to `--base-font-family`. Just don\'t forget to search/replace this new variable name across your project! Please note that the fallbacks for the fonts can be anything, this is just an example. Once we\'re done, it should look like this:\\n```scss\\n\\t--base-font-family: var(--global-base-font), -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Helvetica,\\n\\t\\tArial, sans-serif, \'Apple Color Emoji\', \'Segoe UI Emoji\', \'Segoe UI Symbol\';\\n\\n\\t--secondary-font-family: var(--global-secondary-font), -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Helvetica,\\n\\t\\tArial, sans-serif, \'Apple Color Emoji\', \'Segoe UI Emoji\', \'Segoe UI Symbol\';\\n```\\nAfter defining the `--secondary-font-family` CSS variable, we can go to **_/src/Blocks/components/heading/heading-style.scss_** and add the following rule to the `.heading` class:\\n```scss\\n\\tfont-family: var(--secondary-font-family);\\n```\\n\\nAnd that\'s it! The Heading block will now use the _Noto Serif_ font.\\n\\n## Adding a font picker\\n\\nIn some cases, you may want to give users the option to choose between fonts that they want to use in their block. For this example, we\'ll use the `paragraph` block where we want users to have both _Source Sans Pro_ and _Noto Serif_ available.\\n\\nFirst step is to add a new attribute, options and CSS variable values in **_/src/Blocks/components/paragraph/manifest.json_**:\\n```json\\n// ...\\n\\t\\"attributes\\": {\\n\\t\\t// ...\\n\\t\\t\\"paragraphFontFamily\\": {\\n\\t\\t\\t\\"type\\": \\"string\\",\\n\\t\\t\\t\\"default\\": \\"base\\"\\n\\t\\t}\\n\\t},\\n\\t\\"options\\": {\\n\\t\\t// ...\\n\\t\\t\\"paragraphFontFamily\\": [\\n\\t\\t\\t{\\n\\t\\t\\t\\t\\"label\\": \\"SourceSansPro\\",\\n\\t\\t\\t\\t\\"value\\": \\"base\\"\\n\\t\\t\\t},\\n\\t\\t\\t{\\n\\t\\t\\t\\t\\"label\\": \\"NotoSerif\\",\\n\\t\\t\\t\\t\\"value\\": \\"secondary\\"\\n\\t\\t\\t}\\n\\t\\t],\\n\\t\\t// ...\\n\\t}\\n```\\n\\nAfter defining the new attribute and options for the font family, we now have to add a variable to **_manifest.json_**. We can add it to the `variables` object. This approach is slightly different from the one explained in the [Modifying blocks](/blog/modifying-blocks-color-theme) blog post. Here we can use `%value%` wildcard to dynamically add the selected value to our CSS variable.\\n```json\\n\\"paragraphFontFamily\\": [\\n\\t{\\n\\t\\t\\"variable\\": {\\n\\t\\t\\t\\"paragraph-font-family\\": \\"var(--%value%-font-family)\\"\\n\\t\\t}\\n\\t}\\n]\\n```\\n\\nThe next step is to go to **_/src/Blocks/components/paragraph/components/paragraph-options.js_** and add a control for the new font family option. The first thing we can add is a new attribute that will allow us to toggle showing the Paragraph font family option on other blocks which are using the Paragraph component. There might be a case where we want only one font family, so this option may come in handy in some other blocks.\\n```js\\nconst {\\n\\t\\tsetAttributes,\\n\\t\\t//...\\n\\t\\tshowParagraphFontFamily = true,\\n\\t} = attributes;\\n```\\n\\nAfter that, we need to fetch either the saved attribute value or get the default one from the manifest. We can do that with the `checkAttr` helper, adding it just below `paragraphColor` and `paragraphSize`.\\n```js\\n\\tconst paragraphFontFamily = checkAttr(\'paragraphFontFamily\', attributes, manifest);\\n```\\n\\nNow we have to add an actual control to the options panel which will allow us to choose between fonts.\\n```js\\n\\treturn (\\n\\t\\t// ...\\n\\t\\t{showParagraphFontFamily &&\\n\\t\\t\\t }\\n\\t\\t\\t\\tvalue={paragraphFontFamily}\\n\\t\\t\\t\\toptions={getOption(\'paragraphFontFamily\', attributes, manifest)}\\n\\t\\t\\t\\tonChange={(value) => setAttributes({ [getAttrKey(\'paragraphFontFamily\', attributes, manifest)]: value })}\\n\\t\\t\\t\\tisClearable={false}\\n\\t\\t\\t\\tisSearchable={false}\\n\\t\\t\\t\\tsimpleValue\\n\\t\\t\\t/>\\n\\t\\t}\\n\\t\\t// ...\\n\\t);\\n```\\n\\nThe control for selecting a font should now be available under Paragraph options. Saving the choice now works, but the font stays the same both in the editor and on the frontend.\\n\\n![Font Picker](/img/blog/font-picker.webp)\\n\\nThe final step we need to make this work is to add a CSS rule that consumes our variable to **_/src/Blocks/components/paragraph/paragraph-style.scss_**:\\n```scss\\n.paragraph {\\n\\t// ...\\n\\tfont-family: var(--paragraph-font-family, var(--base-font-family));\\n\\t// ...\\n}\\n```\\n\\nAfter adding this single line of CSS code, your new option for selecting fonts will now be fully functional.\\n\\n## Closing thoughts\\nAdding fonts to a project is something you will usually only do when setting up a new project and then forget about it. As you could see in this blog post, this isn\'t a complicated process, but it has a specific set of steps that have to be taken in order for custom fonts to work in your project.\\n\\nOf course, there are other ways to include fonts in your project, but the described process is what we recommend and use. This is the (Eightshift) Way."},{"id":"modifying-blocks-color-theme","metadata":{"permalink":"/blog/modifying-blocks-color-theme","source":"@site/blog/2022-03-04-modifying-blocks.md","title":"Modifying blocks - Color Theme","description":"Step-by-step guide on how to modify and expand the functionality of existing blocks.","date":"2022-03-22T00:00:00.000Z","tags":[{"label":"eightshift","permalink":"/blog/tags/eightshift"},{"label":"boilerplate","permalink":"/blog/tags/boilerplate"},{"label":"components","permalink":"/blog/tags/components"},{"label":"blocks","permalink":"/blog/tags/blocks"}],"readingTime":8.465,"hasTruncateMarker":true,"authors":[{"name":"Igor Obradovi\u0107","title":"WordPress Engineer","url":"https://github.com/iobrado","imageURL":"https://avatars.githubusercontent.com/u/23059501?v=4","key":"obradovic"}],"frontMatter":{"title":"Modifying blocks - Color Theme","description":"Step-by-step guide on how to modify and expand the functionality of existing blocks.","slug":"modifying-blocks-color-theme","authors":"obradovic","date":"2022-03-22T00:00:00.000Z","tags":["eightshift","boilerplate","components","blocks"],"hide_table_of_contents":false},"unlisted":false,"prevItem":{"title":"Adding fonts","permalink":"/blog/adding-fonts"},"nextItem":{"title":"Adding components and blocks with WP-CLI","permalink":"/blog/adding-blocks-wpcli"}},"content":"In our previous post, we covered how to use Storybook and WP-CLI to add additional blocks to your project. This post will walk you through modifying an existing block step-by-step.\\n\x3c!--truncate--\x3e\\n\\nSince Eightshift Development kit is a starter theme, made for developers to jumpstart and speed up their development, you\'re welcome to modify files in it directly. There is no need to create a child theme to protect changes from updates.\\n\\n## Modifying a block or a component?\\nBecause we used the Quote block in our previous post, we will continue using it as an example as it\'s a fairly simple one. One of the first questions you may ask yourself could be: \\"Should I modify a component or a block?\\". And the answer is - it depends.\\n\\nIf you compare **_components/quote/quote.php_** (component) and **_custom/quote/quote.php_** (block), you\'ll notice that most of the HTML code is inside the component, while the block pretty much only renders the Quote component inside a wrapper. This example will walk you through the whole process of adding a new attribute and its options to a block.\\n\\n## What will we do?\\n\\nWe want to style the block and add a new feature. An option to choose a color theme for the Quote block. These are the specs:\\n- each Quote block has a background with rounded corners\\n- option for three color themes: blue, green, yellow\\n- the background has a lighter shade of the selected color\\n- quote icon has a stronger shade of the selected color\\n\\nTo better help you visualize, this is how the Quote block should look like after making these changes, showcasing all three color theme variations:\\n![Color Theme Examples](/img/blog/color-theme-examples.webp)\\n\\n## Adding background\\n\\nInitial background styling is fairly straightforward. Navigate to **_src/Blocks/components/quote/quote-style.scss_** and paste the following code inside `.quote` class:\\n\\n```css\\npadding: calc(var(--base-font-size) * 1.6rem);\\nborder-radius: calc(var(--base-font-size) * 2rem);\\nbackground-color: global-settings(colors, light);\\n```\\nYou may notice we\'re using `calc` instead of directly writing values in rems. This way makes it much easier to calculate pixel size since `calc(var(--base-font-size) * 1.6rem)` equals `16px`.\\n\\nFor now, we will add a simple light grey background to see how it looks. We\'ll replace this value later with a CSS variable.\\n\\n:::tip\\nDon\'t hardcode hex color values directly inside your component. Instead, use colors defined in your global manifest.\\n:::\\n\\nYou\'ll notice that the changes are visible both in the editor and on the frontend. Since the Gutenberg editor adds some additional markup, sometimes you\'ll need to add additional styling only for the editor. In case we need to override something in the editor for our Quote component, we would simply create **_quote-editor.scss_**.\\n\\n## Adding new colors to your project\\n\\nBecause the theme currently doesn\'t have all the required colors, we need to add additional colors which will be used for the color theme feature. We will use the colors already defined in the manifest for icon color, but we need to add lighter variations of those colors to use them for the background. Navigate to your global manifest, which is located inside **_src/Blocks/manifest.json_** and add the following values inside `colors`:\\n```json\\n{\\n\\t\\"name\\": \\"Light Blue\\",\\n\\t\\"slug\\": \\"light-blue\\",\\n\\t\\"color\\": \\"#B3E5FC\\"\\n},\\n{\\n\\t\\"name\\": \\"Light Green\\",\\n\\t\\"slug\\": \\"light-green\\",\\n\\t\\"color\\": \\"#DCEDC8\\"\\n},\\n{\\n\\t\\"name\\": \\"Light Yellow\\",\\n\\t\\"slug\\": \\"light-yellow\\",\\n\\t\\"color\\": \\"#FFF9C4\\"\\n}\\n```\\n\\n## Adding a new attribute and options to manifest\\n\\nFor editors to be able to choose which color theme to use for the Quote block, we need to define an attribute for it in the manifest. Navigate to **_src/Blocks/components/quote/manifest.json_** and add the following value inside `attributes`:\\n\\n```json\\n\\"quoteColorTheme\\": {\\n\\t\\"type\\": \\"string\\",\\n\\t\\"default\\": \\"blue\\"\\n}\\n```\\n\\n:::caution\\nDouble-check the path of the manifest used in this example. We\'re adding it inside the Quote component manifest, not the Quote block manifest.\\n:::\\n\\nAfter that, since we want to have a fixed number of options, we need to define available options. We can do that inside `options` which is on the same level as `attributes`:\\n```json\\n\\"options\\": {\\n\\t\\"quoteColorTheme\\": [\\n\\t\\t\\"blue\\",\\n\\t\\t\\"green\\",\\n\\t\\t\\"yellow\\"\\n\\t]\\n}\\n```\\n\\n## CSS variables\\n\\nOur next step is to add CSS variables to the Quote component\'s manifest. Inside **_manifest.json_**, on the same level as `attributes`, add the following code:\\n```json\\n\\"variables\\": {\\n\\t\\"quoteColorTheme\\": {\\n\\t\\t\\"blue\\": [\\n\\t\\t\\t{\\n\\t\\t\\t\\t\\"variable\\": {\\n\\t\\t\\t\\t\\t\\"quote-background-color\\": \\"var(--global-colors-light-blue)\\",\\n\\t\\t\\t\\t\\t\\"quote-icon-color\\": \\"var(--global-colors-blue)\\"\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t],\\n\\t\\t\\"green\\": [\\n\\t\\t\\t{\\n\\t\\t\\t\\t\\"variable\\": {\\n\\t\\t\\t\\t\\t\\"quote-background-color\\": \\"var(--global-colors-light-green)\\",\\n\\t\\t\\t\\t\\t\\"quote-icon-color\\": \\"var(--global-colors-green)\\"\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t],\\n\\t\\t\\"yellow\\": [\\n\\t\\t\\t{\\n\\t\\t\\t\\t\\"variable\\": {\\n\\t\\t\\t\\t\\t\\"quote-background-color\\": \\"var(--global-colors-light-yellow)\\",\\n\\t\\t\\t\\t\\t\\"quote-icon-color\\": \\"var(--global-colors-yellow)\\"\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t]\\n\\t}\\n}\\n```\\n\\nNow, navigate back to Quote component\'s **_quote-style.scss_** and replace the `background-color` which we used for testing with the following:\\n```css\\nbackground-color: var(--quote-background-color);\\n```\\n\\nAs you can see, the variable name is the same one we used when defining background color variations in the manifest. For icon color, we do the same. After adding a new color to `&__icon` selector, our code should now look like this:\\n\\n```css\\n&__icon {\\n\\tdisplay: block;\\n\\tmargin-bottom: 1rem;\\n\\tcolor: var(--quote-icon-color);\\n}\\n```\\n\\n## Outputting CSS variables in editor\\nTo make our color theme visible in editor, we have to add few lines of code to **_src/Blocks/components/quote/components/quote-editor.js_** file. First, we need to import a few functions. We need `useMemo` from **_react_**, `outputCssVariables` and `getUnique` from **_@eightshift/frontend-libs/scripts_** and finally, we need data from the global manifest.\\n\\nAfter importing these and defining a unique constant, your code should look like this:\\n\\n```js\\nimport React, { useMemo } from \'react\';\\nimport classnames from \'classnames\';\\nimport { checkAttr, props, selector, outputCssVariables, getUnique } from \'@eightshift/frontend-libs/scripts\';\\nimport { HeadingEditor } from \'../../heading/components/heading-editor\';\\nimport { ParagraphEditor } from \'../../paragraph/components/paragraph-editor\';\\nimport manifest from \'./../manifest.json\';\\nimport globalManifest from \'./../../../manifest.json\';\\n\\nexport const QuoteEditor = (attributes) => {\\n\\tconst unique = useMemo(() => getUnique(), []);\\n\\t//...\\n```\\nNext, we need to add a unique `data-id` and output the `