fastapi-rtk 0.0.52 → 0.0.54
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/dist/fastapi-rtk.es.js
CHANGED
|
@@ -707,7 +707,7 @@ function Ye({
|
|
|
707
707
|
case "Integer":
|
|
708
708
|
return { col: c, opr: f, value: parseInt(u) };
|
|
709
709
|
case "String":
|
|
710
|
-
return { col: c, opr: f, value: Ir(u) };
|
|
710
|
+
return { col: c, opr: f, value: String(Ir(u)) };
|
|
711
711
|
case "Geometry":
|
|
712
712
|
case "Related":
|
|
713
713
|
try {
|
package/dist/fastapi-rtk.umd.js
CHANGED
|
@@ -29,7 +29,7 @@ Check the top-level render call using <`+$+">.")}return E}}function yn(g,E){{if(
|
|
|
29
29
|
<%s {...props} />
|
|
30
30
|
React keys must be passed directly to JSX without using spread:
|
|
31
31
|
let props = %s;
|
|
32
|
-
<%s key={someKey} {...props} />`,et,xe,ar,xe),Fi[xe+et]=!0}}return g===n?Ni(j):Di(j),j}}function Fr(g,E,$){return ot(g,E,$,!0)}function Li(g,E,$){return ot(g,E,$,!1)}var zi=Li,Ui=Fr;zr.Fragment=n,zr.jsx=zi,zr.jsxs=Ui}()),zr}process.env.NODE_ENV==="production"?Bi.exports=Id():Bi.exports=$d();var d=Bi.exports;const sr=e=>{if(typeof e=="string"){try{return sr(JSON.parse(e))}catch{}return encodeURIComponent(e)}return typeof e!="object"?e:Array.isArray(e)?e.map(sr):Object.entries(e).reduce((t,[r,n])=>(t[r]=sr(n),t),{})};function Ve({path:e,method:t,body:r=void 0,queryParams:n=void 0,filterSchema:i=void 0}){Object.entries(n||{}).forEach(([o,s])=>{o==="filters"&&i&&(s=s.map(l=>{const{col:u,opr:f,value:c}=l,p=i==null?void 0:i[u];if(!p||["boolean","number"].includes(typeof c))return l;const{type:y}=p.schema;switch(y){case"Boolean":return{col:u,opr:f,value:c==="true"||c=="1"};case"Integer":return{col:u,opr:f,value:parseInt(c)};case"String":return{col:u,opr:f,value:sr(c)};case"Geometry":case"Related":try{return{col:u,opr:f,value:sr(c)}}catch{return l}case"RelatedList":try{let m=c;const h=m.map(x=>parseInt(x));return h.every(x=>!isNaN(x))&&(m=h),{col:u,opr:f,value:sr(m)}}catch{return l}default:return l}})),(Array.isArray(s)||typeof s=="object")&&(s=JSON.stringify(s)),e.includes("?")||(e+="?"),e+=`${o}=${s}&`}),e.endsWith("&")&&(e=e.slice(0,-1));const a={method:t,mode:"cors",credentials:"include",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:r?JSON.stringify(r):null};return{fetchPath:e,options:a}}function Rd(e){const t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let i=0;i<e.length;i++){let a=e[i];if(typeof a!="string")throw new TypeError("Url must be a string. Received "+a);a!==""&&(i>0&&(a=a.replace(/^[\/]+/,"")),i<e.length-1?a=a.replace(/[\/]+$/,""):a=a.replace(/[\/]+$/,"/"),t.push(a))}let r=t.join("/");r=r.replace(/\/(\?|&|#[^!])/g,"$1");const n=r.split("?");return r=n.shift()+(n.length>0?"?":"")+n.join("&"),r}function Pe(...e){const t=Array.from(Array.isArray(e[0])?e[0]:e);return Rd(t)}function vn(e,{autoInvoke:t=!0,initialLoading:r=!1,clearDataOnRefetch:n=!1,...i}={}){const[a,o]=T.useState(null),[s,l]=T.useState(r),[u,f]=T.useState(null),c=T.useRef(null),p=T.useCallback(()=>{if(e)return n&&o(null),f(null),c.current&&c.current.abort(),c.current=new AbortController,l(!0),fetch(e,{signal:c.current.signal,...i}).then(async m=>{const h=await m.json();if(!m.ok){const x=typeof h.detail=="string"?h.detail:JSON.stringify(h.detail,null,2);throw new Error(x)}return o(h),l(!1),h}).catch(m=>(m&&m.name!=="AbortError"&&(f(m),l(!1)),m))},[e]),y=T.useCallback(()=>{var m;c.current&&((m=c.current)==null||m.abort(""),l(!1))},[]);return T.useEffect(()=>(t&&p(),()=>{c.current&&c.current.abort("")}),[p,t]),{data:a,loading:s,error:u,refetch:p,abort:y}}function Bo({path:e,autoInvoke:t=!0,initialLoading:r=!0}){const{fetchPath:n,options:i}=T.useMemo(()=>Ve({path:Pe(e,"auth/user"),method:"GET"}),[e]),{data:a,loading:o,refetch:s,error:l}=vn(n,{autoInvoke:t,initialLoading:r,...i});return{user:a,loading:o,refetch:s,error:l}}function Wo({path:e,queryParams:t,autoInvoke:r=!0,clearDataOnRefetch:n=!1,filterSchema:i}){const{fetchPath:a,options:o}=T.useMemo(()=>Ve({path:Pe(e,"/"),method:"GET",queryParams:t,filterSchema:i}),[i,e,t]),{data:s,loading:l,refetch:u,error:f}=vn(a,{autoInvoke:r,clearDataOnRefetch:n,...o});return{data:T.useMemo(()=>{if(!s)return null;const p=s.result.map((y,m)=>{const h=s.ids[m];return typeof h=="object"?{...y,...h}:{...y,id:h}});return{...s,result:p}},[s]),loading:l,refetch:u,error:f}}const Md=async(e,t)=>{const{fetchPath:r,options:n}=Ve({path:Pe(e,"/"),method:"POST",body:t}),i=await fetch(r,n),a=await i.json();if(i.ok)return a;const o=typeof a.detail=="string"?a.detail:JSON.stringify(a.detail,null,2);throw new Error(o)},Dd=async(e,t)=>{const{fetchPath:r,options:n}=Ve({path:Pe(e,t.toString()),method:"DELETE"}),i=await fetch(r,n),a=await i.json();if(i.ok)return a;const o=typeof a.detail=="string"?a.detail:JSON.stringify(a.detail,null,2);throw new Error(o)},Nd=async(e,t)=>{const{fetchPath:r,options:n}=Ve({path:Pe(e,t.toString()),method:"GET"}),i=await fetch(r,n),a=await i.json();if(i.ok)return a;const o=typeof a.detail=="string"?a.detail:JSON.stringify(a.detail,null,2);throw new Error(o)},Fd=async(e,t,r)=>{const{fetchPath:n,options:i}=Ve({path:Pe(e,t.toString()),method:"PUT",body:r}),a=await fetch(n,i),o=await a.json();if(a.ok)return o;const s=typeof o.detail=="string"?o.detail:JSON.stringify(o.detail,null,2);throw new Error(s)},Fe=e=>e&&typeof e=="object"?JSON.stringify(e):e;function Wi(e,t){const r=e||{columns:[],filters:[],page:0,page_size:25};return t.hasOwnProperty("columns")&&(r.columns=t.columns),t.hasOwnProperty("filters")&&(r.filters=t.filters),t.hasOwnProperty("order_column")&&(r.order_column=t.order_column),t.hasOwnProperty("order_direction")&&(r.order_direction=t.order_direction),t.hasOwnProperty("page")&&(r.page=t.page),t.hasOwnProperty("page_size")&&(r.page_size=t.page_size),r}const Ho=e=>{const t={};for(const r of e)switch(r.type){case"RelatedList":t[r.name]=[];break;case"Boolean":t[r.name]="false";break;case"Date":case"DateTime":case"Integer":case"Float":case"Geometry":case"Raw":case"Related":t[r.name]=void 0;break;default:t[r.name]=""}return t};function Yt(e){this._maxSize=e,this.clear()}Yt.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Yt.prototype.get=function(e){return this._values[e]},Yt.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var Ld=/[^.^\]^[]+|(?=\[\]|\.\.)/g,Go=/^\d+$/,zd=/^\d/,Ud=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Vd=/^\s*(['"]?)(.*?)(\1)\s*$/,Hi=512,qo=new Yt(Hi),Yo=new Yt(Hi),Ko=new Yt(Hi),Kt={Cache:Yt,split:qi,normalizePath:Gi,setter:function(e){var t=Gi(e);return Yo.get(e)||Yo.set(e,function(n,i){for(var a=0,o=t.length,s=n;a<o-1;){var l=t[a];if(l==="__proto__"||l==="constructor"||l==="prototype")return n;s=s[t[a++]]}s[t[a]]=i})},getter:function(e,t){var r=Gi(e);return Ko.get(e)||Ko.set(e,function(i){for(var a=0,o=r.length;a<o;)if(i!=null||!t)i=i[r[a++]];else return;return i})},join:function(e){return e.reduce(function(t,r){return t+(Yi(r)||Go.test(r)?"["+r+"]":(t?".":"")+r)},"")},forEach:function(e,t,r){Bd(Array.isArray(e)?e:qi(e),t,r)}};function Gi(e){return qo.get(e)||qo.set(e,qi(e).map(function(t){return t.replace(Vd,"$2")}))}function qi(e){return e.match(Ld)||[""]}function Bd(e,t,r){var n=e.length,i,a,o,s;for(a=0;a<n;a++)i=e[a],i&&(Gd(i)&&(i='"'+i+'"'),s=Yi(i),o=!s&&/^\d+$/.test(i),t.call(r,i,s,o,a,e))}function Yi(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function Wd(e){return e.match(zd)&&!e.match(Go)}function Hd(e){return Ud.test(e)}function Gd(e){return!Yi(e)&&(Wd(e)||Hd(e))}const qd=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,bn=e=>e.match(qd)||[],xn=e=>e[0].toUpperCase()+e.slice(1),Ki=(e,t)=>bn(e).join(t).toLowerCase(),Xo=e=>bn(e).reduce((t,r)=>`${t}${t?r[0].toUpperCase()+r.slice(1).toLowerCase():r.toLowerCase()}`,"");var Xi={words:bn,upperFirst:xn,camelCase:Xo,pascalCase:e=>xn(Xo(e)),snakeCase:e=>Ki(e,"_"),kebabCase:e=>Ki(e,"-"),sentenceCase:e=>xn(Ki(e," ")),titleCase:e=>bn(e).map(xn).join(" ")},Ji={exports:{}};Ji.exports=function(e){return Jo(Yd(e),e)},Ji.exports.array=Jo;function Jo(e,t){var r=e.length,n=new Array(r),i={},a=r,o=Kd(t),s=Xd(e);for(t.forEach(function(u){if(!s.has(u[0])||!s.has(u[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});a--;)i[a]||l(e[a],a,new Set);return n;function l(u,f,c){if(c.has(u)){var p;try{p=", node was:"+JSON.stringify(u)}catch{p=""}throw new Error("Cyclic dependency"+p)}if(!s.has(u))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(u));if(!i[f]){i[f]=!0;var y=o.get(u)||new Set;if(y=Array.from(y),f=y.length){c.add(u);do{var m=y[--f];l(m,s.get(m),c)}while(f);c.delete(u)}n[--r]=u}}}function Yd(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var i=e[r];t.add(i[0]),t.add(i[1])}return Array.from(t)}function Kd(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}function Xd(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}var Jd=Ji.exports;const Zd=At(Jd),Qd=Object.prototype.toString,ep=Error.prototype.toString,tp=RegExp.prototype.toString,rp=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",np=/^Symbol\((.*)\)(.*)$/;function ip(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Zo(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return ip(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return rp.call(e).replace(np,"Symbol($1)");const n=Qd.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+ep.call(e)+"]":n==="RegExp"?tp.call(e):null}function xt(e,t){let r=Zo(e,t);return r!==null?r:JSON.stringify(e,function(n,i){let a=Zo(this[n],t);return a!==null?a:i},2)}function Qo(e){return e==null?[]:[].concat(e)}let es,ts,rs,ap=/\$\{\s*(\w+)\s*\}/g;es=Symbol.toStringTag;class ns{constructor(t,r,n,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[es]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],Qo(t).forEach(a=>{if(Le.isError(a)){this.errors.push(...a.errors);const o=a.inner.length?a.inner:[a];this.inner.push(...o)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}ts=Symbol.hasInstance,rs=Symbol.toStringTag;class Le extends Error{static formatError(t,r){const n=r.label||r.path||"this";return n!==r.path&&(r=Object.assign({},r,{path:n})),typeof t=="string"?t.replace(ap,(i,a)=>xt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,i,a){const o=new ns(t,r,n,i);if(a)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[rs]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,Le)}static[ts](t){return ns[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let _t={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=n!=null&&n!==r?` (cast from the value \`${xt(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${xt(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${xt(r,!0)}\``+i}},Ke={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Nt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Zi={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Qi={isValue:"${path} field must be ${value}"},ea={noUnknown:"${path} field has unspecified keys: ${unknown}"},_n={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},is={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${xt(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${xt(r,!0)}\``}return Le.formatError(_t.notType,e)}};var as=Object.assign(Object.create(null),{mixed:_t,string:Ke,number:Nt,date:Zi,object:ea,array:_n,boolean:Qi,tuple:is});const Xt=e=>e&&e.__isYupSchema__;class Tn{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:a}=r,o=typeof n=="function"?n:(...s)=>s.every(l=>l===n);return new Tn(t,(s,l)=>{var u;let f=o(...s)?i:a;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn(n,t,r);if(i===void 0||i===t)return t;if(!Xt(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}}const En={context:"$",value:"."};function op(e,t){return new Ft(e,t)}class Ft{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===En.context,this.isValue=this.key[0]===En.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?En.context:this.isValue?En.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&Kt.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let i=this.isContext?n:this.isValue?t:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}Ft.prototype.__isYupRef=!0;const ht=e=>e==null;function lr(e){function t({value:r,path:n="",options:i,originalValue:a,schema:o},s,l){const{name:u,test:f,params:c,message:p,skipAbsent:y}=e;let{parent:m,context:h,abortEarly:x=o.spec.abortEarly,disableStackTrace:w=o.spec.disableStackTrace}=i;function k(D){return Ft.isRef(D)?D.getValue(r,m,h):D}function M(D={}){const re=Object.assign({value:r,originalValue:a,label:o.spec.label,path:D.path||n,spec:o.spec,disableStackTrace:D.disableStackTrace||w},c,D.params);for(const ge of Object.keys(re))re[ge]=k(re[ge]);const he=new Le(Le.formatError(D.message||p,re),r,re.path,D.type||u,re.disableStackTrace);return he.params=re,he}const F=x?s:l;let _={path:n,parent:m,type:u,from:i.from,createError:M,resolve:k,options:i,originalValue:a,schema:o};const R=D=>{Le.isError(D)?F(D):D?l(null):F(M())},L=D=>{Le.isError(D)?F(D):s(D)};if(y&&ht(r))return R(!0);let J;try{var ae;if(J=f.call(_,r,_),typeof((ae=J)==null?void 0:ae.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(J).then(R,L)}}catch(D){L(D);return}R(J)}return t.OPTIONS=e,t}function ta(e,t,r,n=r){let i,a,o;return t?(Kt.forEach(t,(s,l,u)=>{let f=l?s.slice(1,s.length-1):s;e=e.resolve({context:n,parent:i,value:r});let c=e.type==="tuple",p=u?parseInt(f,10):0;if(e.innerType||c){if(c&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${s}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[p],e=c?e.spec.types[p]:e.innerType}if(!u){if(!e.fields||!e.fields[f])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);i=r,r=r&&r[f],e=e.fields[f]}a=f,o=l?"["+s+"]":"."+s}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}function sp(e,t,r,n){return ta(e,t,r,n).schema}class Sn extends Set{describe(){const t=[];for(const r of this.values())t.push(Ft.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const n of this.values())r.push(t(n));return r}clone(){return new Sn(this.values())}merge(t,r){const n=this.clone();return t.forEach(i=>n.add(i)),r.forEach(i=>n.delete(i)),n}}function ur(e,t=new Map){if(Xt(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=ur(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,ur(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(ur(n,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=ur(i,t)}else throw Error(`Unable to clone ${e}`);return r}class ze{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Sn,this._blacklist=new Sn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_t.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=ur(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let n=t(this);return this._mutate=r,n}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,n=t.clone();const i=Object.assign({},r.spec,n.spec);return n.spec=i,n.internalTests=Object.assign({},r.internalTests,n.internalTests),n._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),n._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(a=>{t.tests.forEach(o=>{a.test(o.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,a)=>a.resolve(i,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,i,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(n=t.abortEarly)!=null?n:this.spec.abortEarly,recursive:(i=t.recursive)!=null?i:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),i=r.assert==="ignore-optionality",a=n._cast(t,r);if(r.assert!==!1&&!n.isType(a)){if(i&&ht(a))return a;let o=xt(t),s=xt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
32
|
+
<%s key={someKey} {...props} />`,et,xe,ar,xe),Fi[xe+et]=!0}}return g===n?Ni(j):Di(j),j}}function Fr(g,E,$){return ot(g,E,$,!0)}function Li(g,E,$){return ot(g,E,$,!1)}var zi=Li,Ui=Fr;zr.Fragment=n,zr.jsx=zi,zr.jsxs=Ui}()),zr}process.env.NODE_ENV==="production"?Bi.exports=Id():Bi.exports=$d();var d=Bi.exports;const sr=e=>{if(typeof e=="string"){try{return sr(JSON.parse(e))}catch{}return encodeURIComponent(e)}return typeof e!="object"?e:Array.isArray(e)?e.map(sr):Object.entries(e).reduce((t,[r,n])=>(t[r]=sr(n),t),{})};function Ve({path:e,method:t,body:r=void 0,queryParams:n=void 0,filterSchema:i=void 0}){Object.entries(n||{}).forEach(([o,s])=>{o==="filters"&&i&&(s=s.map(l=>{const{col:u,opr:f,value:c}=l,p=i==null?void 0:i[u];if(!p||["boolean","number"].includes(typeof c))return l;const{type:y}=p.schema;switch(y){case"Boolean":return{col:u,opr:f,value:c==="true"||c=="1"};case"Integer":return{col:u,opr:f,value:parseInt(c)};case"String":return{col:u,opr:f,value:String(sr(c))};case"Geometry":case"Related":try{return{col:u,opr:f,value:sr(c)}}catch{return l}case"RelatedList":try{let m=c;const h=m.map(x=>parseInt(x));return h.every(x=>!isNaN(x))&&(m=h),{col:u,opr:f,value:sr(m)}}catch{return l}default:return l}})),(Array.isArray(s)||typeof s=="object")&&(s=JSON.stringify(s)),e.includes("?")||(e+="?"),e+=`${o}=${s}&`}),e.endsWith("&")&&(e=e.slice(0,-1));const a={method:t,mode:"cors",credentials:"include",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:r?JSON.stringify(r):null};return{fetchPath:e,options:a}}function Rd(e){const t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let i=0;i<e.length;i++){let a=e[i];if(typeof a!="string")throw new TypeError("Url must be a string. Received "+a);a!==""&&(i>0&&(a=a.replace(/^[\/]+/,"")),i<e.length-1?a=a.replace(/[\/]+$/,""):a=a.replace(/[\/]+$/,"/"),t.push(a))}let r=t.join("/");r=r.replace(/\/(\?|&|#[^!])/g,"$1");const n=r.split("?");return r=n.shift()+(n.length>0?"?":"")+n.join("&"),r}function Pe(...e){const t=Array.from(Array.isArray(e[0])?e[0]:e);return Rd(t)}function vn(e,{autoInvoke:t=!0,initialLoading:r=!1,clearDataOnRefetch:n=!1,...i}={}){const[a,o]=T.useState(null),[s,l]=T.useState(r),[u,f]=T.useState(null),c=T.useRef(null),p=T.useCallback(()=>{if(e)return n&&o(null),f(null),c.current&&c.current.abort(),c.current=new AbortController,l(!0),fetch(e,{signal:c.current.signal,...i}).then(async m=>{const h=await m.json();if(!m.ok){const x=typeof h.detail=="string"?h.detail:JSON.stringify(h.detail,null,2);throw new Error(x)}return o(h),l(!1),h}).catch(m=>(m&&m.name!=="AbortError"&&(f(m),l(!1)),m))},[e]),y=T.useCallback(()=>{var m;c.current&&((m=c.current)==null||m.abort(""),l(!1))},[]);return T.useEffect(()=>(t&&p(),()=>{c.current&&c.current.abort("")}),[p,t]),{data:a,loading:s,error:u,refetch:p,abort:y}}function Bo({path:e,autoInvoke:t=!0,initialLoading:r=!0}){const{fetchPath:n,options:i}=T.useMemo(()=>Ve({path:Pe(e,"auth/user"),method:"GET"}),[e]),{data:a,loading:o,refetch:s,error:l}=vn(n,{autoInvoke:t,initialLoading:r,...i});return{user:a,loading:o,refetch:s,error:l}}function Wo({path:e,queryParams:t,autoInvoke:r=!0,clearDataOnRefetch:n=!1,filterSchema:i}){const{fetchPath:a,options:o}=T.useMemo(()=>Ve({path:Pe(e,"/"),method:"GET",queryParams:t,filterSchema:i}),[i,e,t]),{data:s,loading:l,refetch:u,error:f}=vn(a,{autoInvoke:r,clearDataOnRefetch:n,...o});return{data:T.useMemo(()=>{if(!s)return null;const p=s.result.map((y,m)=>{const h=s.ids[m];return typeof h=="object"?{...y,...h}:{...y,id:h}});return{...s,result:p}},[s]),loading:l,refetch:u,error:f}}const Md=async(e,t)=>{const{fetchPath:r,options:n}=Ve({path:Pe(e,"/"),method:"POST",body:t}),i=await fetch(r,n),a=await i.json();if(i.ok)return a;const o=typeof a.detail=="string"?a.detail:JSON.stringify(a.detail,null,2);throw new Error(o)},Dd=async(e,t)=>{const{fetchPath:r,options:n}=Ve({path:Pe(e,t.toString()),method:"DELETE"}),i=await fetch(r,n),a=await i.json();if(i.ok)return a;const o=typeof a.detail=="string"?a.detail:JSON.stringify(a.detail,null,2);throw new Error(o)},Nd=async(e,t)=>{const{fetchPath:r,options:n}=Ve({path:Pe(e,t.toString()),method:"GET"}),i=await fetch(r,n),a=await i.json();if(i.ok)return a;const o=typeof a.detail=="string"?a.detail:JSON.stringify(a.detail,null,2);throw new Error(o)},Fd=async(e,t,r)=>{const{fetchPath:n,options:i}=Ve({path:Pe(e,t.toString()),method:"PUT",body:r}),a=await fetch(n,i),o=await a.json();if(a.ok)return o;const s=typeof o.detail=="string"?o.detail:JSON.stringify(o.detail,null,2);throw new Error(s)},Fe=e=>e&&typeof e=="object"?JSON.stringify(e):e;function Wi(e,t){const r=e||{columns:[],filters:[],page:0,page_size:25};return t.hasOwnProperty("columns")&&(r.columns=t.columns),t.hasOwnProperty("filters")&&(r.filters=t.filters),t.hasOwnProperty("order_column")&&(r.order_column=t.order_column),t.hasOwnProperty("order_direction")&&(r.order_direction=t.order_direction),t.hasOwnProperty("page")&&(r.page=t.page),t.hasOwnProperty("page_size")&&(r.page_size=t.page_size),r}const Ho=e=>{const t={};for(const r of e)switch(r.type){case"RelatedList":t[r.name]=[];break;case"Boolean":t[r.name]="false";break;case"Date":case"DateTime":case"Integer":case"Float":case"Geometry":case"Raw":case"Related":t[r.name]=void 0;break;default:t[r.name]=""}return t};function Yt(e){this._maxSize=e,this.clear()}Yt.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Yt.prototype.get=function(e){return this._values[e]},Yt.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var Ld=/[^.^\]^[]+|(?=\[\]|\.\.)/g,Go=/^\d+$/,zd=/^\d/,Ud=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Vd=/^\s*(['"]?)(.*?)(\1)\s*$/,Hi=512,qo=new Yt(Hi),Yo=new Yt(Hi),Ko=new Yt(Hi),Kt={Cache:Yt,split:qi,normalizePath:Gi,setter:function(e){var t=Gi(e);return Yo.get(e)||Yo.set(e,function(n,i){for(var a=0,o=t.length,s=n;a<o-1;){var l=t[a];if(l==="__proto__"||l==="constructor"||l==="prototype")return n;s=s[t[a++]]}s[t[a]]=i})},getter:function(e,t){var r=Gi(e);return Ko.get(e)||Ko.set(e,function(i){for(var a=0,o=r.length;a<o;)if(i!=null||!t)i=i[r[a++]];else return;return i})},join:function(e){return e.reduce(function(t,r){return t+(Yi(r)||Go.test(r)?"["+r+"]":(t?".":"")+r)},"")},forEach:function(e,t,r){Bd(Array.isArray(e)?e:qi(e),t,r)}};function Gi(e){return qo.get(e)||qo.set(e,qi(e).map(function(t){return t.replace(Vd,"$2")}))}function qi(e){return e.match(Ld)||[""]}function Bd(e,t,r){var n=e.length,i,a,o,s;for(a=0;a<n;a++)i=e[a],i&&(Gd(i)&&(i='"'+i+'"'),s=Yi(i),o=!s&&/^\d+$/.test(i),t.call(r,i,s,o,a,e))}function Yi(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function Wd(e){return e.match(zd)&&!e.match(Go)}function Hd(e){return Ud.test(e)}function Gd(e){return!Yi(e)&&(Wd(e)||Hd(e))}const qd=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,bn=e=>e.match(qd)||[],xn=e=>e[0].toUpperCase()+e.slice(1),Ki=(e,t)=>bn(e).join(t).toLowerCase(),Xo=e=>bn(e).reduce((t,r)=>`${t}${t?r[0].toUpperCase()+r.slice(1).toLowerCase():r.toLowerCase()}`,"");var Xi={words:bn,upperFirst:xn,camelCase:Xo,pascalCase:e=>xn(Xo(e)),snakeCase:e=>Ki(e,"_"),kebabCase:e=>Ki(e,"-"),sentenceCase:e=>xn(Ki(e," ")),titleCase:e=>bn(e).map(xn).join(" ")},Ji={exports:{}};Ji.exports=function(e){return Jo(Yd(e),e)},Ji.exports.array=Jo;function Jo(e,t){var r=e.length,n=new Array(r),i={},a=r,o=Kd(t),s=Xd(e);for(t.forEach(function(u){if(!s.has(u[0])||!s.has(u[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});a--;)i[a]||l(e[a],a,new Set);return n;function l(u,f,c){if(c.has(u)){var p;try{p=", node was:"+JSON.stringify(u)}catch{p=""}throw new Error("Cyclic dependency"+p)}if(!s.has(u))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(u));if(!i[f]){i[f]=!0;var y=o.get(u)||new Set;if(y=Array.from(y),f=y.length){c.add(u);do{var m=y[--f];l(m,s.get(m),c)}while(f);c.delete(u)}n[--r]=u}}}function Yd(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var i=e[r];t.add(i[0]),t.add(i[1])}return Array.from(t)}function Kd(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}function Xd(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}var Jd=Ji.exports;const Zd=At(Jd),Qd=Object.prototype.toString,ep=Error.prototype.toString,tp=RegExp.prototype.toString,rp=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",np=/^Symbol\((.*)\)(.*)$/;function ip(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Zo(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return ip(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return rp.call(e).replace(np,"Symbol($1)");const n=Qd.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+ep.call(e)+"]":n==="RegExp"?tp.call(e):null}function xt(e,t){let r=Zo(e,t);return r!==null?r:JSON.stringify(e,function(n,i){let a=Zo(this[n],t);return a!==null?a:i},2)}function Qo(e){return e==null?[]:[].concat(e)}let es,ts,rs,ap=/\$\{\s*(\w+)\s*\}/g;es=Symbol.toStringTag;class ns{constructor(t,r,n,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[es]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],Qo(t).forEach(a=>{if(Le.isError(a)){this.errors.push(...a.errors);const o=a.inner.length?a.inner:[a];this.inner.push(...o)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}ts=Symbol.hasInstance,rs=Symbol.toStringTag;class Le extends Error{static formatError(t,r){const n=r.label||r.path||"this";return n!==r.path&&(r=Object.assign({},r,{path:n})),typeof t=="string"?t.replace(ap,(i,a)=>xt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,i,a){const o=new ns(t,r,n,i);if(a)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[rs]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,Le)}static[ts](t){return ns[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let _t={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=n!=null&&n!==r?` (cast from the value \`${xt(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${xt(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${xt(r,!0)}\``+i}},Ke={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Nt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Zi={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Qi={isValue:"${path} field must be ${value}"},ea={noUnknown:"${path} field has unspecified keys: ${unknown}"},_n={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},is={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${xt(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${xt(r,!0)}\``}return Le.formatError(_t.notType,e)}};var as=Object.assign(Object.create(null),{mixed:_t,string:Ke,number:Nt,date:Zi,object:ea,array:_n,boolean:Qi,tuple:is});const Xt=e=>e&&e.__isYupSchema__;class Tn{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:a}=r,o=typeof n=="function"?n:(...s)=>s.every(l=>l===n);return new Tn(t,(s,l)=>{var u;let f=o(...s)?i:a;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn(n,t,r);if(i===void 0||i===t)return t;if(!Xt(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}}const En={context:"$",value:"."};function op(e,t){return new Ft(e,t)}class Ft{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===En.context,this.isValue=this.key[0]===En.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?En.context:this.isValue?En.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&Kt.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let i=this.isContext?n:this.isValue?t:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}Ft.prototype.__isYupRef=!0;const ht=e=>e==null;function lr(e){function t({value:r,path:n="",options:i,originalValue:a,schema:o},s,l){const{name:u,test:f,params:c,message:p,skipAbsent:y}=e;let{parent:m,context:h,abortEarly:x=o.spec.abortEarly,disableStackTrace:w=o.spec.disableStackTrace}=i;function k(D){return Ft.isRef(D)?D.getValue(r,m,h):D}function M(D={}){const re=Object.assign({value:r,originalValue:a,label:o.spec.label,path:D.path||n,spec:o.spec,disableStackTrace:D.disableStackTrace||w},c,D.params);for(const ge of Object.keys(re))re[ge]=k(re[ge]);const he=new Le(Le.formatError(D.message||p,re),r,re.path,D.type||u,re.disableStackTrace);return he.params=re,he}const F=x?s:l;let _={path:n,parent:m,type:u,from:i.from,createError:M,resolve:k,options:i,originalValue:a,schema:o};const R=D=>{Le.isError(D)?F(D):D?l(null):F(M())},L=D=>{Le.isError(D)?F(D):s(D)};if(y&&ht(r))return R(!0);let J;try{var ae;if(J=f.call(_,r,_),typeof((ae=J)==null?void 0:ae.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(J).then(R,L)}}catch(D){L(D);return}R(J)}return t.OPTIONS=e,t}function ta(e,t,r,n=r){let i,a,o;return t?(Kt.forEach(t,(s,l,u)=>{let f=l?s.slice(1,s.length-1):s;e=e.resolve({context:n,parent:i,value:r});let c=e.type==="tuple",p=u?parseInt(f,10):0;if(e.innerType||c){if(c&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${s}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[p],e=c?e.spec.types[p]:e.innerType}if(!u){if(!e.fields||!e.fields[f])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);i=r,r=r&&r[f],e=e.fields[f]}a=f,o=l?"["+s+"]":"."+s}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}function sp(e,t,r,n){return ta(e,t,r,n).schema}class Sn extends Set{describe(){const t=[];for(const r of this.values())t.push(Ft.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const n of this.values())r.push(t(n));return r}clone(){return new Sn(this.values())}merge(t,r){const n=this.clone();return t.forEach(i=>n.add(i)),r.forEach(i=>n.delete(i)),n}}function ur(e,t=new Map){if(Xt(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=ur(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,ur(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(ur(n,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=ur(i,t)}else throw Error(`Unable to clone ${e}`);return r}class ze{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Sn,this._blacklist=new Sn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_t.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=ur(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let n=t(this);return this._mutate=r,n}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,n=t.clone();const i=Object.assign({},r.spec,n.spec);return n.spec=i,n.internalTests=Object.assign({},r.internalTests,n.internalTests),n._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),n._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(a=>{t.tests.forEach(o=>{a.test(o.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,a)=>a.resolve(i,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,i,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(n=t.abortEarly)!=null?n:this.spec.abortEarly,recursive:(i=t.recursive)!=null?i:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),i=r.assert==="ignore-optionality",a=n._cast(t,r);if(r.assert!==!1&&!n.isType(a)){if(i&&ht(a))return a;let o=xt(t),s=xt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
33
33
|
|
|
34
34
|
attempted value: ${o}
|
|
35
35
|
`+(s!==o?`result of cast: ${s}`:""))}return a}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((i,a)=>a.call(this,i,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,i){let{path:a,originalValue:o=t,strict:s=this.spec.strict}=r,l=t;s||(l=this._cast(l,Object.assign({assert:!1},r)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:a,value:l,originalValue:o,options:r,tests:u},n,f=>{if(f.length)return i(f,l);this.runTests({path:a,value:l,originalValue:o,options:r,tests:this.tests},n,i)})}runTests(t,r,n){let i=!1,{tests:a,value:o,originalValue:s,path:l,options:u}=t,f=h=>{i||(i=!0,r(h,o))},c=h=>{i||(i=!0,n(h,o))},p=a.length,y=[];if(!p)return c([]);let m={value:o,originalValue:s,path:l,options:u,schema:this};for(let h=0;h<a.length;h++){const x=a[h];x(m,f,function(k){k&&(Array.isArray(k)?y.push(...k):y.push(k)),--p<=0&&c(y)})}}asNestedTest({key:t,index:r,parent:n,parentPath:i,originalParent:a,options:o}){const s=t??r;if(s==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof s=="number";let u=n[s];const f=Object.assign({},o,{strict:!0,parent:n,value:u,originalValue:a[s],key:void 0,[l?"index":"key"]:s,path:l||s.includes(".")?`${i||""}[${l?s:`"${s}"`}]`:(i?`${i}.`:"")+t});return(c,p,y)=>this.resolve(f)._validate(u,f,p,y)}validate(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return new Promise((o,s)=>i._validate(t,r,(l,u)=>{Le.isError(l)&&(l.value=u),s(l)},(l,u)=>{l.length?s(new Le(l,u,void 0,void 0,a)):o(u)}))}validateSync(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a,o=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return i._validate(t,Object.assign({},r,{sync:!0}),(s,l)=>{throw Le.isError(s)&&(s.value=l),s},(s,l)=>{if(s.length)throw new Le(s,t,void 0,void 0,o);a=l}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(Le.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(Le.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):ur(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const n=this.clone({nullable:t});return n.internalTests.nullable=lr({message:r,name:"nullable",test(i){return i===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=lr({message:r,name:"optionality",test(i){return i===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=_t.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=_t.notNull){return this.nullability(!1,t)}required(t=_t.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=_t.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=lr(r),a=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(o=>!(o.OPTIONS.name===r.name&&(a||o.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),i=Qo(t).map(a=>new Ft(a));return i.forEach(a=>{a.isSibling&&n.deps.push(a.key)}),n.conditions.push(typeof r=="function"?new Tn(i,r):Tn.fromOptions(i,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=lr({message:t,name:"typeError",skipAbsent:!0,test(n){return this.schema._typeCheck(n)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=_t.oneOf){let n=this.clone();return t.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n.internalTests.whiteList=lr({message:r,name:"oneOf",skipAbsent:!0,test(i){let a=this.schema._whitelist,o=a.resolveAll(this.resolve);return o.includes(i)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:o}})}}),n}notOneOf(t,r=_t.notOneOf){let n=this.clone();return t.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n.internalTests.blacklist=lr({message:r,name:"notOneOf",test(i){let a=this.schema._blacklist,o=a.resolveAll(this.resolve);return o.includes(i)?this.createError({params:{values:Array.from(a).join(", "),resolved:o}}):!0}}),n}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:n,meta:i,optional:a,nullable:o}=r.spec;return{meta:i,label:n,optional:a,nullable:o,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(c=>c.name===l.name)===u)}}}ze.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])ze.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:a,schema:o}=ta(this,t,r,n.context);return o[e](i&&i[a],Object.assign({},n,{parent:i,path:t}))};for(const e of["equals","is"])ze.prototype[e]=ze.prototype.oneOf;for(const e of["not","nope"])ze.prototype[e]=ze.prototype.notOneOf;const lp=()=>!0;function wn(e){return new ra(e)}class ra extends ze{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:lp},t))}}wn.prototype=ra.prototype;function na(){return new ia}class ia extends ze{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(n.spec.coerce&&!n.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=Qi.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return ht(r)||r===!0}})}isFalse(t=Qi.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return ht(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}na.prototype=ia.prototype;const up=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function cp(e){const t=aa(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function aa(e){var t,r;const n=up.exec(e);return n?{year:Pt(n[1]),month:Pt(n[2],1)-1,day:Pt(n[3],1),hour:Pt(n[4]),minute:Pt(n[5]),second:Pt(n[6]),millisecond:n[7]?Pt(n[7].substring(0,3)):0,precision:(t=(r=n[7])==null?void 0:r.length)!=null?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:Pt(n[10]),minuteOffset:Pt(n[11])}:null}function Pt(e,t=0){return Number(e)||t}let fp=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,dp=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,pp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,hp="^\\d{4}-\\d{2}-\\d{2}",mp="\\d{2}:\\d{2}:\\d{2}",gp="(([+-]\\d{2}(:?\\d{2})?)|Z)",yp=new RegExp(`${hp}T${mp}(\\.\\d+)?${gp}$`),vp=e=>ht(e)||e===e.trim(),bp={}.toString();function Cn(){return new oa}class oa extends ze{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce||n.isType(t)||Array.isArray(t))return t;const i=t!=null&&t.toString?t.toString():t;return i===bp?t:i})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||_t.required,name:"required",skipAbsent:!0,test:n=>!!n.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=Ke.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r=Ke.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r=Ke.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}matches(t,r){let n=!1,i,a;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:a}=r:i=r),this.test({name:a||"matches",message:i||Ke.matches,params:{regex:t},skipAbsent:!0,test:o=>o===""&&n||o.search(t)!==-1})}email(t=Ke.email){return this.matches(fp,{name:"email",message:t,excludeEmptyString:!0})}url(t=Ke.url){return this.matches(dp,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Ke.uuid){return this.matches(pp,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,i;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:i=void 0}=t:r=t),this.matches(yp,{name:"datetime",message:r||Ke.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||Ke.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:a=>{if(!a||n)return!0;const o=aa(a);return o?!!o.z:!1}}).test({name:"datetime_precision",message:r||Ke.datetime_precision,params:{precision:i},skipAbsent:!0,test:a=>{if(!a||i==null)return!0;const o=aa(a);return o?o.precision===i:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Ke.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:vp})}lowercase(t=Ke.lowercase){return this.transform(r=>ht(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ht(r)||r===r.toLowerCase()})}uppercase(t=Ke.uppercase){return this.transform(r=>ht(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ht(r)||r===r.toUpperCase()})}}Cn.prototype=oa.prototype;let xp=e=>e!=+e;function os(){return new sa}class sa extends ze{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!xp(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let i=t;if(typeof i=="string"){if(i=i.replace(/\s/g,""),i==="")return NaN;i=+i}return n.isType(i)||i===null?i:parseFloat(i)})})}min(t,r=Nt.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(t)}})}max(t,r=Nt.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(t)}})}lessThan(t,r=Nt.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(n){return n<this.resolve(t)}})}moreThan(t,r=Nt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(n){return n>this.resolve(t)}})}positive(t=Nt.positive){return this.moreThan(0,t)}negative(t=Nt.negative){return this.lessThan(0,t)}integer(t=Nt.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>ht(t)?t:t|0)}round(t){var r;let n=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(n.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>ht(i)?i:Math[t](i))}}os.prototype=sa.prototype;let ss=new Date(""),_p=e=>Object.prototype.toString.call(e)==="[object Date]";function la(){return new cr}class cr extends ze{constructor(){super({type:"date",check(t){return _p(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=cp(t),isNaN(t)?cr.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(Ft.isRef(t))n=t;else{let i=this.cast(t);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(t,r=Zi.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(i){return i>=this.resolve(n)}})}max(t,r=Zi.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(i){return i<=this.resolve(n)}})}}cr.INVALID_DATE=ss,la.prototype=cr.prototype,la.INVALID_DATE=ss;function Tp(e,t=[]){let r=[],n=new Set,i=new Set(t.map(([o,s])=>`${o}-${s}`));function a(o,s){let l=Kt.split(o)[0];n.add(l),i.has(`${s}-${l}`)||r.push([s,l])}for(const o of Object.keys(e)){let s=e[o];n.add(o),Ft.isRef(s)&&s.isSibling?a(s.path,o):Xt(s)&&"deps"in s&&s.deps.forEach(l=>a(l,o))}return Zd.array(Array.from(n),r).reverse()}function ls(e,t){let r=1/0;return e.some((n,i)=>{var a;if((a=t.path)!=null&&a.includes(n))return r=i,!0}),r}function us(e){return(t,r)=>ls(e,t)-ls(e,r)}const cs=(e,t,r)=>{if(typeof e!="string")return e;let n=e;try{n=JSON.parse(e)}catch{}return r.isType(n)?n:e};function On(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=On(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=On(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(On)}):"optional"in e?e.optional():e}const Ep=(e,t)=>{const r=[...Kt.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),i=Kt.getter(Kt.join(r),!0)(e);return!!(i&&n in i)};let fs=e=>Object.prototype.toString.call(e)==="[object Object]";function Sp(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const wp=us([]);function Ur(e){return new ua(e)}class ua extends ze{constructor(t){super({type:"object",check(r){return fs(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=wp,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let i=super._cast(t,r);if(i===void 0)return this.getDefault(r);if(!this._typeCheck(i))return i;let a=this.fields,o=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,s=[].concat(this._nodes,Object.keys(i).filter(c=>!this._nodes.includes(c))),l={},u=Object.assign({},r,{parent:l,__validating:r.__validating||!1}),f=!1;for(const c of s){let p=a[c],y=c in i;if(p){let m,h=i[c];u.path=(r.path?`${r.path}.`:"")+c,p=p.resolve({value:h,context:r.context,parent:l});let x=p instanceof ze?p.spec:void 0,w=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||c in i;continue}m=!r.__validating||!w?p.cast(i[c],u):i[c],m!==void 0&&(l[c]=m)}else y&&!o&&(l[c]=i[c]);(y!==c in l||l[c]!==i[c])&&(f=!0)}return f?l:i}_validate(t,r={},n,i){let{from:a=[],originalValue:o=t,recursive:s=this.spec.recursive}=r;r.from=[{schema:this,value:o},...a],r.__validating=!0,r.originalValue=o,super._validate(t,r,n,(l,u)=>{if(!s||!fs(u)){i(l,u);return}o=o||u;let f=[];for(let c of this._nodes){let p=this.fields[c];!p||Ft.isRef(p)||f.push(p.asNestedTest({options:r,key:c,parent:u,parentPath:r.path,originalParent:o}))}this.runTests({tests:f,value:u,originalValue:o,options:r},n,c=>{i(c.sort(this._sortErrors).concat(l),u)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),n=r.fields;for(let[i,a]of Object.entries(this.fields)){const o=n[i];n[i]=o===void 0?a:o}return r.withMutation(i=>i.setFields(n,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(n=>{var i;const a=this.fields[n];let o=t;(i=o)!=null&&i.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[n]})),r[n]=a&&"getDefault"in a?a.getDefault(o):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=Tp(t,r),n._sortErrors=us(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let i=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),i=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),i)})}partial(){const t={};for(const[r,n]of Object.entries(this.fields))t[r]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(t)}deepPartial(){return On(this)}pick(t){const r={};for(const n of t)this.fields[n]&&(r[n]=this.fields[n]);return this.setFields(r,this._excludedEdges.filter(([n,i])=>t.includes(n)&&t.includes(i)))}omit(t){const r=[];for(const n of Object.keys(this.fields))t.includes(n)||r.push(n);return this.pick(r)}from(t,r,n){let i=Kt.getter(t,!0);return this.transform(a=>{if(!a)return a;let o=a;return Ep(a,t)&&(o=Object.assign({},a),n||delete o[t],o[r]=i(a)),o})}json(){return this.transform(cs)}noUnknown(t=!0,r=ea.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;const a=Sp(this.schema,i);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=ea.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const i of Object.keys(r))n[t(i)]=r[i];return n})}camelCase(){return this.transformKeys(Xi.camelCase)}snakeCase(){return this.transformKeys(Xi.snakeCase)}constantCase(){return this.transformKeys(t=>Xi.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[a,o]of Object.entries(r.fields)){var i;let s=t;(i=s)!=null&&i.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[a]})),n.fields[a]=o.describe(s)}return n}}Ur.prototype=ua.prototype;function ca(e){return new fa(e)}class fa extends ze{constructor(t){super({type:"array",spec:{types:t},check(r){return Array.isArray(r)}}),this.innerType=void 0,this.innerType=t}_cast(t,r){const n=super._cast(t,r);if(!this._typeCheck(n)||!this.innerType)return n;let i=!1;const a=n.map((o,s)=>{const l=this.innerType.cast(o,Object.assign({},r,{path:`${r.path||""}[${s}]`}));return l!==o&&(i=!0),l});return i?a:n}_validate(t,r={},n,i){var a;let o=this.innerType,s=(a=r.recursive)!=null?a:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,n,(l,u)=>{var f;if(!s||!o||!this._typeCheck(u)){i(l,u);return}let c=new Array(u.length);for(let y=0;y<u.length;y++){var p;c[y]=o.asNestedTest({options:r,index:y,parent:u,parentPath:r.path,originalParent:(p=r.originalValue)!=null?p:t})}this.runTests({value:u,tests:c,originalValue:(f=r.originalValue)!=null?f:t,options:r},n,y=>i(y.concat(l),u))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(cs)}concat(t){let r=super.concat(t);return r.innerType=this.innerType,t.innerType&&(r.innerType=r.innerType?r.innerType.concat(t.innerType):t.innerType),r}of(t){let r=this.clone();if(!Xt(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+xt(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=_n.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r){return r=r||_n.min,this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r){return r=r||_n.max,this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}ensure(){return this.default(()=>[]).transform((t,r)=>this._typeCheck(t)?t:r==null?[]:[].concat(r))}compact(t){let r=t?(n,i,a)=>!t(n,i,a):n=>!!n;return this.transform(n=>n!=null?n.filter(r):n)}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);if(r.innerType){var i;let a=t;(i=a)!=null&&i.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[0]})),n.innerType=r.innerType.describe(a)}return n}}ca.prototype=fa.prototype;function ds(e){return new da(e)}class da extends ze{constructor(t){super({type:"tuple",spec:{types:t},check(r){const n=this.spec.types;return Array.isArray(r)&&r.length===n.length}}),this.withMutation(()=>{this.typeError(is.notType)})}_cast(t,r){const{types:n}=this.spec,i=super._cast(t,r);if(!this._typeCheck(i))return i;let a=!1;const o=n.map((s,l)=>{const u=s.cast(i[l],Object.assign({},r,{path:`${r.path||""}[${l}]`}));return u!==i[l]&&(a=!0),u});return a?o:i}_validate(t,r={},n,i){let a=this.spec.types;super._validate(t,r,n,(o,s)=>{var l;if(!this._typeCheck(s)){i(o,s);return}let u=[];for(let[c,p]of a.entries()){var f;u[c]=p.asNestedTest({options:r,index:c,parent:s,parentPath:r.path,originalParent:(f=r.originalValue)!=null?f:t})}this.runTests({value:s,tests:u,originalValue:(l=r.originalValue)!=null?l:t,options:r},n,c=>i(c.concat(o),s))})}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);return n.innerType=r.spec.types.map((i,a)=>{var o;let s=t;return(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[a]})),i.describe(s)}),n}}ds.prototype=da.prototype;function Cp(e){return new pa(e)}class pa{constructor(t){this.type="lazy",this.__isYupSchema__=!0,this.spec=void 0,this._resolve=(r,n={})=>{let i=this.builder(r,n);if(!Xt(i))throw new TypeError("lazy() functions must return a valid schema");return this.spec.optional&&(i=i.optional()),i.resolve(n)},this.builder=t,this.spec={meta:void 0,optional:!1}}clone(t){const r=new pa(this.builder);return r.spec=Object.assign({},this.spec,t),r}optionality(t){return this.clone({optional:t})}optional(){return this.optionality(!0)}resolve(t){return this._resolve(t.value,t)}cast(t,r){return this._resolve(t,r).cast(t,r)}asNestedTest(t){let{key:r,index:n,parent:i,options:a}=t,o=i[n??r];return this._resolve(o,Object.assign({},a,{value:o,parent:i})).asNestedTest(t)}validate(t,r){return this._resolve(t,r).validate(t,r)}validateSync(t,r){return this._resolve(t,r).validateSync(t,r)}validateAt(t,r,n){return this._resolve(r,n).validateAt(t,r,n)}validateSyncAt(t,r,n){return this._resolve(r,n).validateSyncAt(t,r,n)}isValid(t,r){return this._resolve(t,r).isValid(t,r)}isValidSync(t,r){return this._resolve(t,r).isValidSync(t,r)}describe(t){return t?this.resolve(t).describe(t):{type:"lazy",meta:this.spec.meta,label:void 0}}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}}function Op(e){Object.keys(e).forEach(t=>{Object.keys(e[t]).forEach(r=>{as[t][r]=e[t][r]})})}function Ap(e,t,r){if(!e||!Xt(e.prototype))throw new TypeError("You must provide a yup schema constructor function");if(typeof t!="string")throw new TypeError("A Method name must be provided");if(typeof r!="function")throw new TypeError("Method function must be provided");e.prototype[t]=r}const ps=Object.freeze(Object.defineProperty({__proto__:null,ArraySchema:fa,BooleanSchema:ia,DateSchema:cr,MixedSchema:ra,NumberSchema:sa,ObjectSchema:ua,Schema:ze,StringSchema:oa,TupleSchema:da,ValidationError:Le,addMethod:Ap,array:ca,bool:na,boolean:na,date:la,defaultLocale:as,getIn:ta,isSchema:Xt,lazy:Cp,mixed:wn,number:os,object:Ur,printValue:xt,reach:sp,ref:op,setLocale:Op,string:Cn,tuple:ds},Symbol.toStringTag,{value:"Module"})),hs=e=>{const t=e.reduce((r,n)=>{let{name:i,required:a,type:o}=n;switch(o){case"RelatedList":o="array";break;case"Related":o="object";break;case"Integer":case"Float":o="number";break;case"Geometry":case"Raw":o="mixed";break;default:o="string"}let s;try{a?s=ps[o]().typeError(`Field must be of type ${o}`).required("Field is required"):s=ps[o]().typeError(`Field must be of type ${o}`).nullable(!0)}catch(l){console.log(l)}return r[i]=s,r},{});return Ur().shape(t)};function ms({path:e,autoInvoke:t=!0,clearDataOnRefetch:r=!1}){const{fetchPath:n,options:i}=T.useMemo(()=>Ve({path:Pe(e,"_info"),method:"GET"}),[e]),{data:a,loading:o,refetch:s,error:l}=vn(n,{autoInvoke:t,clearDataOnRefetch:r,...i});return{info:T.useMemo(()=>a?{...a,add:{columns:a.add_columns,title:a.add_title,schema:hs(a.add_columns),defaultValues:Ho(a.add_columns)},edit:{columns:a.edit_columns,title:a.edit_title,schema:hs(a.edit_columns),defaultValues:Ho(a.edit_columns)}}:null,[a]),loading:o,refetch:s,error:l}}const gs={user:null,loading:!0,error:null};function Pp(e,t){switch(t.type){case"initCall":return{...gs,user:e.user};case"setUser":return{...e,user:t.payload,error:null};case"setError":return{...e,loading:!1,error:t.payload};case"setLoading":return{...e,loading:t.payload};default:return e}}function kp(e){const[t,r]=T.useReducer(Pp,gs),{user:n,refetch:i,loading:a}=Bo({path:e});T.useEffect(()=>{r({type:"setLoading",payload:a})},[a]),T.useEffect(()=>{r({type:"setUser",payload:n})},[n]);const o=T.useCallback(async({username:c,password:p})=>{r({type:"initCall"});try{const y=new FormData;y.append("username",c),y.append("password",p);const{fetchPath:m,options:h}=Ve({path:Pe(e,"auth/login"),method:"POST"}),x=await fetch(m,{...h,headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(y)});x.ok||(x.status===400?r({type:"setError",payload:"Username or password wrong."}):r({type:"setError",payload:"Couldn't sign in user"})),i()}catch(y){console.error("signin error",y),r({type:"setError",payload:"Failed to fetch"})}},[e,i]),s=T.useCallback(async()=>{r({type:"initCall"});try{const{fetchPath:c,options:p}=Ve({path:Pe(e,"auth/logout"),method:"POST"});(await fetch(c,p)).ok||r({type:"setError",payload:"Couldn't sign out user"}),r({type:"setUser",payload:null})}catch(c){console.error("signout error",c),r({type:"setError",payload:"Failed to fetch"})}finally{r({type:"setLoading",payload:!1})}},[e]),l=T.useCallback(async c=>{r({type:"initCall"});try{const{fetchPath:p,options:y}=Ve({path:Pe(e,"auth/user"),method:"PUT",body:c});(await fetch(p,y)).ok||r({type:"setError",payload:"Couldn't update user data"}),i()}catch(p){console.error("update error",p),r({type:"setError",payload:"Failed to post"})}},[e,i]),u=T.useCallback(async c=>{if(!n.email)return r({type:"setError",payload:"No email found"});try{const{fetchPath:p,options:y}=Ve({path:Pe(e,"auth/forgot-password"),method:"POST",body:{email:n.email}}),m=await fetch(p,y);if(!m.ok){r({type:"setError",payload:"Couldn't request token to reset password"});return}const h=await m.json(),{token:x}=h,{fetchPath:w,options:k}=Ve({path:Pe(e,"auth/reset-password"),method:"POST",body:{token:x,password:c}});if(!(await fetch(w,k)).ok){r({type:"setError",payload:"Couldn't reset password"});return}i()}catch(p){console.error("resetPassword error",p),r({type:"setError",payload:"Failed to post"})}},[e,i,n==null?void 0:n.email]),f=T.useCallback((c,p)=>{const y=Pe(e,"auth/login",c);if(p){const x=window.screenLeft+window.outerWidth/2-250,w=window.screenTop+window.outerHeight/2-500/2,k=window.open(y+"?popup=true","auth",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=500, height=500, top=${w}, left=${x}`),M=window.setInterval(function(){k.closed!==!1&&(window.clearInterval(M),i())},200);return}window.location.href=Pe(e,"auth/login",c)},[e,i]);return{user:t.user,loading:t.loading,error:t.error,signin:o,signout:s,update:l,resetPassword:u,oauth_signin:f}}function jp(e,t){const{user:r}=t,[n,i]=T.useState(null),[a,o]=T.useState(!0),[s,l]=T.useState({error:"401 Not authorized",message:"User is not logged in."});T.useEffect(()=>{r&&u(e)},[r]);const u=async f=>{o(!0);try{const{fetchPath:c,options:p}=Ve({path:Pe(f,"info/"),method:"GET"}),y=await fetch(c,p);if(y.ok){const m=await y.json();i(m)}else l({error:"404 Not Found",message:"Couldn't fetch info"})}catch{l({error:"Network error",message:"Failed to fetch"})}finally{o(!1)}};return{info:n,loading:a,error:s}}const ha=T.createContext({auth:{user:null,loading:!1,error:null,signin:async(e,t)=>null,signout:async()=>null,update:async e=>null,resetPassword:async e=>null,oauth_signin:(e,t)=>null},info:{info:null,loading:!1,error:null}});function ys(){return T.useContext(ha).auth}function vs(){return T.useContext(ha).info}function Ip(e){const t={baseUrl:new URL(document.baseURI).pathname+"/api/v1",inheritMantineTheme:!1},{baseUrl:r,children:n}={...t,...e},i=kp(r),a={baseUrl:r,...jp(r,i)};return d.jsx(ha.Provider,{value:{auth:i,info:a},children:n})}const $p=async(e,t,r)=>{const{fetchPath:n,options:i}=Ve({path:Pe(t,"/download"),method:"POST"}),a=await fetch(n,{...i,body:JSON.stringify(r)});if(!a.ok)throw new Error(a.statusText);const o=await a.blob(),s=document.createElement("a"),l=URL.createObjectURL(o);s.href=l,s.download=e.toLowerCase()+".csv",s.click()},bs={path:"",queryParams:null,loading:!1,error:null};function Rp(e,t){switch(t.type){case"setPath":return{...e,path:t.payload};case"setQueryParams":return{...e,queryParams:{...t.payload}};case"setLoading":return{...e,loading:t.payload};case"setError":return{...e,error:t.payload};default:throw new Error}}function Mp({path:e,initialQueryParams:t,relation:r,fetchInfo:n=!0,clearInfoOnRefetch:i=!1,clearDataOnRefetch:a=!1,resetQueryParamsOnPathChange:o=!0}){const[s,l]=T.useReducer(Rp,{...bs,path:e,queryParams:t?Wi(null,t):null}),u=T.useMemo(()=>r?{...s.queryParams,filters:[...s.queryParams.filters,{col:r.foreign_key,opr:r.type,value:Fe(r.id)}]}:s.queryParams,[s.queryParams,r]),f=T.useMemo(()=>u!=null,[u]),{info:c,loading:p,refetch:y,error:m}=ms({path:s.path,autoInvoke:n,clearDataOnRefetch:i}),{data:h,loading:x,refetch:w,error:k}=Wo({path:s.path,queryParams:u,autoInvoke:f,clearDataOnRefetch:a,filterSchema:c==null?void 0:c.filters});T.useEffect(()=>{if(m){l({type:"setError",payload:{message:"Couldn't fetch info",originalError:m}});return}if(k){l({type:"setError",payload:{message:"Couldn't fetch list",originalError:k}});return}l({type:"setError",payload:bs.error})},[m,k]),T.useEffect(()=>{l({type:"setLoading",payload:p||x})},[x,p]),st.useDidUpdate(()=>{o&&l({type:"setQueryParams",payload:Wi(null,t||{})}),l({type:"setPath",payload:e})},[e]);const M=T.useCallback(J=>{const ae=Wi(s.queryParams,J);l({type:"setQueryParams",payload:ae})},[s.queryParams]),F=T.useCallback(async J=>{try{return await Nd(e,Fe(J))}catch(ae){l({type:"setError",payload:{message:`Couldn't fetch item with id ${J}`,originalError:ae}})}},[e]),_=T.useCallback(async(J,ae)=>{try{const D=await Md(e,J);return ae||(y(),w()),D}catch(D){l({type:"setError",payload:{message:"Couldnt add item.",originalError:D}})}},[w,y,e]),R=T.useCallback(async(J,ae,D)=>{try{const re=await Fd(e,Fe(J),ae);return D||(y(),w()),re}catch(re){l({type:"setError",payload:{message:`Couldn't update item with id ${J}`,originalError:re}})}},[w,y,e]),L=T.useCallback(async(J,ae)=>{try{const D=await Dd(e,Fe(J));return ae||(y(),w()),D}catch(D){l({type:"setError",payload:{message:`Couldn't delete item with id ${J}`,originalError:D}})}},[w,y,e]),ye=T.useCallback(async J=>{try{await $p(J,e,s.queryParams)}catch(ae){l({type:"setError",payload:{message:"Couldn't download",originalError:ae}})}},[e,s.queryParams]);return{path:e,data:h,info:c,queryParams:s.queryParams,loading:s.loading,error:s.error,setQueryParams:M,refetch:w,refetchInfo:y,getEntry:F,addEntry:_,updateEntry:R,deleteEntry:L,download:ye}}const Dp=async(e,t,r)=>{try{const{fetchPath:n,options:i}=Ve({path:Pe(e,"/bulk",t),method:"POST",body:r}),a=await fetch(n,i);if(a.ok)return await a.json();throw new Error(a.statusText)}catch(n){throw new Error(n)}},Np=({Api:e})=>{const[t,r]=T.useState([]),[n,i]=T.useState(null),a=T.useCallback(async(s,l)=>{try{i(null);const u=await Dp(e.path,s,t);return l?void 0:(e.refetch(),u)}catch(u){console.error(u),i({message:"Couldn't perform bulk action",originalError:u})}},[e,t]);return{bulkActions:T.useMemo(()=>({selectedIds:t,setSelectedIds:r}),[t,r]),dispatchBulkActions:a,error:n}},ma=T.createContext({Api:{path:"",data:null,info:null,queryParams:null,loading:!1,error:null,setQueryParams:e=>null,refetch:()=>null,refetchInfo:()=>null,getEntry:async e=>({}),addEntry:async(e,t)=>({}),updateEntry:async(e,t,r)=>({}),deleteEntry:async(e,t)=>({}),download:async e=>null},BulkActions:{bulkActions:{selectedIds:[],setSelectedIds:()=>{}},dispatchBulkActions:async(e,t)=>{},error:null}});function Re(){const e=T.useContext(ma);if(e===void 0)throw new Error("useApi must be used within a ApiProvider");return e.Api}function Fp(){const e=T.useContext(ma);if(e===void 0)throw new Error("useBulkActions must be used within a ApiProvider");return e.BulkActions}function xs({resource_name:e="",initialQueryParams:t,relation:r,fetchInfo:n,clearInfoOnRefetch:i,clearDataOnRefetch:a,resetQueryParamsOnPathChange:o,children:s}){const{baseUrl:l}=vs(),u=Mp({path:Pe(l,e),initialQueryParams:t,relation:r,fetchInfo:n,clearInfoOnRefetch:i,clearDataOnRefetch:a,resetQueryParamsOnPathChange:o}),f=Np({path:Pe(l,e),Api:u});return d.jsx(ma.Provider,{value:{Api:u,BulkActions:f},children:s})}function ga(e){return t=>{try{return e.validateSync(t,{abortEarly:!1}),{}}catch(r){const n={};return r instanceof Le&&r.inner.forEach(i=>{n[i.path.replaceAll("[",".").replaceAll("]","")]=i.message}),n}}}function Lp({form:e,name:t,...r}){return d.jsx(d.Fragment,{children:d.jsx(or.DateInput,{...e.getInputProps(t),onChange:n=>{if(n instanceof Date){const i=new Date(n.getTime()-n.getTimezoneOffset()*6e4);e.setFieldValue(t,i.toISOString().substring(0,10))}},value:e.getInputProps(t).value?new Date(e.getInputProps(t).value):null,...r})})}function zp({form:e,name:t,...r}){return d.jsx(d.Fragment,{children:d.jsx(or.DateTimePicker,{...e.getInputProps(t),onChange:n=>{if(n instanceof Date){const i=new Date(n);e.setFieldValue(t,i.toISOString())}},value:e.getInputProps(t).value?new Date(e.getInputProps(t).value):null,...r})})}const Up=/choices=\[([^\]]*)\]/;function Vp({form:e,name:t,items:r,...n}){const i=r[0].match(Up)[1].replaceAll("'","").split(",").map(a=>(a=a.trim(),{label:a,value:a}));return d.jsx(v.Select,{data:i,searchable:!0,...e.getInputProps(t),...n,value:String(e.getInputProps(t).value)||""})}function An({form:e,name:t,...r}){const n=e.getInputProps(t).value,i=T.useMemo(()=>n&&typeof n=="object"?JSON.stringify(n):n||"",[n]);return t==="password"?d.jsx(v.PasswordInput,{...e.getInputProps(t),value:i,...r}):d.jsx(v.TextInput,{...e.getInputProps(t),value:i,...r})}function _s({form:e,name:t,filter:r,...n}){const[i,a]=T.useState(""),o=e.getInputProps(t).value,s=T.useMemo(()=>o?typeof o=="object"?JSON.stringify(o,null,2):o:"",[o]);return T.useEffect(()=>{a(s)},[s]),r?d.jsx(An,{form:e,name:t,...n}):d.jsx(v.JsonInput,{autosize:!0,minRows:4,maxRows:12,validationError:"Invalid JSON",...e.getInputProps(t),...n,value:i,onChange:l=>{if(a(l),!l){e.getInputProps(t).onChange(null);return}try{const u=JSON.parse(l);e.getInputProps(t).onChange(u)}catch{}}})}function Bp({form:e,name:t,filter:r,...n}){const[i,a]=T.useState(!!r);return d.jsxs(v.InputWrapper,{label:n.label,description:n.description,children:[!r&&d.jsxs(v.Group,{align:"center",gap:"xs",py:"0.25rem",children:[d.jsx(v.Checkbox,{checked:i,onChange:o=>a(o.currentTarget.checked)}),d.jsx(v.Text,{size:"xs",children:"WKT"})]}),i?d.jsx(An,{form:e,name:t,...n,label:void 0,description:void 0}):d.jsx(_s,{form:e,name:t,...n,label:void 0,description:void 0})]})}function Wp({form:e,name:t,items:r,...n}){const i=r.map(o=>({value:String(Fe(o.id)),label:o.value})),a=Array.isArray(e.getInputProps(t).value)?e.getInputProps(t).value.map(o=>String(typeof o=="object"?Fe(o.id):o)):[];return d.jsx(v.MultiSelect,{data:i,searchable:!0,...e.getInputProps(t),value:a||[],...n})}function Hp({form:e,name:t,items:r,filter:n,...i}){var o;const a=r.map(s=>({value:String(Fe(s.id)),label:s.value}));return d.jsx(v.Select,{data:a,searchable:!0,...e.getInputProps(t),onChange:s=>{if(n){e.setFieldValue(t,s);return}const l=r.find(u=>String(Fe(u.id))===s)||null;e.setFieldValue(t,l)},value:n?e.getInputProps(t).value:String(Fe((o=e.getInputProps(t).value)==null?void 0:o.id))||"",...i})}function Gp({form:e,name:t,items:r,...n}){return d.jsx(v.Select,{data:r,searchable:!0,...e.getInputProps(t),value:String(e.getInputProps(t).value)||"",...n})}function ya({form:e,name:t,schema:r,filter:n,...i}){if(!r.type)return null;switch(r.type){case"Boolean":return d.jsx(Gp,{form:e,name:t,items:[{label:"true",value:n?"1":"true"},{label:"false",value:n?"0":"false"}],...i});case"RelatedList":return d.jsx(Wp,{form:e,name:t,items:r.values,...i});case"Related":return d.jsx(Hp,{form:e,name:t,items:r.values,filter:n,...i});case"DateTime":return d.jsx(zp,{form:e,name:t,valueFormat:"DD.MM.YYYY HH:mm:ss",schema:r,...i});case"Date":return d.jsx(Lp,{form:e,name:t,valueFormat:"DD.MM.YYYY",schema:r,...i});case"Field":return d.jsx(Vp,{form:e,name:t,items:r.validate,...i});case"Geometry":return d.jsx(Bp,{form:e,name:t,filter:n,...i});case"Raw":return d.jsx(_s,{form:e,name:t,filter:n,...i});case"Integer":case"Float":return d.jsx(An,{form:e,name:t,...i});default:return d.jsx(An,{form:e,name:t,...i})}}function Ts({opened:e,onClose:t,...r}){const{info:n,addEntry:i}=Re(),a={modal:{},stack:{},addButton:{}},{addButton:o,modal:s,stack:l}=v.useProps("AddDialog",a,r),u=Vi.useForm({initialValues:n.add.defaultValues,validate:ga(n.add.schema)}),f=async c=>{await i(c),u.reset(),t()};return T.useEffect(()=>{u.setInitialValues(n.add.defaultValues),u.reset()},[n.add.defaultValues]),d.jsx(v.Modal,{opened:e,onClose:()=>{u.reset(),t()},title:n.add.title,size:"lg",centered:!0,...s,children:d.jsx(v.Box,{component:"form",onSubmit:u.onSubmit(f),children:d.jsx(v.Stack,{spacing:"md",...l,children:d.jsxs(v.ScrollArea.Autosize,{mah:450,type:"auto",children:[n.add.columns.map((c,p)=>d.jsx(ya,{form:u,name:c.name,label:c.label,description:c.description,schema:c,withAsterisk:c.required},p)),d.jsx(v.Group,{position:"right",mt:"xl",children:d.jsx(v.Button,{type:"submit",...o,children:"Add"})})]})})})})}var va={exports:{}},Pn={exports:{}},le={};/** @license React v16.13.1
|