Comparing version 8.2.0 to 8.2.1
@@ -122,2 +122,3 @@ declare const GUBU: { | ||
key: string; | ||
type: string; | ||
node: Node<any>; | ||
@@ -124,0 +125,0 @@ value: any; |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Gubu=e()}}((function(){var e={},t={};Object.defineProperty(t,"__esModule",{value:!0}),t.Gubu=void 0;const n=Symbol.for("gubu$"),r={gubu$:n,v$:"8.2.0"},l=/^[A-Z]/,{toString:i}=Object.prototype,o="gubu",s="name",u="nan",a="never",c="number",f="required",p="array",h="function",v="object",d="string",g="boolean",y="undefined",m="any",b="list",$="instance",k="null",x="type",I="closed",w="shape",j="check",S="regexp",N="String",O="Number",V="Boolean",A="Object",R="Array",D="Function",E="Value",C="Above",G="All",T="Below",B="Check",J="Exact",W="Max",M="Min",F="One",P="Some",z=" for property ",L='"$PATH"',_='"$VALUE"',q={[N]:String,[O]:Number,[V]:Boolean,[A]:Object,[R]:Array,["Symbol"]:Symbol,[D]:Function},H=e=>Object.keys(e),U=(e,t,n)=>Object.defineProperty(e,t,n),K=e=>Array.isArray(e),Z=e=>JSON.parse(e),Q=(e,t)=>JSON.stringify(e,t);class X{constructor(e,t,n,r){this.match=!1,this.dI=0,this.nI=2,this.cI=-1,this.pI=0,this.sI=-1,this.valType=a,this.isRoot=!1,this.key="",this.type=a,this.stop=!0,this.nextSibling=!0,this.fromDflt=!1,this.ignoreVal=void 0,this.curerr=[],this.err=[],this.parents=[],this.keys=[],this.ancestors=[],this.path=[],this.root=e,this.vals=[e,-1],this.node=t,this.nodes=[t,-1],this.ctx=n||{},this.match=!!r}next(){this.stop=!1,this.fromDflt=!1,this.ignoreVal=void 0,this.isRoot=0===this.pI,this.check=void 0;let e=this.nodes[this.pI];for(this.ancestors[this.dI]=this.node;+e;)this.dI--,this.ctx.log&&-1<this.dI&&this.ctx.log("e"+(K(this.parents[this.pI])?"a":"o"),this),this.pI=+e,e=this.nodes[this.pI];e?(this.node=e,this.updateVal(this.vals[this.pI]),this.key=this.keys[this.pI],this.cI=this.pI,this.sI=this.pI+1,Object.isFrozen(this.parents[this.pI])&&(this.parents[this.pI]={...this.parents[this.pI]}),this.parent=this.parents[this.pI],this.nextSibling=!0,this.type=this.node.t,this.path[this.dI]=this.key,this.oval=this.val,this.curerr.length=0):this.stop=!0}updateVal(e){this.val=e,this.valType=typeof this.val,c===this.valType&&isNaN(this.val)&&(this.valType=u),this.isRoot&&!this.match&&(this.root=this.val)}}class Y extends TypeError{constructor(e,t,n,r){var l;super((t=null==t||t.startsWith("G$")?"":t+": ")+n.map(e=>e.text).join("\n")),this.gubu=!0,this.name="GubuError",this.code=e,this.gname=t,this.desc=()=>({name:"GubuError",code:e,err:n,ctx:r}),this.stack=null===(l=this.stack)||void 0===l?void 0:l.replace(/.*\/gubu\/gubu\.[tj]s.*\n/g,""),this.props=n.map(e=>{var t;return{path:e.path,what:e.why,type:null===(t=e.node)||void 0===t?void 0:t.t,value:e.value}})}toJSON(){return{...this,err:this.desc().err,name:this.name,message:this.message}}}const ee={Array:!0,BigInt:!0,Boolean:!0,Function:!0,Number:!0,Object:!0,String:!0,Symbol:!0},te={string:"",number:0,boolean:!1,object:{},array:[],symbol:Symbol(""),bigint:BigInt(0),null:null,regexp:/.*/};function ne(e,t,o){var s,a,f,g;if(le===e)e=void 0;else if(null!=e&&(null===(s=e.$)||void 0===s?void 0:s.gubu$)){if(n===e.$.gubu$)return e.d=null==t?e.d:t,e;if(!0===e.$.gubu$){let r={...e};return r.$={v$:"8.2.0",...r.$,gubu$:n},r.v=null!=r.v&&v===typeof r.v?{...r.v}:r.v,r.t=r.t||typeof r.v,h===r.t&&ee[r.v.name]&&(r.t=r.v.name.toLowerCase(),r.v=He(te[r.t]),r.f=r.v),r.r=!!r.r,r.p=!!r.p,r.d=null==t?null==r.d?-1:r.d:t,r.b=r.b||[],r.a=r.a||[],r.u=r.u||{},r.m=r.m||o||{},r}}let b=null===e?k:typeof e;b=y===b?m:b;let x,I=e,w=I,j=!1,N={},O=[],V=[];if(v===b)w=void 0,K(I)?(b=p,1===I.length&&(x=I[0],I=[])):null!=I&&Function!==I.constructor&&Object!==I.constructor&&null!=I.constructor?("[object RegExp]"===i.call(I)?(b=S,j=!0):(b=$,N.n=I.constructor.name,N.i=I.constructor),w=I):0===H(I).length&&(x=he());else if(h===b)if(ee[e.name])b=e.name.toLowerCase(),j=!0,I=He(te[b]),w=I,A===e.name&&(x=he());else if(I.gubu===r||!0===(null===(a=I.$)||void 0===a?void 0:a.gubu)){let e=I.node?I.node():I;b=e.t,I=e.v,w=I,j=e.r,N={...e.u},O=[...e.a],V=[...e.b]}else D===I.constructor.name&&l.test(I.name)&&(b=$,j=!0,N.n=null===(g=null===(f=I.prototype)||void 0===f?void 0:f.constructor)||void 0===g?void 0:g.name,N.i=I);else c===b&&isNaN(I)?b=u:d===b&&""===I&&(N.empty=!0);let R=null==I||v!==b&&p!==b?I:{...I};return{$:r,t:b,v:R,f:w,n:null!=R&&v===typeof R?H(R).length:0,c:x,r:j,p:!1,d:null==t?-1:t,k:[],e:!0,u:N,a:O,b:V,m:o||{},[Symbol.for("nodejs.util.inspect.custom")](){const e={...this};return delete e.$,JSON.stringify(e,(e,t)=>"function"!=typeof t||Ke[t.name]?t:t.name).replace(/"/g,"").replace(/,/g," ")}}}function re(e,t){var n;const r=[[{},"root",e,t]];for(let l=0;l<r.length;l++){const e=r[l],t=e[0][e[1]]=ne(e[2],e[3]);void 0!==t.c&&((null===(n=t.c.$)||void 0===n?void 0:n.gubu$)||r.push([t,"c",t.c,t.d]));let i=typeof t.v;v===i&&null!=t.v&&Object.entries(t.v).map(e=>{var n;(null===(n=e[1].$)||void 0===n?void 0:n.gubu$)||r.push([t.v,e[0],e[1],t.d+1])})}return r[0][0].root}function le(t,l){const i=null==l?{}:l;i.name=null==i.name?"G$"+(""+Math.random()).substring(2,8):""+i.name;let o=i.meta=i.meta||{};o.active=!0===o.active||!1,o.suffix=d==typeof o.suffix?o.suffix:"$$";let s=i.keyexpr=i.keyexpr||{};s.active=!1!==s.active;let u=i.valexpr=i.valexpr||{};u.active=!0===u.active,u.keymark=d==typeof u.keymark?u.keymark:o.suffix;let c,h=ne(t,0),g="";function N(e,t,n){var r,l,c;const g=null===(r=null==t?void 0:t.skip)||void 0===r?void 0:r.depth,N=Array.isArray(null===(l=null==t?void 0:t.skip)||void 0===l?void 0:l.depth)?t.skip.depth:null,O=Array.isArray(null===(c=null==t?void 0:t.skip)||void 0===c?void 0:c.keys)?t.skip.keys:null,V=new X(e,h,t,n);for(;V.next(),!V.stop;){let t=V.node,n=!1,r=!1,l=!!(t.d===g||N&&N.includes(t.d)||O&&1===t.d&&O.includes(V.key))||t.p;if(0<t.b.length)for(let e=0;e<t.b.length;e++){let l=se(t.b[e],V);t=V.node,void 0!==l.done&&(n=l.done),r=r||!!l.fatal}if(!n){let n=!0,r=void 0===V.val;if(a===V.type)V.curerr.push(Le(a,V,1070));else if(v===V.type){let e;if(void 0!==t.c&&(t.c=re(t.c,1+V.dI)),t.r&&r?(V.ignoreVal=!0,V.curerr.push(Le(f,V,1010))):r||null!==V.val&&v===V.valType&&!K(V.val)?!l&&r&&void 0!==t.f?(V.updateVal(t.f),V.fromDflt=!0,e=V.val,n=!1):l&&r||(V.updateVal(V.val||(V.fromDflt=!0,{})),e=V.val):(V.curerr.push(Le(x,V,1020)),e=K(V.val)?V.val:{}),n&&(e=null==e&&!1===V.ctx.err?{}:e,null!=e)){V.ctx.log&&V.ctx.log("so",V);let n=!1,r=H(t.v),l=V.nI;if(0<r.length){n=!0,V.pI=l;for(let n=0;n<r.length;n++){let l,i=r[n];if(o.active&&i.endsWith(o.suffix)){if(l={short:""},d===typeof t.v[i]?l.short=t.v[i]:l={...l,...t.v[i]},delete t.v[i],n++,r.length<=n)break;if(r[n]!==i.substring(0,i.length-o.suffix.length))throw new Error("Invalid meta key: "+i);i=r[n]}let a=i,c=t.v[i];if(s.active){let e=/^\s*("(\\.|[^"\\])*"|[^\s]+):\s*(.*?)\s*$/.exec(i);e&&(a=e[1],c=ie({src:e[3],d:1+V.dI,meta:l},c),delete t.v[i])}if(u.active&&i.startsWith(u.keymark)){if(i===u.keymark){let e=ie({src:c,d:1+V.dI,meta:l,ancestors:V.ancestors,node:t},t);Object.assign(t,e)}else t.m.$$=t.m.$$||{},t.m.$$[i.substring(u.keymark.length)]=t.v[i];delete t.v[i];continue}let f=ne(c,1+V.dI,l);t.v[a]=f,t.k.includes(a)||t.k.push(a),V.nodes[V.nI]=f,V.vals[V.nI]=e[a],V.parents[V.nI]=e,V.keys[V.nI]=a,V.nI++}}let i=H(e).filter(e=>void 0===t.v[e]);if(0<i.length)if(void 0===t.c)V.ignoreVal=!0,V.curerr.push(Le(I,V,1100,void 0,{k:i}));else{n=!0,V.pI=l;for(let n of i){let r=t.c=ne(t.c,1+V.dI);V.nodes[V.nI]=r,V.vals[V.nI]=e[n],V.parents[V.nI]=e,V.keys[V.nI]=n,V.nI++}}n?(V.dI++,V.nodes[V.nI]=V.sI,V.parents[V.nI]=e,V.nextSibling=!1,V.nI++):V.ctx.log&&V.ctx.log("eo",V)}}else if(p===V.type)if(t.r&&r)V.ignoreVal=!0,V.curerr.push(Le(f,V,1030));else if(r||K(V.val)){if(!l&&r&&void 0!==t.f)V.updateVal(t.f),V.fromDflt=!0;else if(!l||null!=V.val){V.updateVal(V.val||(V.fromDflt=!0,[]));let n=void 0!==t.c,r=0<V.val.length,l=H(t.v).filter(e=>!isNaN(+e)),i=0<l.length;if(n&&(t.c=re(t.c,1+V.dI)),V.ctx.log&&V.ctx.log("sa",V),r||i){V.pI=V.nI;let e=0;if(i)if(l.length<V.val.length&&!n)V.ignoreVal=!0,V.curerr.push(Le(I,V,1090,void 0,{k:l.length}));else for(;e<l.length;e++){let n=t.v[e]=ne(t.v[e],1+V.dI);V.nodes[V.nI]=n,V.vals[V.nI]=V.val[e],V.parents[V.nI]=V.val,V.keys[V.nI]=""+e,V.nI++}if(n&&r){let n=t.c;for(;e<V.val.length;e++)V.nodes[V.nI]=n,V.vals[V.nI]=V.val[e],V.parents[V.nI]=V.val,V.keys[V.nI]=""+e,V.nI++}V.ignoreVal||(V.dI++,V.nodes[V.nI]=V.sI,V.parents[V.nI]=V.val,V.nextSibling=!1,V.nI++)}else V.ctx.log&&n&&null==e&&V.ctx.log("kv",{...V,key:0,val:t.c}),V.ctx.log&&V.ctx.log("ea",V)}}else V.curerr.push(Le(x,V,1040));else if(S===V.type)r&&!t.r?V.ignoreVal=!0:d!==V.valType?(V.ignoreVal=!0,V.curerr.push(Le(x,V,1045))):V.val.match(t.v)||(V.ignoreVal=!0,V.curerr.push(Le(S,V,1045)));else if(m===V.type||b===V.type||j===V.type||void 0===V.val||V.type===V.valType||$===V.type&&t.u.i&&V.val instanceof t.u.i||k===V.type&&null===V.val)if(void 0===V.val){let e=V.path[V.dI];l||!t.r||y===V.type&&V.parent.hasOwnProperty(e)?void 0!==t.f&&!l||y===V.type?(V.updateVal(t.f),V.fromDflt=!0):m===V.type&&(V.ignoreVal=void 0===V.ignoreVal||V.ignoreVal):(V.ignoreVal=!0,V.curerr.push(Le(f,V,1060))),V.ctx.log&&V.ctx.log("kv",V)}else d!==V.type||""!==V.val||t.u.empty||V.curerr.push(Le(f,V,1080)),V.ctx.log&&V.ctx.log("kv",V);else V.curerr.push(Le(x,V,1050))}if(0<t.a.length)for(let e=0;e<t.a.length;e++){let l=se(t.a[e],V);t=V.node,void 0!==l.done&&(n=l.done),r=r||!!l.fatal}let i=l?!1!==V.ignoreVal:!!V.ignoreVal;!V.match&&null!=V.parent&&!n&&!i&&(V.parent[V.key]=V.val),V.nextSibling&&(V.pI=V.sI),(V.node.e||r)&&V.err.push(...V.curerr)}if(0<V.err.length)if(K(V.ctx.err))V.ctx.err.push(...V.err);else if(!V.match&&!1!==V.ctx.err)throw new Y(w,i.name,V.err,V.ctx);return V.match?0===V.err.length:V.root}function O(e,t){return N(e,t,!1)}return O.valid=function(e,t){let n=t||{};return n.err=n.err||[],N(e,n,!1),0===n.err.length},O.match=(e,t)=>N(e,t=t||{},!0),O.error=(e,t)=>{let n=t||{};return n.err=n.err||[],N(e,n,!1),n.err},O.spec=()=>{O(void 0,{err:!1});const e=qe(h,(e,t)=>n===t||t,!1,!0);return Z(e)},O.node=()=>(O.spec(),h),O.stringify=(...e)=>{const t=O.jsonify();return""===g?g="string"==typeof t?t.replace(/^"(.*)"$/,"$1"):JSON.stringify(t,...e):g},O.jsonify=()=>null==c?c=_e(O.node()):c,O.toString=()=>(g=ae(""===g?qe(null==h||!h.$||n!==h.$.gubu$&&!0!==h.$.gubu$?h:h.v,null,!0):g),`[Gubu ${i.name} ${g}]`),e.inspect&&e.inspect.custom&&(O[e.inspect.custom]=O.toString),O.gubu=r,O.spec(),O}function ie(e,t){var n,r;let l,i=!1;"string"==typeof e&&(e={src:e}),e.keymark=e.keymark||"$$";const o=null===(n=null==t?void 0:t.$)||void 0===n?void 0:n.gubu$;if(e.i=e.i||0,null==e.tokens){l=null!=e.val?ne(e.val,(e.d||0)+1,e.meta):void 0,i=!0,e.tokens=[];let n=/\s*,?\s*([)(\.]|"(\\.|[^"\\])*"|\/(\\.|[^\/\\])*\/[a-z]?|[^)(,.\s]+)\s*/g,r=null;for(;r=n.exec(e.src);)e.tokens.push(r[1]);if(!o){let n=0,r=!1;for(;n<e.tokens.length;n++)if(")"==e.tokens[n]){r=!0;break}if((r||n===e.tokens.length)&&void 0!==t){let l="token_"+e.d+"_"+e.i;e.refs=e.refs||{},e.refs[l]=t,r?e.tokens.splice(n,0,e.keymark+l):e.tokens.push("(",e.keymark+l,")")}}}let s=e.tokens[e.i],u=Ke[s];if(")"===e.tokens[e.i])return e.i++,t;e.i++;let a=[];if(null==u)try{let t;if(q[s])u=Ge,a.unshift(s);else{if(y===s)return;if("NaN"===s)return NaN;if(s.match(/^\/.+\/$/))return new RegExp(s.substring(1,s.length-1));if(t=s.match(/^\$\$([^$]+)$/))return e.node?((null===(r=e.node.m)||void 0===r?void 0:r.$$)||{})[t[1]]||e.node.v["$$"+t[1]]:e.refs?e.refs[t[1]]:void 0;{let e=Z(s);if(!i)return e;u=me,a.unshift(e)}}}catch(c){throw new SyntaxError(`Gubu: unexpected token ${s} in builder expression ${e.src}`)}if("("===e.tokens[e.i]){e.i++;let t=null;for(;null!=(t=e.tokens[e.i])&&")"!==t;){let t=ie(e);a.push(t)}e.i++}return l=o?u.call(t,...a):u.call(void 0,...a),"."===e.tokens[e.i]?(e.i++,l=ie(e,l)):i&&e.i<e.tokens.length&&(l=ie(e,l)),l}function oe(e,t={},n=!0){let r;const l=Array.isArray(e)?"array":null===e?"null":typeof e;return"string"===l?r=ie(e):"number"===l||"boolean"===l?r=e:v===l?r=Object.entries(e).reduce((e,n)=>{var r;return e[n[0]]=((null===(r=t.valexpr)||void 0===r?void 0:r.keymark)||"$$")===n[0]?n[1]:oe(n[1],t,!1),e},{}):p===l&&(r=e.map(e=>oe(e,t,!1))),n?(t.valexpr=t.valexpr||{},t.valexpr.active=!0,Ze(r,t)):r}function se(e,t){var n;let r,l={},i=!1;try{i=!(void 0!==t.val||!(null===(n=e.gubu$)||void 0===n?void 0:n.Check))||(t.check=e,e(t.val,l,t))}catch(s){r=s}let o=K(l.err)?0<l.err.length:null!=l.err;if(!i||o){if(void 0===t.val&&(t.node.p||!t.node.r)&&!0!==l.done)return delete l.err,l;let n=l.why||j,i=ue(t);if(d===typeof l.err)t.curerr.push(ze(t,l.err));else if(v===typeof l.err)t.curerr.push(...[l.err].flat().filter(e=>null!=e).map(e=>(e.p=null==e.p?i:e.p,e.m=null==e.m?2010:e.m,e)));else{let l=e.name;null!=l&&""!=l||(l=ae(e.toString().replace(/[ \t\r\n]+/g," "))),t.curerr.push(Le(n,t,1045,void 0,{thrown:r},l))}l.done=null==l.done||l.done}return l.hasOwnProperty("uval")?(t.updateVal(l.uval),t.ignoreVal=!1):void 0===l.val||Number.isNaN(l.val)||(t.updateVal(l.val),t.ignoreVal=!1),void 0!==l.node&&(t.node=l.node),void 0!==l.type&&(t.type=l.type),l}function ue(e){return e.path.slice(1,e.dI+1).filter(e=>null!=e).join(".")}function ae(e,t){let n=String(e),r=null==t||isNaN(t)?30:t<0?0:~~t,l=null==e?0:n.length,i=null==e?"":n.substring(0,l);return i=r<l?i.substring(0,r-3)+"...":i,i.substring(0,r)}const ce=function(e){var t;let n=Pe(this,e);return n.r=!0,n.p=!1,void 0===e?(n.f=void 0,1===arguments.length&&(n.t=y,n.v=void 0)):(null===(t=null==this?void 0:this.$)||void 0===t?void 0:t.gubu$)&&(n.f=void 0),n},fe=function(e){let t=Pe(this,e);return t.c=he(),t},pe=function(e){let t=Pe(this,e);return t.r=!1,void 0===e&&1===arguments.length&&(t.t=y,t.v=void 0),t},he=function(e){let t=Pe(this,e);return t.t=m,void 0!==e&&(t.v=e,t.f=e),t},ve=function(e,t){let n=Pe(this,t);return n.z=e,n},de=function(e){let t=Pe(this,e);return t.r=!1,t.p=!0,t},ge=function(e){let t=Pe(this,e);return t.r=!1,t.p=!0,t.e=!1,t.a.push((function(e,t,n){return 0<n.curerr.length&&(t.uval=void 0,t.done=!1),!0})),t},ye=function(e){let t=Pe(this);return t.t=h,t.v=e,t.f=e,t},me=function(e,t){let n=Pe(this,e);if(void 0!==t&&(n=Pe(n,t)),n.r=!1,n.f=e,void 0===t){h===typeof e&&ee[e.name]&&(n.t=e.name.toLowerCase(),n.f=He(te[n.t]))}else{const e=ne(t);n.t=e.t}return n.p=!1,n},be=function(e){let t=Pe(this,e);return t.u.empty=!0,t},$e=function(e){let t=Pe(this,e);return t.t=a,t},ke=function(e,t){let n=Pe(this),r=c===typeof e;n.t=d,r&&null==t&&(n=ne([]));let l=null;return h===typeof e&&(l=e,n=he()),n.b.push((function(n,i,o){if(l)i.val=l(o.path,o);else if(r){let n=e;i.val=o.path.slice(o.path.length-1-(0<=n?n:0),o.path.length-1+(0<=n?0:1)),d===typeof t&&(i.val=i.val.join(t))}else null==e&&(i.val=o.path[o.path.length-2]);return!0})),n},xe=function(...e){const t=Pe(this);t.t=b,t.r=!0;const n=e.map(e=>Ze(e));t.u.list=n.map(e=>e.node());const r=function(t,r,l){let i=!0;for(let e of n){let n={...l.ctx,err:[]};e(t,n),0<n.err.length&&(i=!1)}return i||(r.why=G,r.err=[ze(l,E+" "+_+z+L+" does not satisfy all of: "+e.map(e=>qe(e,null,!0)).join(", "))]),i};return r.n=G,r.a=e,t.b.push(r),t},Ie=function(...e){let t=Pe(this);t.t=b,t.r=!0;let n=e.map(e=>Ze(e));t.u.list=n.map(e=>e.node());const r=function(t,r,l){let i=!1;for(let e of n){let n={...l.ctx,err:[]},o=e.match(t,n);o&&(r.val=e(t,n)),i||(i=o)}return i||(r.why=P,r.err=[ze(l,E+" "+_+z+L+" does not satisfy any of: "+e.map(e=>qe(e,null,!0)).join(", "))]),i};return r.n=P,r.a=e,t.b.push(r),t},we=function(...e){let t=Pe(this);t.t=b,t.r=!0;let n=e.map(e=>Ze(e));t.u.list=n.map(e=>e.node());const r=function(t,r,l){let i=0;for(let e of n){let n={...l.ctx,err:[]};if(e.match(t,n)){i++,r.val=e(t,n);break}}return 1!==i&&(r.why=F,r.err=[ze(l,E+" "+_+z+L+" does not satisfy one of: "+e.map(e=>qe(e,null,!0)).join(", "))]),!0};return r.n=F,r.a=e,t.b.push(r),t},je=function(...e){const t=Pe(this),n=function(t,n,r){for(let l=0;l<e.length;l++)if(t===e[l])return!0;if(r.node.hasOwnProperty("f")&&void 0===t){const t=r.node.f;for(let n=0;n<e.length;n++)if(t===e[n])return!0}return n.err=ze(r,E+" "+_+z+L+" must be exactly one of: "+e.map(e=>qe(e,null,!0)).join(", ")),n.done=!0,!1};return n.n=J,n.a=e,n.s=()=>J+"("+e.map(e=>qe(e,null,!0)).join(",")+")",t.b.push(n),t},Se=function(e,t){let n=Pe(this,t);return n.b.push(e),n},Ne=function(e,t){let n=Pe(this,t);return n.a.push(e),n},Oe=function(e,t){let n=Pe(this,t);if(n.r=!0,h===typeof e){let t=e;t.gubu$=t.gubu$||{},t.gubu$.Check=!0,t.s=()=>B+"("+qe(e,null,!0)+")",n.b.push(e),n.t=j}else if(v===typeof e){if(Object.prototype.toString.call(e).includes("RegExp")){let t=t=>null!=t&&!Number.isNaN(t)&&!!String(t).match(e);U(t,s,{value:String(e)}),U(t,"gubu$",{value:{Check:!0}}),t.s=()=>B+"("+qe(e,null,!0)+")",n.b.push(t),n.t=j}}else d===typeof e&&(n.t=e);if(void 0!==t){const e=ne(t);n.t=e.t}return n},Ve=function(e){let t=Pe(this,e);return p===t.t&&void 0!==t.c&&0===t.n&&(t.v=[t.c]),t.c=void 0,t},Ae=function(e,t){let n=Pe(this,t),r=d===typeof e?e:(v===typeof e&&e||{}).name;return null!=r&&""!=r&&n.b.push((function(e,t,n){return(n.ctx.ref=n.ctx.ref||{})[r]=n.node,!0})),n},Re=function(e,t){let n=Pe(this,t),r=v===typeof e&&e||{},l=d===typeof e?e:r.name,i=!!r.fill;return null!=l&&""!=l&&n.b.push((function(e,t,n){if(void 0!==e||i){let e=n.ctx.ref=n.ctx.ref||{};if(void 0!==e[l]){let n={...e[l]};n.t=n.t||a,t.node=n,t.type=n.t}}return!0})),n},De=function(e,t){let n=Pe(this,t),r=v===typeof e&&e||{},l=d===typeof e?e:r.name,i=g===typeof r.keep?r.keep:void 0,o=K(r.claim)?r.claim:[];if(null!=l&&""!=l){let e=(e,t,n)=>{if(void 0===e&&0<o.length){n.ctx.Rename=n.ctx.Rename||{},n.ctx.Rename.fromDflt=n.ctx.Rename.fromDflt||{};for(let e of o){let r=n.ctx.Rename.fromDflt[e]||{};if(void 0!==n.parent[e]&&!r.yes){t.val=n.parent[e],n.match||(n.parent[l]=t.val),t.node=r.node;for(let e=0;e<n.err.length;e++)n.err[e].k===r.key&&(n.err.splice(e,1),e--);if(i){let t=n.cI+1;n.nodes.splice(t,0,ne(r.dval)),n.vals.splice(t,0,void 0),n.parents.splice(t,0,n.parent),n.keys.splice(t,0,e),n.nI++,n.pI++}else delete n.parent[e];break}}void 0===t.val&&(t.val=n.node.v)}return!0};U(e,s,{value:"Rename:"+l}),n.b.push(e);let t=(e,t,n)=>(n.parent[l]=e,n.match||i||n.key===l||K(n.parent)&&!1!==i||(delete n.parent[n.key],t.done=!0),n.ctx.Rename=n.ctx.Rename||{},n.ctx.Rename.fromDflt=n.ctx.Rename.fromDflt||{},n.ctx.Rename.fromDflt[l]={yes:n.fromDflt,key:n.key,dval:n.node.v,node:n.node},!0);U(t,s,{value:"Rename:"+l}),n.a.push(t)}return n},Ee=function(e,t){let n=Pe(this,t);return n.c=ne(e),void 0===n.v&&(n.t="object",n.v={},n.f={}),n},Ce=function(e,t){let n=Pe(this,t||[]);return n.t="array",n.c=ne(e),n.m=n.m||{},n.m.rest=!0,n},Ge=function(e,t){let n=ne(q[e]),r=Pe(this,t);return r!==n&&(r.t=n.t,r.r=n.r,r.p=n.p,r.v=n.v),r};function Te(e,t,n,r,l){let i=Pe(e,n);t=+t;let o=function(e,n,r){return l(function(e){return c===typeof e?e:c===typeof(null==e?void 0:e.length)?e.length:null!=e&&v===typeof e?H(e).length:NaN}(e),t,e,n,r)};return Object.defineProperty(o,s,{value:r}),o.n=r,o.a=[t],o.s=()=>r+"("+t+")",o[Symbol.for("nodejs.util.inspect.custom")]=o.s(),o.toJSON=()=>o.s(),i.b.push(o),i}const Be=function(e,t){return Te(this,e,t,M,(e,t,n,r,l)=>{if(t<=e)return!0;l.checkargs={min:1};let i=c===typeof n?"":"length ";return r.err=ze(l,E+" "+_+z+L+` must be a minimum ${i}of ${t} (was ${e}).`),!1})},Je=function(e,t){return Te(this,e,t,W,(e,t,n,r,l)=>{if(e<=t)return!0;let i=c===typeof n?"":"length ";return r.err=ze(l,E+" "+_+z+L+` must be a maximum ${i}of ${t} (was ${e}).`),!1})},We=function(e,t){return Te(this,e,t,C,(e,t,n,r,l)=>{if(t<e)return!0;let i=c===typeof n?"be":"have length";return r.err=ze(l,E+" "+_+z+L+` must ${i} above ${t} (was ${e}).`),!1})},Me=function(e,t){return Te(this,e,t,T,(e,t,n,r,l)=>{if(e<t)return!0;let i=c===typeof n?"be":"have length";return r.err=ze(l,E+" "+_+z+L+` must ${i} below ${t} (was ${e}).`),!1})},Fe=function(e,t){return Te(this,e,t,T,(e,t,n,r,l)=>{if(t===e)return!0;let i=c===typeof n?"":" in length";return r.err=ze(l,E+" "+_+z+L+` must be exactly ${t}${i} (was ${e}).`),!1})};function Pe(e,t){let n,r=null!=e&&(e.window===e||e.global===e);if(void 0!==e&&!r||void 0===t)if(void 0===e||r)n=ne(void 0);else if(void 0!==t){n=ne(t);let r=ne(e);void 0===n.v&&"list"!==n.t&&(n.v=r.v,n.t=r.t),["f","r","p","c","e","z"].map(e=>n[e]=void 0!==r[e]?r[e]:n[e]),n.u=Object.assign({...r.u},n.u),n.m=Object.assign({...r.m},n.m),n.a=r.a.concat(n.a),n.b=r.b.concat(n.b)}else n=ne(e);else n=ne(t);return n.Above?n:Object.assign(n,{Above:We,After:Ne,Any:he,Before:Se,Below:Me,Check:Oe,Child:Ee,Closed:Ve,Default:me,Define:Ae,Empty:be,Exact:je,Fault:ve,Ignore:ge,Len:Fe,Max:Je,Min:Be,Never:$e,Open:fe,Refer:Re,Rename:De,Required:ce,Rest:Ce,Skip:de,Type:Ge})}function ze(e,t,n,r){return Le(n||j,e,4e3,t,r)}function Le(e,t,n,r,l,i){var o;let s={key:t.key,node:t.node,value:t.val,path:ue(t),why:e,check:(null===(o=t.check)||void 0===o?void 0:o.name)||"none",args:t.checkargs||{},mark:n,text:"",use:l||{}},u=ae((void 0===t.val?y:qe(t.val)).replace(/"/g,""));if(null==(r=r||t.node.z)||""===r){let n=u.startsWith("[")?p:u.startsWith("{")?v:null==t.val||c===typeof t.val&&isNaN(t.val)?"value":typeof t.val,r=u.startsWith("[")||K(t.parents[t.pI])?"index":"property",o="is",h=null==l?void 0:l.k;h=K(h)?(r=1<h.length?(o="are","properties"):r,h.join(", ")):h,s.text="Validation failed for "+(0<s.path.length?`${r} "${s.path}" with `:"")+`${n} "${u}" because `+(x===e?$===t.node.t?`the ${n} is not an instance of ${t.node.u.n}`:`the ${n} is not of type ${S===t.node.t?d:t.node.t}`:f===e?""===t.val?"an empty string is not allowed":`the ${n} is required`:"closed"===e?`the ${r} "${h}" ${o} not allowed`:S===e?"the string did not match "+t.node.v:a===e?"no value is allowed":`check "${null==i?e:i}" failed`)+(s.use.thrown?" (threw: "+s.use.thrown.message+")":".")}else s.text=r.replace(/\$VALUE/g,u).replace(/\$PATH/g,s.path);return s}function _e(e){var t;let n=e.t;const r={number:O,string:N,boolean:V};if(r[n]){let t="";return e.r&&(t+=r[n]),""===t&&(t=JSON.stringify(e.v)),t+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),t}if(m===n){let n="";return e.r&&(n+="Required()"),"any"==(null===(t=e.c)||void 0===t?void 0:t.t)&&(n+=(""===n?"":".")+"Open()"),n+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),n.startsWith(".")&&(n=n.slice(1)),""===n&&(n="Any()"),n}if(j===n){let t="";return t+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),t.startsWith(".")&&(t=t.slice(1)),t}if(v===n){let t={};for(let n in e.v)t[n]=_e(e.v[n]);return void 0!==e.c&&(r[e.c.t]?t.$$="Child("+r[e.c.t]+")":"any"===e.c.t?t.$$="Open()":(t.$$="Child($$child)",t.$$child=_e(e.c))),0<e.b.length&&(void 0===t.$$&&(t.$$=""),t.$$+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),t.$$.startsWith(".")&&(t.$$=t.$$.slice(1))),t.$$&&1===Object.keys(t).length&&t.$$.startsWith("Child")?t.$$:t}if("list"===n){let t={},n=0,r=e.u.list.map(e=>_e(e)).map((e,r)=>v===typeof e?(t[r="$$ref"+n++]=e,r):e),l=(e.b[0].n||e.b[0].name)+"("+r.join(",")+")";return 0===n?l:{$$:l,...t}}if("array"===n){let t=[];return void 0!==e.c?t[0]=_e(e.c):t=Object.keys(e.v).reduce((t,n)=>(t[+n]=e.v[n],t),[]).map(e=>_e(e)),t}}function qe(e,t,r,l){let o;if(!l&&e&&e.$&&(n===e.$.gubu$||!0===e.$.gubu$))return e=JSON.stringify(_e(e)),r&&(e="string"==typeof e?e.replace(/\\/g,"").replace(/"/g,""):""),e;try{o=Q(e,(e,o)=>{var s,u,a;if(t&&(o=t(e,o)),null!=o&&v===typeof o&&o.constructor&&A!==o.constructor.name&&R!==o.constructor.name)o="[object RegExp]"===i.call(o)||h===typeof o.toString?o.toString():o.constructor.name;else if(l||n!==(null===(s=null==o?void 0:o.$)||void 0===s?void 0:s.gubu$))if(h===typeof o)o=h===typeof le[o.name]&&isNaN(+e)?void 0:null!=o.name&&""!==o.name?o.name:ae(o.toString().replace(/[ \t\r\n]+/g," "));else if("bigint"==typeof o)o=String(o.toString());else{if(Number.isNaN(o))return"NaN";!0===l||!0!==(null===(u=null==o?void 0:o.$)||void 0===u?void 0:u.gubu$)&&n!==(null===(a=null==o?void 0:o.$)||void 0===a?void 0:a.gubu$)||(o=JSON.stringify(_e(o)))}else"number"===o.t||"string"===o.t||"boolean"===o.t?o=o.v:(o=_e(o),o=JSON.stringify(o),r&&(o="string"==typeof o?o.replace(/\\/g,"").replace(/"/g,""):""));return o}),o=String(o)}catch(s){o=Q(String(e))}return!0===r&&(o=o.replace(/^"/,"").replace(/"$/,"")),o}function He(e){return null==e||v!==typeof e?e:Z(Q(e))}const Ue=e=>ne({...e,$:{gubu$:!0}}),Ke={Above:We,After:Ne,All:xe,Any:he,Before:Se,Below:Me,Check:Oe,Child:Ee,Closed:Ve,Default:me,Define:Ae,Empty:be,Exact:je,Fault:ve,Func:ye,Ignore:ge,Key:ke,Len:Fe,Max:Je,Min:Be,Never:$e,One:we,Open:fe,Optional:pe,Refer:Re,Rename:De,Required:ce,Skip:de,Some:Ie,Rest:Ce,Type:Ge};if(y!==typeof window)for(let Ye in Ke)U(Ke[Ye],s,{value:Ye});Object.assign(le,{Gubu:le,...Ke,...Object.entries(Ke).reduce((e,t)=>(e["G"+t[0]]=t[1],e),{}),isShape:e=>e&&r===e.gubu,G$:Ue,buildize:Pe,makeErr:ze,stringify:qe,truncate:ae,nodize:ne,expr:ie,build:oe,MakeArgu:Qe}),U(le,s,{value:o});const Ze=le;t.Gubu=Ze;function Qe(e){return function(t,n,r){let l=!1;d===typeof t&&(l=!0,r=n,n=t);const i=Ze(r=r||n,{name:e+(n=d===typeof n?" ("+n+")":"")}),o=i.node(),s=o.k;let u=t,a={},c=0,f=0;for(;c<s.length;c++){let e=o.v[s[c]];e.p&&(e=o.v[s[c]]=(t=>Ne((function(e,n,r){if(0<r.curerr.length){f++;for(let e=s.length-1;e>t;e--)o.v[s[e]].m.rest?a[s[e]].splice(o.v[s[e]].m.rest_pos+t-e,0,a[s[e-1]]):(r.vals[r.pI+e-t]=r.vals[r.pI+e-t-1],a[s[e]]=a[s[e-1]]);n.uval=void 0,n.done=!1}return!0}),e))(c),e.e=!1),c!==s.length-1||o.v[s[c]].m.rest||(o.v[s[c]]=Ne((function(e,t,n){return!(s.length-f<u.length&&(0===n.curerr.length&&(t.err=`Too many arguments for type signature (was ${u.length}, expected ${s.length-f})`),t.fatal=!0,1))}),o.v[s[c]]))}function p(e){for(let t=0;t<s.length;t++){let n=o.v[s[t]];n.m.rest?(a[s[t]]=[...e].slice(t),n.m.rest_pos=a[s[t]].length):a[s[t]]=e[t]}return a}return l?function(e){return u=e,a={},c=0,f=0,i(p(e))}:i(p(t))}}const{Gubu:Xe}=t;return Xe})); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Gubu=e()}}((function(){var e={},t={};Object.defineProperty(t,"__esModule",{value:!0}),t.Gubu=void 0;const n=Symbol.for("gubu$"),r={gubu$:n,v$:"8.2.1"},l=/^[A-Z]/,{toString:i}=Object.prototype,o="gubu",s="name",u="nan",a="never",c="number",f="required",p="array",h="function",v="object",d="string",g="boolean",y="undefined",m="any",b="list",$="instance",k="null",x="type",I="closed",w="shape",j="check",S="regexp",N="String",O="Number",V="Boolean",A="Object",R="Array",D="Function",E="Value",C="Above",G="All",T="Below",B="Check",J="Exact",W="Max",M="Min",F="One",P="Some",z=" for property ",L='"$PATH"',_='"$VALUE"',q={[N]:String,[O]:Number,[V]:Boolean,[A]:Object,[R]:Array,["Symbol"]:Symbol,[D]:Function},H=e=>Object.keys(e),U=(e,t,n)=>Object.defineProperty(e,t,n),K=e=>Array.isArray(e),Z=e=>JSON.parse(e),Q=(e,t)=>JSON.stringify(e,t);class X{constructor(e,t,n,r){this.match=!1,this.dI=0,this.nI=2,this.cI=-1,this.pI=0,this.sI=-1,this.valType=a,this.isRoot=!1,this.key="",this.type=a,this.stop=!0,this.nextSibling=!0,this.fromDflt=!1,this.ignoreVal=void 0,this.curerr=[],this.err=[],this.parents=[],this.keys=[],this.ancestors=[],this.path=[],this.root=e,this.vals=[e,-1],this.node=t,this.nodes=[t,-1],this.ctx=n||{},this.match=!!r}next(){this.stop=!1,this.fromDflt=!1,this.ignoreVal=void 0,this.isRoot=0===this.pI,this.check=void 0;let e=this.nodes[this.pI];for(this.ancestors[this.dI]=this.node;+e;)this.dI--,this.ctx.log&&-1<this.dI&&this.ctx.log("e"+(K(this.parents[this.pI])?"a":"o"),this),this.pI=+e,e=this.nodes[this.pI];e?(this.node=e,this.updateVal(this.vals[this.pI]),this.key=this.keys[this.pI],this.cI=this.pI,this.sI=this.pI+1,Object.isFrozen(this.parents[this.pI])&&(this.parents[this.pI]={...this.parents[this.pI]}),this.parent=this.parents[this.pI],this.nextSibling=!0,this.type=this.node.t,this.path[this.dI]=this.key,this.oval=this.val,this.curerr.length=0):this.stop=!0}updateVal(e){this.val=e,this.valType=typeof this.val,c===this.valType&&isNaN(this.val)&&(this.valType=u),this.isRoot&&!this.match&&(this.root=this.val)}}class Y extends TypeError{constructor(e,t,n,r){var l;super((t=null==t||t.startsWith("G$")?"":t+": ")+n.map(e=>e.text).join("\n")),this.gubu=!0,this.name="GubuError",this.code=e,this.gname=t,this.desc=()=>({name:"GubuError",code:e,err:n,ctx:r}),this.stack=null===(l=this.stack)||void 0===l?void 0:l.replace(/.*\/gubu\/gubu\.[tj]s.*\n/g,""),this.props=n.map(e=>{var t;return{path:e.path,what:e.why,type:null===(t=e.node)||void 0===t?void 0:t.t,value:e.value}})}toJSON(){return{...this,err:this.desc().err,name:this.name,message:this.message}}}const ee={Array:!0,BigInt:!0,Boolean:!0,Function:!0,Number:!0,Object:!0,String:!0,Symbol:!0},te={string:"",number:0,boolean:!1,object:{},array:[],symbol:Symbol(""),bigint:BigInt(0),null:null,regexp:/.*/};function ne(e,t,o){var s,a,f,g;if(le===e)e=void 0;else if(null!=e&&(null===(s=e.$)||void 0===s?void 0:s.gubu$)){if(n===e.$.gubu$)return e.d=null==t?e.d:t,e;if(!0===e.$.gubu$){let r={...e};return r.$={v$:"8.2.1",...r.$,gubu$:n},r.v=null!=r.v&&v===typeof r.v?{...r.v}:r.v,r.t=r.t||typeof r.v,h===r.t&&ee[r.v.name]&&(r.t=r.v.name.toLowerCase(),r.v=He(te[r.t]),r.f=r.v),r.r=!!r.r,r.p=!!r.p,r.d=null==t?null==r.d?-1:r.d:t,r.b=r.b||[],r.a=r.a||[],r.u=r.u||{},r.m=r.m||o||{},r}}let b=null===e?k:typeof e;b=y===b?m:b;let x,I=e,w=I,j=!1,N={},O=[],V=[];if(v===b)w=void 0,K(I)?(b=p,1===I.length&&(x=I[0],I=[])):null!=I&&Function!==I.constructor&&Object!==I.constructor&&null!=I.constructor?("[object RegExp]"===i.call(I)?(b=S,j=!0):(b=$,N.n=I.constructor.name,N.i=I.constructor),w=I):0===H(I).length&&(x=he());else if(h===b)if(ee[e.name])b=e.name.toLowerCase(),j=!0,I=He(te[b]),w=I,A===e.name&&(x=he());else if(I.gubu===r||!0===(null===(a=I.$)||void 0===a?void 0:a.gubu)){let e=I.node?I.node():I;b=e.t,I=e.v,w=I,j=e.r,N={...e.u},O=[...e.a],V=[...e.b]}else D===I.constructor.name&&l.test(I.name)&&(b=$,j=!0,N.n=null===(g=null===(f=I.prototype)||void 0===f?void 0:f.constructor)||void 0===g?void 0:g.name,N.i=I);else c===b&&isNaN(I)?b=u:d===b&&""===I&&(N.empty=!0);let R=null==I||v!==b&&p!==b?I:{...I};return{$:r,t:b,v:R,f:w,n:null!=R&&v===typeof R?H(R).length:0,c:x,r:j,p:!1,d:null==t?-1:t,k:[],e:!0,u:N,a:O,b:V,m:o||{},[Symbol.for("nodejs.util.inspect.custom")](){const e={...this};return delete e.$,JSON.stringify(e,(e,t)=>"function"!=typeof t||Ke[t.name]?t:t.name).replace(/"/g,"").replace(/,/g," ")}}}function re(e,t){var n;const r=[[{},"root",e,t]];for(let l=0;l<r.length;l++){const e=r[l],t=e[0][e[1]]=ne(e[2],e[3]);void 0!==t.c&&((null===(n=t.c.$)||void 0===n?void 0:n.gubu$)||r.push([t,"c",t.c,t.d]));let i=typeof t.v;v===i&&null!=t.v&&Object.entries(t.v).map(e=>{var n;(null===(n=e[1].$)||void 0===n?void 0:n.gubu$)||r.push([t.v,e[0],e[1],t.d+1])})}return r[0][0].root}function le(t,l){const i=null==l?{}:l;i.name=null==i.name?"G$"+(""+Math.random()).substring(2,8):""+i.name;let o=i.meta=i.meta||{};o.active=!0===o.active||!1,o.suffix=d==typeof o.suffix?o.suffix:"$$";let s=i.keyexpr=i.keyexpr||{};s.active=!1!==s.active;let u=i.valexpr=i.valexpr||{};u.active=!0===u.active,u.keymark=d==typeof u.keymark?u.keymark:o.suffix;let c,h=ne(t,0),g="";function N(e,t,n){var r,l,c;const g=null===(r=null==t?void 0:t.skip)||void 0===r?void 0:r.depth,N=Array.isArray(null===(l=null==t?void 0:t.skip)||void 0===l?void 0:l.depth)?t.skip.depth:null,O=Array.isArray(null===(c=null==t?void 0:t.skip)||void 0===c?void 0:c.keys)?t.skip.keys:null,V=new X(e,h,t,n);for(;V.next(),!V.stop;){let t=V.node,n=!1,r=!1,l=!!(t.d===g||N&&N.includes(t.d)||O&&1===t.d&&O.includes(V.key))||t.p;if(0<t.b.length)for(let e=0;e<t.b.length;e++){let l=se(t.b[e],V);t=V.node,void 0!==l.done&&(n=l.done),r=r||!!l.fatal}if(!n){let n=!0,r=void 0===V.val;if(a===V.type)V.curerr.push(Le(a,V,1070));else if(v===V.type){let e;if(void 0!==t.c&&(t.c=re(t.c,1+V.dI)),t.r&&r?(V.ignoreVal=!0,V.curerr.push(Le(f,V,1010))):r||null!==V.val&&v===V.valType&&!K(V.val)?!l&&r&&void 0!==t.f?(V.updateVal(t.f),V.fromDflt=!0,e=V.val,n=!1):l&&r||(V.updateVal(V.val||(V.fromDflt=!0,{})),e=V.val):(V.curerr.push(Le(x,V,1020)),e=K(V.val)?V.val:{}),n&&(e=null==e&&!1===V.ctx.err?{}:e,null!=e)){V.ctx.log&&V.ctx.log("so",V);let n=!1,r=H(t.v),l=V.nI;if(0<r.length){n=!0,V.pI=l;for(let n=0;n<r.length;n++){let l,i=r[n];if(o.active&&i.endsWith(o.suffix)){if(l={short:""},d===typeof t.v[i]?l.short=t.v[i]:l={...l,...t.v[i]},delete t.v[i],n++,r.length<=n)break;if(r[n]!==i.substring(0,i.length-o.suffix.length))throw new Error("Invalid meta key: "+i);i=r[n]}let a=i,c=t.v[i];if(s.active){let e=/^\s*("(\\.|[^"\\])*"|[^\s]+):\s*(.*?)\s*$/.exec(i);e&&(a=e[1],c=ie({src:e[3],d:1+V.dI,meta:l},c),delete t.v[i])}if(u.active&&i.startsWith(u.keymark)){if(i===u.keymark){let e=ie({src:c,d:1+V.dI,meta:l,ancestors:V.ancestors,node:t},t);Object.assign(t,e)}else t.m.$$=t.m.$$||{},t.m.$$[i.substring(u.keymark.length)]=t.v[i];delete t.v[i];continue}let f=ne(c,1+V.dI,l);t.v[a]=f,t.k.includes(a)||t.k.push(a),V.nodes[V.nI]=f,V.vals[V.nI]=e[a],V.parents[V.nI]=e,V.keys[V.nI]=a,V.nI++}}let i=H(e).filter(e=>void 0===t.v[e]);if(0<i.length)if(void 0===t.c)V.ignoreVal=!0,V.curerr.push(Le(I,V,1100,void 0,{k:i}));else{n=!0,V.pI=l;for(let n of i){let r=t.c=ne(t.c,1+V.dI);V.nodes[V.nI]=r,V.vals[V.nI]=e[n],V.parents[V.nI]=e,V.keys[V.nI]=n,V.nI++}}n?(V.dI++,V.nodes[V.nI]=V.sI,V.parents[V.nI]=e,V.nextSibling=!1,V.nI++):V.ctx.log&&V.ctx.log("eo",V)}}else if(p===V.type)if(t.r&&r)V.ignoreVal=!0,V.curerr.push(Le(f,V,1030));else if(r||K(V.val)){if(!l&&r&&void 0!==t.f)V.updateVal(t.f),V.fromDflt=!0;else if(!l||null!=V.val){V.updateVal(V.val||(V.fromDflt=!0,[]));let n=void 0!==t.c,r=0<V.val.length,l=H(t.v).filter(e=>!isNaN(+e)),i=0<l.length;if(n&&(t.c=re(t.c,1+V.dI)),V.ctx.log&&V.ctx.log("sa",V),r||i){V.pI=V.nI;let e=0;if(i)if(l.length<V.val.length&&!n)V.ignoreVal=!0,V.curerr.push(Le(I,V,1090,void 0,{k:l.length}));else for(;e<l.length;e++){let n=t.v[e]=ne(t.v[e],1+V.dI);V.nodes[V.nI]=n,V.vals[V.nI]=V.val[e],V.parents[V.nI]=V.val,V.keys[V.nI]=""+e,V.nI++}if(n&&r){let n=t.c;for(;e<V.val.length;e++)V.nodes[V.nI]=n,V.vals[V.nI]=V.val[e],V.parents[V.nI]=V.val,V.keys[V.nI]=""+e,V.nI++}V.ignoreVal||(V.dI++,V.nodes[V.nI]=V.sI,V.parents[V.nI]=V.val,V.nextSibling=!1,V.nI++)}else V.ctx.log&&n&&null==e&&V.ctx.log("kv",{...V,key:0,val:t.c}),V.ctx.log&&V.ctx.log("ea",V)}}else V.curerr.push(Le(x,V,1040));else if(S===V.type)r&&!t.r?V.ignoreVal=!0:d!==V.valType?(V.ignoreVal=!0,V.curerr.push(Le(x,V,1045))):V.val.match(t.v)||(V.ignoreVal=!0,V.curerr.push(Le(S,V,1045)));else if(m===V.type||b===V.type||j===V.type||void 0===V.val||V.type===V.valType||$===V.type&&t.u.i&&V.val instanceof t.u.i||k===V.type&&null===V.val)if(void 0===V.val){let e=V.path[V.dI];l||!t.r||y===V.type&&V.parent.hasOwnProperty(e)?void 0!==t.f&&!l||y===V.type?(V.updateVal(t.f),V.fromDflt=!0):m===V.type&&(V.ignoreVal=void 0===V.ignoreVal||V.ignoreVal):(V.ignoreVal=!0,V.curerr.push(Le(f,V,1060))),V.ctx.log&&V.ctx.log("kv",V)}else d!==V.type||""!==V.val||t.u.empty||V.curerr.push(Le(f,V,1080)),V.ctx.log&&V.ctx.log("kv",V);else V.curerr.push(Le(x,V,1050))}if(0<t.a.length)for(let e=0;e<t.a.length;e++){let l=se(t.a[e],V);t=V.node,void 0!==l.done&&(n=l.done),r=r||!!l.fatal}let i=l?!1!==V.ignoreVal:!!V.ignoreVal;!V.match&&null!=V.parent&&!n&&!i&&(V.parent[V.key]=V.val),V.nextSibling&&(V.pI=V.sI),(V.node.e||r)&&V.err.push(...V.curerr)}if(0<V.err.length)if(K(V.ctx.err))V.ctx.err.push(...V.err);else if(!V.match&&!1!==V.ctx.err)throw new Y(w,i.name,V.err,V.ctx);return V.match?0===V.err.length:V.root}function O(e,t){return N(e,t,!1)}return O.valid=function(e,t){let n=t||{};return n.err=n.err||[],N(e,n,!1),0===n.err.length},O.match=(e,t)=>N(e,t=t||{},!0),O.error=(e,t)=>{let n=t||{};return n.err=n.err||[],N(e,n,!1),n.err},O.spec=()=>{O(void 0,{err:!1});const e=qe(h,(e,t)=>n===t||t,!1,!0);return Z(e)},O.node=()=>(O.spec(),h),O.stringify=(...e)=>{const t=O.jsonify();return""===g?g="string"==typeof t?t.replace(/^"(.*)"$/,"$1"):JSON.stringify(t,...e):g},O.jsonify=()=>null==c?c=_e(O.node()):c,O.toString=()=>(g=ae(""===g?qe(null==h||!h.$||n!==h.$.gubu$&&!0!==h.$.gubu$?h:h.v,null,!0):g),`[Gubu ${i.name} ${g}]`),e.inspect&&e.inspect.custom&&(O[e.inspect.custom]=O.toString),O.gubu=r,O.spec(),O}function ie(e,t){var n,r;let l,i=!1;"string"==typeof e&&(e={src:e}),e.keymark=e.keymark||"$$";const o=null===(n=null==t?void 0:t.$)||void 0===n?void 0:n.gubu$;if(e.i=e.i||0,null==e.tokens){l=null!=e.val?ne(e.val,(e.d||0)+1,e.meta):void 0,i=!0,e.tokens=[];let n=/\s*,?\s*([)(\.]|"(\\.|[^"\\])*"|\/(\\.|[^\/\\])*\/[a-z]?|[^)(,.\s]+)\s*/g,r=null;for(;r=n.exec(e.src);)e.tokens.push(r[1]);if(!o){let n=0,r=!1;for(;n<e.tokens.length;n++)if(")"==e.tokens[n]){r=!0;break}if((r||n===e.tokens.length)&&void 0!==t){let l="token_"+e.d+"_"+e.i;e.refs=e.refs||{},e.refs[l]=t,r?e.tokens.splice(n,0,e.keymark+l):e.tokens.push("(",e.keymark+l,")")}}}let s=e.tokens[e.i],u=Ke[s];if(")"===e.tokens[e.i])return e.i++,t;e.i++;let a=[];if(null==u)try{let t;if(q[s])u=Ge,a.unshift(s);else{if(y===s)return;if("NaN"===s)return NaN;if(s.match(/^\/.+\/$/))return new RegExp(s.substring(1,s.length-1));if(t=s.match(/^\$\$([^$]+)$/))return e.node?((null===(r=e.node.m)||void 0===r?void 0:r.$$)||{})[t[1]]||e.node.v["$$"+t[1]]:e.refs?e.refs[t[1]]:void 0;{let e=Z(s);if(!i)return e;u=me,a.unshift(e)}}}catch(c){throw new SyntaxError(`Gubu: unexpected token ${s} in builder expression ${e.src}`)}if("("===e.tokens[e.i]){e.i++;let t=null;for(;null!=(t=e.tokens[e.i])&&")"!==t;){let t=ie(e);a.push(t)}e.i++}return l=o?u.call(t,...a):u.call(void 0,...a),"."===e.tokens[e.i]?(e.i++,l=ie(e,l)):i&&e.i<e.tokens.length&&(l=ie(e,l)),l}function oe(e,t={},n=!0){let r;const l=Array.isArray(e)?"array":null===e?"null":typeof e;return"string"===l?r=ie(e):"number"===l||"boolean"===l?r=e:v===l?r=Object.entries(e).reduce((e,n)=>{var r;return e[n[0]]=((null===(r=t.valexpr)||void 0===r?void 0:r.keymark)||"$$")===n[0]?n[1]:oe(n[1],t,!1),e},{}):p===l&&(r=e.map(e=>oe(e,t,!1))),n?(t.valexpr=t.valexpr||{},t.valexpr.active=!0,Ze(r,t)):r}function se(e,t){var n;let r,l={},i=!1;try{i=!(void 0!==t.val||!(null===(n=e.gubu$)||void 0===n?void 0:n.Check))||(t.check=e,e(t.val,l,t))}catch(s){r=s}let o=K(l.err)?0<l.err.length:null!=l.err;if(!i||o){if(void 0===t.val&&(t.node.p||!t.node.r)&&!0!==l.done)return delete l.err,l;let n=l.why||j,i=ue(t);if(d===typeof l.err)t.curerr.push(ze(t,l.err));else if(v===typeof l.err)t.curerr.push(...[l.err].flat().filter(e=>null!=e).map(e=>(e.p=null==e.p?i:e.p,e.m=null==e.m?2010:e.m,e)));else{let l=e.name;null!=l&&""!=l||(l=ae(e.toString().replace(/[ \t\r\n]+/g," "))),t.curerr.push(Le(n,t,1045,void 0,{thrown:r},l))}l.done=null==l.done||l.done}return l.hasOwnProperty("uval")?(t.updateVal(l.uval),t.ignoreVal=!1):void 0===l.val||Number.isNaN(l.val)||(t.updateVal(l.val),t.ignoreVal=!1),void 0!==l.node&&(t.node=l.node),void 0!==l.type&&(t.type=l.type),l}function ue(e){return e.path.slice(1,e.dI+1).filter(e=>null!=e).join(".")}function ae(e,t){let n=String(e),r=null==t||isNaN(t)?30:t<0?0:~~t,l=null==e?0:n.length,i=null==e?"":n.substring(0,l);return i=r<l?i.substring(0,r-3)+"...":i,i.substring(0,r)}const ce=function(e){var t;let n=Pe(this,e);return n.r=!0,n.p=!1,void 0===e?(n.f=void 0,1===arguments.length&&(n.t=y,n.v=void 0)):(null===(t=null==this?void 0:this.$)||void 0===t?void 0:t.gubu$)&&(n.f=void 0),n},fe=function(e){let t=Pe(this,e);return t.c=he(),t},pe=function(e){let t=Pe(this,e);return t.r=!1,void 0===e&&1===arguments.length&&(t.t=y,t.v=void 0),t},he=function(e){let t=Pe(this,e);return t.t=m,void 0!==e&&(t.v=e,t.f=e),t},ve=function(e,t){let n=Pe(this,t);return n.z=e,n},de=function(e){let t=Pe(this,e);return t.r=!1,t.p=!0,t},ge=function(e){let t=Pe(this,e);return t.r=!1,t.p=!0,t.e=!1,t.a.push((function(e,t,n){return 0<n.curerr.length&&(t.uval=void 0,t.done=!1),!0})),t},ye=function(e){let t=Pe(this);return t.t=h,t.v=e,t.f=e,t},me=function(e,t){let n=Pe(this,e);if(void 0!==t&&(n=Pe(n,t)),n.r=!1,n.f=e,void 0===t){h===typeof e&&ee[e.name]&&(n.t=e.name.toLowerCase(),n.f=He(te[n.t]))}else{const e=ne(t);n.t=e.t}return n.p=!1,n},be=function(e){let t=Pe(this,e);return t.u.empty=!0,t},$e=function(e){let t=Pe(this,e);return t.t=a,t},ke=function(e,t){let n=Pe(this),r=c===typeof e;n.t=d,r&&null==t&&(n=ne([]));let l=null;return h===typeof e&&(l=e,n=he()),n.b.push((function(n,i,o){if(l)i.val=l(o.path,o);else if(r){let n=e;i.val=o.path.slice(o.path.length-1-(0<=n?n:0),o.path.length-1+(0<=n?0:1)),d===typeof t&&(i.val=i.val.join(t))}else null==e&&(i.val=o.path[o.path.length-2]);return!0})),n},xe=function(...e){const t=Pe(this);t.t=b,t.r=!0;const n=e.map(e=>Ze(e));t.u.list=n.map(e=>e.node());const r=function(t,r,l){let i=!0;for(let e of n){let n={...l.ctx,err:[]};e(t,n),0<n.err.length&&(i=!1)}return i||(r.why=G,r.err=[ze(l,E+" "+_+z+L+" does not satisfy all of: "+e.map(e=>qe(e,null,!0)).join(", "))]),i};return r.n=G,r.a=e,t.b.push(r),t},Ie=function(...e){let t=Pe(this);t.t=b,t.r=!0;let n=e.map(e=>Ze(e));t.u.list=n.map(e=>e.node());const r=function(t,r,l){let i=!1;for(let e of n){let n={...l.ctx,err:[]},o=e.match(t,n);o&&(r.val=e(t,n)),i||(i=o)}return i||(r.why=P,r.err=[ze(l,E+" "+_+z+L+" does not satisfy any of: "+e.map(e=>qe(e,null,!0)).join(", "))]),i};return r.n=P,r.a=e,t.b.push(r),t},we=function(...e){let t=Pe(this);t.t=b,t.r=!0;let n=e.map(e=>Ze(e));t.u.list=n.map(e=>e.node());const r=function(t,r,l){let i=0;for(let e of n){let n={...l.ctx,err:[]};if(e.match(t,n)){i++,r.val=e(t,n);break}}return 1!==i&&(r.why=F,r.err=[ze(l,E+" "+_+z+L+" does not satisfy one of: "+e.map(e=>qe(e,null,!0)).join(", "))]),!0};return r.n=F,r.a=e,t.b.push(r),t},je=function(...e){const t=Pe(this),n=function(t,n,r){for(let l=0;l<e.length;l++)if(t===e[l])return!0;if(r.node.hasOwnProperty("f")&&void 0===t){const t=r.node.f;for(let n=0;n<e.length;n++)if(t===e[n])return!0}return n.err=ze(r,E+" "+_+z+L+" must be exactly one of: "+e.map(e=>qe(e,null,!0)).join(", ")),n.done=!0,!1};return n.n=J,n.a=e,n.s=()=>J+"("+e.map(e=>qe(e,null,!0)).join(",")+")",t.b.push(n),t},Se=function(e,t){let n=Pe(this,t);return n.b.push(e),n},Ne=function(e,t){let n=Pe(this,t);return n.a.push(e),n},Oe=function(e,t){let n=Pe(this,t);if(n.r=!0,h===typeof e){let t=e;t.gubu$=t.gubu$||{},t.gubu$.Check=!0,t.s=()=>B+"("+qe(e,null,!0)+")",n.b.push(e),n.t=j}else if(v===typeof e){if(Object.prototype.toString.call(e).includes("RegExp")){let t=t=>null!=t&&!Number.isNaN(t)&&!!String(t).match(e);U(t,s,{value:String(e)}),U(t,"gubu$",{value:{Check:!0}}),t.s=()=>B+"("+qe(e,null,!0)+")",n.b.push(t),n.t=j}}else d===typeof e&&(n.t=e);if(void 0!==t){const e=ne(t);n.t=e.t}return n},Ve=function(e){let t=Pe(this,e);return p===t.t&&void 0!==t.c&&0===t.n&&(t.v=[t.c]),t.c=void 0,t},Ae=function(e,t){let n=Pe(this,t),r=d===typeof e?e:(v===typeof e&&e||{}).name;return null!=r&&""!=r&&n.b.push((function(e,t,n){return(n.ctx.ref=n.ctx.ref||{})[r]=n.node,!0})),n},Re=function(e,t){let n=Pe(this,t),r=v===typeof e&&e||{},l=d===typeof e?e:r.name,i=!!r.fill;return null!=l&&""!=l&&n.b.push((function(e,t,n){if(void 0!==e||i){let e=n.ctx.ref=n.ctx.ref||{};if(void 0!==e[l]){let n={...e[l]};n.t=n.t||a,t.node=n,t.type=n.t}}return!0})),n},De=function(e,t){let n=Pe(this,t),r=v===typeof e&&e||{},l=d===typeof e?e:r.name,i=g===typeof r.keep?r.keep:void 0,o=K(r.claim)?r.claim:[];if(null!=l&&""!=l){let e=(e,t,n)=>{if(void 0===e&&0<o.length){n.ctx.Rename=n.ctx.Rename||{},n.ctx.Rename.fromDflt=n.ctx.Rename.fromDflt||{};for(let e of o){let r=n.ctx.Rename.fromDflt[e]||{};if(void 0!==n.parent[e]&&!r.yes){t.val=n.parent[e],n.match||(n.parent[l]=t.val),t.node=r.node;for(let e=0;e<n.err.length;e++)n.err[e].k===r.key&&(n.err.splice(e,1),e--);if(i){let t=n.cI+1;n.nodes.splice(t,0,ne(r.dval)),n.vals.splice(t,0,void 0),n.parents.splice(t,0,n.parent),n.keys.splice(t,0,e),n.nI++,n.pI++}else delete n.parent[e];break}}void 0===t.val&&(t.val=n.node.v)}return!0};U(e,s,{value:"Rename:"+l}),n.b.push(e);let t=(e,t,n)=>(n.parent[l]=e,n.match||i||n.key===l||K(n.parent)&&!1!==i||(delete n.parent[n.key],t.done=!0),n.ctx.Rename=n.ctx.Rename||{},n.ctx.Rename.fromDflt=n.ctx.Rename.fromDflt||{},n.ctx.Rename.fromDflt[l]={yes:n.fromDflt,key:n.key,dval:n.node.v,node:n.node},!0);U(t,s,{value:"Rename:"+l}),n.a.push(t)}return n},Ee=function(e,t){let n=Pe(this,t);return n.c=ne(e),void 0===n.v&&(n.t="object",n.v={},n.f={}),n},Ce=function(e,t){let n=Pe(this,t||[]);return n.t="array",n.c=ne(e),n.m=n.m||{},n.m.rest=!0,n},Ge=function(e,t){let n=ne(q[e]),r=Pe(this,t);return r!==n&&(r.t=n.t,r.r=n.r,r.p=n.p,r.v=n.v),r};function Te(e,t,n,r,l){let i=Pe(e,n);t=+t;let o=function(e,n,r){return l(function(e){return c===typeof e?e:c===typeof(null==e?void 0:e.length)?e.length:null!=e&&v===typeof e?H(e).length:NaN}(e),t,e,n,r)};return Object.defineProperty(o,s,{value:r}),o.n=r,o.a=[t],o.s=()=>r+"("+t+")",o[Symbol.for("nodejs.util.inspect.custom")]=o.s(),o.toJSON=()=>o.s(),i.b.push(o),i}const Be=function(e,t){return Te(this,e,t,M,(e,t,n,r,l)=>{if(t<=e)return!0;l.checkargs={min:1};let i=c===typeof n?"":"length ";return r.err=ze(l,E+" "+_+z+L+` must be a minimum ${i}of ${t} (was ${e}).`),!1})},Je=function(e,t){return Te(this,e,t,W,(e,t,n,r,l)=>{if(e<=t)return!0;let i=c===typeof n?"":"length ";return r.err=ze(l,E+" "+_+z+L+` must be a maximum ${i}of ${t} (was ${e}).`),!1})},We=function(e,t){return Te(this,e,t,C,(e,t,n,r,l)=>{if(t<e)return!0;let i=c===typeof n?"be":"have length";return r.err=ze(l,E+" "+_+z+L+` must ${i} above ${t} (was ${e}).`),!1})},Me=function(e,t){return Te(this,e,t,T,(e,t,n,r,l)=>{if(e<t)return!0;let i=c===typeof n?"be":"have length";return r.err=ze(l,E+" "+_+z+L+` must ${i} below ${t} (was ${e}).`),!1})},Fe=function(e,t){return Te(this,e,t,T,(e,t,n,r,l)=>{if(t===e)return!0;let i=c===typeof n?"":" in length";return r.err=ze(l,E+" "+_+z+L+` must be exactly ${t}${i} (was ${e}).`),!1})};function Pe(e,t){let n,r=null!=e&&(e.window===e||e.global===e);if(void 0!==e&&!r||void 0===t)if(void 0===e||r)n=ne(void 0);else if(void 0!==t){n=ne(t);let r=ne(e);void 0===n.v&&"list"!==n.t&&(n.v=r.v,n.t=r.t),["f","r","p","c","e","z"].map(e=>n[e]=void 0!==r[e]?r[e]:n[e]),n.u=Object.assign({...r.u},n.u),n.m=Object.assign({...r.m},n.m),n.a=r.a.concat(n.a),n.b=r.b.concat(n.b)}else n=ne(e);else n=ne(t);return n.Above?n:Object.assign(n,{Above:We,After:Ne,Any:he,Before:Se,Below:Me,Check:Oe,Child:Ee,Closed:Ve,Default:me,Define:Ae,Empty:be,Exact:je,Fault:ve,Ignore:ge,Len:Fe,Max:Je,Min:Be,Never:$e,Open:fe,Refer:Re,Rename:De,Required:ce,Rest:Ce,Skip:de,Type:Ge})}function ze(e,t,n,r){return Le(n||j,e,4e3,t,r)}function Le(e,t,n,r,l,i){var o;let s={key:t.key,type:t.node.t,node:t.node,value:t.val,path:ue(t),why:e,check:(null===(o=t.check)||void 0===o?void 0:o.name)||"none",args:t.checkargs||{},mark:n,text:"",use:l||{}},u=ae((void 0===t.val?y:qe(t.val)).replace(/"/g,""));if(null==(r=r||t.node.z)||""===r){let n=u.startsWith("[")?p:u.startsWith("{")?v:null==t.val||c===typeof t.val&&isNaN(t.val)?"value":typeof t.val,r=u.startsWith("[")||K(t.parents[t.pI])?"index":"property",o="is",h=null==l?void 0:l.k;h=K(h)?(r=1<h.length?(o="are","properties"):r,h.join(", ")):h,s.text="Validation failed for "+(0<s.path.length?`${r} "${s.path}" with `:"")+`${n} "${u}" because `+(x===e?$===t.node.t?`the ${n} is not an instance of ${t.node.u.n}`:`the ${n} is not of type ${S===t.node.t?d:t.node.t}`:f===e?""===t.val?"an empty string is not allowed":`the ${n} is required`:"closed"===e?`the ${r} "${h}" ${o} not allowed`:S===e?"the string did not match "+t.node.v:a===e?"no value is allowed":`check "${null==i?e:i}" failed`)+(s.use.thrown?" (threw: "+s.use.thrown.message+")":".")}else s.text=r.replace(/\$VALUE/g,u).replace(/\$PATH/g,s.path);return s}function _e(e){var t;let n=e.t;const r={number:O,string:N,boolean:V};if(r[n]){let t="";return e.r&&(t+=r[n]),""===t&&(t=JSON.stringify(e.v)),t+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),t}if(m===n){let n="";return e.r&&(n+="Required()"),"any"==(null===(t=e.c)||void 0===t?void 0:t.t)&&(n+=(""===n?"":".")+"Open()"),n+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),n.startsWith(".")&&(n=n.slice(1)),""===n&&(n="Any()"),n}if(j===n){let t="";return t+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),t.startsWith(".")&&(t=t.slice(1)),t}if(v===n){let t={};for(let n in e.v)t[n]=_e(e.v[n]);return void 0!==e.c&&(r[e.c.t]?t.$$="Child("+r[e.c.t]+")":"any"===e.c.t?t.$$="Open()":(t.$$="Child($$child)",t.$$child=_e(e.c))),0<e.b.length&&(void 0===t.$$&&(t.$$=""),t.$$+=e.b.map(t=>t.s?"."+t.s(e):"").join(""),t.$$.startsWith(".")&&(t.$$=t.$$.slice(1))),t.$$&&1===Object.keys(t).length&&t.$$.startsWith("Child")?t.$$:t}if("list"===n){let t={},n=0,r=e.u.list.map(e=>_e(e)).map((e,r)=>v===typeof e?(t[r="$$ref"+n++]=e,r):e),l=(e.b[0].n||e.b[0].name)+"("+r.join(",")+")";return 0===n?l:{$$:l,...t}}if("array"===n){let t=[];return void 0!==e.c?t[0]=_e(e.c):t=Object.keys(e.v).reduce((t,n)=>(t[+n]=e.v[n],t),[]).map(e=>_e(e)),t}}function qe(e,t,r,l){let o;if(!l&&e&&e.$&&(n===e.$.gubu$||!0===e.$.gubu$))return e=JSON.stringify(_e(e)),r&&(e="string"==typeof e?e.replace(/\\/g,"").replace(/"/g,""):""),e;try{o=Q(e,(e,o)=>{var s,u,a;if(t&&(o=t(e,o)),null!=o&&v===typeof o&&o.constructor&&A!==o.constructor.name&&R!==o.constructor.name)o="[object RegExp]"===i.call(o)||h===typeof o.toString?o.toString():o.constructor.name;else if(l||n!==(null===(s=null==o?void 0:o.$)||void 0===s?void 0:s.gubu$))if(h===typeof o)o=h===typeof le[o.name]&&isNaN(+e)?void 0:null!=o.name&&""!==o.name?o.name:ae(o.toString().replace(/[ \t\r\n]+/g," "));else if("bigint"==typeof o)o=String(o.toString());else{if(Number.isNaN(o))return"NaN";!0===l||!0!==(null===(u=null==o?void 0:o.$)||void 0===u?void 0:u.gubu$)&&n!==(null===(a=null==o?void 0:o.$)||void 0===a?void 0:a.gubu$)||(o=JSON.stringify(_e(o)))}else"number"===o.t||"string"===o.t||"boolean"===o.t?o=o.v:(o=_e(o),o=JSON.stringify(o),r&&(o="string"==typeof o?o.replace(/\\/g,"").replace(/"/g,""):""));return o}),o=String(o)}catch(s){o=Q(String(e))}return!0===r&&(o=o.replace(/^"/,"").replace(/"$/,"")),o}function He(e){return null==e||v!==typeof e?e:Z(Q(e))}const Ue=e=>ne({...e,$:{gubu$:!0}}),Ke={Above:We,After:Ne,All:xe,Any:he,Before:Se,Below:Me,Check:Oe,Child:Ee,Closed:Ve,Default:me,Define:Ae,Empty:be,Exact:je,Fault:ve,Func:ye,Ignore:ge,Key:ke,Len:Fe,Max:Je,Min:Be,Never:$e,One:we,Open:fe,Optional:pe,Refer:Re,Rename:De,Required:ce,Skip:de,Some:Ie,Rest:Ce,Type:Ge};if(y!==typeof window)for(let Ye in Ke)U(Ke[Ye],s,{value:Ye});Object.assign(le,{Gubu:le,...Ke,...Object.entries(Ke).reduce((e,t)=>(e["G"+t[0]]=t[1],e),{}),isShape:e=>e&&r===e.gubu,G$:Ue,buildize:Pe,makeErr:ze,stringify:qe,truncate:ae,nodize:ne,expr:ie,build:oe,MakeArgu:Qe}),U(le,s,{value:o});const Ze=le;t.Gubu=Ze;function Qe(e){return function(t,n,r){let l=!1;d===typeof t&&(l=!0,r=n,n=t);const i=Ze(r=r||n,{name:e+(n=d===typeof n?" ("+n+")":"")}),o=i.node(),s=o.k;let u=t,a={},c=0,f=0;for(;c<s.length;c++){let e=o.v[s[c]];e.p&&(e=o.v[s[c]]=(t=>Ne((function(e,n,r){if(0<r.curerr.length){f++;for(let e=s.length-1;e>t;e--)o.v[s[e]].m.rest?a[s[e]].splice(o.v[s[e]].m.rest_pos+t-e,0,a[s[e-1]]):(r.vals[r.pI+e-t]=r.vals[r.pI+e-t-1],a[s[e]]=a[s[e-1]]);n.uval=void 0,n.done=!1}return!0}),e))(c),e.e=!1),c!==s.length-1||o.v[s[c]].m.rest||(o.v[s[c]]=Ne((function(e,t,n){return!(s.length-f<u.length&&(0===n.curerr.length&&(t.err=`Too many arguments for type signature (was ${u.length}, expected ${s.length-f})`),t.fatal=!0,1))}),o.v[s[c]]))}function p(e){for(let t=0;t<s.length;t++){let n=o.v[s[t]];n.m.rest?(a[s[t]]=[...e].slice(t),n.m.rest_pos=a[s[t]].length):a[s[t]]=e[t]}return a}return l?function(e){return u=e,a={},c=0,f=0,i(p(e))}:i(p(t))}}const{Gubu:Xe}=t;return Xe})); |
{ | ||
"name": "gubu", | ||
"version": "8.2.0", | ||
"version": "8.2.1", | ||
"description": "An object shape validation utility.", | ||
@@ -5,0 +5,0 @@ "main": "gubu.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
382205
5251