1 line
7.9 KiB
JavaScript
Vendored
1 line
7.9 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7039],{466:function(e){var t;t=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function a(e,t){return null!=e&&"object"==typeof e&&t in e}var i=RegExp.prototype.test,o=/\S/,s={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},u=/\s*/,l=/\s+/,c=/\s*=/,p=/\s*\}/,h=/#|\^|\/|>|\{|&|=|!/;function f(e){this.string=e,this.tail=e,this.pos=0}function g(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function d(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}f.prototype.eos=function(){return""===this.tail},f.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},f.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case -1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},g.prototype.push=function(e){return new g(e,this)},g.prototype.lookup=function(e){var t=this.cache;if(t.hasOwnProperty(e))o=t[e];else{for(var r,i,o,s,u,l,c=this,p=!1;c;){if(e.indexOf(".")>0)for(s=c.view,u=e.split("."),l=0;null!=s&&l<u.length;)l===u.length-1&&(p=a(s,u[l])||(r=s,i=u[l],null!=r&&"object"!=typeof r&&r.hasOwnProperty&&r.hasOwnProperty(i))),s=s[u[l++]];else s=c.view[e],p=a(c.view,e);if(p){o=s;break}c=c.parent}t[e]=o}return n(o)&&(o=o.call(this.view)),o},d.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},d.prototype.parse=function(e,n){var a=this.templateCache,s=e+":"+(n||v.tags).join(":"),g=void 0!==a,d=g?a.get(s):void 0;return void 0==d&&(d=function(e,n){if(!e)return[];var a,s,g,d,w,y,m,C,E,b=!1,k=[],x=[],S=[],L=!1,j=!1,T="",U=0;function O(){if(L&&!j)for(;S.length;)delete x[S.pop()];else S=[];L=!1,j=!1}function R(e){if("string"==typeof e&&(e=e.split(l,2)),!t(e)||2!==e.length)throw Error("Invalid tags: "+e);a=RegExp(r(e[0])+"\\s*"),s=RegExp("\\s*"+r(e[1])),g=RegExp("\\s*"+r("}"+e[1]))}R(n||v.tags);for(var _=new f(e);!_.eos();){if(d=_.pos,y=_.scanUntil(a))for(var A,D=0,P=y.length;D<P;++D){;(A=m=y.charAt(D),i.call(o,A))?(j=!0,b=!0,T+=" "):(S.push(x.length),T+=m),x.push(["text",m,d,d+1]),d+=1,"\n"===m&&(O(),T="",U=0,b=!1)}if(!_.scan(a))break;if(L=!0,w=_.scan(h)||"name",_.scan(u),"="===w?(y=_.scanUntil(c),_.scan(c),_.scanUntil(s)):"{"===w?(y=_.scanUntil(g),_.scan(p),_.scanUntil(s),w="&"):y=_.scanUntil(s),!_.scan(s))throw Error("Unclosed tag at "+_.pos);if(C=">"==w?[w,y,d,_.pos,T,U,b]:[w,y,d,_.pos],U++,x.push(C),"#"===w||"^"===w)k.push(C);else if("/"===w){if(!(E=k.pop()))throw Error('Unopened section "'+y+'" at '+d);if(E[1]!==y)throw Error('Unclosed section "'+E[1]+'" at '+d)}else"name"===w||"{"===w||"&"===w?j=!0:"="===w&&R(y)}if(O(),E=k.pop())throw Error('Unclosed section "'+E[1]+'" at '+_.pos);return function(e){for(var t,n=[],r=n,a=[],i=0,o=e.length;i<o;++i)switch((t=e[i])[0]){case"#":case"^":r.push(t),a.push(t),r=t[4]=[];break;case"/":a.pop()[5]=t[2],r=a.length>0?a[a.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],a=0,i=e.length;a<i;++a)(t=e[a])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(x))}(e,n),g&&a.set(s,d)),d},d.prototype.render=function(e,t,n,r){var a=this.getConfigTags(r),i=this.parse(e,a),o=t instanceof g?t:new g(t,void 0);return this.renderTokens(i,o,n,e,r)},d.prototype.renderTokens=function(e,t,n,r,a){for(var i,o,s,u="",l=0,c=e.length;l<c;++l)s=void 0,"#"===(o=(i=e[l])[0])?s=this.renderSection(i,t,n,r,a):"^"===o?s=this.renderInverted(i,t,n,r,a):">"===o?s=this.renderPartial(i,t,n,a):"&"===o?s=this.unescapedValue(i,t):"name"===o?s=this.escapedValue(i,t,a):"text"===o&&(s=this.rawValue(i)),void 0!==s&&(u+=s);return u},d.prototype.renderSection=function(e,r,a,i,o){var s=this,u="",l=r.lookup(e[1]);if(l){if(t(l))for(var c=0,p=l.length;c<p;++c)u+=this.renderTokens(e[4],r.push(l[c]),a,i,o);else if("object"==typeof l||"string"==typeof l||"number"==typeof l)u+=this.renderTokens(e[4],r.push(l),a,i,o);else if(n(l)){if("string"!=typeof i)throw Error("Cannot use higher-order sections without the original template");null!=(l=l.call(r.view,i.slice(e[3],e[5]),function(e){return s.render(e,r,a,o)}))&&(u+=l)}else u+=this.renderTokens(e[4],r,a,i,o);return u}},d.prototype.renderInverted=function(e,n,r,a,i){var o=n.lookup(e[1]);if(!o||t(o)&&0===o.length)return this.renderTokens(e[4],n,r,a,i)},d.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),a=e.split("\n"),i=0;i<a.length;i++)a[i].length&&(i>0||!n)&&(a[i]=r+a[i]);return a.join("\n")},d.prototype.renderPartial=function(e,t,r,a){if(r){var i=this.getConfigTags(a),o=n(r)?r(e[1]):r[e[1]];if(null!=o){var s=e[6],u=e[5],l=e[4],c=o;0==u&&l&&(c=this.indentPartial(o,l,s));var p=this.parse(c,i);return this.renderTokens(p,t,r,c,a)}}},d.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},d.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||v.escape,a=t.lookup(e[1]);if(null!=a)return"number"==typeof a&&r===v.escape?String(a):r(a)},d.prototype.rawValue=function(e){return e[1]},d.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},d.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var v={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(cache){w.templateCache=cache},get templateCache(){return w.templateCache}},w=new d;return v.clearCache=function(){return w.clearCache()},v.parse=function(e,t){return w.parse(e,t)},v.render=function(e,n,r,a){if("string"!=typeof e)throw TypeError('Invalid template! Template should be a "string" but "'+(t(e)?"array":typeof e)+'" was given as the first argument for mustache#render(template, view, partials)');return w.render(e,n,r,a)},v.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return s[e]})},v.Scanner=f,v.Context=g,v.Writer=d,v},e.exports=t()},37039:function(e,t,n){var r,a,i,o=n(11163),s=n(67294),u=n(3064),l=n(466);n(41664);var c=(r=l)&&"object"==typeof r&&"default"in r?r:{default:r};(a=i||(i={})).QUERY="query",a.LOCAL_STORAGE="localStorage";let p=e=>{let t="";return(e.useBrowserDefault&&"undefined"!=typeof window&&window&&window.navigator&&(window.navigator.languages||window.navigator.language)&&(t=(window.navigator.languages&&window.navigator.languages[0]||window.navigator.language).split("-")[0].toLowerCase()),e.useBrowserDefault&&t&&e.translations[t])?t:e.defaultLang},h=()=>{if(u.languageDataStore||(u.languageDataStore=i.QUERY),Object.keys(u.translations).length<1)throw Error("Missing translations. Did you import and add the tranlations in 'i18n/index.js'?");if(0===u.defaultLang.length)throw Error("Missing default language. Did you set 'defaultLang' in 'i18n/index.js'?");if(!u.translations[u.defaultLang])throw Error(`Invalid default language '${u.defaultLang}'. Check your 'defaultLang' in 'i18n/index.js'?`);return u.defaultLang=p(u),u};t.$G=()=>{let e=h().translations,{lang:t}=function(){let e=h(),t=e.defaultLang,n=e.translations,r=e.languageDataStore,a=o.useRouter(),[u,l]=s.useState(t),c=()=>{let e=window.localStorage.getItem("next-export-i18n-lang");r===i.LOCAL_STORAGE&&e&&e!==u&&n&&n[e]&&l(e)};return s.useEffect(()=>(c(),document.addEventListener("localStorageLangChange",()=>{c()}),()=>{document.removeEventListener("localStorageLangChange",c)}),[c]),s.useEffect(()=>{let e=a.query?.lang;r===i.QUERY&&e&&e!==u&&n&&n[e]&&l(e)},[u,a.query.lang,n,l]),{lang:u,setLang:l}}();return{t:(n,r)=>{let a=n.split(".").reduce((e,t)=>e&&e[t]||null,e[t])||n;try{return c.default.render(a,r)}catch(e){return a}}}}}}]); |