mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-30 08:33:37 +08:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
var e={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function t(t){return t?{lang:t?.lang??void 0,message:t?.message,abortEarly:t?.abortEarly??void 0,abortPipeEarly:t?.abortPipeEarly??void 0}:e}function n(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function r(e,t,r,i,a){let o=a&&`input`in a?a.input:r.value,s=a?.expected??e.expects??null,c=a?.received??n(o),l={kind:e.kind,type:e.type,input:o,expected:s,received:c,message:`Invalid ${t}: ${s?`Expected ${s} but r`:`R`}eceived ${c}`,requirement:e.requirement,path:a?.path,issues:a?.issues,lang:i.lang,abortEarly:i.abortEarly,abortPipeEarly:i.abortPipeEarly},u=e.kind===`schema`,d=a?.message??e.message??(e.reference,l.lang,void 0)??(u?(l.lang,void 0):null)??i.message??(l.lang,void 0);d!==void 0&&(l.message=typeof d==`function`?d(l):d),u&&(r.typed=!1),r.issues?r.issues.push(l):r.issues=[l]}function i(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function o(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}function s(e){return e[`~standard`]={version:1,vendor:`valibot`,validate:n=>e[`~run`]({value:n},t())},e}function c(e){if(e.path){let t=``;for(let n of e.path)if(typeof n.key==`string`||typeof n.key==`number`)t+=t?`.${n.key}`:n.key;else return null;return t}return null}var l=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}},u=/^[\w+-]+(?:\.[\w+-]+)*@[\da-zA-Z]+(?:[.-][\da-zA-Z]+)*\.[a-zA-Z]{2,}$/u,d=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,ee=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,te=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;function f(e,t){return{kind:`validation`,type:`check`,reference:f,async:!1,expects:null,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&r(this,`input`,e,t),e}}}function p(e){return{kind:`metadata`,type:`description`,reference:p,description:e}}function m(e){return{kind:`validation`,type:`email`,reference:m,expects:null,async:!1,requirement:u,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&r(this,`email`,e,t),e}}}function h(e){return{kind:`validation`,type:`finite`,reference:h,async:!1,expects:null,requirement:Number.isFinite,message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&r(this,`finite`,e,t),e}}}function g(e){return{kind:`validation`,type:`integer`,reference:g,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&r(this,`integer`,e,t),e}}}function _(e){return{kind:`validation`,type:`iso_date`,reference:_,async:!1,expects:null,requirement:d,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&r(this,`date`,e,t),e}}}function v(e){return{kind:`validation`,type:`iso_time`,reference:v,async:!1,expects:null,requirement:ee,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&r(this,`time`,e,t),e}}}function y(e){return{kind:`validation`,type:`iso_timestamp`,reference:y,async:!1,expects:null,requirement:te,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&r(this,`timestamp`,e,t),e}}}function b(e,t){return{kind:`validation`,type:`max_length`,reference:b,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length>this.requirement&&r(this,`length`,e,t,{received:`${e.value.length}`}),e}}}function x(e,t){return{kind:`validation`,type:`max_value`,reference:x,async:!1,expects:`<=${e instanceof Date?e.toJSON():n(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value<=this.requirement)&&r(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():n(e.value)}),e}}}function S(e){return{kind:`metadata`,type:`metadata`,reference:S,metadata:e}}function C(e,t){return{kind:`validation`,type:`min_length`,reference:C,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&r(this,`length`,e,t,{received:`${e.value.length}`}),e}}}function w(e,t){return{kind:`validation`,type:`min_value`,reference:w,async:!1,expects:`>=${e instanceof Date?e.toJSON():n(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value>=this.requirement)&&r(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():n(e.value)}),e}}}function T(e,t){return{kind:`validation`,type:`regex`,reference:T,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&r(this,`format`,e,t),e}}}function E(e){return{kind:`metadata`,type:`title`,reference:E,title:e}}function D(){return{kind:`transformation`,type:`trim`,reference:D,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}function O(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function k(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function A(e,t){return s({kind:`schema`,type:`array`,reference:A,expects:`Array`,async:!1,item:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else r(this,`type`,e,t);return e}})}function j(e){return s({kind:`schema`,type:`boolean`,reference:j,expects:`boolean`,async:!1,message:e,"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:r(this,`type`,e,t),e}})}function M(e){return s({kind:`schema`,type:`lazy`,reference:M,expects:`unknown`,async:!1,getter:e,"~run"(e,t){return this.getter(e.value)[`~run`](e,t)}})}function N(e,t){return s({kind:`schema`,type:`literal`,reference:N,expects:n(e),async:!1,literal:e,message:t,"~run"(e,t){return i(e.value,this.literal)?e.typed=!0:r(this,`type`,e,t),e}})}function ne(e){return s({kind:`schema`,type:`null`,reference:ne,expects:`null`,async:!1,message:e,"~run"(e,t){return e.value===null?e.typed=!0:r(this,`type`,e,t),e}})}function P(e,t){return s({kind:`schema`,type:`nullable`,reference:P,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===null&&(this.default!==void 0&&(e.value=k(this,e,t)),e.value===null)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}function F(e){return s({kind:`schema`,type:`number`,reference:F,expects:`number`,async:!1,message:e,"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:r(this,`type`,e,t),e}})}function I(e,t){return s({kind:`schema`,type:`object`,reference:I,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let i in this.entries){let a=this.entries[i];if(i in n||(a.type===`exact_optional`||a.type===`optional`||a.type===`nullish`)&&a.default!==void 0){let r=i in n?n[i]:k(a),o=a[`~run`]({value:r},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:i,value:r};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[i]=o.value}else if(a.fallback!==void 0)e.value[i]=O(a);else if(a.type!==`exact_optional`&&a.type!==`optional`&&a.type!==`nullish`&&(r(this,`key`,e,t,{input:void 0,expected:`"${i}"`,path:[{type:`object`,origin:`key`,input:n,key:i,value:n[i]}]}),t.abortEarly))break}}else r(this,`type`,e,t);return e}})}function L(e,t){return s({kind:`schema`,type:`optional`,reference:L,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=k(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}function R(e,t){return s({kind:`schema`,type:`picklist`,reference:R,expects:o(e.map(n),`|`),async:!1,options:e,message:t,"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:r(this,`type`,e,t),e}})}function z(e,t,n){return s({kind:`schema`,type:`record`,reference:z,expects:`Object`,async:!1,key:e,value:t,message:n,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(a(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}a.typed&&o.typed||(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else r(this,`type`,e,t);return e}})}function B(e,t){return s({kind:`schema`,type:`strict_object`,reference:B,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let i in this.entries){let a=this.entries[i];if(i in n||(a.type===`exact_optional`||a.type===`optional`||a.type===`nullish`)&&a.default!==void 0){let r=i in n?n[i]:k(a),o=a[`~run`]({value:r},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:i,value:r};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[i]=o.value}else if(a.fallback!==void 0)e.value[i]=O(a);else if(a.type!==`exact_optional`&&a.type!==`optional`&&a.type!==`nullish`&&(r(this,`key`,e,t,{input:void 0,expected:`"${i}"`,path:[{type:`object`,origin:`key`,input:n,key:i,value:n[i]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly){for(let i in n)if(!Object.prototype.hasOwnProperty.call(this.entries,i)){r(this,`key`,e,t,{input:i,expected:`never`,path:[{type:`object`,origin:`key`,input:n,key:i,value:n[i]}]});break}}}else r(this,`type`,e,t);return e}})}function V(e){return s({kind:`schema`,type:`string`,reference:V,expects:`string`,async:!1,message:e,"~run"(e,t){return typeof e.value==`string`?e.typed=!0:r(this,`type`,e,t),e}})}function H(e){let t;if(e)for(let n of e)if(t)for(let e of n.issues)t.push(e);else t=n.issues;return t}function U(e,t){return s({kind:`schema`,type:`union`,reference:U,expects:o(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,"~run"(e,t){let n,i,a;for(let r of this.options){let o=r[`~run`]({value:e.value},t);if(o.typed){if(o.issues)i?i.push(o):i=[o];else{n=o;break}}else a?a.push(o):a=[o]}if(n)return n;if(i){if(i.length===1)return i[0];r(this,`type`,e,t,{issues:H(i)}),e.typed=!0}else if(a?.length===1)return a[0];else r(this,`type`,e,t,{issues:H(a)});return e}})}function W(){return s({kind:`schema`,type:`unknown`,reference:W,expects:`unknown`,async:!1,"~run"(e){return e.typed=!0,e}})}function re(e,n,r){let i=e[`~run`]({value:n},t(r));if(i.issues)throw new l(i.issues);return i.value}function G(...e){return s({...e[0],pipe:e,"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=r[`~run`](t,n))}return t}})}function ie(e,n,r){let i=e[`~run`]({value:n},t(r));return{typed:i.typed,success:!i.issues,output:i.value,issues:i.issues}}var K=G(V(),C(1),b(256)),q=G(F(),h()),J=U([K,q]),Y=G(K,T(/^[\w-]+\/[\w-]+$/)),X=`(?:[\\w~.-]+|:[A-Za-z_]\\w*\\??)`,Z=G(K,T(RegExp(`^/${X}(?:/${X})*$`))),Q=/^(?:[oO][nN]|innerHTML$|outerHTML$|srcdoc$|__proto__$|constructor$|prototype$)/,ae=G(z(V(),W()),f(e=>Object.keys(e).every(e=>!Q.test(e)),`Unsafe view prop.`),S({propertyNames:{not:{pattern:Q.source}}})),$=B({path:G(K,T(RegExp(`^/?${X}(?:/${X})*$`)),p(`Absolute or relative child path. Supports named and optional parameters.`)),name:L(G(K,T(/^[A-Za-z_][\w.-]*$/),p(`Unique Vue Router name. Required for keepAlive.`))),component:L(G(K,p(`Registered view ID. Use layout for a menu group.`))),alias:L(G(U([Z,G(A(Z),C(1),b(16))]),p(`Absolute alternative path(s) for a leaf.`))),redirect:L(G(Z,p(`Absolute path of another configured page.`))),props:L(G(U([j(),ae]),p(`Pass route params (true) or a JSON object to the view.`))),meta:B({i18nKey:L(G(K,p(`Translation key for the menu title.`))),noLocalTitle:L(G(J,p(`Literal title if i18nKey is absent.`))),icon:L(G(Y,p(`IconName from src/icons/manifest.ts.`))),role:L(G(A(J),b(32),p(`Allowed roles. Omitted or empty means any authenticated role.`))),hidden:L(G(j(),p(`Hide from the menu. Direct navigation still uses the role guard.`))),sameLevel:L(G(j(),p(`Append a breadcrumb without replacing the current tab.`))),order:L(G(q,p(`Menu sort order at the top level.`))),env:L(G(U([K,G(A(K),b(16))]),p(`Vite mode(s) in which the menu item is visible.`))),windowOpen:L(G(V(),b(2048),T(/^[Hh][Tt][Tt][Pp][Ss]?:\/\//),p(`Open this HTTP(S) URL in a new tab.`))),ignoreAutoResetScroll:L(G(j(),p(`Keep the content scroll position on navigation.`))),keepAlive:L(G(j(),p(`Keep the view mounted. name must match the registered view name.`))),extra:L(G(B({label:L(J),i18nLabel:L(K),icon:L(Y),show:L(j()),type:L(R([`default`,`primary`,`info`,`success`,`warning`,`error`]))}),p(`Optional menu badge.`)))}),children:L(G(A(M(()=>$)),C(1),b(300)))}),oe=G(B({version:N(1),routes:G(A($),b(300))}),E(`Ray Template route configuration`));export{V as A,re as C,T as D,z as E,W as M,ie as O,L as S,G as T,w as _,f as a,F as b,c,v as d,y as f,C as g,x as h,j as i,D as j,B as k,g as l,b as m,$ as n,m as o,N as p,A as r,h as s,oe as t,_ as u,ne as v,R as w,I as x,P as y}; |