mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
1 line
4.1 KiB
JavaScript
1 line
4.1 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[97920],{42027:(e,t,a)=>{a.r(t),a.d(t,{default:()=>_});var n=a(67294),r=a(52263),l=a(44730),s=a(35742),c=a(39960),o=a(95999);const u=["zero","one","two","few","many","other"];function m(e){return u.filter((t=>e.includes(t)))}const h={locale:"en",pluralForms:m(["one","other"]),select:e=>1===e?"one":"other"};function i(){const{i18n:{currentLocale:e}}=(0,r.Z)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:m(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"),h}}),[e])}function p(){const e=i();return{selectMessage:(t,a)=>function(e,t,a){const n=e.split("|");if(1===n.length)return n[0];n.length>a.pluralForms.length&&console.error("For locale="+a.locale+", a maximum of "+a.pluralForms.length+" plural forms are expected ("+a.pluralForms.join(",")+"), but the message contains "+n.length+": "+e);const r=a.select(t),l=a.pluralForms.indexOf(r);return n[Math.min(l,n.length-1)]}(a,t,e)}}var d=a(8177),g=a(10412);const f=function(){const e=(0,d.k6)(),t=(0,d.TH)(),{siteConfig:{baseUrl:a}}=(0,r.Z)();return{searchValue:g.Z.canUseDOM&&new URLSearchParams(t.search).get("q")||"",updateSearchPath:a=>{const n=new URLSearchParams(t.search);a?n.set("q",a):n.delete("q"),e.replace({search:n.toString()})},generateSearchPageLink:e=>a+"search?q="+encodeURIComponent(e)}};var E=a(90022),y=a(98202),S=a(82539),w=a(10726),b=a(91073),I=a(80311);const P="searchQueryInput_CFBF",R="searchResultItem_U687",v="searchResultItemPath_uIbk",F="searchResultItemSummary_oZHr";var k=a(73926);function C(e){let{searchResult:{document:t,type:a,page:r,tokens:l,metadata:s}}=e;const o=0===a,u=2===a,m=(o?t.b:r.b).slice(),h=u?t.s:t.t;return o||m.push(r.t),n.createElement("article",{className:R},n.createElement("h2",null,n.createElement(c.Z,{to:t.u+(t.h||""),dangerouslySetInnerHTML:{__html:u?(0,S.C)(h,l):(0,w.o)(h,(0,b.m)(s,"t"),l,100)}})),m.length>0&&n.createElement("p",{className:v},(0,k.e)(m)),u&&n.createElement("p",{className:F,dangerouslySetInnerHTML:{__html:(0,w.o)(t.t,(0,b.m)(s,"t"),l,100)}}))}const _=function(){const{siteConfig:{baseUrl:e}}=(0,r.Z)(),{selectMessage:t}=p(),{searchValue:a,updateSearchPath:c}=f(),[u,m]=(0,n.useState)(a),[h,i]=(0,n.useState)(),[d,g]=(0,n.useState)(),S=(0,n.useMemo)((()=>u?(0,o.I)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:u}):(0,o.I)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"})),[u]);(0,n.useEffect)((()=>{c(u),h&&(u?h(u,(e=>{g(e)})):g(void 0))}),[u,h]);const w=(0,n.useCallback)((e=>{m(e.target.value)}),[]);return(0,n.useEffect)((()=>{a&&a!==u&&m(a)}),[a]),(0,n.useEffect)((()=>{!async function(){const{wrappedIndexes:t,zhDictionary:a}=await(0,E.w)(e);i((()=>(0,y.v)(t,a,100)))}()}),[e]),n.createElement(l.Z,null,n.createElement(s.Z,null,n.createElement("meta",{property:"robots",content:"noindex, follow"}),n.createElement("title",null,S)),n.createElement("div",{className:"container margin-vert--lg"},n.createElement("h1",null,S),n.createElement("input",{type:"search",name:"q",className:P,"aria-label":"Search",onChange:w,value:u,autoComplete:"off",autoFocus:!0}),!h&&u&&n.createElement("div",null,n.createElement(I.Z,null)),d&&(d.length>0?n.createElement("p",null,t(d.length,(0,o.I)({id:"theme.SearchPage.documentsFound.plurals",message:"1 document found|{count} documents found",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)'},{count:d.length}))):n.createElement("p",null,(0,o.I)({id:"theme.SearchPage.noResultsText",message:"No documents were found",description:"The paragraph for empty search result"}))),n.createElement("section",null,d&&d.map((e=>n.createElement(C,{key:e.document.i,searchResult:e}))))))}}}]); |