cocos-enhance-kit/assets/js/1a4e3797.68e9420c.js

1 line
4.5 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7920],{42027:function(e,t,n){n.r(t),n.d(t,{default:function(){return x}});var r=n(15861),a=n(87757),l=n.n(a),u=n(67294),c=n(52263),s=n(48476),o=n(35742),i=n(39960),m=n(95999),h=["zero","one","two","few","many","other"];function p(e){return h.filter((function(t){return e.includes(t)}))}var f={locale:"en",pluralForms:p(["one","other"]),select:function(e){return 1===e?"one":"other"}};function d(){var e=(0,c.Z)().i18n.currentLocale;return(0,u.useMemo)((function(){try{return t=e,n=new Intl.PluralRules(t),{locale:t,pluralForms:p(n.resolvedOptions().pluralCategories),select:function(e){return n.select(e)}}}catch(r){return console.error('Failed to use Intl.PluralRules for locale "'+e+'".\nDocusaurus will fallback to the default (English) implementation.\nError: '+r.message+"\n"),f}var t,n}),[e])}function g(){var e=d();return{selectMessage:function(t,n){return function(e,t,n){var r=e.split("|");if(1===r.length)return r[0];r.length>n.pluralForms.length&&console.error("For locale="+n.locale+", a maximum of "+n.pluralForms.length+" plural forms are expected ("+n.pluralForms+"), but the message contains "+r.length+": "+e);var a=n.select(t),l=n.pluralForms.indexOf(a);return r[Math.min(l,r.length-1)]}(n,t,e)}}}var v=n(76775),y=n(10412);var E=function(){var e=(0,v.k6)(),t=(0,v.TH)(),n=(0,c.Z)().siteConfig.baseUrl;return{searchValue:y.Z.canUseDOM&&new URLSearchParams(t.search).get("q")||"",updateSearchPath:function(n){var r=new URLSearchParams(t.search);n?r.set("q",n):r.delete("q"),e.replace({search:r.toString()})},generateSearchPageLink:function(e){return n+"search?q="+encodeURIComponent(e)}}},S=n(90022),w=n(98202),I=n(82539),b=n(10726),F=n(91073),P=n(80311),k="searchQueryInput_CFBF",R="searchResultItem_U687",C="searchResultItemPath_uIbk",Z="searchResultItemSummary_oZHr",_=n(73926);function q(e){var t=e.searchResult,n=t.document,r=t.type,a=t.page,l=t.tokens,c=t.metadata,s=0===r,o=2===r,m=(s?n.b:a.b).slice(),h=o?n.s:n.t;return s||m.push(a.t),u.createElement("article",{className:R},u.createElement("h2",null,u.createElement(i.Z,{to:n.u+(n.h||""),dangerouslySetInnerHTML:{__html:o?(0,I.C)(h,l):(0,b.o)(h,(0,F.m)(c,"t"),l,100)}})),m.length>0&&u.createElement("p",{className:C},(0,_.e)(m)),o&&u.createElement("p",{className:Z,dangerouslySetInnerHTML:{__html:(0,b.o)(n.t,(0,F.m)(c,"t"),l,100)}}))}var x=function(){var e=(0,c.Z)().siteConfig.baseUrl,t=g().selectMessage,n=E(),a=n.searchValue,i=n.updateSearchPath,h=(0,u.useState)(a),p=h[0],f=h[1],d=(0,u.useState)(),v=d[0],y=d[1],I=(0,u.useState)(),b=I[0],F=I[1],R=(0,u.useMemo)((function(){return p?(0,m.I)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:p}):(0,m.I)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"})}),[p]);(0,u.useEffect)((function(){i(p),v&&(p?v(p,(function(e){F(e)})):F(void 0))}),[p,v]);var C=(0,u.useCallback)((function(e){f(e.target.value)}),[]);return(0,u.useEffect)((function(){a&&a!==p&&f(a)}),[a]),(0,u.useEffect)((function(){function t(){return(t=(0,r.Z)(l().mark((function t(){var n,r,a;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,S.w)(e);case 2:n=t.sent,r=n.wrappedIndexes,a=n.zhDictionary,y((function(){return(0,w.v)(r,a,100)}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function(){t.apply(this,arguments)}()}),[e]),u.createElement(s.Z,null,u.createElement(o.Z,null,u.createElement("meta",{property:"robots",content:"noindex, follow"}),u.createElement("title",null,R)),u.createElement("div",{className:"container margin-vert--lg"},u.createElement("h1",null,R),u.createElement("input",{type:"search",name:"q",className:k,"aria-label":"Search",onChange:C,value:p,autoComplete:"off",autoFocus:!0}),!v&&p&&u.createElement("div",null,u.createElement(P.Z,null)),b&&(b.length>0?u.createElement("p",null,t(b.length,(0,m.I)({id:"theme.SearchPage.documentsFound.plurals",message:"1 document found|