fastapi-rtk 0.0.102 → 0.0.103

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.
@@ -2508,7 +2508,7 @@ function gp({
2508
2508
  if (typeof T == "function" && (T = T(O)), !O)
2509
2509
  return rn(null, T);
2510
2510
  const I = rn({ ...O }, T);
2511
- if ((T.filters || T.order_column || T.order_direction) && !T.page && (I.page = 0), c) {
2511
+ if (T && ((T.filters || T.order_column || T.order_direction) && !T.page && (I.page = 0), c)) {
2512
2512
  if (T.page && T.page !== O.page && !T.streaming)
2513
2513
  throw new Error("You cannot change page in streaming mode, use streaming.fetch() instead");
2514
2514
  if (T.page_size && T.page_size !== O.page_size)
@@ -1,7 +1,7 @@
1
1
  (function(k,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("react/jsx-runtime"),require("react-router-dom"),require("zustand"),require("@tanstack/react-query"),require("@mantine/hooks"),require("@mantine/core"),require("@mantine/form"),require("@mantine/dates"),require("@jsonforms/core"),require("@jsonforms/react"),require("clsx"),require("@emotion/react"),require("mantine-react-table")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","react-router-dom","zustand","@tanstack/react-query","@mantine/hooks","@mantine/core","@mantine/form","@mantine/dates","@jsonforms/core","@jsonforms/react","clsx","@emotion/react","mantine-react-table"],v):(k=typeof globalThis<"u"?globalThis:k||self,v(k["fastapi-rtk"]={},k.React,k.jsxRuntime,k.reactRouterDom,k.zustand,k.reactQuery,k.hooks,k.core,k.form,k.dates,k.core$1,k.react,k.clsx,k.react$1,k.mantineReactTable))})(this,function(k,v,l,bs,Pu,tt,ve,g,or,ft,W,fe,At,vs,rt){"use strict";var Wx=Object.defineProperty;var Gx=(k,v,l)=>v in k?Wx(k,v,{enumerable:!0,configurable:!0,writable:!0,value:l}):k[v]=l;var $u=(k,v,l)=>Gx(k,typeof v!="symbol"?v+"":v,l);function Iu(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Oe=Iu(v),Ts=v.createContext({path:"",data:null,info:null,queryParams:null,loading:!1,error:null,streaming:null,specialKey: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});function Q(){const e=v.useContext(Ts);if(e===void 0)throw new Error("useApi must be used within a ApiProvider");return e}function $e({path:e,method:t,body:r=void 0,queryParams:n=void 0}){const o=Object.entries(n||{}).reduce((a,[c,u])=>((Array.isArray(u)||typeof u=="object")&&(u=JSON.stringify(u)),a[c]=u,a),{}),s=new bs.createSearchParams(o);e=e+"?"+s;const i={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:i}}function ku(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 o=0;o<e.length;o++){let s=e[o];if(typeof s!="string")throw new TypeError("Url must be a string. Received "+s);s!==""&&(o>0&&(s=s.replace(/^[\/]+/,"")),o<e.length-1?s=s.replace(/[\/]+$/,""):s=s.replace(/[\/]+$/,"/"),t.push(s))}let r=t.join("/");r=r.replace(/\/(\?|&|#[^!])/g,"$1");const n=r.split("?");return r=n.shift()+(n.length>0?"?":"")+n.join("&"),r}function Se(...e){const t=Array.from(Array.isArray(e[0])?e[0]:e);return ku(t)}const Mu=e=>new Proxy(e,{get(t,r){return t(n=>n[r])}}),Du=(e,t)=>Object.entries(t).reduce((r,[n,o])=>typeof o=="object"&&JSON.stringify(o)===JSON.stringify(e[n])||o===e[n]?r:{...r,[n]:o},{});function sr(e){const[t]=v.useState(()=>Pu.create(()=>({...e}))),[r]=v.useState(()=>Mu(t));return v.useEffect(()=>{t.setState(n=>Du(n,e))},[e,t]),r}const Ss=v.createContext({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,refetch:async()=>null});function bt(){return v.useContext(Ss)}const _s=v.createContext({baseUrl:"",info:null,loading:!1,error:null});function ws(){return v.useContext(_s)}async function Fu(e,{username:t,password:r}){const n=new FormData;n.append("username",t),n.append("password",r);const{fetchPath:o,options:s}=$e({path:Se(e,"auth/login"),method:"POST"}),i=await fetch(o,{...s,headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(n)});if(!i.ok)throw i.status===400?new Error("Username or password wrong."):new Error("Failed to sign in.")}async function Nu(e){const{fetchPath:t,options:r}=$e({path:Se(e,"auth/logout"),method:"POST"});if(!(await fetch(t,r)).ok)throw new Error("Failed to sign out.")}async function Lu(e,t,{email:r}){const{fetchPath:n,options:o}=$e({path:Se(e,"auth/forgot-password"),method:"POST",body:{email:r}}),s=await fetch(n,o);if(!s.ok)throw new Error("Couldn't request token to reset password");const i=await s.json(),{token:a}=i,{fetchPath:c,options:u}=$e({path:Se(e,"auth/reset-password"),method:"POST",body:{token:a,password:t}});if(!(await fetch(c,u)).ok)throw new Error("Couldn't reset password")}async function ju(e,t,r,n){const o=Se(e,"auth/login",t);if(!r){window.location.href=Se(e,"auth/login",t);return}const s=500,i=500,a=window.screenLeft+window.outerWidth/2-s/2,c=window.screenTop+window.outerHeight/2-i/2,u=window.open(o+"?popup=true","auth",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${s}, height=${i}, top=${c}, left=${a}`),d=window.setInterval(function(){u.closed!==!1&&(window.clearInterval(d),n==null||n())},200)}async function zu(e,t){const{fetchPath:r,options:n}=$e({path:Se(e,"info/"),method:"GET"}),o=await fetch(r,{signal:t,...n}),s=await o.json();if(!o.ok){const i=typeof s.detail=="string"?s.detail:JSON.stringify(s.detail,null,2);throw new Error(i)}return s}async function Bu(e,t){const{fetchPath:r,options:n}=$e({path:Se(e,"auth/user"),method:"GET"}),o=await fetch(r,{signal:t,...n}),s=await o.json();if(!o.ok){const i=typeof s.detail=="string"?s.detail:JSON.stringify(s.detail,null,2);throw new Error(i)}return s}async function Uu(e,t){const{fetchPath:r,options:n}=$e({path:Se(e,"auth/user"),method:"PUT",body:t}),o=await fetch(r,n),s=await o.json();if(!o.ok){const i=typeof s.detail=="string"?s.detail:JSON.stringify(s.detail,null,2);throw new Error(i)}return s}function Vu(e,t){const r=tt.useQueryClient(),n=tt.useQuery({queryKey:["user"],queryFn:({signal:f})=>Bu(e,f),retry:!1,...t}),[o,s]=v.useState(null),i=v.useCallback(({username:f,password:p})=>{s(null),Fu(e,{username:f,password:p}).then(()=>r.invalidateQueries({queryKey:["user"]})).catch(y=>s(y))},[e,r]),a=v.useCallback(()=>{s(null),Nu(e).then(()=>r.resetQueries({queryKey:["user"]})).then(()=>r.resetQueries({queryKey:["info"]})).catch(f=>s(f))},[e,r]),c=v.useCallback(f=>{s(null),Uu(e,f).then(()=>r.invalidateQueries({queryKey:["user"]})).catch(p=>s(p))},[e,r]),u=v.useCallback(f=>{s(null),Lu(e,f,n.data).catch(p=>s(p))},[e,n.data]),d=v.useCallback((f,p)=>ju(e,f,p,()=>r.invalidateQueries({queryKey:["user"]})),[e,r]);return{user:n.isError?null:n.data,loading:n.isFetching,error:o?o.message:null,signin:i,signout:a,update:c,resetPassword:u,oauth_signin:d,refetch:n.refetch}}function Wu(e,t){const r=tt.useQuery({queryKey:["info"],queryFn:({signal:n})=>zu(e,n),enabled:!1});return v.useEffect(()=>{t.user&&!r.data&&r.refetch()},[t.user,r]),{baseUrl:e,info:r.data,loading:r.isFetching,error:r.error}}function Gu(e){const t={baseUrl:new URL(document.baseURI).pathname+"/api/v1",inheritMantineTheme:!1},{baseUrl:r,authQueryProps:n,children:o}={...t,...e},s=Vu(r,n),i=sr(s),a=Wu(r,s),c=sr(a);return l.jsx(Ss.Provider,{value:i,children:l.jsx(_s.Provider,{value:c,children:o})})}function Hu(e){const[t]=v.useState(()=>new tt.QueryClient);return l.jsx(tt.QueryClientProvider,{client:t,children:l.jsx(Gu,{...e})})}const Cs=v.createContext({bulkActions:{selectedIds:[],setSelectedIds:()=>{}},dispatchBulkActions:async(e,t)=>{},error:null});function Yu(){const e=v.useContext(Cs);if(e===void 0)throw new Error("useBulkActions must be used within a ApiProvider");return e}const qu=async(e,t)=>{const{fetchPath:r,options:n}=$e({path:Se(e,"/"),method:"POST",body:t}),o=await fetch(r,n);let s=null;const i=o.headers.get("content-type");if(i&&i.includes("application/json")?s=await o.json():s=await o.text(),!o.ok)throw typeof s=="object"?new Error(typeof s.detail=="string"?s.detail:JSON.stringify(s,null,2)):new Error(s);return s},Ku=async(e,t)=>{const{fetchPath:r,options:n}=$e({path:Se(e,t.toString()),method:"DELETE"}),o=await fetch(r,n);let s=null;const i=o.headers.get("content-type");if(i&&i.includes("application/json")?s=await o.json():s=await o.text(),!o.ok)throw typeof s=="object"?new Error(typeof s.detail=="string"?s.detail:JSON.stringify(s,null,2)):new Error(s);return s},Ju=async(e,t)=>{const{fetchPath:r,options:n}=$e({path:e,method:"GET"}),o=await fetch(r,{signal:t,...n}),s=await o.json();if(!o.ok){const i=typeof s.detail=="string"?s.detail:JSON.stringify(s.detail,null,2);throw new Error(i)}return s},Zu=async(e,t)=>{const{fetchPath:r,options:n}=$e({path:Se(e,t.toString()),method:"GET"}),o=await fetch(r,n);let s=null;const i=o.headers.get("content-type");if(i&&i.includes("application/json")?s=await o.json():s=await o.text(),!o.ok)throw typeof s=="object"?new Error(typeof s.detail=="string"?s.detail:JSON.stringify(s,null,2)):new Error(s);return s},Xu=async(e,t,r)=>{const{fetchPath:n,options:o}=$e({path:e,method:"GET",queryParams:t}),s=await fetch(n,{signal:r,...o});let i=null;const a=s.headers.get("content-type");if(a&&a.includes("application/json")?i=await s.json():i=await s.text(),!s.ok)throw typeof i=="object"?new Error(typeof i.detail=="string"?i.detail:JSON.stringify(i,null,2)):new Error(i);return i},Qu=async(e,t,r)=>{const{fetchPath:n,options:o}=$e({path:Se(e,t.toString()),method:"PUT",body:r}),s=await fetch(n,o);let i=null;const a=s.headers.get("content-type");if(a&&a.includes("application/json")?i=await s.json():i=await s.text(),!s.ok)throw typeof i=="object"?new Error(typeof i.detail=="string"?i.detail:JSON.stringify(i,null,2)):new Error(i);return i},ze=e=>e&&typeof e=="object"?Array.isArray(e)?e.join(","):JSON.stringify(e):e,Ru={columns:[],filters:[],page:0,page_size:25};function Ar(e,t={}){return Object.entries(t).reduce((r,[n,o])=>o==null?(delete r[n],r):{...r,[n]:o},e||Ru)}const Es=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};var Or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vt(e){this._maxSize=e,this.clear()}vt.prototype.clear=function(){this._size=0,this._values=Object.create(null)},vt.prototype.get=function(e){return this._values[e]},vt.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var ef=/[^.^\]^[]+|(?=\[\]|\.\.)/g,xs=/^\d+$/,tf=/^\d/,rf=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,nf=/^\s*(['"]?)(.*?)(\1)\s*$/,Fn=512,As=new vt(Fn),Os=new vt(Fn),$s=new vt(Fn),Tt={Cache:vt,split:Ln,normalizePath:Nn,setter:function(e){var t=Nn(e);return Os.get(e)||Os.set(e,function(n,o){for(var s=0,i=t.length,a=n;s<i-1;){var c=t[s];if(c==="__proto__"||c==="constructor"||c==="prototype")return n;a=a[t[s++]]}a[t[s]]=o})},getter:function(e,t){var r=Nn(e);return $s.get(e)||$s.set(e,function(o){for(var s=0,i=r.length;s<i;)if(o!=null||!t)o=o[r[s++]];else return;return o})},join:function(e){return e.reduce(function(t,r){return t+(jn(r)||xs.test(r)?"["+r+"]":(t?".":"")+r)},"")},forEach:function(e,t,r){of(Array.isArray(e)?e:Ln(e),t,r)}};function Nn(e){return As.get(e)||As.set(e,Ln(e).map(function(t){return t.replace(nf,"$2")}))}function Ln(e){return e.match(ef)||[""]}function of(e,t,r){var n=e.length,o,s,i,a;for(s=0;s<n;s++)o=e[s],o&&(lf(o)&&(o='"'+o+'"'),a=jn(o),i=!a&&/^\d+$/.test(o),t.call(r,o,a,i,s,e))}function jn(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function sf(e){return e.match(tf)&&!e.match(xs)}function af(e){return rf.test(e)}function lf(e){return!jn(e)&&(sf(e)||af(e))}const cf=/[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,$r=e=>e.match(cf)||[],Pr=e=>e[0].toUpperCase()+e.slice(1),zn=(e,t)=>$r(e).join(t).toLowerCase(),Ps=e=>$r(e).reduce((t,r)=>`${t}${t?r[0].toUpperCase()+r.slice(1).toLowerCase():r.toLowerCase()}`,"");var Bn={words:$r,upperFirst:Pr,camelCase:Ps,pascalCase:e=>Pr(Ps(e)),snakeCase:e=>zn(e,"_"),kebabCase:e=>zn(e,"-"),sentenceCase:e=>Pr(zn(e," ")),titleCase:e=>$r(e).map(Pr).join(" ")},Un={exports:{}};Un.exports=function(e){return Is(uf(e),e)},Un.exports.array=Is;function Is(e,t){var r=e.length,n=new Array(r),o={},s=r,i=ff(t),a=df(e);for(t.forEach(function(u){if(!a.has(u[0])||!a.has(u[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});s--;)o[s]||c(e[s],s,new Set);return n;function c(u,d,f){if(f.has(u)){var p;try{p=", node was:"+JSON.stringify(u)}catch{p=""}throw new Error("Cyclic dependency"+p)}if(!a.has(u))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(u));if(!o[d]){o[d]=!0;var y=i.get(u)||new Set;if(y=Array.from(y),d=y.length){f.add(u);do{var b=y[--d];c(b,a.get(b),f)}while(d);f.delete(u)}n[--r]=u}}}function uf(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var o=e[r];t.add(o[0]),t.add(o[1])}return Array.from(t)}function ff(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var o=e[r];t.has(o[0])||t.set(o[0],new Set),t.has(o[1])||t.set(o[1],new Set),t.get(o[0]).add(o[1])}return t}function df(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}var pf=Un.exports;const hf=dt(pf),gf=Object.prototype.toString,mf=Error.prototype.toString,yf=RegExp.prototype.toString,bf=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",vf=/^Symbol\((.*)\)(.*)$/;function Tf(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function ks(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return Tf(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return bf.call(e).replace(vf,"Symbol($1)");const n=gf.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+mf.call(e)+"]":n==="RegExp"?yf.call(e):null}function Je(e,t){let r=ks(e,t);return r!==null?r:JSON.stringify(e,function(n,o){let s=ks(this[n],t);return s!==null?s:o},2)}function Ms(e){return e==null?[]:[].concat(e)}let Ds,Fs,Ns,Sf=/\$\{\s*(\w+)\s*\}/g;Ds=Symbol.toStringTag;class Ls{constructor(t,r,n,o){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[Ds]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=o,this.errors=[],this.inner=[],Ms(t).forEach(s=>{if(_e.isError(s)){this.errors.push(...s.errors);const i=s.inner.length?s.inner:[s];this.inner.push(...i)}else this.errors.push(s)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Fs=Symbol.hasInstance,Ns=Symbol.toStringTag;class _e extends Error{static formatError(t,r){const n=r.label||r.path||"this";return r=Object.assign({},r,{path:n,originalPath:r.path}),typeof t=="string"?t.replace(Sf,(o,s)=>Je(r[s])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,o,s){const i=new Ls(t,r,n,o);if(s)return i;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Ns]="Error",this.name=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,_e)}static[Fs](t){return Ls[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let Ze={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 o=n!=null&&n!==r?` (cast from the value \`${Je(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Je(r,!0)}\``+o:`${e} must match the configured type. The validated value was: \`${Je(r,!0)}\``+o}},Ne={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"},pt={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"},Vn={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Wn={isValue:"${path} field must be ${value}"},Ir={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},kr={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"},js={notType:e=>{const{path:t,value:r,spec:n}=e,o=n.types.length;if(Array.isArray(r)){if(r.length<o)return`${t} tuple value has too few items, expected a length of ${o} but got ${r.length} for value: \`${Je(r,!0)}\``;if(r.length>o)return`${t} tuple value has too many items, expected a length of ${o} but got ${r.length} for value: \`${Je(r,!0)}\``}return _e.formatError(Ze.notType,e)}};var zs=Object.assign(Object.create(null),{mixed:Ze,string:Ne,number:pt,date:Vn,object:Ir,array:kr,boolean:Wn,tuple:js});const St=e=>e&&e.__isYupSchema__;class Mr{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:o,otherwise:s}=r,i=typeof n=="function"?n:(...a)=>a.every(c=>c===n);return new Mr(t,(a,c)=>{var u;let d=i(...a)?o:s;return(u=d==null?void 0:d(c))!=null?u:c})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(s=>s.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),o=this.fn(n,t,r);if(o===void 0||o===t)return t;if(!St(o))throw new TypeError("conditions must return a schema object");return o.resolve(r)}}const Dr={context:"$",value:"."};function _f(e,t){return new ht(e,t)}class ht{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]===Dr.context,this.isValue=this.key[0]===Dr.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?Dr.context:this.isValue?Dr.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&Tt.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let o=this.isContext?n:this.isValue?t:r;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}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}}ht.prototype.__isYupRef=!0;const Ye=e=>e==null;function Ot(e){function t({value:r,path:n="",options:o,originalValue:s,schema:i},a,c){const{name:u,test:d,params:f,message:p,skipAbsent:y}=e;let{parent:b,context:h,abortEarly:C=i.spec.abortEarly,disableStackTrace:x=i.spec.disableStackTrace}=o;function F(A){return ht.isRef(A)?A.getValue(r,b,h):A}function $(A={}){const L=Object.assign({value:r,originalValue:s,label:i.spec.label,path:A.path||n,spec:i.spec,disableStackTrace:A.disableStackTrace||x},f,A.params);for(const J of Object.keys(L))L[J]=F(L[J]);const Y=new _e(_e.formatError(A.message||p,L),r,L.path,A.type||u,L.disableStackTrace);return Y.params=L,Y}const w=C?a:c;let S={path:n,parent:b,type:u,from:o.from,createError:$,resolve:F,options:o,originalValue:s,schema:i};const I=A=>{_e.isError(A)?w(A):A?c(null):w($())},j=A=>{_e.isError(A)?w(A):a(A)};if(y&&Ye(r))return I(!0);let U;try{var m;if(U=d.call(S,r,S),typeof((m=U)==null?void 0:m.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${S.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(U).then(I,j)}}catch(A){j(A);return}I(U)}return t.OPTIONS=e,t}function Gn(e,t,r,n=r){let o,s,i;return t?(Tt.forEach(t,(a,c,u)=>{let d=c?a.slice(1,a.length-1):a;e=e.resolve({context:n,parent:o,value:r});let f=e.type==="tuple",p=u?parseInt(d,10):0;if(e.innerType||f){if(f&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${i}" must contain an index to the tuple element, e.g. "${i}[0]"`);if(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);o=r,r=r&&r[p],e=f?e.spec.types[p]:e.innerType}if(!u){if(!e.fields||!e.fields[d])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e.type}")`);o=r,r=r&&r[d],e=e.fields[d]}s=d,i=c?"["+a+"]":"."+a}),{schema:e,parent:o,parentPath:s}):{parent:o,parentPath:t,schema:e}}function wf(e,t,r,n){return Gn(e,t,r,n).schema}class Fr extends Set{describe(){const t=[];for(const r of this.values())t.push(ht.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 Fr(this.values())}merge(t,r){const n=this.clone();return t.forEach(o=>n.add(o)),r.forEach(o=>n.delete(o)),n}}function $t(e,t=new Map){if(St(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]=$t(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,o]of e.entries())r.set(n,$t(o,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add($t(n,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[n,o]of Object.entries(e))r[n]=$t(o,t)}else throw Error(`Unable to clone ${e}`);return r}class xe{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 Fr,this._blacklist=new Fr,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Ze.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=$t(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 o=Object.assign({},r.spec,n.spec);return n.spec=o,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(s=>{t.tests.forEach(i=>{s.test(i.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((o,s)=>s.resolve(o,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,o,s;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:(o=t.recursive)!=null?o:this.spec.recursive,disableStackTrace:(s=t.disableStackTrace)!=null?s:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),o=r.assert==="ignore-optionality",s=n._cast(t,r);if(r.assert!==!1&&!n.isType(s)){if(o&&Ye(s))return s;let i=Je(t),a=Je(s);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
2
2
 
3
3
  attempted value: ${i}
4
- `+(a!==i?`result of cast: ${a}`:""))}return s}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((o,s)=>s.call(this,o,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,o){let{path:s,originalValue:i=t,strict:a=this.spec.strict}=r,c=t;a||(c=this._cast(c,Object.assign({assert:!1},r)));let u=[];for(let d of Object.values(this.internalTests))d&&u.push(d);this.runTests({path:s,value:c,originalValue:i,options:r,tests:u},n,d=>{if(d.length)return o(d,c);this.runTests({path:s,value:c,originalValue:i,options:r,tests:this.tests},n,o)})}runTests(t,r,n){let o=!1,{tests:s,value:i,originalValue:a,path:c,options:u}=t,d=h=>{o||(o=!0,r(h,i))},f=h=>{o||(o=!0,n(h,i))},p=s.length,y=[];if(!p)return f([]);let b={value:i,originalValue:a,path:c,options:u,schema:this};for(let h=0;h<s.length;h++){const C=s[h];C(b,d,function(F){F&&(Array.isArray(F)?y.push(...F):y.push(F)),--p<=0&&f(y)})}}asNestedTest({key:t,index:r,parent:n,parentPath:o,originalParent:s,options:i}){const a=t??r;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof a=="number";let u=n[a];const d=Object.assign({},i,{strict:!0,parent:n,value:u,originalValue:s[a],key:void 0,[c?"index":"key"]:a,path:c||a.includes(".")?`${o||""}[${c?a:`"${a}"`}]`:(o?`${o}.`:"")+t});return(f,p,y)=>this.resolve(d)._validate(u,d,p,y)}validate(t,r){var n;let o=this.resolve(Object.assign({},r,{value:t})),s=(n=r==null?void 0:r.disableStackTrace)!=null?n:o.spec.disableStackTrace;return new Promise((i,a)=>o._validate(t,r,(c,u)=>{_e.isError(c)&&(c.value=u),a(c)},(c,u)=>{c.length?a(new _e(c,u,void 0,void 0,s)):i(u)}))}validateSync(t,r){var n;let o=this.resolve(Object.assign({},r,{value:t})),s,i=(n=r==null?void 0:r.disableStackTrace)!=null?n:o.spec.disableStackTrace;return o._validate(t,Object.assign({},r,{sync:!0}),(a,c)=>{throw _e.isError(a)&&(a.value=c),a},(a,c)=>{if(a.length)throw new _e(a,t,void 0,void 0,i);s=c}),s}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(_e.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(_e.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):$t(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=Ot({message:r,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=Ot({message:r,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=Ze.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=Ze.notNull){return this.nullability(!1,t)}required(t=Ze.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=Ze.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),o=Ot(r),s=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(i=>!(i.OPTIONS.name===r.name&&(s||i.OPTIONS.test===o.OPTIONS.test))),n.tests.push(o),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),o=Ms(t).map(s=>new ht(s));return o.forEach(s=>{s.isSibling&&n.deps.push(s.key)}),n.conditions.push(typeof r=="function"?new Mr(o,r):Mr.fromOptions(o,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=Ot({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=Ze.oneOf){let n=this.clone();return t.forEach(o=>{n._whitelist.add(o),n._blacklist.delete(o)}),n.internalTests.whiteList=Ot({message:r,name:"oneOf",skipAbsent:!0,test(o){let s=this.schema._whitelist,i=s.resolveAll(this.resolve);return i.includes(o)?!0:this.createError({params:{values:Array.from(s).join(", "),resolved:i}})}}),n}notOneOf(t,r=Ze.notOneOf){let n=this.clone();return t.forEach(o=>{n._blacklist.add(o),n._whitelist.delete(o)}),n.internalTests.blacklist=Ot({message:r,name:"notOneOf",test(o){let s=this.schema._blacklist,i=s.resolveAll(this.resolve);return i.includes(o)?this.createError({params:{values:Array.from(s).join(", "),resolved:i}}):!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:o,optional:s,nullable:i}=r.spec;return{meta:o,label:n,optional:s,nullable:i,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,u,d)=>d.findIndex(f=>f.name===c.name)===u)}}}xe.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])xe.prototype[`${e}At`]=function(t,r,n={}){const{parent:o,parentPath:s,schema:i}=Gn(this,t,r,n.context);return i[e](o&&o[s],Object.assign({},n,{parent:o,path:t}))};for(const e of["equals","is"])xe.prototype[e]=xe.prototype.oneOf;for(const e of["not","nope"])xe.prototype[e]=xe.prototype.notOneOf;const Cf=()=>!0;function Nr(e){return new Hn(e)}class Hn extends xe{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:Cf},t))}}Nr.prototype=Hn.prototype;function Yn(){return new qn}class qn extends xe{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=Wn.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return Ye(r)||r===!0}})}isFalse(t=Wn.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return Ye(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)}}Yn.prototype=qn.prototype;const Ef=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function xf(e){const t=Kn(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 Kn(e){var t,r;const n=Ef.exec(e);return n?{year:nt(n[1]),month:nt(n[2],1)-1,day:nt(n[3],1),hour:nt(n[4]),minute:nt(n[5]),second:nt(n[6]),millisecond:n[7]?nt(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:nt(n[10]),minuteOffset:nt(n[11])}:null}function nt(e,t=0){return Number(e)||t}let Af=/^[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])?)*$/,Of=/^((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,$f=/^(?:[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,Pf="^\\d{4}-\\d{2}-\\d{2}",If="\\d{2}:\\d{2}:\\d{2}",kf="(([+-]\\d{2}(:?\\d{2})?)|Z)",Mf=new RegExp(`${Pf}T${If}(\\.\\d+)?${kf}$`),Df=e=>Ye(e)||e===e.trim(),Ff={}.toString();function Lr(){return new Jn}class Jn extends xe{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 o=t!=null&&t.toString?t.toString():t;return o===Ff?t:o})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||Ze.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=Ne.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=Ne.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=Ne.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,o,s;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:o,name:s}=r:o=r),this.test({name:s||"matches",message:o||Ne.matches,params:{regex:t},skipAbsent:!0,test:i=>i===""&&n||i.search(t)!==-1})}email(t=Ne.email){return this.matches(Af,{name:"email",message:t,excludeEmptyString:!0})}url(t=Ne.url){return this.matches(Of,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Ne.uuid){return this.matches($f,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,o;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:o=void 0}=t:r=t),this.matches(Mf,{name:"datetime",message:r||Ne.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||Ne.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:s=>{if(!s||n)return!0;const i=Kn(s);return i?!!i.z:!1}}).test({name:"datetime_precision",message:r||Ne.datetime_precision,params:{precision:o},skipAbsent:!0,test:s=>{if(!s||o==null)return!0;const i=Kn(s);return i?i.precision===o:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Ne.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:Df})}lowercase(t=Ne.lowercase){return this.transform(r=>Ye(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>Ye(r)||r===r.toLowerCase()})}uppercase(t=Ne.uppercase){return this.transform(r=>Ye(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>Ye(r)||r===r.toUpperCase()})}}Lr.prototype=Jn.prototype;let Nf=e=>e!=+e;function Bs(){return new Zn}class Zn extends xe{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!Nf(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let o=t;if(typeof o=="string"){if(o=o.replace(/\s/g,""),o==="")return NaN;o=+o}return n.isType(o)||o===null?o:parseFloat(o)})})}min(t,r=pt.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=pt.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=pt.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=pt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(n){return n>this.resolve(t)}})}positive(t=pt.positive){return this.moreThan(0,t)}negative(t=pt.negative){return this.lessThan(0,t)}integer(t=pt.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>Ye(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(o=>Ye(o)?o:Math[t](o))}}Bs.prototype=Zn.prototype;let Us=new Date(""),Lf=e=>Object.prototype.toString.call(e)==="[object Date]";function Xn(){return new Pt}class Pt extends xe{constructor(){super({type:"date",check(t){return Lf(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=xf(t),isNaN(t)?Pt.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(ht.isRef(t))n=t;else{let o=this.cast(t);if(!this._typeCheck(o))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=o}return n}min(t,r=Vn.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(o){return o>=this.resolve(n)}})}max(t,r=Vn.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(o){return o<=this.resolve(n)}})}}Pt.INVALID_DATE=Us,Xn.prototype=Pt.prototype,Xn.INVALID_DATE=Us;function jf(e,t=[]){let r=[],n=new Set,o=new Set(t.map(([i,a])=>`${i}-${a}`));function s(i,a){let c=Tt.split(i)[0];n.add(c),o.has(`${a}-${c}`)||r.push([a,c])}for(const i of Object.keys(e)){let a=e[i];n.add(i),ht.isRef(a)&&a.isSibling?s(a.path,i):St(a)&&"deps"in a&&a.deps.forEach(c=>s(c,i))}return hf.array(Array.from(n),r).reverse()}function Vs(e,t){let r=1/0;return e.some((n,o)=>{var s;if((s=t.path)!=null&&s.includes(n))return r=o,!0}),r}function Ws(e){return(t,r)=>Vs(e,t)-Vs(e,r)}const Gs=(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 jr(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=jr(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=jr(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(jr)}):"optional"in e?e.optional():e}const zf=(e,t)=>{const r=[...Tt.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),o=Tt.getter(Tt.join(r),!0)(e);return!!(o&&n in o)};let Hs=e=>Object.prototype.toString.call(e)==="[object Object]";function Ys(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const Bf=Ws([]);function ir(e){return new Qn(e)}class Qn extends xe{constructor(t){super({type:"object",check(r){return Hs(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=Bf,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let o=super._cast(t,r);if(o===void 0)return this.getDefault(r);if(!this._typeCheck(o))return o;let s=this.fields,i=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(f=>!this._nodes.includes(f))),c={},u=Object.assign({},r,{parent:c,__validating:r.__validating||!1}),d=!1;for(const f of a){let p=s[f],y=f in o;if(p){let b,h=o[f];u.path=(r.path?`${r.path}.`:"")+f,p=p.resolve({value:h,context:r.context,parent:c});let C=p instanceof xe?p.spec:void 0,x=C==null?void 0:C.strict;if(C!=null&&C.strip){d=d||f in o;continue}b=!r.__validating||!x?p.cast(o[f],u):o[f],b!==void 0&&(c[f]=b)}else y&&!i&&(c[f]=o[f]);(y!==f in c||c[f]!==o[f])&&(d=!0)}return d?c:o}_validate(t,r={},n,o){let{from:s=[],originalValue:i=t,recursive:a=this.spec.recursive}=r;r.from=[{schema:this,value:i},...s],r.__validating=!0,r.originalValue=i,super._validate(t,r,n,(c,u)=>{if(!a||!Hs(u)){o(c,u);return}i=i||u;let d=[];for(let f of this._nodes){let p=this.fields[f];!p||ht.isRef(p)||d.push(p.asNestedTest({options:r,key:f,parent:u,parentPath:r.path,originalParent:i}))}this.runTests({tests:d,value:u,originalValue:i,options:r},n,f=>{o(f.sort(this._sortErrors).concat(c),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[o,s]of Object.entries(this.fields)){const i=n[o];n[o]=i===void 0?s:i}return r.withMutation(o=>o.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 o;const s=this.fields[n];let i=t;(o=i)!=null&&o.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[n]})),r[n]=s&&"getDefault"in s?s.getDefault(i):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=jf(t,r),n._sortErrors=Ws(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let o=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),o=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),o)})}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 jr(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,o])=>t.includes(n)&&t.includes(o)))}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 o=Tt.getter(t,!0);return this.transform(s=>{if(!s)return s;let i=s;return zf(s,t)&&(i=Object.assign({},s),n||delete i[t],i[r]=o(s)),i})}json(){return this.transform(Gs)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Ir.exact,test(r){if(r==null)return!0;const n=Ys(this.schema,r);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=Ir.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(o){if(o==null)return!0;const s=Ys(this.schema,o);return!t||s.length===0||this.createError({params:{unknown:s.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Ir.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const o of Object.keys(r))n[t(o)]=r[o];return n})}camelCase(){return this.transformKeys(Bn.camelCase)}snakeCase(){return this.transformKeys(Bn.snakeCase)}constantCase(){return this.transformKeys(t=>Bn.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[s,i]of Object.entries(r.fields)){var o;let a=t;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[s]})),n.fields[s]=i.describe(a)}return n}}ir.prototype=Qn.prototype;function Rn(e){return new eo(e)}class eo extends xe{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 o=!1;const s=n.map((i,a)=>{const c=this.innerType.cast(i,Object.assign({},r,{path:`${r.path||""}[${a}]`}));return c!==i&&(o=!0),c});return o?s:n}_validate(t,r={},n,o){var s;let i=this.innerType,a=(s=r.recursive)!=null?s:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,n,(c,u)=>{var d;if(!a||!i||!this._typeCheck(u)){o(c,u);return}let f=new Array(u.length);for(let y=0;y<u.length;y++){var p;f[y]=i.asNestedTest({options:r,index:y,parent:u,parentPath:r.path,originalParent:(p=r.originalValue)!=null?p:t})}this.runTests({value:u,tests:f,originalValue:(d=r.originalValue)!=null?d:t,options:r},n,y=>o(y.concat(c),u))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(Gs)}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(!St(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Je(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=kr.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||kr.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||kr.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,o,s)=>!t(n,o,s):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 o;let s=t;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[0]})),n.innerType=r.innerType.describe(s)}return n}}Rn.prototype=eo.prototype;function qs(e){return new to(e)}class to extends xe{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(js.notType)})}_cast(t,r){const{types:n}=this.spec,o=super._cast(t,r);if(!this._typeCheck(o))return o;let s=!1;const i=n.map((a,c)=>{const u=a.cast(o[c],Object.assign({},r,{path:`${r.path||""}[${c}]`}));return u!==o[c]&&(s=!0),u});return s?i:o}_validate(t,r={},n,o){let s=this.spec.types;super._validate(t,r,n,(i,a)=>{var c;if(!this._typeCheck(a)){o(i,a);return}let u=[];for(let[f,p]of s.entries()){var d;u[f]=p.asNestedTest({options:r,index:f,parent:a,parentPath:r.path,originalParent:(d=r.originalValue)!=null?d:t})}this.runTests({value:a,tests:u,originalValue:(c=r.originalValue)!=null?c:t,options:r},n,f=>o(f.concat(i),a))})}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);return n.innerType=r.spec.types.map((o,s)=>{var i;let a=t;return(i=a)!=null&&i.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[s]})),o.describe(a)}),n}}qs.prototype=to.prototype;function Uf(e){return new zr(e)}function Ks(e){try{return e()}catch(t){if(_e.isError(t))return Promise.reject(t);throw t}}class zr{constructor(t){this.type="lazy",this.__isYupSchema__=!0,this.spec=void 0,this._resolve=(r,n={})=>{let o=this.builder(r,n);if(!St(o))throw new TypeError("lazy() functions must return a valid schema");return this.spec.optional&&(o=o.optional()),o.resolve(n)},this.builder=t,this.spec={meta:void 0,optional:!1}}clone(t){const r=new zr(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:o,options:s}=t,i=o[n??r];return this._resolve(i,Object.assign({},s,{value:i,parent:o})).asNestedTest(t)}validate(t,r){return Ks(()=>this._resolve(t,r).validate(t,r))}validateSync(t,r){return this._resolve(t,r).validateSync(t,r)}validateAt(t,r,n){return Ks(()=>this._resolve(r,n).validateAt(t,r,n))}validateSyncAt(t,r,n){return this._resolve(r,n).validateSyncAt(t,r,n)}isValid(t,r){try{return this._resolve(t,r).isValid(t,r)}catch(n){if(_e.isError(n))return Promise.resolve(!1);throw n}}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 Vf(e){Object.keys(e).forEach(t=>{Object.keys(e[t]).forEach(r=>{zs[t][r]=e[t][r]})})}function Wf(e,t,r){if(!e||!St(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 Js=Object.freeze(Object.defineProperty({__proto__:null,ArraySchema:eo,BooleanSchema:qn,DateSchema:Pt,LazySchema:zr,MixedSchema:Hn,NumberSchema:Zn,ObjectSchema:Qn,Schema:xe,StringSchema:Jn,TupleSchema:to,ValidationError:_e,addMethod:Wf,array:Rn,bool:Yn,boolean:Yn,date:Xn,defaultLocale:zs,getIn:Gn,isSchema:St,lazy:Uf,mixed:Nr,number:Bs,object:ir,printValue:Je,reach:wf,ref:_f,setLocale:Vf,string:Lr,tuple:qs},Symbol.toStringTag,{value:"Module"})),Zs=e=>{const t=e.reduce((r,n)=>{let{name:o,required:s,type:i}=n;switch(i){case"RelatedList":i="array";break;case"Integer":case"Float":i="number";break;case"Related":case"Geometry":case"Raw":i="mixed";break;default:i="string"}let a;try{s?a=Js[i]().typeError(`Field must be of type ${i}`).required("Field is required"):a=Js[i]().typeError(`Field must be of type ${i}`).nullable(!0)}catch(c){console.log(c)}return r[o]=a,r},{});return ir().shape(t)},Xs=e=>!e&&typeof e!="boolean"&&typeof e!="number"?null:typeof e=="boolean"?e.toString():Array.isArray(e)?e.map(t=>t.name_||JSON.stringify(t,null,2)).join(", "):typeof e=="object"?e.name_||JSON.stringify(e):e,Gf=e=>e?{...e,add:{columns:e.add_columns,title:e.add_title,schema:Zs(e.add_columns),defaultValues:Es(e.add_columns)},edit:{columns:e.edit_columns,title:e.edit_title,schema:Zs(e.edit_columns),defaultValues:Es(e.edit_columns)}}:null,Hf=async(e,t,r)=>{const{fetchPath:n,options:o}=$e({path:Se(t,"/download"),method:"POST"}),s=await fetch(n,{...o,body:JSON.stringify(r)});let i=null;const a=s.headers.get("content-type");if(a&&a.includes("application/json")?i=await s.json():i=await s.blob(),!s.ok)throw typeof i=="object"?new Error(typeof i.detail=="string"?i.detail:JSON.stringify(i,null,2)):new Error(i);const c=document.createElement("a"),u=URL.createObjectURL(i);c.href=u,c.download=e.toLowerCase()+".csv",c.click()};function Yf({path:e,initialQueryParams:t,relation:r,fetchInfo:n=!0,clearInfoOnRefetch:o=!1,clearDataOnRefetch:s=!1,resetQueryParamsOnPathChange:i=!0,infoQueryProps:a,dataQueryProps:c,streaming:u=!1}){const[d,f]=v.useState(t?Ar(null,t):null),p=v.useRef(e),y=v.useMemo(()=>(p.current=e,r?{...d,filters:[...d.filters,{col:r.foreign_key,opr:r.type,value:ze(r.id)}]}:d),[r,d]),b=v.useCallback(_=>f(P=>{if(typeof _=="function"&&(_=_(P)),!P)return Ar(null,_);const D=Ar({...P},_);if((_.filters||_.order_column||_.order_direction)&&!_.page&&(D.page=0),u){if(_.page&&_.page!==P.page&&!_.streaming)throw new Error("You cannot change page in streaming mode, use streaming.fetch() instead");if(_.page_size&&_.page_size!==P.page_size)throw new Error("You cannot change page size in streaming mode, use streaming.fetch() instead")}return D}),[u]),[h,C]=v.useState(null),x=v.useMemo(()=>h,[h]),F=v.useCallback(()=>C(null),[]),{data:$,isFetching:w,refetch:S,error:I}=tt.useQuery({queryKey:[`info-${e}`],queryFn:({signal:_})=>Ju(Se(e,"_info"),_).then(P=>({...Gf(P),path:e})),placeholderData:o?null:tt.keepPreviousData,enabled:n,retry:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1,...a}),{data:j,isFetching:H,refetch:U,error:m}=tt.useQuery({queryKey:[`data-${p.current}`,JSON.stringify(y)],queryFn:({signal:_})=>y?Xu(Se(p.current,"/"),y,_).then(P=>({...P,result:P.result.map((D,V)=>({...D,id:P.ids[V]})),path:p.current})):null,placeholderData:s?null:tt.keepPreviousData,retry:!1,...c});v.useEffect(()=>{if(I){C({message:"Couldn't fetch info",originalError:I});return}if(m){C({message:"Couldn't fetch list",originalError:m});return}F()},[I,m,F]);const A=v.useMemo(()=>w||H,[w,H]);ve.useDidUpdate(()=>{if(!i)return;const _=Ar(null,t);d!=null&&d.page_size&&(_.page_size=d.page_size),b(_)},[e]);const L=v.useCallback(async _=>{try{const P=await Zu(e,ze(_));return F(),P}catch(P){C({message:`Couldn't fetch item with id ${_}`,originalError:P})}},[e,F]),Y=v.useCallback(async(_,P)=>{try{const D=await qu(e,_);return P||(S(),U()),F(),D}catch(D){C({message:"Couldn't add item",originalError:D})}},[U,S,e,F]),J=v.useCallback(async(_,P,D)=>{try{const V=await Qu(e,ze(_),P);return D||(S(),U()),F(),V}catch(V){C({message:`Couldn't update item with id ${_}`,originalError:V})}},[U,S,e,F]),ae=v.useCallback(async(_,P)=>{try{const D=await Ku(e,ze(_));return P||(S(),U()),F(),D}catch(D){C({message:`Couldn't delete item with id ${_}`,originalError:D})}},[U,S,e,F]),le=v.useCallback(async _=>{try{await Hf(_,e,y)}catch(P){C({message:"Couldn't download",originalError:P})}},[e,y]),[ge,me]=ve.useSetState({data:{},isEnd:!1,fetch:()=>null});v.useEffect(()=>{u&&me({fetch:()=>b({page:0,streaming:!0})})},[b,me,u]),v.useEffect(()=>{u&&j&&me(_=>{let P=Object.keys(_.data).length;const D={isEnd:!1};return y.page<P?(P=y.page,D.data={[y.page]:j.result}):D.data={..._.data,[y.page]:j.result},j.result.length<y.page_size?(D.isEnd=!0,D.fetch=()=>null):D.fetch=()=>b({page:P+1,streaming:!0}),D})},[j,b,me,u]);const Me=v.useMemo(()=>{const _={all:"all",actions:"actions"};return j==null||j.list_columns.forEach(P=>{_[P]&&(_[P]=`_${P}`)}),_},[j==null?void 0:j.list_columns]),O=v.useCallback(()=>y?U():b(),[U,y,b]);return{path:e,data:j,info:$,queryParams:y,loading:A,error:x,streaming:ge,specialKey:Me,setQueryParams:b,refetch:O,refetchInfo:S,getEntry:L,addEntry:Y,updateEntry:J,deleteEntry:ae,download:le}}const qf=async(e,t,r)=>{const{fetchPath:n,options:o}=$e({path:Se(e,"/bulk",t),method:"POST",body:r}),s=await fetch(n,o);let i=null;const a=s.headers.get("content-type");if(a&&a.includes("application/json")?i=await s.json():i=await s.text(),!s.ok)throw typeof i=="object"?new Error(typeof i.detail=="string"?i.detail:JSON.stringify(i,null,2)):new Error(i);return i},Kf=({path:e,refetch:t})=>{const[r,n]=v.useState([]),[o,s]=v.useState(null),i=v.useCallback(async(c,u)=>{try{s(null);const d=await qf(e,c,r);return u||t(),d}catch(d){console.error(d),s({message:"Couldn't perform bulk action",originalError:d})}},[e,t,r]);return{bulkActions:v.useMemo(()=>({selectedIds:r,setSelectedIds:n}),[r,n]),dispatchBulkActions:i,error:o}};function Qs({resource_name:e="",initialQueryParams:t,relation:r,fetchInfo:n,clearInfoOnRefetch:o,clearDataOnRefetch:s,resetQueryParamsOnPathChange:i,infoQueryProps:a,dataQueryProps:c,children:u,streaming:d}){const{baseUrl:f}=ws(),p=Yf({path:Se(f,e),initialQueryParams:t,relation:r,fetchInfo:n,clearInfoOnRefetch:o,clearDataOnRefetch:s,resetQueryParamsOnPathChange:i,infoQueryProps:a,dataQueryProps:c,streaming:d}),y=sr(p),b=Kf(y),h=sr(b);return l.jsx(Ts.Provider,{value:y,children:l.jsx(Cs.Provider,{value:h,children:u})})}/**
4
+ `+(a!==i?`result of cast: ${a}`:""))}return s}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((o,s)=>s.call(this,o,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,o){let{path:s,originalValue:i=t,strict:a=this.spec.strict}=r,c=t;a||(c=this._cast(c,Object.assign({assert:!1},r)));let u=[];for(let d of Object.values(this.internalTests))d&&u.push(d);this.runTests({path:s,value:c,originalValue:i,options:r,tests:u},n,d=>{if(d.length)return o(d,c);this.runTests({path:s,value:c,originalValue:i,options:r,tests:this.tests},n,o)})}runTests(t,r,n){let o=!1,{tests:s,value:i,originalValue:a,path:c,options:u}=t,d=h=>{o||(o=!0,r(h,i))},f=h=>{o||(o=!0,n(h,i))},p=s.length,y=[];if(!p)return f([]);let b={value:i,originalValue:a,path:c,options:u,schema:this};for(let h=0;h<s.length;h++){const C=s[h];C(b,d,function(F){F&&(Array.isArray(F)?y.push(...F):y.push(F)),--p<=0&&f(y)})}}asNestedTest({key:t,index:r,parent:n,parentPath:o,originalParent:s,options:i}){const a=t??r;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof a=="number";let u=n[a];const d=Object.assign({},i,{strict:!0,parent:n,value:u,originalValue:s[a],key:void 0,[c?"index":"key"]:a,path:c||a.includes(".")?`${o||""}[${c?a:`"${a}"`}]`:(o?`${o}.`:"")+t});return(f,p,y)=>this.resolve(d)._validate(u,d,p,y)}validate(t,r){var n;let o=this.resolve(Object.assign({},r,{value:t})),s=(n=r==null?void 0:r.disableStackTrace)!=null?n:o.spec.disableStackTrace;return new Promise((i,a)=>o._validate(t,r,(c,u)=>{_e.isError(c)&&(c.value=u),a(c)},(c,u)=>{c.length?a(new _e(c,u,void 0,void 0,s)):i(u)}))}validateSync(t,r){var n;let o=this.resolve(Object.assign({},r,{value:t})),s,i=(n=r==null?void 0:r.disableStackTrace)!=null?n:o.spec.disableStackTrace;return o._validate(t,Object.assign({},r,{sync:!0}),(a,c)=>{throw _e.isError(a)&&(a.value=c),a},(a,c)=>{if(a.length)throw new _e(a,t,void 0,void 0,i);s=c}),s}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(_e.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(_e.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):$t(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=Ot({message:r,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=Ot({message:r,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=Ze.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=Ze.notNull){return this.nullability(!1,t)}required(t=Ze.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=Ze.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),o=Ot(r),s=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(i=>!(i.OPTIONS.name===r.name&&(s||i.OPTIONS.test===o.OPTIONS.test))),n.tests.push(o),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),o=Ms(t).map(s=>new ht(s));return o.forEach(s=>{s.isSibling&&n.deps.push(s.key)}),n.conditions.push(typeof r=="function"?new Mr(o,r):Mr.fromOptions(o,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=Ot({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=Ze.oneOf){let n=this.clone();return t.forEach(o=>{n._whitelist.add(o),n._blacklist.delete(o)}),n.internalTests.whiteList=Ot({message:r,name:"oneOf",skipAbsent:!0,test(o){let s=this.schema._whitelist,i=s.resolveAll(this.resolve);return i.includes(o)?!0:this.createError({params:{values:Array.from(s).join(", "),resolved:i}})}}),n}notOneOf(t,r=Ze.notOneOf){let n=this.clone();return t.forEach(o=>{n._blacklist.add(o),n._whitelist.delete(o)}),n.internalTests.blacklist=Ot({message:r,name:"notOneOf",test(o){let s=this.schema._blacklist,i=s.resolveAll(this.resolve);return i.includes(o)?this.createError({params:{values:Array.from(s).join(", "),resolved:i}}):!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:o,optional:s,nullable:i}=r.spec;return{meta:o,label:n,optional:s,nullable:i,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,u,d)=>d.findIndex(f=>f.name===c.name)===u)}}}xe.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])xe.prototype[`${e}At`]=function(t,r,n={}){const{parent:o,parentPath:s,schema:i}=Gn(this,t,r,n.context);return i[e](o&&o[s],Object.assign({},n,{parent:o,path:t}))};for(const e of["equals","is"])xe.prototype[e]=xe.prototype.oneOf;for(const e of["not","nope"])xe.prototype[e]=xe.prototype.notOneOf;const Cf=()=>!0;function Nr(e){return new Hn(e)}class Hn extends xe{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:Cf},t))}}Nr.prototype=Hn.prototype;function Yn(){return new qn}class qn extends xe{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=Wn.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return Ye(r)||r===!0}})}isFalse(t=Wn.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return Ye(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)}}Yn.prototype=qn.prototype;const Ef=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function xf(e){const t=Kn(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 Kn(e){var t,r;const n=Ef.exec(e);return n?{year:nt(n[1]),month:nt(n[2],1)-1,day:nt(n[3],1),hour:nt(n[4]),minute:nt(n[5]),second:nt(n[6]),millisecond:n[7]?nt(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:nt(n[10]),minuteOffset:nt(n[11])}:null}function nt(e,t=0){return Number(e)||t}let Af=/^[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])?)*$/,Of=/^((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,$f=/^(?:[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,Pf="^\\d{4}-\\d{2}-\\d{2}",If="\\d{2}:\\d{2}:\\d{2}",kf="(([+-]\\d{2}(:?\\d{2})?)|Z)",Mf=new RegExp(`${Pf}T${If}(\\.\\d+)?${kf}$`),Df=e=>Ye(e)||e===e.trim(),Ff={}.toString();function Lr(){return new Jn}class Jn extends xe{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 o=t!=null&&t.toString?t.toString():t;return o===Ff?t:o})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||Ze.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=Ne.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=Ne.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=Ne.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,o,s;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:o,name:s}=r:o=r),this.test({name:s||"matches",message:o||Ne.matches,params:{regex:t},skipAbsent:!0,test:i=>i===""&&n||i.search(t)!==-1})}email(t=Ne.email){return this.matches(Af,{name:"email",message:t,excludeEmptyString:!0})}url(t=Ne.url){return this.matches(Of,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Ne.uuid){return this.matches($f,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,o;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:o=void 0}=t:r=t),this.matches(Mf,{name:"datetime",message:r||Ne.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||Ne.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:s=>{if(!s||n)return!0;const i=Kn(s);return i?!!i.z:!1}}).test({name:"datetime_precision",message:r||Ne.datetime_precision,params:{precision:o},skipAbsent:!0,test:s=>{if(!s||o==null)return!0;const i=Kn(s);return i?i.precision===o:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Ne.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:Df})}lowercase(t=Ne.lowercase){return this.transform(r=>Ye(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>Ye(r)||r===r.toLowerCase()})}uppercase(t=Ne.uppercase){return this.transform(r=>Ye(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>Ye(r)||r===r.toUpperCase()})}}Lr.prototype=Jn.prototype;let Nf=e=>e!=+e;function Bs(){return new Zn}class Zn extends xe{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!Nf(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let o=t;if(typeof o=="string"){if(o=o.replace(/\s/g,""),o==="")return NaN;o=+o}return n.isType(o)||o===null?o:parseFloat(o)})})}min(t,r=pt.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=pt.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=pt.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=pt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(n){return n>this.resolve(t)}})}positive(t=pt.positive){return this.moreThan(0,t)}negative(t=pt.negative){return this.lessThan(0,t)}integer(t=pt.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>Ye(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(o=>Ye(o)?o:Math[t](o))}}Bs.prototype=Zn.prototype;let Us=new Date(""),Lf=e=>Object.prototype.toString.call(e)==="[object Date]";function Xn(){return new Pt}class Pt extends xe{constructor(){super({type:"date",check(t){return Lf(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=xf(t),isNaN(t)?Pt.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(ht.isRef(t))n=t;else{let o=this.cast(t);if(!this._typeCheck(o))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=o}return n}min(t,r=Vn.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(o){return o>=this.resolve(n)}})}max(t,r=Vn.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(o){return o<=this.resolve(n)}})}}Pt.INVALID_DATE=Us,Xn.prototype=Pt.prototype,Xn.INVALID_DATE=Us;function jf(e,t=[]){let r=[],n=new Set,o=new Set(t.map(([i,a])=>`${i}-${a}`));function s(i,a){let c=Tt.split(i)[0];n.add(c),o.has(`${a}-${c}`)||r.push([a,c])}for(const i of Object.keys(e)){let a=e[i];n.add(i),ht.isRef(a)&&a.isSibling?s(a.path,i):St(a)&&"deps"in a&&a.deps.forEach(c=>s(c,i))}return hf.array(Array.from(n),r).reverse()}function Vs(e,t){let r=1/0;return e.some((n,o)=>{var s;if((s=t.path)!=null&&s.includes(n))return r=o,!0}),r}function Ws(e){return(t,r)=>Vs(e,t)-Vs(e,r)}const Gs=(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 jr(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=jr(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=jr(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(jr)}):"optional"in e?e.optional():e}const zf=(e,t)=>{const r=[...Tt.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),o=Tt.getter(Tt.join(r),!0)(e);return!!(o&&n in o)};let Hs=e=>Object.prototype.toString.call(e)==="[object Object]";function Ys(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const Bf=Ws([]);function ir(e){return new Qn(e)}class Qn extends xe{constructor(t){super({type:"object",check(r){return Hs(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=Bf,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let o=super._cast(t,r);if(o===void 0)return this.getDefault(r);if(!this._typeCheck(o))return o;let s=this.fields,i=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(f=>!this._nodes.includes(f))),c={},u=Object.assign({},r,{parent:c,__validating:r.__validating||!1}),d=!1;for(const f of a){let p=s[f],y=f in o;if(p){let b,h=o[f];u.path=(r.path?`${r.path}.`:"")+f,p=p.resolve({value:h,context:r.context,parent:c});let C=p instanceof xe?p.spec:void 0,x=C==null?void 0:C.strict;if(C!=null&&C.strip){d=d||f in o;continue}b=!r.__validating||!x?p.cast(o[f],u):o[f],b!==void 0&&(c[f]=b)}else y&&!i&&(c[f]=o[f]);(y!==f in c||c[f]!==o[f])&&(d=!0)}return d?c:o}_validate(t,r={},n,o){let{from:s=[],originalValue:i=t,recursive:a=this.spec.recursive}=r;r.from=[{schema:this,value:i},...s],r.__validating=!0,r.originalValue=i,super._validate(t,r,n,(c,u)=>{if(!a||!Hs(u)){o(c,u);return}i=i||u;let d=[];for(let f of this._nodes){let p=this.fields[f];!p||ht.isRef(p)||d.push(p.asNestedTest({options:r,key:f,parent:u,parentPath:r.path,originalParent:i}))}this.runTests({tests:d,value:u,originalValue:i,options:r},n,f=>{o(f.sort(this._sortErrors).concat(c),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[o,s]of Object.entries(this.fields)){const i=n[o];n[o]=i===void 0?s:i}return r.withMutation(o=>o.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 o;const s=this.fields[n];let i=t;(o=i)!=null&&o.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[n]})),r[n]=s&&"getDefault"in s?s.getDefault(i):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=jf(t,r),n._sortErrors=Ws(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let o=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),o=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),o)})}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 jr(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,o])=>t.includes(n)&&t.includes(o)))}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 o=Tt.getter(t,!0);return this.transform(s=>{if(!s)return s;let i=s;return zf(s,t)&&(i=Object.assign({},s),n||delete i[t],i[r]=o(s)),i})}json(){return this.transform(Gs)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Ir.exact,test(r){if(r==null)return!0;const n=Ys(this.schema,r);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=Ir.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(o){if(o==null)return!0;const s=Ys(this.schema,o);return!t||s.length===0||this.createError({params:{unknown:s.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Ir.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const o of Object.keys(r))n[t(o)]=r[o];return n})}camelCase(){return this.transformKeys(Bn.camelCase)}snakeCase(){return this.transformKeys(Bn.snakeCase)}constantCase(){return this.transformKeys(t=>Bn.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[s,i]of Object.entries(r.fields)){var o;let a=t;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[s]})),n.fields[s]=i.describe(a)}return n}}ir.prototype=Qn.prototype;function Rn(e){return new eo(e)}class eo extends xe{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 o=!1;const s=n.map((i,a)=>{const c=this.innerType.cast(i,Object.assign({},r,{path:`${r.path||""}[${a}]`}));return c!==i&&(o=!0),c});return o?s:n}_validate(t,r={},n,o){var s;let i=this.innerType,a=(s=r.recursive)!=null?s:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,n,(c,u)=>{var d;if(!a||!i||!this._typeCheck(u)){o(c,u);return}let f=new Array(u.length);for(let y=0;y<u.length;y++){var p;f[y]=i.asNestedTest({options:r,index:y,parent:u,parentPath:r.path,originalParent:(p=r.originalValue)!=null?p:t})}this.runTests({value:u,tests:f,originalValue:(d=r.originalValue)!=null?d:t,options:r},n,y=>o(y.concat(c),u))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(Gs)}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(!St(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Je(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=kr.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||kr.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||kr.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,o,s)=>!t(n,o,s):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 o;let s=t;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[0]})),n.innerType=r.innerType.describe(s)}return n}}Rn.prototype=eo.prototype;function qs(e){return new to(e)}class to extends xe{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(js.notType)})}_cast(t,r){const{types:n}=this.spec,o=super._cast(t,r);if(!this._typeCheck(o))return o;let s=!1;const i=n.map((a,c)=>{const u=a.cast(o[c],Object.assign({},r,{path:`${r.path||""}[${c}]`}));return u!==o[c]&&(s=!0),u});return s?i:o}_validate(t,r={},n,o){let s=this.spec.types;super._validate(t,r,n,(i,a)=>{var c;if(!this._typeCheck(a)){o(i,a);return}let u=[];for(let[f,p]of s.entries()){var d;u[f]=p.asNestedTest({options:r,index:f,parent:a,parentPath:r.path,originalParent:(d=r.originalValue)!=null?d:t})}this.runTests({value:a,tests:u,originalValue:(c=r.originalValue)!=null?c:t,options:r},n,f=>o(f.concat(i),a))})}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);return n.innerType=r.spec.types.map((o,s)=>{var i;let a=t;return(i=a)!=null&&i.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[s]})),o.describe(a)}),n}}qs.prototype=to.prototype;function Uf(e){return new zr(e)}function Ks(e){try{return e()}catch(t){if(_e.isError(t))return Promise.reject(t);throw t}}class zr{constructor(t){this.type="lazy",this.__isYupSchema__=!0,this.spec=void 0,this._resolve=(r,n={})=>{let o=this.builder(r,n);if(!St(o))throw new TypeError("lazy() functions must return a valid schema");return this.spec.optional&&(o=o.optional()),o.resolve(n)},this.builder=t,this.spec={meta:void 0,optional:!1}}clone(t){const r=new zr(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:o,options:s}=t,i=o[n??r];return this._resolve(i,Object.assign({},s,{value:i,parent:o})).asNestedTest(t)}validate(t,r){return Ks(()=>this._resolve(t,r).validate(t,r))}validateSync(t,r){return this._resolve(t,r).validateSync(t,r)}validateAt(t,r,n){return Ks(()=>this._resolve(r,n).validateAt(t,r,n))}validateSyncAt(t,r,n){return this._resolve(r,n).validateSyncAt(t,r,n)}isValid(t,r){try{return this._resolve(t,r).isValid(t,r)}catch(n){if(_e.isError(n))return Promise.resolve(!1);throw n}}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 Vf(e){Object.keys(e).forEach(t=>{Object.keys(e[t]).forEach(r=>{zs[t][r]=e[t][r]})})}function Wf(e,t,r){if(!e||!St(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 Js=Object.freeze(Object.defineProperty({__proto__:null,ArraySchema:eo,BooleanSchema:qn,DateSchema:Pt,LazySchema:zr,MixedSchema:Hn,NumberSchema:Zn,ObjectSchema:Qn,Schema:xe,StringSchema:Jn,TupleSchema:to,ValidationError:_e,addMethod:Wf,array:Rn,bool:Yn,boolean:Yn,date:Xn,defaultLocale:zs,getIn:Gn,isSchema:St,lazy:Uf,mixed:Nr,number:Bs,object:ir,printValue:Je,reach:wf,ref:_f,setLocale:Vf,string:Lr,tuple:qs},Symbol.toStringTag,{value:"Module"})),Zs=e=>{const t=e.reduce((r,n)=>{let{name:o,required:s,type:i}=n;switch(i){case"RelatedList":i="array";break;case"Integer":case"Float":i="number";break;case"Related":case"Geometry":case"Raw":i="mixed";break;default:i="string"}let a;try{s?a=Js[i]().typeError(`Field must be of type ${i}`).required("Field is required"):a=Js[i]().typeError(`Field must be of type ${i}`).nullable(!0)}catch(c){console.log(c)}return r[o]=a,r},{});return ir().shape(t)},Xs=e=>!e&&typeof e!="boolean"&&typeof e!="number"?null:typeof e=="boolean"?e.toString():Array.isArray(e)?e.map(t=>t.name_||JSON.stringify(t,null,2)).join(", "):typeof e=="object"?e.name_||JSON.stringify(e):e,Gf=e=>e?{...e,add:{columns:e.add_columns,title:e.add_title,schema:Zs(e.add_columns),defaultValues:Es(e.add_columns)},edit:{columns:e.edit_columns,title:e.edit_title,schema:Zs(e.edit_columns),defaultValues:Es(e.edit_columns)}}:null,Hf=async(e,t,r)=>{const{fetchPath:n,options:o}=$e({path:Se(t,"/download"),method:"POST"}),s=await fetch(n,{...o,body:JSON.stringify(r)});let i=null;const a=s.headers.get("content-type");if(a&&a.includes("application/json")?i=await s.json():i=await s.blob(),!s.ok)throw typeof i=="object"?new Error(typeof i.detail=="string"?i.detail:JSON.stringify(i,null,2)):new Error(i);const c=document.createElement("a"),u=URL.createObjectURL(i);c.href=u,c.download=e.toLowerCase()+".csv",c.click()};function Yf({path:e,initialQueryParams:t,relation:r,fetchInfo:n=!0,clearInfoOnRefetch:o=!1,clearDataOnRefetch:s=!1,resetQueryParamsOnPathChange:i=!0,infoQueryProps:a,dataQueryProps:c,streaming:u=!1}){const[d,f]=v.useState(t?Ar(null,t):null),p=v.useRef(e),y=v.useMemo(()=>(p.current=e,r?{...d,filters:[...d.filters,{col:r.foreign_key,opr:r.type,value:ze(r.id)}]}:d),[r,d]),b=v.useCallback(_=>f(P=>{if(typeof _=="function"&&(_=_(P)),!P)return Ar(null,_);const D=Ar({...P},_);if(_&&((_.filters||_.order_column||_.order_direction)&&!_.page&&(D.page=0),u)){if(_.page&&_.page!==P.page&&!_.streaming)throw new Error("You cannot change page in streaming mode, use streaming.fetch() instead");if(_.page_size&&_.page_size!==P.page_size)throw new Error("You cannot change page size in streaming mode, use streaming.fetch() instead")}return D}),[u]),[h,C]=v.useState(null),x=v.useMemo(()=>h,[h]),F=v.useCallback(()=>C(null),[]),{data:$,isFetching:w,refetch:S,error:I}=tt.useQuery({queryKey:[`info-${e}`],queryFn:({signal:_})=>Ju(Se(e,"_info"),_).then(P=>({...Gf(P),path:e})),placeholderData:o?null:tt.keepPreviousData,enabled:n,retry:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1,...a}),{data:j,isFetching:H,refetch:U,error:m}=tt.useQuery({queryKey:[`data-${p.current}`,JSON.stringify(y)],queryFn:({signal:_})=>y?Xu(Se(p.current,"/"),y,_).then(P=>({...P,result:P.result.map((D,V)=>({...D,id:P.ids[V]})),path:p.current})):null,placeholderData:s?null:tt.keepPreviousData,retry:!1,...c});v.useEffect(()=>{if(I){C({message:"Couldn't fetch info",originalError:I});return}if(m){C({message:"Couldn't fetch list",originalError:m});return}F()},[I,m,F]);const A=v.useMemo(()=>w||H,[w,H]);ve.useDidUpdate(()=>{if(!i)return;const _=Ar(null,t);d!=null&&d.page_size&&(_.page_size=d.page_size),b(_)},[e]);const L=v.useCallback(async _=>{try{const P=await Zu(e,ze(_));return F(),P}catch(P){C({message:`Couldn't fetch item with id ${_}`,originalError:P})}},[e,F]),Y=v.useCallback(async(_,P)=>{try{const D=await qu(e,_);return P||(S(),U()),F(),D}catch(D){C({message:"Couldn't add item",originalError:D})}},[U,S,e,F]),J=v.useCallback(async(_,P,D)=>{try{const V=await Qu(e,ze(_),P);return D||(S(),U()),F(),V}catch(V){C({message:`Couldn't update item with id ${_}`,originalError:V})}},[U,S,e,F]),ae=v.useCallback(async(_,P)=>{try{const D=await Ku(e,ze(_));return P||(S(),U()),F(),D}catch(D){C({message:`Couldn't delete item with id ${_}`,originalError:D})}},[U,S,e,F]),le=v.useCallback(async _=>{try{await Hf(_,e,y)}catch(P){C({message:"Couldn't download",originalError:P})}},[e,y]),[ge,me]=ve.useSetState({data:{},isEnd:!1,fetch:()=>null});v.useEffect(()=>{u&&me({fetch:()=>b({page:0,streaming:!0})})},[b,me,u]),v.useEffect(()=>{u&&j&&me(_=>{let P=Object.keys(_.data).length;const D={isEnd:!1};return y.page<P?(P=y.page,D.data={[y.page]:j.result}):D.data={..._.data,[y.page]:j.result},j.result.length<y.page_size?(D.isEnd=!0,D.fetch=()=>null):D.fetch=()=>b({page:P+1,streaming:!0}),D})},[j,b,me,u]);const Me=v.useMemo(()=>{const _={all:"all",actions:"actions"};return j==null||j.list_columns.forEach(P=>{_[P]&&(_[P]=`_${P}`)}),_},[j==null?void 0:j.list_columns]),O=v.useCallback(()=>y?U():b(),[U,y,b]);return{path:e,data:j,info:$,queryParams:y,loading:A,error:x,streaming:ge,specialKey:Me,setQueryParams:b,refetch:O,refetchInfo:S,getEntry:L,addEntry:Y,updateEntry:J,deleteEntry:ae,download:le}}const qf=async(e,t,r)=>{const{fetchPath:n,options:o}=$e({path:Se(e,"/bulk",t),method:"POST",body:r}),s=await fetch(n,o);let i=null;const a=s.headers.get("content-type");if(a&&a.includes("application/json")?i=await s.json():i=await s.text(),!s.ok)throw typeof i=="object"?new Error(typeof i.detail=="string"?i.detail:JSON.stringify(i,null,2)):new Error(i);return i},Kf=({path:e,refetch:t})=>{const[r,n]=v.useState([]),[o,s]=v.useState(null),i=v.useCallback(async(c,u)=>{try{s(null);const d=await qf(e,c,r);return u||t(),d}catch(d){console.error(d),s({message:"Couldn't perform bulk action",originalError:d})}},[e,t,r]);return{bulkActions:v.useMemo(()=>({selectedIds:r,setSelectedIds:n}),[r,n]),dispatchBulkActions:i,error:o}};function Qs({resource_name:e="",initialQueryParams:t,relation:r,fetchInfo:n,clearInfoOnRefetch:o,clearDataOnRefetch:s,resetQueryParamsOnPathChange:i,infoQueryProps:a,dataQueryProps:c,children:u,streaming:d}){const{baseUrl:f}=ws(),p=Yf({path:Se(f,e),initialQueryParams:t,relation:r,fetchInfo:n,clearInfoOnRefetch:o,clearDataOnRefetch:s,resetQueryParamsOnPathChange:i,infoQueryProps:a,dataQueryProps:c,streaming:d}),y=sr(p),b=Kf(y),h=sr(b);return l.jsx(Ts.Provider,{value:y,children:l.jsx(Cs.Provider,{value:h,children:u})})}/**
5
5
  * @license @tabler/icons-react v3.30.0 - MIT
6
6
  *
7
7
  * This source code is licensed under the MIT license.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastapi-rtk",
3
- "version": "0.0.102",
3
+ "version": "0.0.103",
4
4
  "private": false,
5
5
  "description": "A react component library for Flask Appbuilder",
6
6
  "license": "MIT",