ray-template/js/@intlify_core-base@9.13.1-CVxc1Bsn.js

6 lines
15 KiB
JavaScript

import{g as be,i as fe,a as F,w as Ne,b as o,c as P,d as b,e as V,f as D,h as te,j as L,k as ae,l as I,m as q,n as Ae,o as Fe,p as Le,q as Me,t as De}from"./@intlify_shared@9.13.1-BxU0OzX2.js";import{C as Ie,a as Se,c as pe,d as ye,b as Re}from"./@intlify_message-compiler@9.13.1-GrLDMuy_.js";/*!
* core-base v9.13.1
* (c) 2024 kazuya kawaguchi
* Released under the MIT License.
*/function ke(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(be().__INTLIFY_PROD_DEVTOOLS__=!1)}const w=[];w[0]={w:[0],i:[3,0],"[":[4],o:[7]};w[1]={w:[1],".":[2],"[":[4],o:[7]};w[2]={w:[2],i:[3,0],0:[3,0]};w[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]};w[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]};w[5]={"'":[4,0],o:8,l:[5,0]};w[6]={'"':[4,0],o:8,l:[6,0]};const Pe=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function we(e){return Pe.test(e)}function We(e){const t=e.charCodeAt(0),r=e.charCodeAt(e.length-1);return t===r&&(t===34||t===39)?e.slice(1,-1):e}function ve(e){if(e==null)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Ue(e){const t=e.trim();return e.charAt(0)==="0"&&isNaN(parseInt(e))?!1:we(t)?We(t):"*"+t}function Ve(e){const t=[];let r=-1,a=0,n=0,s,c,u,l,i,_,E;const d=[];d[0]=()=>{c===void 0?c=u:c+=u},d[1]=()=>{c!==void 0&&(t.push(c),c=void 0)},d[2]=()=>{d[0](),n++},d[3]=()=>{if(n>0)n--,a=4,d[0]();else{if(n=0,c===void 0||(c=Ue(c),c===!1))return!1;d[1]()}};function g(){const T=e[r+1];if(a===5&&T==="'"||a===6&&T==='"')return r++,u="\\"+T,d[0](),!0}for(;a!==null;)if(r++,s=e[r],!(s==="\\"&&g())){if(l=ve(s),E=w[a],i=E[l]||E.l||8,i===8||(a=i[0],i[1]!==void 0&&(_=d[i[1]],_&&(u=s,_()===!1))))return;if(a===7)return t}}const re=new Map;function $e(e,t){return L(e)?e[t]:null}function Ct(e,t){if(!L(e))return null;let r=re.get(t);if(r||(r=Ve(t),r&&re.set(t,r)),!r)return null;const a=r.length;let n=e,s=0;for(;s<a;){const c=n[r[s]];if(c===void 0||F(n))return null;n=c,s++}return n}const Ke=e=>e,Ge=e=>"",Ye="text",je=e=>e.length===0?"":Me(e),ze=De;function ne(e,t){return e=Math.abs(e),t===2?e?e>1?1:0:1:e?Math.min(e,2):0}function Be(e){const t=I(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(I(e.named.count)||I(e.named.n))?I(e.named.count)?e.named.count:I(e.named.n)?e.named.n:t:t}function He(e,t){t.count||(t.count=e),t.n||(t.n=e)}function Xe(e={}){const t=e.locale,r=Be(e),a=L(e.pluralRules)&&o(t)&&F(e.pluralRules[t])?e.pluralRules[t]:ne,n=L(e.pluralRules)&&o(t)&&F(e.pluralRules[t])?ne:void 0,s=m=>m[a(r,m.length,n)],c=e.list||[],u=m=>c[m],l=e.named||{};I(e.pluralIndex)&&He(r,l);const i=m=>l[m];function _(m){const O=F(e.messages)?e.messages(m):L(e.messages)?e.messages[m]:!1;return O||(e.parent?e.parent.message(m):Ge)}const E=m=>e.modifiers?e.modifiers[m]:Ke,d=b(e.processor)&&F(e.processor.normalize)?e.processor.normalize:je,g=b(e.processor)&&F(e.processor.interpolate)?e.processor.interpolate:ze,T=b(e.processor)&&o(e.processor.type)?e.processor.type:Ye,A={list:u,named:i,plural:s,linked:(m,...O)=>{const[M,f]=O;let h="text",C="";O.length===1?L(M)?(C=M.modifier||C,h=M.type||h):o(M)&&(C=M||C):O.length===2&&(o(M)&&(C=M||C),o(f)&&(h=f||h));const W=_(m)(A),S=h==="vnode"&&P(W)&&C?W[0]:W;return C?E(C)(S,h):S},message:_,type:T,interpolate:g,normalize:d,values:V({},c,l)};return A}let K=null;function bt(e){K=e}function Ze(e,t,r){K&&K.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:r})}const qe=xe("function:translate");function xe(e){return t=>K&&K.emit(e,t)}const me=Ie.__EXTEND_POINT__,v=fe(me),Nt={NOT_FOUND_KEY:me,FALLBACK_TO_TRANSLATE:v(),CANNOT_FORMAT_NUMBER:v(),FALLBACK_TO_NUMBER_FORMAT:v(),CANNOT_FORMAT_DATE:v(),FALLBACK_TO_DATE_FORMAT:v(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:v(),__EXTEND_POINT__:v()},_e=Se.__EXTEND_POINT__,U=fe(_e),R={INVALID_ARGUMENT:_e,INVALID_DATE_ARGUMENT:U(),INVALID_ISO_DATE_ARGUMENT:U(),NOT_SUPPORT_NON_STRING_MESSAGE:U(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:U(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:U(),NOT_SUPPORT_LOCALE_TYPE:U(),__EXTEND_POINT__:U()};function k(e){return pe(e,null,void 0)}function x(e,t){return t.locale!=null?se(t.locale):se(e.locale)}let B;function se(e){if(o(e))return e;if(F(e)){if(e.resolvedOnce&&B!=null)return B;if(e.constructor.name==="Function"){const t=e();if(Le(t))throw k(R.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return B=t}else throw k(R.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw k(R.NOT_SUPPORT_LOCALE_TYPE)}function Je(e,t,r){return[...new Set([r,...P(t)?t:L(t)?Object.keys(t):o(t)?[t]:[r]])]}function At(e,t,r){const a=o(r)?r:X,n=e;n.__localeChainCache||(n.__localeChainCache=new Map);let s=n.__localeChainCache.get(a);if(!s){s=[];let c=[r];for(;P(c);)c=le(s,c,t);const u=P(t)||!b(t)?t:t.default?t.default:null;c=o(u)?[u]:u,P(c)&&le(s,c,!1),n.__localeChainCache.set(a,s)}return s}function le(e,t,r){let a=!0;for(let n=0;n<t.length&&D(a);n++){const s=t[n];o(s)&&(a=Qe(e,t[n],r))}return a}function Qe(e,t,r){let a;const n=t.split("-");do{const s=n.join("-");a=et(e,s,r),n.splice(-1,1)}while(n.length&&a===!0);return a}function et(e,t,r){let a=!1;if(!e.includes(t)&&(a=!0,t)){a=t[t.length-1]!=="!";const n=t.replace(/!/g,"");e.push(n),(P(r)||b(r))&&r[n]&&(a=r[n])}return a}const tt="9.13.1",J=-1,X="en-US",Ft="",ce=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function at(){return{upper:(e,t)=>t==="text"&&o(e)?e.toUpperCase():t==="vnode"&&L(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>t==="text"&&o(e)?e.toLowerCase():t==="vnode"&&L(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>t==="text"&&o(e)?ce(e):t==="vnode"&&L(e)&&"__v_isVNode"in e?ce(e.children):e}}let de;function Lt(e){de=e}let ge;function Mt(e){ge=e}let Te;function Dt(e){Te=e}let Ee=null;const It=e=>{Ee=e},rt=()=>Ee;let Oe=null;const St=e=>{Oe=e},pt=()=>Oe;let ie=0;function yt(e={}){const t=F(e.onWarn)?e.onWarn:Ne,r=o(e.version)?e.version:tt,a=o(e.locale)||F(e.locale)?e.locale:X,n=F(a)?X:a,s=P(e.fallbackLocale)||b(e.fallbackLocale)||o(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:n,c=b(e.messages)?e.messages:{[n]:{}},u=b(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=b(e.numberFormats)?e.numberFormats:{[n]:{}},i=V({},e.modifiers||{},at()),_=e.pluralRules||{},E=F(e.missing)?e.missing:null,d=D(e.missingWarn)||te(e.missingWarn)?e.missingWarn:!0,g=D(e.fallbackWarn)||te(e.fallbackWarn)?e.fallbackWarn:!0,T=!!e.fallbackFormat,N=!!e.unresolving,A=F(e.postTranslation)?e.postTranslation:null,m=b(e.processor)?e.processor:null,O=D(e.warnHtmlMessage)?e.warnHtmlMessage:!0,M=!!e.escapeParameter,f=F(e.messageCompiler)?e.messageCompiler:de,h=F(e.messageResolver)?e.messageResolver:ge||$e,C=F(e.localeFallbacker)?e.localeFallbacker:Te||Je,W=L(e.fallbackContext)?e.fallbackContext:void 0,S=e,j=L(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,z=L(S.__numberFormatters)?S.__numberFormatters:new Map,$=L(S.__meta)?S.__meta:{};ie++;const y={version:r,cid:ie,locale:a,fallbackLocale:s,messages:c,modifiers:i,pluralRules:_,missing:E,missingWarn:d,fallbackWarn:g,fallbackFormat:T,unresolving:N,postTranslation:A,processor:m,warnHtmlMessage:O,escapeParameter:M,messageCompiler:f,messageResolver:h,localeFallbacker:C,fallbackContext:W,onWarn:t,__meta:$};return y.datetimeFormats=u,y.numberFormats=l,y.__datetimeFormatters=j,y.__numberFormatters=z,__INTLIFY_PROD_DEVTOOLS__&&Ze(y,r,$),y}function Q(e,t,r,a,n){const{missing:s,onWarn:c}=e;if(s!==null){const u=s(e,r,t,n);return o(u)?u:t}else return t}function Rt(e,t,r){const a=e;a.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}function nt(e,t){return e===t?!1:e.split("-")[0]===t.split("-")[0]}function st(e,t){const r=t.indexOf(e);if(r===-1)return!1;for(let a=r+1;a<t.length;a++)if(nt(e,t[a]))return!0;return!1}function H(e){return r=>lt(r,e)}function lt(e,t){const r=t.b||t.body;if((r.t||r.type)===1){const a=r,n=a.c||a.cases;return e.plural(n.reduce((s,c)=>[...s,oe(e,c)],[]))}else return oe(e,r)}function oe(e,t){const r=t.s||t.static;if(r)return e.type==="text"?r:e.normalize([r]);{const a=(t.i||t.items).reduce((n,s)=>[...n,Z(e,s)],[]);return e.normalize(a)}}function Z(e,t){const r=t.t||t.type;switch(r){case 3:{const a=t;return a.v||a.value}case 9:{const a=t;return a.v||a.value}case 4:{const a=t;return e.interpolate(e.named(a.k||a.key))}case 5:{const a=t;return e.interpolate(e.list(a.i!=null?a.i:a.index))}case 6:{const a=t,n=a.m||a.modifier;return e.linked(Z(e,a.k||a.key),n?Z(e,n):void 0,e.type)}case 7:{const a=t;return a.v||a.value}case 8:{const a=t;return a.v||a.value}default:throw new Error(`unhandled node type on format message part: ${r}`)}}const ct=e=>e;let Y=Object.create(null);const G=e=>L(e)&&(e.t===0||e.type===0)&&("b"in e||"body"in e);function it(e,t={}){let r=!1;const a=t.onError||ye;return t.onError=n=>{r=!0,a(n)},{...Re(e,t),detectError:r}}function kt(e,t){if(o(e)){D(t.warnHtmlMessage)&&t.warnHtmlMessage;const a=(t.onCacheKey||ct)(e),n=Y[a];if(n)return n;const{ast:s,detectError:c}=it(e,{...t,location:!1,jit:!0}),u=H(s);return c?u:Y[a]=u}else{const r=e.cacheKey;if(r){const a=Y[r];return a||(Y[r]=H(e))}else return H(e)}}const ue=()=>"",p=e=>F(e);function Pt(e,...t){const{fallbackFormat:r,postTranslation:a,unresolving:n,messageCompiler:s,fallbackLocale:c,messages:u}=e,[l,i]=ft(...t),_=D(i.missingWarn)?i.missingWarn:e.missingWarn,E=D(i.fallbackWarn)?i.fallbackWarn:e.fallbackWarn,d=D(i.escapeParameter)?i.escapeParameter:e.escapeParameter,g=!!i.resolvedMessage,T=o(i.default)||D(i.default)?D(i.default)?s?l:()=>l:i.default:r?s?l:()=>l:"",N=r||T!=="",A=x(e,i);d&&ot(i);let[m,O,M]=g?[l,A,u[A]||{}]:he(e,l,A,c,E,_),f=m,h=l;if(!g&&!(o(f)||G(f)||p(f))&&N&&(f=T,h=f),!g&&(!(o(f)||G(f)||p(f))||!o(O)))return n?J:l;let C=!1;const W=()=>{C=!0},S=p(f)?f:Ce(e,l,O,f,h,W);if(C)return f;const j=_t(e,O,M,i),z=Xe(j),$=ut(e,S,z),y=a?a($,l):$;if(__INTLIFY_PROD_DEVTOOLS__){const ee={timestamp:Date.now(),key:o(l)?l:p(f)?f.key:"",locale:O||(p(f)?f.locale:""),format:o(f)?f:p(f)?f.source:"",message:y};ee.meta=V({},e.__meta,rt()||{}),qe(ee)}return y}function ot(e){P(e.list)?e.list=e.list.map(t=>o(t)?ae(t):t):L(e.named)&&Object.keys(e.named).forEach(t=>{o(e.named[t])&&(e.named[t]=ae(e.named[t]))})}function he(e,t,r,a,n,s){const{messages:c,onWarn:u,messageResolver:l,localeFallbacker:i}=e,_=i(e,a,r);let E={},d,g=null;const T="translate";for(let N=0;N<_.length&&(d=_[N],E=c[d]||{},(g=l(E,t))===null&&(g=E[t]),!(o(g)||G(g)||p(g)));N++)if(!st(d,_)){const A=Q(e,t,d,s,T);A!==t&&(g=A)}return[g,d,E]}function Ce(e,t,r,a,n,s){const{messageCompiler:c,warnHtmlMessage:u}=e;if(p(a)){const i=a;return i.locale=i.locale||r,i.key=i.key||t,i}if(c==null){const i=()=>a;return i.locale=r,i.key=t,i}const l=c(a,mt(e,r,n,a,u,s));return l.locale=r,l.key=t,l.source=a,l}function ut(e,t,r){return t(r)}function ft(...e){const[t,r,a]=e,n={};if(!o(t)&&!I(t)&&!p(t)&&!G(t))throw k(R.INVALID_ARGUMENT);const s=I(t)?String(t):(p(t),t);return I(r)?n.plural=r:o(r)?n.default=r:b(r)&&!q(r)?n.named=r:P(r)&&(n.list=r),I(a)?n.plural=a:o(a)?n.default=a:b(a)&&V(n,a),[s,n]}function mt(e,t,r,a,n,s){return{locale:t,key:r,warnHtmlMessage:n,onError:c=>{throw s&&s(c),c},onCacheKey:c=>Ae(t,r,c)}}function _t(e,t,r,a){const{modifiers:n,pluralRules:s,messageResolver:c,fallbackLocale:u,fallbackWarn:l,missingWarn:i,fallbackContext:_}=e,d={locale:t,modifiers:n,pluralRules:s,messages:g=>{let T=c(r,g);if(T==null&&_){const[,,N]=he(_,g,t,u,l,i);T=c(N,g)}if(o(T)||G(T)){let N=!1;const m=Ce(e,g,t,T,g,()=>{N=!0});return N?ue:m}else return p(T)?T:ue}};return e.processor&&(d.processor=e.processor),a.list&&(d.list=a.list),a.named&&(d.named=a.named),I(a.plural)&&(d.pluralIndex=a.plural),d}function wt(e,...t){const{datetimeFormats:r,unresolving:a,fallbackLocale:n,onWarn:s,localeFallbacker:c}=e,{__datetimeFormatters:u}=e,[l,i,_,E]=gt(...t),d=D(_.missingWarn)?_.missingWarn:e.missingWarn;D(_.fallbackWarn)?_.fallbackWarn:e.fallbackWarn;const g=!!_.part,T=x(e,_),N=c(e,n,T);if(!o(l)||l==="")return new Intl.DateTimeFormat(T,E).format(i);let A={},m,O=null;const M="datetime format";for(let C=0;C<N.length&&(m=N[C],A=r[m]||{},O=A[l],!b(O));C++)Q(e,l,m,d,M);if(!b(O)||!o(m))return a?J:l;let f=`${m}__${l}`;q(E)||(f=`${f}__${JSON.stringify(E)}`);let h=u.get(f);return h||(h=new Intl.DateTimeFormat(m,V({},O,E)),u.set(f,h)),g?h.formatToParts(i):h.format(i)}const dt=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function gt(...e){const[t,r,a,n]=e,s={};let c={},u;if(o(t)){const l=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!l)throw k(R.INVALID_ISO_DATE_ARGUMENT);const i=l[3]?l[3].trim().startsWith("T")?`${l[1].trim()}${l[3].trim()}`:`${l[1].trim()}T${l[3].trim()}`:l[1].trim();u=new Date(i);try{u.toISOString()}catch{throw k(R.INVALID_ISO_DATE_ARGUMENT)}}else if(Fe(t)){if(isNaN(t.getTime()))throw k(R.INVALID_DATE_ARGUMENT);u=t}else if(I(t))u=t;else throw k(R.INVALID_ARGUMENT);return o(r)?s.key=r:b(r)&&Object.keys(r).forEach(l=>{dt.includes(l)?c[l]=r[l]:s[l]=r[l]}),o(a)?s.locale=a:b(a)&&(c=a),b(n)&&(c=n),[s.key||"",u,s,c]}function Wt(e,t,r){const a=e;for(const n in r){const s=`${t}__${n}`;a.__datetimeFormatters.has(s)&&a.__datetimeFormatters.delete(s)}}function vt(e,...t){const{numberFormats:r,unresolving:a,fallbackLocale:n,onWarn:s,localeFallbacker:c}=e,{__numberFormatters:u}=e,[l,i,_,E]=Et(...t),d=D(_.missingWarn)?_.missingWarn:e.missingWarn;D(_.fallbackWarn)?_.fallbackWarn:e.fallbackWarn;const g=!!_.part,T=x(e,_),N=c(e,n,T);if(!o(l)||l==="")return new Intl.NumberFormat(T,E).format(i);let A={},m,O=null;const M="number format";for(let C=0;C<N.length&&(m=N[C],A=r[m]||{},O=A[l],!b(O));C++)Q(e,l,m,d,M);if(!b(O)||!o(m))return a?J:l;let f=`${m}__${l}`;q(E)||(f=`${f}__${JSON.stringify(E)}`);let h=u.get(f);return h||(h=new Intl.NumberFormat(m,V({},O,E)),u.set(f,h)),g?h.formatToParts(i):h.format(i)}const Tt=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Et(...e){const[t,r,a,n]=e,s={};let c={};if(!I(t))throw k(R.INVALID_ARGUMENT);const u=t;return o(r)?s.key=r:b(r)&&Object.keys(r).forEach(l=>{Tt.includes(l)?c[l]=r[l]:s[l]=r[l]}),o(a)?s.locale=a:b(a)&&(c=a),b(n)&&(c=n),[s.key||"",u,s,c]}function Ut(e,t,r){const a=e;for(const n in r){const s=`${t}__${n}`;a.__numberFormatters.has(s)&&a.__numberFormatters.delete(s)}}ke();export{R as C,X as D,Ft as M,Tt as N,dt as a,Wt as b,yt as c,Ut as d,It as e,J as f,pt as g,gt as h,wt as i,Et as j,G as k,p as l,At as m,vt as n,Mt as o,ft as p,Dt as q,Lt as r,bt as s,Pt as t,Rt as u,Nt as v,St as w,kt as x,Ct as y};