New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →
Socket
Sign inDemoInstall
Socket

vue-i18n-routing

Package Overview
Dependencies
Maintainers
1
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-i18n-routing - npm Package Compare versions

Comparing version

to
0.0.0-99fc23c

12

dist/vue-i18n-routing.cjs.js

@@ -1,9 +0,5 @@

"use strict";var Xe=Object.defineProperty,Be=Object.defineProperties;var We=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var pe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var _e=(e,t,n)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))pe.call(t,n)&&_e(e,n,t[n]);if(G)for(var n of G(t))ge.call(t,n)&&_e(e,n,t[n]);return e},Q=(e,t)=>Be(e,We(t));var me=(e,t)=>{var n={};for(var o in e)pe.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&G)for(var o of G(e))t.indexOf(o)<0&&ge.call(e,o)&&(n[o]=e[o]);return n};Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var R=require("vue-demi"),Ge=require("@intlify/vue-i18n-bridge");/*!
* shared v9.2.0-beta.25
* (c) 2021 kazuya kawaguchi
"use strict";var Q=Object.defineProperty,Z=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var C=(e,t,a)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,b=(e,t)=>{for(var a in t||(t={}))w.call(t,a)&&C(e,a,t[a]);if(y)for(var a of y(t))z.call(t,a)&&C(e,a,t[a]);return e},O=(e,t)=>Z(e,ee(t));var X=(e,t)=>{var a={};for(var o in e)w.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&y)for(var o of y(e))t.indexOf(o)<0&&z.call(e,o)&&(a[o]=e[o]);return a};Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var _=require("vue-demi"),D=require("@intlify/vue-router-bridge"),te=require("@intlify/vue-i18n-bridge");function ae(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var oe=ae(D);/*!
* shared v9.2.0-beta.28
* (c) 2022 kazuya kawaguchi
* Released under the MIT License.
*/const be=Object.assign,M=e=>typeof e=="string",Je=e=>typeof e=="symbol",Ke={},ee=()=>{},V=Object.assign,Ye=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},z=Array.isArray,Ze=e=>te(e)==="[object Map]",Qe=e=>te(e)==="[object Set]",L=e=>typeof e=="function",et=e=>typeof e=="string",tt=e=>typeof e=="symbol",Re=e=>e!==null&&typeof e=="object",nt=e=>Re(e)&&L(e.then)&&L(e.catch),ot=Object.prototype.toString,te=e=>ot.call(e),rt=e=>te(e)==="[object Object]",xe=(e,t)=>!Object.is(e,t),st=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})};let ct;function lt(e,t){t=t||ct,t&&t.active&&t.effects.push(e)}const it=e=>(e.w&F)>0,ut=e=>(e.n&F)>0,ft=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=F},at=e=>{const{deps:t}=e;if(t.length){let n=0;for(let o=0;o<t.length;o++){const r=t[o];it(r)&&!ut(r)?r.delete(e):t[n++]=r,r.w&=~F,r.n&=~F}t.length=n}};let J=0,F=1;const Ee=30,q=[];let ye;class dt{constructor(t,n=null,o){this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],lt(this,o)}run(){if(!this.active)return this.fn();if(!q.includes(this))try{return q.push(ye=this),ht(),F=1<<++J,J<=Ee?ft(this):Pe(this),this.fn()}finally{J<=Ee&&at(this),F=1<<--J,q.pop();const t=q.length;ye=t>0?q[t-1]:void 0}}stop(){this.active&&(Pe(this),this.onStop&&this.onStop(),this.active=!1)}}function Pe(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}function ht(){}new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(tt));function N(e){return pt(e)?N(e.__v_raw):!!(e&&e.__v_isReactive)}function pt(e){return!!(e&&e.__v_isReadonly)}function gt(e){return st(e,"__v_skip",!0),e}function $(e){return Boolean(e&&e.__v_isRef===!0)}function _t(e){return $(e)?e.value:e}const mt={get:(e,t,n)=>_t(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return $(r)&&!$(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function bt(e){return N(e)?e:new Proxy(e,mt)}Promise.resolve();let Rt=null;function xt(e,t){t&&t.pendingBranch?z(e)?t.effects.push(...e):t.effects.push(e):At(e)}function ve(e,t,n=!1){const o=A||Rt;if(o){const r=o.parent==null?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides;if(r&&e in r)return r[e];if(arguments.length>1)return n&&L(t)?t.call(o.proxy):t}}function Et(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:l,config:{optionMergeStrategies:u}}=e.appContext,f=l.get(t);let a;return f?a=f:!r.length&&!n&&!o?a=t:(a={},r.length&&r.forEach(h=>K(a,h,u,!0)),K(a,t,u)),l.set(t,a),a}function K(e,t,n,o=!1){const{mixins:r,extends:l}=t;l&&K(e,l,n,!0),r&&r.forEach(u=>K(e,u,n,!0));for(const u in t)if(!(o&&u==="expose")){const f=yt[u]||n&&n[u];e[u]=f?f(e[u],t[u]):t[u]}return e}const yt={data:Se,props:T,emits:T,methods:T,computed:T,beforeCreate:x,created:x,beforeMount:x,mounted:x,beforeUpdate:x,updated:x,beforeDestroy:x,beforeUnmount:x,destroyed:x,unmounted:x,activated:x,deactivated:x,errorCaptured:x,serverPrefetch:x,components:T,directives:T,watch:vt,provide:Se,inject:Pt};function Se(e,t){return t?e?function(){return V(L(e)?e.call(this,this):e,L(t)?t.call(this,this):t)}:t:e}function Pt(e,t){return T(Ie(e),Ie(t))}function Ie(e){if(z(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function x(e,t){return e?[...new Set([].concat(e,t))]:t}function T(e,t){return e?V(V(Object.create(null),e),t):t}function vt(e,t){if(!e)return t;if(!t)return e;const n=V(Object.create(null),e);for(const o in t)n[o]=x(e[o],t[o]);return n}const Le=xt,ne=e=>e?It(e)?Lt(e)||e.proxy:ne(e.parent):null,$e=V(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ne(e.parent),$root:e=>ne(e.root),$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?Et(e):e.type,$forceUpdate:e=>()=>Ft(e.update),$nextTick:e=>wt.bind(e.proxy),$watch:e=>__VUE_OPTIONS_API__?jt.bind(e):ee});let A=null;const we=e=>{A=e,e.scope.on()},St=()=>{A&&A.scope.off(),A=null};function It(e){return e.vnode.shapeFlag&4}function Lt(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(bt(gt(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in $e)return $e[n](e)}}))}function j(e,t,n,o){let r;try{r=o?e(...o):e()}catch(l){Oe(l,t,n)}return r}function oe(e,t,n,o){if(L(e)){const l=j(e,t,n,o);return l&&nt(l)&&l.catch(u=>{Oe(u,t,n)}),l}const r=[];for(let l=0;l<e.length;l++)r.push(oe(e[l],t,n,o));return r}function Oe(e,t,n,o=!0){const r=t?t.vnode:null;if(t){let l=t.parent;const u=t.proxy,f=n;for(;l;){const h=l.ec;if(h){for(let s=0;s<h.length;s++)if(h[s](e,u,f)===!1)return}l=l.parent}const a=t.appContext.config.errorHandler;if(a){j(a,null,10,[e,u,f]);return}}$t(e,n,r,o)}function $t(e,t,n,o=!0){console.error(e)}let Y=!1,re=!1;const P=[];let w=0;const H=[];let X=null,k=0;const B=[];let O=null,U=0;const Fe=Promise.resolve();let se=null,ce=null;function wt(e){const t=se||Fe;return e?t.then(this?e.bind(this):e):t}function Ot(e){let t=w+1,n=P.length;for(;t<n;){const o=t+n>>>1;W(P[o])<e?t=o+1:n=o}return t}function Ft(e){(!P.length||!P.includes(e,Y&&e.allowRecurse?w+1:w))&&e!==ce&&(e.id==null?P.push(e):P.splice(Ot(e.id),0,e),Te())}function Te(){!Y&&!re&&(re=!0,se=Fe.then(Me))}function Ae(e,t,n,o){z(e)?n.push(...e):(!t||!t.includes(e,e.allowRecurse?o+1:o))&&n.push(e),Te()}function Tt(e){Ae(e,X,H,k)}function At(e){Ae(e,O,B,U)}function Ce(e,t=null){if(H.length){for(ce=t,X=[...new Set(H)],H.length=0,k=0;k<X.length;k++)X[k]();X=null,k=0,ce=null,Ce(e,t)}}function Ct(e){if(B.length){const t=[...new Set(B)];if(B.length=0,O){O.push(...t);return}for(O=t,O.sort((n,o)=>W(n)-W(o)),U=0;U<O.length;U++)O[U]();O=null,U=0}}const W=e=>e.id==null?1/0:e.id;function Me(e){re=!1,Y=!0,Ce(e),P.sort((n,o)=>W(n)-W(o));const t=ee;try{for(w=0;w<P.length;w++){const n=P[w];n&&n.active!==!1&&j(n,null,14)}}finally{w=0,P.length=0,Ct(),Y=!1,se=null,(P.length||H.length||B.length)&&Me(e)}}const je={};function Mt(e,t,{immediate:n,deep:o,flush:r,onTrack:l,onTrigger:u}=Ke){const f=A;let a,h=!1,s=!1;if($(e)?(a=()=>e.value,h=!!e._shallow):N(e)?(a=()=>e,o=!0):z(e)?(s=!0,h=e.some(N),a=()=>e.map(c=>{if($(c))return c.value;if(N(c))return D(c);if(L(c))return j(c,f,2)})):L(e)?t?a=()=>j(e,f,2):a=()=>{if(!(f&&f.isUnmounted))return b&&b(),oe(e,f,3,[E])}:a=ee,t&&o){const c=a;a=()=>D(c())}let b,E=c=>{b=i.onStop=()=>{j(c,f,4)}},g=s?[]:je;const m=()=>{if(!!i.active)if(t){const c=i.run();(o||h||(s?c.some((_,p)=>xe(_,g[p])):xe(c,g)))&&(b&&b(),oe(t,f,3,[c,g===je?void 0:g,E]),g=c)}else i.run()};m.allowRecurse=!!t;let d;r==="sync"?d=m:r==="post"?d=()=>Le(m,f&&f.suspense):d=()=>{!f||f.isMounted?Tt(m):m()};const i=new dt(a,d);return t?n?m():g=i.run():r==="post"?Le(i.run.bind(i),f&&f.suspense):i.run(),()=>{i.stop(),f&&f.scope&&Ye(f.scope.effects,i)}}function jt(e,t,n){const o=this.proxy,r=et(e)?e.includes(".")?kt(o,e):()=>o[e]:e.bind(o,o);let l;L(t)?l=t:(l=t.handler,n=t);const u=A;we(this);const f=Mt(r,l.bind(o),n);return u?we(u):St(),f}function kt(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r<n.length&&o;r++)o=o[n[r]];return o}}function D(e,t){if(!Re(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),$(e))D(e.value,t);else if(z(e))for(let n=0;n<e.length;n++)D(e[n],t);else if(Qe(e)||Ze(e))e.forEach(n=>{D(n,t)});else if(rt(e))for(const n in e)D(e[n],t);return e}function Ut(e){e=e||[];const t=[];for(const n of e)M(n)?t.push({code:n}):t.push(n);return t}function le(e,t){return $(e.locale)&&t==="composition"}function ke(e){return"global"in e&&"mode"in e}function ie(e){return ke(e)?le(e.global,e.mode)?e.global.locale.value:e.global.locale:$(e.locale)?e.locale.value:e.locale}function Ue(e,t){ke(e)?le(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:$(e.locale)&&(e.locale.value=t)}function Dt(e,t,n){return e.replace(/\/+$/,"")+(t?"/":"")||(n?"":"/")}function Vt(e,{localeCodes:t=[]}={}){if(!le(e.global,e.mode))throw new Error("");const n=R.ref(t);e.global.locales=R.computed(()=>n.value),console.log("... extends i18n done")}const zt={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},ue="",De=zt.PREFIX_EXCEPT_DEFAULT,fe=!1,ae="___",de="default";function he(e,{defaultLocale:t=ue,strategy:n=De,trailingSlash:o=fe,routesNameSeparator:r=ae,defaultLocaleRouteNameSuffix:l=de,includeUprefixedFallback:u=!1,localeCodes:f=[]}={}){if(n==="no_prefix")return e;const a=f.map(s=>M(s)?s:s.code);function h(s,b,E=!1,g=!1){return s.redirect&&(!s.component||!s.file)?[s]:b.reduce((d,i)=>{const{name:c}=s;let{path:_}=s;const p=C({},s);c&&(p.name=`${c}${r}${i}`),s.children&&(p.children=s.children.reduce((S,Z)=>[...S,...h(Z,[i],!0,g)],[]));const I=i===t;if(I&&n==="prefix_and_default")if(E)E&&g&&c&&(p.name+=`${r}${l}`);else{const S=Q(C({},p),{path:_});if(c&&(S.name=`${p.name}${r}${l}`),s.children){S.children=[];for(const Z of s.children)S.children=S.children.concat(h(Z,[i],!0,!0))}d.push(S)}const y=E&&!_.startsWith("/"),v=!y&&!(I&&n==="prefix_except_default");return v&&(_=`/${i}${_}`),_&&(_=Dt(_,o,y)),v&&I&&n==="prefix"&&u&&d.push(C({},s)),p.path=_,d.push(p),d},[])}return e.reduce((s,b)=>[...s,...h(b,a||[])],[])}function qt(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function Nt(e,t,n){const o=`(${e.join("|")})`,r=`(?:${t}${n})?`,l=new RegExp(`${t}${o}${r}$`,"i"),u=qt(e);return a=>{if(a.name){const s=(M(a.name)?a.name:a.name.toString()).match(l);if(s&&s.length>1)return s[1]}else if(a.path){const h=a.path.match(u);if(h&&h.length>1)return h[1]}return""}}function Ht({router:e,i18n:t,defaultLocale:n=ue,strategy:o=De,trailingSlash:r=fe,routesNameSeparator:l=ae,defaultLocaleRouteNameSuffix:u=de,localeCodes:f=[]}={}){const a=Ut(f),h=Nt(a.map(s=>s.code),l,u);if(Vt(t,{localeCodes:a}),R.isVue2){const s=e,b=s.constructor,E=s.options.routes||[],g=he(E,{localeCodes:f,defaultLocale:n,strategy:o,trailingSlash:r,routesNameSeparator:l,defaultLocaleRouteNameSuffix:u});console.log("vue2 routes",E,g);const m=new b({mode:"history",base:s.options.base,routes:g});return m.__defaultLocale=n,m.__strategy=o,m.__trailingSlash=r,m.__routesNameSeparator=l,m.__defaultLocaleRouteNameSuffix=u,m.beforeEach((d,i,c)=>{console.log("beforeEach",d,i);const _=ie(t),p=h(d)||_||n||"";console.log("currentLocale",_,"finalLocale",p),_!==p&&Ue(t,p),c()}),m}else{const s=e,b=s.options.routes||[],E=he(b,{localeCodes:f,defaultLocale:n,strategy:o,trailingSlash:r,routesNameSeparator:l,defaultLocaleRouteNameSuffix:u});return console.log("vue3 routes",b,E,s),b.forEach(g=>s.removeRoute(g.name)),E.forEach(g=>s.addRoute(g)),s.__defaultLocale=n,s.__strategy=o,s.__trailingSlash=r,s.__routesNameSeparator=l,s.__defaultLocaleRouteNameSuffix=u,s.beforeEach((g,m,d)=>{console.log("beforeEach",g,m);const i=ie(t),c=h(g)||i||n||"";console.log("currentLocale",i,"finalLocale",c),i!==c&&Ue(t,c),d()}),s}}const Xt=()=>{const e=R.getCurrentInstance();if(e==null)throw new Error("should be used in setup");return e.$router},Bt=()=>{const e=R.getCurrentInstance();if(e==null)throw new Error("should be used in setup");return R.computed(()=>e.$route)};/*!
* vue-router v4.0.12
* (c) 2021 Eduardo San Martin Morote
* @license MIT
*/const Wt=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Ve=e=>Wt?Symbol(e):"_vr_"+e,Gt=Ve("r"),Jt=Ve("rl");var ze;(function(e){e.pop="pop",e.push="push"})(ze||(ze={}));var qe;(function(e){e.back="back",e.forward="forward",e.unknown=""})(qe||(qe={}));var Ne;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(Ne||(Ne={}));function Kt(){return ve(Gt)}function Yt(){return ve(Jt)}function Zt(){return R.isVue2?Bt():Yt()}function Qt(){return R.isVue2?Xt():Kt()}function en(e={}){const t=Ge.useI18n(),n=Qt(),o=Zt(),r=e.defaultLocaleRouteNameSuffix||n.__defaultLocaleRouteNameSuffix,l=e.defaultLocale||n.__defaultLocale,u=e.routesNameSeparator||n.__routesNameSeparator,f=e.strategy||n.__strategy;function a(d){const i=d!=null?d:R.isRef(o)?o.value:o;return i.name?He(i.name).split(u)[0]:void 0}function h(d,i){let c=He(d)+(f==="no_prefix"?"":u+i);return i===l&&f==="prefix_and_default"&&(c+=u+r),c}function s(d,i){const c=i||ie(t);let _=d;M(d)&&(d[0]==="/"?_={path:d}:_={name:d});let p=be({},_);if(p.path&&!p.name){const y=n.resolve(p),v=R.isVue2?y.route:y,S=a(v);M(S)&&(p={name:h(S,c),params:v.params,query:v.query,hash:v.hash})}else{p.name=h(p.name,c);const{params:y}=p;y&&y["0"]===void 0&&y.pathMatch&&(y["0"]=y.pathMatch)}const I=n.resolve(p);return(R.isVue2?I.route.name:I.name)?I:n.resolve(d)}function b(d,i){const c=s(d,i);return c==null?"":R.isVue2?c.route.redirectedFrom||c.route.fullPath:c.redirectedFrom||c.fullPath}function E(d,i){const c=s(d,i);return c==null?void 0:R.isVue2?c.route:c}function g(d,i){const c=s(d,i);return c==null?void 0:R.isVue2?c.location:c.href}function m(d){const i=a();if(!i)return"";const v=R.isVue2&&R.isRef(o)?o.value:o,{params:c}=v,_=me(v,["params"]),p={},I=be({},_,{name:i,params:Q(C(C({},c),p),{0:c.pathMatch})}),y=b(I,d);return console.log("switchLocalePath",t.locale.value,d,y),y}return{localePath:b,localeRoute:E,localeLocation:g,switchLocalePath:m}}function He(e){return M(e)?e:Je(e)?e.toString():""}function tn({router:e,i18n:t,defaultLocale:n=ue,trailingSlash:o=fe,routesNameSeparator:r=ae,defaultLocaleRouteNameSuffix:l=de,localeCodes:u=[]}={}){if(e==null)throw new Error("TODO");return Ht({router:e,i18n:t,defaultLocale:n,trailingSlash:o,routesNameSeparator:r,defaultLocaleRouteNameSuffix:l,localeCodes:u})}const nn="";exports.VERSION=nn;exports.extendRouting=tn;exports.localizeRoutes=he;exports.useI18nRouting=en;
*/const M=Object.assign,I=e=>typeof e=="string",le=e=>typeof e=="symbol";function ne(e){e=e||[];const t=[];for(const a of e)I(a)?t.push({code:a}):t.push(a);return t}function V(e,t){return _.isRef(e.locale)&&t==="composition"}function j(e){return"global"in e&&"mode"in e}function q(e){return j(e)?V(e.global,e.mode)?e.global.locale.value:e.global.locale:e.locale.value}function re(e,t){j(e)?V(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:_.isRef(e.locale)&&(e.locale.value=t)}function ue(e,t,a){return e.replace(/\/+$/,"")+(t?"/":"")||(a?"":"/")}function G(e){return I(e)?e:le(e)?e.toString():"(null)"}function B(e,t,{defaultLocale:a,strategy:o,routesNameSeparator:c,defaultLocaleRouteNameSuffix:i}){let s=G(e)+(o==="no_prefix"?"":c+t);return t===a&&o==="prefix_and_default"&&(s+=c+i),s}function ce(e={}){var m,L,S,p,R,h,P;const t=(m=e.i18n)!=null?m:te.useI18n(),a=(L=e.router)!=null?L:D.useRouter(),o=(S=e.route)!=null?S:D.useRoute(),c=(p=e.defaultLocaleRouteNameSuffix)!=null?p:a.__defaultLocaleRouteNameSuffix,i=(R=e.defaultLocale)!=null?R:a.__defaultLocale,s=(h=e.routesNameSeparator)!=null?h:a.__routesNameSeparator,g=(P=e.strategy)!=null?P:a.__strategy;function u(r){const f=r!=null?r:_.isRef(o)?o.value:o;return f.name?G(f.name).split(s)[0]:null}function d(r,f){const n=f||q(t);let x=r;I(r)&&(r[0]==="/"?x={path:r}:x={name:r});let E=M({},x);if(E.path&&!E.name){const v=a.resolve(E),T=_.isVue2?v.route:v,U=u(T);I(U)&&(E={name:B(U,n,{defaultLocale:i,strategy:g,routesNameSeparator:s,defaultLocaleRouteNameSuffix:c}),params:T.params,query:T.query,hash:T.hash})}else{E.name=B(E.name,n,{defaultLocale:i,strategy:g,routesNameSeparator:s,defaultLocaleRouteNameSuffix:c});const{params:v}=E;v&&v["0"]===void 0&&v.pathMatch&&(v["0"]=v.pathMatch)}const N=a.resolve(E);return(_.isVue2?N.route.name:N.name)?N:a.resolve(r)}function l(r,f){const n=d(r,f);return n==null?"":_.isVue2?n.route.redirectedFrom||n.route.fullPath:n.redirectedFrom||n.fullPath}function $(r,f){const n=d(r,f);return n==null?void 0:_.isVue2?n.route:n}function F(r,f){const n=d(r,f);return n==null?void 0:_.isVue2?n.location:n}function A(r){const f=u();if(!f)return"";const T=_.isVue2&&_.isRef(o)?o.value:o,{params:n}=T,x=X(T,["params"]),E={},N=M({},x,{name:f,params:O(b(b({},n),E),{0:n.pathMatch})}),v=l(N,r);return console.log("switchLocalePath",t.locale.value,r,v),v}return{getRouteBaseName:u,localePath:l,localeRoute:$,localeLocation:F,switchLocalePath:A}}const se={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},W="",k=se.PREFIX_EXCEPT_DEFAULT,H=!1,Y="___",J="default";function K(e,{defaultLocale:t=W,strategy:a=k,trailingSlash:o=H,routesNameSeparator:c=Y,defaultLocaleRouteNameSuffix:i=J,includeUprefixedFallback:s=!1,locales:g=[]}={}){if(a==="no_prefix")return e;const u=g.map(l=>I(l)?l:l.code);function d(l,$,F=!1,A=!1){return l.redirect&&(!l.component||!l.file)?[l]:$.reduce((L,S)=>{const{name:p}=l;let{path:R}=l;const h=b({},l);p&&(h.name=`${p}${c}${S}`),l.children&&(h.children=l.children.reduce((n,x)=>[...n,...d(x,[S],!0,A)],[]));const P=S===t;if(P&&a==="prefix_and_default")if(F)F&&A&&p&&(h.name+=`${c}${i}`);else{const n=O(b({},h),{path:R});if(p&&(n.name=`${h.name}${c}${i}`),l.children){n.children=[];for(const x of l.children)n.children=n.children.concat(d(x,[S],!0,!0))}L.push(n)}const r=F&&!R.startsWith("/"),f=!r&&!(P&&a==="prefix_except_default");return f&&(R=`/${S}${R}`),R&&(R=ue(R,o,r)),f&&P&&a==="prefix"&&s&&L.push(b({},l)),h.path=R,L.push(h),L},[])}return e.reduce((l,$)=>[...l,...d($,u||[])],[])}function fe(e,{locales:t=[]}={}){if(!V(e.global,e.mode))throw new Error("TODO:");const a=_.ref(t);e.global.locales=_.computed(()=>a.value)}function ie(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function de(e,t,a){const o=`(${e.join("|")})`,c=`(?:${t}${a})?`,i=new RegExp(`${t}${o}${c}$`,"i"),s=ie(e);return u=>{if(u.name){const l=(I(u.name)?u.name:u.name.toString()).match(i);if(l&&l.length>1)return l[1]}else if(u.path){const d=u.path.match(s);if(d&&d.length>1)return d[1]}return""}}function me(e){var t,a,o,c,i,s,g,u;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(a=e.defaultLocale)!=null?a:W,e.strategy=(o=e.strategy)!=null?o:k,e.trailingSlash=(c=e.trailingSlash)!=null?c:H,e.routesNameSeparator=(i=e.routesNameSeparator)!=null?i:Y,e.defaultLocaleRouteNameSuffix=(s=e.defaultLocaleRouteNameSuffix)!=null?s:J,e.locales=(g=e.locales)!=null?g:[],e.routes=(u=e.routes)!=null?u:[],e}function Re(e,t={}){const{version:a,defaultLocale:o,locales:c,strategy:i,trailingSlash:s,routesNameSeparator:g,defaultLocaleRouteNameSuffix:u,routes:d}=me(t),l=ne(c),$=l.map(L=>L.code),F=de($,g,u);fe(e,{locales:l});const A=K(d,{locales:c,defaultLocale:o,strategy:i,trailingSlash:s,routesNameSeparator:g,defaultLocaleRouteNameSuffix:u});t.routes=A;let m=null;if(_.isVue3&&a===4)m=D.createRouter(t);else if(_.isVue2&&a===3)m=new oe.default(t);else throw new Error("TODO:");return m.__defaultLocale=o,m.__localeCodes=$,m.__strategy=i,m.__trailingSlash=s,m.__routesNameSeparator=g,m.__defaultLocaleRouteNameSuffix=u,m.beforeEach((L,S,p)=>{const R=q(e),h=F(L)||R||o||"";R!==h&&re(e,h),p()}),m}const _e="0.0.0";exports.VERSION=_e;exports.createRouter=Re;exports.localizeRoutes=K;exports.useI18nRouting=ce;

@@ -1,11 +0,35 @@

import type { I18n } from 'vue-i18n';
import { Locale } from 'vue-i18n';
import type { Route as Route_2 } from 'vue-router3';
import type { RouteConfig } from 'vue-router3';
import type { RouteLocationNormalizedLoaded } from 'vue-router';
import type { Router } from 'vue-router';
import VueI18n from 'vue-i18n-legacy';
import VueRouter from 'vue-router3';
import type { I18n } from '@intlify/vue-i18n-bridge';
import { Locale } from '@intlify/vue-i18n-bridge';
import type { Location as Location_2 } from '@intlify/vue-router-bridge';
import type { RawLocation } from '@intlify/vue-router-bridge';
import type { Route as Route_2 } from '@intlify/vue-router-bridge';
import type { RouteConfig } from '@intlify/vue-router-bridge';
import type { RouteLocation } from '@intlify/vue-router-bridge';
import type { RouteLocationNormalizedLoaded } from '@intlify/vue-router-bridge';
import type { RouteLocationRaw } from '@intlify/vue-router-bridge';
import type { Router } from '@intlify/vue-router-bridge';
import type { RouterOptions } from '@intlify/vue-router-bridge';
import { useI18n } from '@intlify/vue-i18n-bridge';
import { useRoute } from '@intlify/vue-router-bridge';
import { useRouter } from '@intlify/vue-router-bridge';
import type { VueRouter } from '@intlify/vue-router-bridge';
/**
* Create a Vue Router instance
*
* @param i18n - A Vue I18n instance, see [Vue I18n API docs](https://vue-i18n.intlify.dev/api/general.html#i18n)
* @param options - An options, see {@link VueI18nRoutingOptions}
*
* @returns A Vue Router instance
*
* @remakrs
* You can create a vue router instance to be used by the Vue app.
*
* The routes of the created router instance are handled with i18n routing.
*
* At the Vue 2 will return a [Vue Router v3 instance](https://router.vuejs.org/api/#router-construction-options), and at the Vue 3 will return a [Vue Router v4 instance](https://next.router.vuejs.org/api/#createrouter).
*/
export declare function createRouter<Options extends VueI18nRoutingOptions = VueI18nRoutingOptions>(i18n: I18n, options?: Options): Options['version'] extends 4 ? Router : VueRouter;
/**
* Direction

@@ -15,16 +39,16 @@ */

export declare function extendRouting<TRouter extends VueRouter | Router>({ router, i18n, defaultLocale, trailingSlash, routesNameSeparator, defaultLocaleRouteNameSuffix, localeCodes }?: VueI18nRoutingOptions): TRouter;
export declare interface I18nRouting {
getRouteBaseName(givenRoute?: Route_2 | RouteLocationNormalizedLoaded): string | null;
localePath(route: RawLocation | RouteLocationRaw, locale?: Locale): string;
localeRoute(route: RawLocation | RouteLocationRaw, locale?: Locale): Route_2 | ReturnType<Router['resolve']>;
localeLocation(route: RawLocation | RouteLocationRaw, locale?: Locale): Location_2 | RouteLocation;
switchLocalePath(locale: Locale): void;
}
export declare type I18nRoutingOptions = Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'localeCodes'> & {
routesNameSeparator?: string;
export declare type I18nRoutingOptions = Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'locales' | 'routesNameSeparator'> & {
route?: ReturnType<typeof useRoute>;
router?: ReturnType<typeof useRouter>;
i18n?: ReturnType<typeof useI18n>;
};
export declare interface I18nRoutingReturn {
getRouteBaseName(givenRoute?: Route_2 | RouteLocationNormalizedLoaded): string;
localePath(route: any, locale?: Locale): string;
localeRoute(route: any, locale?: Locale): any;
localeLocation(route: any, locale?: Locale): any;
switchLocalePath(locale: Locale): void;
}
/**

@@ -43,3 +67,3 @@ * Locale object

export declare function localizeRoutes(routes: VueI18nRoute[], { defaultLocale, strategy, trailingSlash, routesNameSeparator, defaultLocaleRouteNameSuffix, includeUprefixedFallback, localeCodes }?: Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'localeCodes' | 'routesNameSeparator' | 'trailingSlash' | 'defaultLocaleRouteNameSuffix'> & {
export declare function localizeRoutes(routes: VueI18nRoute[], { defaultLocale, strategy, trailingSlash, routesNameSeparator, defaultLocaleRouteNameSuffix, includeUprefixedFallback, locales }?: Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'locales' | 'routesNameSeparator' | 'trailingSlash' | 'defaultLocaleRouteNameSuffix'> & {
includeUprefixedFallback?: boolean;

@@ -84,3 +108,3 @@ }): VueI18nRoute[];

export declare function useI18nRouting<Legacy extends boolean = false>(options?: I18nRoutingOptions): I18nRoutingReturn;
export declare function useI18nRouting(options?: I18nRoutingOptions): I18nRouting;

@@ -93,3 +117,3 @@ /**

*/
export declare const VERSION = "";
export declare const VERSION: string;

@@ -104,28 +128,86 @@ /**

/**
* Vue I18n routing options
* Options to initialize a VueRouter instance
*
* @remarks
* This options is extended from Vue Router `RouterOptioins`, so you can specify those options.
*/
export declare interface VueI18nRoutingOptions {
export declare type VueI18nRoutingOptions = {
/**
* Vue Router instance
* Vue Router version
*
* @remarks
* You can choice between vue-router v3 and v4.
*
* If you specify `3`, this function return Vue Router v3 instance, else specify `4`, this function return Vue Router v4 instance.
*
* @defaultValue 4
*/
router?: VueRouter | Router;
version?: 3 | 4;
/**
* Vue I18n instance
* The app's default locale
*
* @remarks
* When using `prefix_except_default` strategy, URLs for locale specified here won't have a prefix.
*
* It's recommended to set this to some locale regardless of chosen strategy, as it will be used as a fallback locale when navigating to a non-existent route
*
* @defaultValue '' (emputy string)
*/
i18n?: VueI18n | I18n;
defaultLocale?: string;
localeCodes?: string[] | LocaleObject[];
/**
* List of locales supported by your app
*
* @remarks TODO:
*
* @defaultValue []
*/
locales?: string[] | LocaleObject[];
/**
* Routes strategy
*
* @remarks
* Can be set to one of the following:
*
* - `no_prefix`: routes won't have a locale prefix
* - `prefix_except_default`: locale prefix added for every locale except default
* - `prefix`: locale prefix added for every locale
* - `prefix_and_default`: locale prefix added for every locale and default
*
* @defaultValue 'prefix_except_default'
*/
strategy?: Strategies;
/**
* Whether to use trailing slash
*
* @defaultValue false
*/
trailingSlash?: boolean;
/**
* Internal separator used for generated route names for each locale. You shouldn't need to change this
*
* @defaultValue '___'
*/
routesNameSeparator?: string;
/**
* Internal suffix added to generated route names for default locale
*
* @remarks
* if strategy is prefix_and_default. You shouldn't need to change this.
*
* @defaultValue 'default'
*/
defaultLocaleRouteNameSuffix?: string;
}
} & RouterOptions;
export { }
import type { ComputedRef } from 'vue'
declare module 'vue-i18n' {
export interface ComposerCustom {
locales: ComputedRef<string[] | LocaleObject[]>
locales: ComputedRef<LocaleObject[]>
}
}
declare module 'vue-i18n-bridge' {
export interface ComposerCustom {
locales: ComputedRef<LocaleObject[]>
}
}

@@ -32,688 +32,13 @@ var __defProp = Object.defineProperty;

};
import { ref, computed, isVue2, getCurrentInstance, isRef as isRef$1 } from "vue-demi";
import { isRef, isVue2, ref, computed, isVue3 } from "vue-demi";
import VueRouter3, { useRouter, useRoute, createRouter as createRouter$1 } from "@intlify/vue-router-bridge";
import { useI18n } from "@intlify/vue-i18n-bridge";
/*!
* shared v9.2.0-beta.25
* (c) 2021 kazuya kawaguchi
* shared v9.2.0-beta.28
* (c) 2022 kazuya kawaguchi
* Released under the MIT License.
*/
const assign = Object.assign;
const isString$1 = (val) => typeof val === "string";
const isSymbol$1 = (val) => typeof val === "symbol";
const EMPTY_OBJ = {};
const NOOP = () => {
};
const extend = Object.assign;
const remove = (arr, el) => {
const i = arr.indexOf(el);
if (i > -1) {
arr.splice(i, 1);
}
};
const isArray = Array.isArray;
const isMap = (val) => toTypeString(val) === "[object Map]";
const isSet = (val) => toTypeString(val) === "[object Set]";
const isFunction = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isSymbol = (val) => typeof val === "symbol";
const isObject = (val) => val !== null && typeof val === "object";
const isPromise = (val) => {
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const def = (obj, key, value) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
value
});
};
let activeEffectScope;
function recordEffectScope(effect, scope) {
scope = scope || activeEffectScope;
if (scope && scope.active) {
scope.effects.push(effect);
}
}
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].w |= trackOpBit;
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i = 0; i < deps.length; i++) {
const dep = deps[i];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
} else {
deps[ptr++] = dep;
}
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
let effectTrackDepth = 0;
let trackOpBit = 1;
const maxMarkerBits = 30;
const effectStack = [];
let activeEffect;
class ReactiveEffect {
constructor(fn, scheduler = null, scope) {
this.fn = fn;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
recordEffectScope(this, scope);
}
run() {
if (!this.active) {
return this.fn();
}
if (!effectStack.includes(this)) {
try {
effectStack.push(activeEffect = this);
enableTracking();
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
} else {
cleanupEffect(this);
}
return this.fn();
} finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
effectStack.pop();
const n = effectStack.length;
activeEffect = n > 0 ? effectStack[n - 1] : void 0;
}
}
}
stop() {
if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanupEffect(effect) {
const { deps } = effect;
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].delete(effect);
}
deps.length = 0;
}
}
function enableTracking() {
}
new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol));
function isReactive(value) {
if (isReadonly(value)) {
return isReactive(value["__v_raw"]);
}
return !!(value && value["__v_isReactive"]);
}
function isReadonly(value) {
return !!(value && value["__v_isReadonly"]);
}
function markRaw(value) {
def(value, "__v_skip", true);
return value;
}
function isRef(r) {
return Boolean(r && r.__v_isRef === true);
}
function unref(ref2) {
return isRef(ref2) ? ref2.value : ref2;
}
const shallowUnwrapHandlers = {
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
set: (target, key, value, receiver) => {
const oldValue = target[key];
if (isRef(oldValue) && !isRef(value)) {
oldValue.value = value;
return true;
} else {
return Reflect.set(target, key, value, receiver);
}
}
};
function proxyRefs(objectWithRefs) {
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
}
Promise.resolve();
let currentRenderingInstance = null;
function queueEffectWithSuspense(fn, suspense) {
if (suspense && suspense.pendingBranch) {
if (isArray(fn)) {
suspense.effects.push(...fn);
} else {
suspense.effects.push(fn);
}
} else {
queuePostFlushCb(fn);
}
}
function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance;
if (instance) {
const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
if (provides && key in provides) {
return provides[key];
} else if (arguments.length > 1) {
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
} else
;
}
}
function resolveMergedOptions(instance) {
const base = instance.type;
const { mixins, extends: extendsOptions } = base;
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
const cached = cache.get(base);
let resolved;
if (cached) {
resolved = cached;
} else if (!globalMixins.length && !mixins && !extendsOptions) {
{
resolved = base;
}
} else {
resolved = {};
if (globalMixins.length) {
globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));
}
mergeOptions(resolved, base, optionMergeStrategies);
}
cache.set(base, resolved);
return resolved;
}
function mergeOptions(to, from, strats, asMixin = false) {
const { mixins, extends: extendsOptions } = from;
if (extendsOptions) {
mergeOptions(to, extendsOptions, strats, true);
}
if (mixins) {
mixins.forEach((m) => mergeOptions(to, m, strats, true));
}
for (const key in from) {
if (asMixin && key === "expose")
;
else {
const strat = internalOptionMergeStrats[key] || strats && strats[key];
to[key] = strat ? strat(to[key], from[key]) : from[key];
}
}
return to;
}
const internalOptionMergeStrats = {
data: mergeDataFn,
props: mergeObjectOptions,
emits: mergeObjectOptions,
methods: mergeObjectOptions,
computed: mergeObjectOptions,
beforeCreate: mergeAsArray,
created: mergeAsArray,
beforeMount: mergeAsArray,
mounted: mergeAsArray,
beforeUpdate: mergeAsArray,
updated: mergeAsArray,
beforeDestroy: mergeAsArray,
beforeUnmount: mergeAsArray,
destroyed: mergeAsArray,
unmounted: mergeAsArray,
activated: mergeAsArray,
deactivated: mergeAsArray,
errorCaptured: mergeAsArray,
serverPrefetch: mergeAsArray,
components: mergeObjectOptions,
directives: mergeObjectOptions,
watch: mergeWatchOptions,
provide: mergeDataFn,
inject: mergeInject
};
function mergeDataFn(to, from) {
if (!from) {
return to;
}
if (!to) {
return from;
}
return function mergedDataFn() {
return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
};
}
function mergeInject(to, from) {
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
}
function normalizeInject(raw) {
if (isArray(raw)) {
const res = {};
for (let i = 0; i < raw.length; i++) {
res[raw[i]] = raw[i];
}
return res;
}
return raw;
}
function mergeAsArray(to, from) {
return to ? [...new Set([].concat(to, from))] : from;
}
function mergeObjectOptions(to, from) {
return to ? extend(extend(Object.create(null), to), from) : from;
}
function mergeWatchOptions(to, from) {
if (!to)
return from;
if (!from)
return to;
const merged = extend(Object.create(null), to);
for (const key in from) {
merged[key] = mergeAsArray(to[key], from[key]);
}
return merged;
}
const queuePostRenderEffect = queueEffectWithSuspense;
const getPublicInstance = (i) => {
if (!i)
return null;
if (isStatefulComponent(i))
return getExposeProxy(i) || i.proxy;
return getPublicInstance(i.parent);
};
const publicPropertiesMap = extend(Object.create(null), {
$: (i) => i,
$el: (i) => i.vnode.el,
$data: (i) => i.data,
$props: (i) => i.props,
$attrs: (i) => i.attrs,
$slots: (i) => i.slots,
$refs: (i) => i.refs,
$parent: (i) => getPublicInstance(i.parent),
$root: (i) => getPublicInstance(i.root),
$emit: (i) => i.emit,
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
$forceUpdate: (i) => () => queueJob(i.update),
$nextTick: (i) => nextTick.bind(i.proxy),
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
});
let currentInstance = null;
const setCurrentInstance = (instance) => {
currentInstance = instance;
instance.scope.on();
};
const unsetCurrentInstance = () => {
currentInstance && currentInstance.scope.off();
currentInstance = null;
};
function isStatefulComponent(instance) {
return instance.vnode.shapeFlag & 4;
}
function getExposeProxy(instance) {
if (instance.exposed) {
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
get(target, key) {
if (key in target) {
return target[key];
} else if (key in publicPropertiesMap) {
return publicPropertiesMap[key](instance);
}
}
}));
}
}
function callWithErrorHandling(fn, instance, type, args) {
let res;
try {
res = args ? fn(...args) : fn();
} catch (err) {
handleError(err, instance, type);
}
return res;
}
function callWithAsyncErrorHandling(fn, instance, type, args) {
if (isFunction(fn)) {
const res = callWithErrorHandling(fn, instance, type, args);
if (res && isPromise(res)) {
res.catch((err) => {
handleError(err, instance, type);
});
}
return res;
}
const values = [];
for (let i = 0; i < fn.length; i++) {
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
}
return values;
}
function handleError(err, instance, type, throwInDev = true) {
const contextVNode = instance ? instance.vnode : null;
if (instance) {
let cur = instance.parent;
const exposedInstance = instance.proxy;
const errorInfo = type;
while (cur) {
const errorCapturedHooks = cur.ec;
if (errorCapturedHooks) {
for (let i = 0; i < errorCapturedHooks.length; i++) {
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
return;
}
}
}
cur = cur.parent;
}
const appErrorHandler = instance.appContext.config.errorHandler;
if (appErrorHandler) {
callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]);
return;
}
}
logError(err, type, contextVNode, throwInDev);
}
function logError(err, type, contextVNode, throwInDev = true) {
{
console.error(err);
}
}
let isFlushing = false;
let isFlushPending = false;
const queue = [];
let flushIndex = 0;
const pendingPreFlushCbs = [];
let activePreFlushCbs = null;
let preFlushIndex = 0;
const pendingPostFlushCbs = [];
let activePostFlushCbs = null;
let postFlushIndex = 0;
const resolvedPromise = Promise.resolve();
let currentFlushPromise = null;
let currentPreFlushParentJob = null;
function nextTick(fn) {
const p = currentFlushPromise || resolvedPromise;
return fn ? p.then(this ? fn.bind(this) : fn) : p;
}
function findInsertionIndex(id) {
let start = flushIndex + 1;
let end = queue.length;
while (start < end) {
const middle = start + end >>> 1;
const middleJobId = getId(queue[middle]);
middleJobId < id ? start = middle + 1 : end = middle;
}
return start;
}
function queueJob(job) {
if ((!queue.length || !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) && job !== currentPreFlushParentJob) {
if (job.id == null) {
queue.push(job);
} else {
queue.splice(findInsertionIndex(job.id), 0, job);
}
queueFlush();
}
}
function queueFlush() {
if (!isFlushing && !isFlushPending) {
isFlushPending = true;
currentFlushPromise = resolvedPromise.then(flushJobs);
}
}
function queueCb(cb, activeQueue, pendingQueue, index) {
if (!isArray(cb)) {
if (!activeQueue || !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
pendingQueue.push(cb);
}
} else {
pendingQueue.push(...cb);
}
queueFlush();
}
function queuePreFlushCb(cb) {
queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
}
function queuePostFlushCb(cb) {
queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
}
function flushPreFlushCbs(seen, parentJob = null) {
if (pendingPreFlushCbs.length) {
currentPreFlushParentJob = parentJob;
activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
pendingPreFlushCbs.length = 0;
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
activePreFlushCbs[preFlushIndex]();
}
activePreFlushCbs = null;
preFlushIndex = 0;
currentPreFlushParentJob = null;
flushPreFlushCbs(seen, parentJob);
}
}
function flushPostFlushCbs(seen) {
if (pendingPostFlushCbs.length) {
const deduped = [...new Set(pendingPostFlushCbs)];
pendingPostFlushCbs.length = 0;
if (activePostFlushCbs) {
activePostFlushCbs.push(...deduped);
return;
}
activePostFlushCbs = deduped;
activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
activePostFlushCbs[postFlushIndex]();
}
activePostFlushCbs = null;
postFlushIndex = 0;
}
}
const getId = (job) => job.id == null ? Infinity : job.id;
function flushJobs(seen) {
isFlushPending = false;
isFlushing = true;
flushPreFlushCbs(seen);
queue.sort((a, b) => getId(a) - getId(b));
const check = NOOP;
try {
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex];
if (job && job.active !== false) {
if (false)
;
callWithErrorHandling(job, null, 14);
}
}
} finally {
flushIndex = 0;
queue.length = 0;
flushPostFlushCbs();
isFlushing = false;
currentFlushPromise = null;
if (queue.length || pendingPreFlushCbs.length || pendingPostFlushCbs.length) {
flushJobs(seen);
}
}
}
const INITIAL_WATCHER_VALUE = {};
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
const instance = currentInstance;
let getter;
let forceTrigger = false;
let isMultiSource = false;
if (isRef(source)) {
getter = () => source.value;
forceTrigger = !!source._shallow;
} else if (isReactive(source)) {
getter = () => source;
deep = true;
} else if (isArray(source)) {
isMultiSource = true;
forceTrigger = source.some(isReactive);
getter = () => source.map((s) => {
if (isRef(s)) {
return s.value;
} else if (isReactive(s)) {
return traverse(s);
} else if (isFunction(s)) {
return callWithErrorHandling(s, instance, 2);
} else
;
});
} else if (isFunction(source)) {
if (cb) {
getter = () => callWithErrorHandling(source, instance, 2);
} else {
getter = () => {
if (instance && instance.isUnmounted) {
return;
}
if (cleanup) {
cleanup();
}
return callWithAsyncErrorHandling(source, instance, 3, [onInvalidate]);
};
}
} else {
getter = NOOP;
}
if (cb && deep) {
const baseGetter = getter;
getter = () => traverse(baseGetter());
}
let cleanup;
let onInvalidate = (fn) => {
cleanup = effect.onStop = () => {
callWithErrorHandling(fn, instance, 4);
};
};
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
const job = () => {
if (!effect.active) {
return;
}
if (cb) {
const newValue = effect.run();
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
if (cleanup) {
cleanup();
}
callWithAsyncErrorHandling(cb, instance, 3, [
newValue,
oldValue === INITIAL_WATCHER_VALUE ? void 0 : oldValue,
onInvalidate
]);
oldValue = newValue;
}
} else {
effect.run();
}
};
job.allowRecurse = !!cb;
let scheduler;
if (flush === "sync") {
scheduler = job;
} else if (flush === "post") {
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
} else {
scheduler = () => {
if (!instance || instance.isMounted) {
queuePreFlushCb(job);
} else {
job();
}
};
}
const effect = new ReactiveEffect(getter, scheduler);
if (cb) {
if (immediate) {
job();
} else {
oldValue = effect.run();
}
} else if (flush === "post") {
queuePostRenderEffect(effect.run.bind(effect), instance && instance.suspense);
} else {
effect.run();
}
return () => {
effect.stop();
if (instance && instance.scope) {
remove(instance.scope.effects, effect);
}
};
}
function instanceWatch(source, value, options) {
const publicThis = this.proxy;
const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
let cb;
if (isFunction(value)) {
cb = value;
} else {
cb = value.handler;
options = value;
}
const cur = currentInstance;
setCurrentInstance(this);
const res = doWatch(getter, cb.bind(publicThis), options);
if (cur) {
setCurrentInstance(cur);
} else {
unsetCurrentInstance();
}
return res;
}
function createPathGetter(ctx, path) {
const segments = path.split(".");
return () => {
let cur = ctx;
for (let i = 0; i < segments.length && cur; i++) {
cur = cur[segments[i]];
}
return cur;
};
}
function traverse(value, seen) {
if (!isObject(value) || value["__v_skip"]) {
return value;
}
seen = seen || new Set();
if (seen.has(value)) {
return value;
}
seen.add(value);
if (isRef(value)) {
traverse(value.value, seen);
} else if (isArray(value)) {
for (let i = 0; i < value.length; i++) {
traverse(value[i], seen);
}
} else if (isSet(value) || isMap(value)) {
value.forEach((v) => {
traverse(v, seen);
});
} else if (isPlainObject(value)) {
for (const key in value) {
traverse(value[key], seen);
}
}
return value;
}
function getNormalizedLocales(locales) {

@@ -723,3 +48,3 @@ locales = locales || [];

for (const locale of locales) {
if (isString$1(locale)) {
if (isString(locale)) {
normalized.push({ code: locale });

@@ -739,3 +64,3 @@ } else {

function getLocale(i18n) {
return isI18nInstance(i18n) ? isComposer(i18n.global, i18n.mode) ? i18n.global.locale.value : i18n.global.locale : isRef(i18n.locale) ? i18n.locale.value : i18n.locale;
return isI18nInstance(i18n) ? isComposer(i18n.global, i18n.mode) ? i18n.global.locale.value : i18n.global.locale : i18n.locale.value;
}

@@ -756,10 +81,117 @@ function setLocale(i18n, locale) {

}
function extendI18n(i18n, { localeCodes = [] } = {}) {
if (!isComposer(i18n.global, i18n.mode)) {
throw new Error("");
function getRouteName(routeName) {
return isString(routeName) ? routeName : isSymbol(routeName) ? routeName.toString() : "(null)";
}
function getLocaleRouteName(routeName, locale, {
defaultLocale,
strategy,
routesNameSeparator,
defaultLocaleRouteNameSuffix
}) {
let name = getRouteName(routeName) + (strategy === "no_prefix" ? "" : routesNameSeparator + locale);
if (locale === defaultLocale && strategy === "prefix_and_default") {
name += routesNameSeparator + defaultLocaleRouteNameSuffix;
}
const _localeCodes = ref(localeCodes);
i18n.global.locales = computed(() => _localeCodes.value);
console.log("... extends i18n done");
return name;
}
function useI18nRouting(options = {}) {
var _a, _b, _c, _d, _e, _f, _g;
const $i18n = (_a = options.i18n) != null ? _a : useI18n();
const $router = (_b = options.router) != null ? _b : useRouter();
const $route = (_c = options.route) != null ? _c : useRoute();
const defaultLocaleRouteNameSuffix = (_d = options.defaultLocaleRouteNameSuffix) != null ? _d : $router.__defaultLocaleRouteNameSuffix;
const defaultLocale = (_e = options.defaultLocale) != null ? _e : $router.__defaultLocale;
const routesNameSeparator = (_f = options.routesNameSeparator) != null ? _f : $router.__routesNameSeparator;
const strategy = (_g = options.strategy) != null ? _g : $router.__strategy;
function getRouteBaseName(givenRoute) {
const route = givenRoute != null ? givenRoute : isRef($route) ? $route.value : $route;
if (!route.name) {
return null;
}
const name = getRouteName(route.name);
return name.split(routesNameSeparator)[0];
}
function resolveRoute(route, locale) {
const _locale = locale || getLocale($i18n);
let _route = route;
if (isString(route)) {
if (route[0] === "/") {
_route = { path: route };
} else {
_route = { name: route };
}
}
let localizedRoute = assign({}, _route);
if (localizedRoute.path && !localizedRoute.name) {
const _resolvedRoute = $router.resolve(localizedRoute);
const resolvedRoute2 = !isVue2 ? _resolvedRoute : _resolvedRoute.route;
const resolvedRouteName = getRouteBaseName(resolvedRoute2);
if (isString(resolvedRouteName)) {
localizedRoute = {
name: getLocaleRouteName(resolvedRouteName, _locale, {
defaultLocale,
strategy,
routesNameSeparator,
defaultLocaleRouteNameSuffix
}),
params: resolvedRoute2.params,
query: resolvedRoute2.query,
hash: resolvedRoute2.hash
};
}
} else {
localizedRoute.name = getLocaleRouteName(localizedRoute.name, _locale, {
defaultLocale,
strategy,
routesNameSeparator,
defaultLocaleRouteNameSuffix
});
const { params } = localizedRoute;
if (params && params["0"] === void 0 && params.pathMatch) {
params["0"] = params.pathMatch;
}
}
const resolvedRoute = $router.resolve(localizedRoute);
if (isVue2 ? resolvedRoute.route.name : resolvedRoute.name) {
return resolvedRoute;
}
return $router.resolve(route);
}
function localePath(route, locale) {
const localizedRoute = resolveRoute(route, locale);
return localizedRoute == null ? "" : isVue2 ? localizedRoute.route.redirectedFrom || localizedRoute.route.fullPath : localizedRoute.redirectedFrom || localizedRoute.fullPath;
}
function localeRoute(route, locale) {
const resolved = resolveRoute(route, locale);
return resolved == null ? void 0 : isVue2 ? resolved.route : resolved;
}
function localeLocation(route, locale) {
const resolved = resolveRoute(route, locale);
return resolved == null ? void 0 : isVue2 ? resolved.location : resolved;
}
function switchLocalePath(locale) {
const name = getRouteBaseName();
if (!name) {
return "";
}
const _a2 = isVue2 && isRef($route) ? $route.value : $route, { params } = _a2, routeCopy = __objRest(_a2, ["params"]);
const langSwitchParams = {};
const baseRoute = assign({}, routeCopy, {
name,
params: __spreadProps(__spreadValues(__spreadValues({}, params), langSwitchParams), {
0: params.pathMatch
})
});
const path = localePath(baseRoute, locale);
console.log("switchLocalePath", $i18n.locale.value, locale, path);
return path;
}
return {
getRouteBaseName,
localePath,
localeRoute,
localeLocation,
switchLocalePath
};
}
const STRATEGIES = {

@@ -783,3 +215,3 @@ PREFIX: "prefix",

includeUprefixedFallback = false,
localeCodes = []
locales = []
} = {}) {

@@ -789,3 +221,3 @@ if (strategy === "no_prefix") {

}
const _localeCodes = localeCodes.map((locale) => isString$1(locale) ? locale : locale.code);
const _localeCodes = locales.map((locale) => isString(locale) ? locale : locale.code);
function makeLocalizedRoutes(route, allowedLocaleCodes, isChild = false, isExtraPageTree = false) {

@@ -842,2 +274,9 @@ if (route.redirect && (!route.component || !route.file)) {

}
function extendI18n(i18n, { locales = [] } = {}) {
if (!isComposer(i18n.global, i18n.mode)) {
throw new Error("TODO:");
}
const _locales = ref(locales);
i18n.global.locales = computed(() => _locales.value);
}
function getLocalesRegex(localeCodes) {

@@ -853,3 +292,3 @@ return new RegExp(`^/(${localeCodes.join("|")})(?:/|$)`, "i");

if (route.name) {
const name = isString$1(route.name) ? route.name : route.name.toString();
const name = isString(route.name) ? route.name : route.name.toString();
const matches = name.match(regexpName);

@@ -869,254 +308,63 @@ if (matches && matches.length > 1) {

}
function extendRouter({
router,
i18n,
defaultLocale = DEFAULT_LOCALE,
strategy = DEFAULT_STRATEGY,
trailingSlash = DEFAULT_TRAILING_SLASH,
routesNameSeparator = DEFAULT_ROUTES_NAME_SEPARATOR,
defaultLocaleRouteNameSuffix = DEFAULT_LOCALE_ROUTE_NAME_SUFFIX,
localeCodes = []
} = {}) {
const normalizedLocaleCodes = getNormalizedLocales(localeCodes);
const getLocaleFromRoute = createLocaleFromRouteGetter(normalizedLocaleCodes.map((l) => l.code), routesNameSeparator, defaultLocaleRouteNameSuffix);
extendI18n(i18n, { localeCodes: normalizedLocaleCodes });
if (isVue2) {
const _router = router;
const _VueRouter = _router.constructor;
const routes = _router.options.routes || [];
const localizedRoutes = localizeRoutes(routes, {
localeCodes,
defaultLocale,
strategy,
trailingSlash,
routesNameSeparator,
defaultLocaleRouteNameSuffix
});
console.log("vue2 routes", routes, localizedRoutes);
const newRouter = new _VueRouter({
mode: "history",
base: _router.options.base,
routes: localizedRoutes
});
newRouter.__defaultLocale = defaultLocale;
newRouter.__strategy = strategy;
newRouter.__trailingSlash = trailingSlash;
newRouter.__routesNameSeparator = routesNameSeparator;
newRouter.__defaultLocaleRouteNameSuffix = defaultLocaleRouteNameSuffix;
newRouter.beforeEach((to, from, next) => {
console.log("beforeEach", to, from);
const currentLocale = getLocale(i18n);
const finalLocale = getLocaleFromRoute(to) || currentLocale || defaultLocale || "";
console.log("currentLocale", currentLocale, "finalLocale", finalLocale);
if (currentLocale !== finalLocale) {
setLocale(i18n, finalLocale);
}
next();
});
return newRouter;
} else {
const _router = router;
const routes = _router.options.routes || [];
const localizedRoutes = localizeRoutes(routes, {
localeCodes,
defaultLocale,
strategy,
trailingSlash,
routesNameSeparator,
defaultLocaleRouteNameSuffix
});
console.log("vue3 routes", routes, localizedRoutes, _router);
routes.forEach((r) => _router.removeRoute(r.name));
localizedRoutes.forEach((route) => _router.addRoute(route));
_router.__defaultLocale = defaultLocale;
_router.__strategy = strategy;
_router.__trailingSlash = trailingSlash;
_router.__routesNameSeparator = routesNameSeparator;
_router.__defaultLocaleRouteNameSuffix = defaultLocaleRouteNameSuffix;
_router.beforeEach((to, from, next) => {
console.log("beforeEach", to, from);
const currentLocale = getLocale(i18n);
const finalLocale = getLocaleFromRoute(to) || currentLocale || defaultLocale || "";
console.log("currentLocale", currentLocale, "finalLocale", finalLocale);
if (currentLocale !== finalLocale) {
setLocale(i18n, finalLocale);
}
next();
});
return _router;
}
function asDefaultVueI18nRouterOptions(options) {
var _a, _b, _c, _d, _e, _f, _g, _h;
options.version = (_a = options.version) != null ? _a : 4;
options.defaultLocale = (_b = options.defaultLocale) != null ? _b : DEFAULT_LOCALE;
options.strategy = (_c = options.strategy) != null ? _c : DEFAULT_STRATEGY;
options.trailingSlash = (_d = options.trailingSlash) != null ? _d : DEFAULT_TRAILING_SLASH;
options.routesNameSeparator = (_e = options.routesNameSeparator) != null ? _e : DEFAULT_ROUTES_NAME_SEPARATOR;
options.defaultLocaleRouteNameSuffix = (_f = options.defaultLocaleRouteNameSuffix) != null ? _f : DEFAULT_LOCALE_ROUTE_NAME_SUFFIX;
options.locales = (_g = options.locales) != null ? _g : [];
options.routes = (_h = options.routes) != null ? _h : [];
return options;
}
const useLegacyRouter = () => {
const vm = getCurrentInstance();
if (vm == null) {
throw new Error(`should be used in setup`);
}
return vm.$router;
};
const useLegacyRoute = () => {
const vm = getCurrentInstance();
if (vm == null) {
throw new Error(`should be used in setup`);
}
return computed(() => vm.$route);
};
/*!
* vue-router v4.0.12
* (c) 2021 Eduardo San Martin Morote
* @license MIT
*/
const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol";
const PolySymbol = (name) => hasSymbol ? Symbol(name) : "_vr_" + name;
const routerKey = /* @__PURE__ */ PolySymbol("r");
const routeLocationKey = /* @__PURE__ */ PolySymbol("rl");
var NavigationType;
(function(NavigationType2) {
NavigationType2["pop"] = "pop";
NavigationType2["push"] = "push";
})(NavigationType || (NavigationType = {}));
var NavigationDirection;
(function(NavigationDirection2) {
NavigationDirection2["back"] = "back";
NavigationDirection2["forward"] = "forward";
NavigationDirection2["unknown"] = "";
})(NavigationDirection || (NavigationDirection = {}));
var NavigationFailureType;
(function(NavigationFailureType2) {
NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
})(NavigationFailureType || (NavigationFailureType = {}));
function useRouter$1() {
return inject(routerKey);
}
function useRoute$1() {
return inject(routeLocationKey);
}
function useRoute() {
return isVue2 ? useLegacyRoute() : useRoute$1();
}
function useRouter() {
return isVue2 ? useLegacyRouter() : useRouter$1();
}
function useI18nRouting(options = {}) {
const $i18n = useI18n();
const $router = useRouter();
const $route = useRoute();
const defaultLocaleRouteNameSuffix = options.defaultLocaleRouteNameSuffix || $router.__defaultLocaleRouteNameSuffix;
const defaultLocale = options.defaultLocale || $router.__defaultLocale;
const routesNameSeparator = options.routesNameSeparator || $router.__routesNameSeparator;
const strategy = options.strategy || $router.__strategy;
function getRouteBaseName(givenRoute) {
const route = givenRoute != null ? givenRoute : isRef$1($route) ? $route.value : $route;
if (!route.name) {
return;
}
const name = getRouteName(route.name);
return name.split(routesNameSeparator)[0];
}
function getLocaleRouteName(routeName, locale) {
let name = getRouteName(routeName) + (strategy === "no_prefix" ? "" : routesNameSeparator + locale);
if (locale === defaultLocale && strategy === "prefix_and_default") {
name += routesNameSeparator + defaultLocaleRouteNameSuffix;
}
return name;
}
function resolveRoute(route, locale) {
const _locale = locale || getLocale($i18n);
let _route = route;
if (isString$1(route)) {
if (route[0] === "/") {
_route = { path: route };
} else {
_route = { name: route };
}
}
let localizedRoute = assign({}, _route);
if (localizedRoute.path && !localizedRoute.name) {
const _resolvedRoute = $router.resolve(localizedRoute);
const resolvedRoute2 = !isVue2 ? _resolvedRoute : _resolvedRoute.route;
const resolvedRouteName = getRouteBaseName(resolvedRoute2);
if (isString$1(resolvedRouteName)) {
localizedRoute = {
name: getLocaleRouteName(resolvedRouteName, _locale),
params: resolvedRoute2.params,
query: resolvedRoute2.query,
hash: resolvedRoute2.hash
};
}
} else {
localizedRoute.name = getLocaleRouteName(localizedRoute.name, _locale);
const { params } = localizedRoute;
if (params && params["0"] === void 0 && params.pathMatch) {
params["0"] = params.pathMatch;
}
}
const resolvedRoute = $router.resolve(localizedRoute);
if (isVue2 ? resolvedRoute.route.name : resolvedRoute.name) {
return resolvedRoute;
}
return $router.resolve(route);
}
function localePath(route, locale) {
const localizedRoute = resolveRoute(route, locale);
return localizedRoute == null ? "" : isVue2 ? localizedRoute.route.redirectedFrom || localizedRoute.route.fullPath : localizedRoute.redirectedFrom || localizedRoute.fullPath;
}
function localeRoute(route, locale) {
const resolved = resolveRoute(route, locale);
return resolved == null ? void 0 : isVue2 ? resolved.route : resolved;
}
function localeLocation(route, locale) {
const resolved = resolveRoute(route, locale);
return resolved == null ? void 0 : isVue2 ? resolved.location : resolved.href;
}
function switchLocalePath(locale) {
const name = getRouteBaseName();
if (!name) {
return "";
}
const _a = isVue2 && isRef$1($route) ? $route.value : $route, { params } = _a, routeCopy = __objRest(_a, ["params"]);
const langSwitchParams = {};
const baseRoute = assign({}, routeCopy, {
name,
params: __spreadProps(__spreadValues(__spreadValues({}, params), langSwitchParams), {
0: params.pathMatch
})
});
const path = localePath(baseRoute, locale);
console.log("switchLocalePath", $i18n.locale.value, locale, path);
return path;
}
return {
localePath,
localeRoute,
localeLocation,
switchLocalePath
};
}
function getRouteName(routeName) {
return isString$1(routeName) ? routeName : isSymbol$1(routeName) ? routeName.toString() : "";
}
function extendRouting({
router,
i18n,
defaultLocale = DEFAULT_LOCALE,
trailingSlash = DEFAULT_TRAILING_SLASH,
routesNameSeparator = DEFAULT_ROUTES_NAME_SEPARATOR,
defaultLocaleRouteNameSuffix = DEFAULT_LOCALE_ROUTE_NAME_SUFFIX,
localeCodes = []
} = {}) {
if (router == null) {
throw new Error("TODO");
}
return extendRouter({
router,
i18n,
function createRouter(i18n, options = {}) {
const {
version,
defaultLocale,
locales,
strategy,
trailingSlash,
routesNameSeparator,
defaultLocaleRouteNameSuffix,
localeCodes
routes
} = asDefaultVueI18nRouterOptions(options);
const normalizedLocaleCodes = getNormalizedLocales(locales);
const localeCodes = normalizedLocaleCodes.map((l) => l.code);
const getLocaleFromRoute = createLocaleFromRouteGetter(localeCodes, routesNameSeparator, defaultLocaleRouteNameSuffix);
extendI18n(i18n, { locales: normalizedLocaleCodes });
const localizedRoutes = localizeRoutes(routes, {
locales,
defaultLocale,
strategy,
trailingSlash,
routesNameSeparator,
defaultLocaleRouteNameSuffix
});
options.routes = localizedRoutes;
let router = null;
if (isVue3 && version === 4) {
router = createRouter$1(options);
} else if (isVue2 && version === 3) {
router = new VueRouter3(options);
} else {
throw new Error("TODO:");
}
router.__defaultLocale = defaultLocale;
router.__localeCodes = localeCodes;
router.__strategy = strategy;
router.__trailingSlash = trailingSlash;
router.__routesNameSeparator = routesNameSeparator;
router.__defaultLocaleRouteNameSuffix = defaultLocaleRouteNameSuffix;
router.beforeEach((to, from, next) => {
const currentLocale = getLocale(i18n);
const finalLocale = getLocaleFromRoute(to) || currentLocale || defaultLocale || "";
if (currentLocale !== finalLocale) {
setLocale(i18n, finalLocale);
}
next();
});
return router;
}
const VERSION = "";
export { VERSION, extendRouting, localizeRoutes, useI18nRouting };
const VERSION = "0.0.0";
export { VERSION, createRouter, localizeRoutes, useI18nRouting };

@@ -1,9 +0,5 @@

var tn=Object.defineProperty,nn=Object.defineProperties;var on=Object.getOwnPropertyDescriptors;var ee=Object.getOwnPropertySymbols;var He=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable;var We=(p,h,x)=>h in p?tn(p,h,{enumerable:!0,configurable:!0,writable:!0,value:x}):p[h]=x,N=(p,h)=>{for(var x in h||(h={}))He.call(h,x)&&We(p,x,h[x]);if(ee)for(var x of ee(h))Xe.call(h,x)&&We(p,x,h[x]);return p},_e=(p,h)=>nn(p,on(h));var Be=(p,h)=>{var x={};for(var I in p)He.call(p,I)&&h.indexOf(I)<0&&(x[I]=p[I]);if(p!=null&&ee)for(var I of ee(p))h.indexOf(I)<0&&Xe.call(p,I)&&(x[I]=p[I]);return x};var VueI18nRouting=function(p,h,x){"use strict";/*!
* shared v9.2.0-beta.25
* (c) 2021 kazuya kawaguchi
var Re=Object.defineProperty,he=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var Q=(c,a,s)=>a in c?Re(c,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[a]=s,y=(c,a)=>{for(var s in a||(a={}))J.call(a,s)&&Q(c,s,a[s]);if(U)for(var s of U(a))K.call(a,s)&&Q(c,s,a[s]);return c},z=(c,a)=>he(c,me(a));var Z=(c,a)=>{var s={};for(var S in c)J.call(c,S)&&a.indexOf(S)<0&&(s[S]=c[S]);if(c!=null&&U)for(var S of U(c))a.indexOf(S)<0&&K.call(c,S)&&(s[S]=c[S]);return s};var VueI18nRouting=function(c,a,s,S){"use strict";function ee(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var te=ee(s);/*!
* shared v9.2.0-beta.28
* (c) 2022 kazuya kawaguchi
* Released under the MIT License.
*/const I=Object.assign,j=e=>typeof e=="string",Ge=e=>typeof e=="symbol",Je={},te=()=>{},H=Object.assign,De=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},X=Array.isArray,Ke=e=>ne(e)==="[object Map]",Ye=e=>ne(e)==="[object Set]",O=e=>typeof e=="function",Ze=e=>typeof e=="string",Qe=e=>typeof e=="symbol",me=e=>e!==null&&typeof e=="object",et=e=>me(e)&&O(e.then)&&O(e.catch),tt=Object.prototype.toString,ne=e=>tt.call(e),nt=e=>ne(e)==="[object Object]",Re=(e,t)=>!Object.is(e,t),ot=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})};let rt;function st(e,t){t=t||rt,t&&t.active&&t.effects.push(e)}const ct=e=>(e.w&v)>0,lt=e=>(e.n&v)>0,it=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=v},ut=e=>{const{deps:t}=e;if(t.length){let n=0;for(let o=0;o<t.length;o++){const r=t[o];ct(r)&&!lt(r)?r.delete(e):t[n++]=r,r.w&=~v,r.n&=~v}t.length=n}};let Y=0,v=1;const be=30,W=[];let Ee;class ft{constructor(t,n=null,o){this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],st(this,o)}run(){if(!this.active)return this.fn();if(!W.includes(this))try{return W.push(Ee=this),at(),v=1<<++Y,Y<=be?it(this):xe(this),this.fn()}finally{Y<=be&&ut(this),v=1<<--Y,W.pop();const t=W.length;Ee=t>0?W[t-1]:void 0}}stop(){this.active&&(xe(this),this.onStop&&this.onStop(),this.active=!1)}}function xe(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}function at(){}new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Qe));function B(e){return dt(e)?B(e.__v_raw):!!(e&&e.__v_isReactive)}function dt(e){return!!(e&&e.__v_isReadonly)}function ht(e){return ot(e,"__v_skip",!0),e}function F(e){return Boolean(e&&e.__v_isRef===!0)}function pt(e){return F(e)?e.value:e}const gt={get:(e,t,n)=>pt(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return F(r)&&!F(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function _t(e){return B(e)?e:new Proxy(e,gt)}Promise.resolve();let mt=null;function Rt(e,t){t&&t.pendingBranch?X(e)?t.effects.push(...e):t.effects.push(e):Tt(e)}function Pe(e,t,n=!1){const o=V||mt;if(o){const r=o.parent==null?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides;if(r&&e in r)return r[e];if(arguments.length>1)return n&&O(t)?t.call(o.proxy):t}}function bt(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:l,config:{optionMergeStrategies:u}}=e.appContext,f=l.get(t);let a;return f?a=f:!r.length&&!n&&!o?a=t:(a={},r.length&&r.forEach(g=>Z(a,g,u,!0)),Z(a,t,u)),l.set(t,a),a}function Z(e,t,n,o=!1){const{mixins:r,extends:l}=t;l&&Z(e,l,n,!0),r&&r.forEach(u=>Z(e,u,n,!0));for(const u in t)if(!(o&&u==="expose")){const f=Et[u]||n&&n[u];e[u]=f?f(e[u],t[u]):t[u]}return e}const Et={data:ye,props:M,emits:M,methods:M,computed:M,beforeCreate:P,created:P,beforeMount:P,mounted:P,beforeUpdate:P,updated:P,beforeDestroy:P,beforeUnmount:P,destroyed:P,unmounted:P,activated:P,deactivated:P,errorCaptured:P,serverPrefetch:P,components:M,directives:M,watch:Pt,provide:ye,inject:xt};function ye(e,t){return t?e?function(){return H(O(e)?e.call(this,this):e,O(t)?t.call(this,this):t)}:t:e}function xt(e,t){return M(Se(e),Se(t))}function Se(e){if(X(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function P(e,t){return e?[...new Set([].concat(e,t))]:t}function M(e,t){return e?H(H(Object.create(null),e),t):t}function Pt(e,t){if(!e)return t;if(!t)return e;const n=H(Object.create(null),e);for(const o in t)n[o]=P(e[o],t[o]);return n}const Ie=Rt,oe=e=>e?St(e)?It(e)||e.proxy:oe(e.parent):null,Le=H(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>oe(e.parent),$root:e=>oe(e.root),$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?bt(e):e.type,$forceUpdate:e=>()=>Ot(e.update),$nextTick:e=>$t.bind(e.proxy),$watch:e=>__VUE_OPTIONS_API__?vt.bind(e):te});let V=null;const $e=e=>{V=e,e.scope.on()},yt=()=>{V&&V.scope.off(),V=null};function St(e){return e.vnode.shapeFlag&4}function It(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(_t(ht(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Le)return Le[n](e)}}))}function k(e,t,n,o){let r;try{r=o?e(...o):e()}catch(l){we(l,t,n)}return r}function re(e,t,n,o){if(O(e)){const l=k(e,t,n,o);return l&&et(l)&&l.catch(u=>{we(u,t,n)}),l}const r=[];for(let l=0;l<e.length;l++)r.push(re(e[l],t,n,o));return r}function we(e,t,n,o=!0){const r=t?t.vnode:null;if(t){let l=t.parent;const u=t.proxy,f=n;for(;l;){const g=l.ec;if(g){for(let s=0;s<g.length;s++)if(g[s](e,u,f)===!1)return}l=l.parent}const a=t.appContext.config.errorHandler;if(a){k(a,null,10,[e,u,f]);return}}Lt(e,n,r,o)}function Lt(e,t,n,o=!0){console.error(e)}let Q=!1,se=!1;const L=[];let A=0;const G=[];let J=null,U=0;const D=[];let C=null,z=0;const Oe=Promise.resolve();let ce=null,le=null;function $t(e){const t=ce||Oe;return e?t.then(this?e.bind(this):e):t}function wt(e){let t=A+1,n=L.length;for(;t<n;){const o=t+n>>>1;K(L[o])<e?t=o+1:n=o}return t}function Ot(e){(!L.length||!L.includes(e,Q&&e.allowRecurse?A+1:A))&&e!==le&&(e.id==null?L.push(e):L.splice(wt(e.id),0,e),Fe())}function Fe(){!Q&&!se&&(se=!0,ce=Oe.then(Ce))}function Te(e,t,n,o){X(e)?n.push(...e):(!t||!t.includes(e,e.allowRecurse?o+1:o))&&n.push(e),Fe()}function Ft(e){Te(e,J,G,U)}function Tt(e){Te(e,C,D,z)}function Ae(e,t=null){if(G.length){for(le=t,J=[...new Set(G)],G.length=0,U=0;U<J.length;U++)J[U]();J=null,U=0,le=null,Ae(e,t)}}function At(e){if(D.length){const t=[...new Set(D)];if(D.length=0,C){C.push(...t);return}for(C=t,C.sort((n,o)=>K(n)-K(o)),z=0;z<C.length;z++)C[z]();C=null,z=0}}const K=e=>e.id==null?1/0:e.id;function Ce(e){se=!1,Q=!0,Ae(e),L.sort((n,o)=>K(n)-K(o));const t=te;try{for(A=0;A<L.length;A++){const n=L[A];n&&n.active!==!1&&k(n,null,14)}}finally{A=0,L.length=0,At(),Q=!1,ce=null,(L.length||G.length||D.length)&&Ce(e)}}const ve={};function Ct(e,t,{immediate:n,deep:o,flush:r,onTrack:l,onTrigger:u}=Je){const f=V;let a,g=!1,s=!1;if(F(e)?(a=()=>e.value,g=!!e._shallow):B(e)?(a=()=>e,o=!0):X(e)?(s=!0,g=e.some(B),a=()=>e.map(c=>{if(F(c))return c.value;if(B(c))return q(c);if(O(c))return k(c,f,2)})):O(e)?t?a=()=>k(e,f,2):a=()=>{if(!(f&&f.isUnmounted))return E&&E(),re(e,f,3,[y])}:a=te,t&&o){const c=a;a=()=>q(c())}let E,y=c=>{E=i.onStop=()=>{k(c,f,4)}},m=s?[]:ve;const b=()=>{if(!!i.active)if(t){const c=i.run();(o||g||(s?c.some((R,_)=>Re(R,m[_])):Re(c,m)))&&(E&&E(),re(t,f,3,[c,m===ve?void 0:m,y]),m=c)}else i.run()};b.allowRecurse=!!t;let d;r==="sync"?d=b:r==="post"?d=()=>Ie(b,f&&f.suspense):d=()=>{!f||f.isMounted?Ft(b):b()};const i=new ft(a,d);return t?n?b():m=i.run():r==="post"?Ie(i.run.bind(i),f&&f.suspense):i.run(),()=>{i.stop(),f&&f.scope&&De(f.scope.effects,i)}}function vt(e,t,n){const o=this.proxy,r=Ze(e)?e.includes(".")?Mt(o,e):()=>o[e]:e.bind(o,o);let l;O(t)?l=t:(l=t.handler,n=t);const u=V;$e(this);const f=Ct(r,l.bind(o),n);return u?$e(u):yt(),f}function Mt(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r<n.length&&o;r++)o=o[n[r]];return o}}function q(e,t){if(!me(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),F(e))q(e.value,t);else if(X(e))for(let n=0;n<e.length;n++)q(e[n],t);else if(Ye(e)||Ke(e))e.forEach(n=>{q(n,t)});else if(nt(e))for(const n in e)q(e[n],t);return e}function Vt(e){e=e||[];const t=[];for(const n of e)j(n)?t.push({code:n}):t.push(n);return t}function ie(e,t){return F(e.locale)&&t==="composition"}function Me(e){return"global"in e&&"mode"in e}function ue(e){return Me(e)?ie(e.global,e.mode)?e.global.locale.value:e.global.locale:F(e.locale)?e.locale.value:e.locale}function Ve(e,t){Me(e)?ie(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:F(e.locale)&&(e.locale.value=t)}function jt(e,t,n){return e.replace(/\/+$/,"")+(t?"/":"")||(n?"":"/")}function kt(e,{localeCodes:t=[]}={}){if(!ie(e.global,e.mode))throw new Error("");const n=h.ref(t);e.global.locales=h.computed(()=>n.value),console.log("... extends i18n done")}const Ut={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},fe="",je=Ut.PREFIX_EXCEPT_DEFAULT,ae=!1,de="___",he="default";function pe(e,{defaultLocale:t=fe,strategy:n=je,trailingSlash:o=ae,routesNameSeparator:r=de,defaultLocaleRouteNameSuffix:l=he,includeUprefixedFallback:u=!1,localeCodes:f=[]}={}){if(n==="no_prefix")return e;const a=f.map(s=>j(s)?s:s.code);function g(s,E,y=!1,m=!1){return s.redirect&&(!s.component||!s.file)?[s]:E.reduce((d,i)=>{const{name:c}=s;let{path:R}=s;const _=N({},s);c&&(_.name=`${c}${r}${i}`),s.children&&(_.children=s.children.reduce((w,ge)=>[...w,...g(ge,[i],!0,m)],[]));const T=i===t;if(T&&n==="prefix_and_default")if(y)y&&m&&c&&(_.name+=`${r}${l}`);else{const w=_e(N({},_),{path:R});if(c&&(w.name=`${_.name}${r}${l}`),s.children){w.children=[];for(const ge of s.children)w.children=w.children.concat(g(ge,[i],!0,!0))}d.push(w)}const S=y&&!R.startsWith("/"),$=!S&&!(T&&n==="prefix_except_default");return $&&(R=`/${i}${R}`),R&&(R=jt(R,o,S)),$&&T&&n==="prefix"&&u&&d.push(N({},s)),_.path=R,d.push(_),d},[])}return e.reduce((s,E)=>[...s,...g(E,a||[])],[])}function zt(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function qt(e,t,n){const o=`(${e.join("|")})`,r=`(?:${t}${n})?`,l=new RegExp(`${t}${o}${r}$`,"i"),u=zt(e);return a=>{if(a.name){const s=(j(a.name)?a.name:a.name.toString()).match(l);if(s&&s.length>1)return s[1]}else if(a.path){const g=a.path.match(u);if(g&&g.length>1)return g[1]}return""}}function Nt({router:e,i18n:t,defaultLocale:n=fe,strategy:o=je,trailingSlash:r=ae,routesNameSeparator:l=de,defaultLocaleRouteNameSuffix:u=he,localeCodes:f=[]}={}){const a=Vt(f),g=qt(a.map(s=>s.code),l,u);if(kt(t,{localeCodes:a}),h.isVue2){const s=e,E=s.constructor,y=s.options.routes||[],m=pe(y,{localeCodes:f,defaultLocale:n,strategy:o,trailingSlash:r,routesNameSeparator:l,defaultLocaleRouteNameSuffix:u});console.log("vue2 routes",y,m);const b=new E({mode:"history",base:s.options.base,routes:m});return b.__defaultLocale=n,b.__strategy=o,b.__trailingSlash=r,b.__routesNameSeparator=l,b.__defaultLocaleRouteNameSuffix=u,b.beforeEach((d,i,c)=>{console.log("beforeEach",d,i);const R=ue(t),_=g(d)||R||n||"";console.log("currentLocale",R,"finalLocale",_),R!==_&&Ve(t,_),c()}),b}else{const s=e,E=s.options.routes||[],y=pe(E,{localeCodes:f,defaultLocale:n,strategy:o,trailingSlash:r,routesNameSeparator:l,defaultLocaleRouteNameSuffix:u});return console.log("vue3 routes",E,y,s),E.forEach(m=>s.removeRoute(m.name)),y.forEach(m=>s.addRoute(m)),s.__defaultLocale=n,s.__strategy=o,s.__trailingSlash=r,s.__routesNameSeparator=l,s.__defaultLocaleRouteNameSuffix=u,s.beforeEach((m,b,d)=>{console.log("beforeEach",m,b);const i=ue(t),c=g(m)||i||n||"";console.log("currentLocale",i,"finalLocale",c),i!==c&&Ve(t,c),d()}),s}}const Ht=()=>{const e=h.getCurrentInstance();if(e==null)throw new Error("should be used in setup");return e.$router},Xt=()=>{const e=h.getCurrentInstance();if(e==null)throw new Error("should be used in setup");return h.computed(()=>e.$route)};/*!
* vue-router v4.0.12
* (c) 2021 Eduardo San Martin Morote
* @license MIT
*/const Wt=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ke=e=>Wt?Symbol(e):"_vr_"+e,Bt=ke("r"),Gt=ke("rl");var Ue;(function(e){e.pop="pop",e.push="push"})(Ue||(Ue={}));var ze;(function(e){e.back="back",e.forward="forward",e.unknown=""})(ze||(ze={}));var qe;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(qe||(qe={}));function Jt(){return Pe(Bt)}function Dt(){return Pe(Gt)}function Kt(){return h.isVue2?Xt():Dt()}function Yt(){return h.isVue2?Ht():Jt()}function Zt(e={}){const t=x.useI18n(),n=Yt(),o=Kt(),r=e.defaultLocaleRouteNameSuffix||n.__defaultLocaleRouteNameSuffix,l=e.defaultLocale||n.__defaultLocale,u=e.routesNameSeparator||n.__routesNameSeparator,f=e.strategy||n.__strategy;function a(d){const i=d!=null?d:h.isRef(o)?o.value:o;return i.name?Ne(i.name).split(u)[0]:void 0}function g(d,i){let c=Ne(d)+(f==="no_prefix"?"":u+i);return i===l&&f==="prefix_and_default"&&(c+=u+r),c}function s(d,i){const c=i||ue(t);let R=d;j(d)&&(d[0]==="/"?R={path:d}:R={name:d});let _=I({},R);if(_.path&&!_.name){const S=n.resolve(_),$=h.isVue2?S.route:S,w=a($);j(w)&&(_={name:g(w,c),params:$.params,query:$.query,hash:$.hash})}else{_.name=g(_.name,c);const{params:S}=_;S&&S["0"]===void 0&&S.pathMatch&&(S["0"]=S.pathMatch)}const T=n.resolve(_);return(h.isVue2?T.route.name:T.name)?T:n.resolve(d)}function E(d,i){const c=s(d,i);return c==null?"":h.isVue2?c.route.redirectedFrom||c.route.fullPath:c.redirectedFrom||c.fullPath}function y(d,i){const c=s(d,i);return c==null?void 0:h.isVue2?c.route:c}function m(d,i){const c=s(d,i);return c==null?void 0:h.isVue2?c.location:c.href}function b(d){const i=a();if(!i)return"";const $=h.isVue2&&h.isRef(o)?o.value:o,{params:c}=$,R=Be($,["params"]),_={},T=I({},R,{name:i,params:_e(N(N({},c),_),{0:c.pathMatch})}),S=E(T,d);return console.log("switchLocalePath",t.locale.value,d,S),S}return{localePath:E,localeRoute:y,localeLocation:m,switchLocalePath:b}}function Ne(e){return j(e)?e:Ge(e)?e.toString():""}function Qt({router:e,i18n:t,defaultLocale:n=fe,trailingSlash:o=ae,routesNameSeparator:r=de,defaultLocaleRouteNameSuffix:l=he,localeCodes:u=[]}={}){if(e==null)throw new Error("TODO");return Nt({router:e,i18n:t,defaultLocale:n,trailingSlash:o,routesNameSeparator:r,defaultLocaleRouteNameSuffix:l,localeCodes:u})}const en="";return p.VERSION=en,p.extendRouting=Qt,p.localizeRoutes=pe,p.useI18nRouting=Zt,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module",p}({},VueDemi,VueI18n);
*/const C=Object.assign,b=e=>typeof e=="string",ae=e=>typeof e=="symbol";function le(e){e=e||[];const t=[];for(const l of e)b(l)?t.push({code:l}):t.push(l);return t}function w(e,t){return a.isRef(e.locale)&&t==="composition"}function X(e){return"global"in e&&"mode"in e}function M(e){return X(e)?w(e.global,e.mode)?e.global.locale.value:e.global.locale:e.locale.value}function ne(e,t){X(e)?w(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:a.isRef(e.locale)&&(e.locale.value=t)}function oe(e,t,l){return e.replace(/\/+$/,"")+(t?"/":"")||(l?"":"/")}function j(e){return b(e)?e:ae(e)?e.toString():"(null)"}function G(e,t,{defaultLocale:l,strategy:u,routesNameSeparator:i,defaultLocaleRouteNameSuffix:R}){let d=j(e)+(u==="no_prefix"?"":i+t);return t===l&&u==="prefix_and_default"&&(d+=i+R),d}function ce(e={}){var m,p,T,A,g,L,v;const t=(m=e.i18n)!=null?m:S.useI18n(),l=(p=e.router)!=null?p:s.useRouter(),u=(T=e.route)!=null?T:s.useRoute(),i=(A=e.defaultLocaleRouteNameSuffix)!=null?A:l.__defaultLocaleRouteNameSuffix,R=(g=e.defaultLocale)!=null?g:l.__defaultLocale,d=(L=e.routesNameSeparator)!=null?L:l.__routesNameSeparator,E=(v=e.strategy)!=null?v:l.__strategy;function f(r){const _=r!=null?r:a.isRef(u)?u.value:u;return _.name?j(_.name).split(d)[0]:null}function h(r,_){const o=_||M(t);let I=r;b(r)&&(r[0]==="/"?I={path:r}:I={name:r});let F=C({},I);if(F.path&&!F.name){const $=l.resolve(F),N=a.isVue2?$.route:$,Y=f(N);b(Y)&&(F={name:G(Y,o,{defaultLocale:R,strategy:E,routesNameSeparator:d,defaultLocaleRouteNameSuffix:i}),params:N.params,query:N.query,hash:N.hash})}else{F.name=G(F.name,o,{defaultLocale:R,strategy:E,routesNameSeparator:d,defaultLocaleRouteNameSuffix:i});const{params:$}=F;$&&$["0"]===void 0&&$.pathMatch&&($["0"]=$.pathMatch)}const V=l.resolve(F);return(a.isVue2?V.route.name:V.name)?V:l.resolve(r)}function n(r,_){const o=h(r,_);return o==null?"":a.isVue2?o.route.redirectedFrom||o.route.fullPath:o.redirectedFrom||o.fullPath}function P(r,_){const o=h(r,_);return o==null?void 0:a.isVue2?o.route:o}function x(r,_){const o=h(r,_);return o==null?void 0:a.isVue2?o.location:o}function O(r){const _=f();if(!_)return"";const N=a.isVue2&&a.isRef(u)?u.value:u,{params:o}=N,I=Z(N,["params"]),F={},V=C({},I,{name:_,params:z(y(y({},o),F),{0:o.pathMatch})}),$=n(V,r);return console.log("switchLocalePath",t.locale.value,r,$),$}return{getRouteBaseName:f,localePath:n,localeRoute:P,localeLocation:x,switchLocalePath:O}}const re={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},q="",D=re.PREFIX_EXCEPT_DEFAULT,W=!1,k="___",B="default";function H(e,{defaultLocale:t=q,strategy:l=D,trailingSlash:u=W,routesNameSeparator:i=k,defaultLocaleRouteNameSuffix:R=B,includeUprefixedFallback:d=!1,locales:E=[]}={}){if(l==="no_prefix")return e;const f=E.map(n=>b(n)?n:n.code);function h(n,P,x=!1,O=!1){return n.redirect&&(!n.component||!n.file)?[n]:P.reduce((p,T)=>{const{name:A}=n;let{path:g}=n;const L=y({},n);A&&(L.name=`${A}${i}${T}`),n.children&&(L.children=n.children.reduce((o,I)=>[...o,...h(I,[T],!0,O)],[]));const v=T===t;if(v&&l==="prefix_and_default")if(x)x&&O&&A&&(L.name+=`${i}${R}`);else{const o=z(y({},L),{path:g});if(A&&(o.name=`${L.name}${i}${R}`),n.children){o.children=[];for(const I of n.children)o.children=o.children.concat(h(I,[T],!0,!0))}p.push(o)}const r=x&&!g.startsWith("/"),_=!r&&!(v&&l==="prefix_except_default");return _&&(g=`/${T}${g}`),g&&(g=oe(g,u,r)),_&&v&&l==="prefix"&&d&&p.push(y({},n)),L.path=g,p.push(L),p},[])}return e.reduce((n,P)=>[...n,...h(P,f||[])],[])}function ue(e,{locales:t=[]}={}){if(!w(e.global,e.mode))throw new Error("TODO:");const l=a.ref(t);e.global.locales=a.computed(()=>l.value)}function se(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function fe(e,t,l){const u=`(${e.join("|")})`,i=`(?:${t}${l})?`,R=new RegExp(`${t}${u}${i}$`,"i"),d=se(e);return f=>{if(f.name){const n=(b(f.name)?f.name:f.name.toString()).match(R);if(n&&n.length>1)return n[1]}else if(f.path){const h=f.path.match(d);if(h&&h.length>1)return h[1]}return""}}function ie(e){var t,l,u,i,R,d,E,f;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(l=e.defaultLocale)!=null?l:q,e.strategy=(u=e.strategy)!=null?u:D,e.trailingSlash=(i=e.trailingSlash)!=null?i:W,e.routesNameSeparator=(R=e.routesNameSeparator)!=null?R:k,e.defaultLocaleRouteNameSuffix=(d=e.defaultLocaleRouteNameSuffix)!=null?d:B,e.locales=(E=e.locales)!=null?E:[],e.routes=(f=e.routes)!=null?f:[],e}function de(e,t={}){const{version:l,defaultLocale:u,locales:i,strategy:R,trailingSlash:d,routesNameSeparator:E,defaultLocaleRouteNameSuffix:f,routes:h}=ie(t),n=le(i),P=n.map(p=>p.code),x=fe(P,E,f);ue(e,{locales:n});const O=H(h,{locales:i,defaultLocale:u,strategy:R,trailingSlash:d,routesNameSeparator:E,defaultLocaleRouteNameSuffix:f});t.routes=O;let m=null;if(a.isVue3&&l===4)m=s.createRouter(t);else if(a.isVue2&&l===3)m=new te.default(t);else throw new Error("TODO:");return m.__defaultLocale=u,m.__localeCodes=P,m.__strategy=R,m.__trailingSlash=d,m.__routesNameSeparator=E,m.__defaultLocaleRouteNameSuffix=f,m.beforeEach((p,T,A)=>{const g=M(e),L=x(p)||g||u||"";g!==L&&ne(e,L),A()}),m}const _e="0.0.0";return c.VERSION=_e,c.createRouter=de,c.localizeRoutes=H,c.useI18nRouting=ce,Object.defineProperty(c,"__esModule",{value:!0}),c[Symbol.toStringTag]="Module",c}({},VueDemi,VueRouter,VueI18n);
{
"name": "vue-i18n-routing",
"description": "The i18n routing with using vue-i18n",
"version": "0.0.0-99e2c9c",
"version": "0.0.0-99fc23c",
"dependencies": {
"@intlify/shared": "beta",
"@intlify/vue-i18n-bridge": "0.0.0-99e2c9c",
"vue-demi": "*"
"@intlify/vue-i18n-bridge": "^0.3.4",
"@intlify/vue-router-bridge": "^0.3.4",
"vue-demi": "^0.12.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.18.20",
"@vue/test-utils": "^1.3.0",
"api-docs-gen": "^0.4.0",
"rimraf": "^3.0.2",
"typescript": "^4.5.4",
"vite": "^2.7.4",

@@ -20,2 +23,3 @@ "vite-plugin-dts": "^0.9.6",

"vue-i18n-legacy": "npm:vue-i18n@latest",
"vue-template-compiler": "^2.6.14",
"vue-router": "^4.0.12",

@@ -28,5 +32,5 @@ "vue-router3": "npm:vue-router@latest",

"vue": "^2.6.14 || ^3.2.0",
"vue-router": "^3.5.3 || ^4.0.0",
"vue-i18n": "^8.26.1 || ^9.2.0-beta.25",
"vue-i18n-bridge": "^9.2.0-beta.25"
"vue-i18n-bridge": "^9.2.0-beta.25",
"vue-router": "^3.5.3 || ^4.0.0"
},

@@ -90,4 +94,3 @@ "peerDependenciesMeta": {

"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix"
},
"readme": "# vue-i18n-routing\n\nThe i18n routing with using vue-i18n\n\nWIP: 👷\n\n## 🤝 API\n\nAbout details, See the [API References]('./api.md)\n\n## Šī¸ License\n\n[MIT](http://opensource.org/licenses/MIT)"
}
}

Sorry, the diff of this file is not supported yet