@mcp-use/inspector 0.14.0-canary.0 → 0.14.0-canary.2

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.
Files changed (47) hide show
  1. package/dist/cli.js +10 -54
  2. package/dist/client/assets/base-Bnm339-a.js +2 -0
  3. package/dist/client/assets/{index-pqhVKjyB.js → base-RWAdy9P6.js} +33 -36
  4. package/dist/client/assets/browser-9kmymM9X.js +12 -0
  5. package/dist/client/assets/embeddings-C7cRBw1j.js +1 -0
  6. package/dist/client/assets/{index-CTUcNdQF.js → index-Apq2pBJl.js} +2 -2
  7. package/dist/client/assets/index-BsLLCsBP.js +1701 -0
  8. package/dist/client/assets/index-C2UfjD9L.js +4 -0
  9. package/dist/client/assets/index-C69r9Nt9.js +34 -0
  10. package/dist/client/assets/index-CtpnfKmY.js +7 -0
  11. package/dist/client/assets/{index-DorqJhTq.js → index-DIa0UgbZ.js} +1 -1
  12. package/dist/client/assets/index-DKR-Owed.js +70 -0
  13. package/dist/client/assets/{index-DvTyGyQK.js → index-DXrgZUfu.js} +3 -3
  14. package/dist/client/index.html +2 -2
  15. package/dist/server/{chunk-YLX7JQDX.js → chunk-BC23UV5D.js} +3 -1
  16. package/dist/server/{chunk-XGILHZOF.js → chunk-F7YWZTWJ.js} +4 -48
  17. package/dist/server/{chunk-JEKCWLHD.js → chunk-NOEIHEAG.js} +2 -2
  18. package/dist/server/{chunk-MCMZDGO6.js → chunk-Z5QIR3IS.js} +2 -2
  19. package/dist/server/cli.js +3 -3
  20. package/dist/server/index.js +4 -4
  21. package/dist/server/middleware.js +4 -4
  22. package/dist/server/server.d.ts.map +1 -1
  23. package/dist/server/server.js +29 -6
  24. package/dist/server/shared-routes.d.ts.map +1 -1
  25. package/dist/server/shared-routes.js +2 -2
  26. package/dist/server/shared-static.d.ts.map +1 -1
  27. package/dist/server/shared-static.js +1 -1
  28. package/dist/server/shared-utils-browser.d.ts.map +1 -1
  29. package/dist/server/shared-utils-browser.js +1 -1
  30. package/package.json +2 -2
  31. package/dist/client/assets/browser-2Ez00ml2.js +0 -501
  32. package/dist/client/assets/display-A5IEINAP-D2Zkswj8.js +0 -17
  33. package/dist/client/assets/embeddings-SLmbAVWP.js +0 -1
  34. package/dist/client/assets/fs-u42MReIY.js +0 -1
  35. package/dist/client/assets/index-BFXh5irY.js +0 -1701
  36. package/dist/client/assets/index-DDOzs1PG.js +0 -20
  37. package/dist/client/assets/index-DF_VhD4l.js +0 -33
  38. package/dist/client/assets/index-DRz5BQNA.js +0 -1
  39. package/dist/client/assets/index-JiKw9JSs.js +0 -5
  40. package/dist/client/assets/index-ZoGs-72y.js +0 -7
  41. package/dist/client/assets/index-jWGWxByD.js +0 -71
  42. package/dist/client/assets/llms-Og3hdOaD.js +0 -2
  43. package/dist/client/assets/path-BX1ROoWV.js +0 -1
  44. package/dist/client/assets/path-MNZaYwxc.js +0 -1
  45. package/dist/client/assets/posthog-node-CuYhrq1Q.js +0 -1
  46. package/dist/client/assets/util-t-trnxQI.js +0 -1
  47. package/dist/client/assets/winston-CYVymxcI.js +0 -37
@@ -1,4 +1,4 @@
1
- import{r as h,R as ce,b as Ai}from"./index-BFXh5irY.js";var lt={exports:{}},Na;function $i(){if(Na)return lt.exports;Na=1;var e={decodeValues:!0,map:!1,silent:!1};function t(l){return typeof l!="string"||l in{}}function r(){return Object.create(null)}function a(l){return typeof l=="string"&&!!l.trim()}function n(l,u){var c=l.split(";").filter(a),d=c.shift(),m=o(d),p=m.name,f=m.value;if(u=u?Object.assign({},e,u):e,t(p))return null;try{f=u.decodeValues?decodeURIComponent(f):f}catch(y){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",y)}var g=r();return g.name=p,g.value=f,c.forEach(function(y){var w=y.split("="),R=w.shift().trimLeft().toLowerCase();if(!t(R)){var C=w.join("=");if(R==="expires")g.expires=new Date(C);else if(R==="max-age"){var P=parseInt(C,10);Number.isNaN(P)||(g.maxAge=P)}else R==="secure"?g.secure=!0:R==="httponly"?g.httpOnly=!0:R==="samesite"?g.sameSite=C:R==="partitioned"?g.partitioned=!0:R&&(g[R]=C)}}),g}function o(l){var u="",c="",d=l.split("=");return d.length>1?(u=d.shift(),c=d.join("=")):c=l,{name:u,value:c}}function i(l,u){if(u=u?Object.assign({},e,u):e,!l)return u.map?r():[];if(l.headers)if(typeof l.headers.getSetCookie=="function")l=l.headers.getSetCookie();else if(l.headers["set-cookie"])l=l.headers["set-cookie"];else{var c=l.headers[Object.keys(l.headers).find(function(m){return m.toLowerCase()==="set-cookie"})];!c&&l.headers.cookie&&!u.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),l=c}if(Array.isArray(l)||(l=[l]),u.map){var d=r();return l.filter(a).reduce(function(m,p){var f=n(p,u);return f&&!t(f.name)&&(m[f.name]=f),m},d)}else return l.filter(a).map(function(m){return n(m,u)}).filter(Boolean)}function s(l){if(Array.isArray(l))return l;if(typeof l!="string")return[];var u=[],c=0,d,m,p,f,g;function y(){for(;c<l.length&&/\s/.test(l.charAt(c));)c+=1;return c<l.length}function w(){return m=l.charAt(c),m!=="="&&m!==";"&&m!==","}for(;c<l.length;){for(d=c,g=!1;y();)if(m=l.charAt(c),m===","){for(p=c,c+=1,y(),f=c;c<l.length&&w();)c+=1;c<l.length&&l.charAt(c)==="="?(g=!0,c=f,u.push(l.substring(d,p)),d=c):c=p+1}else c+=1;(!g||c>=l.length)&&u.push(l.substring(d,l.length))}return u}return lt.exports=i,lt.exports.parse=i,lt.exports.parseString=n,lt.exports.splitCookiesString=s,lt.exports}var Ii=$i();var Cn=e=>{throw TypeError(e)},Hi=(e,t,r)=>t.has(e)||Cn("Cannot "+r),Er=(e,t,r)=>(Hi(e,t,"read from private field"),r?r.call(e):t.get(e)),ji=(e,t,r)=>t.has(e)?Cn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ui=(e=>(e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e))(Ui||{}),Aa="popstate";function xn(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((p,f)=>c(p,typeof p=="string"?null:p.state,f===0?"default":void 0));let o=l(r??n.length-1),i="POP",s=null;function l(p){return Math.min(Math.max(p,0),n.length-1)}function u(){return n[o]}function c(p,f=null,g){let y=Ae(n?u().pathname:"/",p,f,g);return K(y.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(p)}`),y}function d(p){return typeof p=="string"?p:he(p)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(p){return new URL(d(p),"http://localhost")},encodeLocation(p){let f=typeof p=="string"?xe(p):p;return{pathname:f.pathname||"",search:f.search||"",hash:f.hash||""}},push(p,f){i="PUSH";let g=c(p,f);o+=1,n.splice(o,n.length,g),a&&s&&s({action:i,location:g,delta:1})},replace(p,f){i="REPLACE";let g=c(p,f);n[o]=g,a&&s&&s({action:i,location:g,delta:0})},go(p){i="POP";let f=l(o+p),g=n[f];o=f,s&&s({action:i,location:g,delta:p})},listen(p){return s=p,()=>{s=null}}}}function Pn(e={}){function t(a,n){let{pathname:o,search:i,hash:s}=a.location;return Ae("",{pathname:o,search:i,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function r(a,n){return typeof n=="string"?n:he(n)}return Dn(t,r,null,e)}function Ln(e={}){function t(n,o){let{pathname:i="/",search:s="",hash:l=""}=xe(n.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),Ae("",{pathname:i,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(n,o){let i=n.document.querySelector("base"),s="";if(i&&i.getAttribute("href")){let l=n.location.href,u=l.indexOf("#");s=u===-1?l:l.slice(0,u)}return s+"#"+(typeof o=="string"?o:he(o))}function a(n,o){K(n.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Dn(t,r,a,e)}function I(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function K(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function zi(){return Math.random().toString(36).substring(2,10)}function $a(e,t){return{usr:e.state,key:e.key,idx:t}}function Ae(e,t,r=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xe(t):t,state:r,key:t&&t.key||a||zi()}}function he({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function xe(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Dn(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,s="POP",l=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){s="POP";let y=c(),w=y==null?null:y-u;u=y,l&&l({action:s,location:g.location,delta:w})}function m(y,w){s="PUSH";let R=Ae(g.location,y,w);r&&r(R,y),u=c()+1;let C=$a(R,u),P=g.createHref(R);try{i.pushState(C,"",P)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;n.location.assign(P)}o&&l&&l({action:s,location:g.location,delta:1})}function p(y,w){s="REPLACE";let R=Ae(g.location,y,w);r&&r(R,y),u=c();let C=$a(R,u),P=g.createHref(R);i.replaceState(C,"",P),o&&l&&l({action:s,location:g.location,delta:0})}function f(y){return Tn(y)}let g={get action(){return s},get location(){return e(n,i)},listen(y){if(l)throw new Error("A history only accepts one active listener");return n.addEventListener(Aa,d),l=y,()=>{n.removeEventListener(Aa,d),l=null}},createHref(y){return t(n,y)},createURL:f,encodeLocation(y){let w=f(y);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:p,go(y){return i.go(y)}};return g}function Tn(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),I(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:he(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function cc(e){return{defaultValue:e}}var xt,Ne=class{constructor(e){if(ji(this,xt,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Er(this,xt).has(e))return Er(this,xt).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Er(this,xt).set(e,t)}};xt=new WeakMap;var Bi=new Set(["lazy","caseSensitive","path","id","index","children"]);function Wi(e){return Bi.has(e)}var Vi=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Yi(e){return Vi.has(e)}function Ji(e){return e.index===!0}function We(e,t,r=[],a={},n=!1){return e.map((o,i)=>{let s=[...r,String(i)],l=typeof o.id=="string"?o.id:s.join("-");if(I(o.index!==!0||!o.children,"Cannot specify children on an index route"),I(n||!a[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),Ji(o)){let u={...o,id:l};return a[l]=Ia(u,t(u)),u}else{let u={...o,id:l,children:void 0};return a[l]=Ia(u,t(u)),o.children&&(u.children=We(o.children,t,s,a,n)),u}})}function Ia(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ve(e,t,r="/"){return Pt(e,t,r,!1)}function Pt(e,t,r,a){let n=typeof t=="string"?xe(t):t,o=ne(n.pathname||"/",r);if(o==null)return null;let i=kn(e);Ki(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let u=Mn(o);s=al(i[l],u,a)}return s}function _n(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function kn(e,t=[],r=[],a="",n=!1){let o=(i,s,l=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&l)return;I(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=_e([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(I(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),kn(i.children,t,m,d,l)),!(i.path==null&&!i.index)&&t.push({path:d,score:tl(d,i.index),routesMeta:m})};return e.forEach((i,s)=>{if(i.path===""||!i.path?.includes("?"))o(i,s);else for(let l of On(i.path))o(i,s,!0,l)}),t}function On(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=On(a.join("/")),s=[];return s.push(...i.map(l=>l===""?o:[o,l].join("/"))),n&&s.push(...i),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function Ki(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:rl(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Xi=/^:[\w-]+$/,Gi=3,Qi=2,Zi=1,qi=10,el=-2,Ha=e=>e==="*";function tl(e,t){let r=e.split("/"),a=r.length;return r.some(Ha)&&(a+=el),t&&(a+=Qi),r.filter(n=>!Ha(n)).reduce((n,o)=>n+(Xi.test(o)?Gi:o===""?Zi:qi),a)}function rl(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function al(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let s=0;s<a.length;++s){let l=a[s],u=s===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d=Lt({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},c),m=l.route;if(!d&&u&&r&&!a[a.length-1].route.index&&(d=Lt({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},c)),!d)return null;Object.assign(n,d.params),i.push({params:n,pathname:_e([o,d.pathname]),pathnameBase:ll(_e([o,d.pathnameBase])),route:m}),d.pathnameBase!=="/"&&(o=_e([o,d.pathnameBase]))}return i}function dc(e,t={}){let r=e;r.endsWith("*")&&r!=="*"&&!r.endsWith("/*")&&(K(!1,`Route path "${r}" will be treated as if it were "${r.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${r.replace(/\*$/,"/*")}".`),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",n=i=>i==null?"":typeof i=="string"?i:String(i),o=r.split(/\/+/).map((i,s,l)=>{if(s===l.length-1&&i==="*")return n(t["*"]);const c=i.match(/^:([\w-]+)(\??)$/);if(c){const[,d,m]=c;let p=t[d];return I(m==="?"||p!=null,`Missing ":${d}" param`),encodeURIComponent(n(p))}return i.replace(/\?$/g,"")}).filter(i=>!!i);return a+o.join("/")}function Lt(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Fn(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let o=n[0],i=o.replace(/(.)\/+$/,"$1"),s=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let f=s[m]||"";i=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const p=s[m];return d&&!p?u[c]=void 0:u[c]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Fn(e,t=!1,r=!0){K(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l)=>(a.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Mn(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return K(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ne(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function nl({basename:e,pathname:t}){return t==="/"?e:_e([e,t])}var ol=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nr=e=>ol.test(e);function il(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?xe(e):e,o;if(r)if(nr(r))o=r;else{if(r.includes("//")){let i=r;r=r.replace(/\/\/+/g,"/"),K(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${r}`)}r.startsWith("/")?o=ja(r.substring(1),"/"):o=ja(r,t)}else o=t;return{pathname:o,search:sl(a),hash:ul(n)}}function ja(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function br(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Nn(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function or(e){let t=Nn(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function ir(e,t,r,a=!1){let n;typeof e=="string"?n=xe(e):(n={...e},I(!n.pathname||!n.pathname.includes("?"),br("?","pathname","search",n)),I(!n.pathname||!n.pathname.includes("#"),br("#","pathname","hash",n)),I(!n.search||!n.search.includes("#"),br("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,s;if(i==null)s=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}s=d>=0?t[d]:"/"}let l=il(n,s),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}var _e=e=>e.join("/").replace(/\/\/+/g,"/"),ll=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),sl=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ul=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,cl=class{constructor(e,t){this.type="DataWithResponseInit",this.data=e,this.init=t||null}};function dl(e,t){return new cl(e,typeof t=="number"?{status:t}:t)}var lr=(e,t=302)=>{let r=t;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let a=new Headers(r.headers);return a.set("Location",e),new Response(null,{...r,headers:a})},fl=(e,t)=>{let r=lr(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},hl=(e,t)=>{let r=lr(e,t);return r.headers.set("X-Remix-Replace","true"),r},me=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function re(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ct(e){return e.filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var je=Symbol("Uninstrumented");function An(e,t){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(n=>n({id:t.id,index:t.index,path:t.path,instrument(o){let i=Object.keys(r);for(let s of i)o[s]&&r[s].push(o[s])}}));let a={};if(typeof t.lazy=="function"&&r.lazy.length>0){let n=tt(r.lazy,t.lazy,()=>{});n&&(a.lazy=n)}if(typeof t.lazy=="object"){let n=t.lazy;["middleware","loader","action"].forEach(o=>{let i=n[o],s=r[`lazy.${o}`];if(typeof i=="function"&&s.length>0){let l=tt(s,i,()=>{});l&&(a.lazy=Object.assign(a.lazy||{},{[o]:l}))}})}return["loader","action"].forEach(n=>{let o=t[n];if(typeof o=="function"&&r[n].length>0){let i=o[je]??o,s=tt(r[n],i,(...l)=>Ua(l[0]));s&&(s[je]=i,a[n]=s)}}),t.middleware&&t.middleware.length>0&&r.middleware.length>0&&(a.middleware=t.middleware.map(n=>{let o=n[je]??n,i=tt(r.middleware,o,(...s)=>Ua(s[0]));return i?(i[je]=o,i):n})),a}function ml(e,t){let r={navigate:[],fetch:[]};if(t.forEach(a=>a({instrument(n){let o=Object.keys(n);for(let i of o)n[i]&&r[i].push(n[i])}})),r.navigate.length>0){let a=e.navigate[je]??e.navigate,n=tt(r.navigate,a,(...o)=>{let[i,s]=o;return{to:typeof i=="number"||typeof i=="string"?i:i?he(i):".",...za(e,s??{})}});n&&(n[je]=a,e.navigate=n)}if(r.fetch.length>0){let a=e.fetch[je]??e.fetch,n=tt(r.fetch,a,(...o)=>{let[i,,s,l]=o;return{href:s??".",fetcherKey:i,...za(e,l??{})}});n&&(n[je]=a,e.fetch=n)}return e}function pl(e,t){let r={request:[]};t.forEach(n=>n({instrument(o){let i=Object.keys(o);for(let s of i)o[s]&&r[s].push(o[s])}}));let a=e;return r.request.length>0&&(a=tt(r.request,e,(...n)=>{let[o,i]=n;return{request:In(o),context:i!=null?Hn(i):i}})),a}function tt(e,t,r){return e.length===0?null:async(...a)=>{let n=await $n(e,r(...a),()=>t(...a),e.length-1);if(n.type==="error")throw n.value;return n.value}}async function $n(e,t,r,a){let n=e[a],o;if(n){let i,s=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=$n(e,t,r,a-1),o=await i,I(o,"Expected a result"),o.type==="error"&&o.value instanceof Error?{status:"error",error:o.value}:{status:"success",error:void 0});try{await n(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}i||await s(),await i}else try{o={type:"success",value:await r()}}catch(i){o={type:"error",value:i}}return o||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Ua(e){let{request:t,context:r,params:a,unstable_pattern:n}=e;return{request:In(t),params:{...a},unstable_pattern:n,context:Hn(r)}}function za(e,t){return{currentUrl:he(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function In(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Hn(e){if(vl(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var yl=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vl(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===yl}var jn=["POST","PUT","PATCH","DELETE"],gl=new Set(jn),wl=["GET",...jn],Rl=new Set(wl),Un=new Set([301,302,303,307,308]),El=new Set([307,308]),Yt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Kr={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},et={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},zn=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Bn="remix-router-transitions",Wn=Symbol("ResetLoaderData");function Xr(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";I(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=e.hydrationRouteProperties||[],n=e.mapRouteProperties||zn,o=n;if(e.unstable_instrumentations){let v=e.unstable_instrumentations;o=b=>({...n(b),...An(v.map(S=>S.route).filter(Boolean),b)})}let i={},s=We(e.routes,o,void 0,i),l,u=e.basename||"/";u.startsWith("/")||(u=`/${u}`);let c=e.dataStrategy||Ll,d={...e.future},m=null,p=new Set,f=null,g=null,y=null,w=e.hydrationData!=null,R=ve(s,e.history.location,u),C=!1,P=null,x;if(R==null&&!e.patchRoutesOnNavigation){let v=te(404,{pathname:e.history.location.pathname}),{matches:b,route:S}=ut(s);x=!0,R=b,P={[S.id]:v}}else if(R&&!e.hydrationData&&At(R,s,e.history.location.pathname).active&&(R=null),R)if(R.some(v=>v.route.lazy))x=!1;else if(!R.some(v=>Gr(v.route)))x=!0;else{let v=e.hydrationData?e.hydrationData.loaderData:null,b=e.hydrationData?e.hydrationData.errors:null;if(b){let S=R.findIndex(D=>b[D.route.id]!==void 0);x=R.slice(0,S+1).every(D=>!Or(D.route,v,b))}else x=R.every(S=>!Or(S.route,v,b))}else{x=!1,R=[];let v=At(null,s,e.history.location.pathname);v.active&&v.matches&&(C=!0,R=v.matches)}let L,E={historyAction:e.history.action,location:e.history.location,matches:R,initialized:x,navigation:Yt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||P,fetchers:new Map,blockers:new Map},O="POP",_=!1,k,M=!1,V=new Map,X=null,z=!1,J=!1,le=new Set,Y=new Map,Ee=0,pe=-1,Pe=new Map,ye=new Set,be=new Map,Le=new Map,De=new Set,Je=new Map,Mt,gt=null;function gi(){if(m=e.history.listen(({action:v,location:b,delta:S})=>{if(Mt){Mt(),Mt=void 0;return}K(Je.size===0||S!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let D=_a({currentLocation:E.location,nextLocation:b,historyAction:v});if(D&&S!=null){let T=new Promise(N=>{Mt=N});e.history.go(S*-1),Nt(D,{state:"blocked",location:b,proceed(){Nt(D,{state:"proceeding",proceed:void 0,reset:void 0,location:b}),T.then(()=>e.history.go(S))},reset(){let N=new Map(E.blockers);N.set(D,et),se({blockers:N})}});return}return Ke(v,b)}),r){Ml(t,V);let v=()=>Nl(t,V);t.addEventListener("pagehide",v),X=()=>t.removeEventListener("pagehide",v)}return E.initialized||Ke("POP",E.location,{initialHydration:!0}),L}function wi(){m&&m(),X&&X(),p.clear(),k&&k.abort(),E.fetchers.forEach((v,b)=>gr(b)),E.blockers.forEach((v,b)=>Ta(b))}function Ri(v){return p.add(v),()=>p.delete(v)}function se(v,b={}){v.matches&&(v.matches=v.matches.map(T=>{let N=i[T.route.id],A=T.route;return A.element!==N.element||A.errorElement!==N.errorElement||A.hydrateFallbackElement!==N.hydrateFallbackElement?{...T,route:N}:T})),E={...E,...v};let S=[],D=[];E.fetchers.forEach((T,N)=>{T.state==="idle"&&(De.has(N)?S.push(N):D.push(N))}),De.forEach(T=>{!E.fetchers.has(T)&&!Y.has(T)&&S.push(T)}),[...p].forEach(T=>T(E,{deletedFetchers:S,viewTransitionOpts:b.viewTransitionOpts,flushSync:b.flushSync===!0})),S.forEach(T=>gr(T)),D.forEach(T=>E.fetchers.delete(T))}function ot(v,b,{flushSync:S}={}){let D=E.actionData!=null&&E.navigation.formMethod!=null&&de(E.navigation.formMethod)&&E.navigation.state==="loading"&&v.state?._isRedirect!==!0,T;b.actionData?Object.keys(b.actionData).length>0?T=b.actionData:T=null:D?T=E.actionData:T=null;let N=b.loaderData?en(E.loaderData,b.loaderData,b.matches||[],b.errors):E.loaderData,A=E.blockers;A.size>0&&(A=new Map(A),A.forEach((H,j)=>A.set(j,et)));let F=z?!1:Oa(v,b.matches||E.matches),$=_===!0||E.navigation.formMethod!=null&&de(E.navigation.formMethod)&&v.state?._isRedirect!==!0;l&&(s=l,l=void 0),z||O==="POP"||(O==="PUSH"?e.history.push(v,v.state):O==="REPLACE"&&e.history.replace(v,v.state));let U;if(O==="POP"){let H=V.get(E.location.pathname);H&&H.has(v.pathname)?U={currentLocation:E.location,nextLocation:v}:V.has(v.pathname)&&(U={currentLocation:v,nextLocation:E.location})}else if(M){let H=V.get(E.location.pathname);H?H.add(v.pathname):(H=new Set([v.pathname]),V.set(E.location.pathname,H)),U={currentLocation:E.location,nextLocation:v}}se({...b,actionData:T,loaderData:N,historyAction:O,location:v,initialized:!0,navigation:Yt,revalidation:"idle",restoreScrollPosition:F,preventScrollReset:$,blockers:A},{viewTransitionOpts:U,flushSync:S===!0}),O="POP",_=!1,M=!1,z=!1,J=!1,gt?.resolve(),gt=null}async function ba(v,b){if(typeof v=="number"){e.history.go(v);return}let S=kr(E.location,E.matches,u,v,b?.fromRouteId,b?.relative),{path:D,submission:T,error:N}=Wa(!1,S,b),A=E.location,F=Ae(E.location,D,b&&b.state);F={...F,...e.history.encodeLocation(F)};let $=b&&b.replace!=null?b.replace:void 0,U="PUSH";$===!0?U="REPLACE":$===!1||T!=null&&de(T.formMethod)&&T.formAction===E.location.pathname+E.location.search&&(U="REPLACE");let H=b&&"preventScrollReset"in b?b.preventScrollReset===!0:void 0,j=(b&&b.flushSync)===!0,B=_a({currentLocation:A,nextLocation:F,historyAction:U});if(B){Nt(B,{state:"blocked",location:F,proceed(){Nt(B,{state:"proceeding",proceed:void 0,reset:void 0,location:F}),ba(v,b)},reset(){let Z=new Map(E.blockers);Z.set(B,et),se({blockers:Z})}});return}await Ke(U,F,{submission:T,pendingError:N,preventScrollReset:H,replace:b&&b.replace,enableViewTransition:b&&b.viewTransition,flushSync:j})}function Ei(){gt||(gt=Al()),vr(),se({revalidation:"loading"});let v=gt.promise;return E.navigation.state==="submitting"?v:E.navigation.state==="idle"?(Ke(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),v):(Ke(O||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:M===!0}),v)}async function Ke(v,b,S){k&&k.abort(),k=null,O=v,z=(S&&S.startUninterruptedRevalidation)===!0,Oi(E.location,E.matches),_=(S&&S.preventScrollReset)===!0,M=(S&&S.enableViewTransition)===!0;let D=l||s,T=S&&S.overrideNavigation,N=S?.initialHydration&&E.matches&&E.matches.length>0&&!C?E.matches:ve(D,b,u),A=(S&&S.flushSync)===!0;if(N&&E.initialized&&!J&&Tl(E.location,b)&&!(S&&S.submission&&de(S.submission.formMethod))){ot(b,{matches:N},{flushSync:A});return}let F=At(N,D,b.pathname);if(F.active&&F.matches&&(N=F.matches),!N){let{error:oe,notFoundMatches:G,route:Q}=wr(b.pathname);ot(b,{matches:G,loaderData:{},errors:{[Q.id]:oe}},{flushSync:A});return}k=new AbortController;let $=st(e.history,b,k.signal,S&&S.submission),U=e.getContext?await e.getContext():new Ne,H;if(S&&S.pendingError)H=[Ce(N).route.id,{type:"error",error:S.pendingError}];else if(S&&S.submission&&de(S.submission.formMethod)){let oe=await bi($,b,S.submission,N,U,F.active,S&&S.initialHydration===!0,{replace:S.replace,flushSync:A});if(oe.shortCircuited)return;if(oe.pendingActionResult){let[G,Q]=oe.pendingActionResult;if(ie(Q)&&re(Q.error)&&Q.error.status===404){k=null,ot(b,{matches:oe.matches,loaderData:{},errors:{[G]:Q.error}});return}}N=oe.matches||N,H=oe.pendingActionResult,T=Sr(b,S.submission),A=!1,F.active=!1,$=st(e.history,$.url,$.signal)}let{shortCircuited:j,matches:B,loaderData:Z,errors:ae}=await Si($,b,N,U,F.active,T,S&&S.submission,S&&S.fetcherSubmission,S&&S.replace,S&&S.initialHydration===!0,A,H);j||(k=null,ot(b,{matches:B||N,...tn(H),loaderData:Z,errors:ae}))}async function bi(v,b,S,D,T,N,A,F={}){vr();let $=Ol(b,S);if(se({navigation:$},{flushSync:F.flushSync===!0}),N){let j=await $t(D,b.pathname,v.signal);if(j.type==="aborted")return{shortCircuited:!0};if(j.type==="error"){if(j.partialMatches.length===0){let{matches:Z,route:ae}=ut(s);return{matches:Z,pendingActionResult:[ae.id,{type:"error",error:j.error}]}}let B=Ce(j.partialMatches).route.id;return{matches:j.partialMatches,pendingActionResult:[B,{type:"error",error:j.error}]}}else if(j.matches)D=j.matches;else{let{notFoundMatches:B,error:Z,route:ae}=wr(b.pathname);return{matches:B,pendingActionResult:[ae.id,{type:"error",error:Z}]}}}let U,H=dt(D,b);if(!H.route.action&&!H.route.lazy)U={type:"error",error:te(405,{method:v.method,pathname:b.pathname,routeId:H.route.id})};else{let j=ze(o,i,v,D,H,A?[]:a,T),B=await wt(v,j,T,null);if(U=B[H.route.id],!U){for(let Z of D)if(B[Z.route.id]){U=B[Z.route.id];break}}if(v.signal.aborted)return{shortCircuited:!0}}if(Ue(U)){let j;return F&&F.replace!=null?j=F.replace:j=Qa(U.response.headers.get("Location"),new URL(v.url),u)===E.location.pathname+E.location.search,await Xe(v,U,!0,{submission:S,replace:j}),{shortCircuited:!0}}if(ie(U)){let j=Ce(D,H.route.id);return(F&&F.replace)!==!0&&(O="PUSH"),{matches:D,pendingActionResult:[j.route.id,U,H.route.id]}}return{matches:D,pendingActionResult:[H.route.id,U]}}async function Si(v,b,S,D,T,N,A,F,$,U,H,j){let B=N||Sr(b,A),Z=A||F||rn(B),ae=!z&&!U;if(T){if(ae){let ue=Sa(j);se({navigation:B,...ue!==void 0?{actionData:ue}:{}},{flushSync:H})}let W=await $t(S,b.pathname,v.signal);if(W.type==="aborted")return{shortCircuited:!0};if(W.type==="error"){if(W.partialMatches.length===0){let{matches:it,route:Ze}=ut(s);return{matches:it,loaderData:{},errors:{[Ze.id]:W.error}}}let ue=Ce(W.partialMatches).route.id;return{matches:W.partialMatches,loaderData:{},errors:{[ue]:W.error}}}else if(W.matches)S=W.matches;else{let{error:ue,notFoundMatches:it,route:Ze}=wr(b.pathname);return{matches:it,loaderData:{},errors:{[Ze.id]:ue}}}}let oe=l||s,{dsMatches:G,revalidatingFetchers:Q}=Va(v,D,o,i,e.history,E,S,Z,b,U?[]:a,U===!0,J,le,De,be,ye,oe,u,e.patchRoutesOnNavigation!=null,j);if(pe=++Ee,!e.dataStrategy&&!G.some(W=>W.shouldLoad)&&!G.some(W=>W.route.middleware&&W.route.middleware.length>0)&&Q.length===0){let W=La();return ot(b,{matches:S,loaderData:{},errors:j&&ie(j[1])?{[j[0]]:j[1].error}:null,...tn(j),...W?{fetchers:new Map(E.fetchers)}:{}},{flushSync:H}),{shortCircuited:!0}}if(ae){let W={};if(!T){W.navigation=B;let ue=Sa(j);ue!==void 0&&(W.actionData=ue)}Q.length>0&&(W.fetchers=Ci(Q)),se(W,{flushSync:H})}Q.forEach(W=>{Fe(W.key),W.controller&&Y.set(W.key,W.controller)});let Ge=()=>Q.forEach(W=>Fe(W.key));k&&k.signal.addEventListener("abort",Ge);let{loaderResults:Rt,fetcherResults:He}=await Ca(G,Q,v,D);if(v.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",Ge),Q.forEach(W=>Y.delete(W.key));let Te=Ut(Rt);if(Te)return await Xe(v,Te.result,!0,{replace:$}),{shortCircuited:!0};if(Te=Ut(He),Te)return ye.add(Te.key),await Xe(v,Te.result,!0,{replace:$}),{shortCircuited:!0};let{loaderData:Rr,errors:Et}=qa(E,S,Rt,j,Q,He);U&&E.errors&&(Et={...E.errors,...Et});let Qe=La(),It=Da(pe),Ht=Qe||It||Q.length>0;return{matches:S,loaderData:Rr,errors:Et,...Ht?{fetchers:new Map(E.fetchers)}:{}}}function Sa(v){if(v&&!ie(v[1]))return{[v[0]]:v[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function Ci(v){return v.forEach(b=>{let S=E.fetchers.get(b.key),D=bt(void 0,S?S.data:void 0);E.fetchers.set(b.key,D)}),new Map(E.fetchers)}async function xi(v,b,S,D){Fe(v);let T=(D&&D.flushSync)===!0,N=l||s,A=kr(E.location,E.matches,u,S,b,D?.relative),F=ve(N,A,u),$=At(F,N,A);if($.active&&$.matches&&(F=$.matches),!F){Oe(v,b,te(404,{pathname:A}),{flushSync:T});return}let{path:U,submission:H,error:j}=Wa(!0,A,D);if(j){Oe(v,b,j,{flushSync:T});return}let B=e.getContext?await e.getContext():new Ne,Z=(D&&D.preventScrollReset)===!0;if(H&&de(H.formMethod)){await Pi(v,b,U,F,B,$.active,T,Z,H);return}be.set(v,{routeId:b,path:U}),await Li(v,b,U,F,B,$.active,T,Z,H)}async function Pi(v,b,S,D,T,N,A,F,$){vr(),be.delete(v);let U=E.fetchers.get(v);ke(v,Fl($,U),{flushSync:A});let H=new AbortController,j=st(e.history,S,H.signal,$);if(N){let ee=await $t(D,new URL(j.url).pathname,j.signal,v);if(ee.type==="aborted")return;if(ee.type==="error"){Oe(v,b,ee.error,{flushSync:A});return}else if(ee.matches)D=ee.matches;else{Oe(v,b,te(404,{pathname:S}),{flushSync:A});return}}let B=dt(D,S);if(!B.route.action&&!B.route.lazy){let ee=te(405,{method:$.formMethod,pathname:S,routeId:b});Oe(v,b,ee,{flushSync:A});return}Y.set(v,H);let Z=Ee,ae=ze(o,i,j,D,B,a,T),oe=await wt(j,ae,T,v),G=oe[B.route.id];if(!G){for(let ee of ae)if(oe[ee.route.id]){G=oe[ee.route.id];break}}if(j.signal.aborted){Y.get(v)===H&&Y.delete(v);return}if(De.has(v)){if(Ue(G)||ie(G)){ke(v,Me(void 0));return}}else{if(Ue(G))if(Y.delete(v),pe>Z){ke(v,Me(void 0));return}else return ye.add(v),ke(v,bt($)),Xe(j,G,!1,{fetcherSubmission:$,preventScrollReset:F});if(ie(G)){Oe(v,b,G.error);return}}let Q=E.navigation.location||E.location,Ge=st(e.history,Q,H.signal),Rt=l||s,He=E.navigation.state!=="idle"?ve(Rt,E.navigation.location,u):E.matches;I(He,"Didn't find any matches after fetcher action");let Te=++Ee;Pe.set(v,Te);let Rr=bt($,G.data);E.fetchers.set(v,Rr);let{dsMatches:Et,revalidatingFetchers:Qe}=Va(Ge,T,o,i,e.history,E,He,$,Q,a,!1,J,le,De,be,ye,Rt,u,e.patchRoutesOnNavigation!=null,[B.route.id,G]);Qe.filter(ee=>ee.key!==v).forEach(ee=>{let jt=ee.key,Ma=E.fetchers.get(jt),Ni=bt(void 0,Ma?Ma.data:void 0);E.fetchers.set(jt,Ni),Fe(jt),ee.controller&&Y.set(jt,ee.controller)}),se({fetchers:new Map(E.fetchers)});let It=()=>Qe.forEach(ee=>Fe(ee.key));H.signal.addEventListener("abort",It);let{loaderResults:Ht,fetcherResults:W}=await Ca(Et,Qe,Ge,T);if(H.signal.aborted)return;if(H.signal.removeEventListener("abort",It),Pe.delete(v),Y.delete(v),Qe.forEach(ee=>Y.delete(ee.key)),E.fetchers.has(v)){let ee=Me(G.data);E.fetchers.set(v,ee)}let ue=Ut(Ht);if(ue)return Xe(Ge,ue.result,!1,{preventScrollReset:F});if(ue=Ut(W),ue)return ye.add(ue.key),Xe(Ge,ue.result,!1,{preventScrollReset:F});let{loaderData:it,errors:Ze}=qa(E,He,Ht,void 0,Qe,W);Da(Te),E.navigation.state==="loading"&&Te>pe?(I(O,"Expected pending action"),k&&k.abort(),ot(E.navigation.location,{matches:He,loaderData:it,errors:Ze,fetchers:new Map(E.fetchers)})):(se({errors:Ze,loaderData:en(E.loaderData,it,He,Ze),fetchers:new Map(E.fetchers)}),J=!1)}async function Li(v,b,S,D,T,N,A,F,$){let U=E.fetchers.get(v);ke(v,bt($,U?U.data:void 0),{flushSync:A});let H=new AbortController,j=st(e.history,S,H.signal);if(N){let Q=await $t(D,new URL(j.url).pathname,j.signal,v);if(Q.type==="aborted")return;if(Q.type==="error"){Oe(v,b,Q.error,{flushSync:A});return}else if(Q.matches)D=Q.matches;else{Oe(v,b,te(404,{pathname:S}),{flushSync:A});return}}let B=dt(D,S);Y.set(v,H);let Z=Ee,ae=ze(o,i,j,D,B,a,T),G=(await wt(j,ae,T,v))[B.route.id];if(Y.get(v)===H&&Y.delete(v),!j.signal.aborted){if(De.has(v)){ke(v,Me(void 0));return}if(Ue(G))if(pe>Z){ke(v,Me(void 0));return}else{ye.add(v),await Xe(j,G,!1,{preventScrollReset:F});return}if(ie(G)){Oe(v,b,G.error);return}ke(v,Me(G.data))}}async function Xe(v,b,S,{submission:D,fetcherSubmission:T,preventScrollReset:N,replace:A}={}){b.response.headers.has("X-Remix-Revalidate")&&(J=!0);let F=b.response.headers.get("Location");I(F,"Expected a Location header on the redirect Response"),F=Qa(F,new URL(v.url),u);let $=Ae(E.location,F,{_isRedirect:!0});if(r){let ae=!1;if(b.response.headers.has("X-Remix-Reload-Document"))ae=!0;else if(nr(F)){const oe=Tn(F,!0);ae=oe.origin!==t.location.origin||ne(oe.pathname,u)==null}if(ae){A?t.location.replace(F):t.location.assign(F);return}}k=null;let U=A===!0||b.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:H,formAction:j,formEncType:B}=E.navigation;!D&&!T&&H&&j&&B&&(D=rn(E.navigation));let Z=D||T;if(El.has(b.response.status)&&Z&&de(Z.formMethod))await Ke(U,$,{submission:{...Z,formAction:F},preventScrollReset:N||_,enableViewTransition:S?M:void 0});else{let ae=Sr($,D);await Ke(U,$,{overrideNavigation:ae,fetcherSubmission:T,preventScrollReset:N||_,enableViewTransition:S?M:void 0})}}async function wt(v,b,S,D){let T,N={};try{T=await Zn(c,v,b,D,S,!1)}catch(A){return b.filter(F=>F.shouldLoad).forEach(F=>{N[F.route.id]={type:"error",error:A}}),N}if(v.signal.aborted)return N;for(let[A,F]of Object.entries(T))if(oo(F)){let $=F.result;N[A]={type:"redirect",response:to($,v,A,b,u)}}else N[A]=await eo(F);return N}async function Ca(v,b,S,D){let T=wt(S,v,D,null),N=Promise.all(b.map(async $=>{if($.matches&&$.match&&$.request&&$.controller){let H=(await wt($.request,$.matches,D,$.key))[$.match.route.id];return{[$.key]:H}}else return Promise.resolve({[$.key]:{type:"error",error:te(404,{pathname:$.path})}})})),A=await T,F=(await N).reduce(($,U)=>Object.assign($,U),{});return{loaderResults:A,fetcherResults:F}}function vr(){J=!0,be.forEach((v,b)=>{Y.has(b)&&le.add(b),Fe(b)})}function ke(v,b,S={}){E.fetchers.set(v,b),se({fetchers:new Map(E.fetchers)},{flushSync:(S&&S.flushSync)===!0})}function Oe(v,b,S,D={}){let T=Ce(E.matches,b);gr(v),se({errors:{[T.route.id]:S},fetchers:new Map(E.fetchers)},{flushSync:(D&&D.flushSync)===!0})}function xa(v){return Le.set(v,(Le.get(v)||0)+1),De.has(v)&&De.delete(v),E.fetchers.get(v)||Kr}function Di(v,b){Fe(v,b?.reason),ke(v,Me(null))}function gr(v){let b=E.fetchers.get(v);Y.has(v)&&!(b&&b.state==="loading"&&Pe.has(v))&&Fe(v),be.delete(v),Pe.delete(v),ye.delete(v),De.delete(v),le.delete(v),E.fetchers.delete(v)}function Ti(v){let b=(Le.get(v)||0)-1;b<=0?(Le.delete(v),De.add(v)):Le.set(v,b),se({fetchers:new Map(E.fetchers)})}function Fe(v,b){let S=Y.get(v);S&&(S.abort(b),Y.delete(v))}function Pa(v){for(let b of v){let S=xa(b),D=Me(S.data);E.fetchers.set(b,D)}}function La(){let v=[],b=!1;for(let S of ye){let D=E.fetchers.get(S);I(D,`Expected fetcher: ${S}`),D.state==="loading"&&(ye.delete(S),v.push(S),b=!0)}return Pa(v),b}function Da(v){let b=[];for(let[S,D]of Pe)if(D<v){let T=E.fetchers.get(S);I(T,`Expected fetcher: ${S}`),T.state==="loading"&&(Fe(S),Pe.delete(S),b.push(S))}return Pa(b),b.length>0}function _i(v,b){let S=E.blockers.get(v)||et;return Je.get(v)!==b&&Je.set(v,b),S}function Ta(v){E.blockers.delete(v),Je.delete(v)}function Nt(v,b){let S=E.blockers.get(v)||et;I(S.state==="unblocked"&&b.state==="blocked"||S.state==="blocked"&&b.state==="blocked"||S.state==="blocked"&&b.state==="proceeding"||S.state==="blocked"&&b.state==="unblocked"||S.state==="proceeding"&&b.state==="unblocked",`Invalid blocker state transition: ${S.state} -> ${b.state}`);let D=new Map(E.blockers);D.set(v,b),se({blockers:D})}function _a({currentLocation:v,nextLocation:b,historyAction:S}){if(Je.size===0)return;Je.size>1&&K(!1,"A router only supports one blocker at a time");let D=Array.from(Je.entries()),[T,N]=D[D.length-1],A=E.blockers.get(T);if(!(A&&A.state==="proceeding")&&N({currentLocation:v,nextLocation:b,historyAction:S}))return T}function wr(v){let b=te(404,{pathname:v}),S=l||s,{matches:D,route:T}=ut(S);return{notFoundMatches:D,route:T,error:b}}function ki(v,b,S){if(f=v,y=b,g=S||null,!w&&E.navigation===Yt){w=!0;let D=Oa(E.location,E.matches);D!=null&&se({restoreScrollPosition:D})}return()=>{f=null,y=null,g=null}}function ka(v,b){return g&&g(v,b.map(D=>_n(D,E.loaderData)))||v.key}function Oi(v,b){if(f&&y){let S=ka(v,b);f[S]=y()}}function Oa(v,b){if(f){let S=ka(v,b),D=f[S];if(typeof D=="number")return D}return null}function At(v,b,S){if(e.patchRoutesOnNavigation)if(v){if(Object.keys(v[0].params).length>0)return{active:!0,matches:Pt(b,S,u,!0)}}else return{active:!0,matches:Pt(b,S,u,!0)||[]};return{active:!1,matches:null}}async function $t(v,b,S,D){if(!e.patchRoutesOnNavigation)return{type:"success",matches:v};let T=v;for(;;){let N=l==null,A=l||s,F=i;try{await e.patchRoutesOnNavigation({signal:S,path:b,matches:T,fetcherKey:D,patch:(H,j)=>{S.aborted||Ya(H,j,A,F,o,!1)}})}catch(H){return{type:"error",error:H,partialMatches:T}}finally{N&&!S.aborted&&(s=[...s])}if(S.aborted)return{type:"aborted"};let $=ve(A,b,u),U=null;if($){if(Object.keys($[0].params).length===0)return{type:"success",matches:$};if(U=Pt(A,b,u,!0),!(U&&T.length<U.length&&Fa(T,U.slice(0,T.length))))return{type:"success",matches:$}}if(U||(U=Pt(A,b,u,!0)),!U||Fa(T,U))return{type:"success",matches:null};T=U}}function Fa(v,b){return v.length===b.length&&v.every((S,D)=>S.route.id===b[D].route.id)}function Fi(v){i={},l=We(v,o,void 0,i)}function Mi(v,b,S=!1){let D=l==null;Ya(v,b,l||s,i,o,S),D&&(s=[...s],se({}))}return L={get basename(){return u},get future(){return d},get state(){return E},get routes(){return s},get window(){return t},initialize:gi,subscribe:Ri,enableScrollRestoration:ki,navigate:ba,fetch:xi,revalidate:Ei,createHref:v=>e.history.createHref(v),encodeLocation:v=>e.history.encodeLocation(v),getFetcher:xa,resetFetcher:Di,deleteFetcher:Ti,dispose:wi,getBlocker:_i,deleteBlocker:Ta,patchRoutes:Mi,_internalFetchControllers:Y,_internalSetRoutes:Fi,_internalSetStateDoNotUseOrYouWillBreakYourApp(v){se(v)}},e.unstable_instrumentations&&(L=ml(L,e.unstable_instrumentations.map(v=>v.router).filter(Boolean))),L}function Vn(e,t){I(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let r={},a=(t?t.basename:null)||"/",n=t?.mapRouteProperties||zn,o=n;if(t?.unstable_instrumentations){let p=t.unstable_instrumentations;o=f=>({...n(f),...An(p.map(g=>g.route).filter(Boolean),f)})}let i=We(e,o,void 0,r);async function s(p,{requestContext:f,filterMatchesToLoad:g,skipLoaderErrorBubbling:y,skipRevalidation:w,dataStrategy:R,generateMiddlewareResponse:C}={}){let P=new URL(p.url),x=p.method,L=Ae("",he(P),null,"default"),E=ve(i,L,a);if(f=f??new Ne,!Ar(x)&&x!=="HEAD"){let _=te(405,{method:x}),{matches:k,route:M}=ut(i),V={basename:a,location:L,matches:k,loaderData:{},actionData:null,errors:{[M.id]:_},statusCode:_.status,loaderHeaders:{},actionHeaders:{}};return C?C(()=>Promise.resolve(V)):V}else if(!E){let _=te(404,{pathname:L.pathname}),{matches:k,route:M}=ut(i),V={basename:a,location:L,matches:k,loaderData:{},actionData:null,errors:{[M.id]:_},statusCode:_.status,loaderHeaders:{},actionHeaders:{}};return C?C(()=>Promise.resolve(V)):V}if(C){I(f instanceof Ne,"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`");try{await Xa(E,r,o);let _,k=await Ga({request:p,unstable_pattern:ct(E.map(M=>M.route.path)),matches:E,params:E[0].params,context:f},async()=>await C(async(V,X={})=>{let z=await u(V,L,E,f,R||null,y===!0,null,"filterMatchesToLoad"in X?X.filterMatchesToLoad??null:g??null,w===!0);return q(z)?z:(_={location:L,basename:a,...z},_)}),async(M,V)=>{if(Zt(M))return M;if(q(M))try{M=new me(M.status,M.statusText,await qn(M))}catch(X){M=X}if(Be(M)&&(M=_l(M)),_){V in _.loaderData&&(_.loaderData[V]=void 0);let X=Yn(i,_,M,y?V:Ce(E,V).route.id);return C(()=>Promise.resolve(X))}else{let X=y?V:Ce(E,E.find(J=>J.route.id===V||J.route.loader)?.route.id||V).route.id,z={matches:E,location:L,basename:a,loaderData:{},actionData:null,errors:{[X]:M},statusCode:re(M)?M.status:500,actionHeaders:{},loaderHeaders:{}};return C(()=>Promise.resolve(z))}});return I(q(k),"Expected a response in query()"),k}catch(_){if(q(_))return _;throw _}}let O=await u(p,L,E,f,R||null,y===!0,null,g||null,w===!0);return q(O)?O:{location:L,basename:a,...O}}async function l(p,{routeId:f,requestContext:g,dataStrategy:y,generateMiddlewareResponse:w}={}){let R=new URL(p.url),C=p.method,P=Ae("",he(R),null,"default"),x=ve(i,P,a);if(g=g??new Ne,!Ar(C)&&C!=="HEAD"&&C!=="OPTIONS")throw te(405,{method:C});if(!x)throw te(404,{pathname:P.pathname});let L=f?x.find(_=>_.route.id===f):dt(x,P);if(f&&!L)throw te(403,{pathname:P.pathname,routeId:f});if(!L)throw te(404,{pathname:P.pathname});if(w)return I(g instanceof Ne,"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`"),await Xa(x,r,o),await Ga({request:p,unstable_pattern:ct(x.map(k=>k.route.path)),matches:x,params:x[0].params,context:g},async()=>await w(async M=>{let V=await u(M,P,x,g,y||null,!1,L,null,!1),X=O(V);return q(X)?X:typeof X=="string"?new Response(X):Response.json(X)}),k=>{if(Be(k))return Promise.resolve(Nr(k));if(q(k))return Promise.resolve(k);throw k});let E=await u(p,P,x,g,y||null,!1,L,null,!1);return O(E);function O(_){if(q(_))return _;let k=_.errors?Object.values(_.errors)[0]:void 0;if(k!==void 0)throw k;if(_.actionData)return Object.values(_.actionData)[0];if(_.loaderData)return Object.values(_.loaderData)[0]}}async function u(p,f,g,y,w,R,C,P,x){I(p.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(de(p.method))return await c(p,g,C||dt(g,f),y,w,R,C!=null,P,x);let L=await d(p,g,y,w,R,C,P);return q(L)?L:{...L,actionData:null,actionHeaders:{}}}catch(L){if(no(L)&&q(L.result)){if(L.type==="error")throw L.result;return L.result}if(Zt(L))return L;throw L}}async function c(p,f,g,y,w,R,C,P,x){let L;if(!g.route.action&&!g.route.lazy){let _=te(405,{method:p.method,pathname:new URL(p.url).pathname,routeId:g.route.id});if(C)throw _;L={type:"error",error:_}}else{let _=ze(o,r,p,f,g,[],y);L=(await m(p,_,C,y,w))[g.route.id],p.signal.aborted&&Ba(p,C)}if(Ue(L))throw new Response(null,{status:L.response.status,headers:{Location:L.response.headers.get("Location")}});if(C){if(ie(L))throw L.error;return{matches:[g],loaderData:{},actionData:{[g.route.id]:L.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{}}}if(x)if(ie(L)){let _=R?g:Ce(f,g.route.id);return{statusCode:re(L.error)?L.error.status:L.statusCode!=null?L.statusCode:500,actionData:null,actionHeaders:{...L.headers?{[g.route.id]:L.headers}:{}},matches:f,loaderData:{},errors:{[_.route.id]:L.error},loaderHeaders:{}}}else return{actionData:{[g.route.id]:L.data},actionHeaders:L.headers?{[g.route.id]:L.headers}:{},matches:f,loaderData:{},errors:null,statusCode:L.statusCode||200,loaderHeaders:{}};let E=new Request(p.url,{headers:p.headers,redirect:p.redirect,signal:p.signal});if(ie(L)){let _=R?g:Ce(f,g.route.id);return{...await d(E,f,y,w,R,null,P,[_.route.id,L]),statusCode:re(L.error)?L.error.status:L.statusCode!=null?L.statusCode:500,actionData:null,actionHeaders:{...L.headers?{[g.route.id]:L.headers}:{}}}}return{...await d(E,f,y,w,R,null,P),actionData:{[g.route.id]:L.data},...L.statusCode?{statusCode:L.statusCode}:{},actionHeaders:L.headers?{[g.route.id]:L.headers}:{}}}async function d(p,f,g,y,w,R,C,P){let x=R!=null;if(x&&!R?.route.loader&&!R?.route.lazy)throw te(400,{method:p.method,pathname:new URL(p.url).pathname,routeId:R?.route.id});let L;if(R)L=ze(o,r,p,f,R,[],g);else{let _=P&&ie(P[1])?f.findIndex(M=>M.route.id===P[0])-1:void 0,k=ct(f.map(M=>M.route.path));L=f.map((M,V)=>_!=null&&V>_?Dt(o,r,p,k,M,[],g,!1):Dt(o,r,p,k,M,[],g,(M.route.loader||M.route.lazy)!=null&&(!C||C(M))))}if(!y&&!L.some(_=>_.shouldLoad))return{matches:f,loaderData:{},errors:P&&ie(P[1])?{[P[0]]:P[1].error}:null,statusCode:200,loaderHeaders:{}};let E=await m(p,L,x,g,y);return p.signal.aborted&&Ba(p,x),{...ro(f,E,P,!0,w),matches:f}}async function m(p,f,g,y,w){let R=await Zn(w||Fr,p,f,null,y,!0),C={};return await Promise.all(f.map(async P=>{if(!(P.route.id in R))return;let x=R[P.route.id];if(oo(x)){let L=x.result;throw to(L,p,P.route.id,f,a)}if(g){if(q(x.result))throw x;if(Be(x.result))throw Nr(x.result)}C[P.route.id]=await eo(x)})),C}return{dataRoutes:i,query:s,queryRoute:l}}function Yn(e,t,r,a){let n=a||t._deepestRenderedBoundaryId||e[0].id;return{...t,statusCode:re(r)?r.status:500,errors:{[n]:r}}}function Ba(e,t){if(e.signal.reason!==void 0)throw e.signal.reason;let r=t?"queryRoute":"query";throw new Error(`${r}() call aborted without an \`AbortSignal.reason\`: ${e.method} ${e.url}`)}function bl(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function kr(e,t,r,a,n,o){let i,s;if(n){i=[];for(let u of t)if(i.push(u),u.route.id===n){s=u;break}}else i=t,s=t[t.length-1];let l=ir(a||".",or(i),ne(e.pathname,r)||e.pathname,o==="path");if(a==null&&(l.search=e.search,l.hash=e.hash),(a==null||a===""||a===".")&&s){let u=Zr(l.search);if(s.route.index&&!u)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&u){let c=new URLSearchParams(l.search),d=c.getAll("index");c.delete("index"),d.filter(p=>p).forEach(p=>c.append("index",p));let m=c.toString();l.search=m?`?${m}`:""}}return r!=="/"&&(l.pathname=nl({basename:r,pathname:l.pathname})),he(l)}function Wa(e,t,r){if(!r||!bl(r))return{path:t};if(r.formMethod&&!Ar(r.formMethod))return{path:t,error:te(405,{method:r.formMethod})};let a=()=>({path:t,error:te(400,{type:"invalid-body"})}),o=(r.formMethod||"get").toUpperCase(),i=ao(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!de(o))return a();let d=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,[p,f])=>`${m}${p}=${f}
1
+ import{r as h,R as ce,a as Ai}from"./index-BsLLCsBP.js";var lt={exports:{}},Na;function $i(){if(Na)return lt.exports;Na=1;var e={decodeValues:!0,map:!1,silent:!1};function t(l){return typeof l!="string"||l in{}}function r(){return Object.create(null)}function a(l){return typeof l=="string"&&!!l.trim()}function n(l,u){var c=l.split(";").filter(a),d=c.shift(),m=o(d),p=m.name,f=m.value;if(u=u?Object.assign({},e,u):e,t(p))return null;try{f=u.decodeValues?decodeURIComponent(f):f}catch(y){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",y)}var g=r();return g.name=p,g.value=f,c.forEach(function(y){var w=y.split("="),R=w.shift().trimLeft().toLowerCase();if(!t(R)){var C=w.join("=");if(R==="expires")g.expires=new Date(C);else if(R==="max-age"){var P=parseInt(C,10);Number.isNaN(P)||(g.maxAge=P)}else R==="secure"?g.secure=!0:R==="httponly"?g.httpOnly=!0:R==="samesite"?g.sameSite=C:R==="partitioned"?g.partitioned=!0:R&&(g[R]=C)}}),g}function o(l){var u="",c="",d=l.split("=");return d.length>1?(u=d.shift(),c=d.join("=")):c=l,{name:u,value:c}}function i(l,u){if(u=u?Object.assign({},e,u):e,!l)return u.map?r():[];if(l.headers)if(typeof l.headers.getSetCookie=="function")l=l.headers.getSetCookie();else if(l.headers["set-cookie"])l=l.headers["set-cookie"];else{var c=l.headers[Object.keys(l.headers).find(function(m){return m.toLowerCase()==="set-cookie"})];!c&&l.headers.cookie&&!u.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),l=c}if(Array.isArray(l)||(l=[l]),u.map){var d=r();return l.filter(a).reduce(function(m,p){var f=n(p,u);return f&&!t(f.name)&&(m[f.name]=f),m},d)}else return l.filter(a).map(function(m){return n(m,u)}).filter(Boolean)}function s(l){if(Array.isArray(l))return l;if(typeof l!="string")return[];var u=[],c=0,d,m,p,f,g;function y(){for(;c<l.length&&/\s/.test(l.charAt(c));)c+=1;return c<l.length}function w(){return m=l.charAt(c),m!=="="&&m!==";"&&m!==","}for(;c<l.length;){for(d=c,g=!1;y();)if(m=l.charAt(c),m===","){for(p=c,c+=1,y(),f=c;c<l.length&&w();)c+=1;c<l.length&&l.charAt(c)==="="?(g=!0,c=f,u.push(l.substring(d,p)),d=c):c=p+1}else c+=1;(!g||c>=l.length)&&u.push(l.substring(d,l.length))}return u}return lt.exports=i,lt.exports.parse=i,lt.exports.parseString=n,lt.exports.splitCookiesString=s,lt.exports}var Ii=$i();var Cn=e=>{throw TypeError(e)},Hi=(e,t,r)=>t.has(e)||Cn("Cannot "+r),Er=(e,t,r)=>(Hi(e,t,"read from private field"),r?r.call(e):t.get(e)),ji=(e,t,r)=>t.has(e)?Cn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ui=(e=>(e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e))(Ui||{}),Aa="popstate";function xn(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((p,f)=>c(p,typeof p=="string"?null:p.state,f===0?"default":void 0));let o=l(r??n.length-1),i="POP",s=null;function l(p){return Math.min(Math.max(p,0),n.length-1)}function u(){return n[o]}function c(p,f=null,g){let y=Ae(n?u().pathname:"/",p,f,g);return K(y.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(p)}`),y}function d(p){return typeof p=="string"?p:he(p)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(p){return new URL(d(p),"http://localhost")},encodeLocation(p){let f=typeof p=="string"?xe(p):p;return{pathname:f.pathname||"",search:f.search||"",hash:f.hash||""}},push(p,f){i="PUSH";let g=c(p,f);o+=1,n.splice(o,n.length,g),a&&s&&s({action:i,location:g,delta:1})},replace(p,f){i="REPLACE";let g=c(p,f);n[o]=g,a&&s&&s({action:i,location:g,delta:0})},go(p){i="POP";let f=l(o+p),g=n[f];o=f,s&&s({action:i,location:g,delta:p})},listen(p){return s=p,()=>{s=null}}}}function Pn(e={}){function t(a,n){let{pathname:o,search:i,hash:s}=a.location;return Ae("",{pathname:o,search:i,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function r(a,n){return typeof n=="string"?n:he(n)}return Dn(t,r,null,e)}function Ln(e={}){function t(n,o){let{pathname:i="/",search:s="",hash:l=""}=xe(n.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),Ae("",{pathname:i,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(n,o){let i=n.document.querySelector("base"),s="";if(i&&i.getAttribute("href")){let l=n.location.href,u=l.indexOf("#");s=u===-1?l:l.slice(0,u)}return s+"#"+(typeof o=="string"?o:he(o))}function a(n,o){K(n.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Dn(t,r,a,e)}function I(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function K(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function zi(){return Math.random().toString(36).substring(2,10)}function $a(e,t){return{usr:e.state,key:e.key,idx:t}}function Ae(e,t,r=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xe(t):t,state:r,key:t&&t.key||a||zi()}}function he({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function xe(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Dn(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,s="POP",l=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){s="POP";let y=c(),w=y==null?null:y-u;u=y,l&&l({action:s,location:g.location,delta:w})}function m(y,w){s="PUSH";let R=Ae(g.location,y,w);r&&r(R,y),u=c()+1;let C=$a(R,u),P=g.createHref(R);try{i.pushState(C,"",P)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;n.location.assign(P)}o&&l&&l({action:s,location:g.location,delta:1})}function p(y,w){s="REPLACE";let R=Ae(g.location,y,w);r&&r(R,y),u=c();let C=$a(R,u),P=g.createHref(R);i.replaceState(C,"",P),o&&l&&l({action:s,location:g.location,delta:0})}function f(y){return Tn(y)}let g={get action(){return s},get location(){return e(n,i)},listen(y){if(l)throw new Error("A history only accepts one active listener");return n.addEventListener(Aa,d),l=y,()=>{n.removeEventListener(Aa,d),l=null}},createHref(y){return t(n,y)},createURL:f,encodeLocation(y){let w=f(y);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:p,go(y){return i.go(y)}};return g}function Tn(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),I(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:he(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function cc(e){return{defaultValue:e}}var xt,Ne=class{constructor(e){if(ji(this,xt,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Er(this,xt).has(e))return Er(this,xt).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Er(this,xt).set(e,t)}};xt=new WeakMap;var Bi=new Set(["lazy","caseSensitive","path","id","index","children"]);function Wi(e){return Bi.has(e)}var Vi=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Yi(e){return Vi.has(e)}function Ji(e){return e.index===!0}function We(e,t,r=[],a={},n=!1){return e.map((o,i)=>{let s=[...r,String(i)],l=typeof o.id=="string"?o.id:s.join("-");if(I(o.index!==!0||!o.children,"Cannot specify children on an index route"),I(n||!a[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),Ji(o)){let u={...o,id:l};return a[l]=Ia(u,t(u)),u}else{let u={...o,id:l,children:void 0};return a[l]=Ia(u,t(u)),o.children&&(u.children=We(o.children,t,s,a,n)),u}})}function Ia(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ve(e,t,r="/"){return Pt(e,t,r,!1)}function Pt(e,t,r,a){let n=typeof t=="string"?xe(t):t,o=ne(n.pathname||"/",r);if(o==null)return null;let i=kn(e);Ki(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let u=Mn(o);s=al(i[l],u,a)}return s}function _n(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function kn(e,t=[],r=[],a="",n=!1){let o=(i,s,l=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&l)return;I(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=_e([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(I(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),kn(i.children,t,m,d,l)),!(i.path==null&&!i.index)&&t.push({path:d,score:tl(d,i.index),routesMeta:m})};return e.forEach((i,s)=>{if(i.path===""||!i.path?.includes("?"))o(i,s);else for(let l of On(i.path))o(i,s,!0,l)}),t}function On(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=On(a.join("/")),s=[];return s.push(...i.map(l=>l===""?o:[o,l].join("/"))),n&&s.push(...i),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function Ki(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:rl(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Xi=/^:[\w-]+$/,Gi=3,Qi=2,Zi=1,qi=10,el=-2,Ha=e=>e==="*";function tl(e,t){let r=e.split("/"),a=r.length;return r.some(Ha)&&(a+=el),t&&(a+=Qi),r.filter(n=>!Ha(n)).reduce((n,o)=>n+(Xi.test(o)?Gi:o===""?Zi:qi),a)}function rl(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function al(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let s=0;s<a.length;++s){let l=a[s],u=s===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d=Lt({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},c),m=l.route;if(!d&&u&&r&&!a[a.length-1].route.index&&(d=Lt({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},c)),!d)return null;Object.assign(n,d.params),i.push({params:n,pathname:_e([o,d.pathname]),pathnameBase:ll(_e([o,d.pathnameBase])),route:m}),d.pathnameBase!=="/"&&(o=_e([o,d.pathnameBase]))}return i}function dc(e,t={}){let r=e;r.endsWith("*")&&r!=="*"&&!r.endsWith("/*")&&(K(!1,`Route path "${r}" will be treated as if it were "${r.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${r.replace(/\*$/,"/*")}".`),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",n=i=>i==null?"":typeof i=="string"?i:String(i),o=r.split(/\/+/).map((i,s,l)=>{if(s===l.length-1&&i==="*")return n(t["*"]);const c=i.match(/^:([\w-]+)(\??)$/);if(c){const[,d,m]=c;let p=t[d];return I(m==="?"||p!=null,`Missing ":${d}" param`),encodeURIComponent(n(p))}return i.replace(/\?$/g,"")}).filter(i=>!!i);return a+o.join("/")}function Lt(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Fn(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let o=n[0],i=o.replace(/(.)\/+$/,"$1"),s=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let f=s[m]||"";i=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const p=s[m];return d&&!p?u[c]=void 0:u[c]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Fn(e,t=!1,r=!0){K(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l)=>(a.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Mn(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return K(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ne(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function nl({basename:e,pathname:t}){return t==="/"?e:_e([e,t])}var ol=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nr=e=>ol.test(e);function il(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?xe(e):e,o;if(r)if(nr(r))o=r;else{if(r.includes("//")){let i=r;r=r.replace(/\/\/+/g,"/"),K(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${r}`)}r.startsWith("/")?o=ja(r.substring(1),"/"):o=ja(r,t)}else o=t;return{pathname:o,search:sl(a),hash:ul(n)}}function ja(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function br(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Nn(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function or(e){let t=Nn(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function ir(e,t,r,a=!1){let n;typeof e=="string"?n=xe(e):(n={...e},I(!n.pathname||!n.pathname.includes("?"),br("?","pathname","search",n)),I(!n.pathname||!n.pathname.includes("#"),br("#","pathname","hash",n)),I(!n.search||!n.search.includes("#"),br("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,s;if(i==null)s=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}s=d>=0?t[d]:"/"}let l=il(n,s),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}var _e=e=>e.join("/").replace(/\/\/+/g,"/"),ll=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),sl=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ul=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,cl=class{constructor(e,t){this.type="DataWithResponseInit",this.data=e,this.init=t||null}};function dl(e,t){return new cl(e,typeof t=="number"?{status:t}:t)}var lr=(e,t=302)=>{let r=t;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let a=new Headers(r.headers);return a.set("Location",e),new Response(null,{...r,headers:a})},fl=(e,t)=>{let r=lr(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},hl=(e,t)=>{let r=lr(e,t);return r.headers.set("X-Remix-Replace","true"),r},me=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function re(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ct(e){return e.filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var je=Symbol("Uninstrumented");function An(e,t){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(n=>n({id:t.id,index:t.index,path:t.path,instrument(o){let i=Object.keys(r);for(let s of i)o[s]&&r[s].push(o[s])}}));let a={};if(typeof t.lazy=="function"&&r.lazy.length>0){let n=tt(r.lazy,t.lazy,()=>{});n&&(a.lazy=n)}if(typeof t.lazy=="object"){let n=t.lazy;["middleware","loader","action"].forEach(o=>{let i=n[o],s=r[`lazy.${o}`];if(typeof i=="function"&&s.length>0){let l=tt(s,i,()=>{});l&&(a.lazy=Object.assign(a.lazy||{},{[o]:l}))}})}return["loader","action"].forEach(n=>{let o=t[n];if(typeof o=="function"&&r[n].length>0){let i=o[je]??o,s=tt(r[n],i,(...l)=>Ua(l[0]));s&&(s[je]=i,a[n]=s)}}),t.middleware&&t.middleware.length>0&&r.middleware.length>0&&(a.middleware=t.middleware.map(n=>{let o=n[je]??n,i=tt(r.middleware,o,(...s)=>Ua(s[0]));return i?(i[je]=o,i):n})),a}function ml(e,t){let r={navigate:[],fetch:[]};if(t.forEach(a=>a({instrument(n){let o=Object.keys(n);for(let i of o)n[i]&&r[i].push(n[i])}})),r.navigate.length>0){let a=e.navigate[je]??e.navigate,n=tt(r.navigate,a,(...o)=>{let[i,s]=o;return{to:typeof i=="number"||typeof i=="string"?i:i?he(i):".",...za(e,s??{})}});n&&(n[je]=a,e.navigate=n)}if(r.fetch.length>0){let a=e.fetch[je]??e.fetch,n=tt(r.fetch,a,(...o)=>{let[i,,s,l]=o;return{href:s??".",fetcherKey:i,...za(e,l??{})}});n&&(n[je]=a,e.fetch=n)}return e}function pl(e,t){let r={request:[]};t.forEach(n=>n({instrument(o){let i=Object.keys(o);for(let s of i)o[s]&&r[s].push(o[s])}}));let a=e;return r.request.length>0&&(a=tt(r.request,e,(...n)=>{let[o,i]=n;return{request:In(o),context:i!=null?Hn(i):i}})),a}function tt(e,t,r){return e.length===0?null:async(...a)=>{let n=await $n(e,r(...a),()=>t(...a),e.length-1);if(n.type==="error")throw n.value;return n.value}}async function $n(e,t,r,a){let n=e[a],o;if(n){let i,s=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=$n(e,t,r,a-1),o=await i,I(o,"Expected a result"),o.type==="error"&&o.value instanceof Error?{status:"error",error:o.value}:{status:"success",error:void 0});try{await n(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}i||await s(),await i}else try{o={type:"success",value:await r()}}catch(i){o={type:"error",value:i}}return o||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Ua(e){let{request:t,context:r,params:a,unstable_pattern:n}=e;return{request:In(t),params:{...a},unstable_pattern:n,context:Hn(r)}}function za(e,t){return{currentUrl:he(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function In(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Hn(e){if(vl(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var yl=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vl(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===yl}var jn=["POST","PUT","PATCH","DELETE"],gl=new Set(jn),wl=["GET",...jn],Rl=new Set(wl),Un=new Set([301,302,303,307,308]),El=new Set([307,308]),Yt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Kr={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},et={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},zn=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Bn="remix-router-transitions",Wn=Symbol("ResetLoaderData");function Xr(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";I(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=e.hydrationRouteProperties||[],n=e.mapRouteProperties||zn,o=n;if(e.unstable_instrumentations){let v=e.unstable_instrumentations;o=b=>({...n(b),...An(v.map(S=>S.route).filter(Boolean),b)})}let i={},s=We(e.routes,o,void 0,i),l,u=e.basename||"/";u.startsWith("/")||(u=`/${u}`);let c=e.dataStrategy||Ll,d={...e.future},m=null,p=new Set,f=null,g=null,y=null,w=e.hydrationData!=null,R=ve(s,e.history.location,u),C=!1,P=null,x;if(R==null&&!e.patchRoutesOnNavigation){let v=te(404,{pathname:e.history.location.pathname}),{matches:b,route:S}=ut(s);x=!0,R=b,P={[S.id]:v}}else if(R&&!e.hydrationData&&At(R,s,e.history.location.pathname).active&&(R=null),R)if(R.some(v=>v.route.lazy))x=!1;else if(!R.some(v=>Gr(v.route)))x=!0;else{let v=e.hydrationData?e.hydrationData.loaderData:null,b=e.hydrationData?e.hydrationData.errors:null;if(b){let S=R.findIndex(D=>b[D.route.id]!==void 0);x=R.slice(0,S+1).every(D=>!Or(D.route,v,b))}else x=R.every(S=>!Or(S.route,v,b))}else{x=!1,R=[];let v=At(null,s,e.history.location.pathname);v.active&&v.matches&&(C=!0,R=v.matches)}let L,E={historyAction:e.history.action,location:e.history.location,matches:R,initialized:x,navigation:Yt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||P,fetchers:new Map,blockers:new Map},O="POP",_=!1,k,M=!1,V=new Map,X=null,z=!1,J=!1,le=new Set,Y=new Map,Ee=0,pe=-1,Pe=new Map,ye=new Set,be=new Map,Le=new Map,De=new Set,Je=new Map,Mt,gt=null;function gi(){if(m=e.history.listen(({action:v,location:b,delta:S})=>{if(Mt){Mt(),Mt=void 0;return}K(Je.size===0||S!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let D=_a({currentLocation:E.location,nextLocation:b,historyAction:v});if(D&&S!=null){let T=new Promise(N=>{Mt=N});e.history.go(S*-1),Nt(D,{state:"blocked",location:b,proceed(){Nt(D,{state:"proceeding",proceed:void 0,reset:void 0,location:b}),T.then(()=>e.history.go(S))},reset(){let N=new Map(E.blockers);N.set(D,et),se({blockers:N})}});return}return Ke(v,b)}),r){Ml(t,V);let v=()=>Nl(t,V);t.addEventListener("pagehide",v),X=()=>t.removeEventListener("pagehide",v)}return E.initialized||Ke("POP",E.location,{initialHydration:!0}),L}function wi(){m&&m(),X&&X(),p.clear(),k&&k.abort(),E.fetchers.forEach((v,b)=>gr(b)),E.blockers.forEach((v,b)=>Ta(b))}function Ri(v){return p.add(v),()=>p.delete(v)}function se(v,b={}){v.matches&&(v.matches=v.matches.map(T=>{let N=i[T.route.id],A=T.route;return A.element!==N.element||A.errorElement!==N.errorElement||A.hydrateFallbackElement!==N.hydrateFallbackElement?{...T,route:N}:T})),E={...E,...v};let S=[],D=[];E.fetchers.forEach((T,N)=>{T.state==="idle"&&(De.has(N)?S.push(N):D.push(N))}),De.forEach(T=>{!E.fetchers.has(T)&&!Y.has(T)&&S.push(T)}),[...p].forEach(T=>T(E,{deletedFetchers:S,viewTransitionOpts:b.viewTransitionOpts,flushSync:b.flushSync===!0})),S.forEach(T=>gr(T)),D.forEach(T=>E.fetchers.delete(T))}function ot(v,b,{flushSync:S}={}){let D=E.actionData!=null&&E.navigation.formMethod!=null&&de(E.navigation.formMethod)&&E.navigation.state==="loading"&&v.state?._isRedirect!==!0,T;b.actionData?Object.keys(b.actionData).length>0?T=b.actionData:T=null:D?T=E.actionData:T=null;let N=b.loaderData?en(E.loaderData,b.loaderData,b.matches||[],b.errors):E.loaderData,A=E.blockers;A.size>0&&(A=new Map(A),A.forEach((H,j)=>A.set(j,et)));let F=z?!1:Oa(v,b.matches||E.matches),$=_===!0||E.navigation.formMethod!=null&&de(E.navigation.formMethod)&&v.state?._isRedirect!==!0;l&&(s=l,l=void 0),z||O==="POP"||(O==="PUSH"?e.history.push(v,v.state):O==="REPLACE"&&e.history.replace(v,v.state));let U;if(O==="POP"){let H=V.get(E.location.pathname);H&&H.has(v.pathname)?U={currentLocation:E.location,nextLocation:v}:V.has(v.pathname)&&(U={currentLocation:v,nextLocation:E.location})}else if(M){let H=V.get(E.location.pathname);H?H.add(v.pathname):(H=new Set([v.pathname]),V.set(E.location.pathname,H)),U={currentLocation:E.location,nextLocation:v}}se({...b,actionData:T,loaderData:N,historyAction:O,location:v,initialized:!0,navigation:Yt,revalidation:"idle",restoreScrollPosition:F,preventScrollReset:$,blockers:A},{viewTransitionOpts:U,flushSync:S===!0}),O="POP",_=!1,M=!1,z=!1,J=!1,gt?.resolve(),gt=null}async function ba(v,b){if(typeof v=="number"){e.history.go(v);return}let S=kr(E.location,E.matches,u,v,b?.fromRouteId,b?.relative),{path:D,submission:T,error:N}=Wa(!1,S,b),A=E.location,F=Ae(E.location,D,b&&b.state);F={...F,...e.history.encodeLocation(F)};let $=b&&b.replace!=null?b.replace:void 0,U="PUSH";$===!0?U="REPLACE":$===!1||T!=null&&de(T.formMethod)&&T.formAction===E.location.pathname+E.location.search&&(U="REPLACE");let H=b&&"preventScrollReset"in b?b.preventScrollReset===!0:void 0,j=(b&&b.flushSync)===!0,B=_a({currentLocation:A,nextLocation:F,historyAction:U});if(B){Nt(B,{state:"blocked",location:F,proceed(){Nt(B,{state:"proceeding",proceed:void 0,reset:void 0,location:F}),ba(v,b)},reset(){let Z=new Map(E.blockers);Z.set(B,et),se({blockers:Z})}});return}await Ke(U,F,{submission:T,pendingError:N,preventScrollReset:H,replace:b&&b.replace,enableViewTransition:b&&b.viewTransition,flushSync:j})}function Ei(){gt||(gt=Al()),vr(),se({revalidation:"loading"});let v=gt.promise;return E.navigation.state==="submitting"?v:E.navigation.state==="idle"?(Ke(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),v):(Ke(O||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:M===!0}),v)}async function Ke(v,b,S){k&&k.abort(),k=null,O=v,z=(S&&S.startUninterruptedRevalidation)===!0,Oi(E.location,E.matches),_=(S&&S.preventScrollReset)===!0,M=(S&&S.enableViewTransition)===!0;let D=l||s,T=S&&S.overrideNavigation,N=S?.initialHydration&&E.matches&&E.matches.length>0&&!C?E.matches:ve(D,b,u),A=(S&&S.flushSync)===!0;if(N&&E.initialized&&!J&&Tl(E.location,b)&&!(S&&S.submission&&de(S.submission.formMethod))){ot(b,{matches:N},{flushSync:A});return}let F=At(N,D,b.pathname);if(F.active&&F.matches&&(N=F.matches),!N){let{error:oe,notFoundMatches:G,route:Q}=wr(b.pathname);ot(b,{matches:G,loaderData:{},errors:{[Q.id]:oe}},{flushSync:A});return}k=new AbortController;let $=st(e.history,b,k.signal,S&&S.submission),U=e.getContext?await e.getContext():new Ne,H;if(S&&S.pendingError)H=[Ce(N).route.id,{type:"error",error:S.pendingError}];else if(S&&S.submission&&de(S.submission.formMethod)){let oe=await bi($,b,S.submission,N,U,F.active,S&&S.initialHydration===!0,{replace:S.replace,flushSync:A});if(oe.shortCircuited)return;if(oe.pendingActionResult){let[G,Q]=oe.pendingActionResult;if(ie(Q)&&re(Q.error)&&Q.error.status===404){k=null,ot(b,{matches:oe.matches,loaderData:{},errors:{[G]:Q.error}});return}}N=oe.matches||N,H=oe.pendingActionResult,T=Sr(b,S.submission),A=!1,F.active=!1,$=st(e.history,$.url,$.signal)}let{shortCircuited:j,matches:B,loaderData:Z,errors:ae}=await Si($,b,N,U,F.active,T,S&&S.submission,S&&S.fetcherSubmission,S&&S.replace,S&&S.initialHydration===!0,A,H);j||(k=null,ot(b,{matches:B||N,...tn(H),loaderData:Z,errors:ae}))}async function bi(v,b,S,D,T,N,A,F={}){vr();let $=Ol(b,S);if(se({navigation:$},{flushSync:F.flushSync===!0}),N){let j=await $t(D,b.pathname,v.signal);if(j.type==="aborted")return{shortCircuited:!0};if(j.type==="error"){if(j.partialMatches.length===0){let{matches:Z,route:ae}=ut(s);return{matches:Z,pendingActionResult:[ae.id,{type:"error",error:j.error}]}}let B=Ce(j.partialMatches).route.id;return{matches:j.partialMatches,pendingActionResult:[B,{type:"error",error:j.error}]}}else if(j.matches)D=j.matches;else{let{notFoundMatches:B,error:Z,route:ae}=wr(b.pathname);return{matches:B,pendingActionResult:[ae.id,{type:"error",error:Z}]}}}let U,H=dt(D,b);if(!H.route.action&&!H.route.lazy)U={type:"error",error:te(405,{method:v.method,pathname:b.pathname,routeId:H.route.id})};else{let j=ze(o,i,v,D,H,A?[]:a,T),B=await wt(v,j,T,null);if(U=B[H.route.id],!U){for(let Z of D)if(B[Z.route.id]){U=B[Z.route.id];break}}if(v.signal.aborted)return{shortCircuited:!0}}if(Ue(U)){let j;return F&&F.replace!=null?j=F.replace:j=Qa(U.response.headers.get("Location"),new URL(v.url),u)===E.location.pathname+E.location.search,await Xe(v,U,!0,{submission:S,replace:j}),{shortCircuited:!0}}if(ie(U)){let j=Ce(D,H.route.id);return(F&&F.replace)!==!0&&(O="PUSH"),{matches:D,pendingActionResult:[j.route.id,U,H.route.id]}}return{matches:D,pendingActionResult:[H.route.id,U]}}async function Si(v,b,S,D,T,N,A,F,$,U,H,j){let B=N||Sr(b,A),Z=A||F||rn(B),ae=!z&&!U;if(T){if(ae){let ue=Sa(j);se({navigation:B,...ue!==void 0?{actionData:ue}:{}},{flushSync:H})}let W=await $t(S,b.pathname,v.signal);if(W.type==="aborted")return{shortCircuited:!0};if(W.type==="error"){if(W.partialMatches.length===0){let{matches:it,route:Ze}=ut(s);return{matches:it,loaderData:{},errors:{[Ze.id]:W.error}}}let ue=Ce(W.partialMatches).route.id;return{matches:W.partialMatches,loaderData:{},errors:{[ue]:W.error}}}else if(W.matches)S=W.matches;else{let{error:ue,notFoundMatches:it,route:Ze}=wr(b.pathname);return{matches:it,loaderData:{},errors:{[Ze.id]:ue}}}}let oe=l||s,{dsMatches:G,revalidatingFetchers:Q}=Va(v,D,o,i,e.history,E,S,Z,b,U?[]:a,U===!0,J,le,De,be,ye,oe,u,e.patchRoutesOnNavigation!=null,j);if(pe=++Ee,!e.dataStrategy&&!G.some(W=>W.shouldLoad)&&!G.some(W=>W.route.middleware&&W.route.middleware.length>0)&&Q.length===0){let W=La();return ot(b,{matches:S,loaderData:{},errors:j&&ie(j[1])?{[j[0]]:j[1].error}:null,...tn(j),...W?{fetchers:new Map(E.fetchers)}:{}},{flushSync:H}),{shortCircuited:!0}}if(ae){let W={};if(!T){W.navigation=B;let ue=Sa(j);ue!==void 0&&(W.actionData=ue)}Q.length>0&&(W.fetchers=Ci(Q)),se(W,{flushSync:H})}Q.forEach(W=>{Fe(W.key),W.controller&&Y.set(W.key,W.controller)});let Ge=()=>Q.forEach(W=>Fe(W.key));k&&k.signal.addEventListener("abort",Ge);let{loaderResults:Rt,fetcherResults:He}=await Ca(G,Q,v,D);if(v.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",Ge),Q.forEach(W=>Y.delete(W.key));let Te=Ut(Rt);if(Te)return await Xe(v,Te.result,!0,{replace:$}),{shortCircuited:!0};if(Te=Ut(He),Te)return ye.add(Te.key),await Xe(v,Te.result,!0,{replace:$}),{shortCircuited:!0};let{loaderData:Rr,errors:Et}=qa(E,S,Rt,j,Q,He);U&&E.errors&&(Et={...E.errors,...Et});let Qe=La(),It=Da(pe),Ht=Qe||It||Q.length>0;return{matches:S,loaderData:Rr,errors:Et,...Ht?{fetchers:new Map(E.fetchers)}:{}}}function Sa(v){if(v&&!ie(v[1]))return{[v[0]]:v[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function Ci(v){return v.forEach(b=>{let S=E.fetchers.get(b.key),D=bt(void 0,S?S.data:void 0);E.fetchers.set(b.key,D)}),new Map(E.fetchers)}async function xi(v,b,S,D){Fe(v);let T=(D&&D.flushSync)===!0,N=l||s,A=kr(E.location,E.matches,u,S,b,D?.relative),F=ve(N,A,u),$=At(F,N,A);if($.active&&$.matches&&(F=$.matches),!F){Oe(v,b,te(404,{pathname:A}),{flushSync:T});return}let{path:U,submission:H,error:j}=Wa(!0,A,D);if(j){Oe(v,b,j,{flushSync:T});return}let B=e.getContext?await e.getContext():new Ne,Z=(D&&D.preventScrollReset)===!0;if(H&&de(H.formMethod)){await Pi(v,b,U,F,B,$.active,T,Z,H);return}be.set(v,{routeId:b,path:U}),await Li(v,b,U,F,B,$.active,T,Z,H)}async function Pi(v,b,S,D,T,N,A,F,$){vr(),be.delete(v);let U=E.fetchers.get(v);ke(v,Fl($,U),{flushSync:A});let H=new AbortController,j=st(e.history,S,H.signal,$);if(N){let ee=await $t(D,new URL(j.url).pathname,j.signal,v);if(ee.type==="aborted")return;if(ee.type==="error"){Oe(v,b,ee.error,{flushSync:A});return}else if(ee.matches)D=ee.matches;else{Oe(v,b,te(404,{pathname:S}),{flushSync:A});return}}let B=dt(D,S);if(!B.route.action&&!B.route.lazy){let ee=te(405,{method:$.formMethod,pathname:S,routeId:b});Oe(v,b,ee,{flushSync:A});return}Y.set(v,H);let Z=Ee,ae=ze(o,i,j,D,B,a,T),oe=await wt(j,ae,T,v),G=oe[B.route.id];if(!G){for(let ee of ae)if(oe[ee.route.id]){G=oe[ee.route.id];break}}if(j.signal.aborted){Y.get(v)===H&&Y.delete(v);return}if(De.has(v)){if(Ue(G)||ie(G)){ke(v,Me(void 0));return}}else{if(Ue(G))if(Y.delete(v),pe>Z){ke(v,Me(void 0));return}else return ye.add(v),ke(v,bt($)),Xe(j,G,!1,{fetcherSubmission:$,preventScrollReset:F});if(ie(G)){Oe(v,b,G.error);return}}let Q=E.navigation.location||E.location,Ge=st(e.history,Q,H.signal),Rt=l||s,He=E.navigation.state!=="idle"?ve(Rt,E.navigation.location,u):E.matches;I(He,"Didn't find any matches after fetcher action");let Te=++Ee;Pe.set(v,Te);let Rr=bt($,G.data);E.fetchers.set(v,Rr);let{dsMatches:Et,revalidatingFetchers:Qe}=Va(Ge,T,o,i,e.history,E,He,$,Q,a,!1,J,le,De,be,ye,Rt,u,e.patchRoutesOnNavigation!=null,[B.route.id,G]);Qe.filter(ee=>ee.key!==v).forEach(ee=>{let jt=ee.key,Ma=E.fetchers.get(jt),Ni=bt(void 0,Ma?Ma.data:void 0);E.fetchers.set(jt,Ni),Fe(jt),ee.controller&&Y.set(jt,ee.controller)}),se({fetchers:new Map(E.fetchers)});let It=()=>Qe.forEach(ee=>Fe(ee.key));H.signal.addEventListener("abort",It);let{loaderResults:Ht,fetcherResults:W}=await Ca(Et,Qe,Ge,T);if(H.signal.aborted)return;if(H.signal.removeEventListener("abort",It),Pe.delete(v),Y.delete(v),Qe.forEach(ee=>Y.delete(ee.key)),E.fetchers.has(v)){let ee=Me(G.data);E.fetchers.set(v,ee)}let ue=Ut(Ht);if(ue)return Xe(Ge,ue.result,!1,{preventScrollReset:F});if(ue=Ut(W),ue)return ye.add(ue.key),Xe(Ge,ue.result,!1,{preventScrollReset:F});let{loaderData:it,errors:Ze}=qa(E,He,Ht,void 0,Qe,W);Da(Te),E.navigation.state==="loading"&&Te>pe?(I(O,"Expected pending action"),k&&k.abort(),ot(E.navigation.location,{matches:He,loaderData:it,errors:Ze,fetchers:new Map(E.fetchers)})):(se({errors:Ze,loaderData:en(E.loaderData,it,He,Ze),fetchers:new Map(E.fetchers)}),J=!1)}async function Li(v,b,S,D,T,N,A,F,$){let U=E.fetchers.get(v);ke(v,bt($,U?U.data:void 0),{flushSync:A});let H=new AbortController,j=st(e.history,S,H.signal);if(N){let Q=await $t(D,new URL(j.url).pathname,j.signal,v);if(Q.type==="aborted")return;if(Q.type==="error"){Oe(v,b,Q.error,{flushSync:A});return}else if(Q.matches)D=Q.matches;else{Oe(v,b,te(404,{pathname:S}),{flushSync:A});return}}let B=dt(D,S);Y.set(v,H);let Z=Ee,ae=ze(o,i,j,D,B,a,T),G=(await wt(j,ae,T,v))[B.route.id];if(Y.get(v)===H&&Y.delete(v),!j.signal.aborted){if(De.has(v)){ke(v,Me(void 0));return}if(Ue(G))if(pe>Z){ke(v,Me(void 0));return}else{ye.add(v),await Xe(j,G,!1,{preventScrollReset:F});return}if(ie(G)){Oe(v,b,G.error);return}ke(v,Me(G.data))}}async function Xe(v,b,S,{submission:D,fetcherSubmission:T,preventScrollReset:N,replace:A}={}){b.response.headers.has("X-Remix-Revalidate")&&(J=!0);let F=b.response.headers.get("Location");I(F,"Expected a Location header on the redirect Response"),F=Qa(F,new URL(v.url),u);let $=Ae(E.location,F,{_isRedirect:!0});if(r){let ae=!1;if(b.response.headers.has("X-Remix-Reload-Document"))ae=!0;else if(nr(F)){const oe=Tn(F,!0);ae=oe.origin!==t.location.origin||ne(oe.pathname,u)==null}if(ae){A?t.location.replace(F):t.location.assign(F);return}}k=null;let U=A===!0||b.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:H,formAction:j,formEncType:B}=E.navigation;!D&&!T&&H&&j&&B&&(D=rn(E.navigation));let Z=D||T;if(El.has(b.response.status)&&Z&&de(Z.formMethod))await Ke(U,$,{submission:{...Z,formAction:F},preventScrollReset:N||_,enableViewTransition:S?M:void 0});else{let ae=Sr($,D);await Ke(U,$,{overrideNavigation:ae,fetcherSubmission:T,preventScrollReset:N||_,enableViewTransition:S?M:void 0})}}async function wt(v,b,S,D){let T,N={};try{T=await Zn(c,v,b,D,S,!1)}catch(A){return b.filter(F=>F.shouldLoad).forEach(F=>{N[F.route.id]={type:"error",error:A}}),N}if(v.signal.aborted)return N;for(let[A,F]of Object.entries(T))if(oo(F)){let $=F.result;N[A]={type:"redirect",response:to($,v,A,b,u)}}else N[A]=await eo(F);return N}async function Ca(v,b,S,D){let T=wt(S,v,D,null),N=Promise.all(b.map(async $=>{if($.matches&&$.match&&$.request&&$.controller){let H=(await wt($.request,$.matches,D,$.key))[$.match.route.id];return{[$.key]:H}}else return Promise.resolve({[$.key]:{type:"error",error:te(404,{pathname:$.path})}})})),A=await T,F=(await N).reduce(($,U)=>Object.assign($,U),{});return{loaderResults:A,fetcherResults:F}}function vr(){J=!0,be.forEach((v,b)=>{Y.has(b)&&le.add(b),Fe(b)})}function ke(v,b,S={}){E.fetchers.set(v,b),se({fetchers:new Map(E.fetchers)},{flushSync:(S&&S.flushSync)===!0})}function Oe(v,b,S,D={}){let T=Ce(E.matches,b);gr(v),se({errors:{[T.route.id]:S},fetchers:new Map(E.fetchers)},{flushSync:(D&&D.flushSync)===!0})}function xa(v){return Le.set(v,(Le.get(v)||0)+1),De.has(v)&&De.delete(v),E.fetchers.get(v)||Kr}function Di(v,b){Fe(v,b?.reason),ke(v,Me(null))}function gr(v){let b=E.fetchers.get(v);Y.has(v)&&!(b&&b.state==="loading"&&Pe.has(v))&&Fe(v),be.delete(v),Pe.delete(v),ye.delete(v),De.delete(v),le.delete(v),E.fetchers.delete(v)}function Ti(v){let b=(Le.get(v)||0)-1;b<=0?(Le.delete(v),De.add(v)):Le.set(v,b),se({fetchers:new Map(E.fetchers)})}function Fe(v,b){let S=Y.get(v);S&&(S.abort(b),Y.delete(v))}function Pa(v){for(let b of v){let S=xa(b),D=Me(S.data);E.fetchers.set(b,D)}}function La(){let v=[],b=!1;for(let S of ye){let D=E.fetchers.get(S);I(D,`Expected fetcher: ${S}`),D.state==="loading"&&(ye.delete(S),v.push(S),b=!0)}return Pa(v),b}function Da(v){let b=[];for(let[S,D]of Pe)if(D<v){let T=E.fetchers.get(S);I(T,`Expected fetcher: ${S}`),T.state==="loading"&&(Fe(S),Pe.delete(S),b.push(S))}return Pa(b),b.length>0}function _i(v,b){let S=E.blockers.get(v)||et;return Je.get(v)!==b&&Je.set(v,b),S}function Ta(v){E.blockers.delete(v),Je.delete(v)}function Nt(v,b){let S=E.blockers.get(v)||et;I(S.state==="unblocked"&&b.state==="blocked"||S.state==="blocked"&&b.state==="blocked"||S.state==="blocked"&&b.state==="proceeding"||S.state==="blocked"&&b.state==="unblocked"||S.state==="proceeding"&&b.state==="unblocked",`Invalid blocker state transition: ${S.state} -> ${b.state}`);let D=new Map(E.blockers);D.set(v,b),se({blockers:D})}function _a({currentLocation:v,nextLocation:b,historyAction:S}){if(Je.size===0)return;Je.size>1&&K(!1,"A router only supports one blocker at a time");let D=Array.from(Je.entries()),[T,N]=D[D.length-1],A=E.blockers.get(T);if(!(A&&A.state==="proceeding")&&N({currentLocation:v,nextLocation:b,historyAction:S}))return T}function wr(v){let b=te(404,{pathname:v}),S=l||s,{matches:D,route:T}=ut(S);return{notFoundMatches:D,route:T,error:b}}function ki(v,b,S){if(f=v,y=b,g=S||null,!w&&E.navigation===Yt){w=!0;let D=Oa(E.location,E.matches);D!=null&&se({restoreScrollPosition:D})}return()=>{f=null,y=null,g=null}}function ka(v,b){return g&&g(v,b.map(D=>_n(D,E.loaderData)))||v.key}function Oi(v,b){if(f&&y){let S=ka(v,b);f[S]=y()}}function Oa(v,b){if(f){let S=ka(v,b),D=f[S];if(typeof D=="number")return D}return null}function At(v,b,S){if(e.patchRoutesOnNavigation)if(v){if(Object.keys(v[0].params).length>0)return{active:!0,matches:Pt(b,S,u,!0)}}else return{active:!0,matches:Pt(b,S,u,!0)||[]};return{active:!1,matches:null}}async function $t(v,b,S,D){if(!e.patchRoutesOnNavigation)return{type:"success",matches:v};let T=v;for(;;){let N=l==null,A=l||s,F=i;try{await e.patchRoutesOnNavigation({signal:S,path:b,matches:T,fetcherKey:D,patch:(H,j)=>{S.aborted||Ya(H,j,A,F,o,!1)}})}catch(H){return{type:"error",error:H,partialMatches:T}}finally{N&&!S.aborted&&(s=[...s])}if(S.aborted)return{type:"aborted"};let $=ve(A,b,u),U=null;if($){if(Object.keys($[0].params).length===0)return{type:"success",matches:$};if(U=Pt(A,b,u,!0),!(U&&T.length<U.length&&Fa(T,U.slice(0,T.length))))return{type:"success",matches:$}}if(U||(U=Pt(A,b,u,!0)),!U||Fa(T,U))return{type:"success",matches:null};T=U}}function Fa(v,b){return v.length===b.length&&v.every((S,D)=>S.route.id===b[D].route.id)}function Fi(v){i={},l=We(v,o,void 0,i)}function Mi(v,b,S=!1){let D=l==null;Ya(v,b,l||s,i,o,S),D&&(s=[...s],se({}))}return L={get basename(){return u},get future(){return d},get state(){return E},get routes(){return s},get window(){return t},initialize:gi,subscribe:Ri,enableScrollRestoration:ki,navigate:ba,fetch:xi,revalidate:Ei,createHref:v=>e.history.createHref(v),encodeLocation:v=>e.history.encodeLocation(v),getFetcher:xa,resetFetcher:Di,deleteFetcher:Ti,dispose:wi,getBlocker:_i,deleteBlocker:Ta,patchRoutes:Mi,_internalFetchControllers:Y,_internalSetRoutes:Fi,_internalSetStateDoNotUseOrYouWillBreakYourApp(v){se(v)}},e.unstable_instrumentations&&(L=ml(L,e.unstable_instrumentations.map(v=>v.router).filter(Boolean))),L}function Vn(e,t){I(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let r={},a=(t?t.basename:null)||"/",n=t?.mapRouteProperties||zn,o=n;if(t?.unstable_instrumentations){let p=t.unstable_instrumentations;o=f=>({...n(f),...An(p.map(g=>g.route).filter(Boolean),f)})}let i=We(e,o,void 0,r);async function s(p,{requestContext:f,filterMatchesToLoad:g,skipLoaderErrorBubbling:y,skipRevalidation:w,dataStrategy:R,generateMiddlewareResponse:C}={}){let P=new URL(p.url),x=p.method,L=Ae("",he(P),null,"default"),E=ve(i,L,a);if(f=f??new Ne,!Ar(x)&&x!=="HEAD"){let _=te(405,{method:x}),{matches:k,route:M}=ut(i),V={basename:a,location:L,matches:k,loaderData:{},actionData:null,errors:{[M.id]:_},statusCode:_.status,loaderHeaders:{},actionHeaders:{}};return C?C(()=>Promise.resolve(V)):V}else if(!E){let _=te(404,{pathname:L.pathname}),{matches:k,route:M}=ut(i),V={basename:a,location:L,matches:k,loaderData:{},actionData:null,errors:{[M.id]:_},statusCode:_.status,loaderHeaders:{},actionHeaders:{}};return C?C(()=>Promise.resolve(V)):V}if(C){I(f instanceof Ne,"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`");try{await Xa(E,r,o);let _,k=await Ga({request:p,unstable_pattern:ct(E.map(M=>M.route.path)),matches:E,params:E[0].params,context:f},async()=>await C(async(V,X={})=>{let z=await u(V,L,E,f,R||null,y===!0,null,"filterMatchesToLoad"in X?X.filterMatchesToLoad??null:g??null,w===!0);return q(z)?z:(_={location:L,basename:a,...z},_)}),async(M,V)=>{if(Zt(M))return M;if(q(M))try{M=new me(M.status,M.statusText,await qn(M))}catch(X){M=X}if(Be(M)&&(M=_l(M)),_){V in _.loaderData&&(_.loaderData[V]=void 0);let X=Yn(i,_,M,y?V:Ce(E,V).route.id);return C(()=>Promise.resolve(X))}else{let X=y?V:Ce(E,E.find(J=>J.route.id===V||J.route.loader)?.route.id||V).route.id,z={matches:E,location:L,basename:a,loaderData:{},actionData:null,errors:{[X]:M},statusCode:re(M)?M.status:500,actionHeaders:{},loaderHeaders:{}};return C(()=>Promise.resolve(z))}});return I(q(k),"Expected a response in query()"),k}catch(_){if(q(_))return _;throw _}}let O=await u(p,L,E,f,R||null,y===!0,null,g||null,w===!0);return q(O)?O:{location:L,basename:a,...O}}async function l(p,{routeId:f,requestContext:g,dataStrategy:y,generateMiddlewareResponse:w}={}){let R=new URL(p.url),C=p.method,P=Ae("",he(R),null,"default"),x=ve(i,P,a);if(g=g??new Ne,!Ar(C)&&C!=="HEAD"&&C!=="OPTIONS")throw te(405,{method:C});if(!x)throw te(404,{pathname:P.pathname});let L=f?x.find(_=>_.route.id===f):dt(x,P);if(f&&!L)throw te(403,{pathname:P.pathname,routeId:f});if(!L)throw te(404,{pathname:P.pathname});if(w)return I(g instanceof Ne,"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`"),await Xa(x,r,o),await Ga({request:p,unstable_pattern:ct(x.map(k=>k.route.path)),matches:x,params:x[0].params,context:g},async()=>await w(async M=>{let V=await u(M,P,x,g,y||null,!1,L,null,!1),X=O(V);return q(X)?X:typeof X=="string"?new Response(X):Response.json(X)}),k=>{if(Be(k))return Promise.resolve(Nr(k));if(q(k))return Promise.resolve(k);throw k});let E=await u(p,P,x,g,y||null,!1,L,null,!1);return O(E);function O(_){if(q(_))return _;let k=_.errors?Object.values(_.errors)[0]:void 0;if(k!==void 0)throw k;if(_.actionData)return Object.values(_.actionData)[0];if(_.loaderData)return Object.values(_.loaderData)[0]}}async function u(p,f,g,y,w,R,C,P,x){I(p.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(de(p.method))return await c(p,g,C||dt(g,f),y,w,R,C!=null,P,x);let L=await d(p,g,y,w,R,C,P);return q(L)?L:{...L,actionData:null,actionHeaders:{}}}catch(L){if(no(L)&&q(L.result)){if(L.type==="error")throw L.result;return L.result}if(Zt(L))return L;throw L}}async function c(p,f,g,y,w,R,C,P,x){let L;if(!g.route.action&&!g.route.lazy){let _=te(405,{method:p.method,pathname:new URL(p.url).pathname,routeId:g.route.id});if(C)throw _;L={type:"error",error:_}}else{let _=ze(o,r,p,f,g,[],y);L=(await m(p,_,C,y,w))[g.route.id],p.signal.aborted&&Ba(p,C)}if(Ue(L))throw new Response(null,{status:L.response.status,headers:{Location:L.response.headers.get("Location")}});if(C){if(ie(L))throw L.error;return{matches:[g],loaderData:{},actionData:{[g.route.id]:L.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{}}}if(x)if(ie(L)){let _=R?g:Ce(f,g.route.id);return{statusCode:re(L.error)?L.error.status:L.statusCode!=null?L.statusCode:500,actionData:null,actionHeaders:{...L.headers?{[g.route.id]:L.headers}:{}},matches:f,loaderData:{},errors:{[_.route.id]:L.error},loaderHeaders:{}}}else return{actionData:{[g.route.id]:L.data},actionHeaders:L.headers?{[g.route.id]:L.headers}:{},matches:f,loaderData:{},errors:null,statusCode:L.statusCode||200,loaderHeaders:{}};let E=new Request(p.url,{headers:p.headers,redirect:p.redirect,signal:p.signal});if(ie(L)){let _=R?g:Ce(f,g.route.id);return{...await d(E,f,y,w,R,null,P,[_.route.id,L]),statusCode:re(L.error)?L.error.status:L.statusCode!=null?L.statusCode:500,actionData:null,actionHeaders:{...L.headers?{[g.route.id]:L.headers}:{}}}}return{...await d(E,f,y,w,R,null,P),actionData:{[g.route.id]:L.data},...L.statusCode?{statusCode:L.statusCode}:{},actionHeaders:L.headers?{[g.route.id]:L.headers}:{}}}async function d(p,f,g,y,w,R,C,P){let x=R!=null;if(x&&!R?.route.loader&&!R?.route.lazy)throw te(400,{method:p.method,pathname:new URL(p.url).pathname,routeId:R?.route.id});let L;if(R)L=ze(o,r,p,f,R,[],g);else{let _=P&&ie(P[1])?f.findIndex(M=>M.route.id===P[0])-1:void 0,k=ct(f.map(M=>M.route.path));L=f.map((M,V)=>_!=null&&V>_?Dt(o,r,p,k,M,[],g,!1):Dt(o,r,p,k,M,[],g,(M.route.loader||M.route.lazy)!=null&&(!C||C(M))))}if(!y&&!L.some(_=>_.shouldLoad))return{matches:f,loaderData:{},errors:P&&ie(P[1])?{[P[0]]:P[1].error}:null,statusCode:200,loaderHeaders:{}};let E=await m(p,L,x,g,y);return p.signal.aborted&&Ba(p,x),{...ro(f,E,P,!0,w),matches:f}}async function m(p,f,g,y,w){let R=await Zn(w||Fr,p,f,null,y,!0),C={};return await Promise.all(f.map(async P=>{if(!(P.route.id in R))return;let x=R[P.route.id];if(oo(x)){let L=x.result;throw to(L,p,P.route.id,f,a)}if(g){if(q(x.result))throw x;if(Be(x.result))throw Nr(x.result)}C[P.route.id]=await eo(x)})),C}return{dataRoutes:i,query:s,queryRoute:l}}function Yn(e,t,r,a){let n=a||t._deepestRenderedBoundaryId||e[0].id;return{...t,statusCode:re(r)?r.status:500,errors:{[n]:r}}}function Ba(e,t){if(e.signal.reason!==void 0)throw e.signal.reason;let r=t?"queryRoute":"query";throw new Error(`${r}() call aborted without an \`AbortSignal.reason\`: ${e.method} ${e.url}`)}function bl(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function kr(e,t,r,a,n,o){let i,s;if(n){i=[];for(let u of t)if(i.push(u),u.route.id===n){s=u;break}}else i=t,s=t[t.length-1];let l=ir(a||".",or(i),ne(e.pathname,r)||e.pathname,o==="path");if(a==null&&(l.search=e.search,l.hash=e.hash),(a==null||a===""||a===".")&&s){let u=Zr(l.search);if(s.route.index&&!u)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&u){let c=new URLSearchParams(l.search),d=c.getAll("index");c.delete("index"),d.filter(p=>p).forEach(p=>c.append("index",p));let m=c.toString();l.search=m?`?${m}`:""}}return r!=="/"&&(l.pathname=nl({basename:r,pathname:l.pathname})),he(l)}function Wa(e,t,r){if(!r||!bl(r))return{path:t};if(r.formMethod&&!Ar(r.formMethod))return{path:t,error:te(405,{method:r.formMethod})};let a=()=>({path:t,error:te(400,{type:"invalid-body"})}),o=(r.formMethod||"get").toUpperCase(),i=ao(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!de(o))return a();let d=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,[p,f])=>`${m}${p}=${f}
2
2
  `,""):String(r.body);return{path:t,submission:{formMethod:o,formAction:i,formEncType:r.formEncType,formData:void 0,json:void 0,text:d}}}else if(r.formEncType==="application/json"){if(!de(o))return a();try{let d=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:o,formAction:i,formEncType:r.formEncType,formData:void 0,json:d,text:void 0}}}catch{return a()}}}I(typeof FormData=="function","FormData is not available in this environment");let s,l;if(r.formData)s=Mr(r.formData),l=r.formData;else if(r.body instanceof FormData)s=Mr(r.body),l=r.body;else if(r.body instanceof URLSearchParams)s=r.body,l=Za(s);else if(r.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(r.body),l=Za(s)}catch{return a()}let u={formMethod:o,formAction:i,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(de(u.formMethod))return{path:t,submission:u};let c=xe(t);return e&&c.search&&Zr(c.search)&&s.append("index",""),c.search=`?${s}`,{path:he(c),submission:u}}function Va(e,t,r,a,n,o,i,s,l,u,c,d,m,p,f,g,y,w,R,C){let P=C?ie(C[1])?C[1].error:C[1].data:void 0,x=n.createURL(o.location),L=n.createURL(l),E;if(c&&o.errors){let z=Object.keys(o.errors)[0];E=i.findIndex(J=>J.route.id===z)}else if(C&&ie(C[1])){let z=C[0];E=i.findIndex(J=>J.route.id===z)-1}let O=C?C[1].statusCode:void 0,_=O&&O>=400,k={currentUrl:x,currentParams:o.matches[0]?.params||{},nextUrl:L,nextParams:i[0].params,...s,actionResult:P,actionStatus:O},M=ct(i.map(z=>z.route.path)),V=i.map((z,J)=>{let{route:le}=z,Y=null;if(E!=null&&J>E?Y=!1:le.lazy?Y=!0:Gr(le)?c?Y=Or(le,o.loaderData,o.errors):Sl(o.loaderData,o.matches[J],z)&&(Y=!0):Y=!1,Y!==null)return Dt(r,a,e,M,z,u,t,Y);let Ee=_?!1:d||x.pathname+x.search===L.pathname+L.search||x.search!==L.search||Cl(o.matches[J],z),pe={...k,defaultShouldRevalidate:Ee},Pe=Qt(z,pe);return Dt(r,a,e,M,z,u,t,Pe,pe)}),X=[];return f.forEach((z,J)=>{if(c||!i.some(Le=>Le.route.id===z.routeId)||p.has(J))return;let le=o.fetchers.get(J),Y=le&&le.state!=="idle"&&le.data===void 0,Ee=ve(y,z.path,w);if(!Ee){if(R&&Y)return;X.push({key:J,routeId:z.routeId,path:z.path,matches:null,match:null,request:null,controller:null});return}if(g.has(J))return;let pe=dt(Ee,z.path),Pe=new AbortController,ye=st(n,z.path,Pe.signal),be=null;if(m.has(J))m.delete(J),be=ze(r,a,ye,Ee,pe,u,t);else if(Y)d&&(be=ze(r,a,ye,Ee,pe,u,t));else{let Le={...k,defaultShouldRevalidate:_?!1:d};Qt(pe,Le)&&(be=ze(r,a,ye,Ee,pe,u,t,Le))}be&&X.push({key:J,routeId:z.routeId,path:z.path,matches:be,match:pe,request:ye,controller:Pe})}),{dsMatches:V,revalidatingFetchers:X}}function Gr(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Or(e,t,r){if(e.lazy)return!0;if(!Gr(e))return!1;let a=t!=null&&e.id in t,n=r!=null&&r[e.id]!==void 0;return!a&&n?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!a&&!n}function Sl(e,t,r){let a=!t||r.route.id!==t.route.id,n=!e.hasOwnProperty(r.route.id);return a||n}function Cl(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Qt(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Ya(e,t,r,a,n,o){let i;if(e){let u=a[e];I(u,`No route found to patch children into: routeId = ${e}`),u.children||(u.children=[]),i=u.children}else i=r;let s=[],l=[];if(t.forEach(u=>{let c=i.find(d=>Jn(u,d));c?l.push({existingRoute:c,newRoute:u}):s.push(u)}),s.length>0){let u=We(s,n,[e||"_","patch",String(i?.length||"0")],a);i.push(...u)}if(o&&l.length>0)for(let u=0;u<l.length;u++){let{existingRoute:c,newRoute:d}=l[u],m=c,[p]=We([d],n,[],{},!0);Object.assign(m,{element:p.element?p.element:m.element,errorElement:p.errorElement?p.errorElement:m.errorElement,hydrateFallbackElement:p.hydrateFallbackElement?p.hydrateFallbackElement:m.hydrateFallbackElement})}}function Jn(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,a)=>t.children?.some(n=>Jn(r,n))):!1}var Ja=new WeakMap,Qr=({key:e,route:t,manifest:r,mapRouteProperties:a})=>{let n=r[t.id];if(I(n,"No route found in manifest"),!n.lazy||typeof n.lazy!="object")return;let o=n.lazy[e];if(!o)return;let i=Ja.get(n);i||(i={},Ja.set(n,i));let s=i[e];if(s)return s;let l=(async()=>{let u=Wi(e),d=n[e]!==void 0&&e!=="hasErrorBoundary";if(u)K(!u,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(d)K(!1,`Route "${n.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let m=await o();m!=null&&(Object.assign(n,{[e]:m}),Object.assign(n,a(n)))}typeof n.lazy=="object"&&(n.lazy[e]=void 0,Object.values(n.lazy).every(m=>m===void 0)&&(n.lazy=void 0))})();return i[e]=l,l},Ka=new WeakMap;function xl(e,t,r,a,n){let o=r[e.id];if(I(o,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let c=Ka.get(o);if(c)return{lazyRoutePromise:c,lazyHandlerPromise:c};let d=(async()=>{I(typeof e.lazy=="function","No lazy route function found");let m=await e.lazy(),p={};for(let f in m){let g=m[f];if(g===void 0)continue;let y=Yi(f),R=o[f]!==void 0&&f!=="hasErrorBoundary";y?K(!y,"Route property "+f+" is not a supported property to be returned from a lazy route function. This property will be ignored."):R?K(!R,`Route "${o.id}" has a static property "${f}" defined but its lazy function is also returning a value for this property. The lazy route property "${f}" will be ignored.`):p[f]=g}Object.assign(o,p),Object.assign(o,{...a(o),lazy:void 0})})();return Ka.set(o,d),d.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:d}}let i=Object.keys(e.lazy),s=[],l;for(let c of i){if(n&&n.includes(c))continue;let d=Qr({key:c,route:e,manifest:r,mapRouteProperties:a});d&&(s.push(d),c===t&&(l=d))}let u=s.length>0?Promise.all(s).then(()=>{}):void 0;return u?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:l}}function Pl(e){return e!==void 0}function Xa(e,t,r){let a=e.map(({route:n})=>{if(!(typeof n.lazy!="object"||!n.lazy.middleware))return Qr({key:"middleware",route:n,manifest:t,mapRouteProperties:r})}).filter(Pl);return a.length>0?Promise.all(a):void 0}async function Fr(e){let t=e.matches.filter(n=>n.shouldLoad),r={};return(await Promise.all(t.map(n=>n.resolve()))).forEach((n,o)=>{r[t[o].route.id]=n}),r}async function Ll(e){return e.matches.some(t=>t.route.middleware)?Kn(e,()=>Fr(e)):Fr(e)}function Ga(e,t,r){return Xn(e,t,a,q,r);function a(n){return Be(n)?Nr(n):n}}function Kn(e,t){return Xn(e,t,a=>a,kl,r);function r(a,n,o){if(o)return Promise.resolve(Object.assign(o.value,{[n]:{type:"error",result:a}}));{let{matches:i}=e,s=Math.min(Math.max(i.findIndex(u=>u.route.id===n),0),Math.max(i.findIndex(u=>u.unstable_shouldCallHandler()),0)),l=Ce(i,i[s].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:a}})}}}async function Xn(e,t,r,a,n){let{matches:o,request:i,params:s,context:l,unstable_pattern:u}=e,c=o.flatMap(m=>m.route.middleware?m.route.middleware.map(p=>[m.route.id,p]):[]);return await Gn({request:i,params:s,context:l,unstable_pattern:u},c,t,r,a,n)}async function Gn(e,t,r,a,n,o,i=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??new Error(`Request aborted: ${s.method} ${s.url}`);let l=t[i];if(!l)return await r();let[u,c]=l,d,m=async()=>{if(d)throw new Error("You may only call `next()` once per middleware");try{return d={value:await Gn(e,t,r,a,n,o,i+1)},d.value}catch(p){return d={value:await o(p,u,d)},d.value}};try{let p=await c(e,m),f=p!=null?a(p):void 0;return n(f)?f:d?f??d.value:(d={value:await m()},d.value)}catch(p){return await o(p,u,d)}}function Qn(e,t,r,a,n){let o=Qr({key:"middleware",route:a.route,manifest:t,mapRouteProperties:e}),i=xl(a.route,de(r.method)?"action":"loader",t,e,n);return{middleware:o,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function Dt(e,t,r,a,n,o,i,s,l=null){let u=!1,c=Qn(e,t,r,n,o);return{...n,_lazyPromises:c,shouldLoad:s,unstable_shouldRevalidateArgs:l,unstable_shouldCallHandler(d){return u=!0,l?typeof d=="boolean"?Qt(n,{...l,defaultShouldRevalidate:d}):Qt(n,l):s},resolve(d){let{lazy:m,loader:p,middleware:f}=n.route,g=u||s||d&&!de(r.method)&&(m||p),y=f&&f.length>0&&!p&&!m;return g&&(de(r.method)||!y)?Dl({request:r,unstable_pattern:a,match:n,lazyHandlerPromise:c?.handler,lazyRoutePromise:c?.route,handlerOverride:d,scopedContext:i}):Promise.resolve({type:"data",result:void 0})}}}function ze(e,t,r,a,n,o,i,s=null){return a.map(l=>l.route.id!==n.route.id?{...l,shouldLoad:!1,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler:()=>!1,_lazyPromises:Qn(e,t,r,l,o),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Dt(e,t,r,ct(a.map(u=>u.route.path)),l,o,i,!0,s))}async function Zn(e,t,r,a,n,o){r.some(u=>u._lazyPromises?.middleware)&&await Promise.all(r.map(u=>u._lazyPromises?.middleware));let i={request:t,unstable_pattern:ct(r.map(u=>u.route.path)),params:r[0].params,context:n,matches:r},l=await e({...i,fetcherKey:a,runClientMiddleware:o?()=>{throw new Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:u=>{let c=i;return Kn(c,()=>u({...c,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(u=>[u._lazyPromises?.handler,u._lazyPromises?.route]))}catch{}return l}async function Dl({request:e,unstable_pattern:t,match:r,lazyHandlerPromise:a,lazyRoutePromise:n,handlerOverride:o,scopedContext:i}){let s,l,u=de(e.method),c=u?"action":"loader",d=m=>{let p,f=new Promise((w,R)=>p=R);l=()=>p(),e.signal.addEventListener("abort",l);let g=w=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${c}" [routeId: ${r.route.id}]`)):m({request:e,unstable_pattern:t,params:r.params,context:i},...w!==void 0?[w]:[]),y=(async()=>{try{return{type:"data",result:await(o?o(R=>g(R)):g())}}catch(w){return{type:"error",result:w}}})();return Promise.race([y,f])};try{let m=u?r.route.action:r.route.loader;if(a||n)if(m){let p,[f]=await Promise.all([d(m).catch(g=>{p=g}),a,n]);if(p!==void 0)throw p;s=f}else{await a;let p=u?r.route.action:r.route.loader;if(p)[s]=await Promise.all([d(p),n]);else if(c==="action"){let f=new URL(e.url),g=f.pathname+f.search;throw te(405,{method:e.method,pathname:g,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(m)s=await d(m);else{let p=new URL(e.url),f=p.pathname+p.search;throw te(404,{pathname:f})}}catch(m){return{type:"error",result:m}}finally{l&&e.signal.removeEventListener("abort",l)}return s}async function qn(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function eo(e){let{result:t,type:r}=e;if(q(t)){let a;try{a=await qn(t)}catch(n){return{type:"error",error:n}}return r==="error"?{type:"error",error:new me(t.status,t.statusText,a),statusCode:t.status,headers:t.headers}:{type:"data",data:a,statusCode:t.status,headers:t.headers}}return r==="error"?Be(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:new me(t.init?.status||500,void 0,t.data),statusCode:re(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:re(t)?t.status:void 0}:Be(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function to(e,t,r,a,n){let o=e.headers.get("Location");if(I(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!nr(o)){let i=a.slice(0,a.findIndex(s=>s.route.id===r)+1);o=kr(new URL(t.url),i,n,o),e.headers.set("Location",o)}return e}function Qa(e,t,r){if(nr(e)){let a=e,n=a.startsWith("//")?new URL(t.protocol+a):new URL(a),o=ne(n.pathname,r)!=null;if(n.origin===t.origin&&o)return n.pathname+n.search+n.hash}return e}function st(e,t,r,a){let n=e.createURL(ao(t)).toString(),o={signal:r};if(a&&de(a.formMethod)){let{formMethod:i,formEncType:s}=a;o.method=i.toUpperCase(),s==="application/json"?(o.headers=new Headers({"Content-Type":s}),o.body=JSON.stringify(a.json)):s==="text/plain"?o.body=a.text:s==="application/x-www-form-urlencoded"&&a.formData?o.body=Mr(a.formData):o.body=a.formData}return new Request(n,o)}function Mr(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,typeof a=="string"?a:a.name);return t}function Za(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function ro(e,t,r,a=!1,n=!1){let o={},i=null,s,l=!1,u={},c=r&&ie(r[1])?r[1].error:void 0;return e.forEach(d=>{if(!(d.route.id in t))return;let m=d.route.id,p=t[m];if(I(!Ue(p),"Cannot handle redirect results in processLoaderData"),ie(p)){let f=p.error;if(c!==void 0&&(f=c,c=void 0),i=i||{},n)i[m]=f;else{let g=Ce(e,m);i[g.route.id]==null&&(i[g.route.id]=f)}a||(o[m]=Wn),l||(l=!0,s=re(p.error)?p.error.status:500),p.headers&&(u[m]=p.headers)}else o[m]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(s=p.statusCode),p.headers&&(u[m]=p.headers)}),c!==void 0&&r&&(i={[r[0]]:c},r[2]&&(o[r[2]]=void 0)),{loaderData:o,errors:i,statusCode:s||200,loaderHeaders:u}}function qa(e,t,r,a,n,o){let{loaderData:i,errors:s}=ro(t,r,a);return n.filter(l=>!l.matches||l.matches.some(u=>u.shouldLoad)).forEach(l=>{let{key:u,match:c,controller:d}=l;if(d&&d.signal.aborted)return;let m=o[u];if(I(m,"Did not find corresponding fetcher result"),ie(m)){let p=Ce(e.matches,c?.route.id);s&&s[p.route.id]||(s={...s,[p.route.id]:m.error}),e.fetchers.delete(u)}else if(Ue(m))I(!1,"Unhandled fetcher revalidation redirect");else{let p=Me(m.data);e.fetchers.set(u,p)}}),{loaderData:i,errors:s}}function en(e,t,r,a){let n=Object.entries(t).filter(([,o])=>o!==Wn).reduce((o,[i,s])=>(o[i]=s,o),{});for(let o of r){let i=o.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&o.route.loader&&(n[i]=e[i]),a&&a.hasOwnProperty(i))break}return n}function tn(e){return e?ie(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ce(e,t){return(t?e.slice(0,e.findIndex(a=>a.route.id===t)+1):[...e]).reverse().find(a=>a.route.hasErrorBoundary===!0)||e[0]}function ut(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function te(e,{pathname:t,routeId:r,method:a,type:n,message:o}={}){let i="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(i="Bad Request",a&&t&&r?s=`You made a ${a} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:n==="invalid-body"&&(s="Unable to encode submission body")):e===403?(i="Forbidden",s=`Route "${r}" does not match URL "${t}"`):e===404?(i="Not Found",s=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",a&&t&&r?s=`You made a ${a.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:a&&(s=`Invalid request method "${a.toUpperCase()}"`)),new me(e||500,i,new Error(s),!0)}function Ut(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[a,n]=t[r];if(Ue(n))return{key:a,result:n}}}function ao(e){let t=typeof e=="string"?xe(e):e;return he({...t,hash:""})}function Tl(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Nr(e){return Response.json(e.data,e.init??void 0)}function _l(e){return new me(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function kl(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,r])=>typeof t=="string"&&no(r))}function no(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function oo(e){return q(e.result)&&Un.has(e.result.status)}function ie(e){return e.type==="error"}function Ue(e){return(e&&e.type)==="redirect"}function Be(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function q(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function sr(e){return Un.has(e)}function Zt(e){return q(e)&&sr(e.status)&&e.headers.has("Location")}function Ar(e){return Rl.has(e.toUpperCase())}function de(e){return gl.has(e.toUpperCase())}function Zr(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function dt(e,t){let r=typeof t=="string"?xe(t).search:t.search;if(e[e.length-1].route.index&&Zr(r||""))return e[e.length-1];let a=Nn(e);return a[a.length-1]}function rn(e){let{formMethod:t,formAction:r,formEncType:a,text:n,formData:o,json:i}=e;if(!(!t||!r||!a)){if(n!=null)return{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:n};if(o!=null)return{formMethod:t,formAction:r,formEncType:a,formData:o,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}}}function Sr(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Ol(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function bt(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Fl(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Me(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Ml(e,t){try{let r=e.sessionStorage.getItem(Bn);if(r){let a=JSON.parse(r);for(let[n,o]of Object.entries(a||{}))o&&Array.isArray(o)&&t.set(n,new Set(o||[]))}}catch{}}function Nl(e,t){if(t.size>0){let r={};for(let[a,n]of t)r[a]=[...n];try{e.sessionStorage.setItem(Bn,JSON.stringify(r))}catch(a){K(!1,`Failed to save applied view transitions in sessionStorage (${a}).`)}}}function Al(){let e,t,r=new Promise((a,n)=>{e=async o=>{a(o);try{await r}catch{}},t=async o=>{n(o);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}var $e=h.createContext(null);$e.displayName="DataRouter";var Ye=h.createContext(null);Ye.displayName="DataRouterState";var io=h.createContext(!1);function $l(){return h.useContext(io)}var ur=h.createContext({isTransitioning:!1});ur.displayName="ViewTransition";var cr=h.createContext(new Map);cr.displayName="Fetchers";var mt=h.createContext(null);mt.displayName="Await";var fc=e=>h.createElement(mt.Provider,e),ge=h.createContext(null);ge.displayName="Navigation";var pt=h.createContext(null);pt.displayName="Location";var we=h.createContext({outlet:null,matches:[],isDataRoute:!1});we.displayName="Route";var qr=h.createContext(null);qr.displayName="RouteError";function Il(e,{relative:t}={}){I(rt(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=h.useContext(ge),{hash:n,pathname:o,search:i}=Ot(e,{relative:t}),s=o;return r!=="/"&&(s=o==="/"?r:_e([r,o])),a.createHref({pathname:s,search:i,hash:n})}function rt(){return h.useContext(pt)!=null}function Re(){return I(rt(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(pt).location}function hc(){return h.useContext(pt).navigationType}function mc(e){I(rt(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Re();return h.useMemo(()=>Lt(e,Mn(t)),[t,e])}var lo="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function so(e){h.useContext(ge).static||h.useLayoutEffect(e)}function ea(){let{isDataRoute:e}=h.useContext(we);return e?Zl():Hl()}function Hl(){I(rt(),"useNavigate() may be used only in the context of a <Router> component.");let e=h.useContext($e),{basename:t,navigator:r}=h.useContext(ge),{matches:a}=h.useContext(we),{pathname:n}=Re(),o=JSON.stringify(or(a)),i=h.useRef(!1);return so(()=>{i.current=!0}),h.useCallback((l,u={})=>{if(K(i.current,lo),!i.current)return;if(typeof l=="number"){r.go(l);return}let c=ir(l,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:_e([t,c.pathname])),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var uo=h.createContext(null);function pc(){return h.useContext(uo)}function jl(e){let t=h.useContext(we).outlet;return h.useMemo(()=>t&&h.createElement(uo.Provider,{value:e},t),[t,e])}function ta(){let{matches:e}=h.useContext(we),t=e[e.length-1];return t?t.params:{}}function Ot(e,{relative:t}={}){let{matches:r}=h.useContext(we),{pathname:a}=Re(),n=JSON.stringify(or(r));return h.useMemo(()=>ir(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function Ul(e,t){return ra(e,t)}function ra(e,t,r,a,n){I(rt(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=h.useContext(ge),{matches:i}=h.useContext(we),s=i[i.length-1],l=s?s.params:{},u=s?s.pathname:"/",c=s?s.pathnameBase:"/",d=s&&s.route;{let R=d&&d.path||"";fo(u,!d||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
3
 
4
4
  Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let m=Re(),p;if(t){let R=typeof t=="string"?xe(t):t;I(c==="/"||R.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${R.pathname}" was given in the \`location\` prop.`),p=R}else p=m;let f=p.pathname||"/",g=f;if(c!=="/"){let R=c.replace(/^\//,"").split("/");g="/"+f.replace(/^\//,"").split("/").slice(R.length).join("/")}let y=ve(e,{pathname:g});K(d||y!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),K(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=co(y&&y.map(R=>Object.assign({},R,{params:Object.assign({},l,R.params),pathname:_e([c,o.encodeLocation?o.encodeLocation(R.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?c:_e([c,o.encodeLocation?o.encodeLocation(R.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),i,r,a,n);return t&&w?h.createElement(pt.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...p},navigationType:"POP"}},w):w}function zl(){let e=dr(),t=re(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=h.createElement(h.Fragment,null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:o},"ErrorBoundary")," or"," ",h.createElement("code",{style:o},"errorElement")," prop on your route.")),h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:n},r):null,i)}var Bl=h.createElement(zl,null),Wl=class extends h.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?h.createElement(we.Provider,{value:this.props.routeContext},h.createElement(qr.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Vl({routeContext:e,match:t,children:r}){let a=h.useContext($e);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),h.createElement(we.Provider,{value:e},r)}function co(e,t=[],r=null,a=null,n=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,i=r?.errors;if(i!=null){let c=o.findIndex(d=>d.route.id&&i?.[d.route.id]!==void 0);I(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,c+1))}let s=!1,l=-1;if(r)for(let c=0;c<o.length;c++){let d=o[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:m,errors:p}=r,f=d.route.loader&&!m.hasOwnProperty(d.route.id)&&(!p||p[d.route.id]===void 0);if(d.route.lazy||f){s=!0,l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}let u=r&&a?(c,d)=>{a(c,{location:r.location,params:r.matches?.[0]?.params??{},errorInfo:d})}:void 0;return o.reduceRight((c,d,m)=>{let p,f=!1,g=null,y=null;r&&(p=i&&d.route.id?i[d.route.id]:void 0,g=d.route.errorElement||Bl,s&&(l<0&&m===0?(fo("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,y=null):l===m&&(f=!0,y=d.route.hydrateFallbackElement||null)));let w=t.concat(o.slice(0,m+1)),R=()=>{let C;return p?C=g:f?C=y:d.route.Component?C=h.createElement(d.route.Component,null):d.route.element?C=d.route.element:C=c,h.createElement(Vl,{match:d,routeContext:{outlet:c,matches:w,isDataRoute:r!=null},children:C})};return r&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?h.createElement(Wl,{location:r.location,revalidation:r.revalidation,component:g,error:p,children:R(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:u}):R()},null)}function aa(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function na(e){let t=h.useContext($e);return I(t,aa(e)),t}function Ie(e){let t=h.useContext(Ye);return I(t,aa(e)),t}function Yl(e){let t=h.useContext(we);return I(t,aa(e)),t}function yt(e){let t=Yl(e),r=t.matches[t.matches.length-1];return I(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Jl(){return yt("useRouteId")}function Kl(){return Ie("useNavigation").navigation}function yc(){let e=na("useRevalidator"),t=Ie("useRevalidator"),r=h.useCallback(async()=>{await e.router.revalidate()},[e.router]);return h.useMemo(()=>({revalidate:r,state:t.revalidation}),[r,t.revalidation])}function oa(){let{matches:e,loaderData:t}=Ie("useMatches");return h.useMemo(()=>e.map(r=>_n(r,t)),[e,t])}function ia(){let e=Ie("useLoaderData"),t=yt("useLoaderData");return e.loaderData[t]}function vc(e){return Ie("useRouteLoaderData").loaderData[e]}function la(){let e=Ie("useActionData"),t=yt("useLoaderData");return e.actionData?e.actionData[t]:void 0}function dr(){let e=h.useContext(qr),t=Ie("useRouteError"),r=yt("useRouteError");return e!==void 0?e:t.errors?.[r]}function Xl(){return h.useContext(mt)?._data}function gc(){return h.useContext(mt)?._error}var Gl=0;function Ql(e){let{router:t,basename:r}=na("useBlocker"),a=Ie("useBlocker"),[n,o]=h.useState(""),i=h.useCallback(s=>{if(typeof e!="function")return!!e;if(r==="/")return e(s);let{currentLocation:l,nextLocation:u,historyAction:c}=s;return e({currentLocation:{...l,pathname:ne(l.pathname,r)||l.pathname},nextLocation:{...u,pathname:ne(u.pathname,r)||u.pathname},historyAction:c})},[r,e]);return h.useEffect(()=>{let s=String(++Gl);return o(s),()=>t.deleteBlocker(s)},[t]),h.useEffect(()=>{n!==""&&t.getBlocker(n,i)},[t,n,i]),n&&a.blockers.has(n)?a.blockers.get(n):et}function Zl(){let{router:e}=na("useNavigate"),t=yt("useNavigate"),r=h.useRef(!1);return so(()=>{r.current=!0}),h.useCallback(async(n,o={})=>{K(r.current,lo),r.current&&(typeof n=="number"?e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var an={};function fo(e,t,r){!t&&!an[e]&&(an[e]=!0,K(!1,r))}function wc(...e){const t=yt("useRoute"),r=e[0]??t,a=Ie("useRoute"),n=a.matches.find(({route:o})=>o.id===r);if(n!==void 0)return{handle:n.route.handle,loaderData:a.loaderData[r],actionData:a.actionData?.[r]}}var nn={};function Tt(e,t){!e&&!nn[t]&&(nn[t]=!0,console.warn(t))}function Ft(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&K(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:h.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&K(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:h.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&K(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:h.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var sa=["HydrateFallback","hydrateFallbackElement"];function ql(e,t){return Xr({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:xn({initialEntries:t?.initialEntries,initialIndex:t?.initialIndex}),hydrationData:t?.hydrationData,routes:e,hydrationRouteProperties:sa,mapRouteProperties:Ft,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}var es=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}};function ts({router:e,flushSync:t,unstable_onError:r}){let[a,n]=h.useState(e.state),[o,i]=h.useState(),[s,l]=h.useState({isTransitioning:!1}),[u,c]=h.useState(),[d,m]=h.useState(),[p,f]=h.useState(),g=h.useRef(new Map),y=h.useCallback(x=>{n(L=>(x.errors&&r&&Object.entries(x.errors).forEach(([E,O])=>{L.errors?.[E]!==O&&r(O,{location:x.location,params:x.matches[0]?.params??{}})}),x))},[r]),w=h.useCallback((x,{deletedFetchers:L,flushSync:E,viewTransitionOpts:O})=>{x.fetchers.forEach((k,M)=>{k.data!==void 0&&g.current.set(M,k.data)}),L.forEach(k=>g.current.delete(k)),Tt(E===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let _=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Tt(O==null||_,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!O||!_){t&&E?t(()=>y(x)):h.startTransition(()=>y(x));return}if(t&&E){t(()=>{d&&(u&&u.resolve(),d.skipTransition()),l({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let k=e.window.document.startViewTransition(()=>{t(()=>y(x))});k.finished.finally(()=>{t(()=>{c(void 0),m(void 0),i(void 0),l({isTransitioning:!1})})}),t(()=>m(k));return}d?(u&&u.resolve(),d.skipTransition(),f({state:x,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(i(x),l({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[e.window,t,d,u,y]);h.useLayoutEffect(()=>e.subscribe(w),[e,w]),h.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new es)},[s]),h.useEffect(()=>{if(u&&o&&e.window){let x=o,L=u.promise,E=e.window.document.startViewTransition(async()=>{h.startTransition(()=>y(x)),await L});E.finished.finally(()=>{c(void 0),m(void 0),i(void 0),l({isTransitioning:!1})}),m(E)}},[o,u,e.window,y]),h.useEffect(()=>{u&&o&&a.location.key===o.location.key&&u.resolve()},[u,d,a.location,o]),h.useEffect(()=>{!s.isTransitioning&&p&&(i(p.state),l({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),f(void 0))},[s.isTransitioning,p]);let R=h.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:x=>e.navigate(x),push:(x,L,E)=>e.navigate(x,{state:L,preventScrollReset:E?.preventScrollReset}),replace:(x,L,E)=>e.navigate(x,{replace:!0,state:L,preventScrollReset:E?.preventScrollReset})}),[e]),C=e.basename||"/",P=h.useMemo(()=>({router:e,navigator:R,static:!1,basename:C,unstable_onError:r}),[e,R,C,r]);return h.createElement(h.Fragment,null,h.createElement($e.Provider,{value:P},h.createElement(Ye.Provider,{value:a},h.createElement(cr.Provider,{value:g.current},h.createElement(ur.Provider,{value:s},h.createElement(at,{basename:C,location:a.location,navigationType:a.historyAction,navigator:R},h.createElement(rs,{routes:e.routes,future:e.future,state:a,unstable_onError:r})))))),null)}var rs=h.memo(as);function as({routes:e,future:t,state:r,unstable_onError:a}){return ra(e,void 0,r,a,t)}function Rc({basename:e,children:t,initialEntries:r,initialIndex:a}){let n=h.useRef();n.current==null&&(n.current=xn({initialEntries:r,initialIndex:a,v5Compat:!0}));let o=n.current,[i,s]=h.useState({action:o.action,location:o.location}),l=h.useCallback(u=>{h.startTransition(()=>s(u))},[s]);return h.useLayoutEffect(()=>o.listen(l),[o,l]),h.createElement(at,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o})}function Ec({to:e,replace:t,state:r,relative:a}){I(rt(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n}=h.useContext(ge);K(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=h.useContext(we),{pathname:i}=Re(),s=ea(),l=ir(e,or(o),i,a==="path"),u=JSON.stringify(l);return h.useEffect(()=>{s(JSON.parse(u),{replace:t,state:r,relative:a})},[s,u,a,t,r]),null}function ns(e){return jl(e.context)}function os(e){I(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function at({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1}){I(!rt(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),s=h.useMemo(()=>({basename:i,navigator:n,static:o,future:{}}),[i,n,o]);typeof r=="string"&&(r=xe(r));let{pathname:l="/",search:u="",hash:c="",state:d=null,key:m="default"}=r,p=h.useMemo(()=>{let f=ne(l,i);return f==null?null:{location:{pathname:f,search:u,hash:c,state:d,key:m},navigationType:a}},[i,l,u,c,d,m,a]);return K(p!=null,`<Router basename="${i}"> is not able to match the URL "${l}${u}${c}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:h.createElement(ge.Provider,{value:s},h.createElement(pt.Provider,{children:t,value:p}))}function bc({children:e,location:t}){return Ul(qt(e),t)}function Sc({children:e,errorElement:t,resolve:r}){let a=h.useContext($e),n=h.useContext(Ye),o=h.useCallback((i,s)=>{a&&a.unstable_onError&&n&&a.unstable_onError(i,{location:n.location,params:n.matches?.[0]?.params||{},errorInfo:s})},[a,n]);return h.createElement(is,{resolve:r,errorElement:t,onError:o},h.createElement(ls,null,e))}var is=class extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("<Await> caught the following error during render",e,t)}render(){let{children:e,errorElement:t,resolve:r}=this.props,a=null,n=0;if(!(r instanceof Promise))n=1,a=Promise.resolve(),Object.defineProperty(a,"_tracked",{get:()=>!0}),Object.defineProperty(a,"_data",{get:()=>r});else if(this.state.error){n=2;let o=this.state.error;a=Promise.reject().catch(()=>{}),Object.defineProperty(a,"_tracked",{get:()=>!0}),Object.defineProperty(a,"_error",{get:()=>o})}else r._tracked?(a=r,n="_error"in a?2:"_data"in a?1:0):(n=0,Object.defineProperty(r,"_tracked",{get:()=>!0}),a=r.then(o=>Object.defineProperty(r,"_data",{get:()=>o}),o=>{this.props.onError?.(o),Object.defineProperty(r,"_error",{get:()=>o})}));if(n===2&&!t)throw a._error;if(n===2)return h.createElement(mt.Provider,{value:a,children:t});if(n===1)return h.createElement(mt.Provider,{value:a,children:e});throw a}};function ls({children:e}){let t=Xl(),r=typeof e=="function"?e(t):e;return h.createElement(h.Fragment,null,r)}function qt(e,t=[]){let r=[];return h.Children.forEach(e,(a,n)=>{if(!h.isValidElement(a))return;let o=[...t,n];if(a.type===h.Fragment){r.push.apply(r,qt(a.props.children,o));return}I(a.type===os,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),I(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=qt(a.props.children,o)),r.push(i)}),r}var Cc=qt;function xc(e){return co(e)}function ho(){return{params:ta(),loaderData:ia(),actionData:la(),matches:oa()}}function Pc({children:e}){const t=ho();return h.cloneElement(e,t)}function ss(e){return function(){const r=ho();return h.createElement(e,r)}}function mo(){return{params:ta(),loaderData:ia(),actionData:la()}}function Lc({children:e}){const t=mo();return h.cloneElement(e,t)}function us(e){return function(){const r=mo();return h.createElement(e,r)}}function po(){return{params:ta(),loaderData:ia(),actionData:la(),error:dr()}}function Dc({children:e}){const t=po();return h.cloneElement(e,t)}function cs(e){return function(){const r=po();return h.createElement(e,r)}}var Jt="get",Kt="application/x-www-form-urlencoded";function fr(e){return e!=null&&typeof e.tagName=="string"}function ds(e){return fr(e)&&e.tagName.toLowerCase()==="button"}function fs(e){return fr(e)&&e.tagName.toLowerCase()==="form"}function hs(e){return fr(e)&&e.tagName.toLowerCase()==="input"}function ms(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ps(e,t){return e.button===0&&(!t||t==="_self")&&!ms(e)}function $r(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function ys(e,t){let r=$r(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var zt=null;function vs(){if(zt===null)try{new FormData(document.createElement("form"),0),zt=!1}catch{zt=!0}return zt}var gs=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Cr(e){return e!=null&&!gs.has(e)?(K(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kt}"`),null):e}function ws(e,t){let r,a,n,o,i;if(fs(e)){let s=e.getAttribute("action");a=s?ne(s,t):null,r=e.getAttribute("method")||Jt,n=Cr(e.getAttribute("enctype"))||Kt,o=new FormData(e)}else if(ds(e)||hs(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(a=l?ne(l,t):null,r=e.getAttribute("formmethod")||s.getAttribute("method")||Jt,n=Cr(e.getAttribute("formenctype"))||Cr(s.getAttribute("enctype"))||Kt,o=new FormData(s,e),!vs()){let{name:u,type:c,value:d}=e;if(c==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,d)}}else{if(fr(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Jt,a=null,n=Kt,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var yo=-1,vo=-2,go=-3,wo=-4,ua=-5,Ro=-6,Eo=-7,bo="B",So="D",ft="E",Ir="M",Co="N",ht="P",xo="R",Hr="S",Po="Y",Lo="U",jr="Z",Do=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};function Rs(){const e=new TextDecoder;let t="";return new TransformStream({transform(r,a){const n=e.decode(r,{stream:!0}),o=(t+n).split(`
@@ -0,0 +1,70 @@
1
+ import{ax as wt,ay as Ot,az as G,aA as K,aq as at,_ as $,aB as te,aC as ee,aD as ae,aE as se,aF as ne,aG as re,aH as oe,aI as ie,aJ as ce,aK as ue,f as le,aL as me,i as Mt,aM as he,aN as fe,c as pe,aO as ge,aP as de,aQ as be,aR as _e,aS as Te,as as ye,aT as Ee,b as Rt,aU as ve,aV as Lt,aW as Ie,aX as Ne,aY as Ce,av as Y,e as Q,aZ as Dt,a_ as kt,a$ as tt,at as we,C as ct,aa as St,ai as ut,b0 as Oe,b1 as At,a8 as Z,ab as Se,R as gt,D as Ae,au as xt,Q as Pe,a9 as Me,ag as Re,E as Ft,b2 as q,h as B,b3 as Bt,b4 as Le,b5 as Ut,G as De,b6 as ke,j as xe,m as Fe,b7 as Be,b8 as Ue,b9 as je,ba as Ve,bb as Ge,bc as Ze,bd as $e,t as He,ar as Pt,r as Xe,be as Ye,bf as We,bg as Je,bh as ht,o as jt,s as Vt,bi as ze}from"./base-RWAdy9P6.js";import{c as Gt,i as Ke,a as qe,b as Qe,e as ta}from"./base-Bnm339-a.js";import"./index-C2UfjD9L.js";function Zt(a,s,n,i,c){if(s!==a){typeof s.toJSON=="function"&&(s=s.toJSON());for(var l=wt(s),m=wt(a),h=!1,b=m.length-1;b>=0;b--){var p=m[b],T=a[p];if(Ot(s,p)&&!(s[p]===void 0&&T!==void 0&&Array.isArray(s)===!1)){var g=s[p];typeof T=="object"&&T!=null&&typeof g=="object"&&g!=null&&Array.isArray(T)===Array.isArray(g)?Zt(T,g,n,i+"/"+G(p),c):T!==g&&(c&&n.push({op:"test",path:i+"/"+G(p),value:K(T)}),n.push({op:"replace",path:i+"/"+G(p),value:K(g)}))}else Array.isArray(a)===Array.isArray(s)?(c&&n.push({op:"test",path:i+"/"+G(p),value:K(T)}),n.push({op:"remove",path:i+"/"+G(p)}),h=!0):(c&&n.push({op:"test",path:i,value:a}),n.push({op:"replace",path:i,value:s}))}if(!(!h&&l.length==m.length))for(var b=0;b<l.length;b++){var p=l[b];!Ot(a,p)&&s[p]!==void 0&&n.push({op:"add",path:i+"/"+G(p),value:K(s[p])})}}}function dt(a,s,n=!1){var i=[];return Zt(a,s,i,"",n),i}var ea={};$(ea,{convertToOpenAIFunction:()=>$t,convertToOpenAITool:()=>aa,isLangChainTool:()=>Gt,isRunnableToolLike:()=>Qe,isStructuredTool:()=>qe,isStructuredToolParams:()=>Ke});function $t(a,s){const n=typeof s=="number"?void 0:s;return{name:a.name,description:a.description,parameters:at(a.schema),...n?.strict!==void 0?{strict:n.strict}:{}}}function aa(a,s){const n=typeof s=="number"?void 0:s;let i;return Gt(a)?i={type:"function",function:$t(a)}:i=a,n?.strict!==void 0&&(i.function.strict=n.strict),i}var sa={};$(sa,{extendInteropZodObject:()=>Ce,getInteropZodDefaultGetter:()=>Ne,getInteropZodObjectShape:()=>Ie,getSchemaDescription:()=>Lt,interopParse:()=>ve,interopParseAsync:()=>Rt,interopSafeParse:()=>Ee,interopSafeParseAsync:()=>ye,interopZodObjectMakeFieldsOptional:()=>Te,interopZodObjectPartial:()=>_e,interopZodObjectPassthrough:()=>be,interopZodObjectStrict:()=>de,interopZodTransformInputSchema:()=>ge,isInteropZodError:()=>pe,isInteropZodLiteral:()=>fe,isInteropZodObject:()=>he,isInteropZodSchema:()=>Mt,isShapelessZodSchema:()=>me,isSimpleStringZodSchema:()=>le,isZodArrayV4:()=>ue,isZodLiteralV3:()=>ce,isZodLiteralV4:()=>ie,isZodNullableV4:()=>oe,isZodObjectV3:()=>re,isZodObjectV4:()=>ne,isZodOptionalV4:()=>se,isZodSchema:()=>ae,isZodSchemaV3:()=>ee,isZodSchemaV4:()=>te});var et=class extends Y{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(a){super(a),a&&(this.func=a.func)}async invoke(a,s){const n=Q(s);return this.func&&await this.func(a,n),this._callWithConfig(i=>Promise.resolve(i),a,n)}async*transform(a,s){const n=Q(s);let i,c=!0;for await(const l of this._transformStreamWithConfig(a,m=>m,n))if(yield l,c)if(i===void 0)i=l;else try{i=tt(i,l)}catch{i=void 0,c=!1}this.func&&i!==void 0&&await this.func(i,n)}static assign(a){return new Dt(new kt({steps:a}))}};const na=a=>a();function lt(a){const s=a.constructor;return new s({...a,content:a.contentBlocks,response_metadata:{...a.response_metadata,output_version:"v1"}})}var ra={};$(ra,{BaseChatModel:()=>Ht,SimpleChatModel:()=>oa});function mt(a){const s=[];for(const n of a){let i=n;if(Array.isArray(n.content))for(let c=0;c<n.content.length;c++){const l=n.content[c];(Pe(l)||Me(l))&&i===n&&(i=new n.constructor({...i,content:[...n.content.slice(0,c),Re(l),...n.content.slice(c+1)]}))}s.push(i)}return s}var Ht=class U extends ta{lc_namespace=["langchain","chat_models",this._llmType()];disableStreaming=!1;outputVersion;get callKeys(){return[...super.callKeys,"outputVersion"]}constructor(s){super(s),this.outputVersion=na(()=>{const n=s.outputVersion??we("LC_OUTPUT_VERSION");return n&&["v0","v1"].includes(n)?n:"v0"})}_separateRunnableConfigFromCallOptionsCompat(s){const[n,i]=super._separateRunnableConfigFromCallOptions(s);return i.signal=n.signal,[n,i]}async invoke(s,n){const i=U._convertInputToPromptValue(s);return(await this.generatePrompt([i],n,n?.callbacks)).generations[0][0].message}async*_streamResponseChunks(s,n,i){throw new Error("Not implemented.")}async*_streamIterator(s,n){if(this._streamResponseChunks===U.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(s,n);else{const c=U._convertInputToPromptValue(s).toChatMessages(),[l,m]=this._separateRunnableConfigFromCallOptionsCompat(n),h={...l.metadata,...this.getLsParams(m)},b=await ct.configure(l.callbacks,this.callbacks,l.tags,this.tags,h,this.metadata,{verbose:this.verbose}),p={options:m,invocation_params:this?.invocationParams(m),batch_size:1},T=m.outputVersion??this.outputVersion,g=await b?.handleChatModelStart(this.toJSON(),[mt(c)],l.runId,void 0,p,void 0,void 0,l.runName);let y,_;try{for await(const d of this._streamResponseChunks(c,m,g?.[0])){if(d.message.id==null){const f=g?.at(0)?.runId;f!=null&&d.message._updateId(`run-${f}`)}d.message.response_metadata={...d.generationInfo,...d.message.response_metadata},T==="v1"?yield lt(d.message):yield d.message,y?y=y.concat(d):y=d,St(d.message)&&d.message.usage_metadata!==void 0&&(_={tokenUsage:{promptTokens:d.message.usage_metadata.input_tokens,completionTokens:d.message.usage_metadata.output_tokens,totalTokens:d.message.usage_metadata.total_tokens}})}}catch(d){throw await Promise.all((g??[]).map(f=>f?.handleLLMError(d))),d}await Promise.all((g??[]).map(d=>d?.handleLLMEnd({generations:[[y]],llmOutput:_})))}}getLsParams(s){const n=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:s.stop,ls_provider:n}}async _generateUncached(s,n,i,c){const l=s.map(y=>y.map(ut));let m;if(c!==void 0&&c.length===l.length)m=c;else{const y={...i.metadata,...this.getLsParams(n)},_=await ct.configure(i.callbacks,this.callbacks,i.tags,this.tags,y,this.metadata,{verbose:this.verbose}),d={options:n,invocation_params:this?.invocationParams(n),batch_size:1};m=await _?.handleChatModelStart(this.toJSON(),l.map(mt),i.runId,void 0,d,void 0,void 0,i.runName)}const h=n.outputVersion??this.outputVersion,b=[],p=[];if(!!m?.[0].handlers.find(Oe)&&!this.disableStreaming&&l.length===1&&this._streamResponseChunks!==U.prototype._streamResponseChunks)try{const y=await this._streamResponseChunks(l[0],n,m?.[0]);let _,d;for await(const f of y){if(f.message.id==null){const N=m?.at(0)?.runId;N!=null&&f.message._updateId(`run-${N}`)}_===void 0?_=f:_=tt(_,f),St(f.message)&&f.message.usage_metadata!==void 0&&(d={tokenUsage:{promptTokens:f.message.usage_metadata.input_tokens,completionTokens:f.message.usage_metadata.output_tokens,totalTokens:f.message.usage_metadata.total_tokens}})}if(_===void 0)throw new Error("Received empty response from chat model call.");b.push([_]),await m?.[0].handleLLMEnd({generations:b,llmOutput:d})}catch(y){throw await m?.[0].handleLLMError(y),y}else{const y=await Promise.allSettled(l.map(async(_,d)=>{const f=await this._generate(_,{...n,promptIndex:d},m?.[d]);if(h==="v1")for(const N of f.generations)N.message=lt(N.message);return f}));await Promise.all(y.map(async(_,d)=>{if(_.status==="fulfilled"){const f=_.value;for(const N of f.generations){if(N.message.id==null){const I=m?.at(0)?.runId;I!=null&&N.message._updateId(`run-${I}`)}N.message.response_metadata={...N.generationInfo,...N.message.response_metadata}}return f.generations.length===1&&(f.generations[0].message.response_metadata={...f.llmOutput,...f.generations[0].message.response_metadata}),b[d]=f.generations,p[d]=f.llmOutput,m?.[d]?.handleLLMEnd({generations:[f.generations],llmOutput:f.llmOutput})}else return await m?.[d]?.handleLLMError(_.reason),Promise.reject(_.reason)}))}const g={generations:b,llmOutput:p.length?this._combineLLMOutput?.(...p):void 0};return Object.defineProperty(g,At,{value:m?{runIds:m?.map(y=>y.runId)}:void 0,configurable:!0}),g}async _generateCached({messages:s,cache:n,llmStringKey:i,parsedOptions:c,handledOptions:l}){const m=s.map(I=>I.map(ut)),h={...l.metadata,...this.getLsParams(c)},b=await ct.configure(l.callbacks,this.callbacks,l.tags,this.tags,h,this.metadata,{verbose:this.verbose}),p={options:c,invocation_params:this?.invocationParams(c),batch_size:1},T=await b?.handleChatModelStart(this.toJSON(),m.map(mt),l.runId,void 0,p,void 0,void 0,l.runName),g=[],_=(await Promise.allSettled(m.map(async(I,L)=>{const w=U._convertInputToPromptValue(I).toString(),M=await n.lookup(w,i);return M==null&&g.push(L),M}))).map((I,L)=>({result:I,runManager:T?.[L]})).filter(({result:I})=>I.status==="fulfilled"&&I.value!=null||I.status==="rejected"),d=c.outputVersion??this.outputVersion,f=[];await Promise.all(_.map(async({result:I,runManager:L},w)=>{if(I.status==="fulfilled"){const M=I.value;return f[w]=M.map(D=>("message"in D&&Z(D.message)&&Se(D.message)&&(D.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},d==="v1"&&(D.message=lt(D.message))),D.generationInfo={...D.generationInfo,tokenUsage:{}},D)),M.length&&await L?.handleLLMNewToken(M[0].text),L?.handleLLMEnd({generations:[M]},void 0,void 0,void 0,{cached:!0})}else return await L?.handleLLMError(I.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(I.reason)}));const N={generations:f,missingPromptIndices:g,startedRunManagers:T};return Object.defineProperty(N,At,{value:T?{runIds:T?.map(I=>I.runId)}:void 0,configurable:!0}),N}async generate(s,n,i){let c;Array.isArray(n)?c={stop:n}:c=n;const l=s.map(d=>d.map(ut)),[m,h]=this._separateRunnableConfigFromCallOptionsCompat(c);if(m.callbacks=m.callbacks??i,!this.cache)return this._generateUncached(l,h,m);const{cache:b}=this,p=this._getSerializedCacheKeyParametersForCall(h),{generations:T,missingPromptIndices:g,startedRunManagers:y}=await this._generateCached({messages:l,cache:b,llmStringKey:p,parsedOptions:h,handledOptions:m});let _={};if(g.length>0){const d=await this._generateUncached(g.map(f=>l[f]),h,m,y!==void 0?g.map(f=>y?.[f]):void 0);await Promise.all(d.generations.map(async(f,N)=>{const I=g[N];T[I]=f;const L=U._convertInputToPromptValue(l[I]).toString();return b.update(L,p,f)})),_=d.llmOutput??{}}return{generations:T,llmOutput:_}}invocationParams(s){return{}}_modelType(){return"base_chat_model"}async generatePrompt(s,n,i){const c=s.map(l=>l.toChatMessages());return this.generate(c,n,i)}withStructuredOutput(s,n){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(n?.strict)throw new Error('"strict" mode is not supported for this model by default.');const i=s,c=n?.name,l=Lt(i)??"A function available to call.",m=n?.method,h=n?.includeRaw;if(m==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let b=c??"extract",p;Mt(i)?p=[{type:"function",function:{name:b,description:l,parameters:at(i)}}]:("name"in i&&(b=i.name),p=[{type:"function",function:{name:b,description:l,parameters:i}}]);const T=this.bindTools(p),g=gt.from(f=>{if(!Ae.isInstance(f))throw new Error("Input is not an AIMessageChunk.");if(!f.tool_calls||f.tool_calls.length===0)throw new Error("No tool calls found in the response.");const N=f.tool_calls.find(I=>I.name===b);if(!N)throw new Error(`No tool call found with name ${b}.`);return N.args});if(!h)return T.pipe(g).withConfig({runName:"StructuredOutput"});const y=et.assign({parsed:(f,N)=>g.invoke(f.raw,N)}),_=et.assign({parsed:()=>null}),d=y.withFallbacks({fallbacks:[_]});return xt.from([{raw:T},d]).withConfig({runName:"StructuredOutputRunnable"})}},oa=class extends Ht{async _generate(a,s,n){const i=await this._call(a,s,n),c=new Ft(i);if(typeof c.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:c.content,message:c}]}}},ia=class extends Y{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(a){super(a),this.runnables=a.runnables}async invoke(a,s){const{key:n,input:i}=a,c=this.runnables[n];if(c===void 0)throw new Error(`No runnable associated with key "${n}".`);return c.invoke(i,Q(s))}async batch(a,s,n){const i=a.map(g=>g.key),c=a.map(g=>g.input);if(i.find(g=>this.runnables[g]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");const m=i.map(g=>this.runnables[g]),h=this._getOptionsList(s??{},a.length),b=h[0]?.maxConcurrency??n?.maxConcurrency,p=b&&b>0?b:a.length,T=[];for(let g=0;g<c.length;g+=p){const y=c.slice(g,g+p).map((d,f)=>m[f].invoke(d,h[f])),_=await Promise.all(y);T.push(_)}return T.flat()}async stream(a,s){const{key:n,input:i}=a,c=this.runnables[n];if(c===void 0)throw new Error(`No runnable associated with key "${n}".`);return c.stream(i,s)}},ca=class extends Y{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(a){super(a),this.branches=a.branches,this.default=a.default}static from(a){if(a.length<1)throw new Error("RunnableBranch requires at least one branch");const n=a.slice(0,-1).map(([c,l])=>[q(c),q(l)]),i=q(a[a.length-1]);return new this({branches:n,default:i})}async _invoke(a,s,n){let i;for(let c=0;c<this.branches.length;c+=1){const[l,m]=this.branches[c];if(await l.invoke(a,B(s,{callbacks:n?.getChild(`condition:${c+1}`)}))){i=await m.invoke(a,B(s,{callbacks:n?.getChild(`branch:${c+1}`)}));break}}return i||(i=await this.default.invoke(a,B(s,{callbacks:n?.getChild("branch:default")}))),i}async invoke(a,s={}){return this._callWithConfig(this._invoke,a,s)}async*_streamIterator(a,s){const i=await(await Bt(s))?.handleChainStart(this.toJSON(),Le(a,"input"),s?.runId,void 0,void 0,void 0,s?.runName);let c,l=!0,m;try{for(let h=0;h<this.branches.length;h+=1){const[b,p]=this.branches[h];if(await b.invoke(a,B(s,{callbacks:i?.getChild(`condition:${h+1}`)}))){m=await p.stream(a,B(s,{callbacks:i?.getChild(`branch:${h+1}`)}));for await(const g of m)if(yield g,l)if(c===void 0)c=g;else try{c=tt(c,g)}catch{c=void 0,l=!1}break}}if(m===void 0){m=await this.default.stream(a,B(s,{callbacks:i?.getChild("branch:default")}));for await(const h of m)if(yield h,l)if(c===void 0)c=h;else try{c=tt(c,h)}catch{c=void 0,l=!1}}}catch(h){throw await i?.handleChainError(h),h}await i?.handleChainEnd(c??{})}},ua=class extends Ut{runnable;inputMessagesKey;outputMessagesKey;historyMessagesKey;getMessageHistory;constructor(a){let s=gt.from((l,m)=>this._enterHistory(l,m??{})).withConfig({runName:"loadHistory"});const n=a.historyMessagesKey??a.inputMessagesKey;n&&(s=et.assign({[n]:s}).withConfig({runName:"insertHistory"}));const i=s.pipe(a.runnable.withListeners({onEnd:(l,m)=>this._exitHistory(l,m??{})})).withConfig({runName:"RunnableWithMessageHistory"}),c=a.config??{};super({...a,config:c,bound:i}),this.runnable=a.runnable,this.getMessageHistory=a.getMessageHistory,this.inputMessagesKey=a.inputMessagesKey,this.outputMessagesKey=a.outputMessagesKey,this.historyMessagesKey=a.historyMessagesKey}_getInputMessages(a){let s;if(typeof a=="object"&&!Array.isArray(a)&&!Z(a)){let n;this.inputMessagesKey?n=this.inputMessagesKey:Object.keys(a).length===1?n=Object.keys(a)[0]:n="input",Array.isArray(a[n])&&Array.isArray(a[n][0])?s=a[n][0]:s=a[n]}else s=a;if(typeof s=="string")return[new De(s)];if(Array.isArray(s))return s;if(Z(s))return[s];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages.
2
+ Got ${JSON.stringify(s,null,2)}`)}_getOutputMessages(a){let s;if(!Array.isArray(a)&&!Z(a)&&typeof a!="string"){let n;this.outputMessagesKey!==void 0?n=this.outputMessagesKey:Object.keys(a).length===1?n=Object.keys(a)[0]:n="output",a.generations!==void 0?s=a.generations[0][0].message:s=a[n]}else s=a;if(typeof s=="string")return[new Ft(s)];if(Array.isArray(s))return s;if(Z(s))return[s];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(s,null,2)}`)}async _enterHistory(a,s){const i=await(s?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?i.concat(this._getInputMessages(a)):i}async _exitHistory(a,s){const n=s.configurable?.messageHistory;let i;Array.isArray(a.inputs)&&Array.isArray(a.inputs[0])?i=a.inputs[0]:i=a.inputs;let c=this._getInputMessages(i);if(this.historyMessagesKey===void 0){const h=await n.getMessages();c=c.slice(h.length)}const l=a.outputs;if(!l)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(a,null,2)}`);const m=this._getOutputMessages(l);await n.addMessages([...c,...m])}async _mergeConfig(...a){const s=await super._mergeConfig(...a);if(!s.configurable||!s.configurable.sessionId){const i={[this.inputMessagesKey??"input"]:"foo"},c={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream()
3
+ eg. chain.invoke(${JSON.stringify(i)}, ${JSON.stringify(c)})`)}const{sessionId:n}=s.configurable;return s.configurable.messageHistory=await this.getMessageHistory(n),s}},la={};$(la,{RouterRunnable:()=>ia,Runnable:()=>Y,RunnableAssign:()=>Dt,RunnableBinding:()=>Ut,RunnableBranch:()=>ca,RunnableEach:()=>Ze,RunnableLambda:()=>gt,RunnableMap:()=>kt,RunnableParallel:()=>Ge,RunnablePassthrough:()=>et,RunnablePick:()=>Ve,RunnableRetry:()=>je,RunnableSequence:()=>xt,RunnableToolLike:()=>Ue,RunnableWithFallbacks:()=>Be,RunnableWithMessageHistory:()=>ua,_coerceToRunnable:()=>q,ensureConfig:()=>Q,getCallbackManagerForConfig:()=>Bt,mergeConfigs:()=>Fe,patchConfig:()=>B,pickRunnableConfigKeys:()=>xe,raceWithSignal:()=>ke});var Xt=class extends Y{parseResultWithPrompt(a,s,n){return this.parseResult(a,n)}_baseMessageToString(a){return typeof a.content=="string"?a.content:this._baseMessageContentToString(a.content)}_baseMessageContentToString(a){return JSON.stringify(a)}async invoke(a,s){return typeof a=="string"?this._callWithConfig(async(n,i)=>this.parseResult([{text:n}],i?.callbacks),a,{...s,runType:"parser"}):this._callWithConfig(async(n,i)=>this.parseResult([{message:n,text:this._baseMessageToString(n)}],i?.callbacks),a,{...s,runType:"parser"})}},st=class extends Xt{parseResult(a,s){return this.parse(a[0].text,s)}async parseWithPrompt(a,s,n){return this.parse(a,n)}_type(){throw new Error("_type not implemented")}},j=class extends Error{llmOutput;observation;sendToLLM;constructor(a,s,n,i=!1){if(super(a),this.llmOutput=s,this.observation=n,this.sendToLLM=i,i&&(n===void 0||s===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");$e(this,"OUTPUT_PARSING_FAILURE")}},W=class extends st{async*_transform(a){for await(const s of a)typeof s=="string"?yield this.parseResult([{text:s}]):yield this.parseResult([{message:s,text:this._baseMessageToString(s)}])}async*transform(a,s){yield*this._transformStreamWithConfig(a,this._transform.bind(this),{...s,runType:"parser"})}},bt=class extends W{diff=!1;constructor(a){super(a),this.diff=a?.diff??this.diff}async*_transform(a){let s,n;for await(const i of a){if(typeof i!="string"&&typeof i.content!="string")throw new Error("Cannot handle non-string output.");let c;if(He(i)){if(typeof i.content!="string")throw new Error("Cannot handle non-string message output.");c=new Pt({message:i,text:i.content})}else if(Z(i)){if(typeof i.content!="string")throw new Error("Cannot handle non-string message output.");c=new Pt({message:Xe(i),text:i.content})}else c=new Ye({text:i});n===void 0?n=c:n=n.concat(c);const l=await this.parsePartialResult([n]);l!=null&&!We(l,s)&&(this.diff?yield this._diff(s,l):yield l,s=l)}}getFormatInstructions(){return""}},ma={};$(ma,{applyPatch:()=>Je,compare:()=>dt});var ha=class extends bt{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(a,s){return this.diff?super._concatOutputChunks(a,s):s}_diff(a,s){if(s)return a?dt(a,s):[{op:"replace",path:"",value:s}]}async parsePartialResult(a){return ht(a[0].text)}async parse(a){return ht(a,JSON.parse)}getFormatInstructions(){return""}},fa=class extends W{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(a){return Promise.resolve(this.textEncoder.encode(a))}getFormatInstructions(){return""}},J=class extends W{re;async*_transform(a){let s="";for await(const n of a)if(typeof n=="string"?s+=n:s+=n.content,this.re){const i=[...s.matchAll(this.re)];if(i.length>1){let c=0;for(const l of i.slice(0,-1))yield[l[1]],c+=(l.index??0)+l[0].length;s=s.slice(c)}}else{const i=await this.parse(s);if(i.length>1){for(const c of i.slice(0,-1))yield[c];s=i[i.length-1]}}for(const n of await this.parse(s))yield[n]}},pa=class extends J{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(a){try{return a.trim().split(",").map(s=>s.trim())}catch{throw new j(`Could not parse output: ${a}`,a)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},ga=class extends J{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:a,separator:s}){super(...arguments),this.length=a,this.separator=s||","}async parse(a){try{const s=a.trim().split(this.separator).map(n=>n.trim());if(this.length!==void 0&&s.length!==this.length)throw new j(`Incorrect number of items. Expected ${this.length}, got ${s.length}.`);return s}catch(s){throw Object.getPrototypeOf(s)===j.prototype?s:new j(`Could not parse output: ${a}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},da=class extends J{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
4
+
5
+ 1. foo
6
+
7
+ 2. bar
8
+
9
+ 3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(a){return[...a.matchAll(this.re)??[]].map(s=>s[1])}},ba=class extends J{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
10
+
11
+ 1. foo
12
+
13
+ 2. bar
14
+
15
+ 3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(a){return[...a.matchAll(this.re)??[]].map(s=>s[1])}},_a=class extends W{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(a){return Promise.resolve(a)}getFormatInstructions(){return""}_textContentToString(a){return a.text}_imageUrlContentToString(a){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(a){switch(a.type){case"text":case"text_delta":if("text"in a)return this._textContentToString(a);break;case"image_url":if("image_url"in a)return this._imageUrlContentToString(a);break;default:throw new Error(`Cannot coerce "${a.type}" message part into a string.`)}throw new Error(`Invalid content type: ${a.type}`)}_baseMessageContentToString(a){return a.reduce((s,n)=>s+this._messageContentToString(n),"")}},Yt=class extends st{static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(a){super(a),this.schema=a}static fromZodSchema(a){return new this(a)}static fromNamesAndDescriptions(a){const s=jt(Object.fromEntries(Object.entries(a).map(([n,i])=>[n,Vt().describe(i)])));return new this(s)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.
16
+
17
+ "JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.
18
+
19
+ For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}
20
+ would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.
21
+ Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.
22
+
23
+ Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!
24
+
25
+ Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
26
+ \`\`\`json
27
+ ${JSON.stringify(at(this.schema))}
28
+ \`\`\`
29
+ `}async parse(a){try{const s=a.trim(),i=(s.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||s.match(/```json\s*([\s\S]*?)```/)?.[1]||s).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(c,l)=>`"${l.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await Rt(this.schema,JSON.parse(i))}catch(s){throw new j(`Failed to parse. Text: "${a}". Error: ${s}`,a)}}},Wt=class extends Yt{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(a){const s=a?.interpolationDepth??1;if(s<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like:
30
+ \`\`\`json
31
+ ${this._schemaToInstruction(at(this.schema)).replaceAll("{","{".repeat(s)).replaceAll("}","}".repeat(s))}
32
+ \`\`\``}_schemaToInstruction(a,s=2){const n=a;if("type"in n){let i=!1,c;if(Array.isArray(n.type)){const h=n.type.findIndex(b=>b==="null");h!==-1&&(i=!0,n.type.splice(h,1)),c=n.type.join(" | ")}else c=n.type;if(n.type==="object"&&n.properties){const h=n.description?` // ${n.description}`:"";return`{
33
+ ${Object.entries(n.properties).map(([p,T])=>{const g=n.required?.includes(p)?"":" (optional)";return`${" ".repeat(s)}"${p}": ${this._schemaToInstruction(T,s+2)}${g}`}).join(`
34
+ `)}
35
+ ${" ".repeat(s-2)}}${h}`}if(n.type==="array"&&n.items){const h=n.description?` // ${n.description}`:"";return`array[
36
+ ${" ".repeat(s)}${this._schemaToInstruction(n.items,s+2)}
37
+ ${" ".repeat(s-2)}] ${h}`}const l=i?" (nullable)":"",m=n.description?` // ${n.description}`:"";return`${c}${m}${l}`}if("anyOf"in n)return n.anyOf.map(i=>this._schemaToInstruction(i,s)).join(`
38
+ ${" ".repeat(s-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(a){return new this(a)}static fromNamesAndDescriptions(a){const s=jt(Object.fromEntries(Object.entries(a).map(([n,i])=>[n,Vt().describe(i)])));return new this(s)}},Ta=class extends st{structuredInputParser;constructor({inputSchema:a}){super(...arguments),this.structuredInputParser=new Wt(a)}async parse(a){let s;try{s=await this.structuredInputParser.parse(a)}catch(n){throw new j(`Failed to parse. Text: "${a}". Error: ${n}`,a)}return this.outputProcessor(s)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};const ya=function(){const a={};a.parser=function(e,t){return new n(e,t)},a.SAXParser=n,a.SAXStream=p,a.createStream=b,a.MAX_BUFFER_LENGTH=64*1024;const s=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];a.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(e,t){if(!(this instanceof n))return new n(e,t);var u=this;c(u),u.q=u.c="",u.bufferCheckPosition=a.MAX_BUFFER_LENGTH,u.opt=t||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!e,u.noscript=!!(e||u.opt.noscript),u.state=o.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(a.XML_ENTITIES):Object.create(a.ENTITIES),u.attribList=[],u.opt.xmlns&&(u.ns=Object.create(d)),u.trackPosition=u.opt.position!==!1,u.trackPosition&&(u.position=u.line=u.column=0),H(u,"onready")}Object.create||(Object.create=function(e){function t(){}t.prototype=e;var u=new t;return u}),Object.keys||(Object.keys=function(e){var t=[];for(var u in e)e.hasOwnProperty(u)&&t.push(u);return t});function i(e){for(var t=Math.max(a.MAX_BUFFER_LENGTH,10),u=0,r=0,E=s.length;r<E;r++){var O=e[s[r]].length;if(O>t)switch(s[r]){case"textNode":X(e);break;case"cdata":C(e,"oncdata",e.cdata),e.cdata="";break;case"script":C(e,"onscript",e.script),e.script="";break;default:z(e,"Max buffer length exceeded: "+s[r])}u=Math.max(u,O)}var S=a.MAX_BUFFER_LENGTH-u;e.bufferCheckPosition=S+e.position}function c(e){for(var t=0,u=s.length;t<u;t++)e[s[t]]=""}function l(e){X(e),e.cdata!==""&&(C(e,"oncdata",e.cdata),e.cdata=""),e.script!==""&&(C(e,"onscript",e.script),e.script="")}n.prototype={end:function(){yt(this)},write:qt,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){l(this)}};var m=ReadableStream;m||(m=function(){});var h=a.EVENTS.filter(function(e){return e!=="error"&&e!=="end"});function b(e,t){return new p(e,t)}function p(e,t){if(!(this instanceof p))return new p(e,t);m.apply(this),this._parser=new n(e,t),this.writable=!0,this.readable=!0;var u=this;this._parser.onend=function(){u.emit("end")},this._parser.onerror=function(r){u.emit("error",r),u._parser.error=null},this._decoder=null,h.forEach(function(r){Object.defineProperty(u,"on"+r,{get:function(){return u._parser["on"+r]},set:function(E){if(!E)return u.removeAllListeners(r),u._parser["on"+r]=E,E;u.on(r,E)},enumerable:!0,configurable:!1})})}p.prototype=Object.create(m.prototype,{constructor:{value:p}}),p.prototype.write=function(e){return this._parser.write(e.toString()),this.emit("data",e),!0},p.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},p.prototype.on=function(e,t){var u=this;return!u._parser["on"+e]&&h.indexOf(e)!==-1&&(u._parser["on"+e]=function(){var r=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);r.splice(0,0,e),u.emit.apply(u,r)}),m.prototype.on.call(u,e,t)};var T="[CDATA[",g="DOCTYPE",y="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",d={xml:y,xmlns:_},f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,N=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,I=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,L=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function w(e){return e===" "||e===`
39
+ `||e==="\r"||e===" "}function M(e){return e==='"'||e==="'"}function D(e){return e===">"||w(e)}function k(e,t){return e.test(t)}function zt(e,t){return!k(e,t)}var o=0;a.STATE={BEGIN:o++,BEGIN_WHITESPACE:o++,TEXT:o++,TEXT_ENTITY:o++,OPEN_WAKA:o++,SGML_DECL:o++,SGML_DECL_QUOTED:o++,DOCTYPE:o++,DOCTYPE_QUOTED:o++,DOCTYPE_DTD:o++,DOCTYPE_DTD_QUOTED:o++,COMMENT_STARTING:o++,COMMENT:o++,COMMENT_ENDING:o++,COMMENT_ENDED:o++,CDATA:o++,CDATA_ENDING:o++,CDATA_ENDING_2:o++,PROC_INST:o++,PROC_INST_BODY:o++,PROC_INST_ENDING:o++,OPEN_TAG:o++,OPEN_TAG_SLASH:o++,ATTRIB:o++,ATTRIB_NAME:o++,ATTRIB_NAME_SAW_WHITE:o++,ATTRIB_VALUE:o++,ATTRIB_VALUE_QUOTED:o++,ATTRIB_VALUE_CLOSED:o++,ATTRIB_VALUE_UNQUOTED:o++,ATTRIB_VALUE_ENTITY_Q:o++,ATTRIB_VALUE_ENTITY_U:o++,CLOSE_TAG:o++,CLOSE_TAG_SAW_WHITE:o++,SCRIPT:o++,SCRIPT_ENDING:o++},a.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},a.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(a.ENTITIES).forEach(function(e){var t=a.ENTITIES[e],u=typeof t=="number"?String.fromCharCode(t):t;a.ENTITIES[e]=u});for(var _t in a.STATE)a.STATE[a.STATE[_t]]=_t;o=a.STATE;function H(e,t,u){e[t]&&e[t](u)}function C(e,t,u){e.textNode&&X(e),H(e,t,u)}function X(e){e.textNode=Tt(e.opt,e.textNode),e.textNode&&H(e,"ontext",e.textNode),e.textNode=""}function Tt(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function z(e,t){return X(e),e.trackPosition&&(t+=`
40
+ Line: `+e.line+`
41
+ Column: `+e.column+`
42
+ Char: `+e.c),t=new Error(t),e.error=t,H(e,"onerror",t),e}function yt(e){return e.sawRoot&&!e.closedRoot&&v(e,"Unclosed root tag"),e.state!==o.BEGIN&&e.state!==o.BEGIN_WHITESPACE&&e.state!==o.TEXT&&z(e,"Unexpected end"),X(e),e.c="",e.closed=!0,H(e,"onend"),n.call(e,e.strict,e.opt),e}function v(e,t){if(typeof e!="object"||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&z(e,t)}function Kt(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,u=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(u.ns=t.ns),e.attribList.length=0,C(e,"onopentagstart",u)}function nt(e,t){var u=e.indexOf(":"),r=u<0?["",e]:e.split(":"),E=r[0],O=r[1];return t&&e==="xmlns"&&(E="xmlns",O=""),{prefix:E,local:O}}function rt(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),e.attribList.indexOf(e.attribName)!==-1||e.tag.attributes.hasOwnProperty(e.attribName)){e.attribName=e.attribValue="";return}if(e.opt.xmlns){var t=nt(e.attribName,!0),u=t.prefix,r=t.local;if(u==="xmlns")if(r==="xml"&&e.attribValue!==y)v(e,"xml: prefix must be bound to "+y+`
43
+ Actual: `+e.attribValue);else if(r==="xmlns"&&e.attribValue!==_)v(e,"xmlns: prefix must be bound to "+_+`
44
+ Actual: `+e.attribValue);else{var E=e.tag,O=e.tags[e.tags.length-1]||e;E.ns===O.ns&&(E.ns=Object.create(O.ns)),E.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,C(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}function F(e,t){if(e.opt.xmlns){var u=e.tag,r=nt(e.tagName);u.prefix=r.prefix,u.local=r.local,u.uri=u.ns[r.prefix]||"",u.prefix&&!u.uri&&(v(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),u.uri=r.prefix);var E=e.tags[e.tags.length-1]||e;u.ns&&E.ns!==u.ns&&Object.keys(u.ns).forEach(function(Ct){C(e,"onopennamespace",{prefix:Ct,uri:u.ns[Ct]})});for(var O=0,S=e.attribList.length;O<S;O++){var P=e.attribList[O],R=P[0],V=P[1],A=nt(R,!0),x=A.prefix,Qt=A.local,Nt=x===""?"":u.ns[x]||"",it={name:R,value:V,prefix:x,local:Qt,uri:Nt};x&&x!=="xmlns"&&!Nt&&(v(e,"Unbound namespace prefix: "+JSON.stringify(x)),it.uri=x),e.tag.attributes[R]=it,C(e,"onattribute",it)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),C(e,"onopentag",e.tag),t||(!e.noscript&&e.tagName.toLowerCase()==="script"?e.state=o.SCRIPT:e.state=o.TEXT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function ot(e){if(!e.tagName){v(e,"Weird empty close tag."),e.textNode+="</>",e.state=o.TEXT;return}if(e.script){if(e.tagName!=="script"){e.script+="</"+e.tagName+">",e.tagName="",e.state=o.SCRIPT;return}C(e,"onscript",e.script),e.script=""}var t=e.tags.length,u=e.tagName;e.strict||(u=u[e.looseCase]());for(var r=u;t--;){var E=e.tags[t];if(E.name!==r)v(e,"Unexpected close tag");else break}if(t<0){v(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",e.state=o.TEXT;return}e.tagName=u;for(var O=e.tags.length;O-- >t;){var S=e.tag=e.tags.pop();e.tagName=e.tag.name,C(e,"onclosetag",e.tagName);var P={};for(var R in S.ns)P[R]=S.ns[R];var V=e.tags[e.tags.length-1]||e;e.opt.xmlns&&S.ns!==V.ns&&Object.keys(S.ns).forEach(function(A){var x=S.ns[A];C(e,"onclosenamespace",{prefix:A,uri:x})})}t===0&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=o.TEXT}function Et(e){var t=e.entity,u=t.toLowerCase(),r,E="";return e.ENTITIES[t]?e.ENTITIES[t]:e.ENTITIES[u]?e.ENTITIES[u]:(t=u,t.charAt(0)==="#"&&(t.charAt(1)==="x"?(t=t.slice(2),r=parseInt(t,16),E=r.toString(16)):(t=t.slice(1),r=parseInt(t,10),E=r.toString(10))),t=t.replace(/^0+/,""),isNaN(r)||E.toLowerCase()!==t?(v(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(r))}function vt(e,t){t==="<"?(e.state=o.OPEN_WAKA,e.startTagPosition=e.position):w(t)||(v(e,"Non-whitespace before first tag."),e.textNode=t,e.state=o.TEXT)}function It(e,t){var u="";return t<e.length&&(u=e.charAt(t)),u}function qt(e){var t=this;if(this.error)throw this.error;if(t.closed)return z(t,"Cannot write after close. Assign an onready handler.");if(e===null)return yt(t);typeof e=="object"&&(e=e.toString());for(var u=0,r="";r=It(e,u++),t.c=r,!!r;)switch(t.trackPosition&&(t.position++,r===`
45
+ `?(t.line++,t.column=0):t.column++),t.state){case o.BEGIN:if(t.state=o.BEGIN_WHITESPACE,r==="\uFEFF")continue;vt(t,r);continue;case o.BEGIN_WHITESPACE:vt(t,r);continue;case o.TEXT:if(t.sawRoot&&!t.closedRoot){for(var E=u-1;r&&r!=="<"&&r!=="&";)r=It(e,u++),r&&t.trackPosition&&(t.position++,r===`
46
+ `?(t.line++,t.column=0):t.column++);t.textNode+=e.substring(E,u-1)}r==="<"&&!(t.sawRoot&&t.closedRoot&&!t.strict)?(t.state=o.OPEN_WAKA,t.startTagPosition=t.position):(!w(r)&&(!t.sawRoot||t.closedRoot)&&v(t,"Text data outside of root node."),r==="&"?t.state=o.TEXT_ENTITY:t.textNode+=r);continue;case o.SCRIPT:r==="<"?t.state=o.SCRIPT_ENDING:t.script+=r;continue;case o.SCRIPT_ENDING:r==="/"?t.state=o.CLOSE_TAG:(t.script+="<"+r,t.state=o.SCRIPT);continue;case o.OPEN_WAKA:if(r==="!")t.state=o.SGML_DECL,t.sgmlDecl="";else if(!w(r))if(k(f,r))t.state=o.OPEN_TAG,t.tagName=r;else if(r==="/")t.state=o.CLOSE_TAG,t.tagName="";else if(r==="?")t.state=o.PROC_INST,t.procInstName=t.procInstBody="";else{if(v(t,"Unencoded <"),t.startTagPosition+1<t.position){var O=t.position-t.startTagPosition;r=new Array(O).join(" ")+r}t.textNode+="<"+r,t.state=o.TEXT}continue;case o.SGML_DECL:(t.sgmlDecl+r).toUpperCase()===T?(C(t,"onopencdata"),t.state=o.CDATA,t.sgmlDecl="",t.cdata=""):t.sgmlDecl+r==="--"?(t.state=o.COMMENT,t.comment="",t.sgmlDecl=""):(t.sgmlDecl+r).toUpperCase()===g?(t.state=o.DOCTYPE,(t.doctype||t.sawRoot)&&v(t,"Inappropriately located doctype declaration"),t.doctype="",t.sgmlDecl=""):r===">"?(C(t,"onsgmldeclaration",t.sgmlDecl),t.sgmlDecl="",t.state=o.TEXT):(M(r)&&(t.state=o.SGML_DECL_QUOTED),t.sgmlDecl+=r);continue;case o.SGML_DECL_QUOTED:r===t.q&&(t.state=o.SGML_DECL,t.q=""),t.sgmlDecl+=r;continue;case o.DOCTYPE:r===">"?(t.state=o.TEXT,C(t,"ondoctype",t.doctype),t.doctype=!0):(t.doctype+=r,r==="["?t.state=o.DOCTYPE_DTD:M(r)&&(t.state=o.DOCTYPE_QUOTED,t.q=r));continue;case o.DOCTYPE_QUOTED:t.doctype+=r,r===t.q&&(t.q="",t.state=o.DOCTYPE);continue;case o.DOCTYPE_DTD:t.doctype+=r,r==="]"?t.state=o.DOCTYPE:M(r)&&(t.state=o.DOCTYPE_DTD_QUOTED,t.q=r);continue;case o.DOCTYPE_DTD_QUOTED:t.doctype+=r,r===t.q&&(t.state=o.DOCTYPE_DTD,t.q="");continue;case o.COMMENT:r==="-"?t.state=o.COMMENT_ENDING:t.comment+=r;continue;case o.COMMENT_ENDING:r==="-"?(t.state=o.COMMENT_ENDED,t.comment=Tt(t.opt,t.comment),t.comment&&C(t,"oncomment",t.comment),t.comment=""):(t.comment+="-"+r,t.state=o.COMMENT);continue;case o.COMMENT_ENDED:r!==">"?(v(t,"Malformed comment"),t.comment+="--"+r,t.state=o.COMMENT):t.state=o.TEXT;continue;case o.CDATA:r==="]"?t.state=o.CDATA_ENDING:t.cdata+=r;continue;case o.CDATA_ENDING:r==="]"?t.state=o.CDATA_ENDING_2:(t.cdata+="]"+r,t.state=o.CDATA);continue;case o.CDATA_ENDING_2:r===">"?(t.cdata&&C(t,"oncdata",t.cdata),C(t,"onclosecdata"),t.cdata="",t.state=o.TEXT):r==="]"?t.cdata+="]":(t.cdata+="]]"+r,t.state=o.CDATA);continue;case o.PROC_INST:r==="?"?t.state=o.PROC_INST_ENDING:w(r)?t.state=o.PROC_INST_BODY:t.procInstName+=r;continue;case o.PROC_INST_BODY:if(!t.procInstBody&&w(r))continue;r==="?"?t.state=o.PROC_INST_ENDING:t.procInstBody+=r;continue;case o.PROC_INST_ENDING:r===">"?(C(t,"onprocessinginstruction",{name:t.procInstName,body:t.procInstBody}),t.procInstName=t.procInstBody="",t.state=o.TEXT):(t.procInstBody+="?"+r,t.state=o.PROC_INST_BODY);continue;case o.OPEN_TAG:k(N,r)?t.tagName+=r:(Kt(t),r===">"?F(t):r==="/"?t.state=o.OPEN_TAG_SLASH:(w(r)||v(t,"Invalid character in tag name"),t.state=o.ATTRIB));continue;case o.OPEN_TAG_SLASH:r===">"?(F(t,!0),ot(t)):(v(t,"Forward-slash in opening tag not followed by >"),t.state=o.ATTRIB);continue;case o.ATTRIB:if(w(r))continue;r===">"?F(t):r==="/"?t.state=o.OPEN_TAG_SLASH:k(f,r)?(t.attribName=r,t.attribValue="",t.state=o.ATTRIB_NAME):v(t,"Invalid attribute name");continue;case o.ATTRIB_NAME:r==="="?t.state=o.ATTRIB_VALUE:r===">"?(v(t,"Attribute without value"),t.attribValue=t.attribName,rt(t),F(t)):w(r)?t.state=o.ATTRIB_NAME_SAW_WHITE:k(N,r)?t.attribName+=r:v(t,"Invalid attribute name");continue;case o.ATTRIB_NAME_SAW_WHITE:if(r==="=")t.state=o.ATTRIB_VALUE;else{if(w(r))continue;v(t,"Attribute without value"),t.tag.attributes[t.attribName]="",t.attribValue="",C(t,"onattribute",{name:t.attribName,value:""}),t.attribName="",r===">"?F(t):k(f,r)?(t.attribName=r,t.state=o.ATTRIB_NAME):(v(t,"Invalid attribute name"),t.state=o.ATTRIB)}continue;case o.ATTRIB_VALUE:if(w(r))continue;M(r)?(t.q=r,t.state=o.ATTRIB_VALUE_QUOTED):(v(t,"Unquoted attribute value"),t.state=o.ATTRIB_VALUE_UNQUOTED,t.attribValue=r);continue;case o.ATTRIB_VALUE_QUOTED:if(r!==t.q){r==="&"?t.state=o.ATTRIB_VALUE_ENTITY_Q:t.attribValue+=r;continue}rt(t),t.q="",t.state=o.ATTRIB_VALUE_CLOSED;continue;case o.ATTRIB_VALUE_CLOSED:w(r)?t.state=o.ATTRIB:r===">"?F(t):r==="/"?t.state=o.OPEN_TAG_SLASH:k(f,r)?(v(t,"No whitespace between attributes"),t.attribName=r,t.attribValue="",t.state=o.ATTRIB_NAME):v(t,"Invalid attribute name");continue;case o.ATTRIB_VALUE_UNQUOTED:if(!D(r)){r==="&"?t.state=o.ATTRIB_VALUE_ENTITY_U:t.attribValue+=r;continue}rt(t),r===">"?F(t):t.state=o.ATTRIB;continue;case o.CLOSE_TAG:if(t.tagName)r===">"?ot(t):k(N,r)?t.tagName+=r:t.script?(t.script+="</"+t.tagName,t.tagName="",t.state=o.SCRIPT):(w(r)||v(t,"Invalid tagname in closing tag"),t.state=o.CLOSE_TAG_SAW_WHITE);else{if(w(r))continue;zt(f,r)?t.script?(t.script+="</"+r,t.state=o.SCRIPT):v(t,"Invalid tagname in closing tag."):t.tagName=r}continue;case o.CLOSE_TAG_SAW_WHITE:if(w(r))continue;r===">"?ot(t):v(t,"Invalid characters in closing tag");continue;case o.TEXT_ENTITY:case o.ATTRIB_VALUE_ENTITY_Q:case o.ATTRIB_VALUE_ENTITY_U:var S,P;switch(t.state){case o.TEXT_ENTITY:S=o.TEXT,P="textNode";break;case o.ATTRIB_VALUE_ENTITY_Q:S=o.ATTRIB_VALUE_QUOTED,P="attribValue";break;case o.ATTRIB_VALUE_ENTITY_U:S=o.ATTRIB_VALUE_UNQUOTED,P="attribValue";break}if(r===";")if(t.opt.unparsedEntities){var R=Et(t);t.entity="",t.state=S,t.write(R)}else t[P]+=Et(t),t.entity="",t.state=S;else k(t.entity.length?L:I,r)?t.entity+=r:(v(t,"Invalid character in entity name"),t[P]+="&"+t.entity+r,t.entity="",t.state=S);continue;default:throw new Error(t,"Unknown state: "+t.state)}return t.position>=t.bufferCheckPosition&&i(t),t}return String.fromCodePoint||(function(){var e=String.fromCharCode,t=Math.floor,u=function(){var r=16384,E=[],O,S,P=-1,R=arguments.length;if(!R)return"";for(var V="";++P<R;){var A=Number(arguments[P]);if(!isFinite(A)||A<0||A>1114111||t(A)!==A)throw RangeError("Invalid code point: "+A);A<=65535?E.push(A):(A-=65536,O=(A>>10)+55296,S=A%1024+56320,E.push(O,S)),(P+1===R||E.length>r)&&(V+=e.apply(null,E),E.length=0)}return V};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0}):String.fromCodePoint=u})(),a},Ea=ya(),ft=`The output should be formatted as a XML file.
47
+ 1. Output should conform to the tags below.
48
+ 2. If tags are not given, make them on your own.
49
+ 3. Remember to always open and close all the tags.
50
+
51
+ As an example, for the tags ["foo", "bar", "baz"]:
52
+ 1. String "<foo>
53
+ <bar>
54
+ <baz></baz>
55
+ </bar>
56
+ </foo>" is a well-formatted instance of the schema.
57
+ 2. String "<foo>
58
+ <bar>
59
+ </foo>" is a badly-formatted instance.
60
+ 3. String "<foo>
61
+ <tag>
62
+ </tag>
63
+ </foo>" is a badly-formatted instance.
64
+
65
+ Here are the output tags:
66
+ \`\`\`
67
+ {tags}
68
+ \`\`\``;var va=class extends bt{tags;constructor(a){super(a),this.tags=a?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(a,s){if(s)return a?dt(a,s):[{op:"replace",path:"",value:s}]}async parsePartialResult(a){return pt(a[0].text)}async parse(a){return pt(a)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?ft.replace("{tags}",this.tags?.join(", ")??""):ft}};const Ia=a=>a.split(`
69
+ `).map(s=>s.replace(/^\s+/,"")).join(`
70
+ `).trim(),Jt=a=>{if(Object.keys(a).length===0)return{};const s={};return a.children.length>0?(s[a.name]=a.children.map(Jt),s):(s[a.name]=a.text??void 0,s)};function pt(a){const s=Ia(a),n=Ea.parser(!0);let i={};const c=[];n.onopentag=h=>{const b={name:h.name,attributes:h.attributes,children:[],text:"",isSelfClosing:h.isSelfClosing};c.length>0?c[c.length-1].children.push(b):i=b,h.isSelfClosing||c.push(b)},n.onclosetag=()=>{if(c.length>0){const h=c.pop();c.length===0&&h&&(i=h)}},n.ontext=h=>{if(c.length>0){const b=c[c.length-1];b.text+=h}},n.onattribute=h=>{if(c.length>0){const b=c[c.length-1];b.attributes[h.name]=h.value}};const l=/```(xml)?(.*)```/s.exec(s),m=l?l[2]:s;return n.write(m).close(),i&&i.name==="?xml"&&(i=i.children[0]),Jt(i)}var Na={};$(Na,{AsymmetricStructuredOutputParser:()=>Ta,BaseCumulativeTransformOutputParser:()=>bt,BaseLLMOutputParser:()=>Xt,BaseOutputParser:()=>st,BaseTransformOutputParser:()=>W,BytesOutputParser:()=>fa,CommaSeparatedListOutputParser:()=>pa,CustomListOutputParser:()=>ga,JsonMarkdownStructuredOutputParser:()=>Wt,JsonOutputParser:()=>ha,ListOutputParser:()=>J,MarkdownListOutputParser:()=>ba,NumberedListOutputParser:()=>da,OutputParserException:()=>j,StringOutputParser:()=>_a,StructuredOutputParser:()=>Yt,XMLOutputParser:()=>va,XML_FORMAT_INSTRUCTIONS:()=>ft,parseJsonMarkdown:()=>ht,parsePartialJson:()=>ze,parseXMLMarkdown:()=>pt});export{Xt as B,ha as J,j as O,et as R,Yt as S,Ht as a,bt as b,aa as c};