@valbuild/ui 0.60.4 → 0.60.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/ui",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"typecheck": "tsc --noEmit",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@remirror/pm": "^2.0.8",
|
|
42
42
|
"@remirror/react": "^2.0.35",
|
|
43
43
|
"@remirror/styles": "^2.0.7",
|
|
44
|
-
"@valbuild/core": "~0.60.
|
|
45
|
-
"@valbuild/shared": "~0.60.
|
|
44
|
+
"@valbuild/core": "~0.60.5",
|
|
45
|
+
"@valbuild/shared": "~0.60.5",
|
|
46
46
|
"class-variance-authority": "^0.7.0",
|
|
47
47
|
"classnames": "^2.3.2",
|
|
48
48
|
"clsx": "^2.0.0",
|
|
@@ -40,7 +40,7 @@ Error generating stack: `+i.message+`
|
|
|
40
40
|
*/var vL=h,yL=Symbol.for("react.element"),xL=Symbol.for("react.fragment"),bL=Object.prototype.hasOwnProperty,wL=vL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,SL={key:!0,ref:!0,__self:!0,__source:!0};function k2(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)bL.call(t,r)&&!SL.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:yL,type:e,key:i,ref:s,props:o,_owner:wL.current}}kg.Fragment=xL;kg.jsx=k2;kg.jsxs=k2;S2.exports=kg;var b=S2.exports;function Z0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g1(e,t){if(e){if(typeof e=="string")return Z0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Z0(e,t)}}function Eg(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=g1(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
41
41
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!i&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function v1(e){return e.length>0}var Xf=Object.freeze({kind:"ok",value:void 0});function _n(e){return e===void 0?Xf:{kind:"ok",value:e}}function Vt(e){return{kind:"err",error:e}}function iu(e){return e===Xf||e.kind==="ok"}function _g(e){return e!==Xf&&e.kind==="err"}function E2(e){var t=[],n=[],r=Eg(e),o;try{for(r.s();!(o=r.n()).done;){var i=o.value;iu(i)?t.push(i.value):n.push(i.error)}}catch(s){r.e(s)}finally{r.f()}return v1(n)?Vt(n):_n(t)}function kL(e){return E2(e)}function EL(e){var t=[],n=Eg(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;_g(o)&&t.push(o.error)}}catch(i){n.e(i)}finally{n.f()}return v1(t)?Vt(t):Xf}function y1(e,t){return function(n){for(var r=_n(t),o=0;o<n.length&&iu(r);++o)r=e(r.value,n[o],o);return r}}function Hr(e){return function(t){return iu(t)?_n(e(t.value)):t}}function Ja(e){return function(t){return iu(t)?e(t.value):t}}function _L(e){return function(t){return _g(t)?Vt(e(t.error)):t}}function CL(e,t){return function(n){return e(n)?_n(n):Vt(t(n))}}var Cg=function(t,n){return function(r){return iu(r)?t(r.value)?r:Vt(n(r.value)):r}},St=Object.freeze({__proto__:null,voidOk:Xf,ok:_n,err:Vt,isOk:iu,isErr:_g,allT:E2,all:kL,allV:EL,flatMapReduce:y1,map:Hr,flatMap:Ja,mapErr:_L,fromPredicate:CL,filterOrElse:Cg});function OL(e){if(Array.isArray(e))return Z0(e)}function TL(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function PL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
42
42
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _2(e){return OL(e)||TL(e)||g1(e)||PL()}function me(e){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}function ML(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function C2(e){var t=ML(e,"string");return typeof t=="symbol"?t:String(t)}function pe(e,t,n){return t=C2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ok(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ok(Object(n),!0).forEach(function(r){pe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ok(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RL(e){if(Array.isArray(e))return e}function NL(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function $L(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
43
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kn(e,t){return RL(e)||NL(e,t)||g1(e,t)||$L()}function nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tk(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C2(r.key),r)}}function rn(e,t,n){return t&&Tk(e.prototype,t),n&&Tk(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function im(e){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},im(e)}function O2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(O2=function(){return!!e})()}function T2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function AL(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return T2(e)}function Ar(e,t,n){return t=im(t),AL(e,O2()?Reflect.construct(t,n||[],im(e).constructor):t.apply(e,n))}function J0(e,t){return J0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},J0(e,t)}function Dr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J0(e,t)}var Ir=function(){function e(){nn(this,e)}return rn(e,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):pe({},r,[{message:o,value:i}])}}]),e}(),Od=Symbol("GetSchema"),Hn=Symbol("Path"),Xt=Symbol("GetSource");function DL(e){return e[Od]}var x1=rn(function e(t){nn(this,e),this.span=t}),IL=function(e){Dr(t,e);function t(n,r){var o;return nn(this,t),o=Ar(this,t,[r]),pe(T2(o),"type","Sym"),o.value=n,o}return rn(t,[{key:"transpile",value:function(){return this.value}}]),t}(x1);new IL("()");var mn="_type",Cn="_ref",Pk="_tag",LL=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?pe({},r,[{message:"Non-optional file was null or undefined.",value:o}]):typeof o[Cn]!="string"?pe({},r,[{message:"File did not have a file reference string. Got: ".concat(me(o[Cn])),value:o}]):o[mn]!=="file"?pe({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[mn]),value:o}]):o.metadata?pe({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["file:check-metadata"]}]):pe({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[Cn])==="file"&&(r==null?void 0:r[mn])==="file"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}]),t}(Ir),jL=function(t){return new LL(t)};function P2(e){var t,n;if(!e[Cn].startsWith("/public")){var r,o;return{url:e[Cn]+((r=e.metadata)!==null&&r!==void 0&&r.sha256?"?sha256=".concat((o=e.metadata)===null||o===void 0?void 0:o.sha256):""),metadata:e.metadata}}return{url:e[Cn].slice(7)+((t=e.metadata)!==null&&t!==void 0&&t.sha256?"?sha256=".concat((n=e.metadata)===null||n===void 0?void 0:n.sha256):""),metadata:e.metadata}}function M2(e){return me(e)==="object"&&e!==null&&e!==void 0&&("val"in e||"valPath"in e)}function zL(e){return me(e)==="object"&&e!==null&&e!==void 0&&Hn in e&&"val"in e}function R2(e){return e[Hn]}function FL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mk(e,t,n){return t?ln(e(ln(t,n))):ln(t,n)}function Fs(e){return me(e)==="object"&&e!==null&&(Xt in e||Hn in e)}function ln(e,t,n){if(me(e)==="object"){if(Fs(e))return e;if(M2(e))return ln(e.val,e.valPath)}if(e&&e[Cn]&&e[mn]==="file"){var r=e[Cn];if(typeof r!="string")throw Error("Invalid file ref: "+r);return ln(P2(e),t,n)}switch(me(e)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(me(e),": ").concat(e));case"object":if(e!==null)return new Proxy(e,{has:function(i,s){return s===Xt||s===Hn||s==="andThen"||s===Od?!0:s in i},get:function(i,s){if(s===Xt)return e;if(s===Hn)return t;if(s===Od)return n;if(s==="andThen")return function(l){return Mk(l,e,t)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return ln(u,Kr(t,d),n==null?void 0:n.item)}).filter(function(u){return l&&l instanceof Ir?l.assert(Rk(u)):Rk(l(u))});return ln(c,t,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(ln(u,Kr(t,d),n==null?void 0:n.item),ln(d));return Fs(f)?f:ln(f)});return ln(c,t,n)}}if(Array.isArray(i)&&s==="length")return ln(i.length);var a=Reflect.get(i,s);return FL(e,s)?Number.isNaN(Number(s))?ln(a,Kr(t,s),n==null?void 0:n.items[s]):ln(a,Kr(t,Number(s)),n==null?void 0:n.item):a}});default:return pe(pe(pe({eq:function(i){var s=i;if(Fs(i)&&(s=i[Xt],s instanceof x1))throw Error("TODO: Cannot evaluate equality with an Expr");return ln(e===s,void 0)},andThen:function(i){return Mk(i,e===void 0?null:e,t)}},Xt,e===void 0?null:e),Hn,t),Od,n)}}function Kr(e,t){if(me(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));return e!==void 0?"".concat(e,".").concat(JSON.stringify(t)):void 0}function Rk(e){if(me(e)==="object"&&(Xt in e||Hn in e)){var t=e[Xt];return t}return e}var b1=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.items=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:me(o)!=="object"?pe({},r,[{message:"Expected 'object', got '".concat(me(o),"'")}]):Array.isArray(o)?pe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Kn(a,2),c=l[0],u=l[1],d=Kr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var f=u.validate(d,o[c]);f&&s?s=Lc(Lc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(this.items);o<i.length;o++){var s=Kn(i[o],2),a=s[0],l=s[1];if(!l.assert(r[a]))return!1}return me(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new t(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=Kn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}]),t}(Ir),BL=function(t){return new b1(t)},N2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.item=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:me(o)!=="object"||!Array.isArray(o)?pe({},r,[{message:"Expected 'array', got '".concat(me(o),"'")}]):(o.forEach(function(a,l){var c=Kr(r,l);if(!c)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at index ").concat(l),o);else{var u=i.item.validate(c,a);u&&s?s=Lc(Lc({},u),s):u&&(s=u)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;var o=Eg(r),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!this.item.assert(s))return!1}}catch(a){o.e(a)}finally{o.f()}return me(r)==="object"&&Array.isArray(r)}},{key:"optional",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}]),t}(Ir),UL=function(t){return new N2(t)},Q0=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.value=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?pe({},r,[{message:"Expected 'string', got '".concat(me(o),"'"),value:o}]):o!==this.value?pe({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}]),t}(Ir),VL=function(t){return new Q0(t)},$2=function(e){Dr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return nn(this,t),o=Ar(this,t),o.key=n,o.items=r,o.opt=i,o}return rn(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i==null)return!1;if(!this.key)return pe({},r,[{message:"Missing required first argument in union"}]);var a=this.key;if(!Array.isArray(this.items))return pe({},r,[{message:"A union schema must take more than 1 schema arguments",fatal:!0}]);if(typeof a=="string"){if(this.items.some(function(P){return!(P instanceof b1)}))return pe({},r,[{message:"Key is a string, so all schema items must be objects",fatal:!0}]);var l=this.items,c=l.map(function(P){return P.serialize()}),u=c.filter(function(P){return P.type!=="object"||P.items[a].type!=="literal"});if(u.length>0)return pe({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),fatal:!0}]);var d=c,f=d.filter(function(P){return P.items[a].opt});if(f.length>1)return pe({},r,[{message:"Schema cannot have an optional keys: ".concat(a),fatal:!0}]);if(me(i)!=="object")return pe({},r,[{message:"Expected an object"}]);var p=i;if(p[a]===void 0)return pe({},r,[{message:"Missing required key: ".concat(a)}]);var m=[],g=Eg(d),y;try{for(g.s();!(y=g.n()).done;){var v=y.value,x=v.items[a];if(x.type==="literal")if(!m.includes(x.value))m.push(x.value);else return pe({},r,[{message:"Found duplicate key in schema: ".concat(x.value),fatal:!0}])}}catch(P){g.e(P)}finally{g.f()}var w=l.find(function(P){return!P.items[a].validate(r,p[a])});if(!w){var k=Kr(r,a);if(!k)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return pe({},k,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(P){var M=P.items[a];if(M.type==="literal"&&M.value)return'"'.concat(M.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(M,null,2)))}).join(", "))}])}var E=w.validate(r,p);if(E)return E}else if(a instanceof Q0){if(this.items.some(function(P){return!(P instanceof Q0)}))return pe({},r,[{message:"Key is a literal schema, so all schema items must be literals",fatal:!0}]);var S=[a].concat(_2(this.items));if(typeof i=="string"){var _=S.some(function(P){return!P.validate(r,i)});if(!_)return pe({},r,[{message:"Union must match one of the following: ".concat(S.map(function(P){return'"'.concat(P.value,'"')}).join(", "))}])}}else return pe({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new t(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",key:this.key.serialize(),items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}}]),t}(Ir),HL=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new $2(t,r)},A2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return!1}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}]),t}(Ir),WL=function(t){return new A2(t??{})},D2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?pe({},r,[{message:"Non-optional image was null or undefined.",value:o}]):typeof o[Cn]!="string"?pe({},r,[{message:"Image did not have a file reference string. Got: ".concat(me(o[Cn])),value:o}]):o[mn]!=="file"?pe({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[mn]),value:o}]):o.metadata?pe({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["image:replace-metadata"]}]):pe({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[Cn])==="image"&&(r==null?void 0:r[mn])==="file"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}]),t}(Ir),KL=function(t){return new D2(t)},I2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.item=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:me(o)!=="object"?pe({},r,[{message:"Expected 'object', got '".concat(me(o),"'")}]):Array.isArray(o)?pe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Kn(a,2),c=l[0],u=l[1],d=Kr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var f=i.item.validate(d,u);f&&s?s=Lc(Lc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(r);o<i.length;o++){var s=Kn(i[o],2),a=s[1];if(!this.item.assert(a))return!1}return me(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}]),t}(Ir),qL=function(t){return new I2(t)};function GL(e){var t=e[Xt];if(t instanceof x1)throw Error("Cannot get raw source of an Expr");var n=t;return n}function YL(e){return e.indexOf(".")===-1?[e,""]:[e.slice(0,e.indexOf(".")),e.slice(e.indexOf(".")+1)]}function XL(e){return e instanceof b1||me(e)==="object"&&"type"in e&&e.type==="object"}function ZL(e){return e instanceof I2||me(e)==="object"&&"type"in e&&e.type==="record"}function JL(e){return e instanceof N2||me(e)==="object"&&"type"in e&&e.type==="array"}function QL(e){return e instanceof $2||me(e)==="object"&&"type"in e&&e.type==="union"}function e5(e){return e instanceof A2||me(e)==="object"&&"type"in e&&e.type==="richtext"}function t5(e){return e instanceof D2||me(e)==="object"&&"type"in e&&e.type==="image"}function n5(e,t,n){for(var r=L2(e),o=_2(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(JL(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(me(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(me(s)));if(s[u]===void 0){var d;throw Error("Invalid path: array source (length: ".concat((d=s)===null||d===void 0?void 0:d.length,") did not have index ").concat(u," from path: ").concat(e))}s=s[u],i=i.item}else if(ZL(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(me(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(me(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.item}else if(XL(i)){if(me(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(me(s)));if(!s[u])throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.items[u]}else{if(t5(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};if(QL(i)){var f=i.key;if(typeof f!="string")return{v:{path:o.map(function(g){return Number.isNaN(Number(g))?JSON.stringify(g):g}).join("."),schema:i,source:s}};var p=s[f];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(f," in path: ").concat(e));var m=i.items.find(function(g){var y;return(g==null||(y=g.items)===null||y===void 0||(y=y[f])===null||y===void 0?void 0:y.value)===p});if(!m)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(f," of value ").concat(p," in path: ").concat(e));i=m.items[u],s=s[u]}else{if(e5(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function L2(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}var Tr=rn(function e(t){nn(this,e),this.message=t}),r5=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?pe({},r,[{message:"Expected 'number', got '".concat(me(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="number"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}]),t}(Ir),o5=function(t){return new r5(t)},j2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return rn(t,[{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return pe({},r,[{message:"Expected 'string', got '".concat(me(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?pe({},r,l):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}}]),t}(Ir),i5=function(t){return new j2(t)},s5=function(e){Dr(t,e);function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return nn(this,t),n=Ar(this,t),n.opt=r,n}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?pe({},r,[{message:"Expected 'boolean', got '".concat(me(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="boolean"}},{key:"optional",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}]),t}(Ir),a5=function(){return new s5},l5=function(e){Dr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return nn(this,t),o=Ar(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return rn(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return pe({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return pe({},r,[{message:"Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="array"&&typeof o!="number")return pe({},r,[{message:"Type of value in keyof (array) must be 'number'"}]);if(i.type==="record"&&typeof o!="string")return pe({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(o))return pe({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;var o=this.schema;if(!o)return!1;var i=o;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return!1;if(i.opt&&r==null)return!0;if(i.type==="array"&&typeof r!="number"||i.type==="record"&&typeof r!="string")return!1;if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(r))return!1}return!0}},{key:"optional",value:function(){return new t(this.schema,void 0,!0)}},{key:"serialize",value:function(){var r=this.sourcePath;if(!r)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module.");var o=this.schema;if(!o)throw new Error("Cannot serialize oneOf schema with empty selector.");var i;switch(o.type){case"array":i="number";break;case"record":i="string";break;case"object":i=Object.keys(o.items);break;default:throw new Error("Cannot serialize oneOf schema with selector of type '".concat(o.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",path:r,schema:o,opt:this.opt,values:i}}}]),t}(Ir),c5=function(t){var n;return new l5(t==null||(n=t[Od])===null||n===void 0?void 0:n.serialize(),R2(t))};function u5(){return{string:i5,boolean:a5,array:UL,object:BL,number:o5,union:HL,richtext:WL,image:KL,literal:VL,keyOf:c5,record:qL,file:jL}}var Nk="rt_image";function d5(e){return z2(h5(e))}function f5(e){return Fs(e)?me(e[Xt])==="object"&&e[Xt]!==null&&Array.isArray(e[Xt]):Array.isArray(e)}function p5(e){return Fs(e)?me(e[Xt])==="object"&&e[Xt]!==null&&!Array.isArray(e[Xt]):me(e)==="object"}function h5(e){var t=ln(e);function n(r){var o=f5(r),i=p5(r);if(o){var s=Xt in r?r[Xt]:r,a=Hn in r?r[Hn]:void 0;return{val:s.map(function(u,d){return n(Fs(u)?u:ln(u,Kr(a,d)))}),valPath:a}}else if(i){var l=Xt in r?r[Xt]:r,c=Hn in r?r[Hn]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=Kn(u,2),f=d[0],p=d[1];return[f,n(Fs(p)?p:ln(p,Kr(c,f)))]})),valPath:c}}else return Fs(r)?{val:n(r[Xt]),valPath:r[Hn]}:r}return n(t)}function ex(e){var t=M2(e)?e.val:e;switch(me(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(me(t)));case"object":return t===null?null:Array.isArray(t)?t.map(ex):Object.fromEntries(Object.entries(t).map(function(n){var r=Kn(n,2),o=r[0],i=r[1];return[o,i&&ex(i)]}));default:return t}}function z2(e){var t=e.val;switch(me(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(me(t)));case"object":if(t!==null)return new Proxy(t,{has:function(r,o){return o==="val"||o===Hn?!0:$k(r,o)},get:function(r,o){if(o===Hn)return e.valPath;if(o==="val")return ex(e);if(Array.isArray(r)&&o==="length")return r.length;if($k(t,o)){var i,s;return z2({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:Kr(e.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return pe(pe({},Hn,e.valPath),"val",e.val)}}function $k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var m5=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],ut=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(ut||{}),Ak={sha256:1};function g5(e){if(e&&!Ak[e]&&!Ak[e.toLowerCase()])throw new Error("Digest method not supported");return new v5}var v5=function(){function e(){nn(this,e),pe(this,"A",1779033703),pe(this,"B",-1150833019),pe(this,"C",1013904242),pe(this,"D",-1521486534),pe(this,"E",1359893119),pe(this,"F",-1694144372),pe(this,"G",528734635),pe(this,"H",1541459225),pe(this,"_size",0),pe(this,"_sp",0),(!jp||Tu>=ut.allocTotal)&&(jp=new ArrayBuffer(ut.allocTotal),Tu=0),this._byte=new Uint8Array(jp,Tu,ut.allocBytes),this._word=new Int32Array(jp,Tu,ut.allocWords),Tu+=ut.allocBytes}return rn(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+me(n));var r=n.byteOffset,o=n.byteLength,i=o/ut.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%ut.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*ut.inputWords);i--;)this._int32(a,s>>2),s+=ut.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%ut.inputBytes,l=a;r<s&&l<ut.inputBytes;)o[l++]=n[r++];l>=ut.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%ut.inputBytes,c=l;a<i&&c<ut.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=ut.inputBytes&&(this._int32(o),o[0]=o[ut.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,f=0;for(r=r|0;f<ut.inputWords;)ma[f++]=lo(n[r++]);for(f=ut.inputWords;f<ut.workWords;f++)ma[f]=_5(ma[f-2])+ma[f-7]+E5(ma[f-15])+ma[f-16]|0;for(f=0;f<ut.workWords;f++){var p=d+k5(l)+b5(l,c,u)+m5[f]+ma[f]|0,m=S5(o)+w5(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%ut.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>ut.highIndex){for(;i<ut.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<ut.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[ut.highIndex]=lo(l)),a&&(o[ut.lowIndex]=lo(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return Qi(n)+Qi(r)+Qi(o)+Qi(i)+Qi(s)+Qi(a)+Qi(l)+Qi(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=lo(n),d[1]=lo(r),d[2]=lo(o),d[3]=lo(i),d[4]=lo(s),d[5]=lo(a),d[6]=lo(l),d[7]=lo(c),u.slice(0,32)}}]),e}(),ma=new Int32Array(ut.workWords),jp,Tu=0,Qi=function(t){return(t+4294967296).toString(16).substr(-8)},y5=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},x5=function(t){return t},lo=C5()?x5:y5,b5=function(t,n,r){return r^t&(n^r)},w5=function(t,n,r){return t&n|r&(t|n)},S5=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},k5=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},E5=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},_5=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function C5(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var O5=function(t){return g5().update(t).digest("hex")};function vr(){vr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(C,T,O){C[T]=O.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(C,T,O){return Object.defineProperty(C,T,{value:O,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(T,O,R){return T[O]=R}}function u(C,T,O,R){var N=T&&T.prototype instanceof v?T:v,j=Object.create(N.prototype),G=new V(R||[]);return o(j,"_invoke",{value:A(C,O,G)}),j}function d(C,T,O){try{return{type:"normal",arg:C.call(T,O)}}catch(R){return{type:"throw",arg:R}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",g="completed",y={};function v(){}function x(){}function w(){}var k={};c(k,s,function(){return this});var E=Object.getPrototypeOf,S=E&&E(E(K([])));S&&S!==n&&r.call(S,s)&&(k=S);var _=w.prototype=v.prototype=Object.create(k);function P(C){["next","throw","return"].forEach(function(T){c(C,T,function(O){return this._invoke(T,O)})})}function M(C,T){function O(N,j,G,xe){var ue=d(C[N],C,j);if(ue.type!=="throw"){var je=ue.arg,Ce=je.value;return Ce&&typeof Ce=="object"&&r.call(Ce,"__await")?T.resolve(Ce.__await).then(function(Q){O("next",Q,G,xe)},function(Q){O("throw",Q,G,xe)}):T.resolve(Ce).then(function(Q){je.value=Q,G(je)},function(Q){return O("throw",Q,G,xe)})}xe(ue.arg)}var R;o(this,"_invoke",{value:function(N,j){function G(){return new T(function(xe,ue){O(N,j,xe,ue)})}return R=R?R.then(G,G):G()}})}function A(C,T,O){var R=f;return function(N,j){if(R===m)throw new Error("Generator is already running");if(R===g){if(N==="throw")throw j;return{value:e,done:!0}}for(O.method=N,O.arg=j;;){var G=O.delegate;if(G){var xe=I(G,O);if(xe){if(xe===y)continue;return xe}}if(O.method==="next")O.sent=O._sent=O.arg;else if(O.method==="throw"){if(R===f)throw R=g,O.arg;O.dispatchException(O.arg)}else O.method==="return"&&O.abrupt("return",O.arg);R=m;var ue=d(C,T,O);if(ue.type==="normal"){if(R=O.done?g:p,ue.arg===y)continue;return{value:ue.arg,done:O.done}}ue.type==="throw"&&(R=g,O.method="throw",O.arg=ue.arg)}}}function I(C,T){var O=T.method,R=C.iterator[O];if(R===e)return T.delegate=null,O==="throw"&&C.iterator.return&&(T.method="return",T.arg=e,I(C,T),T.method==="throw")||O!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+O+"' method")),y;var N=d(R,C.iterator,T.arg);if(N.type==="throw")return T.method="throw",T.arg=N.arg,T.delegate=null,y;var j=N.arg;return j?j.done?(T[C.resultName]=j.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=e),T.delegate=null,y):j:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,y)}function L(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function re(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function V(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(L,this),this.reset(!0)}function K(C){if(C||C===""){var T=C[s];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var O=-1,R=function N(){for(;++O<C.length;)if(r.call(C,O))return N.value=C[O],N.done=!1,N;return N.value=e,N.done=!0,N};return R.next=R}}throw new TypeError(typeof C+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===x||(T.displayName||T.name)==="GeneratorFunction")},t.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,w):(C.__proto__=w,c(C,l,"GeneratorFunction")),C.prototype=Object.create(_),C},t.awrap=function(C){return{__await:C}},P(M.prototype),c(M.prototype,a,function(){return this}),t.AsyncIterator=M,t.async=function(C,T,O,R,N){N===void 0&&(N=Promise);var j=new M(u(C,T,O,R),N);return t.isGeneratorFunction(T)?j:j.next().then(function(G){return G.done?G.value:j.next()})},P(_),c(_,l,"Generator"),c(_,s,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),t.keys=function(C){var T=Object(C),O=[];for(var R in T)O.push(R);return O.reverse(),function N(){for(;O.length;){var j=O.pop();if(j in T)return N.value=j,N.done=!1,N}return N.done=!0,N}},t.values=K,V.prototype={constructor:V,reset:function(C){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(re),!C)for(var T in this)T.charAt(0)==="t"&&r.call(this,T)&&!isNaN(+T.slice(1))&&(this[T]=e)},stop:function(){this.done=!0;var C=this.tryEntries[0].completion;if(C.type==="throw")throw C.arg;return this.rval},dispatchException:function(C){if(this.done)throw C;var T=this;function O(ue,je){return j.type="throw",j.arg=C,T.next=ue,je&&(T.method="next",T.arg=e),!!je}for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R],j=N.completion;if(N.tryLoc==="root")return O("end");if(N.tryLoc<=this.prev){var G=r.call(N,"catchLoc"),xe=r.call(N,"finallyLoc");if(G&&xe){if(this.prev<N.catchLoc)return O(N.catchLoc,!0);if(this.prev<N.finallyLoc)return O(N.finallyLoc)}else if(G){if(this.prev<N.catchLoc)return O(N.catchLoc,!0)}else{if(!xe)throw new Error("try statement without catch or finally");if(this.prev<N.finallyLoc)return O(N.finallyLoc)}}}},abrupt:function(C,T){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&r.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var N=R;break}}N&&(C==="break"||C==="continue")&&N.tryLoc<=T&&T<=N.finallyLoc&&(N=null);var j=N?N.completion:{};return j.type=C,j.arg=T,N?(this.method="next",this.next=N.finallyLoc,y):this.complete(j)},complete:function(C,T){if(C.type==="throw")throw C.arg;return C.type==="break"||C.type==="continue"?this.next=C.arg:C.type==="return"?(this.rval=this.arg=C.arg,this.method="return",this.next="end"):C.type==="normal"&&T&&(this.next=T),y},finish:function(C){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.finallyLoc===C)return this.complete(O.completion,O.afterLoc),re(O),y}},catch:function(C){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.tryLoc===C){var R=O.completion;if(R.type==="throw"){var N=R.arg;re(O)}return N}}throw new Error("illegal catch attempt")},delegateYield:function(C,T,O){return this.delegate={iterator:K(C),resultName:T,nextLoc:O},this.method==="next"&&(this.arg=e),y}},t}function Dk(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){n(c);return}a.done?t(l):Promise.resolve(l).then(r,o)}function Ul(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){Dk(i,r,o,s,a,"next",l)}function a(l){Dk(i,r,o,s,a,"throw",l)}s(void 0)})}}var F2=function(){function e(t){nn(this,e),this.host=t}return rn(e,[{key:"getDisableUrl",value:function(n){return"".concat(this.host,"/disable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getLoginUrl",value:function(n){return"".concat(this.host,"/authorize?redirect_to=").concat(encodeURIComponent(n))}},{key:"getEnableUrl",value:function(n){return"".concat(this.host,"/enable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getPatches",value:function(){var t=Ul(vr().mark(function r(o){var i,s,a;return vr().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.patchIds,s=o.headers,a=i?"?".concat(i.map(function(u){return"".concat(u,"=").concat(encodeURIComponent(u))}).join("&")):"",c.abrupt("return",fetch("".concat(this.host,"/patches/~").concat(a),{headers:s||{"Content-Type":"application/json"}}).then(function(u){return es(u)}).catch(ga));case 3:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"deletePatches",value:function(){var t=Ul(vr().mark(function r(o,i){var s;return vr().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return s=new URLSearchParams,o.forEach(function(c){return s.append("id",c)}),l.abrupt("return",fetch("".concat(this.host,"/patches/~?").concat(s),{method:"DELETE",headers:i||{"Content-Type":"application/json"}}).then(function(c){return es(c)}).catch(ga));case 3:case"end":return l.stop()}},r,this)}));function n(r,o){return t.apply(this,arguments)}return n}()},{key:"getEditUrl",value:function(){return"/val"}},{key:"postPatches",value:function(n,r,o){return fetch("".concat(this.host,"/patches/~"),{headers:o||{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(pe({},n,r))}).then(function(){var i=Ul(vr().mark(function s(a){return vr().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",es(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(ga)}},{key:"getSession",value:function(){return fetch("".concat(this.host,"/session")).then(function(n){return es(n).catch(ga)})}},{key:"getTree",value:function(n){var r=n.patch,o=r===void 0?!1:r,i=n.includeSchema,s=i===void 0?!1:i,a=n.includeSource,l=a===void 0?!1:a,c=n.treePath,u=c===void 0?"/":c,d=n.headers,f=new URLSearchParams;return f.set("patch",o.toString()),f.set("schema",s.toString()),f.set("source",l.toString()),fetch("".concat(this.host,"/tree/~").concat(u,"?").concat(f.toString()),{headers:d}).then(function(p){return es(p)}).catch(ga)}},{key:"postCommit",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/commit"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=Ul(vr().mark(function s(a){var l;return vr().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(!a.ok){u.next=4;break}return u.abrupt("return",es(a));case 4:if(!(a.status===400&&a.headers.get("content-type")==="application/json")){u.next=13;break}return u.next=7,a.json();case 7:if(l=u.sent,!("validationErrors"in l)){u.next=12;break}return u.abrupt("return",Vt(l));case 12:return u.abrupt("return",B2(a.status,l,a.statusText));case 13:return u.abrupt("return",es(a));case 14:case"end":return u.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(ga)}},{key:"postValidate",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/validate"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=Ul(vr().mark(function s(a){return vr().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",es(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(ga)}}]),e}();function ga(e){return Vt({statusCode:500,message:e instanceof Error||me(e)==="object"&&e&&"message"in e&&typeof e.message=="string"?e.message:"Unknown error",details:me(e)==="object"&&e&&"details"in e?e.details:void 0})}function B2(e,t,n){return Vt({statusCode:e,message:t.message||n,details:t.details||Object.fromEntries(Object.entries(t).filter(function(r){var o=Kn(r,1),i=o[0];return i!=="message"}))})}function es(e){return tx.apply(this,arguments)}function tx(){return tx=Ul(vr().mark(function e(t){var n;return vr().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,!t.ok){o.next=9;break}return o.t0=St,o.next=5,t.json();case 5:return o.t1=o.sent,o.abrupt("return",o.t0.ok.call(o.t0,o.t1));case 9:return o.prev=9,o.next=12,t.json();case 12:return n=o.sent,o.abrupt("return",B2(t.status,n,t.statusText));case 16:return o.prev=16,o.t2=o.catch(9),o.abrupt("return",Vt({statusCode:t.status,message:t.statusText}));case 19:o.next=24;break;case 21:return o.prev=21,o.t3=o.catch(0),o.abrupt("return",Vt({message:o.t3 instanceof Error?o.t3.message:"Unknown error"}));case 24:case"end":return o.stop()}},e,null,[[0,21],[9,16]])})),tx.apply(this,arguments)}var ot={convertFileSource:P2,getSchema:DL,getValPath:R2,getVal:d5,getSource:GL,resolvePath:n5,splitModuleIdAndModulePath:YL,isVal:zL,createValPathOfItem:Kr,getSHA256Hash:O5,initSchema:u5,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&T5(n)}).join("/"))},createPatchPath:function(t){return L2(t)},patchPathToModulePath:function(t){return t.map(function(n){return Number.isInteger(Number(n))?n:JSON.stringify(n)}).join(".")},VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session"};function T5(e){try{return JSON.parse(e)}catch{return e}}var U2={exports:{}};/*!
|
|
43
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kn(e,t){return RL(e)||NL(e,t)||g1(e,t)||$L()}function nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tk(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C2(r.key),r)}}function rn(e,t,n){return t&&Tk(e.prototype,t),n&&Tk(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function im(e){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},im(e)}function O2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(O2=function(){return!!e})()}function T2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function AL(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return T2(e)}function Ar(e,t,n){return t=im(t),AL(e,O2()?Reflect.construct(t,n||[],im(e).constructor):t.apply(e,n))}function J0(e,t){return J0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},J0(e,t)}function Dr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J0(e,t)}var Ir=function(){function e(){nn(this,e)}return rn(e,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):pe({},r,[{message:o,value:i}])}}]),e}(),Od=Symbol("GetSchema"),Hn=Symbol("Path"),Xt=Symbol("GetSource");function DL(e){return e[Od]}var x1=rn(function e(t){nn(this,e),this.span=t}),IL=function(e){Dr(t,e);function t(n,r){var o;return nn(this,t),o=Ar(this,t,[r]),pe(T2(o),"type","Sym"),o.value=n,o}return rn(t,[{key:"transpile",value:function(){return this.value}}]),t}(x1);new IL("()");var mn="_type",Cn="_ref",Pk="_tag",LL=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?pe({},r,[{message:"Non-optional file was null or undefined.",value:o}]):typeof o[Cn]!="string"?pe({},r,[{message:"File did not have a file reference string. Got: ".concat(me(o[Cn])),value:o}]):o[mn]!=="file"?pe({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[mn]),value:o}]):o.metadata?pe({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["file:check-metadata"]}]):pe({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[Cn])==="file"&&(r==null?void 0:r[mn])==="file"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}]),t}(Ir),jL=function(t){return new LL(t)};function P2(e){var t,n;if(!e[Cn].startsWith("/public")){var r,o;return{url:e[Cn]+((r=e.metadata)!==null&&r!==void 0&&r.sha256?"?sha256=".concat((o=e.metadata)===null||o===void 0?void 0:o.sha256):""),metadata:e.metadata}}return{url:e[Cn].slice(7)+((t=e.metadata)!==null&&t!==void 0&&t.sha256?"?sha256=".concat((n=e.metadata)===null||n===void 0?void 0:n.sha256):""),metadata:e.metadata}}function M2(e){return me(e)==="object"&&e!==null&&e!==void 0&&("val"in e||"valPath"in e)}function zL(e){return me(e)==="object"&&e!==null&&e!==void 0&&Hn in e&&"val"in e}function R2(e){return e[Hn]}function FL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mk(e,t,n){return t?ln(e(ln(t,n))):ln(t,n)}function Fs(e){return me(e)==="object"&&e!==null&&(Xt in e||Hn in e)}function ln(e,t,n){if(me(e)==="object"){if(Fs(e))return e;if(M2(e))return ln(e.val,e.valPath)}if(e&&e[Cn]&&e[mn]==="file"){var r=e[Cn];if(typeof r!="string")throw Error("Invalid file ref: "+r);return ln(P2(e),t,n)}switch(me(e)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(me(e),": ").concat(e));case"object":if(e!==null)return new Proxy(e,{has:function(i,s){return s===Xt||s===Hn||s==="andThen"||s===Od?!0:s in i},get:function(i,s){if(s===Xt)return e;if(s===Hn)return t;if(s===Od)return n;if(s==="andThen")return function(l){return Mk(l,e,t)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return ln(u,Kr(t,d),n==null?void 0:n.item)}).filter(function(u){return l&&l instanceof Ir?l.assert(Rk(u)):Rk(l(u))});return ln(c,t,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(ln(u,Kr(t,d),n==null?void 0:n.item),ln(d));return Fs(f)?f:ln(f)});return ln(c,t,n)}}if(Array.isArray(i)&&s==="length")return ln(i.length);var a=Reflect.get(i,s);return FL(e,s)?Number.isNaN(Number(s))?ln(a,Kr(t,s),n==null?void 0:n.items[s]):ln(a,Kr(t,Number(s)),n==null?void 0:n.item):a}});default:return pe(pe(pe({eq:function(i){var s=i;if(Fs(i)&&(s=i[Xt],s instanceof x1))throw Error("TODO: Cannot evaluate equality with an Expr");return ln(e===s,void 0)},andThen:function(i){return Mk(i,e===void 0?null:e,t)}},Xt,e===void 0?null:e),Hn,t),Od,n)}}function Kr(e,t){if(me(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));return e!==void 0?"".concat(e,".").concat(JSON.stringify(t)):void 0}function Rk(e){if(me(e)==="object"&&(Xt in e||Hn in e)){var t=e[Xt];return t}return e}var b1=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.items=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:me(o)!=="object"?pe({},r,[{message:"Expected 'object', got '".concat(me(o),"'")}]):Array.isArray(o)?pe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Kn(a,2),c=l[0],u=l[1],d=Kr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var f=u.validate(d,o[c]);f&&s?s=Lc(Lc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(this.items);o<i.length;o++){var s=Kn(i[o],2),a=s[0],l=s[1];if(!l.assert(r[a]))return!1}return me(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new t(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=Kn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}]),t}(Ir),BL=function(t){return new b1(t)},N2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.item=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:me(o)!=="object"||!Array.isArray(o)?pe({},r,[{message:"Expected 'array', got '".concat(me(o),"'")}]):(o.forEach(function(a,l){var c=Kr(r,l);if(!c)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at index ").concat(l),o);else{var u=i.item.validate(c,a);u&&s?s=Lc(Lc({},u),s):u&&(s=u)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;var o=Eg(r),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!this.item.assert(s))return!1}}catch(a){o.e(a)}finally{o.f()}return me(r)==="object"&&Array.isArray(r)}},{key:"optional",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}]),t}(Ir),UL=function(t){return new N2(t)},Q0=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.value=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?pe({},r,[{message:"Expected 'string', got '".concat(me(o),"'"),value:o}]):o!==this.value?pe({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}]),t}(Ir),VL=function(t){return new Q0(t)},$2=function(e){Dr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return nn(this,t),o=Ar(this,t),o.key=n,o.items=r,o.opt=i,o}return rn(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i==null)return!1;if(!this.key)return pe({},r,[{message:"Missing required first argument in union"}]);var a=this.key;if(!Array.isArray(this.items))return pe({},r,[{message:"A union schema must take more than 1 schema arguments",fatal:!0}]);if(typeof a=="string"){if(this.items.some(function(P){return!(P instanceof b1)}))return pe({},r,[{message:"Key is a string, so all schema items must be objects",fatal:!0}]);var l=this.items,c=l.map(function(P){return P.serialize()}),u=c.filter(function(P){return P.type!=="object"||P.items[a].type!=="literal"});if(u.length>0)return pe({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),fatal:!0}]);var d=c,f=d.filter(function(P){return P.items[a].opt});if(f.length>1)return pe({},r,[{message:"Schema cannot have an optional keys: ".concat(a),fatal:!0}]);if(me(i)!=="object")return pe({},r,[{message:"Expected an object"}]);var p=i;if(p[a]===void 0)return pe({},r,[{message:"Missing required key: ".concat(a)}]);var m=[],g=Eg(d),y;try{for(g.s();!(y=g.n()).done;){var v=y.value,x=v.items[a];if(x.type==="literal")if(!m.includes(x.value))m.push(x.value);else return pe({},r,[{message:"Found duplicate key in schema: ".concat(x.value),fatal:!0}])}}catch(P){g.e(P)}finally{g.f()}var w=l.find(function(P){return!P.items[a].validate(r,p[a])});if(!w){var k=Kr(r,a);if(!k)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return pe({},k,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(P){var M=P.items[a];if(M.type==="literal"&&M.value)return'"'.concat(M.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(M,null,2)))}).join(", "))}])}var E=w.validate(r,p);if(E)return E}else if(a instanceof Q0){if(this.items.some(function(P){return!(P instanceof Q0)}))return pe({},r,[{message:"Key is a literal schema, so all schema items must be literals",fatal:!0}]);var S=[a].concat(_2(this.items));if(typeof i=="string"){var _=S.some(function(P){return!P.validate(r,i)});if(!_)return pe({},r,[{message:"Union must match one of the following: ".concat(S.map(function(P){return'"'.concat(P.value,'"')}).join(", "))}])}}else return pe({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new t(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",key:this.key.serialize(),items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}}]),t}(Ir),HL=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new $2(t,r)},A2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return!1}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}]),t}(Ir),WL=function(t){return new A2(t??{})},D2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?pe({},r,[{message:"Non-optional image was null or undefined.",value:o}]):typeof o[Cn]!="string"?pe({},r,[{message:"Image did not have a file reference string. Got: ".concat(me(o[Cn])),value:o}]):o[mn]!=="file"?pe({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[mn]),value:o}]):o.metadata?pe({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["image:replace-metadata"]}]):pe({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[Cn])==="image"&&(r==null?void 0:r[mn])==="file"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}]),t}(Ir),KL=function(t){return new D2(t)},I2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.item=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:me(o)!=="object"?pe({},r,[{message:"Expected 'object', got '".concat(me(o),"'")}]):Array.isArray(o)?pe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Kn(a,2),c=l[0],u=l[1],d=Kr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var f=i.item.validate(d,u);f&&s?s=Lc(Lc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(r);o<i.length;o++){var s=Kn(i[o],2),a=s[1];if(!this.item.assert(a))return!1}return me(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}]),t}(Ir),qL=function(t){return new I2(t)};function GL(e){var t=e[Xt];if(t instanceof x1)throw Error("Cannot get raw source of an Expr");var n=t;return n}function YL(e){return e.indexOf(".")===-1?[e,""]:[e.slice(0,e.indexOf(".")),e.slice(e.indexOf(".")+1)]}function XL(e){return e instanceof b1||me(e)==="object"&&"type"in e&&e.type==="object"}function ZL(e){return e instanceof I2||me(e)==="object"&&"type"in e&&e.type==="record"}function JL(e){return e instanceof N2||me(e)==="object"&&"type"in e&&e.type==="array"}function QL(e){return e instanceof $2||me(e)==="object"&&"type"in e&&e.type==="union"}function e5(e){return e instanceof A2||me(e)==="object"&&"type"in e&&e.type==="richtext"}function t5(e){return e instanceof D2||me(e)==="object"&&"type"in e&&e.type==="image"}function n5(e,t,n){for(var r=L2(e),o=_2(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(JL(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(me(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(me(s)));if(s[u]===void 0){var d;throw Error("Invalid path: array source (length: ".concat((d=s)===null||d===void 0?void 0:d.length,") did not have index ").concat(u," from path: ").concat(e))}s=s[u],i=i.item}else if(ZL(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(me(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(me(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.item}else if(XL(i)){if(me(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(me(s)));if(!s[u])throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.items[u]}else{if(t5(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};if(QL(i)){var f=i.key;if(typeof f!="string")return{v:{path:o.map(function(g){return Number.isNaN(Number(g))?JSON.stringify(g):g}).join("."),schema:i,source:s}};var p=s[f];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(f," in path: ").concat(e));var m=i.items.find(function(g){var y;return(g==null||(y=g.items)===null||y===void 0||(y=y[f])===null||y===void 0?void 0:y.value)===p});if(!m)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(f," of value ").concat(p," in path: ").concat(e));i=m.items[u],s=s[u]}else{if(e5(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function L2(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}var Tr=rn(function e(t){nn(this,e),this.message=t}),r5=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?pe({},r,[{message:"Expected 'number', got '".concat(me(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="number"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}]),t}(Ir),o5=function(t){return new r5(t)},j2=function(e){Dr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return nn(this,t),r=Ar(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return rn(t,[{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return pe({},r,[{message:"Expected 'string', got '".concat(me(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?pe({},r,l):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}}]),t}(Ir),i5=function(t){return new j2(t)},s5=function(e){Dr(t,e);function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return nn(this,t),n=Ar(this,t),n.opt=r,n}return rn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?pe({},r,[{message:"Expected 'boolean', got '".concat(me(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="boolean"}},{key:"optional",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}]),t}(Ir),a5=function(){return new s5},l5=function(e){Dr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return nn(this,t),o=Ar(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return rn(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return pe({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return pe({},r,[{message:"Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="array"&&typeof o!="number")return pe({},r,[{message:"Type of value in keyof (array) must be 'number'"}]);if(i.type==="record"&&typeof o!="string")return pe({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(o))return pe({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;var o=this.schema;if(!o)return!1;var i=o;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return!1;if(i.opt&&r==null)return!0;if(i.type==="array"&&typeof r!="number"||i.type==="record"&&typeof r!="string")return!1;if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(r))return!1}return!0}},{key:"optional",value:function(){return new t(this.schema,this.sourcePath,!0)}},{key:"serialize",value:function(){var r=this.sourcePath;if(!r)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"array":i="number";break;case"record":i="string";break;case"object":i=Object.keys(o.items);break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(o.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",path:r,schema:o,opt:this.opt,values:i}}}]),t}(Ir),c5=function(t){var n;return new l5(t==null||(n=t[Od])===null||n===void 0?void 0:n.serialize(),R2(t))};function u5(){return{string:i5,boolean:a5,array:UL,object:BL,number:o5,union:HL,richtext:WL,image:KL,literal:VL,keyOf:c5,record:qL,file:jL}}var Nk="rt_image";function d5(e){return z2(h5(e))}function f5(e){return Fs(e)?me(e[Xt])==="object"&&e[Xt]!==null&&Array.isArray(e[Xt]):Array.isArray(e)}function p5(e){return Fs(e)?me(e[Xt])==="object"&&e[Xt]!==null&&!Array.isArray(e[Xt]):me(e)==="object"}function h5(e){var t=ln(e);function n(r){var o=f5(r),i=p5(r);if(o){var s=Xt in r?r[Xt]:r,a=Hn in r?r[Hn]:void 0;return{val:s.map(function(u,d){return n(Fs(u)?u:ln(u,Kr(a,d)))}),valPath:a}}else if(i){var l=Xt in r?r[Xt]:r,c=Hn in r?r[Hn]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=Kn(u,2),f=d[0],p=d[1];return[f,n(Fs(p)?p:ln(p,Kr(c,f)))]})),valPath:c}}else return Fs(r)?{val:n(r[Xt]),valPath:r[Hn]}:r}return n(t)}function ex(e){var t=M2(e)?e.val:e;switch(me(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(me(t)));case"object":return t===null?null:Array.isArray(t)?t.map(ex):Object.fromEntries(Object.entries(t).map(function(n){var r=Kn(n,2),o=r[0],i=r[1];return[o,i&&ex(i)]}));default:return t}}function z2(e){var t=e.val;switch(me(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(me(t)));case"object":if(t!==null)return new Proxy(t,{has:function(r,o){return o==="val"||o===Hn?!0:$k(r,o)},get:function(r,o){if(o===Hn)return e.valPath;if(o==="val")return ex(e);if(Array.isArray(r)&&o==="length")return r.length;if($k(t,o)){var i,s;return z2({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:Kr(e.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return pe(pe({},Hn,e.valPath),"val",e.val)}}function $k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var m5=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],ut=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(ut||{}),Ak={sha256:1};function g5(e){if(e&&!Ak[e]&&!Ak[e.toLowerCase()])throw new Error("Digest method not supported");return new v5}var v5=function(){function e(){nn(this,e),pe(this,"A",1779033703),pe(this,"B",-1150833019),pe(this,"C",1013904242),pe(this,"D",-1521486534),pe(this,"E",1359893119),pe(this,"F",-1694144372),pe(this,"G",528734635),pe(this,"H",1541459225),pe(this,"_size",0),pe(this,"_sp",0),(!jp||Tu>=ut.allocTotal)&&(jp=new ArrayBuffer(ut.allocTotal),Tu=0),this._byte=new Uint8Array(jp,Tu,ut.allocBytes),this._word=new Int32Array(jp,Tu,ut.allocWords),Tu+=ut.allocBytes}return rn(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+me(n));var r=n.byteOffset,o=n.byteLength,i=o/ut.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%ut.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*ut.inputWords);i--;)this._int32(a,s>>2),s+=ut.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%ut.inputBytes,l=a;r<s&&l<ut.inputBytes;)o[l++]=n[r++];l>=ut.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%ut.inputBytes,c=l;a<i&&c<ut.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=ut.inputBytes&&(this._int32(o),o[0]=o[ut.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,f=0;for(r=r|0;f<ut.inputWords;)ma[f++]=lo(n[r++]);for(f=ut.inputWords;f<ut.workWords;f++)ma[f]=_5(ma[f-2])+ma[f-7]+E5(ma[f-15])+ma[f-16]|0;for(f=0;f<ut.workWords;f++){var p=d+k5(l)+b5(l,c,u)+m5[f]+ma[f]|0,m=S5(o)+w5(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%ut.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>ut.highIndex){for(;i<ut.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<ut.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[ut.highIndex]=lo(l)),a&&(o[ut.lowIndex]=lo(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return Qi(n)+Qi(r)+Qi(o)+Qi(i)+Qi(s)+Qi(a)+Qi(l)+Qi(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=lo(n),d[1]=lo(r),d[2]=lo(o),d[3]=lo(i),d[4]=lo(s),d[5]=lo(a),d[6]=lo(l),d[7]=lo(c),u.slice(0,32)}}]),e}(),ma=new Int32Array(ut.workWords),jp,Tu=0,Qi=function(t){return(t+4294967296).toString(16).substr(-8)},y5=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},x5=function(t){return t},lo=C5()?x5:y5,b5=function(t,n,r){return r^t&(n^r)},w5=function(t,n,r){return t&n|r&(t|n)},S5=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},k5=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},E5=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},_5=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function C5(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var O5=function(t){return g5().update(t).digest("hex")};function vr(){vr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(C,T,O){C[T]=O.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(C,T,O){return Object.defineProperty(C,T,{value:O,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(T,O,R){return T[O]=R}}function u(C,T,O,R){var N=T&&T.prototype instanceof v?T:v,j=Object.create(N.prototype),G=new V(R||[]);return o(j,"_invoke",{value:A(C,O,G)}),j}function d(C,T,O){try{return{type:"normal",arg:C.call(T,O)}}catch(R){return{type:"throw",arg:R}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",g="completed",y={};function v(){}function x(){}function w(){}var k={};c(k,s,function(){return this});var E=Object.getPrototypeOf,S=E&&E(E(K([])));S&&S!==n&&r.call(S,s)&&(k=S);var _=w.prototype=v.prototype=Object.create(k);function P(C){["next","throw","return"].forEach(function(T){c(C,T,function(O){return this._invoke(T,O)})})}function M(C,T){function O(N,j,G,xe){var ue=d(C[N],C,j);if(ue.type!=="throw"){var je=ue.arg,Ce=je.value;return Ce&&typeof Ce=="object"&&r.call(Ce,"__await")?T.resolve(Ce.__await).then(function(Q){O("next",Q,G,xe)},function(Q){O("throw",Q,G,xe)}):T.resolve(Ce).then(function(Q){je.value=Q,G(je)},function(Q){return O("throw",Q,G,xe)})}xe(ue.arg)}var R;o(this,"_invoke",{value:function(N,j){function G(){return new T(function(xe,ue){O(N,j,xe,ue)})}return R=R?R.then(G,G):G()}})}function A(C,T,O){var R=f;return function(N,j){if(R===m)throw new Error("Generator is already running");if(R===g){if(N==="throw")throw j;return{value:e,done:!0}}for(O.method=N,O.arg=j;;){var G=O.delegate;if(G){var xe=I(G,O);if(xe){if(xe===y)continue;return xe}}if(O.method==="next")O.sent=O._sent=O.arg;else if(O.method==="throw"){if(R===f)throw R=g,O.arg;O.dispatchException(O.arg)}else O.method==="return"&&O.abrupt("return",O.arg);R=m;var ue=d(C,T,O);if(ue.type==="normal"){if(R=O.done?g:p,ue.arg===y)continue;return{value:ue.arg,done:O.done}}ue.type==="throw"&&(R=g,O.method="throw",O.arg=ue.arg)}}}function I(C,T){var O=T.method,R=C.iterator[O];if(R===e)return T.delegate=null,O==="throw"&&C.iterator.return&&(T.method="return",T.arg=e,I(C,T),T.method==="throw")||O!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+O+"' method")),y;var N=d(R,C.iterator,T.arg);if(N.type==="throw")return T.method="throw",T.arg=N.arg,T.delegate=null,y;var j=N.arg;return j?j.done?(T[C.resultName]=j.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=e),T.delegate=null,y):j:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,y)}function L(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function re(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function V(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(L,this),this.reset(!0)}function K(C){if(C||C===""){var T=C[s];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var O=-1,R=function N(){for(;++O<C.length;)if(r.call(C,O))return N.value=C[O],N.done=!1,N;return N.value=e,N.done=!0,N};return R.next=R}}throw new TypeError(typeof C+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===x||(T.displayName||T.name)==="GeneratorFunction")},t.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,w):(C.__proto__=w,c(C,l,"GeneratorFunction")),C.prototype=Object.create(_),C},t.awrap=function(C){return{__await:C}},P(M.prototype),c(M.prototype,a,function(){return this}),t.AsyncIterator=M,t.async=function(C,T,O,R,N){N===void 0&&(N=Promise);var j=new M(u(C,T,O,R),N);return t.isGeneratorFunction(T)?j:j.next().then(function(G){return G.done?G.value:j.next()})},P(_),c(_,l,"Generator"),c(_,s,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),t.keys=function(C){var T=Object(C),O=[];for(var R in T)O.push(R);return O.reverse(),function N(){for(;O.length;){var j=O.pop();if(j in T)return N.value=j,N.done=!1,N}return N.done=!0,N}},t.values=K,V.prototype={constructor:V,reset:function(C){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(re),!C)for(var T in this)T.charAt(0)==="t"&&r.call(this,T)&&!isNaN(+T.slice(1))&&(this[T]=e)},stop:function(){this.done=!0;var C=this.tryEntries[0].completion;if(C.type==="throw")throw C.arg;return this.rval},dispatchException:function(C){if(this.done)throw C;var T=this;function O(ue,je){return j.type="throw",j.arg=C,T.next=ue,je&&(T.method="next",T.arg=e),!!je}for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R],j=N.completion;if(N.tryLoc==="root")return O("end");if(N.tryLoc<=this.prev){var G=r.call(N,"catchLoc"),xe=r.call(N,"finallyLoc");if(G&&xe){if(this.prev<N.catchLoc)return O(N.catchLoc,!0);if(this.prev<N.finallyLoc)return O(N.finallyLoc)}else if(G){if(this.prev<N.catchLoc)return O(N.catchLoc,!0)}else{if(!xe)throw new Error("try statement without catch or finally");if(this.prev<N.finallyLoc)return O(N.finallyLoc)}}}},abrupt:function(C,T){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&r.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var N=R;break}}N&&(C==="break"||C==="continue")&&N.tryLoc<=T&&T<=N.finallyLoc&&(N=null);var j=N?N.completion:{};return j.type=C,j.arg=T,N?(this.method="next",this.next=N.finallyLoc,y):this.complete(j)},complete:function(C,T){if(C.type==="throw")throw C.arg;return C.type==="break"||C.type==="continue"?this.next=C.arg:C.type==="return"?(this.rval=this.arg=C.arg,this.method="return",this.next="end"):C.type==="normal"&&T&&(this.next=T),y},finish:function(C){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.finallyLoc===C)return this.complete(O.completion,O.afterLoc),re(O),y}},catch:function(C){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.tryLoc===C){var R=O.completion;if(R.type==="throw"){var N=R.arg;re(O)}return N}}throw new Error("illegal catch attempt")},delegateYield:function(C,T,O){return this.delegate={iterator:K(C),resultName:T,nextLoc:O},this.method==="next"&&(this.arg=e),y}},t}function Dk(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){n(c);return}a.done?t(l):Promise.resolve(l).then(r,o)}function Ul(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){Dk(i,r,o,s,a,"next",l)}function a(l){Dk(i,r,o,s,a,"throw",l)}s(void 0)})}}var F2=function(){function e(t){nn(this,e),this.host=t}return rn(e,[{key:"getDisableUrl",value:function(n){return"".concat(this.host,"/disable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getLoginUrl",value:function(n){return"".concat(this.host,"/authorize?redirect_to=").concat(encodeURIComponent(n))}},{key:"getEnableUrl",value:function(n){return"".concat(this.host,"/enable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getPatches",value:function(){var t=Ul(vr().mark(function r(o){var i,s,a;return vr().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.patchIds,s=o.headers,a=i?"?".concat(i.map(function(u){return"".concat(u,"=").concat(encodeURIComponent(u))}).join("&")):"",c.abrupt("return",fetch("".concat(this.host,"/patches/~").concat(a),{headers:s||{"Content-Type":"application/json"}}).then(function(u){return es(u)}).catch(ga));case 3:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"deletePatches",value:function(){var t=Ul(vr().mark(function r(o,i){var s;return vr().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return s=new URLSearchParams,o.forEach(function(c){return s.append("id",c)}),l.abrupt("return",fetch("".concat(this.host,"/patches/~?").concat(s),{method:"DELETE",headers:i||{"Content-Type":"application/json"}}).then(function(c){return es(c)}).catch(ga));case 3:case"end":return l.stop()}},r,this)}));function n(r,o){return t.apply(this,arguments)}return n}()},{key:"getEditUrl",value:function(){return"/val"}},{key:"postPatches",value:function(n,r,o){return fetch("".concat(this.host,"/patches/~"),{headers:o||{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(pe({},n,r))}).then(function(){var i=Ul(vr().mark(function s(a){return vr().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",es(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(ga)}},{key:"getSession",value:function(){return fetch("".concat(this.host,"/session")).then(function(n){return es(n).catch(ga)})}},{key:"getTree",value:function(n){var r=n.patch,o=r===void 0?!1:r,i=n.includeSchema,s=i===void 0?!1:i,a=n.includeSource,l=a===void 0?!1:a,c=n.treePath,u=c===void 0?"/":c,d=n.headers,f=new URLSearchParams;return f.set("patch",o.toString()),f.set("schema",s.toString()),f.set("source",l.toString()),fetch("".concat(this.host,"/tree/~").concat(u,"?").concat(f.toString()),{headers:d}).then(function(p){return es(p)}).catch(ga)}},{key:"postCommit",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/commit"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=Ul(vr().mark(function s(a){var l;return vr().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(!a.ok){u.next=4;break}return u.abrupt("return",es(a));case 4:if(!(a.status===400&&a.headers.get("content-type")==="application/json")){u.next=13;break}return u.next=7,a.json();case 7:if(l=u.sent,!("validationErrors"in l)){u.next=12;break}return u.abrupt("return",Vt(l));case 12:return u.abrupt("return",B2(a.status,l,a.statusText));case 13:return u.abrupt("return",es(a));case 14:case"end":return u.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(ga)}},{key:"postValidate",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/validate"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=Ul(vr().mark(function s(a){return vr().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",es(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(ga)}}]),e}();function ga(e){return Vt({statusCode:500,message:e instanceof Error||me(e)==="object"&&e&&"message"in e&&typeof e.message=="string"?e.message:"Unknown error",details:me(e)==="object"&&e&&"details"in e?e.details:void 0})}function B2(e,t,n){return Vt({statusCode:e,message:t.message||n,details:t.details||Object.fromEntries(Object.entries(t).filter(function(r){var o=Kn(r,1),i=o[0];return i!=="message"}))})}function es(e){return tx.apply(this,arguments)}function tx(){return tx=Ul(vr().mark(function e(t){var n;return vr().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,!t.ok){o.next=9;break}return o.t0=St,o.next=5,t.json();case 5:return o.t1=o.sent,o.abrupt("return",o.t0.ok.call(o.t0,o.t1));case 9:return o.prev=9,o.next=12,t.json();case 12:return n=o.sent,o.abrupt("return",B2(t.status,n,t.statusText));case 16:return o.prev=16,o.t2=o.catch(9),o.abrupt("return",Vt({statusCode:t.status,message:t.statusText}));case 19:o.next=24;break;case 21:return o.prev=21,o.t3=o.catch(0),o.abrupt("return",Vt({message:o.t3 instanceof Error?o.t3.message:"Unknown error"}));case 24:case"end":return o.stop()}},e,null,[[0,21],[9,16]])})),tx.apply(this,arguments)}var ot={convertFileSource:P2,getSchema:DL,getValPath:R2,getVal:d5,getSource:GL,resolvePath:n5,splitModuleIdAndModulePath:YL,isVal:zL,createValPathOfItem:Kr,getSHA256Hash:O5,initSchema:u5,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&T5(n)}).join("/"))},createPatchPath:function(t){return L2(t)},patchPathToModulePath:function(t){return t.map(function(n){return Number.isInteger(Number(n))?n:JSON.stringify(n)}).join(".")},VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session"};function T5(e){try{return JSON.parse(e)}catch{return e}}var U2={exports:{}};/*!
|
|
44
44
|
Copyright (c) 2018 Jed Watson.
|
|
45
45
|
Licensed under the MIT License (MIT), see
|
|
46
46
|
http://jedwatson.github.io/classnames
|
package/server/.tmp/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Val</title>
|
|
7
|
-
<script type="module" crossorigin src="/api/val/static/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/api/val/static/assets/index-WRueAJgB.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/api/val/static/assets/index-ctzNOPVY.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|