@malloy-publisher/app 0.12.5 → 0.13.0

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 (29) hide show
  1. package/dist/api-doc.yaml +785 -57
  2. package/dist/assets/{EnvironmentPage-gNvDKTtA.js → EnvironmentPage-B74sWMJb.js} +1 -1
  3. package/dist/assets/{HomePage-lrIG8Qjk.js → HomePage-BOb2eaod.js} +1 -1
  4. package/dist/assets/{MainPage-CJf3Uuul.js → MainPage-D6QvMDBc.js} +1 -1
  5. package/dist/assets/{ModelPage-t_Ln0qr1.js → ModelPage-DOac8VF3.js} +2 -2
  6. package/dist/assets/{PackagePage-Cxa0_alv.js → PackagePage-CpahRMLt.js} +1 -1
  7. package/dist/assets/{PackageSplatRoute-FyScmoYw.js → PackageSplatRoute-BBPH3864.js} +2 -2
  8. package/dist/assets/{RenderedResult-DqPvGZgL.es-BNxk46Vn.js → RenderedResult-D5HJr2Xo.es-CFweT1ny.js} +3 -3
  9. package/dist/assets/{RouteError-BZUUKmNE.js → RouteError-r7ydeLAE.js} +1 -1
  10. package/dist/assets/{ThemeEditorPage-vDnfPmZz.js → ThemeEditorPage-dxaIYM0S.js} +1 -1
  11. package/dist/assets/{ToggleButtonGroup-DdUWm7cB.js → ToggleButtonGroup-B8CQst36.js} +1 -1
  12. package/dist/assets/{documentRoutes-DtWdqG6B.js → documentRoutes-Dn5OclPv.js} +1 -1
  13. package/dist/assets/{editPageMounted-vEdUjhAX.js → editPageMounted-BXWQAQvv.js} +2 -2
  14. package/dist/assets/{index-CRAwrhYM.js → index-B0BUzE-t.js} +8 -2
  15. package/dist/assets/index-BiZnC_i6.js +1318 -0
  16. package/dist/assets/{index-dUom3Bdm.js → index-C2rpVa58.js} +1 -1
  17. package/dist/assets/index-Co7C9Gew.js +2724 -0
  18. package/dist/assets/{index-D-htCO4q.js → index-D3PvzI_V.js} +38 -38
  19. package/dist/assets/{index-DYHeNKEh.js → index-jw6yCO3t.js} +1 -1
  20. package/dist/assets/{index.es-DpNxHwgw.js → index.es-BfpodLFo.js} +1 -1
  21. package/dist/assets/usePackageLinkNavigate-CpjXFkgK.js +1 -0
  22. package/dist/assets/{usePackageRoute-CjGpnrTp.js → usePackageRoute-CwvWFoYD.js} +1 -1
  23. package/dist/index.html +1 -1
  24. package/dist/mcp-app/report.css +1 -0
  25. package/dist/mcp-app/report.js +3422 -0
  26. package/package.json +5 -4
  27. package/dist/assets/index-DgBiwYeC.js +0 -2714
  28. package/dist/assets/index-diN_kmcj.js +0 -1314
  29. package/dist/assets/usePackageLinkNavigate-D2TepxAX.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-diN_kmcj.js","assets/index-CRAwrhYM.js","assets/index-dUom3Bdm.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-DYHeNKEh.js","assets/index-DgBiwYeC.js","assets/MainPage-CJf3Uuul.js","assets/editPageMounted-vEdUjhAX.js","assets/documentRoutes-DtWdqG6B.js","assets/usePackageRoute-CjGpnrTp.js","assets/PackageSplatRoute-FyScmoYw.js","assets/PackagePage-Cxa0_alv.js","assets/usePackageLinkNavigate-D2TepxAX.js","assets/ThemeEditorPage-vDnfPmZz.js","assets/ToggleButtonGroup-DdUWm7cB.js"])))=>i.map(i=>d[i]);
2
- function uL(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(r,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var ZRe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function A$(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vS={exports:{}},Rm={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BiZnC_i6.js","assets/index-B0BUzE-t.js","assets/index-C2rpVa58.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-jw6yCO3t.js","assets/index-Co7C9Gew.js","assets/MainPage-D6QvMDBc.js","assets/editPageMounted-BXWQAQvv.js","assets/documentRoutes-Dn5OclPv.js","assets/usePackageRoute-CwvWFoYD.js","assets/PackageSplatRoute-BBPH3864.js","assets/PackagePage-CpahRMLt.js","assets/usePackageLinkNavigate-CpjXFkgK.js","assets/ThemeEditorPage-dxaIYM0S.js","assets/ToggleButtonGroup-B8CQst36.js"])))=>i.map(i=>d[i]);
2
+ function uL(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(r,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var JRe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function A$(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vS={exports:{}},Rm={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
5
5
  *
@@ -57,9 +57,9 @@ Error generating stack: `+h.message+`
57
57
  *
58
58
  * @license MIT
59
59
  */var fL=e=>{throw TypeError(e)},pL=(e,t,n)=>t.has(e)||fL("Cannot "+n),Yi=(e,t,n)=>(pL(e,t,"read from private field"),n?n.call(e):t.get(e)),vg=(e,t,n)=>t.has(e)?fL("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),el=(e,t,n,r)=>(pL(e,t,"write to private field"),t.set(e,n),n),ox=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,ax=/^[\\/]{2}/;function hL(e,t){return t+e.replace(/\\/g,"/")}var wO="popstate";function SO(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function IU(e={}){function t(r,o){let a=o.state?.masked,{pathname:i,search:s,hash:l}=a||r.location;return Zg("",{pathname:i,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:Oa(o)}return zU(t,n,null,e)}function er(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ko(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function LU(){return Math.random().toString(36).substring(2,10)}function CO(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Zg(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?$l(t):t,state:n,key:t&&t.key||r||LU(),mask:o}}function Oa({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function $l(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function zU(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:a=!1}=r,i=o.history,s="POP",l=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){s="POP";let S=u(),b=S==null?null:S-d;d=S,l&&l({action:s,location:w.location,delta:b})}function g(S,b){s="PUSH";let $=SO(S)?S:Zg(w.location,S,b);d=u()+1;let k=CO($,d),T=w.createHref($.mask||$);try{i.pushState(k,"",T)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;o.location.assign(T)}a&&l&&l({action:s,location:w.location,delta:1})}function y(S,b){s="REPLACE";let $=SO(S)?S:Zg(w.location,S,b);d=u();let k=CO($,d),T=w.createHref($.mask||$);i.replaceState(k,"",T),a&&l&&l({action:s,location:w.location,delta:0})}function x(S){return mL(o,S)}let w={get action(){return s},get location(){return e(o,i)},listen(S){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(wO,m),l=S,()=>{o.removeEventListener(wO,m),l=null}},createHref(S){return t(o,S)},createURL:x,encodeLocation(S){let b=x(S);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:g,replace:y,go(S){return i.go(S)}};return w}function mL(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),er(r,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Oa(t);return o=o.replace(/ $/,"%20"),!n&&ax.test(o)&&(o=r+o),new URL(o,r)}var bg,kO=class{constructor(e){if(vg(this,bg,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Yi(this,bg).has(e))return Yi(this,bg).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Yi(this,bg).set(e,t)}};bg=new WeakMap;var FU=new Set(["lazy","caseSensitive","path","id","index","children"]);function _U(e){return FU.has(e)}var BU=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function UU(e){return BU.has(e)}function qU(e){return e.index===!0}function Jg(e,t,n=[],r={},o=!1){return e.map((a,i)=>{let s=[...n,String(i)],l=typeof a.id=="string"?a.id:s.join("-");if(er(a.index!==!0||!a.children,"Cannot specify children on an index route"),er(o||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),qU(a)){let d={...a,id:l};return r[l]=$O(d,t(d)),d}else{let d={...a,id:l,children:void 0};return r[l]=$O(d,t(d)),a.children&&(d.children=Jg(a.children,t,s,r,o)),d}})}function $O(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function gL(e,t,n="/"){return Ds(e,t,n,!1)}function Ds(e,t,n,r,o){let a=typeof t=="string"?$l(t):t,i=Ga(a.pathname||"/",n);if(i==null)return null;let s=o??Yb(e),l=null,d=tq(i);for(let u=0;l==null&&u<s.length;++u)l=eq(s[u],d,r);return l}function HU(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Yb(e){let t=yL(e);return VU(t),t}function yL(e,t=[],n=[],r="",o=!1){let a=(i,s,l=o,d)=>{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&l)return;er(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let m=ts([r,u.relativePath]),g=n.concat(u);i.children&&i.children.length>0&&(er(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),yL(i.children,t,g,m,l)),!(i.path==null&&!i.index)&&t.push({path:m,score:ZU(m,i.index),routesMeta:g.map((y,x)=>{let[w,S]=xL(y.relativePath,y.caseSensitive,x===g.length-1);return{...y,matcher:w,compiledParams:S}})})};return e.forEach((i,s)=>{if(i.path===""||!i.path?.includes("?"))a(i,s);else for(let l of vL(i.path))a(i,s,!0,l)}),t}function vL(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let i=vL(r.join("/")),s=[];return s.push(...i.map(l=>l===""?a:[a,l].join("/"))),o&&s.push(...i),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function VU(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:JU(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var WU=/^:[\w-]+$/,YU=3,GU=2,KU=1,QU=10,XU=-2,RO=e=>e==="*";function ZU(e,t){let n=e.split("/"),r=n.length;return n.some(RO)&&(r+=XU),t&&(r+=GU),n.filter(o=>!RO(o)).reduce((o,a)=>o+(WU.test(a)?YU:a===""?KU:QU),r)}function JU(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function eq(e,t,n=!1){let{routesMeta:r}=e,o={},a="/",i=[];for(let s=0;s<r.length;++s){let l=r[s],d=s===r.length-1,u=a==="/"?t:t.slice(a.length)||"/",m={path:l.relativePath,caseSensitive:l.caseSensitive,end:d},g=l.matcher&&l.compiledParams?bL(m,u,l.matcher,l.compiledParams):x0(m,u),y=l.route;if(!g&&d&&n&&!r[r.length-1].route.index&&(g=x0({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!g)return null;Object.assign(o,g.params),i.push({params:o,pathname:ts([a,g.pathname]),pathnameBase:oq(ts([a,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(a=ts([a,g.pathnameBase]))}return i}function x0(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=xL(e.path,e.caseSensitive,e.end);return bL(e,t,n,r)}function bL(e,t,n,r){let o=t.match(n);if(!o)return null;let a=o[0],i=Fp(a,1),s=o.slice(1);return{params:r.reduce((d,{paramName:u,isOptional:m},g)=>{if(u==="*"){let x=s[g]||"";i=Fp(a.slice(0,a.length-x.length),1)}const y=s[g];return m&&!y?d[u]=void 0:d[u]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:i,pattern:e}}function xL(e,t=!1,n=!0){ko(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 r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l,d,u)=>{if(r.push({paramName:s,isOptional:l!=null}),l){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function tq(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ko(!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 Ga(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function nq({basename:e,pathname:t}){return t==="/"?e:ts([e,t])}var N$=e=>ox.test(e);function rq(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?$l(e):e,a;return n?(n=I$(n),n.startsWith("/")||n.startsWith("\\")?a=TO(n.substring(1),"/"):a=TO(n,t)):a=t,{pathname:a,search:aq(r),hash:iq(o)}}function TO(e,t){let n=Fp(t).split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function kS(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function wL(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ix(e){let t=wL(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function My(e,t,n,r=!1){let o;typeof e=="string"?o=$l(e):(o={...e},er(!o.pathname||!o.pathname.includes("?"),kS("?","pathname","search",o)),er(!o.pathname||!o.pathname.includes("#"),kS("#","pathname","hash",o)),er(!o.search||!o.search.includes("#"),kS("#","search","hash",o)));let a=e===""||o.pathname==="",i=a?"/":o.pathname,s;if(i==null)s=n;else{let m=t.length-1;if(!r&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),m-=1;o.pathname=g.join("/")}s=m>=0?t[m]:"/"}let l=rq(o,s),d=i&&i!=="/"&&i.endsWith("/"),u=(a||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(d||u)&&(l.pathname+="/"),l}var I$=e=>e.replace(/[\\/]{2,}/g,"/"),ts=e=>I$(e.join("/"));function Fp(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var oq=e=>Fp(e).replace(/^\/*/,"/"),aq=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,iq=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,sq=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Oy=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ey(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Py(e){let t=e.map(n=>n.route.path).filter(Boolean);return ts(t)||"/"}var SL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function CL(e,t){let n=e;if(typeof n!="string"||!ox.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(SL)try{let a=new URL(window.location.href),i=ax.test(n)?new URL(hL(n,a.protocol)):new URL(n),s=Ga(i.pathname,t);i.origin===a.origin&&s!=null?n=s+i.search+i.hash:o=!0}catch{ko(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}var iu=Symbol("Uninstrumented");function lq(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(a){let i=Object.keys(n);for(let s of i)a[s]&&n[s].push(a[s])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let o=Sp(n.lazy,t.lazy,()=>{});o&&(r.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(a=>{let i=o[a],s=n[`lazy.${a}`];if(typeof i=="function"&&s.length>0){let l=Sp(s,i,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[a]:l}))}})}return["loader","action"].forEach(o=>{let a=t[o];if(typeof a=="function"&&n[o].length>0){let i=a[iu]??a,s=Sp(n[o],i,(...l)=>EO(l[0]));s&&(o==="loader"&&i.hydrate===!0&&(s.hydrate=!0),s[iu]=i,r[o]=s)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(o=>{let a=o[iu]??o,i=Sp(n.middleware,a,(...s)=>EO(s[0]));return i?(i[iu]=a,i):o})),r}function cq(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(o){let a=Object.keys(o);for(let i of a)o[i]&&n[i].push(o[i])}})),n.navigate.length>0){let r=e.navigate[iu]??e.navigate,o=Sp(n.navigate,r,(...a)=>{let[i,s]=a;return{to:typeof i=="number"||typeof i=="string"?i:i?Oa(i):".",...MO(e,s??{})}});o&&(o[iu]=r,e.navigate=o)}if(n.fetch.length>0){let r=e.fetch[iu]??e.fetch,o=Sp(n.fetch,r,(...a)=>{let[i,,s,l]=a;return{href:s??".",fetcherKey:i,...MO(e,l??{})}});o&&(o[iu]=r,e.fetch=o)}return e}function Sp(e,t,n){return e.length===0?null:async(...r)=>{let o=await kL(e,n(...r),()=>t(...r),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function kL(e,t,n,r){let o=e[r],a;if(o){let i,s=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=kL(e,t,n,r-1),a=await i,er(a,"Expected a result"),a.type==="error"&&a.value instanceof Error?{status:"error",error:a.value}:{status:"success",error:void 0});try{await o(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}i||await s(),await i}else try{a={type:"success",value:await n()}}catch(i){a={type:"error",value:i}}return a||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function EO(e){let{request:t,context:n,params:r,pattern:o}=e;return{request:uq(t),params:{...r},pattern:o,context:dq(n)}}function MO(e,t){return{currentUrl:Oa(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 uq(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function dq(e){if(pq(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var fq=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function pq(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")===fq}var OO=new URL("http://localhost");function L$(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),OO)}catch{return OO}}function $S(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function hq(e,t){if(e.startsWith("//"))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===""||e.slice(n.length).startsWith("//"):!1}function Mp(e,t,n,r){let o=null;try{o=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),i=o!=null&&!$S(o,n),s=!$S(a,n);if(r==="reject"){if(i||s)throw new Error("External navigation is not allowed")}else if(s&&(o==null||!hq(e,o)||!$S(o,a)))throw new Error("External navigation is not allowed")}var $L=["POST","PUT","PATCH","DELETE"],mq=new Set($L),gq=["GET",...$L],yq=new Set(gq),RL=new Set([301,302,303,307,308]),vq=new Set([307,308]),RS={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},bq={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},hp={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},xq=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),TL="remix-router-transitions",EL=Symbol("ResetLoaderData"),dd,mp,eu,gp,wq=class{constructor(e){vg(this,dd),vg(this,mp),vg(this,eu),vg(this,gp),el(this,dd,e),el(this,mp,Yb(e))}get stableRoutes(){return Yi(this,dd)}get activeRoutes(){return Yi(this,eu)??Yi(this,dd)}get branches(){return Yi(this,gp)??Yi(this,mp)}get hasHMRRoutes(){return Yi(this,eu)!=null}setRoutes(e){el(this,dd,e),el(this,mp,Yb(e))}setHmrRoutes(e){el(this,eu,e),el(this,gp,Yb(e))}commitHmrRoutes(){Yi(this,eu)&&(el(this,dd,Yi(this,eu)),el(this,mp,Yi(this,gp)),el(this,eu,void 0),el(this,gp,void 0))}};dd=new WeakMap;mp=new WeakMap;eu=new WeakMap;gp=new WeakMap;function Sq(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";er(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],o=e.mapRouteProperties||xq,a=o;if(e.instrumentations){let xe=e.instrumentations;a=Ee=>({...o(Ee),...lq(xe.map(Be=>Be.route).filter(Boolean),Ee)})}let i={},s=new wq(Jg(e.routes,a,void 0,i)),l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let d=e.dataStrategy||Tq,u={...e.future},m=null,g=new Set,y=null,x=null,w=null,S=null,b=e.hydrationData!=null,$=Ds(s.activeRoutes,e.history.location,l,!1,s.branches),k=!1,T=null,O,P;if($==null&&!e.patchRoutesOnNavigation){let xe=Gi(404,{pathname:e.history.location.pathname}),{matches:Ee,route:Be}=ab(s.activeRoutes);O=!0,P=!O,$=Ee,T={[Be.id]:xe}}else if($&&!e.hydrationData&&jt($,s.activeRoutes,e.history.location.pathname).active&&($=null),$)if($.some(xe=>xe.route.lazy))O=!1,P=!O;else if(!$.some(xe=>z$(xe.route)))O=!0,P=!O;else{let xe=e.hydrationData?e.hydrationData.loaderData:null,Ee=e.hydrationData?e.hydrationData.errors:null,Be=$;if(Ee){let Ye=$.findIndex(ut=>Ee[ut.route.id]!==void 0);Be=Be.slice(0,Ye+1)}P=!1,O=!0,Be.forEach(Ye=>{let ut=ML(Ye.route,xe,Ee);P=P||ut.renderFallback,O=O&&!ut.shouldLoad})}else{O=!1,P=!O,$=[];let xe=jt(null,s.activeRoutes,e.history.location.pathname);xe.active&&xe.matches&&(k=!0,$=xe.matches)}let D,A={historyAction:e.history.action,location:e.history.location,matches:$,initialized:O,renderFallback:P,navigation:RS,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||T,fetchers:new Map,blockers:new Map},F="POP",L=null,_=!1,R,z=!1,N=new Map,B=null,I=!1,H=!1,Y=new Set,ae=new Map,K=0,oe=-1,ue=new Map,G=new Set,ie=new Map,Q=new Map,ee=new Set,Z=new Map,de,le=null;function fe(){if(m=e.history.listen(({action:xe,location:Ee,delta:Be})=>{if(de){de(),de=void 0;return}ko(Z.size===0||Be!=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 Ye=qt({currentLocation:A.location,nextLocation:Ee,historyAction:xe});if(Ye&&Be!=null){let ut=new Promise(Et=>{de=Et});e.history.go(Be*-1),$n(Ye,{state:"blocked",location:Ee,proceed(){$n(Ye,{state:"proceeding",proceed:void 0,reset:void 0,location:Ee}),ut.then(()=>e.history.go(Be))},reset(){let Et=new Map(A.blockers);Et.set(Ye,hp),se({blockers:Et})}}),L?.resolve(),L=null;return}return Re(xe,Ee)}),n){Wq(t,N);let xe=()=>Yq(t,N);t.addEventListener("pagehide",xe),B=()=>t.removeEventListener("pagehide",xe)}return A.initialized||Re("POP",A.location,{initialHydration:!0}),D}function he(){m&&m(),B&&B(),g.clear(),R&&R.abort(),A.fetchers.forEach((xe,Ee)=>Rt(A.fetchers,Ee)),A.blockers.forEach((xe,Ee)=>pn(Ee))}function me(xe){if(g.add(xe),y){let{newErrors:Ee}=y;y=null,xe(A,{deletedFetchers:[],newErrors:Ee,viewTransitionOpts:void 0,flushSync:!1})}return()=>g.delete(xe)}function se(xe,Ee={}){xe.matches&&(xe.matches=xe.matches.map(ut=>{let Et=i[ut.route.id],Ct=ut.route;return Ct.element!==Et.element||Ct.errorElement!==Et.errorElement||Ct.hydrateFallbackElement!==Et.hydrateFallbackElement?{...ut,route:Et}:ut})),A={...A,...xe};let Be=[],Ye=[];A.fetchers.forEach((ut,Et)=>{ut.state==="idle"&&(ee.has(Et)?Be.push(Et):Ye.push(Et))}),ee.forEach(ut=>{!A.fetchers.has(ut)&&!ae.has(ut)&&Be.push(ut)}),g.size===0&&(y={newErrors:xe.errors??null}),[...g].forEach(ut=>ut(A,{deletedFetchers:Be,newErrors:xe.errors??null,viewTransitionOpts:Ee.viewTransitionOpts,flushSync:Ee.flushSync===!0})),Be.forEach(ut=>Rt(A.fetchers,ut)),Ye.forEach(ut=>A.fetchers.delete(ut))}function ve(xe,Ee,{flushSync:Be}={}){let Ye=A.actionData!=null&&A.navigation.formMethod!=null&&ya(A.navigation.formMethod)&&A.navigation.state==="loading"&&xe.state?._isRedirect!==!0,ut;Ee.actionData?Object.keys(Ee.actionData).length>0?ut=Ee.actionData:ut=null:Ye?ut=A.actionData:ut=null;let Et=Ee.loaderData?_O(A.loaderData,Ee.loaderData,Ee.matches||[],Ee.errors):A.loaderData,Ct=A.blockers;Ct.size>0&&(Ct=new Map(Ct),Ct.forEach((zt,Vt)=>Ct.set(Vt,hp)));let Mt=I?!1:en(xe,Ee.matches||A.matches),Lt=_===!0||A.navigation.formMethod!=null&&ya(A.navigation.formMethod)&&xe.state?._isRedirect!==!0;s.commitHmrRoutes(),I||F==="POP"||(F==="PUSH"?e.history.push(xe,xe.state):F==="REPLACE"&&e.history.replace(xe,xe.state));let Xt;if(F==="POP"&&!I&&xe!==A.location){let zt=N.get(A.location.pathname);zt&&zt.has(xe.pathname)?Xt={currentLocation:A.location,nextLocation:xe}:N.has(xe.pathname)&&(Xt={currentLocation:xe,nextLocation:A.location})}else if(z){let zt=N.get(A.location.pathname);zt?zt.add(xe.pathname):(zt=new Set([xe.pathname]),N.set(A.location.pathname,zt)),Xt={currentLocation:A.location,nextLocation:xe}}se({...Ee,actionData:ut,loaderData:Et,historyAction:F,location:xe,initialized:!0,renderFallback:!1,navigation:RS,revalidation:"idle",restoreScrollPosition:Mt,preventScrollReset:Lt,blockers:Ct},{viewTransitionOpts:Xt,flushSync:Be===!0}),F="POP",_=!1,z=!1,I=!1,H=!1,L?.resolve(),L=null,le?.resolve(),le=null}async function Le(xe,Ee){if(L?.resolve(),L=null,typeof xe=="number"){L||(L=HO());let Ue=L.promise;return e.history.go(xe),Ue}let Be=qC(A.location,A.matches,l,xe,Ee?.fromRouteId,Ee?.relative),{path:Ye,submission:ut,error:Et}=PO(!1,Be,Ee),Ct;if(Ee?.mask){let Ue=typeof Ee.mask=="string"?$l(Ee.mask):{...A.location.mask,...Ee.mask};if(Ct={pathname:Ue.pathname??"",search:Ue.search??"",hash:Ue.hash??""},ax.test(Ct.pathname))throw new Error("External navigation is not allowed");Ct.pathname.startsWith("\\")&&(Ct.pathname=Ct.pathname.replace(/^\\+/,"/")),Mp(typeof Ee.mask=="string"?Ee.mask:Oa(Ee.mask),Oa(Ct),e.history.createURL("/"),"reject")}let Mt=A.location,Lt=Zg(Mt,Ye,Ee&&Ee.state,void 0,Ct);Lt={...Lt,...e.history.encodeLocation(Lt)},Mp(xe==null?e.history.createHref(A.location):typeof xe=="string"?xe:Oa(xe),e.history.createHref(Lt.mask||Lt),e.history.createURL("/"),"reject");let Xt=Ee&&Ee.replace!=null?Ee.replace:void 0,zt="PUSH";Xt===!0?zt="REPLACE":Xt===!1||ut!=null&&ya(ut.formMethod)&&ut.formAction===A.location.pathname+A.location.search&&(zt="REPLACE");let Vt=Ee&&"preventScrollReset"in Ee?Ee.preventScrollReset===!0:void 0,ge=(Ee&&Ee.flushSync)===!0,ye=qt({currentLocation:Mt,nextLocation:Lt,historyAction:zt});if(ye){$n(ye,{state:"blocked",location:Lt,proceed(){$n(ye,{state:"proceeding",proceed:void 0,reset:void 0,location:Lt}),Le(xe,Ee)},reset(){let Ue=new Map(A.blockers);Ue.set(ye,hp),se({blockers:Ue})}});return}await Re(zt,Lt,{submission:ut,pendingError:Et,preventScrollReset:Vt,replace:Ee&&Ee.replace,enableViewTransition:Ee&&Ee.viewTransition,flushSync:ge,callSiteDefaultShouldRevalidate:Ee&&Ee.defaultShouldRevalidate})}function Ae(){le||(le=HO()),ze(),se({revalidation:"loading"});let xe=le.promise;return A.navigation.state==="submitting"?xe:A.navigation.state==="idle"?(Re(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),xe):(Re(F||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:z===!0}),xe)}async function Re(xe,Ee,Be){R&&R.abort(),R=null,F=xe,I=(Be&&Be.startUninterruptedRevalidation)===!0,Rn(A.location,A.matches),_=(Be&&Be.preventScrollReset)===!0,z=(Be&&Be.enableViewTransition)===!0;let Ye=s.activeRoutes,ut=Be?.initialHydration&&A.matches&&A.matches.length>0&&!k?A.matches:Ds(Ye,Ee,l,!1,s.branches),Et=(Be&&Be.flushSync)===!0;if(ut&&A.initialized&&!H&&Iq(A.location,Ee)&&!(Be&&Be.submission&&ya(Be.submission.formMethod))){ve(Ee,{matches:ut},{flushSync:Et});return}let Ct=jt(ut,Ye,Ee.pathname);if(Ct.active&&Ct.matches&&(ut=Ct.matches),!ut){let{error:We,notFoundMatches:Nt,route:Kt}=Pn(Ee.pathname);ve(Ee,{matches:Nt,loaderData:{},errors:{[Kt.id]:We}},{flushSync:Et});return}let Mt=Be&&Be.overrideNavigation?{...Be.overrideNavigation,matches:ut,historyAction:xe}:void 0;R=new AbortController;let Lt=yp(e.history,Ee,R.signal,Be&&Be.submission),Xt=e.getContext?await e.getContext():new kO,zt;if(Be&&Be.pendingError)zt=[nu(ut).route.id,{type:"error",error:Be.pendingError}];else if(Be&&Be.submission&&ya(Be.submission.formMethod)){let We=await re(Lt,Ee,Be.submission,ut,xe,Xt,Ct.active,Be&&Be.initialHydration===!0,{replace:Be.replace,flushSync:Et});if(We.shortCircuited)return;if(We.pendingActionResult){let[Nt,Kt]=We.pendingActionResult;if(gi(Kt)&&ey(Kt.error)&&Kt.error.status===404){R=null,ve(Ee,{matches:We.matches,loaderData:{},errors:{[Nt]:Kt.error}});return}}ut=We.matches||ut,zt=We.pendingActionResult,Mt=TS(Ee,ut,xe,Be.submission),Et=!1,Ct.active=!1,Lt=yp(e.history,Lt.url,Lt.signal)}let{shortCircuited:Vt,matches:ge,loaderData:ye,errors:Ue,workingFetchers:gt}=await _e(Lt,Ee,ut,xe,Xt,Ct.active,Mt,Be&&Be.submission,Be&&Be.fetcherSubmission,Be&&Be.replace,Be&&Be.initialHydration===!0,Et,zt,Be&&Be.callSiteDefaultShouldRevalidate);Vt||(R=null,ve(Ee,{matches:ge||ut,...BO(zt),loaderData:ye,errors:Ue,...gt?{fetchers:gt}:{}}))}async function re(xe,Ee,Be,Ye,ut,Et,Ct,Mt,Lt={}){ze();let Xt=Hq(Ee,Ye,ut,Be);if(se({navigation:Xt},{flushSync:Lt.flushSync===!0}),Ct){let ge=await Ur(Ye,Ee.pathname,xe.signal);if(ge.type==="aborted")return{shortCircuited:!0};if(ge.type==="error"){if(ge.partialMatches.length===0){let{matches:Ue,route:gt}=ab(s.activeRoutes);return{matches:Ue,pendingActionResult:[gt.id,{type:"error",error:ge.error}]}}let ye=nu(ge.partialMatches).route.id;return{matches:ge.partialMatches,pendingActionResult:[ye,{type:"error",error:ge.error}]}}else if(ge.matches)Ye=ge.matches;else{let{notFoundMatches:ye,error:Ue,route:gt}=Pn(Ee.pathname);return{matches:ye,pendingActionResult:[gt.id,{type:"error",error:Ue}]}}}let zt,Vt=Gb(Ye,Ee);if(!Vt.route.action&&!Vt.route.lazy)zt={type:"error",error:Gi(405,{method:xe.method,pathname:Ee.pathname,routeId:Vt.route.id})};else{let ge=Op(a,i,xe,Ee,Ye,Vt,Mt?[]:r,Et),ye=await tt(xe,Ee,ge,Et,null);if(zt=ye[Vt.route.id],!zt){for(let Ue of Ye)if(ye[Ue.route.id]){zt=ye[Ue.route.id];break}}if(xe.signal.aborted)return{shortCircuited:!0}}if(vd(zt)){let ge;return Lt&&Lt.replace!=null?ge=Lt.replace:ge=LO(zt.response.headers.get("Location"),new URL(xe.url),l,e.history)===A.location.pathname+A.location.search,await at(xe,zt,!0,{submission:Be,replace:ge}),{shortCircuited:!0}}if(gi(zt)){let ge=nu(Ye,Vt.route.id);return(Lt&&Lt.replace)!==!0&&(F="PUSH"),{matches:Ye,pendingActionResult:[ge.route.id,zt,Vt.route.id]}}return{matches:Ye,pendingActionResult:[Vt.route.id,zt]}}async function _e(xe,Ee,Be,Ye,ut,Et,Ct,Mt,Lt,Xt,zt,Vt,ge,ye){let Ue=Ct||TS(Ee,Be,Ye,Mt),gt=Mt||Lt||qO(Ue),We=!I&&!zt;if(Et){if(We){let Dr=Me(ge);se({navigation:Ue,...Dr!==void 0?{actionData:Dr}:{}},{flushSync:Vt})}let tn=await Ur(Be,Ee.pathname,xe.signal);if(tn.type==="aborted")return{shortCircuited:!0};if(tn.type==="error"){if(tn.partialMatches.length===0){let{matches:fo,route:Do}=ab(s.activeRoutes);return{matches:fo,loaderData:{},errors:{[Do.id]:tn.error}}}let Dr=nu(tn.partialMatches).route.id;return{matches:tn.partialMatches,loaderData:{},errors:{[Dr]:tn.error}}}else if(tn.matches)Be=tn.matches;else{let{error:Dr,notFoundMatches:fo,route:Do}=Pn(Ee.pathname);return{matches:fo,loaderData:{},errors:{[Do.id]:Dr}}}}let Nt=s.activeRoutes,{dsMatches:Kt,revalidatingFetchers:hn}=jO(xe,ut,a,i,e.history,A,Be,gt,Ee,zt?[]:r,zt===!0,H,Y,ee,ie,G,Nt,l,e.patchRoutesOnNavigation!=null,s.branches,ge,ye);if(oe=++K,!e.dataStrategy&&!Kt.some(tn=>tn.shouldLoad)&&!Kt.some(tn=>tn.route.middleware&&tn.route.middleware.length>0)&&hn.length===0){let tn=new Map(A.fetchers),Dr=Dt(tn);return ve(Ee,{matches:Be,loaderData:{},errors:ge&&gi(ge[1])?{[ge[0]]:ge[1].error}:null,...BO(ge),...Dr?{fetchers:tn}:{}},{flushSync:Vt}),{shortCircuited:!0}}if(We){let tn={};if(!Et){tn.navigation=Ue;let Dr=Me(ge);Dr!==void 0&&(tn.actionData=Dr)}hn.length>0&&(tn.fetchers=Ge(hn)),se(tn,{flushSync:Vt})}hn.forEach(tn=>{it(tn.key),tn.controller&&ae.set(tn.key,tn.controller)});let we=()=>hn.forEach(tn=>it(tn.key));R&&R.signal.addEventListener("abort",we);let{loaderResults:Pe,fetcherResults:ft}=await pt(Kt,hn,xe,Ee,ut);if(xe.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener("abort",we),hn.forEach(tn=>ae.delete(tn.key));let kt=ib(Pe);if(kt)return await at(xe,kt.result,!0,{replace:Xt}),{shortCircuited:!0};if(kt=ib(ft),kt)return G.add(kt.key),await at(xe,kt.result,!0,{replace:Xt}),{shortCircuited:!0};let Ot=new Map(A.fetchers),{loaderData:Pt,errors:Ft}=FO(A,Be,Pe,ge,hn,ft,Ot);zt&&A.errors&&(Ft={...A.errors,...Ft});let on=Dt(Ot),On=nn(oe,Ot),or=on||On||hn.length>0;return{matches:Be,loaderData:Pt,errors:Ft,...or?{workingFetchers:Ot}:{}}}function Me(xe){if(xe&&!gi(xe[1]))return{[xe[0]]:xe[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function Ge(xe){let Ee=new Map(A.fetchers);return xe.forEach(Be=>{let Ye=Ee.get(Be.key),ut=Em(void 0,Ye?Ye.data:void 0);Ee.set(Be.key,ut)}),Ee}async function Je(xe,Ee,Be,Ye){it(xe);let ut=(Ye&&Ye.flushSync)===!0,Et=s.activeRoutes,Ct=qC(A.location,A.matches,l,Be,Ee,Ye?.relative),Mt=Ds(Et,Ct,l,!1,s.branches),Lt=jt(Mt,Et,Ct);if(Lt.active&&Lt.matches&&(Mt=Lt.matches),!Mt){Ve(xe,Ee,Gi(404,{pathname:Ct}),{flushSync:ut});return}let{path:Xt,submission:zt,error:Vt}=PO(!0,Ct,Ye);if(Vt){Ve(xe,Ee,Vt,{flushSync:ut});return}let ge=e.getContext?await e.getContext():new kO,ye=(Ye&&Ye.preventScrollReset)===!0;if(zt&&ya(zt.formMethod)){await St(xe,Ee,Xt,Mt,ge,Lt.active,ut,ye,zt,Ye&&Ye.defaultShouldRevalidate);return}ie.set(xe,{routeId:Ee,path:Xt}),await Ut(xe,Ee,Xt,Mt,ge,Lt.active,ut,ye,zt)}async function St(xe,Ee,Be,Ye,ut,Et,Ct,Mt,Lt,Xt){ze(),ie.delete(xe);let zt=A.fetchers.get(xe);be(xe,Vq(Lt,zt),{flushSync:Ct});let Vt=new AbortController,ge=yp(e.history,Be,Vt.signal,Lt);if(Et){let fr=await Ur(Ye,new URL(ge.url).pathname,ge.signal,xe);if(fr.type==="aborted")return;if(fr.type==="error"){Ve(xe,Ee,fr.error,{flushSync:Ct});return}else if(fr.matches)Ye=fr.matches;else{Ve(xe,Ee,Gi(404,{pathname:Be}),{flushSync:Ct});return}}let ye=Gb(Ye,Be);if(!ye.route.action&&!ye.route.lazy){let fr=Gi(405,{method:Lt.formMethod,pathname:Be,routeId:Ee});Ve(xe,Ee,fr,{flushSync:Ct});return}ae.set(xe,Vt);let Ue=K,gt=Op(a,i,ge,Be,Ye,ye,r,ut),We=await tt(ge,Be,gt,ut,xe),Nt=We[ye.route.id];if(!Nt){for(let fr of gt)if(We[fr.route.id]){Nt=We[fr.route.id];break}}if(ge.signal.aborted){ae.get(xe)===Vt&&ae.delete(xe);return}if(ee.has(xe)){if(vd(Nt)||gi(Nt)){be(xe,il(void 0));return}}else{if(vd(Nt))if(ae.delete(xe),oe>Ue){be(xe,il(void 0));return}else return G.add(xe),be(xe,Em(Lt)),at(ge,Nt,!1,{fetcherSubmission:Lt,preventScrollReset:Mt});if(gi(Nt)){Ve(xe,Ee,Nt.error);return}}let Kt=A.navigation.location||A.location,hn=yp(e.history,Kt,Vt.signal),we=s.activeRoutes,Pe=A.navigation.state!=="idle"?Ds(we,A.navigation.location,l,!1,s.branches):A.matches;er(Pe,"Didn't find any matches after fetcher action");let ft=++K;ue.set(xe,ft);let{dsMatches:kt,revalidatingFetchers:Ot}=jO(hn,ut,a,i,e.history,A,Pe,Lt,Kt,r,!1,H,Y,ee,ie,G,we,l,e.patchRoutesOnNavigation!=null,s.branches,[ye.route.id,Nt],Xt),Pt=Em(Lt,Nt.data),Ft=new Map(A.fetchers);Ft.set(xe,Pt),Ot.filter(fr=>fr.key!==xe).forEach(fr=>{let qr=fr.key,ti=Ft.get(qr),El=Em(void 0,ti?ti.data:void 0);Ft.set(qr,El),it(qr),fr.controller&&ae.set(qr,fr.controller)}),se({fetchers:Ft});let on=()=>Ot.forEach(fr=>it(fr.key));Vt.signal.addEventListener("abort",on);let{loaderResults:On,fetcherResults:or}=await pt(kt,Ot,hn,Kt,ut);if(Vt.signal.aborted)return;Vt.signal.removeEventListener("abort",on),ue.delete(xe),ae.delete(xe),Ot.forEach(fr=>ae.delete(fr.key));let tn=A.fetchers.has(xe),Dr=fr=>{if(!tn)return fr;let qr=new Map(fr.fetchers);return qr.set(xe,il(Nt.data)),{...fr,fetchers:qr}},fo=ib(On);if(fo)return A=Dr(A),at(hn,fo.result,!1,{preventScrollReset:Mt});if(fo=ib(or),fo)return G.add(fo.key),A=Dr(A),at(hn,fo.result,!1,{preventScrollReset:Mt});let Do=new Map(A.fetchers);tn&&Do.set(xe,il(Nt.data));let{loaderData:vs,errors:ca}=FO(A,Pe,On,void 0,Ot,or,Do);nn(ft,Do),A.navigation.state==="loading"&&ft>oe?(er(F,"Expected pending action"),R&&R.abort(),ve(A.navigation.location,{matches:Pe,loaderData:vs,errors:ca,fetchers:Do})):(se({errors:ca,loaderData:_O(A.loaderData,vs,Pe,ca),fetchers:Do}),H=!1)}async function Ut(xe,Ee,Be,Ye,ut,Et,Ct,Mt,Lt){let Xt=A.fetchers.get(xe);be(xe,Em(Lt,Xt?Xt.data:void 0),{flushSync:Ct});let zt=new AbortController,Vt=yp(e.history,Be,zt.signal);if(Et){let Nt=await Ur(Ye,new URL(Vt.url).pathname,Vt.signal,xe);if(Nt.type==="aborted")return;if(Nt.type==="error"){Ve(xe,Ee,Nt.error,{flushSync:Ct});return}else if(Nt.matches)Ye=Nt.matches;else{Ve(xe,Ee,Gi(404,{pathname:Be}),{flushSync:Ct});return}}let ge=Gb(Ye,Be);ae.set(xe,zt);let ye=K,Ue=Op(a,i,Vt,Be,Ye,ge,r,ut),gt=await tt(Vt,Be,Ue,ut,xe),We=gt[ge.route.id];if(!We){for(let Nt of Ye)if(gt[Nt.route.id]){We=gt[Nt.route.id];break}}if(ae.get(xe)===zt&&ae.delete(xe),!Vt.signal.aborted){if(ee.has(xe)){be(xe,il(void 0));return}if(vd(We))if(oe>ye){be(xe,il(void 0));return}else{G.add(xe),await at(Vt,We,!1,{preventScrollReset:Mt});return}if(gi(We)){Ve(xe,Ee,We.error);return}be(xe,il(We.data))}}async function at(xe,Ee,Be,{submission:Ye,fetcherSubmission:ut,preventScrollReset:Et,replace:Ct}={}){Be||(L?.resolve(),L=null),Ee.response.headers.has("X-Remix-Revalidate")&&(H=!0);let Mt=Ee.response.headers.get("Location");er(Mt,"Expected a Location header on the redirect Response");let Lt=Mt,Xt=new URL(xe.url);Mt=LO(Mt,Xt,l,e.history),Mp(Lt,Mt,Xt,"allow-explicit");let zt=Zg(A.location,Mt,{_isRedirect:!0});if(n){let We=!1;if(Ee.response.headers.has("X-Remix-Reload-Document"))We=!0;else if(N$(Mt)){const Nt=mL(t,Mt,!0);We=Nt.origin!==t.location.origin||Ga(Nt.pathname,l)==null}if(We){Ct?t.location.replace(Mt):t.location.assign(Mt);return}}R=null;let Vt=Ct===!0||Ee.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:ge,formAction:ye,formEncType:Ue}=A.navigation;!Ye&&!ut&&ge&&ye&&Ue&&(Ye=qO(A.navigation));let gt=Ye||ut;if(vq.has(Ee.response.status)&&gt&&ya(gt.formMethod))await Re(Vt,zt,{submission:{...gt,formAction:Mt},preventScrollReset:Et||_,enableViewTransition:Be?z:void 0});else{let We=TS(zt,[],Vt,Ye);await Re(Vt,zt,{overrideNavigation:We,fetcherSubmission:ut,preventScrollReset:Et||_,enableViewTransition:Be?z:void 0})}}async function tt(xe,Ee,Be,Ye,ut){let Et,Ct={};try{Et=await Mq(d,xe,Ee,Be,ut,Ye,!1)}catch(Mt){return Be.filter(Lt=>Lt.shouldLoad).forEach(Lt=>{Ct[Lt.route.id]={type:"error",error:Mt}}),Ct}if(xe.signal.aborted)return Ct;if(!ya(xe.method))for(let Mt of Be){if(Et[Mt.route.id]?.type==="error")break;!Et.hasOwnProperty(Mt.route.id)&&!A.loaderData.hasOwnProperty(Mt.route.id)&&(!A.errors||!A.errors.hasOwnProperty(Mt.route.id))&&Mt.shouldCallHandler()&&(Et[Mt.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Mt.route.id}`)})}for(let[Mt,Lt]of Object.entries(Et))if(_q(Lt)){let Xt=Lt.result;Ct[Mt]={type:"redirect",response:Aq(Xt,xe,Mt,Be,l)}}else Ct[Mt]=await jq(Lt);return Ct}async function pt(xe,Ee,Be,Ye,ut){let Et=tt(Be,Ye,xe,ut,null),Ct=Promise.all(Ee.map(async Xt=>{if(Xt.matches&&Xt.match&&Xt.request&&Xt.controller){let Vt=(await tt(Xt.request,Xt.path,Xt.matches,ut,Xt.key))[Xt.match.route.id];return{[Xt.key]:Vt}}else return Promise.resolve({[Xt.key]:{type:"error",error:Gi(404,{pathname:Xt.path})}})})),Mt=await Et,Lt=(await Ct).reduce((Xt,zt)=>Object.assign(Xt,zt),{});return{loaderResults:Mt,fetcherResults:Lt}}function ze(){H=!0,ie.forEach((xe,Ee)=>{ae.has(Ee)&&Y.add(Ee),it(Ee)})}function be(xe,Ee,Be={}){let Ye=new Map(A.fetchers);Ye.set(xe,Ee),se({fetchers:Ye},{flushSync:(Be&&Be.flushSync)===!0})}function Ve(xe,Ee,Be,Ye={}){let ut=nu(A.matches,Ee),Et=new Map(A.fetchers);Rt(Et,xe),se({errors:{[ut.route.id]:Be},fetchers:Et},{flushSync:(Ye&&Ye.flushSync)===!0})}function Oe(xe){return Q.set(xe,(Q.get(xe)||0)+1),ee.has(xe)&&ee.delete(xe),A.fetchers.get(xe)||bq}function $t(xe,Ee){it(xe,Ee?.reason),be(xe,il(null))}function Rt(xe,Ee){let Be=A.fetchers.get(Ee);ae.has(Ee)&&!(Be&&Be.state==="loading"&&ue.has(Ee))&&it(Ee),ie.delete(Ee),ue.delete(Ee),G.delete(Ee),ee.delete(Ee),Y.delete(Ee),xe.delete(Ee)}function vt(xe){let Ee=(Q.get(xe)||0)-1;Ee<=0?(Q.delete(xe),ee.add(xe)):Q.set(xe,Ee),se({fetchers:new Map(A.fetchers)})}function it(xe,Ee){let Be=ae.get(xe);Be&&(Be.abort(Ee),ae.delete(xe))}function st(xe,Ee){for(let Be of xe){let Ye=Ee.get(Be);er(Ye,`Expected fetcher: ${Be}`);let ut=il(Ye.data);Ee.set(Be,ut)}}function Dt(xe){let Ee=[],Be=!1;for(let Ye of G){let ut=xe.get(Ye);er(ut,`Expected fetcher: ${Ye}`),ut.state==="loading"&&(G.delete(Ye),Ee.push(Ye),Be=!0)}return st(Ee,xe),Be}function nn(xe,Ee){let Be=[];for(let[Ye,ut]of ue)if(ut<xe){let Et=Ee.get(Ye);er(Et,`Expected fetcher: ${Ye}`),Et.state==="loading"&&(it(Ye),ue.delete(Ye),Be.push(Ye))}return st(Be,Ee),Be.length>0}function Bt(xe,Ee){let Be=A.blockers.get(xe)||hp;return Z.get(xe)!==Ee&&Z.set(xe,Ee),Be}function pn(xe){A.blockers.delete(xe),Z.delete(xe)}function $n(xe,Ee){let Be=A.blockers.get(xe)||hp;er(Be.state==="unblocked"&&Ee.state==="blocked"||Be.state==="blocked"&&Ee.state==="blocked"||Be.state==="blocked"&&Ee.state==="proceeding"||Be.state==="blocked"&&Ee.state==="unblocked"||Be.state==="proceeding"&&Ee.state==="unblocked",`Invalid blocker state transition: ${Be.state} -> ${Ee.state}`);let Ye=new Map(A.blockers);Ye.set(xe,Ee),se({blockers:Ye})}function qt({currentLocation:xe,nextLocation:Ee,historyAction:Be}){if(Z.size===0)return;Z.size>1&&ko(!1,"A router only supports one blocker at a time");let Ye=Array.from(Z.entries()),[ut,Et]=Ye[Ye.length-1],Ct=A.blockers.get(ut);if(!(Ct&&Ct.state==="proceeding")&&Et({currentLocation:xe,nextLocation:Ee,historyAction:Be}))return ut}function Pn(xe){let Ee=Gi(404,{pathname:xe}),Be=s.activeRoutes,{matches:Ye,route:ut}=ab(Be);return{notFoundMatches:Ye,route:ut,error:Ee}}function Se(xe,Ee,Be){if(x=xe,S=Ee,w=Be||null,!b&&A.navigation===RS){b=!0;let Ye=en(A.location,A.matches);Ye!=null&&se({restoreScrollPosition:Ye})}return()=>{x=null,S=null,w=null}}function jn(xe,Ee){return w&&w(xe,Ee.map(Ye=>HU(Ye,A.loaderData)))||xe.key}function Rn(xe,Ee){if(x&&S){let Be=jn(xe,Ee);x[Be]=S()}}function en(xe,Ee){if(x){let Be=jn(xe,Ee),Ye=x[Be];if(typeof Ye=="number")return Ye}return null}function jt(xe,Ee,Be){if(e.patchRoutesOnNavigation){let Ye=s.branches;if(xe){if(Object.keys(xe[0].params).length>0)return{active:!0,matches:Ds(Ee,Be,l,!0,Ye)}}else return{active:!0,matches:Ds(Ee,Be,l,!0,Ye)||[]}}return{active:!1,matches:null}}async function Ur(xe,Ee,Be,Ye){if(!e.patchRoutesOnNavigation)return{type:"success",matches:xe};let ut=xe;for(;;){let Et=i;try{await e.patchRoutesOnNavigation({signal:Be,path:Ee,matches:ut,fetcherKey:Ye,patch:(Xt,zt)=>{Be.aborted||AO(Xt,zt,s,Et,a,!1)}})}catch(Xt){return{type:"error",error:Xt,partialMatches:ut}}if(Be.aborted)return{type:"aborted"};let Ct=s.branches,Mt=Ds(s.activeRoutes,Ee,l,!1,Ct),Lt=null;if(Mt){if(Object.keys(Mt[0].params).length===0)return{type:"success",matches:Mt};if(Lt=Ds(s.activeRoutes,Ee,l,!0,Ct),!(Lt&&ut.length<Lt.length&&qn(ut,Lt.slice(0,ut.length))))return{type:"success",matches:Mt}}if(Lt||(Lt=Ds(s.activeRoutes,Ee,l,!0,Ct)),!Lt||qn(ut,Lt))return{type:"success",matches:null};ut=Lt}}function qn(xe,Ee){return xe.length===Ee.length&&xe.every((Be,Ye)=>Be.route.id===Ee[Ye].route.id)}function mn(xe){i={},s.setHmrRoutes(Jg(xe,a,void 0,i))}function Bn(xe,Ee,Be=!1){AO(xe,Ee,s,i,a,Be),s.hasHMRRoutes||se({})}return D={get basename(){return l},get future(){return u},get state(){return A},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return i},get window(){return t},initialize:fe,subscribe:me,enableScrollRestoration:Se,navigate:Le,fetch:Je,revalidate:Ae,createHref:xe=>e.history.createHref(xe),createURL:xe=>e.history.createURL(xe),encodeLocation:xe=>e.history.encodeLocation(xe),getFetcher:Oe,resetFetcher:$t,deleteFetcher:vt,dispose:he,getBlocker:Bt,deleteBlocker:pn,patchRoutes:Bn,_internalFetchControllers:ae,_internalSetRoutes:mn,_internalSetStateDoNotUseOrYouWillBreakYourApp(xe){se(xe)}},e.instrumentations&&(D=cq(D,e.instrumentations.map(xe=>xe.router).filter(Boolean))),D}function Cq(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function qC(e,t,n,r,o,a){let i,s;if(o){i=[];for(let d of t)if(i.push(d),d.route.id===o){s=d;break}}else i=t,s=t[t.length-1];let l=My(r||".",ix(i),Ga(e.pathname,n)||e.pathname,a==="path");if(r==null&&(l.search=e.search,l.hash=e.hash),(r==null||r===""||r===".")&&s){let d=_$(l.search);if(s.route.index&&!d)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&d){let u=new URLSearchParams(l.search),m=u.getAll("index");u.delete("index"),m.filter(y=>y).forEach(y=>u.append("index",y));let g=u.toString();l.search=g?`?${g}`:""}}return n!=="/"&&(l.pathname=nq({basename:n,pathname:l.pathname})),Oa(l)}function PO(e,t,n){if(!n||!Cq(n))return{path:t};if(n.formMethod&&!qq(n.formMethod))return{path:t,error:Gi(405,{method:n.formMethod})};let r=()=>({path:t,error:Gi(400,{type:"invalid-body"})}),a=(n.formMethod||"get").toUpperCase(),i=IL(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!ya(a))return r();let m=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((g,[y,x])=>`${g}${y}=${x}
60
- `,""):String(n.body);return{path:t,submission:{formMethod:a,formAction:i,formEncType:n.formEncType,formData:void 0,json:void 0,text:m}}}else if(n.formEncType==="application/json"){if(!ya(a))return r();try{let m=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:a,formAction:i,formEncType:n.formEncType,formData:void 0,json:m,text:void 0}}}catch{return r()}}}er(typeof FormData=="function","FormData is not available in this environment");let s,l;if(n.formData)s=WC(n.formData),l=n.formData;else if(n.body instanceof FormData)s=WC(n.body),l=n.body;else if(n.body instanceof URLSearchParams)s=n.body,l=zO(s);else if(n.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(n.body),l=zO(s)}catch{return r()}let d={formMethod:a,formAction:i,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(ya(d.formMethod))return{path:t,submission:d};let u=$l(t);return e&&u.search&&_$(u.search)&&s.append("index",""),u.search=`?${s}`,{path:Oa(u),submission:d}}function jO(e,t,n,r,o,a,i,s,l,d,u,m,g,y,x,w,S,b,$,k,T,O){let P=T?gi(T[1])?T[1].error:T[1].data:void 0,D=o.createURL(a.location),A=o.createURL(l),F;if(u&&a.errors){let I=Object.keys(a.errors)[0];F=i.findIndex(H=>H.route.id===I)}else if(T&&gi(T[1])){let I=T[0];F=i.findIndex(H=>H.route.id===I)-1}let L=T?T[1].statusCode:void 0,_=L&&L>=400,R={currentUrl:D,currentParams:a.matches[0]?.params||{},nextUrl:A,nextParams:i[0].params,...s,actionResult:P,actionStatus:L},z=Py(i),N=i.map((I,H)=>{let{route:Y}=I,ae=null;if(F!=null&&H>F)ae=!1;else if(Y.lazy)ae=!0;else if(!z$(Y))ae=!1;else if(u){let{shouldLoad:G}=ML(Y,a.loaderData,a.errors);ae=G}else kq(a.loaderData,a.matches[H],I)&&(ae=!0);if(ae!==null)return HC(n,r,e,l,z,I,d,t,ae);let K=!1;typeof O=="boolean"?K=O:_?K=!1:(m||D.pathname+D.search===A.pathname+A.search||D.search!==A.search||$q(a.matches[H],I))&&(K=!0);let oe={...R,defaultShouldRevalidate:K},ue=Dg(I,oe);return HC(n,r,e,l,z,I,d,t,ue,oe,O)}),B=[];return x.forEach((I,H)=>{if(u||!i.some(Q=>Q.route.id===I.routeId)||y.has(H))return;let Y=a.fetchers.get(H),ae=Y&&Y.state!=="idle"&&Y.data===void 0,K=Ds(S,I.path,b??"/",!1,k);if(!K){if($&&ae)return;B.push({key:H,routeId:I.routeId,path:I.path,matches:null,match:null,request:null,controller:null});return}if(w.has(H))return;let oe=Gb(K,I.path),ue=new AbortController,G=yp(o,I.path,ue.signal),ie=null;if(g.has(H))g.delete(H),ie=Op(n,r,G,I.path,K,oe,d,t);else if(ae)m&&(ie=Op(n,r,G,I.path,K,oe,d,t));else{let Q;typeof O=="boolean"?Q=O:_?Q=!1:Q=m;let ee={...R,defaultShouldRevalidate:Q};Dg(oe,ee)&&(ie=Op(n,r,G,I.path,K,oe,d,t,ee))}ie&&B.push({key:H,routeId:I.routeId,path:I.path,matches:ie,match:oe,request:G,controller:ue})}),{dsMatches:N,revalidatingFetchers:B}}function z$(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function ML(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!z$(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;if(!r&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!o;return{shouldLoad:a,renderFallback:a}}function kq(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function $q(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Dg(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function AO(e,t,n,r,o,a){let i;if(e){let d=r[e];er(d,`No route found to patch children into: routeId = ${e}`),d.children||(d.children=[]),i=d.children}else i=n.activeRoutes;let s=[],l=[];if(t.forEach(d=>{let u=i.find(m=>OL(d,m));u?l.push({existingRoute:u,newRoute:d}):s.push(d)}),s.length>0){let d=Jg(s,o,[e||"_","patch",String(i?.length||"0")],r);i.push(...d)}if(a&&l.length>0)for(let d=0;d<l.length;d++){let{existingRoute:u,newRoute:m}=l[d],g=u,[y]=Jg([m],o,[],{},!0);Object.assign(g,{element:y.element?y.element:g.element,errorElement:y.errorElement?y.errorElement:g.errorElement,hydrateFallbackElement:y.hydrateFallbackElement?y.hydrateFallbackElement:g.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function OL(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((n,r)=>t.children?.some(o=>OL(n,o)))??!1:!1}var DO=new WeakMap,PL=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(er(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let a=o.lazy[e];if(!a)return;let i=DO.get(o);i||(i={},DO.set(o,i));let s=i[e];if(s)return s;let l=(async()=>{let d=_U(e),m=o[e]!==void 0&&e!=="hasErrorBoundary";if(d)ko(!d,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(m)ko(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let g=await a();g!=null&&(Object.assign(o,{[e]:g}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(g=>g===void 0)&&(o.lazy=void 0))})();return i[e]=l,l},NO=new WeakMap;function Rq(e,t,n,r,o){let a=n[e.id];if(er(a,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let u=NO.get(a);if(u)return{lazyRoutePromise:u,lazyHandlerPromise:u};let m=(async()=>{er(typeof e.lazy=="function","No lazy route function found");let g=await e.lazy(),y={};for(let x in g){let w=g[x];if(w===void 0)continue;let S=UU(x),$=a[x]!==void 0&&x!=="hasErrorBoundary";S?ko(!S,"Route property "+x+" is not a supported property to be returned from a lazy route function. This property will be ignored."):$?ko(!$,`Route "${a.id}" has a static property "${x}" defined but its lazy function is also returning a value for this property. The lazy route property "${x}" will be ignored.`):y[x]=w}Object.assign(a,y),Object.assign(a,{...r(a),lazy:void 0})})();return NO.set(a,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let i=Object.keys(e.lazy),s=[],l;for(let u of i){if(o&&o.includes(u))continue;let m=PL({key:u,route:e,manifest:n,mapRouteProperties:r});m&&(s.push(m),u===t&&(l=m))}let d=s.length>0?Promise.all(s).then(()=>{}):void 0;return d?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:l}}async function IO(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,a)=>{n[t[a].route.id]=o}),n}async function Tq(e){return e.matches.some(t=>t.route.middleware)?jL(e,()=>IO(e)):IO(e)}function jL(e,t){return Eq(e,t,r=>{if(Uq(r))throw r;return r},zq,n);function n(r,o,a){if(a)return Promise.resolve(Object.assign(a.value,{[o]:{type:"error",result:r}}));{let{matches:i}=e,s=Math.min(Math.max(i.findIndex(d=>d.route.id===o),0),Math.max(i.findIndex(d=>d.shouldCallHandler()),0)),l=nu(i,i[s].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function Eq(e,t,n,r,o){let{matches:a,...i}=e,s=a.flatMap(d=>d.route.middleware?d.route.middleware.map(u=>[d.route.id,u]):[]);return await AL(i,s,t,n,r,o)}async function AL(e,t,n,r,o,a,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 n();let[d,u]=l,m,g=async()=>{if(m)throw new Error("You may only call `next()` once per middleware");try{return m={value:await AL(e,t,n,r,o,a,i+1)},m.value}catch(y){return m={value:await a(y,d,m)},m.value}};try{let y=await u(e,g),x=y!=null?r(y):void 0;return o(x)?x:m?x??m.value:(m={value:await g()},m.value)}catch(y){return await a(y,d,m)}}function DL(e,t,n,r,o){let a=PL({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=Rq(r.route,ya(n.method)?"action":"loader",t,e,o);return{middleware:a,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function HC(e,t,n,r,o,a,i,s,l,d=null,u){let m=!1,g=DL(e,t,n,a,i);return{...a,_lazyPromises:g,shouldLoad:l,shouldRevalidateArgs:d,shouldCallHandler(y){return m=!0,d?typeof u=="boolean"?Dg(a,{...d,defaultShouldRevalidate:u}):typeof y=="boolean"?Dg(a,{...d,defaultShouldRevalidate:y}):Dg(a,d):l},resolve(y){let{lazy:x,loader:w,middleware:S}=a.route,b=m||l||y&&!ya(n.method)&&(x||w),$=S&&S.length>0&&!w&&!x;return b&&(ya(n.method)||!$)?Oq({request:n,path:r,pattern:o,match:a,lazyHandlerPromise:g?.handler,lazyRoutePromise:g?.route,handlerOverride:y,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function Op(e,t,n,r,o,a,i,s,l=null){return o.map(d=>d.route.id!==a.route.id?{...d,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:DL(e,t,n,d,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:HC(e,t,n,r,Py(o),d,i,s,!0,l))}async function Mq(e,t,n,r,o,a,i){r.some(u=>u._lazyPromises?.middleware)&&await Promise.all(r.map(u=>u._lazyPromises?.middleware));let s={request:t,url:NL(t,n),pattern:Py(r),params:r[0].params,context:a,matches:r},d=await e({...s,fetcherKey:o,runClientMiddleware:u=>{let m=s;return jL(m,()=>u({...m,fetcherKey:o,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 d}async function Oq({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:o,lazyRoutePromise:a,handlerOverride:i,scopedContext:s}){let l,d,u=ya(e.method),m=u?"action":"loader",g=y=>{let x,w=new Promise(($,k)=>x=k);d=()=>x(),e.signal.addEventListener("abort",d);let S=$=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${r.route.id}]`)):y({request:e,url:NL(e,t),pattern:n,params:r.params,context:s},...$!==void 0?[$]:[]),b=(async()=>{try{return{type:"data",result:await(i?i(k=>S(k)):S())}}catch($){return{type:"error",result:$}}})();return Promise.race([b,w])};try{let y=u?r.route.action:r.route.loader;if(o||a)if(y){let x,[w]=await Promise.all([g(y).catch(S=>{x=S}),o,a]);if(x!==void 0)throw x;l=w}else{await o;let x=u?r.route.action:r.route.loader;if(x)[l]=await Promise.all([g(x),a]);else if(m==="action"){let w=new URL(e.url),S=w.pathname+w.search;throw Gi(405,{method:e.method,pathname:S,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(y)l=await g(y);else{let x=new URL(e.url),w=x.pathname+x.search;throw Gi(404,{pathname:w})}}catch(y){return{type:"error",result:y}}finally{d&&e.signal.removeEventListener("abort",d)}return l}async function Pq(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 jq(e){let{result:t,type:n}=e;if(F$(t)){let r;try{r=await Pq(t)}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new Oy(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?UO(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:Lq(t),statusCode:ey(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:ey(t)?t.status:void 0}:UO(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 Aq(e,t,n,r,o){let a=e.headers.get("Location");if(er(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!N$(a)){let i=r.slice(0,r.findIndex(s=>s.route.id===n)+1);a=qC(new URL(t.url),i,o,a),e.headers.set("Location",a)}return e}var Dq=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function VC(e){try{return Dq.includes(new URL(e).protocol)}catch{return!1}}function LO(e,t,n,r){if(N$(e)){let o=e,a=ax.test(o)?new URL(hL(o,t.protocol)):new URL(o);if(VC(a.toString()))throw new Error("Invalid redirect location");let i=Ga(a.pathname,n)!=null;if(a.origin===t.origin&&i)return I$(a.pathname)+a.search+a.hash}try{let o=r.createURL(e);if(VC(o.toString()))throw new Error("Invalid redirect location")}catch{}return e}function yp(e,t,n,r){let o=e.createURL(IL(t)).toString(),a={signal:n};if(r&&ya(r.formMethod)){let{formMethod:i,formEncType:s}=r;a.method=i.toUpperCase(),s==="application/json"?(a.headers=new Headers({"Content-Type":s}),a.body=JSON.stringify(r.json)):s==="text/plain"?a.body=r.text:s==="application/x-www-form-urlencoded"&&r.formData?a.body=WC(r.formData):a.body=r.formData}return new Request(o,a)}function NL(e,t){let n=new URL(e.url),r=typeof t=="string"?$l(t):t;if(n.pathname=r.pathname||"/",r.search){let o=new URLSearchParams(r.search),a=o.getAll("index");o.delete("index");for(let i of a.filter(Boolean))o.append("index",i);n.search=o.size?`?${o.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function WC(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function zO(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Nq(e,t,n,r=!1,o=!1){let a={},i=null,s,l=!1,d={},u=n&&gi(n[1])?n[1].error:void 0;return e.forEach(m=>{if(!(m.route.id in t))return;let g=m.route.id,y=t[g];if(er(!vd(y),"Cannot handle redirect results in processLoaderData"),gi(y)){let x=y.error;if(u!==void 0&&(x=u,u=void 0),i=i||{},o)i[g]=x;else{let w=nu(e,g);i[w.route.id]==null&&(i[w.route.id]=x)}r||(a[g]=EL),l||(l=!0,s=ey(y.error)?y.error.status:500),y.headers&&(d[g]=y.headers)}else a[g]=y.data,y.statusCode&&y.statusCode!==200&&!l&&(s=y.statusCode),y.headers&&(d[g]=y.headers)}),u!==void 0&&n&&(i={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:i,statusCode:s||200,loaderHeaders:d}}function FO(e,t,n,r,o,a,i){let{loaderData:s,errors:l}=Nq(t,n,r);return o.filter(d=>!d.matches||d.matches.some(u=>u.shouldLoad)).forEach(d=>{let{key:u,match:m,controller:g}=d;if(g&&g.signal.aborted)return;let y=a[u];if(er(y,"Did not find corresponding fetcher result"),gi(y)){let x=nu(e.matches,m?.route.id);l&&l[x.route.id]||(l={...l,[x.route.id]:y.error}),i.delete(u)}else if(vd(y))er(!1,"Unhandled fetcher revalidation redirect");else{let x=il(y.data);i.set(u,x)}}),{loaderData:s,errors:l}}function _O(e,t,n,r){let o=Object.entries(t).filter(([,a])=>a!==EL).reduce((a,[i,s])=>(a[i]=s,a),{});for(let a of n){let i=a.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&a.route.loader&&(o[i]=e[i]),r&&r.hasOwnProperty(i))break}return o}function BO(e){return e?gi(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function nu(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function ab(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Gi(e,{pathname:t,routeId:n,method:r,type:o,message:a}={}){let i="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(i="Bad Request",r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:o==="invalid-body"&&(s="Unable to encode submission body")):e===403?(i="Forbidden",s=`Route "${n}" does not match URL "${t}"`):e===404?(i="Not Found",s=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Oy(e||500,i,new Error(s),!0)}function ib(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(vd(o))return{key:r,result:o}}}function IL(e){let t=typeof e=="string"?$l(e):e;return Oa({...t,hash:""})}function Iq(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Lq(e){return new Oy(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function zq(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&Fq(n))}function Fq(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function _q(e){return F$(e.result)&&RL.has(e.result.status)}function gi(e){return e.type==="error"}function vd(e){return(e&&e.type)==="redirect"}function UO(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function F$(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Bq(e){return RL.has(e)}function Uq(e){return F$(e)&&Bq(e.status)&&e.headers.has("Location")}function qq(e){return yq.has(e.toUpperCase())}function ya(e){return mq.has(e.toUpperCase())}function _$(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Gb(e,t){let n=typeof t=="string"?$l(t).search:t.search;if(e[e.length-1].route.index&&_$(n||""))return e[e.length-1];let r=wL(e);return r[r.length-1]}function qO(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:a,json:i}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}}}function TS(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Hq(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function Em(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 Vq(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 il(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 Wq(e,t){try{let n=e.sessionStorage.getItem(TL);if(n){let r=JSON.parse(n);for(let[o,a]of Object.entries(r||{}))a&&Array.isArray(a)&&t.set(o,new Set(a||[]))}}catch{}}function Yq(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(TL,JSON.stringify(n))}catch(r){ko(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function HO(){let e,t,n=new Promise((r,o)=>{e=async a=>{r(a);try{await n}catch{}},t=async a=>{o(a);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Gd=C.createContext(null);Gd.displayName="DataRouter";var jy=C.createContext(null);jy.displayName="DataRouterState";var LL=C.createContext(!1);function zL(){return C.useContext(LL)}var B$=C.createContext({isTransitioning:!1});B$.displayName="ViewTransition";var FL=C.createContext(new Map);FL.displayName="Fetchers";var Gq=C.createContext(null);Gq.displayName="Await";var Oi=C.createContext(null);Oi.displayName="Navigation";var sx=C.createContext(null);sx.displayName="Location";var ps=C.createContext({outlet:null,matches:[],isDataRoute:!1});ps.displayName="Route";var U$=C.createContext(null);U$.displayName="RouteError";var _L="REACT_ROUTER_ERROR",Kq="REDIRECT",Qq="ROUTE_ERROR_RESPONSE";function Xq(e){if(e.startsWith(`${_L}:${Kq}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Zq(e){if(e.startsWith(`${_L}:${Qq}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Oy(t.status,t.statusText,t.data)}catch{}}function Jq(e,{relative:t}={}){er(lh(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=C.useContext(Oi),{hash:o,pathname:a,search:i}=Dy(e,{relative:t}),s=a;return n!=="/"&&(s=a==="/"?n:ts([n,a])),r.createHref({pathname:s,search:i,hash:o})}function lh(){return C.useContext(sx)!=null}function hs(){return er(lh(),"useLocation() may be used only in the context of a <Router> component."),C.useContext(sx).location}var BL="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function UL(e){C.useContext(Oi).static||C.useLayoutEffect(e)}function Ay(){let{isDataRoute:e}=C.useContext(ps);return e?pH():eH()}function eH(){er(lh(),"useNavigate() may be used only in the context of a <Router> component.");let e=C.useContext(Gd),{basename:t,navigator:n}=C.useContext(Oi),{matches:r}=C.useContext(ps),{pathname:o}=hs(),a=JSON.stringify(ix(r)),i=C.useRef(!1);return UL(()=>{i.current=!0}),C.useCallback((l,d={})=>{if(ko(i.current,BL),!i.current)return;if(typeof l=="number"){n.go(l);return}let u=My(l,JSON.parse(a),o,d.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ts([t,u.pathname])),Mp(typeof l=="string"?l:Oa(l),n.createHref(u),L$(n),"reject"),(d.replace?n.replace:n.push)(u,d.state,d)},[t,n,a,o,e])}var tH=C.createContext(null);function nH(e){let t=C.useContext(ps).outlet;return C.useMemo(()=>t&&C.createElement(tH.Provider,{value:e},t),[t,e])}function JRe(){let{matches:e}=C.useContext(ps);return e[e.length-1]?.params??{}}function Dy(e,{relative:t}={}){let{matches:n}=C.useContext(ps),{pathname:r}=hs(),o=JSON.stringify(ix(n));return C.useMemo(()=>My(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function rH(e,t,n){er(lh(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=C.useContext(Oi),{matches:o}=C.useContext(ps),a=o[o.length-1],i=a?a.params:{},s=a?a.pathname:"/",l=a?a.pathnameBase:"/",d=a&&a.route;{let S=d&&d.path||"";WL(s,!d||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${S}">) 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.
60
+ `,""):String(n.body);return{path:t,submission:{formMethod:a,formAction:i,formEncType:n.formEncType,formData:void 0,json:void 0,text:m}}}else if(n.formEncType==="application/json"){if(!ya(a))return r();try{let m=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:a,formAction:i,formEncType:n.formEncType,formData:void 0,json:m,text:void 0}}}catch{return r()}}}er(typeof FormData=="function","FormData is not available in this environment");let s,l;if(n.formData)s=WC(n.formData),l=n.formData;else if(n.body instanceof FormData)s=WC(n.body),l=n.body;else if(n.body instanceof URLSearchParams)s=n.body,l=zO(s);else if(n.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(n.body),l=zO(s)}catch{return r()}let d={formMethod:a,formAction:i,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(ya(d.formMethod))return{path:t,submission:d};let u=$l(t);return e&&u.search&&_$(u.search)&&s.append("index",""),u.search=`?${s}`,{path:Oa(u),submission:d}}function jO(e,t,n,r,o,a,i,s,l,d,u,m,g,y,x,w,S,b,$,k,T,O){let P=T?gi(T[1])?T[1].error:T[1].data:void 0,D=o.createURL(a.location),A=o.createURL(l),F;if(u&&a.errors){let I=Object.keys(a.errors)[0];F=i.findIndex(H=>H.route.id===I)}else if(T&&gi(T[1])){let I=T[0];F=i.findIndex(H=>H.route.id===I)-1}let L=T?T[1].statusCode:void 0,_=L&&L>=400,R={currentUrl:D,currentParams:a.matches[0]?.params||{},nextUrl:A,nextParams:i[0].params,...s,actionResult:P,actionStatus:L},z=Py(i),N=i.map((I,H)=>{let{route:Y}=I,ae=null;if(F!=null&&H>F)ae=!1;else if(Y.lazy)ae=!0;else if(!z$(Y))ae=!1;else if(u){let{shouldLoad:G}=ML(Y,a.loaderData,a.errors);ae=G}else kq(a.loaderData,a.matches[H],I)&&(ae=!0);if(ae!==null)return HC(n,r,e,l,z,I,d,t,ae);let K=!1;typeof O=="boolean"?K=O:_?K=!1:(m||D.pathname+D.search===A.pathname+A.search||D.search!==A.search||$q(a.matches[H],I))&&(K=!0);let oe={...R,defaultShouldRevalidate:K},ue=Dg(I,oe);return HC(n,r,e,l,z,I,d,t,ue,oe,O)}),B=[];return x.forEach((I,H)=>{if(u||!i.some(Q=>Q.route.id===I.routeId)||y.has(H))return;let Y=a.fetchers.get(H),ae=Y&&Y.state!=="idle"&&Y.data===void 0,K=Ds(S,I.path,b??"/",!1,k);if(!K){if($&&ae)return;B.push({key:H,routeId:I.routeId,path:I.path,matches:null,match:null,request:null,controller:null});return}if(w.has(H))return;let oe=Gb(K,I.path),ue=new AbortController,G=yp(o,I.path,ue.signal),ie=null;if(g.has(H))g.delete(H),ie=Op(n,r,G,I.path,K,oe,d,t);else if(ae)m&&(ie=Op(n,r,G,I.path,K,oe,d,t));else{let Q;typeof O=="boolean"?Q=O:_?Q=!1:Q=m;let ee={...R,defaultShouldRevalidate:Q};Dg(oe,ee)&&(ie=Op(n,r,G,I.path,K,oe,d,t,ee))}ie&&B.push({key:H,routeId:I.routeId,path:I.path,matches:ie,match:oe,request:G,controller:ue})}),{dsMatches:N,revalidatingFetchers:B}}function z$(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function ML(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!z$(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;if(!r&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!o;return{shouldLoad:a,renderFallback:a}}function kq(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function $q(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Dg(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function AO(e,t,n,r,o,a){let i;if(e){let d=r[e];er(d,`No route found to patch children into: routeId = ${e}`),d.children||(d.children=[]),i=d.children}else i=n.activeRoutes;let s=[],l=[];if(t.forEach(d=>{let u=i.find(m=>OL(d,m));u?l.push({existingRoute:u,newRoute:d}):s.push(d)}),s.length>0){let d=Jg(s,o,[e||"_","patch",String(i?.length||"0")],r);i.push(...d)}if(a&&l.length>0)for(let d=0;d<l.length;d++){let{existingRoute:u,newRoute:m}=l[d],g=u,[y]=Jg([m],o,[],{},!0);Object.assign(g,{element:y.element?y.element:g.element,errorElement:y.errorElement?y.errorElement:g.errorElement,hydrateFallbackElement:y.hydrateFallbackElement?y.hydrateFallbackElement:g.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function OL(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((n,r)=>t.children?.some(o=>OL(n,o)))??!1:!1}var DO=new WeakMap,PL=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(er(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let a=o.lazy[e];if(!a)return;let i=DO.get(o);i||(i={},DO.set(o,i));let s=i[e];if(s)return s;let l=(async()=>{let d=_U(e),m=o[e]!==void 0&&e!=="hasErrorBoundary";if(d)ko(!d,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(m)ko(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let g=await a();g!=null&&(Object.assign(o,{[e]:g}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(g=>g===void 0)&&(o.lazy=void 0))})();return i[e]=l,l},NO=new WeakMap;function Rq(e,t,n,r,o){let a=n[e.id];if(er(a,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let u=NO.get(a);if(u)return{lazyRoutePromise:u,lazyHandlerPromise:u};let m=(async()=>{er(typeof e.lazy=="function","No lazy route function found");let g=await e.lazy(),y={};for(let x in g){let w=g[x];if(w===void 0)continue;let S=UU(x),$=a[x]!==void 0&&x!=="hasErrorBoundary";S?ko(!S,"Route property "+x+" is not a supported property to be returned from a lazy route function. This property will be ignored."):$?ko(!$,`Route "${a.id}" has a static property "${x}" defined but its lazy function is also returning a value for this property. The lazy route property "${x}" will be ignored.`):y[x]=w}Object.assign(a,y),Object.assign(a,{...r(a),lazy:void 0})})();return NO.set(a,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let i=Object.keys(e.lazy),s=[],l;for(let u of i){if(o&&o.includes(u))continue;let m=PL({key:u,route:e,manifest:n,mapRouteProperties:r});m&&(s.push(m),u===t&&(l=m))}let d=s.length>0?Promise.all(s).then(()=>{}):void 0;return d?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:l}}async function IO(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,a)=>{n[t[a].route.id]=o}),n}async function Tq(e){return e.matches.some(t=>t.route.middleware)?jL(e,()=>IO(e)):IO(e)}function jL(e,t){return Eq(e,t,r=>{if(Uq(r))throw r;return r},zq,n);function n(r,o,a){if(a)return Promise.resolve(Object.assign(a.value,{[o]:{type:"error",result:r}}));{let{matches:i}=e,s=Math.min(Math.max(i.findIndex(d=>d.route.id===o),0),Math.max(i.findIndex(d=>d.shouldCallHandler()),0)),l=nu(i,i[s].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function Eq(e,t,n,r,o){let{matches:a,...i}=e,s=a.flatMap(d=>d.route.middleware?d.route.middleware.map(u=>[d.route.id,u]):[]);return await AL(i,s,t,n,r,o)}async function AL(e,t,n,r,o,a,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 n();let[d,u]=l,m,g=async()=>{if(m)throw new Error("You may only call `next()` once per middleware");try{return m={value:await AL(e,t,n,r,o,a,i+1)},m.value}catch(y){return m={value:await a(y,d,m)},m.value}};try{let y=await u(e,g),x=y!=null?r(y):void 0;return o(x)?x:m?x??m.value:(m={value:await g()},m.value)}catch(y){return await a(y,d,m)}}function DL(e,t,n,r,o){let a=PL({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=Rq(r.route,ya(n.method)?"action":"loader",t,e,o);return{middleware:a,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function HC(e,t,n,r,o,a,i,s,l,d=null,u){let m=!1,g=DL(e,t,n,a,i);return{...a,_lazyPromises:g,shouldLoad:l,shouldRevalidateArgs:d,shouldCallHandler(y){return m=!0,d?typeof u=="boolean"?Dg(a,{...d,defaultShouldRevalidate:u}):typeof y=="boolean"?Dg(a,{...d,defaultShouldRevalidate:y}):Dg(a,d):l},resolve(y){let{lazy:x,loader:w,middleware:S}=a.route,b=m||l||y&&!ya(n.method)&&(x||w),$=S&&S.length>0&&!w&&!x;return b&&(ya(n.method)||!$)?Oq({request:n,path:r,pattern:o,match:a,lazyHandlerPromise:g?.handler,lazyRoutePromise:g?.route,handlerOverride:y,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function Op(e,t,n,r,o,a,i,s,l=null){return o.map(d=>d.route.id!==a.route.id?{...d,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:DL(e,t,n,d,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:HC(e,t,n,r,Py(o),d,i,s,!0,l))}async function Mq(e,t,n,r,o,a,i){r.some(u=>u._lazyPromises?.middleware)&&await Promise.all(r.map(u=>u._lazyPromises?.middleware));let s={request:t,url:NL(t,n),pattern:Py(r),params:r[0].params,context:a,matches:r},d=await e({...s,fetcherKey:o,runClientMiddleware:u=>{let m=s;return jL(m,()=>u({...m,fetcherKey:o,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 d}async function Oq({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:o,lazyRoutePromise:a,handlerOverride:i,scopedContext:s}){let l,d,u=ya(e.method),m=u?"action":"loader",g=y=>{let x,w=new Promise(($,k)=>x=k);d=()=>x(),e.signal.addEventListener("abort",d);let S=$=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${r.route.id}]`)):y({request:e,url:NL(e,t),pattern:n,params:r.params,context:s},...$!==void 0?[$]:[]),b=(async()=>{try{return{type:"data",result:await(i?i(k=>S(k)):S())}}catch($){return{type:"error",result:$}}})();return Promise.race([b,w])};try{let y=u?r.route.action:r.route.loader;if(o||a)if(y){let x,[w]=await Promise.all([g(y).catch(S=>{x=S}),o,a]);if(x!==void 0)throw x;l=w}else{await o;let x=u?r.route.action:r.route.loader;if(x)[l]=await Promise.all([g(x),a]);else if(m==="action"){let w=new URL(e.url),S=w.pathname+w.search;throw Gi(405,{method:e.method,pathname:S,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(y)l=await g(y);else{let x=new URL(e.url),w=x.pathname+x.search;throw Gi(404,{pathname:w})}}catch(y){return{type:"error",result:y}}finally{d&&e.signal.removeEventListener("abort",d)}return l}async function Pq(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 jq(e){let{result:t,type:n}=e;if(F$(t)){let r;try{r=await Pq(t)}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new Oy(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?UO(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:Lq(t),statusCode:ey(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:ey(t)?t.status:void 0}:UO(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 Aq(e,t,n,r,o){let a=e.headers.get("Location");if(er(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!N$(a)){let i=r.slice(0,r.findIndex(s=>s.route.id===n)+1);a=qC(new URL(t.url),i,o,a),e.headers.set("Location",a)}return e}var Dq=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function VC(e){try{return Dq.includes(new URL(e).protocol)}catch{return!1}}function LO(e,t,n,r){if(N$(e)){let o=e,a=ax.test(o)?new URL(hL(o,t.protocol)):new URL(o);if(VC(a.toString()))throw new Error("Invalid redirect location");let i=Ga(a.pathname,n)!=null;if(a.origin===t.origin&&i)return I$(a.pathname)+a.search+a.hash}try{let o=r.createURL(e);if(VC(o.toString()))throw new Error("Invalid redirect location")}catch{}return e}function yp(e,t,n,r){let o=e.createURL(IL(t)).toString(),a={signal:n};if(r&&ya(r.formMethod)){let{formMethod:i,formEncType:s}=r;a.method=i.toUpperCase(),s==="application/json"?(a.headers=new Headers({"Content-Type":s}),a.body=JSON.stringify(r.json)):s==="text/plain"?a.body=r.text:s==="application/x-www-form-urlencoded"&&r.formData?a.body=WC(r.formData):a.body=r.formData}return new Request(o,a)}function NL(e,t){let n=new URL(e.url),r=typeof t=="string"?$l(t):t;if(n.pathname=r.pathname||"/",r.search){let o=new URLSearchParams(r.search),a=o.getAll("index");o.delete("index");for(let i of a.filter(Boolean))o.append("index",i);n.search=o.size?`?${o.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function WC(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function zO(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Nq(e,t,n,r=!1,o=!1){let a={},i=null,s,l=!1,d={},u=n&&gi(n[1])?n[1].error:void 0;return e.forEach(m=>{if(!(m.route.id in t))return;let g=m.route.id,y=t[g];if(er(!vd(y),"Cannot handle redirect results in processLoaderData"),gi(y)){let x=y.error;if(u!==void 0&&(x=u,u=void 0),i=i||{},o)i[g]=x;else{let w=nu(e,g);i[w.route.id]==null&&(i[w.route.id]=x)}r||(a[g]=EL),l||(l=!0,s=ey(y.error)?y.error.status:500),y.headers&&(d[g]=y.headers)}else a[g]=y.data,y.statusCode&&y.statusCode!==200&&!l&&(s=y.statusCode),y.headers&&(d[g]=y.headers)}),u!==void 0&&n&&(i={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:i,statusCode:s||200,loaderHeaders:d}}function FO(e,t,n,r,o,a,i){let{loaderData:s,errors:l}=Nq(t,n,r);return o.filter(d=>!d.matches||d.matches.some(u=>u.shouldLoad)).forEach(d=>{let{key:u,match:m,controller:g}=d;if(g&&g.signal.aborted)return;let y=a[u];if(er(y,"Did not find corresponding fetcher result"),gi(y)){let x=nu(e.matches,m?.route.id);l&&l[x.route.id]||(l={...l,[x.route.id]:y.error}),i.delete(u)}else if(vd(y))er(!1,"Unhandled fetcher revalidation redirect");else{let x=il(y.data);i.set(u,x)}}),{loaderData:s,errors:l}}function _O(e,t,n,r){let o=Object.entries(t).filter(([,a])=>a!==EL).reduce((a,[i,s])=>(a[i]=s,a),{});for(let a of n){let i=a.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&a.route.loader&&(o[i]=e[i]),r&&r.hasOwnProperty(i))break}return o}function BO(e){return e?gi(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function nu(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function ab(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Gi(e,{pathname:t,routeId:n,method:r,type:o,message:a}={}){let i="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(i="Bad Request",r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:o==="invalid-body"&&(s="Unable to encode submission body")):e===403?(i="Forbidden",s=`Route "${n}" does not match URL "${t}"`):e===404?(i="Not Found",s=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Oy(e||500,i,new Error(s),!0)}function ib(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(vd(o))return{key:r,result:o}}}function IL(e){let t=typeof e=="string"?$l(e):e;return Oa({...t,hash:""})}function Iq(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Lq(e){return new Oy(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function zq(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&Fq(n))}function Fq(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function _q(e){return F$(e.result)&&RL.has(e.result.status)}function gi(e){return e.type==="error"}function vd(e){return(e&&e.type)==="redirect"}function UO(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function F$(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Bq(e){return RL.has(e)}function Uq(e){return F$(e)&&Bq(e.status)&&e.headers.has("Location")}function qq(e){return yq.has(e.toUpperCase())}function ya(e){return mq.has(e.toUpperCase())}function _$(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Gb(e,t){let n=typeof t=="string"?$l(t).search:t.search;if(e[e.length-1].route.index&&_$(n||""))return e[e.length-1];let r=wL(e);return r[r.length-1]}function qO(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:a,json:i}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}}}function TS(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Hq(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function Em(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 Vq(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 il(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 Wq(e,t){try{let n=e.sessionStorage.getItem(TL);if(n){let r=JSON.parse(n);for(let[o,a]of Object.entries(r||{}))a&&Array.isArray(a)&&t.set(o,new Set(a||[]))}}catch{}}function Yq(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(TL,JSON.stringify(n))}catch(r){ko(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function HO(){let e,t,n=new Promise((r,o)=>{e=async a=>{r(a);try{await n}catch{}},t=async a=>{o(a);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Gd=C.createContext(null);Gd.displayName="DataRouter";var jy=C.createContext(null);jy.displayName="DataRouterState";var LL=C.createContext(!1);function zL(){return C.useContext(LL)}var B$=C.createContext({isTransitioning:!1});B$.displayName="ViewTransition";var FL=C.createContext(new Map);FL.displayName="Fetchers";var Gq=C.createContext(null);Gq.displayName="Await";var Oi=C.createContext(null);Oi.displayName="Navigation";var sx=C.createContext(null);sx.displayName="Location";var ps=C.createContext({outlet:null,matches:[],isDataRoute:!1});ps.displayName="Route";var U$=C.createContext(null);U$.displayName="RouteError";var _L="REACT_ROUTER_ERROR",Kq="REDIRECT",Qq="ROUTE_ERROR_RESPONSE";function Xq(e){if(e.startsWith(`${_L}:${Kq}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Zq(e){if(e.startsWith(`${_L}:${Qq}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Oy(t.status,t.statusText,t.data)}catch{}}function Jq(e,{relative:t}={}){er(lh(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=C.useContext(Oi),{hash:o,pathname:a,search:i}=Dy(e,{relative:t}),s=a;return n!=="/"&&(s=a==="/"?n:ts([n,a])),r.createHref({pathname:s,search:i,hash:o})}function lh(){return C.useContext(sx)!=null}function hs(){return er(lh(),"useLocation() may be used only in the context of a <Router> component."),C.useContext(sx).location}var BL="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function UL(e){C.useContext(Oi).static||C.useLayoutEffect(e)}function Ay(){let{isDataRoute:e}=C.useContext(ps);return e?pH():eH()}function eH(){er(lh(),"useNavigate() may be used only in the context of a <Router> component.");let e=C.useContext(Gd),{basename:t,navigator:n}=C.useContext(Oi),{matches:r}=C.useContext(ps),{pathname:o}=hs(),a=JSON.stringify(ix(r)),i=C.useRef(!1);return UL(()=>{i.current=!0}),C.useCallback((l,d={})=>{if(ko(i.current,BL),!i.current)return;if(typeof l=="number"){n.go(l);return}let u=My(l,JSON.parse(a),o,d.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ts([t,u.pathname])),Mp(typeof l=="string"?l:Oa(l),n.createHref(u),L$(n),"reject"),(d.replace?n.replace:n.push)(u,d.state,d)},[t,n,a,o,e])}var tH=C.createContext(null);function nH(e){let t=C.useContext(ps).outlet;return C.useMemo(()=>t&&C.createElement(tH.Provider,{value:e},t),[t,e])}function e2e(){let{matches:e}=C.useContext(ps);return e[e.length-1]?.params??{}}function Dy(e,{relative:t}={}){let{matches:n}=C.useContext(ps),{pathname:r}=hs(),o=JSON.stringify(ix(n));return C.useMemo(()=>My(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function rH(e,t,n){er(lh(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=C.useContext(Oi),{matches:o}=C.useContext(ps),a=o[o.length-1],i=a?a.params:{},s=a?a.pathname:"/",l=a?a.pathnameBase:"/",d=a&&a.route;{let S=d&&d.path||"";WL(s,!d||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${S}">) 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.
61
61
 
62
- Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let u=hs(),m;m=u;let g=m.pathname||"/",y=g;if(l!=="/"){let S=l.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=n&&n.state.matches.length?n.state.matches.map(S=>Object.assign(S,{route:n.manifest[S.route.id]||S.route})):gL(e,{pathname:y});return ko(d||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),ko(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.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.`),lH(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},i,S.params),pathname:ts([l,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:ts([l,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),o,n)}function oH(){let e=dH(),t=ey(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:a},"ErrorBoundary")," or"," ",C.createElement("code",{style:a},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},t),n?C.createElement("pre",{style:o},n):null,i)}var aH=C.createElement(oH,null),qL=class extends C.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(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Zq(e.digest);n&&(e=n)}let t=e!==void 0?C.createElement(ps.Provider,{value:this.props.routeContext},C.createElement(U$.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?C.createElement(iH,{error:e},t):t}};qL.contextType=LL;var ES=new WeakMap;function iH({children:e,error:t}){let{basename:n,navigator:r}=C.useContext(Oi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=Xq(t.digest);if(o){let a=ES.get(t);if(a)throw a;let i=CL(o.location,n),s=i.absoluteURL||i.to;if(Mp(o.location,s,L$(r),"allow-explicit"),VC(s))throw new Error("Invalid redirect location");if(SL&&!ES.get(t))if(i.isExternal||o.reloadDocument)window.location.href=s;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:o.replace}));throw ES.set(t,l),l}return C.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s}`})}}return e}function sH({routeContext:e,match:t,children:n}){let r=C.useContext(Gd);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(ps.Provider,{value:e},n)}function lH(e,t=[],n){let r=n?.state;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,a=r?.errors;if(a!=null){let u=o.findIndex(m=>m.route.id&&a?.[m.route.id]!==void 0);er(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let i=!1,s=-1;if(n&&r){i=r.renderFallback;for(let u=0;u<o.length;u++){let m=o[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(s=u),m.route.id){let{loaderData:g,errors:y}=r,x=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!y||y[m.route.id]===void 0);if(m.route.lazy||x){n.isStatic&&(i=!0),s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}}let l=n?.onError,d=r&&l?(u,m)=>{l(u,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Py(r.matches),errorInfo:m})}:void 0;return o.reduceRight((u,m,g)=>{let y,x=!1,w=null,S=null;r&&(y=a&&m.route.id?a[m.route.id]:void 0,w=m.route.errorElement||aH,i&&(s<0&&g===0?(WL("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,S=null):s===g&&(x=!0,S=m.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,g+1)),$=()=>{let k;return y?k=w:x?k=S:m.route.Component?k=C.createElement(m.route.Component,null):m.route.element?k=m.route.element:k=u,C.createElement(sH,{match:m,routeContext:{outlet:u,matches:b,isDataRoute:r!=null},children:k})};return r&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?C.createElement(qL,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:$(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:d}):$()},null)}function q$(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function HL(e){let t=C.useContext(Gd);return er(t,q$(e)),t}function VL(e){let t=C.useContext(jy);return er(t,q$(e)),t}function cH(e){let t=C.useContext(ps);return er(t,q$(e)),t}function H$(e){let t=cH(e),n=t.matches[t.matches.length-1];return er(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function uH(){return H$("useRouteId")}function dH(){let e=C.useContext(U$),t=VL("useRouteError"),n=H$("useRouteError");return e!==void 0?e:t.errors?.[n]}var fH=0;function e2e(e){let{router:t,basename:n}=HL("useBlocker"),r=VL("useBlocker"),[o,a]=C.useState(""),i=C.useCallback(s=>{if(typeof e!="function")return!!e;if(n==="/")return e(s);let{currentLocation:l,nextLocation:d,historyAction:u}=s;return e({currentLocation:{...l,pathname:Ga(l.pathname,n)||l.pathname},nextLocation:{...d,pathname:Ga(d.pathname,n)||d.pathname},historyAction:u})},[n,e]);return C.useEffect(()=>{let s=String(++fH);return a(s),()=>t.deleteBlocker(s)},[t]),C.useEffect(()=>{o!==""&&t.getBlocker(o,i)},[t,o,i]),o&&r.blockers.has(o)?r.blockers.get(o):hp}function pH(){let{router:e}=HL("useNavigate"),t=H$("useNavigate"),n=C.useRef(!1);return UL(()=>{n.current=!0}),C.useCallback(async(o,a={})=>{ko(n.current,BL),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var VO={};function WL(e,t,n){!t&&!VO[e]&&(VO[e]=!0,ko(!1,n))}var WO={};function YO(e,t){!e&&!WO[t]&&(WO[t]=!0,console.warn(t))}var hH="useOptimistic",GO=jd[hH],mH=()=>{};function gH(e){return GO?GO(e):[e,mH]}function yH(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ko(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:C.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ko(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:C.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ko(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:C.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var vH=["HydrateFallback","hydrateFallbackElement"],bH=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function xH({router:e,flushSync:t,onError:n,useTransitions:r}){r=zL()||r;let[a,i]=C.useState(e.state),[s,l]=gH(a),[d,u]=C.useState(),[m,g]=C.useState({isTransitioning:!1}),[y,x]=C.useState(),[w,S]=C.useState(),[b,$]=C.useState(),k=C.useRef(new Map),T=C.useCallback((A,{deletedFetchers:F,newErrors:L,flushSync:_,viewTransitionOpts:R})=>{L&&n&&Object.values(L).forEach(N=>n(N,{location:A.location,params:A.matches[0]?.params??{},pattern:Py(A.matches)})),A.fetchers.forEach((N,B)=>{N.data!==void 0&&k.current.set(B,N.data)}),F.forEach(N=>k.current.delete(N)),YO(_===!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 z=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(YO(R==null||z,"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."),!R||!z){t&&_?t(()=>i(A)):r===!1?i(A):C.startTransition(()=>{r===!0&&l(N=>KO(N,A)),i(A)});return}if(t&&_){t(()=>{w&&(y?.resolve(),w.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:R.currentLocation,nextLocation:R.nextLocation})});let N=e.window.document.startViewTransition(()=>{t(()=>i(A))});N.finished.finally(()=>{t(()=>{x(void 0),S(void 0),u(void 0),g({isTransitioning:!1})})}),t(()=>S(N));return}w?(y?.resolve(),w.skipTransition(),$({state:A,currentLocation:R.currentLocation,nextLocation:R.nextLocation})):(u(A),g({isTransitioning:!0,flushSync:!1,currentLocation:R.currentLocation,nextLocation:R.nextLocation}))},[e.window,t,w,y,r,l,n]);C.useLayoutEffect(()=>e.subscribe(T),[e,T]),C.useEffect(()=>{m.isTransitioning&&!m.flushSync&&x(new bH)},[m]),C.useEffect(()=>{if(y&&d&&e.window){let A=d,F=y.promise,L=e.window.document.startViewTransition(async()=>{r===!1?i(A):C.startTransition(()=>{r===!0&&l(_=>KO(_,A)),i(A)}),await F});L.finished.finally(()=>{x(void 0),S(void 0),u(void 0),g({isTransitioning:!1})}),S(L)}},[d,y,e.window,r,l]),C.useEffect(()=>{y&&d&&s.location.key===d.location.key&&y.resolve()},[y,w,s.location,d]),C.useEffect(()=>{!m.isTransitioning&&b&&(u(b.state),g({isTransitioning:!0,flushSync:!1,currentLocation:b.currentLocation,nextLocation:b.nextLocation}),$(void 0))},[m.isTransitioning,b]);let O=C.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:A=>e.navigate(A),push:(A,F,L)=>e.navigate(A,{state:F,preventScrollReset:L?.preventScrollReset}),replace:(A,F,L)=>e.navigate(A,{replace:!0,state:F,preventScrollReset:L?.preventScrollReset})}),[e]),P=e.basename||"/",D=C.useMemo(()=>({router:e,navigator:O,static:!1,basename:P,onError:n}),[e,O,P,n]);return C.createElement(C.Fragment,null,C.createElement(Gd.Provider,{value:D},C.createElement(jy.Provider,{value:s},C.createElement(FL.Provider,{value:k.current},C.createElement(B$.Provider,{value:m},C.createElement(kH,{basename:P,location:s.location,navigationType:s.historyAction,navigator:O,useTransitions:r},C.createElement(wH,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function KO(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var wH=C.memo(SH);function SH({routes:e,manifest:t,future:n,state:r,isStatic:o,onError:a}){return rH(e,void 0,{manifest:t,state:r,isStatic:o,onError:a})}function CH({to:e,replace:t,state:n,relative:r}){er(lh(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:a}=C.useContext(Oi);ko(!o,"<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:i}=C.useContext(ps),{pathname:s}=hs(),l=Ay(),d=My(e,ix(i),s,r==="path");Mp(typeof e=="string"?e:Oa(e),a.createHref(d),L$(a),"reject");let u=JSON.stringify(d);return C.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function t2e(e){return nH(e.context)}function kH({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1,useTransitions:i}){er(!lh(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=C.useMemo(()=>({basename:s,navigator:o,static:a,useTransitions:i,future:{}}),[s,o,a,i]);typeof n=="string"&&(n=$l(n));let{pathname:d="/",search:u="",hash:m="",state:g=null,key:y="default",mask:x}=n,w=C.useMemo(()=>{let S=Ga(d,s);return S==null?null:{location:{pathname:S,search:u,hash:m,state:g,key:y,mask:x},navigationType:r}},[s,d,u,m,g,y,r,x]);return ko(w!=null,`<Router basename="${s}"> is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:C.createElement(Oi.Provider,{value:l},C.createElement(sx.Provider,{children:t,value:w}))}var Kb="get",Qb="application/x-www-form-urlencoded";function lx(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $H(e){return lx(e)&&e.tagName.toLowerCase()==="button"}function RH(e){return lx(e)&&e.tagName.toLowerCase()==="form"}function TH(e){return lx(e)&&e.tagName.toLowerCase()==="input"}function EH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function MH(e,t){return e.button===0&&(!t||t==="_self")&&!EH(e)}function YC(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function OH(e,t){let n=YC(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(a=>{n.append(o,a)})}),n}var sb=null;function PH(){if(sb===null)try{new FormData(document.createElement("form"),0),sb=!1}catch{sb=!0}return sb}var jH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function MS(e){return e!=null&&!jH.has(e)?(ko(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qb}"`),null):e}function AH(e,t){let n,r,o,a,i;if(RH(e)){let s=e.getAttribute("action");r=s?Ga(s,t):null,n=e.getAttribute("method")||Kb,o=MS(e.getAttribute("enctype"))||Qb,a=new FormData(e)}else if($H(e)||TH(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(r=l?Ga(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||Kb,o=MS(e.getAttribute("formenctype"))||MS(s.getAttribute("enctype"))||Qb,a=new FormData(s,e),!PH()){let{name:d,type:u,value:m}=e;if(u==="image"){let g=d?`${d}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else d&&a.append(d,m)}}else{if(lx(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Kb,r=null,o=Qb,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function V$(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function YL(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Ga(o.pathname,t)==="/"?o.pathname=`${Fp(t)}/_root.${r}`:o.pathname=`${Fp(o.pathname)}.${r}`,o}async function DH(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function NH(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function IH(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await DH(a,n);return i.links?i.links():[]}return[]}));return _H(r.flat(1).filter(NH).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function QO(e,t,n,r,o,a){let i=(l,d)=>n[d]?l.route.id!==n[d].route.id:!0,s=(l,d)=>n[d].pathname!==l.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==l.params["*"];return a==="assets"?t.filter((l,d)=>i(l,d)||s(l,d)):a==="data"?t.filter((l,d)=>{let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(i(l,d)||s(l,d))return!0;if(l.route.shouldRevalidate){let m=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function LH(e,t,{includeHydrateFallback:n}={}){return zH(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function zH(e){return[...new Set(e)]}function FH(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function _H(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(FH(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function W$(){let e=C.useContext(Gd);return V$(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function BH(){let e=C.useContext(jy);return V$(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Y$=C.createContext(void 0);Y$.displayName="FrameworkContext";function cx(){let e=C.useContext(Y$);return V$(e,"You must render this element inside a <HydratedRouter> element"),e}function UH(e,t){let n=C.useContext(Y$),[r,o]=C.useState(!1),[a,i]=C.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=t,g=C.useRef(null);C.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=b=>{b.forEach($=>{i($.isIntersecting)})},S=new IntersectionObserver(w,{threshold:.5});return g.current&&S.observe(g.current),()=>{S.disconnect()}}},[e]),C.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,g,{}]:[a,g,{onFocus:Mm(s,y),onBlur:Mm(l,x),onMouseEnter:Mm(d,y),onMouseLeave:Mm(u,x),onTouchStart:Mm(m,y)}]:[!1,g,{}]}function Mm(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function qH({page:e,...t}){let n=zL(),{nonce:r}=cx(),{router:o}=W$(),a=C.useMemo(()=>gL(o.routes,e,o.basename),[o.routes,e,o.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?C.createElement(VH,{page:e,matches:a,...t}):C.createElement(WH,{page:e,matches:a,...t})):null}function HH(e){let{manifest:t,routeModules:n}=cx(),[r,o]=C.useState([]);return C.useEffect(()=>{let a=!1;return IH(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function VH({page:e,matches:t,...n}){let r=hs(),{future:o}=cx(),{basename:a}=W$(),i=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let s=YL(e,a,o.v8_trailingSlashAwareDataRequests,"rsc"),l=!1,d=[];for(let u of t)typeof u.route.shouldRevalidate=="function"?l=!0:d.push(u.route.id);return l&&d.length>0&&s.searchParams.set("_routes",d.join(",")),[s.pathname+s.search]},[a,o.v8_trailingSlashAwareDataRequests,e,r,t]);return C.createElement(C.Fragment,null,i.map(s=>C.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...n})))}function WH({page:e,matches:t,...n}){let r=hs(),{future:o,manifest:a,routeModules:i}=cx(),{basename:s}=W$(),{loaderData:l,matches:d}=BH(),u=C.useMemo(()=>QO(e,t,d,a,r,"data"),[e,t,d,a,r]),m=C.useMemo(()=>QO(e,t,d,a,r,"assets"),[e,t,d,a,r]),g=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,S=!1;if(t.forEach($=>{let k=a.routes[$.route.id];!k||!k.hasLoader||(!u.some(T=>T.route.id===$.route.id)&&$.route.id in l&&i[$.route.id]?.shouldRevalidate||k.hasClientLoader?S=!0:w.add($.route.id))}),w.size===0)return[];let b=YL(e,s,o.v8_trailingSlashAwareDataRequests,"data");return S&&w.size>0&&b.searchParams.set("_routes",t.filter($=>w.has($.route.id)).map($=>$.route.id).join(",")),[b.pathname+b.search]},[s,o.v8_trailingSlashAwareDataRequests,l,r,a,u,t,e,i]),y=C.useMemo(()=>LH(m,a),[m,a]),x=HH(m);return C.createElement(C.Fragment,null,g.map(w=>C.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>C.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),x.map(({key:w,link:S})=>C.createElement("link",{key:w,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function YH(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var GH=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{GH&&(window.__reactRouterVersion="7.18.4")}catch{}function KH(e,t){return Sq({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:IU({window:t?.window}),hydrationData:QH(),routes:e,mapRouteProperties:yH,hydrationRouteProperties:vH,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function QH(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:XH(e.errors)}),e}function XH(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Oy(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&sq.includes(o.__subType)){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let a=new Error(o.message);a.stack="",n[r]=a}}else n[r]=o;return n}var GL=C.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,mask:s,state:l,target:d,to:u,preventScrollReset:m,viewTransition:g,defaultShouldRevalidate:y,...x},w){let{basename:S,navigator:b,useTransitions:$}=C.useContext(Oi),k=typeof u=="string"&&ox.test(u),T=CL(u,S);u=T.to;let O=Jq(u,{relative:o}),P=hs(),D=null;if(s){let B=My(s,[],P.mask?P.mask.pathname:"/",!0);S!=="/"&&(B.pathname=B.pathname==="/"?S:ts([S,B.pathname])),D=b.createHref(B)}let[A,F,L]=UH(r,x),_=tV(u,{replace:i,mask:s,state:l,target:d,preventScrollReset:m,relative:o,viewTransition:g,defaultShouldRevalidate:y,useTransitions:$});function R(B){t&&t(B),B.defaultPrevented||_(B)}let z=!(T.isExternal||a),N=C.createElement("a",{...x,...L,href:(z?D:void 0)||T.absoluteURL||O,onClick:z?R:t,ref:YH(w,F),target:d,"data-discover":!k&&n==="render"?"true":void 0});return A&&!k?C.createElement(C.Fragment,null,N,C.createElement(qH,{page:O})):N});GL.displayName="Link";var ZH=C.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:s,children:l,...d},u){let m=Dy(i,{relative:d.relative}),g=hs(),y=C.useContext(jy),{navigator:x,basename:w}=C.useContext(Oi),S=y!=null&&sV(m)&&s===!0,b=x.encodeLocation?x.encodeLocation(m).pathname:m.pathname,$=g.pathname,k=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||($=$.toLowerCase(),k=k?k.toLowerCase():null,b=b.toLowerCase()),k&&w&&(k=Ga(k,w)||k);const T=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let O=$===b||!o&&$.startsWith(b)&&$.charAt(T)==="/",P=k!=null&&(k===b||!o&&k.startsWith(b)&&k.charAt(b.length)==="/"),D={isActive:O,isPending:P,isTransitioning:S},A=O?t:void 0,F;typeof r=="function"?F=r(D):F=[r,O?"active":null,P?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let L=typeof a=="function"?a(D):a;return C.createElement(GL,{...d,"aria-current":A,className:F,ref:u,style:L,to:i,viewTransition:s},typeof l=="function"?l(D):l)});ZH.displayName="NavLink";var JH=C.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=Kb,action:s,onSubmit:l,relative:d,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:g,...y},x)=>{let{useTransitions:w}=C.useContext(Oi),S=aV(),b=iV(s,{relative:d}),$=i.toLowerCase()==="get"?"get":"post",k=typeof s=="string"&&ox.test(s),T=O=>{if(l&&l(O),O.defaultPrevented)return;O.preventDefault();let P=O.nativeEvent.submitter,D=P?.getAttribute("formmethod")||i,A=()=>S(P||O.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:o,state:a,relative:d,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:g});w&&n!==!1?C.startTransition(()=>A()):A()};return C.createElement("form",{ref:x,method:$,action:b,onSubmit:r?l:T,...y,"data-discover":!k&&e==="render"?"true":void 0})});JH.displayName="Form";function eV(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KL(e){let t=C.useContext(Gd);return er(t,eV(e)),t}function tV(e,{target:t,replace:n,mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:s,defaultShouldRevalidate:l,useTransitions:d}={}){let u=Ay(),m=hs(),g=Dy(e,{relative:i});return C.useCallback(y=>{if(MH(y,t)){y.preventDefault();let x=n!==void 0?n:Oa(m)===Oa(g),w=()=>u(e,{replace:x,mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:s,defaultShouldRevalidate:l});d?C.startTransition(()=>w()):w()}},[m,u,g,n,r,o,t,e,a,i,s,l,d])}function nV(e){ko(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=C.useRef(YC(e)),n=C.useRef(!1),r=hs(),o=C.useMemo(()=>OH(r.search,n.current?null:t.current),[r.search]),a=Ay(),i=C.useCallback((s,l)=>{const d=YC(typeof s=="function"?s(new URLSearchParams(o)):s);n.current=!0,a("?"+d,l)},[a,o]);return[o,i]}var rV=0,oV=()=>`__${String(++rV)}__`;function aV(){let{router:e}=KL("useSubmit"),{basename:t}=C.useContext(Oi),n=uH(),r=e.fetch,o=e.navigate;return C.useCallback(async(a,i={})=>{let{action:s,method:l,encType:d,formData:u,body:m}=AH(a,t);if(i.navigate===!1){let g=i.fetcherKey||oV();await r(g,n,i.action||s,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||l,formEncType:i.encType||d,flushSync:i.flushSync})}else await o(i.action||s,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||l,formEncType:i.encType||d,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,o,t,n])}function iV(e,{relative:t}={}){let{basename:n}=C.useContext(Oi),r=C.useContext(ps);er(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...Dy(e||".",{relative:t})},i=hs();if(e==null){a.search=i.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(u=>u==="")){s.delete("index"),l.filter(m=>m).forEach(m=>s.append("index",m));let u=s.toString();a.search=u?`?${u}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:ts([n,a.pathname])),Oa(a)}function sV(e,{relative:t}={}){let n=C.useContext(B$);er(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=KL("useViewTransitionState"),o=Dy(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ga(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Ga(n.nextLocation.pathname,r)||n.nextLocation.pathname;return x0(o.pathname,i)!=null||x0(o.pathname,a)!=null}var ux=dL();const su=A$(ux);function lV(e){return C.createElement(xH,{flushSync:ux.flushSync,...e})}const cV="modulepreload",uV=function(e){return"/"+e},XO={},wo=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=s?.nonce||s?.getAttribute("nonce");o=i(n.map(d=>{if(d=uV(d),d in XO)return;XO[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":cV,u||(g.as="script"),g.crossOrigin="",g.href=d,l&&g.setAttribute("nonce",l),document.head.appendChild(g),u)return new Promise((y,x)=>{g.addEventListener("load",y),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(i){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=i,window.dispatchEvent(s),!s.defaultPrevented)throw i}return o.then(i=>{for(const s of i||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})},ty={black:"#000",white:"#fff"},Qf={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Xf={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Zf={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Jf={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},ep={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Om={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},dV={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function sc(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Minified MUI error #${e}; visit ${n} for the full message.`}const Is="$$material";function w0(){return w0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w0.apply(null,arguments)}function fV(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function pV(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var hV=(function(){function e(n){var r=this;this._insertTag=function(o){var a;r.tags.length===0?r.insertionPoint?a=r.insertionPoint.nextSibling:r.prepend?a=r.container.firstChild:a=r.before:a=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(o,a),r.tags.push(o)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(pV(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var a=fV(o);try{a.insertRule(r,a.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}),this.tags=[],this.ctr=0},e})(),ga="-ms-",S0="-moz-",xr="-webkit-",QL="comm",G$="rule",K$="decl",mV="@import",XL="@keyframes",gV="@layer",yV=Math.abs,dx=String.fromCharCode,vV=Object.assign;function bV(e,t){return la(e,0)^45?(((t<<2^la(e,0))<<2^la(e,1))<<2^la(e,2))<<2^la(e,3):0}function ZL(e){return e.trim()}function xV(e,t){return(e=t.exec(e))?e[0]:e}function wr(e,t,n){return e.replace(t,n)}function GC(e,t){return e.indexOf(t)}function la(e,t){return e.charCodeAt(t)|0}function ny(e,t,n){return e.slice(t,n)}function ll(e){return e.length}function Q$(e){return e.length}function lb(e,t){return t.push(e),e}function wV(e,t){return e.map(t).join("")}var fx=1,_p=1,JL=0,Ka=0,zo=0,ch="";function px(e,t,n,r,o,a,i){return{value:e,root:t,parent:n,type:r,props:o,children:a,line:fx,column:_p,length:i,return:""}}function Pm(e,t){return vV(px("",null,null,"",null,null,0),e,{length:-e.length},t)}function SV(){return zo}function CV(){return zo=Ka>0?la(ch,--Ka):0,_p--,zo===10&&(_p=1,fx--),zo}function $i(){return zo=Ka<JL?la(ch,Ka++):0,_p++,zo===10&&(_p=1,fx++),zo}function gl(){return la(ch,Ka)}function Xb(){return Ka}function Ny(e,t){return ny(ch,e,t)}function ry(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function e5(e){return fx=_p=1,JL=ll(ch=e),Ka=0,[]}function t5(e){return ch="",e}function Zb(e){return ZL(Ny(Ka-1,KC(e===91?e+2:e===40?e+1:e)))}function kV(e){for(;(zo=gl())&&zo<33;)$i();return ry(e)>2||ry(zo)>3?"":" "}function $V(e,t){for(;--t&&$i()&&!(zo<48||zo>102||zo>57&&zo<65||zo>70&&zo<97););return Ny(e,Xb()+(t<6&&gl()==32&&$i()==32))}function KC(e){for(;$i();)switch(zo){case e:return Ka;case 34:case 39:e!==34&&e!==39&&KC(zo);break;case 40:e===41&&KC(e);break;case 92:$i();break}return Ka}function RV(e,t){for(;$i()&&e+zo!==57;)if(e+zo===84&&gl()===47)break;return"/*"+Ny(t,Ka-1)+"*"+dx(e===47?e:$i())}function TV(e){for(;!ry(gl());)$i();return Ny(e,Ka)}function EV(e){return t5(Jb("",null,null,null,[""],e=e5(e),0,[0],e))}function Jb(e,t,n,r,o,a,i,s,l){for(var d=0,u=0,m=i,g=0,y=0,x=0,w=1,S=1,b=1,$=0,k="",T=o,O=a,P=r,D=k;S;)switch(x=$,$=$i()){case 40:if(x!=108&&la(D,m-1)==58){GC(D+=wr(Zb($),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:D+=Zb($);break;case 9:case 10:case 13:case 32:D+=kV(x);break;case 92:D+=$V(Xb()-1,7);continue;case 47:switch(gl()){case 42:case 47:lb(MV(RV($i(),Xb()),t,n),l);break;default:D+="/"}break;case 123*w:s[d++]=ll(D)*b;case 125*w:case 59:case 0:switch($){case 0:case 125:S=0;case 59+u:b==-1&&(D=wr(D,/\f/g,"")),y>0&&ll(D)-m&&lb(y>32?JO(D+";",r,n,m-1):JO(wr(D," ","")+";",r,n,m-2),l);break;case 59:D+=";";default:if(lb(P=ZO(D,t,n,d,u,o,s,k,T=[],O=[],m),a),$===123)if(u===0)Jb(D,t,P,P,T,a,m,s,O);else switch(g===99&&la(D,3)===110?100:g){case 100:case 108:case 109:case 115:Jb(e,P,P,r&&lb(ZO(e,P,P,0,0,o,s,k,o,T=[],m),O),o,O,m,s,r?T:O);break;default:Jb(D,P,P,P,[""],O,0,s,O)}}d=u=y=0,w=b=1,k=D="",m=i;break;case 58:m=1+ll(D),y=x;default:if(w<1){if($==123)--w;else if($==125&&w++==0&&CV()==125)continue}switch(D+=dx($),$*w){case 38:b=u>0?1:(D+="\f",-1);break;case 44:s[d++]=(ll(D)-1)*b,b=1;break;case 64:gl()===45&&(D+=Zb($i())),g=gl(),u=m=ll(k=D+=TV(Xb())),$++;break;case 45:x===45&&ll(D)==2&&(w=0)}}return a}function ZO(e,t,n,r,o,a,i,s,l,d,u){for(var m=o-1,g=o===0?a:[""],y=Q$(g),x=0,w=0,S=0;x<r;++x)for(var b=0,$=ny(e,m+1,m=yV(w=i[x])),k=e;b<y;++b)(k=ZL(w>0?g[b]+" "+$:wr($,/&\f/g,g[b])))&&(l[S++]=k);return px(e,t,n,o===0?G$:s,l,d,u)}function MV(e,t,n){return px(e,t,n,QL,dx(SV()),ny(e,2,-2),0)}function JO(e,t,n,r){return px(e,t,n,K$,ny(e,0,r),ny(e,r+1,-1),r)}function Pp(e,t){for(var n="",r=Q$(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function OV(e,t,n,r){switch(e.type){case gV:if(e.children.length)break;case mV:case K$:return e.return=e.return||e.value;case QL:return"";case XL:return e.return=e.value+"{"+Pp(e.children,r)+"}";case G$:e.value=e.props.join(",")}return ll(n=Pp(e.children,r))?e.return=e.value+"{"+n+"}":""}function PV(e){var t=Q$(e);return function(n,r,o,a){for(var i="",s=0;s<t;s++)i+=e[s](n,r,o,a)||"";return i}}function jV(e){return function(t){t.root||(t=t.return)&&e(t)}}function n5(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var AV=function(t,n,r){for(var o=0,a=0;o=a,a=gl(),o===38&&a===12&&(n[r]=1),!ry(a);)$i();return Ny(t,Ka)},DV=function(t,n){var r=-1,o=44;do switch(ry(o)){case 0:o===38&&gl()===12&&(n[r]=1),t[r]+=AV(Ka-1,n,r);break;case 2:t[r]+=Zb(o);break;case 4:if(o===44){t[++r]=gl()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=dx(o)}while(o=$i());return t},NV=function(t,n){return t5(DV(e5(t),n))},eP=new WeakMap,IV=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,o=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!eP.get(r))&&!o){eP.set(t,!0);for(var a=[],i=NV(n,a),s=r.props,l=0,d=0;l<i.length;l++)for(var u=0;u<s.length;u++,d++)t.props[d]=a[l]?i[l].replace(/&\f/g,s[u]):s[u]+" "+i[l]}}},LV=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function r5(e,t){switch(bV(e,t)){case 5103:return xr+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return xr+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return xr+e+S0+e+ga+e+e;case 6828:case 4268:return xr+e+ga+e+e;case 6165:return xr+e+ga+"flex-"+e+e;case 5187:return xr+e+wr(e,/(\w+).+(:[^]+)/,xr+"box-$1$2"+ga+"flex-$1$2")+e;case 5443:return xr+e+ga+"flex-item-"+wr(e,/flex-|-self/,"")+e;case 4675:return xr+e+ga+"flex-line-pack"+wr(e,/align-content|flex-|-self/,"")+e;case 5548:return xr+e+ga+wr(e,"shrink","negative")+e;case 5292:return xr+e+ga+wr(e,"basis","preferred-size")+e;case 6060:return xr+"box-"+wr(e,"-grow","")+xr+e+ga+wr(e,"grow","positive")+e;case 4554:return xr+wr(e,/([^-])(transform)/g,"$1"+xr+"$2")+e;case 6187:return wr(wr(wr(e,/(zoom-|grab)/,xr+"$1"),/(image-set)/,xr+"$1"),e,"")+e;case 5495:case 3959:return wr(e,/(image-set\([^]*)/,xr+"$1$`$1");case 4968:return wr(wr(e,/(.+:)(flex-)?(.*)/,xr+"box-pack:$3"+ga+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+xr+e+e;case 4095:case 3583:case 4068:case 2532:return wr(e,/(.+)-inline(.+)/,xr+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ll(e)-1-t>6)switch(la(e,t+1)){case 109:if(la(e,t+4)!==45)break;case 102:return wr(e,/(.+:)(.+)-([^]+)/,"$1"+xr+"$2-$3$1"+S0+(la(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~GC(e,"stretch")?r5(wr(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(la(e,t+1)!==115)break;case 6444:switch(la(e,ll(e)-3-(~GC(e,"!important")&&10))){case 107:return wr(e,":",":"+xr)+e;case 101:return wr(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+xr+(la(e,14)===45?"inline-":"")+"box$3$1"+xr+"$2$3$1"+ga+"$2box$3")+e}break;case 5936:switch(la(e,t+11)){case 114:return xr+e+ga+wr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return xr+e+ga+wr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return xr+e+ga+wr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return xr+e+ga+e+e}return e}var zV=function(t,n,r,o){if(t.length>-1&&!t.return)switch(t.type){case K$:t.return=r5(t.value,t.length);break;case XL:return Pp([Pm(t,{value:wr(t.value,"@","@"+xr)})],o);case G$:if(t.length)return wV(t.props,function(a){switch(xV(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Pp([Pm(t,{props:[wr(a,/:(read-\w+)/,":"+S0+"$1")]})],o);case"::placeholder":return Pp([Pm(t,{props:[wr(a,/:(plac\w+)/,":"+xr+"input-$1")]}),Pm(t,{props:[wr(a,/:(plac\w+)/,":"+S0+"$1")]}),Pm(t,{props:[wr(a,/:(plac\w+)/,ga+"input-$1")]})],o)}return""})}},FV=[zV],_V=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var S=w.getAttribute("data-emotion");S.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var o=t.stylisPlugins||FV,a={},i,s=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var S=w.getAttribute("data-emotion").split(" "),b=1;b<S.length;b++)a[S[b]]=!0;s.push(w)});var l,d=[IV,LV];{var u,m=[OV,jV(function(w){u.insert(w)})],g=PV(d.concat(o,m)),y=function(S){return Pp(EV(S),g)};l=function(S,b,$,k){u=$,y(S?S+"{"+b.styles+"}":b.styles),k&&(x.inserted[b.name]=!0)}}var x={key:n,sheet:new hV({key:n,container:i,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:l};return x.sheet.hydrate(s),x},OS={exports:{}},kr={};/** @license React v16.13.1
62
+ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let u=hs(),m;m=u;let g=m.pathname||"/",y=g;if(l!=="/"){let S=l.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=n&&n.state.matches.length?n.state.matches.map(S=>Object.assign(S,{route:n.manifest[S.route.id]||S.route})):gL(e,{pathname:y});return ko(d||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),ko(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.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.`),lH(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},i,S.params),pathname:ts([l,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:ts([l,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),o,n)}function oH(){let e=dH(),t=ey(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:a},"ErrorBoundary")," or"," ",C.createElement("code",{style:a},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},t),n?C.createElement("pre",{style:o},n):null,i)}var aH=C.createElement(oH,null),qL=class extends C.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(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Zq(e.digest);n&&(e=n)}let t=e!==void 0?C.createElement(ps.Provider,{value:this.props.routeContext},C.createElement(U$.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?C.createElement(iH,{error:e},t):t}};qL.contextType=LL;var ES=new WeakMap;function iH({children:e,error:t}){let{basename:n,navigator:r}=C.useContext(Oi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=Xq(t.digest);if(o){let a=ES.get(t);if(a)throw a;let i=CL(o.location,n),s=i.absoluteURL||i.to;if(Mp(o.location,s,L$(r),"allow-explicit"),VC(s))throw new Error("Invalid redirect location");if(SL&&!ES.get(t))if(i.isExternal||o.reloadDocument)window.location.href=s;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:o.replace}));throw ES.set(t,l),l}return C.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s}`})}}return e}function sH({routeContext:e,match:t,children:n}){let r=C.useContext(Gd);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(ps.Provider,{value:e},n)}function lH(e,t=[],n){let r=n?.state;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,a=r?.errors;if(a!=null){let u=o.findIndex(m=>m.route.id&&a?.[m.route.id]!==void 0);er(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let i=!1,s=-1;if(n&&r){i=r.renderFallback;for(let u=0;u<o.length;u++){let m=o[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(s=u),m.route.id){let{loaderData:g,errors:y}=r,x=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!y||y[m.route.id]===void 0);if(m.route.lazy||x){n.isStatic&&(i=!0),s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}}let l=n?.onError,d=r&&l?(u,m)=>{l(u,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Py(r.matches),errorInfo:m})}:void 0;return o.reduceRight((u,m,g)=>{let y,x=!1,w=null,S=null;r&&(y=a&&m.route.id?a[m.route.id]:void 0,w=m.route.errorElement||aH,i&&(s<0&&g===0?(WL("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,S=null):s===g&&(x=!0,S=m.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,g+1)),$=()=>{let k;return y?k=w:x?k=S:m.route.Component?k=C.createElement(m.route.Component,null):m.route.element?k=m.route.element:k=u,C.createElement(sH,{match:m,routeContext:{outlet:u,matches:b,isDataRoute:r!=null},children:k})};return r&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?C.createElement(qL,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:$(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:d}):$()},null)}function q$(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function HL(e){let t=C.useContext(Gd);return er(t,q$(e)),t}function VL(e){let t=C.useContext(jy);return er(t,q$(e)),t}function cH(e){let t=C.useContext(ps);return er(t,q$(e)),t}function H$(e){let t=cH(e),n=t.matches[t.matches.length-1];return er(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function uH(){return H$("useRouteId")}function dH(){let e=C.useContext(U$),t=VL("useRouteError"),n=H$("useRouteError");return e!==void 0?e:t.errors?.[n]}var fH=0;function t2e(e){let{router:t,basename:n}=HL("useBlocker"),r=VL("useBlocker"),[o,a]=C.useState(""),i=C.useCallback(s=>{if(typeof e!="function")return!!e;if(n==="/")return e(s);let{currentLocation:l,nextLocation:d,historyAction:u}=s;return e({currentLocation:{...l,pathname:Ga(l.pathname,n)||l.pathname},nextLocation:{...d,pathname:Ga(d.pathname,n)||d.pathname},historyAction:u})},[n,e]);return C.useEffect(()=>{let s=String(++fH);return a(s),()=>t.deleteBlocker(s)},[t]),C.useEffect(()=>{o!==""&&t.getBlocker(o,i)},[t,o,i]),o&&r.blockers.has(o)?r.blockers.get(o):hp}function pH(){let{router:e}=HL("useNavigate"),t=H$("useNavigate"),n=C.useRef(!1);return UL(()=>{n.current=!0}),C.useCallback(async(o,a={})=>{ko(n.current,BL),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var VO={};function WL(e,t,n){!t&&!VO[e]&&(VO[e]=!0,ko(!1,n))}var WO={};function YO(e,t){!e&&!WO[t]&&(WO[t]=!0,console.warn(t))}var hH="useOptimistic",GO=jd[hH],mH=()=>{};function gH(e){return GO?GO(e):[e,mH]}function yH(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ko(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:C.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ko(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:C.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ko(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:C.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var vH=["HydrateFallback","hydrateFallbackElement"],bH=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function xH({router:e,flushSync:t,onError:n,useTransitions:r}){r=zL()||r;let[a,i]=C.useState(e.state),[s,l]=gH(a),[d,u]=C.useState(),[m,g]=C.useState({isTransitioning:!1}),[y,x]=C.useState(),[w,S]=C.useState(),[b,$]=C.useState(),k=C.useRef(new Map),T=C.useCallback((A,{deletedFetchers:F,newErrors:L,flushSync:_,viewTransitionOpts:R})=>{L&&n&&Object.values(L).forEach(N=>n(N,{location:A.location,params:A.matches[0]?.params??{},pattern:Py(A.matches)})),A.fetchers.forEach((N,B)=>{N.data!==void 0&&k.current.set(B,N.data)}),F.forEach(N=>k.current.delete(N)),YO(_===!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 z=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(YO(R==null||z,"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."),!R||!z){t&&_?t(()=>i(A)):r===!1?i(A):C.startTransition(()=>{r===!0&&l(N=>KO(N,A)),i(A)});return}if(t&&_){t(()=>{w&&(y?.resolve(),w.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:R.currentLocation,nextLocation:R.nextLocation})});let N=e.window.document.startViewTransition(()=>{t(()=>i(A))});N.finished.finally(()=>{t(()=>{x(void 0),S(void 0),u(void 0),g({isTransitioning:!1})})}),t(()=>S(N));return}w?(y?.resolve(),w.skipTransition(),$({state:A,currentLocation:R.currentLocation,nextLocation:R.nextLocation})):(u(A),g({isTransitioning:!0,flushSync:!1,currentLocation:R.currentLocation,nextLocation:R.nextLocation}))},[e.window,t,w,y,r,l,n]);C.useLayoutEffect(()=>e.subscribe(T),[e,T]),C.useEffect(()=>{m.isTransitioning&&!m.flushSync&&x(new bH)},[m]),C.useEffect(()=>{if(y&&d&&e.window){let A=d,F=y.promise,L=e.window.document.startViewTransition(async()=>{r===!1?i(A):C.startTransition(()=>{r===!0&&l(_=>KO(_,A)),i(A)}),await F});L.finished.finally(()=>{x(void 0),S(void 0),u(void 0),g({isTransitioning:!1})}),S(L)}},[d,y,e.window,r,l]),C.useEffect(()=>{y&&d&&s.location.key===d.location.key&&y.resolve()},[y,w,s.location,d]),C.useEffect(()=>{!m.isTransitioning&&b&&(u(b.state),g({isTransitioning:!0,flushSync:!1,currentLocation:b.currentLocation,nextLocation:b.nextLocation}),$(void 0))},[m.isTransitioning,b]);let O=C.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:A=>e.navigate(A),push:(A,F,L)=>e.navigate(A,{state:F,preventScrollReset:L?.preventScrollReset}),replace:(A,F,L)=>e.navigate(A,{replace:!0,state:F,preventScrollReset:L?.preventScrollReset})}),[e]),P=e.basename||"/",D=C.useMemo(()=>({router:e,navigator:O,static:!1,basename:P,onError:n}),[e,O,P,n]);return C.createElement(C.Fragment,null,C.createElement(Gd.Provider,{value:D},C.createElement(jy.Provider,{value:s},C.createElement(FL.Provider,{value:k.current},C.createElement(B$.Provider,{value:m},C.createElement(kH,{basename:P,location:s.location,navigationType:s.historyAction,navigator:O,useTransitions:r},C.createElement(wH,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function KO(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var wH=C.memo(SH);function SH({routes:e,manifest:t,future:n,state:r,isStatic:o,onError:a}){return rH(e,void 0,{manifest:t,state:r,isStatic:o,onError:a})}function CH({to:e,replace:t,state:n,relative:r}){er(lh(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:a}=C.useContext(Oi);ko(!o,"<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:i}=C.useContext(ps),{pathname:s}=hs(),l=Ay(),d=My(e,ix(i),s,r==="path");Mp(typeof e=="string"?e:Oa(e),a.createHref(d),L$(a),"reject");let u=JSON.stringify(d);return C.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function n2e(e){return nH(e.context)}function kH({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1,useTransitions:i}){er(!lh(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=C.useMemo(()=>({basename:s,navigator:o,static:a,useTransitions:i,future:{}}),[s,o,a,i]);typeof n=="string"&&(n=$l(n));let{pathname:d="/",search:u="",hash:m="",state:g=null,key:y="default",mask:x}=n,w=C.useMemo(()=>{let S=Ga(d,s);return S==null?null:{location:{pathname:S,search:u,hash:m,state:g,key:y,mask:x},navigationType:r}},[s,d,u,m,g,y,r,x]);return ko(w!=null,`<Router basename="${s}"> is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:C.createElement(Oi.Provider,{value:l},C.createElement(sx.Provider,{children:t,value:w}))}var Kb="get",Qb="application/x-www-form-urlencoded";function lx(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $H(e){return lx(e)&&e.tagName.toLowerCase()==="button"}function RH(e){return lx(e)&&e.tagName.toLowerCase()==="form"}function TH(e){return lx(e)&&e.tagName.toLowerCase()==="input"}function EH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function MH(e,t){return e.button===0&&(!t||t==="_self")&&!EH(e)}function YC(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function OH(e,t){let n=YC(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(a=>{n.append(o,a)})}),n}var sb=null;function PH(){if(sb===null)try{new FormData(document.createElement("form"),0),sb=!1}catch{sb=!0}return sb}var jH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function MS(e){return e!=null&&!jH.has(e)?(ko(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qb}"`),null):e}function AH(e,t){let n,r,o,a,i;if(RH(e)){let s=e.getAttribute("action");r=s?Ga(s,t):null,n=e.getAttribute("method")||Kb,o=MS(e.getAttribute("enctype"))||Qb,a=new FormData(e)}else if($H(e)||TH(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(r=l?Ga(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||Kb,o=MS(e.getAttribute("formenctype"))||MS(s.getAttribute("enctype"))||Qb,a=new FormData(s,e),!PH()){let{name:d,type:u,value:m}=e;if(u==="image"){let g=d?`${d}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else d&&a.append(d,m)}}else{if(lx(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Kb,r=null,o=Qb,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function V$(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function YL(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Ga(o.pathname,t)==="/"?o.pathname=`${Fp(t)}/_root.${r}`:o.pathname=`${Fp(o.pathname)}.${r}`,o}async function DH(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function NH(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function IH(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await DH(a,n);return i.links?i.links():[]}return[]}));return _H(r.flat(1).filter(NH).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function QO(e,t,n,r,o,a){let i=(l,d)=>n[d]?l.route.id!==n[d].route.id:!0,s=(l,d)=>n[d].pathname!==l.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==l.params["*"];return a==="assets"?t.filter((l,d)=>i(l,d)||s(l,d)):a==="data"?t.filter((l,d)=>{let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(i(l,d)||s(l,d))return!0;if(l.route.shouldRevalidate){let m=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function LH(e,t,{includeHydrateFallback:n}={}){return zH(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function zH(e){return[...new Set(e)]}function FH(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function _H(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(FH(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function W$(){let e=C.useContext(Gd);return V$(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function BH(){let e=C.useContext(jy);return V$(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Y$=C.createContext(void 0);Y$.displayName="FrameworkContext";function cx(){let e=C.useContext(Y$);return V$(e,"You must render this element inside a <HydratedRouter> element"),e}function UH(e,t){let n=C.useContext(Y$),[r,o]=C.useState(!1),[a,i]=C.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=t,g=C.useRef(null);C.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=b=>{b.forEach($=>{i($.isIntersecting)})},S=new IntersectionObserver(w,{threshold:.5});return g.current&&S.observe(g.current),()=>{S.disconnect()}}},[e]),C.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,g,{}]:[a,g,{onFocus:Mm(s,y),onBlur:Mm(l,x),onMouseEnter:Mm(d,y),onMouseLeave:Mm(u,x),onTouchStart:Mm(m,y)}]:[!1,g,{}]}function Mm(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function qH({page:e,...t}){let n=zL(),{nonce:r}=cx(),{router:o}=W$(),a=C.useMemo(()=>gL(o.routes,e,o.basename),[o.routes,e,o.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?C.createElement(VH,{page:e,matches:a,...t}):C.createElement(WH,{page:e,matches:a,...t})):null}function HH(e){let{manifest:t,routeModules:n}=cx(),[r,o]=C.useState([]);return C.useEffect(()=>{let a=!1;return IH(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function VH({page:e,matches:t,...n}){let r=hs(),{future:o}=cx(),{basename:a}=W$(),i=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let s=YL(e,a,o.v8_trailingSlashAwareDataRequests,"rsc"),l=!1,d=[];for(let u of t)typeof u.route.shouldRevalidate=="function"?l=!0:d.push(u.route.id);return l&&d.length>0&&s.searchParams.set("_routes",d.join(",")),[s.pathname+s.search]},[a,o.v8_trailingSlashAwareDataRequests,e,r,t]);return C.createElement(C.Fragment,null,i.map(s=>C.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...n})))}function WH({page:e,matches:t,...n}){let r=hs(),{future:o,manifest:a,routeModules:i}=cx(),{basename:s}=W$(),{loaderData:l,matches:d}=BH(),u=C.useMemo(()=>QO(e,t,d,a,r,"data"),[e,t,d,a,r]),m=C.useMemo(()=>QO(e,t,d,a,r,"assets"),[e,t,d,a,r]),g=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,S=!1;if(t.forEach($=>{let k=a.routes[$.route.id];!k||!k.hasLoader||(!u.some(T=>T.route.id===$.route.id)&&$.route.id in l&&i[$.route.id]?.shouldRevalidate||k.hasClientLoader?S=!0:w.add($.route.id))}),w.size===0)return[];let b=YL(e,s,o.v8_trailingSlashAwareDataRequests,"data");return S&&w.size>0&&b.searchParams.set("_routes",t.filter($=>w.has($.route.id)).map($=>$.route.id).join(",")),[b.pathname+b.search]},[s,o.v8_trailingSlashAwareDataRequests,l,r,a,u,t,e,i]),y=C.useMemo(()=>LH(m,a),[m,a]),x=HH(m);return C.createElement(C.Fragment,null,g.map(w=>C.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>C.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),x.map(({key:w,link:S})=>C.createElement("link",{key:w,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function YH(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var GH=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{GH&&(window.__reactRouterVersion="7.18.4")}catch{}function KH(e,t){return Sq({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:IU({window:t?.window}),hydrationData:QH(),routes:e,mapRouteProperties:yH,hydrationRouteProperties:vH,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function QH(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:XH(e.errors)}),e}function XH(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Oy(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&sq.includes(o.__subType)){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let a=new Error(o.message);a.stack="",n[r]=a}}else n[r]=o;return n}var GL=C.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,mask:s,state:l,target:d,to:u,preventScrollReset:m,viewTransition:g,defaultShouldRevalidate:y,...x},w){let{basename:S,navigator:b,useTransitions:$}=C.useContext(Oi),k=typeof u=="string"&&ox.test(u),T=CL(u,S);u=T.to;let O=Jq(u,{relative:o}),P=hs(),D=null;if(s){let B=My(s,[],P.mask?P.mask.pathname:"/",!0);S!=="/"&&(B.pathname=B.pathname==="/"?S:ts([S,B.pathname])),D=b.createHref(B)}let[A,F,L]=UH(r,x),_=tV(u,{replace:i,mask:s,state:l,target:d,preventScrollReset:m,relative:o,viewTransition:g,defaultShouldRevalidate:y,useTransitions:$});function R(B){t&&t(B),B.defaultPrevented||_(B)}let z=!(T.isExternal||a),N=C.createElement("a",{...x,...L,href:(z?D:void 0)||T.absoluteURL||O,onClick:z?R:t,ref:YH(w,F),target:d,"data-discover":!k&&n==="render"?"true":void 0});return A&&!k?C.createElement(C.Fragment,null,N,C.createElement(qH,{page:O})):N});GL.displayName="Link";var ZH=C.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:s,children:l,...d},u){let m=Dy(i,{relative:d.relative}),g=hs(),y=C.useContext(jy),{navigator:x,basename:w}=C.useContext(Oi),S=y!=null&&sV(m)&&s===!0,b=x.encodeLocation?x.encodeLocation(m).pathname:m.pathname,$=g.pathname,k=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||($=$.toLowerCase(),k=k?k.toLowerCase():null,b=b.toLowerCase()),k&&w&&(k=Ga(k,w)||k);const T=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let O=$===b||!o&&$.startsWith(b)&&$.charAt(T)==="/",P=k!=null&&(k===b||!o&&k.startsWith(b)&&k.charAt(b.length)==="/"),D={isActive:O,isPending:P,isTransitioning:S},A=O?t:void 0,F;typeof r=="function"?F=r(D):F=[r,O?"active":null,P?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let L=typeof a=="function"?a(D):a;return C.createElement(GL,{...d,"aria-current":A,className:F,ref:u,style:L,to:i,viewTransition:s},typeof l=="function"?l(D):l)});ZH.displayName="NavLink";var JH=C.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=Kb,action:s,onSubmit:l,relative:d,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:g,...y},x)=>{let{useTransitions:w}=C.useContext(Oi),S=aV(),b=iV(s,{relative:d}),$=i.toLowerCase()==="get"?"get":"post",k=typeof s=="string"&&ox.test(s),T=O=>{if(l&&l(O),O.defaultPrevented)return;O.preventDefault();let P=O.nativeEvent.submitter,D=P?.getAttribute("formmethod")||i,A=()=>S(P||O.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:o,state:a,relative:d,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:g});w&&n!==!1?C.startTransition(()=>A()):A()};return C.createElement("form",{ref:x,method:$,action:b,onSubmit:r?l:T,...y,"data-discover":!k&&e==="render"?"true":void 0})});JH.displayName="Form";function eV(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KL(e){let t=C.useContext(Gd);return er(t,eV(e)),t}function tV(e,{target:t,replace:n,mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:s,defaultShouldRevalidate:l,useTransitions:d}={}){let u=Ay(),m=hs(),g=Dy(e,{relative:i});return C.useCallback(y=>{if(MH(y,t)){y.preventDefault();let x=n!==void 0?n:Oa(m)===Oa(g),w=()=>u(e,{replace:x,mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:s,defaultShouldRevalidate:l});d?C.startTransition(()=>w()):w()}},[m,u,g,n,r,o,t,e,a,i,s,l,d])}function nV(e){ko(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=C.useRef(YC(e)),n=C.useRef(!1),r=hs(),o=C.useMemo(()=>OH(r.search,n.current?null:t.current),[r.search]),a=Ay(),i=C.useCallback((s,l)=>{const d=YC(typeof s=="function"?s(new URLSearchParams(o)):s);n.current=!0,a("?"+d,l)},[a,o]);return[o,i]}var rV=0,oV=()=>`__${String(++rV)}__`;function aV(){let{router:e}=KL("useSubmit"),{basename:t}=C.useContext(Oi),n=uH(),r=e.fetch,o=e.navigate;return C.useCallback(async(a,i={})=>{let{action:s,method:l,encType:d,formData:u,body:m}=AH(a,t);if(i.navigate===!1){let g=i.fetcherKey||oV();await r(g,n,i.action||s,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||l,formEncType:i.encType||d,flushSync:i.flushSync})}else await o(i.action||s,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:u,body:m,formMethod:i.method||l,formEncType:i.encType||d,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,o,t,n])}function iV(e,{relative:t}={}){let{basename:n}=C.useContext(Oi),r=C.useContext(ps);er(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...Dy(e||".",{relative:t})},i=hs();if(e==null){a.search=i.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(u=>u==="")){s.delete("index"),l.filter(m=>m).forEach(m=>s.append("index",m));let u=s.toString();a.search=u?`?${u}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:ts([n,a.pathname])),Oa(a)}function sV(e,{relative:t}={}){let n=C.useContext(B$);er(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=KL("useViewTransitionState"),o=Dy(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ga(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Ga(n.nextLocation.pathname,r)||n.nextLocation.pathname;return x0(o.pathname,i)!=null||x0(o.pathname,a)!=null}var ux=dL();const su=A$(ux);function lV(e){return C.createElement(xH,{flushSync:ux.flushSync,...e})}const cV="modulepreload",uV=function(e){return"/"+e},XO={},wo=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=s?.nonce||s?.getAttribute("nonce");o=i(n.map(d=>{if(d=uV(d),d in XO)return;XO[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":cV,u||(g.as="script"),g.crossOrigin="",g.href=d,l&&g.setAttribute("nonce",l),document.head.appendChild(g),u)return new Promise((y,x)=>{g.addEventListener("load",y),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(i){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=i,window.dispatchEvent(s),!s.defaultPrevented)throw i}return o.then(i=>{for(const s of i||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})},ty={black:"#000",white:"#fff"},Qf={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Xf={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Zf={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Jf={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},ep={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Om={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},dV={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function sc(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Minified MUI error #${e}; visit ${n} for the full message.`}const Is="$$material";function w0(){return w0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w0.apply(null,arguments)}function fV(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function pV(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var hV=(function(){function e(n){var r=this;this._insertTag=function(o){var a;r.tags.length===0?r.insertionPoint?a=r.insertionPoint.nextSibling:r.prepend?a=r.container.firstChild:a=r.before:a=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(o,a),r.tags.push(o)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(pV(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var a=fV(o);try{a.insertRule(r,a.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}),this.tags=[],this.ctr=0},e})(),ga="-ms-",S0="-moz-",xr="-webkit-",QL="comm",G$="rule",K$="decl",mV="@import",XL="@keyframes",gV="@layer",yV=Math.abs,dx=String.fromCharCode,vV=Object.assign;function bV(e,t){return la(e,0)^45?(((t<<2^la(e,0))<<2^la(e,1))<<2^la(e,2))<<2^la(e,3):0}function ZL(e){return e.trim()}function xV(e,t){return(e=t.exec(e))?e[0]:e}function wr(e,t,n){return e.replace(t,n)}function GC(e,t){return e.indexOf(t)}function la(e,t){return e.charCodeAt(t)|0}function ny(e,t,n){return e.slice(t,n)}function ll(e){return e.length}function Q$(e){return e.length}function lb(e,t){return t.push(e),e}function wV(e,t){return e.map(t).join("")}var fx=1,_p=1,JL=0,Ka=0,zo=0,ch="";function px(e,t,n,r,o,a,i){return{value:e,root:t,parent:n,type:r,props:o,children:a,line:fx,column:_p,length:i,return:""}}function Pm(e,t){return vV(px("",null,null,"",null,null,0),e,{length:-e.length},t)}function SV(){return zo}function CV(){return zo=Ka>0?la(ch,--Ka):0,_p--,zo===10&&(_p=1,fx--),zo}function $i(){return zo=Ka<JL?la(ch,Ka++):0,_p++,zo===10&&(_p=1,fx++),zo}function gl(){return la(ch,Ka)}function Xb(){return Ka}function Ny(e,t){return ny(ch,e,t)}function ry(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function e5(e){return fx=_p=1,JL=ll(ch=e),Ka=0,[]}function t5(e){return ch="",e}function Zb(e){return ZL(Ny(Ka-1,KC(e===91?e+2:e===40?e+1:e)))}function kV(e){for(;(zo=gl())&&zo<33;)$i();return ry(e)>2||ry(zo)>3?"":" "}function $V(e,t){for(;--t&&$i()&&!(zo<48||zo>102||zo>57&&zo<65||zo>70&&zo<97););return Ny(e,Xb()+(t<6&&gl()==32&&$i()==32))}function KC(e){for(;$i();)switch(zo){case e:return Ka;case 34:case 39:e!==34&&e!==39&&KC(zo);break;case 40:e===41&&KC(e);break;case 92:$i();break}return Ka}function RV(e,t){for(;$i()&&e+zo!==57;)if(e+zo===84&&gl()===47)break;return"/*"+Ny(t,Ka-1)+"*"+dx(e===47?e:$i())}function TV(e){for(;!ry(gl());)$i();return Ny(e,Ka)}function EV(e){return t5(Jb("",null,null,null,[""],e=e5(e),0,[0],e))}function Jb(e,t,n,r,o,a,i,s,l){for(var d=0,u=0,m=i,g=0,y=0,x=0,w=1,S=1,b=1,$=0,k="",T=o,O=a,P=r,D=k;S;)switch(x=$,$=$i()){case 40:if(x!=108&&la(D,m-1)==58){GC(D+=wr(Zb($),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:D+=Zb($);break;case 9:case 10:case 13:case 32:D+=kV(x);break;case 92:D+=$V(Xb()-1,7);continue;case 47:switch(gl()){case 42:case 47:lb(MV(RV($i(),Xb()),t,n),l);break;default:D+="/"}break;case 123*w:s[d++]=ll(D)*b;case 125*w:case 59:case 0:switch($){case 0:case 125:S=0;case 59+u:b==-1&&(D=wr(D,/\f/g,"")),y>0&&ll(D)-m&&lb(y>32?JO(D+";",r,n,m-1):JO(wr(D," ","")+";",r,n,m-2),l);break;case 59:D+=";";default:if(lb(P=ZO(D,t,n,d,u,o,s,k,T=[],O=[],m),a),$===123)if(u===0)Jb(D,t,P,P,T,a,m,s,O);else switch(g===99&&la(D,3)===110?100:g){case 100:case 108:case 109:case 115:Jb(e,P,P,r&&lb(ZO(e,P,P,0,0,o,s,k,o,T=[],m),O),o,O,m,s,r?T:O);break;default:Jb(D,P,P,P,[""],O,0,s,O)}}d=u=y=0,w=b=1,k=D="",m=i;break;case 58:m=1+ll(D),y=x;default:if(w<1){if($==123)--w;else if($==125&&w++==0&&CV()==125)continue}switch(D+=dx($),$*w){case 38:b=u>0?1:(D+="\f",-1);break;case 44:s[d++]=(ll(D)-1)*b,b=1;break;case 64:gl()===45&&(D+=Zb($i())),g=gl(),u=m=ll(k=D+=TV(Xb())),$++;break;case 45:x===45&&ll(D)==2&&(w=0)}}return a}function ZO(e,t,n,r,o,a,i,s,l,d,u){for(var m=o-1,g=o===0?a:[""],y=Q$(g),x=0,w=0,S=0;x<r;++x)for(var b=0,$=ny(e,m+1,m=yV(w=i[x])),k=e;b<y;++b)(k=ZL(w>0?g[b]+" "+$:wr($,/&\f/g,g[b])))&&(l[S++]=k);return px(e,t,n,o===0?G$:s,l,d,u)}function MV(e,t,n){return px(e,t,n,QL,dx(SV()),ny(e,2,-2),0)}function JO(e,t,n,r){return px(e,t,n,K$,ny(e,0,r),ny(e,r+1,-1),r)}function Pp(e,t){for(var n="",r=Q$(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function OV(e,t,n,r){switch(e.type){case gV:if(e.children.length)break;case mV:case K$:return e.return=e.return||e.value;case QL:return"";case XL:return e.return=e.value+"{"+Pp(e.children,r)+"}";case G$:e.value=e.props.join(",")}return ll(n=Pp(e.children,r))?e.return=e.value+"{"+n+"}":""}function PV(e){var t=Q$(e);return function(n,r,o,a){for(var i="",s=0;s<t;s++)i+=e[s](n,r,o,a)||"";return i}}function jV(e){return function(t){t.root||(t=t.return)&&e(t)}}function n5(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var AV=function(t,n,r){for(var o=0,a=0;o=a,a=gl(),o===38&&a===12&&(n[r]=1),!ry(a);)$i();return Ny(t,Ka)},DV=function(t,n){var r=-1,o=44;do switch(ry(o)){case 0:o===38&&gl()===12&&(n[r]=1),t[r]+=AV(Ka-1,n,r);break;case 2:t[r]+=Zb(o);break;case 4:if(o===44){t[++r]=gl()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=dx(o)}while(o=$i());return t},NV=function(t,n){return t5(DV(e5(t),n))},eP=new WeakMap,IV=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,o=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!eP.get(r))&&!o){eP.set(t,!0);for(var a=[],i=NV(n,a),s=r.props,l=0,d=0;l<i.length;l++)for(var u=0;u<s.length;u++,d++)t.props[d]=a[l]?i[l].replace(/&\f/g,s[u]):s[u]+" "+i[l]}}},LV=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function r5(e,t){switch(bV(e,t)){case 5103:return xr+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return xr+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return xr+e+S0+e+ga+e+e;case 6828:case 4268:return xr+e+ga+e+e;case 6165:return xr+e+ga+"flex-"+e+e;case 5187:return xr+e+wr(e,/(\w+).+(:[^]+)/,xr+"box-$1$2"+ga+"flex-$1$2")+e;case 5443:return xr+e+ga+"flex-item-"+wr(e,/flex-|-self/,"")+e;case 4675:return xr+e+ga+"flex-line-pack"+wr(e,/align-content|flex-|-self/,"")+e;case 5548:return xr+e+ga+wr(e,"shrink","negative")+e;case 5292:return xr+e+ga+wr(e,"basis","preferred-size")+e;case 6060:return xr+"box-"+wr(e,"-grow","")+xr+e+ga+wr(e,"grow","positive")+e;case 4554:return xr+wr(e,/([^-])(transform)/g,"$1"+xr+"$2")+e;case 6187:return wr(wr(wr(e,/(zoom-|grab)/,xr+"$1"),/(image-set)/,xr+"$1"),e,"")+e;case 5495:case 3959:return wr(e,/(image-set\([^]*)/,xr+"$1$`$1");case 4968:return wr(wr(e,/(.+:)(flex-)?(.*)/,xr+"box-pack:$3"+ga+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+xr+e+e;case 4095:case 3583:case 4068:case 2532:return wr(e,/(.+)-inline(.+)/,xr+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ll(e)-1-t>6)switch(la(e,t+1)){case 109:if(la(e,t+4)!==45)break;case 102:return wr(e,/(.+:)(.+)-([^]+)/,"$1"+xr+"$2-$3$1"+S0+(la(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~GC(e,"stretch")?r5(wr(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(la(e,t+1)!==115)break;case 6444:switch(la(e,ll(e)-3-(~GC(e,"!important")&&10))){case 107:return wr(e,":",":"+xr)+e;case 101:return wr(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+xr+(la(e,14)===45?"inline-":"")+"box$3$1"+xr+"$2$3$1"+ga+"$2box$3")+e}break;case 5936:switch(la(e,t+11)){case 114:return xr+e+ga+wr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return xr+e+ga+wr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return xr+e+ga+wr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return xr+e+ga+e+e}return e}var zV=function(t,n,r,o){if(t.length>-1&&!t.return)switch(t.type){case K$:t.return=r5(t.value,t.length);break;case XL:return Pp([Pm(t,{value:wr(t.value,"@","@"+xr)})],o);case G$:if(t.length)return wV(t.props,function(a){switch(xV(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Pp([Pm(t,{props:[wr(a,/:(read-\w+)/,":"+S0+"$1")]})],o);case"::placeholder":return Pp([Pm(t,{props:[wr(a,/:(plac\w+)/,":"+xr+"input-$1")]}),Pm(t,{props:[wr(a,/:(plac\w+)/,":"+S0+"$1")]}),Pm(t,{props:[wr(a,/:(plac\w+)/,ga+"input-$1")]})],o)}return""})}},FV=[zV],_V=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var S=w.getAttribute("data-emotion");S.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var o=t.stylisPlugins||FV,a={},i,s=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var S=w.getAttribute("data-emotion").split(" "),b=1;b<S.length;b++)a[S[b]]=!0;s.push(w)});var l,d=[IV,LV];{var u,m=[OV,jV(function(w){u.insert(w)})],g=PV(d.concat(o,m)),y=function(S){return Pp(EV(S),g)};l=function(S,b,$,k){u=$,y(S?S+"{"+b.styles+"}":b.styles),k&&(x.inserted[b.name]=!0)}}var x={key:n,sheet:new hV({key:n,container:i,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:l};return x.sheet.hydrate(s),x},OS={exports:{}},kr={};/** @license React v16.13.1
63
63
  * react-is.production.min.js
64
64
  *
65
65
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -271,7 +271,7 @@ export default theme;`}function PP(e){return typeof e=="number"?`${(e*100).toFix
271
271
  `);i=s===-1?"":a.slice(s+1)}if(!r.stack)r.stack=i;else if(i){const s=i.indexOf(`
272
272
  `),l=s===-1?-1:i.indexOf(`
273
273
  `,s+1),d=l===-1?"":i.slice(l+1);String(r.stack).endsWith(d)||(r.stack+=`
274
- `+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Bd(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&l0.assertOptions(r,{silentJSONParsing:ha.transitional(ha.boolean),forcedJSONParsing:ha.transitional(ha.boolean),clarifyTimeoutError:ha.transitional(ha.boolean),legacyInterceptorReqResOrdering:ha.transitional(ha.boolean),advertiseZstdAcceptEncoding:ha.transitional(ha.boolean),validateStatusUndefinedResolves:ha.transitional(ha.boolean)},!1),o!=null&&(De.isFunction(o)?n.paramsSerializer={serialize:o}:l0.assertOptions(o,{encode:ha.function,serialize:ha.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),l0.assertOptions(n,{baseUrl:ha.spelling("baseURL"),withXsrfToken:ha.spelling("withXSRFToken")},!0),n.method=(De.getSafeProp(n,"method")||De.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=a&&De.merge(a.common,a[n.method]);a&&De.forEach(l4.concat("common"),x=>{delete a[x]}),n.headers=ba.concat(i,a);const s=[];let l=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;l=l&&w.synchronous;const S=n.transitional||GR;S&&S.legacyInterceptorReqResOrdering?s.unshift(w.fulfilled,w.rejected):s.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let u,m=0,g;if(!l){const x=[QS.bind(this),void 0];for(x.unshift(...s),x.push(...d),g=x.length,u=Promise.resolve(n);m<g;)u=u.then(x[m++],x[m++]);return u}g=s.length;let y=n;for(;m<g;){const x=s[m++],w=s[m++];try{y=x?x(y):y}catch(S){if(!w){u=Promise.reject(S);break}try{const b=w.call(this,S);De.isThenable(b)&&(u=Promise.resolve(b).then(()=>QS.call(this,y)))}catch(b){u=Promise.reject(b)}break}}if(!u)try{u=QS.call(this,y)}catch(x){u=Promise.reject(x)}for(m=0,g=d.length;m<g;)u=u.then(d[m++],d[m++]);return u}getUri(t){t=Bd(this.defaults,t);const n=f4(t.baseURL,t.url,t.allowAbsoluteUrls,t);return o4(n,t.params,t.paramsSerializer)}};De.forEach(["delete","get","head","options"],function(t){Td.prototype[t]=function(n,r){return this.request(Bd(r||{},{method:t,url:n,data:r&&De.hasOwnProp(r,"data")?r.data:void 0}))}});De.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,i,s){return this.request(Bd(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Td.prototype[t]=n(),t!=="query"&&(Td.prototype[t+"Form"]=n(!0))});let _ne=class y4{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{r.subscribe(s),a=s}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,s){r.reason||(r.reason=new Vy(a,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new y4(function(o){t=o}),cancel:t}}};function Bne(e){return function(n){return e.apply(null,n)}}function Une(e){return De.isObject(e)&&e.isAxiosError===!0}const c0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(c0).forEach(([e,t])=>{c0[t]===void 0&&(c0[t]=e)});function v4(e){const t=new Td(e),n=Uz(Td.prototype.request,t);return De.extend(n,Td.prototype,t,{allOwnKeys:!0}),De.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return v4(Bd(e,o))},n}const It=v4(Hy);It.Axios=Td;It.CanceledError=Vy;It.CancelToken=_ne;It.isCancel=c4;It.VERSION=QR;It.toFormData=Wx;It.AxiosError=Wt;It.Cancel=It.CanceledError;It.all=function(t){return Promise.all(t)};It.spread=Bne;It.isAxiosError=Une;It.mergeConfig=Bd;It.AxiosHeaders=ba;It.formToJSON=e=>s4(De.isHTMLForm(e)?new FormData(e):e);It.getAdapter=g4.getAdapter;It.HttpStatusCode=c0;It.default=It;const{Axios:i2e,AxiosError:s2e,CanceledError:l2e,isCancel:c2e,CancelToken:u2e,VERSION:d2e,all:f2e,Cancel:p2e,isAxiosError:h2e,spread:m2e,toFormData:g2e,AxiosHeaders:y2e,HttpStatusCode:v2e,formToJSON:b2e,getAdapter:x2e,mergeConfig:w2e,create:S2e}=It,pA="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",wi={radius:{control:"6px",tile:"8px",menu:"10px",dialog:"12px"},size:{control:32,chip:24},type:{pageTitle:{fontSize:24,fontWeight:600,letterSpacing:"-0.01em"},tileTitle:{fontSize:14,fontWeight:600,lineHeight:1.4},prose:{fontSize:15,lineHeight:1.6},control:{fontSize:13,fontWeight:500},caption:{fontSize:12,lineHeight:1.4},label:{fontSize:12,fontWeight:600,lineHeight:1.4},code:{fontSize:11.5,fontFamily:pA}},font:{mono:pA},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function qne(e){if(!e)return wi;const t={...wi.font,...e.font},n={...wi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...wi.radius,...e.radius},size:{...wi.size,...e.size},type:n,font:t,shadow:{...wi.shadow,...e.shadow}}}const hr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490",slate:"#475569"},ZR={environment:hr.emerald,package:hr.teal,connection:hr.orange},Fo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',Hne=ct(DK)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),Vne=ct(zK)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),b4=ct(HK)({padding:"0"}),x4=ct("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),Wne=ct("div")({height:"100%"}),w4=ct("div")({height:"75vh",width:"100%",overflowY:"auto"}),Yne={light:{accent:hr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},Gne={light:"#ffffff",dark:"#0f172a"},Kne=3,_g=e=>{const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return;const n=t[1].length===3?[...t[1]].map(r=>r+r).join(""):t[1];return[0,2,4].map(r=>parseInt(n.slice(r,r+2),16))},S4=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,Ak=(e,t,n)=>S4(e.map(r=>r+(t-r)*n)),Dk=e=>{const[t,n,r]=e.map(o=>{const a=o/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},L0=(e,t)=>{const[n,r]=[Dk(e),Dk(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},Qne=[15,23,42];function Nk(e,t,n=Kne){const r=_g(e),o=_g(t);if(!r||!o||L0(r,o)>=n)return e;const a=Dk(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=_g(Ak(r,a,i));if(s&&L0(s,o)>=n)return S4(s)}return a===255?"#ffffff":"#000000"}function Ik(e,t,n=Gne[t]){const r=Yne[t];if(!e||e.toLowerCase()===hr.blue)return r;if(!_g(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=Nk(e,n),a=_g(o),i=t==="dark"?Ak(a,255,.25):Ak(a,0,.2),s=L0(a,[255,255,255]),l=L0(a,Qne);return{accent:o,accentHover:i,accentContrast:s>=l?"#ffffff":"#0f172a"}}const Xne=[hr.blue,hr.orange,hr.emerald,hr.pink,hr.violet,hr.amber,hr.cyan,hr.lime],Zne="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Lk={palette:{series:Xne,background:{light:"#ffffff",dark:"#0f172a"},tableHeader:{light:"#475569",dark:"#cbd5e1"},tableHeaderBackground:{light:"#f8fafc",dark:"#1e293b"},tableBody:{light:"#475569",dark:"#e2e8f0"},tile:{light:"#ffffff",dark:"#0f172a"},tileTitle:{light:"#475569",dark:"#94a3b8"},mapColor:{light:hr.blue,dark:hr.blue},border:{light:"#e2e8f0",dark:"#334155"},cardBorder:{light:"#cbd5e1",dark:"#475569"},axis:{light:"#cbd5e1",dark:"#475569"},gridline:{light:"#cbd5e1",dark:"#475569"},chartText:{light:"#0f172a",dark:"#e2e8f0"},value:{light:"#0f172a",dark:"#f1f5f9"}},font:{family:Zne,size:12}},Jne=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function C4(e,t){const n=Lk.palette??{},r=Lk.font??{family:"sans-serif",size:12};let o=[...n.series??[]],a=!1,i=r.family??"sans-serif",s=r.size??12;const l={background:{...n.background??{}},tableHeader:{...n.tableHeader??{}},tableHeaderBackground:{...n.tableHeaderBackground??{}},tableBody:{...n.tableBody??{}},tile:{...n.tile??{}},tileTitle:{...n.tileTitle??{}},mapColor:{...n.mapColor??{}},border:{...n.border??{}},cardBorder:{...n.cardBorder??{}},axis:{...n.axis??{}},gridline:{...n.gridline??{}},chartText:{...n.chartText??{}},value:{...n.value??{}}},d={light:new Set,dark:new Set};for(const x of e)if(x){Array.isArray(x.palette?.series)&&(o=[...x.palette.series],a=!0);for(const w of Jne){const S=x.palette?.[w];S&&(l[w]={...l[w],...S},S.light!==void 0&&d.light.add(w),S.dark!==void 0&&d.dark.add(w))}typeof x.font?.family=="string"&&(i=x.font.family),typeof x.font?.size=="number"&&(s=x.font.size)}const u=t==="dark",m=x=>l[x][t]??n[x]?.[t],g=m("background"),y=u&&d.light.has("mapColor")&&!d.dark.has("mapColor")?Nk(l.mapColor.light,g):m("mapColor");return{mode:t,ui:wi,series:u&&a?o.map(x=>Nk(x,g)):o,...Ik(o[0],t,g),font:{family:i,size:s},background:g,tableHeader:m("tableHeader"),tableHeaderBackground:m("tableHeaderBackground"),tableBody:m("tableBody"),tile:m("tile"),tileTitle:m("tileTitle"),mapColor:y,tableBackground:g,border:`1px solid ${m("border")}`,cardBorder:`1px solid ${m("cardBorder")}`,pinnedBorder:`1px solid ${m("cardBorder")}`,valueColor:m("value"),foreground:m("chartText"),axisFaint:m("axis"),gridline:m("gridline"),shadow:u?{lift:"0 2px 12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08)",drag:"0 12px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12)"}:{lift:"0 2px 10px rgba(0, 0, 0, 0.10)",drag:"0 12px 32px rgba(0, 0, 0, 0.22)"},dashboardRoot:u?"#0f172a":"#ffffff",drillLink:Ik(void 0,t).accent}}function C2e(e,t){const n=t.palette?.series;if(!Array.isArray(n)||n.length!==1)return t;const r=n[0],o=e.reduce((d,u)=>Array.isArray(u?.palette?.series)?u.palette.series:d,Lk.palette?.series??[]),a=d=>d.toLowerCase()===r.toLowerCase(),[i,...s]=o,l=s.length>0?s.map(d=>a(d)?i:d):[i].filter(d=>d!==void 0&&!a(d));return{...t,palette:{...t.palette,series:[r,...l]}}}function ere(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const k4=C.createContext(void 0);function tre({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),l=C.useMemo(()=>qne(a),[s]),d=C.useMemo(()=>({...C4(e,t),ui:l}),[e,t,l]),u=C.useMemo(()=>({theme:d,layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o}),[d,e,t,n,r,o]);return p.jsx(k4.Provider,{value:u,children:i})}function Vr(){return C.useContext(k4)||{theme:C4([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const rn="http://localhost/api/v0".replace(/\/+$/,"");let Ja=class{constructor(t,n=rn,r=It){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},nre=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const an={},sn="https://example.com",Qe=function(e,t,n){if(n==null)throw new nre(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function zk(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>zk(e,r,n)):Object.keys(t).forEach(r=>zk(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const ln=function(e,...t){const n=new URLSearchParams(e.search);zk(n,t),e.search=n.toString()},rre=function(e,t){return t instanceof Set?Array.from(t):t},Mo=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{},rre):e||""},cn=function(e){return e.pathname+e.search+e.hash},un=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},$4={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},hA={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},Ea={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Cb={Version:"version",Package:"package"},ore=function(e){return{getAgent:async(t,n,r,o,a,i={})=>{Qe("getAgent","environmentName",t),Qe("getAgent","packageName",n),Qe("getAgent","agentName",r);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};o!==void 0&&(g.skills=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},getAgentSkillFile:async(t,n,r,o,a,i={})=>{Qe("getAgentSkillFile","environmentName",t),Qe("getAgentSkillFile","packageName",n),Qe("getAgentSkillFile","agentName",r),Qe("getAgentSkillFile","relativeFilepath",o);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}/skills/{relativeFilepath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))).replace("{relativeFilepath}",encodeURIComponent(String(o))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},listAgents:async(t,n,r,o={})=>{Qe("listAgents","environmentName",t),Qe("listAgents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/agents".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},XS=function(e){const t=ore(e);return{async getAgent(n,r,o,a,i,s){const l=await t.getAgent(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["AgentsApi.getAgent"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async getAgentSkillFile(n,r,o,a,i,s){const l=await t.getAgentSkillFile(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["AgentsApi.getAgentSkillFile"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async listAgents(n,r,o,a){const i=await t.listAgents(n,r,o,a),s=e?.serverIndex??0,l=an["AgentsApi.listAgents"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let are=class extends Ja{getAgent(t,n,r,o,a,i){return XS(this.configuration).getAgent(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getAgentSkillFile(t,n,r,o,a,i){return XS(this.configuration).getAgentSkillFile(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}listAgents(t,n,r,o){return XS(this.configuration).listAgents(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ire=function(e){return{createConnection:async(t,n,r,o={})=>{Qe("createConnection","environmentName",t),Qe("createConnection","connectionName",n),Qe("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},deleteConnection:async(t,n,r={})=>{Qe("deleteConnection","environmentName",t),Qe("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},getConnection:async(t,n,r={})=>{Qe("getConnection","environmentName",t),Qe("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},getTable:async(t,n,r,o,a={})=>{Qe("getTable","environmentName",t),Qe("getTable","connectionName",n),Qe("getTable","schemaName",r),Qe("getTable","tablePath",o);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))).replace("{tablePath}",encodeURIComponent(String(o))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{Qe("getTableInPackage","environmentName",t),Qe("getTableInPackage","packageName",n),Qe("getTableInPackage","connectionName",r),Qe("getTableInPackage","schemaName",o),Qe("getTableInPackage","tablePath",a);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))).replace("{tablePath}",encodeURIComponent(String(a))),d=new URL(l,sn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",ln(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:cn(d),options:m}},listConnections:async(t,n={})=>{Qe("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},listSchemas:async(t,n,r={})=>{Qe("listSchemas","environmentName",t),Qe("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{Qe("listSchemasInPackage","environmentName",t),Qe("listSchemasInPackage","packageName",n),Qe("listSchemasInPackage","connectionName",r);const i="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listTables:async(t,n,r,o,a={})=>{Qe("listTables","environmentName",t),Qe("listTables","connectionName",n),Qe("listTables","schemaName",r);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o&&(m.tableNames=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{Qe("listTablesInPackage","environmentName",t),Qe("listTablesInPackage","packageName",n),Qe("listTablesInPackage","connectionName",r),Qe("listTablesInPackage","schemaName",o);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))),d=new URL(l,sn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};a&&(y.tableNames=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",ln(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:cn(d),options:m}},postQuerydata:async(t,n,r,o={})=>{Qe("postQuerydata","environmentName",t),Qe("postQuerydata","connectionName",n),Qe("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{Qe("postQuerydataInPackage","environmentName",t),Qe("postQuerydataInPackage","packageName",n),Qe("postQuerydataInPackage","connectionName",r),Qe("postQuerydataInPackage","postQuerydataRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},postSqlsource:async(t,n,r,o={})=>{Qe("postSqlsource","environmentName",t),Qe("postSqlsource","connectionName",n),Qe("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{Qe("postSqlsourceInPackage","environmentName",t),Qe("postSqlsourceInPackage","packageName",n),Qe("postSqlsourceInPackage","connectionName",r),Qe("postSqlsourceInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},postTemporarytable:async(t,n,r,o={})=>{Qe("postTemporarytable","environmentName",t),Qe("postTemporarytable","connectionName",n),Qe("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{Qe("postTemporarytableInPackage","environmentName",t),Qe("postTemporarytableInPackage","packageName",n),Qe("postTemporarytableInPackage","connectionName",r),Qe("postTemporarytableInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},updateConnection:async(t,n,r,o={})=>{Qe("updateConnection","environmentName",t),Qe("updateConnection","connectionName",n),Qe("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}}}},sa=function(e){const t=ire(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.createConnection"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=an["ConnectionsApi.deleteConnection"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=an["ConnectionsApi.getConnection"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async getTable(n,r,o,a,i){const s=await t.getTable(n,r,o,a,i),l=e?.serverIndex??0,d=an["ConnectionsApi.getTable"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async getTableInPackage(n,r,o,a,i,s,l){const d=await t.getTableInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=an["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>un(d,It,rn,e)(g,m||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=an["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=an["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async listSchemasInPackage(n,r,o,a,i){const s=await t.listSchemasInPackage(n,r,o,a,i),l=e?.serverIndex??0,d=an["ConnectionsApi.listSchemasInPackage"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listTables(n,r,o,a,i){const s=await t.listTables(n,r,o,a,i),l=e?.serverIndex??0,d=an["ConnectionsApi.listTables"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listTablesInPackage(n,r,o,a,i,s,l){const d=await t.listTablesInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=an["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>un(d,It,rn,e)(g,m||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.postQuerydata"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async postQuerydataInPackage(n,r,o,a,i,s){const l=await t.postQuerydataInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ConnectionsApi.postQuerydataInPackage"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.postSqlsource"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async postSqlsourceInPackage(n,r,o,a,i,s){const l=await t.postSqlsourceInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ConnectionsApi.postSqlsourceInPackage"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async postTemporarytableInPackage(n,r,o,a,i,s){const l=await t.postTemporarytableInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ConnectionsApi.postTemporarytableInPackage"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.updateConnection"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let sre=class extends Ja{createConnection(t,n,r,o){return sa(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return sa(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return sa(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getTable(t,n,r,o,a){return sa(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTableInPackage(t,n,r,o,a,i,s){return sa(this.configuration).getTableInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listConnections(t,n){return sa(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return sa(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listSchemasInPackage(t,n,r,o,a){return sa(this.configuration).listSchemasInPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTables(t,n,r,o,a){return sa(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTablesInPackage(t,n,r,o,a,i,s){return sa(this.configuration).listTablesInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}postQuerydata(t,n,r,o){return sa(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postQuerydataInPackage(t,n,r,o,a,i){return sa(this.configuration).postQuerydataInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postSqlsource(t,n,r,o){return sa(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsourceInPackage(t,n,r,o,a,i){return sa(this.configuration).postSqlsourceInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return sa(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytableInPackage(t,n,r,o,a,i){return sa(this.configuration).postTemporarytableInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}updateConnection(t,n,r,o){return sa(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const lre=function(e){return{getDashboard:async(t,n,r,o,a={})=>{Qe("getDashboard","environmentName",t),Qe("getDashboard","packageName",n),Qe("getDashboard","dashboardName",r);const i="/environments/{environmentName}/packages/{packageName}/dashboards/{dashboardName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{dashboardName}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listDashboards:async(t,n,r,o={})=>{Qe("listDashboards","environmentName",t),Qe("listDashboards","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/dashboards".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},mA=function(e){const t=lre(e);return{async getDashboard(n,r,o,a,i){const s=await t.getDashboard(n,r,o,a,i),l=e?.serverIndex??0,d=an["DashboardsApi.getDashboard"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listDashboards(n,r,o,a){const i=await t.listDashboards(n,r,o,a),s=e?.serverIndex??0,l=an["DashboardsApi.listDashboards"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};class cre extends Ja{getDashboard(t,n,r,o,a){return mA(this.configuration).getDashboard(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listDashboards(t,n,r,o){return mA(this.configuration).listDashboards(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const ure=function(e){return{listDataApps:async(t,n,r,o={})=>{Qe("listDataApps","environmentName",t),Qe("listDataApps","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/data-apps".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},dre=function(e){const t=ure(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,l=an["DataAppsApi.listDataApps"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};class fre extends Ja{listDataApps(t,n,r,o){return dre(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const pre=function(e){return{listDatabases:async(t,n,r,o={})=>{Qe("listDatabases","environmentName",t),Qe("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},hre=function(e){const t=pre(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=an["DatabasesApi.listDatabases"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let mre=class extends Ja{listDatabases(t,n,r,o){return hre(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const gre=function(e){return{createEnvironment:async(t,n={})=>{Qe("createEnvironment","environment",t);const r="/environments",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:cn(o),options:i}},deleteEnvironment:async(t,n={})=>{Qe("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},l={};s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},getEnvironment:async(t,n,r={})=>{Qe("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};n!==void 0&&(d.reload=n),l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},updateEnvironment:async(t,n,r={})=>{Qe("updateEnvironment","environmentName",t),Qe("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},d={};l["Content-Type"]="application/json",l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},s.data=Mo(n,s,e),{url:cn(a),options:s}}}},Bm=function(e){const t=gre(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=an["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=an["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=an["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=an["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=an["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)}}};let yre=class extends Ja{createEnvironment(t,n){return Bm(this.configuration).createEnvironment(t,n).then(r=>r(this.axios,this.basePath))}deleteEnvironment(t,n){return Bm(this.configuration).deleteEnvironment(t,n).then(r=>r(this.axios,this.basePath))}getEnvironment(t,n,r){return Bm(this.configuration).getEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}listEnvironments(t){return Bm(this.configuration).listEnvironments(t).then(n=>n(this.axios,this.basePath))}updateEnvironment(t,n,r){return Bm(this.configuration).updateEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}};const vre=function(e){return{createMaterialization:async(t,n,r,o={})=>{Qe("createMaterialization","environmentName",t),Qe("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},deleteMaterialization:async(t,n,r,o,a,i={})=>{Qe("deleteMaterialization","environmentName",t),Qe("deleteMaterialization","packageName",n),Qe("deleteMaterialization","materializationId",r);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"DELETE",...d,...i},m={},g={};o!==void 0&&(g.dropTables=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},getMaterialization:async(t,n,r,o,a={})=>{Qe("getMaterialization","environmentName",t),Qe("getMaterialization","packageName",n),Qe("getMaterialization","materializationId",r);const i="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listMaterializations:async(t,n,r,o,a,i={})=>{Qe("listMaterializations","environmentName",t),Qe("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};r!==void 0&&(g.limit=r),o!==void 0&&(g.offset=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{Qe("materializationAction","environmentName",t),Qe("materializationAction","packageName",n),Qe("materializationAction","materializationId",r),Qe("materializationAction","action",o);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};o!==void 0&&(g.action=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}}}},Um=function(e){const t=vre(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,l=an["MaterializationsApi.createMaterialization"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async deleteMaterialization(n,r,o,a,i,s){const l=await t.deleteMaterialization(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["MaterializationsApi.deleteMaterialization"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=an["MaterializationsApi.getMaterialization"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listMaterializations(n,r,o,a,i,s){const l=await t.listMaterializations(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["MaterializationsApi.listMaterializations"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async materializationAction(n,r,o,a,i,s){const l=await t.materializationAction(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["MaterializationsApi.materializationAction"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)}}};let bre=class extends Ja{createMaterialization(t,n,r,o){return Um(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a,i){return Um(this.configuration).deleteMaterialization(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return Um(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return Um(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return Um(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const xre={Stop:"stop"},wre=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{Qe("compileModelSource","environmentName",t),Qe("compileModelSource","packageName",n),Qe("compileModelSource","path",r),Qe("compileModelSource","compileRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/compile".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},executeQueryModel:async(t,n,r,o,a,i={})=>{Qe("executeQueryModel","environmentName",t),Qe("executeQueryModel","packageName",n),Qe("executeQueryModel","path",r),Qe("executeQueryModel","queryRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.includeHiddenFilesAndSources=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},getModel:async(t,n,r,o,a,i,s={})=>{Qe("getModel","environmentName",t),Qe("getModel","packageName",n),Qe("getModel","path",r);const l="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,sn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};o!==void 0&&(y.versionId=o),a!==void 0&&(y.includeHiddenFilesAndSources=a),i!==void 0&&(y.givens=i),g.Accept="application/json",ln(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:cn(d),options:m}},listModels:async(t,n,r,o,a={})=>{Qe("listModels","environmentName",t),Qe("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},updateModelSource:async(t,n,r,o,a,i={})=>{Qe("updateModelSource","environmentName",t),Qe("updateModelSource","packageName",n),Qe("updateModelSource","path",r),Qe("updateModelSource","modelSourceWriteRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"PUT",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}}}},qm=function(e){const t=wre(e);return{async compileModelSource(n,r,o,a,i,s){const l=await t.compileModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ModelsApi.compileModelSource"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async executeQueryModel(n,r,o,a,i,s){const l=await t.executeQueryModel(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ModelsApi.executeQueryModel"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async getModel(n,r,o,a,i,s,l){const d=await t.getModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=an["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>un(d,It,rn,e)(g,m||y)},async listModels(n,r,o,a,i){const s=await t.listModels(n,r,o,a,i),l=e?.serverIndex??0,d=an["ModelsApi.listModels"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async updateModelSource(n,r,o,a,i,s){const l=await t.updateModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ModelsApi.updateModelSource"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)}}};let Sre=class extends Ja{compileModelSource(t,n,r,o,a,i){return qm(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i){return qm(this.configuration).executeQueryModel(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getModel(t,n,r,o,a,i,s){return qm(this.configuration).getModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listModels(t,n,r,o,a){return qm(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return qm(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Cre=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,s,l,d={})=>{Qe("executeNotebookCell","environmentName",t),Qe("executeNotebookCell","packageName",n),Qe("executeNotebookCell","path",r),Qe("executeNotebookCell","cellIndex",o);const u="/environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))).replace("{cellIndex}",encodeURIComponent(String(o))),m=new URL(u,sn);let g;e&&(g=e.baseOptions);const y={method:"GET",...g,...d},x={},w={};a!==void 0&&(w.versionId=a),i!==void 0&&(w.filter_params=i),s!==void 0&&(w.bypass_filters=s),l!==void 0&&(w.givens=l),x.Accept="application/json",ln(m,w);let S=g&&g.headers?g.headers:{};return y.headers={...x,...S,...d.headers},{url:cn(m),options:y}},getNotebook:async(t,n,r,o,a={})=>{Qe("getNotebook","environmentName",t),Qe("getNotebook","packageName",n),Qe("getNotebook","path",r);const i="/environments/{environmentName}/packages/{packageName}/notebooks/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listNotebooks:async(t,n,r,o={})=>{Qe("listNotebooks","environmentName",t),Qe("listNotebooks","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},ZS=function(e){const t=Cre(e);return{async executeNotebookCell(n,r,o,a,i,s,l,d,u){const m=await t.executeNotebookCell(n,r,o,a,i,s,l,d,u),g=e?.serverIndex??0,y=an["NotebooksApi.executeNotebookCell"]?.[g]?.url;return(x,w)=>un(m,It,rn,e)(x,y||w)},async getNotebook(n,r,o,a,i){const s=await t.getNotebook(n,r,o,a,i),l=e?.serverIndex??0,d=an["NotebooksApi.getNotebook"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,l=an["NotebooksApi.listNotebooks"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let kre=class extends Ja{executeNotebookCell(t,n,r,o,a,i,s,l,d){return ZS(this.configuration).executeNotebookCell(t,n,r,o,a,i,s,l,d).then(u=>u(this.axios,this.basePath))}getNotebook(t,n,r,o,a){return ZS(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return ZS(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const $re=function(e){return{createPackage:async(t,n,r,o={})=>{Qe("createPackage","environmentName",t),Qe("createPackage","_package",n);const a="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};r!==void 0&&(u.dryRun=r),d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(n,l,e),{url:cn(i),options:l}},deletePackage:async(t,n,r={})=>{Qe("deletePackage","environmentName",t),Qe("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Qe("getPackage","environmentName",t),Qe("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.reload=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},getPackageBuildPlan:async(t,n,r,o={})=>{Qe("getPackageBuildPlan","environmentName",t),Qe("getPackageBuildPlan","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/build-plan".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageClassification:async(t,n,r,o={})=>{Qe("getPackageClassification","environmentName",t),Qe("getPackageClassification","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/classification".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageEmbeddingIndex:async(t,n,r,o={})=>{Qe("getPackageEmbeddingIndex","environmentName",t),Qe("getPackageEmbeddingIndex","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/embedding-index".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageEntities:async(t,n,r,o,a={})=>{Qe("getPackageEntities","environmentName",t),Qe("getPackageEntities","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/entities".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},getPackageStatus:async(t,n,r,o={})=>{Qe("getPackageStatus","environmentName",t),Qe("getPackageStatus","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/status".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},listPackages:async(t,n={})=>{Qe("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},updatePackage:async(t,n,r,o={})=>{Qe("updatePackage","environmentName",t),Qe("updatePackage","packageName",n),Qe("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}}}},nl=function(e){const t=$re(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.createPackage"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=an["PackagesApi.deletePackage"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),l=e?.serverIndex??0,d=an["PackagesApi.getPackage"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async getPackageBuildPlan(n,r,o,a){const i=await t.getPackageBuildPlan(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageBuildPlan"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageClassification(n,r,o,a){const i=await t.getPackageClassification(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageClassification"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageEmbeddingIndex(n,r,o,a){const i=await t.getPackageEmbeddingIndex(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageEmbeddingIndex"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageEntities(n,r,o,a,i){const s=await t.getPackageEntities(n,r,o,a,i),l=e?.serverIndex??0,d=an["PackagesApi.getPackageEntities"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async getPackageStatus(n,r,o,a){const i=await t.getPackageStatus(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageStatus"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=an["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.updatePackage"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let Rre=class extends Ja{createPackage(t,n,r,o){return nl(this.configuration).createPackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}deletePackage(t,n,r){return nl(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return nl(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageBuildPlan(t,n,r,o){return nl(this.configuration).getPackageBuildPlan(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageClassification(t,n,r,o){return nl(this.configuration).getPackageClassification(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEmbeddingIndex(t,n,r,o){return nl(this.configuration).getPackageEmbeddingIndex(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEntities(t,n,r,o,a){return nl(this.configuration).getPackageEntities(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageStatus(t,n,r,o){return nl(this.configuration).getPackageStatus(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackages(t,n){return nl(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return nl(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Tre=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};t!==void 0&&(l.includeLoading=t),s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},updateTheme:async(t,n={})=>{Qe("updateTheme","theme",t);const r="/theme",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:cn(o),options:i}}}},kb=function(e){const t=Tre(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=an["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=an["PublisherApi.getStatus"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=an["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=an["PublisherApi.updateTheme"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)}}};let Ere=class extends Ja{deleteTheme(t){return kb(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return kb(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return kb(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return kb(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Mre=function(e){return{getReport:async(t,n,r,o,a={})=>{Qe("getReport","environmentName",t),Qe("getReport","packageName",n),Qe("getReport","path",r);const i="/environments/{environmentName}/packages/{packageName}/reports/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listReports:async(t,n,r,o={})=>{Qe("listReports","environmentName",t),Qe("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},gA=function(e){const t=Mre(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),l=e?.serverIndex??0,d=an["ReportsApi.getReport"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,l=an["ReportsApi.listReports"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let Ore=class extends Ja{getReport(t,n,r,o,a){return gA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return gA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Pre=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{Qe("deletePackageVersion","environmentName",t),Qe("deletePackageVersion","packageName",n),Qe("deletePackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"DELETE",...s,...o},d={},u={};d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageVersion:async(t,n,r,o={})=>{Qe("getPackageVersion","environmentName",t),Qe("getPackageVersion","packageName",n),Qe("getPackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},listPackageVersions:async(t,n,r={})=>{Qe("listPackageVersions","environmentName",t),Qe("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{Qe("setPackageLatestVersion","environmentName",t),Qe("setPackageLatestVersion","packageName",n),Qe("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"PUT",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},setPackageVersionManifest:async(t,n,r,o,a={})=>{Qe("setPackageVersionManifest","environmentName",t),Qe("setPackageVersionManifest","packageName",n),Qe("setPackageVersionManifest","version",r),Qe("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"PUT",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:cn(s),options:d}},updatePackageVersion:async(t,n,r,o,a={})=>{Qe("updatePackageVersion","environmentName",t),Qe("updatePackageVersion","packageName",n),Qe("updatePackageVersion","version",r),Qe("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"PATCH",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:cn(s),options:d}}}},op=function(e){const t=Pre(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,l=an["VersionsApi.deletePackageVersion"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,l=an["VersionsApi.getPackageVersion"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=an["VersionsApi.listPackageVersions"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,l=an["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async setPackageVersionManifest(n,r,o,a,i){const s=await t.setPackageVersionManifest(n,r,o,a,i),l=e?.serverIndex??0,d=an["VersionsApi.setPackageVersionManifest"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async updatePackageVersion(n,r,o,a,i){const s=await t.updatePackageVersion(n,r,o,a,i),l=e?.serverIndex??0,d=an["VersionsApi.updatePackageVersion"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)}}};let jre=class extends Ja{deletePackageVersion(t,n,r,o){return op(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return op(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return op(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return op(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return op(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return op(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const Are=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},startWatching:async(t,n={})=>{Qe("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:cn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{Qe("streamPackageEvents","environmentName",t),Qe("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="text/event-stream,application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},$b=function(e){const t=Are(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=an["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=an["WatchModeApi.startWatching"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=an["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,l=an["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let Dre=class extends Ja{getWatchStatus(t){return $b(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return $b(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return $b(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return $b(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Nre=class{apiKey;username;password;accessToken;awsv4;basePath;serverIndex;baseOptions;formDataCtor;constructor(t={}){this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.awsv4=t.awsv4,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){return t!==null&&/^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i.test(t)}};const JR=new Eee({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),Ire={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function Lre(e,t){return t||e?.modelPage==="viewer"?"viewer":"explorer"}function zre(e){return{modelPage:Lre(e.data,e.isError&&e.data===void 0),isLoadingStatus:e.isPending}}const Fk="publisher:themeMode";function Fre(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Fk);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function _re(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(Fk):window.localStorage.setItem(Fk,e)}catch{}}function Bre(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}It.defaults.baseURL||(It.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const R4=C.createContext(void 0),Ure=(e,t)=>{const n=`${window.location.protocol}//${window.location.host}/api/v0`,r=It.create({baseURL:e||n,withCredentials:!0,timeout:6e5});r.interceptors.request.use(async a=>{const i=await t?.();return a.headers.Authorization=i||"",a});const o=new Nre({basePath:n});return{models:new Sre(o,n,r),publisher:new Ere(o,n,r),environments:new yre(o,n,r),packages:new Rre(o,n,r),agents:new are(o,n,r),dashboards:new cre(o,n,r),dataApps:new fre(o,n,r),notebooks:new kre(o,n,r),reports:new Ore(o,n,r),connections:new sre(o,n,r),databases:new mre(o,n,r),materializations:new bre(o,n,r),watchMode:new Dre(o,n,r),versions:new jre(o,n,r)}},qre=e=>p.jsx(Mee,{client:JR,children:p.jsx(Hre,{...e})}),Hre=({children:e,getAccessToken:t,baseURL:n,mutable:r,theme:o,ui:a})=>{const i=C.useMemo(()=>Ure(n,t),[n,t]),s=n||`${window.location.protocol}//${window.location.host}/api/v0`,l=zd({queryKey:["status",s],retry:3,queryFn:async()=>(await i.publisher.getStatus()).data});l.error&&console.error("Failed to fetch publisher status:",l.error);const d=l.data?.frozenConfig,u=l.data?.theme,{modelPage:m,isLoadingStatus:g}=zre(l);let y;l.isLoading||l.error?y=r:d?y=!1:y=r??!0;const x=C.useMemo(()=>[u,o],[u,o]),[w,S]=C.useState(Fre),[b,$]=C.useState(Bre);C.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const A=window.matchMedia("(prefers-color-scheme: dark)"),F=L=>$(L.matches);return A.addEventListener("change",F),()=>A.removeEventListener("change",F)},[]);const k=C.useCallback(A=>{S(A),_re(A)},[]),T=u?.allowUserToggle??!0,O=T?w:void 0,P=C.useMemo(()=>ere(u?.defaultMode,O,b),[u?.defaultMode,O,b]),D={server:s,getAccessToken:t,apiClients:i,mutable:y,isLoadingStatus:g,instanceTheme:u,modelPage:m};return p.jsx(R4.Provider,{value:D,children:p.jsx(tre,{layers:x,mode:P,userChoice:O,setMode:k,allowUserToggle:T,...a?{ui:a}:{},children:e})})},tr=()=>{const e=C.useContext(R4);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e};function yd(){return yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yd.apply(this,arguments)}const Vre=["children","options"],yA=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),vA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Wre=["style","script","pre"],Yre=["src","href","data","formAction","srcDoc","action"],Gre=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Kre=/mailto:/i,Qre=/\n{2,}$/,bA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Xre=/^ *> ?/gm,Zre=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Jre=/^ {2,}\n/,eoe=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,xA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,wA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,toe=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,noe=/^(?:\n *)*\n/,roe=/\r\n?/g,ooe=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,aoe=/^\[\^([^\]]+)]/,ioe=/\f/g,soe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,loe=/^\s*?\[(x|\s)\]/,SA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,CA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,kA=/^([^\n]+)\n *(=|-){3,} *\n/,JS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,coe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,$A=/^<!--[\s\S]*?(?:-->)/,uoe=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,eC=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,doe=/^\{.*\}$/,foe=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,poe=/^<([^ >]+@[^ >]+)>/,hoe=/^<([^ >]+:\/[^ >]+)>/,moe=/-([a-z])?/gi,RA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,goe=/^[^\n]+(?: \n|\n{2,})/,yoe=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,voe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,boe=/^\[([^\]]*)\] ?\[([^\]]*)\]/,xoe=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,woe=/\t/g,Soe=/(^ *\||\| *$)/g,Coe=/^ *:-+: *$/,koe=/^ *:-+ *$/,$oe=/^ *-+: *$/,Gx=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,Kx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",Roe=RegExp(`^([*_])\\1${Gx(1)}${Kx}\\1\\1(?!\\1)`),Toe=RegExp(`^([*_])${Gx(0)}${Kx}\\1(?!\\1)`),Eoe=RegExp(`^(==)${Gx(0)}${Kx}\\1`),Moe=RegExp(`^(~~)${Gx(0)}${Kx}\\1`),Ooe=/^(:[a-zA-Z0-9-_]+:)/,Poe=/^\\([^0-9A-Za-z\s])/,joe=/\\([^0-9A-Za-z\s])/g,Aoe=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Doe=/^\n+/,Noe=/^([ \t]*)/,Ioe=/(?:^|\n)( *)$/,e2="(?:\\d+\\.)",t2="(?:[*+-])";function T4(e){return"( *)("+(e===1?e2:t2)+") +"}const E4=T4(1),M4=T4(2);function O4(e){return RegExp("^"+(e===1?E4:M4))}const Loe=O4(1),zoe=O4(2);function P4(e){return RegExp("^"+(e===1?E4:M4)+"[^\\n]*(?:\\n(?!\\1"+(e===1?e2:t2)+" )[^\\n]*)*(\\n|$)","gm")}const Foe=P4(1),_oe=P4(2);function j4(e){const t=e===1?e2:t2;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const A4=j4(1),D4=j4(2);function TA(e,t){const n=t===1,r=n?A4:D4,o=n?Foe:_oe,a=n?Loe:zoe;return{t:i=>a.test(i),o:Yp(function(i,s){const l=Ioe.exec(s.prevCapture);return l&&(s.list||!s.inline&&!s.simple)?r.exec(i=l[1]+i):null}),i:1,u(i,s,l){const d=n?+i[2]:void 0,u=i[0].replace(Qre,`
274
+ `+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Bd(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&l0.assertOptions(r,{silentJSONParsing:ha.transitional(ha.boolean),forcedJSONParsing:ha.transitional(ha.boolean),clarifyTimeoutError:ha.transitional(ha.boolean),legacyInterceptorReqResOrdering:ha.transitional(ha.boolean),advertiseZstdAcceptEncoding:ha.transitional(ha.boolean),validateStatusUndefinedResolves:ha.transitional(ha.boolean)},!1),o!=null&&(De.isFunction(o)?n.paramsSerializer={serialize:o}:l0.assertOptions(o,{encode:ha.function,serialize:ha.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),l0.assertOptions(n,{baseUrl:ha.spelling("baseURL"),withXsrfToken:ha.spelling("withXSRFToken")},!0),n.method=(De.getSafeProp(n,"method")||De.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=a&&De.merge(a.common,a[n.method]);a&&De.forEach(l4.concat("common"),x=>{delete a[x]}),n.headers=ba.concat(i,a);const s=[];let l=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;l=l&&w.synchronous;const S=n.transitional||GR;S&&S.legacyInterceptorReqResOrdering?s.unshift(w.fulfilled,w.rejected):s.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let u,m=0,g;if(!l){const x=[QS.bind(this),void 0];for(x.unshift(...s),x.push(...d),g=x.length,u=Promise.resolve(n);m<g;)u=u.then(x[m++],x[m++]);return u}g=s.length;let y=n;for(;m<g;){const x=s[m++],w=s[m++];try{y=x?x(y):y}catch(S){if(!w){u=Promise.reject(S);break}try{const b=w.call(this,S);De.isThenable(b)&&(u=Promise.resolve(b).then(()=>QS.call(this,y)))}catch(b){u=Promise.reject(b)}break}}if(!u)try{u=QS.call(this,y)}catch(x){u=Promise.reject(x)}for(m=0,g=d.length;m<g;)u=u.then(d[m++],d[m++]);return u}getUri(t){t=Bd(this.defaults,t);const n=f4(t.baseURL,t.url,t.allowAbsoluteUrls,t);return o4(n,t.params,t.paramsSerializer)}};De.forEach(["delete","get","head","options"],function(t){Td.prototype[t]=function(n,r){return this.request(Bd(r||{},{method:t,url:n,data:r&&De.hasOwnProp(r,"data")?r.data:void 0}))}});De.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,i,s){return this.request(Bd(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Td.prototype[t]=n(),t!=="query"&&(Td.prototype[t+"Form"]=n(!0))});let _ne=class y4{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{r.subscribe(s),a=s}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,s){r.reason||(r.reason=new Vy(a,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new y4(function(o){t=o}),cancel:t}}};function Bne(e){return function(n){return e.apply(null,n)}}function Une(e){return De.isObject(e)&&e.isAxiosError===!0}const c0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(c0).forEach(([e,t])=>{c0[t]===void 0&&(c0[t]=e)});function v4(e){const t=new Td(e),n=Uz(Td.prototype.request,t);return De.extend(n,Td.prototype,t,{allOwnKeys:!0}),De.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return v4(Bd(e,o))},n}const It=v4(Hy);It.Axios=Td;It.CanceledError=Vy;It.CancelToken=_ne;It.isCancel=c4;It.VERSION=QR;It.toFormData=Wx;It.AxiosError=Wt;It.Cancel=It.CanceledError;It.all=function(t){return Promise.all(t)};It.spread=Bne;It.isAxiosError=Une;It.mergeConfig=Bd;It.AxiosHeaders=ba;It.formToJSON=e=>s4(De.isHTMLForm(e)?new FormData(e):e);It.getAdapter=g4.getAdapter;It.HttpStatusCode=c0;It.default=It;const{Axios:s2e,AxiosError:l2e,CanceledError:c2e,isCancel:u2e,CancelToken:d2e,VERSION:f2e,all:p2e,Cancel:h2e,isAxiosError:m2e,spread:g2e,toFormData:y2e,AxiosHeaders:v2e,HttpStatusCode:b2e,formToJSON:x2e,getAdapter:w2e,mergeConfig:S2e,create:C2e}=It,pA="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",wi={radius:{control:"6px",tile:"8px",menu:"10px",dialog:"12px"},size:{control:32,chip:24},type:{pageTitle:{fontSize:24,fontWeight:600,letterSpacing:"-0.01em"},tileTitle:{fontSize:14,fontWeight:600,lineHeight:1.4},prose:{fontSize:15,lineHeight:1.6},control:{fontSize:13,fontWeight:500},caption:{fontSize:12,lineHeight:1.4},label:{fontSize:12,fontWeight:600,lineHeight:1.4},code:{fontSize:11.5,fontFamily:pA}},font:{mono:pA},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function qne(e){if(!e)return wi;const t={...wi.font,...e.font},n={...wi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...wi.radius,...e.radius},size:{...wi.size,...e.size},type:n,font:t,shadow:{...wi.shadow,...e.shadow}}}const hr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490",slate:"#475569"},ZR={environment:hr.emerald,package:hr.teal,connection:hr.orange},Fo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',Hne=ct(DK)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),Vne=ct(zK)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),b4=ct(HK)({padding:"0"}),x4=ct("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),Wne=ct("div")({height:"100%"}),w4=ct("div")({height:"75vh",width:"100%",overflowY:"auto"}),Yne={light:{accent:hr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},Gne={light:"#ffffff",dark:"#0f172a"},Kne=3,_g=e=>{const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return;const n=t[1].length===3?[...t[1]].map(r=>r+r).join(""):t[1];return[0,2,4].map(r=>parseInt(n.slice(r,r+2),16))},S4=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,Ak=(e,t,n)=>S4(e.map(r=>r+(t-r)*n)),Dk=e=>{const[t,n,r]=e.map(o=>{const a=o/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},L0=(e,t)=>{const[n,r]=[Dk(e),Dk(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},Qne=[15,23,42];function Nk(e,t,n=Kne){const r=_g(e),o=_g(t);if(!r||!o||L0(r,o)>=n)return e;const a=Dk(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=_g(Ak(r,a,i));if(s&&L0(s,o)>=n)return S4(s)}return a===255?"#ffffff":"#000000"}function Ik(e,t,n=Gne[t]){const r=Yne[t];if(!e||e.toLowerCase()===hr.blue)return r;if(!_g(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=Nk(e,n),a=_g(o),i=t==="dark"?Ak(a,255,.25):Ak(a,0,.2),s=L0(a,[255,255,255]),l=L0(a,Qne);return{accent:o,accentHover:i,accentContrast:s>=l?"#ffffff":"#0f172a"}}const Xne=[hr.blue,hr.orange,hr.emerald,hr.pink,hr.violet,hr.amber,hr.cyan,hr.lime],Zne="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Lk={palette:{series:Xne,background:{light:"#ffffff",dark:"#0f172a"},tableHeader:{light:"#475569",dark:"#cbd5e1"},tableHeaderBackground:{light:"#f8fafc",dark:"#1e293b"},tableBody:{light:"#475569",dark:"#e2e8f0"},tile:{light:"#ffffff",dark:"#0f172a"},tileTitle:{light:"#475569",dark:"#94a3b8"},mapColor:{light:hr.blue,dark:hr.blue},border:{light:"#e2e8f0",dark:"#334155"},cardBorder:{light:"#cbd5e1",dark:"#475569"},axis:{light:"#cbd5e1",dark:"#475569"},gridline:{light:"#cbd5e1",dark:"#475569"},chartText:{light:"#0f172a",dark:"#e2e8f0"},value:{light:"#0f172a",dark:"#f1f5f9"}},font:{family:Zne,size:12}},Jne=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function C4(e,t){const n=Lk.palette??{},r=Lk.font??{family:"sans-serif",size:12};let o=[...n.series??[]],a=!1,i=r.family??"sans-serif",s=r.size??12;const l={background:{...n.background??{}},tableHeader:{...n.tableHeader??{}},tableHeaderBackground:{...n.tableHeaderBackground??{}},tableBody:{...n.tableBody??{}},tile:{...n.tile??{}},tileTitle:{...n.tileTitle??{}},mapColor:{...n.mapColor??{}},border:{...n.border??{}},cardBorder:{...n.cardBorder??{}},axis:{...n.axis??{}},gridline:{...n.gridline??{}},chartText:{...n.chartText??{}},value:{...n.value??{}}},d={light:new Set,dark:new Set};for(const x of e)if(x){Array.isArray(x.palette?.series)&&(o=[...x.palette.series],a=!0);for(const w of Jne){const S=x.palette?.[w];S&&(l[w]={...l[w],...S},S.light!==void 0&&d.light.add(w),S.dark!==void 0&&d.dark.add(w))}typeof x.font?.family=="string"&&(i=x.font.family),typeof x.font?.size=="number"&&(s=x.font.size)}const u=t==="dark",m=x=>l[x][t]??n[x]?.[t],g=m("background"),y=u&&d.light.has("mapColor")&&!d.dark.has("mapColor")?Nk(l.mapColor.light,g):m("mapColor");return{mode:t,ui:wi,series:u&&a?o.map(x=>Nk(x,g)):o,...Ik(o[0],t,g),font:{family:i,size:s},background:g,tableHeader:m("tableHeader"),tableHeaderBackground:m("tableHeaderBackground"),tableBody:m("tableBody"),tile:m("tile"),tileTitle:m("tileTitle"),mapColor:y,tableBackground:g,border:`1px solid ${m("border")}`,cardBorder:`1px solid ${m("cardBorder")}`,pinnedBorder:`1px solid ${m("cardBorder")}`,valueColor:m("value"),foreground:m("chartText"),axisFaint:m("axis"),gridline:m("gridline"),shadow:u?{lift:"0 2px 12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08)",drag:"0 12px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12)"}:{lift:"0 2px 10px rgba(0, 0, 0, 0.10)",drag:"0 12px 32px rgba(0, 0, 0, 0.22)"},dashboardRoot:u?"#0f172a":"#ffffff",drillLink:Ik(void 0,t).accent}}function k2e(e,t){const n=t.palette?.series;if(!Array.isArray(n)||n.length!==1)return t;const r=n[0],o=e.reduce((d,u)=>Array.isArray(u?.palette?.series)?u.palette.series:d,Lk.palette?.series??[]),a=d=>d.toLowerCase()===r.toLowerCase(),[i,...s]=o,l=s.length>0?s.map(d=>a(d)?i:d):[i].filter(d=>d!==void 0&&!a(d));return{...t,palette:{...t.palette,series:[r,...l]}}}function ere(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const k4=C.createContext(void 0);function tre({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),l=C.useMemo(()=>qne(a),[s]),d=C.useMemo(()=>({...C4(e,t),ui:l}),[e,t,l]),u=C.useMemo(()=>({theme:d,layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o}),[d,e,t,n,r,o]);return p.jsx(k4.Provider,{value:u,children:i})}function Vr(){return C.useContext(k4)||{theme:C4([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const rn="http://localhost/api/v0".replace(/\/+$/,"");let Ja=class{constructor(t,n=rn,r=It){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},nre=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const an={},sn="https://example.com",Qe=function(e,t,n){if(n==null)throw new nre(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function zk(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>zk(e,r,n)):Object.keys(t).forEach(r=>zk(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const ln=function(e,...t){const n=new URLSearchParams(e.search);zk(n,t),e.search=n.toString()},rre=function(e,t){return t instanceof Set?Array.from(t):t},Mo=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{},rre):e||""},cn=function(e){return e.pathname+e.search+e.hash},un=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},$4={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},hA={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},Ea={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Cb={Version:"version",Package:"package"},ore=function(e){return{getAgent:async(t,n,r,o,a,i={})=>{Qe("getAgent","environmentName",t),Qe("getAgent","packageName",n),Qe("getAgent","agentName",r);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};o!==void 0&&(g.skills=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},getAgentSkillFile:async(t,n,r,o,a,i={})=>{Qe("getAgentSkillFile","environmentName",t),Qe("getAgentSkillFile","packageName",n),Qe("getAgentSkillFile","agentName",r),Qe("getAgentSkillFile","relativeFilepath",o);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}/skills/{relativeFilepath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))).replace("{relativeFilepath}",encodeURIComponent(String(o))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},listAgents:async(t,n,r,o={})=>{Qe("listAgents","environmentName",t),Qe("listAgents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/agents".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},XS=function(e){const t=ore(e);return{async getAgent(n,r,o,a,i,s){const l=await t.getAgent(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["AgentsApi.getAgent"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async getAgentSkillFile(n,r,o,a,i,s){const l=await t.getAgentSkillFile(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["AgentsApi.getAgentSkillFile"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async listAgents(n,r,o,a){const i=await t.listAgents(n,r,o,a),s=e?.serverIndex??0,l=an["AgentsApi.listAgents"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let are=class extends Ja{getAgent(t,n,r,o,a,i){return XS(this.configuration).getAgent(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getAgentSkillFile(t,n,r,o,a,i){return XS(this.configuration).getAgentSkillFile(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}listAgents(t,n,r,o){return XS(this.configuration).listAgents(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ire=function(e){return{createConnection:async(t,n,r,o={})=>{Qe("createConnection","environmentName",t),Qe("createConnection","connectionName",n),Qe("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},deleteConnection:async(t,n,r={})=>{Qe("deleteConnection","environmentName",t),Qe("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},getConnection:async(t,n,r={})=>{Qe("getConnection","environmentName",t),Qe("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},getTable:async(t,n,r,o,a={})=>{Qe("getTable","environmentName",t),Qe("getTable","connectionName",n),Qe("getTable","schemaName",r),Qe("getTable","tablePath",o);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))).replace("{tablePath}",encodeURIComponent(String(o))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{Qe("getTableInPackage","environmentName",t),Qe("getTableInPackage","packageName",n),Qe("getTableInPackage","connectionName",r),Qe("getTableInPackage","schemaName",o),Qe("getTableInPackage","tablePath",a);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))).replace("{tablePath}",encodeURIComponent(String(a))),d=new URL(l,sn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",ln(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:cn(d),options:m}},listConnections:async(t,n={})=>{Qe("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},listSchemas:async(t,n,r={})=>{Qe("listSchemas","environmentName",t),Qe("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{Qe("listSchemasInPackage","environmentName",t),Qe("listSchemasInPackage","packageName",n),Qe("listSchemasInPackage","connectionName",r);const i="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listTables:async(t,n,r,o,a={})=>{Qe("listTables","environmentName",t),Qe("listTables","connectionName",n),Qe("listTables","schemaName",r);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o&&(m.tableNames=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{Qe("listTablesInPackage","environmentName",t),Qe("listTablesInPackage","packageName",n),Qe("listTablesInPackage","connectionName",r),Qe("listTablesInPackage","schemaName",o);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))),d=new URL(l,sn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};a&&(y.tableNames=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",ln(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:cn(d),options:m}},postQuerydata:async(t,n,r,o={})=>{Qe("postQuerydata","environmentName",t),Qe("postQuerydata","connectionName",n),Qe("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{Qe("postQuerydataInPackage","environmentName",t),Qe("postQuerydataInPackage","packageName",n),Qe("postQuerydataInPackage","connectionName",r),Qe("postQuerydataInPackage","postQuerydataRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},postSqlsource:async(t,n,r,o={})=>{Qe("postSqlsource","environmentName",t),Qe("postSqlsource","connectionName",n),Qe("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{Qe("postSqlsourceInPackage","environmentName",t),Qe("postSqlsourceInPackage","packageName",n),Qe("postSqlsourceInPackage","connectionName",r),Qe("postSqlsourceInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},postTemporarytable:async(t,n,r,o={})=>{Qe("postTemporarytable","environmentName",t),Qe("postTemporarytable","connectionName",n),Qe("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{Qe("postTemporarytableInPackage","environmentName",t),Qe("postTemporarytableInPackage","packageName",n),Qe("postTemporarytableInPackage","connectionName",r),Qe("postTemporarytableInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},updateConnection:async(t,n,r,o={})=>{Qe("updateConnection","environmentName",t),Qe("updateConnection","connectionName",n),Qe("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}}}},sa=function(e){const t=ire(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.createConnection"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=an["ConnectionsApi.deleteConnection"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=an["ConnectionsApi.getConnection"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async getTable(n,r,o,a,i){const s=await t.getTable(n,r,o,a,i),l=e?.serverIndex??0,d=an["ConnectionsApi.getTable"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async getTableInPackage(n,r,o,a,i,s,l){const d=await t.getTableInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=an["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>un(d,It,rn,e)(g,m||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=an["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=an["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async listSchemasInPackage(n,r,o,a,i){const s=await t.listSchemasInPackage(n,r,o,a,i),l=e?.serverIndex??0,d=an["ConnectionsApi.listSchemasInPackage"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listTables(n,r,o,a,i){const s=await t.listTables(n,r,o,a,i),l=e?.serverIndex??0,d=an["ConnectionsApi.listTables"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listTablesInPackage(n,r,o,a,i,s,l){const d=await t.listTablesInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=an["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>un(d,It,rn,e)(g,m||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.postQuerydata"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async postQuerydataInPackage(n,r,o,a,i,s){const l=await t.postQuerydataInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ConnectionsApi.postQuerydataInPackage"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.postSqlsource"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async postSqlsourceInPackage(n,r,o,a,i,s){const l=await t.postSqlsourceInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ConnectionsApi.postSqlsourceInPackage"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async postTemporarytableInPackage(n,r,o,a,i,s){const l=await t.postTemporarytableInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ConnectionsApi.postTemporarytableInPackage"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,l=an["ConnectionsApi.updateConnection"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let sre=class extends Ja{createConnection(t,n,r,o){return sa(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return sa(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return sa(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getTable(t,n,r,o,a){return sa(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTableInPackage(t,n,r,o,a,i,s){return sa(this.configuration).getTableInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listConnections(t,n){return sa(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return sa(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listSchemasInPackage(t,n,r,o,a){return sa(this.configuration).listSchemasInPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTables(t,n,r,o,a){return sa(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTablesInPackage(t,n,r,o,a,i,s){return sa(this.configuration).listTablesInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}postQuerydata(t,n,r,o){return sa(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postQuerydataInPackage(t,n,r,o,a,i){return sa(this.configuration).postQuerydataInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postSqlsource(t,n,r,o){return sa(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsourceInPackage(t,n,r,o,a,i){return sa(this.configuration).postSqlsourceInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return sa(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytableInPackage(t,n,r,o,a,i){return sa(this.configuration).postTemporarytableInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}updateConnection(t,n,r,o){return sa(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const lre=function(e){return{getDashboard:async(t,n,r,o,a={})=>{Qe("getDashboard","environmentName",t),Qe("getDashboard","packageName",n),Qe("getDashboard","dashboardName",r);const i="/environments/{environmentName}/packages/{packageName}/dashboards/{dashboardName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{dashboardName}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listDashboards:async(t,n,r,o={})=>{Qe("listDashboards","environmentName",t),Qe("listDashboards","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/dashboards".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},mA=function(e){const t=lre(e);return{async getDashboard(n,r,o,a,i){const s=await t.getDashboard(n,r,o,a,i),l=e?.serverIndex??0,d=an["DashboardsApi.getDashboard"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listDashboards(n,r,o,a){const i=await t.listDashboards(n,r,o,a),s=e?.serverIndex??0,l=an["DashboardsApi.listDashboards"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};class cre extends Ja{getDashboard(t,n,r,o,a){return mA(this.configuration).getDashboard(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listDashboards(t,n,r,o){return mA(this.configuration).listDashboards(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const ure=function(e){return{listDataApps:async(t,n,r,o={})=>{Qe("listDataApps","environmentName",t),Qe("listDataApps","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/data-apps".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},dre=function(e){const t=ure(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,l=an["DataAppsApi.listDataApps"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let fre=class extends Ja{listDataApps(t,n,r,o){return dre(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const pre=function(e){return{listDatabases:async(t,n,r,o={})=>{Qe("listDatabases","environmentName",t),Qe("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},hre=function(e){const t=pre(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=an["DatabasesApi.listDatabases"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let mre=class extends Ja{listDatabases(t,n,r,o){return hre(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const gre=function(e){return{createEnvironment:async(t,n={})=>{Qe("createEnvironment","environment",t);const r="/environments",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:cn(o),options:i}},deleteEnvironment:async(t,n={})=>{Qe("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},l={};s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},getEnvironment:async(t,n,r={})=>{Qe("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};n!==void 0&&(d.reload=n),l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},updateEnvironment:async(t,n,r={})=>{Qe("updateEnvironment","environmentName",t),Qe("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},d={};l["Content-Type"]="application/json",l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},s.data=Mo(n,s,e),{url:cn(a),options:s}}}},Bm=function(e){const t=gre(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=an["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=an["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=an["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=an["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=an["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)}}};let yre=class extends Ja{createEnvironment(t,n){return Bm(this.configuration).createEnvironment(t,n).then(r=>r(this.axios,this.basePath))}deleteEnvironment(t,n){return Bm(this.configuration).deleteEnvironment(t,n).then(r=>r(this.axios,this.basePath))}getEnvironment(t,n,r){return Bm(this.configuration).getEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}listEnvironments(t){return Bm(this.configuration).listEnvironments(t).then(n=>n(this.axios,this.basePath))}updateEnvironment(t,n,r){return Bm(this.configuration).updateEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}};const vre=function(e){return{createMaterialization:async(t,n,r,o={})=>{Qe("createMaterialization","environmentName",t),Qe("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},deleteMaterialization:async(t,n,r,o,a,i={})=>{Qe("deleteMaterialization","environmentName",t),Qe("deleteMaterialization","packageName",n),Qe("deleteMaterialization","materializationId",r);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"DELETE",...d,...i},m={},g={};o!==void 0&&(g.dropTables=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},getMaterialization:async(t,n,r,o,a={})=>{Qe("getMaterialization","environmentName",t),Qe("getMaterialization","packageName",n),Qe("getMaterialization","materializationId",r);const i="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listMaterializations:async(t,n,r,o,a,i={})=>{Qe("listMaterializations","environmentName",t),Qe("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};r!==void 0&&(g.limit=r),o!==void 0&&(g.offset=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{Qe("materializationAction","environmentName",t),Qe("materializationAction","packageName",n),Qe("materializationAction","materializationId",r),Qe("materializationAction","action",o);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};o!==void 0&&(g.action=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:cn(l),options:u}}}},Um=function(e){const t=vre(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,l=an["MaterializationsApi.createMaterialization"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async deleteMaterialization(n,r,o,a,i,s){const l=await t.deleteMaterialization(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["MaterializationsApi.deleteMaterialization"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=an["MaterializationsApi.getMaterialization"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listMaterializations(n,r,o,a,i,s){const l=await t.listMaterializations(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["MaterializationsApi.listMaterializations"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async materializationAction(n,r,o,a,i,s){const l=await t.materializationAction(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["MaterializationsApi.materializationAction"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)}}};let bre=class extends Ja{createMaterialization(t,n,r,o){return Um(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a,i){return Um(this.configuration).deleteMaterialization(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return Um(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return Um(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return Um(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const xre={Stop:"stop"},wre=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{Qe("compileModelSource","environmentName",t),Qe("compileModelSource","packageName",n),Qe("compileModelSource","path",r),Qe("compileModelSource","compileRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/compile".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},executeQueryModel:async(t,n,r,o,a,i={})=>{Qe("executeQueryModel","environmentName",t),Qe("executeQueryModel","packageName",n),Qe("executeQueryModel","path",r),Qe("executeQueryModel","queryRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.includeHiddenFilesAndSources=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}},getModel:async(t,n,r,o,a,i,s={})=>{Qe("getModel","environmentName",t),Qe("getModel","packageName",n),Qe("getModel","path",r);const l="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,sn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};o!==void 0&&(y.versionId=o),a!==void 0&&(y.includeHiddenFilesAndSources=a),i!==void 0&&(y.givens=i),g.Accept="application/json",ln(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:cn(d),options:m}},listModels:async(t,n,r,o,a={})=>{Qe("listModels","environmentName",t),Qe("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},updateModelSource:async(t,n,r,o,a,i={})=>{Qe("updateModelSource","environmentName",t),Qe("updateModelSource","packageName",n),Qe("updateModelSource","path",r),Qe("updateModelSource","modelSourceWriteRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(s,sn);let d;e&&(d=e.baseOptions);const u={method:"PUT",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",ln(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:cn(l),options:u}}}},qm=function(e){const t=wre(e);return{async compileModelSource(n,r,o,a,i,s){const l=await t.compileModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ModelsApi.compileModelSource"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async executeQueryModel(n,r,o,a,i,s){const l=await t.executeQueryModel(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ModelsApi.executeQueryModel"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)},async getModel(n,r,o,a,i,s,l){const d=await t.getModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=an["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>un(d,It,rn,e)(g,m||y)},async listModels(n,r,o,a,i){const s=await t.listModels(n,r,o,a,i),l=e?.serverIndex??0,d=an["ModelsApi.listModels"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async updateModelSource(n,r,o,a,i,s){const l=await t.updateModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=an["ModelsApi.updateModelSource"]?.[d]?.url;return(m,g)=>un(l,It,rn,e)(m,u||g)}}};let Sre=class extends Ja{compileModelSource(t,n,r,o,a,i){return qm(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i){return qm(this.configuration).executeQueryModel(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getModel(t,n,r,o,a,i,s){return qm(this.configuration).getModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listModels(t,n,r,o,a){return qm(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return qm(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Cre=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,s,l,d={})=>{Qe("executeNotebookCell","environmentName",t),Qe("executeNotebookCell","packageName",n),Qe("executeNotebookCell","path",r),Qe("executeNotebookCell","cellIndex",o);const u="/environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))).replace("{cellIndex}",encodeURIComponent(String(o))),m=new URL(u,sn);let g;e&&(g=e.baseOptions);const y={method:"GET",...g,...d},x={},w={};a!==void 0&&(w.versionId=a),i!==void 0&&(w.filter_params=i),s!==void 0&&(w.bypass_filters=s),l!==void 0&&(w.givens=l),x.Accept="application/json",ln(m,w);let S=g&&g.headers?g.headers:{};return y.headers={...x,...S,...d.headers},{url:cn(m),options:y}},getNotebook:async(t,n,r,o,a={})=>{Qe("getNotebook","environmentName",t),Qe("getNotebook","packageName",n),Qe("getNotebook","path",r);const i="/environments/{environmentName}/packages/{packageName}/notebooks/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listNotebooks:async(t,n,r,o={})=>{Qe("listNotebooks","environmentName",t),Qe("listNotebooks","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},ZS=function(e){const t=Cre(e);return{async executeNotebookCell(n,r,o,a,i,s,l,d,u){const m=await t.executeNotebookCell(n,r,o,a,i,s,l,d,u),g=e?.serverIndex??0,y=an["NotebooksApi.executeNotebookCell"]?.[g]?.url;return(x,w)=>un(m,It,rn,e)(x,y||w)},async getNotebook(n,r,o,a,i){const s=await t.getNotebook(n,r,o,a,i),l=e?.serverIndex??0,d=an["NotebooksApi.getNotebook"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,l=an["NotebooksApi.listNotebooks"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let kre=class extends Ja{executeNotebookCell(t,n,r,o,a,i,s,l,d){return ZS(this.configuration).executeNotebookCell(t,n,r,o,a,i,s,l,d).then(u=>u(this.axios,this.basePath))}getNotebook(t,n,r,o,a){return ZS(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return ZS(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const $re=function(e){return{createPackage:async(t,n,r,o={})=>{Qe("createPackage","environmentName",t),Qe("createPackage","_package",n);const a="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};r!==void 0&&(u.dryRun=r),d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(n,l,e),{url:cn(i),options:l}},deletePackage:async(t,n,r={})=>{Qe("deletePackage","environmentName",t),Qe("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Qe("getPackage","environmentName",t),Qe("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.reload=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},getPackageBuildPlan:async(t,n,r,o={})=>{Qe("getPackageBuildPlan","environmentName",t),Qe("getPackageBuildPlan","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/build-plan".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageClassification:async(t,n,r,o={})=>{Qe("getPackageClassification","environmentName",t),Qe("getPackageClassification","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/classification".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageEmbeddingIndex:async(t,n,r,o={})=>{Qe("getPackageEmbeddingIndex","environmentName",t),Qe("getPackageEmbeddingIndex","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/embedding-index".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageEntities:async(t,n,r,o,a={})=>{Qe("getPackageEntities","environmentName",t),Qe("getPackageEntities","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/entities".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},getPackageStatus:async(t,n,r,o={})=>{Qe("getPackageStatus","environmentName",t),Qe("getPackageStatus","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/status".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},listPackages:async(t,n={})=>{Qe("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},updatePackage:async(t,n,r,o={})=>{Qe("updatePackage","environmentName",t),Qe("updatePackage","packageName",n),Qe("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}}}},nl=function(e){const t=$re(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.createPackage"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=an["PackagesApi.deletePackage"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),l=e?.serverIndex??0,d=an["PackagesApi.getPackage"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async getPackageBuildPlan(n,r,o,a){const i=await t.getPackageBuildPlan(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageBuildPlan"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageClassification(n,r,o,a){const i=await t.getPackageClassification(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageClassification"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageEmbeddingIndex(n,r,o,a){const i=await t.getPackageEmbeddingIndex(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageEmbeddingIndex"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageEntities(n,r,o,a,i){const s=await t.getPackageEntities(n,r,o,a,i),l=e?.serverIndex??0,d=an["PackagesApi.getPackageEntities"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async getPackageStatus(n,r,o,a){const i=await t.getPackageStatus(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.getPackageStatus"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=an["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=an["PackagesApi.updatePackage"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let Rre=class extends Ja{createPackage(t,n,r,o){return nl(this.configuration).createPackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}deletePackage(t,n,r){return nl(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return nl(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageBuildPlan(t,n,r,o){return nl(this.configuration).getPackageBuildPlan(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageClassification(t,n,r,o){return nl(this.configuration).getPackageClassification(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEmbeddingIndex(t,n,r,o){return nl(this.configuration).getPackageEmbeddingIndex(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEntities(t,n,r,o,a){return nl(this.configuration).getPackageEntities(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageStatus(t,n,r,o){return nl(this.configuration).getPackageStatus(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackages(t,n){return nl(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return nl(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Tre=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};t!==void 0&&(l.includeLoading=t),s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:cn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},updateTheme:async(t,n={})=>{Qe("updateTheme","theme",t);const r="/theme",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:cn(o),options:i}}}},kb=function(e){const t=Tre(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=an["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=an["PublisherApi.getStatus"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=an["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=an["PublisherApi.updateTheme"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)}}};let Ere=class extends Ja{deleteTheme(t){return kb(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return kb(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return kb(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return kb(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Mre=function(e){return{getReport:async(t,n,r,o,a={})=>{Qe("getReport","environmentName",t),Qe("getReport","packageName",n),Qe("getReport","path",r);const i="/environments/{environmentName}/packages/{packageName}/reports/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:cn(s),options:d}},listReports:async(t,n,r,o={})=>{Qe("listReports","environmentName",t),Qe("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},gA=function(e){const t=Mre(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),l=e?.serverIndex??0,d=an["ReportsApi.getReport"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,l=an["ReportsApi.listReports"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let Ore=class extends Ja{getReport(t,n,r,o,a){return gA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return gA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Pre=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{Qe("deletePackageVersion","environmentName",t),Qe("deletePackageVersion","packageName",n),Qe("deletePackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"DELETE",...s,...o},d={},u={};d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},getPackageVersion:async(t,n,r,o={})=>{Qe("getPackageVersion","environmentName",t),Qe("getPackageVersion","packageName",n),Qe("getPackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}},listPackageVersions:async(t,n,r={})=>{Qe("listPackageVersions","environmentName",t),Qe("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,sn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",ln(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:cn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{Qe("setPackageLatestVersion","environmentName",t),Qe("setPackageLatestVersion","packageName",n),Qe("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"PUT",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:cn(i),options:l}},setPackageVersionManifest:async(t,n,r,o,a={})=>{Qe("setPackageVersionManifest","environmentName",t),Qe("setPackageVersionManifest","packageName",n),Qe("setPackageVersionManifest","version",r),Qe("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"PUT",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:cn(s),options:d}},updatePackageVersion:async(t,n,r,o,a={})=>{Qe("updatePackageVersion","environmentName",t),Qe("updatePackageVersion","packageName",n),Qe("updatePackageVersion","version",r),Qe("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,sn);let l;e&&(l=e.baseOptions);const d={method:"PATCH",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",ln(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:cn(s),options:d}}}},op=function(e){const t=Pre(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,l=an["VersionsApi.deletePackageVersion"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,l=an["VersionsApi.getPackageVersion"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=an["VersionsApi.listPackageVersions"]?.[i]?.url;return(l,d)=>un(a,It,rn,e)(l,s||d)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,l=an["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)},async setPackageVersionManifest(n,r,o,a,i){const s=await t.setPackageVersionManifest(n,r,o,a,i),l=e?.serverIndex??0,d=an["VersionsApi.setPackageVersionManifest"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)},async updatePackageVersion(n,r,o,a,i){const s=await t.updatePackageVersion(n,r,o,a,i),l=e?.serverIndex??0,d=an["VersionsApi.updatePackageVersion"]?.[l]?.url;return(u,m)=>un(s,It,rn,e)(u,d||m)}}};let jre=class extends Ja{deletePackageVersion(t,n,r,o){return op(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return op(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return op(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return op(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return op(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return op(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const Are=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},startWatching:async(t,n={})=>{Qe("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,sn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",ln(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:cn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,sn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",ln(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:cn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{Qe("streamPackageEvents","environmentName",t),Qe("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,sn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="text/event-stream,application/json",ln(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:cn(i),options:l}}}},$b=function(e){const t=Are(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=an["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=an["WatchModeApi.startWatching"]?.[a]?.url;return(s,l)=>un(o,It,rn,e)(s,i||l)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=an["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>un(r,It,rn,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,l=an["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(d,u)=>un(i,It,rn,e)(d,l||u)}}};let Dre=class extends Ja{getWatchStatus(t){return $b(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return $b(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return $b(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return $b(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Nre=class{apiKey;username;password;accessToken;awsv4;basePath;serverIndex;baseOptions;formDataCtor;constructor(t={}){this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.awsv4=t.awsv4,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){return t!==null&&/^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i.test(t)}};const JR=new Eee({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),Ire={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function Lre(e,t){return t||e?.modelPage==="viewer"?"viewer":"explorer"}function zre(e){return{modelPage:Lre(e.data,e.isError&&e.data===void 0),isLoadingStatus:e.isPending}}const Fk="publisher:themeMode";function Fre(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Fk);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function _re(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(Fk):window.localStorage.setItem(Fk,e)}catch{}}function Bre(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}It.defaults.baseURL||(It.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const R4=C.createContext(void 0),Ure=(e,t,n)=>{const r=`${window.location.protocol}//${window.location.host}/api/v0`,o=It.create({baseURL:e||r,withCredentials:!0,timeout:6e5,...n?{adapter:n}:{}});o.interceptors.request.use(async i=>{const s=await t?.();return i.headers.Authorization=s||"",i});const a=new Nre({basePath:r});return{models:new Sre(a,r,o),publisher:new Ere(a,r,o),environments:new yre(a,r,o),packages:new Rre(a,r,o),agents:new are(a,r,o),dashboards:new cre(a,r,o),dataApps:new fre(a,r,o),notebooks:new kre(a,r,o),reports:new Ore(a,r,o),connections:new sre(a,r,o),databases:new mre(a,r,o),materializations:new bre(a,r,o),watchMode:new Dre(a,r,o),versions:new jre(a,r,o)}},qre=e=>p.jsx(Mee,{client:JR,children:p.jsx(Hre,{...e})}),Hre=({children:e,getAccessToken:t,baseURL:n,mutable:r,theme:o,ui:a,adapter:i,mode:s})=>{const l=C.useMemo(()=>Ure(n,t,i),[n,t,i]),d=n||`${window.location.protocol}//${window.location.host}/api/v0`,u=zd({queryKey:["status",d],retry:3,queryFn:async()=>(await l.publisher.getStatus()).data});u.error&&console.error("Failed to fetch publisher status:",u.error);const m=u.data?.frozenConfig,g=u.data?.theme,{modelPage:y,isLoadingStatus:x}=zre(u);let w;u.isLoading||u.error?w=r:m?w=!1:w=r??!0;const S=C.useMemo(()=>[g,o],[g,o]),[b,$]=C.useState(Fre),[k,T]=C.useState(Bre);C.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const L=window.matchMedia("(prefers-color-scheme: dark)"),_=R=>T(R.matches);return L.addEventListener("change",_),()=>L.removeEventListener("change",_)},[]);const O=C.useCallback(L=>{$(L),_re(L)},[]),P=g?.allowUserToggle??!0,D=P?b:void 0,A=C.useMemo(()=>s??ere(g?.defaultMode,D,k),[s,g?.defaultMode,D,k]),F={server:d,getAccessToken:t,apiClients:l,mutable:w,isLoadingStatus:x,instanceTheme:g,modelPage:y};return p.jsx(R4.Provider,{value:F,children:p.jsx(tre,{layers:S,mode:A,userChoice:D,setMode:O,allowUserToggle:P&&s===void 0,...a?{ui:a}:{},children:e})})},tr=()=>{const e=C.useContext(R4);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e};function yd(){return yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yd.apply(this,arguments)}const Vre=["children","options"],yA=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),vA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Wre=["style","script","pre"],Yre=["src","href","data","formAction","srcDoc","action"],Gre=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Kre=/mailto:/i,Qre=/\n{2,}$/,bA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Xre=/^ *> ?/gm,Zre=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Jre=/^ {2,}\n/,eoe=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,xA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,wA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,toe=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,noe=/^(?:\n *)*\n/,roe=/\r\n?/g,ooe=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,aoe=/^\[\^([^\]]+)]/,ioe=/\f/g,soe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,loe=/^\s*?\[(x|\s)\]/,SA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,CA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,kA=/^([^\n]+)\n *(=|-){3,} *\n/,JS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,coe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,$A=/^<!--[\s\S]*?(?:-->)/,uoe=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,eC=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,doe=/^\{.*\}$/,foe=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,poe=/^<([^ >]+@[^ >]+)>/,hoe=/^<([^ >]+:\/[^ >]+)>/,moe=/-([a-z])?/gi,RA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,goe=/^[^\n]+(?: \n|\n{2,})/,yoe=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,voe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,boe=/^\[([^\]]*)\] ?\[([^\]]*)\]/,xoe=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,woe=/\t/g,Soe=/(^ *\||\| *$)/g,Coe=/^ *:-+: *$/,koe=/^ *:-+ *$/,$oe=/^ *-+: *$/,Gx=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,Kx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",Roe=RegExp(`^([*_])\\1${Gx(1)}${Kx}\\1\\1(?!\\1)`),Toe=RegExp(`^([*_])${Gx(0)}${Kx}\\1(?!\\1)`),Eoe=RegExp(`^(==)${Gx(0)}${Kx}\\1`),Moe=RegExp(`^(~~)${Gx(0)}${Kx}\\1`),Ooe=/^(:[a-zA-Z0-9-_]+:)/,Poe=/^\\([^0-9A-Za-z\s])/,joe=/\\([^0-9A-Za-z\s])/g,Aoe=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Doe=/^\n+/,Noe=/^([ \t]*)/,Ioe=/(?:^|\n)( *)$/,e2="(?:\\d+\\.)",t2="(?:[*+-])";function T4(e){return"( *)("+(e===1?e2:t2)+") +"}const E4=T4(1),M4=T4(2);function O4(e){return RegExp("^"+(e===1?E4:M4))}const Loe=O4(1),zoe=O4(2);function P4(e){return RegExp("^"+(e===1?E4:M4)+"[^\\n]*(?:\\n(?!\\1"+(e===1?e2:t2)+" )[^\\n]*)*(\\n|$)","gm")}const Foe=P4(1),_oe=P4(2);function j4(e){const t=e===1?e2:t2;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const A4=j4(1),D4=j4(2);function TA(e,t){const n=t===1,r=n?A4:D4,o=n?Foe:_oe,a=n?Loe:zoe;return{t:i=>a.test(i),o:Yp(function(i,s){const l=Ioe.exec(s.prevCapture);return l&&(s.list||!s.inline&&!s.simple)?r.exec(i=l[1]+i):null}),i:1,u(i,s,l){const d=n?+i[2]:void 0,u=i[0].replace(Qre,`
275
275
  `).match(o);let m=!1;return{items:u.map(function(g,y){const x=a.exec(g)[0].length,w=RegExp("^ {1,"+x+"}","gm"),S=g.replace(w,"").replace(a,""),b=y===u.length-1,$=S.indexOf(`
276
276
 
277
277
  `)!==-1||b&&m;m=$;const k=l.inline,T=l.list;let O;l.list=!0,$?(l.inline=!1,O=Bg(S)+`
@@ -287,13 +287,13 @@ export default theme;`}function PP(e){return typeof e=="number"?`${(e*100).toFix
287
287
  `)===-1)return null;let k="";b.split(`
288
288
  `).every(O=>(O+=`
289
289
  `,!a.some(P=>P.test(O))&&(k+=O,!!O.trim())));const T=Bg(k);return T===""?null:[k,,T]}),i:3,u:tC,l:(b,$,k)=>s("p",{key:k.key},$(b.children,k))},22:{t:["["],o:Kc(yoe),i:0,u:b=>(m[b[1]]={target:b[2],title:b[4]},{}),l:rC},23:{t:["!["],o:Qc(voe),i:0,u:b=>({alt:b[1]?rl(b[1]):void 0,ref:b[2]}),l:(b,$,k)=>m[b.ref]?s("img",{key:k.key,alt:b.alt,src:r(m[b.ref].target,"img","src"),title:m[b.ref].title}):null},24:{t:b=>b[0]==="["&&b.indexOf("](")===-1,o:Kc(boe),i:0,u:(b,$,k)=>({children:$(b[1],k),fallbackChildren:b[0],ref:b[2]}),l:(b,$,k)=>m[b.ref]?s("a",{key:k.key,href:r(m[b.ref].target,"a","href"),title:m[b.ref].title},$(b.children,k)):s("span",{key:k.key},b.fallbackChildren)},25:{t:["|"],o:Zl(RA),i:1,u:Voe,l(b,$,k){const T=b;return s("table",{key:k.key},s("thead",null,s("tr",null,T.header.map(function(O,P){return s("th",{key:P,style:MA(T,P)},$(O,k))}))),s("tbody",null,T.cells.map(function(O,P){return s("tr",{key:P},O.map(function(D,A){return s("td",{key:A,style:MA(T,A)},$(D,k))}))})))}},27:{o:Yp(function(b,$){let k;return u0(b,":")&&(k=Ooe.exec(b)),k||Aoe.exec(b)}),i:4,u(b){const $=b[0];return{text:$.indexOf("&")===-1?$:$.replace(coe,(k,T)=>t.namedCodesToUnicode[T]||k)}},l:b=>b.text},28:{t:["**","__"],o:Qc(Roe),i:2,u:(b,$,k)=>({children:$(b[2],k)}),l:(b,$,k)=>s("strong",{key:k.key},$(b.children,k))},29:{t:b=>{const $=b[0];return($==="*"||$==="_")&&b[1]!==$},o:Qc(Toe),i:3,u:(b,$,k)=>({children:$(b[2],k)}),l:(b,$,k)=>s("em",{key:k.key},$(b.children,k))},30:{t:["\\"],o:Qc(Poe),i:1,u:b=>({text:b[1],type:"27"})},31:{t:["=="],o:Qc(Eoe),i:3,u:tC,l:(b,$,k)=>s("mark",{key:k.key},$(b.children,k))},32:{t:["~~"],o:Qc(Moe),i:3,u:tC,l:(b,$,k)=>s("del",{key:k.key},$(b.children,k))}};t.disableParsingRawHTML===!0&&(delete g[11],delete g[13]);const y=(function(b){var $=Object.keys(b);function k(T,O){var P=[];if(O.prevCapture=O.prevCapture||"",T.trim())for(;T;)for(var D=0;D<$.length;){var A=$[D],F=b[A];if(!F.t||qoe(T,O,F.t)){var L=F.o(T,O);if(L&&L[0]){T=T.substring(L[0].length);var _=F.u(L,k,O);O.prevCapture+=L[0],_.type||(_.type=A),P.push(_);break}D++}else D++}return O.prevCapture="",P}return $.sort(function(T,O){return b[T].i-b[O].i||(T<O?-1:1)}),function(T,O){return k((function(P){return P.replace(roe,`
290
- `).replace(ioe,"").replace(woe," ")})(T),O)}})(g),x=(w=(function(b,$){return function(k,T,O){const P=b[k.type].l;return $?$(()=>P(k,T,O),k,T,O):P(k,T,O)}})(g,t.renderRule),function b($,k={}){if(Array.isArray($)){const T=k.key,O=[];let P=!1;for(let D=0;D<$.length;D++){k.key=D;const A=b($[D],k),F=typeof A=="string";F&&P?O[O.length-1]+=A:A!==null&&O.push(A),P=F}return k.key=T,O}return w($,b,k)});var w;const S=l(e);return u.length?s("div",null,S,s("footer",{key:"footer"},u.map(function(b){return s("div",{id:n(b.identifier,Hm),key:b.identifier},b.identifier,x(y(b.footnote,{inline:!0})))}))):S}const Zoe=e=>{let{children:t="",options:n}=e,r=(function(o,a){if(o==null)return{};var i,s,l={},d=Object.keys(o);for(s=0;s<d.length;s++)a.indexOf(i=d[s])>=0||(l[i]=o[i]);return l})(e,Vre);return C.cloneElement(Xoe(t,n),r)},Joe="[A-Za-z_][A-Za-z0-9_]*",F2e=e=>e.split(/\r\n|\r|\n/),N4=e=>new RegExp(`^${Joe}$`).test(e),eae=new Set("accept aggregate calculate calculation connection declare dimension drill except given group_by grouped_by having index join_cross join_many join_one limit measure nest order_by partition_by primary_key query rename run sample select timezone top type view where".split(" ")),tae=new Set("all and as asc avg boolean by case cast compose count date day desc distinct else end exclude export extend false filter for from full has hour import in include inner internal is json left like max min minute month not now null number on or pick private public quarter right second source sql string sum table then this timestamp timestamptz to true virtual week when with year".split(" ")),Wy=e=>N4(e)&&!tae.has(e.toLowerCase()),_2e=e=>Wy(e)&&!eae.has(e.toLowerCase()),B2e=e=>N4(e)&&!Wy(e)?`\`${e}\``:e;function OA(e){const t=/^##\|?(?:[ \t\r\n]|$)/.exec(e);if(!t)return!1;const n=/[0-9A-Za-z_\u00C0-\u024F\u1E00-\u1EFF]+/y;let r=0,o="";for(let a=t[0].length;a<e.length;a++){const i=e[a];if(/\s/.test(i))continue;if(e.startsWith("-...",a)){a+=3,o="";continue}n.lastIndex=a;const s=n.exec(e)?.[0];if(i==='"'||i==="'"){const l=e.startsWith(i.repeat(3),a)?i.repeat(3):i;for(a+=l.length;a<e.length&&!e.startsWith(l,a);)a+=e[a]==="\\"?2:1;a+=l.length-1}else if(i==="`"){let l=a+1;for(;l<e.length&&e[l]!=="`"&&e[l]!==`
290
+ `).replace(ioe,"").replace(woe," ")})(T),O)}})(g),x=(w=(function(b,$){return function(k,T,O){const P=b[k.type].l;return $?$(()=>P(k,T,O),k,T,O):P(k,T,O)}})(g,t.renderRule),function b($,k={}){if(Array.isArray($)){const T=k.key,O=[];let P=!1;for(let D=0;D<$.length;D++){k.key=D;const A=b($[D],k),F=typeof A=="string";F&&P?O[O.length-1]+=A:A!==null&&O.push(A),P=F}return k.key=T,O}return w($,b,k)});var w;const S=l(e);return u.length?s("div",null,S,s("footer",{key:"footer"},u.map(function(b){return s("div",{id:n(b.identifier,Hm),key:b.identifier},b.identifier,x(y(b.footnote,{inline:!0})))}))):S}const Zoe=e=>{let{children:t="",options:n}=e,r=(function(o,a){if(o==null)return{};var i,s,l={},d=Object.keys(o);for(s=0;s<d.length;s++)a.indexOf(i=d[s])>=0||(l[i]=o[i]);return l})(e,Vre);return C.cloneElement(Xoe(t,n),r)},Joe="[A-Za-z_][A-Za-z0-9_]*",B2e=e=>e.split(/\r\n|\r|\n/),N4=e=>new RegExp(`^${Joe}$`).test(e),eae=new Set("accept aggregate calculate calculation connection declare dimension drill except given group_by grouped_by having index join_cross join_many join_one limit measure nest order_by partition_by primary_key query rename run sample select timezone top type view where".split(" ")),tae=new Set("all and as asc avg boolean by case cast compose count date day desc distinct else end exclude export extend false filter for from full has hour import in include inner internal is json left like max min minute month not now null number on or pick private public quarter right second source sql string sum table then this timestamp timestamptz to true virtual week when with year".split(" ")),Wy=e=>N4(e)&&!tae.has(e.toLowerCase()),U2e=e=>Wy(e)&&!eae.has(e.toLowerCase()),q2e=e=>N4(e)&&!Wy(e)?`\`${e}\``:e;function OA(e){const t=/^##\|?(?:[ \t\r\n]|$)/.exec(e);if(!t)return!1;const n=/[0-9A-Za-z_\u00C0-\u024F\u1E00-\u1EFF]+/y;let r=0,o="";for(let a=t[0].length;a<e.length;a++){const i=e[a];if(/\s/.test(i))continue;if(e.startsWith("-...",a)){a+=3,o="";continue}n.lastIndex=a;const s=n.exec(e)?.[0];if(i==='"'||i==="'"){const l=e.startsWith(i.repeat(3),a)?i.repeat(3):i;for(a+=l.length;a<e.length&&!e.startsWith(l,a);)a+=e[a]==="\\"?2:1;a+=l.length-1}else if(i==="`"){let l=a+1;for(;l<e.length&&e[l]!=="`"&&e[l]!==`
291
291
  `;)l+=e[l]==="\\"?2:1;const d=e.slice(a+1,l);if(r===0&&d==="artifact"&&!/[=.-]/.test(o))return!0;a=l}else if(i==="#"){const l=e.indexOf(`
292
- `,a);if(l<0)return!1;a=l;continue}else if(i==="{"||i==="[")r++;else if(i==="}"||i==="]")r--;else if(s){if(r===0&&s==="artifact"&&!/[=.-]/.test(o))return!0;a+=s.length-1}o=i}return!1}function PA(e){const t=e.trim().split(/[ \t\r]/,1)[0],n=/^(#{1,2})(\|?)(?:\(markdown\)|<markdown>|\[markdown\]|\{markdown\})$/.exec(t);return n?{level:n[1].length,block:n[2]==="|"}:void 0}function nae(e,t,n){const r=/^[ \t]*/.exec(e)[0].length;if(t!==void 0&&r!==t)return!1;const o=e.slice(r);return o.startsWith(n)&&(n!=="|#"||o.charAt(2)!=="#")}function Qx(e,t){const n=new Map;e.forEach((a,i)=>{const s=/^[ \t]*/.exec(a)?.[0].length??0;for(const l of["|##","|#"])if(nae(a,s,l)){const d=`${s}${l}`,u=n.get(d);u?u.push(i):n.set(d,[i]);break}});const r=new Map,o=[];for(let a=0;a<e.length;a++){if(t?.(a))continue;const i=/^([ \t]*)(#{1,2})\|/.exec(e[a]);if(!i)continue;const s=`${i[1].length}${i[2]==="#"?"|#":"|##"}`,l=n.get(s)??[];let d=r.get(s)??0;for(;d<l.length&&l[d]<=a;)d++;r.set(s,d),d<l.length&&(o.push([a,l[d]]),a=l[d])}return o}function I4(e){const t=new Set;for(const[n,r]of Qx(e))for(let o=n;o<=r;o++)t.add(o);return t}function U2e(e,t){const n=new Set,r=new Set;for(const[o,a]of Qx(e,t)){const i=PA(e[o])?.level===1;for(let s=o;s<=a;s++)r.add(s),i&&n.add(s)}return e.forEach((o,a)=>{if(r.has(a)||t?.(a))return;const i=PA(o);i?.level===1&&!i.block&&n.add(a)}),n}function rae(e){const t=I4(e),n=e.findIndex((o,a)=>!t.has(a)&&!/^\s*##\|/.test(o)&&OA(o.trim())),r=Qx(e).find(([o,a])=>OA(e.slice(o,a).join(`
292
+ `,a);if(l<0)return!1;a=l;continue}else if(i==="{"||i==="[")r++;else if(i==="}"||i==="]")r--;else if(s){if(r===0&&s==="artifact"&&!/[=.-]/.test(o))return!0;a+=s.length-1}o=i}return!1}function PA(e){const t=e.trim().split(/[ \t\r]/,1)[0],n=/^(#{1,2})(\|?)(?:\(markdown\)|<markdown>|\[markdown\]|\{markdown\})$/.exec(t);return n?{level:n[1].length,block:n[2]==="|"}:void 0}function nae(e,t,n){const r=/^[ \t]*/.exec(e)[0].length;if(t!==void 0&&r!==t)return!1;const o=e.slice(r);return o.startsWith(n)&&(n!=="|#"||o.charAt(2)!=="#")}function Qx(e,t){const n=new Map;e.forEach((a,i)=>{const s=/^[ \t]*/.exec(a)?.[0].length??0;for(const l of["|##","|#"])if(nae(a,s,l)){const d=`${s}${l}`,u=n.get(d);u?u.push(i):n.set(d,[i]);break}});const r=new Map,o=[];for(let a=0;a<e.length;a++){if(t?.(a))continue;const i=/^([ \t]*)(#{1,2})\|/.exec(e[a]);if(!i)continue;const s=`${i[1].length}${i[2]==="#"?"|#":"|##"}`,l=n.get(s)??[];let d=r.get(s)??0;for(;d<l.length&&l[d]<=a;)d++;r.set(s,d),d<l.length&&(o.push([a,l[d]]),a=l[d])}return o}function I4(e){const t=new Set;for(const[n,r]of Qx(e))for(let o=n;o<=r;o++)t.add(o);return t}function H2e(e,t){const n=new Set,r=new Set;for(const[o,a]of Qx(e,t)){const i=PA(e[o])?.level===1;for(let s=o;s<=a;s++)r.add(s),i&&n.add(s)}return e.forEach((o,a)=>{if(r.has(a)||t?.(a))return;const i=PA(o);i?.level===1&&!i.block&&n.add(a)}),n}function rae(e){const t=I4(e),n=e.findIndex((o,a)=>!t.has(a)&&!/^\s*##\|/.test(o)&&OA(o.trim())),r=Qx(e).find(([o,a])=>OA(e.slice(o,a).join(`
293
293
  `).trim()));return r&&(n<0||r[0]<n)?{from:r[0],to:r[1],block:!0,text:e.slice(r[0],r[1]).join(`
294
- `)}:n<0?void 0:{from:n,to:n,block:!1,text:e[n]}}const q2e=e=>/^\s*##(?:\|\s*|[ \t]*)artifact\b/.test(e),H2e="The `artifact` property is not the first on its tag, so the builder cannot rewrite the tag without risking the properties before it. Move `artifact { … }` first on the tag to edit this file here.",oae=e=>rae(e)?.from??-1,V2e=e=>e.replace(/^\s*##\|?\s*/,"# "),aae=/^##"([ \t]|$)/;function W2e(e){const t=oae(e),n=I4(e),r=m=>t<0||m<t,o=m=>t>=0&&m>t,a=[];e.forEach((m,g)=>{!n.has(g)&&aae.test(m.trim())&&a.push({at:g,text:m.trim().slice(3).trim(),block:!1})});for(const[m,g]of Qx(e)){if(!/^[ \t]*##\|"([ \t]|$)/.test(e[m]))continue;const y=[e[m].trim().slice(4),...e.slice(m+1,g)].map(x=>x.trim()).join(`
294
+ `)}:n<0?void 0:{from:n,to:n,block:!1,text:e[n]}}const V2e=e=>/^\s*##(?:\|\s*|[ \t]*)artifact\b/.test(e),W2e="The `artifact` property is not the first on its tag, so the builder cannot rewrite the tag without risking the properties before it. Move `artifact { … }` first on the tag to edit this file here.",oae=e=>rae(e)?.from??-1,Y2e=e=>e.replace(/^\s*##\|?\s*/,"# "),aae=/^##"([ \t]|$)/;function G2e(e){const t=oae(e),n=I4(e),r=m=>t<0||m<t,o=m=>t>=0&&m>t,a=[];e.forEach((m,g)=>{!n.has(g)&&aae.test(m.trim())&&a.push({at:g,text:m.trim().slice(3).trim(),block:!1})});for(const[m,g]of Qx(e)){if(!/^[ \t]*##\|"([ \t]|$)/.test(e[m]))continue;const y=[e[m].trim().slice(4),...e.slice(m+1,g)].map(x=>x.trim()).join(`
295
295
  `).trim();y.length>0&&a.push({at:m,text:y,block:!0})}a.sort((m,g)=>m.at-g.at);const i=a.filter(m=>r(m.at)),s=a.filter(m=>o(m.at)),l=i.some(m=>m.text.trim())?i:s,d=l.map(m=>m.text).join(`
296
- `),u=m=>m.filter(g=>!g.block).map(g=>g.at);return{read:u(l),blankAbove:l===s?u(i):[],below:u(s),belowBlock:s.some(m=>m.block),inBlock:l.some(m=>m.block),...d.trim()?{text:d}:{}}}const iae=/^[A-Za-z_][A-Za-z0-9_]*$/;function Y2e(e){const t=e.trim(),n=t.split(/[ \t\r]/,1)[0],r=/^##\|(?:\((markdown|text)\)|<(markdown|text)>|\[(markdown|text)\]|\{(markdown|text)\})$/.exec(n);if(!r)return;const o=t.slice(n.length).trim();return{route:r[1]??r[2]??r[3]??r[4],rest:o,...iae.test(o)?{name:o}:{}}}function G2e(e){const t=(e??"").split("->").map(a=>a.trim());if(t.length!==2)return;const n=t[1].indexOf("+"),r=n<0?t[1]:t[1].slice(0,n).trim(),o=n<0?void 0:t[1].slice(n).trim();return{source:t[0],view:r,...o===void 0?{}:{refinement:o}}}const K2e=e=>/^`([A-Za-z_][A-Za-z0-9_]*)`$/.test(e)?e.slice(1,-1):e,sae=new Set([401,403,404]);function L4(e){const t=e,n=t?.response?.status??t?.status;return typeof n!="number"||!sae.has(n)}var rd={},Os={},jA;function yh(){if(jA)return Os;jA=1,Object.defineProperty(Os,"__esModule",{value:!0}),Os.isChainOp=e,Os.isStringCondition=t,Os.isStringFilter=n,Os.isBooleanFilter=r,Os.isNumberFilter=o,Os.isTemporalFilter=a,Os.isFilterExpression=i,Os.isFilterable=s;function e(l){return["and","or",","].includes(l)}function t(l){return["starts","ends","contains","="].includes(l.operator)}function n(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["starts","ends","contains","=","~","null","none","empty","and","or",",","()"].includes(l.operator)}function r(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["null","none","true","false","=false","=true"].includes(l.operator)}function o(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["range","<=",">=","!=","=",">","<","and","or","()","null","none"].includes(l.operator)}function a(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["literal","before","after","to","for","in","and","or","in_last","this","last","next","()","null","none"].includes(l.operator)}function i(l){return typeof l=="object"&&l!==null&&"operator"in l}function s(l){return["string","number","boolean","timestamp","timestamptz","date"].includes(l)}return Os}var Vm={},AA;function lae(){return AA||(AA=1,Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.BooleanFilterExpression=void 0,Vm.BooleanFilterExpression={parse(e){var t;if(e.match(/^\s*$/))return{parsed:null,log:[]};const n={parsed:null,log:[]};let r=e.toLowerCase().trim().replace(/\s\s+/," "),o=!1;if(r.startsWith("not ")&&(o=!0,r=r.slice(4)),r==="true")n.parsed={operator:"true"};else if(r==="=true")n.parsed={operator:"=true"};else if(r==="false")n.parsed={operator:"false"};else if(r==="=false")n.parsed={operator:"=false"};else if(r==="null")n.parsed={operator:"null"};else if(r==="none")n.parsed={operator:"none"};else{const a=e.match(/[^\s]/),i=a&&(t=a.index)!==null&&t!==void 0?t:0;n.log=[{message:`Illegal boolean filter '${r}'. Must be one of true,=true,false,=false,null,none`,severity:"error",startIndex:i,endIndex:i+e.length-1}]}return o&&n.parsed&&(n.parsed.not=!0),n},unparse(e){return e===null?"":(e.not?"not ":"")+e.operator}}),Vm}var aC={},ma={},DA;function Xx(){if(DA)return ma;DA=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.maybeNot=t,ma.unescape=n,ma.escape=r,ma.matchOp=a,ma.conjoin=s,ma.joinNumbers=l,ma.mkRange=d,ma.mkValues=u,ma.numNot=m,ma.temporalNot=g,ma.joinTemporal=y,ma.timeLiteral=x,ma.mkUnits=w;const e=yh();function t(S){const[b,$]=S;return b&&$&&(0,e.isStringFilter)($)?{...$,not:!0}:$}function n(S){return S.replace(/\\(.)/g,"$1")}function r(S){const b=S.toLowerCase();return b==="null"||b==="empty"||b==="none"?"\\"+S:S.replace(/([,; |()\\%_-])/g,"\\$1")}function o(S){let b=!1,$=!1,k=0,T=!1;const O=S.length;for(let P=0;P<O;P+=1){const D=S[P];if(D===" "||D===" "){k+=1;continue}k=0,D==="%"?(T=!0,P===0&&(b=!0),$=!0):($=!1,D==="\\"?P+=1:D==="_"&&(T=!0))}return{hasLike:T,percentEnd:$&&O>1,percentStart:b&&O>1,endSpace:k}}function a(S){let b=S.trimStart();const{hasLike:$,percentEnd:k,percentStart:T,endSpace:O}=o(b);if(O>0&&(b=b.slice(0,-O)),$){if(T&&k){const P=b.slice(1,-1);if(!o(P).hasLike&&P.length>0)return{operator:"contains",values:[n(P)]}}else if(k){const P=b.slice(0,-1);if(!o(P).hasLike)return{operator:"starts",values:[n(P)]}}else if(T){const P=b.slice(1);if(!o(P).hasLike)return{operator:"ends",values:[n(P)]}}return{operator:"~",escaped_values:[b]}}return b.toLowerCase()==="null"?{operator:"null"}:b.toLowerCase()==="empty"?{operator:"empty"}:b.toLowerCase()==="none"?{operator:"none"}:{operator:"=",values:[n(b)]}}function i(S,b){var $,k;return S.operator===b.operator&&(($=S.not)!==null&&$!==void 0?$:!1)===((k=b.not)!==null&&k!==void 0?k:!1)}function s(S,b,$){if(b=b.toLowerCase(),(0,e.isStringFilter)(S)&&(0,e.isStringFilter)($)){if(b===","){if(S.operator==="~"&&i(S,$))return{...S,escaped_values:[...S.escaped_values,...$.escaped_values]};if((0,e.isStringCondition)(S)&&i(S,$))return{...S,values:[...S.values,...$.values]}}const k=b===","?",":b==="|"?"or":b===";"?"and":void 0;if(k)return S.operator===k?{...S,members:[...S.members,$]}:{operator:k,members:[S,$]}}return null}function l(S,b,$){if(b=b.toLowerCase(),(0,e.isNumberFilter)(S)&&(0,e.isNumberFilter)($)){if(b==="or"&&S.operator==="="&&i(S,$)){const k={operator:"=",values:[...S.values,...$.values]};return S.not&&(k.not=!0),k}if(b==="and"||b==="or")return S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}}return null}function d(S,b,$,k){return{operator:"range",startValue:b,startOperator:S==="("?">":">=",endValue:$,endOperator:k===")"?"<":"<="}}function u(S,b){return{values:[S,...b]}}function m(S,b){return(0,e.isNumberFilter)(S)&&b?S.operator==="="?{operator:"!=",values:S.values}:S.operator==="!="?{operator:"=",values:S.values}:{...S,not:!0}:S}function g(S,b){if((0,e.isTemporalFilter)(S)&&b){if("not"in S){const $={...S};return S.not?delete $.not:$.not=!0,$}return{...S,not:!0}}return S}function y(S,b,$){return b=b.toLowerCase(),(0,e.isTemporalFilter)(S)&&(0,e.isTemporalFilter)($)&&(b==="and"||b==="or")?S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}:null}function x(S,b){const $={moment:"literal",literal:S};return b&&($.units=b),$}function w(S){switch(S.toLowerCase()){case"second":case"seconds":return"second";case"minute":case"minutes":return"minute";case"hour":case"hours":return"hour";case"day":case"days":return"day";case"week":case"weeks":return"week";case"month":case"months":return"month";case"quarter":case"quarters":return"quarter";case"year":case"years":return"year"}}return ma}var iC,NA;function cae(){if(NA)return iC;NA=1;const{numNot:e,mkRange:t,joinNumbers:n,mkValues:r}=Xx();function o(l,d){function u(){this.constructor=l}u.prototype=d.prototype,l.prototype=new u}function a(l,d,u,m){var g=Error.call(this,l);return Object.setPrototypeOf&&Object.setPrototypeOf(g,a.prototype),g.expected=d,g.found=u,g.location=m,g.name="SyntaxError",g}o(a,Error);function i(l,d,u){return u=u||" ",l.length>d?l:(d-=l.length,u+=u.repeat(d),l+u.slice(0,d))}a.prototype.format=function(l){var d="Error: "+this.message;if(this.location){var u=null,m;for(m=0;m<l.length;m++)if(l[m].source===this.location.source){u=l[m].text.split(/\r\n|\n|\r/g);break}var g=this.location.start,y=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(g):g,x=this.location.source+":"+y.line+":"+y.column;if(u){var w=this.location.end,S=i("",y.line.toString().length," "),b=u[g.line-1],$=g.line===w.line?w.column:b.length+1,k=$-g.column||1;d+=`
296
+ `),u=m=>m.filter(g=>!g.block).map(g=>g.at);return{read:u(l),blankAbove:l===s?u(i):[],below:u(s),belowBlock:s.some(m=>m.block),inBlock:l.some(m=>m.block),...d.trim()?{text:d}:{}}}const iae=/^[A-Za-z_][A-Za-z0-9_]*$/;function K2e(e){const t=e.trim(),n=t.split(/[ \t\r]/,1)[0],r=/^##\|(?:\((markdown|text)\)|<(markdown|text)>|\[(markdown|text)\]|\{(markdown|text)\})$/.exec(n);if(!r)return;const o=t.slice(n.length).trim();return{route:r[1]??r[2]??r[3]??r[4],rest:o,...iae.test(o)?{name:o}:{}}}function Q2e(e){const t=(e??"").split("->").map(a=>a.trim());if(t.length!==2)return;const n=t[1].indexOf("+"),r=n<0?t[1]:t[1].slice(0,n).trim(),o=n<0?void 0:t[1].slice(n).trim();return{source:t[0],view:r,...o===void 0?{}:{refinement:o}}}const X2e=e=>/^`([A-Za-z_][A-Za-z0-9_]*)`$/.test(e)?e.slice(1,-1):e,sae=new Set([401,403,404]);function L4(e){const t=e,n=t?.response?.status??t?.status;return typeof n!="number"||!sae.has(n)}var rd={},Os={},jA;function yh(){if(jA)return Os;jA=1,Object.defineProperty(Os,"__esModule",{value:!0}),Os.isChainOp=e,Os.isStringCondition=t,Os.isStringFilter=n,Os.isBooleanFilter=r,Os.isNumberFilter=o,Os.isTemporalFilter=a,Os.isFilterExpression=i,Os.isFilterable=s;function e(l){return["and","or",","].includes(l)}function t(l){return["starts","ends","contains","="].includes(l.operator)}function n(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["starts","ends","contains","=","~","null","none","empty","and","or",",","()"].includes(l.operator)}function r(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["null","none","true","false","=false","=true"].includes(l.operator)}function o(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["range","<=",">=","!=","=",">","<","and","or","()","null","none"].includes(l.operator)}function a(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["literal","before","after","to","for","in","and","or","in_last","this","last","next","()","null","none"].includes(l.operator)}function i(l){return typeof l=="object"&&l!==null&&"operator"in l}function s(l){return["string","number","boolean","timestamp","timestamptz","date"].includes(l)}return Os}var Vm={},AA;function lae(){return AA||(AA=1,Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.BooleanFilterExpression=void 0,Vm.BooleanFilterExpression={parse(e){var t;if(e.match(/^\s*$/))return{parsed:null,log:[]};const n={parsed:null,log:[]};let r=e.toLowerCase().trim().replace(/\s\s+/," "),o=!1;if(r.startsWith("not ")&&(o=!0,r=r.slice(4)),r==="true")n.parsed={operator:"true"};else if(r==="=true")n.parsed={operator:"=true"};else if(r==="false")n.parsed={operator:"false"};else if(r==="=false")n.parsed={operator:"=false"};else if(r==="null")n.parsed={operator:"null"};else if(r==="none")n.parsed={operator:"none"};else{const a=e.match(/[^\s]/),i=a&&(t=a.index)!==null&&t!==void 0?t:0;n.log=[{message:`Illegal boolean filter '${r}'. Must be one of true,=true,false,=false,null,none`,severity:"error",startIndex:i,endIndex:i+e.length-1}]}return o&&n.parsed&&(n.parsed.not=!0),n},unparse(e){return e===null?"":(e.not?"not ":"")+e.operator}}),Vm}var aC={},ma={},DA;function Xx(){if(DA)return ma;DA=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.maybeNot=t,ma.unescape=n,ma.escape=r,ma.matchOp=a,ma.conjoin=s,ma.joinNumbers=l,ma.mkRange=d,ma.mkValues=u,ma.numNot=m,ma.temporalNot=g,ma.joinTemporal=y,ma.timeLiteral=x,ma.mkUnits=w;const e=yh();function t(S){const[b,$]=S;return b&&$&&(0,e.isStringFilter)($)?{...$,not:!0}:$}function n(S){return S.replace(/\\(.)/g,"$1")}function r(S){const b=S.toLowerCase();return b==="null"||b==="empty"||b==="none"?"\\"+S:S.replace(/([,; |()\\%_-])/g,"\\$1")}function o(S){let b=!1,$=!1,k=0,T=!1;const O=S.length;for(let P=0;P<O;P+=1){const D=S[P];if(D===" "||D===" "){k+=1;continue}k=0,D==="%"?(T=!0,P===0&&(b=!0),$=!0):($=!1,D==="\\"?P+=1:D==="_"&&(T=!0))}return{hasLike:T,percentEnd:$&&O>1,percentStart:b&&O>1,endSpace:k}}function a(S){let b=S.trimStart();const{hasLike:$,percentEnd:k,percentStart:T,endSpace:O}=o(b);if(O>0&&(b=b.slice(0,-O)),$){if(T&&k){const P=b.slice(1,-1);if(!o(P).hasLike&&P.length>0)return{operator:"contains",values:[n(P)]}}else if(k){const P=b.slice(0,-1);if(!o(P).hasLike)return{operator:"starts",values:[n(P)]}}else if(T){const P=b.slice(1);if(!o(P).hasLike)return{operator:"ends",values:[n(P)]}}return{operator:"~",escaped_values:[b]}}return b.toLowerCase()==="null"?{operator:"null"}:b.toLowerCase()==="empty"?{operator:"empty"}:b.toLowerCase()==="none"?{operator:"none"}:{operator:"=",values:[n(b)]}}function i(S,b){var $,k;return S.operator===b.operator&&(($=S.not)!==null&&$!==void 0?$:!1)===((k=b.not)!==null&&k!==void 0?k:!1)}function s(S,b,$){if(b=b.toLowerCase(),(0,e.isStringFilter)(S)&&(0,e.isStringFilter)($)){if(b===","){if(S.operator==="~"&&i(S,$))return{...S,escaped_values:[...S.escaped_values,...$.escaped_values]};if((0,e.isStringCondition)(S)&&i(S,$))return{...S,values:[...S.values,...$.values]}}const k=b===","?",":b==="|"?"or":b===";"?"and":void 0;if(k)return S.operator===k?{...S,members:[...S.members,$]}:{operator:k,members:[S,$]}}return null}function l(S,b,$){if(b=b.toLowerCase(),(0,e.isNumberFilter)(S)&&(0,e.isNumberFilter)($)){if(b==="or"&&S.operator==="="&&i(S,$)){const k={operator:"=",values:[...S.values,...$.values]};return S.not&&(k.not=!0),k}if(b==="and"||b==="or")return S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}}return null}function d(S,b,$,k){return{operator:"range",startValue:b,startOperator:S==="("?">":">=",endValue:$,endOperator:k===")"?"<":"<="}}function u(S,b){return{values:[S,...b]}}function m(S,b){return(0,e.isNumberFilter)(S)&&b?S.operator==="="?{operator:"!=",values:S.values}:S.operator==="!="?{operator:"=",values:S.values}:{...S,not:!0}:S}function g(S,b){if((0,e.isTemporalFilter)(S)&&b){if("not"in S){const $={...S};return S.not?delete $.not:$.not=!0,$}return{...S,not:!0}}return S}function y(S,b,$){return b=b.toLowerCase(),(0,e.isTemporalFilter)(S)&&(0,e.isTemporalFilter)($)&&(b==="and"||b==="or")?S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}:null}function x(S,b){const $={moment:"literal",literal:S};return b&&($.units=b),$}function w(S){switch(S.toLowerCase()){case"second":case"seconds":return"second";case"minute":case"minutes":return"minute";case"hour":case"hours":return"hour";case"day":case"days":return"day";case"week":case"weeks":return"week";case"month":case"months":return"month";case"quarter":case"quarters":return"quarter";case"year":case"years":return"year"}}return ma}var iC,NA;function cae(){if(NA)return iC;NA=1;const{numNot:e,mkRange:t,joinNumbers:n,mkValues:r}=Xx();function o(l,d){function u(){this.constructor=l}u.prototype=d.prototype,l.prototype=new u}function a(l,d,u,m){var g=Error.call(this,l);return Object.setPrototypeOf&&Object.setPrototypeOf(g,a.prototype),g.expected=d,g.found=u,g.location=m,g.name="SyntaxError",g}o(a,Error);function i(l,d,u){return u=u||" ",l.length>d?l:(d-=l.length,u+=u.repeat(d),l+u.slice(0,d))}a.prototype.format=function(l){var d="Error: "+this.message;if(this.location){var u=null,m;for(m=0;m<l.length;m++)if(l[m].source===this.location.source){u=l[m].text.split(/\r\n|\n|\r/g);break}var g=this.location.start,y=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(g):g,x=this.location.source+":"+y.line+":"+y.column;if(u){var w=this.location.end,S=i("",y.line.toString().length," "),b=u[g.line-1],$=g.line===w.line?w.column:b.length+1,k=$-g.column||1;d+=`
297
297
  --> `+x+`
298
298
  `+S+` |
299
299
  `+y.line+" | "+b+`
@@ -346,7 +346,7 @@ const theme = ${JSON.stringify(t,null,2)};
346
346
  theme.breakpoints = createBreakpoints(theme.breakpoints || {});
347
347
  theme.transitions = createTransitions(theme.transitions || {});
348
348
 
349
- export default theme;`}function RD(e){return typeof e=="number"?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}const Tse=e=>{if(!Number.isNaN(+e))return+e;const t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let r=0;r<t.length;r+=1)n+=+t[r];return n};function Ese(e){Object.assign(e,{alpha(t,n){const r=this||e;return r.colorSpace?`oklch(from ${t} l c h / ${typeof n=="string"?`calc(${n})`:n})`:r.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof n=="string"?`calc(${n})`:n})`:F0(t,Tse(n))},lighten(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #fff ${RD(n)})`:u1(t,n)},darken(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #000 ${RD(n)})`:c1(t,n)}})}function qk(e={},...t){const{breakpoints:n,mixins:r={},spacing:o,palette:a={},transitions:i={},typography:s={},shape:l,colorSpace:d,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(dc(20));const m=c2({...a,colorSpace:d}),g=u2(e);let y=xa(g,{mixins:hse(g.breakpoints,r),palette:m,shadows:xse.slice(),typography:gse(m,s),transitions:kse(i),zIndex:{...$se}});return y=xa(y,u),y=t.reduce((x,w)=>xa(x,w),y),y.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},y.unstable_sx=function(x){return Gp({sx:x,theme:this})},y.toRuntimeSource=Z4,Ese(y),y}function Hk(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const Mse=[...Array(25)].map((e,t)=>{if(t===0)return"none";const n=Hk(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function J4(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function eF(e){return e==="dark"?Mse:[]}function Ose(e){const{palette:t={mode:"light"},opacity:n,overlays:r,colorSpace:o,...a}=e,i=c2({...t,colorSpace:o});return{palette:i,opacity:{...J4(i.mode),...n},overlays:r||eF(i.mode),...a}}function Pse(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}const jse=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:""}overlays-${n}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],Ase=e=>(t,n)=>{const r=e.rootSelector||":root",o=e.colorSchemeSelector;let a=o;if(o==="class"&&(a=".%s"),o==="data"&&(a="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(a=`[${o}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const i={};return jse(e.cssVarPrefix).forEach(s=>{i[s]=n[s],delete n[s]}),a==="media"?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace("%s",t)]:i,[`${r}, ${a.replace("%s",t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!=="media")return`${r}, ${a.replace("%s",String(t))}`}else if(t){if(a==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace("%s",String(t))}return r};function Dse(e,t){t.forEach(n=>{e[n]||(e[n]={})})}function mt(e,t,n){!e[t]&&n&&(e[t]=n)}function $g(e){return typeof e!="string"||!e.startsWith("hsl")?e:W4(e)}function tc(e,t){`${t}Channel`in e||(e[`${t}Channel`]=kg($g(e[t])))}function Nse(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const al=e=>{try{return e()}catch{}},Ise=(e="mui")=>O5(e);function gC(e,t,n,r,o){if(!n)return;n=n===!0?{}:n;const a=o==="dark"?"dark":"light";if(!r){t[o]=Ose({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}const{palette:i,...s}=qk({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[o]={...n,palette:i,opacity:{...J4(a),...n?.opacity},overlays:n?.overlays||eF(a)},s}function Lse(e={},...t){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:o=!1,cssVarPrefix:a="mui",nativeColor:i=!1,shouldSkipGeneratingVar:s=Pse,colorSchemeSelector:l=n.light&&n.dark?"media":void 0,rootSelector:d=":root",...u}=e,m=Object.keys(n)[0],g=r||(n.light&&m!=="light"?"light":m),y=Ise(a),{[g]:x,light:w,dark:S,...b}=n,$={...b};let k=x;if((g==="dark"&&!("dark"in n)||g==="light"&&!("light"in n))&&(k=!0),!k)throw new Error(dc(21,g));let T;i&&(T="oklch");const O=gC(T,$,k,u,g);w&&!$.light&&gC(T,$,w,void 0,"light"),S&&!$.dark&&gC(T,$,S,void 0,"dark");let P={defaultColorScheme:g,...O,cssVarPrefix:a,colorSchemeSelector:l,rootSelector:d,getCssVar:y,colorSchemes:$,font:{...dse(O.typography),...O.font},spacing:Nse(u.spacing)};Object.keys(P.colorSchemes).forEach(_=>{const R=P.colorSchemes[_].palette,z=B=>{const I=B.split("-"),H=I[1],Y=I[2];return y(B,R[H][Y])};R.mode==="light"&&(mt(R.common,"background","#fff"),mt(R.common,"onBackground","#000")),R.mode==="dark"&&(mt(R.common,"background","#000"),mt(R.common,"onBackground","#fff"));function N(B,I,H){if(T){let Y;return B===id&&(Y=`transparent ${((1-H)*100).toFixed(0)}%`),B===Pr&&(Y=`#000 ${(H*100).toFixed(0)}%`),B===jr&&(Y=`#fff ${(H*100).toFixed(0)}%`),`color-mix(in ${T}, ${I}, ${Y})`}return B(I,H)}if(Dse(R,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),R.mode==="light"){mt(R.Alert,"errorColor",N(Pr,R.error.light,.6)),mt(R.Alert,"infoColor",N(Pr,R.info.light,.6)),mt(R.Alert,"successColor",N(Pr,R.success.light,.6)),mt(R.Alert,"warningColor",N(Pr,R.warning.light,.6)),mt(R.Alert,"errorFilledBg",z("palette-error-main")),mt(R.Alert,"infoFilledBg",z("palette-info-main")),mt(R.Alert,"successFilledBg",z("palette-success-main")),mt(R.Alert,"warningFilledBg",z("palette-warning-main")),mt(R.Alert,"errorFilledColor",al(()=>R.getContrastText(R.error.main))),mt(R.Alert,"infoFilledColor",al(()=>R.getContrastText(R.info.main))),mt(R.Alert,"successFilledColor",al(()=>R.getContrastText(R.success.main))),mt(R.Alert,"warningFilledColor",al(()=>R.getContrastText(R.warning.main))),mt(R.Alert,"errorStandardBg",N(jr,R.error.light,.9)),mt(R.Alert,"infoStandardBg",N(jr,R.info.light,.9)),mt(R.Alert,"successStandardBg",N(jr,R.success.light,.9)),mt(R.Alert,"warningStandardBg",N(jr,R.warning.light,.9)),mt(R.Alert,"errorIconColor",z("palette-error-main")),mt(R.Alert,"infoIconColor",z("palette-info-main")),mt(R.Alert,"successIconColor",z("palette-success-main")),mt(R.Alert,"warningIconColor",z("palette-warning-main")),mt(R.AppBar,"defaultBg",z("palette-grey-100")),mt(R.Avatar,"defaultBg",z("palette-grey-400")),mt(R.Button,"inheritContainedBg",z("palette-grey-300")),mt(R.Button,"inheritContainedHoverBg",z("palette-grey-A100")),mt(R.Chip,"defaultBorder",z("palette-grey-400")),mt(R.Chip,"defaultAvatarColor",z("palette-grey-700")),mt(R.Chip,"defaultIconColor",z("palette-grey-700")),mt(R.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),mt(R.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),mt(R.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),mt(R.LinearProgress,"primaryBg",N(jr,R.primary.main,.62)),mt(R.LinearProgress,"secondaryBg",N(jr,R.secondary.main,.62)),mt(R.LinearProgress,"errorBg",N(jr,R.error.main,.62)),mt(R.LinearProgress,"infoBg",N(jr,R.info.main,.62)),mt(R.LinearProgress,"successBg",N(jr,R.success.main,.62)),mt(R.LinearProgress,"warningBg",N(jr,R.warning.main,.62)),mt(R.Skeleton,"bg",T?N(id,R.text.primary,.11):`rgba(${z("palette-text-primaryChannel")} / 0.11)`),mt(R.Slider,"primaryTrack",N(jr,R.primary.main,.62)),mt(R.Slider,"secondaryTrack",N(jr,R.secondary.main,.62)),mt(R.Slider,"errorTrack",N(jr,R.error.main,.62)),mt(R.Slider,"infoTrack",N(jr,R.info.main,.62)),mt(R.Slider,"successTrack",N(jr,R.success.main,.62)),mt(R.Slider,"warningTrack",N(jr,R.warning.main,.62));const B=T?N(Pr,R.background.default,.6825):Ob(R.background.default,.8);mt(R.SnackbarContent,"bg",B),mt(R.SnackbarContent,"color",al(()=>T?Uk.text.primary:R.getContrastText(B))),mt(R.SpeedDialAction,"fabHoverBg",Ob(R.background.paper,.15)),mt(R.StepConnector,"border",z("palette-grey-400")),mt(R.StepContent,"border",z("palette-grey-400")),mt(R.Switch,"defaultColor",z("palette-common-white")),mt(R.Switch,"defaultDisabledColor",z("palette-grey-100")),mt(R.Switch,"primaryDisabledColor",N(jr,R.primary.main,.62)),mt(R.Switch,"secondaryDisabledColor",N(jr,R.secondary.main,.62)),mt(R.Switch,"errorDisabledColor",N(jr,R.error.main,.62)),mt(R.Switch,"infoDisabledColor",N(jr,R.info.main,.62)),mt(R.Switch,"successDisabledColor",N(jr,R.success.main,.62)),mt(R.Switch,"warningDisabledColor",N(jr,R.warning.main,.62)),mt(R.TableCell,"border",N(jr,N(id,R.divider,1),.88)),mt(R.Tooltip,"bg",N(id,R.grey[700],.92))}if(R.mode==="dark"){mt(R.Alert,"errorColor",N(jr,R.error.light,.6)),mt(R.Alert,"infoColor",N(jr,R.info.light,.6)),mt(R.Alert,"successColor",N(jr,R.success.light,.6)),mt(R.Alert,"warningColor",N(jr,R.warning.light,.6)),mt(R.Alert,"errorFilledBg",z("palette-error-dark")),mt(R.Alert,"infoFilledBg",z("palette-info-dark")),mt(R.Alert,"successFilledBg",z("palette-success-dark")),mt(R.Alert,"warningFilledBg",z("palette-warning-dark")),mt(R.Alert,"errorFilledColor",al(()=>R.getContrastText(R.error.dark))),mt(R.Alert,"infoFilledColor",al(()=>R.getContrastText(R.info.dark))),mt(R.Alert,"successFilledColor",al(()=>R.getContrastText(R.success.dark))),mt(R.Alert,"warningFilledColor",al(()=>R.getContrastText(R.warning.dark))),mt(R.Alert,"errorStandardBg",N(Pr,R.error.light,.9)),mt(R.Alert,"infoStandardBg",N(Pr,R.info.light,.9)),mt(R.Alert,"successStandardBg",N(Pr,R.success.light,.9)),mt(R.Alert,"warningStandardBg",N(Pr,R.warning.light,.9)),mt(R.Alert,"errorIconColor",z("palette-error-main")),mt(R.Alert,"infoIconColor",z("palette-info-main")),mt(R.Alert,"successIconColor",z("palette-success-main")),mt(R.Alert,"warningIconColor",z("palette-warning-main")),mt(R.AppBar,"defaultBg",z("palette-grey-900")),mt(R.AppBar,"darkBg",z("palette-background-paper")),mt(R.AppBar,"darkColor",z("palette-text-primary")),mt(R.Avatar,"defaultBg",z("palette-grey-600")),mt(R.Button,"inheritContainedBg",z("palette-grey-800")),mt(R.Button,"inheritContainedHoverBg",z("palette-grey-700")),mt(R.Chip,"defaultBorder",z("palette-grey-700")),mt(R.Chip,"defaultAvatarColor",z("palette-grey-300")),mt(R.Chip,"defaultIconColor",z("palette-grey-300")),mt(R.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),mt(R.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),mt(R.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),mt(R.LinearProgress,"primaryBg",N(Pr,R.primary.main,.5)),mt(R.LinearProgress,"secondaryBg",N(Pr,R.secondary.main,.5)),mt(R.LinearProgress,"errorBg",N(Pr,R.error.main,.5)),mt(R.LinearProgress,"infoBg",N(Pr,R.info.main,.5)),mt(R.LinearProgress,"successBg",N(Pr,R.success.main,.5)),mt(R.LinearProgress,"warningBg",N(Pr,R.warning.main,.5)),mt(R.Skeleton,"bg",T?N(id,R.text.primary,.13):`rgba(${z("palette-text-primaryChannel")} / 0.13)`),mt(R.Slider,"primaryTrack",N(Pr,R.primary.main,.5)),mt(R.Slider,"secondaryTrack",N(Pr,R.secondary.main,.5)),mt(R.Slider,"errorTrack",N(Pr,R.error.main,.5)),mt(R.Slider,"infoTrack",N(Pr,R.info.main,.5)),mt(R.Slider,"successTrack",N(Pr,R.success.main,.5)),mt(R.Slider,"warningTrack",N(Pr,R.warning.main,.5));const B=T?N(jr,R.background.default,.985):Ob(R.background.default,.98);mt(R.SnackbarContent,"bg",B),mt(R.SnackbarContent,"color",al(()=>T?G4.text.primary:R.getContrastText(B))),mt(R.SpeedDialAction,"fabHoverBg",Ob(R.background.paper,.15)),mt(R.StepConnector,"border",z("palette-grey-600")),mt(R.StepContent,"border",z("palette-grey-600")),mt(R.Switch,"defaultColor",z("palette-grey-300")),mt(R.Switch,"defaultDisabledColor",z("palette-grey-600")),mt(R.Switch,"primaryDisabledColor",N(Pr,R.primary.main,.55)),mt(R.Switch,"secondaryDisabledColor",N(Pr,R.secondary.main,.55)),mt(R.Switch,"errorDisabledColor",N(Pr,R.error.main,.55)),mt(R.Switch,"infoDisabledColor",N(Pr,R.info.main,.55)),mt(R.Switch,"successDisabledColor",N(Pr,R.success.main,.55)),mt(R.Switch,"warningDisabledColor",N(Pr,R.warning.main,.55)),mt(R.TableCell,"border",N(Pr,N(id,R.divider,1),.68)),mt(R.Tooltip,"bg",N(id,R.grey[700],.92))}tc(R.background,"default"),tc(R.background,"paper"),tc(R.common,"background"),tc(R.common,"onBackground"),tc(R,"divider"),Object.keys(R).forEach(B=>{const I=R[B];B!=="tonalOffset"&&I&&typeof I=="object"&&(I.main&&mt(R[B],"mainChannel",kg($g(I.main))),I.light&&mt(R[B],"lightChannel",kg($g(I.light))),I.dark&&mt(R[B],"darkChannel",kg($g(I.dark))),I.contrastText&&mt(R[B],"contrastTextChannel",kg($g(I.contrastText))),B==="text"&&(tc(R[B],"primary"),tc(R[B],"secondary")),B==="action"&&(I.active&&tc(R[B],"active"),I.selected&&tc(R[B],"selected")))})}),P=t.reduce((_,R)=>xa(_,R),P);const D={prefix:a,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:Ase(P),enableContrastVars:i},{vars:A,generateThemeVars:F,generateStyleSheets:L}=use(P,D);return P.vars=A,Object.entries(P.colorSchemes[P.defaultColorScheme]).forEach(([_,R])=>{P[_]=R}),P.generateThemeVars=F,P.generateStyleSheets=L,P.generateSpacing=function(){return rR(u.spacing,i2(this))},P.getColorSchemeSelector=fse(l),P.spacing=P.generateSpacing(),P.shouldSkipGeneratingVar=s,P.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},P.unstable_sx=function(_){return Gp({sx:_,theme:this})},P.toRuntimeSource=Z4,P}function TD(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:c2({...n===!0?{}:n.palette,mode:t})})}function tF(e={},...t){const{palette:n,cssVariables:r=!1,colorSchemes:o=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...i}=e,s=a||"light",l=o?.[s],d={...o,...n?{[s]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in e))return qk(e,...t);let u=n;"palette"in e||d[s]&&(d[s]!==!0?u=d[s].palette:s==="dark"&&(u={mode:"dark"}));const m=qk({...e,palette:u},...t);return m.defaultColorScheme=s,m.colorSchemes=d,m.palette.mode==="light"&&(m.colorSchemes.light={...d.light!==!0&&d.light,palette:m.palette},TD(m,"dark",d.dark)),m.palette.mode==="dark"&&(m.colorSchemes.dark={...d.dark!==!0&&d.dark,palette:m.palette},TD(m,"light",d.light)),m}return!n&&!("light"in d)&&s==="light"&&(d.light=!0),Lse({...i,colorSchemes:d,defaultColorScheme:s,...typeof r!="boolean"&&r},...t)}const d1=tF(),bh="$$material";function Xd(){const e=fh(d1);return e[bh]||e}function zse(e){return p.jsx(aR,{...e,defaultTheme:d1,themeId:bh})}function Fse(e){const{variants:t,...n}=e,r={variants:t,style:Ed(n),isProcessed:!0};return r.style===n||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Ed(o.style))}),r}const _se=u2();function yC(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Cd(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Bse(e){return e?(t,n)=>n[e]:null}function Use(e,t,n){e.theme=Hse(e.theme)?n:e.theme[t]||e.theme}function f0(e,t,n){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(o=>f0(e,o,n));if(Array.isArray(r?.variants)){let o;if(r.isProcessed)o=n?Cd(r.style,n):r.style;else{const{variants:a,...i}=r;o=n?Cd(Ed(i),n):i}return nF(e,r.variants,[o],n)}return r?.isProcessed?n?Cd(Ed(r.style),n):r.style:n?Cd(Ed(r),n):r}function nF(e,t,n=[],r=void 0){let o;e:for(let a=0;a<t.length;a+=1){const i=t[a];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const s in i.props)if(e[s]!==i.props[s]&&e.ownerState?.[s]!==i.props[s])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},n.push(r?Cd(Ed(i.style(o)),r):i.style(o))):n.push(r?Cd(Ed(i.style),r):i.style)}return n}function qse(e={}){const{themeId:t,defaultTheme:n=_se,rootShouldForwardProp:r=yC,slotShouldForwardProp:o=yC}=e;function a(i){Use(i,t,n)}return(i,s={})=>{Yie(i,O=>O.filter(P=>P!==Gp));const{name:l,slot:d,skipVariantsResolver:u,skipSx:m,overridesResolver:g=Bse(Wse(d)),...y}=s,x=l&&l.startsWith("Mui")||d?"components":"custom",w=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,S=m||!1;let b=yC;d==="Root"||d==="root"?b=r:d?b=o:Vse(i)&&(b=void 0);const $=Wie(i,{shouldForwardProp:b,label:void 0,...y}),k=O=>{if(O.__emotion_real===O)return O;if(typeof O=="function")return function(P){return f0(P,O,P.theme.modularCssLayers?x:void 0)};if(pl(O)){const P=Fse(O);return function(D){return P.variants?f0(D,P,D.theme.modularCssLayers?x:void 0):D.theme.modularCssLayers?Cd(P.style,x):P.style}}return O},T=(...O)=>{const P=[],D=O.map(k),A=[];if(P.push(a),l&&g&&A.push(function(_){const R=_.theme.components?.[l]?.styleOverrides;if(!R)return null;const z={};for(const N in R)z[N]=f0(_,R[N],_.theme.modularCssLayers?"theme":void 0);return g(_,z)}),l&&!w&&A.push(function(_){const R=_.theme?.components?.[l]?.variants;return R?nF(_,R,[],_.theme.modularCssLayers?"theme":void 0):null}),S||A.push(Gp),Array.isArray(D[0])){const _=D.shift(),R=new Array(P.length).fill(""),z=new Array(A.length).fill("");let N;N=[...R,..._,...z],N.raw=[...R,..._.raw,...z],P.unshift(N)}const F=[...P,...D,...A],L=$(...F);return i.muiName&&(L.muiName=i.muiName),L};return $.withConfig&&(T.withConfig=$.withConfig),T}}function Hse(e){for(const t in e)return!1;return!0}function Vse(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Wse(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function rF(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const ei=e=>rF(e)&&e!=="classes",nt=qse({themeId:bh,defaultTheme:d1,rootShouldForwardProp:ei});function Yse(e){return function(t){return p.jsx(zse,{styles:typeof e=="function"?n=>e({theme:n,...t}):e})}}function Gse(){return Rie}const Gn=E5;function Kn(e){return Zie(e)}function fn(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=Cn(e,o,n)}),r}function Kse(e){return Cn("MuiSvgIcon",e)}fn("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Qse=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${Tt(t)}`,`fontSize${Tt(n)}`]};return bn(o,Kse,r)},Xse=nt("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${Tt(n.color)}`],t[`fontSize${Tt(n.fontSize)}`]]}})(Gn(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),B0=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiSvgIcon"}),{children:r,className:o,color:a="inherit",component:i="svg",fontSize:s="medium",htmlColor:l,inheritViewBox:d=!1,titleAccess:u,viewBox:m="0 0 24 24",...g}=n,y=C.isValidElement(r)&&r.type==="svg",x={...n,color:a,component:i,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:m,hasSvgAsChild:y},w={};d||(w.viewBox=m);const S=Qse(x);return p.jsxs(Xse,{as:i,className:Ht(S.root,o),focusable:"false",color:l,"aria-hidden":u?void 0:!0,role:u?"img":void 0,ref:t,...w,...g,...y&&r.props,ownerState:x,children:[y?r.props.children:r,u?p.jsx("title",{children:u}):null]})});B0.muiName="SvgIcon";function Jt(e,t){function n(r,o){return p.jsx(B0,{"data-testid":void 0,ref:o,...r,children:e})}return n.muiName=B0.muiName,C.memo(C.forwardRef(n))}function oF(e,t=166){let n;function r(...o){const a=()=>{e.apply(this,o)};clearTimeout(n),n=setTimeout(a,t)}return r.clear=()=>{clearTimeout(n)},r}function p0(e,t){return C.isValidElement(e)&&t.indexOf(e.type.muiName??e.type?._payload?.value?.muiName)!==-1}function Yo(e){return e&&e.ownerDocument||document}function pc(e){return Yo(e).defaultView||window}function Vk(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ti(e){const{controlled:t,default:n,name:r,state:o="value"}=e,{current:a}=C.useRef(t!==void 0),[i,s]=C.useState(n),l=a?t:i,d=C.useCallback(u=>{a||s(u)},[]);return[l,d]}function Yt(e){const t=C.useRef(e);return Go(()=>{t.current=e}),C.useRef((...n)=>(0,t.current)(...n)).current}function vr(...e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(a=>{if(a==null)return null;if(typeof a=="function"){const i=a,s=i(r);return typeof s=="function"?s:()=>{i(null)}}return a.current=r,()=>{a.current=null}});return()=>{o.forEach(a=>a?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}function Zse(e,t){const n=e.charCodeAt(2);return e[0]==="o"&&e[1]==="n"&&n>=65&&n<=90&&typeof t=="function"}function aF(e,t){if(!e)return t;function n(i,s){const l={};return Object.keys(s).forEach(d=>{Zse(d,s[d])&&typeof i[d]=="function"&&(l[d]=(...u)=>{i[d](...u),s[d](...u)})}),l}if(typeof e=="function"||typeof t=="function")return i=>{const s=typeof t=="function"?t(i):t,l=typeof e=="function"?e({...i,...s}):e,d=Ht(i?.className,s?.className,l?.className),u=n(l,s);return{...s,...l,...u,...!!d&&{className:d},...s?.style&&l?.style&&{style:{...s.style,...l.style}},...s?.sx&&l?.sx&&{sx:[...Array.isArray(s.sx)?s.sx:[s.sx],...Array.isArray(l.sx)?l.sx:[l.sx]]}}};const r=t,o=n(e,r),a=Ht(r?.className,e?.className);return{...t,...e,...o,...!!a&&{className:a},...r?.style&&e?.style&&{style:{...r.style,...e.style}},...r?.sx&&e?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}const f1=Jt(p.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),Jse=2,ele=24,Q2e=(e,t,n)=>Math.min(Math.max(e+t,1),Math.min(n,ele)),vl=16,X2e=vl/2;function tle(e,t){const n=Math.min(e.colspan??1,t);return e.break?`1 / span ${n}`:`span ${n}`}const d2=80,nle=3,Z2e=2,J2e=1,rle=16,iF=e=>e*d2+(e-1)*vl,eTe=(e,t=nle)=>Math.min(Math.max(Math.round((e+vl)/(d2+vl)),t),rle),sF=240;function tTe(e,t,n=sF){const[r,o]=C.useState(0);return C.useEffect(()=>{const a=e.current;if(!a||typeof ResizeObserver>"u")return;o(a.getBoundingClientRect().width);const i=new ResizeObserver(([s])=>o(s?.contentRect.width??0));return i.observe(a),()=>i.disconnect()},[e]),lF(t,r,n)}function lF(e,t,n){if(!(t>0)||e<=1)return 1;const r=(t-(e-1)*vl)/e;return Math.min(e,Math.max(1,Math.ceil((n+vl)/(r+vl))))}const cF={query:5,text:2},uF=e=>e.some(t=>t.row!==void 0);function ole(e,t,n){const r=Math.min(e.colspan??1,t),o=e.col===void 0?void 0:Math.min(e.col,t-r+1);return{gridRow:e.row===void 0?`span ${n}`:`${e.row} / span ${n}`,gridColumn:o===void 0?`span ${r}`:`${o} / span ${r}`}}const ale=e=>e.row===void 0?1e6:e.row*1e3+(e.col??0);function ile({tiles:e,columns:t,keyOf:n,renderTile:r,minTilePx:o,rowGapPx:a=vl,defaultRowspan:i=s=>cF[s.kind==="text"?"text":"query"]}){const s=uF(e),l=C.useRef(null),[d,u]=C.useState(0);C.useEffect(()=>{const g=l.current;if(o===void 0||!g||typeof ResizeObserver>"u")return;const y=new ResizeObserver(([x])=>u(x?.contentRect.width??0));return y.observe(g),()=>y.disconnect()},[o]);const m=o===void 0?1:lF(t,d,o);return p.jsx(Te,{ref:l,sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:`repeat(${t}, minmax(0, 1fr))`},columnGap:`${vl}px`,rowGap:`${a}px`,...s&&{gridAutoRows:`${d2}px`}},children:e.map((g,y)=>p.jsx(Te,{sx:{display:"grid",minWidth:0,...!s&&g.rowspan!==void 0&&{height:iF(g.rowspan),alignSelf:"start"},...(s||g.rowspan!==void 0)&&{gridTemplateRows:"minmax(0, 1fr)"},...s?(()=>{const x=g.rowspan??i(g),w=ole(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t,x);return{gridRow:{xs:`span ${x}`,md:w.gridRow},gridColumn:{md:w.gridColumn},order:{xs:ale(g),md:0}}})():{gridColumn:{md:tle(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t)}}},children:r(g,y)},n(g,y)))})}function p1(e){let t="",n=0;for(;;){const r=e.indexOf('"',n);if(r<0)break;let o=r+1;for(;o<e.length&&e[o]!=='"';)o+=e[o]==="\\"?2:1;if(o>=e.length)break;t+=`${e.slice(n,r)}""`,n=o+1}return t+e.slice(n)}const dF=["bar_chart","line_chart","scatter_chart","shape_map","segment_map","big_value","sparkline","combo_chart"],f2=["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map","combo_chart"],sle=e=>f2.includes(e),Wk=new Set([...dF,"viz"]);function h1(e){const t=e.trim();if(!/^#[ \t]/.test(t)||/[{=]/.test(t))return;const n=t.slice(1).trim().split(/[ \t]+/),r=[];let o;for(const a of n)if(a.startsWith("-")){if(o!==void 0)return;const i=a.slice(1);if(!Wk.has(i))return;r.push(i)}else{if(o!==void 0||!Wk.has(a))return;o=a}return{negated:r,...o!==void 0&&{pick:o}}}function fF(e){const t=e.trim();return!/^#[ \t]/.test(t)||h1(t)?!1:(p1(t).match(/[A-Za-z_]+/g)??[]).some(n=>Wk.has(n))}function nTe(){return["#",...f2.filter(e=>e!=="big_value").map(e=>`-${e}`)].join(" ")}function rTe(e,t){return["#",...f2.filter(n=>n!==e&&(t===void 0||t.includes(n)||e==="none"&&n==="big_value")).map(n=>`-${n}`),"-viz",...e==="none"?[]:[e]].join(" ")}function lle(e){return e.pick!==void 0?sle(e.pick)?e.pick:"custom":e.negated.includes("viz")?"none":"custom"}function cle(e){if(e.length===0)return"default";if(e.length>1)return"custom";const t=h1(e[0]);return t?lle(t):"custom"}function oTe(e){const t=e.filter(n=>h1(n));return e.some(fF)?"custom":t.length===0?void 0:cle(t)}const ule=/^#[ \t]*theme\.palette\.series[ \t]*=[ \t]*\[[ \t]*"(#[0-9A-Fa-f]{6})"[ \t]*\][ \t]*$/;function aTe(e){return ule.exec(e.trim())?.[1]?.toLowerCase()}const iTe=e=>`# theme.palette.series=["${e.toLowerCase()}"]`,sTe="# -theme.palette.series",dle=e=>/^#[0-9A-Fa-f]{6}$/.test(e);function lTe(e){const t=e.trim().toLowerCase();if(dle(t))return t;const n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return n?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:void 0}const cTe=e=>e.filter(t=>h1(t)||fF(t)),xh=Jt(p.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function Oo({open:e,onClose:t,title:n,description:r,maxWidth:o="sm",showClose:a=!1,actions:i,initialFocus:s,className:l,children:d}){const u=C.useId(),m=Vr().theme.ui;return p.jsxs(zx,{open:e,onClose:t,maxWidth:o,fullWidth:!0,"aria-labelledby":u,...l?{className:l}:{},PaperProps:{sx:{borderRadius:m.radius.dialog}},...s?{TransitionProps:{onEntered:()=>s.current?.focus()}}:{},children:[p.jsxs(_x,{id:u,sx:{px:3,pt:3,pb:r?.5:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,fontSize:"1.25rem",fontWeight:"fontWeightMedium",letterSpacing:"-0.025em",lineHeight:1.2},children:[n,a&&p.jsx(ro,{"aria-label":"Close",onClick:t,size:"small",sx:{color:"text.secondary",mr:-1},children:p.jsx(xh,{fontSize:"small"})})]}),p.jsxs(Fx,{sx:{px:3,pb:1,pt:1},children:[r&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:2},children:r}),p.jsx(Yn,{sx:{gap:2,pt:r?0:1},children:d})]}),i&&p.jsx(pz,{sx:{px:3,pb:3,pt:2,gap:1},children:i})]})}function uTe({open:e,canSave:t,onKeepEditing:n,onDiscard:r,onSaveAndExit:o}){return p.jsx(Oo,{open:e,onClose:n,title:"Leave with unsaved changes?",description:t&&o?"Your edits have not been saved. Save them, or leave without them.":"Leaving now discards your unsaved edits.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{onClick:n,children:"Keep editing"}),p.jsx(Vn,{color:"error",onClick:r,children:"Discard changes"}),t&&o&&p.jsx(Vn,{variant:"contained",onClick:o,children:"Save and exit"})]}),children:null})}const pF=Jt(p.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));function Qy({label:e,onClick:t,disabled:n}){return p.jsx(Vn,{variant:"contained",color:"primary",startIcon:p.jsx(f1,{}),onClick:t,disabled:n,"aria-label":`Add ${e.toLowerCase()}`,sx:{whiteSpace:"nowrap"},children:e})}function Xy({label:e,icon:t,onClick:n,disabled:r,disabledReason:o,ariaLabel:a,ariaHasPopup:i}){const s=p.jsx("span",{children:p.jsx(Vn,{variant:"outlined",startIcon:t,onClick:n,disabled:r,"aria-label":a,"aria-haspopup":i,sx:{whiteSpace:"nowrap"},children:e})});return r&&o?p.jsx(Br,{title:o,children:s}):s}const hF=Jt(p.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),Zy="120ms",Jy={"@media (prefers-reduced-motion: reduce)":{transition:"none",animation:"none"}},dTe=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",fle={"@media (hover: none)":{opacity:1}},fTe=e=>e.palette.mode==="dark"?e.palette.error.main:e.palette.error.dark;wi.size.control;wi.size.chip;wi.radius.control;wi.radius.tile;wi.radius.dialog;wi.type;const ple="72ch",Zd=e=>e.replace(/^1px solid /,""),mF=(e,t)=>`color-mix(in srgb, ${Zd(e)}, ${t} 25%)`,m1={line_chart:"A line chart",bar_chart:"A bar chart",scatter_chart:"A scatter chart",combo_chart:"A bar and line chart"},hle={line:"line_chart",bar:"bar_chart",scatter:"scatter_chart",combo:"combo_chart"},mle=new Set(["x","y","y2","series"]);function Yk(e){const t=e.trim();return!t.startsWith("#")||t.startsWith("#(")||t.startsWith('#"')?[]:p1(t.slice(1)).split(/[\s{}[\],]+/).filter(Boolean)}function gF(e){const t=[];let n;for(const r of e)for(const o of Yk(r))if(o.startsWith("-")){const a=o.slice(1);a==="viz"&&(n=void 0);const i=t.indexOf(a);i>=0&&t.splice(i,1)}else if(o.startsWith("viz="))n=hle[o.slice(4)]??o;else if(m1[o]!==void 0||o==="big_value"){const a=t.indexOf(o);a>=0&&t.splice(a,1),t.push(o)}return n??t.at(-1)}function pTe(e){const t=gF(e);return t!==void 0&&m1[t]!==void 0}function gle(e,{groupBys:t,totals:n}){if(m1[e]!==void 0){if(e==="scatter_chart")return t===0&&n<2?"no_x_axis":void 0;if(t===0)return"no_x_axis";if(e==="combo_chart")return n===2?void 0:"combo_totals";if(n===0)return"no_y_axis"}}function yle(e){const t=e.trim();if(!t.startsWith("#(malloy)"))return!1;const n=p1(t.slice(9));let r="",o=0;for(const i of n)i==="{"||i==="["?o++:i==="}"||i==="]"?o=Math.max(0,o-1):o===0&&(r+=i==="="?" = ":i);const a=r.split(/\s+/);return a.some((i,s)=>i==="calculation"&&a[s-1]!=="=")}const Gk=e=>e!==void 0&&(e.kind==="measure"||(e.annotations??[]).some(t=>yle(t?.value??""))),vle=e=>e.kind==="join"||e.type?.kind==="array_type";function ble(e){const t=e.filter(Gk).length;return{groupBys:e.filter(n=>!Gk(n)&&!vle(n)).length,totals:t}}const ED=e=>mle.has(e.split("=")[0]);function xle(e){if(!e)return;let t;try{t=JSON.parse(e)}catch{return}const n=t?.schema?.fields;if(!Array.isArray(n)||n.length===0)return;const r=(t.annotations??[]).map(l=>l?.value).filter(l=>typeof l=="string"),o=gF(r),a=o&&m1[o];if(!o||!a||r.some(l=>Yk(l).some(ED))||n.some(l=>(l.annotations??[]).some(d=>Yk(d.value??"").some(ED))))return;const{groupBys:i,totals:s}=ble(n);switch(gle(o,{groupBys:i,totals:s})){case"no_x_axis":return`This chart has no field for the x-axis. ${a} needs a group by, such as a date or a category. Show it as big numbers or a table instead, or add a group by to its query.`;case"combo_totals":return`${a} needs exactly two totals, the first drawn as bars and the second as a line. This one has ${s}.`;case"no_y_axis":return`This chart has no total for the y-axis. ${a} needs at least one aggregate, such as a count or a sum.`;default:return}}const wle=Jt(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),Sle=Jt(p.jsx("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z"})),Cle=Jt(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),kle=Jt([p.jsx("circle",{cx:"7",cy:"14",r:"3"},"0"),p.jsx("circle",{cx:"11",cy:"6",r:"3"},"1"),p.jsx("circle",{cx:"16.6",cy:"17.6",r:"3"},"2")]),Kp=Jt(p.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),$le=Jt(p.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"})),Rle=Jt(p.jsx("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2M3 19c0 1.1.9 2 2 2h3V10H3z"}));function vC(e){const t=e.replace(/_+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function Tle({chart:e}){const t={fontSize:16};switch(e){case"bar_chart":case"combo_chart":return p.jsx(wle,{sx:t});case"line_chart":case"sparkline":return p.jsx($le,{sx:t});case"scatter_chart":return p.jsx(kle,{sx:t});case"shape_map":case"segment_map":return p.jsx(Sle,{sx:t});case"big_value":return p.jsx(Cle,{sx:t});default:return p.jsx(Rle,{sx:t})}}function Ele({groups:e,query:t,onQuery:n,picked:r,onPick:o,onTake:a,searchRef:i,empty:s,footer:l,disabled:d=!1}){const{theme:u}=Vr(),m=u.ui,g=C.useId(),y=t.trim().toLowerCase(),x=C.useMemo(()=>e.map(O=>({...O,entries:O.entries.filter(P=>y===""||[P.name,P.title,O.label,O.detail??""].join(" ").toLowerCase().includes(y))})).filter(O=>O.entries.length>0),[e,y]),w=x.flatMap(O=>O.entries),S=C.useMemo(()=>new Map(e.flatMap(O=>O.entries).map((O,P)=>[O.key,`${g}-${P}`])),[e,g]),b=O=>S.get(O)??`${g}-none`,$=w.some(O=>O.key===r)?r:void 0,k=O=>{o(O),window.requestAnimationFrame(()=>window.document.getElementById(b(O))?.scrollIntoView({block:"nearest"}))},T=O=>{if(w.length===0)return;const P=w.findIndex(A=>A.key===$),D=P===-1?O===1?0:w.length-1:Math.min(w.length-1,Math.max(0,P+O));k(w[D].key)};return p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",minHeight:0,flex:1},children:[p.jsx(Te,{sx:{p:1.5,pb:1},children:p.jsx(Ri,{size:"small",fullWidth:!0,inputRef:i,placeholder:"Search the model",value:t,disabled:d,onChange:O=>n(O.target.value),onKeyDown:O=>{if(O.key==="ArrowDown")O.preventDefault(),T(1);else if(O.key==="ArrowUp")O.preventDefault(),T(-1);else if(O.key==="Enter"){const P=$??w[0]?.key;if(P===void 0)return;O.preventDefault(),a(P)}},inputProps:{"aria-label":"Search the model",role:"combobox","aria-controls":g,"aria-expanded":!0,...$!==void 0?{"aria-activedescendant":b($)}:{}},InputProps:{startAdornment:p.jsx(PR,{position:"start",children:p.jsx(Kp,{sx:{fontSize:18,color:"text.secondary"}})})}})}),p.jsxs(Te,{id:g,role:"listbox","aria-label":"From the model",sx:{overflowY:"auto",flex:1,minHeight:0,pb:1},children:[e.length===0&&s,e.length>0&&x.length===0&&p.jsxs(wt,{variant:"body2",sx:{color:u.tileTitle,px:2,py:1},children:["No view matches “",t.trim(),"”."]}),x.map(O=>p.jsxs(Te,{role:"group","aria-label":O.ariaLabel??O.label,children:[p.jsxs(Te,{"aria-hidden":!0,sx:{px:2,pt:1.25,pb:.5,...m.type.caption,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[p.jsx(Te,{component:"span",sx:{...m.type.label,fontSize:"0.92em",letterSpacing:"0.04em",textTransform:"uppercase"},children:O.label.replace(/_+/g," ")}),O.detail&&` · ${O.detail}`]}),O.entries.map(P=>{const D=P.key===r;return p.jsxs(Te,{id:b(P.key),role:"option","aria-selected":D,"aria-label":`${P.title} (${P.name})`,onClick:()=>{d||k(P.key)},onDoubleClick:()=>{d||a(P.key)},sx:A=>({display:"flex",alignItems:"center",gap:1.25,mx:.75,px:1.25,py:.75,borderRadius:m.radius.control,cursor:d?"default":"pointer",bgcolor:D?`color-mix(in srgb, ${u.accent} 9%, ${A.palette.background.paper})`:"transparent","&:hover":D||d?{}:{bgcolor:A.palette.action.hover}}),children:[p.jsx(Te,{"aria-hidden":!0,sx:A=>({width:26,height:26,flex:"none",borderRadius:m.radius.control,display:"flex",alignItems:"center",justifyContent:"center",color:D?u.accent:A.palette.text.secondary,bgcolor:D?A.palette.background.paper:A.palette.action.hover,boxShadow:D?`inset 0 0 0 1px color-mix(in srgb, ${u.accent} 35%, transparent)`:"none"}),children:p.jsx(Tle,{chart:P.chart})}),p.jsxs(Te,{sx:{minWidth:0},children:[p.jsx(Te,{sx:{...m.type.control,fontWeight:D?m.type.label.fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:P.title}),p.jsx(Te,{sx:{...m.type.code,color:"text.secondary"},children:P.name})]})]},P.key)})]},O.key)),y===""&&l]})]})}const Mle=new Set(["bar","line","chart","scatter_chart","combo"]),Ole=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function hTe(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":Mle.has(e)?"container":"content"}function mTe(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&Ole.has(e)}function gTe(e){return e==="dashboard"?3:2}function Ple(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function yTe(e,t){const n=Ple(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const yF=400,jle=700,Ale=700;function Dle({renderAs:e,maxHeight:t,tableMaxHeight:n}){return e!=="table"||n===void 0?t:t===void 0?n:Math.min(t,n)}const Nle=600,Ile=800,Lle=400,zle=2e3;function Fle(e,t){const n=t??zle;return e===void 0?n:Math.min(e,n)}function MD({sizing:e,contentHeight:t,maxHeight:n,fillHeight:r,firstPaintHeight:o}){if(e==="container"){const i=n??Lle;return r!==void 0&&r>0?Math.min(i,r):i}if(t===void 0||t<=0)return Fle(n,o);const a=n===void 0?t:Math.min(n,t);return r===void 0?a:Math.max(a,r)}const _le="data-publisher-tight",Ble="publisher-result-scroller";function Ule(e,t,n=1){return e===1&&t<=2&&n===1?void 0:e}function vTe(e,t,n,r=1){const o={...e},a=Ule(t,n,r);return a===void 0?delete o.colspan:o.colspan=a,o}function qle(e,t){if(e==="linear")return{layout:"linear",columns:1,widths:!1,insertBetween:!0,tileMaxHeight:void 0,tableMaxHeight:Ale};const n=t??Jse;return{layout:"grid",columns:n,widths:n>1,insertBetween:!1,tileMaxHeight:yF,tableMaxHeight:void 0}}const vF="document.malloy",bF=e=>e.slice(0,e.lastIndexOf("/")+1),xF=(e,t)=>new URL(e,`https://malloy.invalid/${bF(t)}`).pathname.slice(1);function wF(e,t){const n=bF(t).split("/").filter(Boolean),r=e.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const a=n.length-o;return`${"../".repeat(a)}${r.slice(o).join("/")}`}function Hle(e,t,n,r=vF,o=[n]){return e.sources.some(a=>a.base===t)?!0:e.imports.some(a=>a.kind==="names"?a.names.includes(t):o.includes(xF(a.from,r)))}function bTe(e,t,n,r=vF,o=[n]){const{imports:a}=e;if(Hle(e,t,n,r,o))return a;const i=a.findIndex(s=>s.kind==="names"&&o.includes(xF(s.from,r)));return i<0?[...a,{kind:"names",names:[t],from:wF(n,r)}]:a.map((s,l)=>l===i&&s.kind==="names"?{...s,names:[...s.names,t]}:s)}const SF=Jt(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"})),Vle=Jt(p.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m-5.5-2.5 7.51-3.49L17.5 6.5 9.99 9.99zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1"})),Wle=600,OD=()=>typeof IntersectionObserver>"u";function Yle(e){for(let t=e.parentElement;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t}return null}function Gle(e=Wle){const[t,n]=C.useState(OD),r=C.useRef(t),o=C.useRef(null),a=C.useCallback(i=>{if(o.current?.disconnect(),o.current=null,!i||r.current||OD())return;const s=i.getBoundingClientRect(),l=Yle(i),d=l?.getBoundingClientRect()??{top:0,bottom:window.innerHeight||document.documentElement.clientHeight};if(s.bottom>=d.top-e&&s.top<=d.bottom+e){r.current=!0,n(!0);return}const u=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&(r.current=!0,u.disconnect(),n(!0))},{root:l,rootMargin:`${e}px 0px`});u.observe(i),o.current=u},[e]);return C.useEffect(()=>()=>o.current?.disconnect(),[]),C.useEffect(()=>{if(t||typeof window>"u")return;const i=()=>{r.current=!0,o.current?.disconnect(),n(!0)};return window.addEventListener("beforeprint",i),()=>window.removeEventListener("beforeprint",i)},[t]),[a,t]}function CF({summary:e,detail:t}){return p.jsxs(lo,{severity:"error",sx:{"& .MuiAlert-message":{minWidth:0,flex:1}},children:[e!==void 0&&p.jsx(Te,{sx:{mb:.5},children:e}),p.jsx(Te,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:Fo,fontSize:"0.8125rem",color:"text.secondary"},children:t})]})}function ja({error:e,context:t}){const n=e.data?.message||"Unknown error";return p.jsx(CF,{summary:t,detail:n})}function xTe(e){const t=Kle(e);return{name:e.name,type:e.type,...t===void 0?{}:{default:t},...e.label===void 0?{}:{label:e.label},...e.description===void 0?{}:{description:e.description},...e.control===void 0?{}:{control:e.control},...e.suggest?{suggest:{...e.suggest.source===void 0?{}:{source:e.suggest.source},...e.suggest.query===void 0?{}:{query:e.suggest.query},dimension:e.suggest.dimension}}:{},...e.rangeMin===void 0?{}:{rangeMin:e.rangeMin},...e.rangeMax===void 0?{}:{rangeMax:e.rangeMax}}}function Kle(e){return e.type?.startsWith("filter<")?e.default?.match(/^f(['"])([\s\S]*)\1$/)?.[2]??e.default:e.default}function p2(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/[\u0000-\u001f]/g,t=>Qle[t]??Xle(t))}const Qle={"\n":"\\n","\r":"\\r"," ":"\\t","\b":"\\b","\f":"\\f"},Xle=e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`;function Zle(e,t){if(e==null||e==="")return;const n=r=>`'${p2(r)}'`;switch(t===void 0?Jle(e):t.startsWith("filter<")?"filter":t){case"filter":return ece(String(e));case"string":return n(String(e));case"number":{const r=typeof e=="number"?e:Number(e);return Number.isFinite(r)?String(r):void 0}case"boolean":return e===!0||e==="true"?"true":"false";case"date":{const r=PD(e);return r&&`@${r}`}case"timestamp":{const r=PD(e);if(!r)return;const o=e instanceof Date?e.toISOString().slice(11,19):/[T ](\d{2}:\d{2}(?::\d{2})?)/.exec(String(e))?.[1]??"00:00:00";return`@${r} ${o}`}default:return}}function Jle(e){if(typeof e=="string")return"string";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.toISOString().slice(11,19)==="00:00:00"?"date":"timestamp"}function ece(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];r==="\\"?t+=n+1<e.length?r+e[++n]:"\\\\":t+=r==="'"?"\\'":r}return`f'${t}'`}function PD(e){return e instanceof Date?Number.isNaN(e.getTime())?void 0:e.toISOString().slice(0,10):/^(\d{4}-\d{2}-\d{2})/.exec(String(e))?.[1]}const Qp="malloy-publisher.report-draft:",Xp={storage:()=>window.localStorage};function wTe(e){const{server:t,environmentName:n,packageName:r,versionId:o,path:a}=e;return`${t}|${n}/${r}@${o??""}/${a}`}function STe(e){if(typeof e=="string"){h0(e);return}const{server:t,environmentName:n,packageName:r,path:o}=e,a=`${n}/${r}@`,i=e.versionId!==void 0?`${e.versionId}/${o}`:void 0;try{const s=Xp.storage(),l=[];for(let d=0;d<s.length;d++){const u=s.key(d);if(!u?.startsWith(Qp))continue;const m=u.slice(Qp.length),g=m.indexOf("|");if(g===-1)continue;const[y,x]=[m.slice(0,g),m.slice(g+1)];if(t!==void 0&&y!==t||!x.startsWith(a))continue;const w=x.slice(a.length);(i!==void 0?w!==i:w.slice(w.indexOf("/")+1)!==o)||l.push(u)}for(const d of l)s.removeItem(d)}catch{}}function CTe(){try{const e=`${Qp}probe`;return Xp.storage().setItem(e,"1"),Xp.storage().removeItem(e),!0}catch{return!1}}function tce(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return`${e.length}:${(t>>>0).toString(36)}`}function nce(e){try{const t=Xp.storage().getItem(Qp+e);if(!t)return;const n=JSON.parse(t);return n?.v===1&&n.document?n:void 0}catch{return}}function rce(e,t){try{return Xp.storage().setItem(Qp+e,JSON.stringify(t)),!0}catch{return!1}}function h0(e){try{Xp.storage().removeItem(Qp+e)}catch{}}function bC(e,t){const n=e;for(const r of Object.keys(n))delete n[r];Object.assign(n,structuredClone(t))}function kTe(e,t,n){const[r,o]=C.useState(),[a,i]=C.useState(),[s,l]=C.useState(!1),d=C.useRef(void 0),u=C.useRef(void 0),m=C.useRef(!1),g=tce(n),y=C.useRef(t);y.current=t;const x=C.useRef(!1);C.useEffect(()=>{if(e===void 0||x.current)return;x.current=!0;const T=nce(e);if(!T)return;const O=y.current;if(JSON.stringify(T.document)===JSON.stringify(O.document)){h0(e);return}if(T.base!==g){d.current=T,o({savedAt:T.savedAt,stale:!0,pending:!0});return}O.update(P=>bC(P,T.document)),u.current=JSON.stringify(T.document),m.current=!0,o({savedAt:T.savedAt,stale:!1,pending:!1})},[e]);const{document:w,dirty:S}=t;C.useEffect(()=>{if(e===void 0||!x.current||d.current&&!S)return;if(d.current&&(d.current=void 0,o(void 0)),u.current!==void 0){const O=JSON.stringify(w);m.current?O===u.current&&(m.current=!1):O!==u.current&&(u.current=void 0,o(void 0))}if(!S){h0(e),i(void 0),l(!1);return}const T=Date.now();rce(e,{v:1,document:w,base:g,savedAt:T})?(i(T),l(!1)):(i(void 0),l(!0))},[e,w,S,g]);const b=C.useCallback(()=>{const T=d.current;T&&(d.current=void 0,y.current.update(O=>bC(O,T.document)),u.current=JSON.stringify(T.document),m.current=!0,o(O=>O&&{...O,pending:!1}))},[]),$=C.useCallback(()=>{d.current||(u.current=void 0,o(void 0))},[]),k=C.useCallback(()=>{if(d.current&&e!==void 0){d.current=void 0,h0(e),o(void 0);return}const T=y.current;T.update(O=>bC(O,T.saved)),u.current=void 0,o(void 0)},[e]);return{keptAt:a,keeping:!s,restored:r,dismissRestored:$,discard:k,restoreOffered:b}}const oce=(e,t)=>({...t,...e}),kF={emit:()=>{},listening:!1};function Kk(e,t){return t?{listening:!0,emit:n=>{try{t(oce(n,e))}catch{}}}:kF}function ace(e,t){const n=C.useRef(t);n.current=t;const r=t!==void 0,{path:o,layout:a}=e;return C.useMemo(()=>Kk({path:o,...a?{layout:a}:{}},r?i=>n.current?.(i):void 0),[o,a,r])}const $F=C.createContext(kF),g1=()=>C.useContext($F);function U0(e){const t=e,n=typeof t?.status=="number"?t.status:typeof t?.response?.status=="number"?t.response.status:void 0;return n===void 0?t?.code==="ERR_NETWORK"?"network":"unknown":n===404?"not_found":n===401||n===403?"forbidden":n===501?"unsupported":n>=500?"server":n>=400?"invalid":"unknown"}var Qk={exports:{}},ice=Qk.exports,jD;function sce(){return jD||(jD=1,(function(e,t){(function(n,r){e.exports=r()})(ice,(function(){var n=1e3,r=6e4,o=36e5,a="millisecond",i="second",s="minute",l="hour",d="day",u="week",m="month",g="quarter",y="year",x="date",w="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var B=["th","st","nd","rd"],I=N%100;return"["+N+(B[(I-20)%10]||B[I]||B[0])+"]"}},k=function(N,B,I){var H=String(N);return!H||H.length>=B?N:""+Array(B+1-H.length).join(I)+N},T={s:k,z:function(N){var B=-N.utcOffset(),I=Math.abs(B),H=Math.floor(I/60),Y=I%60;return(B<=0?"+":"-")+k(H,2,"0")+":"+k(Y,2,"0")},m:function N(B,I){if(B.date()<I.date())return-N(I,B);var H=12*(I.year()-B.year())+(I.month()-B.month()),Y=B.clone().add(H,m),ae=I-Y<0,K=B.clone().add(H+(ae?-1:1),m);return+(-(H+(I-Y)/(ae?Y-K:K-Y))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y,w:u,d,D:x,h:l,m:s,s:i,ms:a,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},O="en",P={};P[O]=$;var D="$isDayjsObject",A=function(N){return N instanceof R||!(!N||!N[D])},F=function N(B,I,H){var Y;if(!B)return O;if(typeof B=="string"){var ae=B.toLowerCase();P[ae]&&(Y=ae),I&&(P[ae]=I,Y=ae);var K=B.split("-");if(!Y&&K.length>1)return N(K[0])}else{var oe=B.name;P[oe]=B,Y=oe}return!H&&Y&&(O=Y),Y||!H&&O},L=function(N,B){if(A(N))return N.clone();var I=typeof B=="object"?B:{};return I.date=N,I.args=arguments,new R(I)},_=T;_.l=F,_.i=A,_.w=function(N,B){return L(N,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var R=(function(){function N(I){this.$L=F(I.locale,null,!0),this.parse(I),this.$x=this.$x||I.x||{},this[D]=!0}var B=N.prototype;return B.parse=function(I){this.$d=(function(H){var Y=H.date,ae=H.utc;if(Y===null)return new Date(NaN);if(_.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var K=Y.match(S);if(K){var oe=K[2]-1||0,ue=(K[7]||"0").substring(0,3);return ae?new Date(Date.UTC(K[1],oe,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)):new Date(K[1],oe,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)}}return new Date(Y)})(I),this.init()},B.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},B.$utils=function(){return _},B.isValid=function(){return this.$d.toString()!==w},B.isSame=function(I,H){var Y=L(I);return this.startOf(H)<=Y&&Y<=this.endOf(H)},B.isAfter=function(I,H){return L(I)<this.startOf(H)},B.isBefore=function(I,H){return this.endOf(H)<L(I)},B.$g=function(I,H,Y){return _.u(I)?this[H]:this.set(Y,I)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(I,H){var Y=this,ae=!!_.u(H)||H,K=_.p(I),oe=function(le,fe){var he=_.w(Y.$u?Date.UTC(Y.$y,fe,le):new Date(Y.$y,fe,le),Y);return ae?he:he.endOf(d)},ue=function(le,fe){return _.w(Y.toDate()[le].apply(Y.toDate("s"),(ae?[0,0,0,0]:[23,59,59,999]).slice(fe)),Y)},G=this.$W,ie=this.$M,Q=this.$D,ee="set"+(this.$u?"UTC":"");switch(K){case y:return ae?oe(1,0):oe(31,11);case m:return ae?oe(1,ie):oe(0,ie+1);case u:var Z=this.$locale().weekStart||0,de=(G<Z?G+7:G)-Z;return oe(ae?Q-de:Q+(6-de),ie);case d:case x:return ue(ee+"Hours",0);case l:return ue(ee+"Minutes",1);case s:return ue(ee+"Seconds",2);case i:return ue(ee+"Milliseconds",3);default:return this.clone()}},B.endOf=function(I){return this.startOf(I,!1)},B.$set=function(I,H){var Y,ae=_.p(I),K="set"+(this.$u?"UTC":""),oe=(Y={},Y[d]=K+"Date",Y[x]=K+"Date",Y[m]=K+"Month",Y[y]=K+"FullYear",Y[l]=K+"Hours",Y[s]=K+"Minutes",Y[i]=K+"Seconds",Y[a]=K+"Milliseconds",Y)[ae],ue=ae===d?this.$D+(H-this.$W):H;if(ae===m||ae===y){var G=this.clone().set(x,1);G.$d[oe](ue),G.init(),this.$d=G.set(x,Math.min(this.$D,G.daysInMonth())).$d}else oe&&this.$d[oe](ue);return this.init(),this},B.set=function(I,H){return this.clone().$set(I,H)},B.get=function(I){return this[_.p(I)]()},B.add=function(I,H){var Y,ae=this;I=Number(I);var K=_.p(H),oe=function(ie){var Q=L(ae);return _.w(Q.date(Q.date()+Math.round(ie*I)),ae)};if(K===m)return this.set(m,this.$M+I);if(K===y)return this.set(y,this.$y+I);if(K===d)return oe(1);if(K===u)return oe(7);var ue=(Y={},Y[s]=r,Y[l]=o,Y[i]=n,Y)[K]||1,G=this.$d.getTime()+I*ue;return _.w(G,this)},B.subtract=function(I,H){return this.add(-1*I,H)},B.format=function(I){var H=this,Y=this.$locale();if(!this.isValid())return Y.invalidDate||w;var ae=I||"YYYY-MM-DDTHH:mm:ssZ",K=_.z(this),oe=this.$H,ue=this.$m,G=this.$M,ie=Y.weekdays,Q=Y.months,ee=Y.meridiem,Z=function(fe,he,me,se){return fe&&(fe[he]||fe(H,ae))||me[he].slice(0,se)},de=function(fe){return _.s(oe%12||12,fe,"0")},le=ee||function(fe,he,me){var se=fe<12?"AM":"PM";return me?se.toLowerCase():se};return ae.replace(b,(function(fe,he){return he||(function(me){switch(me){case"YY":return String(H.$y).slice(-2);case"YYYY":return _.s(H.$y,4,"0");case"M":return G+1;case"MM":return _.s(G+1,2,"0");case"MMM":return Z(Y.monthsShort,G,Q,3);case"MMMM":return Z(Q,G);case"D":return H.$D;case"DD":return _.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Z(Y.weekdaysMin,H.$W,ie,2);case"ddd":return Z(Y.weekdaysShort,H.$W,ie,3);case"dddd":return ie[H.$W];case"H":return String(oe);case"HH":return _.s(oe,2,"0");case"h":return de(1);case"hh":return de(2);case"a":return le(oe,ue,!0);case"A":return le(oe,ue,!1);case"m":return String(ue);case"mm":return _.s(ue,2,"0");case"s":return String(H.$s);case"ss":return _.s(H.$s,2,"0");case"SSS":return _.s(H.$ms,3,"0");case"Z":return K}return null})(fe)||K.replace(":","")}))},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(I,H,Y){var ae,K=this,oe=_.p(H),ue=L(I),G=(ue.utcOffset()-this.utcOffset())*r,ie=this-ue,Q=function(){return _.m(K,ue)};switch(oe){case y:ae=Q()/12;break;case m:ae=Q();break;case g:ae=Q()/3;break;case u:ae=(ie-G)/6048e5;break;case d:ae=(ie-G)/864e5;break;case l:ae=ie/o;break;case s:ae=ie/r;break;case i:ae=ie/n;break;default:ae=ie}return Y?ae:_.a(ae)},B.daysInMonth=function(){return this.endOf(m).$D},B.$locale=function(){return P[this.$L]},B.locale=function(I,H){if(!I)return this.$L;var Y=this.clone(),ae=F(I,H,!0);return ae&&(Y.$L=ae),Y},B.clone=function(){return _.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},N})(),z=R.prototype;return L.prototype=z,[["$ms",a],["$s",i],["$m",s],["$H",l],["$W",d],["$M",m],["$y",y],["$D",x]].forEach((function(N){z[N[1]]=function(B){return this.$g(B,N[0],N[1])}})),L.extend=function(N,B){return N.$i||(N(B,R,L),N.$i=!0),L},L.locale=F,L.isDayjs=A,L.unix=function(N){return L(1e3*N)},L.en=P[O],L.Ls=P,L.p={},L}))})(Qk)),Qk.exports}var lce=sce();const Ar=yc(lce);var Xk={exports:{}},cce=Xk.exports,AD;function uce(){return AD||(AD=1,(function(e,t){(function(n,r){e.exports=r()})(cce,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,o=/([+-]|\d\d)/g;return function(a,i,s){var l=i.prototype;s.utc=function(w){var S={date:w,utc:!0,args:arguments};return new i(S)},l.utc=function(w){var S=s(this.toDate(),{locale:this.$L,utc:!0});return w?S.add(this.utcOffset(),n):S},l.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var d=l.parse;l.parse=function(w){w.utc&&(this.$u=!0),this.$utils().u(w.$offset)||(this.$offset=w.$offset),d.call(this,w)};var u=l.init;l.init=function(){if(this.$u){var w=this.$d;this.$y=w.getUTCFullYear(),this.$M=w.getUTCMonth(),this.$D=w.getUTCDate(),this.$W=w.getUTCDay(),this.$H=w.getUTCHours(),this.$m=w.getUTCMinutes(),this.$s=w.getUTCSeconds(),this.$ms=w.getUTCMilliseconds()}else u.call(this)};var m=l.utcOffset;l.utcOffset=function(w,S){var b=this.$utils().u;if(b(w))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof w=="string"&&(w=(function(O){O===void 0&&(O="");var P=O.match(r);if(!P)return null;var D=(""+P[0]).match(o)||["-",0,0],A=D[0],F=60*+D[1]+ +D[2];return F===0?0:A==="+"?F:-F})(w),w===null))return this;var $=Math.abs(w)<=16?60*w:w;if($===0)return this.utc(S);var k=this.clone();if(S)return k.$offset=$,k.$u=!1,k;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add($+T,n)).$offset=$,k.$x.$localOffset=T,k};var g=l.format;l.format=function(w){var S=w||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},l.valueOf=function(){var w=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*w},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(w){return w==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var x=l.diff;l.diff=function(w,S,b){if(w&&this.$u===w.$u)return x.call(this,w,S,b);var $=this.local(),k=s(w).local();return x.call($,k,S,b)}}}))})(Xk)),Xk.exports}var dce=uce();const h2=yc(dce);Ar.extend(h2);function ou(e){return(e??"").startsWith("filter<")}function fce(e){const{parsed:t}=ji.BooleanFilterExpression.parse(e);if(!(!t||t.not))return t.operator==="true"||t.operator==="false"?t.operator:void 0}function uu(e){const t=/^filter<(.+)>$/.exec(e??"");return t?t[1]:void 0}function m2(e){const t=e.filter(n=>n.trim()!=="");return t.length===0?"":ji.StringFilterExpression.unparse({operator:"=",values:[...t]})}function RF(e){if(e.trim()==="")return[];const{parsed:t}=ji.StringFilterExpression.parse(e);return EF(t)?t.values:[e]}function TF(e){return e===void 0||e.trim()===""?!0:EF(ji.StringFilterExpression.parse(e).parsed)}function EF(e){return e!==null&&ji.isStringCondition(e)&&e.operator==="="&&e.not!==!0}function pce(e){return ji.NumberFilterExpression.unparse({operator:">=",values:[String(e)]})}function MF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.NumberFilterExpression.parse(t);if(n===null||n.operator!==">="||n.not===!0||n.values?.length!==1)return;const r=Number(n.values[0]);return Number.isFinite(r)?r:void 0}function hce(e,t){return ji.NumberFilterExpression.unparse({operator:"range",startOperator:">=",startValue:String(e),endOperator:"<=",endValue:String(t)})}function OF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.NumberFilterExpression.parse(t);if(n===null||n.operator!=="range"||n.not===!0||n.startOperator!==">="||n.endOperator!=="<=")return;const r=Number(n.startValue),o=Number(n.endValue);return Number.isFinite(r)&&Number.isFinite(o)&&r<=o?[r,o]:void 0}const my=[{key:"today",label:"Today",clause:{operator:"in",in:{moment:"today"}}},{key:"7d",label:"Last 7 days",clause:{operator:"in_last",units:"day",n:"7"}},{key:"30d",label:"Last 30 days",clause:{operator:"in_last",units:"day",n:"30"}},{key:"90d",label:"Last 90 days",clause:{operator:"in_last",units:"day",n:"90"}},{key:"12m",label:"Last 12 months",clause:{operator:"in_last",units:"month",n:"12"}}];function mce(e){const t=my.find(n=>n.key===e);return t?ji.TemporalFilterExpression.unparse(t.clause):void 0}function PF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.TemporalFilterExpression.parse(t);if(n!==null)for(const r of my){const o=r.clause;if(o.operator===n.operator&&(o.operator==="in"&&n.operator==="in"&&n.not!==!0&&n.in.moment===o.in.moment||o.operator==="in_last"&&n.operator==="in_last"&&n.not!==!0&&n.units===o.units&&Number(n.n)===Number(o.n)))return r.key}}const gce=/^\d{4}-\d{2}-\d{2}$/;function yce(e,t){const n=Ar.utc(t,"YYYY-MM-DD").add(1,"day");return ji.TemporalFilterExpression.unparse({operator:"to",fromMoment:{moment:"literal",literal:e,units:"day"},toMoment:{moment:"literal",literal:n.format("YYYY-MM-DD"),units:"day"}})}function jF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.TemporalFilterExpression.parse(t);if(n===null||n.operator!=="to"||n.not===!0)return;const r=DD(n.fromMoment),o=DD(n.toMoment);if(r===void 0||o===void 0)return;const a=Ar.utc(o,"YYYY-MM-DD").subtract(1,"day");if(!(!a.isValid()||a.isBefore(Ar.utc(r,"YYYY-MM-DD"))))return{firstDay:r,lastDay:a.format("YYYY-MM-DD")}}function DD(e){return e.moment==="literal"&&gce.test(e.literal)?e.literal:void 0}const Gm="self";function AF(e){if(!e)return[];if(e.wasDimension&&!e.wasDimension())return[];const t=e.tag?.tag("drill");return t?(t.textArray("to")??[t.text("to")].filter(ND)).filter(ND):[]}function DF(e){const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function NF(e){return e.tag?.tag("drill")?.text("given")??e.name}function y1(e){if(typeof e=="string"){const t=m2([e]);return t===""?void 0:t}if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(e instanceof Date){const t=e.toISOString();return t.slice(0,t.indexOf("T"))}}function Zk(e){return e instanceof Date?y1(e)??"":String(e)}function vce(e){if(!e||e.isHeader)return;const t=e.field;if(!t)return;const n=AF(t);if(n.length===0)return;const r=y1(e.value);if(r!==void 0)return{to:n,given:NF(t),value:r,rawValue:e.value,label:Zk(e.value)}}function ND(e){return typeof e=="string"&&e!==""}function bce(e,t){if(t!==void 0&&!ou(t)){if(t==="number"){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;const n=Number(e);return Number.isFinite(n)?n:void 0}if(t==="date"||t==="timestamp"||t==="timestamptz")return e instanceof Date?e:void 0;if(t==="boolean")return typeof e=="boolean"?e:e==="true"?!0:e==="false"?!1:void 0;if(typeof e=="string")return e.trim()===""?void 0:e;if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(typeof e=="boolean")return String(e)}return uu(t)==="string"&&typeof e=="number"?Number.isFinite(e)?m2([String(e)]):void 0:uu(t)==="number"?typeof e=="number"?Number.isFinite(e)?String(e):void 0:typeof e!="string"||e.trim()===""?void 0:Number.isFinite(Number(e))?e.trim():void 0:y1(e)}function xce({declaredTypes:e,setGiven:t,documentName:n}){const r=g1(),o=C.useMemo(()=>{const l=new Map;for(const d of e.keys())l.has(d.toLowerCase())||l.set(d.toLowerCase(),d);return l},[e]),a=C.useCallback(l=>e.has(l)?l:o.get(l.toLowerCase()),[e,o]),i=C.useCallback(l=>a(l)!==void 0,[a]),s=C.useCallback((l,d)=>{const u=a(l);if(u===void 0){r.emit({type:"report.drill",to:"self",outcome:"unresolved"}),r.listening||console.warn(`# drill { to=self } tried to set '${l}', which '${n}' does not declare as a given. Name the given with 'given=' on the drill tag.`);return}const m=e.get(u),g=bce(d,m);if(g===void 0){r.emit({type:"report.drill",to:"self",outcome:"malformed"}),r.listening||console.warn(`Drill declined: ${JSON.stringify(d)} cannot be a value for given "${u}"`+(m?` of type ${m}`:""));return}t(u,g),r.emit({type:"report.drill",to:"self",outcome:"resolved"})},[e,n,a,t,r]);return{resolveGiven:a,canSelf:i,onSelf:s}}function IF(e,t){if(e!=null){if(e instanceof Date)return g2(e,t);if(!Array.isArray(e))return String(e)}}function wce(e,t){return new Date(Date.UTC(e.year(),e.month(),e.date(),t?.getUTCHours()??0,t?.getUTCMinutes()??0,t?.getUTCSeconds()??0,t?.getUTCMilliseconds()??0))}const Sce=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(\d{1,2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?)?\s*(Z|[+-]\d{2}:?\d{2}|[+-]\d{2}|UTC|GMT)?$/i;function LF(e){const t=e.trim();return t===""?e:t.replace(/^(\d{4}-\d{1,2}-\d{1,2}[T\s]+\d{1,2}:\d{2}(?::\d{2})?(?:\.\d{1,9})?)\s+(\d{2}:?\d{2}|\d{2})$/,"$1+$2")}function Cce(e,t=!1){const n=LF(e);if(n==="")return;const r=Sce.exec(n);if(!r)return;const[,o,a,i,s,l,d,u,m]=r,g={year:Number(o),month:Number(a),day:Number(i),hour:Number(s??0),minute:Number(l??0),second:Number(d??0),milli:Number((u??"").slice(0,3).padEnd(3,"0")||0)},y=Date.UTC(g.year,g.month-1,g.day,g.hour,g.minute,g.second,g.milli),x=new Date(y);if(!(x.getUTCFullYear()===g.year&&x.getUTCMonth()===g.month-1&&x.getUTCDate()===g.day&&x.getUTCHours()===g.hour&&x.getUTCMinutes()===g.minute&&x.getUTCSeconds()===g.second)||m!==void 0&&s===void 0)return;const w=kce(m);if(w===void 0)return;const S=new Date(y-w*6e4);if(!(t&&m!==void 0&&S.getUTCDate()!==g.day))return S}function kce(e){if(e===void 0)return 0;const t=e.toUpperCase();if(t==="Z"||t==="UTC"||t==="GMT")return 0;const n=/^([+-])(\d{2}):?(\d{2})?$/.exec(t);if(!n)return;const r=Number(n[3]??0);if(r>59)return;const o=Number(n[2])*60+r,a=n[1]!=="-";if(!(o>(a?840:720)))return a?o:-o}function zF(e){return!$ce.has(e??"")}const $ce=new Set(["boolean","number","date","timestamp","timestamptz"]);function FF(e,t){if(t===""&&!zF(e))return null;if(ou(e))return t;switch(e){case"number":{const n=t.trim()===""?NaN:Number(t);return Number.isFinite(n)?n:t}case"boolean":return t==="true"?!0:t==="false"?!1:t;case"date":case"timestamp":case"timestamptz":{const n=LF(t);return Cce(n,e==="date")??n}default:return t}}function m0(e,t){const n={};for(const[r,o]of e){const a=IF(o,t.get(r));a!==void 0&&(n[r]=a)}return n}function g2(e,t){const n=e.toISOString();switch(t){case"timestamptz":return n;case"timestamp":return n.slice(0,-1);default:return n.slice(0,10)}}function Jd(e,t,n){const r=n?new Set(n):void 0,o={};for(const[a,i]of e)r&&!r.has(a)||i!=null&&(Array.isArray(i)||(o[a]=i instanceof Date?g2(i,t.get(a)):i));return o}function y2(e,t,n){if(!t)return e;const r=n?new Set(n):void 0,o={...e};for(const[a,i]of Object.entries(t))r&&!r.has(a)||a in o||i===null||i===void 0||(o[a]=Array.isArray(i)?[...i]:i instanceof Date?g2(i,void 0):i);return o}function ID(e,t){const n=new Map;for(const[r,o]of Object.entries(e))t.has(r)&&n.set(r,FF(t.get(r),o));return n}function xC(e,t){const n=Array.from(e.keys()).filter(o=>!t.has(o));if(n.length===0)return e;const r=new Map(e);for(const o of n)r.delete(o);return r}function LD(e){return Object.entries(e??{}).sort(([t],[n])=>t<n?-1:1)}function Rce(e,t,n){for(const r of n.keys())if(e[r]!==t[r])return!1;return!0}const Tce=1500;function Pb(e,t){const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>e[r]===t[r])}function _F({declaredTypes:e,startingValues:t,params:n,onParamsChange:r,documentKey:o,autorun:a}){const i=C.useMemo(()=>ID(t??{},e),[e,JSON.stringify(t)]),s=C.useRef(null),l=C.useRef([]),d=C.useRef(0),u=C.useRef({documentKey:o,params:n}),m=B=>B!==null&&Rce(n??{},B,e),g=Date.now();l.current=l.current.filter(B=>g-B.at<Tce);const y=(s.current===null?l.current.map(B=>B.params):[...l.current.map(B=>B.params),s.current]).findIndex(m);u.current.documentKey!==o&&(l.current=[]),(u.current.documentKey!==o||!Pb(n??{},u.current.params??{})&&y<0)&&(u.current={documentKey:o,params:n}),y>0&&(l.current=l.current.slice(y));const x=u.current.params,w=JSON.stringify(t),S=JSON.stringify(x),b=C.useMemo(()=>ID({...t??{},...x??{}},e),[e,w,S]),$=C.useMemo(()=>JSON.stringify([o??null,LD(t),LD(x)]),[o,w,S]),[k,T]=C.useState(null),O=k?.key===$?k:null;C.useEffect(()=>{k!==null&&k.key!==$&&T(null)},[k,$]);const P=C.useMemo(()=>xC(O?.draft??b,e),[O,b,e]),D=C.useMemo(()=>xC(O?.applied??b,e),[O,b,e]),A=C.useCallback(B=>B?.key===$?B:{key:$,draft:b,applied:b},[$,b]),F=C.useMemo(()=>m0(D,e),[D,e]);s.current===null&&(s.current=F,d.current=Date.now()),C.useEffect(()=>{r&&(Pb(s.current??{},F)||(s.current!==null&&(l.current=[...l.current.slice(-31),{params:s.current,at:d.current}]),s.current=F,d.current=Date.now(),r(F)))},[F,r]);const L=C.useCallback((B,I)=>{T(H=>{const Y=A(H),ae=new Map(Y.draft);return I===null?ae.delete(B):ae.set(B,I),{key:Y.key,draft:ae,applied:a?ae:Y.applied}})},[a,A]),_=C.useCallback(()=>{T(B=>({key:A(B).key,draft:i,applied:i}))},[A,i]),R=C.useCallback(()=>{T(B=>{const I=A(B);return{key:I.key,draft:I.draft,applied:I.draft}})},[A]),z=C.useMemo(()=>{if(a)return!1;if(P.size!==D.size)return!0;for(const[B,I]of P){const H=D.get(B);if(I instanceof Date&&H instanceof Date){if(I.getTime()!==H.getTime())return!0}else if(Array.isArray(I)&&Array.isArray(H)){if(String(I)!==String(H))return!0}else if(I!==H)return!0}return!1},[a,P,D]),N=C.useMemo(()=>{const B=m0(xC(i,e),e);return Pb(m0(P,e),B)&&Pb(F,B)},[i,P,F,e]);return{draft:P,applied:D,setGiven:L,reset:_,apply:R,pending:z,atStart:N}}const Ece="You don't have access to this data";function $Te(e){return(e??[]).filter(t=>t.kind==="definition"&&!t.restricted).map(t=>t.text??"").join(`
349
+ export default theme;`}function RD(e){return typeof e=="number"?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}const Tse=e=>{if(!Number.isNaN(+e))return+e;const t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let r=0;r<t.length;r+=1)n+=+t[r];return n};function Ese(e){Object.assign(e,{alpha(t,n){const r=this||e;return r.colorSpace?`oklch(from ${t} l c h / ${typeof n=="string"?`calc(${n})`:n})`:r.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof n=="string"?`calc(${n})`:n})`:F0(t,Tse(n))},lighten(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #fff ${RD(n)})`:u1(t,n)},darken(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #000 ${RD(n)})`:c1(t,n)}})}function qk(e={},...t){const{breakpoints:n,mixins:r={},spacing:o,palette:a={},transitions:i={},typography:s={},shape:l,colorSpace:d,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(dc(20));const m=c2({...a,colorSpace:d}),g=u2(e);let y=xa(g,{mixins:hse(g.breakpoints,r),palette:m,shadows:xse.slice(),typography:gse(m,s),transitions:kse(i),zIndex:{...$se}});return y=xa(y,u),y=t.reduce((x,w)=>xa(x,w),y),y.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},y.unstable_sx=function(x){return Gp({sx:x,theme:this})},y.toRuntimeSource=Z4,Ese(y),y}function Hk(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const Mse=[...Array(25)].map((e,t)=>{if(t===0)return"none";const n=Hk(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function J4(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function eF(e){return e==="dark"?Mse:[]}function Ose(e){const{palette:t={mode:"light"},opacity:n,overlays:r,colorSpace:o,...a}=e,i=c2({...t,colorSpace:o});return{palette:i,opacity:{...J4(i.mode),...n},overlays:r||eF(i.mode),...a}}function Pse(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}const jse=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:""}overlays-${n}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],Ase=e=>(t,n)=>{const r=e.rootSelector||":root",o=e.colorSchemeSelector;let a=o;if(o==="class"&&(a=".%s"),o==="data"&&(a="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(a=`[${o}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const i={};return jse(e.cssVarPrefix).forEach(s=>{i[s]=n[s],delete n[s]}),a==="media"?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace("%s",t)]:i,[`${r}, ${a.replace("%s",t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!=="media")return`${r}, ${a.replace("%s",String(t))}`}else if(t){if(a==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace("%s",String(t))}return r};function Dse(e,t){t.forEach(n=>{e[n]||(e[n]={})})}function mt(e,t,n){!e[t]&&n&&(e[t]=n)}function $g(e){return typeof e!="string"||!e.startsWith("hsl")?e:W4(e)}function tc(e,t){`${t}Channel`in e||(e[`${t}Channel`]=kg($g(e[t])))}function Nse(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const al=e=>{try{return e()}catch{}},Ise=(e="mui")=>O5(e);function gC(e,t,n,r,o){if(!n)return;n=n===!0?{}:n;const a=o==="dark"?"dark":"light";if(!r){t[o]=Ose({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}const{palette:i,...s}=qk({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[o]={...n,palette:i,opacity:{...J4(a),...n?.opacity},overlays:n?.overlays||eF(a)},s}function Lse(e={},...t){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:o=!1,cssVarPrefix:a="mui",nativeColor:i=!1,shouldSkipGeneratingVar:s=Pse,colorSchemeSelector:l=n.light&&n.dark?"media":void 0,rootSelector:d=":root",...u}=e,m=Object.keys(n)[0],g=r||(n.light&&m!=="light"?"light":m),y=Ise(a),{[g]:x,light:w,dark:S,...b}=n,$={...b};let k=x;if((g==="dark"&&!("dark"in n)||g==="light"&&!("light"in n))&&(k=!0),!k)throw new Error(dc(21,g));let T;i&&(T="oklch");const O=gC(T,$,k,u,g);w&&!$.light&&gC(T,$,w,void 0,"light"),S&&!$.dark&&gC(T,$,S,void 0,"dark");let P={defaultColorScheme:g,...O,cssVarPrefix:a,colorSchemeSelector:l,rootSelector:d,getCssVar:y,colorSchemes:$,font:{...dse(O.typography),...O.font},spacing:Nse(u.spacing)};Object.keys(P.colorSchemes).forEach(_=>{const R=P.colorSchemes[_].palette,z=B=>{const I=B.split("-"),H=I[1],Y=I[2];return y(B,R[H][Y])};R.mode==="light"&&(mt(R.common,"background","#fff"),mt(R.common,"onBackground","#000")),R.mode==="dark"&&(mt(R.common,"background","#000"),mt(R.common,"onBackground","#fff"));function N(B,I,H){if(T){let Y;return B===id&&(Y=`transparent ${((1-H)*100).toFixed(0)}%`),B===Pr&&(Y=`#000 ${(H*100).toFixed(0)}%`),B===jr&&(Y=`#fff ${(H*100).toFixed(0)}%`),`color-mix(in ${T}, ${I}, ${Y})`}return B(I,H)}if(Dse(R,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),R.mode==="light"){mt(R.Alert,"errorColor",N(Pr,R.error.light,.6)),mt(R.Alert,"infoColor",N(Pr,R.info.light,.6)),mt(R.Alert,"successColor",N(Pr,R.success.light,.6)),mt(R.Alert,"warningColor",N(Pr,R.warning.light,.6)),mt(R.Alert,"errorFilledBg",z("palette-error-main")),mt(R.Alert,"infoFilledBg",z("palette-info-main")),mt(R.Alert,"successFilledBg",z("palette-success-main")),mt(R.Alert,"warningFilledBg",z("palette-warning-main")),mt(R.Alert,"errorFilledColor",al(()=>R.getContrastText(R.error.main))),mt(R.Alert,"infoFilledColor",al(()=>R.getContrastText(R.info.main))),mt(R.Alert,"successFilledColor",al(()=>R.getContrastText(R.success.main))),mt(R.Alert,"warningFilledColor",al(()=>R.getContrastText(R.warning.main))),mt(R.Alert,"errorStandardBg",N(jr,R.error.light,.9)),mt(R.Alert,"infoStandardBg",N(jr,R.info.light,.9)),mt(R.Alert,"successStandardBg",N(jr,R.success.light,.9)),mt(R.Alert,"warningStandardBg",N(jr,R.warning.light,.9)),mt(R.Alert,"errorIconColor",z("palette-error-main")),mt(R.Alert,"infoIconColor",z("palette-info-main")),mt(R.Alert,"successIconColor",z("palette-success-main")),mt(R.Alert,"warningIconColor",z("palette-warning-main")),mt(R.AppBar,"defaultBg",z("palette-grey-100")),mt(R.Avatar,"defaultBg",z("palette-grey-400")),mt(R.Button,"inheritContainedBg",z("palette-grey-300")),mt(R.Button,"inheritContainedHoverBg",z("palette-grey-A100")),mt(R.Chip,"defaultBorder",z("palette-grey-400")),mt(R.Chip,"defaultAvatarColor",z("palette-grey-700")),mt(R.Chip,"defaultIconColor",z("palette-grey-700")),mt(R.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),mt(R.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),mt(R.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),mt(R.LinearProgress,"primaryBg",N(jr,R.primary.main,.62)),mt(R.LinearProgress,"secondaryBg",N(jr,R.secondary.main,.62)),mt(R.LinearProgress,"errorBg",N(jr,R.error.main,.62)),mt(R.LinearProgress,"infoBg",N(jr,R.info.main,.62)),mt(R.LinearProgress,"successBg",N(jr,R.success.main,.62)),mt(R.LinearProgress,"warningBg",N(jr,R.warning.main,.62)),mt(R.Skeleton,"bg",T?N(id,R.text.primary,.11):`rgba(${z("palette-text-primaryChannel")} / 0.11)`),mt(R.Slider,"primaryTrack",N(jr,R.primary.main,.62)),mt(R.Slider,"secondaryTrack",N(jr,R.secondary.main,.62)),mt(R.Slider,"errorTrack",N(jr,R.error.main,.62)),mt(R.Slider,"infoTrack",N(jr,R.info.main,.62)),mt(R.Slider,"successTrack",N(jr,R.success.main,.62)),mt(R.Slider,"warningTrack",N(jr,R.warning.main,.62));const B=T?N(Pr,R.background.default,.6825):Ob(R.background.default,.8);mt(R.SnackbarContent,"bg",B),mt(R.SnackbarContent,"color",al(()=>T?Uk.text.primary:R.getContrastText(B))),mt(R.SpeedDialAction,"fabHoverBg",Ob(R.background.paper,.15)),mt(R.StepConnector,"border",z("palette-grey-400")),mt(R.StepContent,"border",z("palette-grey-400")),mt(R.Switch,"defaultColor",z("palette-common-white")),mt(R.Switch,"defaultDisabledColor",z("palette-grey-100")),mt(R.Switch,"primaryDisabledColor",N(jr,R.primary.main,.62)),mt(R.Switch,"secondaryDisabledColor",N(jr,R.secondary.main,.62)),mt(R.Switch,"errorDisabledColor",N(jr,R.error.main,.62)),mt(R.Switch,"infoDisabledColor",N(jr,R.info.main,.62)),mt(R.Switch,"successDisabledColor",N(jr,R.success.main,.62)),mt(R.Switch,"warningDisabledColor",N(jr,R.warning.main,.62)),mt(R.TableCell,"border",N(jr,N(id,R.divider,1),.88)),mt(R.Tooltip,"bg",N(id,R.grey[700],.92))}if(R.mode==="dark"){mt(R.Alert,"errorColor",N(jr,R.error.light,.6)),mt(R.Alert,"infoColor",N(jr,R.info.light,.6)),mt(R.Alert,"successColor",N(jr,R.success.light,.6)),mt(R.Alert,"warningColor",N(jr,R.warning.light,.6)),mt(R.Alert,"errorFilledBg",z("palette-error-dark")),mt(R.Alert,"infoFilledBg",z("palette-info-dark")),mt(R.Alert,"successFilledBg",z("palette-success-dark")),mt(R.Alert,"warningFilledBg",z("palette-warning-dark")),mt(R.Alert,"errorFilledColor",al(()=>R.getContrastText(R.error.dark))),mt(R.Alert,"infoFilledColor",al(()=>R.getContrastText(R.info.dark))),mt(R.Alert,"successFilledColor",al(()=>R.getContrastText(R.success.dark))),mt(R.Alert,"warningFilledColor",al(()=>R.getContrastText(R.warning.dark))),mt(R.Alert,"errorStandardBg",N(Pr,R.error.light,.9)),mt(R.Alert,"infoStandardBg",N(Pr,R.info.light,.9)),mt(R.Alert,"successStandardBg",N(Pr,R.success.light,.9)),mt(R.Alert,"warningStandardBg",N(Pr,R.warning.light,.9)),mt(R.Alert,"errorIconColor",z("palette-error-main")),mt(R.Alert,"infoIconColor",z("palette-info-main")),mt(R.Alert,"successIconColor",z("palette-success-main")),mt(R.Alert,"warningIconColor",z("palette-warning-main")),mt(R.AppBar,"defaultBg",z("palette-grey-900")),mt(R.AppBar,"darkBg",z("palette-background-paper")),mt(R.AppBar,"darkColor",z("palette-text-primary")),mt(R.Avatar,"defaultBg",z("palette-grey-600")),mt(R.Button,"inheritContainedBg",z("palette-grey-800")),mt(R.Button,"inheritContainedHoverBg",z("palette-grey-700")),mt(R.Chip,"defaultBorder",z("palette-grey-700")),mt(R.Chip,"defaultAvatarColor",z("palette-grey-300")),mt(R.Chip,"defaultIconColor",z("palette-grey-300")),mt(R.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),mt(R.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),mt(R.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),mt(R.LinearProgress,"primaryBg",N(Pr,R.primary.main,.5)),mt(R.LinearProgress,"secondaryBg",N(Pr,R.secondary.main,.5)),mt(R.LinearProgress,"errorBg",N(Pr,R.error.main,.5)),mt(R.LinearProgress,"infoBg",N(Pr,R.info.main,.5)),mt(R.LinearProgress,"successBg",N(Pr,R.success.main,.5)),mt(R.LinearProgress,"warningBg",N(Pr,R.warning.main,.5)),mt(R.Skeleton,"bg",T?N(id,R.text.primary,.13):`rgba(${z("palette-text-primaryChannel")} / 0.13)`),mt(R.Slider,"primaryTrack",N(Pr,R.primary.main,.5)),mt(R.Slider,"secondaryTrack",N(Pr,R.secondary.main,.5)),mt(R.Slider,"errorTrack",N(Pr,R.error.main,.5)),mt(R.Slider,"infoTrack",N(Pr,R.info.main,.5)),mt(R.Slider,"successTrack",N(Pr,R.success.main,.5)),mt(R.Slider,"warningTrack",N(Pr,R.warning.main,.5));const B=T?N(jr,R.background.default,.985):Ob(R.background.default,.98);mt(R.SnackbarContent,"bg",B),mt(R.SnackbarContent,"color",al(()=>T?G4.text.primary:R.getContrastText(B))),mt(R.SpeedDialAction,"fabHoverBg",Ob(R.background.paper,.15)),mt(R.StepConnector,"border",z("palette-grey-600")),mt(R.StepContent,"border",z("palette-grey-600")),mt(R.Switch,"defaultColor",z("palette-grey-300")),mt(R.Switch,"defaultDisabledColor",z("palette-grey-600")),mt(R.Switch,"primaryDisabledColor",N(Pr,R.primary.main,.55)),mt(R.Switch,"secondaryDisabledColor",N(Pr,R.secondary.main,.55)),mt(R.Switch,"errorDisabledColor",N(Pr,R.error.main,.55)),mt(R.Switch,"infoDisabledColor",N(Pr,R.info.main,.55)),mt(R.Switch,"successDisabledColor",N(Pr,R.success.main,.55)),mt(R.Switch,"warningDisabledColor",N(Pr,R.warning.main,.55)),mt(R.TableCell,"border",N(Pr,N(id,R.divider,1),.68)),mt(R.Tooltip,"bg",N(id,R.grey[700],.92))}tc(R.background,"default"),tc(R.background,"paper"),tc(R.common,"background"),tc(R.common,"onBackground"),tc(R,"divider"),Object.keys(R).forEach(B=>{const I=R[B];B!=="tonalOffset"&&I&&typeof I=="object"&&(I.main&&mt(R[B],"mainChannel",kg($g(I.main))),I.light&&mt(R[B],"lightChannel",kg($g(I.light))),I.dark&&mt(R[B],"darkChannel",kg($g(I.dark))),I.contrastText&&mt(R[B],"contrastTextChannel",kg($g(I.contrastText))),B==="text"&&(tc(R[B],"primary"),tc(R[B],"secondary")),B==="action"&&(I.active&&tc(R[B],"active"),I.selected&&tc(R[B],"selected")))})}),P=t.reduce((_,R)=>xa(_,R),P);const D={prefix:a,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:Ase(P),enableContrastVars:i},{vars:A,generateThemeVars:F,generateStyleSheets:L}=use(P,D);return P.vars=A,Object.entries(P.colorSchemes[P.defaultColorScheme]).forEach(([_,R])=>{P[_]=R}),P.generateThemeVars=F,P.generateStyleSheets=L,P.generateSpacing=function(){return rR(u.spacing,i2(this))},P.getColorSchemeSelector=fse(l),P.spacing=P.generateSpacing(),P.shouldSkipGeneratingVar=s,P.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},P.unstable_sx=function(_){return Gp({sx:_,theme:this})},P.toRuntimeSource=Z4,P}function TD(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:c2({...n===!0?{}:n.palette,mode:t})})}function tF(e={},...t){const{palette:n,cssVariables:r=!1,colorSchemes:o=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...i}=e,s=a||"light",l=o?.[s],d={...o,...n?{[s]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in e))return qk(e,...t);let u=n;"palette"in e||d[s]&&(d[s]!==!0?u=d[s].palette:s==="dark"&&(u={mode:"dark"}));const m=qk({...e,palette:u},...t);return m.defaultColorScheme=s,m.colorSchemes=d,m.palette.mode==="light"&&(m.colorSchemes.light={...d.light!==!0&&d.light,palette:m.palette},TD(m,"dark",d.dark)),m.palette.mode==="dark"&&(m.colorSchemes.dark={...d.dark!==!0&&d.dark,palette:m.palette},TD(m,"light",d.light)),m}return!n&&!("light"in d)&&s==="light"&&(d.light=!0),Lse({...i,colorSchemes:d,defaultColorScheme:s,...typeof r!="boolean"&&r},...t)}const d1=tF(),bh="$$material";function Xd(){const e=fh(d1);return e[bh]||e}function zse(e){return p.jsx(aR,{...e,defaultTheme:d1,themeId:bh})}function Fse(e){const{variants:t,...n}=e,r={variants:t,style:Ed(n),isProcessed:!0};return r.style===n||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Ed(o.style))}),r}const _se=u2();function yC(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Cd(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Bse(e){return e?(t,n)=>n[e]:null}function Use(e,t,n){e.theme=Hse(e.theme)?n:e.theme[t]||e.theme}function f0(e,t,n){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(o=>f0(e,o,n));if(Array.isArray(r?.variants)){let o;if(r.isProcessed)o=n?Cd(r.style,n):r.style;else{const{variants:a,...i}=r;o=n?Cd(Ed(i),n):i}return nF(e,r.variants,[o],n)}return r?.isProcessed?n?Cd(Ed(r.style),n):r.style:n?Cd(Ed(r),n):r}function nF(e,t,n=[],r=void 0){let o;e:for(let a=0;a<t.length;a+=1){const i=t[a];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const s in i.props)if(e[s]!==i.props[s]&&e.ownerState?.[s]!==i.props[s])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},n.push(r?Cd(Ed(i.style(o)),r):i.style(o))):n.push(r?Cd(Ed(i.style),r):i.style)}return n}function qse(e={}){const{themeId:t,defaultTheme:n=_se,rootShouldForwardProp:r=yC,slotShouldForwardProp:o=yC}=e;function a(i){Use(i,t,n)}return(i,s={})=>{Yie(i,O=>O.filter(P=>P!==Gp));const{name:l,slot:d,skipVariantsResolver:u,skipSx:m,overridesResolver:g=Bse(Wse(d)),...y}=s,x=l&&l.startsWith("Mui")||d?"components":"custom",w=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,S=m||!1;let b=yC;d==="Root"||d==="root"?b=r:d?b=o:Vse(i)&&(b=void 0);const $=Wie(i,{shouldForwardProp:b,label:void 0,...y}),k=O=>{if(O.__emotion_real===O)return O;if(typeof O=="function")return function(P){return f0(P,O,P.theme.modularCssLayers?x:void 0)};if(pl(O)){const P=Fse(O);return function(D){return P.variants?f0(D,P,D.theme.modularCssLayers?x:void 0):D.theme.modularCssLayers?Cd(P.style,x):P.style}}return O},T=(...O)=>{const P=[],D=O.map(k),A=[];if(P.push(a),l&&g&&A.push(function(_){const R=_.theme.components?.[l]?.styleOverrides;if(!R)return null;const z={};for(const N in R)z[N]=f0(_,R[N],_.theme.modularCssLayers?"theme":void 0);return g(_,z)}),l&&!w&&A.push(function(_){const R=_.theme?.components?.[l]?.variants;return R?nF(_,R,[],_.theme.modularCssLayers?"theme":void 0):null}),S||A.push(Gp),Array.isArray(D[0])){const _=D.shift(),R=new Array(P.length).fill(""),z=new Array(A.length).fill("");let N;N=[...R,..._,...z],N.raw=[...R,..._.raw,...z],P.unshift(N)}const F=[...P,...D,...A],L=$(...F);return i.muiName&&(L.muiName=i.muiName),L};return $.withConfig&&(T.withConfig=$.withConfig),T}}function Hse(e){for(const t in e)return!1;return!0}function Vse(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Wse(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function rF(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const ei=e=>rF(e)&&e!=="classes",nt=qse({themeId:bh,defaultTheme:d1,rootShouldForwardProp:ei});function Yse(e){return function(t){return p.jsx(zse,{styles:typeof e=="function"?n=>e({theme:n,...t}):e})}}function Gse(){return Rie}const Gn=E5;function Kn(e){return Zie(e)}function fn(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=Cn(e,o,n)}),r}function Kse(e){return Cn("MuiSvgIcon",e)}fn("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Qse=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${Tt(t)}`,`fontSize${Tt(n)}`]};return bn(o,Kse,r)},Xse=nt("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${Tt(n.color)}`],t[`fontSize${Tt(n.fontSize)}`]]}})(Gn(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),B0=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiSvgIcon"}),{children:r,className:o,color:a="inherit",component:i="svg",fontSize:s="medium",htmlColor:l,inheritViewBox:d=!1,titleAccess:u,viewBox:m="0 0 24 24",...g}=n,y=C.isValidElement(r)&&r.type==="svg",x={...n,color:a,component:i,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:m,hasSvgAsChild:y},w={};d||(w.viewBox=m);const S=Qse(x);return p.jsxs(Xse,{as:i,className:Ht(S.root,o),focusable:"false",color:l,"aria-hidden":u?void 0:!0,role:u?"img":void 0,ref:t,...w,...g,...y&&r.props,ownerState:x,children:[y?r.props.children:r,u?p.jsx("title",{children:u}):null]})});B0.muiName="SvgIcon";function Jt(e,t){function n(r,o){return p.jsx(B0,{"data-testid":void 0,ref:o,...r,children:e})}return n.muiName=B0.muiName,C.memo(C.forwardRef(n))}function oF(e,t=166){let n;function r(...o){const a=()=>{e.apply(this,o)};clearTimeout(n),n=setTimeout(a,t)}return r.clear=()=>{clearTimeout(n)},r}function p0(e,t){return C.isValidElement(e)&&t.indexOf(e.type.muiName??e.type?._payload?.value?.muiName)!==-1}function Yo(e){return e&&e.ownerDocument||document}function pc(e){return Yo(e).defaultView||window}function Vk(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ti(e){const{controlled:t,default:n,name:r,state:o="value"}=e,{current:a}=C.useRef(t!==void 0),[i,s]=C.useState(n),l=a?t:i,d=C.useCallback(u=>{a||s(u)},[]);return[l,d]}function Yt(e){const t=C.useRef(e);return Go(()=>{t.current=e}),C.useRef((...n)=>(0,t.current)(...n)).current}function vr(...e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(a=>{if(a==null)return null;if(typeof a=="function"){const i=a,s=i(r);return typeof s=="function"?s:()=>{i(null)}}return a.current=r,()=>{a.current=null}});return()=>{o.forEach(a=>a?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}function Zse(e,t){const n=e.charCodeAt(2);return e[0]==="o"&&e[1]==="n"&&n>=65&&n<=90&&typeof t=="function"}function aF(e,t){if(!e)return t;function n(i,s){const l={};return Object.keys(s).forEach(d=>{Zse(d,s[d])&&typeof i[d]=="function"&&(l[d]=(...u)=>{i[d](...u),s[d](...u)})}),l}if(typeof e=="function"||typeof t=="function")return i=>{const s=typeof t=="function"?t(i):t,l=typeof e=="function"?e({...i,...s}):e,d=Ht(i?.className,s?.className,l?.className),u=n(l,s);return{...s,...l,...u,...!!d&&{className:d},...s?.style&&l?.style&&{style:{...s.style,...l.style}},...s?.sx&&l?.sx&&{sx:[...Array.isArray(s.sx)?s.sx:[s.sx],...Array.isArray(l.sx)?l.sx:[l.sx]]}}};const r=t,o=n(e,r),a=Ht(r?.className,e?.className);return{...t,...e,...o,...!!a&&{className:a},...r?.style&&e?.style&&{style:{...r.style,...e.style}},...r?.sx&&e?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}const f1=Jt(p.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),Jse=2,ele=24,Z2e=(e,t,n)=>Math.min(Math.max(e+t,1),Math.min(n,ele)),vl=16,J2e=vl/2;function tle(e,t){const n=Math.min(e.colspan??1,t);return e.break?`1 / span ${n}`:`span ${n}`}const d2=80,nle=3,eTe=2,tTe=1,rle=16,iF=e=>e*d2+(e-1)*vl,nTe=(e,t=nle)=>Math.min(Math.max(Math.round((e+vl)/(d2+vl)),t),rle),sF=240;function rTe(e,t,n=sF){const[r,o]=C.useState(0);return C.useEffect(()=>{const a=e.current;if(!a||typeof ResizeObserver>"u")return;o(a.getBoundingClientRect().width);const i=new ResizeObserver(([s])=>o(s?.contentRect.width??0));return i.observe(a),()=>i.disconnect()},[e]),lF(t,r,n)}function lF(e,t,n){if(!(t>0)||e<=1)return 1;const r=(t-(e-1)*vl)/e;return Math.min(e,Math.max(1,Math.ceil((n+vl)/(r+vl))))}const cF={query:5,text:2},uF=e=>e.some(t=>t.row!==void 0);function ole(e,t,n){const r=Math.min(e.colspan??1,t),o=e.col===void 0?void 0:Math.min(e.col,t-r+1);return{gridRow:e.row===void 0?`span ${n}`:`${e.row} / span ${n}`,gridColumn:o===void 0?`span ${r}`:`${o} / span ${r}`}}const ale=e=>e.row===void 0?1e6:e.row*1e3+(e.col??0);function ile({tiles:e,columns:t,keyOf:n,renderTile:r,minTilePx:o,rowGapPx:a=vl,defaultRowspan:i=s=>cF[s.kind==="text"?"text":"query"]}){const s=uF(e),l=C.useRef(null),[d,u]=C.useState(0);C.useEffect(()=>{const g=l.current;if(o===void 0||!g||typeof ResizeObserver>"u")return;const y=new ResizeObserver(([x])=>u(x?.contentRect.width??0));return y.observe(g),()=>y.disconnect()},[o]);const m=o===void 0?1:lF(t,d,o);return p.jsx(Te,{ref:l,sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:`repeat(${t}, minmax(0, 1fr))`},columnGap:`${vl}px`,rowGap:`${a}px`,...s&&{gridAutoRows:`${d2}px`}},children:e.map((g,y)=>p.jsx(Te,{sx:{display:"grid",minWidth:0,...!s&&g.rowspan!==void 0&&{height:iF(g.rowspan),alignSelf:"start"},...(s||g.rowspan!==void 0)&&{gridTemplateRows:"minmax(0, 1fr)"},...s?(()=>{const x=g.rowspan??i(g),w=ole(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t,x);return{gridRow:{xs:`span ${x}`,md:w.gridRow},gridColumn:{md:w.gridColumn},order:{xs:ale(g),md:0}}})():{gridColumn:{md:tle(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t)}}},children:r(g,y)},n(g,y)))})}function p1(e){let t="",n=0;for(;;){const r=e.indexOf('"',n);if(r<0)break;let o=r+1;for(;o<e.length&&e[o]!=='"';)o+=e[o]==="\\"?2:1;if(o>=e.length)break;t+=`${e.slice(n,r)}""`,n=o+1}return t+e.slice(n)}const dF=["bar_chart","line_chart","scatter_chart","shape_map","segment_map","big_value","sparkline","combo_chart"],f2=["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map","combo_chart"],sle=e=>f2.includes(e),Wk=new Set([...dF,"viz"]);function h1(e){const t=e.trim();if(!/^#[ \t]/.test(t)||/[{=]/.test(t))return;const n=t.slice(1).trim().split(/[ \t]+/),r=[];let o;for(const a of n)if(a.startsWith("-")){if(o!==void 0)return;const i=a.slice(1);if(!Wk.has(i))return;r.push(i)}else{if(o!==void 0||!Wk.has(a))return;o=a}return{negated:r,...o!==void 0&&{pick:o}}}function fF(e){const t=e.trim();return!/^#[ \t]/.test(t)||h1(t)?!1:(p1(t).match(/[A-Za-z_]+/g)??[]).some(n=>Wk.has(n))}function oTe(){return["#",...f2.filter(e=>e!=="big_value").map(e=>`-${e}`)].join(" ")}function aTe(e,t){return["#",...f2.filter(n=>n!==e&&(t===void 0||t.includes(n)||e==="none"&&n==="big_value")).map(n=>`-${n}`),"-viz",...e==="none"?[]:[e]].join(" ")}function lle(e){return e.pick!==void 0?sle(e.pick)?e.pick:"custom":e.negated.includes("viz")?"none":"custom"}function cle(e){if(e.length===0)return"default";if(e.length>1)return"custom";const t=h1(e[0]);return t?lle(t):"custom"}function iTe(e){const t=e.filter(n=>h1(n));return e.some(fF)?"custom":t.length===0?void 0:cle(t)}const ule=/^#[ \t]*theme\.palette\.series[ \t]*=[ \t]*\[[ \t]*"(#[0-9A-Fa-f]{6})"[ \t]*\][ \t]*$/;function sTe(e){return ule.exec(e.trim())?.[1]?.toLowerCase()}const lTe=e=>`# theme.palette.series=["${e.toLowerCase()}"]`,cTe="# -theme.palette.series",dle=e=>/^#[0-9A-Fa-f]{6}$/.test(e);function uTe(e){const t=e.trim().toLowerCase();if(dle(t))return t;const n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return n?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:void 0}const dTe=e=>e.filter(t=>h1(t)||fF(t)),xh=Jt(p.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function Oo({open:e,onClose:t,title:n,description:r,maxWidth:o="sm",showClose:a=!1,actions:i,initialFocus:s,className:l,children:d}){const u=C.useId(),m=Vr().theme.ui;return p.jsxs(zx,{open:e,onClose:t,maxWidth:o,fullWidth:!0,"aria-labelledby":u,...l?{className:l}:{},PaperProps:{sx:{borderRadius:m.radius.dialog}},...s?{TransitionProps:{onEntered:()=>s.current?.focus()}}:{},children:[p.jsxs(_x,{id:u,sx:{px:3,pt:3,pb:r?.5:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,fontSize:"1.25rem",fontWeight:"fontWeightMedium",letterSpacing:"-0.025em",lineHeight:1.2},children:[n,a&&p.jsx(ro,{"aria-label":"Close",onClick:t,size:"small",sx:{color:"text.secondary",mr:-1},children:p.jsx(xh,{fontSize:"small"})})]}),p.jsxs(Fx,{sx:{px:3,pb:1,pt:1},children:[r&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:2},children:r}),p.jsx(Yn,{sx:{gap:2,pt:r?0:1},children:d})]}),i&&p.jsx(pz,{sx:{px:3,pb:3,pt:2,gap:1},children:i})]})}function fTe({open:e,canSave:t,onKeepEditing:n,onDiscard:r,onSaveAndExit:o}){return p.jsx(Oo,{open:e,onClose:n,title:"Leave with unsaved changes?",description:t&&o?"Your edits have not been saved. Save them, or leave without them.":"Leaving now discards your unsaved edits.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{onClick:n,children:"Keep editing"}),p.jsx(Vn,{color:"error",onClick:r,children:"Discard changes"}),t&&o&&p.jsx(Vn,{variant:"contained",onClick:o,children:"Save and exit"})]}),children:null})}const pF=Jt(p.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));function Qy({label:e,onClick:t,disabled:n}){return p.jsx(Vn,{variant:"contained",color:"primary",startIcon:p.jsx(f1,{}),onClick:t,disabled:n,"aria-label":`Add ${e.toLowerCase()}`,sx:{whiteSpace:"nowrap"},children:e})}function Xy({label:e,icon:t,onClick:n,disabled:r,disabledReason:o,ariaLabel:a,ariaHasPopup:i}){const s=p.jsx("span",{children:p.jsx(Vn,{variant:"outlined",startIcon:t,onClick:n,disabled:r,"aria-label":a,"aria-haspopup":i,sx:{whiteSpace:"nowrap"},children:e})});return r&&o?p.jsx(Br,{title:o,children:s}):s}const hF=Jt(p.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),Zy="120ms",Jy={"@media (prefers-reduced-motion: reduce)":{transition:"none",animation:"none"}},pTe=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",fle={"@media (hover: none)":{opacity:1}},hTe=e=>e.palette.mode==="dark"?e.palette.error.main:e.palette.error.dark;wi.size.control;wi.size.chip;wi.radius.control;wi.radius.tile;wi.radius.dialog;wi.type;const ple="72ch",Zd=e=>e.replace(/^1px solid /,""),mF=(e,t)=>`color-mix(in srgb, ${Zd(e)}, ${t} 25%)`,m1={line_chart:"A line chart",bar_chart:"A bar chart",scatter_chart:"A scatter chart",combo_chart:"A bar and line chart"},hle={line:"line_chart",bar:"bar_chart",scatter:"scatter_chart",combo:"combo_chart"},mle=new Set(["x","y","y2","series"]);function Yk(e){const t=e.trim();return!t.startsWith("#")||t.startsWith("#(")||t.startsWith('#"')?[]:p1(t.slice(1)).split(/[\s{}[\],]+/).filter(Boolean)}function gF(e){const t=[];let n;for(const r of e)for(const o of Yk(r))if(o.startsWith("-")){const a=o.slice(1);a==="viz"&&(n=void 0);const i=t.indexOf(a);i>=0&&t.splice(i,1)}else if(o.startsWith("viz="))n=hle[o.slice(4)]??o;else if(m1[o]!==void 0||o==="big_value"){const a=t.indexOf(o);a>=0&&t.splice(a,1),t.push(o)}return n??t.at(-1)}function mTe(e){const t=gF(e);return t!==void 0&&m1[t]!==void 0}function gle(e,{groupBys:t,totals:n}){if(m1[e]!==void 0){if(e==="scatter_chart")return t===0&&n<2?"no_x_axis":void 0;if(t===0)return"no_x_axis";if(e==="combo_chart")return n===2?void 0:"combo_totals";if(n===0)return"no_y_axis"}}function yle(e){const t=e.trim();if(!t.startsWith("#(malloy)"))return!1;const n=p1(t.slice(9));let r="",o=0;for(const i of n)i==="{"||i==="["?o++:i==="}"||i==="]"?o=Math.max(0,o-1):o===0&&(r+=i==="="?" = ":i);const a=r.split(/\s+/);return a.some((i,s)=>i==="calculation"&&a[s-1]!=="=")}const Gk=e=>e!==void 0&&(e.kind==="measure"||(e.annotations??[]).some(t=>yle(t?.value??""))),vle=e=>e.kind==="join"||e.type?.kind==="array_type";function ble(e){const t=e.filter(Gk).length;return{groupBys:e.filter(n=>!Gk(n)&&!vle(n)).length,totals:t}}const ED=e=>mle.has(e.split("=")[0]);function xle(e){if(!e)return;let t;try{t=JSON.parse(e)}catch{return}const n=t?.schema?.fields;if(!Array.isArray(n)||n.length===0)return;const r=(t.annotations??[]).map(l=>l?.value).filter(l=>typeof l=="string"),o=gF(r),a=o&&m1[o];if(!o||!a||r.some(l=>Yk(l).some(ED))||n.some(l=>(l.annotations??[]).some(d=>Yk(d.value??"").some(ED))))return;const{groupBys:i,totals:s}=ble(n);switch(gle(o,{groupBys:i,totals:s})){case"no_x_axis":return`This chart has no field for the x-axis. ${a} needs a group by, such as a date or a category. Show it as big numbers or a table instead, or add a group by to its query.`;case"combo_totals":return`${a} needs exactly two totals, the first drawn as bars and the second as a line. This one has ${s}.`;case"no_y_axis":return`This chart has no total for the y-axis. ${a} needs at least one aggregate, such as a count or a sum.`;default:return}}const wle=Jt(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),Sle=Jt(p.jsx("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z"})),Cle=Jt(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),kle=Jt([p.jsx("circle",{cx:"7",cy:"14",r:"3"},"0"),p.jsx("circle",{cx:"11",cy:"6",r:"3"},"1"),p.jsx("circle",{cx:"16.6",cy:"17.6",r:"3"},"2")]),Kp=Jt(p.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),$le=Jt(p.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"})),Rle=Jt(p.jsx("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2M3 19c0 1.1.9 2 2 2h3V10H3z"}));function vC(e){const t=e.replace(/_+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function Tle({chart:e}){const t={fontSize:16};switch(e){case"bar_chart":case"combo_chart":return p.jsx(wle,{sx:t});case"line_chart":case"sparkline":return p.jsx($le,{sx:t});case"scatter_chart":return p.jsx(kle,{sx:t});case"shape_map":case"segment_map":return p.jsx(Sle,{sx:t});case"big_value":return p.jsx(Cle,{sx:t});default:return p.jsx(Rle,{sx:t})}}function Ele({groups:e,query:t,onQuery:n,picked:r,onPick:o,onTake:a,searchRef:i,empty:s,footer:l,disabled:d=!1}){const{theme:u}=Vr(),m=u.ui,g=C.useId(),y=t.trim().toLowerCase(),x=C.useMemo(()=>e.map(O=>({...O,entries:O.entries.filter(P=>y===""||[P.name,P.title,O.label,O.detail??""].join(" ").toLowerCase().includes(y))})).filter(O=>O.entries.length>0),[e,y]),w=x.flatMap(O=>O.entries),S=C.useMemo(()=>new Map(e.flatMap(O=>O.entries).map((O,P)=>[O.key,`${g}-${P}`])),[e,g]),b=O=>S.get(O)??`${g}-none`,$=w.some(O=>O.key===r)?r:void 0,k=O=>{o(O),window.requestAnimationFrame(()=>window.document.getElementById(b(O))?.scrollIntoView({block:"nearest"}))},T=O=>{if(w.length===0)return;const P=w.findIndex(A=>A.key===$),D=P===-1?O===1?0:w.length-1:Math.min(w.length-1,Math.max(0,P+O));k(w[D].key)};return p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",minHeight:0,flex:1},children:[p.jsx(Te,{sx:{p:1.5,pb:1},children:p.jsx(Ri,{size:"small",fullWidth:!0,inputRef:i,placeholder:"Search the model",value:t,disabled:d,onChange:O=>n(O.target.value),onKeyDown:O=>{if(O.key==="ArrowDown")O.preventDefault(),T(1);else if(O.key==="ArrowUp")O.preventDefault(),T(-1);else if(O.key==="Enter"){const P=$??w[0]?.key;if(P===void 0)return;O.preventDefault(),a(P)}},inputProps:{"aria-label":"Search the model",role:"combobox","aria-controls":g,"aria-expanded":!0,...$!==void 0?{"aria-activedescendant":b($)}:{}},InputProps:{startAdornment:p.jsx(PR,{position:"start",children:p.jsx(Kp,{sx:{fontSize:18,color:"text.secondary"}})})}})}),p.jsxs(Te,{id:g,role:"listbox","aria-label":"From the model",sx:{overflowY:"auto",flex:1,minHeight:0,pb:1},children:[e.length===0&&s,e.length>0&&x.length===0&&p.jsxs(wt,{variant:"body2",sx:{color:u.tileTitle,px:2,py:1},children:["No view matches “",t.trim(),"”."]}),x.map(O=>p.jsxs(Te,{role:"group","aria-label":O.ariaLabel??O.label,children:[p.jsxs(Te,{"aria-hidden":!0,sx:{px:2,pt:1.25,pb:.5,...m.type.caption,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[p.jsx(Te,{component:"span",sx:{...m.type.label,fontSize:"0.92em",letterSpacing:"0.04em",textTransform:"uppercase"},children:O.label.replace(/_+/g," ")}),O.detail&&` · ${O.detail}`]}),O.entries.map(P=>{const D=P.key===r;return p.jsxs(Te,{id:b(P.key),role:"option","aria-selected":D,"aria-label":`${P.title} (${P.name})`,onClick:()=>{d||k(P.key)},onDoubleClick:()=>{d||a(P.key)},sx:A=>({display:"flex",alignItems:"center",gap:1.25,mx:.75,px:1.25,py:.75,borderRadius:m.radius.control,cursor:d?"default":"pointer",bgcolor:D?`color-mix(in srgb, ${u.accent} 9%, ${A.palette.background.paper})`:"transparent","&:hover":D||d?{}:{bgcolor:A.palette.action.hover}}),children:[p.jsx(Te,{"aria-hidden":!0,sx:A=>({width:26,height:26,flex:"none",borderRadius:m.radius.control,display:"flex",alignItems:"center",justifyContent:"center",color:D?u.accent:A.palette.text.secondary,bgcolor:D?A.palette.background.paper:A.palette.action.hover,boxShadow:D?`inset 0 0 0 1px color-mix(in srgb, ${u.accent} 35%, transparent)`:"none"}),children:p.jsx(Tle,{chart:P.chart})}),p.jsxs(Te,{sx:{minWidth:0},children:[p.jsx(Te,{sx:{...m.type.control,fontWeight:D?m.type.label.fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:P.title}),p.jsx(Te,{sx:{...m.type.code,color:"text.secondary"},children:P.name})]})]},P.key)})]},O.key)),y===""&&l]})]})}const Mle=new Set(["bar","line","chart","scatter_chart","combo"]),Ole=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function gTe(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":Mle.has(e)?"container":"content"}function yTe(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&Ole.has(e)}function vTe(e){return e==="dashboard"?3:2}function Ple(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function bTe(e,t){const n=Ple(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const yF=400,jle=700,Ale=700;function Dle({renderAs:e,maxHeight:t,tableMaxHeight:n}){return e!=="table"||n===void 0?t:t===void 0?n:Math.min(t,n)}const Nle=600,Ile=800,Lle=400,zle=2e3;function Fle(e,t){const n=t??zle;return e===void 0?n:Math.min(e,n)}function MD({sizing:e,contentHeight:t,maxHeight:n,fillHeight:r,firstPaintHeight:o}){if(e==="container"){const i=n??Lle;return r!==void 0&&r>0?Math.min(i,r):i}if(t===void 0||t<=0)return Fle(n,o);const a=n===void 0?t:Math.min(n,t);return r===void 0?a:Math.max(a,r)}const _le="data-publisher-tight",Ble="publisher-result-scroller";function Ule(e,t,n=1){return e===1&&t<=2&&n===1?void 0:e}function xTe(e,t,n,r=1){const o={...e},a=Ule(t,n,r);return a===void 0?delete o.colspan:o.colspan=a,o}function qle(e,t){if(e==="linear")return{layout:"linear",columns:1,widths:!1,insertBetween:!0,tileMaxHeight:void 0,tableMaxHeight:Ale};const n=t??Jse;return{layout:"grid",columns:n,widths:n>1,insertBetween:!1,tileMaxHeight:yF,tableMaxHeight:void 0}}const vF="document.malloy",bF=e=>e.slice(0,e.lastIndexOf("/")+1),xF=(e,t)=>new URL(e,`https://malloy.invalid/${bF(t)}`).pathname.slice(1);function wF(e,t){const n=bF(t).split("/").filter(Boolean),r=e.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const a=n.length-o;return`${"../".repeat(a)}${r.slice(o).join("/")}`}function Hle(e,t,n,r=vF,o=[n]){return e.sources.some(a=>a.base===t)?!0:e.imports.some(a=>a.kind==="names"?a.names.includes(t):o.includes(xF(a.from,r)))}function wTe(e,t,n,r=vF,o=[n]){const{imports:a}=e;if(Hle(e,t,n,r,o))return a;const i=a.findIndex(s=>s.kind==="names"&&o.includes(xF(s.from,r)));return i<0?[...a,{kind:"names",names:[t],from:wF(n,r)}]:a.map((s,l)=>l===i&&s.kind==="names"?{...s,names:[...s.names,t]}:s)}const SF=Jt(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"})),Vle=Jt(p.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m-5.5-2.5 7.51-3.49L17.5 6.5 9.99 9.99zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1"})),Wle=600,OD=()=>typeof IntersectionObserver>"u";function Yle(e){for(let t=e.parentElement;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t}return null}function Gle(e=Wle){const[t,n]=C.useState(OD),r=C.useRef(t),o=C.useRef(null),a=C.useCallback(i=>{if(o.current?.disconnect(),o.current=null,!i||r.current||OD())return;const s=i.getBoundingClientRect(),l=Yle(i),d=l?.getBoundingClientRect()??{top:0,bottom:window.innerHeight||document.documentElement.clientHeight};if(s.bottom>=d.top-e&&s.top<=d.bottom+e){r.current=!0,n(!0);return}const u=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&(r.current=!0,u.disconnect(),n(!0))},{root:l,rootMargin:`${e}px 0px`});u.observe(i),o.current=u},[e]);return C.useEffect(()=>()=>o.current?.disconnect(),[]),C.useEffect(()=>{if(t||typeof window>"u")return;const i=()=>{r.current=!0,o.current?.disconnect(),n(!0)};return window.addEventListener("beforeprint",i),()=>window.removeEventListener("beforeprint",i)},[t]),[a,t]}function CF({summary:e,detail:t}){return p.jsxs(lo,{severity:"error",sx:{"& .MuiAlert-message":{minWidth:0,flex:1}},children:[e!==void 0&&p.jsx(Te,{sx:{mb:.5},children:e}),p.jsx(Te,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:Fo,fontSize:"0.8125rem",color:"text.secondary"},children:t})]})}function ja({error:e,context:t}){const n=e.data?.message||"Unknown error";return p.jsx(CF,{summary:t,detail:n})}function STe(e){const t=Kle(e);return{name:e.name,type:e.type,...t===void 0?{}:{default:t},...e.label===void 0?{}:{label:e.label},...e.description===void 0?{}:{description:e.description},...e.control===void 0?{}:{control:e.control},...e.suggest?{suggest:{...e.suggest.source===void 0?{}:{source:e.suggest.source},...e.suggest.query===void 0?{}:{query:e.suggest.query},dimension:e.suggest.dimension}}:{},...e.rangeMin===void 0?{}:{rangeMin:e.rangeMin},...e.rangeMax===void 0?{}:{rangeMax:e.rangeMax}}}function Kle(e){return e.type?.startsWith("filter<")?e.default?.match(/^f(['"])([\s\S]*)\1$/)?.[2]??e.default:e.default}function p2(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/[\u0000-\u001f]/g,t=>Qle[t]??Xle(t))}const Qle={"\n":"\\n","\r":"\\r"," ":"\\t","\b":"\\b","\f":"\\f"},Xle=e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`;function Zle(e,t){if(e==null||e==="")return;const n=r=>`'${p2(r)}'`;switch(t===void 0?Jle(e):t.startsWith("filter<")?"filter":t){case"filter":return ece(String(e));case"string":return n(String(e));case"number":{const r=typeof e=="number"?e:Number(e);return Number.isFinite(r)?String(r):void 0}case"boolean":return e===!0||e==="true"?"true":"false";case"date":{const r=PD(e);return r&&`@${r}`}case"timestamp":{const r=PD(e);if(!r)return;const o=e instanceof Date?e.toISOString().slice(11,19):/[T ](\d{2}:\d{2}(?::\d{2})?)/.exec(String(e))?.[1]??"00:00:00";return`@${r} ${o}`}default:return}}function Jle(e){if(typeof e=="string")return"string";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.toISOString().slice(11,19)==="00:00:00"?"date":"timestamp"}function ece(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];r==="\\"?t+=n+1<e.length?r+e[++n]:"\\\\":t+=r==="'"?"\\'":r}return`f'${t}'`}function PD(e){return e instanceof Date?Number.isNaN(e.getTime())?void 0:e.toISOString().slice(0,10):/^(\d{4}-\d{2}-\d{2})/.exec(String(e))?.[1]}const Qp="malloy-publisher.report-draft:",Xp={storage:()=>window.localStorage};function CTe(e){const{server:t,environmentName:n,packageName:r,versionId:o,path:a}=e;return`${t}|${n}/${r}@${o??""}/${a}`}function kTe(e){if(typeof e=="string"){h0(e);return}const{server:t,environmentName:n,packageName:r,path:o}=e,a=`${n}/${r}@`,i=e.versionId!==void 0?`${e.versionId}/${o}`:void 0;try{const s=Xp.storage(),l=[];for(let d=0;d<s.length;d++){const u=s.key(d);if(!u?.startsWith(Qp))continue;const m=u.slice(Qp.length),g=m.indexOf("|");if(g===-1)continue;const[y,x]=[m.slice(0,g),m.slice(g+1)];if(t!==void 0&&y!==t||!x.startsWith(a))continue;const w=x.slice(a.length);(i!==void 0?w!==i:w.slice(w.indexOf("/")+1)!==o)||l.push(u)}for(const d of l)s.removeItem(d)}catch{}}function $Te(){try{const e=`${Qp}probe`;return Xp.storage().setItem(e,"1"),Xp.storage().removeItem(e),!0}catch{return!1}}function tce(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return`${e.length}:${(t>>>0).toString(36)}`}function nce(e){try{const t=Xp.storage().getItem(Qp+e);if(!t)return;const n=JSON.parse(t);return n?.v===1&&n.document?n:void 0}catch{return}}function rce(e,t){try{return Xp.storage().setItem(Qp+e,JSON.stringify(t)),!0}catch{return!1}}function h0(e){try{Xp.storage().removeItem(Qp+e)}catch{}}function bC(e,t){const n=e;for(const r of Object.keys(n))delete n[r];Object.assign(n,structuredClone(t))}function RTe(e,t,n){const[r,o]=C.useState(),[a,i]=C.useState(),[s,l]=C.useState(!1),d=C.useRef(void 0),u=C.useRef(void 0),m=C.useRef(!1),g=tce(n),y=C.useRef(t);y.current=t;const x=C.useRef(!1);C.useEffect(()=>{if(e===void 0||x.current)return;x.current=!0;const T=nce(e);if(!T)return;const O=y.current;if(JSON.stringify(T.document)===JSON.stringify(O.document)){h0(e);return}if(T.base!==g){d.current=T,o({savedAt:T.savedAt,stale:!0,pending:!0});return}O.update(P=>bC(P,T.document)),u.current=JSON.stringify(T.document),m.current=!0,o({savedAt:T.savedAt,stale:!1,pending:!1})},[e]);const{document:w,dirty:S}=t;C.useEffect(()=>{if(e===void 0||!x.current||d.current&&!S)return;if(d.current&&(d.current=void 0,o(void 0)),u.current!==void 0){const O=JSON.stringify(w);m.current?O===u.current&&(m.current=!1):O!==u.current&&(u.current=void 0,o(void 0))}if(!S){h0(e),i(void 0),l(!1);return}const T=Date.now();rce(e,{v:1,document:w,base:g,savedAt:T})?(i(T),l(!1)):(i(void 0),l(!0))},[e,w,S,g]);const b=C.useCallback(()=>{const T=d.current;T&&(d.current=void 0,y.current.update(O=>bC(O,T.document)),u.current=JSON.stringify(T.document),m.current=!0,o(O=>O&&{...O,pending:!1}))},[]),$=C.useCallback(()=>{d.current||(u.current=void 0,o(void 0))},[]),k=C.useCallback(()=>{if(d.current&&e!==void 0){d.current=void 0,h0(e),o(void 0);return}const T=y.current;T.update(O=>bC(O,T.saved)),u.current=void 0,o(void 0)},[e]);return{keptAt:a,keeping:!s,restored:r,dismissRestored:$,discard:k,restoreOffered:b}}const oce=(e,t)=>({...t,...e}),kF={emit:()=>{},listening:!1};function Kk(e,t){return t?{listening:!0,emit:n=>{try{t(oce(n,e))}catch{}}}:kF}function ace(e,t){const n=C.useRef(t);n.current=t;const r=t!==void 0,{path:o,layout:a}=e;return C.useMemo(()=>Kk({path:o,...a?{layout:a}:{}},r?i=>n.current?.(i):void 0),[o,a,r])}const $F=C.createContext(kF),g1=()=>C.useContext($F);function U0(e){const t=e,n=typeof t?.status=="number"?t.status:typeof t?.response?.status=="number"?t.response.status:void 0;return n===void 0?t?.code==="ERR_NETWORK"?"network":"unknown":n===404?"not_found":n===401||n===403?"forbidden":n===501?"unsupported":n>=500?"server":n>=400?"invalid":"unknown"}var Qk={exports:{}},ice=Qk.exports,jD;function sce(){return jD||(jD=1,(function(e,t){(function(n,r){e.exports=r()})(ice,(function(){var n=1e3,r=6e4,o=36e5,a="millisecond",i="second",s="minute",l="hour",d="day",u="week",m="month",g="quarter",y="year",x="date",w="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var B=["th","st","nd","rd"],I=N%100;return"["+N+(B[(I-20)%10]||B[I]||B[0])+"]"}},k=function(N,B,I){var H=String(N);return!H||H.length>=B?N:""+Array(B+1-H.length).join(I)+N},T={s:k,z:function(N){var B=-N.utcOffset(),I=Math.abs(B),H=Math.floor(I/60),Y=I%60;return(B<=0?"+":"-")+k(H,2,"0")+":"+k(Y,2,"0")},m:function N(B,I){if(B.date()<I.date())return-N(I,B);var H=12*(I.year()-B.year())+(I.month()-B.month()),Y=B.clone().add(H,m),ae=I-Y<0,K=B.clone().add(H+(ae?-1:1),m);return+(-(H+(I-Y)/(ae?Y-K:K-Y))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y,w:u,d,D:x,h:l,m:s,s:i,ms:a,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},O="en",P={};P[O]=$;var D="$isDayjsObject",A=function(N){return N instanceof R||!(!N||!N[D])},F=function N(B,I,H){var Y;if(!B)return O;if(typeof B=="string"){var ae=B.toLowerCase();P[ae]&&(Y=ae),I&&(P[ae]=I,Y=ae);var K=B.split("-");if(!Y&&K.length>1)return N(K[0])}else{var oe=B.name;P[oe]=B,Y=oe}return!H&&Y&&(O=Y),Y||!H&&O},L=function(N,B){if(A(N))return N.clone();var I=typeof B=="object"?B:{};return I.date=N,I.args=arguments,new R(I)},_=T;_.l=F,_.i=A,_.w=function(N,B){return L(N,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var R=(function(){function N(I){this.$L=F(I.locale,null,!0),this.parse(I),this.$x=this.$x||I.x||{},this[D]=!0}var B=N.prototype;return B.parse=function(I){this.$d=(function(H){var Y=H.date,ae=H.utc;if(Y===null)return new Date(NaN);if(_.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var K=Y.match(S);if(K){var oe=K[2]-1||0,ue=(K[7]||"0").substring(0,3);return ae?new Date(Date.UTC(K[1],oe,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)):new Date(K[1],oe,K[3]||1,K[4]||0,K[5]||0,K[6]||0,ue)}}return new Date(Y)})(I),this.init()},B.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},B.$utils=function(){return _},B.isValid=function(){return this.$d.toString()!==w},B.isSame=function(I,H){var Y=L(I);return this.startOf(H)<=Y&&Y<=this.endOf(H)},B.isAfter=function(I,H){return L(I)<this.startOf(H)},B.isBefore=function(I,H){return this.endOf(H)<L(I)},B.$g=function(I,H,Y){return _.u(I)?this[H]:this.set(Y,I)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(I,H){var Y=this,ae=!!_.u(H)||H,K=_.p(I),oe=function(le,fe){var he=_.w(Y.$u?Date.UTC(Y.$y,fe,le):new Date(Y.$y,fe,le),Y);return ae?he:he.endOf(d)},ue=function(le,fe){return _.w(Y.toDate()[le].apply(Y.toDate("s"),(ae?[0,0,0,0]:[23,59,59,999]).slice(fe)),Y)},G=this.$W,ie=this.$M,Q=this.$D,ee="set"+(this.$u?"UTC":"");switch(K){case y:return ae?oe(1,0):oe(31,11);case m:return ae?oe(1,ie):oe(0,ie+1);case u:var Z=this.$locale().weekStart||0,de=(G<Z?G+7:G)-Z;return oe(ae?Q-de:Q+(6-de),ie);case d:case x:return ue(ee+"Hours",0);case l:return ue(ee+"Minutes",1);case s:return ue(ee+"Seconds",2);case i:return ue(ee+"Milliseconds",3);default:return this.clone()}},B.endOf=function(I){return this.startOf(I,!1)},B.$set=function(I,H){var Y,ae=_.p(I),K="set"+(this.$u?"UTC":""),oe=(Y={},Y[d]=K+"Date",Y[x]=K+"Date",Y[m]=K+"Month",Y[y]=K+"FullYear",Y[l]=K+"Hours",Y[s]=K+"Minutes",Y[i]=K+"Seconds",Y[a]=K+"Milliseconds",Y)[ae],ue=ae===d?this.$D+(H-this.$W):H;if(ae===m||ae===y){var G=this.clone().set(x,1);G.$d[oe](ue),G.init(),this.$d=G.set(x,Math.min(this.$D,G.daysInMonth())).$d}else oe&&this.$d[oe](ue);return this.init(),this},B.set=function(I,H){return this.clone().$set(I,H)},B.get=function(I){return this[_.p(I)]()},B.add=function(I,H){var Y,ae=this;I=Number(I);var K=_.p(H),oe=function(ie){var Q=L(ae);return _.w(Q.date(Q.date()+Math.round(ie*I)),ae)};if(K===m)return this.set(m,this.$M+I);if(K===y)return this.set(y,this.$y+I);if(K===d)return oe(1);if(K===u)return oe(7);var ue=(Y={},Y[s]=r,Y[l]=o,Y[i]=n,Y)[K]||1,G=this.$d.getTime()+I*ue;return _.w(G,this)},B.subtract=function(I,H){return this.add(-1*I,H)},B.format=function(I){var H=this,Y=this.$locale();if(!this.isValid())return Y.invalidDate||w;var ae=I||"YYYY-MM-DDTHH:mm:ssZ",K=_.z(this),oe=this.$H,ue=this.$m,G=this.$M,ie=Y.weekdays,Q=Y.months,ee=Y.meridiem,Z=function(fe,he,me,se){return fe&&(fe[he]||fe(H,ae))||me[he].slice(0,se)},de=function(fe){return _.s(oe%12||12,fe,"0")},le=ee||function(fe,he,me){var se=fe<12?"AM":"PM";return me?se.toLowerCase():se};return ae.replace(b,(function(fe,he){return he||(function(me){switch(me){case"YY":return String(H.$y).slice(-2);case"YYYY":return _.s(H.$y,4,"0");case"M":return G+1;case"MM":return _.s(G+1,2,"0");case"MMM":return Z(Y.monthsShort,G,Q,3);case"MMMM":return Z(Q,G);case"D":return H.$D;case"DD":return _.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Z(Y.weekdaysMin,H.$W,ie,2);case"ddd":return Z(Y.weekdaysShort,H.$W,ie,3);case"dddd":return ie[H.$W];case"H":return String(oe);case"HH":return _.s(oe,2,"0");case"h":return de(1);case"hh":return de(2);case"a":return le(oe,ue,!0);case"A":return le(oe,ue,!1);case"m":return String(ue);case"mm":return _.s(ue,2,"0");case"s":return String(H.$s);case"ss":return _.s(H.$s,2,"0");case"SSS":return _.s(H.$ms,3,"0");case"Z":return K}return null})(fe)||K.replace(":","")}))},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(I,H,Y){var ae,K=this,oe=_.p(H),ue=L(I),G=(ue.utcOffset()-this.utcOffset())*r,ie=this-ue,Q=function(){return _.m(K,ue)};switch(oe){case y:ae=Q()/12;break;case m:ae=Q();break;case g:ae=Q()/3;break;case u:ae=(ie-G)/6048e5;break;case d:ae=(ie-G)/864e5;break;case l:ae=ie/o;break;case s:ae=ie/r;break;case i:ae=ie/n;break;default:ae=ie}return Y?ae:_.a(ae)},B.daysInMonth=function(){return this.endOf(m).$D},B.$locale=function(){return P[this.$L]},B.locale=function(I,H){if(!I)return this.$L;var Y=this.clone(),ae=F(I,H,!0);return ae&&(Y.$L=ae),Y},B.clone=function(){return _.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},N})(),z=R.prototype;return L.prototype=z,[["$ms",a],["$s",i],["$m",s],["$H",l],["$W",d],["$M",m],["$y",y],["$D",x]].forEach((function(N){z[N[1]]=function(B){return this.$g(B,N[0],N[1])}})),L.extend=function(N,B){return N.$i||(N(B,R,L),N.$i=!0),L},L.locale=F,L.isDayjs=A,L.unix=function(N){return L(1e3*N)},L.en=P[O],L.Ls=P,L.p={},L}))})(Qk)),Qk.exports}var lce=sce();const Ar=yc(lce);var Xk={exports:{}},cce=Xk.exports,AD;function uce(){return AD||(AD=1,(function(e,t){(function(n,r){e.exports=r()})(cce,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,o=/([+-]|\d\d)/g;return function(a,i,s){var l=i.prototype;s.utc=function(w){var S={date:w,utc:!0,args:arguments};return new i(S)},l.utc=function(w){var S=s(this.toDate(),{locale:this.$L,utc:!0});return w?S.add(this.utcOffset(),n):S},l.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var d=l.parse;l.parse=function(w){w.utc&&(this.$u=!0),this.$utils().u(w.$offset)||(this.$offset=w.$offset),d.call(this,w)};var u=l.init;l.init=function(){if(this.$u){var w=this.$d;this.$y=w.getUTCFullYear(),this.$M=w.getUTCMonth(),this.$D=w.getUTCDate(),this.$W=w.getUTCDay(),this.$H=w.getUTCHours(),this.$m=w.getUTCMinutes(),this.$s=w.getUTCSeconds(),this.$ms=w.getUTCMilliseconds()}else u.call(this)};var m=l.utcOffset;l.utcOffset=function(w,S){var b=this.$utils().u;if(b(w))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof w=="string"&&(w=(function(O){O===void 0&&(O="");var P=O.match(r);if(!P)return null;var D=(""+P[0]).match(o)||["-",0,0],A=D[0],F=60*+D[1]+ +D[2];return F===0?0:A==="+"?F:-F})(w),w===null))return this;var $=Math.abs(w)<=16?60*w:w;if($===0)return this.utc(S);var k=this.clone();if(S)return k.$offset=$,k.$u=!1,k;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add($+T,n)).$offset=$,k.$x.$localOffset=T,k};var g=l.format;l.format=function(w){var S=w||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},l.valueOf=function(){var w=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*w},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(w){return w==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var x=l.diff;l.diff=function(w,S,b){if(w&&this.$u===w.$u)return x.call(this,w,S,b);var $=this.local(),k=s(w).local();return x.call($,k,S,b)}}}))})(Xk)),Xk.exports}var dce=uce();const h2=yc(dce);Ar.extend(h2);function ou(e){return(e??"").startsWith("filter<")}function fce(e){const{parsed:t}=ji.BooleanFilterExpression.parse(e);if(!(!t||t.not))return t.operator==="true"||t.operator==="false"?t.operator:void 0}function uu(e){const t=/^filter<(.+)>$/.exec(e??"");return t?t[1]:void 0}function m2(e){const t=e.filter(n=>n.trim()!=="");return t.length===0?"":ji.StringFilterExpression.unparse({operator:"=",values:[...t]})}function RF(e){if(e.trim()==="")return[];const{parsed:t}=ji.StringFilterExpression.parse(e);return EF(t)?t.values:[e]}function TF(e){return e===void 0||e.trim()===""?!0:EF(ji.StringFilterExpression.parse(e).parsed)}function EF(e){return e!==null&&ji.isStringCondition(e)&&e.operator==="="&&e.not!==!0}function pce(e){return ji.NumberFilterExpression.unparse({operator:">=",values:[String(e)]})}function MF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.NumberFilterExpression.parse(t);if(n===null||n.operator!==">="||n.not===!0||n.values?.length!==1)return;const r=Number(n.values[0]);return Number.isFinite(r)?r:void 0}function hce(e,t){return ji.NumberFilterExpression.unparse({operator:"range",startOperator:">=",startValue:String(e),endOperator:"<=",endValue:String(t)})}function OF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.NumberFilterExpression.parse(t);if(n===null||n.operator!=="range"||n.not===!0||n.startOperator!==">="||n.endOperator!=="<=")return;const r=Number(n.startValue),o=Number(n.endValue);return Number.isFinite(r)&&Number.isFinite(o)&&r<=o?[r,o]:void 0}const my=[{key:"today",label:"Today",clause:{operator:"in",in:{moment:"today"}}},{key:"7d",label:"Last 7 days",clause:{operator:"in_last",units:"day",n:"7"}},{key:"30d",label:"Last 30 days",clause:{operator:"in_last",units:"day",n:"30"}},{key:"90d",label:"Last 90 days",clause:{operator:"in_last",units:"day",n:"90"}},{key:"12m",label:"Last 12 months",clause:{operator:"in_last",units:"month",n:"12"}}];function mce(e){const t=my.find(n=>n.key===e);return t?ji.TemporalFilterExpression.unparse(t.clause):void 0}function PF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.TemporalFilterExpression.parse(t);if(n!==null)for(const r of my){const o=r.clause;if(o.operator===n.operator&&(o.operator==="in"&&n.operator==="in"&&n.not!==!0&&n.in.moment===o.in.moment||o.operator==="in_last"&&n.operator==="in_last"&&n.not!==!0&&n.units===o.units&&Number(n.n)===Number(o.n)))return r.key}}const gce=/^\d{4}-\d{2}-\d{2}$/;function yce(e,t){const n=Ar.utc(t,"YYYY-MM-DD").add(1,"day");return ji.TemporalFilterExpression.unparse({operator:"to",fromMoment:{moment:"literal",literal:e,units:"day"},toMoment:{moment:"literal",literal:n.format("YYYY-MM-DD"),units:"day"}})}function jF(e){const t=e.trim();if(t==="")return;const{parsed:n}=ji.TemporalFilterExpression.parse(t);if(n===null||n.operator!=="to"||n.not===!0)return;const r=DD(n.fromMoment),o=DD(n.toMoment);if(r===void 0||o===void 0)return;const a=Ar.utc(o,"YYYY-MM-DD").subtract(1,"day");if(!(!a.isValid()||a.isBefore(Ar.utc(r,"YYYY-MM-DD"))))return{firstDay:r,lastDay:a.format("YYYY-MM-DD")}}function DD(e){return e.moment==="literal"&&gce.test(e.literal)?e.literal:void 0}const Gm="self";function AF(e){if(!e)return[];if(e.wasDimension&&!e.wasDimension())return[];const t=e.tag?.tag("drill");return t?(t.textArray("to")??[t.text("to")].filter(ND)).filter(ND):[]}function DF(e){const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function NF(e){return e.tag?.tag("drill")?.text("given")??e.name}function y1(e){if(typeof e=="string"){const t=m2([e]);return t===""?void 0:t}if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(e instanceof Date){const t=e.toISOString();return t.slice(0,t.indexOf("T"))}}function Zk(e){return e instanceof Date?y1(e)??"":String(e)}function vce(e){if(!e||e.isHeader)return;const t=e.field;if(!t)return;const n=AF(t);if(n.length===0)return;const r=y1(e.value);if(r!==void 0)return{to:n,given:NF(t),value:r,rawValue:e.value,label:Zk(e.value)}}function ND(e){return typeof e=="string"&&e!==""}function bce(e,t){if(t!==void 0&&!ou(t)){if(t==="number"){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;const n=Number(e);return Number.isFinite(n)?n:void 0}if(t==="date"||t==="timestamp"||t==="timestamptz")return e instanceof Date?e:void 0;if(t==="boolean")return typeof e=="boolean"?e:e==="true"?!0:e==="false"?!1:void 0;if(typeof e=="string")return e.trim()===""?void 0:e;if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(typeof e=="boolean")return String(e)}return uu(t)==="string"&&typeof e=="number"?Number.isFinite(e)?m2([String(e)]):void 0:uu(t)==="number"?typeof e=="number"?Number.isFinite(e)?String(e):void 0:typeof e!="string"||e.trim()===""?void 0:Number.isFinite(Number(e))?e.trim():void 0:y1(e)}function xce({declaredTypes:e,setGiven:t,documentName:n}){const r=g1(),o=C.useMemo(()=>{const l=new Map;for(const d of e.keys())l.has(d.toLowerCase())||l.set(d.toLowerCase(),d);return l},[e]),a=C.useCallback(l=>e.has(l)?l:o.get(l.toLowerCase()),[e,o]),i=C.useCallback(l=>a(l)!==void 0,[a]),s=C.useCallback((l,d)=>{const u=a(l);if(u===void 0){r.emit({type:"report.drill",to:"self",outcome:"unresolved"}),r.listening||console.warn(`# drill { to=self } tried to set '${l}', which '${n}' does not declare as a given. Name the given with 'given=' on the drill tag.`);return}const m=e.get(u),g=bce(d,m);if(g===void 0){r.emit({type:"report.drill",to:"self",outcome:"malformed"}),r.listening||console.warn(`Drill declined: ${JSON.stringify(d)} cannot be a value for given "${u}"`+(m?` of type ${m}`:""));return}t(u,g),r.emit({type:"report.drill",to:"self",outcome:"resolved"})},[e,n,a,t,r]);return{resolveGiven:a,canSelf:i,onSelf:s}}function IF(e,t){if(e!=null){if(e instanceof Date)return g2(e,t);if(!Array.isArray(e))return String(e)}}function wce(e,t){return new Date(Date.UTC(e.year(),e.month(),e.date(),t?.getUTCHours()??0,t?.getUTCMinutes()??0,t?.getUTCSeconds()??0,t?.getUTCMilliseconds()??0))}const Sce=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(\d{1,2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?)?\s*(Z|[+-]\d{2}:?\d{2}|[+-]\d{2}|UTC|GMT)?$/i;function LF(e){const t=e.trim();return t===""?e:t.replace(/^(\d{4}-\d{1,2}-\d{1,2}[T\s]+\d{1,2}:\d{2}(?::\d{2})?(?:\.\d{1,9})?)\s+(\d{2}:?\d{2}|\d{2})$/,"$1+$2")}function Cce(e,t=!1){const n=LF(e);if(n==="")return;const r=Sce.exec(n);if(!r)return;const[,o,a,i,s,l,d,u,m]=r,g={year:Number(o),month:Number(a),day:Number(i),hour:Number(s??0),minute:Number(l??0),second:Number(d??0),milli:Number((u??"").slice(0,3).padEnd(3,"0")||0)},y=Date.UTC(g.year,g.month-1,g.day,g.hour,g.minute,g.second,g.milli),x=new Date(y);if(!(x.getUTCFullYear()===g.year&&x.getUTCMonth()===g.month-1&&x.getUTCDate()===g.day&&x.getUTCHours()===g.hour&&x.getUTCMinutes()===g.minute&&x.getUTCSeconds()===g.second)||m!==void 0&&s===void 0)return;const w=kce(m);if(w===void 0)return;const S=new Date(y-w*6e4);if(!(t&&m!==void 0&&S.getUTCDate()!==g.day))return S}function kce(e){if(e===void 0)return 0;const t=e.toUpperCase();if(t==="Z"||t==="UTC"||t==="GMT")return 0;const n=/^([+-])(\d{2}):?(\d{2})?$/.exec(t);if(!n)return;const r=Number(n[3]??0);if(r>59)return;const o=Number(n[2])*60+r,a=n[1]!=="-";if(!(o>(a?840:720)))return a?o:-o}function zF(e){return!$ce.has(e??"")}const $ce=new Set(["boolean","number","date","timestamp","timestamptz"]);function FF(e,t){if(t===""&&!zF(e))return null;if(ou(e))return t;switch(e){case"number":{const n=t.trim()===""?NaN:Number(t);return Number.isFinite(n)?n:t}case"boolean":return t==="true"?!0:t==="false"?!1:t;case"date":case"timestamp":case"timestamptz":{const n=LF(t);return Cce(n,e==="date")??n}default:return t}}function m0(e,t){const n={};for(const[r,o]of e){const a=IF(o,t.get(r));a!==void 0&&(n[r]=a)}return n}function g2(e,t){const n=e.toISOString();switch(t){case"timestamptz":return n;case"timestamp":return n.slice(0,-1);default:return n.slice(0,10)}}function Jd(e,t,n){const r=n?new Set(n):void 0,o={};for(const[a,i]of e)r&&!r.has(a)||i!=null&&(Array.isArray(i)||(o[a]=i instanceof Date?g2(i,t.get(a)):i));return o}function y2(e,t,n){if(!t)return e;const r=n?new Set(n):void 0,o={...e};for(const[a,i]of Object.entries(t))r&&!r.has(a)||a in o||i===null||i===void 0||(o[a]=Array.isArray(i)?[...i]:i instanceof Date?g2(i,void 0):i);return o}function ID(e,t){const n=new Map;for(const[r,o]of Object.entries(e))t.has(r)&&n.set(r,FF(t.get(r),o));return n}function xC(e,t){const n=Array.from(e.keys()).filter(o=>!t.has(o));if(n.length===0)return e;const r=new Map(e);for(const o of n)r.delete(o);return r}function LD(e){return Object.entries(e??{}).sort(([t],[n])=>t<n?-1:1)}function Rce(e,t,n){for(const r of n.keys())if(e[r]!==t[r])return!1;return!0}const Tce=1500;function Pb(e,t){const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>e[r]===t[r])}function _F({declaredTypes:e,startingValues:t,params:n,onParamsChange:r,documentKey:o,autorun:a}){const i=C.useMemo(()=>ID(t??{},e),[e,JSON.stringify(t)]),s=C.useRef(null),l=C.useRef([]),d=C.useRef(0),u=C.useRef({documentKey:o,params:n}),m=B=>B!==null&&Rce(n??{},B,e),g=Date.now();l.current=l.current.filter(B=>g-B.at<Tce);const y=(s.current===null?l.current.map(B=>B.params):[...l.current.map(B=>B.params),s.current]).findIndex(m);u.current.documentKey!==o&&(l.current=[]),(u.current.documentKey!==o||!Pb(n??{},u.current.params??{})&&y<0)&&(u.current={documentKey:o,params:n}),y>0&&(l.current=l.current.slice(y));const x=u.current.params,w=JSON.stringify(t),S=JSON.stringify(x),b=C.useMemo(()=>ID({...t??{},...x??{}},e),[e,w,S]),$=C.useMemo(()=>JSON.stringify([o??null,LD(t),LD(x)]),[o,w,S]),[k,T]=C.useState(null),O=k?.key===$?k:null;C.useEffect(()=>{k!==null&&k.key!==$&&T(null)},[k,$]);const P=C.useMemo(()=>xC(O?.draft??b,e),[O,b,e]),D=C.useMemo(()=>xC(O?.applied??b,e),[O,b,e]),A=C.useCallback(B=>B?.key===$?B:{key:$,draft:b,applied:b},[$,b]),F=C.useMemo(()=>m0(D,e),[D,e]);s.current===null&&(s.current=F,d.current=Date.now()),C.useEffect(()=>{r&&(Pb(s.current??{},F)||(s.current!==null&&(l.current=[...l.current.slice(-31),{params:s.current,at:d.current}]),s.current=F,d.current=Date.now(),r(F)))},[F,r]);const L=C.useCallback((B,I)=>{T(H=>{const Y=A(H),ae=new Map(Y.draft);return I===null?ae.delete(B):ae.set(B,I),{key:Y.key,draft:ae,applied:a?ae:Y.applied}})},[a,A]),_=C.useCallback(()=>{T(B=>({key:A(B).key,draft:i,applied:i}))},[A,i]),R=C.useCallback(()=>{T(B=>{const I=A(B);return{key:I.key,draft:I.draft,applied:I.draft}})},[A]),z=C.useMemo(()=>{if(a)return!1;if(P.size!==D.size)return!0;for(const[B,I]of P){const H=D.get(B);if(I instanceof Date&&H instanceof Date){if(I.getTime()!==H.getTime())return!0}else if(Array.isArray(I)&&Array.isArray(H)){if(String(I)!==String(H))return!0}else if(I!==H)return!0}return!1},[a,P,D]),N=C.useMemo(()=>{const B=m0(xC(i,e),e);return Pb(m0(P,e),B)&&Pb(F,B)},[i,P,F,e]);return{draft:P,applied:D,setGiven:L,reset:_,apply:R,pending:z,atStart:N}}const Ece="You don't have access to this data";function TTe(e){return(e??[]).filter(t=>t.kind==="definition"&&!t.restricted).map(t=>t.text??"").join(`
350
350
 
351
351
  `)}function v1(e,t){return e===""?t:`${e}
352
352
 
@@ -468,45 +468,45 @@ ${t}`}function Mce(e){return e?.status===403}function Zp(e){return`\`${e.replace
468
468
  `),P=k.selectionStart===T;O&&P&&k.setSelectionRange(T,T),n&&n($)};return p.jsxs(C.Fragment,{children:[p.jsx("textarea",{value:i,onChange:b,ref:u,rows:o,style:a,...s}),p.jsx("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:g,tabIndex:-1,style:{...Xhe.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function nf({props:e,states:t,muiFormControl:n}){return t.reduce((r,o)=>(r[o]=e[o],n&&typeof e[o]>"u"&&(r[o]=n[o]),r),{})}function SN(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function G0(e,t=!1){return e&&(SN(e.value)&&e.value!==""||t&&SN(e.defaultValue)&&e.defaultValue!=="")}function eme(e){return e.startAdornment}function tme(e){return Cn("MuiInputBase",e)}const bi=fn("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]);var CN;const R1=(e,t)=>{const{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size==="small"&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${Tt(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},T1=(e,t)=>{const{ownerState:n}=e;return[t.input,n.size==="small"&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type==="search"&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},nme=e=>{const{classes:t,color:n,disabled:r,error:o,endAdornment:a,focused:i,formControl:s,fullWidth:l,hiddenLabel:d,multiline:u,readOnly:m,size:g,startAdornment:y,type:x}=e,w={root:["root",`color${Tt(n)}`,r&&"disabled",o&&"error",l&&"fullWidth",i&&"focused",s&&"formControl",g&&g!=="medium"&&`size${Tt(g)}`,u&&"multiline",y&&"adornedStart",a&&"adornedEnd",d&&"hiddenLabel",m&&"readOnly"],input:["input",r&&"disabled",x==="search"&&"inputTypeSearch",u&&"inputMultiline",g==="small"&&"inputSizeSmall",d&&"inputHiddenLabel",y&&"inputAdornedStart",a&&"inputAdornedEnd",m&&"readOnly"]};return bn(w,tme,t)},E1=nt("div",{name:"MuiInputBase",slot:"Root",overridesResolver:R1})(Gn(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${bi.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:t})=>t.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:t,size:n})=>t.multiline&&n==="small",style:{paddingTop:1}},{props:({ownerState:t})=>t.fullWidth,style:{width:"100%"}}]}))),M1=nt("input",{name:"MuiInputBase",slot:"Input",overridesResolver:T1})(Gn(({theme:e})=>{const t=e.palette.mode==="light",n={color:"currentColor",...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})},r={opacity:"0 !important"},o=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${bi.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":o,"&:focus::-moz-placeholder":o,"&:focus::-ms-input-placeholder":o},[`&.${bi.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:a})=>!a.disableInjectingGlobalStyles,style:{animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:a})=>a.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),kN=Yse({"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}),B2=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiInputBase"}),{"aria-describedby":r,autoComplete:o,autoFocus:a,className:i,color:s,components:l={},componentsProps:d={},defaultValue:u,disabled:m,disableInjectingGlobalStyles:g,endAdornment:y,error:x,fullWidth:w=!1,id:S,inputComponent:b="input",inputProps:$={},inputRef:k,margin:T,maxRows:O,minRows:P,multiline:D=!1,name:A,onBlur:F,onChange:L,onClick:_,onFocus:R,onKeyDown:z,onKeyUp:N,placeholder:B,readOnly:I,renderSuffix:H,rows:Y,size:ae,slotProps:K={},slots:oe={},startAdornment:ue,type:G="text",value:ie,...Q}=n,ee=$.value!=null?$.value:ie,{current:Z}=C.useRef(ee!=null),de=C.useRef(),le=C.useCallback(Ve=>{},[]),fe=vr(de,k,$.ref,le),[he,me]=C.useState(!1),se=Ai(),ve=nf({props:n,muiFormControl:se,states:["color","disabled","error","hiddenLabel","size","required","filled"]});ve.focused=se?se.focused:he,C.useEffect(()=>{!se&&m&&he&&(me(!1),F&&F())},[se,m,he,F]);const Le=se&&se.onFilled,Ae=se&&se.onEmpty,Re=C.useCallback(Ve=>{G0(Ve)?Le&&Le():Ae&&Ae()},[Le,Ae]);Go(()=>{Z&&Re({value:ee})},[ee,Re,Z]);const re=Ve=>{R&&R(Ve),$.onFocus&&$.onFocus(Ve),se&&se.onFocus?se.onFocus(Ve):me(!0)},_e=Ve=>{F&&F(Ve),$.onBlur&&$.onBlur(Ve),se&&se.onBlur?se.onBlur(Ve):me(!1)},Me=(Ve,...Oe)=>{if(!Z){const $t=Ve.target||de.current;if($t==null)throw new Error(dc(1));Re({value:$t.value})}$.onChange&&$.onChange(Ve,...Oe),L&&L(Ve,...Oe)};C.useEffect(()=>{Re(de.current)},[]);const Ge=Ve=>{de.current&&Ve.currentTarget===Ve.target&&de.current.focus(),_&&_(Ve)};let Je=b,St=$;D&&Je==="input"&&(Y?St={type:void 0,minRows:Y,maxRows:Y,...St}:St={type:void 0,maxRows:O,minRows:P,...St},Je=Jhe);const Ut=Ve=>{Re(Ve.animationName==="mui-auto-fill-cancel"?de.current:{value:"x"})};C.useEffect(()=>{se&&se.setAdornedStart(!!ue)},[se,ue]);const at={...n,color:ve.color||"primary",disabled:ve.disabled,endAdornment:y,error:ve.error,focused:ve.focused,formControl:se,fullWidth:w,hiddenLabel:ve.hiddenLabel,multiline:D,size:ve.size,startAdornment:ue,type:G},tt=nme(at),pt=oe.root||l.Root||E1,ze=K.root||d.root||{},be=oe.input||l.Input||M1;return St={...St,...K.input??d.input},p.jsxs(C.Fragment,{children:[!g&&typeof kN=="function"&&(CN||(CN=p.jsx(kN,{}))),p.jsxs(pt,{...ze,ref:t,onClick:Ge,...Q,...!Jp(pt)&&{ownerState:{...at,...ze.ownerState}},className:Ht(tt.root,ze.className,i,I&&"MuiInputBase-readOnly"),children:[ue,p.jsx(S1.Provider,{value:null,children:p.jsx(be,{"aria-invalid":ve.error,"aria-describedby":r,autoComplete:o,autoFocus:a,defaultValue:u,disabled:ve.disabled,id:S,onAnimationStart:Ut,name:A,placeholder:B,readOnly:I,required:ve.required,rows:Y,value:ee,onKeyDown:z,onKeyUp:N,type:G,...St,...!Jp(be)&&{as:Je,ownerState:{...at,...St.ownerState}},ref:fe,className:Ht(tt.input,St.className,I&&"MuiInputBase-readOnly"),onBlur:_e,onChange:Me,onFocus:re})}),y,H?H({...ve,startAdornment:ue}):null]})]})});function rme(e){return Cn("MuiInput",e)}const au={...bi,...fn("MuiInput",["root","underline","input"])},ome=e=>{const{classes:t,disableUnderline:n}=e,r=bn({root:["root",!n&&"underline"],input:["input"]},rme,t);return{...t,...r}},ame=nt(E1,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[...R1(e,t),!n.disableUnderline&&t.underline]}})(Gn(({theme:e})=>{let t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:"relative",variants:[{props:({ownerState:n})=>n.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:n})=>!n.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${au.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${au.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${au.disabled}, .${au.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${au.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(Ma()).map(([n])=>({props:{color:n,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[n].main}`}}}))]}})),ime=nt(M1,{name:"MuiInput",slot:"Input",overridesResolver:T1})({}),U2=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiInput"}),{disableUnderline:r=!1,components:o={},componentsProps:a,fullWidth:i=!1,inputComponent:s="input",multiline:l=!1,slotProps:d,slots:u={},type:m="text",...g}=n,y=ome(n),x={root:{ownerState:{disableUnderline:r}}},w=d??a?xa(d??a,x):x,S=u.root??o.Root??ame,b=u.input??o.Input??ime;return p.jsx(B2,{slots:{root:S,input:b},slotProps:w,fullWidth:i,inputComponent:s,multiline:l,ref:t,type:m,...g,classes:y})});U2.muiName="Input";function sme(e){return Cn("MuiFilledInput",e)}const xi={...bi,...fn("MuiFilledInput",["root","underline","input","adornedStart","adornedEnd","sizeSmall","multiline","hiddenLabel"])},lme=e=>{const{classes:t,disableUnderline:n,startAdornment:r,endAdornment:o,size:a,hiddenLabel:i,multiline:s}=e,l={root:["root",!n&&"underline",r&&"adornedStart",o&&"adornedEnd",a==="small"&&`size${Tt(a)}`,i&&"hiddenLabel",s&&"multiline"],input:["input"]},d=bn(l,sme,t);return{...t,...d}},cme=nt(E1,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiFilledInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[...R1(e,t),!n.disableUnderline&&t.underline]}})(Gn(({theme:e})=>{const t=e.palette.mode==="light",n=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",r=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",o=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",a=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{position:"relative",backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:o,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${xi.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${xi.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:i})=>!i.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${xi.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${xi.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${xi.disabled}, .${xi.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${xi.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(Ma()).map(([i])=>({props:{disableUnderline:!1,color:i},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[i]?.main}`}}})),{props:({ownerState:i})=>i.startAdornment,style:{paddingLeft:12}},{props:({ownerState:i})=>i.endAdornment,style:{paddingRight:12}},{props:({ownerState:i})=>i.multiline,style:{padding:"25px 12px 8px"}},{props:({ownerState:i,size:s})=>i.multiline&&s==="small",style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:i})=>i.multiline&&i.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:i})=>i.multiline&&i.hiddenLabel&&i.size==="small",style:{paddingTop:8,paddingBottom:9}}]}})),ume=nt(M1,{name:"MuiFilledInput",slot:"Input",overridesResolver:T1})(Gn(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:e.palette.mode==="light"?null:"#fff",caretColor:e.palette.mode==="light"?null:"#fff",borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:t})=>t.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:t})=>t.startAdornment,style:{paddingLeft:0}},{props:({ownerState:t})=>t.endAdornment,style:{paddingRight:0}},{props:({ownerState:t})=>t.hiddenLabel&&t.size==="small",style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:t})=>t.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),q2=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFilledInput"}),{disableUnderline:r=!1,components:o={},componentsProps:a,fullWidth:i=!1,hiddenLabel:s,inputComponent:l="input",multiline:d=!1,slotProps:u,slots:m={},type:g="text",...y}=n,x={...n,disableUnderline:r,fullWidth:i,inputComponent:l,multiline:d,type:g},w=lme(n),S={root:{ownerState:x},input:{ownerState:x}},b=u??a?xa(S,u??a):S,$=m.root??o.Root??cme,k=m.input??o.Input??ume;return p.jsx(B2,{slots:{root:$,input:k},slotProps:b,fullWidth:i,inputComponent:l,multiline:d,ref:t,type:g,...y,classes:w})});q2.muiName="Input";var $N;const dme=nt("fieldset",{name:"MuiNotchedOutlined",shouldForwardProp:ei})({textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%"}),fme=nt("legend",{name:"MuiNotchedOutlined",shouldForwardProp:ei})(Gn(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:({ownerState:t})=>!t.withLabel,style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:t})=>t.withLabel,style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:({ownerState:t})=>t.withLabel&&t.notched,style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function pme(e){const{children:t,classes:n,className:r,label:o,notched:a,...i}=e,s=o!=null&&o!=="",l={...e,notched:a,withLabel:s};return p.jsx(dme,{"aria-hidden":!0,className:r,ownerState:l,...i,children:p.jsx(fme,{ownerState:l,children:s?p.jsx("span",{children:o}):$N||($N=p.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"}))})})}function hme(e){return Cn("MuiOutlinedInput",e)}const Wi={...bi,...fn("MuiOutlinedInput",["root","notchedOutline","input"])},mme=e=>{const{classes:t}=e,n=bn({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},hme,t);return{...t,...n}},gme=nt(E1,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiOutlinedInput",slot:"Root",overridesResolver:R1})(Gn(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{position:"relative",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${Wi.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${Wi.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${Wi.focused} .${Wi.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(Ma()).map(([n])=>({props:{color:n},style:{[`&.${Wi.focused} .${Wi.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}})),{props:{},style:{[`&.${Wi.error} .${Wi.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${Wi.disabled} .${Wi.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:n})=>n.startAdornment,style:{paddingLeft:14}},{props:({ownerState:n})=>n.endAdornment,style:{paddingRight:14}},{props:({ownerState:n})=>n.multiline,style:{padding:"16.5px 14px"}},{props:({ownerState:n,size:r})=>n.multiline&&r==="small",style:{padding:"8.5px 14px"}}]}})),yme=nt(pme,{name:"MuiOutlinedInput",slot:"NotchedOutline"})(Gn(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),vme=nt(M1,{name:"MuiOutlinedInput",slot:"Input",overridesResolver:T1})(Gn(({theme:e})=>({padding:"16.5px 14px",...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:e.palette.mode==="light"?null:"#fff",caretColor:e.palette.mode==="light"?null:"#fff",borderRadius:"inherit"}},...e.vars&&{"&:-webkit-autofill":{borderRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{padding:"8.5px 14px"}},{props:({ownerState:t})=>t.multiline,style:{padding:0}},{props:({ownerState:t})=>t.startAdornment,style:{paddingLeft:0}},{props:({ownerState:t})=>t.endAdornment,style:{paddingRight:0}}]}))),H2=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiOutlinedInput"}),{components:r={},fullWidth:o=!1,inputComponent:a="input",label:i,multiline:s=!1,notched:l,slots:d={},slotProps:u={},type:m="text",...g}=n,y=mme(n),x=Ai(),w=nf({props:n,muiFormControl:x,states:["color","disabled","error","focused","hiddenLabel","size","required"]}),S={...n,color:w.color||"primary",disabled:w.disabled,error:w.error,focused:w.focused,formControl:x,fullWidth:o,hiddenLabel:w.hiddenLabel,multiline:s,size:w.size,type:m},b=d.root??r.Root??gme,$=d.input??r.Input??vme,[k,T]=ur("notchedOutline",{elementType:yme,className:y.notchedOutline,shouldForwardComponentProp:!0,ownerState:S,externalForwardedProps:{slots:d,slotProps:u},additionalProps:{label:i!=null&&i!==""&&w.required?p.jsxs(C.Fragment,{children:[i," ","*"]}):i}});return p.jsx(B2,{slots:{root:b,input:$},slotProps:u,renderSuffix:O=>p.jsx(k,{...T,notched:typeof l<"u"?l:!!(O.startAdornment||O.filled||O.focused)}),fullWidth:o,inputComponent:a,multiline:s,ref:t,type:m,...g,classes:{...y,notchedOutline:null}})});H2.muiName="Input";function bme(e){return Cn("MuiFormLabel",e)}const Wg=fn("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),xme=e=>{const{classes:t,color:n,focused:r,disabled:o,error:a,filled:i,required:s}=e,l={root:["root",`color${Tt(n)}`,o&&"disabled",a&&"error",i&&"filled",r&&"focused",s&&"required"],asterisk:["asterisk",a&&"error"]};return bn(l,bme,t)},wme=nt("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color==="secondary"&&t.colorSecondary,n.filled&&t.filled]}})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(e.palette).filter(Ma()).map(([t])=>({props:{color:t},style:{[`&.${Wg.focused}`]:{color:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${Wg.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Wg.error}`]:{color:(e.vars||e).palette.error.main}}}]}))),Sme=nt("span",{name:"MuiFormLabel",slot:"Asterisk"})(Gn(({theme:e})=>({[`&.${Wg.error}`]:{color:(e.vars||e).palette.error.main}}))),Cme=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFormLabel"}),{children:r,className:o,color:a,component:i="label",disabled:s,error:l,filled:d,focused:u,required:m,...g}=n,y=Ai(),x=nf({props:n,muiFormControl:y,states:["color","required","focused","disabled","error","filled"]}),w={...n,color:x.color||"primary",component:i,disabled:x.disabled,error:x.error,filled:x.filled,focused:x.focused,required:x.required},S=xme(w);return p.jsxs(wme,{as:i,ownerState:w,className:Ht(S.root,o),ref:t,...g,children:[r,x.required&&p.jsxs(Sme,{ownerState:w,"aria-hidden":!0,className:S.asterisk,children:[" ","*"]})]})});function kme(e){return Cn("MuiInputLabel",e)}fn("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const $me=e=>{const{classes:t,formControl:n,size:r,shrink:o,disableAnimation:a,variant:i,required:s}=e,l={root:["root",n&&"formControl",!a&&"animated",o&&"shrink",r&&r!=="medium"&&`size${Tt(r)}`,i],asterisk:[s&&"asterisk"]},d=bn(l,kme,t);return{...t,...d}},Rme=nt(Cme,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiInputLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Wg.asterisk}`]:t.asterisk},t.root,n.formControl&&t.formControl,n.size==="small"&&t.sizeSmall,n.shrink&&t.shrink,!n.disableAnimation&&t.animated,n.focused&&t.focused,t[n.variant]]}})(Gn(({theme:e})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:t})=>t.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:t})=>t.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:t})=>!t.disableAnimation,style:{transition:e.transitions.create(["color","transform","max-width"],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:t,ownerState:n})=>t==="filled"&&n.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:t,ownerState:n,size:r})=>t==="filled"&&n.shrink&&r==="small",style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:t,ownerState:n})=>t==="outlined"&&n.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),I3=C.forwardRef(function(e,t){const n=Kn({name:"MuiInputLabel",props:e}),{disableAnimation:r=!1,margin:o,shrink:a,variant:i,className:s,...l}=n,d=Ai();let u=a;typeof u>"u"&&d&&(u=d.filled||d.focused||d.adornedStart);const m=nf({props:n,muiFormControl:d,states:["size","variant","required","focused"]}),g={...n,disableAnimation:r,formControl:d,shrink:u,size:m.size,variant:m.variant,required:m.required,focused:m.focused},y=$me(g);return p.jsx(Rme,{"data-shrink":u,ref:t,className:Ht(y.root,s),...l,ownerState:g,classes:y})});function Tme(e){return Cn("MuiFormControl",e)}fn("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const Eme=e=>{const{classes:t,margin:n,fullWidth:r}=e,o={root:["root",n!=="none"&&`margin${Tt(n)}`,r&&"fullWidth"]};return bn(o,Tme,t)},Mme=nt("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`margin${Tt(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),L3=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFormControl"}),{children:r,className:o,color:a="primary",component:i="div",disabled:s=!1,error:l=!1,focused:d,fullWidth:u=!1,hiddenLabel:m=!1,margin:g="none",required:y=!1,size:x="medium",variant:w="outlined",...S}=n,b={...n,color:a,component:i,disabled:s,error:l,fullWidth:u,hiddenLabel:m,margin:g,required:y,size:x,variant:w},$=Eme(b),[k,T]=C.useState(()=>{let N=!1;return r&&C.Children.forEach(r,B=>{if(!p0(B,["Input","Select"]))return;const I=p0(B,["Select"])?B.props.input:B;I&&eme(I.props)&&(N=!0)}),N}),[O,P]=C.useState(()=>{let N=!1;return r&&C.Children.forEach(r,B=>{p0(B,["Input","Select"])&&(G0(B.props,!0)||G0(B.props.inputProps,!0))&&(N=!0)}),N}),[D,A]=C.useState(!1);s&&D&&A(!1);const F=d!==void 0&&!s?d:D;let L;C.useRef(!1);const _=C.useCallback(()=>{P(!0)},[]),R=C.useCallback(()=>{P(!1)},[]),z=C.useMemo(()=>({adornedStart:k,setAdornedStart:T,color:a,disabled:s,error:l,filled:O,focused:F,fullWidth:u,hiddenLabel:m,size:x,onBlur:()=>{A(!1)},onFocus:()=>{A(!0)},onEmpty:R,onFilled:_,registerEffect:L,required:y,variant:w}),[k,a,s,l,O,F,u,m,L,R,_,y,x,w]);return p.jsx(S1.Provider,{value:z,children:p.jsx(Mme,{as:i,ownerState:b,className:Ht($.root,o),ref:t,...S,children:r})})});function Ome(e){return Cn("MuiFormHelperText",e)}const RN=fn("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]);var TN;const Pme=e=>{const{classes:t,contained:n,size:r,disabled:o,error:a,filled:i,focused:s,required:l}=e,d={root:["root",o&&"disabled",a&&"error",r&&`size${Tt(r)}`,n&&"contained",s&&"focused",i&&"filled",l&&"required"]};return bn(d,Ome,t)},jme=nt("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.size&&t[`size${Tt(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${RN.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${RN.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:"small"},style:{marginTop:4}},{props:({ownerState:t})=>t.contained,style:{marginLeft:14,marginRight:14}}]}))),z3=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFormHelperText"}),{children:r,className:o,component:a="p",disabled:i,error:s,filled:l,focused:d,margin:u,required:m,variant:g,...y}=n,x=Ai(),w=nf({props:n,muiFormControl:x,states:["variant","size","disabled","error","filled","focused","required"]}),S={...n,component:a,contained:w.variant==="filled"||w.variant==="outlined",variant:w.variant,size:w.size,disabled:w.disabled,error:w.error,filled:w.filled,focused:w.focused,required:w.required};delete S.ownerState;const b=Pme(S);return p.jsx(jme,{as:a,className:Ht(b.root,o),ref:t,...y,ownerState:S,children:r===" "?TN||(TN=p.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"})):r})});function kC(e,t,n){return e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:n?null:e.firstChild}function EN(e,t,n){return e===t?n?e.firstChild:e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:n?null:e.lastChild}function F3(e,t){if(t===void 0)return!0;let n=e.innerText;return n===void 0&&(n=e.textContent),n=n.trim().toLowerCase(),n.length===0?!1:t.repeating?n[0]===t.keys[0]:n.startsWith(t.keys.join(""))}function Zm(e,t,n,r,o,a){let i=!1,s=o(e,t,t?n:!1);for(;s;){if(s===e.firstChild){if(i)return!1;i=!0}const l=r?!1:s.disabled||s.getAttribute("aria-disabled")==="true";if(!s.hasAttribute("tabindex")||!F3(s,a)||l)s=o(e,s,n);else return s.focus(),!0}return!1}const Ame=C.forwardRef(function(e,t){const{actions:n,autoFocus:r=!1,autoFocusItem:o=!1,children:a,className:i,disabledItemsFocusable:s=!1,disableListWrap:l=!1,onKeyDown:d,variant:u="selectedMenu",...m}=e,g=C.useRef(null),y=C.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null});Go(()=>{r&&g.current.focus()},[r]),C.useImperativeHandle(n,()=>({adjustStyleForScrollbar:($,{direction:k})=>{const T=!g.current.style.width;if($.clientHeight<g.current.clientHeight&&T){const O=`${QF(pc($))}px`;g.current.style[k==="rtl"?"paddingLeft":"paddingRight"]=O,g.current.style.width=`calc(100% + ${O})`}return g.current}}),[]);const x=$=>{const k=g.current,T=$.key;if($.ctrlKey||$.metaKey||$.altKey){d&&d($);return}const O=Yo(k).activeElement;if(T==="ArrowDown")$.preventDefault(),Zm(k,O,l,s,kC);else if(T==="ArrowUp")$.preventDefault(),Zm(k,O,l,s,EN);else if(T==="Home")$.preventDefault(),Zm(k,null,l,s,kC);else if(T==="End")$.preventDefault(),Zm(k,null,l,s,EN);else if(T.length===1){const P=y.current,D=T.toLowerCase(),A=performance.now();P.keys.length>0&&(A-P.lastTime>500?(P.keys=[],P.repeating=!0,P.previousKeyMatched=!0):P.repeating&&D!==P.keys[0]&&(P.repeating=!1)),P.lastTime=A,P.keys.push(D);const F=O&&!P.repeating&&F3(O,P);P.previousKeyMatched&&(F||Zm(k,O,!1,s,kC,P))?$.preventDefault():P.previousKeyMatched=!1}d&&d($)},w=vr(g,t);let S=-1;C.Children.forEach(a,($,k)=>{if(!C.isValidElement($)){S===k&&(S+=1,S>=a.length&&(S=-1));return}$.props.disabled||(u==="selectedMenu"&&$.props.selected||S===-1)&&(S=k),S===k&&($.props.disabled||$.props.muiSkipListHighlight||$.type.muiSkipListHighlight)&&(S+=1,S>=a.length&&(S=-1))});const b=C.Children.map(a,($,k)=>{if(k===S){const T={};return o&&(T.autoFocus=!0),$.props.tabIndex===void 0&&u==="selectedMenu"&&(T.tabIndex=0),C.cloneElement($,T)}return $});return p.jsx(P3,{role:"menu",ref:w,className:i,onKeyDown:x,tabIndex:r?0:-1,...m,children:b})});function Dme(e){const t=Yo(e);return t.body===e?pc(e).innerWidth>t.documentElement.clientWidth:e.scrollHeight>e.clientHeight}function Yg(e,t){t?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden")}function MN(e){return parseInt(pc(e).getComputedStyle(e).paddingRight,10)||0}function Nme(e){const t=["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].includes(e.tagName),n=e.tagName==="INPUT"&&e.getAttribute("type")==="hidden";return t||n}function ON(e,t,n,r,o){const a=[t,n,...r];[].forEach.call(e.children,i=>{const s=!a.includes(i),l=!Nme(i);s&&l&&Yg(i,o)})}function $C(e,t){let n=-1;return e.some((r,o)=>t(r)?(n=o,!0):!1),n}function Ime(e,t){const n=[],r=e.container;if(!t.disableScrollLock){if(Dme(r)){const a=QF(pc(r));n.push({value:r.style.paddingRight,property:"padding-right",el:r}),r.style.paddingRight=`${MN(r)+a}px`;const i=Yo(r).querySelectorAll(".mui-fixed");[].forEach.call(i,s=>{n.push({value:s.style.paddingRight,property:"padding-right",el:s}),s.style.paddingRight=`${MN(s)+a}px`})}let o;if(r.parentNode instanceof DocumentFragment)o=Yo(r).body;else{const a=r.parentElement,i=pc(r);o=a?.nodeName==="HTML"&&i.getComputedStyle(a).overflowY==="scroll"?a:r}n.push({value:o.style.overflow,property:"overflow",el:o},{value:o.style.overflowX,property:"overflow-x",el:o},{value:o.style.overflowY,property:"overflow-y",el:o}),o.style.overflow="hidden"}return()=>{n.forEach(({value:o,el:a,property:i})=>{o?a.style.setProperty(i,o):a.style.removeProperty(i)})}}function Lme(e){const t=[];return[].forEach.call(e.children,n=>{n.getAttribute("aria-hidden")==="true"&&t.push(n)}),t}class zme{constructor(){this.modals=[],this.containers=[]}add(t,n){let r=this.modals.indexOf(t);if(r!==-1)return r;r=this.modals.length,this.modals.push(t),t.modalRef&&Yg(t.modalRef,!1);const o=Lme(n);ON(n,t.mount,t.modalRef,o,!0);const a=$C(this.containers,i=>i.container===n);return a!==-1?(this.containers[a].modals.push(t),r):(this.containers.push({modals:[t],container:n,restore:null,hiddenSiblings:o}),r)}mount(t,n){const r=$C(this.containers,a=>a.modals.includes(t)),o=this.containers[r];o.restore||(o.restore=Ime(o,n))}remove(t,n=!0){const r=this.modals.indexOf(t);if(r===-1)return r;const o=$C(this.containers,i=>i.modals.includes(t)),a=this.containers[o];if(a.modals.splice(a.modals.indexOf(t),1),this.modals.splice(r,1),a.modals.length===0)a.restore&&a.restore(),t.modalRef&&Yg(t.modalRef,n),ON(a.container,t.mount,t.modalRef,a.hiddenSiblings,!1),this.containers.splice(o,1);else{const i=a.modals[a.modals.length-1];i.modalRef&&Yg(i.modalRef,!1)}return r}isTopModal(t){return this.modals.length>0&&this.modals[this.modals.length-1]===t}}function Fme(e){return Cn("MuiBackdrop",e)}fn("MuiBackdrop",["root","invisible"]);const _me=e=>{const{classes:t,invisible:n}=e;return bn({root:["root",n&&"invisible"]},Fme,t)},Bme=nt("div",{name:"MuiBackdrop",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.invisible&&t.invisible]}})({position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",right:0,bottom:0,top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.5)",WebkitTapHighlightColor:"transparent",variants:[{props:{invisible:!0},style:{backgroundColor:"transparent"}}]}),_3=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiBackdrop"}),{children:r,className:o,component:a="div",invisible:i=!1,open:s,components:l={},componentsProps:d={},slotProps:u={},slots:m={},TransitionComponent:g,transitionDuration:y,...x}=n,w={...n,component:a,invisible:i},S=_me(w),b={transition:g,root:l.Root,...m},$={...d,...u},k={component:a,slots:b,slotProps:$},[T,O]=ur("root",{elementType:Bme,externalForwardedProps:k,className:Ht(S.root,o),ownerState:w}),[P,D]=ur("transition",{elementType:Hd,externalForwardedProps:k,ownerState:w});return p.jsx(P,{in:s,timeout:y,...x,...D,children:p.jsx(T,{"aria-hidden":!0,...O,classes:S,ref:t,children:r})})});function Ume(e){return typeof e=="function"?e():e}function qme(e){return e?e.props.hasOwnProperty("in"):!1}const PN=()=>{},Db=new zme;function Hme(e){const{container:t,disableEscapeKeyDown:n=!1,disableScrollLock:r=!1,closeAfterTransition:o=!1,onTransitionEnter:a,onTransitionExited:i,children:s,onClose:l,open:d,rootRef:u}=e,m=C.useRef({}),g=C.useRef(null),y=C.useRef(null),x=vr(y,u),[w,S]=C.useState(!d),b=qme(s);let $=!0;(e["aria-hidden"]==="false"||e["aria-hidden"]===!1)&&($=!1);const k=()=>Yo(g.current),T=()=>(m.current.modalRef=y.current,m.current.mount=g.current,m.current),O=()=>{Db.mount(T(),{disableScrollLock:r}),y.current&&(y.current.scrollTop=0)},P=Yt(()=>{const R=Ume(t)||k().body;Db.add(T(),R),y.current&&O()}),D=()=>Db.isTopModal(T()),A=Yt(R=>{g.current=R,R&&(d&&D()?O():y.current&&Yg(y.current,$))}),F=C.useCallback(()=>{Db.remove(T(),$)},[$]);C.useEffect(()=>()=>{F()},[F]),C.useEffect(()=>{d?P():(!b||!o)&&F()},[d,F,b,o,P]);const L=R=>z=>{R.onKeyDown?.(z),!(z.key!=="Escape"||z.which===229||!D())&&(n||(z.stopPropagation(),l&&l(z,"escapeKeyDown")))},_=R=>z=>{R.onClick?.(z),z.target===z.currentTarget&&l&&l(z,"backdropClick")};return{getRootProps:(R={})=>{const z=q0(e);delete z.onTransitionEnter,delete z.onTransitionExited;const N={...z,...R};return{role:"presentation",...N,onKeyDown:L(N),ref:x}},getBackdropProps:(R={})=>{const z=R;return{"aria-hidden":!0,...z,onClick:_(z),open:d}},getTransitionProps:()=>{const R=()=>{S(!1),a&&a()},z=()=>{S(!0),i&&i(),o&&F()};return{onEnter:nD(R,s?.props.onEnter??PN),onExited:nD(z,s?.props.onExited??PN)}},rootRef:x,portalRef:A,isTopModal:D,exited:w,hasTransition:b}}function Vme(e){return Cn("MuiModal",e)}fn("MuiModal",["root","hidden","backdrop"]);const Wme=e=>{const{open:t,exited:n,classes:r}=e;return bn({root:["root",!t&&n&&"hidden"],backdrop:["backdrop"]},Vme,r)},Yme=nt("div",{name:"MuiModal",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.open&&n.exited&&t.hidden]}})(Gn(({theme:e})=>({position:"fixed",zIndex:(e.vars||e).zIndex.modal,right:0,bottom:0,top:0,left:0,variants:[{props:({ownerState:t})=>!t.open&&t.exited,style:{visibility:"hidden"}}]}))),Gme=nt(_3,{name:"MuiModal",slot:"Backdrop"})({zIndex:-1}),B3=C.forwardRef(function(e,t){const n=Kn({name:"MuiModal",props:e}),{BackdropComponent:r=Gme,BackdropProps:o,classes:a,className:i,closeAfterTransition:s=!1,children:l,container:d,component:u,components:m={},componentsProps:g={},disableAutoFocus:y=!1,disableEnforceFocus:x=!1,disableEscapeKeyDown:w=!1,disablePortal:S=!1,disableRestoreFocus:b=!1,disableScrollLock:$=!1,hideBackdrop:k=!1,keepMounted:T=!1,onClose:O,onTransitionEnter:P,onTransitionExited:D,open:A,slotProps:F={},slots:L={},theme:_,...R}=n,z={...n,closeAfterTransition:s,disableAutoFocus:y,disableEnforceFocus:x,disableEscapeKeyDown:w,disablePortal:S,disableRestoreFocus:b,disableScrollLock:$,hideBackdrop:k,keepMounted:T},{getRootProps:N,getBackdropProps:B,getTransitionProps:I,portalRef:H,isTopModal:Y,exited:ae,hasTransition:K}=Hme({...z,rootRef:t}),oe={...z,exited:ae},ue=Wme(oe),G={};if(l.props.tabIndex===void 0&&(G.tabIndex="-1"),K){const{onEnter:le,onExited:fe}=I();G.onEnter=le,G.onExited=fe}const ie={slots:{root:m.Root,backdrop:m.Backdrop,...L},slotProps:{...g,...F}},[Q,ee]=ur("root",{ref:t,elementType:Yme,externalForwardedProps:{...ie,...R,component:u},getSlotProps:N,ownerState:oe,className:Ht(i,ue?.root,!oe.open&&oe.exited&&ue?.hidden)}),[Z,de]=ur("backdrop",{ref:o?.ref,elementType:r,externalForwardedProps:ie,shouldForwardComponentProp:!0,additionalProps:o,getSlotProps:le=>B({...le,onClick:fe=>{le?.onClick&&le.onClick(fe)}}),className:Ht(o?.className,ue?.backdrop),ownerState:oe});return!T&&!A&&(!K||ae)?null:p.jsx(k3,{ref:H,container:d,disablePortal:S,children:p.jsxs(Q,{...ee,children:[!k&&r?p.jsx(Z,{...de}):null,p.jsx($3,{disableEnforceFocus:x,disableAutoFocus:y,disableRestoreFocus:b,isEnabled:Y,open:A,children:C.cloneElement(l,G)})]})})});function Kme(e){return Cn("MuiPopover",e)}fn("MuiPopover",["root","paper"]);function jN(e,t){let n=0;return typeof t=="number"?n=t:t==="center"?n=e.height/2:t==="bottom"&&(n=e.height),n}function AN(e,t){let n=0;return typeof t=="number"?n=t:t==="center"?n=e.width/2:t==="right"&&(n=e.width),n}function DN(e){return[e.horizontal,e.vertical].map(t=>typeof t=="number"?`${t}px`:t).join(" ")}function Nb(e){return typeof e=="function"?e():e}const Qme=e=>{const{classes:t}=e;return bn({root:["root"],paper:["paper"]},Kme,t)},Xme=nt(B3,{name:"MuiPopover",slot:"Root"})({}),U3=nt(tf,{name:"MuiPopover",slot:"Paper"})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),Zme=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiPopover"}),{action:r,anchorEl:o,anchorOrigin:a={vertical:"top",horizontal:"left"},anchorPosition:i,anchorReference:s="anchorEl",children:l,className:d,container:u,elevation:m=8,marginThreshold:g=16,open:y,PaperProps:x={},slots:w={},slotProps:S={},transformOrigin:b={vertical:"top",horizontal:"left"},TransitionComponent:$,transitionDuration:k="auto",TransitionProps:T={},disableScrollLock:O=!1,...P}=n,D=C.useRef(),A={...n,anchorOrigin:a,anchorReference:s,elevation:m,marginThreshold:g,transformOrigin:b,TransitionComponent:$,transitionDuration:k,TransitionProps:T},F=Qme(A),L=C.useCallback(()=>{if(s==="anchorPosition")return i;const le=Nb(o),fe=(le&&le.nodeType===1?le:Yo(D.current).body).getBoundingClientRect();return{top:fe.top+jN(fe,a.vertical),left:fe.left+AN(fe,a.horizontal)}},[o,a.horizontal,a.vertical,i,s]),_=C.useCallback(le=>({vertical:jN(le,b.vertical),horizontal:AN(le,b.horizontal)}),[b.horizontal,b.vertical]),R=C.useCallback(le=>{const fe={width:le.offsetWidth,height:le.offsetHeight},he=_(fe);if(s==="none")return{top:null,left:null,transformOrigin:DN(he)};const me=L();let se=me.top-he.vertical,ve=me.left-he.horizontal;const Le=se+fe.height,Ae=ve+fe.width,Re=pc(Nb(o)),re=Re.innerHeight-g,_e=Re.innerWidth-g;if(g!==null&&se<g){const Me=se-g;se-=Me,he.vertical+=Me}else if(g!==null&&Le>re){const Me=Le-re;se-=Me,he.vertical+=Me}if(g!==null&&ve<g){const Me=ve-g;ve-=Me,he.horizontal+=Me}else if(Ae>_e){const Me=Ae-_e;ve-=Me,he.horizontal+=Me}return{top:`${Math.round(se)}px`,left:`${Math.round(ve)}px`,transformOrigin:DN(he)}},[o,s,L,_,g]),[z,N]=C.useState(y),B=C.useCallback(()=>{const le=D.current;if(!le)return;const fe=R(le);fe.top!==null&&le.style.setProperty("top",fe.top),fe.left!==null&&(le.style.left=fe.left),le.style.transformOrigin=fe.transformOrigin,N(!0)},[R]);C.useEffect(()=>(O&&window.addEventListener("scroll",B),()=>window.removeEventListener("scroll",B)),[o,O,B]);const I=()=>{B()},H=()=>{N(!1)};C.useEffect(()=>{y&&B()}),C.useImperativeHandle(r,()=>y?{updatePosition:()=>{B()}}:null,[y,B]),C.useEffect(()=>{if(!y)return;const le=oF(()=>{B()}),fe=pc(Nb(o));return fe.addEventListener("resize",le),()=>{le.clear(),fe.removeEventListener("resize",le)}},[o,y,B]);let Y=k;const ae={slots:{transition:$,...w},slotProps:{transition:T,paper:x,...S}},[K,oe]=ur("transition",{elementType:gy,externalForwardedProps:ae,ownerState:A,getSlotProps:le=>({...le,onEntering:(fe,he)=>{le.onEntering?.(fe,he),I()},onExited:fe=>{le.onExited?.(fe),H()}}),additionalProps:{appear:!0,in:y}});k==="auto"&&!K.muiSupportAuto&&(Y=void 0);const ue=u||(o?Yo(Nb(o)).body:void 0),[G,{slots:ie,slotProps:Q,...ee}]=ur("root",{ref:t,elementType:Xme,externalForwardedProps:{...ae,...P},shouldForwardComponentProp:!0,additionalProps:{slots:{backdrop:w.backdrop},slotProps:{backdrop:aF(typeof S.backdrop=="function"?S.backdrop(A):S.backdrop,{invisible:!0})},container:ue,open:y},ownerState:A,className:Ht(F.root,d)}),[Z,de]=ur("paper",{ref:D,className:F.paper,elementType:U3,externalForwardedProps:ae,shouldForwardComponentProp:!0,additionalProps:{elevation:m,style:z?void 0:{opacity:0}},ownerState:A});return p.jsx(G,{...ee,...!Jp(G)&&{slots:ie,slotProps:Q,disableScrollLock:O},children:p.jsx(K,{...oe,timeout:Y,children:p.jsx(Z,{...de,children:l})})})});function Jme(e){return Cn("MuiMenu",e)}fn("MuiMenu",["root","paper","list"]);const ege={vertical:"top",horizontal:"right"},tge={vertical:"top",horizontal:"left"},nge=e=>{const{classes:t}=e;return bn({root:["root"],paper:["paper"],list:["list"]},Jme,t)},rge=nt(Zme,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiMenu",slot:"Root"})({}),oge=nt(U3,{name:"MuiMenu",slot:"Paper"})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),age=nt(Ame,{name:"MuiMenu",slot:"List"})({outline:0}),ige=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiMenu"}),{autoFocus:r=!0,children:o,className:a,disableAutoFocusItem:i=!1,MenuListProps:s={},onClose:l,open:d,PaperProps:u={},PopoverClasses:m,transitionDuration:g="auto",TransitionProps:{onEntering:y,...x}={},variant:w="selectedMenu",slots:S={},slotProps:b={},...$}=n,k=Fs(),T={...n,autoFocus:r,disableAutoFocusItem:i,MenuListProps:s,onEntering:y,PaperProps:u,transitionDuration:g,TransitionProps:x,variant:w},O=nge(T),P=r&&!i&&d,D=C.useRef(null),A=(Y,ae)=>{D.current&&D.current.adjustStyleForScrollbar(Y,{direction:k?"rtl":"ltr"}),y&&y(Y,ae)},F=Y=>{Y.key==="Tab"&&(Y.preventDefault(),l&&l(Y,"tabKeyDown"))};let L=-1;C.Children.map(o,(Y,ae)=>{C.isValidElement(Y)&&(Y.props.disabled||(w==="selectedMenu"&&Y.props.selected||L===-1)&&(L=ae))});const _={slots:S,slotProps:{list:s,transition:x,paper:u,...b}},R=Cr({elementType:S.root,externalSlotProps:b.root,ownerState:T,className:[O.root,a]}),[z,N]=ur("paper",{className:O.paper,elementType:oge,externalForwardedProps:_,shouldForwardComponentProp:!0,ownerState:T}),[B,I]=ur("list",{className:Ht(O.list,s.className),elementType:age,shouldForwardComponentProp:!0,externalForwardedProps:_,getSlotProps:Y=>({...Y,onKeyDown:ae=>{F(ae),Y.onKeyDown?.(ae)}}),ownerState:T}),H=typeof _.slotProps.transition=="function"?_.slotProps.transition(T):_.slotProps.transition;return p.jsx(rge,{onClose:l,anchorOrigin:{vertical:"bottom",horizontal:k?"right":"left"},transformOrigin:k?ege:tge,slots:{root:S.root,paper:z,backdrop:S.backdrop,...S.transition&&{transition:S.transition}},slotProps:{root:R,paper:N,backdrop:typeof b.backdrop=="function"?b.backdrop(T):b.backdrop,transition:{...H,onEntering:(...Y)=>{A(...Y),H?.onEntering?.(...Y)}}},open:d,ref:t,transitionDuration:g,ownerState:T,...$,classes:m,children:p.jsx(B,{actions:D,autoFocus:r&&(L===-1||i),autoFocusItem:P,variant:w,...I,children:o})})});function sge(e){return Cn("MuiNativeSelect",e)}const V2=fn("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),lge=e=>{const{classes:t,variant:n,disabled:r,multiple:o,open:a,error:i}=e,s={select:["select",n,r&&"disabled",o&&"multiple",i&&"error"],icon:["icon",`icon${Tt(n)}`,a&&"iconOpen",r&&"disabled"]};return bn(s,sge,t)},q3=nt("select",{name:"MuiNativeSelect"})(({theme:e})=>({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":{borderRadius:0},[`&.${V2.disabled}`]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:t})=>t.variant!=="filled"&&t.variant!=="outlined",style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:"filled"},style:{"&&&":{paddingRight:32}}},{props:{variant:"outlined"},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),cge=nt(q3,{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:ei,overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${V2.multiple}`]:t.multiple}]}})({}),H3=nt("svg",{name:"MuiNativeSelect"})(({theme:e})=>({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(e.vars||e).palette.action.active,[`&.${V2.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:t})=>t.open,style:{transform:"rotate(180deg)"}},{props:{variant:"filled"},style:{right:7}},{props:{variant:"outlined"},style:{right:7}}]})),uge=nt(H3,{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${Tt(n.variant)}`],n.open&&t.iconOpen]}})({}),dge=C.forwardRef(function(e,t){const{className:n,disabled:r,error:o,IconComponent:a,inputRef:i,variant:s="standard",...l}=e,d={...e,disabled:r,variant:s,error:o},u=lge(d);return p.jsxs(C.Fragment,{children:[p.jsx(cge,{ownerState:d,className:Ht(u.select,n),disabled:r,ref:i||t,...l}),e.multiple?null:p.jsx(uge,{as:a,ownerState:d,className:u.icon})]})});function V3(e){return Cn("MuiSelect",e)}const Jm=fn("MuiSelect",["root","select","multiple","filled","outlined","standard","disabled","focused","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]);var NN;const fge=nt(q3,{name:"MuiSelect",slot:"Select",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`&.${Jm.select}`]:t.select},{[`&.${Jm.select}`]:t[n.variant]},{[`&.${Jm.error}`]:t.error},{[`&.${Jm.multiple}`]:t.multiple}]}})({[`&.${Jm.select}`]:{height:"auto",minHeight:"1.4375em",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}}),pge=nt(H3,{name:"MuiSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${Tt(n.variant)}`],n.open&&t.iconOpen]}})({}),hge=nt("input",{shouldForwardProp:e=>rF(e)&&e!=="classes",name:"MuiSelect",slot:"NativeInput"})({bottom:0,left:0,position:"absolute",opacity:0,pointerEvents:"none",width:"100%",boxSizing:"border-box"});function IN(e,t){return typeof t=="object"&&t!==null?e===t:String(e)===String(t)}function mge(e){return e==null||typeof e=="string"&&!e.trim()}const gge=e=>{const{classes:t,variant:n,disabled:r,multiple:o,open:a,error:i}=e,s={select:["select",n,r&&"disabled",o&&"multiple",i&&"error"],icon:["icon",`icon${Tt(n)}`,a&&"iconOpen",r&&"disabled"],nativeInput:["nativeInput"]};return bn(s,V3,t)},yge=C.forwardRef(function(e,t){const{"aria-describedby":n,"aria-label":r,autoFocus:o,autoWidth:a,children:i,className:s,defaultOpen:l,defaultValue:d,disabled:u,displayEmpty:m,error:g=!1,IconComponent:y,inputRef:x,labelId:w,MenuProps:S={},multiple:b,name:$,onBlur:k,onChange:T,onClose:O,onFocus:P,onOpen:D,open:A,readOnly:F,renderValue:L,required:_,SelectDisplayProps:R={},tabIndex:z,type:N,value:B,variant:I="standard",...H}=e,[Y,ae]=Ti({controlled:B,default:d,name:"Select"}),[K,oe]=Ti({controlled:A,default:l,name:"Select"}),ue=C.useRef(null),G=C.useRef(null),[ie,Q]=C.useState(null),{current:ee}=C.useRef(A!=null),[Z,de]=C.useState(),le=vr(t,x),fe=C.useCallback(vt=>{G.current=vt,vt&&Q(vt)},[]),he=ie?.parentNode;C.useImperativeHandle(le,()=>({focus:()=>{G.current.focus()},node:ue.current,value:Y}),[Y]),C.useEffect(()=>{l&&K&&ie&&!ee&&(de(a?null:he.clientWidth),G.current.focus())},[ie,a]),C.useEffect(()=>{o&&G.current.focus()},[o]),C.useEffect(()=>{if(!w)return;const vt=Yo(G.current).getElementById(w);if(vt){const it=()=>{getSelection().isCollapsed&&G.current.focus()};return vt.addEventListener("click",it),()=>{vt.removeEventListener("click",it)}}},[w]);const me=(vt,it)=>{vt?D&&D(it):O&&O(it),ee||(de(a?null:he.clientWidth),oe(vt))},se=vt=>{vt.button===0&&(vt.preventDefault(),G.current.focus(),me(!0,vt))},ve=vt=>{me(!1,vt)},Le=C.Children.toArray(i),Ae=vt=>{const it=Le.find(st=>st.props.value===vt.target.value);it!==void 0&&(ae(it.props.value),T&&T(vt,it))},Re=vt=>it=>{let st;if(it.currentTarget.hasAttribute("tabindex")){if(b){st=Array.isArray(Y)?Y.slice():[];const Dt=Y.indexOf(vt.props.value);Dt===-1?st.push(vt.props.value):st.splice(Dt,1)}else st=vt.props.value;if(vt.props.onClick&&vt.props.onClick(it),Y!==st&&(ae(st),T)){const Dt=it.nativeEvent||it,nn=new Dt.constructor(Dt.type,Dt);Object.defineProperty(nn,"target",{writable:!0,value:{value:st,name:$}}),T(nn,vt)}b||me(!1,it)}},re=vt=>{F||[" ","ArrowUp","ArrowDown","Enter"].includes(vt.key)&&(vt.preventDefault(),me(!0,vt))},_e=ie!==null&&K,Me=vt=>{!_e&&k&&(Object.defineProperty(vt,"target",{writable:!0,value:{value:Y,name:$}}),k(vt))};delete H["aria-invalid"];let Ge,Je;const St=[];let Ut=!1;(G0({value:Y})||m)&&(L?Ge=L(Y):Ut=!0);const at=Le.map(vt=>{if(!C.isValidElement(vt))return null;let it;if(b){if(!Array.isArray(Y))throw new Error(dc(2));it=Y.some(st=>IN(st,vt.props.value)),it&&Ut&&St.push(vt.props.children)}else it=IN(Y,vt.props.value),it&&Ut&&(Je=vt.props.children);return C.cloneElement(vt,{"aria-selected":it?"true":"false",onClick:Re(vt),onKeyUp:st=>{st.key===" "&&st.preventDefault(),vt.props.onKeyUp&&vt.props.onKeyUp(st)},role:"option",selected:it,value:void 0,"data-value":vt.props.value})});Ut&&(b?St.length===0?Ge=null:Ge=St.reduce((vt,it,st)=>(vt.push(it),st<St.length-1&&vt.push(", "),vt),[]):Ge=Je);let tt=Z;!a&&ee&&ie&&(tt=he.clientWidth);let pt;typeof z<"u"?pt=z:pt=u?null:0;const ze=R.id||($?`mui-component-select-${$}`:void 0),be={...e,variant:I,value:Y,open:_e,error:g},Ve=gge(be),Oe={...S.PaperProps,...typeof S.slotProps?.paper=="function"?S.slotProps.paper(be):S.slotProps?.paper},$t={...S.MenuListProps,...typeof S.slotProps?.list=="function"?S.slotProps.list(be):S.slotProps?.list},Rt=_s();return p.jsxs(C.Fragment,{children:[p.jsx(fge,{as:"div",ref:fe,tabIndex:pt,role:"combobox","aria-controls":_e?Rt:void 0,"aria-disabled":u?"true":void 0,"aria-expanded":_e?"true":"false","aria-haspopup":"listbox","aria-label":r,"aria-labelledby":[w,ze].filter(Boolean).join(" ")||void 0,"aria-describedby":n,"aria-required":_?"true":void 0,"aria-invalid":g?"true":void 0,onKeyDown:re,onMouseDown:u||F?null:se,onBlur:Me,onFocus:P,...R,ownerState:be,className:Ht(R.className,Ve.select,s),id:ze,children:mge(Ge)?NN||(NN=p.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"})):Ge}),p.jsx(hge,{"aria-invalid":g,value:Array.isArray(Y)?Y.join(","):Y,name:$,ref:ue,"aria-hidden":!0,onChange:Ae,tabIndex:-1,disabled:u,className:Ve.nativeInput,autoFocus:o,required:_,...H,ownerState:be}),p.jsx(pge,{as:y,className:Ve.icon,ownerState:be}),p.jsx(ige,{id:`menu-${$||""}`,anchorEl:he,open:_e,onClose:ve,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...S,slotProps:{...S.slotProps,list:{"aria-labelledby":w,role:"listbox","aria-multiselectable":b?"true":void 0,disableListWrap:!0,id:Rt,...$t},paper:{...Oe,style:{minWidth:tt,...Oe!=null?Oe.style:null}}},children:at})]})}),W3=Jt(p.jsx("path",{d:"M7 10l5 5 5-5z"})),vge=e=>{const{classes:t}=e,n=bn({root:["root"]},V3,t);return{...t,...n}},W2={name:"MuiSelect",slot:"Root",shouldForwardProp:e=>ei(e)&&e!=="variant"},bge=nt(U2,W2)(""),xge=nt(H2,W2)(""),wge=nt(q2,W2)(""),Y3=C.forwardRef(function(e,t){const n=Kn({name:"MuiSelect",props:e}),{autoWidth:r=!1,children:o,classes:a={},className:i,defaultOpen:s=!1,displayEmpty:l=!1,IconComponent:d=W3,id:u,input:m,inputProps:g,label:y,labelId:x,MenuProps:w,multiple:S=!1,native:b=!1,onClose:$,onOpen:k,open:T,renderValue:O,SelectDisplayProps:P,variant:D="outlined",...A}=n,F=b?dge:yge,L=Ai(),_=nf({props:n,muiFormControl:L,states:["variant","error"]}),R=_.variant||D,z={...n,variant:R,classes:a},N=vge(z),{root:B,...I}=N,H=m||{standard:p.jsx(bge,{ownerState:z}),outlined:p.jsx(xge,{label:y,ownerState:z}),filled:p.jsx(wge,{ownerState:z})}[R],Y=vr(t,wh(H));return p.jsx(C.Fragment,{children:C.cloneElement(H,{inputComponent:F,inputProps:{children:o,error:_.error,IconComponent:d,variant:R,type:void 0,multiple:S,...b?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:l,labelId:x,MenuProps:w,onClose:$,onOpen:k,open:T,renderValue:O,SelectDisplayProps:{id:u,...P}},...g,classes:g?xa(I,g.classes):I,...m?m.props.inputProps:{}},...(S&&b||l)&&R==="outlined"?{notched:!0}:{},ref:Y,className:Ht(H.props.className,i,N.root),...!m&&{variant:R},...A})})});Y3.muiName="Select";function Sge(e){return Cn("MuiTextField",e)}fn("MuiTextField",["root"]);const Cge={standard:U2,filled:q2,outlined:H2},kge=e=>{const{classes:t}=e;return bn({root:["root"]},Sge,t)},$ge=nt(L3,{name:"MuiTextField",slot:"Root"})({}),yr=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiTextField"}),{autoComplete:r,autoFocus:o=!1,children:a,className:i,color:s="primary",defaultValue:l,disabled:d=!1,error:u=!1,FormHelperTextProps:m,fullWidth:g=!1,helperText:y,id:x,InputLabelProps:w,inputProps:S,InputProps:b,inputRef:$,label:k,maxRows:T,minRows:O,multiline:P=!1,name:D,onBlur:A,onChange:F,onFocus:L,placeholder:_,required:R=!1,rows:z,select:N=!1,SelectProps:B,slots:I={},slotProps:H={},type:Y,value:ae,variant:K="outlined",...oe}=n,ue={...n,autoFocus:o,color:s,disabled:d,error:u,fullWidth:g,multiline:P,required:R,select:N,variant:K},G=kge(ue),ie=_s(x),Q=y&&ie?`${ie}-helper-text`:void 0,ee=k&&ie?`${ie}-label`:void 0,Z=Cge[K],de={slots:I,slotProps:{input:b,inputLabel:w,htmlInput:S,formHelperText:m,select:B,...H}},le={},fe=de.slotProps.inputLabel;K==="outlined"&&(fe&&typeof fe.shrink<"u"&&(le.notched=fe.shrink),le.label=k),N&&((!B||!B.native)&&(le.id=void 0),le["aria-describedby"]=void 0);const[he,me]=ur("root",{elementType:$ge,shouldForwardComponentProp:!0,externalForwardedProps:{...de,...oe},ownerState:ue,className:Ht(G.root,i),ref:t,additionalProps:{disabled:d,error:u,fullWidth:g,required:R,color:s,variant:K}}),[se,ve]=ur("input",{elementType:Z,externalForwardedProps:de,additionalProps:le,ownerState:ue}),[Le,Ae]=ur("inputLabel",{elementType:I3,externalForwardedProps:de,ownerState:ue}),[Re,re]=ur("htmlInput",{elementType:"input",externalForwardedProps:de,ownerState:ue}),[_e,Me]=ur("formHelperText",{elementType:z3,externalForwardedProps:de,ownerState:ue}),[Ge,Je]=ur("select",{elementType:Y3,externalForwardedProps:de,ownerState:ue}),St=p.jsx(se,{"aria-describedby":Q,autoComplete:r,autoFocus:o,defaultValue:l,fullWidth:g,multiline:P,name:D,rows:z,maxRows:T,minRows:O,type:Y,value:ae,id:ie,inputRef:$,onBlur:A,onChange:F,onFocus:L,placeholder:_,inputProps:re,slots:{input:I.htmlInput?Re:void 0},...ve});return p.jsxs(he,{...me,children:[k!=null&&k!==""&&p.jsx(Le,{htmlFor:ie,id:ee,...Ae,children:k}),N?p.jsx(Ge,{"aria-describedby":Q,id:ie,labelId:ee,value:ae,input:St,...Je,children:a}):St,y&&p.jsx(_e,{id:Q,...Me,children:y})]})}),Rge=({utils:e,format:t})=>{let n=10,r=t,o=e.expandFormat(t);for(;o!==r;)if(r=o,o=e.expandFormat(r),n-=1,n<0)throw new Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the picker component.");return o},Tge=({utils:e,expandedFormat:t})=>{const n=[],{start:r,end:o}=e.escapedCharacters,a=new RegExp(`(\\${r}[^\\${o}]*\\${o})+`,"g");let i=null;for(;i=a.exec(t);)n.push({start:i.index,end:a.lastIndex-1});return n},Ege=(e,t,n,r)=>{switch(n.type){case"year":return t.fieldYearPlaceholder({digitAmount:e.formatByString(e.date(void 0,"default"),r).length,format:r});case"month":return t.fieldMonthPlaceholder({contentType:n.contentType,format:r});case"day":return t.fieldDayPlaceholder({format:r});case"weekDay":return t.fieldWeekDayPlaceholder({contentType:n.contentType,format:r});case"hours":return t.fieldHoursPlaceholder({format:r});case"minutes":return t.fieldMinutesPlaceholder({format:r});case"seconds":return t.fieldSecondsPlaceholder({format:r});case"meridiem":return t.fieldMeridiemPlaceholder({format:r});default:return r}},Mge=({utils:e,date:t,shouldRespectLeadingZeros:n,localeText:r,localizedDigits:o,now:a,token:i,startSeparator:s})=>{if(i==="")throw new Error("MUI X: Should not call `commitToken` with an empty token");const l=e3(e,i),d=o3(e,l.contentType,l.type,i),u=n?d:l.contentType==="digit",m=t!=null&&e.isValid(t);let g=m?e.formatByString(t,i):"",y=null;if(u)if(d)y=g===""?e.formatByString(a,i).length:g.length;else{if(l.maxLength==null)throw new Error(`MUI X: The token ${i} should have a 'maxDigitNumber' property on it's adapter`);y=l.maxLength,m&&(g=k2(n3(Ud(g,o),y),o))}return Fe({},l,{format:i,maxLength:y,value:g,placeholder:Ege(e,r,l,i),hasLeadingZerosInFormat:d,hasLeadingZerosInInput:u,startSeparator:s,endSeparator:"",modified:!1})},Oge=e=>{const{utils:t,expandedFormat:n,escapedParts:r}=e,o=t.date(void 0),a=[];let i="";const s=Object.keys(t.formatTokenMap).sort((y,x)=>x.length-y.length),l=/^([a-zA-Z]+)/,d=new RegExp(`^(${s.join("|")})*$`),u=new RegExp(`^(${s.join("|")})`),m=y=>r.find(x=>x.start<=y&&x.end>=y);let g=0;for(;g<n.length;){const y=m(g),x=y!=null,w=l.exec(n.slice(g))?.[1];if(!x&&w!=null&&d.test(w)){let S=w;for(;S.length>0;){const b=u.exec(S)[1];S=S.slice(b.length),a.push(Mge(Fe({},e,{now:o,token:b,startSeparator:i}))),i=""}g+=w.length}else{const S=n[g];x&&y?.start===g||y?.end===g||(a.length===0?i+=S:a[a.length-1].endSeparator+=S),g+=1}}return a.length===0&&i.length>0&&a.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:i,endSeparator:"",modified:!1}),a},Pge=({isRtl:e,formatDensity:t,sections:n})=>n.map(r=>{const o=a=>{let i=a;return e&&i!==null&&i.includes(" ")&&(i=`⁩${i}⁦`),t==="spacious"&&["/",".","-"].includes(i)&&(i=` ${i} `),i};return r.startSeparator=o(r.startSeparator),r.endSeparator=o(r.endSeparator),r}),LN=e=>{let t=Rge(e);e.isRtl&&e.enableAccessibleFieldDOMStructure&&(t=t.split(" ").reverse().join(" "));const n=Tge(Fe({},e,{expandedFormat:t})),r=Oge(Fe({},e,{expandedFormat:t,escapedParts:n}));return Pge(Fe({},e,{sections:r}))},jge=e=>{const t=Qr(),n=vc(),r=ef(),o=Fs(),{valueManager:a,fieldValueManager:i,valueType:s,validator:l,internalProps:d,internalProps:{value:u,defaultValue:m,referenceDate:g,onChange:y,format:x,formatDensity:w="dense",selectedSections:S,onSelectedSectionsChange:b,shouldRespectLeadingZeros:$=!1,timezone:k,enableAccessibleFieldDOMStructure:T=!1}}=e,{timezone:O,value:P,handleValueChange:D}=z2({timezone:k,value:u,defaultValue:m,referenceDate:g,onChange:y,valueManager:a}),A=C.useMemo(()=>jue(t),[t]),F=C.useMemo(()=>zue(t,A,O),[t,A,O]),L=C.useCallback((Q,ee=null)=>i.getSectionsFromValue(t,Q,ee,Z=>LN({utils:t,localeText:n,localizedDigits:A,format:x,date:Z,formatDensity:w,shouldRespectLeadingZeros:$,enableAccessibleFieldDOMStructure:T,isRtl:o})),[i,x,n,A,o,$,t,w,T]),[_,R]=C.useState(()=>{const Q=L(P),ee={sections:Q,value:P,referenceValue:a.emptyValue,tempValueStrAndroid:null},Z=Eue(Q),de=a.getInitialReferenceValue({referenceDate:g,value:P,utils:t,props:d,granularity:Z,timezone:O});return Fe({},ee,{referenceValue:de})}),[z,N]=Ti({controlled:S,default:null,name:"useField",state:"selectedSections"}),B=Q=>{N(Q),b?.(Q)},I=C.useMemo(()=>a$(z,_.sections),[z,_.sections]),H=I==="all"?0:I,Y=({value:Q,referenceValue:ee,sections:Z})=>{if(R(le=>Fe({},le,{sections:Z,value:Q,referenceValue:ee,tempValueStrAndroid:null})),a.areValuesEqual(t,_.value,Q))return;const de={validationError:l({adapter:r,value:Q,timezone:O,props:d})};D(Q,de)},ae=(Q,ee)=>{const Z=[..._.sections];return Z[Q]=Fe({},Z[Q],{value:ee,modified:!0}),Z},K=()=>{Y({value:a.emptyValue,referenceValue:_.referenceValue,sections:L(a.emptyValue)})},oe=()=>{if(H==null)return;const Q=_.sections[H],ee=i.getActiveDateManager(t,_,Q),Z=ee.getSections(_.sections).filter(he=>he.value!=="").length===(Q.value===""?0:1),de=ae(H,""),le=Z?null:t.getInvalidDate(),fe=ee.getNewValuesFromNewActiveDate(le);Y(Fe({},fe,{sections:de}))},ue=Q=>{const ee=(le,fe)=>{const he=t.parse(le,x);if(he==null||!t.isValid(he))return null;const me=LN({utils:t,localeText:n,localizedDigits:A,format:x,date:he,formatDensity:w,shouldRespectLeadingZeros:$,enableAccessibleFieldDOMStructure:T,isRtl:o});return JD(t,he,me,fe,!1)},Z=i.parseValueStr(Q,_.referenceValue,ee),de=i.updateReferenceValue(t,Z,_.referenceValue);Y({value:Z,referenceValue:de,sections:L(Z,_.sections)})},G=({activeSection:Q,newSectionValue:ee,shouldGoToNextSection:Z})=>{Z&&H<_.sections.length-1&&B(H+1);const de=i.getActiveDateManager(t,_,Q),le=ae(H,ee),fe=de.getSections(le),he=Nue(t,fe,A);let me,se;if(he!=null&&t.isValid(he)){const ve=JD(t,he,fe,de.referenceDate,!0);me=de.getNewValuesFromNewActiveDate(ve),se=!0}else me=de.getNewValuesFromNewActiveDate(he),se=(he!=null&&!t.isValid(he))!=(de.date!=null&&!t.isValid(de.date));return se?Y(Fe({},me,{sections:le})):R(ve=>Fe({},ve,me,{sections:le,tempValueStrAndroid:null}))},ie=Q=>R(ee=>Fe({},ee,{tempValueStrAndroid:Q}));return C.useEffect(()=>{const Q=L(_.value);R(ee=>Fe({},ee,{sections:Q}))},[x,t.locale,o]),C.useEffect(()=>{let Q;a.areValuesEqual(t,_.value,P)?Q=a.getTimezone(t,_.value)!==a.getTimezone(t,P):Q=!0,Q&&R(ee=>Fe({},ee,{value:P,referenceValue:i.updateReferenceValue(t,P,ee.referenceValue),sections:L(P)}))},[P]),{state:_,activeSectionIndex:H,parsedSelectedSections:I,setSelectedSections:B,clearValue:K,clearActiveSection:oe,updateSectionValue:G,updateValueFromValueStr:ue,setTempAndroidValueStr:ie,getSectionsFromValue:L,sectionsValueBoundaries:F,localizedDigits:A,timezone:O}},Age=5e3,dp=e=>e.saveQuery!=null,Dge=({sections:e,updateSectionValue:t,sectionsValueBoundaries:n,localizedDigits:r,setTempAndroidValueStr:o,timezone:a})=>{const i=Qr(),[s,l]=C.useState(null),d=Yt(()=>l(null));C.useEffect(()=>{s!=null&&e[s.sectionIndex]?.type!==s.sectionType&&d()},[e,s,d]),C.useEffect(()=>{if(s!=null){const y=setTimeout(()=>d(),Age);return()=>{clearTimeout(y)}}return()=>{}},[s,d]);const u=({keyPressed:y,sectionIndex:x},w,S)=>{const b=y.toLowerCase(),$=e[x];if(s!=null&&(!S||S(s.value))&&s.sectionIndex===x){const T=`${s.value}${b}`,O=w(T,$);if(!dp(O))return l({sectionIndex:x,value:T,sectionType:$.type}),O}const k=w(b,$);return dp(k)&&!k.saveQuery?(d(),null):(l({sectionIndex:x,value:b,sectionType:$.type}),dp(k)?null:k)},m=y=>{const x=(S,b,$)=>{const k=b.filter(T=>T.toLowerCase().startsWith($));return k.length===0?{saveQuery:!1}:{sectionValue:k[0],shouldGoToNextSection:k.length===1}},w=(S,b,$,k)=>{const T=O=>t3(i,a,b.type,O);if(b.contentType==="letter")return x(b.format,T(b.format),S);if($&&k!=null&&e3(i,$).contentType==="letter"){const O=T($),P=x($,O,S);return dp(P)?{saveQuery:!1}:Fe({},P,{sectionValue:k(P.sectionValue,O)})}return{saveQuery:!1}};return u(y,(S,b)=>{switch(b.type){case"month":{const $=k=>XD(i,k,i.formats.month,b.format);return w(S,b,i.formats.month,$)}case"weekDay":{const $=(k,T)=>T.indexOf(k).toString();return w(S,b,i.formats.weekday,$)}case"meridiem":return w(S,b);default:return{saveQuery:!1}}})},g=y=>{const x=(w,S)=>{const b=Ud(w,r),$=Number(b),k=n[S.type]({currentDate:null,format:S.format,contentType:S.contentType});if($>k.maximum)return{saveQuery:!1};if($<k.minimum)return{saveQuery:!0};const T=$*10>k.maximum||b.length===k.maximum.toString().length;return{sectionValue:r3(i,$,k,r,S),shouldGoToNextSection:T}};return u(y,(w,S)=>{if(S.contentType==="digit"||S.contentType==="digit-with-letter")return x(w,S);if(S.type==="month"){o3(i,"digit","month","MM");const b=x(w,{type:S.type,format:"MM",hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2});if(dp(b))return b;const $=XD(i,b.sectionValue,"MM",S.format);return Fe({},b,{sectionValue:$})}if(S.type==="weekDay"){const b=x(w,S);if(dp(b))return b;const $=x1(i,S.format)[Number(b.sectionValue)-1];return Fe({},b,{sectionValue:$})}return{saveQuery:!1}},w=>QD(w,r))};return{applyCharacterEditing:Yt(y=>{const x=e[y.sectionIndex],w=QD(y.keyPressed,r)?g(Fe({},y,{keyPressed:k2(y.keyPressed,r)})):m(y);if(w==null){o(null);return}t({activeSection:x,newSectionValue:w.sectionValue,shouldGoToNextSection:w.shouldGoToNextSection})}),resetCharacterQuery:d}},Nge=e=>{const{internalProps:{disabled:t,readOnly:n=!1},forwardedProps:{sectionListRef:r,onBlur:o,onClick:a,onFocus:i,onInput:s,onPaste:l,focused:d,autoFocus:u=!1},fieldValueManager:m,applyCharacterEditing:g,resetCharacterQuery:y,setSelectedSections:x,parsedSelectedSections:w,state:S,clearActiveSection:b,clearValue:$,updateSectionValue:k,updateValueFromValueStr:T,sectionOrder:O,areAllSectionsEmpty:P,sectionsValueBoundaries:D}=e,A=C.useRef(null),F=vr(r,A),L=vc(),_=Qr(),R=_s(),[z,N]=C.useState(!1),B=C.useMemo(()=>({syncSelectionToDOM:()=>{if(!A.current)return;const se=document.getSelection();if(!se)return;if(w==null){se.rangeCount>0&&A.current.getRoot().contains(se.getRangeAt(0).startContainer)&&se.removeAllRanges(),z&&A.current.getRoot().blur();return}if(!A.current.getRoot().contains(Ua(document)))return;const ve=new window.Range;let Le;w==="all"?Le=A.current.getRoot():S.sections[w].type==="empty"?Le=A.current.getSectionContainer(w):Le=A.current.getSectionContent(w),ve.selectNodeContents(Le),Le.focus(),se.removeAllRanges(),se.addRange(ve)},getActiveSectionIndexFromDOM:()=>{const se=Ua(document);return!se||!A.current||!A.current.getRoot().contains(se)?null:A.current.getSectionIndexFromDOMElement(se)},focusField:(se=0)=>{if(!A.current||B.getActiveSectionIndexFromDOM()!=null)return;const ve=a$(se,S.sections);N(!0),A.current.getSectionContent(ve).focus()},setSelectedSections:se=>{if(!A.current)return;const ve=a$(se,S.sections);N((ve==="all"?0:ve)!==null),x(se)},isFieldFocused:()=>{const se=Ua(document);return!!A.current&&A.current.getRoot().contains(se)}}),[w,x,S.sections,z]),I=Yt(se=>{if(!A.current)return;const ve=S.sections[se];A.current.getSectionContent(se).innerHTML=ve.value||ve.placeholder,B.syncSelectionToDOM()}),H=Yt((se,...ve)=>{se.isDefaultPrevented()||!A.current||(N(!0),a?.(se,...ve),w==="all"?setTimeout(()=>{const Le=document.getSelection().getRangeAt(0).startOffset;if(Le===0){x(O.startIndex);return}let Ae=0,Re=0;for(;Re<Le&&Ae<S.sections.length;){const re=S.sections[Ae];Ae+=1,Re+=`${re.startSeparator}${re.value||re.placeholder}${re.endSeparator}`.length}x(Ae-1)}):z?A.current.getRoot().contains(se.target)||x(O.startIndex):(N(!0),x(O.startIndex)))}),Y=Yt(se=>{if(s?.(se),!A.current||w!=="all")return;const ve=se.target.textContent??"";A.current.getRoot().innerHTML=S.sections.map(Le=>`${Le.startSeparator}${Le.value||Le.placeholder}${Le.endSeparator}`).join(""),B.syncSelectionToDOM(),ve.length===0||ve.charCodeAt(0)===10?(y(),$(),x("all")):ve.length>1?T(ve):(w==="all"&&x(0),g({keyPressed:ve,sectionIndex:0}))}),ae=Yt(se=>{if(l?.(se),n||w!=="all"){se.preventDefault();return}const ve=se.clipboardData.getData("text");se.preventDefault(),y(),T(ve)}),K=Yt((...se)=>{i?.(...se),!(z||!A.current)&&(N(!0),A.current.getSectionIndexFromDOMElement(Ua(document))!=null||x(O.startIndex))}),oe=Yt((...se)=>{o?.(...se),setTimeout(()=>{if(!A.current)return;const ve=Ua(document);!A.current.getRoot().contains(ve)&&(N(!1),x(null))})}),ue=Yt(se=>ve=>{ve.isDefaultPrevented()||x(se)}),G=Yt(se=>{se.preventDefault()}),ie=Yt(se=>()=>{x(se)}),Q=Yt(se=>{if(se.preventDefault(),n||t||typeof w!="number")return;const ve=S.sections[w],Le=se.clipboardData.getData("text"),Ae=/^[a-zA-Z]+$/.test(Le),Re=/^[0-9]+$/.test(Le),re=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(Le);ve.contentType==="letter"&&Ae||ve.contentType==="digit"&&Re||ve.contentType==="digit-with-letter"&&re?(y(),k({activeSection:ve,newSectionValue:Le,shouldGoToNextSection:!0})):!Ae&&!Re&&(y(),T(Le))}),ee=Yt(se=>{se.preventDefault(),se.dataTransfer.dropEffect="none"}),Z=Yt(se=>{if(!A.current)return;const ve=se.target,Le=ve.textContent??"",Ae=A.current.getSectionIndexFromDOMElement(ve),Re=S.sections[Ae];if(n||!A.current){I(Ae);return}if(Le.length===0){if(Re.value===""){I(Ae);return}const re=se.nativeEvent.inputType;if(re==="insertParagraph"||re==="insertLineBreak"){I(Ae);return}y(),b();return}g({keyPressed:Le,sectionIndex:Ae}),I(Ae)});Go(()=>{if(!(!z||!A.current)){if(w==="all")A.current.getRoot().focus();else if(typeof w=="number"){const se=A.current.getSectionContent(w);se&&se.focus()}}},[w,z]);const de=C.useMemo(()=>S.sections.reduce((se,ve)=>(se[ve.type]=D[ve.type]({currentDate:null,contentType:ve.contentType,format:ve.format}),se),{}),[D,S.sections]),le=w==="all",fe=C.useMemo(()=>S.sections.map((se,ve)=>{const Le=!le&&!t&&!n;return{container:{"data-sectionindex":ve,onClick:ue(ve)},content:{tabIndex:le||ve>0?-1:0,contentEditable:!le&&!t&&!n,role:"spinbutton",id:`${R}-${se.type}`,"aria-labelledby":`${R}-${se.type}`,"aria-readonly":n,"aria-valuenow":que(se,_),"aria-valuemin":de[se.type].minimum,"aria-valuemax":de[se.type].maximum,"aria-valuetext":se.value?Uue(se,_):L.empty,"aria-label":L[se.type],"aria-disabled":t,spellCheck:Le?!1:void 0,autoCapitalize:Le?"off":void 0,autoCorrect:Le?"off":void 0,[parseInt(C.version,10)>=17?"enterKeyHint":"enterkeyhint"]:Le?"next":void 0,children:se.value||se.placeholder,onInput:Z,onPaste:Q,onFocus:ie(ve),onDragOver:ee,onMouseUp:G,inputMode:se.contentType==="letter"?"text":"numeric"},before:{children:se.startSeparator},after:{children:se.endSeparator}}}),[S.sections,ie,Q,ee,Z,ue,G,t,n,le,L,_,de,R]),he=Yt(se=>{T(se.target.value)}),me=C.useMemo(()=>P?"":m.getV7HiddenInputValueFromSections(S.sections),[P,S.sections,m]);return C.useEffect(()=>{if(A.current==null)throw new Error(["MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`","You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.","","If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:","","<DatePicker slots={{ textField: MyCustomTextField }} />","","Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element"].join(`
469
469
  `));u&&A.current&&A.current.getSectionContent(O.startIndex).focus()},[]),{interactions:B,returnedValue:{autoFocus:u,readOnly:n,focused:d??z,sectionListRef:F,onBlur:oe,onClick:H,onFocus:K,onInput:Y,onPaste:ae,enableAccessibleFieldDOMStructure:!0,elements:fe,tabIndex:w===0?-1:0,contentEditable:le,value:me,onChange:he,areAllSectionsEmpty:P}}},$p=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),Ige=(e,t,n)=>{let r=0,o=n?1:0;const a=[];for(let i=0;i<e.length;i+=1){const s=e[i],l=$2(s,n?"input-rtl":"input-ltr",t),d=`${s.startSeparator}${l}${s.endSeparator}`,u=$p(d).length,m=d.length,g=$p(l),y=o+(g===""?0:l.indexOf(g[0]))+s.startSeparator.length,x=y+g.length;a.push(Fe({},s,{start:r,end:r+u,startInInput:y,endInInput:x})),r+=u,o+=m}return a},Lge=e=>{const t=Fs(),n=C.useRef(void 0),r=C.useRef(void 0),{forwardedProps:{onFocus:o,onClick:a,onPaste:i,onBlur:s,inputRef:l,placeholder:d},internalProps:{readOnly:u=!1,disabled:m=!1},parsedSelectedSections:g,activeSectionIndex:y,state:x,fieldValueManager:w,valueManager:S,applyCharacterEditing:b,resetCharacterQuery:$,updateSectionValue:k,updateValueFromValueStr:T,clearActiveSection:O,clearValue:P,setTempAndroidValueStr:D,setSelectedSections:A,getSectionsFromValue:F,areAllSectionsEmpty:L,localizedDigits:_}=e,R=C.useRef(null),z=vr(l,R),N=C.useMemo(()=>Ige(x.sections,_,t),[x.sections,_,t]),B=C.useMemo(()=>({syncSelectionToDOM:()=>{if(!R.current)return;if(g==null){R.current.scrollLeft&&(R.current.scrollLeft=0);return}if(R.current!==Ua(document))return;const ee=R.current.scrollTop;if(g==="all")R.current.select();else{const Z=N[g],de=Z.type==="empty"?Z.startInInput-Z.startSeparator.length:Z.startInInput,le=Z.type==="empty"?Z.endInInput+Z.endSeparator.length:Z.endInInput;(de!==R.current.selectionStart||le!==R.current.selectionEnd)&&R.current===Ua(document)&&R.current.setSelectionRange(de,le),clearTimeout(r.current),r.current=setTimeout(()=>{R.current&&R.current===Ua(document)&&R.current.selectionStart===R.current.selectionEnd&&(R.current.selectionStart!==de||R.current.selectionEnd!==le)&&B.syncSelectionToDOM()})}R.current.scrollTop=ee},getActiveSectionIndexFromDOM:()=>{const ee=R.current.selectionStart??0,Z=R.current.selectionEnd??0;if(ee===0&&Z===0)return null;const de=ee<=N[0].startInInput?1:N.findIndex(le=>le.startInInput-le.startSeparator.length>ee);return de===-1?N.length-1:de-1},focusField:(ee=0)=>{Ua(document)!==R.current&&(R.current?.focus(),A(ee))},setSelectedSections:ee=>A(ee),isFieldFocused:()=>R.current===Ua(document)}),[R,g,N,A]),I=()=>{const ee=R.current.selectionStart??0;let Z;ee<=N[0].startInInput||ee>=N[N.length-1].endInInput?Z=1:Z=N.findIndex(le=>le.startInInput-le.startSeparator.length>ee);const de=Z===-1?N.length-1:Z-1;A(de)},H=Yt((...ee)=>{o?.(...ee);const Z=R.current;clearTimeout(n.current),n.current=setTimeout(()=>{!Z||Z!==R.current||y==null&&(Z.value.length&&Number(Z.selectionEnd)-Number(Z.selectionStart)===Z.value.length?A("all"):I())})}),Y=Yt((ee,...Z)=>{ee.isDefaultPrevented()||(a?.(ee,...Z),I())}),ae=Yt(ee=>{if(i?.(ee),ee.preventDefault(),u||m)return;const Z=ee.clipboardData.getData("text");if(typeof g=="number"){const de=x.sections[g],le=/^[a-zA-Z]+$/.test(Z),fe=/^[0-9]+$/.test(Z),he=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(Z);if(de.contentType==="letter"&&le||de.contentType==="digit"&&fe||de.contentType==="digit-with-letter"&&he){$(),k({activeSection:de,newSectionValue:Z,shouldGoToNextSection:!0});return}if(le||fe)return}$(),T(Z)}),K=Yt((...ee)=>{s?.(...ee),A(null)}),oe=Yt(ee=>{if(u)return;const Z=ee.target.value;if(Z===""){$(),P();return}const de=ee.nativeEvent.data,le=de&&de.length>1,fe=le?de:Z,he=$p(fe);if(g==="all"&&A(y),y==null||le){T(le?de:he);return}let me;if(g==="all"&&he.length===1)me=he;else{const se=$p(w.getV6InputValueFromSections(N,_,t));let ve=-1,Le=-1;for(let re=0;re<se.length;re+=1)ve===-1&&se[re]!==he[re]&&(ve=re),Le===-1&&se[se.length-re-1]!==he[he.length-re-1]&&(Le=re);const Ae=N[y];if(ve<Ae.start||se.length-Le-1>Ae.end)return;const Re=he.length-se.length+Ae.end-$p(Ae.endSeparator||"").length;me=he.slice(Ae.start+$p(Ae.startSeparator||"").length,Re)}if(me.length===0){_ue()&&D(fe),$(),O();return}b({keyPressed:me,sectionIndex:y})}),ue=C.useMemo(()=>d!==void 0?d:w.getV6InputValueFromSections(F(S.emptyValue),_,t),[d,w,F,S.emptyValue,_,t]),G=C.useMemo(()=>x.tempValueStrAndroid??w.getV6InputValueFromSections(x.sections,_,t),[x.sections,w,x.tempValueStrAndroid,_,t]);C.useEffect(()=>(R.current&&R.current===Ua(document)&&A("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);const ie=C.useMemo(()=>y==null||x.sections[y].contentType==="letter"?"text":"numeric",[y,x.sections]),Q=!(R.current&&R.current===Ua(document))&&L;return{interactions:B,returnedValue:{readOnly:u,onBlur:K,onClick:Y,onFocus:H,onPaste:ae,inputRef:z,enableAccessibleFieldDOMStructure:!1,placeholder:ue,inputMode:ie,autoComplete:"off",value:Q?"":G,onChange:oe}}},zge=e=>{const t=Qr(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:o,enableAccessibleFieldDOMStructure:a=!1,disabled:i=!1,readOnly:s=!1},forwardedProps:{onKeyDown:l,error:d,clearable:u,onClear:m},fieldValueManager:g,valueManager:y,validator:x}=e,w=Fs(),S=jge(e),{state:b,activeSectionIndex:$,parsedSelectedSections:k,setSelectedSections:T,clearValue:O,clearActiveSection:P,updateSectionValue:D,setTempAndroidValueStr:A,sectionsValueBoundaries:F,localizedDigits:L,timezone:_}=S,R=Dge({sections:b.sections,updateSectionValue:D,sectionsValueBoundaries:F,localizedDigits:L,setTempAndroidValueStr:A,timezone:_}),{resetCharacterQuery:z}=R,N=y.areValuesEqual(t,b.value,y.emptyValue),B=a?Nge:Lge,I=C.useMemo(()=>Bue(b.sections,w&&!a),[b.sections,w,a]),{returnedValue:H,interactions:Y}=B(Fe({},e,S,R,{areAllSectionsEmpty:N,sectionOrder:I})),ae=Yt(Q=>{if(l?.(Q),!i)switch(!0){case((Q.ctrlKey||Q.metaKey)&&String.fromCharCode(Q.keyCode)==="A"&&!Q.shiftKey&&!Q.altKey):{Q.preventDefault(),T("all");break}case Q.key==="ArrowRight":{if(Q.preventDefault(),k==null)T(I.startIndex);else if(k==="all")T(I.endIndex);else{const ee=I.neighbors[k].rightIndex;ee!==null&&T(ee)}break}case Q.key==="ArrowLeft":{if(Q.preventDefault(),k==null)T(I.endIndex);else if(k==="all")T(I.startIndex);else{const ee=I.neighbors[k].leftIndex;ee!==null&&T(ee)}break}case Q.key==="Delete":{if(Q.preventDefault(),s)break;k==null||k==="all"?O():P(),z();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(Q.key):{if(Q.preventDefault(),s||$==null)break;k==="all"&&T($);const ee=b.sections[$],Z=g.getActiveDateManager(t,b,ee),de=Aue(t,_,ee,Q.key,F,L,Z.date,{minutesStep:o});D({activeSection:ee,newSectionValue:de,shouldGoToNextSection:!1});break}}});Go(()=>{Y.syncSelectionToDOM()});const{hasValidationError:K}=d3({props:n,validator:x,timezone:_,value:b.value,onError:n.onError}),oe=C.useMemo(()=>d!==void 0?d:K,[K,d]);C.useEffect(()=>{!oe&&$==null&&z()},[b.referenceValue,$,oe]),C.useEffect(()=>{b.tempValueStrAndroid!=null&&$!=null&&(z(),P())},[b.sections]),C.useImperativeHandle(r,()=>({getSections:()=>b.sections,getActiveSectionIndex:Y.getActiveSectionIndexFromDOM,setSelectedSections:Y.setSelectedSections,focusField:Y.focusField,isFieldFocused:Y.isFieldFocused}));const ue=Yt((Q,...ee)=>{Q.preventDefault(),m?.(Q,...ee),O(),Y.isFieldFocused()?T(I.startIndex):Y.focusField(0)}),G={onKeyDown:ae,onClear:ue,error:oe,clearable:!!(u&&!N&&!s&&!i)},ie={disabled:i,readOnly:s};return Fe({},e.forwardedProps,G,ie,H)},Fge=["clearable","onClear","InputProps","sx","slots","slotProps"],_ge=["ownerState"],Bge=e=>{const t=vc(),{clearable:n,onClear:r,InputProps:o,sx:a,slots:i,slotProps:s}=e,l=Hn(e,Fge),d=i?.clearButton??Tu,u=Cr({elementType:d,externalSlotProps:s?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),m=Hn(u,_ge),g=i?.clearIcon??Qhe,y=Cr({elementType:g,externalSlotProps:s?.clearIcon,ownerState:{}});return Fe({},l,{InputProps:Fe({},o,{endAdornment:p.jsxs(C.Fragment,{children:[n&&p.jsx(f3,{position:"end",sx:{marginRight:o?.endAdornment?-1:-1.5},children:p.jsx(d,Fe({},m,{onClick:r,children:p.jsx(g,Fe({fontSize:"small"},y))}))}),o?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(a)?a:[a]]})},Uge=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],qge=(e,t)=>C.useMemo(()=>{const n=Fe({},e),r={},o=a=>{n.hasOwnProperty(a)&&(r[a]=n[a],delete n[a])};return Uge.forEach(o),c3.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),Hge=e=>{const t=Qr(),n=ev();return Fe({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:cs(t,e.minDate,n.minDate),maxDate:cs(t,e.maxDate,n.maxDate)})},Vge=e=>{const t=Hge(e),{forwardedProps:n,internalProps:r}=qge(t,"date");return zge({forwardedProps:n,internalProps:r,valueManager:Cl,fieldValueManager:Vue,validator:tv,valueType:"date"})};function Wge(e){return Cn("MuiPickersTextField",e)}fn("MuiPickersTextField",["root","focused","disabled","error","required"]);function Yge(e){return Cn("MuiPickersInputBase",e)}const Ip=fn("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function Gge(e){return Cn("MuiPickersSectionList",e)}const eg=fn("MuiPickersSectionList",["root","section","sectionContent"]),Kge=["slots","slotProps","elements","sectionListRef"],G3=nt("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),K3=nt("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),Q3=nt("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),X3=nt("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),Qge=e=>{const{classes:t}=e;return bn({root:["root"],section:["section"],sectionContent:["sectionContent"]},Gge,t)};function Xge(e){const{slots:t,slotProps:n,element:r,classes:o}=e,a=t?.section??K3,i=Cr({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),s=t?.sectionContent??X3,l=Cr({elementType:s,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),d=t?.sectionSeparator??Q3,u=Cr({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),m=Cr({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return p.jsxs(a,Fe({},i,{children:[p.jsx(d,Fe({},u)),p.jsx(s,Fe({},l)),p.jsx(d,Fe({},m))]}))}const Zge=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:a,sectionListRef:i}=n,s=Hn(n,Kge),l=Qge(n),d=C.useRef(null),u=vr(t,d),m=x=>{if(!d.current)throw new Error(`MUI X: Cannot call sectionListRef.${x} before the mount of the component.`);return d.current};C.useImperativeHandle(i,()=>({getRoot(){return m("getRoot")},getSectionContainer(x){return m("getSectionContainer").querySelector(`.${eg.section}[data-sectionindex="${x}"]`)},getSectionContent(x){return m("getSectionContent").querySelector(`.${eg.section}[data-sectionindex="${x}"] .${eg.sectionContent}`)},getSectionIndexFromDOMElement(x){const w=m("getSectionIndexFromDOMElement");if(x==null||!w.contains(x))return null;let S=null;return x.classList.contains(eg.section)?S=x:x.classList.contains(eg.sectionContent)&&(S=x.parentElement),S==null?null:Number(S.dataset.sectionindex)}}));const g=r?.root??G3,y=Cr({elementType:g,externalSlotProps:o?.root,externalForwardedProps:s,additionalProps:{ref:u,suppressContentEditableWarning:!0},className:l.root,ownerState:{}});return p.jsx(g,Fe({},y,{children:y.contentEditable?a.map(({content:x,before:w,after:S})=>`${w.children}${x.children}${S.children}`).join(""):p.jsx(C.Fragment,{children:a.map((x,w)=>p.jsx(Xge,{slots:r,slotProps:o,element:x,classes:l},w))})}))}),Jge=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],eye=e=>Math.round(e*1e5)/1e5,O1=nt("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>Fe({},e.typography.body1,{color:(e.vars||e).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:`${eye(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),Y2=nt(G3,{name:"MuiPickersInputBase",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})(({theme:e})=>({padding:"4px 0 5px",fontFamily:e.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{isRtl:!0},style:{textAlign:"right /*! @noflip */"}},{props:{size:"small"},style:{paddingTop:1}},{props:{adornedStart:!1,focused:!1,filled:!1},style:{color:"currentColor",opacity:0}},{props:({adornedStart:t,focused:n,filled:r,label:o})=>!t&&!n&&!r&&o==null,style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:e.palette.mode==="light"?.42:.5}}]})),tye=nt(K3,{name:"MuiPickersInputBase",slot:"Section",overridesResolver:(e,t)=>t.section})(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),nye=nt(X3,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(e,t)=>t.content})(({theme:e})=>({fontFamily:e.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),rye=nt(Q3,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),oye=nt("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(Fe({},bue)),aye=e=>{const{focused:t,disabled:n,error:r,classes:o,fullWidth:a,readOnly:i,color:s,size:l,endAdornment:d,startAdornment:u}=e,m={root:["root",t&&!n&&"focused",n&&"disabled",i&&"readOnly",r&&"error",a&&"fullWidth",`color${Tt(s)}`,l==="small"&&"inputSizeSmall",!!u&&"adornedStart",!!d&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return bn(m,Yge,o)},G2=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:a,onChange:i,id:s,endAdornment:l,startAdornment:d,renderSuffix:u,slots:m,slotProps:g,contentEditable:y,tabIndex:x,onInput:w,onPaste:S,onKeyDown:b,name:$,readOnly:k,inputProps:T,inputRef:O,sectionListRef:P}=n,D=Hn(n,Jge),A=C.useRef(null),F=vr(t,A),L=vr(T?.ref,O),_=Fs(),R=Ai();if(!R)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const z=ae=>{if(R.disabled){ae.stopPropagation();return}R.onFocus?.(ae)};C.useEffect(()=>{R&&R.setAdornedStart(!!d)},[R,d]),C.useEffect(()=>{R&&(o?R.onEmpty():R.onFilled())},[R,o]);const N=Fe({},n,R,{isRtl:_}),B=aye(N),I=m?.root||O1,H=Cr({elementType:I,externalSlotProps:g?.root,externalForwardedProps:D,additionalProps:{"aria-invalid":R.error,ref:F},className:B.root,ownerState:N}),Y=m?.input||Y2;return p.jsxs(I,Fe({},H,{children:[d,p.jsx(Zge,{sectionListRef:P,elements:r,contentEditable:y,tabIndex:x,className:B.sectionsContainer,onFocus:z,onBlur:R.onBlur,onInput:w,onPaste:S,onKeyDown:b,slots:{root:Y,section:tye,sectionContent:nye,sectionSeparator:rye},slotProps:{root:{ownerState:N},sectionContent:{className:Ip.sectionContent},sectionSeparator:({position:ae})=>({className:ae==="before"?Ip.sectionBefore:Ip.sectionAfter})}}),l,u?u(Fe({},R)):null,p.jsx(oye,Fe({name:$,className:B.input,value:a,onChange:i,id:s,"aria-hidden":"true",tabIndex:-1,readOnly:k,required:R.required,disabled:R.disabled},T,{ref:L}))]}))});function iye(e){return Cn("MuiPickersOutlinedInput",e)}const js=Fe({},Ip,fn("MuiPickersOutlinedInput",["root","notchedOutline","input"])),sye=["children","className","label","notched","shrink"],lye=nt("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline",overridesResolver:(e,t)=>t.notchedOutline})(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}}),zN=nt("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),cye=nt("legend")(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{withLabel:!1},style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:{withLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{withLabel:!0,notched:!0},style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]}));function uye(e){const{className:t,label:n}=e,r=Hn(e,sye),o=n!=null&&n!=="",a=Fe({},e,{withLabel:o});return p.jsx(lye,Fe({"aria-hidden":!0,className:t},r,{ownerState:a,children:p.jsx(cye,{ownerState:a,children:o?p.jsx(zN,{children:n}):p.jsx(zN,{className:"notranslate",children:"​"})})}))}const dye=["label","autoFocus","ownerState","notched"],fye=nt(O1,{name:"MuiPickersOutlinedInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${js.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${js.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${js.focused} .${js.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${js.disabled}`]:{[`& .${js.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${js.error} .${js.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},variants:Object.keys((e.vars??e).palette).filter(n=>(e.vars??e).palette[n]?.main??!1).map(n=>({props:{color:n},style:{[`&.${js.focused}:not(.${js.error}) .${js.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),pye=nt(Y2,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),hye=e=>{const{classes:t}=e,n=bn({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},iye,t);return Fe({},t,n)},Z3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:a}=n,i=Hn(n,dye),s=Ai(),l=Fe({},n,o,s,{color:s?.color||"primary"}),d=hye(l);return p.jsx(G2,Fe({slots:{root:fye,input:pye},renderSuffix:u=>p.jsx(uye,{shrink:!!(a||u.adornedStart||u.focused||u.filled),notched:!!(a||u.adornedStart||u.focused||u.filled),className:d.notchedOutline,label:r!=null&&r!==""&&s?.required?p.jsxs(C.Fragment,{children:[r," ","*"]}):r,ownerState:l})},i,{label:r,classes:d,ref:t}))});Z3.muiName="Input";function mye(e){return Cn("MuiPickersFilledInput",e)}const cd=Fe({},Ip,fn("MuiPickersFilledInput",["root","underline","input"])),gye=["label","autoFocus","disableUnderline","ownerState"],yye=nt(O1,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>e0(e)&&e!=="disableUnderline"})(({theme:e})=>{const t=e.palette.mode==="light",n=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",r=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",o=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",a=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:o,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${cd.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${cd.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[...Object.keys((e.vars??e).palette).filter(i=>(e.vars??e).palette[i].main).map(i=>({props:{color:i,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[i]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${cd.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${cd.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`:n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${cd.disabled}, .${cd.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${cd.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:i})=>!!i,style:{paddingLeft:12}},{props:({endAdornment:i})=>!!i,style:{paddingRight:12}}]}}),vye=nt(Y2,{name:"MuiPickersFilledInput",slot:"sectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:0}},{props:({endAdornment:e})=>!!e,style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,size:"small"},style:{paddingTop:8,paddingBottom:9}}]}),bye=e=>{const{classes:t,disableUnderline:n}=e,r=bn({root:["root",!n&&"underline"],input:["input"]},mye,t);return Fe({},t,r)},J3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=Hn(n,gye),s=Ai(),l=Fe({},n,a,s,{color:s?.color||"primary"}),d=bye(l);return p.jsx(G2,Fe({slots:{root:yye,input:vye},slotProps:{root:{disableUnderline:o}}},i,{label:r,classes:d,ref:t}))});J3.muiName="Input";function xye(e){return Cn("MuiPickersFilledInput",e)}const tg=Fe({},Ip,fn("MuiPickersInput",["root","input"])),wye=["label","autoFocus","disableUnderline","ownerState"],Sye=nt(O1,{name:"MuiPickersInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(n=>(e.vars??e).palette[n].main).map(n=>({props:{color:n},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[n].main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${tg.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${tg.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${tg.disabled}, .${tg.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${tg.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),Cye=e=>{const{classes:t,disableUnderline:n}=e,r=bn({root:["root",!n&&"underline"],input:["input"]},xye,t);return Fe({},t,r)},e_=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=Hn(n,wye),s=Ai(),l=Fe({},n,a,s,{disableUnderline:o,color:s?.color||"primary"}),d=Cye(l);return p.jsx(G2,Fe({slots:{root:Sye}},i,{label:r,classes:d,ref:t}))});e_.muiName="Input";const kye=["onFocus","onBlur","className","color","disabled","error","variant","required","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps"],$ye={standard:e_,filled:J3,outlined:Z3},Rye=nt(L3,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),Tye=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return bn({root:["root",t&&!n&&"focused",n&&"disabled",o&&"required"]},Wge,r)},Eye=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:a,color:i="primary",disabled:s=!1,error:l=!1,variant:d="outlined",required:u=!1,InputProps:m,inputProps:g,inputRef:y,sectionListRef:x,elements:w,areAllSectionsEmpty:S,onClick:b,onKeyDown:$,onKeyUp:k,onPaste:T,onInput:O,endAdornment:P,startAdornment:D,tabIndex:A,contentEditable:F,focused:L,value:_,onChange:R,fullWidth:z,id:N,name:B,helperText:I,FormHelperTextProps:H,label:Y,InputLabelProps:ae}=n,K=Hn(n,kye),oe=C.useRef(null),ue=vr(t,oe),G=_s(N),ie=I&&G?`${G}-helper-text`:void 0,Q=Y&&G?`${G}-label`:void 0,ee=Fe({},n,{color:i,disabled:s,error:l,focused:L,required:u,variant:d}),Z=Tye(ee),de=$ye[d];return p.jsxs(Rye,Fe({className:Ht(Z.root,a),ref:ue,focused:L,onFocus:r,onBlur:o,disabled:s,variant:d,error:l,color:i,fullWidth:z,required:u,ownerState:ee},K,{children:[p.jsx(I3,Fe({htmlFor:G,id:Q},ae,{children:Y})),p.jsx(de,Fe({elements:w,areAllSectionsEmpty:S,onClick:b,onKeyDown:$,onKeyUp:k,onInput:O,onPaste:T,endAdornment:P,startAdornment:D,tabIndex:A,contentEditable:F,value:_,onChange:R,id:G,fullWidth:z,inputProps:g,inputRef:y,sectionListRef:x,label:Y,name:B,role:"group","aria-labelledby":Q,"aria-describedby":ie,"aria-live":ie?"polite":void 0},m)),I&&p.jsx(z3,Fe({id:ie},H,{children:I}))]}))}),Mye=["enableAccessibleFieldDOMStructure"],Oye=["InputProps","readOnly"],Pye=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],jye=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=Hn(e,Mye);if(t){const{InputProps:m,readOnly:g}=n,y=Hn(n,Oye);return Fe({},y,{InputProps:Fe({},m??{},{readOnly:g})})}const{onPaste:r,onKeyDown:o,inputMode:a,readOnly:i,InputProps:s,inputProps:l,inputRef:d}=n,u=Hn(n,Pye);return Fe({},u,{InputProps:Fe({},s??{},{readOnly:i}),inputProps:Fe({},l??{},{inputMode:a,onPaste:r,onKeyDown:o,ref:d})})},Aye=["slots","slotProps","InputProps","inputProps"],t_=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiDateField"}),{slots:r,slotProps:o,InputProps:a,inputProps:i}=n,s=Hn(n,Aye),l=n,d=r?.textField??(e.enableAccessibleFieldDOMStructure?Eye:yr),u=Cr({elementType:d,externalSlotProps:o?.textField,externalForwardedProps:s,additionalProps:{ref:t},ownerState:l});u.inputProps=Fe({},i,u.inputProps),u.InputProps=Fe({},a,u.InputProps);const m=Vge(u),g=jye(m),y=Bge(Fe({},g,{slots:r,slotProps:o}));return p.jsx(d,Fe({},y))}),n_=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i,timezone:s})=>{const l=ef();return C.useCallback(d=>tv({adapter:l,value:d,timezone:s,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i}})!==null,[l,e,t,n,r,o,a,i,s])},Dye=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return Fe({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const a=o.newTimezone;if(n.getTimezone(r.currentMonth)===a)return r;let i=n.setTimezone(r.currentMonth,a);return n.getMonth(i)!==n.getMonth(r.currentMonth)&&(i=n.setMonth(i,n.getMonth(r.currentMonth))),Fe({},r,{currentMonth:i})}case"finishMonthSwitchingAnimation":return Fe({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const a=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return Fe({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:a&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:a?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},Nye=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:a=!1,maxDate:i,minDate:s,onMonthChange:l,reduceAnimations:d,shouldDisableDate:u,timezone:m}=e,g=Qr(),y=C.useRef(Dye(!!d,a,g)).current,x=C.useMemo(()=>Cl.getInitialReferenceValue({value:t,utils:g,timezone:m,props:e,referenceDate:n,granularity:dl.day}),[n,m]),[w,S]=C.useReducer(y,{isMonthSwitchingAnimating:!1,focusedDay:x,currentMonth:g.startOfMonth(x),slideDirection:"left"});C.useEffect(()=>{S({type:"changeMonthTimezone",newTimezone:g.getTimezone(x)})},[x,g]);const b=C.useCallback(P=>{S(Fe({type:"changeMonth"},P)),l&&l(P.newMonth)},[l]),$=C.useCallback(P=>{const D=P;g.isSameMonth(D,w.currentMonth)||b({newMonth:g.startOfMonth(D),direction:g.isAfterDay(D,w.currentMonth)?"left":"right"})},[w.currentMonth,b,g]),k=n_({shouldDisableDate:u,minDate:s,maxDate:i,disableFuture:r,disablePast:o,timezone:m}),T=C.useCallback(()=>{S({type:"finishMonthSwitchingAnimation"})},[]),O=Yt((P,D)=>{k(P)||S({type:"changeFocusedDay",focusedDay:P,withoutMonthSwitchingAnimation:D})});return{referenceDate:x,calendarState:w,changeMonth:$,changeFocusedDay:O,isDateDisabled:k,onMonthSwitchingAnimationEnd:T,handleChangeMonth:b}},Iye=e=>Cn("MuiPickersFadeTransitionGroup",e);fn("MuiPickersFadeTransitionGroup",["root"]);const Lye=e=>{const{classes:t}=e;return bn({root:["root"]},Iye,t)},zye=nt(nv,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function r_(e){const t=Kr({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Lye(t),s=Xd();return o?n:p.jsx(zye,{className:Ht(i.root,r),children:p.jsx(Hd,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:s.transitions.duration.enteringScreen,enter:s.transitions.duration.enteringScreen,exit:0},children:n},a)})}function Fye(e){return Cn("MuiPickersDay",e)}const ud=fn("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),_ye=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],Bye=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:a,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:s,classes:l}=e,d=i&&!s;return bn({root:["root",t&&!d&&"selected",a&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",i&&s&&"dayOutsideMonth",d&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},Fye,l)},o_=({theme:e})=>Fe({},e.typography.caption,{width:by,height:by,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:as(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:as(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${ud.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${ud.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${ud.disabled}:not(.${ud.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${ud.disabled}&.${ud.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${k1}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${ud.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),a_=(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.today&&t.today,!n.outsideCurrentMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.outsideCurrentMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},Uye=nt(qd,{name:"MuiPickersDay",slot:"Root",overridesResolver:a_})(o_),qye=nt("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:a_})(({theme:e})=>Fe({},o_({theme:e}),{opacity:0,pointerEvents:"none"})),ng=()=>{},Hye=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,day:a,disabled:i=!1,disableHighlightToday:s=!1,disableMargin:l=!1,isAnimating:d,onClick:u,onDaySelect:m,onFocus:g=ng,onBlur:y=ng,onKeyDown:x=ng,onMouseDown:w=ng,onMouseEnter:S=ng,outsideCurrentMonth:b,selected:$=!1,showDaysOutsideCurrentMonth:k=!1,children:T,today:O=!1}=n,P=Hn(n,_ye),D=Fe({},n,{autoFocus:r,disabled:i,disableHighlightToday:s,disableMargin:l,selected:$,showDaysOutsideCurrentMonth:k,today:O}),A=Bye(D),F=Qr(),L=C.useRef(null),_=vr(L,t);Go(()=>{r&&!i&&!d&&!b&&L.current.focus()},[r,i,d,b]);const R=N=>{w(N),b&&N.preventDefault()},z=N=>{i||m(a),b&&N.currentTarget.focus(),u&&u(N)};return b&&!k?p.jsx(qye,{className:Ht(A.root,A.hiddenDaySpacingFiller,o),ownerState:D,role:P.role}):p.jsx(Uye,Fe({className:Ht(A.root,o),ref:_,centerRipple:!0,disabled:i,tabIndex:$?0:-1,onKeyDown:N=>x(N,a),onFocus:N=>g(N,a),onBlur:N=>y(N,a),onMouseEnter:N=>S(N,a),onClick:z,onMouseDown:R},P,{ownerState:D,children:T||F.format(a,"dayOfMonth")}))}),Vye=C.memo(Hye),Wye=e=>Cn("MuiPickersSlideTransition",e),Hi=fn("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Yye=["children","className","reduceAnimations","slideDirection","transKey","classes"],Gye=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return bn(r,Wye,t)},Kye=nt(nv,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${Hi["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${Hi["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${Hi.slideEnterActive}`]:t.slideEnterActive},{[`.${Hi.slideExit}`]:t.slideExit},{[`.${Hi["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${Hi["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{const t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${Hi["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${Hi["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${Hi.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${Hi.slideExit}`]:{transform:"translate(0%)"},[`& .${Hi["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${Hi["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function Qye(e){const t=Kr({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Hn(t,Yye),s=Gye(t),l=Xd();if(o)return p.jsx("div",{className:Ht(s.root,r),children:n});const d={exit:s.exit,enterActive:s.enterActive,enter:s.enter,exitActive:s.exitActive};return p.jsx(Kye,{className:Ht(s.root,r),childFactory:u=>C.cloneElement(u,{classNames:d}),role:"presentation",children:p.jsx(T2,Fe({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:d},i,{children:n}),a)})}const Xye=e=>Cn("MuiDayCalendar",e);fn("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const Zye=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Jye=["ownerState"],eve=e=>{const{classes:t}=e;return bn({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Xye,t)},i_=(by+k1*2)*6,tve=nt("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),nve=nt("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),rve=nt(Sr,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(e,t)=>t.weekDayLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),ove=nt(Sr,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(e,t)=>t.weekNumberLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),ave=nt(Sr,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>Fe({},e.typography.caption,{width:by,height:by,padding:0,margin:`0 ${k1}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),ive=nt("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:i_}),sve=nt(Qye,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:i_}),lve=nt("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),cve=nt("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${k1}px 0`,display:"flex",justifyContent:"center"});function uve(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:a,currentMonthNumber:i,isViewFocused:s}=e,l=Hn(e,Zye);const{disabled:d,disableHighlightToday:u,isMonthSwitchingAnimating:m,showDaysOutsideCurrentMonth:g,slots:y,slotProps:x,timezone:w}=t,S=Qr(),b=w1(w),$=r!==null&&S.isSameDay(n,r),k=o.some(R=>S.isSameDay(R,n)),T=S.isSameDay(n,b),O=y?.day??Vye,P=Cr({elementType:O,externalSlotProps:x?.day,additionalProps:Fe({disableHighlightToday:u,showDaysOutsideCurrentMonth:g,role:"gridcell",isAnimating:m,"data-timestamp":S.toJsDate(n).valueOf()},l),ownerState:Fe({},t,{day:n,selected:k})}),D=Hn(P,Jye),A=C.useMemo(()=>d||a(n),[d,a,n]),F=C.useMemo(()=>S.getMonth(n)!==i,[S,n,i]),L=C.useMemo(()=>{const R=S.startOfMonth(S.setMonth(n,i));return g?S.isSameDay(n,S.startOfWeek(R)):S.isSameDay(n,R)},[i,n,g,S]),_=C.useMemo(()=>{const R=S.endOfMonth(S.setMonth(n,i));return g?S.isSameDay(n,S.endOfWeek(R)):S.isSameDay(n,R)},[i,n,g,S]);return p.jsx(O,Fe({},D,{day:n,disabled:A,autoFocus:s&&$,today:T,outsideCurrentMonth:F,isFirstVisibleCell:L,isLastVisibleCell:_,selected:k,tabIndex:$?0:-1,"aria-selected":k,"aria-current":T?"date":void 0}))}function dve(e){const t=Kr({props:e,name:"MuiDayCalendar"}),n=Qr(),{onFocusedDayChange:r,className:o,currentMonth:a,selectedDays:i,focusedDay:s,loading:l,onSelectedDaysChange:d,onMonthSwitchingAnimationEnd:u,readOnly:m,reduceAnimations:g,renderLoading:y=()=>p.jsx("span",{children:"..."}),slideDirection:x,TransitionProps:w,disablePast:S,disableFuture:b,minDate:$,maxDate:k,shouldDisableDate:T,shouldDisableMonth:O,shouldDisableYear:P,dayOfWeekFormatter:D=Ae=>n.format(Ae,"weekdayShort").charAt(0).toUpperCase(),hasFocus:A,onFocusedViewChange:F,gridLabelId:L,displayWeekNumber:_,fixedWeekNumber:R,autoFocus:z,timezone:N}=t,B=w1(N),I=eve(t),H=Fs(),Y=n_({shouldDisableDate:T,shouldDisableMonth:O,shouldDisableYear:P,minDate:$,maxDate:k,disablePast:S,disableFuture:b,timezone:N}),ae=vc(),[K,oe]=Ti({name:"DayCalendar",state:"hasFocus",controlled:A,default:z??!1}),[ue,G]=C.useState(()=>s||B),ie=Yt(Ae=>{m||d(Ae)}),Q=Ae=>{Y(Ae)||(r(Ae),G(Ae),F?.(!0),oe(!0))},ee=Yt((Ae,Re)=>{switch(Ae.key){case"ArrowUp":Q(n.addDays(Re,-7)),Ae.preventDefault();break;case"ArrowDown":Q(n.addDays(Re,7)),Ae.preventDefault();break;case"ArrowLeft":{const re=n.addDays(Re,H?1:-1),_e=n.addMonths(Re,H?1:-1),Me=qg({utils:n,date:re,minDate:H?re:n.startOfMonth(_e),maxDate:H?n.endOfMonth(_e):re,isDateDisabled:Y,timezone:N});Q(Me||re),Ae.preventDefault();break}case"ArrowRight":{const re=n.addDays(Re,H?-1:1),_e=n.addMonths(Re,H?-1:1),Me=qg({utils:n,date:re,minDate:H?n.startOfMonth(_e):re,maxDate:H?re:n.endOfMonth(_e),isDateDisabled:Y,timezone:N});Q(Me||re),Ae.preventDefault();break}case"Home":Q(n.startOfWeek(Re)),Ae.preventDefault();break;case"End":Q(n.endOfWeek(Re)),Ae.preventDefault();break;case"PageUp":Q(n.addMonths(Re,1)),Ae.preventDefault();break;case"PageDown":Q(n.addMonths(Re,-1)),Ae.preventDefault();break}}),Z=Yt((Ae,Re)=>Q(Re)),de=Yt((Ae,Re)=>{K&&n.isSameDay(ue,Re)&&F?.(!1)}),le=n.getMonth(a),fe=n.getYear(a),he=C.useMemo(()=>i.filter(Ae=>!!Ae).map(Ae=>n.startOfDay(Ae)),[n,i]),me=`${fe}-${le}`,se=C.useMemo(()=>C.createRef(),[me]),ve=C.useMemo(()=>{const Ae=n.startOfMonth(a),Re=n.endOfMonth(a);return Y(ue)||n.isAfterDay(ue,Re)||n.isBeforeDay(ue,Ae)?qg({utils:n,date:ue,minDate:Ae,maxDate:Re,disablePast:S,disableFuture:b,isDateDisabled:Y,timezone:N}):ue},[a,b,S,ue,Y,n,N]),Le=C.useMemo(()=>{const Ae=n.getWeekArray(a);let Re=n.addMonths(a,1);for(;R&&Ae.length<R;){const re=n.getWeekArray(Re),_e=n.isSameDay(Ae[Ae.length-1][0],re[0][0]);re.slice(_e?1:0).forEach(Me=>{Ae.length<R&&Ae.push(Me)}),Re=n.addMonths(Re,1)}return Ae},[a,R,n]);return p.jsxs(tve,{role:"grid","aria-labelledby":L,className:I.root,children:[p.jsxs(nve,{role:"row",className:I.header,children:[_&&p.jsx(ove,{variant:"caption",role:"columnheader","aria-label":ae.calendarWeekNumberHeaderLabel,className:I.weekNumberLabel,children:ae.calendarWeekNumberHeaderText}),kue(n,B).map((Ae,Re)=>p.jsx(rve,{variant:"caption",role:"columnheader","aria-label":n.format(Ae,"weekday"),className:I.weekDayLabel,children:D(Ae)},Re.toString()))]}),l?p.jsx(ive,{className:I.loadingContainer,children:y()}):p.jsx(sve,Fe({transKey:me,onExited:u,reduceAnimations:g,slideDirection:x,className:Ht(o,I.slideTransition)},w,{nodeRef:se,children:p.jsx(lve,{ref:se,role:"rowgroup",className:I.monthContainer,children:Le.map((Ae,Re)=>p.jsxs(cve,{role:"row",className:I.weekContainer,"aria-rowindex":Re+1,children:[_&&p.jsx(ave,{className:I.weekNumber,role:"rowheader","aria-label":ae.calendarWeekNumberAriaLabelText(n.getWeekNumber(Ae[0])),children:ae.calendarWeekNumberText(n.getWeekNumber(Ae[0]))}),Ae.map((re,_e)=>p.jsx(uve,{parentProps:t,day:re,selectedDays:he,focusableDay:ve,onKeyDown:ee,onFocus:Z,onBlur:de,onDaySelect:ie,isDateDisabled:Y,currentMonthNumber:le,isViewFocused:K,"aria-colindex":_e+1},re.toString()))]},`week-${Ae[0]}`))})}))]})}function fve(e){return Cn("MuiPickersMonth",e)}const Ib=fn("MuiPickersMonth",["root","monthButton","disabled","selected"]),pve=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],hve=e=>{const{disabled:t,selected:n,classes:r}=e;return bn({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},fve,r)},mve=nt("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),gve=nt("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Ib.disabled}`]:t.disabled},{[`&.${Ib.selected}`]:t.selected}]})(({theme:e})=>Fe({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:as(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:as(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Ib.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Ib.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),yve=C.memo(function(e){const t=Kr({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:l,onClick:d,onKeyDown:u,onFocus:m,onBlur:g,"aria-current":y,"aria-label":x,slots:w,slotProps:S}=t,b=Hn(t,pve),$=C.useRef(null),k=hve(t);Go(()=>{n&&$.current?.focus()},[n]);const T=w?.monthButton??gve,O=Cr({elementType:T,externalSlotProps:S?.monthButton,additionalProps:{children:o,disabled:a,tabIndex:l,ref:$,type:"button",role:"radio","aria-current":y,"aria-checked":i,"aria-label":x,onClick:P=>d(P,s),onKeyDown:P=>u(P,s),onFocus:P=>m(P,s),onBlur:P=>g(P,s)},ownerState:t,className:k.monthButton});return p.jsx(mve,Fe({className:Ht(k.root,r),ownerState:t},b,{children:p.jsx(T,Fe({},O))}))});function vve(e){return Cn("MuiMonthCalendar",e)}fn("MuiMonthCalendar",["root"]);const bve=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],xve=e=>{const{classes:t}=e;return bn({root:["root"]},vve,t)};function wve(e,t){const n=Qr(),r=ev(),o=Kr({props:e,name:t});return Fe({disableFuture:!1,disablePast:!1},o,{minDate:cs(n,o.minDate,r.minDate),maxDate:cs(n,o.maxDate,r.maxDate)})}const Sve=nt("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:$1,boxSizing:"border-box"}),Cve=C.forwardRef(function(e,t){const n=wve(e,"MuiMonthCalendar"),{className:r,value:o,defaultValue:a,referenceDate:i,disabled:s,disableFuture:l,disablePast:d,maxDate:u,minDate:m,onChange:g,shouldDisableMonth:y,readOnly:x,autoFocus:w=!1,onMonthFocus:S,hasFocus:b,onFocusedViewChange:$,monthsPerRow:k=3,timezone:T,gridLabelId:O,slots:P,slotProps:D}=n,A=Hn(n,bve),{value:F,handleValueChange:L,timezone:_}=F2({name:"MonthCalendar",timezone:T,value:o,defaultValue:a,referenceDate:i,onChange:g,valueManager:Cl}),R=w1(_),z=Fs(),N=Qr(),B=C.useMemo(()=>Cl.getInitialReferenceValue({value:F,utils:N,props:n,timezone:_,referenceDate:i,granularity:dl.month}),[]),I=n,H=xve(I),Y=C.useMemo(()=>N.getMonth(R),[N,R]),ae=C.useMemo(()=>F!=null?N.getMonth(F):null,[F,N]),[K,oe]=C.useState(()=>ae||N.getMonth(B)),[ue,G]=Ti({name:"MonthCalendar",state:"hasFocus",controlled:b,default:w??!1}),ie=Yt(he=>{G(he),$&&$(he)}),Q=C.useCallback(he=>{const me=N.startOfMonth(d&&N.isAfter(R,m)?R:m),se=N.startOfMonth(l&&N.isBefore(R,u)?R:u),ve=N.startOfMonth(he);return N.isBefore(ve,me)||N.isAfter(ve,se)?!0:y?y(ve):!1},[l,d,u,m,R,y,N]),ee=Yt((he,me)=>{if(x)return;const se=N.setMonth(F??B,me);L(se)}),Z=Yt(he=>{Q(N.setMonth(F??B,he))||(oe(he),ie(!0),S&&S(he))});C.useEffect(()=>{oe(he=>ae!==null&&he!==ae?ae:he)},[ae]);const de=Yt((he,me)=>{switch(he.key){case"ArrowUp":Z((12+me-3)%12),he.preventDefault();break;case"ArrowDown":Z((12+me+3)%12),he.preventDefault();break;case"ArrowLeft":Z((12+me+(z?1:-1))%12),he.preventDefault();break;case"ArrowRight":Z((12+me+(z?-1:1))%12),he.preventDefault();break}}),le=Yt((he,me)=>{Z(me)}),fe=Yt((he,me)=>{K===me&&ie(!1)});return p.jsx(Sve,Fe({ref:t,className:Ht(H.root,r),ownerState:I,role:"radiogroup","aria-labelledby":O},A,{children:S2(N,F??B).map(he=>{const me=N.getMonth(he),se=N.format(he,"monthShort"),ve=N.format(he,"month"),Le=me===ae,Ae=s||Q(he);return p.jsx(yve,{selected:Le,value:me,onClick:ee,onKeyDown:de,autoFocus:ue&&me===K,disabled:Ae,tabIndex:me===K&&!Ae?0:-1,onFocus:le,onBlur:fe,"aria-current":Y===me?"date":void 0,"aria-label":ve,monthsPerRow:k,slots:P,slotProps:D,children:se},se)})}))});function kve(e){return Cn("MuiPickersYear",e)}const Lb=fn("MuiPickersYear",["root","yearButton","selected","disabled"]),$ve=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],Rve=e=>{const{disabled:t,selected:n,classes:r}=e;return bn({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},kve,r)},Tve=nt("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),Eve=nt("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${Lb.disabled}`]:t.disabled},{[`&.${Lb.selected}`]:t.selected}]})(({theme:e})=>Fe({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:as(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:as(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Lb.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Lb.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Mve=C.memo(function(e){const t=Kr({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:l,onClick:d,onKeyDown:u,onFocus:m,onBlur:g,"aria-current":y,slots:x,slotProps:w}=t,S=Hn(t,$ve),b=C.useRef(null),$=Rve(t);Go(()=>{n&&b.current?.focus()},[n]);const k=x?.yearButton??Eve,T=Cr({elementType:k,externalSlotProps:w?.yearButton,additionalProps:{children:o,disabled:a,tabIndex:l,ref:b,type:"button",role:"radio","aria-current":y,"aria-checked":i,onClick:O=>d(O,s),onKeyDown:O=>u(O,s),onFocus:O=>m(O,s),onBlur:O=>g(O,s)},ownerState:t,className:$.yearButton});return p.jsx(Tve,Fe({className:Ht($.root,r),ownerState:t},S,{children:p.jsx(k,Fe({},T))}))});function Ove(e){return Cn("MuiYearCalendar",e)}fn("MuiYearCalendar",["root"]);const Pve=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],jve=e=>{const{classes:t}=e;return bn({root:["root"]},Ove,t)};function Ave(e,t){const n=Qr(),r=ev(),o=Kr({props:e,name:t});return Fe({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:cs(n,o.minDate,r.minDate),maxDate:cs(n,o.maxDate,r.maxDate)})}const Dve=nt("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:$1,maxHeight:Phe,boxSizing:"border-box",position:"relative"}),Nve=C.forwardRef(function(e,t){const n=Ave(e,"MuiYearCalendar"),{autoFocus:r,className:o,value:a,defaultValue:i,referenceDate:s,disabled:l,disableFuture:d,disablePast:u,maxDate:m,minDate:g,onChange:y,readOnly:x,shouldDisableYear:w,onYearFocus:S,hasFocus:b,onFocusedViewChange:$,yearsOrder:k="asc",yearsPerRow:T,timezone:O,gridLabelId:P,slots:D,slotProps:A}=n,F=Hn(n,Pve),{value:L,handleValueChange:_,timezone:R}=F2({name:"YearCalendar",timezone:O,value:a,defaultValue:i,referenceDate:s,onChange:y,valueManager:Cl}),z=w1(R),N=Fs(),B=Qr(),I=C.useMemo(()=>Cl.getInitialReferenceValue({value:L,utils:B,props:n,timezone:R,referenceDate:s,granularity:dl.year}),[]),H=n,Y=jve(H),ae=C.useMemo(()=>B.getYear(z),[B,z]),K=C.useMemo(()=>L!=null?B.getYear(L):null,[L,B]),[oe,ue]=C.useState(()=>K||B.getYear(I)),[G,ie]=Ti({name:"YearCalendar",state:"hasFocus",controlled:b,default:r??!1}),Q=Yt(Re=>{ie(Re),$&&$(Re)}),ee=C.useCallback(Re=>{if(u&&B.isBeforeYear(Re,z)||d&&B.isAfterYear(Re,z)||g&&B.isBeforeYear(Re,g)||m&&B.isAfterYear(Re,m))return!0;if(!w)return!1;const re=B.startOfYear(Re);return w(re)},[d,u,m,g,z,w,B]),Z=Yt((Re,re)=>{if(x)return;const _e=B.setYear(L??I,re);_(_e)}),de=Yt(Re=>{ee(B.setYear(L??I,Re))||(ue(Re),Q(!0),S?.(Re))});C.useEffect(()=>{ue(Re=>K!==null&&Re!==K?K:Re)},[K]);const le=k!=="desc"?T*1:T*-1,fe=N&&k==="asc"||!N&&k==="desc"?-1:1,he=Yt((Re,re)=>{switch(Re.key){case"ArrowUp":de(re-le),Re.preventDefault();break;case"ArrowDown":de(re+le),Re.preventDefault();break;case"ArrowLeft":de(re-fe),Re.preventDefault();break;case"ArrowRight":de(re+fe),Re.preventDefault();break}}),me=Yt((Re,re)=>{de(re)}),se=Yt((Re,re)=>{oe===re&&Q(!1)}),ve=C.useRef(null),Le=vr(t,ve);C.useEffect(()=>{if(r||ve.current===null)return;const Re=ve.current.querySelector('[tabindex="0"]');if(!Re)return;const re=Re.offsetHeight,_e=Re.offsetTop,Me=ve.current.clientHeight,Ge=ve.current.scrollTop,Je=_e+re;re>Me||_e<Ge||(ve.current.scrollTop=Je-Me/2-re/2)},[r]);const Ae=B.getYearRange([g,m]);return k==="desc"&&Ae.reverse(),p.jsx(Dve,Fe({ref:Le,className:Ht(Y.root,o),ownerState:H,role:"radiogroup","aria-labelledby":P},F,{children:Ae.map(Re=>{const re=B.getYear(Re),_e=re===K,Me=l||ee(Re);return p.jsx(Mve,{selected:_e,value:re,onClick:Z,onKeyDown:he,autoFocus:G&&re===oe,disabled:Me,tabIndex:re===oe&&!Me?0:-1,onFocus:me,onBlur:se,"aria-current":ae===re?"date":void 0,yearsPerRow:T,slots:D,slotProps:A,children:B.format(Re,"year")},B.format(Re,"year"))})}))}),Ive=e=>Cn("MuiPickersCalendarHeader",e),Lve=fn("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function zve(e){return Cn("MuiPickersArrowSwitcher",e)}fn("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const Fve=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],_ve=["ownerState"],Bve=["ownerState"],Uve=nt("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),qve=nt("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),FN=nt(Tu,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),Hve=e=>{const{classes:t}=e;return bn({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},zve,t)},Vve=C.forwardRef(function(e,t){const n=Fs(),r=Kr({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:a,slots:i,slotProps:s,isNextDisabled:l,isNextHidden:d,onGoToNext:u,nextLabel:m,isPreviousDisabled:g,isPreviousHidden:y,onGoToPrevious:x,previousLabel:w,labelId:S}=r,b=Hn(r,Fve),$=r,k=Hve($),T={isDisabled:l,isHidden:d,goTo:u,label:m},O={isDisabled:g,isHidden:y,goTo:x,label:w},P=i?.previousIconButton??FN,D=Cr({elementType:P,externalSlotProps:s?.previousIconButton,additionalProps:{size:"medium",title:O.label,"aria-label":O.label,disabled:O.isDisabled,edge:"end",onClick:O.goTo},ownerState:Fe({},$,{hidden:O.isHidden}),className:Ht(k.button,k.previousIconButton)}),A=i?.nextIconButton??FN,F=Cr({elementType:A,externalSlotProps:s?.nextIconButton,additionalProps:{size:"medium",title:T.label,"aria-label":T.label,disabled:T.isDisabled,edge:"start",onClick:T.goTo},ownerState:Fe({},$,{hidden:T.isHidden}),className:Ht(k.button,k.nextIconButton)}),L=i?.leftArrowIcon??Yhe,_=Cr({elementType:L,externalSlotProps:s?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:$,className:k.leftArrowIcon}),R=Hn(_,_ve),z=i?.rightArrowIcon??Ghe,N=Cr({elementType:z,externalSlotProps:s?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:$,className:k.rightArrowIcon}),B=Hn(N,Bve);return p.jsxs(Uve,Fe({ref:t,className:Ht(k.root,a),ownerState:$},b,{children:[p.jsx(P,Fe({},D,{children:n?p.jsx(z,Fe({},B)):p.jsx(L,Fe({},R))})),o?p.jsx(Sr,{variant:"subtitle1",component:"span",id:S,children:o}):p.jsx(qve,{className:k.spacer,ownerState:$}),p.jsx(A,Fe({},F,{children:n?p.jsx(L,Fe({},R)):p.jsx(z,Fe({},B))}))]}))});function Wve(e,{disableFuture:t,maxDate:n,timezone:r}){const o=Qr();return C.useMemo(()=>{const a=o.date(void 0,r),i=o.startOfMonth(t&&o.isBefore(a,n)?a:n);return!o.isAfter(i,e)},[t,n,e,o,r])}function Yve(e,{disablePast:t,minDate:n,timezone:r}){const o=Qr();return C.useMemo(()=>{const a=o.date(void 0,r),i=o.startOfMonth(t&&o.isAfter(a,n)?a:n);return!o.isBefore(i,e)},[t,n,e,o,r])}const Gve=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],Kve=["ownerState"],Qve=e=>{const{classes:t}=e;return bn({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},Ive,t)},Xve=nt("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),Zve=nt("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>Fe({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),Jve=nt("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),ebe=nt(Tu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Lve.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),tbe=nt(Whe,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),nbe=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=Kr({props:e,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:i,currentMonth:s,disabled:l,disableFuture:d,disablePast:u,maxDate:m,minDate:g,onMonthChange:y,onViewChange:x,view:w,reduceAnimations:S,views:b,labelId:$,className:k,timezone:T,format:O=`${r.formats.month} ${r.formats.year}`}=o,P=Hn(o,Gve),D=o,A=Qve(o),F=a?.switchViewButton??ebe,L=Cr({elementType:F,externalSlotProps:i?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(w)},ownerState:D,className:A.switchViewButton}),_=a?.switchViewIcon??tbe,R=Cr({elementType:_,externalSlotProps:i?.switchViewIcon,ownerState:D,className:A.switchViewIcon}),z=Hn(R,Kve),N=()=>y(r.addMonths(s,1),"left"),B=()=>y(r.addMonths(s,-1),"right"),I=Wve(s,{disableFuture:d,maxDate:m,timezone:T}),H=Yve(s,{disablePast:u,minDate:g,timezone:T}),Y=()=>{if(!(b.length===1||!x||l))if(b.length===2)x(b.find(K=>K!==w)||b[0]);else{const K=b.indexOf(w)!==0?0:1;x(b[K])}};if(b.length===1&&b[0]==="year")return null;const ae=r.formatByString(s,O);return p.jsxs(Xve,Fe({},P,{ownerState:D,className:Ht(A.root,k),ref:t,children:[p.jsxs(Zve,{role:"presentation",onClick:Y,ownerState:D,"aria-live":"polite",className:A.labelContainer,children:[p.jsx(r_,{reduceAnimations:S,transKey:ae,children:p.jsx(Jve,{id:$,ownerState:D,className:A.label,children:ae})}),b.length>1&&!l&&p.jsx(F,Fe({},L,{children:p.jsx(_,Fe({},z))}))]}),p.jsx(Hd,{in:w==="day",appear:!S,enter:!S,children:p.jsx(Vve,{slots:a,slotProps:i,onGoToPrevious:B,isPreviousDisabled:H,previousLabel:n.previousMonth,onGoToNext:N,isNextDisabled:I,nextLabel:n.nextMonth})})]}))}),rbe=nt("div")({overflow:"hidden",width:$1,maxHeight:_2,display:"flex",flexDirection:"column",margin:"0 auto"}),obe=e=>Cn("MuiDateCalendar",e);fn("MuiDateCalendar",["root","viewTransitionContainer"]);const abe=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],ibe=e=>{const{classes:t}=e;return bn({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},obe,t)};function sbe(e,t){const n=Qr(),r=ev(),o=R3(),a=Kr({props:e,name:t});return Fe({},a,{loading:a.loading??!1,disablePast:a.disablePast??!1,disableFuture:a.disableFuture??!1,openTo:a.openTo??"day",views:a.views??["year","day"],reduceAnimations:a.reduceAnimations??o,renderLoading:a.renderLoading??(()=>p.jsx("span",{children:"..."})),minDate:cs(n,a.minDate,r.minDate),maxDate:cs(n,a.maxDate,r.maxDate)})}const lbe=nt(rbe,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:_2}),cbe=nt(r_,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),ube=C.forwardRef(function(e,t){const n=Qr(),r=_s(),o=sbe(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:i,value:s,defaultValue:l,referenceDate:d,disableFuture:u,disablePast:m,onChange:g,onYearChange:y,onMonthChange:x,reduceAnimations:w,shouldDisableDate:S,shouldDisableMonth:b,shouldDisableYear:$,view:k,views:T,openTo:O,className:P,disabled:D,readOnly:A,minDate:F,maxDate:L,disableHighlightToday:_,focusedView:R,onFocusedViewChange:z,showDaysOutsideCurrentMonth:N,fixedWeekNumber:B,dayOfWeekFormatter:I,slots:H,slotProps:Y,loading:ae,renderLoading:K,displayWeekNumber:oe,yearsOrder:ue,yearsPerRow:G,monthsPerRow:ie,timezone:Q}=o,ee=Hn(o,abe),{value:Z,handleValueChange:de,timezone:le}=F2({name:"DateCalendar",timezone:Q,value:s,defaultValue:l,referenceDate:d,onChange:g,valueManager:Cl}),{view:fe,setView:he,focusedView:me,setFocusedView:se,goToNextView:ve,setValueAndGoToNextView:Le}=T3({view:k,views:T,openTo:O,onChange:de,onViewChange:i,autoFocus:a,focusedView:R,onFocusedViewChange:z}),{referenceDate:Ae,calendarState:Re,changeFocusedDay:re,changeMonth:_e,handleChangeMonth:Me,isDateDisabled:Ge,onMonthSwitchingAnimationEnd:Je}=Nye({value:Z,referenceDate:d,reduceAnimations:w,onMonthChange:x,minDate:F,maxDate:L,shouldDisableDate:S,disablePast:m,disableFuture:u,timezone:le}),St=D&&Z||F,Ut=D&&Z||L,at=`${r}-grid-label`,tt=me!==null,pt=H?.calendarHeader??nbe,ze=Cr({elementType:pt,externalSlotProps:Y?.calendarHeader,additionalProps:{views:T,view:fe,currentMonth:Re.currentMonth,onViewChange:he,onMonthChange:(nn,Bt)=>Me({newMonth:nn,direction:Bt}),minDate:St,maxDate:Ut,disabled:D,disablePast:m,disableFuture:u,reduceAnimations:w,timezone:le,labelId:at},ownerState:o}),be=Yt(nn=>{const Bt=n.startOfMonth(nn),pn=n.endOfMonth(nn),$n=Ge(nn)?qg({utils:n,date:nn,minDate:n.isBefore(F,Bt)?Bt:F,maxDate:n.isAfter(L,pn)?pn:L,disablePast:m,disableFuture:u,isDateDisabled:Ge,timezone:le}):nn;$n?(Le($n,"finish"),x?.(Bt)):(ve(),_e(Bt)),re($n,!0)}),Ve=Yt(nn=>{const Bt=n.startOfYear(nn),pn=n.endOfYear(nn),$n=Ge(nn)?qg({utils:n,date:nn,minDate:n.isBefore(F,Bt)?Bt:F,maxDate:n.isAfter(L,pn)?pn:L,disablePast:m,disableFuture:u,isDateDisabled:Ge,timezone:le}):nn;$n?(Le($n,"finish"),y?.($n)):(ve(),_e(Bt)),re($n,!0)}),Oe=Yt(nn=>de(nn&&H0(n,nn,Z??Ae),"finish",fe));C.useEffect(()=>{Z!=null&&n.isValid(Z)&&_e(Z)},[Z]);const $t=o,Rt=ibe($t),vt={disablePast:m,disableFuture:u,maxDate:L,minDate:F},it={disableHighlightToday:_,readOnly:A,disabled:D,timezone:le,gridLabelId:at,slots:H,slotProps:Y},st=C.useRef(fe);C.useEffect(()=>{st.current!==fe&&(me===st.current&&se(fe,!0),st.current=fe)},[me,se,fe]);const Dt=C.useMemo(()=>[Z],[Z]);return p.jsxs(lbe,Fe({ref:t,className:Ht(Rt.root,P),ownerState:$t},ee,{children:[p.jsx(pt,Fe({},ze,{slots:H,slotProps:Y})),p.jsx(cbe,{reduceAnimations:w,className:Rt.viewTransitionContainer,transKey:fe,ownerState:$t,children:p.jsxs("div",{children:[fe==="year"&&p.jsx(Nve,Fe({},vt,it,{value:Z,onChange:Ve,shouldDisableYear:$,hasFocus:tt,onFocusedViewChange:nn=>se("year",nn),yearsOrder:ue,yearsPerRow:G,referenceDate:Ae})),fe==="month"&&p.jsx(Cve,Fe({},vt,it,{hasFocus:tt,className:P,value:Z,onChange:be,shouldDisableMonth:b,onFocusedViewChange:nn=>se("month",nn),monthsPerRow:ie,referenceDate:Ae})),fe==="day"&&p.jsx(dve,Fe({},Re,vt,it,{onMonthSwitchingAnimationEnd:Je,onFocusedDayChange:re,reduceAnimations:w,selectedDays:Dt,onSelectedDaysChange:Oe,shouldDisableDate:S,shouldDisableMonth:b,shouldDisableYear:$,hasFocus:tt,onFocusedViewChange:nn=>se("day",nn),showDaysOutsideCurrentMonth:N,fixedWeekNumber:B,dayOfWeekFormatter:I,displayWeekNumber:oe,loading:ae,renderLoading:K}))]})})]}))}),Lp=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:l,className:d,classes:u,disableFuture:m,disablePast:g,minDate:y,maxDate:x,shouldDisableDate:w,shouldDisableMonth:S,shouldDisableYear:b,reduceAnimations:$,onMonthChange:k,monthsPerRow:T,onYearChange:O,yearsOrder:P,yearsPerRow:D,slots:A,slotProps:F,loading:L,renderLoading:_,disableHighlightToday:R,readOnly:z,disabled:N,showDaysOutsideCurrentMonth:B,dayOfWeekFormatter:I,sx:H,autoFocus:Y,fixedWeekNumber:ae,displayWeekNumber:K,timezone:oe})=>p.jsx(ube,{view:e,onViewChange:t,views:n.filter(YD),focusedView:r&&YD(r)?r:null,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:l,className:d,classes:u,disableFuture:m,disablePast:g,minDate:y,maxDate:x,shouldDisableDate:w,shouldDisableMonth:S,shouldDisableYear:b,reduceAnimations:$,onMonthChange:k,monthsPerRow:T,onYearChange:O,yearsOrder:P,yearsPerRow:D,slots:A,slotProps:F,loading:L,renderLoading:_,disableHighlightToday:R,readOnly:z,disabled:N,showDaysOutsideCurrentMonth:B,dayOfWeekFormatter:I,sx:H,autoFocus:Y,fixedWeekNumber:ae,displayWeekNumber:K,timezone:oe}),s_=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=l3(e,"MuiDesktopDatePicker"),a=Fe({day:Lp,month:Lp,year:Lp},o.viewRenderers),i=Fe({},o,{viewRenderers:a,format:C2(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:Fe({openPickerIcon:Khe,field:t_},o.slots),slotProps:Fe({},o.slotProps,{field:l=>Fe({},b1(o.slotProps?.field,l),u3(o),{ref:t}),toolbar:Fe({hidden:!0},o.slotProps?.toolbar)})}),{renderPicker:s}=Vhe({props:i,valueManager:Cl,valueType:"date",getOpenDialogAriaText:i3({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:tv});return s()});s_.propTypes={autoFocus:dt.bool,className:dt.string,closeOnSelect:dt.bool,dayOfWeekFormatter:dt.func,defaultValue:dt.object,disabled:dt.bool,disableFuture:dt.bool,disableHighlightToday:dt.bool,disableOpenPicker:dt.bool,disablePast:dt.bool,displayWeekNumber:dt.bool,enableAccessibleFieldDOMStructure:dt.any,fixedWeekNumber:dt.number,format:dt.string,formatDensity:dt.oneOf(["dense","spacious"]),inputRef:GF,label:dt.node,loading:dt.bool,localeText:dt.object,maxDate:dt.object,minDate:dt.object,monthsPerRow:dt.oneOf([3,4]),name:dt.string,onAccept:dt.func,onChange:dt.func,onClose:dt.func,onError:dt.func,onMonthChange:dt.func,onOpen:dt.func,onSelectedSectionsChange:dt.func,onViewChange:dt.func,onYearChange:dt.func,open:dt.bool,openTo:dt.oneOf(["day","month","year"]),orientation:dt.oneOf(["landscape","portrait"]),readOnly:dt.bool,reduceAnimations:dt.bool,referenceDate:dt.object,renderLoading:dt.func,selectedSections:dt.oneOfType([dt.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),dt.number]),shouldDisableDate:dt.func,shouldDisableMonth:dt.func,shouldDisableYear:dt.func,showDaysOutsideCurrentMonth:dt.bool,slotProps:dt.object,slots:dt.object,sx:dt.oneOfType([dt.arrayOf(dt.oneOfType([dt.func,dt.object,dt.bool])),dt.func,dt.object]),timezone:dt.string,value:dt.object,view:dt.oneOf(["day","month","year"]),viewRenderers:dt.shape({day:dt.func,month:dt.func,year:dt.func}),views:dt.arrayOf(dt.oneOf(["day","month","year"]).isRequired),yearsOrder:dt.oneOf(["asc","desc"]),yearsPerRow:dt.oneOf([3,4])};function dbe(e){return Cn("MuiDialogContent",e)}fn("MuiDialogContent",["root","dividers"]);const fbe=fn("MuiDialogTitle",["root"]),pbe=e=>{const{classes:t,dividers:n}=e;return bn({root:["root",n&&"dividers"]},dbe,t)},hbe=nt("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Gn(({theme:e})=>({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px",variants:[{props:({ownerState:t})=>t.dividers,style:{padding:"16px 24px",borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>!t.dividers,style:{[`.${fbe.root} + &`]:{paddingTop:0}}}]}))),mbe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiDialogContent"}),{className:r,dividers:o=!1,...a}=n,i={...n,dividers:o},s=pbe(i);return p.jsx(hbe,{className:Ht(s.root,r),ownerState:i,ref:t,...a})});function gbe(e){return Cn("MuiDialog",e)}const Gg=fn("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),ybe=C.createContext({}),vbe=nt(_3,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),bbe=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:a}=e,i={root:["root"],container:["container",`scroll${Tt(n)}`],paper:["paper",`paperScroll${Tt(n)}`,`paperWidth${Tt(String(r))}`,o&&"paperFullWidth",a&&"paperFullScreen"]};return bn(i,gbe,t)},xbe=nt(B3,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),wbe=nt("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Tt(n.scroll)}`]]}})({height:"100%","@media print":{height:"auto"},outline:0,variants:[{props:{scroll:"paper"},style:{display:"flex",justifyContent:"center",alignItems:"center"}},{props:{scroll:"body"},style:{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}}}]}),Sbe=nt(tf,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Tt(n.scroll)}`],t[`paperWidth${Tt(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Gn(({theme:e})=>({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"},variants:[{props:{scroll:"paper"},style:{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"}},{props:{scroll:"body"},style:{display:"inline-block",verticalAlign:"middle",textAlign:"initial"}},{props:({ownerState:t})=>!t.maxWidth,style:{maxWidth:"calc(100% - 64px)"}},{props:{maxWidth:"xs"},style:{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${Gg.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}}},...Object.keys(e.breakpoints.values).filter(t=>t!=="xs").map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${Gg.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:"calc(100% - 64px)"}}}})),{props:({ownerState:t})=>t.fullWidth,style:{width:"calc(100% - 64px)"}},{props:({ownerState:t})=>t.fullScreen,style:{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${Gg.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),Cbe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiDialog"}),r=Xd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":i,"aria-modal":s=!0,BackdropComponent:l,BackdropProps:d,children:u,className:m,disableEscapeKeyDown:g=!1,fullScreen:y=!1,fullWidth:x=!1,maxWidth:w="sm",onClick:S,onClose:b,open:$,PaperComponent:k=tf,PaperProps:T={},scroll:O="paper",slots:P={},slotProps:D={},TransitionComponent:A=Hd,transitionDuration:F=o,TransitionProps:L,..._}=n,R={...n,disableEscapeKeyDown:g,fullScreen:y,fullWidth:x,maxWidth:w,scroll:O},z=bbe(R),N=C.useRef(),B=me=>{N.current=me.target===me.currentTarget},I=me=>{S&&S(me),N.current&&(N.current=null,b&&b(me,"backdropClick"))},H=_s(i),Y=C.useMemo(()=>({titleId:H}),[H]),ae={transition:A,...P},K={transition:L,paper:T,backdrop:d,...D},oe={slots:ae,slotProps:K},[ue,G]=ur("root",{elementType:xbe,shouldForwardComponentProp:!0,externalForwardedProps:oe,ownerState:R,className:Ht(z.root,m),ref:t}),[ie,Q]=ur("backdrop",{elementType:vbe,shouldForwardComponentProp:!0,externalForwardedProps:oe,ownerState:R}),[ee,Z]=ur("paper",{elementType:Sbe,shouldForwardComponentProp:!0,externalForwardedProps:oe,ownerState:R,className:Ht(z.paper,T.className)}),[de,le]=ur("container",{elementType:wbe,externalForwardedProps:oe,ownerState:R,className:z.container}),[fe,he]=ur("transition",{elementType:Hd,externalForwardedProps:oe,ownerState:R,additionalProps:{appear:!0,in:$,timeout:F,role:"presentation"}});return p.jsx(ue,{closeAfterTransition:!0,slots:{backdrop:ie},slotProps:{backdrop:{transitionDuration:F,as:l,...Q}},disableEscapeKeyDown:g,onClose:b,open:$,onClick:I,...G,..._,children:p.jsx(fe,{...he,children:p.jsx(de,{onMouseDown:B,...le,children:p.jsx(ee,{as:k,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":H,"aria-modal":s,...Z,children:p.jsx(ybe.Provider,{value:Y,children:u})})})})})}),kbe=nt(Cbe)({[`& .${Gg.container}`]:{outline:0},[`& .${Gg.paper}`]:{outline:0,minWidth:$1}}),$be=nt(mbe)({"&:first-of-type":{padding:0}});function Rbe(e){const{children:t,onDismiss:n,open:r,slots:o,slotProps:a}=e,i=o?.dialog??kbe,s=o?.mobileTransition??Hd;return p.jsx(i,Fe({open:r,onClose:n},a?.dialog,{TransitionComponent:s,TransitionProps:a?.mobileTransition,PaperComponent:o?.mobilePaper,PaperProps:a?.mobilePaper,children:p.jsx($be,{children:t})}))}const Tbe=["props","getOpenDialogAriaText"],Ebe=e=>{let{props:t,getOpenDialogAriaText:n}=e,r=Hn(e,Tbe);const{slots:o,slotProps:a,className:i,sx:s,format:l,formatDensity:d,enableAccessibleFieldDOMStructure:u,selectedSections:m,onSelectedSectionsChange:g,timezone:y,name:x,label:w,inputRef:S,readOnly:b,disabled:$,localeText:k}=t,T=C.useRef(null),O=_s(),P=a?.toolbar?.hidden??!1,{open:D,actions:A,layoutProps:F,renderCurrentView:L,fieldProps:_,contextValue:R}=E3(Fe({},r,{props:t,fieldRef:T,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),z=o.field,N=Cr({elementType:z,externalSlotProps:a?.field,additionalProps:Fe({},_,P&&{id:O},!($||b)&&{onClick:A.onOpen,onKeyDown:Ppe(A.onOpen)},{readOnly:b??!0,disabled:$,className:i,sx:s,format:l,formatDensity:d,enableAccessibleFieldDOMStructure:u,selectedSections:m,onSelectedSectionsChange:g,timezone:y,label:w,name:x},S?{inputRef:S}:{}),ownerState:t});N.inputProps=Fe({},N.inputProps,{"aria-label":n(_.value)});const B=Fe({textField:o.textField},N.slots),I=o.layout??D3;let H=O;P&&(w?H=`${O}-label`:H=void 0);const Y=Fe({},a,{toolbar:Fe({},a?.toolbar,{titleId:O}),mobilePaper:Fe({"aria-labelledby":H},a?.mobilePaper)}),ae=vr(T,N.unstableFieldRef);return{renderPicker:()=>p.jsxs(N3,{contextValue:R,localeText:k,children:[p.jsx(z,Fe({},N,{slots:B,slotProps:Y,unstableFieldRef:ae})),p.jsx(Rbe,Fe({},A,{open:D,slots:o,slotProps:Y,children:p.jsx(I,Fe({},F,Y?.layout,{slots:o,slotProps:Y,children:L()}))}))]})}},l_=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=l3(e,"MuiMobileDatePicker"),a=Fe({day:Lp,month:Lp,year:Lp},o.viewRenderers),i=Fe({},o,{viewRenderers:a,format:C2(r,o,!1),slots:Fe({field:t_},o.slots),slotProps:Fe({},o.slotProps,{field:l=>Fe({},b1(o.slotProps?.field,l),u3(o),{ref:t}),toolbar:Fe({hidden:!1},o.slotProps?.toolbar)})}),{renderPicker:s}=Ebe({props:i,valueManager:Cl,valueType:"date",getOpenDialogAriaText:i3({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:tv});return s()});l_.propTypes={autoFocus:dt.bool,className:dt.string,closeOnSelect:dt.bool,dayOfWeekFormatter:dt.func,defaultValue:dt.object,disabled:dt.bool,disableFuture:dt.bool,disableHighlightToday:dt.bool,disableOpenPicker:dt.bool,disablePast:dt.bool,displayWeekNumber:dt.bool,enableAccessibleFieldDOMStructure:dt.any,fixedWeekNumber:dt.number,format:dt.string,formatDensity:dt.oneOf(["dense","spacious"]),inputRef:GF,label:dt.node,loading:dt.bool,localeText:dt.object,maxDate:dt.object,minDate:dt.object,monthsPerRow:dt.oneOf([3,4]),name:dt.string,onAccept:dt.func,onChange:dt.func,onClose:dt.func,onError:dt.func,onMonthChange:dt.func,onOpen:dt.func,onSelectedSectionsChange:dt.func,onViewChange:dt.func,onYearChange:dt.func,open:dt.bool,openTo:dt.oneOf(["day","month","year"]),orientation:dt.oneOf(["landscape","portrait"]),readOnly:dt.bool,reduceAnimations:dt.bool,referenceDate:dt.object,renderLoading:dt.func,selectedSections:dt.oneOfType([dt.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),dt.number]),shouldDisableDate:dt.func,shouldDisableMonth:dt.func,shouldDisableYear:dt.func,showDaysOutsideCurrentMonth:dt.bool,slotProps:dt.object,slots:dt.object,sx:dt.oneOfType([dt.arrayOf(dt.oneOfType([dt.func,dt.object,dt.bool])),dt.func,dt.object]),timezone:dt.string,value:dt.object,view:dt.oneOf(["day","month","year"]),viewRenderers:dt.shape({day:dt.func,month:dt.func,year:dt.func}),views:dt.arrayOf(dt.oneOf(["day","month","year"]).isRequired),yearsOrder:dt.oneOf(["asc","desc"]),yearsPerRow:dt.oneOf([3,4])};const Mbe=["desktopModeMediaQuery"],Obe=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=jpe}=n,o=Hn(n,Mbe);return YF(r,{defaultMatches:!0})?p.jsx(s_,Fe({ref:t},o)):p.jsx(l_,Fe({ref:t},o))}),c_=400;function u_(e,t){const[n,r]=C.useState(e);return C.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function d_(e,t,{same:n=Object.is,unset:r=!1}={}){const[o,a]=C.useState(e),[i,s]=C.useState(!1),l=C.useRef(!1),d=C.useRef(null),u=C.useRef(!1),m=C.useRef({draft:o,committed:e,focused:i,unset:r,commit:t,same:n});C.useEffect(()=>{m.current={draft:o,committed:e,focused:i,unset:r,commit:t,same:n}});const g=()=>{const k=m.current,T=d.current?d.current.value:k.committed;return l.current&&(k.unset||!k.same(k.draft,T))},y=()=>{const k=m.current;d.current={value:k.draft},k.commit(k.draft),k.unset&&k.same(k.draft,k.committed)&&(l.current=!1)},x=()=>{g()&&y()},[w,S]=C.useState(0),b=C.useMemo(()=>({draft:o,gen:w}),[o,w]),$=u_(b,c_);return C.useEffect(()=>{const k=m.current;k.same($.draft,k.draft)&&g()&&!u.current&&y()},[$]),C.useEffect(()=>()=>x(),[]),C.useEffect(()=>{if(d.current&&n(d.current.value,e)&&(d.current=null),n(o,e)){!r&&!d.current&&(l.current=!1);return}(!i||!l.current)&&a(e)},[e,i,o,r,n]),{draft:o,change:k=>{l.current=!0,a(k),!m.current.focused&&!n(k,e)&&t(k)},reset:k=>{l.current=!1,d.current=null,a(k)},bind:{onFocus:()=>s(!0),onBlur:()=>{s(!1),x(),d.current=null},onKeyDown:k=>{k.key==="Enter"&&!k.nativeEvent.isComposing&&x()},onCompositionStart:()=>{u.current=!0},onCompositionEnd:()=>{u.current=!1,S(k=>k+1)}}}}const Pbe=250,jbe=300*1e3;function Abe(e,t){const n=C.useContext(HR),r=t.trim(),[o,a]=C.useState("");C.useEffect(()=>{const m=setTimeout(()=>a(r),Pbe);return()=>clearTimeout(m)},[r]);const[i,s]=C.useState(),l=e?JSON.stringify(e.key):void 0;C.useEffect(()=>{if(!e||!n||o==="")return;let m=!0;return n.fetchQuery({queryKey:[...e.key,o],queryFn:({signal:g})=>e.run(o,g),staleTime:jbe}).then(g=>{m&&s({key:l,text:o,page:g})}).catch(()=>{m&&s({key:l,text:o,failed:!0})}),()=>{m=!1}},[n,l,o]);const d=e!==void 0&&n!==void 0&&r!=="",u=i!==void 0&&i.key===l&&i.text===r;return{active:d,searching:d&&!u,page:d&&u?i.page:void 0,failed:d&&u&&i.failed===!0}}function P1(e,t){if(!t)return;const n=t.trim();if(!n)return;const r=e??"string";if(r==="date"||r==="timestamp"||r==="timestamptz")return n.replace(/^@/,"");if(r.startsWith("filter<")){const o=n.replace(/^f(?=['"])/,""),a=o.match(/^'([^'\\]*)'$/)??o.match(/^"([^"\\]*)"$/);return a?a[1]:o}return r==="string"?Dbe(n):n}function Dbe(e){const t=e[0];return e.length>=2&&(t==="'"||t==='"')&&e[e.length-1]===t?e.slice(1,-1).replace(/\\(["'\\ntr])/g,(n,r)=>r==="n"?`
470
470
  `:r==="t"?" ":r==="r"?"\r":r):e}Ar.extend(h2);const _N=14,Nbe=42;function Ibe(e){const t=(e.annotations??[]).filter(r=>r.trim().startsWith("#("));if(t.length===0)return;const n=[];for(const r of t){const o=r.trim(),a=o.match(/description="([^"]*)"/);if(a){n.push(a[1]);continue}const i=o.replace(/^#\(/,"").replace(/\)\s*$/,"").trim();i&&n.push(i)}return n.length>0?n.join(`
471
- `):void 0}function f_({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:a,optionsTruncated:i,optionSearch:s,onOpen:l}){const d=e.label??e.name??"",{theme:u}=Vr(),m=e.type??"string",g=Ibe(e),y=P1(m,e.default),x=y!==void 0?`Default: ${y===""?"(empty)":y}`:void 0,w=g||x?p.jsxs(p.Fragment,{children:[g,g&&x?p.jsx("br",{}):null,x]}):void 0,S=m==="string"||uu(m)==="string",b=!ou(m)||typeof t!="string"||TF(t),$=Q=>p.jsx(Ri,{label:d,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:p.jsxs(p.Fragment,{children:[`Not a ${Q}. Clear it to pick one.`,w?p.jsx("br",{}):null,w]}),slotProps:{input:{endAdornment:p.jsx(p_,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),k=ou(m),T=e.control==="multiselect"&&k,O=ou(m),P=e.control==="select"||e.control==="multiselect",D=P?O?typeof t=="string"?RF(t):[]:typeof t=="string"&&t!==""?[t]:[]:[],[A,F]=C.useState(""),[L,_]=C.useState(null),R=C.useRef(null),z=Abe(P?s:void 0,A);if(P&&S&&b&&!(!T&&D.length>1)){const Q=Z=>{const de=O?m2(Z):void 0;if(Z.length===0||de===""){n(null);return}n(O?de:Z[0])},ee=Ube(z,i,s);return p.jsx(h_.Provider,{value:ee,children:p.jsx(gK,{multiple:T,disableCloseOnSelect:T,onOpen:l,freeSolo:!0,forcePopupIcon:!0,autoSelect:!T,options:z.page?.values??r??[],...z.page?{filterOptions:Z=>Z}:{},onInputChange:(Z,de,le)=>F(le==="input"?de:""),loading:o||z.searching,loadingText:z.searching?"Searching…":"Loading…",noOptionsText:a?"Options unavailable":"No matching values",slots:{paper:Bbe},value:T?D:D[0]??null,onChange:(Z,de)=>Q(de===null?[]:Array.isArray(de)?de:[de]),renderInput:Z=>p.jsx(Ri,{...Z,label:d,size:"small",placeholder:D.length!==0?void 0:t===""?"All":y??"All",error:a,helperText:a?p.jsxs(p.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",w?p.jsx("br",{}):null,w]}):w,slotProps:{input:{...Z.InputProps,endAdornment:p.jsxs(p.Fragment,{children:[o&&p.jsx(ku,{size:16}),Z.InputProps.endAdornment]})},htmlInput:{...Z.inputProps,onBlur:de=>{if(Z.inputProps.onBlur?.(de),!T)return;const le=de.target.value.trim();le!==""&&!D.includes(le)&&Q([...D,le])}}}}),fullWidth:!0})})}const N=ou(m)&&uu(m)==="number",{rangeMin:B,rangeMax:I}=e,H=N&&typeof t=="string"?MF(t):void 0,Y=N&&typeof t=="string"?OF(t):void 0;if((N||m==="number")&&B!==void 0&&I!==void 0&&(!N||t===void 0||t===null||t===""||H!==void 0||Y!==void 0)){const Q=Y??(H!==void 0?[H,I]:void 0),ee=N?Q?.[0]:typeof t=="number"?t:void 0;if(ee===void 0&&t!==void 0&&t!==null&&t!=="")return $("number");const Z=L!==null,de=Z?Array.isArray(L)?L[0]:L:ee??B,le=Array.isArray(L)?[L[0],L[1]]:Q??[B,I],fe=le[1]>=I?`≥ ${le[0]}`:`${le[0]} to ${le[1]}`,he=N&&t===""&&!Z,me=ee!==void 0||he||Z;return p.jsxs(gk,{fullWidth:!0,children:[p.jsxs(Te,{component:"fieldset",sx:se=>({m:0,minWidth:0,border:u.cardBorder,borderRadius:2,px:`${_N}px`,pt:0,pb:.75,minHeight:Nbe,transition:"border-color 120ms ease-in","&:hover":{borderColor:se.palette.text.secondary},"&:focus-within":{borderColor:se.palette.text.primary}}),children:[p.jsx(wt,{component:"legend",variant:"caption",color:"text.secondary",sx:{px:.5,lineHeight:1},children:d}),p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:"fontWeightMedium"},children:me?he?"Any":N?fe:String(de):N?"Any":y??"Unset"}),me&&p.jsx(xy,{onClear:()=>n(null),sx:{p:0}})]}),p.jsx(cJ,{size:"small",min:B,max:I,value:N?le:de,disableSwap:N,valueLabelDisplay:"auto","aria-label":N?void 0:d,getAriaLabel:N?se=>se===0?`${d} from`:`${d} to`:void 0,sx:{py:0,mt:.5},onChange:(se,ve)=>{R.current=ve,_(ve)},onChangeCommitted:()=>{const se=R.current;if(R.current=null,_(null),se!==null){if(N){const[ve,Le]=Array.isArray(se)?[se[0],se[1]]:[se,se];if(ve<=B&&Le>=I){n(null);return}n(Le>=I?pce(ve):hce(ve,Le));return}n(Array.isArray(se)?se[0]:se)}}}),p.jsxs(Yn,{direction:"row",justifyContent:"space-between",children:[p.jsx(wt,{variant:"caption",color:"text.secondary",children:B}),p.jsx(wt,{variant:"caption",color:"text.secondary",children:I})]})]}),w&&p.jsx(yk,{sx:{mx:`${_N}px`},children:w})]})}const ae=ou(m)?uu(m):void 0,K=ae==="date"||ae==="timestamp"||ae==="timestamptz",oe=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),ue=t==null||oe;if(K&&!oe){const Q=Fbe(t);if(Q!==void 0)return p.jsx(_be,{label:d,state:Q,onChange:n,helperNode:w,defaultDisplay:y})}if(K&&ue){const Q=oe?Ar.utc(t):null;return p.jsx(K0,{label:d,committed:Q?.isValid()?Q:null,toValue:ee=>ee.format("YYYY-MM-DD"),onChange:n,helperText:w})}if(uu(m)==="boolean"){const Q=typeof t=="string"?fce(t):void 0;if(t==null||t===""||Q!==void 0)return p.jsx(zbe,{label:d,picked:Q,emptyOverride:t==="",onChange:n,helperNode:w,defaultDisplay:y})}if(m==="boolean"){const Q=typeof t=="boolean";if(!Q&&t!==void 0&&t!==null)return $("true or false");const ee=e.default?.trim()==="true";return p.jsxs(gk,{children:[p.jsxs(Yn,{direction:"row",alignItems:"center",children:[p.jsx(MR,{control:p.jsx(oQ,{checked:Q?t:ee,onChange:Z=>n(Z.target.checked)}),label:d}),Q&&p.jsx(xy,{onClear:()=>n(null),edge:"end"})]}),w&&p.jsx(yk,{children:w})]})}if(m==="number"){const Q=t!=null;return Q&&t!==""&&typeof t!="number"?$("number"):p.jsx(BN,{label:d,type:"number",committed:typeof t=="number"?String(t):"",onCommit:ee=>n(ee===""?null:Number(ee)),placeholder:y,helperText:w,isOverridden:Q,onClear:()=>n(null)})}if(m==="date"||m==="timestamp"||m==="timestamptz"){const Q=t instanceof Date?t:typeof t=="string"?(Z=>Z instanceof Date?Z:null)(FF(m,t)):null,ee=Q?Ar.utc(Q):null;return t!=null&&t!==""&&Q===null?$("date"):p.jsx(K0,{label:d,committed:ee,toValue:Z=>wce(Z,Q??void 0),onChange:n,helperText:w})}const G=typeof t=="string"?t:"",ie=t!=null;return p.jsx(BN,{label:d,committed:G,onCommit:n,placeholder:ie?void 0:y??(m.startsWith("filter<")?m:void 0),helperText:w,isOverridden:ie,emptyOverrides:!0,onClear:()=>n(null)})}function BN({label:e,type:t,committed:n,onCommit:r,placeholder:o,helperText:a,isOverridden:i,emptyOverrides:s=!1,onClear:l}){const{draft:d,change:u,reset:m,bind:g}=d_(n,r,{unset:s&&!i});return p.jsx(Ri,{label:e,type:t,value:d,onChange:y=>u(y.target.value),placeholder:o,helperText:a,slotProps:{input:{endAdornment:i&&p.jsx(p_,{onClear:()=>{m(""),l()}})}},...g,fullWidth:!0,size:"small"})}const Lbe=(e,t)=>e===null||t===null?e===t:e.year()===t.year()&&e.month()===t.month()&&e.date()===t.date();function K0({label:e,committed:t,toValue:n,onChange:r,helperText:o,minDate:a}){const{draft:i,change:s,reset:l,bind:d}=d_(t,u=>{u===null?r(null):u.isValid()&&r(n(u))},{same:Lbe});return p.jsx(a3,{dateAdapter:fue,children:p.jsx(Obe,{label:e,value:i,minDate:a,onChange:s,slotProps:{textField:{fullWidth:!0,size:"small",helperText:o,...d},field:{clearable:!0,onClear:()=>{l(null),r(null)}},clearButton:{onMouseDown:u=>u.preventDefault()}}})})}function xy({onClear:e,edge:t,sx:n}){return p.jsx(ro,{size:"small","aria-label":"Clear value",onClick:e,edge:t,sx:[{minWidth:24,minHeight:24},...Array.isArray(n)?n:[n]],children:p.jsx(Uce,{fontSize:"small"})})}function p_({onClear:e}){return p.jsx(PR,{position:"end",onMouseDown:t=>t.preventDefault(),children:p.jsx(xy,{onClear:e,edge:"end"})})}const zb="__any__";function zbe({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:a}){const i=t??(n?zb:"");return p.jsx(Te,{"data-testid":"boolean-filter",children:p.jsxs(Ri,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:s=>s==="true"||s==="false"?s:s===zb?"Any":a||"Any"},input:{endAdornment:i!==""?p.jsx(xy,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:s=>{s.target.value!==zb&&r(s.target.value)},children:[n&&p.jsx(ea,{value:zb,children:"Any"}),p.jsx(ea,{value:"true",children:"true"}),p.jsx(ea,{value:"false",children:"false"})]})})}function Fbe(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=PF(e);if(t!==void 0)return{kind:"preset",key:t};const n=jF(e);if(n!==void 0)return{kind:"days",...n}}const Fb="__custom__",RC="__any__";function _be({label:e,state:t,onChange:n,helperNode:r,defaultDisplay:o}){const a=t.kind==="days"?`days:${t.firstDay}/${t.lastDay}`:t.kind==="preset"?`preset:${t.key}`:t.kind,[i,s]=C.useState(t.kind==="days"),[l,d]=C.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});C.useEffect(()=>{t.kind==="days"?(s(!0),d({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&s(!1)},[a]);const u=t.kind!=="unset",m=i?Fb:t.kind==="preset"?t.key:t.kind==="any"?RC:"",g=x=>{d(x),x.from&&x.to&&!Ar.utc(x.to).isBefore(Ar.utc(x.from))&&n(yce(x.from,x.to))},y=x=>{const w=x?Ar.utc(x):null;return w?.isValid()?w:null};return p.jsxs(Yn,{direction:"row",spacing:1,"data-testid":"time-range",children:[p.jsxs(Ri,{select:!0,label:e,value:m,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:x=>{if(x===Fb)return"Custom range";if(x===RC)return"Any time";const w=my.find(S=>S.key===x);return w?w.label:o??"Any time"}},input:{endAdornment:u?p.jsx(xy,{onClear:()=>{s(!1),d({}),n(null)},sx:{mr:2}}):void 0}},onChange:x=>{const w=x.target.value;if(w===Fb){s(!0);return}s(!1);const S=mce(w);S!==void 0&&n(S)},children:[t.kind==="any"&&p.jsx(ea,{value:RC,children:"Any time"}),my.map(x=>p.jsx(ea,{value:x.key,children:x.label},x.key)),p.jsx(ea,{value:Fb,children:"Custom range"})]}),i&&p.jsxs(p.Fragment,{children:[p.jsx(K0,{label:"From",committed:y(l.from),toValue:x=>x.format("YYYY-MM-DD"),onChange:x=>g({...l,from:x===null?void 0:String(x)})}),p.jsx(K0,{label:"To",committed:y(l.to),minDate:y(l.from)??void 0,toValue:x=>x.format("YYYY-MM-DD"),onChange:x=>g({...l,to:x===null?void 0:String(x)})})]})]})}const h_=C.createContext(void 0);function Bbe({children:e,...t}){const n=C.useContext(h_);return p.jsxs(Qa,{...t,children:[e,n&&p.jsx(Te,{role:"note",sx:{px:2,py:1,borderTop:1,borderColor:"divider",color:"text.secondary",typography:"caption"},children:n})]})}const _b=e=>e.toLocaleString("en-US");function Ube(e,t,n){if(e.active)return e.searching?"Searching all values…":e.failed?`Could not search all values. Showing matches in the first ${_b(Md)}.`:e.page?.truncated?`Showing the first ${_b(v2)} matches. Keep typing to narrow them.`:void 0;if(t)return n?`Showing the first ${_b(Md)} values. Type to search them all.`:`Showing the first ${_b(Md)} values. A value not listed can still be typed.`}const qbe=C.createContext(void 0),Sh=()=>C.useContext(qbe),Tg="remove-badge",Hbe={[`& .${Tg}`]:{opacity:0},[`&:hover .${Tg}, &:focus-within .${Tg}`]:{opacity:1},"@media (hover: none)":{[`& .${Tg}`]:{opacity:1}}};function Vbe({label:e,onRemove:t,disabledReason:n,inset:r=0}){const{theme:o}=Vr(),a=n!==void 0,i=p.jsx(ro,{className:Tg,"aria-label":e,"aria-disabled":a||void 0,...a?{"aria-description":n}:{},onClick:s=>{s.stopPropagation(),a||t()},onPointerDown:s=>s.stopPropagation(),sx:s=>({position:"absolute",top:-8-r,right:-8-r,zIndex:3,width:18,height:18,p:0,borderRadius:"50%",border:`1px solid ${Zd(o.cardBorder)}`,bgcolor:s.palette.background.paper,color:s.palette.text.secondary,cursor:a?"default":"pointer",transition:`opacity ${Zy}`,...Jy,"&:hover":{bgcolor:s.palette.background.paper,color:a?s.palette.text.secondary:s.palette.text.primary,borderColor:mF(o.cardBorder,o.tileTitle)}}),children:p.jsx(xh,{sx:{fontSize:12}})});return a?p.jsx(Br,{title:n,children:i}):i}const K2=e=>e.required===!0,Wbe=(e,t)=>e==null||e===""&&!zF(t);function Ybe(e,t,n){return e.filter(r=>r.name!==void 0&&K2(r)&&Wbe(t.get(r.name),r.type)&&(n?.[r.name]===void 0||n[r.name]===null))}function Gbe(e,t){if(!t||e.length===0)return[];const n=new Set(t);return e.filter(r=>r.name&&n.has(r.name))}const m_=e=>e.label??e.name??"";function g_(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Kbe(e){const t=e.map(m_);return`Pick a value for ${g_(t)} to see this report.`}function Qbe(e){return`Waiting for ${g_(e.map(m_))}.`}const y$=28,Xbe=/^\d{4}-\d{2}-\d{2}$/,y_=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});function TC(e){if(!Xbe.test(e))return e;const t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:y_.format(t)}function Zbe(e,t){if(e.length===0)return"";const n=e.join(", ");return t?n:n.length<=y$||e.length===1?Q0(n,t):`${Q0(e[0]??"",t)} +${e.length-1}`}function Q0(e,t){return!t&&e.length>y$?`${e.slice(0,y$-1)}…`:e}function Jbe(e,t){if(K2(e))return"Required";const n=e.type??"string",r=P1(n,e.default);if(r!==void 0&&r!=="")return v_(n,r,t);const o=uu(n)??n;return e.control==="select"||e.control==="multiselect"||o==="string"?"All":"Any"}function v_(e,t,n){if(!ou(e))return Q0(TC(t),n);const r=uu(e);if(r==="string"&&TF(t))return Zbe(RF(t),n);if(r==="number"){const o=OF(t);if(o)return`${o[0]}–${o[1]}`;const a=MF(t);if(a!==void 0)return`≥ ${a}`}if(r==="date"||r==="timestamp"||r==="timestamptz"){const o=PF(t);if(o)return my.find(i=>i.key===o)?.label??t;const a=jF(t);if(a)return`${TC(a.firstDay)} – ${TC(a.lastDay)}`}return Q0(t,n)}function b_(e,t,n){return t==null?Jbe(e,n):t instanceof Date?Number.isNaN(t.getTime())?"":y_.format(t):typeof t=="boolean"?t?"Yes":"No":typeof t=="number"?String(t):t===""?"(empty)":v_(e.type??"string",t,n)}function e0e(e,t){return b_(e,t,!1)}function t0e(e,t){return b_(e,t,!0)}function n0e(e){const{given:t,value:n,onChange:r}=e,{theme:o}=Vr(),a=o.ui,i=Sh(),[s,l]=C.useState(null),d=t.name??"",u=t.label??d,m=n!=null,g=e0e(t,n),y=s!==null,x=i?.stateOf(d),w=x?.problem,S=x?.fixed,b=p.jsxs(x_,{name:d,set:m,open:y,problem:w,fixed:S!==void 0,required:!m&&K2(t),children:[p.jsxs(is,{"aria-haspopup":"dialog","aria-expanded":y,"aria-label":`${u}: ${g}`,onClick:$=>{l($.currentTarget),e.onOpen?.()},sx:$=>({height:"100%",borderRadius:a.radius.control,pl:"10px",pr:m?"4px":"8px",gap:"6px",fontFamily:"inherit",fontSize:a.type.control.fontSize,lineHeight:1,minWidth:0,color:$.palette.text.primary}),children:[p.jsx(Te,{component:"span",sx:$=>({color:m?o.accent:$.palette.text.secondary,whiteSpace:"nowrap"}),children:u}),p.jsx(Te,{component:"span",sx:{fontWeight:a.type.control.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g}),!m&&p.jsx(hF,{"aria-hidden":!0,sx:$=>({fontSize:16,color:$.palette.text.secondary,transform:y?"rotate(180deg)":"none"})})]}),m&&p.jsx(ro,{"aria-label":`Clear ${u}`,onClick:()=>r(null),sx:{width:22,height:22,mr:"4px",borderRadius:"4px",color:o.accent},children:p.jsx(xh,{sx:{fontSize:14}})})]});return p.jsxs(p.Fragment,{children:[w?p.jsx(Br,{title:w,children:b}):b,p.jsxs(DR,{className:Sl.filterPopover,open:y,anchorEl:s,onClose:()=>l(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":`${u} filter`,sx:{mt:.75,p:1.5,width:300,maxWidth:"calc(100vw - 32px)",boxSizing:"border-box",borderRadius:a.radius.tile,border:o.cardBorder,boxShadow:o.shadow.lift}}},children:[p.jsx(f_,{...e}),i&&p.jsxs(Te,{sx:$=>({mt:1.5,pt:1,borderTop:`1px solid ${$.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:.5}),children:[w&&p.jsx(wt,{sx:{...a.type.caption,color:"warning.main"},children:w}),S!==void 0&&p.jsx(wt,{sx:$=>({...a.type.caption,color:$.palette.text.secondary}),children:S}),p.jsx(a0e,{name:d,type:t.type,text:r0e(n,t.type)}),S===void 0?p.jsx(Vn,{size:"small","aria-label":`Edit filter ${d}`,"aria-haspopup":"dialog",onClick:()=>{l(null),i.onEdit(d)},sx:{px:.75,minWidth:0,...a.type.control},children:"Filter settings…"}):x?.openModel&&p.jsx(Vn,{size:"small",onClick:()=>{l(null),x.openModel?.()},sx:{px:.75,minWidth:0,...a.type.control},children:"Open the model"})]})]})]})}function r0e(e,t){if(e!=null)return IF(e,t)}function o0e(e,t){return e===void 0||!t?.startsWith("filter<")?e:/^f(['"])([\s\S]*)\1$/.exec(e)?.[2]??e}function a0e({name:e,type:t,text:n}){const r=Sh(),o=Vr().theme.ui;if(!r?.setStartingValue)return null;const a=r.setStartingValue,i=o0e(r.startingValueOf?.(e),t),s=r.stateOf(e)?.origin==="dashboard",l={px:.75,minWidth:0,...o.type.control};return p.jsxs(p.Fragment,{children:[i!==void 0&&i===n&&p.jsxs(wt,{sx:d=>({...o.type.caption,color:d.palette.text.secondary,px:.75,display:"flex",alignItems:"center",gap:.5}),children:[p.jsx(pF,{"aria-hidden":!0,sx:{fontSize:14}}),"Report default"]}),n!==void 0&&n!==i&&p.jsx(Vn,{size:"small",onClick:()=>a(e,n),sx:l,children:"Make this the report's default"}),i!==void 0&&p.jsx(Vn,{size:"small",onClick:()=>a(e,void 0),sx:l,children:s?"Use the filter's default":"Use the model's default"})]})}function x_({name:e,set:t=!1,open:n=!1,unused:r=!1,problem:o,fixed:a=!1,required:i=!1,children:s}){const{theme:l}=Vr(),d=l.ui,u=Sh();return p.jsxs(Te,{className:Sl.filter,"data-filter":e,"data-set":t||void 0,"data-problem":o?!0:void 0,"data-required":i||void 0,sx:m=>({position:"relative",display:"inline-flex",alignItems:"center",height:d.size.control,boxSizing:"border-box",borderRadius:d.radius.control,border:"1px solid",borderStyle:r?"dashed":"solid",borderColor:o||i?m.palette.warning.main:t?`color-mix(in srgb, ${l.accent} 45%, transparent)`:n?l.accent:Zd(l.cardBorder),bgcolor:t?`color-mix(in srgb, ${l.accent} 8%, ${m.palette.background.paper})`:m.palette.background.paper,opacity:r?.75:1,transition:`border-color ${Zy}`,...Jy,"&:hover":{borderColor:t||n||o?void 0:mF(l.cardBorder,l.tileTitle)},maxWidth:"100%",...Hbe}),children:[s,u&&!a&&p.jsx(Vbe,{label:`Remove filter ${e}`,onRemove:()=>u.onRemove(e)})]})}function i0e({name:e,label:t,unused:n=!0}){const r=Sh(),o=Vr().theme.ui;if(!r)return null;const a=r.stateOf(e)?.problem,i=p.jsx(x_,{name:e,unused:n,problem:a,children:p.jsxs(is,{"aria-label":`Edit filter ${e}`,"aria-haspopup":"dialog",onClick:()=>r.onEdit(e),sx:s=>({height:"100%",borderRadius:o.radius.control,px:"10px",gap:"6px",fontFamily:"inherit",fontSize:o.type.control.fontSize,lineHeight:1,color:s.palette.text.secondary,whiteSpace:"nowrap"}),children:[p.jsx("span",{children:t}),n&&p.jsx(Te,{component:"span",sx:{fontStyle:"italic"},children:"Unused"})]})});return a?p.jsx(Br,{title:a,children:i}):i}function s0e(){const{theme:e}=Vr(),t=e.ui,n=Sh();if(!n)return null;const r=n.addDisabledReason!==void 0;return p.jsx(Br,{title:n.addDisabledReason??"",children:p.jsx("span",{children:p.jsx(Vn,{variant:"outlined",startIcon:p.jsx(f1,{}),"aria-label":"Add filter","aria-haspopup":"dialog",disabled:r,onClick:()=>n.onAdd(),sx:o=>({height:t.size.control,minHeight:t.size.control,px:1.25,borderRadius:t.radius.control,borderStyle:"dashed",borderColor:Zd(e.cardBorder),color:o.palette.text.secondary,boxShadow:"none",...t.type.control,"& .MuiButton-startIcon":{mr:.5},"& .MuiButton-startIcon svg":{fontSize:16}}),children:"Filter"})})})}function j1({givens:e,values:t,onChange:n,onReset:r,canReset:o,layout:a="panel",options:i,optionsLoading:s,optionsFailed:l,optionsTruncated:d,optionSearch:u,apply:m,title:g,onControlOpen:y}){const x=Sh();if(e.length===0&&!(x&&a==="bar"))return null;const w=Array.from(t.values()).some(T=>T!==null),S=o??w,b=T=>{if(T===void 0)return{};const O=u?.get(T);return{...d?.has(T)?{optionsTruncated:!0}:{},...O?{optionSearch:O}:{},...y?{onOpen:()=>y(T)}:{}}},$=e.map(T=>p.jsx(Te,{children:p.jsx(f_,{given:T,value:T.name?t.get(T.name):void 0,onChange:O=>T.name&&n(T.name,O),options:T.name?i?.get(T.name):void 0,optionsLoading:s,optionsFailed:T.name?l?.has(T.name):void 0,...b(T.name)})},T.name)),k=p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,children:[m&&p.jsx(Vn,{variant:"contained",size:"small",disableElevation:!0,onClick:()=>m.pending&&m.onApply(),"aria-disabled":!m.pending,sx:{"&[aria-disabled='true']":{cursor:"default",color:"action.disabled",backgroundColor:"action.disabledBackground","&:hover":{backgroundColor:"action.disabledBackground"}}},children:"Apply"}),S&&p.jsx(Vn,{variant:"text",size:"small",onClick:r,children:"Reset"})]});return a==="bar"?p.jsxs(Yn,{direction:"row",role:"group","aria-label":g??"Filters",useFlexGap:!0,sx:{flexWrap:"wrap",alignItems:"center",gap:1},children:[e.map(T=>p.jsx(n0e,{given:T,value:T.name?t.get(T.name):void 0,onChange:O=>T.name&&n(T.name,O),options:T.name?i?.get(T.name):void 0,optionsLoading:s,optionsFailed:T.name?l?.has(T.name):void 0,...b(T.name)},T.name)),x?.unrendered.map(T=>p.jsx(i0e,{name:T.name,label:T.label},T.name)),p.jsx(s0e,{}),p.jsx(Te,{sx:{ml:"auto"},children:k})]}):p.jsxs(Qa,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[p.jsxs(Yn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[p.jsx(wt,{variant:"subtitle2",sx:{fontWeight:"fontWeightMedium",color:"text.primary"},children:g??"Filters"}),k]}),p.jsx(Te,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:$})]})}const l0e=/^(https?|mailto|tel):/i,c0e=/^[a-z][a-z0-9+.-]*:/i;function u0e({href:e,title:t,children:n,context:r}){const o=!!e&&c0e.test(e),a=!!e&&!o&&!e.startsWith("/")&&!e.startsWith("#");if(!e||!a||!r){const m=o&&!l0e.test(e??"");return p.jsx("a",{href:m?void 0:e,title:t,...o?{target:"_blank",rel:"noopener noreferrer"}:{},children:n})}const i=r.sourcePath&&r.sourcePath.includes("/")?r.sourcePath.slice(0,r.sourcePath.lastIndexOf("/")+1):"",s=new URL(e,`https://malloy.invalid/${i}`),l=s.pathname.slice(1)+s.search+s.hash,d=`/${r.environmentName}/${r.packageName}/${l}`,{onNavigate:u}=r;return p.jsx("a",{href:d,title:t,onClick:u?m=>{m.preventDefault(),u(d,m)}:void 0,children:n})}const d0e=e=>({document:{"& > :first-child, & > div:only-child > :first-child":{mt:0},"& > :last-child, & > div:only-child > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"fontWeightMedium",color:"text.primary",mb:1,mt:2},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p, & ul, & ol":{color:"text.primary",...e.type.prose,mb:1,maxWidth:ple},"& li":{mb:.5}},caption:{color:"text.secondary",typography:"body2","& > :first-of-type":{mt:0},"& > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontSize:"inherit",fontWeight:"fontWeightMedium",m:"0.5em 0 0.25em"},"& p":{m:"0.5em 0"},"& ul, & ol":{m:"0.5em 0",pl:3},"& code":{fontFamily:e.font.mono,fontSize:"0.9em"}}});function f0e({alt:e}){return p.jsx(p.Fragment,{children:e})}function oh({children:e,variant:t="caption",links:n,sx:r}){const{theme:o}=Vr();return p.jsx(Te,{sx:[d0e(o.ui)[t],{fontFamily:o.font.family},...Array.isArray(r)?r:[r]],children:p.jsx(Zoe,{options:{forceBlock:t==="document",disableParsingRawHTML:!0,overrides:{a:{component:u0e,props:{context:n}},img:{component:f0e}}},children:e})})}const wu={opening:e=>e?`Opening the ${e}…`:"Opening…",running:"Running…",loading:"Loading…"};function Bo({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[p.jsx(ku,{size:t,color:n,thickness:r}),e&&p.jsx(wt,{variant:i,color:"text.secondary",children:e})]});return o?p.jsx(Te,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}let rg;function p0e(){return rg||(rg=wo(()=>import("./index-DgBiwYeC.js"),[]),rg.catch(()=>{rg=void 0})),rg}function Q2(){typeof window>"u"||p0e().catch(()=>{})}const w_=Jt(p.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function zp({sx:e,...t}){const{theme:n}=Vr();return p.jsx(ro,{size:"small",...t,sx:[{width:32,height:32,bgcolor:n.tile,border:n.border,color:n.tileTitle,"&:hover":{bgcolor:n.tile,color:n.drillLink},"& .MuiSvgIcon-root":{fontSize:18}},...Array.isArray(e)?e:[e]]})}const h0e=new Set(["warn","error"]);function m0e(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!h0e.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
472
- `)}}const g0e=C.lazy(()=>wo(()=>import("./RenderedResult-DqPvGZgL.es-BNxk46Vn.js"),[]).then(e=>e.c));function A1({result:e,maxHeight:t,tableMaxHeight:n,firstPaintHeight:r,maxResultSize:o=0,renderLogs:a,drill:i,fill:s=!1,compactToFit:l=!1}){const d=C.useRef(null);C.useEffect(()=>Q2(),[]);const[u,m]=C.useState(void 0),[g,y]=C.useState(void 0),[x,w]=C.useState(void 0),S=C.useCallback((B,I)=>{m(B),w(I)},[]),[b,$]=C.useState(!1),[k,T]=C.useState(void 0),O=m0e(a);C.useEffect(()=>{const B=d.current;if(!s||!B)return;const I=new ResizeObserver(([H])=>{T(Math.round(H.contentRect.height)),F(Math.round(H.contentRect.width))});return I.observe(B),()=>I.disconnect()},[s,!!e,b]);const[P,D]=C.useState(void 0),[A,F]=C.useState(void 0),L=s&&l&&u==="content";if(C.useEffect(()=>{D(void 0)},[e,A,L]),C.useEffect(()=>{L&&(k===void 0||g===void 0||(P===void 0&&g>k+1?D(g):P!==void 0&&k>=P&&D(void 0)))},[L,k,g,P]),!e)return null;if(o>0&&e.length>o&&!b)return p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[p.jsx(gae,{sx:{fontSize:48,color:"#757575"}}),p.jsx(wt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),p.jsx(Vn,{variant:"contained",color:"primary",onClick:()=>$(!0),children:"Proceed"})]});const _=p.jsx(Bo,{text:wu.loading,centered:!0,size:32}),R=Dle({renderAs:x,maxHeight:t,tableMaxHeight:n}),z=MD({sizing:u,contentHeight:g,maxHeight:R,fillHeight:s?k:void 0,firstPaintHeight:r}),N=p.jsx(C.Suspense,{fallback:_,children:p.jsx(g0e,{result:e,height:z,onSizeChange:y,onSizing:S,drill:i,fill:s})});return p.jsxs(Te,{ref:d,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflowX:"hidden",overflowY:s?"hidden":"auto",...s&&{flex:`1 1 ${MD({sizing:u,contentHeight:g,maxHeight:R,firstPaintHeight:r})}px`,minHeight:0}},children:[s?p.jsx(Te,{className:Ble,...L&&P!==void 0?{[_le]:""}:{},sx:{position:"absolute",inset:0,overflowX:"hidden",overflowY:"auto"},children:N}):N,O&&p.jsx(Te,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:p.jsx(Br,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:p.jsx(zp,{"aria-label":"Render tag warnings",children:p.jsx(w_,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function X2({state:e,context:t,loadingText:n=wu.running,maxHeight:r,tableMaxHeight:o,firstPaintHeight:a,maxResultSize:i,drill:s,fill:l,compactToFit:d,transform:u}){const{data:m,isSuccess:g,isError:y,error:x,fetchStatus:w,isPlaceholderData:S}=e,b=g||w==="fetching";C.useEffect(()=>{b&&Q2()},[b]);const $=m?.data.result,k=C.useMemo(()=>$!==void 0&&u?u($):$,[$,u]),T=C.useMemo(()=>xle(k),[k]);if(y)return p.jsx(Te,{sx:{p:2},children:p.jsx(ja,{context:t,error:x})});if(!g)return p.jsx(Bo,{text:w==="idle"?wu.loading:n});if(T)return p.jsx(Te,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:T})});const O=p.jsx(A1,{result:k,maxHeight:r,tableMaxHeight:o,...a!==void 0?{firstPaintHeight:a}:{},maxResultSize:i,renderLogs:m.data.renderLogs,drill:s,fill:l,compactToFit:d});return p.jsxs(Te,{"aria-busy":S||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},opacity:S?.55:1,transition:S?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[S&&p.jsx(hz,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),p.jsx(Te,{className:"result-body",children:O})]})}const Pd=()=>typeof performance<"u"?performance.now():Date.now(),y0e=Jt(p.jsx("path",{d:"m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37C20.3 4.95 19.83 4 19 4H6.83l2 2zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),v0e=3;function b0e(e,t){if(e===void 0)return[];const n=new Set(e);return t.flatMap(r=>r.name&&!n.has(r.name)?[r.label??r.name]:[])}function x0e(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function w0e({ignored:e}){const{theme:t}=Vr();if(e.length===0)return null;const n=e.length>v0e?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return p.jsxs(Te,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${x0e(e)}, so changing ${e.length===1?"it":"them"} won't change this tile`,sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",mb:1,alignSelf:"flex-start",px:.75,py:.125,border:1,borderColor:"warning.main",borderRadius:1,fontSize:11,lineHeight:1.6,color:"warning.main",fontFamily:t.font.family},children:[p.jsx(y0e,{sx:{fontSize:12}}),p.jsx(Te,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const S0e=/\.malloy(nb)?$/,D1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(S0e,"")||void 0,C0e=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),S_=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${C0e(n)}`,k0e="edit",$0e=(e,t,n)=>`${S_(e,t,n)}?${k0e}`,Z2=e=>e.layout==="linear"?"linear":"grid",v$=e=>({layout:Z2(e),path:e.path,editable:e.editable!==!1});function R0e(e,t){const n=t.find(r=>r.path===e);return n?.path?v$({...n,path:n.path}):void 0}function T0e(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function E0e(e,t){if(!T0e(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=R0e(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}const M0e=(e,t,n)=>["reports",e,t,n];async function O0e(e,t,n,r){try{return(await e.reports.listReports(t,n,r)).data}catch(o){if(o?.response?.status===404)return[];throw o}}function C_(e,t,n,r=!0){const{apiClients:o}=tr(),a=co({queryKey:M0e(e,t,n),queryFn:()=>O0e(o,e,t,n),enabled:r,staleTime:6e4});return{reports:a.data??[],settled:a.isSuccess||a.isError,isFetching:a.isFetching,isError:a.isError,error:a.error,refetch:a.refetch}}const k_=20,P0e={radius:"8px",padding:`${k_}px`};function TTe(e,t=P0e){return{"--malloy-render--font-family":e.font.family,"--malloy-render--table-font-size":`${e.font.size}px`,"--malloy-render--table-header-color":e.tableHeader,"--malloy-render--table-body-color":e.tableBody,"--malloy-render--table-border":e.border,"--malloy-render--table-pinned-border":e.pinnedBorder,"--malloy-render--tile-background":e.tile,"--publisher-dashboard-root":e.dashboardRoot,"--malloy-render--label-color":e.tileTitle,"--malloy-render--value-color":e.valueColor,"--publisher-drill-link":e.drillLink,"--publisher-dashboard-card-radius":t.radius,"--publisher-dashboard-card-padding":t.padding,"--publisher-dashboard-card-border":e.cardBorder}}const j0e={query:120,text:72};function X0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=Vr(),s=i.ui,l=e||t==="none";return p.jsx(Qa,{ref:o,className:Sl.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:l?"none":i.cardBorder,borderRadius:l?0:s.radius.tile,background:l?"none":i.tile,overflow:"hidden",isolation:"isolate",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:j0e[n],p:t==="none"?0:e?"12px 0":`${k_}px`},...Array.isArray(r)?r:[r]],children:a})}const A0e=Sl.tileHeading;function $_({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=Vr(),i=a.ui;return p.jsxs(Te,{className:A0e,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[p.jsxs(Te,{sx:{minWidth:0,flex:1},children:[p.jsx(wt,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&p.jsx(wt,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const D0e=-1;function N0e(e){const t=e.ownerDocument;for(let n=e.parentElement;n&&n!==t.body&&n!==t.documentElement;n=n.parentElement)if(/(auto|scroll|overlay)/.test(getComputedStyle(n).overflowY))return n}function I0e(e,t){if((t?t.scrollTop:window.scrollY)<=0)return!1;const n=parseFloat(getComputedStyle(e).top);if(Number.isNaN(n))return!1;const r=t?t.getBoundingClientRect().top+t.clientTop:0;return e.getBoundingClientRect().top-r<=n+.5}function L0e(){const[e,t]=C.useState(!1),n=C.useRef(null);return{stickyRef:C.useCallback(r=>{if(n.current?.(),n.current=null,!r||typeof window>"u")return;const o=N0e(r),a=o??window;let i=0;const s=()=>{i=0,t(I0e(r,o))},l=()=>{i===0&&(i=requestAnimationFrame(s))};a.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),s(),n.current=()=>{a.removeEventListener("scroll",l),window.removeEventListener("resize",l),i!==0&&cancelAnimationFrame(i)}},[]),stuck:e}}const z0e=4,F0e="--publisher-sticky-top",_0e=2;function b$({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return p.jsxs(Yn,{className:Sl.report,"data-layout":e,sx:[{gap:_0e},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function R_({title:e,description:t,actions:n}){const r=Vr().theme.ui;return p.jsxs(Yn,{className:Sl.header,sx:{gap:1.5},children:[p.jsxs(Yn,{direction:"row",sx:{alignItems:"center",gap:2},children:[p.jsx(wt,{component:"h1",className:Sl.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&p.jsx(Te,{sx:{my:"-4px"},children:n})]}),t]})}function N1({sx:e,children:t}){return p.jsx(X0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function T_({children:e}){const{theme:t}=Vr(),{stickyRef:n,stuck:r}=L0e();return p.jsx(Te,{ref:n,className:Sl.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`calc(var(${F0e}, 0px) + ${D0e}px)`,zIndex:z0e,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Zd(t.cardBorder)}`:"none",transition:`box-shadow ${Zy}`,...Jy},children:e})}const Xr=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const a=r[o];a==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:a==="packages"?n.packageName=decodeURI(r[o+1])||void 0:a==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:a==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},I1=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${encodeURIComponent(e.versionId)}`),t};function J2(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const B0e=e=>J2(e,"MalloyTranslator"),U0e=e=>J2(e,"parseAnnotation"),q0e=e=>J2(e,"ASTQuery");async function ETe(){return B0e(await wo(()=>import("./index-diN_kmcj.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function MTe(){return U0e(await wo(()=>Promise.resolve().then(()=>Rae),void 0))}async function H0e(){return q0e(await wo(()=>import("./index-dUom3Bdm.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function V0e(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function E_(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function W0e({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const a=e?"host":t?"package":"browser",i=n!==void 0&&a==="package";return{savesTo:a,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function OTe(e,t){return e??(t===void 0?void 0:await V0e(t))}function PTe({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:a}){return o!==void 0?`The saved copy could not be read, so Save is off: ${o}`:e&&r?r.writeable?r.description:`${r.description}: you cannot save into it.`:n?`Reading version ${a}: a version is a fixed point in history, so Save is off.`:t?"Save writes the file into the package.":r?`${r.description}: this server does not take writes.`:"This server does not take writes."}function jTe(e){return e instanceof Error?e.message:String(e)}function Y0e(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function ATe({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:l,afterWrite:d}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:a,expectedHash:i})}catch(g){for(const y of s)t.invalidateQueries({queryKey:y});throw new Error(Y0e(g))}const m=u.data.contentHash;await d?.(m);for(const{queryKey:g,refetchType:y,wait:x}of l){const w=t.invalidateQueries({queryKey:g,...y?{refetchType:y}:{}});x&&await w}return m}function DTe(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function NTe(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=Xr(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class M_ extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const O_=e=>e instanceof M_||e instanceof Error&&e.name==="DocumentNotFoundError",G0e=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function P_(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(G0e,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const og=e=>Wy(e)?e:`\`${e}\``;function eT(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=P_("title",t);if(a)return a;if(t.includes("|##"))return"A title cannot contain `|##`, which closes the report's artifact tag.";if(/["\\\r\n]/.test(n)||n.trim()==="")return`The model path ${JSON.stringify(n)} cannot be written as an import.`;for(const[i,s]of[["source",r],["view",o]])if(s.trim()===""||/[`\r\n\\]/.test(s))return`The ${i} name ${JSON.stringify(s)} cannot be written as a Malloy name.`}const K0e=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},UN=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Q0e="report.malloy";function tT(e,t,n=Q0e){const r=eT(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),l=UN(s),d=og(`${a}_tiles`),u=og(`${i}_tile`),m=`"${d} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${l}`," tiles=[",` ${m}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${og(a)} } from "${wF(o,n)}"`,"",`source: ${d} is ${og(a)} extend {`,` # label=${UN(K0e(i))}`,` view: ${u} is ${og(i)}`,"}",""].join(`
473
- `)}function ITe(e,t){return tT(e,"linear",t)}function X0e(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function Z0e({title:e,modelPath:t,source:n,view:r}){for(const[o,a]of[["source",n],["view",r]])if(!Wy(a))return`The ${o} name ${JSON.stringify(a)} cannot be written as a Malloy name.`;return/["\\\r\n]/.test(t)?`The model path ${JSON.stringify(t)} cannot be written into an import.`:P_("title",e)}function LTe(e,t){const n=Z0e(e);if(n)throw new Error(n);return tT(e,"grid",t)}const j_=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function J0e(e,t){const n=j_(t);return`${n===""?"":`${n}/`}${e}.malloy`}function exe(e){return X0e(e)||"untitled"}function A_(e,t=1,n){const r=exe(e);return J0e(t>1?`${r}-${t}`:r,n)}const wy=(e,t,n)=>`${e}/${t}/${n}`,txe=(e,t,n,r,o)=>({workspace:t,type:e,path:wy(n,r,o)}),nT=20;function nxe(e){const{savesTo:t,writer:n}=W0e({...e,readFailed:!1});return t==="browser"?void 0:n}const qN=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function D_(e){if(!e.endsWith(".malloy"))return"A report's file name ends in .malloy.";const t=e.split("/");if(t.some(n=>n===""||n==="."||n===".."))return"A location is a path inside the package, such as sales/q3.malloy.";if(t.at(-1)===".malloy")return"A report's file needs a name.";if(t[0].toLowerCase()==="public")return"A report cannot live under public/, which is served as plain files.";if(e.toLowerCase()==="index.malloy")return"The package's index.malloy is its surface, never a report."}async function rxe(e){const t=e.layout??"linear",n=Pd();let r;try{r=await oxe(e,t)}catch(o){throw Kk({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return Kk({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:Pd()-n}),e.onCreated?.(r),r}async function oxe(e,t){const{document:n,target:r}=e,o=eT(n);if(o)throw new Error(o);const a=j_(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:nT},(w,S)=>A_(n.title,S+1,a));for(const w of i){const S=D_(w);if(S)throw new Error(S)}const s=w=>tT(n,t,w);if(r.route==="package"){const w=new Set(r.existing);let S;for(const b of i)if(!w.has(b))try{await r.write(b,s(b)),S=b;break}catch($){if(!axe($))throw $}if(S===void 0)throw HN(n.title,e.path);return{layout:t,path:S,slug:qN(S)}}const{storage:l,workspace:d,environmentName:u,packageName:m}=r,g=new Set(r.existing),y=new Set((await l.listDocuments(d)).map(w=>w.path));let x;for(const w of i){const S=txe(t,d.name,u,m,w),b=await l.resolveDocumentPath?.(S)??w;if(y.has(S.path)||g.has(w)||g.has(b))continue;let $=!0;try{await l.getDocument(S)}catch(k){if(!O_(k))throw k;$=!1}if(!$){x={layout:t,path:b,slug:qN(b),locator:S};break}}if(x===void 0)throw HN(n.title,e.path);return await l.saveDocument(x.locator,s(x.path)),x}const axe=e=>e?.response?.status===409,HN=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${nT} tries. Fix: choose a different title.`);function ixe(e){try{const t=JSON.parse(e??"");return new Set((t.entries??[]).flatMap(n=>n.kind==="source"&&typeof n.name=="string"?[n.name]:[]))}catch{return new Set}}function VN(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function sxe(e){for(const t of e??[]){const n=/^#\s*(?:-[A-Za-z_]+\s+)*([a-z_]+)/.exec(t.trim())?.[1];if(n&&dF.includes(n))return n}}function lxe({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=tr(),s=Bz({queries:r.map(x=>({queryKey:["new-document-model",e,t,n,x,i],queryFn:async()=>(await a.models.getModel(e,t,x,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),l=s.map(x=>x.dataUpdatedAt).join(),d=C.useMemo(()=>{const x=new Map;return s.forEach((w,S)=>{const b=[],$=ixe(w.data?.modelInfo);for(const k of w.data?.sources??[]){if(typeof k.name!="string"||!$.has(k.name))continue;const T=VN(k.annotations);for(const O of k.views??[])if(typeof O.name=="string"){const P=VN(O.annotations),D=sxe(O.annotations);b.push({source:k.name,view:O.name,...P?{description:P}:{},...D?{chart:D}:{},...T?{sourceDescription:T}:{}})}}b.length>0&&x.set(r[S],b)}),x},[l,r]),u=s.some(x=>x.isLoading),m=u?[]:r.filter((x,w)=>s[w]?.isError),g=!u&&s.some(x=>x.isError&&L4(x.error)),y=()=>{s.forEach(x=>{x.isError&&x.refetch()})};return{choices:d,isLoading:u,isSuccess:s.length>0&&s.every(x=>!x.isPending),failed:m,retry:y,canRetry:g}}const N_=C.createContext(void 0);function cxe({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return p.jsx(N_.Provider,{value:n,children:e})}function I_(){return C.useContext(N_)}function uxe(e,{environmentName:t,packageName:n,path:r,versionId:o},a){return{queryKey:["report",t,n,o,r],queryFn:async({signal:i})=>(await e.reports.getReport(t,n,r,o,{signal:i})).data,...a===void 0?{}:{staleTime:a}}}const zTe=1e4,L_=e=>e==="notebook"?"linear":"grid",FTe=(e,t)=>`${e}s/${t}.malloy`;function dxe(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[I1({environmentName:e,packageName:t,modelPath:n})]]]}function fxe(e,t,n,r){for(const o of[["report"],["reports"],...dxe(t,n,r)])e.invalidateQueries({queryKey:o})}function co(e){const{server:t}=tr(),n={...e,queryKey:[...e.queryKey,t],queryFn:async r=>{try{return await e.queryFn(r)}catch(o){if(o&&typeof o=="object"&&"response"in o){const a=o;if(a.response?.data){const i=new Error(a.response.data.message||a.message);throw i.status=a.response.status,i.data=a.response.data,i}}throw o}},retry:!1,throwOnError:!1};return zd(n,JR)}function hl(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const a=new Error(o.response.data.message||o.message);throw a.status=o.response.status,a.data=o.response.data,a}}throw r}},retry:!1,throwOnError:!1};return a0(t,JR)}function pxe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function _Te(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function rT(e,{enabled:t=!0}={}){const{apiClients:n}=tr(),r=pxe(e);return co({queryKey:r,queryFn:({signal:o})=>n.models.executeQueryModel(e.environmentName,e.packageName,e.modelPath,{queryName:e.queryName,query:e.query,sourceName:e.sourceName,givens:e.givens,versionId:e.versionId},void 0,{signal:o}),enabled:t,placeholderData:(o,a)=>a&&mxe(a.queryKey,r)?o:void 0,...Ire})}const hxe=8;function mxe(e,t){return e.every((n,r)=>r===hxe||r>=t.length||n===t[r])}const gxe=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function z_(e){let t=!1;for(const[n,r]of Array.from(e.entries())){if(r.deleted)continue;if(n==="image"||n==="link"){e.delete(n),t=!0;continue}if(n==="label"){let a;try{a=e.text("label")}catch{a=void 0}if(a!==void 0&&gxe.test(a)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const a of[r,...o])z_(a)&&(t=!0)}return t}function yxe(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=e1.parseAnnotation(t)}catch{return""}return n.log.length>0?"":z_(n.tag)?`${n.tag.toString()}
474
- `:e}function x$(e){if(Array.isArray(e)){for(const n of e)x$(n);return}if(e===null||typeof e!="object")return;const t=e;for(const[n,r]of Object.entries(t))if(n==="annotations"&&Array.isArray(r))for(const o of r){const a=o;typeof a?.value=="string"&&(a.value=yxe(a.value))}else x$(r)}function F_(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);x$(t);const r=JSON.stringify(t);return r===n?e:r}const vxe=new Set(["bar_chart","line_chart","scatter_chart","combo_chart","shape_map","segment_map","point_map","big_value","sparkline","list","list_detail","dashboard","transpose","table","json","image","link","text"]),bxe={value:`# big_value
475
- `};function xxe(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(r=>Gk(r)))return!1;const n=e.data;return n?n.kind==="record_cell"?!0:n.kind==="array_cell"&&Array.isArray(n.array_value)&&n.array_value.length===1:!1}function wxe(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=p1(n.slice(1));for(const o of r.split(/[\s{}=.,[\]]+/))if(vxe.has(o))return!0}return!1}function __(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!xxe(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return wxe(r)?e:JSON.stringify({...t,annotations:[bxe,...n]})}const Sxe=e=>F_(__(e));function WN(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?DF(t):e}function B_({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,annotation:i,label:s,subtitle:l,heading:d,borderless:u,givens:m,hostGivens:g,declaredTypes:y,givenNames:x,height:w,tableMaxHeight:S,fixedHeight:b,maxResultSize:$,drill:k,onExplore:T,chrome:O="card",ignoredFilters:P,preamble:D,restricted:A,waitingFor:F,index:L}){const{theme:_}=Vr(),[R,z]=Gle(),N=rT({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?v1(D??"",`${i?`${i}
476
- `:""}run: ${a}`):void 0,givens:y2(Jd(m,y,x),g,x)},{enabled:z&&A!==!0&&F===void 0}),{emit:B}=g1(),I=N.isError?N.error:void 0;C.useEffect(()=>{I!==void 0&&B({type:"report.query_failed",...L!==void 0?{tile:L}:{},category:U0(I)})},[I,B,L]);const H=A===!0||D!==void 0&&N.isError&&Mce(N.error);return p.jsxs(X0,{cardRef:R,borderless:u,chrome:O,sx:{"& .malloy-render, & .malloy-table":{width:"100%"},"& .publisher-tile-explore":{opacity:0,transition:`opacity ${Zy}`,...Jy,...fle},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&p.jsx($_,{title:d?.title??s??WN(a),subtitle:d?d.subtitle:l,quiet:O==="none",tooltip:a,action:T&&p.jsx(Br,{title:"Explore from here",children:p.jsx(ro,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??WN(a)}`,onClick:T,sx:{mt:-.5,mr:-.5,color:_.tileTitle},children:p.jsx(Vle,{fontSize:"small"})})})}),P&&p.jsx(w0e,{ignored:P}),F!==void 0?p.jsx(Te,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:F})}):H?p.jsx(Te,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:Ece})}):p.jsx(X2,{fill:!0,state:N,context:a??o??r,maxHeight:w,tableMaxHeight:S,compactToFit:b,firstPaintHeight:yF,maxResultSize:$,drill:k,transform:D!==void 0?a!==void 0?Sxe:F_:a!==void 0?__:void 0})]})}function BTe(e,{enabled:t=!0}={}){const{apiClients:n}=tr();return co({queryKey:["compiled-document",e.environmentName,e.packageName,e.modelPath,e.source,e.givens??null],queryFn:async()=>{const r=(await n.models.compileModelSource(e.environmentName,e.packageName,e.modelPath,{source:e.source,scope:"append",...e.givens&&Object.keys(e.givens).length>0?{givens:e.givens}:{}})).data;return{document:r.document,result:r}},enabled:t})}Jt(p.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));const U_="(max-width:599.95px)";function Cxe(){return oee(U_,{noSsr:!0})}function kxe(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(U_).matches}function UTe({children:e}){const[t]=C.useState(kxe),[n,r]=C.useState(!1);return!t||n?p.jsx(p.Fragment,{children:e}):p.jsxs(Yn,{sx:{alignItems:"flex-start",gap:1.5,py:3},children:[p.jsx(wt,{variant:"h6",children:"Editing works best on a larger screen"}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"The editor is built for a wider window. You can still try it here."}),p.jsx(Vn,{variant:"outlined",onClick:()=>r(!0),children:"Edit anyway"})]})}function qTe(){const e=Ay();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function q_(e,t){return e.flatMap(({filter:n})=>{if(n.kind!=="literal_equality"||n.expression.kind!=="field_reference")return[];const r=$xe(n.value,t);return r===void 0?[]:[{field:n.expression.name,label:r,expression:n.expression}]})}function H_(e,t){switch(e.kind){case"string_literal":return`'${p2(e.string_value)}'`;case"number_literal":return e.string_value!==void 0?/^-?\d+(\.\d+)?$/.test(e.string_value)?e.string_value:void 0:Number.isFinite(e.number_value)?String(e.number_value):void 0;case"boolean_literal":return String(e.boolean_value);case"date_literal":{const n=V_(e.date_value);return n&&`@${n[0]}-${n[1]}-${n[2]}`}case"timestamp_literal":{const n=Y_(e.timestamp_value,t);return n&&`@${n[0]}-${n[1]}-${n[2]} ${n[3]}:${n[4]}:${n[5]}${W_(e.timestamp_value)}`}default:return}}function $xe(e,t){switch(e.kind){case"string_literal":return e.string_value;case"null_literal":return"null";case"date_literal":{const n=V_(e.date_value);return n&&YN([...n,"00","00","00"],e.granularity??"day")}case"timestamp_literal":{const n=Y_(e.timestamp_value,t);return n&&YN(n,e.granularity??"second")+(e.granularity===void 0?W_(e.timestamp_value):"")}default:return H_(e)}}function V_(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?[t[1],t[2],t[3]]:void 0}function W_(e){const t=/:\d{2}\.(\d+)/.exec(e)?.[1]?.replace(/0+$/,"");return t?`.${t}`:""}function Y_(e,t){const n=new Date(e);if(Number.isNaN(n.getTime()))return;let r;try{r=new Intl.DateTimeFormat("en-US",{timeZone:t??"UTC",hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n)}catch{return}const o=a=>r.find(i=>i.type===a)?.value??"";return[o("year").padStart(4,"0"),o("month"),o("day"),o("hour"),o("minute"),o("second")]}function YN([e,t,n,r,o,a],i){switch(i){case"year":return e;case"quarter":return`${e}-Q${Math.floor((Number(t)-1)/3)+1}`;case"month":return`${e}-${t}`;case"week":case"day":return`${e}-${t}-${n}`;case"hour":return`${e}-${t}-${n} ${r}`;case"minute":return`${e}-${t}-${n} ${r}:${o}`;default:return`${e}-${t}-${n} ${r}:${o}:${a}`}}const Rxe="drill_metadata_corrected",Z0=e=>e,ah=e=>{try{return e?.()}catch{return}},G_=e=>ah(e.isBasic?.bind(e))===!0&&ah(e.wasDimension?.bind(e))===!0,Txe=e=>[e.isString,e.isNumber,e.isBoolean,e.isTime].some(t=>ah(t?.bind(e))===!0);function J0(e){const t=e.metadataTag?.text("drill_expression","code");return t===void 0||t.trim()===""?void 0:t}function K_(e){const t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t}function Q_(e){const t=K_(e),n=(t[t.length-1]??e).metadataTag,r=n?.text("source","name");if(!r||!n?.array||n.array("source","parameters")!==void 0||n.has?.(Rxe)!==!0)return;const o=[];for(const i of[...t].reverse())if(ah(i.isArray?.bind(i))===!0){if(i.metadataTag?.has?.("drillable")!==!0)return;for(const s of i.metadataTag?.array?.("drill_filters")??[]){const l=s.text("code");if(!l)return;o.push(l)}}const a=n?.text("query_name");return{source:r,filters:o,...a&&!a.startsWith("__")?{queryName:a}:{}}}function av(e){const t=new Set;for(const n of K_(e))for(const r of n.fields??[])G_(r)&&t.add(r);return[...t]}function X_(e){const t=new Set(av(e).filter(n=>ah(n.isTime?.bind(n))===!0).map(n=>ah(n.getEffectiveQueryTimezone?.bind(n))));return t.size>1?null:[...t][0]}function GN(e){return!G_(e)||J0(e)===void 0||Q_(e)===void 0||X_(e)===null?!1:av(e).every(t=>J0(t)!==void 0&&t.drillStableExpression!==void 0&&Txe(t))}function Exe(e,t){const n=av(e),r=[],o=new Set;for(const a of t){if(a.kind==="drill")continue;const{filter:i}=a;if(i.kind!=="literal_equality")return;const s=JSON.stringify(i.expression),l=n.find(u=>JSON.stringify(u.drillStableExpression)===s),d=l&&J0(l);if(l===void 0||d===void 0)return;r.push({code:d,value:i.value}),o.add(l)}return n.every(a=>o.has(a))&&r.length>0?r:void 0}const Mxe=360;function w$(e){return e?e.getLabel?.()??e.tag?.text("label")??Z0(e).metadataTag?.text("label")??e.name:""}function Oxe(e,t){const n=e.drillClauses?q_(e.drillClauses,e.timezone):[];if(n.length===0)return`${w$(t)}: ${e.label}`;const r=av(Z0(t));return n.map(o=>{const a=JSON.stringify(o.expression),i=r.find(s=>JSON.stringify(s.drillStableExpression)===a);return`${i?w$(i):o.field}: ${o.label}`}).join(", ")}function Z_({onNavigate:e,onSelf:t,destinationTitle:n,canSelf:r,onRows:o}){const[a,i]=C.useState(null),s=C.useCallback((S,b)=>S.filter($=>$===Gm?t!==void 0&&(r?.(b)??!0):e!==void 0),[e,t,r]),l=C.useCallback((S,b,$)=>{if(b===Gm){t?.(S.given,S.rawValue);return}e?.({path:b,dashboard:b,givens:{[S.given]:S.value}},$)},[e,t]),d=C.useCallback(S=>{if(!o||S.noRows||S.isHeader||!S.field)return;const b=Z0(S.field);if(!GN(b))return;const $=Q_(b);if($===void 0)return;const k=S.drillClauses;let T;if(k!==void 0){const P=Exe(b,k);if(P===void 0)return;T={dimensions:P}}else{const P=J0(b);if(P===void 0||av(b).length!==1||y1(S.value)===void 0||typeof S.value=="number"&&Number.isInteger(S.value)&&!Number.isSafeInteger(S.value))return;T={code:P}}const O=X_(b)??void 0;return{field:S.field.name,rawValue:S.value,label:Zk(S.value),target:$,...T,...S.context===void 0?{}:{context:S.context},...k===void 0?{}:{drillClauses:k},...O===void 0?{}:{timezone:O}}},[o]),u=C.useCallback(S=>{const b=vce(S),$=d(S),k=b?Array.from(new Set(s(b.to,b.given))).sort((P,D)=>+(D===Gm)-+(P===Gm)):[],T=`${w$(S.field)}: ${b?.label??Zk(S.value)}`,O=k.map(P=>({key:`to:${P}`,label:P===Gm?`Filter to ${T}`:`Open ${n?.(P)??DF(P.split("/").pop()??P)} (${T})`,run:()=>{b&&l(b,P,S.event)}}));$&&S.field&&O.push({key:"rows",label:`Show rows (${Oxe($,S.field)})`,run:()=>o?.($)}),O.length!==0&&i({items:O,top:S.event?.clientY??0,left:S.event?.clientX??0})},[l,s,o,d,n]),m=C.useCallback(S=>s(AF(S),NF(S)).length>0,[s]),g=C.useCallback(S=>o!==void 0&&GN(Z0(S)),[o]),y=C.useMemo(()=>({onClick:u,canDrill:S=>m(S)||g(S)}),[u,m,g]),x=C.useCallback((S,b)=>({canDrill:$=>m($)||b&&g($),onClick:$=>u({...$,...S===void 0?{}:{context:S},...b?{}:{noRows:!0}})}),[u,m,g]),w=C.useCallback(()=>i(null),[]);return{drill:y,bindingFor:x,drillMenu:p.jsx(uc,{open:a!==null,onClose:w,anchorReference:"anchorPosition",anchorPosition:{top:a?.top??0,left:a?.left??0},children:(a?.items??[]).map(S=>p.jsx(ea,{title:S.label,"aria-label":S.label,onClick:()=>{w(),S.run()},sx:{maxWidth:Mxe},children:p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label})},S.key))})}}const Pxe=e=>{const t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current};function HTe(){const[e]=nV(),t=Ay(),n=hs(),r=C.useMemo(()=>Object.fromEntries(e.entries()),[e]),o=C.useRef(new Set),a=C.useRef(null),i=C.useCallback(d=>{const u=a.current,m=new URLSearchParams(u?.key===n.key?u.search:n.search);d(m);const g=m.toString();a.current={key:n.key,search:g},t({search:g,hash:n.hash},{replace:!0})},[t,n]),s=C.useCallback((d,u)=>{const m=new Set([...u,...o.current]);o.current=new Set([...o.current,...Object.keys(d),...u]),i(g=>{for(const y of m)Object.prototype.hasOwnProperty.call(d,y)||g.delete(y);for(const[y,x]of Object.entries(d))g.set(y,x)})},[i]),l=C.useCallback((d,u)=>i(m=>{u===void 0?m.delete(d):m.set(d,u)}),[i]);return{params:r,onGivensChange:s,setParam:l}}const jxe=Jt(p.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}));function Eg(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function Mg(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Axe(e){if(e===void 0)return"";switch(e.kind){case"null_cell":return"";case"number_cell":return e.string_value??String(e.number_value);case"boolean_cell":return e.boolean_value?"true":"false";case"date_cell":return e.date_value;case"timestamp_cell":return e.timestamp_value;case"string_cell":return Mg(Eg(e.string_value));case"json_cell":return Mg(Eg(e.json_value));case"sql_native_cell":return Mg(Eg(e.sql_native_value));default:return Mg(Eg(JSON.stringify(e)))}}function J_(e){const t=e.data;return t?.kind!=="array_cell"?[]:t.array_value.flatMap(n=>n.kind==="record_cell"?[n.record_value]:[])}function Dxe(e){const t=e.schema.fields;return`\uFEFF${[t.map(n=>Mg(Eg(n.name))).join(","),...J_(e).map(n=>t.map((r,o)=>Axe(n[o])).join(","))].join(`\r
471
+ `):void 0}function f_({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:a,optionsTruncated:i,optionSearch:s,onOpen:l}){const d=e.label??e.name??"",{theme:u}=Vr(),m=e.type??"string",g=Ibe(e),y=P1(m,e.default),x=y!==void 0?`Default: ${y===""?"(empty)":y}`:void 0,w=g||x?p.jsxs(p.Fragment,{children:[g,g&&x?p.jsx("br",{}):null,x]}):void 0,S=m==="string"||uu(m)==="string",b=!ou(m)||typeof t!="string"||TF(t),$=Q=>p.jsx(Ri,{label:d,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:p.jsxs(p.Fragment,{children:[`Not a ${Q}. Clear it to pick one.`,w?p.jsx("br",{}):null,w]}),slotProps:{input:{endAdornment:p.jsx(p_,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),k=ou(m),T=e.control==="multiselect"&&k,O=ou(m),P=e.control==="select"||e.control==="multiselect",D=P?O?typeof t=="string"?RF(t):[]:typeof t=="string"&&t!==""?[t]:[]:[],[A,F]=C.useState(""),[L,_]=C.useState(null),R=C.useRef(null),z=Abe(P?s:void 0,A);if(P&&S&&b&&!(!T&&D.length>1)){const Q=Z=>{const de=O?m2(Z):void 0;if(Z.length===0||de===""){n(null);return}n(O?de:Z[0])},ee=Ube(z,i,s);return p.jsx(h_.Provider,{value:ee,children:p.jsx(gK,{multiple:T,disableCloseOnSelect:T,onOpen:l,freeSolo:!0,forcePopupIcon:!0,autoSelect:!T,options:z.page?.values??r??[],...z.page?{filterOptions:Z=>Z}:{},onInputChange:(Z,de,le)=>F(le==="input"?de:""),loading:o||z.searching,loadingText:z.searching?"Searching…":"Loading…",noOptionsText:a?"Options unavailable":"No matching values",slots:{paper:Bbe},value:T?D:D[0]??null,onChange:(Z,de)=>Q(de===null?[]:Array.isArray(de)?de:[de]),renderInput:Z=>p.jsx(Ri,{...Z,label:d,size:"small",placeholder:D.length!==0?void 0:t===""?"All":y??"All",error:a,helperText:a?p.jsxs(p.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",w?p.jsx("br",{}):null,w]}):w,slotProps:{input:{...Z.InputProps,endAdornment:p.jsxs(p.Fragment,{children:[o&&p.jsx(ku,{size:16}),Z.InputProps.endAdornment]})},htmlInput:{...Z.inputProps,onBlur:de=>{if(Z.inputProps.onBlur?.(de),!T)return;const le=de.target.value.trim();le!==""&&!D.includes(le)&&Q([...D,le])}}}}),fullWidth:!0})})}const N=ou(m)&&uu(m)==="number",{rangeMin:B,rangeMax:I}=e,H=N&&typeof t=="string"?MF(t):void 0,Y=N&&typeof t=="string"?OF(t):void 0;if((N||m==="number")&&B!==void 0&&I!==void 0&&(!N||t===void 0||t===null||t===""||H!==void 0||Y!==void 0)){const Q=Y??(H!==void 0?[H,I]:void 0),ee=N?Q?.[0]:typeof t=="number"?t:void 0;if(ee===void 0&&t!==void 0&&t!==null&&t!=="")return $("number");const Z=L!==null,de=Z?Array.isArray(L)?L[0]:L:ee??B,le=Array.isArray(L)?[L[0],L[1]]:Q??[B,I],fe=le[1]>=I?`≥ ${le[0]}`:`${le[0]} to ${le[1]}`,he=N&&t===""&&!Z,me=ee!==void 0||he||Z;return p.jsxs(gk,{fullWidth:!0,children:[p.jsxs(Te,{component:"fieldset",sx:se=>({m:0,minWidth:0,border:u.cardBorder,borderRadius:2,px:`${_N}px`,pt:0,pb:.75,minHeight:Nbe,transition:"border-color 120ms ease-in","&:hover":{borderColor:se.palette.text.secondary},"&:focus-within":{borderColor:se.palette.text.primary}}),children:[p.jsx(wt,{component:"legend",variant:"caption",color:"text.secondary",sx:{px:.5,lineHeight:1},children:d}),p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:"fontWeightMedium"},children:me?he?"Any":N?fe:String(de):N?"Any":y??"Unset"}),me&&p.jsx(xy,{onClear:()=>n(null),sx:{p:0}})]}),p.jsx(cJ,{size:"small",min:B,max:I,value:N?le:de,disableSwap:N,valueLabelDisplay:"auto","aria-label":N?void 0:d,getAriaLabel:N?se=>se===0?`${d} from`:`${d} to`:void 0,sx:{py:0,mt:.5},onChange:(se,ve)=>{R.current=ve,_(ve)},onChangeCommitted:()=>{const se=R.current;if(R.current=null,_(null),se!==null){if(N){const[ve,Le]=Array.isArray(se)?[se[0],se[1]]:[se,se];if(ve<=B&&Le>=I){n(null);return}n(Le>=I?pce(ve):hce(ve,Le));return}n(Array.isArray(se)?se[0]:se)}}}),p.jsxs(Yn,{direction:"row",justifyContent:"space-between",children:[p.jsx(wt,{variant:"caption",color:"text.secondary",children:B}),p.jsx(wt,{variant:"caption",color:"text.secondary",children:I})]})]}),w&&p.jsx(yk,{sx:{mx:`${_N}px`},children:w})]})}const ae=ou(m)?uu(m):void 0,K=ae==="date"||ae==="timestamp"||ae==="timestamptz",oe=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),ue=t==null||oe;if(K&&!oe){const Q=Fbe(t);if(Q!==void 0)return p.jsx(_be,{label:d,state:Q,onChange:n,helperNode:w,defaultDisplay:y})}if(K&&ue){const Q=oe?Ar.utc(t):null;return p.jsx(K0,{label:d,committed:Q?.isValid()?Q:null,toValue:ee=>ee.format("YYYY-MM-DD"),onChange:n,helperText:w})}if(uu(m)==="boolean"){const Q=typeof t=="string"?fce(t):void 0;if(t==null||t===""||Q!==void 0)return p.jsx(zbe,{label:d,picked:Q,emptyOverride:t==="",onChange:n,helperNode:w,defaultDisplay:y})}if(m==="boolean"){const Q=typeof t=="boolean";if(!Q&&t!==void 0&&t!==null)return $("true or false");const ee=e.default?.trim()==="true";return p.jsxs(gk,{children:[p.jsxs(Yn,{direction:"row",alignItems:"center",children:[p.jsx(MR,{control:p.jsx(oQ,{checked:Q?t:ee,onChange:Z=>n(Z.target.checked)}),label:d}),Q&&p.jsx(xy,{onClear:()=>n(null),edge:"end"})]}),w&&p.jsx(yk,{children:w})]})}if(m==="number"){const Q=t!=null;return Q&&t!==""&&typeof t!="number"?$("number"):p.jsx(BN,{label:d,type:"number",committed:typeof t=="number"?String(t):"",onCommit:ee=>n(ee===""?null:Number(ee)),placeholder:y,helperText:w,isOverridden:Q,onClear:()=>n(null)})}if(m==="date"||m==="timestamp"||m==="timestamptz"){const Q=t instanceof Date?t:typeof t=="string"?(Z=>Z instanceof Date?Z:null)(FF(m,t)):null,ee=Q?Ar.utc(Q):null;return t!=null&&t!==""&&Q===null?$("date"):p.jsx(K0,{label:d,committed:ee,toValue:Z=>wce(Z,Q??void 0),onChange:n,helperText:w})}const G=typeof t=="string"?t:"",ie=t!=null;return p.jsx(BN,{label:d,committed:G,onCommit:n,placeholder:ie?void 0:y??(m.startsWith("filter<")?m:void 0),helperText:w,isOverridden:ie,emptyOverrides:!0,onClear:()=>n(null)})}function BN({label:e,type:t,committed:n,onCommit:r,placeholder:o,helperText:a,isOverridden:i,emptyOverrides:s=!1,onClear:l}){const{draft:d,change:u,reset:m,bind:g}=d_(n,r,{unset:s&&!i});return p.jsx(Ri,{label:e,type:t,value:d,onChange:y=>u(y.target.value),placeholder:o,helperText:a,slotProps:{input:{endAdornment:i&&p.jsx(p_,{onClear:()=>{m(""),l()}})}},...g,fullWidth:!0,size:"small"})}const Lbe=(e,t)=>e===null||t===null?e===t:e.year()===t.year()&&e.month()===t.month()&&e.date()===t.date();function K0({label:e,committed:t,toValue:n,onChange:r,helperText:o,minDate:a}){const{draft:i,change:s,reset:l,bind:d}=d_(t,u=>{u===null?r(null):u.isValid()&&r(n(u))},{same:Lbe});return p.jsx(a3,{dateAdapter:fue,children:p.jsx(Obe,{label:e,value:i,minDate:a,onChange:s,slotProps:{textField:{fullWidth:!0,size:"small",helperText:o,...d},field:{clearable:!0,onClear:()=>{l(null),r(null)}},clearButton:{onMouseDown:u=>u.preventDefault()}}})})}function xy({onClear:e,edge:t,sx:n}){return p.jsx(ro,{size:"small","aria-label":"Clear value",onClick:e,edge:t,sx:[{minWidth:24,minHeight:24},...Array.isArray(n)?n:[n]],children:p.jsx(Uce,{fontSize:"small"})})}function p_({onClear:e}){return p.jsx(PR,{position:"end",onMouseDown:t=>t.preventDefault(),children:p.jsx(xy,{onClear:e,edge:"end"})})}const zb="__any__";function zbe({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:a}){const i=t??(n?zb:"");return p.jsx(Te,{"data-testid":"boolean-filter",children:p.jsxs(Ri,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:s=>s==="true"||s==="false"?s:s===zb?"Any":a||"Any"},input:{endAdornment:i!==""?p.jsx(xy,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:s=>{s.target.value!==zb&&r(s.target.value)},children:[n&&p.jsx(ea,{value:zb,children:"Any"}),p.jsx(ea,{value:"true",children:"true"}),p.jsx(ea,{value:"false",children:"false"})]})})}function Fbe(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=PF(e);if(t!==void 0)return{kind:"preset",key:t};const n=jF(e);if(n!==void 0)return{kind:"days",...n}}const Fb="__custom__",RC="__any__";function _be({label:e,state:t,onChange:n,helperNode:r,defaultDisplay:o}){const a=t.kind==="days"?`days:${t.firstDay}/${t.lastDay}`:t.kind==="preset"?`preset:${t.key}`:t.kind,[i,s]=C.useState(t.kind==="days"),[l,d]=C.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});C.useEffect(()=>{t.kind==="days"?(s(!0),d({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&s(!1)},[a]);const u=t.kind!=="unset",m=i?Fb:t.kind==="preset"?t.key:t.kind==="any"?RC:"",g=x=>{d(x),x.from&&x.to&&!Ar.utc(x.to).isBefore(Ar.utc(x.from))&&n(yce(x.from,x.to))},y=x=>{const w=x?Ar.utc(x):null;return w?.isValid()?w:null};return p.jsxs(Yn,{direction:"row",spacing:1,"data-testid":"time-range",children:[p.jsxs(Ri,{select:!0,label:e,value:m,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:x=>{if(x===Fb)return"Custom range";if(x===RC)return"Any time";const w=my.find(S=>S.key===x);return w?w.label:o??"Any time"}},input:{endAdornment:u?p.jsx(xy,{onClear:()=>{s(!1),d({}),n(null)},sx:{mr:2}}):void 0}},onChange:x=>{const w=x.target.value;if(w===Fb){s(!0);return}s(!1);const S=mce(w);S!==void 0&&n(S)},children:[t.kind==="any"&&p.jsx(ea,{value:RC,children:"Any time"}),my.map(x=>p.jsx(ea,{value:x.key,children:x.label},x.key)),p.jsx(ea,{value:Fb,children:"Custom range"})]}),i&&p.jsxs(p.Fragment,{children:[p.jsx(K0,{label:"From",committed:y(l.from),toValue:x=>x.format("YYYY-MM-DD"),onChange:x=>g({...l,from:x===null?void 0:String(x)})}),p.jsx(K0,{label:"To",committed:y(l.to),minDate:y(l.from)??void 0,toValue:x=>x.format("YYYY-MM-DD"),onChange:x=>g({...l,to:x===null?void 0:String(x)})})]})]})}const h_=C.createContext(void 0);function Bbe({children:e,...t}){const n=C.useContext(h_);return p.jsxs(Qa,{...t,children:[e,n&&p.jsx(Te,{role:"note",sx:{px:2,py:1,borderTop:1,borderColor:"divider",color:"text.secondary",typography:"caption"},children:n})]})}const _b=e=>e.toLocaleString("en-US");function Ube(e,t,n){if(e.active)return e.searching?"Searching all values…":e.failed?`Could not search all values. Showing matches in the first ${_b(Md)}.`:e.page?.truncated?`Showing the first ${_b(v2)} matches. Keep typing to narrow them.`:void 0;if(t)return n?`Showing the first ${_b(Md)} values. Type to search them all.`:`Showing the first ${_b(Md)} values. A value not listed can still be typed.`}const qbe=C.createContext(void 0),Sh=()=>C.useContext(qbe),Tg="remove-badge",Hbe={[`& .${Tg}`]:{opacity:0},[`&:hover .${Tg}, &:focus-within .${Tg}`]:{opacity:1},"@media (hover: none)":{[`& .${Tg}`]:{opacity:1}}};function Vbe({label:e,onRemove:t,disabledReason:n,inset:r=0}){const{theme:o}=Vr(),a=n!==void 0,i=p.jsx(ro,{className:Tg,"aria-label":e,"aria-disabled":a||void 0,...a?{"aria-description":n}:{},onClick:s=>{s.stopPropagation(),a||t()},onPointerDown:s=>s.stopPropagation(),sx:s=>({position:"absolute",top:-8-r,right:-8-r,zIndex:3,width:18,height:18,p:0,borderRadius:"50%",border:`1px solid ${Zd(o.cardBorder)}`,bgcolor:s.palette.background.paper,color:s.palette.text.secondary,cursor:a?"default":"pointer",transition:`opacity ${Zy}`,...Jy,"&:hover":{bgcolor:s.palette.background.paper,color:a?s.palette.text.secondary:s.palette.text.primary,borderColor:mF(o.cardBorder,o.tileTitle)}}),children:p.jsx(xh,{sx:{fontSize:12}})});return a?p.jsx(Br,{title:n,children:i}):i}const K2=e=>e.required===!0,Wbe=(e,t)=>e==null||e===""&&!zF(t);function Ybe(e,t,n){return e.filter(r=>r.name!==void 0&&K2(r)&&Wbe(t.get(r.name),r.type)&&(n?.[r.name]===void 0||n[r.name]===null))}function Gbe(e,t){if(!t||e.length===0)return[];const n=new Set(t);return e.filter(r=>r.name&&n.has(r.name))}const m_=e=>e.label??e.name??"";function g_(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Kbe(e){const t=e.map(m_);return`Pick a value for ${g_(t)} to see this report.`}function Qbe(e){return`Waiting for ${g_(e.map(m_))}.`}const y$=28,Xbe=/^\d{4}-\d{2}-\d{2}$/,y_=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});function TC(e){if(!Xbe.test(e))return e;const t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:y_.format(t)}function Zbe(e,t){if(e.length===0)return"";const n=e.join(", ");return t?n:n.length<=y$||e.length===1?Q0(n,t):`${Q0(e[0]??"",t)} +${e.length-1}`}function Q0(e,t){return!t&&e.length>y$?`${e.slice(0,y$-1)}…`:e}function Jbe(e,t){if(K2(e))return"Required";const n=e.type??"string",r=P1(n,e.default);if(r!==void 0&&r!=="")return v_(n,r,t);const o=uu(n)??n;return e.control==="select"||e.control==="multiselect"||o==="string"?"All":"Any"}function v_(e,t,n){if(!ou(e))return Q0(TC(t),n);const r=uu(e);if(r==="string"&&TF(t))return Zbe(RF(t),n);if(r==="number"){const o=OF(t);if(o)return`${o[0]}–${o[1]}`;const a=MF(t);if(a!==void 0)return`≥ ${a}`}if(r==="date"||r==="timestamp"||r==="timestamptz"){const o=PF(t);if(o)return my.find(i=>i.key===o)?.label??t;const a=jF(t);if(a)return`${TC(a.firstDay)} – ${TC(a.lastDay)}`}return Q0(t,n)}function b_(e,t,n){return t==null?Jbe(e,n):t instanceof Date?Number.isNaN(t.getTime())?"":y_.format(t):typeof t=="boolean"?t?"Yes":"No":typeof t=="number"?String(t):t===""?"(empty)":v_(e.type??"string",t,n)}function e0e(e,t){return b_(e,t,!1)}function t0e(e,t){return b_(e,t,!0)}function n0e(e){const{given:t,value:n,onChange:r}=e,{theme:o}=Vr(),a=o.ui,i=Sh(),[s,l]=C.useState(null),d=t.name??"",u=t.label??d,m=n!=null,g=e0e(t,n),y=s!==null,x=i?.stateOf(d),w=x?.problem,S=x?.fixed,b=p.jsxs(x_,{name:d,set:m,open:y,problem:w,fixed:S!==void 0,required:!m&&K2(t),children:[p.jsxs(is,{"aria-haspopup":"dialog","aria-expanded":y,"aria-label":`${u}: ${g}`,onClick:$=>{l($.currentTarget),e.onOpen?.()},sx:$=>({height:"100%",borderRadius:a.radius.control,pl:"10px",pr:m?"4px":"8px",gap:"6px",fontFamily:"inherit",fontSize:a.type.control.fontSize,lineHeight:1,minWidth:0,color:$.palette.text.primary}),children:[p.jsx(Te,{component:"span",sx:$=>({color:m?o.accent:$.palette.text.secondary,whiteSpace:"nowrap"}),children:u}),p.jsx(Te,{component:"span",sx:{fontWeight:a.type.control.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g}),!m&&p.jsx(hF,{"aria-hidden":!0,sx:$=>({fontSize:16,color:$.palette.text.secondary,transform:y?"rotate(180deg)":"none"})})]}),m&&p.jsx(ro,{"aria-label":`Clear ${u}`,onClick:()=>r(null),sx:{width:22,height:22,mr:"4px",borderRadius:"4px",color:o.accent},children:p.jsx(xh,{sx:{fontSize:14}})})]});return p.jsxs(p.Fragment,{children:[w?p.jsx(Br,{title:w,children:b}):b,p.jsxs(DR,{className:Sl.filterPopover,open:y,anchorEl:s,onClose:()=>l(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":`${u} filter`,sx:{mt:.75,p:1.5,width:300,maxWidth:"calc(100vw - 32px)",boxSizing:"border-box",borderRadius:a.radius.tile,border:o.cardBorder,boxShadow:o.shadow.lift}}},children:[p.jsx(f_,{...e}),i&&p.jsxs(Te,{sx:$=>({mt:1.5,pt:1,borderTop:`1px solid ${$.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:.5}),children:[w&&p.jsx(wt,{sx:{...a.type.caption,color:"warning.main"},children:w}),S!==void 0&&p.jsx(wt,{sx:$=>({...a.type.caption,color:$.palette.text.secondary}),children:S}),p.jsx(a0e,{name:d,type:t.type,text:r0e(n,t.type)}),S===void 0?p.jsx(Vn,{size:"small","aria-label":`Edit filter ${d}`,"aria-haspopup":"dialog",onClick:()=>{l(null),i.onEdit(d)},sx:{px:.75,minWidth:0,...a.type.control},children:"Filter settings…"}):x?.openModel&&p.jsx(Vn,{size:"small",onClick:()=>{l(null),x.openModel?.()},sx:{px:.75,minWidth:0,...a.type.control},children:"Open the model"})]})]})]})}function r0e(e,t){if(e!=null)return IF(e,t)}function o0e(e,t){return e===void 0||!t?.startsWith("filter<")?e:/^f(['"])([\s\S]*)\1$/.exec(e)?.[2]??e}function a0e({name:e,type:t,text:n}){const r=Sh(),o=Vr().theme.ui;if(!r?.setStartingValue)return null;const a=r.setStartingValue,i=o0e(r.startingValueOf?.(e),t),s=r.stateOf(e)?.origin==="dashboard",l={px:.75,minWidth:0,...o.type.control};return p.jsxs(p.Fragment,{children:[i!==void 0&&i===n&&p.jsxs(wt,{sx:d=>({...o.type.caption,color:d.palette.text.secondary,px:.75,display:"flex",alignItems:"center",gap:.5}),children:[p.jsx(pF,{"aria-hidden":!0,sx:{fontSize:14}}),"Report default"]}),n!==void 0&&n!==i&&p.jsx(Vn,{size:"small",onClick:()=>a(e,n),sx:l,children:"Make this the report's default"}),i!==void 0&&p.jsx(Vn,{size:"small",onClick:()=>a(e,void 0),sx:l,children:s?"Use the filter's default":"Use the model's default"})]})}function x_({name:e,set:t=!1,open:n=!1,unused:r=!1,problem:o,fixed:a=!1,required:i=!1,children:s}){const{theme:l}=Vr(),d=l.ui,u=Sh();return p.jsxs(Te,{className:Sl.filter,"data-filter":e,"data-set":t||void 0,"data-problem":o?!0:void 0,"data-required":i||void 0,sx:m=>({position:"relative",display:"inline-flex",alignItems:"center",height:d.size.control,boxSizing:"border-box",borderRadius:d.radius.control,border:"1px solid",borderStyle:r?"dashed":"solid",borderColor:o||i?m.palette.warning.main:t?`color-mix(in srgb, ${l.accent} 45%, transparent)`:n?l.accent:Zd(l.cardBorder),bgcolor:t?`color-mix(in srgb, ${l.accent} 8%, ${m.palette.background.paper})`:m.palette.background.paper,opacity:r?.75:1,transition:`border-color ${Zy}`,...Jy,"&:hover":{borderColor:t||n||o?void 0:mF(l.cardBorder,l.tileTitle)},maxWidth:"100%",...Hbe}),children:[s,u&&!a&&p.jsx(Vbe,{label:`Remove filter ${e}`,onRemove:()=>u.onRemove(e)})]})}function i0e({name:e,label:t,unused:n=!0}){const r=Sh(),o=Vr().theme.ui;if(!r)return null;const a=r.stateOf(e)?.problem,i=p.jsx(x_,{name:e,unused:n,problem:a,children:p.jsxs(is,{"aria-label":`Edit filter ${e}`,"aria-haspopup":"dialog",onClick:()=>r.onEdit(e),sx:s=>({height:"100%",borderRadius:o.radius.control,px:"10px",gap:"6px",fontFamily:"inherit",fontSize:o.type.control.fontSize,lineHeight:1,color:s.palette.text.secondary,whiteSpace:"nowrap"}),children:[p.jsx("span",{children:t}),n&&p.jsx(Te,{component:"span",sx:{fontStyle:"italic"},children:"Unused"})]})});return a?p.jsx(Br,{title:a,children:i}):i}function s0e(){const{theme:e}=Vr(),t=e.ui,n=Sh();if(!n)return null;const r=n.addDisabledReason!==void 0;return p.jsx(Br,{title:n.addDisabledReason??"",children:p.jsx("span",{children:p.jsx(Vn,{variant:"outlined",startIcon:p.jsx(f1,{}),"aria-label":"Add filter","aria-haspopup":"dialog",disabled:r,onClick:()=>n.onAdd(),sx:o=>({height:t.size.control,minHeight:t.size.control,px:1.25,borderRadius:t.radius.control,borderStyle:"dashed",borderColor:Zd(e.cardBorder),color:o.palette.text.secondary,boxShadow:"none",...t.type.control,"& .MuiButton-startIcon":{mr:.5},"& .MuiButton-startIcon svg":{fontSize:16}}),children:"Filter"})})})}function j1({givens:e,values:t,onChange:n,onReset:r,canReset:o,layout:a="panel",options:i,optionsLoading:s,optionsFailed:l,optionsTruncated:d,optionSearch:u,apply:m,title:g,onControlOpen:y}){const x=Sh();if(e.length===0&&!(x&&a==="bar"))return null;const w=Array.from(t.values()).some(T=>T!==null),S=o??w,b=T=>{if(T===void 0)return{};const O=u?.get(T);return{...d?.has(T)?{optionsTruncated:!0}:{},...O?{optionSearch:O}:{},...y?{onOpen:()=>y(T)}:{}}},$=e.map(T=>p.jsx(Te,{children:p.jsx(f_,{given:T,value:T.name?t.get(T.name):void 0,onChange:O=>T.name&&n(T.name,O),options:T.name?i?.get(T.name):void 0,optionsLoading:s,optionsFailed:T.name?l?.has(T.name):void 0,...b(T.name)})},T.name)),k=p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,children:[m&&p.jsx(Vn,{variant:"contained",size:"small",disableElevation:!0,onClick:()=>m.pending&&m.onApply(),"aria-disabled":!m.pending,sx:{"&[aria-disabled='true']":{cursor:"default",color:"action.disabled",backgroundColor:"action.disabledBackground","&:hover":{backgroundColor:"action.disabledBackground"}}},children:"Apply"}),S&&p.jsx(Vn,{variant:"text",size:"small",onClick:r,children:"Reset"})]});return a==="bar"?p.jsxs(Yn,{direction:"row",role:"group","aria-label":g??"Filters",useFlexGap:!0,sx:{flexWrap:"wrap",alignItems:"center",gap:1},children:[e.map(T=>p.jsx(n0e,{given:T,value:T.name?t.get(T.name):void 0,onChange:O=>T.name&&n(T.name,O),options:T.name?i?.get(T.name):void 0,optionsLoading:s,optionsFailed:T.name?l?.has(T.name):void 0,...b(T.name)},T.name)),x?.unrendered.map(T=>p.jsx(i0e,{name:T.name,label:T.label},T.name)),p.jsx(s0e,{}),p.jsx(Te,{sx:{ml:"auto"},children:k})]}):p.jsxs(Qa,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[p.jsxs(Yn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[p.jsx(wt,{variant:"subtitle2",sx:{fontWeight:"fontWeightMedium",color:"text.primary"},children:g??"Filters"}),k]}),p.jsx(Te,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:$})]})}const l0e=/^(https?|mailto|tel):/i,c0e=/^[a-z][a-z0-9+.-]*:/i;function u0e({href:e,title:t,children:n,context:r}){const o=!!e&&c0e.test(e),a=!!e&&!o&&!e.startsWith("/")&&!e.startsWith("#");if(!e||!a||!r){const m=o&&!l0e.test(e??"");return p.jsx("a",{href:m?void 0:e,title:t,...o?{target:"_blank",rel:"noopener noreferrer"}:{},children:n})}const i=r.sourcePath&&r.sourcePath.includes("/")?r.sourcePath.slice(0,r.sourcePath.lastIndexOf("/")+1):"",s=new URL(e,`https://malloy.invalid/${i}`),l=s.pathname.slice(1)+s.search+s.hash,d=`/${r.environmentName}/${r.packageName}/${l}`,{onNavigate:u}=r;return p.jsx("a",{href:d,title:t,onClick:u?m=>{m.preventDefault(),u(d,m)}:void 0,children:n})}const d0e=e=>({document:{"& > :first-child, & > div:only-child > :first-child":{mt:0},"& > :last-child, & > div:only-child > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"fontWeightMedium",color:"text.primary",mb:1,mt:2},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p, & ul, & ol":{color:"text.primary",...e.type.prose,mb:1,maxWidth:ple},"& li":{mb:.5}},caption:{color:"text.secondary",typography:"body2","& > :first-of-type":{mt:0},"& > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontSize:"inherit",fontWeight:"fontWeightMedium",m:"0.5em 0 0.25em"},"& p":{m:"0.5em 0"},"& ul, & ol":{m:"0.5em 0",pl:3},"& code":{fontFamily:e.font.mono,fontSize:"0.9em"}}});function f0e({alt:e}){return p.jsx(p.Fragment,{children:e})}function oh({children:e,variant:t="caption",links:n,sx:r}){const{theme:o}=Vr();return p.jsx(Te,{sx:[d0e(o.ui)[t],{fontFamily:o.font.family},...Array.isArray(r)?r:[r]],children:p.jsx(Zoe,{options:{forceBlock:t==="document",disableParsingRawHTML:!0,overrides:{a:{component:u0e,props:{context:n}},img:{component:f0e}}},children:e})})}const wu={opening:e=>e?`Opening the ${e}…`:"Opening…",running:"Running…",loading:"Loading…"};function Bo({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[p.jsx(ku,{size:t,color:n,thickness:r}),e&&p.jsx(wt,{variant:i,color:"text.secondary",children:e})]});return o?p.jsx(Te,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}let rg;function p0e(){return rg||(rg=wo(()=>import("./index-Co7C9Gew.js"),[]),rg.catch(()=>{rg=void 0})),rg}function Q2(){typeof window>"u"||p0e().catch(()=>{})}const w_=Jt(p.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function zp({sx:e,...t}){const{theme:n}=Vr();return p.jsx(ro,{size:"small",...t,sx:[{width:32,height:32,bgcolor:n.tile,border:n.border,color:n.tileTitle,"&:hover":{bgcolor:n.tile,color:n.drillLink},"& .MuiSvgIcon-root":{fontSize:18}},...Array.isArray(e)?e:[e]]})}const h0e=new Set(["warn","error"]);function m0e(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!h0e.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
472
+ `)}}const g0e=C.lazy(()=>wo(()=>import("./RenderedResult-D5HJr2Xo.es-CFweT1ny.js"),[]).then(e=>e.c));function A1({result:e,maxHeight:t,tableMaxHeight:n,firstPaintHeight:r,maxResultSize:o=0,renderLogs:a,drill:i,fill:s=!1,compactToFit:l=!1}){const d=C.useRef(null);C.useEffect(()=>Q2(),[]);const[u,m]=C.useState(void 0),[g,y]=C.useState(void 0),[x,w]=C.useState(void 0),S=C.useCallback((B,I)=>{m(B),w(I)},[]),[b,$]=C.useState(!1),[k,T]=C.useState(void 0),O=m0e(a);C.useEffect(()=>{const B=d.current;if(!s||!B)return;const I=new ResizeObserver(([H])=>{T(Math.round(H.contentRect.height)),F(Math.round(H.contentRect.width))});return I.observe(B),()=>I.disconnect()},[s,!!e,b]);const[P,D]=C.useState(void 0),[A,F]=C.useState(void 0),L=s&&l&&u==="content";if(C.useEffect(()=>{D(void 0)},[e,A,L]),C.useEffect(()=>{L&&(k===void 0||g===void 0||(P===void 0&&g>k+1?D(g):P!==void 0&&k>=P&&D(void 0)))},[L,k,g,P]),!e)return null;if(o>0&&e.length>o&&!b)return p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[p.jsx(gae,{sx:{fontSize:48,color:"#757575"}}),p.jsx(wt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),p.jsx(Vn,{variant:"contained",color:"primary",onClick:()=>$(!0),children:"Proceed"})]});const _=p.jsx(Bo,{text:wu.loading,centered:!0,size:32}),R=Dle({renderAs:x,maxHeight:t,tableMaxHeight:n}),z=MD({sizing:u,contentHeight:g,maxHeight:R,fillHeight:s?k:void 0,firstPaintHeight:r}),N=p.jsx(C.Suspense,{fallback:_,children:p.jsx(g0e,{result:e,height:z,onSizeChange:y,onSizing:S,drill:i,fill:s})});return p.jsxs(Te,{ref:d,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflowX:"hidden",overflowY:s?"hidden":"auto",...s&&{flex:`1 1 ${MD({sizing:u,contentHeight:g,maxHeight:R,firstPaintHeight:r})}px`,minHeight:0}},children:[s?p.jsx(Te,{className:Ble,...L&&P!==void 0?{[_le]:""}:{},sx:{position:"absolute",inset:0,overflowX:"hidden",overflowY:"auto"},children:N}):N,O&&p.jsx(Te,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:p.jsx(Br,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:p.jsx(zp,{"aria-label":"Render tag warnings",children:p.jsx(w_,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function X2({state:e,context:t,loadingText:n=wu.running,maxHeight:r,tableMaxHeight:o,firstPaintHeight:a,maxResultSize:i,drill:s,fill:l,compactToFit:d,transform:u}){const{data:m,isSuccess:g,isError:y,error:x,fetchStatus:w,isPlaceholderData:S}=e,b=g||w==="fetching";C.useEffect(()=>{b&&Q2()},[b]);const $=m?.data.result,k=C.useMemo(()=>$!==void 0&&u?u($):$,[$,u]),T=C.useMemo(()=>xle(k),[k]);if(y)return p.jsx(Te,{sx:{p:2},children:p.jsx(ja,{context:t,error:x})});if(!g)return p.jsx(Bo,{text:w==="idle"?wu.loading:n});if(T)return p.jsx(Te,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:T})});const O=p.jsx(A1,{result:k,maxHeight:r,tableMaxHeight:o,...a!==void 0?{firstPaintHeight:a}:{},maxResultSize:i,renderLogs:m.data.renderLogs,drill:s,fill:l,compactToFit:d});return p.jsxs(Te,{"aria-busy":S||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},opacity:S?.55:1,transition:S?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[S&&p.jsx(hz,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),p.jsx(Te,{className:"result-body",children:O})]})}const Pd=()=>typeof performance<"u"?performance.now():Date.now(),y0e=Jt(p.jsx("path",{d:"m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37C20.3 4.95 19.83 4 19 4H6.83l2 2zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),v0e=3;function b0e(e,t){if(e===void 0)return[];const n=new Set(e);return t.flatMap(r=>r.name&&!n.has(r.name)?[r.label??r.name]:[])}function x0e(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function w0e({ignored:e}){const{theme:t}=Vr();if(e.length===0)return null;const n=e.length>v0e?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return p.jsxs(Te,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${x0e(e)}, so changing ${e.length===1?"it":"them"} won't change this tile`,sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",mb:1,alignSelf:"flex-start",px:.75,py:.125,border:1,borderColor:"warning.main",borderRadius:1,fontSize:11,lineHeight:1.6,color:"warning.main",fontFamily:t.font.family},children:[p.jsx(y0e,{sx:{fontSize:12}}),p.jsx(Te,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const S0e=/\.malloy(nb)?$/,D1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(S0e,"")||void 0,C0e=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),S_=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${C0e(n)}`,k0e="edit",$0e=(e,t,n)=>`${S_(e,t,n)}?${k0e}`,Z2=e=>e.layout==="linear"?"linear":"grid",v$=e=>({layout:Z2(e),path:e.path,editable:e.editable!==!1});function R0e(e,t){const n=t.find(r=>r.path===e);return n?.path?v$({...n,path:n.path}):void 0}function T0e(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function E0e(e,t){if(!T0e(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=R0e(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}const M0e=(e,t,n)=>["reports",e,t,n];async function O0e(e,t,n,r){try{return(await e.reports.listReports(t,n,r)).data}catch(o){if(o?.response?.status===404)return[];throw o}}function C_(e,t,n,r=!0){const{apiClients:o}=tr(),a=co({queryKey:M0e(e,t,n),queryFn:()=>O0e(o,e,t,n),enabled:r,staleTime:6e4});return{reports:a.data??[],settled:a.isSuccess||a.isError,isFetching:a.isFetching,isError:a.isError,error:a.error,refetch:a.refetch}}const k_=20,P0e={radius:"8px",padding:`${k_}px`};function MTe(e,t=P0e){return{"--malloy-render--font-family":e.font.family,"--malloy-render--table-font-size":`${e.font.size}px`,"--malloy-render--table-header-color":e.tableHeader,"--malloy-render--table-body-color":e.tableBody,"--malloy-render--table-border":e.border,"--malloy-render--table-pinned-border":e.pinnedBorder,"--malloy-render--tile-background":e.tile,"--publisher-dashboard-root":e.dashboardRoot,"--malloy-render--label-color":e.tileTitle,"--malloy-render--value-color":e.valueColor,"--publisher-drill-link":e.drillLink,"--publisher-dashboard-card-radius":t.radius,"--publisher-dashboard-card-padding":t.padding,"--publisher-dashboard-card-border":e.cardBorder}}const j0e={query:120,text:72};function X0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=Vr(),s=i.ui,l=e||t==="none";return p.jsx(Qa,{ref:o,className:Sl.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:l?"none":i.cardBorder,borderRadius:l?0:s.radius.tile,background:l?"none":i.tile,overflow:"hidden",isolation:"isolate",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:j0e[n],p:t==="none"?0:e?"12px 0":`${k_}px`},...Array.isArray(r)?r:[r]],children:a})}const A0e=Sl.tileHeading;function $_({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=Vr(),i=a.ui;return p.jsxs(Te,{className:A0e,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[p.jsxs(Te,{sx:{minWidth:0,flex:1},children:[p.jsx(wt,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&p.jsx(wt,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const D0e=-1;function N0e(e){const t=e.ownerDocument;for(let n=e.parentElement;n&&n!==t.body&&n!==t.documentElement;n=n.parentElement)if(/(auto|scroll|overlay)/.test(getComputedStyle(n).overflowY))return n}function I0e(e,t){if((t?t.scrollTop:window.scrollY)<=0)return!1;const n=parseFloat(getComputedStyle(e).top);if(Number.isNaN(n))return!1;const r=t?t.getBoundingClientRect().top+t.clientTop:0;return e.getBoundingClientRect().top-r<=n+.5}function L0e(){const[e,t]=C.useState(!1),n=C.useRef(null);return{stickyRef:C.useCallback(r=>{if(n.current?.(),n.current=null,!r||typeof window>"u")return;const o=N0e(r),a=o??window;let i=0;const s=()=>{i=0,t(I0e(r,o))},l=()=>{i===0&&(i=requestAnimationFrame(s))};a.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),s(),n.current=()=>{a.removeEventListener("scroll",l),window.removeEventListener("resize",l),i!==0&&cancelAnimationFrame(i)}},[]),stuck:e}}const z0e=4,F0e="--publisher-sticky-top",_0e=2;function b$({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return p.jsxs(Yn,{className:Sl.report,"data-layout":e,sx:[{gap:_0e},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function R_({title:e,description:t,actions:n}){const r=Vr().theme.ui;return p.jsxs(Yn,{className:Sl.header,sx:{gap:1.5},children:[p.jsxs(Yn,{direction:"row",sx:{alignItems:"center",gap:2},children:[p.jsx(wt,{component:"h1",className:Sl.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&p.jsx(Te,{sx:{my:"-4px"},children:n})]}),t]})}function N1({sx:e,children:t}){return p.jsx(X0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function T_({children:e}){const{theme:t}=Vr(),{stickyRef:n,stuck:r}=L0e();return p.jsx(Te,{ref:n,className:Sl.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`calc(var(${F0e}, 0px) + ${D0e}px)`,zIndex:z0e,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Zd(t.cardBorder)}`:"none",transition:`box-shadow ${Zy}`,...Jy},children:e})}const Xr=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const a=r[o];a==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:a==="packages"?n.packageName=decodeURI(r[o+1])||void 0:a==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:a==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},I1=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${encodeURIComponent(e.versionId)}`),t};function J2(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const B0e=e=>J2(e,"MalloyTranslator"),U0e=e=>J2(e,"parseAnnotation"),q0e=e=>J2(e,"ASTQuery");async function OTe(){return B0e(await wo(()=>import("./index-BiZnC_i6.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function PTe(){return U0e(await wo(()=>Promise.resolve().then(()=>Rae),void 0))}async function H0e(){return q0e(await wo(()=>import("./index-C2rpVa58.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function V0e(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function E_(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function W0e({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const a=e?"host":t?"package":"browser",i=n!==void 0&&a==="package";return{savesTo:a,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function jTe(e,t){return e??(t===void 0?void 0:await V0e(t))}function ATe({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:a}){return o!==void 0?`The saved copy could not be read, so Save is off: ${o}`:e&&r?r.writeable?r.description:`${r.description}: you cannot save into it.`:n?`Reading version ${a}: a version is a fixed point in history, so Save is off.`:t?"Save writes the file into the package.":r?`${r.description}: this server does not take writes.`:"This server does not take writes."}function DTe(e){return e instanceof Error?e.message:String(e)}function Y0e(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function NTe({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:l,afterWrite:d}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:a,expectedHash:i})}catch(g){for(const y of s)t.invalidateQueries({queryKey:y});throw new Error(Y0e(g))}const m=u.data.contentHash;await d?.(m);for(const{queryKey:g,refetchType:y,wait:x}of l){const w=t.invalidateQueries({queryKey:g,...y?{refetchType:y}:{}});x&&await w}return m}function ITe(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function LTe(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=Xr(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class M_ extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const O_=e=>e instanceof M_||e instanceof Error&&e.name==="DocumentNotFoundError",G0e=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function P_(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(G0e,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const og=e=>Wy(e)?e:`\`${e}\``;function eT(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=P_("title",t);if(a)return a;if(t.includes("|##"))return"A title cannot contain `|##`, which closes the report's artifact tag.";if(/["\\\r\n]/.test(n)||n.trim()==="")return`The model path ${JSON.stringify(n)} cannot be written as an import.`;for(const[i,s]of[["source",r],["view",o]])if(s.trim()===""||/[`\r\n\\]/.test(s))return`The ${i} name ${JSON.stringify(s)} cannot be written as a Malloy name.`}const K0e=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},UN=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Q0e="report.malloy";function tT(e,t,n=Q0e){const r=eT(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),l=UN(s),d=og(`${a}_tiles`),u=og(`${i}_tile`),m=`"${d} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${l}`," tiles=[",` ${m}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${og(a)} } from "${wF(o,n)}"`,"",`source: ${d} is ${og(a)} extend {`,` # label=${UN(K0e(i))}`,` view: ${u} is ${og(i)}`,"}",""].join(`
473
+ `)}function zTe(e,t){return tT(e,"linear",t)}function X0e(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function Z0e({title:e,modelPath:t,source:n,view:r}){for(const[o,a]of[["source",n],["view",r]])if(!Wy(a))return`The ${o} name ${JSON.stringify(a)} cannot be written as a Malloy name.`;return/["\\\r\n]/.test(t)?`The model path ${JSON.stringify(t)} cannot be written into an import.`:P_("title",e)}function FTe(e,t){const n=Z0e(e);if(n)throw new Error(n);return tT(e,"grid",t)}const j_=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function J0e(e,t){const n=j_(t);return`${n===""?"":`${n}/`}${e}.malloy`}function exe(e){return X0e(e)||"untitled"}function A_(e,t=1,n){const r=exe(e);return J0e(t>1?`${r}-${t}`:r,n)}const wy=(e,t,n)=>`${e}/${t}/${n}`,txe=(e,t,n,r,o)=>({workspace:t,type:e,path:wy(n,r,o)}),nT=20;function nxe(e){const{savesTo:t,writer:n}=W0e({...e,readFailed:!1});return t==="browser"?void 0:n}const qN=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function D_(e){if(!e.endsWith(".malloy"))return"A report's file name ends in .malloy.";const t=e.split("/");if(t.some(n=>n===""||n==="."||n===".."))return"A location is a path inside the package, such as sales/q3.malloy.";if(t.at(-1)===".malloy")return"A report's file needs a name.";if(t[0].toLowerCase()==="public")return"A report cannot live under public/, which is served as plain files.";if(e.toLowerCase()==="index.malloy")return"The package's index.malloy is its surface, never a report."}async function rxe(e){const t=e.layout??"linear",n=Pd();let r;try{r=await oxe(e,t)}catch(o){throw Kk({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return Kk({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:Pd()-n}),e.onCreated?.(r),r}async function oxe(e,t){const{document:n,target:r}=e,o=eT(n);if(o)throw new Error(o);const a=j_(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:nT},(w,S)=>A_(n.title,S+1,a));for(const w of i){const S=D_(w);if(S)throw new Error(S)}const s=w=>tT(n,t,w);if(r.route==="package"){const w=new Set(r.existing);let S;for(const b of i)if(!w.has(b))try{await r.write(b,s(b)),S=b;break}catch($){if(!ixe($))throw $}if(S===void 0)throw HN(n.title,e.path);return{layout:t,path:S,slug:qN(S)}}const{storage:l,workspace:d,environmentName:u,packageName:m}=r,g=new Set(r.existing),y=new Set((await l.listDocuments(d)).map(w=>w.path));let x;for(const w of i){const S=txe(t,d.name,u,m,w),b=await l.resolveDocumentPath?.(S)??w;if(y.has(S.path)||g.has(w)||g.has(b))continue;let $=!0;try{await l.getDocument(S)}catch(k){if(!O_(k))throw k;$=!1}if(!$){x={layout:t,path:b,slug:qN(b),locator:S};break}}if(x===void 0)throw HN(n.title,e.path);return await l.saveDocument(x.locator,s(x.path)),x}const axe=/^`[^`]+` already exists in the package\b/;function ixe(e){const t=e?.response;if(t?.status!==409)return!1;const n=t.data?.reason;if(n==="FILE_EXISTS")return!0;if(n!=null)return!1;const r=t.data?.message;return typeof r=="string"&&axe.test(r)}const HN=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${nT} tries. Fix: choose a different title.`);function sxe(e){try{const t=JSON.parse(e??"");return new Set((t.entries??[]).flatMap(n=>n.kind==="source"&&typeof n.name=="string"?[n.name]:[]))}catch{return new Set}}function VN(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function lxe(e){for(const t of e??[]){const n=/^#\s*(?:-[A-Za-z_]+\s+)*([a-z_]+)/.exec(t.trim())?.[1];if(n&&dF.includes(n))return n}}function cxe({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=tr(),s=Bz({queries:r.map(x=>({queryKey:["new-document-model",e,t,n,x,i],queryFn:async()=>(await a.models.getModel(e,t,x,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),l=s.map(x=>x.dataUpdatedAt).join(),d=C.useMemo(()=>{const x=new Map;return s.forEach((w,S)=>{const b=[],$=sxe(w.data?.modelInfo);for(const k of w.data?.sources??[]){if(typeof k.name!="string"||!$.has(k.name))continue;const T=VN(k.annotations);for(const O of k.views??[])if(typeof O.name=="string"){const P=VN(O.annotations),D=lxe(O.annotations);b.push({source:k.name,view:O.name,...P?{description:P}:{},...D?{chart:D}:{},...T?{sourceDescription:T}:{}})}}b.length>0&&x.set(r[S],b)}),x},[l,r]),u=s.some(x=>x.isLoading),m=u?[]:r.filter((x,w)=>s[w]?.isError),g=!u&&s.some(x=>x.isError&&L4(x.error)),y=()=>{s.forEach(x=>{x.isError&&x.refetch()})};return{choices:d,isLoading:u,isSuccess:s.length>0&&s.every(x=>!x.isPending),failed:m,retry:y,canRetry:g}}const N_=C.createContext(void 0);function uxe({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return p.jsx(N_.Provider,{value:n,children:e})}function I_(){return C.useContext(N_)}function dxe(e,{environmentName:t,packageName:n,path:r,versionId:o},a){return{queryKey:["report",t,n,o,r],queryFn:async({signal:i})=>(await e.reports.getReport(t,n,r,o,{signal:i})).data,...a===void 0?{}:{staleTime:a}}}const _Te=1e4,L_=e=>e==="notebook"?"linear":"grid",BTe=(e,t)=>`${e}s/${t}.malloy`;function fxe(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[I1({environmentName:e,packageName:t,modelPath:n})]]]}function pxe(e,t,n,r){for(const o of[["report"],["reports"],...fxe(t,n,r)])e.invalidateQueries({queryKey:o})}function co(e){const{server:t}=tr(),n={...e,queryKey:[...e.queryKey,t],queryFn:async r=>{try{return await e.queryFn(r)}catch(o){if(o&&typeof o=="object"&&"response"in o){const a=o;if(a.response?.data){const i=new Error(a.response.data.message||a.message);throw i.status=a.response.status,i.data=a.response.data,i}}throw o}},retry:!1,throwOnError:!1};return zd(n,JR)}function hl(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const a=new Error(o.response.data.message||o.message);throw a.status=o.response.status,a.data=o.response.data,a}}throw r}},retry:!1,throwOnError:!1};return a0(t,JR)}function hxe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function UTe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function rT(e,{enabled:t=!0}={}){const{apiClients:n}=tr(),r=hxe(e);return co({queryKey:r,queryFn:({signal:o})=>n.models.executeQueryModel(e.environmentName,e.packageName,e.modelPath,{queryName:e.queryName,query:e.query,sourceName:e.sourceName,givens:e.givens,versionId:e.versionId},void 0,{signal:o}),enabled:t,placeholderData:(o,a)=>a&&gxe(a.queryKey,r)?o:void 0,...Ire})}const mxe=8;function gxe(e,t){return e.every((n,r)=>r===mxe||r>=t.length||n===t[r])}const yxe=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function z_(e){let t=!1;for(const[n,r]of Array.from(e.entries())){if(r.deleted)continue;if(n==="image"||n==="link"){e.delete(n),t=!0;continue}if(n==="label"){let a;try{a=e.text("label")}catch{a=void 0}if(a!==void 0&&yxe.test(a)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const a of[r,...o])z_(a)&&(t=!0)}return t}function vxe(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=e1.parseAnnotation(t)}catch{return""}return n.log.length>0?"":z_(n.tag)?`${n.tag.toString()}
474
+ `:e}function x$(e){if(Array.isArray(e)){for(const n of e)x$(n);return}if(e===null||typeof e!="object")return;const t=e;for(const[n,r]of Object.entries(t))if(n==="annotations"&&Array.isArray(r))for(const o of r){const a=o;typeof a?.value=="string"&&(a.value=vxe(a.value))}else x$(r)}function F_(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);x$(t);const r=JSON.stringify(t);return r===n?e:r}const bxe=new Set(["bar_chart","line_chart","scatter_chart","combo_chart","shape_map","segment_map","point_map","big_value","sparkline","list","list_detail","dashboard","transpose","table","json","image","link","text"]),xxe={value:`# big_value
475
+ `};function wxe(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(r=>Gk(r)))return!1;const n=e.data;return n?n.kind==="record_cell"?!0:n.kind==="array_cell"&&Array.isArray(n.array_value)&&n.array_value.length===1:!1}function Sxe(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=p1(n.slice(1));for(const o of r.split(/[\s{}=.,[\]]+/))if(bxe.has(o))return!0}return!1}function __(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!wxe(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return Sxe(r)?e:JSON.stringify({...t,annotations:[xxe,...n]})}const Cxe=e=>F_(__(e));function WN(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?DF(t):e}function B_({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,annotation:i,label:s,subtitle:l,heading:d,borderless:u,givens:m,hostGivens:g,declaredTypes:y,givenNames:x,height:w,tableMaxHeight:S,fixedHeight:b,maxResultSize:$,drill:k,onExplore:T,chrome:O="card",ignoredFilters:P,preamble:D,restricted:A,waitingFor:F,index:L}){const{theme:_}=Vr(),[R,z]=Gle(),N=rT({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?v1(D??"",`${i?`${i}
476
+ `:""}run: ${a}`):void 0,givens:y2(Jd(m,y,x),g,x)},{enabled:z&&A!==!0&&F===void 0}),{emit:B}=g1(),I=N.isError?N.error:void 0;C.useEffect(()=>{I!==void 0&&B({type:"report.query_failed",...L!==void 0?{tile:L}:{},category:U0(I)})},[I,B,L]);const H=A===!0||D!==void 0&&N.isError&&Mce(N.error);return p.jsxs(X0,{cardRef:R,borderless:u,chrome:O,sx:{"& .malloy-render, & .malloy-table":{width:"100%"},"& .publisher-tile-explore":{opacity:0,transition:`opacity ${Zy}`,...Jy,...fle},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&p.jsx($_,{title:d?.title??s??WN(a),subtitle:d?d.subtitle:l,quiet:O==="none",tooltip:a,action:T&&p.jsx(Br,{title:"Explore from here",children:p.jsx(ro,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??WN(a)}`,onClick:T,sx:{mt:-.5,mr:-.5,color:_.tileTitle},children:p.jsx(Vle,{fontSize:"small"})})})}),P&&p.jsx(w0e,{ignored:P}),F!==void 0?p.jsx(Te,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:F})}):H?p.jsx(Te,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:Ece})}):p.jsx(X2,{fill:!0,state:N,context:a??o??r,maxHeight:w,tableMaxHeight:S,compactToFit:b,firstPaintHeight:yF,maxResultSize:$,drill:k,transform:D!==void 0?a!==void 0?Cxe:F_:a!==void 0?__:void 0})]})}function qTe(e,{enabled:t=!0}={}){const{apiClients:n}=tr();return co({queryKey:["compiled-document",e.environmentName,e.packageName,e.modelPath,e.source,e.givens??null],queryFn:async()=>{const r=(await n.models.compileModelSource(e.environmentName,e.packageName,e.modelPath,{source:e.source,scope:"append",...e.givens&&Object.keys(e.givens).length>0?{givens:e.givens}:{}})).data;return{document:r.document,result:r}},enabled:t})}Jt(p.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));const U_="(max-width:599.95px)";function kxe(){return oee(U_,{noSsr:!0})}function $xe(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(U_).matches}function HTe({children:e}){const[t]=C.useState($xe),[n,r]=C.useState(!1);return!t||n?p.jsx(p.Fragment,{children:e}):p.jsxs(Yn,{sx:{alignItems:"flex-start",gap:1.5,py:3},children:[p.jsx(wt,{variant:"h6",children:"Editing works best on a larger screen"}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"The editor is built for a wider window. You can still try it here."}),p.jsx(Vn,{variant:"outlined",onClick:()=>r(!0),children:"Edit anyway"})]})}function VTe(){const e=Ay();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function q_(e,t){return e.flatMap(({filter:n})=>{if(n.kind!=="literal_equality"||n.expression.kind!=="field_reference")return[];const r=Rxe(n.value,t);return r===void 0?[]:[{field:n.expression.name,label:r,expression:n.expression}]})}function H_(e,t){switch(e.kind){case"string_literal":return`'${p2(e.string_value)}'`;case"number_literal":return e.string_value!==void 0?/^-?\d+(\.\d+)?$/.test(e.string_value)?e.string_value:void 0:Number.isFinite(e.number_value)?String(e.number_value):void 0;case"boolean_literal":return String(e.boolean_value);case"date_literal":{const n=V_(e.date_value);return n&&`@${n[0]}-${n[1]}-${n[2]}`}case"timestamp_literal":{const n=Y_(e.timestamp_value,t);return n&&`@${n[0]}-${n[1]}-${n[2]} ${n[3]}:${n[4]}:${n[5]}${W_(e.timestamp_value)}`}default:return}}function Rxe(e,t){switch(e.kind){case"string_literal":return e.string_value;case"null_literal":return"null";case"date_literal":{const n=V_(e.date_value);return n&&YN([...n,"00","00","00"],e.granularity??"day")}case"timestamp_literal":{const n=Y_(e.timestamp_value,t);return n&&YN(n,e.granularity??"second")+(e.granularity===void 0?W_(e.timestamp_value):"")}default:return H_(e)}}function V_(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?[t[1],t[2],t[3]]:void 0}function W_(e){const t=/:\d{2}\.(\d+)/.exec(e)?.[1]?.replace(/0+$/,"");return t?`.${t}`:""}function Y_(e,t){const n=new Date(e);if(Number.isNaN(n.getTime()))return;let r;try{r=new Intl.DateTimeFormat("en-US",{timeZone:t??"UTC",hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n)}catch{return}const o=a=>r.find(i=>i.type===a)?.value??"";return[o("year").padStart(4,"0"),o("month"),o("day"),o("hour"),o("minute"),o("second")]}function YN([e,t,n,r,o,a],i){switch(i){case"year":return e;case"quarter":return`${e}-Q${Math.floor((Number(t)-1)/3)+1}`;case"month":return`${e}-${t}`;case"week":case"day":return`${e}-${t}-${n}`;case"hour":return`${e}-${t}-${n} ${r}`;case"minute":return`${e}-${t}-${n} ${r}:${o}`;default:return`${e}-${t}-${n} ${r}:${o}:${a}`}}const Txe="drill_metadata_corrected",Z0=e=>e,ah=e=>{try{return e?.()}catch{return}},G_=e=>ah(e.isBasic?.bind(e))===!0&&ah(e.wasDimension?.bind(e))===!0,Exe=e=>[e.isString,e.isNumber,e.isBoolean,e.isTime].some(t=>ah(t?.bind(e))===!0);function J0(e){const t=e.metadataTag?.text("drill_expression","code");return t===void 0||t.trim()===""?void 0:t}function K_(e){const t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t}function Q_(e){const t=K_(e),n=(t[t.length-1]??e).metadataTag,r=n?.text("source","name");if(!r||!n?.array||n.array("source","parameters")!==void 0||n.has?.(Txe)!==!0)return;const o=[];for(const i of[...t].reverse())if(ah(i.isArray?.bind(i))===!0){if(i.metadataTag?.has?.("drillable")!==!0)return;for(const s of i.metadataTag?.array?.("drill_filters")??[]){const l=s.text("code");if(!l)return;o.push(l)}}const a=n?.text("query_name");return{source:r,filters:o,...a&&!a.startsWith("__")?{queryName:a}:{}}}function av(e){const t=new Set;for(const n of K_(e))for(const r of n.fields??[])G_(r)&&t.add(r);return[...t]}function X_(e){const t=new Set(av(e).filter(n=>ah(n.isTime?.bind(n))===!0).map(n=>ah(n.getEffectiveQueryTimezone?.bind(n))));return t.size>1?null:[...t][0]}function GN(e){return!G_(e)||J0(e)===void 0||Q_(e)===void 0||X_(e)===null?!1:av(e).every(t=>J0(t)!==void 0&&t.drillStableExpression!==void 0&&Exe(t))}function Mxe(e,t){const n=av(e),r=[],o=new Set;for(const a of t){if(a.kind==="drill")continue;const{filter:i}=a;if(i.kind!=="literal_equality")return;const s=JSON.stringify(i.expression),l=n.find(u=>JSON.stringify(u.drillStableExpression)===s),d=l&&J0(l);if(l===void 0||d===void 0)return;r.push({code:d,value:i.value}),o.add(l)}return n.every(a=>o.has(a))&&r.length>0?r:void 0}const Oxe=360;function w$(e){return e?e.getLabel?.()??e.tag?.text("label")??Z0(e).metadataTag?.text("label")??e.name:""}function Pxe(e,t){const n=e.drillClauses?q_(e.drillClauses,e.timezone):[];if(n.length===0)return`${w$(t)}: ${e.label}`;const r=av(Z0(t));return n.map(o=>{const a=JSON.stringify(o.expression),i=r.find(s=>JSON.stringify(s.drillStableExpression)===a);return`${i?w$(i):o.field}: ${o.label}`}).join(", ")}function Z_({onNavigate:e,onSelf:t,destinationTitle:n,canSelf:r,onRows:o}){const[a,i]=C.useState(null),s=C.useCallback((S,b)=>S.filter($=>$===Gm?t!==void 0&&(r?.(b)??!0):e!==void 0),[e,t,r]),l=C.useCallback((S,b,$)=>{if(b===Gm){t?.(S.given,S.rawValue);return}e?.({path:b,dashboard:b,givens:{[S.given]:S.value}},$)},[e,t]),d=C.useCallback(S=>{if(!o||S.noRows||S.isHeader||!S.field)return;const b=Z0(S.field);if(!GN(b))return;const $=Q_(b);if($===void 0)return;const k=S.drillClauses;let T;if(k!==void 0){const P=Mxe(b,k);if(P===void 0)return;T={dimensions:P}}else{const P=J0(b);if(P===void 0||av(b).length!==1||y1(S.value)===void 0||typeof S.value=="number"&&Number.isInteger(S.value)&&!Number.isSafeInteger(S.value))return;T={code:P}}const O=X_(b)??void 0;return{field:S.field.name,rawValue:S.value,label:Zk(S.value),target:$,...T,...S.context===void 0?{}:{context:S.context},...k===void 0?{}:{drillClauses:k},...O===void 0?{}:{timezone:O}}},[o]),u=C.useCallback(S=>{const b=vce(S),$=d(S),k=b?Array.from(new Set(s(b.to,b.given))).sort((P,D)=>+(D===Gm)-+(P===Gm)):[],T=`${w$(S.field)}: ${b?.label??Zk(S.value)}`,O=k.map(P=>({key:`to:${P}`,label:P===Gm?`Filter to ${T}`:`Open ${n?.(P)??DF(P.split("/").pop()??P)} (${T})`,run:()=>{b&&l(b,P,S.event)}}));$&&S.field&&O.push({key:"rows",label:`Show rows (${Pxe($,S.field)})`,run:()=>o?.($)}),O.length!==0&&i({items:O,top:S.event?.clientY??0,left:S.event?.clientX??0})},[l,s,o,d,n]),m=C.useCallback(S=>s(AF(S),NF(S)).length>0,[s]),g=C.useCallback(S=>o!==void 0&&GN(Z0(S)),[o]),y=C.useMemo(()=>({onClick:u,canDrill:S=>m(S)||g(S)}),[u,m,g]),x=C.useCallback((S,b)=>({canDrill:$=>m($)||b&&g($),onClick:$=>u({...$,...S===void 0?{}:{context:S},...b?{}:{noRows:!0}})}),[u,m,g]),w=C.useCallback(()=>i(null),[]);return{drill:y,bindingFor:x,drillMenu:p.jsx(uc,{open:a!==null,onClose:w,anchorReference:"anchorPosition",anchorPosition:{top:a?.top??0,left:a?.left??0},children:(a?.items??[]).map(S=>p.jsx(ea,{title:S.label,"aria-label":S.label,onClick:()=>{w(),S.run()},sx:{maxWidth:Oxe},children:p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label})},S.key))})}}const jxe=e=>{const t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current};function WTe(){const[e]=nV(),t=Ay(),n=hs(),r=C.useMemo(()=>Object.fromEntries(e.entries()),[e]),o=C.useRef(new Set),a=C.useRef(null),i=C.useCallback(d=>{const u=a.current,m=new URLSearchParams(u?.key===n.key?u.search:n.search);d(m);const g=m.toString();a.current={key:n.key,search:g},t({search:g,hash:n.hash},{replace:!0})},[t,n]),s=C.useCallback((d,u)=>{const m=new Set([...u,...o.current]);o.current=new Set([...o.current,...Object.keys(d),...u]),i(g=>{for(const y of m)Object.prototype.hasOwnProperty.call(d,y)||g.delete(y);for(const[y,x]of Object.entries(d))g.set(y,x)})},[i]),l=C.useCallback((d,u)=>i(m=>{u===void 0?m.delete(d):m.set(d,u)}),[i]);return{params:r,onGivensChange:s,setParam:l}}const Axe=Jt(p.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}));function Eg(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function Mg(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Dxe(e){if(e===void 0)return"";switch(e.kind){case"null_cell":return"";case"number_cell":return e.string_value??String(e.number_value);case"boolean_cell":return e.boolean_value?"true":"false";case"date_cell":return e.date_value;case"timestamp_cell":return e.timestamp_value;case"string_cell":return Mg(Eg(e.string_value));case"json_cell":return Mg(Eg(e.json_value));case"sql_native_cell":return Mg(Eg(e.sql_native_value));default:return Mg(Eg(JSON.stringify(e)))}}function J_(e){const t=e.data;return t?.kind!=="array_cell"?[]:t.array_value.flatMap(n=>n.kind==="record_cell"?[n.record_value]:[])}function Nxe(e){const t=e.schema.fields;return`\uFEFF${[t.map(n=>Mg(Eg(n.name))).join(","),...J_(e).map(n=>t.map((r,o)=>Dxe(n[o])).join(","))].join(`\r
477
477
  `)}\r
478
- `}function Nxe(e,t){return[e,"rows",...t].join("_").replace(/[^A-Za-z0-9._-]+/g,"_").replace(/_+/g,"_").replace(/^[_.]+|[_.]+$/g,"").slice(0,120)||"rows"}function Ixe(e,t,n){return n==="server_default"&&t!==void 0&&e>=t?t:void 0}const KN="Download the rows behind this value as CSV, up to the server's row limit",Lxe=4e4;function zxe(e,t){const n=URL.createObjectURL(new Blob([e],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),Lxe)}function Fxe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The request failed."}function _xe({query:e,preamble:t,environmentName:n,packageName:r,modelPath:o,versionId:a,givens:i,fileName:s}){const{apiClients:l}=tr(),[d,u]=C.useState(!1),[m,g]=C.useState(KN),[y,x]=C.useState(void 0),w=C.useRef(void 0);C.useEffect(()=>()=>w.current?.abort(),[]);const S=async()=>{w.current?.abort();const b=new AbortController;w.current=b,u(!0),x(void 0);try{const $=await l.models.executeQueryModel(n,r,o,{query:t===void 0?e:v1(t,e),givens:i,versionId:a},void 0,{signal:b.signal});if(b.signal.aborted)return;const k=$.data,T=JSON.parse(k.result??"{}"),O=Ixe(J_(T).length,k.queryRowLimit,k.queryRowLimitSource);g(O===void 0?KN:`First ${O} rows: the server's row limit, so there may be more`),zxe(Dxe(T),O===void 0?`${s}.csv`:`${s}_first_${O}_rows_server_limit.csv`)}catch($){if(b.signal.aborted)return;x(`Download failed: ${Fxe($)}`)}finally{w.current===b&&(w.current=void 0,u(!1))}};return p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:1},children:[y&&p.jsx(wt,{role:"alert",variant:"caption",color:"error",sx:{maxWidth:320},children:y}),p.jsx(Br,{title:m,children:p.jsx("span",{children:p.jsx(Vn,{size:"small",startIcon:p.jsx(jxe,{fontSize:"small"}),onClick:()=>void S(),disabled:d,children:"Download CSV"})})})]})}const e6=200;function Bxe(e){const{target:t}=e;if(t!==void 0&&!(e.dimensions===void 0&&e.code===void 0))return{...e,target:t}}function QN(e,t=e6){const n=qxe(e);if(n===void 0)return;const r=[...e.target.filters,...n].join(", "),o=e.timezone?`timezone: '${p2(e.timezone)}'; `:"",a=t===null?"":`; limit: ${t}`,i=Uxe(e.target.source);if(i!==void 0)return`run: ${i} -> { ${o}where: ${r}; select: *${a} }`}function Uxe(e){return Wy(e)?e:e.includes("`")?void 0:`\`${e}\``}function EC(e){return/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(e)?e:`(${e})`}function qxe(e){if(e.dimensions){const n=[];for(const{code:r,value:o}of e.dimensions){if(o.kind==="null_literal"){n.push(`${EC(r)} is null`);continue}const a=H_(o,e.timezone);if(a===void 0)return;n.push(`${EC(r)} = ${a}`)}return n}const t=Zle(e.rawValue);return e.code!==void 0&&t?[`${EC(e.code)} = ${t}`]:void 0}const Hxe="This value cannot be written as a filter, so its rows cannot be fetched.";function XN(e){const t=e.drillClauses?q_(e.drillClauses,e.timezone):[];return t.length>0?t:[{field:e.field,label:e.label}]}function Vxe({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,preamble:a,givens:i,onClose:s,onDone:l,actions:d}){const{theme:u}=Vr(),m=e?QN(e):void 0,g=e?QN(e,null):void 0,y=e&&g!==void 0?{query:g,...a===void 0?{}:{preamble:a},environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},givens:i,fileName:Nxe(e.target.source,XN(e).map(x=>x.label))}:void 0;return p.jsxs(zx,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[p.jsxs(_x,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[p.jsxs(Te,{children:[e?p.jsxs(p.Fragment,{children:["Rows where"," ",XN(e).map((x,w)=>p.jsxs(C.Fragment,{children:[w>0&&" and ",p.jsx(Te,{component:"code",sx:{fontSize:"0.9em"},children:x.field})," ","is ",x.label]},w))]}):"Rows",p.jsx(wt,{component:"div",variant:"caption",sx:{color:u.tileTitle,mt:.25},children:e?`The first ${e6} rows of ${e.target.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[y&&(d?d(y):p.jsx(_xe,{...y})),p.jsx(ro,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary"},children:p.jsx(xh,{fontSize:"small"})})]})]}),p.jsxs(Fx,{dividers:!0,sx:{p:0,minHeight:240},children:[m===void 0&&e&&p.jsx(wt,{variant:"body2",sx:{p:2},children:Hxe}),m!==void 0&&p.jsx(Wxe,{query:a===void 0?m:v1(a,m),environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:i,...l?{onDone:l}:{}})]}),p.jsxs(pz,{sx:{px:3,py:1.5},children:[m!==void 0&&p.jsx(wt,{variant:"caption",sx:{mr:"auto",color:u.tileTitle,fontFamily:u.ui.font.mono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m,children:m}),p.jsx(Vn,{onClick:s,children:"Close"})]})]})}function Wxe({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:i}){const s=rT({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:a}),{isSuccess:l,isError:d}=s,u=C.useRef(void 0);return C.useEffect(()=>{u.current=Pd()},[e]),C.useEffect(()=>{u.current===void 0||!l&&!d||(i?.(l,Pd()-u.current),u.current=void 0)},[l,d,i]),p.jsx(Te,{sx:{p:1},children:p.jsx(X2,{state:s,context:e})})}function t6({manifest:e,environmentName:t,packageName:n,versionId:r,documentName:o,givens:a,onGivensChange:i,onNavigate:s,height:l,maxResultSize:d,controlsLayout:u="bar",preamble:m,runModelPath:g,hiddenGivens:y,literalReads:x,onLinkNavigate:w,actions:S,rowsActions:b}){const $=C.useMemo(()=>w?{environmentName:t,packageName:n,sourcePath:e.path??o,onNavigate:w}:void 0,[t,n,e.path,o,w]),k=C.useMemo(()=>(e.givens??[]).filter(le=>!(m!==void 0&&le.secure===!0)&&!(le.name!==void 0&&y?.includes(le.name))),[e,y,m]),T=C.useMemo(()=>a===void 0?void 0:Object.fromEntries(Object.entries(a).filter(([,le])=>typeof le=="string")),[a]),O=b2({specs:k,loaded:!0,startingValues:e.startingGivens,params:T,onGivensChange:i,documentKey:`${t}/${n}/${r??""}/${o}`,autorun:e.autorun!==!1,environmentName:t,packageName:n,modelPath:g??e.path,versionId:r,documentName:o,...m!==void 0?{preamble:m}:{},...a?{hostGivens:a}:{}}),{applied:P,declaredTypes:D,canSelf:A,onSelf:F}=O,L=g1(),_=C.useMemo(()=>{const le=new Set((e.tiles??[]).flatMap(fe=>fe.givenNames??[]));return Object.fromEntries(Object.entries(a??{}).filter(([fe])=>le.has(fe)&&!D.has(fe)))},[e,a,D]),[R,z]=C.useState(void 0),N=C.useCallback(le=>{const fe=Bxe(le);fe!==void 0&&z(fe)},[]),B=C.useMemo(()=>y2(Jd(P,D),_),[P,D,_]),{reports:I}=C_(t,n,r,s!==void 0),H=C.useCallback(le=>{const fe=E0e(le,I);if(fe.kind!=="path")return;const he=fe.report.path;return I.find(me=>me.path===he)?.title||void 0},[I]),{bindingFor:Y,drillMenu:ae}=Z_({onNavigate:s,onSelf:F,canSelf:A,onRows:N,destinationTitle:H}),K=C.useCallback((le,fe)=>Y(le,fe!==!0),[Y]),{columns:oe,layout:ue,tileMaxHeight:G,tableMaxHeight:ie}=qle(e.layout,e.dashboardColumns),Q=C.useMemo(()=>Ybe(k,P,a),[k,P,a]);if(e.error)return p.jsx(b$,{layout:ue,header:p.jsx(ZN,{manifest:e,links:$,actions:S}),children:p.jsx(lo,{severity:"error",children:e.error})});const ee=g??e.path,Z=e.tiles??[],de=uF(Z);return p.jsxs(b$,{layout:ue,header:p.jsx(ZN,{manifest:e,links:$,actions:S}),controls:k.length>0?p.jsx(T_,{children:p.jsx(j1,{...O.panel,layout:u})}):void 0,children:[Q.length>0&&p.jsx(lo,{severity:"info",children:Kbe(Q)}),ee===void 0?p.jsx(lo,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):Z.length>0?p.jsx(ile,{tiles:Z,columns:oe,minTilePx:sF,rowGapPx:vl,keyOf:(le,fe)=>`${fe}:${le.kind==="text"?`text:${le.name}`:le.query}`,renderTile:(le,fe)=>le.kind==="text"||le.query===void 0?p.jsx(Te,{sx:le.rowspan!==void 0||de?{minHeight:0,overflow:"auto"}:void 0,children:p.jsx(Yxe,{markdown:le.markdown??"",links:$})}):p.jsx(B_,{index:fe,environmentName:t,packageName:n,versionId:r,modelPath:ee,tile:le.query,label:le.label,subtitle:le.subtitle,borderless:le.borderless,givens:P,hostGivens:_,declaredTypes:D,givenNames:le.givenNames,height:le.rowspan!==void 0||de?iF(le.rowspan??cF.query):ue==="grid"?l??G:G,tableMaxHeight:ie,fixedHeight:le.rowspan!==void 0||de,maxResultSize:d,drill:K(le.query,le.restricted),ignoredFilters:b0e(le.givenNames&&(le.query&&x?.[le.query]?[...le.givenNames,...x[le.query]]:le.givenNames),k),...m!==void 0?{preamble:m,restricted:le.restricted}:{},...(()=>{const he=Gbe(Q,le.givenNames);return he.length>0?{waitingFor:Qbe(he)}:{}})()})}):p.jsx(lo,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),ae,ee!==void 0&&p.jsx(Vxe,{request:R,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:ee,...m===void 0?{}:{preamble:m},givens:B,...b===void 0?{}:{actions:b},onClose:()=>z(void 0),onDone:(le,fe)=>{R&&L.emit({type:"report.rows_shown",source:R.target.source,view:R.target.queryName??"",field:R.field,ok:le,durationMs:fe})}})]})}function Yxe({markdown:e,links:t}){return p.jsx(N1,{children:p.jsx(oh,{variant:"document",links:t,children:e})})}function ZN({manifest:e,links:t,actions:n}){return p.jsx(R_,{title:e.title??e.name,actions:n,description:e.description?p.jsx(N1,{children:p.jsx(oh,{variant:"document",links:t,children:e.description})}):void 0})}const n6=Jt(p.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Gxe="publisher:resize";function Kxe(e){return typeof e=="object"&&e!==null&&e.type===Gxe&&typeof e.height=="number"}function r6(e){return e.replace(/\/api\/v0\/?$/,"")}function Qxe({server:e,environmentName:t,packageName:n,path:r,versionId:o}){const a=r.startsWith("public/")?r.slice(7):r,i=`${r6(e)}/environments/${encodeURIComponent(t)}/packages/${encodeURIComponent(n)}/`+a;return o===void 0?i:`${i}${i.includes("?")?"&":"?"}versionId=${encodeURIComponent(o)}`}function Xxe(e){try{const{environmentName:t,packageName:n,modelPath:r,versionId:o}=Xr(e);return!t||!n||!r?null:{environmentName:t,packageName:n,dataAppPath:r,versionId:o}}catch{return null}}function VTe({resourceUri:e}){const{server:t,apiClients:n}=tr(),r=Xxe(e),o=r?.environmentName??"",a=r?.packageName??"",i=r?.dataAppPath??"",s=r?.versionId,l=C.useMemo(()=>Qxe({server:t,environmentName:o,packageName:a,path:i,...s!==void 0?{versionId:s}:{}}),[t,o,a,i,s]),d=co({queryKey:["data-apps",o,a,s],queryFn:()=>n.dataApps.listDataApps(o,a,s),enabled:!!r}).data?.data?.find(w=>w.path===i),u=d?.title??i,m=d?.fit==="viewport",g=C.useRef(null),[y,x]=C.useState(120);return C.useEffect(()=>{if(m)return;function w(S){Kxe(S.data)&&S.source===g.current?.contentWindow&&S.data.height>0&&x(Math.ceil(S.data.height))}return window.addEventListener("message",w),()=>window.removeEventListener("message",w)},[m]),r?p.jsxs(Te,{sx:{p:3,...m?{height:"100%",display:"flex",flexDirection:"column"}:{maxWidth:1600,mx:"auto"}},children:[p.jsxs(Yn,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1,flexShrink:0},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium",letterSpacing:"-0.025em"},children:u}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo},children:i}),p.jsx(Te,{sx:{flex:1}}),p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(ro,{size:"small",href:l,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",sx:{color:"text.secondary"},children:p.jsx(n6,{fontSize:"small"})})})]}),p.jsx(Te,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",backgroundColor:"background.paper",...m?{flex:1,minHeight:0}:{}},children:p.jsx("iframe",{ref:g,src:l,title:u,sandbox:"allow-scripts allow-same-origin allow-forms",style:{display:"block",width:"100%",height:m?"100%":y,border:0}})})]}):p.jsxs(Te,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Can't open data app"}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["This data app link is missing an environment, package, or path:",p.jsx(Te,{component:"span",sx:{fontFamily:Fo,ml:1},children:e})]})]})}function Ns({title:e,count:t,description:n,action:r,children:o}){const a=C.useId();return p.jsxs(Te,{component:"section","aria-labelledby":a,sx:{mb:4},children:[p.jsxs(Yn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:n?0:1,minHeight:40},children:[p.jsxs(Yn,{direction:"row",alignItems:"baseline",spacing:1,children:[p.jsx(wt,{id:a,variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em",lineHeight:1.2},children:e}),t!==void 0&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),r]}),n&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:n}),p.jsx(Te,{children:o})]})}function Zxe({resourceUri:e}){const{environmentName:t}=Xr(e),{apiClients:n}=tr(),[r,o]=C.useState(!1),a=90,{data:i,isSuccess:s,isError:l,error:d}=co({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),u=i?.data?.readme||"",m=u.split(/\s+/),g=m.length>a,y=m.slice(0,a).join(" ");return p.jsxs(p.Fragment,{children:[!s&&!l&&p.jsx(Bo,{text:"Fetching About..."}),s&&u&&p.jsxs(Ns,{title:"Readme",children:[p.jsx(oh,{variant:"caption",children:r||!g?u:y}),g&&p.jsx(Te,{sx:{mt:1},children:p.jsx(Xy,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),l&&p.jsx(ja,{error:d,context:`${t} > About`})]})}function Jxe(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,i=w2();C.useEffect(()=>{if(!o)return;function S(b){b.defaultPrevented||b.key==="Escape"&&r?.(b,"escapeKeyDown")}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[o,r]);const s=Yt((S,b)=>{r?.(S,b)}),l=Yt(S=>{!r||S==null||i.start(S,()=>{s(null,"timeout")})});C.useEffect(()=>(o&&l(t),i.clear),[o,t,l,i]);const d=S=>{r?.(S,"clickaway")},u=i.clear,m=C.useCallback(()=>{t!=null&&l(a??t*.5)},[t,a,l]),g=S=>b=>{const $=S.onBlur;$?.(b),m()},y=S=>b=>{const $=S.onFocus;$?.(b),u()},x=S=>b=>{const $=S.onMouseEnter;$?.(b),u()},w=S=>b=>{const $=S.onMouseLeave;$?.(b),m()};return C.useEffect(()=>{if(!n&&o)return window.addEventListener("focus",m),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",u)}},[n,o,m,u]),{getRootProps:(S={})=>{const b={...q0(e),...q0(S)};return{role:"presentation",...S,...b,onBlur:g(b),onFocus:y(b),onMouseEnter:x(b),onMouseLeave:w(b)}},onClickAway:d}}function JN(e){return e.substring(2).toLowerCase()}function e1e(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function t1e(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,i=C.useRef(!1),s=C.useRef(null),l=C.useRef(!1),d=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{l.current=!0},0),()=>{l.current=!1}),[]);const u=vr(wh(t),s),m=Yt(x=>{const w=d.current;d.current=!1;const S=Yo(s.current);if(!l.current||!s.current||"clientX"in x&&e1e(x,S))return;if(i.current){i.current=!1;return}let b;x.composedPath?b=x.composedPath().includes(s.current):b=!S.documentElement.contains(x.target)||s.current.contains(x.target),!b&&(n||!w)&&o(x)}),g=x=>w=>{d.current=!0;const S=t.props[x];S&&S(w)},y={ref:u};return a!==!1&&(y[a]=g(a)),C.useEffect(()=>{if(a!==!1){const x=JN(a),w=Yo(s.current),S=()=>{i.current=!0};return w.addEventListener(x,m),w.addEventListener("touchmove",S),()=>{w.removeEventListener(x,m),w.removeEventListener("touchmove",S)}}},[m,a]),r!==!1&&(y[r]=g(r)),C.useEffect(()=>{if(r!==!1){const x=JN(r),w=Yo(s.current);return w.addEventListener(x,m),()=>{w.removeEventListener(x,m)}}},[m,r]),C.cloneElement(t,y)}function n1e(e){return Cn("MuiSnackbarContent",e)}fn("MuiSnackbarContent",["root","message","action"]);const r1e=e=>{const{classes:t}=e;return bn({root:["root"],action:["action"],message:["message"]},n1e,t)},o1e=nt(tf,{name:"MuiSnackbarContent",slot:"Root"})(Gn(({theme:e})=>{const t=e.palette.mode==="light"?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Bk(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Bk(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),a1e=nt("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),i1e=nt("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),s1e=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:a,role:i="alert",...s}=n,l=n,d=r1e(l);return p.jsxs(o1e,{role:i,elevation:6,className:Ht(d.root,o),ownerState:l,ref:t,...s,children:[p.jsx(a1e,{className:d.message,ownerState:l,children:a}),r?p.jsx(i1e,{className:d.action,ownerState:l,children:r}):null]})});function l1e(e){return Cn("MuiSnackbar",e)}fn("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const c1e=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${Tt(n.vertical)}${Tt(n.horizontal)}`]};return bn(r,l1e,t)},u1e=nt("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${Tt(n.anchorOrigin.vertical)}${Tt(n.anchorOrigin.horizontal)}`]]}})(Gn(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center",variants:[{props:({ownerState:t})=>t.anchorOrigin.vertical==="top",style:{top:8,[e.breakpoints.up("sm")]:{top:24}}},{props:({ownerState:t})=>t.anchorOrigin.vertical!=="top",style:{bottom:8,[e.breakpoints.up("sm")]:{bottom:24}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="left",style:{justifyContent:"flex-start",[e.breakpoints.up("sm")]:{left:24,right:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="right",style:{justifyContent:"flex-end",[e.breakpoints.up("sm")]:{right:24,left:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="center",style:{[e.breakpoints.up("sm")]:{left:"50%",right:"auto",transform:"translateX(-50%)"}}}]}))),d1e=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiSnackbar"}),r=Xd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:i,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:d,className:u,ClickAwayListenerProps:m,ContentProps:g,disableWindowBlurListener:y=!1,message:x,onBlur:w,onClose:S,onFocus:b,onMouseEnter:$,onMouseLeave:k,open:T,resumeHideDuration:O,slots:P={},slotProps:D={},TransitionComponent:A,transitionDuration:F=o,TransitionProps:{onEnter:L,onExited:_,...R}={},...z}=n,N={...n,anchorOrigin:{vertical:i,horizontal:s},autoHideDuration:l,disableWindowBlurListener:y,TransitionComponent:A,transitionDuration:F},B=c1e(N),{getRootProps:I,onClickAway:H}=Jxe({...N}),[Y,ae]=C.useState(!0),K=me=>{ae(!0),_&&_(me)},oe=(me,se)=>{ae(!1),L&&L(me,se)},ue={slots:{transition:A,...P},slotProps:{content:g,clickAwayListener:m,transition:R,...D}},[G,ie]=ur("root",{ref:t,className:[B.root,u],elementType:u1e,getSlotProps:I,externalForwardedProps:{...ue,...z},ownerState:N}),[Q,{ownerState:ee,...Z}]=ur("clickAwayListener",{elementType:t1e,externalForwardedProps:ue,getSlotProps:me=>({onClickAway:(...se)=>{const ve=se[0];me.onClickAway?.(...se),!ve?.defaultMuiPrevented&&H(...se)}}),ownerState:N}),[de,le]=ur("content",{elementType:s1e,shouldForwardComponentProp:!0,externalForwardedProps:ue,additionalProps:{message:x,action:a},ownerState:N}),[fe,he]=ur("transition",{elementType:gy,externalForwardedProps:ue,getSlotProps:me=>({onEnter:(...se)=>{me.onEnter?.(...se),oe(...se)},onExited:(...se)=>{me.onExited?.(...se),K(...se)}}),additionalProps:{appear:!0,in:T,timeout:F,direction:i==="top"?"down":"up"},ownerState:N});return!T&&Y?null:p.jsx(Q,{...Z,...P.clickAwayListener&&{ownerState:ee},children:p.jsx(G,{...ie,children:p.jsx(fe,{...he,children:d||p.jsx(de,{...le})})})})});let S$;function f1e(e){S$=e}function eI(e){if(S$)try{S$(e)}catch{}}function rc(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return eI({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw eI({type:"console.mutation",resource:e,action:t,ok:!1,durationMs:Date.now()-o,reason:a instanceof Error?a.message:"An unknown error occurred"}),a}})}function Ch({mutationFn:e,success:t,invalidates:n,closeDialog:r,resource:o,action:a}){const i=Tl(),[s,l]=C.useState(""),d=hl({mutationFn:rc(o,a,e),onSuccess(){r();for(const u of n)i.invalidateQueries({queryKey:u});l(t)},onError(u){l(u instanceof Error?u.message:"An unknown error occurred")}});return{mutate:d.mutate,isPending:d.isPending,notice:p.jsx(d1e,{open:s!=="",autoHideDuration:6e3,onClose:()=>l(""),message:s})}}const o6="https://docs.malloydata.dev/documentation",tI=`${o6}/user_guides/publishing`,Bb="https://github.com/malloydata/publisher/blob/main/docs",tu={docsHome:`${o6}/`,publishing:`${tI}/publishing`,mcpAgents:`${tI}/mcp_agents`,surfaces:`${Bb}/choosing-a-surface.md`,givens:`${Bb}/givens.md`,materialization:`${Bb}/materialization.md`,connections:`${Bb}/connections.md`};function p1e({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=tr(),{environmentName:o}=Xr(e),a=Ch({mutationFn(s){return r.packages.createPackage(o,{name:s.name,description:s.description,location:s.location})},success:"Package created",invalidates:[["packages",o]],closeDialog:()=>n(!1),resource:"package",action:"create"}),i=s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString(),m=l.get("location")?.toString();a.mutate({name:d,description:u,location:m})};return p.jsxs(p.Fragment,{children:[p.jsx(Qy,{label:"Package",onClick:()=>n(!0)}),p.jsx(Oo,{open:t,onClose:()=>n(!1),title:"New package",description:p.jsxs(p.Fragment,{children:["A package is a directory of Malloy models and their data. Give its location as a GitHub, S3 or GCS URL, or an absolute path the server can read; see the"," ",p.jsx(Te,{component:"a",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary"},children:"package format"}),"."]}),actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),p.jsx(Vn,{type:"submit",form:"package-form",variant:"contained",loading:a.isPending,children:"Create package"})]}),children:p.jsx("form",{onSubmit:i,id:"package-form",children:p.jsxs(Yn,{sx:{gap:2},children:[p.jsx(Ri,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(Ri,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(Ri,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}const h1e=Jt(p.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function L1({icon:e,tint:t,label:n,mono:r,description:o,rightLabel:a,trailingAction:i,onClick:s,ariaLabel:l}){const d=!!s;return p.jsxs(Te,{onClick:s,onKeyDown:d?u=>{s&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s(u))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":l,sx:u=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:d?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":d?{backgroundColor:u.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":d?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[p.jsx(Te,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),p.jsxs(Te,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"baseline",gap:1.5},children:[p.jsx(wt,{variant:"body2",sx:{...r?{fontFamily:Fo}:{},flexShrink:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),o&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]}),a&&p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:a}),i&&p.jsx(Te,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:i})]})}const a6=Jt(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),m1e=fn("MuiBox",["root"]),g1e=tF(),Ta=sR({themeId:bh,defaultTheme:g1e,defaultClassName:m1e.root,generateClassName:B4.generate}),z1=hR({createStyledComponent:nt("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>Kn({props:e,name:"MuiStack"})}),nI=fn("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function y1e(e){return Cn("MuiListItemIcon",e)}const rI=fn("MuiListItemIcon",["root","alignItemsFlexStart"]),v1e=e=>{const{alignItems:t,classes:n}=e;return bn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},y1e,n)},b1e=nt("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(Gn(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),oT=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiListItemIcon"}),{className:r,...o}=n,a=C.useContext(ic),i={...n,alignItems:a.alignItems},s=v1e(i);return p.jsx(b1e,{className:Ht(s.root,r),ownerState:i,ref:t,...o})});function x1e(e){return Cn("MuiListItemText",e)}const Rp=fn("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),w1e=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return bn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},x1e,t)},S1e=nt("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Rp.primary}`]:t.primary},{[`& .${Rp.secondary}`]:t.secondary},t.root,n.inset&&t.inset,n.primary&&n.secondary&&t.multiline,n.dense&&t.dense]}})({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4,[`.${eN.root}:where(& .${Rp.primary})`]:{display:"block"},[`.${eN.root}:where(& .${Rp.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),aT=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiListItemText"}),{children:r,className:o,disableTypography:a=!1,inset:i=!1,primary:s,primaryTypographyProps:l,secondary:d,secondaryTypographyProps:u,slots:m={},slotProps:g={},...y}=n,{dense:x}=C.useContext(ic);let w=s??r,S=d;const b={...n,disableTypography:a,inset:i,primary:!!w,secondary:!!S,dense:x},$=w1e(b),k={slots:m,slotProps:{primary:l,secondary:u,...g}},[T,O]=ur("root",{className:Ht($.root,o),elementType:S1e,externalForwardedProps:{...k,...y},ownerState:b,ref:t}),[P,D]=ur("primary",{className:$.primary,elementType:Sr,externalForwardedProps:k,ownerState:b}),[A,F]=ur("secondary",{className:$.secondary,elementType:Sr,externalForwardedProps:k,ownerState:b});return w!=null&&w.type!==Sr&&!a&&(w=p.jsx(P,{variant:x?"body2":"body1",component:D?.variant?void 0:"span",...D,children:w})),S!=null&&S.type!==Sr&&!a&&(S=p.jsx(A,{variant:"body2",color:"textSecondary",...F,children:S})),p.jsxs(T,{...O,children:[w,S]})});function C1e(e){return Cn("MuiMenuItem",e)}const ag=fn("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),k1e=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},$1e=e=>{const{disabled:t,dense:n,divider:r,disableGutters:o,selected:a,classes:i}=e,s=bn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},C1e,i);return{...i,...s}},R1e=nt(qd,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:k1e})(Gn(({theme:e})=>({...e.typography.body1,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap","&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${ag.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${ag.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${ag.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${ag.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${ag.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${nI.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${nI.inset}`]:{marginLeft:52},[`& .${Rp.root}`]:{marginTop:0,marginBottom:0},[`& .${Rp.inset}`]:{paddingLeft:36},[`& .${rI.root}`]:{minWidth:36},variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:t})=>!t.dense,style:{[e.breakpoints.up("sm")]:{minHeight:"auto"}}},{props:({ownerState:t})=>t.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${rI.root} svg`]:{fontSize:"1.25rem"}}}]}))),Vo=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:o="li",dense:a=!1,divider:i=!1,disableGutters:s=!1,focusVisibleClassName:l,role:d="menuitem",tabIndex:u,className:m,...g}=n,y=C.useContext(ic),x=C.useMemo(()=>({dense:a||y.dense||!1,disableGutters:s}),[y.dense,a,s]),w=C.useRef(null);Go(()=>{r&&w.current&&w.current.focus()},[r]);const S={...n,dense:x.dense,divider:i,disableGutters:s},b=$1e(n),$=vr(w,t);let k;return n.disabled||(k=u!==void 0?u:-1),p.jsx(ic.Provider,{value:x,children:p.jsx(R1e,{ref:$,role:d,tabIndex:k,component:o,focusVisibleClassName:Ht(b.focusVisible,l),className:Ht(b.root,m),...g,ownerState:S,classes:b})})}),ac={postgres:[{label:"Host",name:"host",type:"text",required:!1},{label:"Port",name:"port",type:"number",required:!1},{label:"Database Name",name:"databaseName",type:"text",required:!1},{label:"User Name",name:"userName",type:"text",required:!1},{label:"Password",name:"password",type:"password",required:!1},{label:"Connection String",name:"connectionString",type:"text",required:!1}],bigquery:[{label:"Project ID",name:"defaultProjectId",type:"text",required:!1},{label:"Billing Project ID",name:"billingProjectId",type:"text",required:!1},{label:"Location",name:"location",type:"text",required:!1},{label:"Service Account Key JSON",name:"serviceAccountKeyJson",type:"text",required:!0},{label:"Maximum Bytes Billed",name:"maximumBytesBilled",type:"text",required:!1},{label:"Query Timeout Milliseconds",name:"queryTimeoutMilliseconds",type:"text",required:!1},{label:"Database Metadata",name:"dbmeta",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}],snowflake:[{label:"Account",name:"account",type:"text",required:!0},{label:"Username",name:"username",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Role",name:"role",type:"text",required:!1},{label:"Warehouse",name:"warehouse",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"Response Timeout Milliseconds",name:"responseTimeoutMilliseconds",type:"text",required:!1},{label:"Private Key",name:"privateKey",type:"password",required:!1},{label:"Private Key Passphrase",name:"privateKeyPass",type:"password",required:!1}],trino:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Catalog",name:"catalog",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Peaka Key",name:"peakaKey",type:"password",required:!1}],databricks:[{label:"Host",name:"host",type:"text",required:!0},{label:"HTTP Path",name:"path",type:"text",required:!0},{label:"Access Token",name:"token",type:"password",required:!1},{label:"OAuth Client ID",name:"oauthClientId",type:"text",required:!1},{label:"OAuth Client Secret",name:"oauthClientSecret",type:"password",required:!1},{label:"Default Catalog",name:"defaultCatalog",type:"text",required:!1},{label:"Default Schema",name:"defaultSchema",type:"text",required:!1}],mysql:[{label:"Host",name:"host",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Database",name:"database",type:"text",required:!0}],sqlserver:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Database",name:"database",type:"text",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Encrypt",name:"encrypt",type:"text",required:!1,selectOptions:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},{label:"Trust server certificate",name:"trustServerCertificate",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]},{label:"Host name in certificate",name:"hostNameInCertificate",type:"text",required:!1},{label:"Instance name",name:"instanceName",type:"text",required:!1}],duckdb:[],motherduck:[{label:"Access Token",name:"accessToken",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1}],ducklake:[],publisher:[]},Og={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",trino:"trinoConnection",databricks:"databricksConnection",mysql:"mysqlConnection",sqlserver:"sqlserverConnection",duckdb:"duckdbConnection",motherduck:"motherduckConnection",ducklake:"ducklakeConnection",publisher:"publisherConnection"},T1e={bigquery:{dbmeta:"boolean"},sqlserver:{port:"integer",encrypt:"boolean",trustServerCertificate:"boolean"}},E1e={sqlserver:["hostNameInCertificate","instanceName"]};function i6(e,t){const n=T1e[e],r=E1e[e];if(!n&&!r)return t;const o={...t};for(const a of r??[])o[a]===""&&delete o[a];for(const[a,i]of Object.entries(n??{})){const s=t[a];if(s!==void 0){if(s===""){delete o[a];continue}if(i==="integer"){const l=Number(s);Number.isInteger(l)&&(o[a]=l)}else(s==="true"||s==="false")&&(o[a]=s==="true")}}return o}const s6=Object.values(hA).filter(e=>e!==hA.Publisher),C$={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},Sy=[{label:"Credential Provider",name:"provider",type:"text",required:!1,selectOptions:[{label:"Access key pair",value:"config"},{label:"Host credential chain",value:"credential_chain"}]},{label:"Access Key ID",name:"accessKeyId",type:"text",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Secret Access Key",name:"secretAccessKey",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Credential Chain",name:"chain",type:"text",required:!1,visibleWhen:{field:"provider",value:"credential_chain"}},{label:"Region",name:"region",type:"text",required:!1},{label:"Endpoint",name:"endpoint",type:"text",required:!1},{label:"Session Token",name:"sessionToken",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}}],Cy=[{label:"Key ID",name:"keyId",type:"text",required:!0},{label:"Secret",name:"secret",type:"password",required:!0}],M1e=[{label:"Auth Type",name:"authType",type:"text",required:!0,selectOptions:[{label:"SAS Token",value:"sas_token"},{label:"Service Principal (SPN)",value:"service_principal"}]},{label:"SAS URL (e.g. https://account.blob.core.windows.net/container/file.parquet?sp=r&st=...)",name:"sasUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"sas_token"}},{label:"Tenant ID",name:"tenantId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client ID",name:"clientId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client Secret",name:"clientSecret",type:"password",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Account Name",name:"accountName",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"File URL (e.g. abfss://container/path/file.parquet)",name:"fileUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}}];function ex(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?ac[e]||[]:e==="s3"?Sy:e==="gcs"?Cy:e==="azure"?M1e:[]}function O1e({onSubmit:e,isSubmitting:t}){const[n,r]=C.useState(!1),[o,a]=C.useState("postgres"),[i,s]=C.useState([]),[l,d]=C.useState("postgres"),[u,m]=C.useState("s3"),[g,y]=C.useState("config"),x=()=>{r(!0)},w=()=>{r(!1),s([]),a("postgres"),d("postgres"),m("s3"),y("config")},S=async T=>{T.preventDefault();const O=new FormData(T.currentTarget),P=O.get("name")?.toString(),D=O.get("type")?.toString(),A=ac[D];if(!P)throw new Error("Name is required");if(!D)throw new Error("Type is required");let F;if(D==="ducklake"){const L={};if(l==="postgres"){const z=ac.postgres,N={};if(z.forEach(B=>{const I=O.get(`ducklake_pg_${B.name}`)?.toString();I&&(N[B.name]=I)}),Object.keys(N).length===0)throw new Error("DuckLake requires catalog connection");L.postgresConnection=N}const _=O.get("ducklake_bucketUrl")?.toString();if(!_)throw new Error("DuckLake requires a bucket URL");const R={bucketUrl:_};if(u==="s3"){const z={};if(Sy.forEach(N=>{const B=O.get(`ducklake_s3_${N.name}`)?.toString();B&&(z[N.name]=B)}),z.provider==="credential_chain")delete z.accessKeyId,delete z.secretAccessKey,delete z.sessionToken;else{if(delete z.chain,!z.accessKeyId)throw new Error("S3 Access Key ID is required");if(!z.secretAccessKey)throw new Error("S3 Secret Access Key is required")}Object.keys(z).length>0&&(R.s3Connection=z)}else if(u==="gcs"){const z={};if(Cy.forEach(N=>{const B=O.get(`ducklake_gcs_${N.name}`)?.toString();B&&(z[N.name]=B)}),!z.keyId)throw new Error("GCS Key ID is required");if(!z.secret)throw new Error("GCS Secret is required");Object.keys(z).length>0&&(R.gcsConnection=z)}F={name:P,type:D,ducklakeConnection:{catalog:L,storage:R}}}else if(D==="duckdb"){if(i.length===0)throw new Error("DuckDB connection must have at least one attached database");const L=i.map((_,R)=>{const z=_.dbType,N=O.get(`attachedDb_${R}_name`)?.toString();if(!N)throw new Error(`Attached database at index ${R} must have a name`);const B={name:N,type:z},I=ex(z);if(I&&I.length>0){const H={};if(I.forEach(ae=>{const K=O.get(`attachedDb_${R}_${ae.name}`)?.toString();K&&(H[ae.name]=K)}),z==="s3"){if(H.provider==="credential_chain")delete H.accessKeyId,delete H.secretAccessKey,delete H.sessionToken;else if(delete H.chain,!H.accessKeyId||!H.secretAccessKey)throw new Error(`Attached database "${N}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const Y=C$[z];Y&&(B[Y]=H)}return B});F={name:P,type:D,duckdbConnection:{attachedDatabases:L}}}else{const L={};if(A.forEach(_=>{const R=O.get(_.name)?.toString();R&&(L[_.name]=R)}),D==="postgres"){if(!L.connectionString?.trim()){const _=["host","port","databaseName","userName","password"];for(const R of _)if(!L[R])throw new Error(`${A.find(z=>z.name===R)?.label||R} is required`)}}else if(D==="bigquery"){if(!L.serviceAccountKeyJson)throw new Error("Service Account Key JSON is required")}else if(D==="snowflake"){if(!L.account)throw new Error("Account is required");if(!L.username)throw new Error("Username is required");if(!L.warehouse)throw new Error("Warehouse is required");if(!L.password&&!L.privateKey)throw new Error("Either password or private key is required")}else if(D==="trino"){if(!L.server)throw new Error("Server is required");if(!L.user)throw new Error("User is required");if(L.server.trim().startsWith("https://")&&!L.password&&!L.peakaKey)throw new Error("Password is required for HTTPS connections (or use Peaka Key)")}else if(D==="mysql"){const _=["host","port","database","user","password"];for(const R of _)if(!L[R])throw new Error(`${A.find(z=>z.name===R)?.label||R} is required`)}else if(D==="sqlserver"){const _=["server","database","user","password"];if(!L.instanceName&&!L.port)throw new Error("Port is required unless an instance name is given");for(const R of _)if(!L[R])throw new Error(`${A.find(z=>z.name===R)?.label||R} is required`)}else if(D==="motherduck"){if(!L.accessToken)throw new Error("Access Token is required")}else if(D==="databricks"){if(!L.host)throw new Error("Host is required");if(!L.path)throw new Error("HTTP Path is required");const _=L.oauthClientId&&L.oauthClientSecret;if(!L.token&&!_)throw new Error("Either Access Token or OAuth Client ID + Secret is required")}F={name:P,type:D,[Og[D]]:i6(D,L)}}await e(F),w()},b=()=>{s([...i,{name:"",dbType:"postgres"}])},$=T=>{s(i.filter((O,P)=>P!==T))},k=(T,O)=>{const P=[...i];P[T]={...P[T],dbType:O},s(P)};return p.jsxs(kn.Fragment,{children:[p.jsx(Qy,{label:"Connection",onClick:x}),p.jsx(Oo,{open:n,onClose:w,title:"New connection",description:"Add a connection so packages in this environment can query your database with Malloy.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:t,onClick:w,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"connection-form",variant:"contained",loading:t,children:"Create connection"})]}),children:p.jsx("form",{onSubmit:S,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small"}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:o,select:!0,onChange:T=>a(T.target.value),children:s6.map(T=>p.jsx(Vo,{value:T,children:T},T))}),o==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:l,select:!0,onChange:T=>d(T.target.value),children:p.jsx(Vo,{value:"postgres",children:"PostgreSQL"})}),l==="postgres"&&p.jsx(p.Fragment,{children:ac.postgres.map(T=>p.jsx(yr,{id:`ducklake_pg_${T.name}`,name:`ducklake_pg_${T.name}`,label:T.label,type:T.type,fullWidth:!0,size:"small"},`pg_${T.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:u,select:!0,onChange:T=>m(T.target.value),children:[p.jsx(Vo,{value:"s3",children:"S3"}),p.jsx(Vo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:u==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small"}),u==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(T=>T.visibleWhen?g===T.visibleWhen.value:!0).map(T=>p.jsx(yr,{id:`ducklake_s3_${T.name}`,name:`ducklake_s3_${T.name}`,label:T.label,type:T.selectOptions?void 0:T.type,fullWidth:!0,size:"small",required:T.required,select:!!T.selectOptions,defaultValue:T.selectOptions?g:void 0,onChange:T.name==="provider"?O=>y(O.target.value):void 0,placeholder:T.name==="region"?"us-east-1":void 0,children:T.selectOptions?.map(O=>p.jsx(Vo,{value:O.value,children:O.label},O.value))},`s3_${T.name}`))]}),u==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(T=>p.jsx(yr,{id:`ducklake_gcs_${T.name}`,name:`ducklake_gcs_${T.name}`,label:T.label,type:T.type,fullWidth:!0,size:"small",required:T.required},`gcs_${T.name}`))]})]})]}):o==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Sr,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(f1,{}),onClick:b,ariaLabel:"Add database"})]}),i.length===0&&p.jsx(Sr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),i.map((T,O)=>{const P=ex(T.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Sr,{variant:"subtitle2",children:["Database ",O+1]}),p.jsx(Tu,{onClick:()=>$(O),size:"small",color:"error",children:p.jsx(a6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${O}_name`,name:`attachedDb_${O}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:T.name}),p.jsx(yr,{id:`attachedDb_${O}_type`,name:`attachedDb_${O}_type`,label:"Database Type",fullWidth:!0,size:"small",value:T.dbType,select:!0,onChange:D=>k(O,D.target.value),children:Object.values($4).map(D=>p.jsx(Vo,{value:D,children:D},D))}),P.filter(D=>D.visibleWhen?(T[D.visibleWhen.field]||P.find(A=>A.name===D.visibleWhen?.field)?.selectOptions?.[0]?.value)===D.visibleWhen.value:!0).map(D=>p.jsx(yr,{id:`attachedDb_${O}_${D.name}`,name:`attachedDb_${O}_${D.name}`,label:D.label,type:D.selectOptions?void 0:D.type,fullWidth:!0,size:"small",required:D.required,select:!!D.selectOptions,defaultValue:D.selectOptions?.[0]?.value,onChange:D.selectOptions?A=>{const F=[...i];F[O]={...F[O],[D.name]:A.target.value},s(F)}:void 0,children:D.selectOptions?.map(A=>p.jsx(Vo,{value:A.value,children:A.label},A.value))},D.name))]},O)})]}):ac[o].map(T=>p.jsx(yr,{id:T.name,name:T.name,label:T.label,type:T.type,fullWidth:!0,size:"small",required:T.required,select:!!T.selectOptions,defaultValue:T.selectOptions?T.selectOptions[0]?.value:void 0,children:T.selectOptions?.map(O=>p.jsx(Vo,{value:O.value,children:O.label},O.value))},T.name))]})})})]})}function P1e({connection:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),i=()=>{a(!0)},s=()=>{a(!1),t()};return p.jsxs(kn.Fragment,{children:[p.jsxs(Vo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(oT,{sx:{color:"inherit"},children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(aT,{children:"Delete"})]}),p.jsx(Oo,{open:o,onClose:s,title:"Delete connection",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:s,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete connection"})]}),children:p.jsxs(Sr,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const oI=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function aI(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function iI(e){const t=e.ducklakeConnection;return t&&t.storage?.gcsConnection?"gcs":"s3"}function j1e({connection:e,onSubmit:t,isSubmitting:n,onCloseDialog:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(e.type),l=kn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[d,u]=C.useState(()=>aI(e)),[m,g]=C.useState("postgres"),[y,x]=C.useState(()=>iI(e)),[w,S]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),b=()=>{u(aI(e)),s(e.type),S(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),g("postgres"),x(iI(e)),a(!0)},$=()=>{a(!1),r?.()},k=async F=>{F.preventDefault();const L=new FormData(F.currentTarget),_=L.get("name")?.toString(),R=L.get("type")?.toString(),z=ac[R];if(!_)throw new Error("Name is required");if(!R)throw new Error("Type is required");let N;if(R==="ducklake"){const B={};if(m==="postgres"){const Y=ac.postgres,ae={};if(Y.forEach(K=>{const oe=L.get(`ducklake_pg_${K.name}`)?.toString();oe&&(ae[K.name]=oe)}),Object.keys(ae).length===0)throw new Error("DuckLake requires catalog connection");B.postgresConnection=ae}const I=L.get("ducklake_bucketUrl")?.toString();if(!I)throw new Error("DuckLake requires a bucket URL");const H={bucketUrl:I};if(y==="s3"){const Y={};Sy.forEach(K=>{const oe=L.get(`ducklake_s3_${K.name}`)?.toString();oe&&(Y[K.name]=oe)});const ae=e.ducklakeConnection?.storage?.s3Connection;if(ae&&(!Y.provider&&ae.provider&&(Y.provider=ae.provider),!Y.chain&&ae.chain&&(Y.chain=ae.chain),!Y.accessKeyId&&ae.accessKeyId&&(Y.accessKeyId=ae.accessKeyId)),Y.provider==="credential_chain")delete Y.accessKeyId,delete Y.secretAccessKey,delete Y.sessionToken;else if(delete Y.chain,!Y.accessKeyId)throw new Error("S3 Access Key ID is required");Object.keys(Y).length>0&&(H.s3Connection=Y)}else if(y==="gcs"){const Y={};Cy.forEach(K=>{const oe=L.get(`ducklake_gcs_${K.name}`)?.toString();oe&&(Y[K.name]=oe)});const ae=e.ducklakeConnection?.storage?.gcsConnection;if(ae&&!Y.keyId&&ae.keyId&&(Y.keyId=ae.keyId),!Y.keyId)throw new Error("GCS Key ID is required");Object.keys(Y).length>0&&(H.gcsConnection=Y)}N={name:_,type:R,ducklakeConnection:{catalog:B,storage:H}}}else if(R==="duckdb"){if(d.length===0)throw new Error("DuckDB connection must have at least one attached database");const B=d.map((I,H)=>{const Y=I.dbType,ae=L.get(`attachedDb_${H}_name`)?.toString();if(!ae)throw new Error(`Attached database at index ${H} must have a name`);const K={name:ae,type:Y},oe=ex(Y);if(oe&&oe.length>0){const ue={};if(oe.forEach(ie=>{const Q=L.get(`attachedDb_${H}_${ie.name}`)?.toString();Q&&(ue[ie.name]=Q)}),Y==="s3"){if(ue.provider==="credential_chain")delete ue.accessKeyId,delete ue.secretAccessKey,delete ue.sessionToken;else if(delete ue.chain,!ue.accessKeyId||!ue.secretAccessKey)throw new Error(`Attached database "${ae}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const G=C$[Y];G&&(K[G]=ue)}return K});N={name:_,type:R,duckdbConnection:{attachedDatabases:B}}}else{const B=e[Og[R]]||{},I={};if(z.forEach(H=>{const Y=L.get(H.name)?.toString(),ae=B[H.name];Y?I[H.name]=Y:oI.has(H.name)||(Y!==void 0?I[H.name]=Y:ae&&(I[H.name]=ae))}),R==="postgres"){const H=["host","port","databaseName","userName"],Y=l.has("postgresConnection.connectionString");if(!(I.connectionString?.trim()||Y)){const ae=H;for(const K of ae)if(!I[K])throw new Error(`${z.find(oe=>oe.name===K)?.label||K} is required`)}}else if(R==="snowflake"){if(!I.account)throw new Error("Account is required");if(!I.username)throw new Error("Username is required");if(!I.warehouse)throw new Error("Warehouse is required")}else if(R==="trino"){if(!I.server)throw new Error("Server is required");if(!I.user)throw new Error("User is required")}else if(R==="mysql"){const H=["host","port","database","user"];for(const Y of H)if(!I[Y])throw new Error(`${z.find(ae=>ae.name===Y)?.label||Y} is required`)}else if(R==="sqlserver"){const H=["server","database","user"];if(!I.instanceName&&!I.port)throw new Error("Port is required unless an instance name is given");for(const Y of H)if(!I[Y])throw new Error(`${z.find(ae=>ae.name===Y)?.label||Y} is required`)}else if(R==="databricks"){if(!I.host)throw new Error("Host is required");if(!I.path)throw new Error("HTTP Path is required")}N={name:_,type:R,[Og[R]]:i6(R,I)}}await t(N),$()},T=()=>{u([...d,{name:"",dbType:"postgres"}])},O=F=>{u(d.filter((L,_)=>_!==F))},P=(F,L)=>{const _=[...d];_[F]={..._[F],dbType:L},u(_)},D=(F,L)=>{const _=e.duckdbConnection?.attachedDatabases;if(!_||!_[F])return"";const R=_[F],z=C$[R.type||""];return z&&R[z]?R[z][L]??"":""},A=F=>{const L=e.ducklakeConnection;if(!L)return"";if(F.startsWith("pg_")){const _=F.replace("pg_","");return L.catalog?.postgresConnection?.[_]??""}if(F==="bucketUrl")return L.storage?.bucketUrl??"";if(F.startsWith("s3_")){const _=F.replace("s3_","");return L.storage?.s3Connection?.[_]??""}if(F.startsWith("gcs_")){const _=F.replace("gcs_","");return L.storage?.gcsConnection?.[_]??""}return""};return p.jsxs(kn.Fragment,{children:[p.jsxs(Vo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:F=>{F.preventDefault(),F.stopPropagation(),b()},children:[p.jsx(oT,{children:p.jsx(r2,{fontSize:"small"})}),p.jsx(aT,{children:"Edit"})]}),p.jsx(Oo,{open:o,onClose:$,title:"Edit connection",description:"Change how packages in this environment reach your database.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:n,onClick:$,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"connection-form",variant:"contained",loading:n,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:k,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",defaultValue:e.name}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:i,select:!0,onChange:F=>s(F.target.value),children:s6.map(F=>p.jsx(Vo,{value:F,children:F},F))}),i==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:m,select:!0,onChange:F=>g(F.target.value),children:p.jsx(Vo,{value:"postgres",children:"PostgreSQL"})}),m==="postgres"&&p.jsx(p.Fragment,{children:ac.postgres.map(F=>p.jsx(yr,{id:`ducklake_pg_${F.name}`,name:`ducklake_pg_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",defaultValue:A(`pg_${F.name}`)},`pg_${F.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:y,select:!0,onChange:F=>x(F.target.value),children:[p.jsx(Vo,{value:"s3",children:"S3"}),p.jsx(Vo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:y==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small",defaultValue:A("bucketUrl")}),y==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(F=>F.visibleWhen?w===F.visibleWhen.value:!0).map(F=>p.jsx(yr,{id:`ducklake_s3_${F.name}`,name:`ducklake_s3_${F.name}`,label:F.label,type:F.selectOptions?void 0:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secretAccessKey",select:!!F.selectOptions,defaultValue:F.selectOptions?w:A(`s3_${F.name}`),onChange:F.name==="provider"?L=>S(L.target.value):void 0,placeholder:F.name==="region"?"us-east-1":F.name==="secretAccessKey"&&l.has("ducklakeConnection.storage.s3Connection.secretAccessKey")?"Leave empty to keep existing":void 0,children:F.selectOptions?.map(L=>p.jsx(Vo,{value:L.value,children:L.label},L.value))},`s3_${F.name}`))]}),y==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(F=>p.jsx(yr,{id:`ducklake_gcs_${F.name}`,name:`ducklake_gcs_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secret",defaultValue:A(`gcs_${F.name}`),placeholder:F.name==="secret"&&l.has("ducklakeConnection.storage.gcsConnection.secret")?"Leave empty to keep existing":void 0},`gcs_${F.name}`))]})]})]}):i==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Sr,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(f1,{}),onClick:T,ariaLabel:"Add database"})]}),d.length===0&&p.jsx(Sr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),d.map((F,L)=>{const _=ex(F.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Sr,{variant:"subtitle2",children:["Database ",L+1]}),p.jsx(Tu,{"aria-label":`Remove attached database ${L+1}`,onClick:()=>O(L),size:"small",color:"error",children:p.jsx(a6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${L}_name`,name:`attachedDb_${L}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:F.name}),p.jsx(yr,{id:`attachedDb_${L}_type`,name:`attachedDb_${L}_type`,label:"Database Type",fullWidth:!0,size:"small",value:F.dbType,select:!0,onChange:R=>P(L,R.target.value),children:Object.values($4).map(R=>p.jsx(Vo,{value:R,children:R},R))}),_.filter(R=>R.visibleWhen?(F[R.visibleWhen.field]||D(L,R.visibleWhen.field)||_.find(z=>z.name===R.visibleWhen?.field)?.selectOptions?.[0]?.value)===R.visibleWhen.value:!0).map(R=>p.jsx(yr,{id:`attachedDb_${L}_${R.name}`,name:`attachedDb_${L}_${R.name}`,label:R.label,type:R.selectOptions?void 0:R.type,fullWidth:!0,size:"small",required:R.required,select:!!R.selectOptions,defaultValue:D(L,R.name)||R.selectOptions?.[0]?.value,onChange:R.selectOptions?z=>{const N=[...d];N[L]={...N[L],[R.name]:z.target.value},u(N)}:void 0,children:R.selectOptions?.map(z=>p.jsx(Vo,{value:z.value,children:z.label},z.value))},R.name))]},L)})]}):ac[i].map(F=>{const L=e?.[Og[i]??""]?.[F.name??""]??"",_=F.type==="password"||oI.has(F.name),R=l.has(`${Og[i]??""}.${F.name}`),z=F.selectOptions?L===""||L===void 0?F.selectOptions[0]?.value:String(L):void 0;return p.jsx(yr,{id:F.name,name:F.name,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&!_&&!L,select:!!F.selectOptions,defaultValue:F.selectOptions?z:L,placeholder:R?"Leave empty to keep existing":void 0,helperText:_?R?"Stored value is not shown. Leave empty to keep it.":"No value stored.":void 0,children:F.selectOptions?.map(N=>p.jsx(Vo,{value:N.value,children:N.label},N.value))},F.name)})]})})})]})}function sI(e,t){return!e||e.type!=="duckdb"?!1:(e.duckdbConnection?.attachedDatabases||[]).some(n=>n.type==="azure"&&n.name===t)}function A1e(e){return e.startsWith("gs://")||e.startsWith("s3://")||e.startsWith("https://")||e.startsWith("abfss://")||e.startsWith("az://")}function D1e({connectionName:e,resourceUri:t,schema:n,connection:r}){const{apiClients:o}=tr(),{environmentName:a}=Xr(t),[i,s]=kn.useState(null),[l,d]=kn.useState(n||null),[u,m]=kn.useState(!1),{data:g,isError:y,isLoading:x,error:w}=co({queryKey:["schemas",a,e],queryFn:()=>o.connections.listSchemas(a,e)}),S=g?.data||[];return p.jsxs(Cp,{container:!0,spacing:1,children:[!n&&p.jsx(Cp,{size:{xs:12,md:4},children:p.jsxs(Qa,{sx:{p:1,m:0},children:[p.jsxs(Te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),p.jsx(MR,{control:p.jsx(Cz,{checked:u,onChange:b=>m(b.target.checked)}),label:"Hidden Schemas"})]}),p.jsx(wl,{sx:{mt:"2px"}}),p.jsxs(Te,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[x&&p.jsx(Bo,{text:"Loading schemas..."}),y&&p.jsx(ja,{error:w,context:`${a} > ${e} > Schemas`}),!x&&!y&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Schemas"}),!x&&!y&&S.length>0&&p.jsx(AR,{dense:!0,disablePadding:!0,children:S.map(b=>{const $=b.name;return b.isHidden&&!u?null:p.jsx(mz,{selected:l===$,onClick:()=>{d($),s(null)},children:p.jsx(Ci,{primary:$})},$)})})]})]})}),p.jsx(Cp,{size:{xs:12,md:n?6:4},children:l&&p.jsx(Qa,{sx:{p:1,m:0},children:p.jsx(L1e,{connectionName:e,schemaName:l,onTableSelect:b=>{s(b)},resourceUri:t,connection:r})})}),p.jsx(Cp,{size:{xs:12,md:n?6:4},children:l&&i&&p.jsx(N1e,{environmentName:a,connectionName:e,schemaName:l,tableResource:i})})]})}function N1e({environmentName:e,connectionName:t,schemaName:n,tableResource:r}){const{apiClients:o}=tr(),{data:a,isLoading:i,isError:s,error:l}=co({queryKey:["connectionTableDetail",e,t,n,r],queryFn:()=>o.connections.getTable(e,t,n,r),enabled:!!n&&!!r}),d={resource:a?.data?.resource??r,columns:a?.data?.columns??[]};return p.jsxs(Qa,{sx:{p:1,m:0},children:[s&&p.jsx(ja,{error:l,context:`${e} > ${t} > ${n} > ${r}`}),!s&&p.jsx(I1e,{table:d,loading:i})]})}function I1e({table:e,loading:t}){return t?p.jsx(Bo,{text:"Loading columns..."}):p.jsxs(p.Fragment,{children:[p.jsxs(wt,{variant:"overline",fontWeight:"bold",sx:{display:"block",wordBreak:"break-all"},children:[e.resource.includes("://")||/\.(parquet|csv|json|tsv|ndjson)$/i.test(e.resource)?"File":"Table",": ",e.resource]}),p.jsx(wl,{}),p.jsx(Te,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:p.jsx(WJ,{children:p.jsxs(Bx,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"NAME"}),p.jsx(dr,{children:"TYPE"})]})}),p.jsx(qx,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>p.jsxs(vu,{children:[p.jsx(dr,{children:n.name}),p.jsx(dr,{children:n.type})]},n.name))})]})})})]})}function L1e({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=Xr(r),{apiClients:i}=tr(),[s,l]=C.useState(""),{data:d,isSuccess:u,isError:m,error:g,isLoading:y}=co({queryKey:["tablesInSchema",a,e,t],queryFn:()=>i.connections.listTables(a,e,t)}),x=sI(o,t),w=b=>x?b:b.split(".").pop()||b,S=u&&d?.data?d.data.filter(b=>w(b.resource).toLowerCase().includes(s.toLowerCase())).sort((b,$)=>w(b.resource).localeCompare(w($.resource))):[];return p.jsxs(p.Fragment,{children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:A1e(t)||sI(o,t)?`Files in ${t}`:`Tables in ${t}`}),p.jsx(wl,{}),p.jsx(Te,{sx:{mt:1,mb:1},children:p.jsx(Ri,{size:"small",fullWidth:!0,placeholder:"Search tables...",value:s,onChange:b=>l(b.target.value),variant:"outlined"})}),p.jsx(wl,{}),p.jsxs(Te,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[y&&p.jsx(Bo,{text:"Fetching Tables..."}),m&&p.jsx(ja,{error:g,context:`${a} > ${e} > ${t}`}),u&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Tables"}),u&&d?.data&&d.data.length>0&&p.jsx(AR,{dense:!0,disablePadding:!0,children:S.map(b=>{let $=w(b.resource);return!x&&b.resource.includes("://")&&($=b.resource.split("/").pop()||b.resource),p.jsx(mz,{onClick:()=>n(b.resource),children:p.jsx(Ci,{primary:$,secondary:b.columns.length>0?`${b.columns.length} columns`:void 0})},b.resource)})})]})]})}const z1e={bigquery:"BigQuery",snowflake:"Snowflake",postgres:"PostgreSQL",mysql:"MySQL",sqlserver:"SQL Server",trino:"Trino",databricks:"Databricks",duckdb:"DuckDB",ducklake:"DuckLake",s3:"S3",gcs:"GCS",azure:"Azure"};function F1e(e){return e?z1e[e]??e:""}function _1e({resourceUri:e}){const{apiClients:t,mutable:n}=tr(),r=Tl(),{environmentName:o}=Xr(e),[a,i]=C.useState(""),[s,l]=C.useState(null),d=I1({environmentName:o,connectionName:s}),{data:u,isSuccess:m,isError:g,error:y}=co({queryKey:["connections",o],queryFn:()=>t.connections.listConnections(o)}),x=hl({mutationFn:rc("connection","create",k=>t.environments.updateEnvironment(o,{name:o,connections:[...u.data,k]})),onSuccess(){i("Connection added successfully"),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),w=hl({mutationFn:rc("connection","update",k=>t.environments.updateEnvironment(o,{name:o,connections:u.data.map(T=>T.name===k.name?k:T)})),onSuccess(k,T){i(`Connection ${T.name} updated successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),S=hl({mutationFn:rc("connection","delete",k=>{if(!k.name)throw new Error("Cannot delete a connection with no name");return t.connections.deleteConnection(o,k.name)}),onSuccess(k,T){i(`Connection ${T.name} deleted successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),b=m?[...u.data].sort((k,T)=>(k.name??"").localeCompare(T.name??"")):[],$=x.isPending||w.isPending||S.isPending;return p.jsxs(Ns,{title:"Connections",...m?{count:b.length}:{},description:"Database connections available to packages in this environment",...n&&m?{action:p.jsx(O1e,{onSubmit:k=>x.mutateAsync(k),isSubmitting:x.isPending})}:{},children:[!m&&!g&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Fetching Connections..."}),g&&p.jsx(ja,{error:y,context:`${o} > Connections`}),m&&b.length===0&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"No connections yet."}),m&&b.length>0&&p.jsx(Yn,{children:b.map(k=>p.jsx(B1e,{connection:k,mutable:n,isMutating:$,onOpenExplorer:()=>l(k.name??null),onEdit:T=>w.mutateAsync(T),onDelete:T=>S.mutateAsync(T)},k.name))}),p.jsx(hh,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a}),p.jsx(Oo,{open:s!==null,onClose:()=>l(null),maxWidth:"lg",title:`Connection explorer: ${s??""}`,showClose:!0,children:s&&p.jsx(D1e,{resourceUri:d,connectionName:s,connection:u?.data?.find(k=>k.name===s)})})]})}function B1e({connection:e,mutable:t,isMutating:n,onOpenExplorer:r,onEdit:o,onDelete:a}){const[i,s]=C.useState(null),l=!!i,d=m=>{m.stopPropagation(),s(m.currentTarget)},u=()=>s(null);return p.jsx(L1,{icon:p.jsx(h1e,{sx:{fontSize:18}}),tint:ZR.connection,label:e.name??"",ariaLabel:e.name??"",description:F1e(e.type),onClick:r,...t?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small",onClick:d,"aria-label":`Connection actions for ${e.name??""}`.trim(),children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:i,open:l,onClose:u,onClick:m=>m.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(j1e,{connection:e,onSubmit:o,isSubmitting:n,onCloseDialog:u}),p.jsx(P1e,{connection:e,onCloseDialog:u,isMutating:n,onDelete:()=>a(e)})]})]})}:{}})}const U1e=Jt([p.jsx("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-1 18H5V9h14zm1-13H4V4h16z"},"0"),p.jsx("path",{d:"M9 12h6v2H9z"},"1")]);function q1e({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=tr(),a=()=>{r(!0)},i=()=>{r(!1),t()},{environmentName:s,packageName:l}=Xr(e),d=Ch({mutationFn:()=>o.packages.deletePackage(s,l),success:"Package deleted",invalidates:[["packages",s]],closeDialog:i,resource:"package",action:"delete"});return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(Ci,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete package",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:i,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>d.mutate(),loading:d.isPending,children:"Delete package"})]}),children:p.jsxs(Sr,{variant:"body2",children:["Delete ",p.jsx("strong",{children:l}),"? The package stops being served and this cannot be undone."]})}),d.notice]})}function H1e({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=tr(),i=()=>{o(!0)},s=()=>{o(!1),n()},{packageName:l,environmentName:d}=Xr(t),u=Ch({mutationFn(g){return a.packages.updatePackage(d,l,{name:l,description:g.description})},success:"Package updated",invalidates:[["packages",d]],closeDialog:s,resource:"package",action:"update"}),m=g=>{g.preventDefault();const y=new FormData(g.currentTarget).get("description")?.toString();u.mutate({description:y})};return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:i,children:[p.jsx(ml,{children:p.jsx(r2,{fontSize:"small"})}),p.jsx(Ci,{children:"Edit"})]}),p.jsx(Oo,{open:r,onClose:s,title:"Edit package",description:`What ${e.name} is, for the people who open it.`,actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:u.isPending,onClick:s,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"package-form",variant:"contained",loading:u.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:m,id:"package-form",children:p.jsxs(Yn,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,size:"small",defaultValue:e.description,InputLabelProps:{shrink:!0}})]})})}),u.notice]})}function V1e({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=tr(),{environmentName:r}=Xr(t),{data:o,isSuccess:a,isError:i,error:s}=co({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});if(i)return p.jsx(ja,{error:s,context:`${r} > Packages`});if(!a)return p.jsx(Bo,{text:"Fetching Packages..."});const l=[...o.data].sort((d,u)=>d.name.localeCompare(u.name));return p.jsx(Yn,{children:l.map(d=>{const u=I1({environmentName:r,packageName:d.name});return p.jsx(W1e,{pkg:d,packageResourceUri:u,onSelectPackage:e},d.name)})})}function W1e({pkg:e,packageResourceUri:t,onSelectPackage:n}){const{mutable:r}=tr(),o=e.versionId!==void 0||e.latestVersion!==void 0,[a,i]=C.useState(null),s=!!a,l=u=>{u.stopPropagation(),i(u.currentTarget)},d=()=>i(null);return p.jsx(L1,{icon:p.jsx(U1e,{sx:{fontSize:18}}),tint:ZR.package,label:e.name,ariaLabel:e.name,...e.description?{description:e.description}:{},onClick:u=>n(e.name,u),...r?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small",onClick:l,"aria-label":`Package actions for ${e.name}`,children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:a,open:s,onClose:d,onClick:u=>u.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[!o&&p.jsx(H1e,{package:e,resourceUri:t,onCloseDialog:d}),p.jsx(q1e,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function WTe({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=tr(),{environmentName:o}=Xr(t),a=co({queryKey:["packages",o],queryFn:()=>n.packages.listPackages(o)});return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Te,{sx:{mb:4},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:o}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Manage packages and database connections in this environment. Open a package to explore its models and notebooks."})]}),p.jsx(Ns,{title:"Packages",...a.isSuccess?{count:a.data.data.length}:{},description:"Published packages available for use in this environment",...r?{action:p.jsx(p1e,{resourceUri:t})}:{},children:p.jsx(V1e,{onSelectPackage:e,resourceUri:t})}),p.jsx(_1e,{resourceUri:t}),p.jsx(Zxe,{resourceUri:t})]})}function lI({array1:e,array2:t,parser:n=r=>r}){return e&&t&&e.length===t.length&&e.every((r,o)=>n(r)===n(t[o]))}function cI(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Y1e(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:i=!1}=e;return(s,{inputValue:l,getOptionLabel:d})=>{let u=i?l.trim():l;n&&(u=u.toLowerCase()),t&&(u=cI(u));const m=u?s.filter(g=>{let y=(a||d)(g);return n&&(y=y.toLowerCase()),t&&(y=cI(y)),o==="start"?y.startsWith(u):y.includes(u)}):s;return typeof r=="number"?m.slice(0,r):m}}const G1e=Y1e(),uI=5,K1e=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),Q1e=[];function dI(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function X1e(e){const{unstable_isActiveElementInListbox:t=K1e,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,clearOnBlur:s=!e.freeSolo,clearOnEscape:l=!1,componentName:d="useAutocomplete",defaultValue:u=e.multiple?Q1e:null,disableClearable:m=!1,disableCloseOnSelect:g=!1,disabled:y,disabledItemsFocusable:x=!1,disableListWrap:w=!1,filterOptions:S=G1e,filterSelectedOptions:b=!1,freeSolo:$=!1,getOptionDisabled:k,getOptionKey:T,getOptionLabel:O=ge=>ge.label??ge,groupBy:P,handleHomeEndKeys:D=!e.freeSolo,id:A,includeInputInList:F=!1,inputValue:L,isOptionEqualToValue:_=(ge,ye)=>ge===ye,multiple:R=!1,onChange:z,onClose:N,onHighlightChange:B,onInputChange:I,onOpen:H,open:Y,openOnFocus:ae=!1,options:K,readOnly:oe=!1,renderValue:ue,selectOnFocus:G=!e.freeSolo,value:ie}=e,Q=_s(A);let ee=O;ee=ge=>{const ye=O(ge);return typeof ye!="string"?String(ye):ye};const Z=C.useRef(!1),de=C.useRef(!0),le=C.useRef(null),fe=C.useRef(null),[he,me]=C.useState(null),[se,ve]=C.useState(-1),Le=o?0:-1,Ae=C.useRef(Le),Re=C.useRef(dI(u??ie,R,ee)).current,[re,_e]=Ti({controlled:ie,default:u,name:d}),[Me,Ge]=Ti({controlled:L,default:Re,name:d,state:"inputValue"}),[Je,St]=C.useState(!1),Ut=C.useCallback((ge,ye,Ue)=>{if(!(R?re.length<ye.length:ye!==null)&&!s)return;const gt=dI(ye,R,ee,ue);Me!==gt&&(Ge(gt),I&&I(ge,gt,Ue))},[ee,Me,R,I,Ge,s,re,ue]),[at,tt]=Ti({controlled:Y,default:!1,name:d,state:"open"}),[pt,ze]=C.useState(!0),be=!R&&re!=null&&Me===ee(re),Ve=at&&!oe,Oe=Ve?S(K.filter(ge=>!(b&&(R?re:[re]).some(ye=>ye!==null&&_(ge,ye)))),{inputValue:be&&pt?"":Me,getOptionLabel:ee}):[],$t=Pxe({filteredOptions:Oe,value:re,inputValue:Me});C.useEffect(()=>{const ge=re!==$t.value;Je&&!ge||$&&!ge||Ut(null,re,"reset")},[re,Ut,Je,$t.value,$]);const Rt=at&&Oe.length>0&&!oe,vt=Yt(ge=>{if(ge===-1)le.current.focus();else{const ye=ue?"data-item-index":"data-tag-index";he.querySelector(`[${ye}="${ge}"]`).focus()}});C.useEffect(()=>{R&&se>re.length-1&&(ve(-1),vt(-1))},[re,R,se,vt]);function it(ge,ye){if(!fe.current||ge<0||ge>=Oe.length)return-1;let Ue=ge;for(;;){const gt=fe.current.querySelector(`[data-option-index="${Ue}"]`),We=x?!1:!gt||gt.disabled||gt.getAttribute("aria-disabled")==="true";if(gt&&gt.hasAttribute("tabindex")&&!We)return Ue;if(ye==="next"?Ue=(Ue+1)%Oe.length:Ue=(Ue-1+Oe.length)%Oe.length,Ue===ge)return-1}}const st=Yt(({event:ge,index:ye,reason:Ue})=>{if(Ae.current=ye,ye===-1?le.current.removeAttribute("aria-activedescendant"):le.current.setAttribute("aria-activedescendant",`${Q}-option-${ye}`),B&&["mouse","keyboard","touch"].includes(Ue)&&B(ge,ye===-1?null:Oe[ye],Ue),!fe.current)return;const gt=fe.current.querySelector(`[role="option"].${n}-focused`);gt&&(gt.classList.remove(`${n}-focused`),gt.classList.remove(`${n}-focusVisible`));let We=fe.current;if(fe.current.getAttribute("role")!=="listbox"&&(We=fe.current.parentElement.querySelector('[role="listbox"]')),!We)return;if(ye===-1){We.scrollTop=0;return}const Nt=fe.current.querySelector(`[data-option-index="${ye}"]`);if(Nt&&(Nt.classList.add(`${n}-focused`),Ue==="keyboard"&&Nt.classList.add(`${n}-focusVisible`),We.scrollHeight>We.clientHeight&&Ue!=="mouse"&&Ue!=="touch")){const Kt=Nt,hn=We.clientHeight+We.scrollTop,we=Kt.offsetTop+Kt.offsetHeight;we>hn?We.scrollTop=we-We.clientHeight:Kt.offsetTop-Kt.offsetHeight*(P?1.3:0)<We.scrollTop&&(We.scrollTop=Kt.offsetTop-Kt.offsetHeight*(P?1.3:0))}}),Dt=Yt(({event:ge,diff:ye,direction:Ue="next",reason:gt})=>{if(!Ve)return;const We=it((()=>{const Nt=Oe.length-1;if(ye==="reset")return Le;if(ye==="start")return 0;if(ye==="end")return Nt;const Kt=Ae.current+ye;return Kt<0?Kt===-1&&F?-1:w&&Ae.current!==-1||Math.abs(ye)>1?0:Nt:Kt>Nt?Kt===Nt+1&&F?-1:w||Math.abs(ye)>1?Nt:0:Kt})(),Ue);if(st({index:We,reason:gt,event:ge}),r&&ye!=="reset")if(We===-1)le.current.value=Me;else{const Nt=ee(Oe[We]);le.current.value=Nt,Nt.toLowerCase().indexOf(Me.toLowerCase())===0&&Me.length>0&&le.current.setSelectionRange(Me.length,Nt.length)}}),nn=!lI({array1:$t.filteredOptions,array2:Oe,parser:ee}),Bt=()=>{const ge=(ye,Ue)=>{const gt=ye?ee(ye):"",We=Ue?ee(Ue):"";return gt===We};if(Ae.current!==-1&&!lI({array1:$t.filteredOptions,array2:Oe,parser:ee})&&$t.inputValue===Me&&(R?re.length===$t.value.length&&$t.value.every((ye,Ue)=>ee(re[Ue])===ee(ye)):ge($t.value,re))){const ye=$t.filteredOptions[Ae.current];if(ye)return Oe.findIndex(Ue=>ee(Ue)===ee(ye))}return-1},pn=C.useCallback(()=>{if(!Ve)return;const ge=Bt();if(ge!==-1){Ae.current=ge;return}const ye=R?re[0]:re;if(Oe.length===0||ye==null){Dt({diff:"reset"});return}if(fe.current){if(ye!=null){const Ue=Oe[Ae.current];if(R&&Ue&&re.findIndex(We=>_(Ue,We))!==-1)return;const gt=Oe.findIndex(We=>_(We,ye));gt===-1?Dt({diff:"reset"}):st({index:gt});return}if(Ae.current>=Oe.length-1){st({index:Oe.length-1});return}st({index:Ae.current})}},[Oe.length,R?!1:re,b,Dt,st,Ve,Me,R]),$n=Yt(ge=>{Vk(fe,ge),ge&&pn()});C.useEffect(()=>{nn&&pn()},[pn,nn]);const qt=ge=>{at||(tt(!0),ze(!0),H&&H(ge))},Pn=(ge,ye)=>{at&&(tt(!1),N&&N(ge,ye))},Se=(ge,ye,Ue,gt)=>{if(R){if(re.length===ye.length&&re.every((We,Nt)=>We===ye[Nt]))return}else if(re===ye)return;z&&z(ge,ye,Ue,gt),_e(ye)},jn=C.useRef(!1),Rn=(ge,ye,Ue="selectOption",gt="options")=>{let We=Ue,Nt=ye;if(R){Nt=Array.isArray(re)?re.slice():[];const Kt=Nt.findIndex(hn=>_(ye,hn));Kt===-1?Nt.push(ye):gt!=="freeSolo"&&(Nt.splice(Kt,1),We="removeOption")}Ut(ge,Nt,We),Se(ge,Nt,We,{option:ye}),!g&&(!ge||!ge.ctrlKey&&!ge.metaKey)&&Pn(ge,We),(i===!0||i==="touch"&&jn.current||i==="mouse"&&!jn.current)&&le.current.blur()};function en(ge,ye){if(ge===-1)return-1;let Ue=ge;for(;;){if(ye==="next"&&Ue===re.length||ye==="previous"&&Ue===-1)return-1;const gt=ue?"data-item-index":"data-tag-index",We=he.querySelector(`[${gt}="${Ue}"]`);if(!We||!We.hasAttribute("tabindex")||We.disabled||We.getAttribute("aria-disabled")==="true")Ue+=ye==="next"?1:-1;else return Ue}}const jt=(ge,ye)=>{if(!R)return;Me===""&&Pn(ge,"toggleInput");let Ue=se;se===-1?Me===""&&ye==="previous"&&(Ue=re.length-1):(Ue+=ye==="next"?1:-1,Ue<0&&(Ue=0),Ue===re.length&&(Ue=-1)),Ue=en(Ue,ye),ve(Ue),vt(Ue)},Ur=ge=>{Z.current=!0,Ge(""),I&&I(ge,"","clear"),Se(ge,R?[]:null,"clear")},qn=ge=>ye=>{if(ge.onKeyDown&&ge.onKeyDown(ye),!ye.defaultMuiPrevented&&(se!==-1&&!["ArrowLeft","ArrowRight"].includes(ye.key)&&(ve(-1),vt(-1)),ye.which!==229))switch(ye.key){case"Home":Ve&&D&&(ye.preventDefault(),Dt({diff:"start",direction:"next",reason:"keyboard",event:ye}));break;case"End":Ve&&D&&(ye.preventDefault(),Dt({diff:"end",direction:"previous",reason:"keyboard",event:ye}));break;case"PageUp":ye.preventDefault(),Dt({diff:-uI,direction:"previous",reason:"keyboard",event:ye}),qt(ye);break;case"PageDown":ye.preventDefault(),Dt({diff:uI,direction:"next",reason:"keyboard",event:ye}),qt(ye);break;case"ArrowDown":ye.preventDefault(),Dt({diff:1,direction:"next",reason:"keyboard",event:ye}),qt(ye);break;case"ArrowUp":ye.preventDefault(),Dt({diff:-1,direction:"previous",reason:"keyboard",event:ye}),qt(ye);break;case"ArrowLeft":!R&&ue?vt(0):jt(ye,"previous");break;case"ArrowRight":!R&&ue?vt(-1):jt(ye,"next");break;case"Enter":if(Ae.current!==-1&&Ve){const Ue=Oe[Ae.current],gt=k?k(Ue):!1;if(ye.preventDefault(),gt)return;Rn(ye,Ue,"selectOption"),r&&le.current.setSelectionRange(le.current.value.length,le.current.value.length)}else $&&Me!==""&&be===!1&&(R&&ye.preventDefault(),Rn(ye,Me,"createOption","freeSolo"));break;case"Escape":Ve?(ye.preventDefault(),ye.stopPropagation(),Pn(ye,"escape")):l&&(Me!==""||R&&re.length>0||ue)&&(ye.preventDefault(),ye.stopPropagation(),Ur(ye));break;case"Backspace":if(R&&!oe&&Me===""&&re.length>0){const Ue=se===-1?re.length-1:se,gt=re.slice();gt.splice(Ue,1),Se(ye,gt,"removeOption",{option:re[Ue]})}!R&&ue&&!oe&&(_e(null),vt(-1));break;case"Delete":if(R&&!oe&&Me===""&&re.length>0&&se!==-1){const Ue=se,gt=re.slice();gt.splice(Ue,1),Se(ye,gt,"removeOption",{option:re[Ue]})}!R&&ue&&!oe&&(_e(null),vt(-1));break}},mn=ge=>{St(!0),ae&&!Z.current&&qt(ge)},Bn=ge=>{if(t(fe)){le.current.focus();return}St(!1),de.current=!0,Z.current=!1,a&&Ae.current!==-1&&Ve?Rn(ge,Oe[Ae.current],"blur"):a&&$&&Me!==""?Rn(ge,Me,"blur","freeSolo"):s&&Ut(ge,re,"blur"),Pn(ge,"blur")},xe=ge=>{const ye=ge.target.value;Me!==ye&&(Ge(ye),ze(!1),I&&I(ge,ye,"input")),ye===""?!m&&!R&&Se(ge,null,"clear"):qt(ge)},Ee=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Ae.current!==ye&&st({event:ge,index:ye,reason:"mouse"})},Be=ge=>{st({event:ge,index:Number(ge.currentTarget.getAttribute("data-option-index")),reason:"touch"}),jn.current=!0},Ye=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Rn(ge,Oe[ye],"selectOption"),jn.current=!1},ut=ge=>ye=>{const Ue=re.slice();Ue.splice(ge,1),Se(ye,Ue,"removeOption",{option:re[ge]})},Et=ge=>{Se(ge,null,"removeOption",{option:re})},Ct=ge=>{at?Pn(ge,"toggleInput"):qt(ge)},Mt=ge=>{ge.currentTarget.contains(ge.target)&&ge.target.getAttribute("id")!==Q&&ge.preventDefault()},Lt=ge=>{ge.currentTarget.contains(ge.target)&&(le.current.focus(),G&&de.current&&le.current.selectionEnd-le.current.selectionStart===0&&le.current.select(),de.current=!1)},Xt=ge=>{!y&&(Me===""||!at)&&Ct(ge)};let zt=$&&Me.length>0;zt=zt||(R?re.length>0:re!==null);let Vt=Oe;return P&&(Vt=Oe.reduce((ge,ye,Ue)=>{const gt=P(ye);return ge.length>0&&ge[ge.length-1].group===gt?ge[ge.length-1].options.push(ye):ge.push({key:Ue,index:Ue,group:gt,options:[ye]}),ge},[])),y&&Je&&Bn(),{getRootProps:(ge={})=>({...ge,onKeyDown:qn(ge),onMouseDown:Mt,onClick:Lt}),getInputLabelProps:()=>({id:`${Q}-label`,htmlFor:Q}),getInputProps:()=>({id:Q,value:Me,onBlur:Bn,onFocus:mn,onChange:xe,onMouseDown:Xt,"aria-activedescendant":Ve?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Rt?`${Q}-listbox`:void 0,"aria-expanded":Rt,autoComplete:"off",ref:le,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:y}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Ur}),getItemProps:({index:ge=0}={})=>({...R&&{key:ge},...ue?{"data-item-index":ge}:{"data-tag-index":ge},tabIndex:-1,...!oe&&{onDelete:R?ut(ge):Et}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:Ct}),getTagProps:({index:ge})=>({key:ge,"data-tag-index":ge,tabIndex:-1,...!oe&&{onDelete:ut(ge)}}),getListboxProps:()=>({role:"listbox",id:`${Q}-listbox`,"aria-labelledby":`${Q}-label`,ref:$n,onMouseDown:ge=>{ge.preventDefault()}}),getOptionProps:({index:ge,option:ye})=>{const Ue=(R?re:[re]).some(We=>We!=null&&_(ye,We)),gt=k?k(ye):!1;return{key:T?.(ye)??ee(ye),tabIndex:-1,role:"option",id:`${Q}-option-${ge}`,onMouseMove:Ee,onClick:Ye,onTouchStart:Be,"data-option-index":ge,"aria-disabled":gt,"aria-selected":Ue}},id:Q,inputValue:Me,value:re,dirty:zt,expanded:Ve&&he,popupOpen:Ve,focused:Je||se!==-1,anchorEl:he,setAnchorEl:me,focusedItem:se,focusedTag:se,groupedOptions:Vt}}function Z1e(e){return Cn("MuiListSubheader",e)}fn("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const J1e=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,i={root:["root",n!=="default"&&`color${Tt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return bn(i,Z1e,t)},ewe=nt("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Tt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(Gn(({theme:e})=>({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.inset,style:{paddingLeft:72}},{props:({ownerState:t})=>!t.disableSticky,style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),k$=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:i=!1,disableSticky:s=!1,inset:l=!1,...d}=n,u={...n,color:o,component:a,disableGutters:i,disableSticky:s,inset:l},m=J1e(u);return p.jsx(ewe,{as:a,className:Ht(m.root,r),ref:t,ownerState:u,...d})});k$&&(k$.muiSkipListHighlight=!0);const twe=Jt(p.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function nwe(e){return Cn("MuiAutocomplete",e)}const Jn=fn("MuiAutocomplete",["root","expanded","fullWidth","focused","focusVisible","tag","tagSizeSmall","tagSizeMedium","hasPopupIcon","hasClearIcon","inputRoot","input","inputFocused","endAdornment","clearIndicator","popupIndicator","popupIndicatorOpen","popper","popperDisablePortal","paper","listbox","loading","noOptions","option","groupLabel","groupUl"]);var fI,pI;const rwe=e=>{const{classes:t,disablePortal:n,expanded:r,focused:o,fullWidth:a,hasClearIcon:i,hasPopupIcon:s,inputFocused:l,popupOpen:d,size:u}=e,m={root:["root",r&&"expanded",o&&"focused",a&&"fullWidth",i&&"hasClearIcon",s&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",l&&"inputFocused"],tag:["tag",`tagSize${Tt(u)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",d&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return bn(m,nwe,t)},owe=nt("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:i,size:s}=n;return[{[`& .${Jn.tag}`]:t.tag},{[`& .${Jn.tag}`]:t[`tagSize${Tt(s)}`]},{[`& .${Jn.inputRoot}`]:t.inputRoot},{[`& .${Jn.input}`]:t.input},{[`& .${Jn.input}`]:i&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Jn.focused} .${Jn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Jn.clearIndicator}`]:{visibility:"visible"}},[`& .${Jn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Jn.inputRoot}`]:{[`.${Jn.hasPopupIcon}&, .${Jn.hasClearIcon}&`]:{paddingRight:30},[`.${Jn.hasPopupIcon}.${Jn.hasClearIcon}&`]:{paddingRight:56},[`& .${Jn.input}`]:{width:0,minWidth:30}},[`& .${au.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${au.root}.${bi.sizeSmall}`]:{[`& .${au.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Wi.root}`]:{padding:9,[`.${Jn.hasPopupIcon}&, .${Jn.hasClearIcon}&`]:{paddingRight:39},[`.${Jn.hasPopupIcon}.${Jn.hasClearIcon}&`]:{paddingRight:65},[`& .${Jn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Jn.endAdornment}`]:{right:9}},[`& .${Wi.root}.${bi.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Jn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${xi.root}`]:{paddingTop:19,paddingLeft:8,[`.${Jn.hasPopupIcon}&, .${Jn.hasClearIcon}&`]:{paddingRight:39},[`.${Jn.hasPopupIcon}.${Jn.hasClearIcon}&`]:{paddingRight:65},[`& .${xi.input}`]:{padding:"7px 4px"},[`& .${Jn.endAdornment}`]:{right:9}},[`& .${xi.root}.${bi.sizeSmall}`]:{paddingBottom:1,[`& .${xi.input}`]:{padding:"2.5px 4px"}},[`& .${bi.hiddenLabel}`]:{paddingTop:8},[`& .${xi.root}.${bi.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Jn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${xi.root}.${bi.hiddenLabel}.${bi.sizeSmall}`]:{[`& .${Jn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Jn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Jn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Jn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Jn.inputRoot}`]:{flexWrap:"wrap"}}}]}),awe=nt("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),iwe=nt(Tu,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),swe=nt(Tu,{name:"MuiAutocomplete",slot:"PopupIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen]}})({padding:2,marginRight:-2,variants:[{props:{popupOpen:!0},style:{transform:"rotate(180deg)"}}]}),lwe=nt(L2,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Jn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(Gn(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),cwe=nt(tf,{name:"MuiAutocomplete",slot:"Paper"})(Gn(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),uwe=nt("div",{name:"MuiAutocomplete",slot:"Loading"})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),dwe=nt("div",{name:"MuiAutocomplete",slot:"NoOptions"})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),fwe=nt("ul",{name:"MuiAutocomplete",slot:"Listbox"})(Gn(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Jn.option}`]:{minHeight:48,display:"flex",overflow:"hidden",justifyContent:"flex-start",alignItems:"center",cursor:"pointer",paddingTop:6,boxSizing:"border-box",outline:"0",WebkitTapHighlightColor:"transparent",paddingBottom:6,paddingLeft:16,paddingRight:16,[e.breakpoints.up("sm")]:{minHeight:"auto"},[`&.${Jn.focused}`]:{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},'&[aria-disabled="true"]':{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:"none"},[`&.${Jn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Jn.focused}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Jn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),pwe=nt(k$,{name:"MuiAutocomplete",slot:"GroupLabel"})(Gn(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),hwe=nt("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Jn.option}`]:{paddingLeft:24}}),mwe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,ChipProps:s,className:l,clearIcon:d=fI||(fI=p.jsx(twe,{fontSize:"small"})),clearOnBlur:u=!n.freeSolo,clearOnEscape:m=!1,clearText:g="Clear",closeText:y="Close",componentsProps:x,defaultValue:w=n.multiple?[]:null,disableClearable:S=!1,disableCloseOnSelect:b=!1,disabled:$=!1,disabledItemsFocusable:k=!1,disableListWrap:T=!1,disablePortal:O=!1,filterOptions:P,filterSelectedOptions:D=!1,forcePopupIcon:A="auto",freeSolo:F=!1,fullWidth:L=!1,getLimitTagsText:_=we=>`+${we}`,getOptionDisabled:R,getOptionKey:z,getOptionLabel:N,isOptionEqualToValue:B,groupBy:I,handleHomeEndKeys:H=!n.freeSolo,id:Y,includeInputInList:ae=!1,inputValue:K,limitTags:oe=-1,ListboxComponent:ue,ListboxProps:G,loading:ie=!1,loadingText:Q="Loading…",multiple:ee=!1,noOptionsText:Z="No options",onChange:de,onClose:le,onHighlightChange:fe,onInputChange:he,onOpen:me,open:se,openOnFocus:ve=!1,openText:Le="Open",options:Ae,PaperComponent:Re,PopperComponent:re,popupIcon:_e=pI||(pI=p.jsx(W3,{})),readOnly:Me=!1,renderGroup:Ge,renderInput:Je,renderOption:St,renderTags:Ut,renderValue:at,selectOnFocus:tt=!n.freeSolo,size:pt="medium",slots:ze={},slotProps:be={},value:Ve,...Oe}=n,{getRootProps:$t,getInputProps:Rt,getInputLabelProps:vt,getPopupIndicatorProps:it,getClearProps:st,getItemProps:Dt,getListboxProps:nn,getOptionProps:Bt,value:pn,dirty:$n,expanded:qt,id:Pn,popupOpen:Se,focused:jn,focusedItem:Rn,anchorEl:en,setAnchorEl:jt,inputValue:Ur,groupedOptions:qn}=X1e({...n,componentName:"Autocomplete"}),mn=!S&&!$&&$n&&!Me,Bn=(!F||A===!0)&&A!==!1,{onMouseDown:xe}=Rt(),{ref:Ee,...Be}=nn(),Ye=N||(we=>we.label??we),ut={...n,disablePortal:O,expanded:qt,focused:jn,fullWidth:L,getOptionLabel:Ye,hasClearIcon:mn,hasPopupIcon:Bn,inputFocused:Rn===-1,popupOpen:Se,size:pt},Et=rwe(ut),Ct={slots:{paper:Re,popper:re,...ze},slotProps:{chip:s,listbox:G,...x,...be}},[Mt,Lt]=ur("listbox",{elementType:fwe,externalForwardedProps:Ct,ownerState:ut,className:Et.listbox,additionalProps:Be,ref:Ee}),[Xt,zt]=ur("paper",{elementType:tf,externalForwardedProps:Ct,ownerState:ut,className:Et.paper}),[Vt,ge]=ur("popper",{elementType:L2,externalForwardedProps:Ct,ownerState:ut,className:Et.popper,additionalProps:{disablePortal:O,style:{width:en?en.clientWidth:null},role:"presentation",anchorEl:en,open:Se}});let ye;const Ue=we=>({className:Et.tag,disabled:$,...Dt(we)});if(ee?pn.length>0&&(Ut?ye=Ut(pn,Ue,ut):at?ye=at(pn,Ue,ut):ye=pn.map((we,Pe)=>{const{key:ft,...kt}=Ue({index:Pe});return p.jsx(A3,{label:Ye(we),size:pt,...kt,...Ct.slotProps.chip},ft)})):at&&pn!=null&&(ye=at(pn,Ue,ut)),oe>-1&&Array.isArray(ye)){const we=ye.length-oe;!jn&&we>0&&(ye=ye.splice(0,oe),ye.push(p.jsx("span",{className:Et.tag,children:_(we)},ye.length)))}const gt=Ge||(we=>p.jsxs("li",{children:[p.jsx(pwe,{className:Et.groupLabel,ownerState:ut,component:"div",children:we.group}),p.jsx(hwe,{className:Et.groupUl,ownerState:ut,children:we.children})]},we.key)),We=St||((we,Pe)=>{const{key:ft,...kt}=we;return p.jsx("li",{...kt,children:Ye(Pe)},ft)}),Nt=(we,Pe)=>{const ft=Bt({option:we,index:Pe});return We({...ft,className:Et.option},we,{selected:ft["aria-selected"],index:Pe,inputValue:Ur},ut)},Kt=Ct.slotProps.clearIndicator,hn=Ct.slotProps.popupIndicator;return p.jsxs(C.Fragment,{children:[p.jsx(owe,{ref:t,className:Ht(Et.root,l),ownerState:ut,...$t(Oe),children:Je({id:Pn,disabled:$,fullWidth:!0,size:pt==="small"?"small":void 0,InputLabelProps:vt(),InputProps:{ref:jt,className:Et.inputRoot,startAdornment:ye,onMouseDown:we=>{we.target===we.currentTarget&&xe(we)},...(mn||Bn)&&{endAdornment:p.jsxs(awe,{className:Et.endAdornment,ownerState:ut,children:[mn?p.jsx(iwe,{...st(),"aria-label":g,title:g,ownerState:ut,...Kt,className:Ht(Et.clearIndicator,Kt?.className),children:d}):null,Bn?p.jsx(swe,{...it(),disabled:$,"aria-label":Se?y:Le,title:Se?y:Le,ownerState:ut,...hn,className:Ht(Et.popupIndicator,hn?.className),children:_e}):null]})}},inputProps:{className:Et.input,disabled:$,readOnly:Me,...Rt()}})}),en?p.jsx(lwe,{as:Vt,...ge,children:p.jsxs(cwe,{as:Xt,...zt,children:[ie&&qn.length===0?p.jsx(uwe,{className:Et.loading,ownerState:ut,children:Q}):null,qn.length===0&&!F&&!ie?p.jsx(dwe,{className:Et.noOptions,ownerState:ut,role:"presentation",onMouseDown:we=>{we.preventDefault()},children:Z}):null,qn.length>0?p.jsx(Mt,{as:ue,...Lt,children:qn.map((we,Pe)=>I?gt({key:we.key,group:we.group,children:we.options.map((ft,kt)=>Nt(ft,we.index+kt))}):Nt(we,Pe))}):null]})}):null]})});Ar.extend(h2);const gwe=Jt(p.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),l6=e=>{if(!e)return"Explore semantic models, run queries, and build reports";const t=e.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),n=t.split(/\n\s*\n/)[1]||t;if(n.length<=120)return n;const r=n.substring(0,120).split(" ");return r.pop(),r.join(" ")+"..."},c6=(e,t)=>{const n=(e.readme||void 0)?.split(`
478
+ `}function Ixe(e,t){return[e,"rows",...t].join("_").replace(/[^A-Za-z0-9._-]+/g,"_").replace(/_+/g,"_").replace(/^[_.]+|[_.]+$/g,"").slice(0,120)||"rows"}function Lxe(e,t,n){return n==="server_default"&&t!==void 0&&e>=t?t:void 0}const KN="Download the rows behind this value as CSV, up to the server's row limit",zxe=4e4;function Fxe(e,t){const n=URL.createObjectURL(new Blob([e],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),zxe)}function _xe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The request failed."}function Bxe({query:e,preamble:t,environmentName:n,packageName:r,modelPath:o,versionId:a,givens:i,fileName:s}){const{apiClients:l}=tr(),[d,u]=C.useState(!1),[m,g]=C.useState(KN),[y,x]=C.useState(void 0),w=C.useRef(void 0);C.useEffect(()=>()=>w.current?.abort(),[]);const S=async()=>{w.current?.abort();const b=new AbortController;w.current=b,u(!0),x(void 0);try{const $=await l.models.executeQueryModel(n,r,o,{query:t===void 0?e:v1(t,e),givens:i,versionId:a},void 0,{signal:b.signal});if(b.signal.aborted)return;const k=$.data,T=JSON.parse(k.result??"{}"),O=Lxe(J_(T).length,k.queryRowLimit,k.queryRowLimitSource);g(O===void 0?KN:`First ${O} rows: the server's row limit, so there may be more`),Fxe(Nxe(T),O===void 0?`${s}.csv`:`${s}_first_${O}_rows_server_limit.csv`)}catch($){if(b.signal.aborted)return;x(`Download failed: ${_xe($)}`)}finally{w.current===b&&(w.current=void 0,u(!1))}};return p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:1},children:[y&&p.jsx(wt,{role:"alert",variant:"caption",color:"error",sx:{maxWidth:320},children:y}),p.jsx(Br,{title:m,children:p.jsx("span",{children:p.jsx(Vn,{size:"small",startIcon:p.jsx(Axe,{fontSize:"small"}),onClick:()=>void S(),disabled:d,children:"Download CSV"})})})]})}const e6=200;function Uxe(e){const{target:t}=e;if(t!==void 0&&!(e.dimensions===void 0&&e.code===void 0))return{...e,target:t}}function QN(e,t=e6){const n=Hxe(e);if(n===void 0)return;const r=[...e.target.filters,...n].join(", "),o=e.timezone?`timezone: '${p2(e.timezone)}'; `:"",a=t===null?"":`; limit: ${t}`,i=qxe(e.target.source);if(i!==void 0)return`run: ${i} -> { ${o}where: ${r}; select: *${a} }`}function qxe(e){return Wy(e)?e:e.includes("`")?void 0:`\`${e}\``}function EC(e){return/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(e)?e:`(${e})`}function Hxe(e){if(e.dimensions){const n=[];for(const{code:r,value:o}of e.dimensions){if(o.kind==="null_literal"){n.push(`${EC(r)} is null`);continue}const a=H_(o,e.timezone);if(a===void 0)return;n.push(`${EC(r)} = ${a}`)}return n}const t=Zle(e.rawValue);return e.code!==void 0&&t?[`${EC(e.code)} = ${t}`]:void 0}const Vxe="This value cannot be written as a filter, so its rows cannot be fetched.";function XN(e){const t=e.drillClauses?q_(e.drillClauses,e.timezone):[];return t.length>0?t:[{field:e.field,label:e.label}]}function Wxe({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,preamble:a,givens:i,onClose:s,onDone:l,actions:d}){const{theme:u}=Vr(),m=e?QN(e):void 0,g=e?QN(e,null):void 0,y=e&&g!==void 0?{query:g,...a===void 0?{}:{preamble:a},environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},givens:i,fileName:Ixe(e.target.source,XN(e).map(x=>x.label))}:void 0;return p.jsxs(zx,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[p.jsxs(_x,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[p.jsxs(Te,{children:[e?p.jsxs(p.Fragment,{children:["Rows where"," ",XN(e).map((x,w)=>p.jsxs(C.Fragment,{children:[w>0&&" and ",p.jsx(Te,{component:"code",sx:{fontSize:"0.9em"},children:x.field})," ","is ",x.label]},w))]}):"Rows",p.jsx(wt,{component:"div",variant:"caption",sx:{color:u.tileTitle,mt:.25},children:e?`The first ${e6} rows of ${e.target.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[y&&(d?d(y):p.jsx(Bxe,{...y})),p.jsx(ro,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary"},children:p.jsx(xh,{fontSize:"small"})})]})]}),p.jsxs(Fx,{dividers:!0,sx:{p:0,minHeight:240},children:[m===void 0&&e&&p.jsx(wt,{variant:"body2",sx:{p:2},children:Vxe}),m!==void 0&&p.jsx(Yxe,{query:a===void 0?m:v1(a,m),environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:i,...l?{onDone:l}:{}})]}),p.jsxs(pz,{sx:{px:3,py:1.5},children:[m!==void 0&&p.jsx(wt,{variant:"caption",sx:{mr:"auto",color:u.tileTitle,fontFamily:u.ui.font.mono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m,children:m}),p.jsx(Vn,{onClick:s,children:"Close"})]})]})}function Yxe({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:i}){const s=rT({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:a}),{isSuccess:l,isError:d}=s,u=C.useRef(void 0);return C.useEffect(()=>{u.current=Pd()},[e]),C.useEffect(()=>{u.current===void 0||!l&&!d||(i?.(l,Pd()-u.current),u.current=void 0)},[l,d,i]),p.jsx(Te,{sx:{p:1},children:p.jsx(X2,{state:s,context:e})})}function t6({manifest:e,environmentName:t,packageName:n,versionId:r,documentName:o,givens:a,onGivensChange:i,onNavigate:s,height:l,maxResultSize:d,controlsLayout:u="bar",preamble:m,runModelPath:g,hiddenGivens:y,literalReads:x,onLinkNavigate:w,actions:S,rowsActions:b}){const $=C.useMemo(()=>w?{environmentName:t,packageName:n,sourcePath:e.path??o,onNavigate:w}:void 0,[t,n,e.path,o,w]),k=C.useMemo(()=>(e.givens??[]).filter(le=>!(m!==void 0&&le.secure===!0)&&!(le.name!==void 0&&y?.includes(le.name))),[e,y,m]),T=C.useMemo(()=>a===void 0?void 0:Object.fromEntries(Object.entries(a).filter(([,le])=>typeof le=="string")),[a]),O=b2({specs:k,loaded:!0,startingValues:e.startingGivens,params:T,onGivensChange:i,documentKey:`${t}/${n}/${r??""}/${o}`,autorun:e.autorun!==!1,environmentName:t,packageName:n,modelPath:g??e.path,versionId:r,documentName:o,...m!==void 0?{preamble:m}:{},...a?{hostGivens:a}:{}}),{applied:P,declaredTypes:D,canSelf:A,onSelf:F}=O,L=g1(),_=C.useMemo(()=>{const le=new Set((e.tiles??[]).flatMap(fe=>fe.givenNames??[]));return Object.fromEntries(Object.entries(a??{}).filter(([fe])=>le.has(fe)&&!D.has(fe)))},[e,a,D]),[R,z]=C.useState(void 0),N=C.useCallback(le=>{const fe=Uxe(le);fe!==void 0&&z(fe)},[]),B=C.useMemo(()=>y2(Jd(P,D),_),[P,D,_]),{reports:I}=C_(t,n,r,s!==void 0),H=C.useCallback(le=>{const fe=E0e(le,I);if(fe.kind!=="path")return;const he=fe.report.path;return I.find(me=>me.path===he)?.title||void 0},[I]),{bindingFor:Y,drillMenu:ae}=Z_({onNavigate:s,onSelf:F,canSelf:A,onRows:N,destinationTitle:H}),K=C.useCallback((le,fe)=>Y(le,fe!==!0),[Y]),{columns:oe,layout:ue,tileMaxHeight:G,tableMaxHeight:ie}=qle(e.layout,e.dashboardColumns),Q=C.useMemo(()=>Ybe(k,P,a),[k,P,a]);if(e.error)return p.jsx(b$,{layout:ue,header:p.jsx(ZN,{manifest:e,links:$,actions:S}),children:p.jsx(lo,{severity:"error",children:e.error})});const ee=g??e.path,Z=e.tiles??[],de=uF(Z);return p.jsxs(b$,{layout:ue,header:p.jsx(ZN,{manifest:e,links:$,actions:S}),controls:k.length>0?p.jsx(T_,{children:p.jsx(j1,{...O.panel,layout:u})}):void 0,children:[Q.length>0&&p.jsx(lo,{severity:"info",children:Kbe(Q)}),ee===void 0?p.jsx(lo,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):Z.length>0?p.jsx(ile,{tiles:Z,columns:oe,minTilePx:sF,rowGapPx:vl,keyOf:(le,fe)=>`${fe}:${le.kind==="text"?`text:${le.name}`:le.query}`,renderTile:(le,fe)=>le.kind==="text"||le.query===void 0?p.jsx(Te,{sx:le.rowspan!==void 0||de?{minHeight:0,overflow:"auto"}:void 0,children:p.jsx(Gxe,{markdown:le.markdown??"",links:$})}):p.jsx(B_,{index:fe,environmentName:t,packageName:n,versionId:r,modelPath:ee,tile:le.query,label:le.label,subtitle:le.subtitle,borderless:le.borderless,givens:P,hostGivens:_,declaredTypes:D,givenNames:le.givenNames,height:le.rowspan!==void 0||de?iF(le.rowspan??cF.query):ue==="grid"?l??G:G,tableMaxHeight:ie,fixedHeight:le.rowspan!==void 0||de,maxResultSize:d,drill:K(le.query,le.restricted),ignoredFilters:b0e(le.givenNames&&(le.query&&x?.[le.query]?[...le.givenNames,...x[le.query]]:le.givenNames),k),...m!==void 0?{preamble:m,restricted:le.restricted}:{},...(()=>{const he=Gbe(Q,le.givenNames);return he.length>0?{waitingFor:Qbe(he)}:{}})()})}):p.jsx(lo,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),ae,ee!==void 0&&p.jsx(Wxe,{request:R,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:ee,...m===void 0?{}:{preamble:m},givens:B,...b===void 0?{}:{actions:b},onClose:()=>z(void 0),onDone:(le,fe)=>{R&&L.emit({type:"report.rows_shown",source:R.target.source,view:R.target.queryName??"",field:R.field,ok:le,durationMs:fe})}})]})}function Gxe({markdown:e,links:t}){return p.jsx(N1,{children:p.jsx(oh,{variant:"document",links:t,children:e})})}function ZN({manifest:e,links:t,actions:n}){return p.jsx(R_,{title:e.title??e.name,actions:n,description:e.description?p.jsx(N1,{children:p.jsx(oh,{variant:"document",links:t,children:e.description})}):void 0})}const n6=Jt(p.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Kxe="publisher:resize";function Qxe(e){return typeof e=="object"&&e!==null&&e.type===Kxe&&typeof e.height=="number"}function r6(e){return e.replace(/\/api\/v0\/?$/,"")}function Xxe({server:e,environmentName:t,packageName:n,path:r,versionId:o}){const a=r.startsWith("public/")?r.slice(7):r,i=`${r6(e)}/environments/${encodeURIComponent(t)}/packages/${encodeURIComponent(n)}/`+a;return o===void 0?i:`${i}${i.includes("?")?"&":"?"}versionId=${encodeURIComponent(o)}`}function Zxe(e){try{const{environmentName:t,packageName:n,modelPath:r,versionId:o}=Xr(e);return!t||!n||!r?null:{environmentName:t,packageName:n,dataAppPath:r,versionId:o}}catch{return null}}function YTe({resourceUri:e}){const{server:t,apiClients:n}=tr(),r=Zxe(e),o=r?.environmentName??"",a=r?.packageName??"",i=r?.dataAppPath??"",s=r?.versionId,l=C.useMemo(()=>Xxe({server:t,environmentName:o,packageName:a,path:i,...s!==void 0?{versionId:s}:{}}),[t,o,a,i,s]),d=co({queryKey:["data-apps",o,a,s],queryFn:()=>n.dataApps.listDataApps(o,a,s),enabled:!!r}).data?.data?.find(w=>w.path===i),u=d?.title??i,m=d?.fit==="viewport",g=C.useRef(null),[y,x]=C.useState(120);return C.useEffect(()=>{if(m)return;function w(S){Qxe(S.data)&&S.source===g.current?.contentWindow&&S.data.height>0&&x(Math.ceil(S.data.height))}return window.addEventListener("message",w),()=>window.removeEventListener("message",w)},[m]),r?p.jsxs(Te,{sx:{p:3,...m?{height:"100%",display:"flex",flexDirection:"column"}:{maxWidth:1600,mx:"auto"}},children:[p.jsxs(Yn,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1,flexShrink:0},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium",letterSpacing:"-0.025em"},children:u}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo},children:i}),p.jsx(Te,{sx:{flex:1}}),p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(ro,{size:"small",href:l,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",sx:{color:"text.secondary"},children:p.jsx(n6,{fontSize:"small"})})})]}),p.jsx(Te,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",backgroundColor:"background.paper",...m?{flex:1,minHeight:0}:{}},children:p.jsx("iframe",{ref:g,src:l,title:u,sandbox:"allow-scripts allow-same-origin allow-forms",style:{display:"block",width:"100%",height:m?"100%":y,border:0}})})]}):p.jsxs(Te,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Can't open data app"}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["This data app link is missing an environment, package, or path:",p.jsx(Te,{component:"span",sx:{fontFamily:Fo,ml:1},children:e})]})]})}function Ns({title:e,count:t,description:n,action:r,children:o}){const a=C.useId();return p.jsxs(Te,{component:"section","aria-labelledby":a,sx:{mb:4},children:[p.jsxs(Yn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:n?0:1,minHeight:40},children:[p.jsxs(Yn,{direction:"row",alignItems:"baseline",spacing:1,children:[p.jsx(wt,{id:a,variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em",lineHeight:1.2},children:e}),t!==void 0&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),r]}),n&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:n}),p.jsx(Te,{children:o})]})}function Jxe({resourceUri:e}){const{environmentName:t}=Xr(e),{apiClients:n}=tr(),[r,o]=C.useState(!1),a=90,{data:i,isSuccess:s,isError:l,error:d}=co({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),u=i?.data?.readme||"",m=u.split(/\s+/),g=m.length>a,y=m.slice(0,a).join(" ");return p.jsxs(p.Fragment,{children:[!s&&!l&&p.jsx(Bo,{text:"Fetching About..."}),s&&u&&p.jsxs(Ns,{title:"Readme",children:[p.jsx(oh,{variant:"caption",children:r||!g?u:y}),g&&p.jsx(Te,{sx:{mt:1},children:p.jsx(Xy,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),l&&p.jsx(ja,{error:d,context:`${t} > About`})]})}function e1e(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,i=w2();C.useEffect(()=>{if(!o)return;function S(b){b.defaultPrevented||b.key==="Escape"&&r?.(b,"escapeKeyDown")}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[o,r]);const s=Yt((S,b)=>{r?.(S,b)}),l=Yt(S=>{!r||S==null||i.start(S,()=>{s(null,"timeout")})});C.useEffect(()=>(o&&l(t),i.clear),[o,t,l,i]);const d=S=>{r?.(S,"clickaway")},u=i.clear,m=C.useCallback(()=>{t!=null&&l(a??t*.5)},[t,a,l]),g=S=>b=>{const $=S.onBlur;$?.(b),m()},y=S=>b=>{const $=S.onFocus;$?.(b),u()},x=S=>b=>{const $=S.onMouseEnter;$?.(b),u()},w=S=>b=>{const $=S.onMouseLeave;$?.(b),m()};return C.useEffect(()=>{if(!n&&o)return window.addEventListener("focus",m),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",u)}},[n,o,m,u]),{getRootProps:(S={})=>{const b={...q0(e),...q0(S)};return{role:"presentation",...S,...b,onBlur:g(b),onFocus:y(b),onMouseEnter:x(b),onMouseLeave:w(b)}},onClickAway:d}}function JN(e){return e.substring(2).toLowerCase()}function t1e(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function n1e(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,i=C.useRef(!1),s=C.useRef(null),l=C.useRef(!1),d=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{l.current=!0},0),()=>{l.current=!1}),[]);const u=vr(wh(t),s),m=Yt(x=>{const w=d.current;d.current=!1;const S=Yo(s.current);if(!l.current||!s.current||"clientX"in x&&t1e(x,S))return;if(i.current){i.current=!1;return}let b;x.composedPath?b=x.composedPath().includes(s.current):b=!S.documentElement.contains(x.target)||s.current.contains(x.target),!b&&(n||!w)&&o(x)}),g=x=>w=>{d.current=!0;const S=t.props[x];S&&S(w)},y={ref:u};return a!==!1&&(y[a]=g(a)),C.useEffect(()=>{if(a!==!1){const x=JN(a),w=Yo(s.current),S=()=>{i.current=!0};return w.addEventListener(x,m),w.addEventListener("touchmove",S),()=>{w.removeEventListener(x,m),w.removeEventListener("touchmove",S)}}},[m,a]),r!==!1&&(y[r]=g(r)),C.useEffect(()=>{if(r!==!1){const x=JN(r),w=Yo(s.current);return w.addEventListener(x,m),()=>{w.removeEventListener(x,m)}}},[m,r]),C.cloneElement(t,y)}function r1e(e){return Cn("MuiSnackbarContent",e)}fn("MuiSnackbarContent",["root","message","action"]);const o1e=e=>{const{classes:t}=e;return bn({root:["root"],action:["action"],message:["message"]},r1e,t)},a1e=nt(tf,{name:"MuiSnackbarContent",slot:"Root"})(Gn(({theme:e})=>{const t=e.palette.mode==="light"?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Bk(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Bk(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),i1e=nt("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),s1e=nt("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),l1e=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:a,role:i="alert",...s}=n,l=n,d=o1e(l);return p.jsxs(a1e,{role:i,elevation:6,className:Ht(d.root,o),ownerState:l,ref:t,...s,children:[p.jsx(i1e,{className:d.message,ownerState:l,children:a}),r?p.jsx(s1e,{className:d.action,ownerState:l,children:r}):null]})});function c1e(e){return Cn("MuiSnackbar",e)}fn("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const u1e=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${Tt(n.vertical)}${Tt(n.horizontal)}`]};return bn(r,c1e,t)},d1e=nt("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${Tt(n.anchorOrigin.vertical)}${Tt(n.anchorOrigin.horizontal)}`]]}})(Gn(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center",variants:[{props:({ownerState:t})=>t.anchorOrigin.vertical==="top",style:{top:8,[e.breakpoints.up("sm")]:{top:24}}},{props:({ownerState:t})=>t.anchorOrigin.vertical!=="top",style:{bottom:8,[e.breakpoints.up("sm")]:{bottom:24}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="left",style:{justifyContent:"flex-start",[e.breakpoints.up("sm")]:{left:24,right:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="right",style:{justifyContent:"flex-end",[e.breakpoints.up("sm")]:{right:24,left:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="center",style:{[e.breakpoints.up("sm")]:{left:"50%",right:"auto",transform:"translateX(-50%)"}}}]}))),f1e=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiSnackbar"}),r=Xd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:i,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:d,className:u,ClickAwayListenerProps:m,ContentProps:g,disableWindowBlurListener:y=!1,message:x,onBlur:w,onClose:S,onFocus:b,onMouseEnter:$,onMouseLeave:k,open:T,resumeHideDuration:O,slots:P={},slotProps:D={},TransitionComponent:A,transitionDuration:F=o,TransitionProps:{onEnter:L,onExited:_,...R}={},...z}=n,N={...n,anchorOrigin:{vertical:i,horizontal:s},autoHideDuration:l,disableWindowBlurListener:y,TransitionComponent:A,transitionDuration:F},B=u1e(N),{getRootProps:I,onClickAway:H}=e1e({...N}),[Y,ae]=C.useState(!0),K=me=>{ae(!0),_&&_(me)},oe=(me,se)=>{ae(!1),L&&L(me,se)},ue={slots:{transition:A,...P},slotProps:{content:g,clickAwayListener:m,transition:R,...D}},[G,ie]=ur("root",{ref:t,className:[B.root,u],elementType:d1e,getSlotProps:I,externalForwardedProps:{...ue,...z},ownerState:N}),[Q,{ownerState:ee,...Z}]=ur("clickAwayListener",{elementType:n1e,externalForwardedProps:ue,getSlotProps:me=>({onClickAway:(...se)=>{const ve=se[0];me.onClickAway?.(...se),!ve?.defaultMuiPrevented&&H(...se)}}),ownerState:N}),[de,le]=ur("content",{elementType:l1e,shouldForwardComponentProp:!0,externalForwardedProps:ue,additionalProps:{message:x,action:a},ownerState:N}),[fe,he]=ur("transition",{elementType:gy,externalForwardedProps:ue,getSlotProps:me=>({onEnter:(...se)=>{me.onEnter?.(...se),oe(...se)},onExited:(...se)=>{me.onExited?.(...se),K(...se)}}),additionalProps:{appear:!0,in:T,timeout:F,direction:i==="top"?"down":"up"},ownerState:N});return!T&&Y?null:p.jsx(Q,{...Z,...P.clickAwayListener&&{ownerState:ee},children:p.jsx(G,{...ie,children:p.jsx(fe,{...he,children:d||p.jsx(de,{...le})})})})});let S$;function p1e(e){S$=e}function eI(e){if(S$)try{S$(e)}catch{}}function rc(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return eI({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw eI({type:"console.mutation",resource:e,action:t,ok:!1,durationMs:Date.now()-o,reason:a instanceof Error?a.message:"An unknown error occurred"}),a}})}function Ch({mutationFn:e,success:t,invalidates:n,closeDialog:r,resource:o,action:a}){const i=Tl(),[s,l]=C.useState(""),d=hl({mutationFn:rc(o,a,e),onSuccess(){r();for(const u of n)i.invalidateQueries({queryKey:u});l(t)},onError(u){l(u instanceof Error?u.message:"An unknown error occurred")}});return{mutate:d.mutate,isPending:d.isPending,notice:p.jsx(f1e,{open:s!=="",autoHideDuration:6e3,onClose:()=>l(""),message:s})}}const o6="https://docs.malloydata.dev/documentation",tI=`${o6}/user_guides/publishing`,Bb="https://github.com/malloydata/publisher/blob/main/docs",tu={docsHome:`${o6}/`,publishing:`${tI}/publishing`,mcpAgents:`${tI}/mcp_agents`,surfaces:`${Bb}/choosing-a-surface.md`,givens:`${Bb}/givens.md`,materialization:`${Bb}/materialization.md`,connections:`${Bb}/connections.md`};function h1e({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=tr(),{environmentName:o}=Xr(e),a=Ch({mutationFn(s){return r.packages.createPackage(o,{name:s.name,description:s.description,location:s.location})},success:"Package created",invalidates:[["packages",o]],closeDialog:()=>n(!1),resource:"package",action:"create"}),i=s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString(),m=l.get("location")?.toString();a.mutate({name:d,description:u,location:m})};return p.jsxs(p.Fragment,{children:[p.jsx(Qy,{label:"Package",onClick:()=>n(!0)}),p.jsx(Oo,{open:t,onClose:()=>n(!1),title:"New package",description:p.jsxs(p.Fragment,{children:["A package is a directory of Malloy models and their data. Give its location as a GitHub, S3 or GCS URL, or an absolute path the server can read; see the"," ",p.jsx(Te,{component:"a",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary"},children:"package format"}),"."]}),actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),p.jsx(Vn,{type:"submit",form:"package-form",variant:"contained",loading:a.isPending,children:"Create package"})]}),children:p.jsx("form",{onSubmit:i,id:"package-form",children:p.jsxs(Yn,{sx:{gap:2},children:[p.jsx(Ri,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(Ri,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(Ri,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}const m1e=Jt(p.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function L1({icon:e,tint:t,label:n,mono:r,description:o,rightLabel:a,trailingAction:i,onClick:s,ariaLabel:l}){const d=!!s;return p.jsxs(Te,{onClick:s,onKeyDown:d?u=>{s&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s(u))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":l,sx:u=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:d?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":d?{backgroundColor:u.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":d?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[p.jsx(Te,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),p.jsxs(Te,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"baseline",gap:1.5},children:[p.jsx(wt,{variant:"body2",sx:{...r?{fontFamily:Fo}:{},flexShrink:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),o&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]}),a&&p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:a}),i&&p.jsx(Te,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:i})]})}const a6=Jt(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),g1e=fn("MuiBox",["root"]),y1e=tF(),Ta=sR({themeId:bh,defaultTheme:y1e,defaultClassName:g1e.root,generateClassName:B4.generate}),z1=hR({createStyledComponent:nt("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>Kn({props:e,name:"MuiStack"})}),nI=fn("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function v1e(e){return Cn("MuiListItemIcon",e)}const rI=fn("MuiListItemIcon",["root","alignItemsFlexStart"]),b1e=e=>{const{alignItems:t,classes:n}=e;return bn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},v1e,n)},x1e=nt("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(Gn(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),oT=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiListItemIcon"}),{className:r,...o}=n,a=C.useContext(ic),i={...n,alignItems:a.alignItems},s=b1e(i);return p.jsx(x1e,{className:Ht(s.root,r),ownerState:i,ref:t,...o})});function w1e(e){return Cn("MuiListItemText",e)}const Rp=fn("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),S1e=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return bn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},w1e,t)},C1e=nt("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Rp.primary}`]:t.primary},{[`& .${Rp.secondary}`]:t.secondary},t.root,n.inset&&t.inset,n.primary&&n.secondary&&t.multiline,n.dense&&t.dense]}})({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4,[`.${eN.root}:where(& .${Rp.primary})`]:{display:"block"},[`.${eN.root}:where(& .${Rp.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),aT=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiListItemText"}),{children:r,className:o,disableTypography:a=!1,inset:i=!1,primary:s,primaryTypographyProps:l,secondary:d,secondaryTypographyProps:u,slots:m={},slotProps:g={},...y}=n,{dense:x}=C.useContext(ic);let w=s??r,S=d;const b={...n,disableTypography:a,inset:i,primary:!!w,secondary:!!S,dense:x},$=S1e(b),k={slots:m,slotProps:{primary:l,secondary:u,...g}},[T,O]=ur("root",{className:Ht($.root,o),elementType:C1e,externalForwardedProps:{...k,...y},ownerState:b,ref:t}),[P,D]=ur("primary",{className:$.primary,elementType:Sr,externalForwardedProps:k,ownerState:b}),[A,F]=ur("secondary",{className:$.secondary,elementType:Sr,externalForwardedProps:k,ownerState:b});return w!=null&&w.type!==Sr&&!a&&(w=p.jsx(P,{variant:x?"body2":"body1",component:D?.variant?void 0:"span",...D,children:w})),S!=null&&S.type!==Sr&&!a&&(S=p.jsx(A,{variant:"body2",color:"textSecondary",...F,children:S})),p.jsxs(T,{...O,children:[w,S]})});function k1e(e){return Cn("MuiMenuItem",e)}const ag=fn("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),$1e=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},R1e=e=>{const{disabled:t,dense:n,divider:r,disableGutters:o,selected:a,classes:i}=e,s=bn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},k1e,i);return{...i,...s}},T1e=nt(qd,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:$1e})(Gn(({theme:e})=>({...e.typography.body1,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap","&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${ag.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${ag.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${ag.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${ag.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${ag.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${nI.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${nI.inset}`]:{marginLeft:52},[`& .${Rp.root}`]:{marginTop:0,marginBottom:0},[`& .${Rp.inset}`]:{paddingLeft:36},[`& .${rI.root}`]:{minWidth:36},variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:t})=>!t.dense,style:{[e.breakpoints.up("sm")]:{minHeight:"auto"}}},{props:({ownerState:t})=>t.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${rI.root} svg`]:{fontSize:"1.25rem"}}}]}))),Vo=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:o="li",dense:a=!1,divider:i=!1,disableGutters:s=!1,focusVisibleClassName:l,role:d="menuitem",tabIndex:u,className:m,...g}=n,y=C.useContext(ic),x=C.useMemo(()=>({dense:a||y.dense||!1,disableGutters:s}),[y.dense,a,s]),w=C.useRef(null);Go(()=>{r&&w.current&&w.current.focus()},[r]);const S={...n,dense:x.dense,divider:i,disableGutters:s},b=R1e(n),$=vr(w,t);let k;return n.disabled||(k=u!==void 0?u:-1),p.jsx(ic.Provider,{value:x,children:p.jsx(T1e,{ref:$,role:d,tabIndex:k,component:o,focusVisibleClassName:Ht(b.focusVisible,l),className:Ht(b.root,m),...g,ownerState:S,classes:b})})}),ac={postgres:[{label:"Host",name:"host",type:"text",required:!1},{label:"Port",name:"port",type:"number",required:!1},{label:"Database Name",name:"databaseName",type:"text",required:!1},{label:"User Name",name:"userName",type:"text",required:!1},{label:"Password",name:"password",type:"password",required:!1},{label:"Connection String",name:"connectionString",type:"text",required:!1}],bigquery:[{label:"Project ID",name:"defaultProjectId",type:"text",required:!1},{label:"Billing Project ID",name:"billingProjectId",type:"text",required:!1},{label:"Location",name:"location",type:"text",required:!1},{label:"Service Account Key JSON",name:"serviceAccountKeyJson",type:"text",required:!0},{label:"Maximum Bytes Billed",name:"maximumBytesBilled",type:"text",required:!1},{label:"Query Timeout Milliseconds",name:"queryTimeoutMilliseconds",type:"text",required:!1},{label:"Database Metadata",name:"dbmeta",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}],snowflake:[{label:"Account",name:"account",type:"text",required:!0},{label:"Username",name:"username",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Role",name:"role",type:"text",required:!1},{label:"Warehouse",name:"warehouse",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"Response Timeout Milliseconds",name:"responseTimeoutMilliseconds",type:"text",required:!1},{label:"Private Key",name:"privateKey",type:"password",required:!1},{label:"Private Key Passphrase",name:"privateKeyPass",type:"password",required:!1}],trino:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Catalog",name:"catalog",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Peaka Key",name:"peakaKey",type:"password",required:!1}],databricks:[{label:"Host",name:"host",type:"text",required:!0},{label:"HTTP Path",name:"path",type:"text",required:!0},{label:"Access Token",name:"token",type:"password",required:!1},{label:"OAuth Client ID",name:"oauthClientId",type:"text",required:!1},{label:"OAuth Client Secret",name:"oauthClientSecret",type:"password",required:!1},{label:"Default Catalog",name:"defaultCatalog",type:"text",required:!1},{label:"Default Schema",name:"defaultSchema",type:"text",required:!1}],mysql:[{label:"Host",name:"host",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Database",name:"database",type:"text",required:!0}],sqlserver:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Database",name:"database",type:"text",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Encrypt",name:"encrypt",type:"text",required:!1,selectOptions:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},{label:"Trust server certificate",name:"trustServerCertificate",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]},{label:"Host name in certificate",name:"hostNameInCertificate",type:"text",required:!1},{label:"Instance name",name:"instanceName",type:"text",required:!1}],duckdb:[],motherduck:[{label:"Access Token",name:"accessToken",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1}],ducklake:[],publisher:[]},Og={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",trino:"trinoConnection",databricks:"databricksConnection",mysql:"mysqlConnection",sqlserver:"sqlserverConnection",duckdb:"duckdbConnection",motherduck:"motherduckConnection",ducklake:"ducklakeConnection",publisher:"publisherConnection"},E1e={bigquery:{dbmeta:"boolean"},sqlserver:{port:"integer",encrypt:"boolean",trustServerCertificate:"boolean"}},M1e={sqlserver:["hostNameInCertificate","instanceName"]};function i6(e,t){const n=E1e[e],r=M1e[e];if(!n&&!r)return t;const o={...t};for(const a of r??[])o[a]===""&&delete o[a];for(const[a,i]of Object.entries(n??{})){const s=t[a];if(s!==void 0){if(s===""){delete o[a];continue}if(i==="integer"){const l=Number(s);Number.isInteger(l)&&(o[a]=l)}else(s==="true"||s==="false")&&(o[a]=s==="true")}}return o}const s6=Object.values(hA).filter(e=>e!==hA.Publisher),C$={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},Sy=[{label:"Credential Provider",name:"provider",type:"text",required:!1,selectOptions:[{label:"Access key pair",value:"config"},{label:"Host credential chain",value:"credential_chain"}]},{label:"Access Key ID",name:"accessKeyId",type:"text",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Secret Access Key",name:"secretAccessKey",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Credential Chain",name:"chain",type:"text",required:!1,visibleWhen:{field:"provider",value:"credential_chain"}},{label:"Region",name:"region",type:"text",required:!1},{label:"Endpoint",name:"endpoint",type:"text",required:!1},{label:"Session Token",name:"sessionToken",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}}],Cy=[{label:"Key ID",name:"keyId",type:"text",required:!0},{label:"Secret",name:"secret",type:"password",required:!0}],O1e=[{label:"Auth Type",name:"authType",type:"text",required:!0,selectOptions:[{label:"SAS Token",value:"sas_token"},{label:"Service Principal (SPN)",value:"service_principal"}]},{label:"SAS URL (e.g. https://account.blob.core.windows.net/container/file.parquet?sp=r&st=...)",name:"sasUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"sas_token"}},{label:"Tenant ID",name:"tenantId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client ID",name:"clientId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client Secret",name:"clientSecret",type:"password",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Account Name",name:"accountName",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"File URL (e.g. abfss://container/path/file.parquet)",name:"fileUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}}];function ex(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?ac[e]||[]:e==="s3"?Sy:e==="gcs"?Cy:e==="azure"?O1e:[]}function P1e({onSubmit:e,isSubmitting:t}){const[n,r]=C.useState(!1),[o,a]=C.useState("postgres"),[i,s]=C.useState([]),[l,d]=C.useState("postgres"),[u,m]=C.useState("s3"),[g,y]=C.useState("config"),x=()=>{r(!0)},w=()=>{r(!1),s([]),a("postgres"),d("postgres"),m("s3"),y("config")},S=async T=>{T.preventDefault();const O=new FormData(T.currentTarget),P=O.get("name")?.toString(),D=O.get("type")?.toString(),A=ac[D];if(!P)throw new Error("Name is required");if(!D)throw new Error("Type is required");let F;if(D==="ducklake"){const L={};if(l==="postgres"){const z=ac.postgres,N={};if(z.forEach(B=>{const I=O.get(`ducklake_pg_${B.name}`)?.toString();I&&(N[B.name]=I)}),Object.keys(N).length===0)throw new Error("DuckLake requires catalog connection");L.postgresConnection=N}const _=O.get("ducklake_bucketUrl")?.toString();if(!_)throw new Error("DuckLake requires a bucket URL");const R={bucketUrl:_};if(u==="s3"){const z={};if(Sy.forEach(N=>{const B=O.get(`ducklake_s3_${N.name}`)?.toString();B&&(z[N.name]=B)}),z.provider==="credential_chain")delete z.accessKeyId,delete z.secretAccessKey,delete z.sessionToken;else{if(delete z.chain,!z.accessKeyId)throw new Error("S3 Access Key ID is required");if(!z.secretAccessKey)throw new Error("S3 Secret Access Key is required")}Object.keys(z).length>0&&(R.s3Connection=z)}else if(u==="gcs"){const z={};if(Cy.forEach(N=>{const B=O.get(`ducklake_gcs_${N.name}`)?.toString();B&&(z[N.name]=B)}),!z.keyId)throw new Error("GCS Key ID is required");if(!z.secret)throw new Error("GCS Secret is required");Object.keys(z).length>0&&(R.gcsConnection=z)}F={name:P,type:D,ducklakeConnection:{catalog:L,storage:R}}}else if(D==="duckdb"){if(i.length===0)throw new Error("DuckDB connection must have at least one attached database");const L=i.map((_,R)=>{const z=_.dbType,N=O.get(`attachedDb_${R}_name`)?.toString();if(!N)throw new Error(`Attached database at index ${R} must have a name`);const B={name:N,type:z},I=ex(z);if(I&&I.length>0){const H={};if(I.forEach(ae=>{const K=O.get(`attachedDb_${R}_${ae.name}`)?.toString();K&&(H[ae.name]=K)}),z==="s3"){if(H.provider==="credential_chain")delete H.accessKeyId,delete H.secretAccessKey,delete H.sessionToken;else if(delete H.chain,!H.accessKeyId||!H.secretAccessKey)throw new Error(`Attached database "${N}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const Y=C$[z];Y&&(B[Y]=H)}return B});F={name:P,type:D,duckdbConnection:{attachedDatabases:L}}}else{const L={};if(A.forEach(_=>{const R=O.get(_.name)?.toString();R&&(L[_.name]=R)}),D==="postgres"){if(!L.connectionString?.trim()){const _=["host","port","databaseName","userName","password"];for(const R of _)if(!L[R])throw new Error(`${A.find(z=>z.name===R)?.label||R} is required`)}}else if(D==="bigquery"){if(!L.serviceAccountKeyJson)throw new Error("Service Account Key JSON is required")}else if(D==="snowflake"){if(!L.account)throw new Error("Account is required");if(!L.username)throw new Error("Username is required");if(!L.warehouse)throw new Error("Warehouse is required");if(!L.password&&!L.privateKey)throw new Error("Either password or private key is required")}else if(D==="trino"){if(!L.server)throw new Error("Server is required");if(!L.user)throw new Error("User is required");if(L.server.trim().startsWith("https://")&&!L.password&&!L.peakaKey)throw new Error("Password is required for HTTPS connections (or use Peaka Key)")}else if(D==="mysql"){const _=["host","port","database","user","password"];for(const R of _)if(!L[R])throw new Error(`${A.find(z=>z.name===R)?.label||R} is required`)}else if(D==="sqlserver"){const _=["server","database","user","password"];if(!L.instanceName&&!L.port)throw new Error("Port is required unless an instance name is given");for(const R of _)if(!L[R])throw new Error(`${A.find(z=>z.name===R)?.label||R} is required`)}else if(D==="motherduck"){if(!L.accessToken)throw new Error("Access Token is required")}else if(D==="databricks"){if(!L.host)throw new Error("Host is required");if(!L.path)throw new Error("HTTP Path is required");const _=L.oauthClientId&&L.oauthClientSecret;if(!L.token&&!_)throw new Error("Either Access Token or OAuth Client ID + Secret is required")}F={name:P,type:D,[Og[D]]:i6(D,L)}}await e(F),w()},b=()=>{s([...i,{name:"",dbType:"postgres"}])},$=T=>{s(i.filter((O,P)=>P!==T))},k=(T,O)=>{const P=[...i];P[T]={...P[T],dbType:O},s(P)};return p.jsxs(kn.Fragment,{children:[p.jsx(Qy,{label:"Connection",onClick:x}),p.jsx(Oo,{open:n,onClose:w,title:"New connection",description:"Add a connection so packages in this environment can query your database with Malloy.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:t,onClick:w,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"connection-form",variant:"contained",loading:t,children:"Create connection"})]}),children:p.jsx("form",{onSubmit:S,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small"}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:o,select:!0,onChange:T=>a(T.target.value),children:s6.map(T=>p.jsx(Vo,{value:T,children:T},T))}),o==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:l,select:!0,onChange:T=>d(T.target.value),children:p.jsx(Vo,{value:"postgres",children:"PostgreSQL"})}),l==="postgres"&&p.jsx(p.Fragment,{children:ac.postgres.map(T=>p.jsx(yr,{id:`ducklake_pg_${T.name}`,name:`ducklake_pg_${T.name}`,label:T.label,type:T.type,fullWidth:!0,size:"small"},`pg_${T.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:u,select:!0,onChange:T=>m(T.target.value),children:[p.jsx(Vo,{value:"s3",children:"S3"}),p.jsx(Vo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:u==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small"}),u==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(T=>T.visibleWhen?g===T.visibleWhen.value:!0).map(T=>p.jsx(yr,{id:`ducklake_s3_${T.name}`,name:`ducklake_s3_${T.name}`,label:T.label,type:T.selectOptions?void 0:T.type,fullWidth:!0,size:"small",required:T.required,select:!!T.selectOptions,defaultValue:T.selectOptions?g:void 0,onChange:T.name==="provider"?O=>y(O.target.value):void 0,placeholder:T.name==="region"?"us-east-1":void 0,children:T.selectOptions?.map(O=>p.jsx(Vo,{value:O.value,children:O.label},O.value))},`s3_${T.name}`))]}),u==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(T=>p.jsx(yr,{id:`ducklake_gcs_${T.name}`,name:`ducklake_gcs_${T.name}`,label:T.label,type:T.type,fullWidth:!0,size:"small",required:T.required},`gcs_${T.name}`))]})]})]}):o==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Sr,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(f1,{}),onClick:b,ariaLabel:"Add database"})]}),i.length===0&&p.jsx(Sr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),i.map((T,O)=>{const P=ex(T.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Sr,{variant:"subtitle2",children:["Database ",O+1]}),p.jsx(Tu,{onClick:()=>$(O),size:"small",color:"error",children:p.jsx(a6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${O}_name`,name:`attachedDb_${O}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:T.name}),p.jsx(yr,{id:`attachedDb_${O}_type`,name:`attachedDb_${O}_type`,label:"Database Type",fullWidth:!0,size:"small",value:T.dbType,select:!0,onChange:D=>k(O,D.target.value),children:Object.values($4).map(D=>p.jsx(Vo,{value:D,children:D},D))}),P.filter(D=>D.visibleWhen?(T[D.visibleWhen.field]||P.find(A=>A.name===D.visibleWhen?.field)?.selectOptions?.[0]?.value)===D.visibleWhen.value:!0).map(D=>p.jsx(yr,{id:`attachedDb_${O}_${D.name}`,name:`attachedDb_${O}_${D.name}`,label:D.label,type:D.selectOptions?void 0:D.type,fullWidth:!0,size:"small",required:D.required,select:!!D.selectOptions,defaultValue:D.selectOptions?.[0]?.value,onChange:D.selectOptions?A=>{const F=[...i];F[O]={...F[O],[D.name]:A.target.value},s(F)}:void 0,children:D.selectOptions?.map(A=>p.jsx(Vo,{value:A.value,children:A.label},A.value))},D.name))]},O)})]}):ac[o].map(T=>p.jsx(yr,{id:T.name,name:T.name,label:T.label,type:T.type,fullWidth:!0,size:"small",required:T.required,select:!!T.selectOptions,defaultValue:T.selectOptions?T.selectOptions[0]?.value:void 0,children:T.selectOptions?.map(O=>p.jsx(Vo,{value:O.value,children:O.label},O.value))},T.name))]})})})]})}function j1e({connection:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),i=()=>{a(!0)},s=()=>{a(!1),t()};return p.jsxs(kn.Fragment,{children:[p.jsxs(Vo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(oT,{sx:{color:"inherit"},children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(aT,{children:"Delete"})]}),p.jsx(Oo,{open:o,onClose:s,title:"Delete connection",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:s,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete connection"})]}),children:p.jsxs(Sr,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const oI=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function aI(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function iI(e){const t=e.ducklakeConnection;return t&&t.storage?.gcsConnection?"gcs":"s3"}function A1e({connection:e,onSubmit:t,isSubmitting:n,onCloseDialog:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(e.type),l=kn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[d,u]=C.useState(()=>aI(e)),[m,g]=C.useState("postgres"),[y,x]=C.useState(()=>iI(e)),[w,S]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),b=()=>{u(aI(e)),s(e.type),S(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),g("postgres"),x(iI(e)),a(!0)},$=()=>{a(!1),r?.()},k=async F=>{F.preventDefault();const L=new FormData(F.currentTarget),_=L.get("name")?.toString(),R=L.get("type")?.toString(),z=ac[R];if(!_)throw new Error("Name is required");if(!R)throw new Error("Type is required");let N;if(R==="ducklake"){const B={};if(m==="postgres"){const Y=ac.postgres,ae={};if(Y.forEach(K=>{const oe=L.get(`ducklake_pg_${K.name}`)?.toString();oe&&(ae[K.name]=oe)}),Object.keys(ae).length===0)throw new Error("DuckLake requires catalog connection");B.postgresConnection=ae}const I=L.get("ducklake_bucketUrl")?.toString();if(!I)throw new Error("DuckLake requires a bucket URL");const H={bucketUrl:I};if(y==="s3"){const Y={};Sy.forEach(K=>{const oe=L.get(`ducklake_s3_${K.name}`)?.toString();oe&&(Y[K.name]=oe)});const ae=e.ducklakeConnection?.storage?.s3Connection;if(ae&&(!Y.provider&&ae.provider&&(Y.provider=ae.provider),!Y.chain&&ae.chain&&(Y.chain=ae.chain),!Y.accessKeyId&&ae.accessKeyId&&(Y.accessKeyId=ae.accessKeyId)),Y.provider==="credential_chain")delete Y.accessKeyId,delete Y.secretAccessKey,delete Y.sessionToken;else if(delete Y.chain,!Y.accessKeyId)throw new Error("S3 Access Key ID is required");Object.keys(Y).length>0&&(H.s3Connection=Y)}else if(y==="gcs"){const Y={};Cy.forEach(K=>{const oe=L.get(`ducklake_gcs_${K.name}`)?.toString();oe&&(Y[K.name]=oe)});const ae=e.ducklakeConnection?.storage?.gcsConnection;if(ae&&!Y.keyId&&ae.keyId&&(Y.keyId=ae.keyId),!Y.keyId)throw new Error("GCS Key ID is required");Object.keys(Y).length>0&&(H.gcsConnection=Y)}N={name:_,type:R,ducklakeConnection:{catalog:B,storage:H}}}else if(R==="duckdb"){if(d.length===0)throw new Error("DuckDB connection must have at least one attached database");const B=d.map((I,H)=>{const Y=I.dbType,ae=L.get(`attachedDb_${H}_name`)?.toString();if(!ae)throw new Error(`Attached database at index ${H} must have a name`);const K={name:ae,type:Y},oe=ex(Y);if(oe&&oe.length>0){const ue={};if(oe.forEach(ie=>{const Q=L.get(`attachedDb_${H}_${ie.name}`)?.toString();Q&&(ue[ie.name]=Q)}),Y==="s3"){if(ue.provider==="credential_chain")delete ue.accessKeyId,delete ue.secretAccessKey,delete ue.sessionToken;else if(delete ue.chain,!ue.accessKeyId||!ue.secretAccessKey)throw new Error(`Attached database "${ae}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const G=C$[Y];G&&(K[G]=ue)}return K});N={name:_,type:R,duckdbConnection:{attachedDatabases:B}}}else{const B=e[Og[R]]||{},I={};if(z.forEach(H=>{const Y=L.get(H.name)?.toString(),ae=B[H.name];Y?I[H.name]=Y:oI.has(H.name)||(Y!==void 0?I[H.name]=Y:ae&&(I[H.name]=ae))}),R==="postgres"){const H=["host","port","databaseName","userName"],Y=l.has("postgresConnection.connectionString");if(!(I.connectionString?.trim()||Y)){const ae=H;for(const K of ae)if(!I[K])throw new Error(`${z.find(oe=>oe.name===K)?.label||K} is required`)}}else if(R==="snowflake"){if(!I.account)throw new Error("Account is required");if(!I.username)throw new Error("Username is required");if(!I.warehouse)throw new Error("Warehouse is required")}else if(R==="trino"){if(!I.server)throw new Error("Server is required");if(!I.user)throw new Error("User is required")}else if(R==="mysql"){const H=["host","port","database","user"];for(const Y of H)if(!I[Y])throw new Error(`${z.find(ae=>ae.name===Y)?.label||Y} is required`)}else if(R==="sqlserver"){const H=["server","database","user"];if(!I.instanceName&&!I.port)throw new Error("Port is required unless an instance name is given");for(const Y of H)if(!I[Y])throw new Error(`${z.find(ae=>ae.name===Y)?.label||Y} is required`)}else if(R==="databricks"){if(!I.host)throw new Error("Host is required");if(!I.path)throw new Error("HTTP Path is required")}N={name:_,type:R,[Og[R]]:i6(R,I)}}await t(N),$()},T=()=>{u([...d,{name:"",dbType:"postgres"}])},O=F=>{u(d.filter((L,_)=>_!==F))},P=(F,L)=>{const _=[...d];_[F]={..._[F],dbType:L},u(_)},D=(F,L)=>{const _=e.duckdbConnection?.attachedDatabases;if(!_||!_[F])return"";const R=_[F],z=C$[R.type||""];return z&&R[z]?R[z][L]??"":""},A=F=>{const L=e.ducklakeConnection;if(!L)return"";if(F.startsWith("pg_")){const _=F.replace("pg_","");return L.catalog?.postgresConnection?.[_]??""}if(F==="bucketUrl")return L.storage?.bucketUrl??"";if(F.startsWith("s3_")){const _=F.replace("s3_","");return L.storage?.s3Connection?.[_]??""}if(F.startsWith("gcs_")){const _=F.replace("gcs_","");return L.storage?.gcsConnection?.[_]??""}return""};return p.jsxs(kn.Fragment,{children:[p.jsxs(Vo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:F=>{F.preventDefault(),F.stopPropagation(),b()},children:[p.jsx(oT,{children:p.jsx(r2,{fontSize:"small"})}),p.jsx(aT,{children:"Edit"})]}),p.jsx(Oo,{open:o,onClose:$,title:"Edit connection",description:"Change how packages in this environment reach your database.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:n,onClick:$,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"connection-form",variant:"contained",loading:n,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:k,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",defaultValue:e.name}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:i,select:!0,onChange:F=>s(F.target.value),children:s6.map(F=>p.jsx(Vo,{value:F,children:F},F))}),i==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:m,select:!0,onChange:F=>g(F.target.value),children:p.jsx(Vo,{value:"postgres",children:"PostgreSQL"})}),m==="postgres"&&p.jsx(p.Fragment,{children:ac.postgres.map(F=>p.jsx(yr,{id:`ducklake_pg_${F.name}`,name:`ducklake_pg_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",defaultValue:A(`pg_${F.name}`)},`pg_${F.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Sr,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:y,select:!0,onChange:F=>x(F.target.value),children:[p.jsx(Vo,{value:"s3",children:"S3"}),p.jsx(Vo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:y==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small",defaultValue:A("bucketUrl")}),y==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(F=>F.visibleWhen?w===F.visibleWhen.value:!0).map(F=>p.jsx(yr,{id:`ducklake_s3_${F.name}`,name:`ducklake_s3_${F.name}`,label:F.label,type:F.selectOptions?void 0:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secretAccessKey",select:!!F.selectOptions,defaultValue:F.selectOptions?w:A(`s3_${F.name}`),onChange:F.name==="provider"?L=>S(L.target.value):void 0,placeholder:F.name==="region"?"us-east-1":F.name==="secretAccessKey"&&l.has("ducklakeConnection.storage.s3Connection.secretAccessKey")?"Leave empty to keep existing":void 0,children:F.selectOptions?.map(L=>p.jsx(Vo,{value:L.value,children:L.label},L.value))},`s3_${F.name}`))]}),y==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Sr,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(F=>p.jsx(yr,{id:`ducklake_gcs_${F.name}`,name:`ducklake_gcs_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secret",defaultValue:A(`gcs_${F.name}`),placeholder:F.name==="secret"&&l.has("ducklakeConnection.storage.gcsConnection.secret")?"Leave empty to keep existing":void 0},`gcs_${F.name}`))]})]})]}):i==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Sr,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(f1,{}),onClick:T,ariaLabel:"Add database"})]}),d.length===0&&p.jsx(Sr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),d.map((F,L)=>{const _=ex(F.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Sr,{variant:"subtitle2",children:["Database ",L+1]}),p.jsx(Tu,{"aria-label":`Remove attached database ${L+1}`,onClick:()=>O(L),size:"small",color:"error",children:p.jsx(a6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${L}_name`,name:`attachedDb_${L}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:F.name}),p.jsx(yr,{id:`attachedDb_${L}_type`,name:`attachedDb_${L}_type`,label:"Database Type",fullWidth:!0,size:"small",value:F.dbType,select:!0,onChange:R=>P(L,R.target.value),children:Object.values($4).map(R=>p.jsx(Vo,{value:R,children:R},R))}),_.filter(R=>R.visibleWhen?(F[R.visibleWhen.field]||D(L,R.visibleWhen.field)||_.find(z=>z.name===R.visibleWhen?.field)?.selectOptions?.[0]?.value)===R.visibleWhen.value:!0).map(R=>p.jsx(yr,{id:`attachedDb_${L}_${R.name}`,name:`attachedDb_${L}_${R.name}`,label:R.label,type:R.selectOptions?void 0:R.type,fullWidth:!0,size:"small",required:R.required,select:!!R.selectOptions,defaultValue:D(L,R.name)||R.selectOptions?.[0]?.value,onChange:R.selectOptions?z=>{const N=[...d];N[L]={...N[L],[R.name]:z.target.value},u(N)}:void 0,children:R.selectOptions?.map(z=>p.jsx(Vo,{value:z.value,children:z.label},z.value))},R.name))]},L)})]}):ac[i].map(F=>{const L=e?.[Og[i]??""]?.[F.name??""]??"",_=F.type==="password"||oI.has(F.name),R=l.has(`${Og[i]??""}.${F.name}`),z=F.selectOptions?L===""||L===void 0?F.selectOptions[0]?.value:String(L):void 0;return p.jsx(yr,{id:F.name,name:F.name,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&!_&&!L,select:!!F.selectOptions,defaultValue:F.selectOptions?z:L,placeholder:R?"Leave empty to keep existing":void 0,helperText:_?R?"Stored value is not shown. Leave empty to keep it.":"No value stored.":void 0,children:F.selectOptions?.map(N=>p.jsx(Vo,{value:N.value,children:N.label},N.value))},F.name)})]})})})]})}function sI(e,t){return!e||e.type!=="duckdb"?!1:(e.duckdbConnection?.attachedDatabases||[]).some(n=>n.type==="azure"&&n.name===t)}function D1e(e){return e.startsWith("gs://")||e.startsWith("s3://")||e.startsWith("https://")||e.startsWith("abfss://")||e.startsWith("az://")}function N1e({connectionName:e,resourceUri:t,schema:n,connection:r}){const{apiClients:o}=tr(),{environmentName:a}=Xr(t),[i,s]=kn.useState(null),[l,d]=kn.useState(n||null),[u,m]=kn.useState(!1),{data:g,isError:y,isLoading:x,error:w}=co({queryKey:["schemas",a,e],queryFn:()=>o.connections.listSchemas(a,e)}),S=g?.data||[];return p.jsxs(Cp,{container:!0,spacing:1,children:[!n&&p.jsx(Cp,{size:{xs:12,md:4},children:p.jsxs(Qa,{sx:{p:1,m:0},children:[p.jsxs(Te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),p.jsx(MR,{control:p.jsx(Cz,{checked:u,onChange:b=>m(b.target.checked)}),label:"Hidden Schemas"})]}),p.jsx(wl,{sx:{mt:"2px"}}),p.jsxs(Te,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[x&&p.jsx(Bo,{text:"Loading schemas..."}),y&&p.jsx(ja,{error:w,context:`${a} > ${e} > Schemas`}),!x&&!y&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Schemas"}),!x&&!y&&S.length>0&&p.jsx(AR,{dense:!0,disablePadding:!0,children:S.map(b=>{const $=b.name;return b.isHidden&&!u?null:p.jsx(mz,{selected:l===$,onClick:()=>{d($),s(null)},children:p.jsx(Ci,{primary:$})},$)})})]})]})}),p.jsx(Cp,{size:{xs:12,md:n?6:4},children:l&&p.jsx(Qa,{sx:{p:1,m:0},children:p.jsx(z1e,{connectionName:e,schemaName:l,onTableSelect:b=>{s(b)},resourceUri:t,connection:r})})}),p.jsx(Cp,{size:{xs:12,md:n?6:4},children:l&&i&&p.jsx(I1e,{environmentName:a,connectionName:e,schemaName:l,tableResource:i})})]})}function I1e({environmentName:e,connectionName:t,schemaName:n,tableResource:r}){const{apiClients:o}=tr(),{data:a,isLoading:i,isError:s,error:l}=co({queryKey:["connectionTableDetail",e,t,n,r],queryFn:()=>o.connections.getTable(e,t,n,r),enabled:!!n&&!!r}),d={resource:a?.data?.resource??r,columns:a?.data?.columns??[]};return p.jsxs(Qa,{sx:{p:1,m:0},children:[s&&p.jsx(ja,{error:l,context:`${e} > ${t} > ${n} > ${r}`}),!s&&p.jsx(L1e,{table:d,loading:i})]})}function L1e({table:e,loading:t}){return t?p.jsx(Bo,{text:"Loading columns..."}):p.jsxs(p.Fragment,{children:[p.jsxs(wt,{variant:"overline",fontWeight:"bold",sx:{display:"block",wordBreak:"break-all"},children:[e.resource.includes("://")||/\.(parquet|csv|json|tsv|ndjson)$/i.test(e.resource)?"File":"Table",": ",e.resource]}),p.jsx(wl,{}),p.jsx(Te,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:p.jsx(WJ,{children:p.jsxs(Bx,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"NAME"}),p.jsx(dr,{children:"TYPE"})]})}),p.jsx(qx,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>p.jsxs(vu,{children:[p.jsx(dr,{children:n.name}),p.jsx(dr,{children:n.type})]},n.name))})]})})})]})}function z1e({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=Xr(r),{apiClients:i}=tr(),[s,l]=C.useState(""),{data:d,isSuccess:u,isError:m,error:g,isLoading:y}=co({queryKey:["tablesInSchema",a,e,t],queryFn:()=>i.connections.listTables(a,e,t)}),x=sI(o,t),w=b=>x?b:b.split(".").pop()||b,S=u&&d?.data?d.data.filter(b=>w(b.resource).toLowerCase().includes(s.toLowerCase())).sort((b,$)=>w(b.resource).localeCompare(w($.resource))):[];return p.jsxs(p.Fragment,{children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:D1e(t)||sI(o,t)?`Files in ${t}`:`Tables in ${t}`}),p.jsx(wl,{}),p.jsx(Te,{sx:{mt:1,mb:1},children:p.jsx(Ri,{size:"small",fullWidth:!0,placeholder:"Search tables...",value:s,onChange:b=>l(b.target.value),variant:"outlined"})}),p.jsx(wl,{}),p.jsxs(Te,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[y&&p.jsx(Bo,{text:"Fetching Tables..."}),m&&p.jsx(ja,{error:g,context:`${a} > ${e} > ${t}`}),u&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Tables"}),u&&d?.data&&d.data.length>0&&p.jsx(AR,{dense:!0,disablePadding:!0,children:S.map(b=>{let $=w(b.resource);return!x&&b.resource.includes("://")&&($=b.resource.split("/").pop()||b.resource),p.jsx(mz,{onClick:()=>n(b.resource),children:p.jsx(Ci,{primary:$,secondary:b.columns.length>0?`${b.columns.length} columns`:void 0})},b.resource)})})]})]})}const F1e={bigquery:"BigQuery",snowflake:"Snowflake",postgres:"PostgreSQL",mysql:"MySQL",sqlserver:"SQL Server",trino:"Trino",databricks:"Databricks",duckdb:"DuckDB",ducklake:"DuckLake",s3:"S3",gcs:"GCS",azure:"Azure"};function _1e(e){return e?F1e[e]??e:""}function B1e({resourceUri:e}){const{apiClients:t,mutable:n}=tr(),r=Tl(),{environmentName:o}=Xr(e),[a,i]=C.useState(""),[s,l]=C.useState(null),d=I1({environmentName:o,connectionName:s}),{data:u,isSuccess:m,isError:g,error:y}=co({queryKey:["connections",o],queryFn:()=>t.connections.listConnections(o)}),x=hl({mutationFn:rc("connection","create",k=>t.environments.updateEnvironment(o,{name:o,connections:[...u.data,k]})),onSuccess(){i("Connection added successfully"),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),w=hl({mutationFn:rc("connection","update",k=>t.environments.updateEnvironment(o,{name:o,connections:u.data.map(T=>T.name===k.name?k:T)})),onSuccess(k,T){i(`Connection ${T.name} updated successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),S=hl({mutationFn:rc("connection","delete",k=>{if(!k.name)throw new Error("Cannot delete a connection with no name");return t.connections.deleteConnection(o,k.name)}),onSuccess(k,T){i(`Connection ${T.name} deleted successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),b=m?[...u.data].sort((k,T)=>(k.name??"").localeCompare(T.name??"")):[],$=x.isPending||w.isPending||S.isPending;return p.jsxs(Ns,{title:"Connections",...m?{count:b.length}:{},description:"Database connections available to packages in this environment",...n&&m?{action:p.jsx(P1e,{onSubmit:k=>x.mutateAsync(k),isSubmitting:x.isPending})}:{},children:[!m&&!g&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Fetching Connections..."}),g&&p.jsx(ja,{error:y,context:`${o} > Connections`}),m&&b.length===0&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"No connections yet."}),m&&b.length>0&&p.jsx(Yn,{children:b.map(k=>p.jsx(U1e,{connection:k,mutable:n,isMutating:$,onOpenExplorer:()=>l(k.name??null),onEdit:T=>w.mutateAsync(T),onDelete:T=>S.mutateAsync(T)},k.name))}),p.jsx(hh,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a}),p.jsx(Oo,{open:s!==null,onClose:()=>l(null),maxWidth:"lg",title:`Connection explorer: ${s??""}`,showClose:!0,children:s&&p.jsx(N1e,{resourceUri:d,connectionName:s,connection:u?.data?.find(k=>k.name===s)})})]})}function U1e({connection:e,mutable:t,isMutating:n,onOpenExplorer:r,onEdit:o,onDelete:a}){const[i,s]=C.useState(null),l=!!i,d=m=>{m.stopPropagation(),s(m.currentTarget)},u=()=>s(null);return p.jsx(L1,{icon:p.jsx(m1e,{sx:{fontSize:18}}),tint:ZR.connection,label:e.name??"",ariaLabel:e.name??"",description:_1e(e.type),onClick:r,...t?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small",onClick:d,"aria-label":`Connection actions for ${e.name??""}`.trim(),children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:i,open:l,onClose:u,onClick:m=>m.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(A1e,{connection:e,onSubmit:o,isSubmitting:n,onCloseDialog:u}),p.jsx(j1e,{connection:e,onCloseDialog:u,isMutating:n,onDelete:()=>a(e)})]})]})}:{}})}const q1e=Jt([p.jsx("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-1 18H5V9h14zm1-13H4V4h16z"},"0"),p.jsx("path",{d:"M9 12h6v2H9z"},"1")]);function H1e({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=tr(),a=()=>{r(!0)},i=()=>{r(!1),t()},{environmentName:s,packageName:l}=Xr(e),d=Ch({mutationFn:()=>o.packages.deletePackage(s,l),success:"Package deleted",invalidates:[["packages",s]],closeDialog:i,resource:"package",action:"delete"});return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(Ci,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete package",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:i,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>d.mutate(),loading:d.isPending,children:"Delete package"})]}),children:p.jsxs(Sr,{variant:"body2",children:["Delete ",p.jsx("strong",{children:l}),"? The package stops being served and this cannot be undone."]})}),d.notice]})}function V1e({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=tr(),i=()=>{o(!0)},s=()=>{o(!1),n()},{packageName:l,environmentName:d}=Xr(t),u=Ch({mutationFn(g){return a.packages.updatePackage(d,l,{name:l,description:g.description})},success:"Package updated",invalidates:[["packages",d]],closeDialog:s,resource:"package",action:"update"}),m=g=>{g.preventDefault();const y=new FormData(g.currentTarget).get("description")?.toString();u.mutate({description:y})};return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:i,children:[p.jsx(ml,{children:p.jsx(r2,{fontSize:"small"})}),p.jsx(Ci,{children:"Edit"})]}),p.jsx(Oo,{open:r,onClose:s,title:"Edit package",description:`What ${e.name} is, for the people who open it.`,actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:u.isPending,onClick:s,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"package-form",variant:"contained",loading:u.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:m,id:"package-form",children:p.jsxs(Yn,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,size:"small",defaultValue:e.description,InputLabelProps:{shrink:!0}})]})})}),u.notice]})}function W1e({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=tr(),{environmentName:r}=Xr(t),{data:o,isSuccess:a,isError:i,error:s}=co({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});if(i)return p.jsx(ja,{error:s,context:`${r} > Packages`});if(!a)return p.jsx(Bo,{text:"Fetching Packages..."});const l=[...o.data].sort((d,u)=>d.name.localeCompare(u.name));return p.jsx(Yn,{children:l.map(d=>{const u=I1({environmentName:r,packageName:d.name});return p.jsx(Y1e,{pkg:d,packageResourceUri:u,onSelectPackage:e},d.name)})})}function Y1e({pkg:e,packageResourceUri:t,onSelectPackage:n}){const{mutable:r}=tr(),o=e.versionId!==void 0||e.latestVersion!==void 0,[a,i]=C.useState(null),s=!!a,l=u=>{u.stopPropagation(),i(u.currentTarget)},d=()=>i(null);return p.jsx(L1,{icon:p.jsx(q1e,{sx:{fontSize:18}}),tint:ZR.package,label:e.name,ariaLabel:e.name,...e.description?{description:e.description}:{},onClick:u=>n(e.name,u),...r?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small",onClick:l,"aria-label":`Package actions for ${e.name}`,children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:a,open:s,onClose:d,onClick:u=>u.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[!o&&p.jsx(V1e,{package:e,resourceUri:t,onCloseDialog:d}),p.jsx(H1e,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function GTe({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=tr(),{environmentName:o}=Xr(t),a=co({queryKey:["packages",o],queryFn:()=>n.packages.listPackages(o)});return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Te,{sx:{mb:4},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:o}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Manage packages and database connections in this environment. Open a package to explore its models and notebooks."})]}),p.jsx(Ns,{title:"Packages",...a.isSuccess?{count:a.data.data.length}:{},description:"Published packages available for use in this environment",...r?{action:p.jsx(h1e,{resourceUri:t})}:{},children:p.jsx(W1e,{onSelectPackage:e,resourceUri:t})}),p.jsx(B1e,{resourceUri:t}),p.jsx(Jxe,{resourceUri:t})]})}function lI({array1:e,array2:t,parser:n=r=>r}){return e&&t&&e.length===t.length&&e.every((r,o)=>n(r)===n(t[o]))}function cI(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function G1e(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:i=!1}=e;return(s,{inputValue:l,getOptionLabel:d})=>{let u=i?l.trim():l;n&&(u=u.toLowerCase()),t&&(u=cI(u));const m=u?s.filter(g=>{let y=(a||d)(g);return n&&(y=y.toLowerCase()),t&&(y=cI(y)),o==="start"?y.startsWith(u):y.includes(u)}):s;return typeof r=="number"?m.slice(0,r):m}}const K1e=G1e(),uI=5,Q1e=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),X1e=[];function dI(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function Z1e(e){const{unstable_isActiveElementInListbox:t=Q1e,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,clearOnBlur:s=!e.freeSolo,clearOnEscape:l=!1,componentName:d="useAutocomplete",defaultValue:u=e.multiple?X1e:null,disableClearable:m=!1,disableCloseOnSelect:g=!1,disabled:y,disabledItemsFocusable:x=!1,disableListWrap:w=!1,filterOptions:S=K1e,filterSelectedOptions:b=!1,freeSolo:$=!1,getOptionDisabled:k,getOptionKey:T,getOptionLabel:O=ge=>ge.label??ge,groupBy:P,handleHomeEndKeys:D=!e.freeSolo,id:A,includeInputInList:F=!1,inputValue:L,isOptionEqualToValue:_=(ge,ye)=>ge===ye,multiple:R=!1,onChange:z,onClose:N,onHighlightChange:B,onInputChange:I,onOpen:H,open:Y,openOnFocus:ae=!1,options:K,readOnly:oe=!1,renderValue:ue,selectOnFocus:G=!e.freeSolo,value:ie}=e,Q=_s(A);let ee=O;ee=ge=>{const ye=O(ge);return typeof ye!="string"?String(ye):ye};const Z=C.useRef(!1),de=C.useRef(!0),le=C.useRef(null),fe=C.useRef(null),[he,me]=C.useState(null),[se,ve]=C.useState(-1),Le=o?0:-1,Ae=C.useRef(Le),Re=C.useRef(dI(u??ie,R,ee)).current,[re,_e]=Ti({controlled:ie,default:u,name:d}),[Me,Ge]=Ti({controlled:L,default:Re,name:d,state:"inputValue"}),[Je,St]=C.useState(!1),Ut=C.useCallback((ge,ye,Ue)=>{if(!(R?re.length<ye.length:ye!==null)&&!s)return;const gt=dI(ye,R,ee,ue);Me!==gt&&(Ge(gt),I&&I(ge,gt,Ue))},[ee,Me,R,I,Ge,s,re,ue]),[at,tt]=Ti({controlled:Y,default:!1,name:d,state:"open"}),[pt,ze]=C.useState(!0),be=!R&&re!=null&&Me===ee(re),Ve=at&&!oe,Oe=Ve?S(K.filter(ge=>!(b&&(R?re:[re]).some(ye=>ye!==null&&_(ge,ye)))),{inputValue:be&&pt?"":Me,getOptionLabel:ee}):[],$t=jxe({filteredOptions:Oe,value:re,inputValue:Me});C.useEffect(()=>{const ge=re!==$t.value;Je&&!ge||$&&!ge||Ut(null,re,"reset")},[re,Ut,Je,$t.value,$]);const Rt=at&&Oe.length>0&&!oe,vt=Yt(ge=>{if(ge===-1)le.current.focus();else{const ye=ue?"data-item-index":"data-tag-index";he.querySelector(`[${ye}="${ge}"]`).focus()}});C.useEffect(()=>{R&&se>re.length-1&&(ve(-1),vt(-1))},[re,R,se,vt]);function it(ge,ye){if(!fe.current||ge<0||ge>=Oe.length)return-1;let Ue=ge;for(;;){const gt=fe.current.querySelector(`[data-option-index="${Ue}"]`),We=x?!1:!gt||gt.disabled||gt.getAttribute("aria-disabled")==="true";if(gt&&gt.hasAttribute("tabindex")&&!We)return Ue;if(ye==="next"?Ue=(Ue+1)%Oe.length:Ue=(Ue-1+Oe.length)%Oe.length,Ue===ge)return-1}}const st=Yt(({event:ge,index:ye,reason:Ue})=>{if(Ae.current=ye,ye===-1?le.current.removeAttribute("aria-activedescendant"):le.current.setAttribute("aria-activedescendant",`${Q}-option-${ye}`),B&&["mouse","keyboard","touch"].includes(Ue)&&B(ge,ye===-1?null:Oe[ye],Ue),!fe.current)return;const gt=fe.current.querySelector(`[role="option"].${n}-focused`);gt&&(gt.classList.remove(`${n}-focused`),gt.classList.remove(`${n}-focusVisible`));let We=fe.current;if(fe.current.getAttribute("role")!=="listbox"&&(We=fe.current.parentElement.querySelector('[role="listbox"]')),!We)return;if(ye===-1){We.scrollTop=0;return}const Nt=fe.current.querySelector(`[data-option-index="${ye}"]`);if(Nt&&(Nt.classList.add(`${n}-focused`),Ue==="keyboard"&&Nt.classList.add(`${n}-focusVisible`),We.scrollHeight>We.clientHeight&&Ue!=="mouse"&&Ue!=="touch")){const Kt=Nt,hn=We.clientHeight+We.scrollTop,we=Kt.offsetTop+Kt.offsetHeight;we>hn?We.scrollTop=we-We.clientHeight:Kt.offsetTop-Kt.offsetHeight*(P?1.3:0)<We.scrollTop&&(We.scrollTop=Kt.offsetTop-Kt.offsetHeight*(P?1.3:0))}}),Dt=Yt(({event:ge,diff:ye,direction:Ue="next",reason:gt})=>{if(!Ve)return;const We=it((()=>{const Nt=Oe.length-1;if(ye==="reset")return Le;if(ye==="start")return 0;if(ye==="end")return Nt;const Kt=Ae.current+ye;return Kt<0?Kt===-1&&F?-1:w&&Ae.current!==-1||Math.abs(ye)>1?0:Nt:Kt>Nt?Kt===Nt+1&&F?-1:w||Math.abs(ye)>1?Nt:0:Kt})(),Ue);if(st({index:We,reason:gt,event:ge}),r&&ye!=="reset")if(We===-1)le.current.value=Me;else{const Nt=ee(Oe[We]);le.current.value=Nt,Nt.toLowerCase().indexOf(Me.toLowerCase())===0&&Me.length>0&&le.current.setSelectionRange(Me.length,Nt.length)}}),nn=!lI({array1:$t.filteredOptions,array2:Oe,parser:ee}),Bt=()=>{const ge=(ye,Ue)=>{const gt=ye?ee(ye):"",We=Ue?ee(Ue):"";return gt===We};if(Ae.current!==-1&&!lI({array1:$t.filteredOptions,array2:Oe,parser:ee})&&$t.inputValue===Me&&(R?re.length===$t.value.length&&$t.value.every((ye,Ue)=>ee(re[Ue])===ee(ye)):ge($t.value,re))){const ye=$t.filteredOptions[Ae.current];if(ye)return Oe.findIndex(Ue=>ee(Ue)===ee(ye))}return-1},pn=C.useCallback(()=>{if(!Ve)return;const ge=Bt();if(ge!==-1){Ae.current=ge;return}const ye=R?re[0]:re;if(Oe.length===0||ye==null){Dt({diff:"reset"});return}if(fe.current){if(ye!=null){const Ue=Oe[Ae.current];if(R&&Ue&&re.findIndex(We=>_(Ue,We))!==-1)return;const gt=Oe.findIndex(We=>_(We,ye));gt===-1?Dt({diff:"reset"}):st({index:gt});return}if(Ae.current>=Oe.length-1){st({index:Oe.length-1});return}st({index:Ae.current})}},[Oe.length,R?!1:re,b,Dt,st,Ve,Me,R]),$n=Yt(ge=>{Vk(fe,ge),ge&&pn()});C.useEffect(()=>{nn&&pn()},[pn,nn]);const qt=ge=>{at||(tt(!0),ze(!0),H&&H(ge))},Pn=(ge,ye)=>{at&&(tt(!1),N&&N(ge,ye))},Se=(ge,ye,Ue,gt)=>{if(R){if(re.length===ye.length&&re.every((We,Nt)=>We===ye[Nt]))return}else if(re===ye)return;z&&z(ge,ye,Ue,gt),_e(ye)},jn=C.useRef(!1),Rn=(ge,ye,Ue="selectOption",gt="options")=>{let We=Ue,Nt=ye;if(R){Nt=Array.isArray(re)?re.slice():[];const Kt=Nt.findIndex(hn=>_(ye,hn));Kt===-1?Nt.push(ye):gt!=="freeSolo"&&(Nt.splice(Kt,1),We="removeOption")}Ut(ge,Nt,We),Se(ge,Nt,We,{option:ye}),!g&&(!ge||!ge.ctrlKey&&!ge.metaKey)&&Pn(ge,We),(i===!0||i==="touch"&&jn.current||i==="mouse"&&!jn.current)&&le.current.blur()};function en(ge,ye){if(ge===-1)return-1;let Ue=ge;for(;;){if(ye==="next"&&Ue===re.length||ye==="previous"&&Ue===-1)return-1;const gt=ue?"data-item-index":"data-tag-index",We=he.querySelector(`[${gt}="${Ue}"]`);if(!We||!We.hasAttribute("tabindex")||We.disabled||We.getAttribute("aria-disabled")==="true")Ue+=ye==="next"?1:-1;else return Ue}}const jt=(ge,ye)=>{if(!R)return;Me===""&&Pn(ge,"toggleInput");let Ue=se;se===-1?Me===""&&ye==="previous"&&(Ue=re.length-1):(Ue+=ye==="next"?1:-1,Ue<0&&(Ue=0),Ue===re.length&&(Ue=-1)),Ue=en(Ue,ye),ve(Ue),vt(Ue)},Ur=ge=>{Z.current=!0,Ge(""),I&&I(ge,"","clear"),Se(ge,R?[]:null,"clear")},qn=ge=>ye=>{if(ge.onKeyDown&&ge.onKeyDown(ye),!ye.defaultMuiPrevented&&(se!==-1&&!["ArrowLeft","ArrowRight"].includes(ye.key)&&(ve(-1),vt(-1)),ye.which!==229))switch(ye.key){case"Home":Ve&&D&&(ye.preventDefault(),Dt({diff:"start",direction:"next",reason:"keyboard",event:ye}));break;case"End":Ve&&D&&(ye.preventDefault(),Dt({diff:"end",direction:"previous",reason:"keyboard",event:ye}));break;case"PageUp":ye.preventDefault(),Dt({diff:-uI,direction:"previous",reason:"keyboard",event:ye}),qt(ye);break;case"PageDown":ye.preventDefault(),Dt({diff:uI,direction:"next",reason:"keyboard",event:ye}),qt(ye);break;case"ArrowDown":ye.preventDefault(),Dt({diff:1,direction:"next",reason:"keyboard",event:ye}),qt(ye);break;case"ArrowUp":ye.preventDefault(),Dt({diff:-1,direction:"previous",reason:"keyboard",event:ye}),qt(ye);break;case"ArrowLeft":!R&&ue?vt(0):jt(ye,"previous");break;case"ArrowRight":!R&&ue?vt(-1):jt(ye,"next");break;case"Enter":if(Ae.current!==-1&&Ve){const Ue=Oe[Ae.current],gt=k?k(Ue):!1;if(ye.preventDefault(),gt)return;Rn(ye,Ue,"selectOption"),r&&le.current.setSelectionRange(le.current.value.length,le.current.value.length)}else $&&Me!==""&&be===!1&&(R&&ye.preventDefault(),Rn(ye,Me,"createOption","freeSolo"));break;case"Escape":Ve?(ye.preventDefault(),ye.stopPropagation(),Pn(ye,"escape")):l&&(Me!==""||R&&re.length>0||ue)&&(ye.preventDefault(),ye.stopPropagation(),Ur(ye));break;case"Backspace":if(R&&!oe&&Me===""&&re.length>0){const Ue=se===-1?re.length-1:se,gt=re.slice();gt.splice(Ue,1),Se(ye,gt,"removeOption",{option:re[Ue]})}!R&&ue&&!oe&&(_e(null),vt(-1));break;case"Delete":if(R&&!oe&&Me===""&&re.length>0&&se!==-1){const Ue=se,gt=re.slice();gt.splice(Ue,1),Se(ye,gt,"removeOption",{option:re[Ue]})}!R&&ue&&!oe&&(_e(null),vt(-1));break}},mn=ge=>{St(!0),ae&&!Z.current&&qt(ge)},Bn=ge=>{if(t(fe)){le.current.focus();return}St(!1),de.current=!0,Z.current=!1,a&&Ae.current!==-1&&Ve?Rn(ge,Oe[Ae.current],"blur"):a&&$&&Me!==""?Rn(ge,Me,"blur","freeSolo"):s&&Ut(ge,re,"blur"),Pn(ge,"blur")},xe=ge=>{const ye=ge.target.value;Me!==ye&&(Ge(ye),ze(!1),I&&I(ge,ye,"input")),ye===""?!m&&!R&&Se(ge,null,"clear"):qt(ge)},Ee=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Ae.current!==ye&&st({event:ge,index:ye,reason:"mouse"})},Be=ge=>{st({event:ge,index:Number(ge.currentTarget.getAttribute("data-option-index")),reason:"touch"}),jn.current=!0},Ye=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Rn(ge,Oe[ye],"selectOption"),jn.current=!1},ut=ge=>ye=>{const Ue=re.slice();Ue.splice(ge,1),Se(ye,Ue,"removeOption",{option:re[ge]})},Et=ge=>{Se(ge,null,"removeOption",{option:re})},Ct=ge=>{at?Pn(ge,"toggleInput"):qt(ge)},Mt=ge=>{ge.currentTarget.contains(ge.target)&&ge.target.getAttribute("id")!==Q&&ge.preventDefault()},Lt=ge=>{ge.currentTarget.contains(ge.target)&&(le.current.focus(),G&&de.current&&le.current.selectionEnd-le.current.selectionStart===0&&le.current.select(),de.current=!1)},Xt=ge=>{!y&&(Me===""||!at)&&Ct(ge)};let zt=$&&Me.length>0;zt=zt||(R?re.length>0:re!==null);let Vt=Oe;return P&&(Vt=Oe.reduce((ge,ye,Ue)=>{const gt=P(ye);return ge.length>0&&ge[ge.length-1].group===gt?ge[ge.length-1].options.push(ye):ge.push({key:Ue,index:Ue,group:gt,options:[ye]}),ge},[])),y&&Je&&Bn(),{getRootProps:(ge={})=>({...ge,onKeyDown:qn(ge),onMouseDown:Mt,onClick:Lt}),getInputLabelProps:()=>({id:`${Q}-label`,htmlFor:Q}),getInputProps:()=>({id:Q,value:Me,onBlur:Bn,onFocus:mn,onChange:xe,onMouseDown:Xt,"aria-activedescendant":Ve?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Rt?`${Q}-listbox`:void 0,"aria-expanded":Rt,autoComplete:"off",ref:le,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:y}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Ur}),getItemProps:({index:ge=0}={})=>({...R&&{key:ge},...ue?{"data-item-index":ge}:{"data-tag-index":ge},tabIndex:-1,...!oe&&{onDelete:R?ut(ge):Et}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:Ct}),getTagProps:({index:ge})=>({key:ge,"data-tag-index":ge,tabIndex:-1,...!oe&&{onDelete:ut(ge)}}),getListboxProps:()=>({role:"listbox",id:`${Q}-listbox`,"aria-labelledby":`${Q}-label`,ref:$n,onMouseDown:ge=>{ge.preventDefault()}}),getOptionProps:({index:ge,option:ye})=>{const Ue=(R?re:[re]).some(We=>We!=null&&_(ye,We)),gt=k?k(ye):!1;return{key:T?.(ye)??ee(ye),tabIndex:-1,role:"option",id:`${Q}-option-${ge}`,onMouseMove:Ee,onClick:Ye,onTouchStart:Be,"data-option-index":ge,"aria-disabled":gt,"aria-selected":Ue}},id:Q,inputValue:Me,value:re,dirty:zt,expanded:Ve&&he,popupOpen:Ve,focused:Je||se!==-1,anchorEl:he,setAnchorEl:me,focusedItem:se,focusedTag:se,groupedOptions:Vt}}function J1e(e){return Cn("MuiListSubheader",e)}fn("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const ewe=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,i={root:["root",n!=="default"&&`color${Tt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return bn(i,J1e,t)},twe=nt("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Tt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(Gn(({theme:e})=>({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.inset,style:{paddingLeft:72}},{props:({ownerState:t})=>!t.disableSticky,style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),k$=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:i=!1,disableSticky:s=!1,inset:l=!1,...d}=n,u={...n,color:o,component:a,disableGutters:i,disableSticky:s,inset:l},m=ewe(u);return p.jsx(twe,{as:a,className:Ht(m.root,r),ref:t,ownerState:u,...d})});k$&&(k$.muiSkipListHighlight=!0);const nwe=Jt(p.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function rwe(e){return Cn("MuiAutocomplete",e)}const Jn=fn("MuiAutocomplete",["root","expanded","fullWidth","focused","focusVisible","tag","tagSizeSmall","tagSizeMedium","hasPopupIcon","hasClearIcon","inputRoot","input","inputFocused","endAdornment","clearIndicator","popupIndicator","popupIndicatorOpen","popper","popperDisablePortal","paper","listbox","loading","noOptions","option","groupLabel","groupUl"]);var fI,pI;const owe=e=>{const{classes:t,disablePortal:n,expanded:r,focused:o,fullWidth:a,hasClearIcon:i,hasPopupIcon:s,inputFocused:l,popupOpen:d,size:u}=e,m={root:["root",r&&"expanded",o&&"focused",a&&"fullWidth",i&&"hasClearIcon",s&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",l&&"inputFocused"],tag:["tag",`tagSize${Tt(u)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",d&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return bn(m,rwe,t)},awe=nt("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:i,size:s}=n;return[{[`& .${Jn.tag}`]:t.tag},{[`& .${Jn.tag}`]:t[`tagSize${Tt(s)}`]},{[`& .${Jn.inputRoot}`]:t.inputRoot},{[`& .${Jn.input}`]:t.input},{[`& .${Jn.input}`]:i&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Jn.focused} .${Jn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Jn.clearIndicator}`]:{visibility:"visible"}},[`& .${Jn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Jn.inputRoot}`]:{[`.${Jn.hasPopupIcon}&, .${Jn.hasClearIcon}&`]:{paddingRight:30},[`.${Jn.hasPopupIcon}.${Jn.hasClearIcon}&`]:{paddingRight:56},[`& .${Jn.input}`]:{width:0,minWidth:30}},[`& .${au.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${au.root}.${bi.sizeSmall}`]:{[`& .${au.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Wi.root}`]:{padding:9,[`.${Jn.hasPopupIcon}&, .${Jn.hasClearIcon}&`]:{paddingRight:39},[`.${Jn.hasPopupIcon}.${Jn.hasClearIcon}&`]:{paddingRight:65},[`& .${Jn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Jn.endAdornment}`]:{right:9}},[`& .${Wi.root}.${bi.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Jn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${xi.root}`]:{paddingTop:19,paddingLeft:8,[`.${Jn.hasPopupIcon}&, .${Jn.hasClearIcon}&`]:{paddingRight:39},[`.${Jn.hasPopupIcon}.${Jn.hasClearIcon}&`]:{paddingRight:65},[`& .${xi.input}`]:{padding:"7px 4px"},[`& .${Jn.endAdornment}`]:{right:9}},[`& .${xi.root}.${bi.sizeSmall}`]:{paddingBottom:1,[`& .${xi.input}`]:{padding:"2.5px 4px"}},[`& .${bi.hiddenLabel}`]:{paddingTop:8},[`& .${xi.root}.${bi.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Jn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${xi.root}.${bi.hiddenLabel}.${bi.sizeSmall}`]:{[`& .${Jn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Jn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Jn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Jn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Jn.inputRoot}`]:{flexWrap:"wrap"}}}]}),iwe=nt("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),swe=nt(Tu,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),lwe=nt(Tu,{name:"MuiAutocomplete",slot:"PopupIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen]}})({padding:2,marginRight:-2,variants:[{props:{popupOpen:!0},style:{transform:"rotate(180deg)"}}]}),cwe=nt(L2,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Jn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(Gn(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),uwe=nt(tf,{name:"MuiAutocomplete",slot:"Paper"})(Gn(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),dwe=nt("div",{name:"MuiAutocomplete",slot:"Loading"})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),fwe=nt("div",{name:"MuiAutocomplete",slot:"NoOptions"})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),pwe=nt("ul",{name:"MuiAutocomplete",slot:"Listbox"})(Gn(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Jn.option}`]:{minHeight:48,display:"flex",overflow:"hidden",justifyContent:"flex-start",alignItems:"center",cursor:"pointer",paddingTop:6,boxSizing:"border-box",outline:"0",WebkitTapHighlightColor:"transparent",paddingBottom:6,paddingLeft:16,paddingRight:16,[e.breakpoints.up("sm")]:{minHeight:"auto"},[`&.${Jn.focused}`]:{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},'&[aria-disabled="true"]':{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:"none"},[`&.${Jn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Jn.focused}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Jn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),hwe=nt(k$,{name:"MuiAutocomplete",slot:"GroupLabel"})(Gn(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),mwe=nt("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Jn.option}`]:{paddingLeft:24}}),gwe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,ChipProps:s,className:l,clearIcon:d=fI||(fI=p.jsx(nwe,{fontSize:"small"})),clearOnBlur:u=!n.freeSolo,clearOnEscape:m=!1,clearText:g="Clear",closeText:y="Close",componentsProps:x,defaultValue:w=n.multiple?[]:null,disableClearable:S=!1,disableCloseOnSelect:b=!1,disabled:$=!1,disabledItemsFocusable:k=!1,disableListWrap:T=!1,disablePortal:O=!1,filterOptions:P,filterSelectedOptions:D=!1,forcePopupIcon:A="auto",freeSolo:F=!1,fullWidth:L=!1,getLimitTagsText:_=we=>`+${we}`,getOptionDisabled:R,getOptionKey:z,getOptionLabel:N,isOptionEqualToValue:B,groupBy:I,handleHomeEndKeys:H=!n.freeSolo,id:Y,includeInputInList:ae=!1,inputValue:K,limitTags:oe=-1,ListboxComponent:ue,ListboxProps:G,loading:ie=!1,loadingText:Q="Loading…",multiple:ee=!1,noOptionsText:Z="No options",onChange:de,onClose:le,onHighlightChange:fe,onInputChange:he,onOpen:me,open:se,openOnFocus:ve=!1,openText:Le="Open",options:Ae,PaperComponent:Re,PopperComponent:re,popupIcon:_e=pI||(pI=p.jsx(W3,{})),readOnly:Me=!1,renderGroup:Ge,renderInput:Je,renderOption:St,renderTags:Ut,renderValue:at,selectOnFocus:tt=!n.freeSolo,size:pt="medium",slots:ze={},slotProps:be={},value:Ve,...Oe}=n,{getRootProps:$t,getInputProps:Rt,getInputLabelProps:vt,getPopupIndicatorProps:it,getClearProps:st,getItemProps:Dt,getListboxProps:nn,getOptionProps:Bt,value:pn,dirty:$n,expanded:qt,id:Pn,popupOpen:Se,focused:jn,focusedItem:Rn,anchorEl:en,setAnchorEl:jt,inputValue:Ur,groupedOptions:qn}=Z1e({...n,componentName:"Autocomplete"}),mn=!S&&!$&&$n&&!Me,Bn=(!F||A===!0)&&A!==!1,{onMouseDown:xe}=Rt(),{ref:Ee,...Be}=nn(),Ye=N||(we=>we.label??we),ut={...n,disablePortal:O,expanded:qt,focused:jn,fullWidth:L,getOptionLabel:Ye,hasClearIcon:mn,hasPopupIcon:Bn,inputFocused:Rn===-1,popupOpen:Se,size:pt},Et=owe(ut),Ct={slots:{paper:Re,popper:re,...ze},slotProps:{chip:s,listbox:G,...x,...be}},[Mt,Lt]=ur("listbox",{elementType:pwe,externalForwardedProps:Ct,ownerState:ut,className:Et.listbox,additionalProps:Be,ref:Ee}),[Xt,zt]=ur("paper",{elementType:tf,externalForwardedProps:Ct,ownerState:ut,className:Et.paper}),[Vt,ge]=ur("popper",{elementType:L2,externalForwardedProps:Ct,ownerState:ut,className:Et.popper,additionalProps:{disablePortal:O,style:{width:en?en.clientWidth:null},role:"presentation",anchorEl:en,open:Se}});let ye;const Ue=we=>({className:Et.tag,disabled:$,...Dt(we)});if(ee?pn.length>0&&(Ut?ye=Ut(pn,Ue,ut):at?ye=at(pn,Ue,ut):ye=pn.map((we,Pe)=>{const{key:ft,...kt}=Ue({index:Pe});return p.jsx(A3,{label:Ye(we),size:pt,...kt,...Ct.slotProps.chip},ft)})):at&&pn!=null&&(ye=at(pn,Ue,ut)),oe>-1&&Array.isArray(ye)){const we=ye.length-oe;!jn&&we>0&&(ye=ye.splice(0,oe),ye.push(p.jsx("span",{className:Et.tag,children:_(we)},ye.length)))}const gt=Ge||(we=>p.jsxs("li",{children:[p.jsx(hwe,{className:Et.groupLabel,ownerState:ut,component:"div",children:we.group}),p.jsx(mwe,{className:Et.groupUl,ownerState:ut,children:we.children})]},we.key)),We=St||((we,Pe)=>{const{key:ft,...kt}=we;return p.jsx("li",{...kt,children:Ye(Pe)},ft)}),Nt=(we,Pe)=>{const ft=Bt({option:we,index:Pe});return We({...ft,className:Et.option},we,{selected:ft["aria-selected"],index:Pe,inputValue:Ur},ut)},Kt=Ct.slotProps.clearIndicator,hn=Ct.slotProps.popupIndicator;return p.jsxs(C.Fragment,{children:[p.jsx(awe,{ref:t,className:Ht(Et.root,l),ownerState:ut,...$t(Oe),children:Je({id:Pn,disabled:$,fullWidth:!0,size:pt==="small"?"small":void 0,InputLabelProps:vt(),InputProps:{ref:jt,className:Et.inputRoot,startAdornment:ye,onMouseDown:we=>{we.target===we.currentTarget&&xe(we)},...(mn||Bn)&&{endAdornment:p.jsxs(iwe,{className:Et.endAdornment,ownerState:ut,children:[mn?p.jsx(swe,{...st(),"aria-label":g,title:g,ownerState:ut,...Kt,className:Ht(Et.clearIndicator,Kt?.className),children:d}):null,Bn?p.jsx(lwe,{...it(),disabled:$,"aria-label":Se?y:Le,title:Se?y:Le,ownerState:ut,...hn,className:Ht(Et.popupIndicator,hn?.className),children:_e}):null]})}},inputProps:{className:Et.input,disabled:$,readOnly:Me,...Rt()}})}),en?p.jsx(cwe,{as:Vt,...ge,children:p.jsxs(uwe,{as:Xt,...zt,children:[ie&&qn.length===0?p.jsx(dwe,{className:Et.loading,ownerState:ut,children:Q}):null,qn.length===0&&!F&&!ie?p.jsx(fwe,{className:Et.noOptions,ownerState:ut,role:"presentation",onMouseDown:we=>{we.preventDefault()},children:Z}):null,qn.length>0?p.jsx(Mt,{as:ue,...Lt,children:qn.map((we,Pe)=>I?gt({key:we.key,group:we.group,children:we.options.map((ft,kt)=>Nt(ft,we.index+kt))}):Nt(we,Pe))}):null]})}):null]})});Ar.extend(h2);const ywe=Jt(p.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),l6=e=>{if(!e)return"Explore semantic models, run queries, and build reports";const t=e.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),n=t.split(/\n\s*\n/)[1]||t;if(n.length<=120)return n;const r=n.substring(0,120).split(" ");return r.pop(),r.join(" ")+"..."},c6=(e,t)=>{const n=(e.readme||void 0)?.split(`
479
479
  `)??[];return n.length===0&&(n.push(`# ${e.name}`),n.push("")),(e.readme?.length??0)>0&&t?n.splice(2,1,t):t&&n.push(t),n.join(`
480
- `)};function hI(){const[e,t]=C.useState(!1),{apiClients:n}=tr(),r=()=>{t(!0)},o=()=>{t(!1)},a=Ch({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:c6({name:s.name,readme:""},s.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),i=async s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString();if(!d)throw new Error("Name is required");a.mutate({name:d,description:u})};return p.jsxs(kn.Fragment,{children:[p.jsx(Qy,{label:"Environment",onClick:r}),p.jsx(Oo,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:a.isPending,onClick:o,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:p.jsx("form",{onSubmit:i,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",placeholder:"Explore semantic models, run queries, and build reports",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}function ywe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=tr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(Ci,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete environment",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:i,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>s.mutate(),loading:s.isPending,children:"Delete environment"})]}),children:p.jsxs(Sr,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),s.notice]})}function vwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=tr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn(d){return o.environments.updateEnvironment(e.name,{name:e.name,readme:c6({name:e.name,readme:e.readme},d.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"update"}),l=d=>{d.preventDefault();const u=new FormData(d.currentTarget).get("description")?.toString();s.mutate({description:u})};return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(r2,{fontSize:"small"})}),p.jsx(Ci,{children:"Edit"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:s.isPending,onClick:i,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"environment-form",variant:"contained",loading:s.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:l,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:l6(e.readme),InputLabelProps:{shrink:!0}})]})})}),s.notice]})}const bwe=[{title:"Model",body:"An agent writes what the data means in Malloy — sources, joins, measures — from a warehouse or a file, and validates each edit without a restart.",href:tu.publishing},{title:"Analyze",body:"Claude, Cursor, Codex or an agent you build asks over MCP; applications and BI tools use REST. Every question runs against the model, never the raw tables.",href:tu.mcpAgents},{title:"Surface",body:"Reports declared in Malloy, laid out as a grid or read top to bottom, and no-build HTML data apps, all shipped inside the package, plus this Console for browsing them.",href:tu.surfaces},{title:"Govern",body:"Runtime parameters, row-level filters and per-source gates are declared in the model, so every surface reads the same rules rather than writing its own.",href:tu.givens},{title:"Optimize",body:"One annotation materializes an expensive source into a table, and another rolls a measure up to a coarser grain, rebuilt on demand or on a schedule.",href:tu.materialization},{title:"Run anywhere",body:"DuckDB is built in for CSV, Parquet, JSON and Excel; BigQuery, Snowflake, Postgres, Databricks, MotherDuck and more connect by configuration.",href:tu.connections}];function xwe({href:e,children:t}){return p.jsx(Te,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function YTe({onClickEnvironment:e}){const{apiClients:t,mutable:n}=tr(),{data:r,isSuccess:o,isError:a,error:i}=co({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return p.jsx(ja,{error:i,context:"Environments List"});if(!o)return p.jsx(Bo,{text:"Loading environments..."});const s=r.data??[];return p.jsxs(O0,{maxWidth:"md",sx:{py:6},children:[p.jsxs(Te,{sx:{mb:5},children:[p.jsx(wt,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),p.jsx(wt,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6},children:"One data model, served over MCP and REST to AI agents, applications and BI tools. Write down what your data means — the sources, the joins, the measures, who may see what — and every surface asks the same model, so the same question returns the same numbers tomorrow."})]}),p.jsx(Cp,{container:!0,spacing:4,sx:{mb:5},children:bwe.map(l=>p.jsx(Cp,{size:{xs:12,sm:6},children:p.jsxs(Yn,{spacing:1,children:[p.jsx(wt,{variant:"body2",component:"a",href:l.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:l.title}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:l.body})]})},l.title))}),p.jsx(wl,{sx:{my:4}}),s.length>0?p.jsx(Ns,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:p.jsx(hI,{})}:{},children:p.jsx(Yn,{children:s.map(l=>p.jsx(wwe,{environment:l,...e?{onClickEnvironment:e}:{}},l.name))})}):p.jsxs(Te,{sx:{mb:4},children:[p.jsx(wt,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:3,maxWidth:600},children:"Create your first Malloy environment to start exploring semantic models and building data experiences."}),n?p.jsx(hI,{}):p.jsx(Vn,{variant:"contained",color:"primary",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),p.jsx(wl,{sx:{my:4}}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",p.jsx(xwe,{href:"https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw",children:"Malloy Slack community"})," ","to ask questions, share ideas, and contribute."]})]})}function wwe({environment:e,onClickEnvironment:t}){const{mutable:n}=tr(),[r,o]=C.useState(null),a=!!r,i=l6(e.readme),s=d=>{d.stopPropagation(),o(d.currentTarget)},l=()=>o(null);return p.jsx(L1,{icon:p.jsx(gwe,{sx:{fontSize:18}}),tint:ZR.environment,label:e.name??"",ariaLabel:e.name??"",...i?{description:i}:{},...e.name&&t?{onClick:d=>t(`/${e.name}/`,d)}:{},...n?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small",onClick:s,"aria-label":`Environment actions for ${e.name}`,children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:r,open:a,onClose:l,onClick:d=>d.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(vwe,{environment:e,onCloseDialog:l}),p.jsx(ywe,{environment:e,onCloseDialog:l})]})]})}:{}})}var fp={},hi={},ig={},pp={},mI={},gI;function Swe(){return gI||(gI=1,Object.defineProperty(mI,"__esModule",{value:!0})),mI}var sg={},lg={},yI;function rf(){if(yI)return lg;yI=1,Object.defineProperty(lg,"__esModule",{value:!0}),lg.CronField=void 0;let e=class u6{#e=!1;#t=!1;#n=!1;#o=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(n,r={rawValue:""}){if(!Array.isArray(n))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(n.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...r,rawValue:r.rawValue??""},this.#o=n.sort(u6.sorter),this.#n=this.options.wildcard!==void 0?this.options.wildcard:this.#r(),this.#e=this.options.rawValue.includes("L")||n.includes("L"),this.#t=this.options.rawValue.includes("?")||n.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#o}static sorter(n,r){const o=typeof n=="number",a=typeof r=="number";return o&&a?n-r:!o&&!a?n.localeCompare(r):o?-1:1}static findNearestValueInList(n,r,o){if(o){for(let a=n.length-1;a>=0;a--)if(n[a]<r)return n[a];return null}for(let a=0;a<n.length;a++)if(n[a]>r)return n[a];return null}findNearestValue(n,r){return this.constructor.findNearestValueInList(this.values,n,r)}serialize(){return{wildcard:this.#n,values:this.#o}}validate(){let n;const r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",o=s=>l=>new RegExp(`^\\d{0,2}${l}$`).test(s),a=s=>(n=s,typeof s=="number"?s>=this.min&&s<=this.max:this.chars.some(o(s)));if(!this.#o.every(a))throw new Error(`${this.constructor.name} Validation error, got value ${n} expected range ${this.min}-${this.max}${r}`);const i=this.#o.find((s,l)=>this.#o.indexOf(s)!==l);if(i)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${i}`)}#r(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(n,r)=>r+this.min).every(n=>this.#o.includes(n))}};return lg.CronField=e,lg}var vI;function Cwe(){if(vI)return sg;vI=1,Object.defineProperty(sg,"__esModule",{value:!0}),sg.CronDayOfMonth=void 0;const e=rf(),t=1,n=31,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return sg.CronDayOfMonth=o,sg}var cg={},bI;function kwe(){if(bI)return cg;bI=1,Object.defineProperty(cg,"__esModule",{value:!0}),cg.CronDayOfWeek=void 0;const e=rf(),t=0,n=7,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};return cg.CronDayOfWeek=o,cg}var ug={},xI;function $we(){if(xI)return ug;xI=1,Object.defineProperty(ug,"__esModule",{value:!0}),ug.CronHour=void 0;const e=rf(),t=0,n=23,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return ug.CronHour=o,ug}var dg={},wI;function Rwe(){if(wI)return dg;wI=1,Object.defineProperty(dg,"__esModule",{value:!0}),dg.CronMinute=void 0;const e=rf(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return dg.CronMinute=o,dg}var fg={},SI={},Ba={},CI;function Twe(){if(CI)return Ba;CI=1,Object.defineProperty(Ba,"__esModule",{value:!0});class e extends Error{}class t extends e{constructor(M){super(`Invalid DateTime: ${M.toMessage()}`)}}class n extends e{constructor(M){super(`Invalid Interval: ${M.toMessage()}`)}}class r extends e{constructor(M){super(`Invalid Duration: ${M.toMessage()}`)}}class o extends e{}class a extends e{constructor(M){super(`Invalid unit ${M}`)}}class i extends e{}class s extends e{constructor(){super("Zone is an abstract class")}}const l="numeric",d="short",u="long",m={year:l,month:l,day:l},g={year:l,month:d,day:l},y={year:l,month:d,day:l,weekday:d},x={year:l,month:u,day:l},w={year:l,month:u,day:l,weekday:u},S={hour:l,minute:l},b={hour:l,minute:l,second:l},$={hour:l,minute:l,second:l,timeZoneName:d},k={hour:l,minute:l,second:l,timeZoneName:u},T={hour:l,minute:l,hourCycle:"h23"},O={hour:l,minute:l,second:l,hourCycle:"h23"},P={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:d},D={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:u},A={year:l,month:l,day:l,hour:l,minute:l},F={year:l,month:l,day:l,hour:l,minute:l,second:l},L={year:l,month:d,day:l,hour:l,minute:l},_={year:l,month:d,day:l,hour:l,minute:l,second:l},R={year:l,month:d,day:l,weekday:d,hour:l,minute:l},z={year:l,month:u,day:l,hour:l,minute:l,timeZoneName:d},N={year:l,month:u,day:l,hour:l,minute:l,second:l,timeZoneName:d},B={year:l,month:u,day:l,weekday:u,hour:l,minute:l,timeZoneName:u},I={year:l,month:u,day:l,weekday:u,hour:l,minute:l,second:l,timeZoneName:u};class H{get type(){throw new s}get name(){throw new s}get ianaName(){return this.name}get isUniversal(){throw new s}offsetName(M,q){throw new s}formatOffset(M,q){throw new s}offset(M){throw new s}equals(M){throw new s}get isValid(){throw new s}}let Y=null;class ae extends H{static get instance(){return Y===null&&(Y=new ae),Y}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(M,{format:q,locale:J}){return Ou(M,q,J)}formatOffset(M,q){return Us(this.offset(M),q)}offset(M){return-new Date(M).getTimezoneOffset()}equals(M){return M.type==="system"}get isValid(){return!0}}const K=new Map;function oe(W){let M=K.get(W);return M===void 0&&(M=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:W,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),K.set(W,M)),M}const ue={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function G(W,M){const q=W.format(M).replace(/\u200E/g,""),J=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(q),[,ce,Ce,Ne,qe,Xe,At,Mn]=J;return[Ne,ce,Ce,qe,Xe,At,Mn]}function ie(W,M){const q=W.formatToParts(M),J=[];for(let ce=0;ce<q.length;ce++){const{type:Ce,value:Ne}=q[ce],qe=ue[Ce];Ce==="era"?J[qe]=Ne:We(qe)||(J[qe]=parseInt(Ne,10))}return J}const Q=new Map;class ee extends H{static create(M){let q=Q.get(M);return q===void 0&&Q.set(M,q=new ee(M)),q}static resetCache(){Q.clear(),K.clear()}static isValidSpecifier(M){return this.isValidZone(M)}static isValidZone(M){if(!M)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:M}).format(),!0}catch{return!1}}constructor(M){super(),this.zoneName=M,this.valid=ee.isValidZone(M)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(M,{format:q,locale:J}){return Ou(M,q,J,this.name)}formatOffset(M,q){return Us(this.offset(M),q)}offset(M){if(!this.valid)return NaN;const q=new Date(M);if(isNaN(q))return NaN;const J=oe(this.name);let[ce,Ce,Ne,qe,Xe,At,Mn]=J.formatToParts?ie(J,q):G(J,q);qe==="BC"&&(ce=-Math.abs(ce)+1);const Fn=ti({year:ce,month:Ce,day:Ne,hour:Xe===24?0:Xe,minute:At,second:Mn,millisecond:0});let pr=+q;const An=pr%1e3;return pr-=An>=0?An:1e3+An,(Fn-pr)/(60*1e3)}equals(M){return M.type==="iana"&&M.name===this.name}get isValid(){return this.valid}}let Z={};function de(W,M={}){const q=JSON.stringify([W,M]);let J=Z[q];return J||(J=new Intl.ListFormat(W,M),Z[q]=J),J}const le=new Map;function fe(W,M={}){const q=JSON.stringify([W,M]);let J=le.get(q);return J===void 0&&(J=new Intl.DateTimeFormat(W,M),le.set(q,J)),J}const he=new Map;function me(W,M={}){const q=JSON.stringify([W,M]);let J=he.get(q);return J===void 0&&(J=new Intl.NumberFormat(W,M),he.set(q,J)),J}const se=new Map;function ve(W,M={}){const{base:q,...J}=M,ce=JSON.stringify([W,J]);let Ce=se.get(ce);return Ce===void 0&&(Ce=new Intl.RelativeTimeFormat(W,M),se.set(ce,Ce)),Ce}let Le=null;function Ae(){return Le||(Le=new Intl.DateTimeFormat().resolvedOptions().locale,Le)}const Re=new Map;function re(W){let M=Re.get(W);return M===void 0&&(M=new Intl.DateTimeFormat(W).resolvedOptions(),Re.set(W,M)),M}const _e=new Map;function Me(W){let M=_e.get(W);if(!M){const q=new Intl.Locale(W);M="getWeekInfo"in q?q.getWeekInfo():q.weekInfo,"minimalDays"in M||(M={...Ve,...M}),_e.set(W,M)}return M}function Ge(W){const M=W.indexOf("-x-");M!==-1&&(W=W.substring(0,M));const q=W.indexOf("-u-");if(q===-1)return[W];{let J,ce;try{J=fe(W).resolvedOptions(),ce=W}catch{const qe=W.substring(0,q);J=fe(qe).resolvedOptions(),ce=qe}const{numberingSystem:Ce,calendar:Ne}=J;return[ce,Ce,Ne]}}function Je(W,M,q){return(q||M)&&(W.includes("-u-")||(W+="-u"),q&&(W+=`-ca-${q}`),M&&(W+=`-nu-${M}`)),W}function St(W){const M=[];for(let q=1;q<=12;q++){const J=En.utc(2009,q,1);M.push(W(J))}return M}function Ut(W){const M=[];for(let q=1;q<=7;q++){const J=En.utc(2016,11,13+q);M.push(W(J))}return M}function at(W,M,q,J){const ce=W.listingMode();return ce==="error"?null:ce==="en"?q(M):J(M)}function tt(W){return W.numberingSystem&&W.numberingSystem!=="latn"?!1:W.numberingSystem==="latn"||!W.locale||W.locale.startsWith("en")||re(W.locale).numberingSystem==="latn"}class pt{constructor(M,q,J){this.padTo=J.padTo||0,this.floor=J.floor||!1;const{padTo:ce,floor:Ce,...Ne}=J;if(!q||Object.keys(Ne).length>0){const qe={useGrouping:!1,...J};J.padTo>0&&(qe.minimumIntegerDigits=J.padTo),this.inf=me(M,qe)}}format(M){if(this.inf){const q=this.floor?Math.floor(M):M;return this.inf.format(q)}else{const q=this.floor?Math.floor(M):vs(M,3);return tn(q,this.padTo)}}}class ze{constructor(M,q,J){this.opts=J,this.originalZone=void 0;let ce;if(this.opts.timeZone)this.dt=M;else if(M.zone.type==="fixed"){const Ne=-1*(M.offset/60),qe=Ne>=0?`Etc/GMT+${Ne}`:`Etc/GMT${Ne}`;M.offset!==0&&ee.create(qe).valid?(ce=qe,this.dt=M):(ce="UTC",this.dt=M.offset===0?M:M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone)}else M.zone.type==="system"?this.dt=M:M.zone.type==="iana"?(this.dt=M,ce=M.zone.name):(ce="UTC",this.dt=M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone);const Ce={...this.opts};Ce.timeZone=Ce.timeZone||ce,this.dtf=fe(q,Ce)}format(){return this.originalZone?this.formatToParts().map(({value:M})=>M).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const M=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?M.map(q=>{if(q.type==="timeZoneName"){const J=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...q,value:J}}else return q}):M}resolvedOptions(){return this.dtf.resolvedOptions()}}class be{constructor(M,q,J){this.opts={style:"long",...J},!q&&Pe()&&(this.rtf=ve(M,J))}format(M,q){return this.rtf?this.rtf.format(M,q):Sc(q,M,this.opts.numeric,this.opts.style!=="long")}formatToParts(M,q){return this.rtf?this.rtf.formatToParts(M,q):[]}}const Ve={firstDay:1,minimalDays:4,weekend:[6,7]};class Oe{static fromOpts(M){return Oe.create(M.locale,M.numberingSystem,M.outputCalendar,M.weekSettings,M.defaultToEN)}static create(M,q,J,ce,Ce=!1){const Ne=M||mn.defaultLocale,qe=Ne||(Ce?"en-US":Ae()),Xe=q||mn.defaultNumberingSystem,At=J||mn.defaultOutputCalendar,Mn=on(ce)||mn.defaultWeekSettings;return new Oe(qe,Xe,At,Mn,Ne)}static resetCache(){Le=null,le.clear(),he.clear(),se.clear(),Re.clear(),_e.clear()}static fromObject({locale:M,numberingSystem:q,outputCalendar:J,weekSettings:ce}={}){return Oe.create(M,q,J,ce)}constructor(M,q,J,ce,Ce){const[Ne,qe,Xe]=Ge(M);this.locale=Ne,this.numberingSystem=q||qe||null,this.outputCalendar=J||Xe||null,this.weekSettings=ce,this.intl=Je(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=Ce,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=tt(this)),this.fastNumbersCached}listingMode(){const M=this.isEnglish(),q=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return M&&q?"en":"intl"}clone(M){return!M||Object.getOwnPropertyNames(M).length===0?this:Oe.create(M.locale||this.specifiedLocale,M.numberingSystem||this.numberingSystem,M.outputCalendar||this.outputCalendar,on(M.weekSettings)||this.weekSettings,M.defaultToEN||!1)}redefaultToEN(M={}){return this.clone({...M,defaultToEN:!0})}redefaultToSystem(M={}){return this.clone({...M,defaultToEN:!1})}months(M,q=!1){return at(this,M,Pl,()=>{const J=this.intl==="ja"||this.intl.startsWith("ja-");q&=!J;const ce=q?{month:M,day:"numeric"}:{month:M},Ce=q?"format":"standalone";if(!this.monthsCache[Ce][M]){const Ne=J?qe=>this.dtFormatter(qe,ce).format():qe=>this.extract(qe,ce,"month");this.monthsCache[Ce][M]=St(Ne)}return this.monthsCache[Ce][M]})}weekdays(M,q=!1){return at(this,M,ws,()=>{const J=q?{weekday:M,year:"numeric",month:"long",day:"numeric"}:{weekday:M},ce=q?"format":"standalone";return this.weekdaysCache[ce][M]||(this.weekdaysCache[ce][M]=Ut(Ce=>this.extract(Ce,J,"weekday"))),this.weekdaysCache[ce][M]})}meridiems(){return at(this,void 0,()=>ju,()=>{if(!this.meridiemCache){const M={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[En.utc(2016,11,13,9),En.utc(2016,11,13,19)].map(q=>this.extract(q,M,"dayperiod"))}return this.meridiemCache})}eras(M){return at(this,M,Da,()=>{const q={era:M};return this.eraCache[M]||(this.eraCache[M]=[En.utc(-40,1,1),En.utc(2017,1,1)].map(J=>this.extract(J,q,"era"))),this.eraCache[M]})}extract(M,q,J){const ce=this.dtFormatter(M,q),Ce=ce.formatToParts(),Ne=Ce.find(qe=>qe.type.toLowerCase()===J);return Ne?Ne.value:null}numberFormatter(M={}){return new pt(this.intl,M.forceSimple||this.fastNumbers,M)}dtFormatter(M,q={}){return new ze(M,this.intl,q)}relFormatter(M={}){return new be(this.intl,this.isEnglish(),M)}listFormatter(M={}){return de(this.intl,M)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||re(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ft()?Me(this.locale):Ve}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(M){return this.locale===M.locale&&this.numberingSystem===M.numberingSystem&&this.outputCalendar===M.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let $t=null;class Rt extends H{static get utcInstance(){return $t===null&&($t=new Rt(0)),$t}static instance(M){return M===0?Rt.utcInstance:new Rt(M)}static parseSpecifier(M){if(M){const q=M.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(q)return new Rt(Ml(q[1],q[2]))}return null}constructor(M){super(),this.fixed=M}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Us(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Us(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(M,q){return Us(this.fixed,q)}get isUniversal(){return!0}offset(){return this.fixed}equals(M){return M.type==="fixed"&&M.fixed===this.fixed}get isValid(){return!0}}class vt extends H{constructor(M){super(),this.zoneName=M}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function it(W,M){if(We(W)||W===null)return M;if(W instanceof H)return W;if(hn(W)){const q=W.toLowerCase();return q==="default"?M:q==="local"||q==="system"?ae.instance:q==="utc"||q==="gmt"?Rt.utcInstance:Rt.parseSpecifier(q)||ee.create(W)}else return Nt(W)?Rt.instance(W):typeof W=="object"&&"offset"in W&&typeof W.offset=="function"?W:new vt(W)}const st={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Dt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},nn=st.hanidec.replace(/[\[|\]]/g,"").split("");function Bt(W){let M=parseInt(W,10);if(isNaN(M)){M="";for(let q=0;q<W.length;q++){const J=W.charCodeAt(q);if(W[q].search(st.hanidec)!==-1)M+=nn.indexOf(W[q]);else for(const ce in Dt){const[Ce,Ne]=Dt[ce];J>=Ce&&J<=Ne&&(M+=J-Ce)}}return parseInt(M,10)}else return M}const pn=new Map;function $n(){pn.clear()}function qt({numberingSystem:W},M=""){const q=W||"latn";let J=pn.get(q);J===void 0&&(J=new Map,pn.set(q,J));let ce=J.get(M);return ce===void 0&&(ce=new RegExp(`${st[q]}${M}`),J.set(M,ce)),ce}let Pn=()=>Date.now(),Se="system",jn=null,Rn=null,en=null,jt=60,Ur,qn=null;class mn{static get now(){return Pn}static set now(M){Pn=M}static set defaultZone(M){Se=M}static get defaultZone(){return it(Se,ae.instance)}static get defaultLocale(){return jn}static set defaultLocale(M){jn=M}static get defaultNumberingSystem(){return Rn}static set defaultNumberingSystem(M){Rn=M}static get defaultOutputCalendar(){return en}static set defaultOutputCalendar(M){en=M}static get defaultWeekSettings(){return qn}static set defaultWeekSettings(M){qn=on(M)}static get twoDigitCutoffYear(){return jt}static set twoDigitCutoffYear(M){jt=M%100}static get throwOnInvalid(){return Ur}static set throwOnInvalid(M){Ur=M}static resetCaches(){Oe.resetCache(),ee.resetCache(),En.resetCache(),$n()}}class Bn{constructor(M,q){this.reason=M,this.explanation=q}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xe=[0,31,59,90,120,151,181,212,243,273,304,334],Ee=[0,31,60,91,121,152,182,213,244,274,305,335];function Be(W,M){return new Bn("unit out of range",`you specified ${M} (of type ${typeof M}) as a ${W}, which is invalid`)}function Ye(W,M,q){const J=new Date(Date.UTC(W,M-1,q));W<100&&W>=0&&J.setUTCFullYear(J.getUTCFullYear()-1900);const ce=J.getUTCDay();return ce===0?7:ce}function ut(W,M,q){return q+(ca(W)?Ee:xe)[M-1]}function Et(W,M){const q=ca(W)?Ee:xe,J=q.findIndex(Ce=>Ce<M),ce=M-q[J];return{month:J+1,day:ce}}function Ct(W,M){return(W-M+7)%7+1}function Mt(W,M=4,q=1){const{year:J,month:ce,day:Ce}=W,Ne=ut(J,ce,Ce),qe=Ct(Ye(J,ce,Ce),q);let Xe=Math.floor((Ne-qe+14-M)/7),At;return Xe<1?(At=J-1,Xe=bs(At,M,q)):Xe>bs(J,M,q)?(At=J+1,Xe=1):At=J,{weekYear:At,weekNumber:Xe,weekday:qe,...Ol(W)}}function Lt(W,M=4,q=1){const{weekYear:J,weekNumber:ce,weekday:Ce}=W,Ne=Ct(Ye(J,1,M),q),qe=fr(J);let Xe=ce*7+Ce-Ne-7+M,At;Xe<1?(At=J-1,Xe+=fr(At)):Xe>qe?(At=J+1,Xe-=fr(J)):At=J;const{month:Mn,day:Fn}=Et(At,Xe);return{year:At,month:Mn,day:Fn,...Ol(W)}}function Xt(W){const{year:M,month:q,day:J}=W,ce=ut(M,q,J);return{year:M,ordinal:ce,...Ol(W)}}function zt(W){const{year:M,ordinal:q}=W,{month:J,day:ce}=Et(M,q);return{year:M,month:J,day:ce,...Ol(W)}}function Vt(W,M){if(!We(W.localWeekday)||!We(W.localWeekNumber)||!We(W.localWeekYear)){if(!We(W.weekday)||!We(W.weekNumber)||!We(W.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return We(W.localWeekday)||(W.weekday=W.localWeekday),We(W.localWeekNumber)||(W.weekNumber=W.localWeekNumber),We(W.localWeekYear)||(W.weekYear=W.localWeekYear),delete W.localWeekday,delete W.localWeekNumber,delete W.localWeekYear,{minDaysInFirstWeek:M.getMinDaysInFirstWeek(),startOfWeek:M.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ge(W,M=4,q=1){const J=Kt(W.weekYear),ce=On(W.weekNumber,1,bs(W.weekYear,M,q)),Ce=On(W.weekday,1,7);return J?ce?Ce?!1:Be("weekday",W.weekday):Be("week",W.weekNumber):Be("weekYear",W.weekYear)}function ye(W){const M=Kt(W.year),q=On(W.ordinal,1,fr(W.year));return M?q?!1:Be("ordinal",W.ordinal):Be("year",W.year)}function Ue(W){const M=Kt(W.year),q=On(W.month,1,12),J=On(W.day,1,qr(W.year,W.month));return M?q?J?!1:Be("day",W.day):Be("month",W.month):Be("year",W.year)}function gt(W){const{hour:M,minute:q,second:J,millisecond:ce}=W,Ce=On(M,0,23)||M===24&&q===0&&J===0&&ce===0,Ne=On(q,0,59),qe=On(J,0,59),Xe=On(ce,0,999);return Ce?Ne?qe?Xe?!1:Be("millisecond",ce):Be("second",J):Be("minute",q):Be("hour",M)}function We(W){return typeof W>"u"}function Nt(W){return typeof W=="number"}function Kt(W){return typeof W=="number"&&W%1===0}function hn(W){return typeof W=="string"}function we(W){return Object.prototype.toString.call(W)==="[object Date]"}function Pe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ft(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function kt(W){return Array.isArray(W)?W:[W]}function Ot(W,M,q){if(W.length!==0)return W.reduce((J,ce)=>{const Ce=[M(ce),ce];return J&&q(J[0],Ce[0])===J[0]?J:Ce},null)[1]}function Pt(W,M){return M.reduce((q,J)=>(q[J]=W[J],q),{})}function Ft(W,M){return Object.prototype.hasOwnProperty.call(W,M)}function on(W){if(W==null)return null;if(typeof W!="object")throw new i("Week settings must be an object");if(!On(W.firstDay,1,7)||!On(W.minimalDays,1,7)||!Array.isArray(W.weekend)||W.weekend.some(M=>!On(M,1,7)))throw new i("Invalid week settings");return{firstDay:W.firstDay,minimalDays:W.minimalDays,weekend:Array.from(W.weekend)}}function On(W,M,q){return Kt(W)&&W>=M&&W<=q}function or(W,M){return W-M*Math.floor(W/M)}function tn(W,M=2){const q=W<0;let J;return q?J="-"+(""+-W).padStart(M,"0"):J=(""+W).padStart(M,"0"),J}function Dr(W){if(!(We(W)||W===null||W===""))return parseInt(W,10)}function fo(W){if(!(We(W)||W===null||W===""))return parseFloat(W)}function Do(W){if(!(We(W)||W===null||W==="")){const M=parseFloat("0."+W)*1e3;return Math.floor(M)}}function vs(W,M,q="round"){const J=10**M;switch(q){case"expand":return W>0?Math.ceil(W*J)/J:Math.floor(W*J)/J;case"trunc":return Math.trunc(W*J)/J;case"round":return Math.round(W*J)/J;case"floor":return Math.floor(W*J)/J;case"ceil":return Math.ceil(W*J)/J;default:throw new RangeError(`Value rounding ${q} is out of range`)}}function ca(W){return W%4===0&&(W%100!==0||W%400===0)}function fr(W){return ca(W)?366:365}function qr(W,M){const q=or(M-1,12)+1,J=W+(M-q)/12;return q===2?ca(J)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][q-1]}function ti(W){let M=Date.UTC(W.year,W.month-1,W.day,W.hour,W.minute,W.second,W.millisecond);return W.year<100&&W.year>=0&&(M=new Date(M),M.setUTCFullYear(W.year,W.month-1,W.day)),+M}function El(W,M,q){return-Ct(Ye(W,1,M),q)+M-1}function bs(W,M=4,q=1){const J=El(W,M,q),ce=El(W+1,M,q);return(fr(W)-J+ce)/7}function Di(W){return W>99?W:W>mn.twoDigitCutoffYear?1900+W:2e3+W}function Ou(W,M,q,J=null){const ce=new Date(W),Ce={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};J&&(Ce.timeZone=J);const Ne={timeZoneName:M,...Ce},qe=new Intl.DateTimeFormat(q,Ne).formatToParts(ce).find(Xe=>Xe.type.toLowerCase()==="timezonename");return qe?qe.value:null}function Ml(W,M){let q=parseInt(W,10);Number.isNaN(q)&&(q=0);const J=parseInt(M,10)||0,ce=q<0||Object.is(q,-0)?-J:J;return q*60+ce}function xs(W){const M=Number(W);if(typeof W=="boolean"||W===""||!Number.isFinite(M))throw new i(`Invalid unit value ${W}`);return M}function bc(W,M){const q={};for(const J in W)if(Ft(W,J)){const ce=W[J];if(ce==null)continue;q[M(J)]=xs(ce)}return q}function Us(W,M){const q=Math.trunc(Math.abs(W/60)),J=Math.trunc(Math.abs(W%60)),ce=W>=0?"+":"-";switch(M){case"short":return`${ce}${tn(q,2)}:${tn(J,2)}`;case"narrow":return`${ce}${q}${J>0?`:${J}`:""}`;case"techie":return`${ce}${tn(q,2)}${tn(J,2)}`;default:throw new RangeError(`Value format ${M} is out of range for property format`)}}function Ol(W){return Pt(W,["hour","minute","second","millisecond"])}const Pu=["January","February","March","April","May","June","July","August","September","October","November","December"],af=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$h=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pl(W){switch(W){case"narrow":return[...$h];case"short":return[...af];case"long":return[...Pu];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const xc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],wc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qs=["M","T","W","T","F","S","S"];function ws(W){switch(W){case"narrow":return[...qs];case"short":return[...wc];case"long":return[...xc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const ju=["AM","PM"],Au=["Before Christ","Anno Domini"],sf=["BC","AD"],jl=["B","A"];function Da(W){switch(W){case"narrow":return[...jl];case"short":return[...sf];case"long":return[...Au];default:return null}}function Du(W){return ju[W.hour<12?0:1]}function Al(W,M){return ws(M)[W.weekday-1]}function Ni(W,M){return Pl(M)[W.month-1]}function Nu(W,M){return Da(M)[W.year<0?0:1]}function Sc(W,M,q="always",J=!1){const ce={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},Ce=["hours","minutes","seconds"].indexOf(W)===-1;if(q==="auto"&&Ce){const Fn=W==="days";switch(M){case 1:return Fn?"tomorrow":`next ${ce[W][0]}`;case-1:return Fn?"yesterday":`last ${ce[W][0]}`;case 0:return Fn?"today":`this ${ce[W][0]}`}}const Ne=Object.is(M,-0)||M<0,qe=Math.abs(M),Xe=qe===1,At=ce[W],Mn=J?Xe?At[1]:At[2]||At[1]:Xe?ce[W][0]:W;return Ne?`${qe} ${Mn} ago`:`in ${qe} ${Mn}`}function Iu(W,M){let q="";for(const J of W)J.literal?q+=J.val:q+=M(J.val);return q}const Cc={D:m,DD:g,DDD:x,DDDD:w,t:S,tt:b,ttt:$,tttt:k,T,TT:O,TTT:P,TTTT:D,f:A,ff:L,fff:z,ffff:B,F,FF:_,FFF:N,FFFF:I};class oo{static create(M,q={}){return new oo(M,q)}static parseFormat(M){let q=null,J="",ce=!1;const Ce=[];for(let Ne=0;Ne<M.length;Ne++){const qe=M.charAt(Ne);qe==="'"?((J.length>0||ce)&&Ce.push({literal:ce||/^\s+$/.test(J),val:J===""?"'":J}),q=null,J="",ce=!ce):ce||qe===q?J+=qe:(J.length>0&&Ce.push({literal:/^\s+$/.test(J),val:J}),J=qe,q=qe)}return J.length>0&&Ce.push({literal:ce||/^\s+$/.test(J),val:J}),Ce}static macroTokenToFormatOpts(M){return Cc[M]}constructor(M,q){this.opts=q,this.loc=M,this.systemLoc=null}formatWithSystemDefault(M,q){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(M,{...this.opts,...q}).format()}dtFormatter(M,q={}){return this.loc.dtFormatter(M,{...this.opts,...q})}formatDateTime(M,q){return this.dtFormatter(M,q).format()}formatDateTimeParts(M,q){return this.dtFormatter(M,q).formatToParts()}formatInterval(M,q){return this.dtFormatter(M.start,q).dtf.formatRange(M.start.toJSDate(),M.end.toJSDate())}resolvedOptions(M,q){return this.dtFormatter(M,q).resolvedOptions()}num(M,q=0,J=void 0){if(this.opts.forceSimple)return tn(M,q);const ce={...this.opts};return q>0&&(ce.padTo=q),J&&(ce.signDisplay=J),this.loc.numberFormatter(ce).format(M)}formatDateTimeFromString(M,q){const J=this.loc.listingMode()==="en",ce=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",Ce=(An,Jr)=>this.loc.extract(M,An,Jr),Ne=An=>M.isOffsetFixed&&M.offset===0&&An.allowZ?"Z":M.isValid?M.zone.formatOffset(M.ts,An.format):"",qe=()=>J?Du(M):Ce({hour:"numeric",hourCycle:"h12"},"dayperiod"),Xe=(An,Jr)=>J?Ni(M,An):Ce(Jr?{month:An}:{month:An,day:"numeric"},"month"),At=(An,Jr)=>J?Al(M,An):Ce(Jr?{weekday:An}:{weekday:An,month:"long",day:"numeric"},"weekday"),Mn=An=>{const Jr=oo.macroTokenToFormatOpts(An);return Jr?this.formatWithSystemDefault(M,Jr):An},Fn=An=>J?Nu(M,An):Ce({era:An},"era"),pr=An=>{switch(An){case"S":return this.num(M.millisecond);case"u":case"SSS":return this.num(M.millisecond,3);case"s":return this.num(M.second);case"ss":return this.num(M.second,2);case"uu":return this.num(Math.floor(M.millisecond/10),2);case"uuu":return this.num(Math.floor(M.millisecond/100));case"m":return this.num(M.minute);case"mm":return this.num(M.minute,2);case"h":return this.num(M.hour%12===0?12:M.hour%12);case"hh":return this.num(M.hour%12===0?12:M.hour%12,2);case"H":return this.num(M.hour);case"HH":return this.num(M.hour,2);case"Z":return Ne({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return Ne({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return Ne({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return M.zone.offsetName(M.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return M.zone.offsetName(M.ts,{format:"long",locale:this.loc.locale});case"z":return M.zoneName;case"a":return qe();case"d":return ce?Ce({day:"numeric"},"day"):this.num(M.day);case"dd":return ce?Ce({day:"2-digit"},"day"):this.num(M.day,2);case"c":return this.num(M.weekday);case"ccc":return At("short",!0);case"cccc":return At("long",!0);case"ccccc":return At("narrow",!0);case"E":return this.num(M.weekday);case"EEE":return At("short",!1);case"EEEE":return At("long",!1);case"EEEEE":return At("narrow",!1);case"L":return ce?Ce({month:"numeric",day:"numeric"},"month"):this.num(M.month);case"LL":return ce?Ce({month:"2-digit",day:"numeric"},"month"):this.num(M.month,2);case"LLL":return Xe("short",!0);case"LLLL":return Xe("long",!0);case"LLLLL":return Xe("narrow",!0);case"M":return ce?Ce({month:"numeric"},"month"):this.num(M.month);case"MM":return ce?Ce({month:"2-digit"},"month"):this.num(M.month,2);case"MMM":return Xe("short",!1);case"MMMM":return Xe("long",!1);case"MMMMM":return Xe("narrow",!1);case"y":return ce?Ce({year:"numeric"},"year"):this.num(M.year);case"yy":return ce?Ce({year:"2-digit"},"year"):this.num(M.year.toString().slice(-2),2);case"yyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,4);case"yyyyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,6);case"G":return Fn("short");case"GG":return Fn("long");case"GGGGG":return Fn("narrow");case"kk":return this.num(M.weekYear.toString().slice(-2),2);case"kkkk":return this.num(M.weekYear,4);case"W":return this.num(M.weekNumber);case"WW":return this.num(M.weekNumber,2);case"n":return this.num(M.localWeekNumber);case"nn":return this.num(M.localWeekNumber,2);case"ii":return this.num(M.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(M.localWeekYear,4);case"o":return this.num(M.ordinal);case"ooo":return this.num(M.ordinal,3);case"q":return this.num(M.quarter);case"qq":return this.num(M.quarter,2);case"X":return this.num(Math.floor(M.ts/1e3));case"x":return this.num(M.ts);default:return Mn(An)}};return Iu(oo.parseFormat(q),pr)}formatDurationFromString(M,q){const J=this.opts.signMode==="negativeLargestOnly"?-1:1,ce=Mn=>{switch(Mn[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},Ce=(Mn,Fn)=>pr=>{const An=ce(pr);if(An){const Jr=Fn.isNegativeDuration&&An!==Fn.largestUnit?J:1;let Qo;return this.opts.signMode==="negativeLargestOnly"&&An!==Fn.largestUnit?Qo="never":this.opts.signMode==="all"?Qo="always":Qo="auto",this.num(Mn.get(An)*Jr,pr.length,Qo)}else return pr},Ne=oo.parseFormat(q),qe=Ne.reduce((Mn,{literal:Fn,val:pr})=>Fn?Mn:Mn.concat(pr),[]),Xe=M.shiftTo(...qe.map(ce).filter(Mn=>Mn)),At={isNegativeDuration:Xe<0,largestUnit:Object.keys(Xe.values)[0]};return Iu(Ne,Ce(Xe,At))}}const Lu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function U(...W){const M=W.reduce((q,J)=>q+J.source,"");return RegExp(`^${M}$`)}function $o(...W){return M=>W.reduce(([q,J,ce],Ce)=>{const[Ne,qe,Xe]=Ce(M,ce);return[{...q,...Ne},qe||J,Xe]},[{},null,1]).slice(0,2)}function ao(W,...M){if(W==null)return[null,null];for(const[q,J]of M){const ce=q.exec(W);if(ce)return J(ce)}return[null,null]}function ni(...W){return(M,q)=>{const J={};let ce;for(ce=0;ce<W.length;ce++)J[W[ce]]=Dr(M[q+ce]);return[J,null,q+ce]}}const je=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Ss=`(?:${je.source}?(?:\\[(${Lu.source})\\])?)?`,zn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ko=RegExp(`${zn.source}${Ss}`),Hs=RegExp(`(?:[Tt]${Ko.source})?`),zu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,lf=/(\d{4})-?W(\d\d)(?:-?(\d))?/,cf=/(\d{4})-?(\d{3})/,ot=ni("weekYear","weekNumber","weekDay"),Fu=ni("year","ordinal"),_u=/(\d{4})-(\d\d)-(\d\d)/,kc=RegExp(`${zn.source} ?(?:${je.source}|(${Lu.source}))?`),uf=RegExp(`(?: ${kc.source})?`);function Vs(W,M,q){const J=W[M];return We(J)?q:Dr(J)}function Dl(W,M){return[{year:Vs(W,M),month:Vs(W,M+1,1),day:Vs(W,M+2,1)},null,M+3]}function Cs(W,M){return[{hours:Vs(W,M,0),minutes:Vs(W,M+1,0),seconds:Vs(W,M+2,0),milliseconds:Do(W[M+3])},null,M+4]}function Ws(W,M){const q=!W[M]&&!W[M+1],J=Ml(W[M+1],W[M+2]),ce=q?null:Rt.instance(J);return[{},ce,M+3]}function ua(W,M){const q=W[M]?ee.create(W[M]):null;return[{},q,M+1]}const Rh=RegExp(`^T?${zn.source}$`),Th=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Nl(W){const[M,q,J,ce,Ce,Ne,qe,Xe,At]=W,Mn=M[0]==="-",Fn=Xe&&Xe[0]==="-",pr=(An,Jr=!1)=>An!==void 0&&(Jr||An&&Mn)?-An:An;return[{years:pr(fo(q)),months:pr(fo(J)),weeks:pr(fo(ce)),days:pr(fo(Ce)),hours:pr(fo(Ne)),minutes:pr(fo(qe)),seconds:pr(fo(Xe),Xe==="-0"),milliseconds:pr(Do(At),Fn)}]}const df={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Bu(W,M,q,J,ce,Ce,Ne){const qe={year:M.length===2?Di(Dr(M)):Dr(M),month:af.indexOf(q)+1,day:Dr(J),hour:Dr(ce),minute:Dr(Ce)};return Ne&&(qe.second=Dr(Ne)),W&&(qe.weekday=W.length>3?xc.indexOf(W)+1:wc.indexOf(W)+1),qe}const Eh=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function ff(W){const[,M,q,J,ce,Ce,Ne,qe,Xe,At,Mn,Fn]=W,pr=Bu(M,ce,J,q,Ce,Ne,qe);let An;return Xe?An=df[Xe]:At?An=0:An=Ml(Mn,Fn),[pr,new Rt(An)]}function Mh(W){return W.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const pf=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Uu=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Oh=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function $c(W){const[,M,q,J,ce,Ce,Ne,qe]=W;return[Bu(M,ce,J,q,Ce,Ne,qe),Rt.utcInstance]}function Ph(W){const[,M,q,J,ce,Ce,Ne,qe]=W;return[Bu(M,qe,q,J,ce,Ce,Ne),Rt.utcInstance]}const jh=U(zu,Hs),Ah=U(lf,Hs),Dh=U(cf,Hs),qu=U(Ko),Ys=$o(Dl,Cs,Ws,ua),Nh=$o(ot,Cs,Ws,ua),hf=$o(Fu,Cs,Ws,ua),mf=$o(Cs,Ws,ua);function gf(W){return ao(W,[jh,Ys],[Ah,Nh],[Dh,hf],[qu,mf])}function yf(W){return ao(Mh(W),[Eh,ff])}function vf(W){return ao(W,[pf,$c],[Uu,$c],[Oh,Ph])}function Gs(W){return ao(W,[Th,Nl])}const Ih=$o(Cs);function Lh(W){return ao(W,[Rh,Ih])}const zh=U(_u,uf),bf=U(kc),xf=$o(Cs,Ws,ua);function Il(W){return ao(W,[zh,Ys],[bf,xf])}const ar="Invalid Duration",ks={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Zr={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ks},V=146097/400,te=146097/4800,X={years:{quarters:4,months:12,weeks:V/7,days:V,hours:V*24,minutes:V*24*60,seconds:V*24*60*60,milliseconds:V*24*60*60*1e3},quarters:{months:3,weeks:V/28,days:V/4,hours:V*24/4,minutes:V*24*60/4,seconds:V*24*60*60/4,milliseconds:V*24*60*60*1e3/4},months:{weeks:te/7,days:te,hours:te*24,minutes:te*24*60,seconds:te*24*60*60,milliseconds:te*24*60*60*1e3},...ks},$e=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Zt=$e.slice(0).reverse();function Gt(W,M,q=!1){const J={values:q?M.values:{...W.values,...M.values||{}},loc:W.loc.clone(M.loc),conversionAccuracy:M.conversionAccuracy||W.conversionAccuracy,matrix:M.matrix||W.matrix};return new Qt(J)}function Dn(W,M){var q;let J=(q=M.milliseconds)!=null?q:0;for(const ce of Zt.slice(1))M[ce]&&(J+=M[ce]*W[ce].milliseconds);return J}function Qn(W,M){const q=Dn(W,M)<0?-1:1;$e.reduceRight((J,ce)=>{if(We(M[ce]))return J;if(J){const Ce=M[J]*q,Ne=W[ce][J],qe=Math.floor(Ce/Ne);M[ce]+=qe*q,M[J]-=qe*Ne*q}return ce},null),$e.reduce((J,ce)=>{if(We(M[ce]))return J;if(J){const Ce=M[J]%1;M[J]-=Ce,M[ce]+=Ce*W[J][ce]}return ce},null)}function Xn(W){const M={};for(const[q,J]of Object.entries(W))J!==0&&(M[q]=J);return M}class Qt{constructor(M){const q=M.conversionAccuracy==="longterm"||!1;let J=q?X:Zr;M.matrix&&(J=M.matrix),this.values=M.values,this.loc=M.loc||Oe.create(),this.conversionAccuracy=q?"longterm":"casual",this.invalid=M.invalid||null,this.matrix=J,this.isLuxonDuration=!0}static fromMillis(M,q){return Qt.fromObject({milliseconds:M},q)}static fromObject(M,q={}){if(M==null||typeof M!="object")throw new i(`Duration.fromObject: argument expected to be an object, got ${M===null?"null":typeof M}`);return new Qt({values:bc(M,Qt.normalizeUnit),loc:Oe.fromObject(q),conversionAccuracy:q.conversionAccuracy,matrix:q.matrix})}static fromDurationLike(M){if(Nt(M))return Qt.fromMillis(M);if(Qt.isDuration(M))return M;if(typeof M=="object")return Qt.fromObject(M);throw new i(`Unknown duration argument ${M} of type ${typeof M}`)}static fromISO(M,q){const[J]=Gs(M);return J?Qt.fromObject(J,q):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static fromISOTime(M,q){const[J]=Lh(M);return J?Qt.fromObject(J,q):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static invalid(M,q=null){if(!M)throw new i("need to specify a reason the Duration is invalid");const J=M instanceof Bn?M:new Bn(M,q);if(mn.throwOnInvalid)throw new r(J);return new Qt({invalid:J})}static normalizeUnit(M){const q={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[M&&M.toLowerCase()];if(!q)throw new a(M);return q}static isDuration(M){return M&&M.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(M,q={}){const J={...q,floor:q.round!==!1&&q.floor!==!1};return this.isValid?oo.create(this.loc,J).formatDurationFromString(this,M):ar}toHuman(M={}){if(!this.isValid)return ar;const q=M.showZeros!==!1,J=$e.map(ce=>{const Ce=this.values[ce];return We(Ce)||Ce===0&&!q?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...M,unit:ce.slice(0,-1)}).format(Ce)}).filter(ce=>ce);return this.loc.listFormatter({type:"conjunction",style:M.listStyle||"narrow",...M}).format(J)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let M="P";return this.years!==0&&(M+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(M+=this.months+this.quarters*3+"M"),this.weeks!==0&&(M+=this.weeks+"W"),this.days!==0&&(M+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(M+="T"),this.hours!==0&&(M+=this.hours+"H"),this.minutes!==0&&(M+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(M+=vs(this.seconds+this.milliseconds/1e3,3)+"S"),M==="P"&&(M+="T0S"),M}toISOTime(M={}){if(!this.isValid)return null;const q=this.toMillis();return q<0||q>=864e5?null:(M={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...M,includeOffset:!1},En.fromMillis(q,{zone:"UTC"}).toISOTime(M))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Dn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M),J={};for(const ce of $e)(Ft(q.values,ce)||Ft(this.values,ce))&&(J[ce]=q.get(ce)+this.get(ce));return Gt(this,{values:J},!0)}minus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M);return this.plus(q.negate())}mapUnits(M){if(!this.isValid)return this;const q={};for(const J of Object.keys(this.values))q[J]=xs(M(this.values[J],J));return Gt(this,{values:q},!0)}get(M){return this[Qt.normalizeUnit(M)]}set(M){if(!this.isValid)return this;const q={...this.values,...bc(M,Qt.normalizeUnit)};return Gt(this,{values:q})}reconfigure({locale:M,numberingSystem:q,conversionAccuracy:J,matrix:ce}={}){const Ce={loc:this.loc.clone({locale:M,numberingSystem:q}),matrix:ce,conversionAccuracy:J};return Gt(this,Ce)}as(M){return this.isValid?this.shiftTo(M).get(M):NaN}normalize(){if(!this.isValid)return this;const M=this.toObject();return Qn(this.matrix,M),Gt(this,{values:M},!0)}rescale(){if(!this.isValid)return this;const M=Xn(this.normalize().shiftToAll().toObject());return Gt(this,{values:M},!0)}shiftTo(...M){if(!this.isValid)return this;if(M.length===0)return this;M=M.map(Ne=>Qt.normalizeUnit(Ne));const q={},J={},ce=this.toObject();let Ce;for(const Ne of $e)if(M.indexOf(Ne)>=0){Ce=Ne;let qe=0;for(const At in J)qe+=this.matrix[At][Ne]*J[At],J[At]=0;Nt(ce[Ne])&&(qe+=ce[Ne]);const Xe=Math.trunc(qe);q[Ne]=Xe,J[Ne]=(qe*1e3-Xe*1e3)/1e3}else Nt(ce[Ne])&&(J[Ne]=ce[Ne]);for(const Ne in J)J[Ne]!==0&&(q[Ce]+=Ne===Ce?J[Ne]:J[Ne]/this.matrix[Ce][Ne]);return Qn(this.matrix,q),Gt(this,{values:q},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const M={};for(const q of Object.keys(this.values))M[q]=this.values[q]===0?0:-this.values[q];return Gt(this,{values:M},!0)}removeZeros(){if(!this.isValid)return this;const M=Xn(this.values);return Gt(this,{values:M},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(M){if(!this.isValid||!M.isValid||!this.loc.equals(M.loc))return!1;function q(J,ce){return J===void 0||J===0?ce===void 0||ce===0:J===ce}for(const J of $e)if(!q(this.values[J],M.values[J]))return!1;return!0}}const $r="Invalid Interval";function Rr(W,M){return!W||!W.isValid?xn.invalid("missing or invalid start"):!M||!M.isValid?xn.invalid("missing or invalid end"):M<W?xn.invalid("end before start",`The end of an interval must be after its start, but you had start=${W.toISO()} and end=${M.toISO()}`):null}class xn{constructor(M){this.s=M.start,this.e=M.end,this.invalid=M.invalid||null,this.isLuxonInterval=!0}static invalid(M,q=null){if(!M)throw new i("need to specify a reason the Interval is invalid");const J=M instanceof Bn?M:new Bn(M,q);if(mn.throwOnInvalid)throw new n(J);return new xn({invalid:J})}static fromDateTimes(M,q){const J=li(M),ce=li(q);return Rr(J,ce)??new xn({start:J,end:ce})}static after(M,q){const J=Qt.fromDurationLike(q),ce=li(M);return xn.fromDateTimes(ce,ce.plus(J))}static before(M,q){const J=Qt.fromDurationLike(q),ce=li(M);return xn.fromDateTimes(ce.minus(J),ce)}static fromISO(M,q){const[J,ce]=(M||"").split("/",2);if(J&&ce){let Ce,Ne;try{Ce=En.fromISO(J,q),Ne=Ce.isValid}catch{Ne=!1}let qe,Xe;try{qe=En.fromISO(ce,q),Xe=qe.isValid}catch{Xe=!1}if(Ne&&Xe)return xn.fromDateTimes(Ce,qe);if(Ne){const At=Qt.fromISO(ce,q);if(At.isValid)return xn.after(Ce,At)}else if(Xe){const At=Qt.fromISO(J,q);if(At.isValid)return xn.before(qe,At)}}return xn.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static isInterval(M){return M&&M.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(M="milliseconds"){return this.isValid?this.toDuration(M).get(M):NaN}count(M="milliseconds",q){if(!this.isValid)return NaN;const J=this.start.startOf(M,q);let ce;return q!=null&&q.useLocaleWeeks?ce=this.end.reconfigure({locale:J.locale}):ce=this.end,ce=ce.startOf(M,q),Math.floor(ce.diff(J,M).get(M))+(ce.valueOf()!==this.end.valueOf())}hasSame(M){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,M):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(M){return this.isValid?this.s>M:!1}isBefore(M){return this.isValid?this.e<=M:!1}contains(M){return this.isValid?this.s<=M&&this.e>M:!1}set({start:M,end:q}={}){return this.isValid?xn.fromDateTimes(M||this.s,q||this.e):this}splitAt(...M){if(!this.isValid)return[];const q=M.map(li).filter(Ne=>this.contains(Ne)).sort((Ne,qe)=>Ne.toMillis()-qe.toMillis()),J=[];let{s:ce}=this,Ce=0;for(;ce<this.e;){const Ne=q[Ce]||this.e,qe=+Ne>+this.e?this.e:Ne;J.push(xn.fromDateTimes(ce,qe)),ce=qe,Ce+=1}return J}splitBy(M){const q=Qt.fromDurationLike(M);if(!this.isValid||!q.isValid||q.as("milliseconds")===0)return[];let{s:J}=this,ce=1,Ce;const Ne=[];for(;J<this.e;){const qe=this.start.plus(q.mapUnits(Xe=>Xe*ce));Ce=+qe>+this.e?this.e:qe,Ne.push(xn.fromDateTimes(J,Ce)),J=Ce,ce+=1}return Ne}divideEqually(M){return this.isValid?this.splitBy(this.length()/M).slice(0,M):[]}overlaps(M){return this.e>M.s&&this.s<M.e}abutsStart(M){return this.isValid?+this.e==+M.s:!1}abutsEnd(M){return this.isValid?+M.e==+this.s:!1}engulfs(M){return this.isValid?this.s<=M.s&&this.e>=M.e:!1}equals(M){return!this.isValid||!M.isValid?!1:this.s.equals(M.s)&&this.e.equals(M.e)}intersection(M){if(!this.isValid)return this;const q=this.s>M.s?this.s:M.s,J=this.e<M.e?this.e:M.e;return q>=J?null:xn.fromDateTimes(q,J)}union(M){if(!this.isValid)return this;const q=this.s<M.s?this.s:M.s,J=this.e>M.e?this.e:M.e;return xn.fromDateTimes(q,J)}static merge(M){const[q,J]=M.sort((ce,Ce)=>ce.s-Ce.s).reduce(([ce,Ce],Ne)=>Ce?Ce.overlaps(Ne)||Ce.abutsStart(Ne)?[ce,Ce.union(Ne)]:[ce.concat([Ce]),Ne]:[ce,Ne],[[],null]);return J&&q.push(J),q}static xor(M){let q=null,J=0;const ce=[],Ce=M.map(Xe=>[{time:Xe.s,type:"s"},{time:Xe.e,type:"e"}]),Ne=Array.prototype.concat(...Ce),qe=Ne.sort((Xe,At)=>Xe.time-At.time);for(const Xe of qe)J+=Xe.type==="s"?1:-1,J===1?q=Xe.time:(q&&+q!=+Xe.time&&ce.push(xn.fromDateTimes(q,Xe.time)),q=null);return xn.merge(ce)}difference(...M){return xn.xor([this].concat(M)).map(q=>this.intersection(q)).filter(q=>q&&!q.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:$r}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(M=m,q={}){return this.isValid?oo.create(this.s.loc.clone(q),M).formatInterval(this):$r}toISO(M){return this.isValid?`${this.s.toISO(M)}/${this.e.toISO(M)}`:$r}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:$r}toISOTime(M){return this.isValid?`${this.s.toISOTime(M)}/${this.e.toISOTime(M)}`:$r}toFormat(M,{separator:q=" – "}={}){return this.isValid?`${this.s.toFormat(M)}${q}${this.e.toFormat(M)}`:$r}toDuration(M,q){return this.isValid?this.e.diff(this.s,M,q):Qt.invalid(this.invalidReason)}mapEndpoints(M){return xn.fromDateTimes(M(this.s),M(this.e))}}class br{static hasDST(M=mn.defaultZone){const q=En.now().setZone(M).set({month:12});return!M.isUniversal&&q.offset!==q.set({month:6}).offset}static isValidIANAZone(M){return ee.isValidZone(M)}static normalizeZone(M){return it(M,mn.defaultZone)}static getStartOfWeek({locale:M=null,locObj:q=null}={}){return(q||Oe.create(M)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:M=null,locObj:q=null}={}){return(q||Oe.create(M)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:M=null,locObj:q=null}={}){return(q||Oe.create(M)).getWeekendDays().slice()}static months(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Oe.create(q,J,Ce)).months(M)}static monthsFormat(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Oe.create(q,J,Ce)).months(M,!0)}static weekdays(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null}={}){return(ce||Oe.create(q,J,null)).weekdays(M)}static weekdaysFormat(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null}={}){return(ce||Oe.create(q,J,null)).weekdays(M,!0)}static meridiems({locale:M=null}={}){return Oe.create(M).meridiems()}static eras(M="short",{locale:q=null}={}){return Oe.create(q,null,"gregory").eras(M)}static features(){return{relative:Pe(),localeWeek:ft()}}}function Wr(W,M){const q=ce=>ce.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),J=q(M)-q(W);return Math.floor(Qt.fromMillis(J).as("days"))}function Gr(W,M,q){const J=[["years",(Xe,At)=>At.year-Xe.year],["quarters",(Xe,At)=>At.quarter-Xe.quarter+(At.year-Xe.year)*4],["months",(Xe,At)=>At.month-Xe.month+(At.year-Xe.year)*12],["weeks",(Xe,At)=>{const Mn=Wr(Xe,At);return(Mn-Mn%7)/7}],["days",Wr]],ce={},Ce=W;let Ne,qe;for(const[Xe,At]of J)q.indexOf(Xe)>=0&&(Ne=Xe,ce[Xe]=At(W,M),qe=Ce.plus(ce),qe>M?(ce[Xe]--,W=Ce.plus(ce),W>M&&(qe=W,ce[Xe]--,W=Ce.plus(ce))):W=qe);return[W,ce,qe,Ne]}function ri(W,M,q,J){let[ce,Ce,Ne,qe]=Gr(W,M,q);const Xe=M-ce,At=q.filter(Fn=>["hours","minutes","seconds","milliseconds"].indexOf(Fn)>=0);At.length===0&&(Ne<M&&(Ne=ce.plus({[qe]:1})),Ne!==ce&&(Ce[qe]=(Ce[qe]||0)+Xe/(Ne-ce)));const Mn=Qt.fromObject(Ce,J);return At.length>0?Qt.fromMillis(Xe,J).shiftTo(...At).plus(Mn):Mn}const wa="missing Intl.DateTimeFormat.formatToParts support";function Un(W,M=q=>q){return{regex:W,deser:([q])=>M(Bt(q))}}const Ll="[  ]",Sa=new RegExp(Ll,"g");function $s(W){return W.replace(/\./g,"\\.?").replace(Sa,Ll)}function da(W){return W.replace(/\./g,"").replace(Sa," ").toLowerCase()}function io(W,M){return W===null?null:{regex:RegExp(W.map($s).join("|")),deser:([q])=>W.findIndex(J=>da(q)===da(J))+M}}function zl(W,M){return{regex:W,deser:([,q,J])=>Ml(q,J),groups:M}}function Ro(W){return{regex:W,deser:([M])=>M}}function Rc(W){return W.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Fh(W,M){const q=qt(M),J=qt(M,"{2}"),ce=qt(M,"{3}"),Ce=qt(M,"{4}"),Ne=qt(M,"{6}"),qe=qt(M,"{1,2}"),Xe=qt(M,"{1,3}"),At=qt(M,"{1,6}"),Mn=qt(M,"{1,9}"),Fn=qt(M,"{2,4}"),pr=qt(M,"{4,6}"),An=Qo=>({regex:RegExp(Rc(Qo.val)),deser:([Na])=>Na,literal:!0}),Jr=(Qo=>{if(W.literal)return An(Qo);switch(Qo.val){case"G":return io(M.eras("short"),0);case"GG":return io(M.eras("long"),0);case"y":return Un(At);case"yy":return Un(Fn,Di);case"yyyy":return Un(Ce);case"yyyyy":return Un(pr);case"yyyyyy":return Un(Ne);case"M":return Un(qe);case"MM":return Un(J);case"MMM":return io(M.months("short",!0),1);case"MMMM":return io(M.months("long",!0),1);case"L":return Un(qe);case"LL":return Un(J);case"LLL":return io(M.months("short",!1),1);case"LLLL":return io(M.months("long",!1),1);case"d":return Un(qe);case"dd":return Un(J);case"o":return Un(Xe);case"ooo":return Un(ce);case"HH":return Un(J);case"H":return Un(qe);case"hh":return Un(J);case"h":return Un(qe);case"mm":return Un(J);case"m":return Un(qe);case"q":return Un(qe);case"qq":return Un(J);case"s":return Un(qe);case"ss":return Un(J);case"S":return Un(Xe);case"SSS":return Un(ce);case"u":return Ro(Mn);case"uu":return Ro(qe);case"uuu":return Un(q);case"a":return io(M.meridiems(),0);case"kkkk":return Un(Ce);case"kk":return Un(Fn,Di);case"W":return Un(qe);case"WW":return Un(J);case"E":case"c":return Un(q);case"EEE":return io(M.weekdays("short",!1),1);case"EEEE":return io(M.weekdays("long",!1),1);case"ccc":return io(M.weekdays("short",!0),1);case"cccc":return io(M.weekdays("long",!0),1);case"Z":case"ZZ":return zl(new RegExp(`([+-]${qe.source})(?::(${J.source}))?`),2);case"ZZZ":return zl(new RegExp(`([+-]${qe.source})(${J.source})?`),2);case"z":return Ro(/[a-z_+-/]{1,256}?/i);case" ":return Ro(/[^\S\n\r]/);default:return An(Qo)}})(W)||{invalidReason:wa};return Jr.token=W,Jr}const sv={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Fl(W,M,q){const{type:J,value:ce}=W;if(J==="literal"){const Xe=/^\s+$/.test(ce);return{literal:!Xe,val:Xe?" ":ce}}const Ce=M[J];let Ne=J;J==="hour"&&(M.hour12!=null?Ne=M.hour12?"hour12":"hour24":M.hourCycle!=null?M.hourCycle==="h11"||M.hourCycle==="h12"?Ne="hour12":Ne="hour24":Ne=q.hour12?"hour12":"hour24");let qe=sv[Ne];if(typeof qe=="object"&&(qe=qe[Ce]),qe)return{literal:!1,val:qe}}function lv(W){return[`^${W.map(M=>M.regex).reduce((M,q)=>`${M}(${q.source})`,"")}$`,W]}function cv(W,M,q){const J=W.match(M);if(J){const ce={};let Ce=1;for(const Ne in q)if(Ft(q,Ne)){const qe=q[Ne],Xe=qe.groups?qe.groups+1:1;!qe.literal&&qe.token&&(ce[qe.token.val[0]]=qe.deser(J.slice(Ce,Ce+Xe))),Ce+=Xe}return[J,ce]}else return[J,{}]}function uv(W){const M=ce=>{switch(ce){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let q=null,J;return We(W.z)||(q=ee.create(W.z)),We(W.Z)||(q||(q=new Rt(W.Z)),J=W.Z),We(W.q)||(W.M=(W.q-1)*3+1),We(W.h)||(W.h<12&&W.a===1?W.h+=12:W.h===12&&W.a===0&&(W.h=0)),W.G===0&&W.y&&(W.y=-W.y),We(W.u)||(W.S=Do(W.u)),[Object.keys(W).reduce((ce,Ce)=>{const Ne=M(Ce);return Ne&&(ce[Ne]=W[Ce]),ce},{}),q,J]}let _h=null;function H1(){return _h||(_h=En.fromMillis(1555555555555)),_h}function V1(W,M){if(W.literal)return W;const q=oo.macroTokenToFormatOpts(W.val),J=qh(q,M);return J==null||J.includes(void 0)?W:J}function Bh(W,M){return Array.prototype.concat(...W.map(q=>V1(q,M)))}class Uh{constructor(M,q){if(this.locale=M,this.format=q,this.tokens=Bh(oo.parseFormat(q),M),this.units=this.tokens.map(J=>Fh(J,M)),this.disqualifyingUnit=this.units.find(J=>J.invalidReason),!this.disqualifyingUnit){const[J,ce]=lv(this.units);this.regex=RegExp(J,"i"),this.handlers=ce}}explainFromTokens(M){if(this.isValid){const[q,J]=cv(M,this.regex,this.handlers),[ce,Ce,Ne]=J?uv(J):[null,null,void 0];if(Ft(J,"a")&&Ft(J,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:M,tokens:this.tokens,regex:this.regex,rawMatches:q,matches:J,result:ce,zone:Ce,specificOffset:Ne}}else return{input:M,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function wf(W,M,q){return new Uh(W,q).explainFromTokens(M)}function oi(W,M,q){const{result:J,zone:ce,specificOffset:Ce,invalidReason:Ne}=wf(W,M,q);return[J,ce,Ce,Ne]}function qh(W,M){if(!W)return null;const q=oo.create(M,W).dtFormatter(H1()),J=q.formatToParts(),ce=q.resolvedOptions();return J.map(Ce=>Fl(Ce,W,ce))}const fa="Invalid DateTime",Ca=864e13;function Ii(W){return new Bn("unsupported zone",`the zone "${W.name}" is not supported`)}function Hu(W){return W.weekData===null&&(W.weekData=Mt(W.c)),W.weekData}function Tc(W){return W.localWeekData===null&&(W.localWeekData=Mt(W.c,W.loc.getMinDaysInFirstWeek(),W.loc.getStartOfWeek())),W.localWeekData}function Li(W,M){const q={ts:W.ts,zone:W.zone,c:W.c,o:W.o,loc:W.loc,invalid:W.invalid};return new En({...q,...M,old:q})}function Sf(W,M,q){let J=W-M*60*1e3;const ce=q.offset(J);if(M===ce)return[J,M];J-=(ce-M)*60*1e3;const Ce=q.offset(J);return ce===Ce?[J,ce]:[W-Math.min(ce,Ce)*60*1e3,Math.max(ce,Ce)]}function Rs(W,M){W+=M*60*1e3;const q=new Date(W);return{year:q.getUTCFullYear(),month:q.getUTCMonth()+1,day:q.getUTCDate(),hour:q.getUTCHours(),minute:q.getUTCMinutes(),second:q.getUTCSeconds(),millisecond:q.getUTCMilliseconds()}}function Vu(W,M,q){return Sf(ti(W),M,q)}function Wu(W,M){const q=W.o,J=W.c.year+Math.trunc(M.years),ce=W.c.month+Math.trunc(M.months)+Math.trunc(M.quarters)*3,Ce={...W.c,year:J,month:ce,day:Math.min(W.c.day,qr(J,ce))+Math.trunc(M.days)+Math.trunc(M.weeks)*7},Ne=Qt.fromObject({years:M.years-Math.trunc(M.years),quarters:M.quarters-Math.trunc(M.quarters),months:M.months-Math.trunc(M.months),weeks:M.weeks-Math.trunc(M.weeks),days:M.days-Math.trunc(M.days),hours:M.hours,minutes:M.minutes,seconds:M.seconds,milliseconds:M.milliseconds}).as("milliseconds"),qe=ti(Ce);let[Xe,At]=Sf(qe,q,W.zone);return Ne!==0&&(Xe+=Ne,At=W.zone.offset(Xe)),{ts:Xe,o:At}}function ai(W,M,q,J,ce,Ce){const{setZone:Ne,zone:qe}=q;if(W&&Object.keys(W).length!==0||M){const Xe=M||qe,At=En.fromObject(W,{...q,zone:Xe,specificOffset:Ce});return Ne?At:At.setZone(qe)}else return En.invalid(new Bn("unparsable",`the input "${ce}" can't be parsed as ${J}`))}function Cf(W,M,q=!0){return W.isValid?oo.create(Oe.create("en-US"),{allowZ:q,forceSimple:!0}).formatDateTimeFromString(W,M):null}function ra(W,M,q){const J=W.c.year>9999||W.c.year<0;let ce="";if(J&&W.c.year>=0&&(ce+="+"),ce+=tn(W.c.year,J?6:4),q==="year")return ce;if(M){if(ce+="-",ce+=tn(W.c.month),q==="month")return ce;ce+="-"}else if(ce+=tn(W.c.month),q==="month")return ce;return ce+=tn(W.c.day),ce}function kf(W,M,q,J,ce,Ce,Ne){let qe=!q||W.c.millisecond!==0||W.c.second!==0,Xe="";switch(Ne){case"day":case"month":case"year":break;default:if(Xe+=tn(W.c.hour),Ne==="hour")break;if(M){if(Xe+=":",Xe+=tn(W.c.minute),Ne==="minute")break;qe&&(Xe+=":",Xe+=tn(W.c.second))}else{if(Xe+=tn(W.c.minute),Ne==="minute")break;qe&&(Xe+=tn(W.c.second))}if(Ne==="second")break;qe&&(!J||W.c.millisecond!==0)&&(Xe+=".",Xe+=tn(W.c.millisecond,3))}return ce&&(W.isOffsetFixed&&W.offset===0&&!Ce?Xe+="Z":W.o<0?(Xe+="-",Xe+=tn(Math.trunc(-W.o/60)),Xe+=":",Xe+=tn(Math.trunc(-W.o%60))):(Xe+="+",Xe+=tn(Math.trunc(W.o/60)),Xe+=":",Xe+=tn(Math.trunc(W.o%60)))),Ce&&(Xe+="["+W.zone.ianaName+"]"),Xe}const zi={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},dv={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},$f={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Fi=["year","month","day","hour","minute","second","millisecond"],Hh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Vh=["year","ordinal","hour","minute","second","millisecond"];function Ts(W){const M={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[W.toLowerCase()];if(!M)throw new a(W);return M}function _l(W){switch(W.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Ts(W)}}function Rf(W){if(ii===void 0&&(ii=mn.now()),W.type!=="iana")return W.offset(ii);const M=W.name;let q=si.get(M);return q===void 0&&(q=W.offset(ii),si.set(M,q)),q}function Yu(W,M){const q=it(M.zone,mn.defaultZone);if(!q.isValid)return En.invalid(Ii(q));const J=Oe.fromObject(M);let ce,Ce;if(We(W.year))ce=mn.now();else{for(const Xe of Fi)We(W[Xe])&&(W[Xe]=zi[Xe]);const Ne=Ue(W)||gt(W);if(Ne)return En.invalid(Ne);const qe=Rf(q);[ce,Ce]=Vu(W,qe,q)}return new En({ts:ce,zone:q,loc:J,o:Ce})}function ka(W,M,q){const J=We(q.round)?!0:q.round,ce=We(q.rounding)?"trunc":q.rounding,Ce=(qe,Xe)=>(qe=vs(qe,J||q.calendary?0:2,q.calendary?"round":ce),M.loc.clone(q).relFormatter(q).format(qe,Xe)),Ne=qe=>q.calendary?M.hasSame(W,qe)?0:M.startOf(qe).diff(W.startOf(qe),qe).get(qe):M.diff(W,qe).get(qe);if(q.unit)return Ce(Ne(q.unit),q.unit);for(const qe of q.units){const Xe=Ne(qe);if(Math.abs(Xe)>=1)return Ce(Xe,qe)}return Ce(W>M?-0:0,q.units[q.units.length-1])}function $a(W){let M={},q;return W.length>0&&typeof W[W.length-1]=="object"?(M=W[W.length-1],q=Array.from(W).slice(0,W.length-1)):q=Array.from(W),[M,q]}let ii;const si=new Map;class En{constructor(M){const q=M.zone||mn.defaultZone;let J=M.invalid||(Number.isNaN(M.ts)?new Bn("invalid input"):null)||(q.isValid?null:Ii(q));this.ts=We(M.ts)?mn.now():M.ts;let ce=null,Ce=null;if(!J)if(M.old&&M.old.ts===this.ts&&M.old.zone.equals(q))[ce,Ce]=[M.old.c,M.old.o];else{const Ne=Nt(M.o)&&!M.old?M.o:q.offset(this.ts);ce=Rs(this.ts,Ne),J=Number.isNaN(ce.year)?new Bn("invalid input"):null,ce=J?null:ce,Ce=J?null:Ne}this._zone=q,this.loc=M.loc||Oe.create(),this.invalid=J,this.weekData=null,this.localWeekData=null,this.c=ce,this.o=Ce,this.isLuxonDateTime=!0}static now(){return new En({})}static local(){const[M,q]=$a(arguments),[J,ce,Ce,Ne,qe,Xe,At]=q;return Yu({year:J,month:ce,day:Ce,hour:Ne,minute:qe,second:Xe,millisecond:At},M)}static utc(){const[M,q]=$a(arguments),[J,ce,Ce,Ne,qe,Xe,At]=q;return M.zone=Rt.utcInstance,Yu({year:J,month:ce,day:Ce,hour:Ne,minute:qe,second:Xe,millisecond:At},M)}static fromJSDate(M,q={}){const J=we(M)?M.valueOf():NaN;if(Number.isNaN(J))return En.invalid("invalid input");const ce=it(q.zone,mn.defaultZone);return ce.isValid?new En({ts:J,zone:ce,loc:Oe.fromObject(q)}):En.invalid(Ii(ce))}static fromMillis(M,q={}){if(Nt(M))return M<-Ca||M>Ca?En.invalid("Timestamp out of range"):new En({ts:M,zone:it(q.zone,mn.defaultZone),loc:Oe.fromObject(q)});throw new i(`fromMillis requires a numerical input, but received a ${typeof M} with value ${M}`)}static fromSeconds(M,q={}){if(Nt(M))return new En({ts:M*1e3,zone:it(q.zone,mn.defaultZone),loc:Oe.fromObject(q)});throw new i("fromSeconds requires a numerical input")}static fromObject(M,q={}){M=M||{};const J=it(q.zone,mn.defaultZone);if(!J.isValid)return En.invalid(Ii(J));const ce=Oe.fromObject(q),Ce=bc(M,_l),{minDaysInFirstWeek:Ne,startOfWeek:qe}=Vt(Ce,ce),Xe=mn.now(),At=We(q.specificOffset)?J.offset(Xe):q.specificOffset,Mn=!We(Ce.ordinal),Fn=!We(Ce.year),pr=!We(Ce.month)||!We(Ce.day),An=Fn||pr,Jr=Ce.weekYear||Ce.weekNumber;if((An||Mn)&&Jr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(pr&&Mn)throw new o("Can't mix ordinal dates with month/day");const Qo=Jr||Ce.weekday&&!An;let Na,Ia,La=Rs(Xe,At);Qo?(Na=Hh,Ia=dv,La=Mt(La,Ne,qe)):Mn?(Na=Vh,Ia=$f,La=Xt(La)):(Na=Fi,Ia=zi);let _i=!1;for(const Ks of Na){const pv=Ce[Ks];We(pv)?_i?Ce[Ks]=Ia[Ks]:Ce[Ks]=La[Ks]:_i=!0}const Wh=Qo?ge(Ce,Ne,qe):Mn?ye(Ce):Ue(Ce),Tf=Wh||gt(Ce);if(Tf)return En.invalid(Tf);const Gu=Qo?Lt(Ce,Ne,qe):Mn?zt(Ce):Ce,[Ef,Bl]=Vu(Gu,At,J),po=new En({ts:Ef,zone:J,o:Bl,loc:ce});return Ce.weekday&&An&&M.weekday!==po.weekday?En.invalid("mismatched weekday",`you can't specify both a weekday of ${Ce.weekday} and a date of ${po.toISO()}`):po.isValid?po:En.invalid(po.invalid)}static fromISO(M,q={}){const[J,ce]=gf(M);return ai(J,ce,q,"ISO 8601",M)}static fromRFC2822(M,q={}){const[J,ce]=yf(M);return ai(J,ce,q,"RFC 2822",M)}static fromHTTP(M,q={}){const[J,ce]=vf(M);return ai(J,ce,q,"HTTP",q)}static fromFormat(M,q,J={}){if(We(M)||We(q))throw new i("fromFormat requires an input string and a format");const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0}),[qe,Xe,At,Mn]=oi(Ne,M,q);return Mn?En.invalid(Mn):ai(qe,Xe,J,`format ${q}`,M,At)}static fromString(M,q,J={}){return En.fromFormat(M,q,J)}static fromSQL(M,q={}){const[J,ce]=Il(M);return ai(J,ce,q,"SQL",M)}static invalid(M,q=null){if(!M)throw new i("need to specify a reason the DateTime is invalid");const J=M instanceof Bn?M:new Bn(M,q);if(mn.throwOnInvalid)throw new t(J);return new En({invalid:J})}static isDateTime(M){return M&&M.isLuxonDateTime||!1}static parseFormatForOpts(M,q={}){const J=qh(M,Oe.fromObject(q));return J?J.map(ce=>ce?ce.val:null).join(""):null}static expandFormat(M,q={}){return Bh(oo.parseFormat(M),Oe.fromObject(q)).map(J=>J.val).join("")}static resetCache(){ii=void 0,si.clear()}get(M){return this[M]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Hu(this).weekYear:NaN}get weekNumber(){return this.isValid?Hu(this).weekNumber:NaN}get weekday(){return this.isValid?Hu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Tc(this).weekday:NaN}get localWeekNumber(){return this.isValid?Tc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Tc(this).weekYear:NaN}get ordinal(){return this.isValid?Xt(this.c).ordinal:NaN}get monthShort(){return this.isValid?br.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?br.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?br.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?br.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const M=864e5,q=6e4,J=ti(this.c),ce=this.zone.offset(J-M),Ce=this.zone.offset(J+M),Ne=this.zone.offset(J-ce*q),qe=this.zone.offset(J-Ce*q);if(Ne===qe)return[this];const Xe=J-Ne*q,At=J-qe*q,Mn=Rs(Xe,Ne),Fn=Rs(At,qe);return Mn.hour===Fn.hour&&Mn.minute===Fn.minute&&Mn.second===Fn.second&&Mn.millisecond===Fn.millisecond?[Li(this,{ts:Xe}),Li(this,{ts:At})]:[this]}get isInLeapYear(){return ca(this.year)}get daysInMonth(){return qr(this.year,this.month)}get daysInYear(){return this.isValid?fr(this.year):NaN}get weeksInWeekYear(){return this.isValid?bs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?bs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(M={}){const{locale:q,numberingSystem:J,calendar:ce}=oo.create(this.loc.clone(M),M).resolvedOptions(this);return{locale:q,numberingSystem:J,outputCalendar:ce}}toUTC(M=0,q={}){return this.setZone(Rt.instance(M),q)}toLocal(){return this.setZone(mn.defaultZone)}setZone(M,{keepLocalTime:q=!1,keepCalendarTime:J=!1}={}){if(M=it(M,mn.defaultZone),M.equals(this.zone))return this;if(M.isValid){let ce=this.ts;if(q||J){const Ce=M.offset(this.ts),Ne=this.toObject();[ce]=Vu(Ne,Ce,M)}return Li(this,{ts:ce,zone:M})}else return En.invalid(Ii(M))}reconfigure({locale:M,numberingSystem:q,outputCalendar:J}={}){const ce=this.loc.clone({locale:M,numberingSystem:q,outputCalendar:J});return Li(this,{loc:ce})}setLocale(M){return this.reconfigure({locale:M})}set(M){if(!this.isValid)return this;const q=bc(M,_l),{minDaysInFirstWeek:J,startOfWeek:ce}=Vt(q,this.loc),Ce=!We(q.weekYear)||!We(q.weekNumber)||!We(q.weekday),Ne=!We(q.ordinal),qe=!We(q.year),Xe=!We(q.month)||!We(q.day),At=qe||Xe,Mn=q.weekYear||q.weekNumber;if((At||Ne)&&Mn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Xe&&Ne)throw new o("Can't mix ordinal dates with month/day");let Fn;Ce?Fn=Lt({...Mt(this.c,J,ce),...q},J,ce):We(q.ordinal)?(Fn={...this.toObject(),...q},We(q.day)&&(Fn.day=Math.min(qr(Fn.year,Fn.month),Fn.day))):Fn=zt({...Xt(this.c),...q});const[pr,An]=Vu(Fn,this.o,this.zone);return Li(this,{ts:pr,o:An})}plus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M);return Li(this,Wu(this,q))}minus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M).negate();return Li(this,Wu(this,q))}startOf(M,{useLocaleWeeks:q=!1}={}){if(!this.isValid)return this;const J={},ce=Qt.normalizeUnit(M);switch(ce){case"years":J.month=1;case"quarters":case"months":J.day=1;case"weeks":case"days":J.hour=0;case"hours":J.minute=0;case"minutes":J.second=0;case"seconds":J.millisecond=0;break}if(ce==="weeks")if(q){const Ce=this.loc.getStartOfWeek(),{weekday:Ne}=this;Ne<Ce&&(J.weekNumber=this.weekNumber-1),J.weekday=Ce}else J.weekday=1;if(ce==="quarters"){const Ce=Math.ceil(this.month/3);J.month=(Ce-1)*3+1}return this.set(J)}endOf(M,q){return this.isValid?this.plus({[M]:1}).startOf(M,q).minus(1):this}toFormat(M,q={}){return this.isValid?oo.create(this.loc.redefaultToEN(q)).formatDateTimeFromString(this,M):fa}toLocaleString(M=m,q={}){return this.isValid?oo.create(this.loc.clone(q),M).formatDateTime(this):fa}toLocaleParts(M={}){return this.isValid?oo.create(this.loc.clone(M),M).formatDateTimeParts(this):[]}toISO({format:M="extended",suppressSeconds:q=!1,suppressMilliseconds:J=!1,includeOffset:ce=!0,extendedZone:Ce=!1,precision:Ne="milliseconds"}={}){if(!this.isValid)return null;Ne=Ts(Ne);const qe=M==="extended";let Xe=ra(this,qe,Ne);return Fi.indexOf(Ne)>=3&&(Xe+="T"),Xe+=kf(this,qe,q,J,ce,Ce,Ne),Xe}toISODate({format:M="extended",precision:q="day"}={}){return this.isValid?ra(this,M==="extended",Ts(q)):null}toISOWeekDate(){return Cf(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:M=!1,suppressSeconds:q=!1,includeOffset:J=!0,includePrefix:ce=!1,extendedZone:Ce=!1,format:Ne="extended",precision:qe="milliseconds"}={}){return this.isValid?(qe=Ts(qe),(ce&&Fi.indexOf(qe)>=3?"T":"")+kf(this,Ne==="extended",q,M,J,Ce,qe)):null}toRFC2822(){return Cf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Cf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ra(this,!0):null}toSQLTime({includeOffset:M=!0,includeZone:q=!1,includeOffsetSpace:J=!0}={}){let ce="HH:mm:ss.SSS";return(q||M)&&(J&&(ce+=" "),q?ce+="z":M&&(ce+="ZZ")),Cf(this,ce,!0)}toSQL(M={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(M)}`:null}toString(){return this.isValid?this.toISO():fa}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(M={}){if(!this.isValid)return{};const q={...this.c};return M.includeConfig&&(q.outputCalendar=this.outputCalendar,q.numberingSystem=this.loc.numberingSystem,q.locale=this.loc.locale),q}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(M,q="milliseconds",J={}){if(!this.isValid||!M.isValid)return Qt.invalid("created by diffing an invalid DateTime");const ce={locale:this.locale,numberingSystem:this.numberingSystem,...J},Ce=kt(q).map(Qt.normalizeUnit),Ne=M.valueOf()>this.valueOf(),qe=Ne?this:M,Xe=Ne?M:this,At=ri(qe,Xe,Ce,ce);return Ne?At.negate():At}diffNow(M="milliseconds",q={}){return this.diff(En.now(),M,q)}until(M){return this.isValid?xn.fromDateTimes(this,M):this}hasSame(M,q,J){if(!this.isValid)return!1;const ce=M.valueOf(),Ce=this.setZone(M.zone,{keepLocalTime:!0});return Ce.startOf(q,J)<=ce&&ce<=Ce.endOf(q,J)}equals(M){return this.isValid&&M.isValid&&this.valueOf()===M.valueOf()&&this.zone.equals(M.zone)&&this.loc.equals(M.loc)}toRelative(M={}){if(!this.isValid)return null;const q=M.base||En.fromObject({},{zone:this.zone}),J=M.padding?this<q?-M.padding:M.padding:0;let ce=["years","months","days","hours","minutes","seconds"],Ce=M.unit;return Array.isArray(M.unit)&&(ce=M.unit,Ce=void 0),ka(q,this.plus(J),{...M,numeric:"always",units:ce,unit:Ce})}toRelativeCalendar(M={}){return this.isValid?ka(M.base||En.fromObject({},{zone:this.zone}),this,{...M,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...M){if(!M.every(En.isDateTime))throw new i("min requires all arguments be DateTimes");return Ot(M,q=>q.valueOf(),Math.min)}static max(...M){if(!M.every(En.isDateTime))throw new i("max requires all arguments be DateTimes");return Ot(M,q=>q.valueOf(),Math.max)}static fromFormatExplain(M,q,J={}){const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});return wf(Ne,M,q)}static fromStringExplain(M,q,J={}){return En.fromFormatExplain(M,q,J)}static buildFormatParser(M,q={}){const{locale:J=null,numberingSystem:ce=null}=q,Ce=Oe.fromOpts({locale:J,numberingSystem:ce,defaultToEN:!0});return new Uh(Ce,M)}static fromFormatParser(M,q,J={}){if(We(M)||We(q))throw new i("fromFormatParser requires an input string and a format parser");const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});if(!Ne.equals(q.locale))throw new i(`fromFormatParser called with a locale of ${Ne}, but the format parser was created for ${q.locale}`);const{result:qe,zone:Xe,specificOffset:At,invalidReason:Mn}=q.explainFromTokens(M);return Mn?En.invalid(Mn):ai(qe,Xe,J,`format ${q.format}`,M,At)}static get DATE_SHORT(){return m}static get DATE_MED(){return g}static get DATE_MED_WITH_WEEKDAY(){return y}static get DATE_FULL(){return x}static get DATE_HUGE(){return w}static get TIME_SIMPLE(){return S}static get TIME_WITH_SECONDS(){return b}static get TIME_WITH_SHORT_OFFSET(){return $}static get TIME_WITH_LONG_OFFSET(){return k}static get TIME_24_SIMPLE(){return T}static get TIME_24_WITH_SECONDS(){return O}static get TIME_24_WITH_SHORT_OFFSET(){return P}static get TIME_24_WITH_LONG_OFFSET(){return D}static get DATETIME_SHORT(){return A}static get DATETIME_SHORT_WITH_SECONDS(){return F}static get DATETIME_MED(){return L}static get DATETIME_MED_WITH_SECONDS(){return _}static get DATETIME_MED_WITH_WEEKDAY(){return R}static get DATETIME_FULL(){return z}static get DATETIME_FULL_WITH_SECONDS(){return N}static get DATETIME_HUGE(){return B}static get DATETIME_HUGE_WITH_SECONDS(){return I}}function li(W){if(En.isDateTime(W))return W;if(W&&W.valueOf&&Nt(W.valueOf()))return En.fromJSDate(W);if(W&&typeof W=="object")return En.fromObject(W);throw new i(`Unknown datetime argument: ${W}, of type ${typeof W}`)}const fv="3.7.2";return Ba.DateTime=En,Ba.Duration=Qt,Ba.FixedOffsetZone=Rt,Ba.IANAZone=ee,Ba.Info=br,Ba.Interval=xn,Ba.InvalidZone=vt,Ba.Settings=mn,Ba.SystemZone=ae,Ba.VERSION=fv,Ba.Zone=H,Ba}var kI;function iT(){return kI||(kI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=Twe();var n;(function(a){a.Second="Second",a.Minute="Minute",a.Hour="Hour",a.Day="Day",a.Month="Month",a.Year="Year"})(n||(e.TimeUnit=n={}));var r;(function(a){a.Add="Add",a.Subtract="Subtract"})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);class o{#e;#t=null;#n=null;constructor(i,s){const l={zone:s};if(i?i instanceof o?(this.#e=i.#e,this.#t=i.#t,this.#n=i.#n):i instanceof Date?this.#e=t.DateTime.fromJSDate(i,l):typeof i=="number"?this.#e=t.DateTime.fromMillis(i,l):(this.#e=t.DateTime.fromISO(i,l),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(i,"EEE, d MMM yyyy HH:mm:ss",l))):this.#e=t.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${i}`);s&&s!==this.#e.zoneName&&(this.#e=this.#e.setZone(s))}static#o(i){return i%4===0&&i%100!==0||i%400===0}get dstStart(){return this.#t}set dstStart(i){this.#t=i}get dstEnd(){return this.#n}set dstEnd(i){this.#n=i}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(i){switch(i){case n.Year:return this.addYear();case n.Month:return this.addMonth();case n.Day:return this.addDay();case n.Hour:return this.addHour();case n.Minute:return this.addMinute();case n.Second:return this.addSecond()}}subtractUnit(i){switch(i){case n.Year:return this.subtractYear();case n.Month:return this.subtractMonth();case n.Day:return this.subtractDay();case n.Hour:return this.subtractHour();case n.Minute:return this.subtractMinute();case n.Second:return this.subtractSecond()}}invokeDateOperation(i,s){if(i===r.Add){this.addUnit(s);return}if(i===r.Subtract){this.subtractUnit(s);return}throw new Error(`Invalid verb: ${i}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){const i=this.#e.weekday;return i===7?0:i}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#r().day}getUTCFullYear(){return this.#r().year}getUTCDay(){const i=this.#r().weekday;return i===7?0:i}getUTCMonth(){return this.#r().month-1}getUTCHours(){return this.#r().hour}getUTCMinutes(){return this.#r().minute}getUTCSeconds(){return this.#r().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(i){this.#e=this.#e.set({day:i})}setFullYear(i){this.#e=this.#e.set({year:i})}setDay(i){this.#e=this.#e.set({weekday:i})}setMonth(i){this.#e=this.#e.set({month:i+1})}setHours(i){this.#e=this.#e.set({hour:i})}setMinutes(i){this.#e=this.#e.set({minute:i})}setSeconds(i){this.#e=this.#e.set({second:i})}setMilliseconds(i){this.#e=this.#e.set({millisecond:i})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){const{day:i,month:s}=this.#e;if(s===2){const l=o.#o(this.#e.year);return i===e.DAYS_IN_MONTH[s-1]-(l?0:1)}return i===e.DAYS_IN_MONTH[s-1]}isLastWeekdayOfMonth(){const{day:i,month:s}=this.#e;let l;return s===2?l=e.DAYS_IN_MONTH[s-1]-(o.#o(this.#e.year)?0:1):l=e.DAYS_IN_MONTH[s-1],i>l-7}applyDateOperation(i,s,l){if(s===n.Month||s===n.Day){this.invokeDateOperation(i,s);return}const d=this.getHours();this.invokeDateOperation(i,s);const u=this.getHours(),m=u-d;m===2?l!==24&&(this.dstStart=d+1):m===0&&this.getMinutes()===0&&this.getSeconds()===0&&l!==24&&(this.dstEnd=u)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(SI)),SI}var $I;function Ewe(){if($I)return fg;$I=1,Object.defineProperty(fg,"__esModule",{value:!0}),fg.CronMonth=void 0;const e=iT(),t=rf(),n=1,r=12,o=Object.freeze([]);let a=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return o}static get daysInMonth(){return e.DAYS_IN_MONTH}constructor(i,s){super(i,s),this.validate()}get values(){return super.values}};return fg.CronMonth=a,fg}var pg={},RI;function Mwe(){if(RI)return pg;RI=1,Object.defineProperty(pg,"__esModule",{value:!0}),pg.CronSecond=void 0;const e=rf(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return pg.CronSecond=o,pg}var TI;function sT(){return TI||(TI=1,(function(e){var t=pp&&pp.__createBinding||(Object.create?(function(r,o,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(o,a);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,i,s)}):(function(r,o,a,i){i===void 0&&(i=a),r[i]=o[a]})),n=pp&&pp.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,r,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(Swe(),e),n(Cwe(),e),n(kwe(),e),n(rf(),e),n($we(),e),n(Rwe(),e),n(Ewe(),e),n(Mwe(),e)})(pp)),pp}var EI;function d6(){if(EI)return ig;EI=1,Object.defineProperty(ig,"__esModule",{value:!0}),ig.CronFieldCollection=void 0;const e=sT();let t=class Pg{#e;#t;#n;#o;#r;#a;static from(r,o){return new Pg({second:this.resolveField(e.CronSecond,r.second,o.second),minute:this.resolveField(e.CronMinute,r.minute,o.minute),hour:this.resolveField(e.CronHour,r.hour,o.hour),dayOfMonth:this.resolveField(e.CronDayOfMonth,r.dayOfMonth,o.dayOfMonth),month:this.resolveField(e.CronMonth,r.month,o.month),dayOfWeek:this.resolveField(e.CronDayOfWeek,r.dayOfWeek,o.dayOfWeek)})}static resolveField(r,o,a){return a?a instanceof e.CronField?a:new r(a):o}constructor({second:r,minute:o,hour:a,dayOfMonth:i,month:s,dayOfWeek:l}){if(!r)throw new Error("Validation error, Field second is missing");if(!o)throw new Error("Validation error, Field minute is missing");if(!a)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!s)throw new Error("Validation error, Field month is missing");if(!l)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&l.isWildcard&&!(parseInt(i.values[0],10)<=e.CronMonth.daysInMonth[s.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=r,this.#t=o,this.#n=a,this.#r=s,this.#a=l,this.#o=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#o}get month(){return this.#r}get dayOfWeek(){return this.#a}static compactField(r){if(r.length===0)return[];const o=[];let a;return r.forEach((i,s,l)=>{if(a===void 0){a={start:i,count:1};return}const d=l[s-1]||a.start,u=l[s+1];if(i==="L"||i==="W"){o.push(a),o.push({start:i,count:1}),a=void 0;return}if(a.step===void 0&&u!==void 0){const m=i-d,g=u-i;if(m<=g){a={...a,count:2,end:i,step:m};return}a.step=1}i-(a.end??0)===a.step?(a.count++,a.end=i):(a.count===1?o.push({start:a.start,count:1}):a.count===2?(o.push({start:a.start,count:1}),o.push({start:a.end??d,count:1})):o.push(a),a={start:i,count:1})}),a&&o.push(a),o}static#s(r,o,a){const i=o.step;return i?i===1&&o.start===r.min&&o.end&&o.end>=a?r.hasQuestionMarkChar?"?":"*":i!==1&&o.start===r.min&&o.end&&o.end>=a-i+1?`*/${i}`:null:null}static#i(r,o){const a=r.step;if(a===1)return`${r.start}-${r.end}`;const i=r.start===0?r.count-1:r.count;if(!a)throw new Error("Unexpected range step");if(!r.end)throw new Error("Unexpected range end");if(a*i>r.end){const s=(d,u)=>{if(typeof r.start!="number")throw new Error("Unexpected range start");return u%a===0?r.start+u:null};if(typeof r.start!="number")throw new Error("Unexpected range start");const l={length:r.end-r.start+1};return Array.from(l,s).filter(d=>d!==null).join(",")}return r.end===o-a+1?`${r.start}/${a}`:`${r.start}-${r.end}/${a}`}stringifyField(r){let o=r.max,a=r.values;if(r instanceof e.CronDayOfWeek){o=6;const s=this.#a.values;a=s[s.length-1]===7?s.slice(0,-1):s}r instanceof e.CronDayOfMonth&&(o=this.#r.values.length===1?e.CronMonth.daysInMonth[this.#r.values[0]-1]:r.max);const i=Pg.compactField(a);if(i.length===1){const s=Pg.#s(r,i[0],o);if(s)return s}return i.map(s=>{const l=s.count===1?s.start.toString():Pg.#i(s,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${l}#${r.nthDay}`:l}).join(",")}stringify(r=!1){const o=[];return r&&o.push(this.stringifyField(this.#e)),o.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#o),this.stringifyField(this.#r),this.stringifyField(this.#a)),o.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#o.serialize(),month:this.#r.serialize(),dayOfWeek:this.#a.serialize()}}};return ig.CronFieldCollection=t,ig}var MI={},OI;function f6(){return OI||(OI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpression=e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;const t=iT();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range",e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";const n=1e4;class r{#e;#t;#n;#o;#r;#a;#s=null;#i=!1;constructor(a,i){this.#e=i,this.#t=i.tz,this.#o=i.startDate?new t.CronDate(i.startDate,this.#t):null,this.#r=i.endDate?new t.CronDate(i.endDate,this.#t):null;let s=i.currentDate??i.startDate;if(s){const l=new t.CronDate(s,this.#t);this.#o&&l.getTime()<this.#o.getTime()?s=this.#o:this.#r&&l.getTime()>this.#r.getTime()&&(s=this.#r)}this.#n=new t.CronDate(s,this.#t),this.#a=a}get fields(){return this.#a}static fieldsToExpression(a,i){return new r(a,i||{})}static#c(a,i){return i.some(s=>s===a)}#l(a,i){return a[i?a.length-1:0]}#d(a){const i=`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`;if(this.#s===i)return this.#i;const s=new t.CronDate(a);s.setStartOfDay();const l=new t.CronDate(a);return l.setEndOfDay(),this.#s=i,this.#i=s.getUTCOffset()!==l.getUTCOffset(),this.#i}#u(a,i,s){const l=this.#a.second.values,d=a.getSeconds(),u=this.#a.second.findNearestValue(d,s);if(u!==null){a.setSeconds(u);return}a.applyDateOperation(i,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(l,s))}#p(a,i,s){const l=this.#a.minute.values,d=this.#a.second.values,u=a.getMinutes(),m=this.#a.minute.findNearestValue(u,s);if(m!==null){a.setMinutes(m),a.setSeconds(this.#l(d,s));return}a.applyDateOperation(i,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(l,s)),a.setSeconds(this.#l(d,s))}static#f(a,i){const s=i.isLastWeekdayOfMonth();return a.some(l=>{const d=parseInt(l.toString().charAt(0),10)%7;if(Number.isNaN(d))throw new Error(`Invalid last weekday of the month expression: ${l}`);return i.getDay()===d&&s})}next(){return this.#h()}prev(){return this.#h(!0)}hasNext(){const a=this.#n;try{return this.#h(),!0}catch{return!1}finally{this.#n=a}}hasPrev(){const a=this.#n;try{return this.#h(!0),!0}catch{return!1}finally{this.#n=a}}take(a){const i=[];if(a>=0)for(let s=0;s<a;s++)try{i.push(this.next())}catch{return i}else for(let s=0;s>a;s--)try{i.push(this.prev())}catch{return i}return i}reset(a){this.#n=new t.CronDate(a||this.#e.currentDate,this.#t)}stringify(a=!1){return this.#a.stringify(a)}includesDate(a){const{second:i,minute:s,hour:l,month:d}=this.#a,u=new t.CronDate(a,this.#t);return!(!i.values.includes(u.getSeconds())||!s.values.includes(u.getMinutes())||!l.values.includes(u.getHours())||!d.values.includes(u.getMonth()+1)||!this.#m(u)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(u.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(a){const i=this.#a.dayOfMonth.isWildcard,s=!i,l=this.#a.dayOfWeek.isWildcard,d=!l,u=r.#c(a.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&a.isLastDayOfMonth(),m=r.#c(a.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#f(this.#a.dayOfWeek.values,a);return!!(s&&d&&(u||m)||u&&!d||i&&!l&&m)}#g(a,i,s){const l=this.#a.hour.values,d=l,u=a.getHours(),m=r.#c(u,l),g=a.dstEnd===u;if(a.dstStart!==null&&a.dstStart===u-1&&r.#c(a.dstStart,l))return!0;if(g&&!s)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,d.length),!1;if(m)return!0;a.dstStart=null;const y=this.#a.hour.findNearestValue(u,s);if(y===null)return a.applyDateOperation(i,t.TimeUnit.Day,d.length),!1;if(this.#d(a)){const x=s?u-y:y-u;for(let w=0;w<x&&(a.applyDateOperation(i,t.TimeUnit.Hour,d.length),!(!s&&a.getHours()>=y||s&&a.getHours()<=y));w++);}else a.setHours(y);return a.setMinutes(this.#l(this.#a.minute.values,s)),a.setSeconds(this.#l(this.#a.second.values,s)),!1}#y(a){if(!this.#o&&!this.#r)return;const i=a.getTime();if(this.#o&&i<this.#o.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#r&&i>this.#r.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#h(a=!1){const i=a?t.DateMathOp.Subtract:t.DateMathOp.Add,s=new t.CronDate(this.#n),l=s.getTime();let d=0;for(;++d<n;){if(this.#y(s),!this.#m(s)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(s.getDate()/7)===this.#a.dayOfWeek.nthDay)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(s.getMonth()+1,this.#a.month.values)){s.applyDateOperation(i,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#g(s,i,a)){if(!r.#c(s.getMinutes(),this.#a.minute.values)){this.#p(s,i,a);continue}if(!r.#c(s.getSeconds(),this.#a.second.values)){this.#u(s,i,a);continue}if(l===s.getTime()){(i==="Add"||s.getMilliseconds()===0)&&s.applyDateOperation(i,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(d>n)throw new Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return s.getMilliseconds()!==0&&s.setMilliseconds(0),this.#n=s,s}[Symbol.iterator](){return{next:()=>{try{return{value:this.#h(),done:!1}}catch{return{value:void 0,done:!0}}}}}}e.CronExpression=r,e.default=r})(MI)),MI}var Ub={},PI;function Owe(){if(PI)return Ub;PI=1,Object.defineProperty(Ub,"__esModule",{value:!0}),Ub.seededRandom=n;function e(r){let o=2166136261;for(let a=0;a<r.length;a++)o^=r.charCodeAt(a),o=Math.imul(o,16777619);return()=>o>>>0}function t(r){return()=>{let o=r+=1831565813;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296}}function n(r){const o=r?e(r)():Math.floor(Math.random()*1e10);return t(o)}return Ub}var jI;function $$(){if(jI)return hi;jI=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.CronExpressionParser=hi.DayOfWeek=hi.Months=hi.CronUnit=hi.PredefinedExpressions=void 0;const e=d6(),t=f6(),n=Owe(),r=sT();var o;(function(d){d["@yearly"]="0 0 0 1 1 *",d["@annually"]="0 0 0 1 1 *",d["@monthly"]="0 0 0 1 * *",d["@weekly"]="0 0 0 * * 0",d["@daily"]="0 0 0 * * *",d["@hourly"]="0 0 * * * *",d["@minutely"]="0 * * * * *",d["@secondly"]="* * * * * *",d["@weekdays"]="0 0 0 * * 1-5",d["@weekends"]="0 0 0 * * 0,6"})(o||(hi.PredefinedExpressions=o={}));var a;(function(d){d.Second="Second",d.Minute="Minute",d.Hour="Hour",d.DayOfMonth="DayOfMonth",d.Month="Month",d.DayOfWeek="DayOfWeek"})(a||(hi.CronUnit=a={}));var i;(function(d){d[d.jan=1]="jan",d[d.feb=2]="feb",d[d.mar=3]="mar",d[d.apr=4]="apr",d[d.may=5]="may",d[d.jun=6]="jun",d[d.jul=7]="jul",d[d.aug=8]="aug",d[d.sep=9]="sep",d[d.oct=10]="oct",d[d.nov=11]="nov",d[d.dec=12]="dec"})(i||(hi.Months=i={}));var s;(function(d){d[d.sun=0]="sun",d[d.mon=1]="mon",d[d.tue=2]="tue",d[d.wed=3]="wed",d[d.thu=4]="thu",d[d.fri=5]="fri",d[d.sat=6]="sat"})(s||(hi.DayOfWeek=s={}));let l=class mi{static parse(u,m={}){const{strict:g=!1,hashSeed:y}=m,x=(0,n.seededRandom)(y);u=o[u]||u;const w=mi.#e(u,g);if(!(w.dayOfMonth==="*"||w.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const S=mi.#t(a.Second,w.second,r.CronSecond.constraints,x),b=mi.#t(a.Minute,w.minute,r.CronMinute.constraints,x),$=mi.#t(a.Hour,w.hour,r.CronHour.constraints,x),k=mi.#t(a.Month,w.month,r.CronMonth.constraints,x),T=mi.#t(a.DayOfMonth,w.dayOfMonth,r.CronDayOfMonth.constraints,x),{dayOfWeek:O,nthDayOfWeek:P}=mi.#d(w.dayOfWeek),D=mi.#t(a.DayOfWeek,O,r.CronDayOfWeek.constraints,x),A=new e.CronFieldCollection({second:new r.CronSecond(S,{rawValue:w.second}),minute:new r.CronMinute(b,{rawValue:w.minute}),hour:new r.CronHour($,{rawValue:w.hour}),dayOfMonth:new r.CronDayOfMonth(T,{rawValue:w.dayOfMonth}),month:new r.CronMonth(k,{rawValue:w.month}),dayOfWeek:new r.CronDayOfWeek(D,{rawValue:w.dayOfWeek,nthDayOfWeek:P})});return new t.CronExpression(A,{...m,expression:u})}static#e(u,m){if(m&&!u.length)throw new Error("Invalid cron expression");u=u||"0 * * * * *";const g=u.trim().split(/\s+/);if(m&&g.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(g.length>6)throw new Error("Invalid cron expression, too many fields");const y=["*","*","*","*","*","0"];g.length<y.length&&g.unshift(...y.slice(g.length));const[x,w,S,b,$,k]=g;return{second:x,minute:w,hour:S,dayOfMonth:b,month:$,dayOfWeek:k}}static#t(u,m,g,y){if((u===a.Month||u===a.DayOfWeek)&&(m=m.replace(/[a-z]{3}/gi,x=>{x=x.toLowerCase();const w=i[x]||s[x];if(w===void 0)throw new Error(`Validation error, cannot resolve alias "${x}"`);return w.toString()})),!g.validChars.test(m))throw new Error(`Invalid characters, got value: ${m}`);return m=this.#n(m,g),m=this.#o(m,g,y),this.#r(u,m,g)}static#n(u,m){return u.replace(/[*?]/g,m.min+"-"+m.max)}static#o(u,m,g){const y=g();return u.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(x,w,S,b)=>{if(w&&S&&b){const $=parseInt(w,10),k=parseInt(S,10),T=parseInt(b,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);if(T<=0)throw new Error(`Invalid step: ${T}, must be positive`);const O=Math.max($,m.min),P=Math.floor(y*T),D=[];for(let A=Math.floor(O/T)*T+P;A<=k;A+=T)A>=O&&D.push(A);return D.join(",")}else if(w&&S){const $=parseInt(w,10),k=parseInt(S,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);return String(Math.floor(y*(k-$+1))+$)}else if(b){const $=parseInt(b,10);if($<=0)throw new Error(`Invalid step: ${$}, must be positive`);const k=Math.floor(y*$),T=[];for(let O=Math.floor(m.min/$)*$+k;O<=m.max;O+=$)O>=m.min&&T.push(O);return T.join(",")}else return String(Math.floor(y*(m.max-m.min+1)+m.min))})}static#r(u,m,g){const y=[];function x(w,S){if(Array.isArray(w))y.push(...w);else if(mi.#u(S,w))y.push(w);else{const b=parseInt(w.toString(),10);if(!(b>=S.min&&b<=S.max))throw new Error(`Constraint error, got value ${w} expected range ${S.min}-${S.max}`);y.push(u===a.DayOfWeek?b%7:w)}}return m.split(",").forEach(w=>{if(!(w.length>0))throw new Error("Invalid list value format");x(mi.#a(u,w,g),g)}),y}static#a(u,m,g){const y=m.split("/");if(y.length>2)throw new Error(`Invalid repeat: ${m}`);return y.length===2?(y[0].includes("-")||(y[0]=`${y[0]}-${g.max}`),mi.#l(u,y[0],parseInt(y[1],10),g)):mi.#l(u,m,1,g)}static#s(u,m,g){if(!(!isNaN(u)&&!isNaN(m)&&u>=g.min&&m<=g.max))throw new Error(`Constraint error, got range ${u}-${m} expected range ${g.min}-${g.max}`);if(u>m)throw new Error(`Invalid range: ${u}-${m}, min(${u}) > max(${m})`)}static#i(u){if(!(!isNaN(u)&&u>0))throw new Error(`Constraint error, cannot repeat at every ${u} time.`)}static#c(u,m,g,y){const x=[];u===a.DayOfWeek&&g%7===0&&x.push(0);for(let w=m;w<=g;w+=y)x.indexOf(w)===-1&&x.push(w);return x}static#l(u,m,g,y){const x=m.split("-");if(x.length<=1)return isNaN(+m)?m:+m;const[w,S]=x.map(b=>parseInt(b,10));return this.#s(w,S,y),this.#i(g),this.#c(u,w,S,g)}static#d(u){const m=u.split("#");if(m.length<=1)return{dayOfWeek:m[0]};const g=+m[m.length-1],y=u.match(/([,-/])/);if(y!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${y?.[0]}\` special characters are incompatible`);if(!(m.length<=2&&!isNaN(g)&&g>=1&&g<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:m[0],nthDayOfWeek:g}}static#u(u,m){return u.chars.some(g=>m.toString().includes(g))}};return hi.CronExpressionParser=l,hi}var As={};const Pwe={},jwe=Object.freeze(Object.defineProperty({__proto__:null,default:Pwe},Symbol.toStringTag,{value:"Module"})),AI=Eae(jwe);var DI;function Awe(){if(DI)return As;DI=1;var e=As&&As.__createBinding||(Object.create?(function(a,i,s,l){l===void 0&&(l=s);var d=Object.getOwnPropertyDescriptor(i,s);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(a,l,d)}):(function(a,i,s,l){l===void 0&&(l=s),a[l]=i[s]})),t=As&&As.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=As&&As.__importStar||(function(){var a=function(i){return a=Object.getOwnPropertyNames||function(s){var l=[];for(var d in s)Object.prototype.hasOwnProperty.call(s,d)&&(l[l.length]=d);return l},a(i)};return function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var l=a(i),d=0;d<l.length;d++)l[d]!=="default"&&e(s,i,l[d]);return t(s,i),s}})();Object.defineProperty(As,"__esModule",{value:!0}),As.CronFileParser=void 0;const r=$$();let o=class y0{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(AI)),l=await s(i,"utf8");return y0.#e(l)}static parseFileSync(i){const{readFileSync:s}=AI,l=s(i,"utf8");return y0.#e(l)}static#e(i){const s=i.split(`
481
- `),l={variables:{},expressions:[],errors:{}};for(const d of s){const u=d.trim();if(u.length===0||u.startsWith("#"))continue;const m=u.match(/^(.*)=(.*)$/);if(m){const[,g,y]=m;l.variables[g]=y.replace(/["']/g,"");continue}try{const g=y0.#t(u);l.expressions.push(g.interval)}catch(g){l.errors[u]=g}}return l}static#t(i){const s=i.split(" ");return{interval:r.CronExpressionParser.parse(s.slice(0,5).join(" ")),command:s.slice(5,s.length)}}};return As.CronFileParser=o,As}var NI;function Dwe(){return NI||(NI=1,(function(e){var t=fp&&fp.__createBinding||(Object.create?(function(d,u,m,g){g===void 0&&(g=m);var y=Object.getOwnPropertyDescriptor(u,m);(!y||("get"in y?!u.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return u[m]}}),Object.defineProperty(d,g,y)}):(function(d,u,m,g){g===void 0&&(g=m),d[g]=u[m]})),n=fp&&fp.__exportStar||function(d,u){for(var m in d)m!=="default"&&!Object.prototype.hasOwnProperty.call(u,m)&&t(u,d,m)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;const r=$$();var o=iT();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=d6();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var i=f6();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return i.CronExpression}});var s=$$();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var l=Awe();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return l.CronFileParser}}),n(sT(),e),e.default=r.CronExpressionParser})(fp)),fp}var Nwe=Dwe(),II={exports:{}},LI;function Iwe(){return LI||(LI=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,()=>(()=>{var n={949:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var d=l(515),u=(function(){function m(g,y,x){y===void 0&&(y=!0),x===void 0&&(x=!1),this.expression=g,this.dayOfWeekStartIndexZero=y,this.monthStartIndexZero=x}return m.prototype.parse=function(){var g,y,x=(g=this.expression)!==null&&g!==void 0?g:"";if(x==="@reboot")return y=["@reboot","","","","","",""],y;if(x.startsWith("@")){var w=this.parseSpecial(this.expression);y=this.extractParts(w)}else y=this.extractParts(this.expression);return this.normalize(y),this.validate(y),y},m.prototype.parseSpecial=function(g){var y={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},x=y[g];if(!x)throw new Error("Unknown special expression.");return x},m.prototype.extractParts=function(g){if(!this.expression)throw new Error("cron expression is empty");for(var y=g.trim().split(/[ ]+/),x=0;x<y.length;x++)if(y[x].includes(",")){var w=y[x].split(",").map(function(b){return b.trim()}).filter(function(b){return b!==""}).map(function(b){return isNaN(Number(b))?b:Number(b)}).filter(function(b){return b!==null&&b!==""});w.length===0&&w.push("*"),w.sort(function(b,$){return b!==null&&$!==null?b-$:0}),y[x]=w.map(function(b){return b!==null?b.toString():""}).join(",")}if(y.length<5)throw new Error("Expression has only ".concat(y.length," part").concat(y.length==1?"":"s",". At least 5 parts are required."));if(y.length==5)y.unshift(""),y.push("");else if(y.length==6){var S=/\d{4}$/.test(y[5])||y[4]=="?"||y[2]=="?";S?y.unshift(""):y.push("")}else if(y.length>7)throw new Error("Expression has ".concat(y.length," parts; too many!"));return y},m.prototype.normalize=function(g){var y=this;if(g[3]=g[3].replace("?","*"),g[5]=g[5].replace("?","*"),g[2]=g[2].replace("?","*"),g[0].indexOf("0/")==0&&(g[0]=g[0].replace("0/","*/")),g[1].indexOf("0/")==0&&(g[1]=g[1].replace("0/","*/")),g[2].indexOf("0/")==0&&(g[2]=g[2].replace("0/","*/")),g[3].indexOf("1/")==0&&(g[3]=g[3].replace("1/","*/")),g[4].indexOf("1/")==0&&(g[4]=g[4].replace("1/","*/")),g[6].indexOf("1/")==0&&(g[6]=g[6].replace("1/","*/")),g[5]=g[5].replace(/(^\d)|([^#/\s]\d)/g,function(O){var P=O.replace(/\D/,""),D=P;return y.dayOfWeekStartIndexZero?P=="7"&&(D="0"):D=(parseInt(P)-1).toString(),O.replace(P,D)}),g[5]=="L"&&(g[5]="6"),g[3]=="?"&&(g[3]="*"),g[3].indexOf("W")>-1&&(g[3].indexOf(",")>-1||g[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var x={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var w in x)g[5]=g[5].replace(new RegExp(w,"gi"),x[w].toString());g[4]=g[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(O){var P=O.replace(/\D/,""),D=P;return y.monthStartIndexZero&&(D=(parseInt(P)+1).toString()),O.replace(P,D)});var S={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var b in S)g[4]=g[4].replace(new RegExp(b,"gi"),S[b].toString());g[0]=="0"&&(g[0]=""),!/\*|\-|\,|\//.test(g[2])&&(/\*|\//.test(g[1])||/\*|\//.test(g[0]))&&(g[2]+="-".concat(g[2]));for(var $=0;$<g.length;$++)if(g[$].indexOf(",")!=-1&&(g[$]=g[$].split(",").filter(function(O){return O!==""}).join(",")||"*"),g[$]=="*/1"&&(g[$]="*"),g[$].indexOf("/")>-1&&!/^\*|\-|\,/.test(g[$])){var k=null;switch($){case 4:k="12";break;case 5:k="6";break;case 6:k="9999";break;default:k=null;break}if(k!==null){var T=g[$].split("/");g[$]="".concat(T[0],"-").concat(k,"/").concat(T[1])}}},m.prototype.validate=function(g){var y="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(g[0],y),this.validateOnlyExpectedCharactersFound(g[1],y),this.validateOnlyExpectedCharactersFound(g[2],y),this.validateOnlyExpectedCharactersFound(g[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(g[4],y),this.validateOnlyExpectedCharactersFound(g[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(g[6],y),this.validateAnyRanges(g)},m.prototype.validateAnyRanges=function(g){d.default.secondRange(g[0]),d.default.minuteRange(g[1]),d.default.hourRange(g[2]),d.default.dayOfMonthRange(g[3]),d.default.monthRange(g[4],this.monthStartIndexZero),d.default.dayOfWeekRange(g[5],this.dayOfWeekStartIndexZero)},m.prototype.validateOnlyExpectedCharactersFound=function(g,y){var x=g.match(new RegExp("[^".concat(y,"]+"),"gi"));if(x&&x.length)throw new Error("Expression contains invalid values: '".concat(x.toString(),"'"))},m})();s.CronParser=u}),333:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var d=l(823),u=l(949),m=(function(){function g(y,x){if(this.expression=y,this.options=x,this.expressionParts=new Array(5),!this.options.locale&&g.defaultLocale&&(this.options.locale=g.defaultLocale),!g.locales[this.options.locale]){var w=Object.keys(g.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(w,"'.")),this.options.locale=w}this.i18n=g.locales[this.options.locale],x.use24HourTimeFormat===void 0&&(x.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return g.toString=function(y,x){var w=x===void 0?{}:x,S=w.throwExceptionOnParseError,b=S===void 0?!0:S,$=w.verbose,k=$===void 0?!1:$,T=w.dayOfWeekStartIndexZero,O=T===void 0?!0:T,P=w.monthStartIndexZero,D=P===void 0?!1:P,A=w.use24HourTimeFormat,F=w.locale,L=F===void 0?null:F,_={throwExceptionOnParseError:b,verbose:k,dayOfWeekStartIndexZero:O,monthStartIndexZero:D,use24HourTimeFormat:A,locale:L};_.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var R=new g(y,_);return R.getFullDescription()},g.initialize=function(y,x){x===void 0&&(x="en"),g.specialCharacters=["/","-",",","*"],g.defaultLocale=x,y.load(g.locales)},g.prototype.getFullDescription=function(){var y,x,w="";try{var S=new u.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=S.parse(),this.expressionParts[0]==="@reboot")return((x=(y=this.i18n).atReboot)===null||x===void 0?void 0:x.call(y))||"Run once, at startup";var b=this.getTimeOfDayDescription(),$=this.getDayOfMonthDescription(),k=this.getMonthDescription(),T=this.getDayOfWeekDescription(),O=this.getYearDescription();w+=b+$+T+k+O,w=this.transformVerbosity(w,!!this.options.verbose),w=w.charAt(0).toLocaleUpperCase()+w.substr(1)}catch(P){if(!this.options.throwExceptionOnParseError)w=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(P)}return w},g.prototype.getTimeOfDayDescription=function(){var y=this.expressionParts[0],x=this.expressionParts[1],w=this.expressionParts[2],S="";if(!d.StringUtilities.containsAny(x,g.specialCharacters)&&!d.StringUtilities.containsAny(w,g.specialCharacters)&&!d.StringUtilities.containsAny(y,g.specialCharacters))S+=this.i18n.atSpace()+this.formatTime(w,x,y);else if(!y&&x.indexOf("-")>-1&&!(x.indexOf(",")>-1)&&!(x.indexOf("/")>-1)&&!d.StringUtilities.containsAny(w,g.specialCharacters)){var b=x.split("-");S+=d.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(w,b[0],""),this.formatTime(w,b[1],""))}else if(!y&&w.indexOf(",")>-1&&w.indexOf("-")==-1&&w.indexOf("/")==-1&&!d.StringUtilities.containsAny(x,g.specialCharacters)){var $=w.split(",");S+=this.i18n.at();for(var k=0;k<$.length;k++)S+=" ",S+=this.formatTime($[k],x,""),k<$.length-2&&(S+=","),k==$.length-2&&(S+=this.i18n.spaceAnd())}else{var T=this.getSecondsDescription(),O=this.getMinutesDescription(),P=this.getHoursDescription();if(S+=T,S&&O&&(S+=", "),S+=O,O===P)return S;S&&P&&(S+=", "),S+=P}return S},g.prototype.getSecondsDescription=function(){var y=this,x=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(w){return w},function(w){return d.StringUtilities.format(y.i18n.everyX0Seconds(w),w)},function(w){return y.i18n.secondsX0ThroughX1PastTheMinute()},function(w){return w=="0"?"":parseInt(w)<20?y.i18n.atX0SecondsPastTheMinute(w):y.i18n.atX0SecondsPastTheMinuteGt20()||y.i18n.atX0SecondsPastTheMinute(w)});return x},g.prototype.getMinutesDescription=function(){var y=this,x=this.expressionParts[0],w=this.expressionParts[2],S=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(b){return b},function(b){return d.StringUtilities.format(y.i18n.everyX0Minutes(b),b)},function(b){return y.i18n.minutesX0ThroughX1PastTheHour()},function(b){try{return b=="0"&&w.indexOf("/")==-1&&x==""?y.i18n.everyHour():parseInt(b)<20?y.i18n.atX0MinutesPastTheHour(b):y.i18n.atX0MinutesPastTheHourGt20()||y.i18n.atX0MinutesPastTheHour(b)}catch{return y.i18n.atX0MinutesPastTheHour(b)}});return S},g.prototype.getHoursDescription=function(){var y=this,x=this.expressionParts[2],w=0,S=[];x.split("/")[0].split(",").forEach(function(k){var T=k.split("-");T.length===2&&S.push({value:T[1],index:w+1}),w+=T.length});var b=0,$=this.getSegmentDescription(x,this.i18n.everyHour(),function(k){var T=S.find(function(P){return P.value===k&&P.index===b}),O=T&&y.expressionParts[1]!=="0";return b++,O?y.formatTime(k,"59",""):y.formatTime(k,"0","")},function(k){return d.StringUtilities.format(y.i18n.everyX0Hours(k),k)},function(k){return y.i18n.betweenX0AndX1()},function(k){return y.i18n.atX0()});return $},g.prototype.getDayOfWeekDescription=function(){var y=this,x=this.i18n.daysOfTheWeek(),w=null;return this.expressionParts[5]=="*"?w="":w=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(S,b){var $=S;S.indexOf("#")>-1?$=S.substring(0,S.indexOf("#")):S.indexOf("L")>-1&&($=$.replace("L",""));var k=parseInt($),T=y.i18n.daysOfTheWeekInCase?y.i18n.daysOfTheWeekInCase(b)[k]:x[k];if(S.indexOf("#")>-1){var O=null,P=S.substring(S.indexOf("#")+1),D=S.substring(0,S.indexOf("#"));switch(P){case"1":O=y.i18n.first(D);break;case"2":O=y.i18n.second(D);break;case"3":O=y.i18n.third(D);break;case"4":O=y.i18n.fourth(D);break;case"5":O=y.i18n.fifth(D);break}T=O+" "+T}return T},function(S){return parseInt(S)==1?"":d.StringUtilities.format(y.i18n.commaEveryX0DaysOfTheWeek(S),S)},function(S){var b=S.substring(0,S.indexOf("-")),$=y.expressionParts[3]!="*";return $?y.i18n.commaAndX0ThroughX1(b):y.i18n.commaX0ThroughX1(b)},function(S){var b=null;if(S.indexOf("#")>-1){var $=S.substring(S.indexOf("#")+1),k=S.substring(0,S.indexOf("#"));b=y.i18n.commaOnThe($,k).trim()+y.i18n.spaceX0OfTheMonth()}else if(S.indexOf("L")>-1)b=y.i18n.commaOnTheLastX0OfTheMonth(S.replace("L",""));else{var T=y.expressionParts[3]!="*";b=T?y.i18n.commaAndOnX0():y.i18n.commaOnlyOnX0(S)}return b}),w},g.prototype.getMonthDescription=function(){var y=this,x=this.i18n.monthsOfTheYear(),w=this.getSegmentDescription(this.expressionParts[4],"",function(S,b){return b&&y.i18n.monthsOfTheYearInCase?y.i18n.monthsOfTheYearInCase(b)[parseInt(S)-1]:x[parseInt(S)-1]},function(S){return parseInt(S)==1?"":d.StringUtilities.format(y.i18n.commaEveryX0Months(S),S)},function(S){return y.i18n.commaMonthX0ThroughMonthX1()||y.i18n.commaX0ThroughX1()},function(S){return y.i18n.commaOnlyInMonthX0?y.i18n.commaOnlyInMonthX0():y.i18n.commaOnlyInX0()});return w},g.prototype.getDayOfMonthDescription=function(){var y=this,x=null,w=this.expressionParts[3];switch(w){case"L":x=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":x=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var S=w.match(/(\d{1,2}W)|(W\d{1,2})/);if(S){var b=parseInt(S[0].replace("W","")),$=b==1?this.i18n.firstWeekday():d.StringUtilities.format(this.i18n.weekdayNearestDayX0(),b.toString());x=d.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),$);break}else{var k=w.match(/L-(\d{1,2})/);if(k){var T=k[1];x=d.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(T),T);break}else{if(w=="*"&&this.expressionParts[5]!="*")return"";x=this.getSegmentDescription(w,this.i18n.commaEveryDay(),function(O){return O=="L"?y.i18n.lastDay():y.i18n.dayX0?d.StringUtilities.format(y.i18n.dayX0(),O):O},function(O){return O=="1"?y.i18n.commaEveryDay():y.i18n.commaEveryX0Days(O)},function(O){return y.i18n.commaBetweenDayX0AndX1OfTheMonth(O)},function(O){return y.i18n.commaOnDayX0OfTheMonth(O)})}break}}return x},g.prototype.getYearDescription=function(){var y=this,x=this.getSegmentDescription(this.expressionParts[6],"",function(w){return/^\d+$/.test(w)?new Date(parseInt(w),1).getFullYear().toString():w},function(w){return d.StringUtilities.format(y.i18n.commaEveryX0Years(w),w)},function(w){return y.i18n.commaYearX0ThroughYearX1()||y.i18n.commaX0ThroughX1()},function(w){return y.i18n.commaOnlyInYearX0?y.i18n.commaOnlyInYearX0():y.i18n.commaOnlyInX0()});return x},g.prototype.getSegmentDescription=function(y,x,w,S,b,$){var k=null,T=y.indexOf("/")>-1,O=y.indexOf("-")>-1,P=y.indexOf(",")>-1;if(!y)k="";else if(y==="*")k=x;else if(!T&&!O&&!P)k=d.StringUtilities.format($(y),w(y));else if(P){for(var D=y.split(","),A="",F=0;F<D.length;F++)if(F>0&&D.length>2&&(A+=",",F<D.length-1&&(A+=" ")),F>0&&D.length>1&&(F==D.length-1||D.length==2)&&(A+="".concat(this.i18n.spaceAnd()," ")),D[F].indexOf("/")>-1||D[F].indexOf("-")>-1){var L=D[F].indexOf("-")>-1&&D[F].indexOf("/")==-1,_=this.getSegmentDescription(D[F],x,w,S,L?this.i18n.commaX0ThroughX1:b,$);L&&(_=_.replace(", ","")),A+=_}else T?A+=this.getSegmentDescription(D[F],x,w,S,b,$):A+=w(D[F]);T?k=A:k=d.StringUtilities.format($(y),A)}else if(T){var D=y.split("/");if(k=d.StringUtilities.format(S(D[1]),D[1]),D[0].indexOf("-")>-1){var R=this.generateRangeSegmentDescription(D[0],b,w);R.indexOf(", ")!=0&&(k+=", "),k+=R}else if(D[0].indexOf("*")==-1){var z=d.StringUtilities.format($(D[0]),w(D[0]));z=z.replace(", ",""),k+=d.StringUtilities.format(this.i18n.commaStartingX0(),z)}}else O&&(k=this.generateRangeSegmentDescription(y,b,w));return k},g.prototype.generateRangeSegmentDescription=function(y,x,w){var S="",b=y.split("-"),$=w(b[0],1),k=w(b[1],2),T=x(y);return S+=d.StringUtilities.format(T,$,k),S},g.prototype.formatTime=function(y,x,w){var S=0,b=0,$=parseInt(y)+S,k=parseInt(x)+b;k>=60?(k-=60,$+=1):k<0&&(k+=60,$-=1),$>=24?$=$-24:$<0&&($=24+$);var T="",O=!1;this.options.use24HourTimeFormat||(O=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),T=O?"".concat(this.getPeriod($)," "):" ".concat(this.getPeriod($)),$>12&&($-=12),$===0&&($=12));var P="";return w&&(P=":".concat(("00"+w).substring(w.length))),"".concat(O?T:"").concat(("00"+$.toString()).substring($.toString().length),":").concat(("00"+k.toString()).substring(k.toString().length)).concat(P).concat(O?"":T)},g.prototype.transformVerbosity=function(y,x){if(!x&&(y=y.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),y=y.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),y=y.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),y=y.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var w=0,S=Object.entries(this.i18n.conciseVerbosityReplacements());w<S.length;w++){var b=S[w],$=b[0],k=b[1];y=y.replace(new RegExp($,"g"),k)}return y},g.prototype.getPeriod=function(y){return y>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},g.locales={},g})();s.ExpressionDescriptor=m}),747:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.enLocaleLoader=void 0;var d=l(486),u=(function(){function m(){}return m.prototype.load=function(g){g.en=new d.en},m})();s.enLocaleLoader=u}),486:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var l=(function(){function d(){}return d.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},d.prototype.atX0MinutesPastTheHourGt20=function(){return null},d.prototype.commaMonthX0ThroughMonthX1=function(){return null},d.prototype.commaYearX0ThroughYearX1=function(){return null},d.prototype.use24HourTimeFormatByDefault=function(){return!1},d.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},d.prototype.everyMinute=function(){return"every minute"},d.prototype.everyHour=function(){return"every hour"},d.prototype.atSpace=function(){return"At "},d.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},d.prototype.at=function(){return"At"},d.prototype.spaceAnd=function(){return" and"},d.prototype.everySecond=function(){return"every second"},d.prototype.everyX0Seconds=function(){return"every %s seconds"},d.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},d.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},d.prototype.everyX0Minutes=function(){return"every %s minutes"},d.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},d.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},d.prototype.everyX0Hours=function(){return"every %s hours"},d.prototype.betweenX0AndX1=function(){return"between %s and %s"},d.prototype.atX0=function(){return"at %s"},d.prototype.commaEveryDay=function(){return", every day"},d.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},d.prototype.commaX0ThroughX1=function(){return", %s through %s"},d.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},d.prototype.first=function(){return"first"},d.prototype.second=function(){return"second"},d.prototype.third=function(){return"third"},d.prototype.fourth=function(){return"fourth"},d.prototype.fifth=function(){return"fifth"},d.prototype.commaOnThe=function(){return", on the "},d.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},d.prototype.lastDay=function(){return"the last day"},d.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},d.prototype.commaOnlyOnX0=function(){return", only on %s"},d.prototype.commaAndOnX0=function(){return", and on %s"},d.prototype.commaEveryX0Months=function(){return", every %s months"},d.prototype.commaOnlyInX0=function(){return", only in %s"},d.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},d.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},d.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},d.prototype.firstWeekday=function(){return"first weekday"},d.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},d.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},d.prototype.commaEveryX0Days=function(){return", every %s days"},d.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},d.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},d.prototype.commaEveryHour=function(){return", every hour"},d.prototype.commaEveryX0Years=function(){return", every %s years"},d.prototype.commaStartingX0=function(){return", starting %s"},d.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},d.prototype.atReboot=function(){return"Run once, at startup"},d})();s.en=l}),515:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0});function l(u,m){if(!u)throw new Error(m)}var d=(function(){function u(){}return u.secondRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=59,"seconds part must be >= 0 and <= 59")}},u.minuteRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=59,"minutes part must be >= 0 and <= 59")}},u.hourRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=23,"hours part must be >= 0 and <= 23")}},u.dayOfMonthRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=1&&x<=31,"DOM part must be >= 1 and <= 31")}},u.monthRange=function(m,g){for(var y=m.split(","),x=0;x<y.length;x++)if(!isNaN(parseInt(y[x],10))){var w=parseInt(y[x],10);l(w>=1&&w<=12,g?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},u.dayOfWeekRange=function(m,g){for(var y=m.split(","),x=0;x<y.length;x++)if(!isNaN(parseInt(y[x],10))){var w=parseInt(y[x],10);l(w>=0&&w<=6,g?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},u})();s.default=d}),823:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var l=(function(){function d(){}return d.format=function(u){for(var m=[],g=1;g<arguments.length;g++)m[g-1]=arguments[g];return u.replace(/%s/g,function(y){return m.shift()})},d.containsAny=function(u,m){return m.some(function(g){return u.indexOf(g)>-1})},d})();s.StringUtilities=l})},r={};function o(i){var s=r[i];if(s!==void 0)return s.exports;var l=r[i]={exports:{}};return n[i](l,l.exports,o),l.exports}var a={};return(()=>{var i=a;Object.defineProperty(i,"__esModule",{value:!0}),i.toString=void 0;var s=o(333),l=o(747);s.ExpressionDescriptor.initialize(new l.enLocaleLoader),i.default=s.ExpressionDescriptor;var d=s.ExpressionDescriptor.toString;i.toString=d})(),a})())})(II)),II.exports}var Lwe=Iwe();const zwe=yc(Lwe),Fwe=new Set(["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","SUN","MON","TUE","WED","THU","FRI","SAT"]);function _we(e){for(const t of e.trim().split(/\s+/)){if(/[#?]/.test(t))return!1;for(const n of t.split(/[,\-/]/))if(!(n===""||n==="*")&&/[A-Za-z]/.test(n)&&!Fwe.has(n.toUpperCase()))return!1}return!0}function lT(e){const t=(e??"").trim();if(t.split(/\s+/).filter(Boolean).length!==5)return{valid:!1,description:"",nextRun:null,error:"Expected a 5-field UNIX cron: minute hour day-of-month month day-of-week."};if(!_we(t))return{valid:!1,description:"",nextRun:null,error:"Unsupported cron syntax: L, W, #, and ? extensions are not allowed (plain 5-field UNIX cron only)."};try{const n=zwe.toString(t,{use24HourTimeFormat:!0,verbose:!1}),r=Nwe.CronExpressionParser.parse(t,{tz:"UTC"}).next().toDate();return{valid:!0,description:n,nextRun:r}}catch(n){return{valid:!1,description:"",nextRun:null,error:n instanceof Error?n.message:"Invalid cron expression."}}}function p6(e){return e?e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC":"—"}function Bwe({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),l=()=>a(!1),d=async()=>{try{await e({forceRefresh:i}),a(!1)}catch{}},u=p.jsx("span",{children:p.jsx(Qy,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return p.jsxs(p.Fragment,{children:[n&&r?p.jsx(Br,{title:r,children:u}):u,p.jsx(Oo,{open:o,onClose:l,title:"New materialization",description:"Compile the package, build a table for every persist source, and load them so queries serve from the tables.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{onClick:l,children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:t,onClick:d,children:"Materialize"})]}),children:p.jsx(uX,{children:p.jsx(MR,{control:p.jsx(Cz,{checked:i,onChange:m=>s(m.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function v0({children:e}){return p.jsx(wt,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function tx(e){return e===Ea.Pending||e===Ea.ManifestRowsReady}function Uwe(e){return e===Ea.ManifestFileReady||e===Ea.Failed||e===Ea.Cancelled}function h6(e){switch(e){case Ea.ManifestFileReady:return"Done";case Ea.Failed:return"Failed";case Ea.Cancelled:return"Cancelled";case Ea.Pending:case Ea.ManifestRowsReady:return"Pending";default:return"Unknown"}}function R$(e){switch(e){case Ea.ManifestRowsReady:return"info";case Ea.ManifestFileReady:return"success";case Ea.Failed:return"error";case Ea.Cancelled:return"warning";case Ea.Pending:default:return"default"}}function qwe(e){const t=Object.values(cT(e).refusedSources??{}).map(r=>({name:r.name,message:r.message})),n=Object.values(e.manifest?.failures??{}).filter(r=>r.refused).map(r=>({name:r.sourceName??r.sourceEntityId,message:r.reason}));return[...t,...n].sort((r,o)=>r.name.localeCompare(o.name))}function m6(e,t){const n=[`${e.sourcesBuilt??0} built`,`${e.sourcesReused??0} reused`];return e.sourcesRefused&&n.push(`${e.sourcesRefused} refused`),n.join(t)}function cT(e){return e.metadata??{}}function Hwe(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function g6(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),o=Math.max(0,r-n);if(o<1e3)return`${o}ms`;const a=Math.round(o/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),s=a%60;if(i<60)return`${i}m ${s}s`;const l=Math.floor(i/60),d=i%60;return`${l}h ${d}m`}function T$(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Vwe(e){if(!e)return"-";const t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Wwe({entries:e,builtAt:t}){const n=Object.entries(e??{});return p.jsxs(Te,{children:[p.jsxs(Yn,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[p.jsx(v0,{children:"Build manifest"}),t&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["Built ",T$(t)]})]}),n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):p.jsxs(Bx,{size:"small",children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"Source"}),p.jsx(dr,{children:"Table name"}),p.jsx(dr,{children:"Connection"}),p.jsx(dr,{children:"Realization"}),p.jsx(dr,{align:"right",children:"Rows"})]})}),p.jsx(qx,{children:n.map(([r,o])=>p.jsxs(vu,{children:[p.jsx(dr,{sx:{fontFamily:Fo},children:o.sourceName??r}),p.jsx(dr,{sx:{fontFamily:Fo},children:o.physicalTableName??"-"}),p.jsx(dr,{sx:{fontFamily:Fo},children:o.connectionName??"-"}),p.jsx(dr,{children:o.realization??"-"}),p.jsx(dr,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function y6({meta:e}){const t=e.trigger==="SCHEDULER";return p.jsx(Br,{title:t?"Fired by the materialization schedule":"Triggered manually",children:p.jsx(wt,{variant:"body2",color:"text.secondary",children:Hwe(e)})})}function Ywe({materialization:e,buildPlan:t,onClose:n}){const r=e?cT(e):{},o=e?qwe(e):[],a=t.status==="ready"?Object.values(t.plan?.sources??{}):[];return p.jsx(zx,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&p.jsxs(p.Fragment,{children:[p.jsxs(_x,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[p.jsx(TR,{size:"small",label:h6(e.status),color:R$(e.status),variant:tx(e.status)?"filled":"outlined"}),p.jsx(y6,{meta:r})]}),p.jsx(wt,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo,wordBreak:"break-all"},children:e.id}),p.jsx(ro,{"aria-label":"close",onClick:n,sx:{position:"absolute",right:8,top:8},children:p.jsx(xh,{fontSize:"small"})})]}),p.jsxs(Fx,{dividers:!0,children:[p.jsxs(Te,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[p.jsx(hg,{label:"Started",value:T$(e.startedAt??e.createdAt)}),p.jsx(hg,{label:"Completed",value:T$(e.completedAt)}),p.jsx(hg,{label:"Duration",value:g6(e.startedAt,e.completedAt)}),p.jsx(hg,{label:"Sources",value:m6(r," · ")}),p.jsx(hg,{label:"Force refresh",value:r.forceRefresh?"Yes":"No"})]}),e.error&&p.jsxs(Te,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[p.jsx(v0,{children:p.jsx(Te,{component:"span",sx:{color:"error.main"},children:"Error"})}),p.jsx(wt,{variant:"body2",sx:{fontFamily:Fo,whiteSpace:"pre-wrap"},children:e.error})]}),o.length>0&&p.jsxs(Te,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"warning.main"},children:[p.jsx(v0,{children:p.jsx(Te,{component:"span",sx:{color:"warning.main"},children:"Refused sources"})}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1},children:"Not built, because materializing them would be unsafe. They serve live until the model changes."}),o.map(i=>p.jsxs(Te,{sx:{mt:1},children:[p.jsx(wt,{variant:"body2",sx:{fontFamily:Fo},children:i.name}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-wrap"},children:i.message})]},i.name))]}),p.jsxs(Te,{sx:{mb:3},children:[p.jsx(v0,{children:"Build plan"}),t.status==="loading"?p.jsx(Bo,{text:wu.loading,size:16,centered:!1}):t.status==="unavailable"?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"The build plan is unavailable."}):a.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):p.jsxs(Bx,{size:"small",children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"Source"}),p.jsx(dr,{children:"Connection"}),p.jsx(dr,{children:"Dialect"}),p.jsx(dr,{align:"right",children:"Columns"}),p.jsx(dr,{children:"Source Entity ID"})]})}),p.jsx(qx,{children:a.map(i=>p.jsxs(vu,{children:[p.jsx(dr,{sx:{fontFamily:Fo},children:i.name}),p.jsx(dr,{sx:{fontFamily:Fo},children:i.connectionName}),p.jsx(dr,{children:i.dialect??"-"}),p.jsx(dr,{align:"right",children:i.columns?.length??0}),p.jsx(dr,{sx:{fontFamily:Fo,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:i.sourceEntityId})]},i.sourceID))})]})]}),p.jsx(Wwe,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function hg({label:e,value:t}){return p.jsxs(Te,{children:[p.jsx(wt,{variant:"caption",color:"text.secondary",display:"block",children:e}),p.jsx(wt,{variant:"body2",children:t})]})}const Gwe=Jt(p.jsx("path",{d:"M6 6h12v12H6z"}));function Kwe(e){return Cn("PrivateSwitchBase",e)}fn("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Qwe=e=>{const{classes:t,checked:n,disabled:r,edge:o}=e,a={root:["root",n&&"checked",r&&"disabled",o&&`edge${Tt(o)}`],input:["input"]};return bn(a,Kwe,t)},Xwe=nt(qd,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e==="start"&&t.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e==="end"&&t.size!=="small",style:{marginRight:-12}}]}),Zwe=nt("input",{name:"MuiSwitchBase",shouldForwardProp:ei})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),Jwe=C.forwardRef(function(e,t){const{autoFocus:n,checked:r,checkedIcon:o,defaultChecked:a,disabled:i,disableFocusRipple:s=!1,edge:l=!1,icon:d,id:u,inputProps:m,inputRef:g,name:y,onBlur:x,onChange:w,onFocus:S,readOnly:b,required:$=!1,tabIndex:k,type:T,value:O,slots:P={},slotProps:D={},...A}=e,[F,L]=Ti({controlled:r,default:!!a,name:"SwitchBase",state:"checked"}),_=Ai(),R=ie=>{S&&S(ie),_&&_.onFocus&&_.onFocus(ie)},z=ie=>{x&&x(ie),_&&_.onBlur&&_.onBlur(ie)},N=ie=>{if(ie.nativeEvent.defaultPrevented)return;const Q=ie.target.checked;L(Q),w&&w(ie,Q)};let B=i;_&&typeof B>"u"&&(B=_.disabled);const I=T==="checkbox"||T==="radio",H={...e,checked:F,disabled:B,disableFocusRipple:s,edge:l},Y=Qwe(H),ae={slots:P,slotProps:{input:m,...D}},[K,oe]=ur("root",{ref:t,elementType:Xwe,className:Y.root,shouldForwardComponentProp:!0,externalForwardedProps:{...ae,component:"span",...A},getSlotProps:ie=>({...ie,onFocus:Q=>{ie.onFocus?.(Q),R(Q)},onBlur:Q=>{ie.onBlur?.(Q),z(Q)}}),ownerState:H,additionalProps:{centerRipple:!0,focusRipple:!s,disabled:B,role:void 0,tabIndex:null}}),[ue,G]=ur("input",{ref:g,elementType:Zwe,className:Y.input,externalForwardedProps:ae,getSlotProps:ie=>({...ie,onChange:Q=>{ie.onChange?.(Q),N(Q)}}),ownerState:H,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:B,id:I?u:void 0,name:y,readOnly:b,required:$,tabIndex:k,type:T,...T==="checkbox"&&O===void 0?{}:{value:O}}});return p.jsxs(K,{...oe,children:[p.jsx(ue,{...G}),F?o:d]})}),eSe=Jt(p.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),tSe=Jt(p.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),nSe=Jt(p.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function rSe(e){return Cn("MuiCheckbox",e)}const MC=fn("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),oSe=e=>{const{classes:t,indeterminate:n,color:r,size:o}=e,a={root:["root",n&&"indeterminate",`color${Tt(r)}`,`size${Tt(o)}`]},i=bn(a,rSe,t);return{...t,...i}},aSe=nt(Jwe,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Tt(n.size)}`],n.color!=="default"&&t[`color${Tt(n.color)}`]]}})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ma()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ma()).map(([t])=>({props:{color:t},style:{[`&.${MC.checked}, &.${MC.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${MC.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),iSe=p.jsx(tSe,{}),sSe=p.jsx(eSe,{}),lSe=p.jsx(nSe,{}),cSe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiCheckbox"}),{checkedIcon:r=iSe,color:o="primary",icon:a=sSe,indeterminate:i=!1,indeterminateIcon:s=lSe,inputProps:l,size:d="medium",disableRipple:u=!1,className:m,slots:g={},slotProps:y={},...x}=n,w=i?s:a,S=i?s:r,b={...n,disableRipple:u,color:o,indeterminate:i,size:d},$=oSe(b),k=y.input??l,[T,O]=ur("root",{ref:t,elementType:aSe,className:Ht($.root,m),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...x},ownerState:b,additionalProps:{type:"checkbox",icon:C.cloneElement(w,{fontSize:w.props.fontSize??d}),checkedIcon:C.cloneElement(S,{fontSize:S.props.fontSize??d}),disableRipple:u,slots:g,slotProps:{input:aF(typeof k=="function"?k(b):k,{"data-indeterminate":i})}}});return p.jsx(T,{...O,classes:$})});function uSe(e){return Cn("MuiFormControlLabel",e)}const jg=fn("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),dSe=e=>{const{classes:t,disabled:n,labelPlacement:r,error:o,required:a}=e,i={root:["root",n&&"disabled",`labelPlacement${Tt(r)}`,o&&"error",a&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",o&&"error"]};return bn(i,uSe,t)},fSe=nt("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${jg.label}`]:t.label},t.root,t[`labelPlacement${Tt(n.labelPlacement)}`]]}})(Gn(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${jg.disabled}`]:{cursor:"default"},[`& .${jg.label}`]:{[`&.${jg.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:"start"},style:{flexDirection:"row-reverse",marginRight:-11}},{props:{labelPlacement:"top"},style:{flexDirection:"column-reverse"}},{props:{labelPlacement:"bottom"},style:{flexDirection:"column"}},{props:({labelPlacement:t})=>t==="start"||t==="top"||t==="bottom",style:{marginLeft:16}}]}))),pSe=nt("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(Gn(({theme:e})=>({[`&.${jg.error}`]:{color:(e.vars||e).palette.error.main}}))),hSe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFormControlLabel"}),{checked:r,className:o,componentsProps:a={},control:i,disabled:s,disableTypography:l,inputRef:d,label:u,labelPlacement:m="end",name:g,onChange:y,required:x,slots:w={},slotProps:S={},value:b,...$}=n,k=Ai(),T=s??i.props.disabled??k?.disabled,O=x??i.props.required,P={disabled:T,required:O};["checked","name","onChange","value","inputRef"].forEach(N=>{typeof i.props[N]>"u"&&typeof n[N]<"u"&&(P[N]=n[N])});const D=nf({props:n,muiFormControl:k,states:["error"]}),A={...n,disabled:T,labelPlacement:m,required:O,error:D.error},F=dSe(A),L={slots:w,slotProps:{...a,...S}},[_,R]=ur("typography",{elementType:Sr,externalForwardedProps:L,ownerState:A});let z=u;return z!=null&&z.type!==Sr&&!l&&(z=p.jsx(_,{component:"span",...R,className:Ht(F.label,R?.className),children:z})),p.jsxs(fSe,{className:Ht(F.root,o),ownerState:A,ref:t,...$,children:[C.cloneElement(i,P),O?p.jsxs("div",{children:[z,p.jsxs(pSe,{ownerState:A,"aria-hidden":!0,className:F.asterisk,children:[" ","*"]})]}):z]})});function mSe({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),l=()=>a(!0),d=()=>{a(!1),s(!1),t()};return p.jsxs(kn.Fragment,{children:[p.jsxs(Vo,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:u=>{u.stopPropagation(),l()},sx:{color:"error.main"},children:[p.jsx(oT,{sx:{color:"inherit"},children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(aT,{children:"Delete"})]}),p.jsxs(Oo,{open:o,onClose:d,title:"Delete materialization",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:d,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(i),loading:n,children:"Delete run"})]}),children:[p.jsx(Sr,{variant:"body2",children:"Delete this run's record? This cannot be undone."}),p.jsx(hSe,{control:p.jsx(cSe,{checked:i,onChange:u=>s(u.target.checked)}),label:"Also drop the materialized tables this run produced"})]})]})}function gSe({materializations:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){return e.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:"No materializations yet."}):p.jsxs(Bx,{size:"small",sx:{"& td, & th":{borderColor:"divider"},"& td:first-of-type, & th:first-of-type":{pl:0},"& td:last-of-type, & th:last-of-type":{pr:0},"& th":{color:"text.secondary",fontWeight:600}},children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"Status"}),p.jsx(dr,{children:"Trigger"}),p.jsx(dr,{children:"Started"}),p.jsx(dr,{children:"Duration"}),p.jsx(dr,{children:"Sources"}),p.jsx(dr,{align:"right",children:"Actions"})]})}),p.jsx(qx,{children:e.map(i=>p.jsx(ySe,{materialization:i,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},i.id))})]})}function ySe({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[i,s]=C.useState(null),l=!!i,d=()=>s(null),u=cT(e),m=u.sourcesBuilt!==void 0||u.sourcesReused!==void 0?m6(u,", "):"-",g=tx(e.status),y=Uwe(e.status),x=e.error??void 0,w=t&&(g||y);return p.jsxs(vu,{hover:!0,sx:{cursor:"pointer","&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},onClick:()=>a(e),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),a(e))},role:"button",tabIndex:0,"aria-label":`View materialization ${e.id??""} details`.trim(),children:[p.jsx(dr,{children:p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:.5},children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:500,color:R$(e.status)==="default"?"text.primary":`${R$(e.status)}.main`},children:h6(e.status)}),x&&p.jsx(Br,{title:x,children:p.jsx(w_,{fontSize:"small",color:"error"})})]})}),p.jsx(dr,{children:p.jsx(y6,{meta:u})}),p.jsx(dr,{children:Vwe(e.startedAt??e.createdAt)}),p.jsx(dr,{children:g6(e.startedAt,e.completedAt)}),p.jsx(dr,{children:m}),p.jsx(dr,{align:"right",onClick:S=>S.stopPropagation(),children:w&&p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small","aria-label":`Materialization actions for ${e.id??""}`.trim(),onClick:S=>s(S.currentTarget),children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:i,open:l,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[t&&g&&p.jsxs(ea,{"aria-label":`Stop materialization ${e.id??""}`.trim(),disabled:n,onClick:()=>{d(),r(e)},children:[p.jsx(ml,{children:p.jsx(Gwe,{fontSize:"small"})}),p.jsx(Ci,{children:"Stop"})]}),t&&y&&p.jsx(mSe,{materialization:e,isMutating:n,onCloseDialog:d,onDelete:S=>o(e,S)})]})]})})]})}const vSe=Jt(p.jsx("path",{d:"m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27zm0-11.47L17.74 9 12 13.47 6.26 9z"})),bSe={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function xSe({scope:e,disabled:t,disabledReason:n,isSubmitting:r,onChange:o}){const[a,i]=C.useState(null),s=async l=>{i(null),l!==e&&await o(l).catch(()=>{})};return p.jsxs(p.Fragment,{children:[p.jsx(Xy,{label:"Scope",icon:p.jsx(vSe,{}),onClick:l=>i(l.currentTarget),disabled:t||r,...n?{disabledReason:n}:{},ariaHasPopup:"menu",ariaLabel:`Scope: ${e}`}),p.jsx(uc,{anchorEl:a,open:!!a,onClose:()=>i(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:["package","version"].map(l=>p.jsxs(ea,{selected:l===e,onClick:()=>void s(l),children:[p.jsx(ml,{sx:{minWidth:32},children:l===e&&p.jsx(pF,{fontSize:"small"})}),p.jsx(Ci,{primary:l,secondary:bSe[l]})]},l))})]})}const wSe=Jt([p.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),p.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),zI="0 6 * * *";function SSe({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,i]=C.useState(!1),[s,l]=C.useState(e??zI),d=()=>{l(e??zI),i(!0)},u=()=>i(!1),m=lT(s),g=async y=>{try{await o(y),i(!1)}catch{}};return p.jsxs(p.Fragment,{children:[p.jsx(Xy,{label:"Schedule",icon:p.jsx(wSe,{}),onClick:d,disabled:n,...r?{disabledReason:r}:{},ariaHasPopup:"dialog",ariaLabel:e?"Edit schedule":"Set schedule"}),p.jsxs(Oo,{open:a,onClose:u,title:e?"Edit schedule":"Set schedule",description:"The publisher rebuilds this package's materializations on this cadence: a 5-field UNIX cron, in UTC. In a hosted deployment the change takes effect on your next publish.",actions:p.jsxs(p.Fragment,{children:[e&&p.jsx(Vn,{color:"error",loading:t,onClick:()=>g(null),sx:{mr:"auto"},children:"Clear schedule"}),p.jsx(Vn,{onClick:u,children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:t,disabled:!m.valid,onClick:()=>g(s.trim()),children:"Save schedule"})]}),children:[p.jsx(Ri,{autoFocus:!0,fullWidth:!0,size:"small",label:"Cron expression",value:s,onChange:y=>l(y.target.value),error:s.trim()!==""&&!m.valid,helperText:m.valid?`${m.description} · next run ${p6(m.nextRun)}`:m.error,slotProps:{htmlInput:{style:{fontFamily:Fo}}}}),p.jsxs(lo,{severity:"info",children:["A schedule runs only on version-scoped packages, so saving one sets ",p.jsx("code",{children:"scope: version"})," for this package."]})]})]})}const CSe=3e3;function kSe({resourceUri:e,versioned:t=!1}){const{apiClients:n,mutable:r}=tr(),o=Tl(),{environmentName:a,packageName:i,versionId:s}=Xr(e),[l,d]=C.useState(""),[u,m]=C.useState(null);if(!i)throw new Error("Materializations requires a package in the resource URI");const g=co({queryKey:["materializations",a,i,s],queryFn:()=>n.materializations.listMaterializations(a,i,void 0,void 0,s),refetchInterval:H=>(H.state.data?.data??[]).some(Y=>tx(Y.status))?CSe:!1}),y=co({queryKey:["package",a,i,s],queryFn:()=>n.packages.getPackage(a,i,s)}),x=co({queryKey:["package-build-plan",a,i,s],queryFn:async({signal:H})=>{try{return{inline:!1,plan:(await n.packages.getPackageBuildPlan(a,i,s,{signal:H})).data}}catch(Y){if(Y?.response?.status===404)return{inline:!0,plan:null};throw Y}},enabled:u!==null}),w=()=>o.invalidateQueries({queryKey:["materializations",a,i]}),S=hl({mutationFn:rc("materialization","create",H=>n.materializations.createMaterialization(a,i,{forceRefresh:H.forceRefresh,...s!==void 0?{versionId:s}:{}})),onSuccess(){d("Materialization requested"),w()},onError(H){d(H.message),w()}}),b=hl({mutationFn:rc("materialization","update",H=>n.materializations.materializationAction(a,i,H.id,xre.Stop,s)),onSuccess(){d("Materialization stopped"),w()},onError(H){d(H.message)}}),$=hl({mutationFn:rc("materialization","delete",({materialization:H,dropTables:Y})=>n.materializations.deleteMaterialization(a,i,H.id,Y,s)),onSuccess(){d("Materialization deleted"),w()},onError(H){d(H.message)}}),k=y.data?.data,T=hl({mutationFn:rc("schedule","update",H=>n.packages.updatePackage(a,i,{name:i,description:k?.description,...H?{scope:Cb.Version}:{},materialization:{schedule:H}})),onSuccess(H,Y){d(Y?"Schedule updated":"Schedule cleared"),o.invalidateQueries({queryKey:["package",a,i]})},onError(H){d(H.message)}}),O=hl({mutationFn:rc("scope","update",H=>n.packages.updatePackage(a,i,{name:i,description:k?.description,scope:H})),onSuccess(){d("Scope updated"),o.invalidateQueries({queryKey:["package",a,i]})},onError(H){d(H.message)}}),P=g.data?.data??[],D=P.find(H=>H.id===u)??null,A=P.some(H=>tx(H.status)),F=S.isPending||b.isPending||$.isPending,L=x.isError?{status:"unavailable"}:x.isSuccess?x.data.inline?y.isSuccess?{status:"ready",plan:k?.buildPlan??null}:y.isError?{status:"unavailable"}:{status:"loading"}:{status:"ready",plan:x.data.plan}:{status:"loading"},_=k?.materialization?.schedule??null,R=k?.scope===Cb.Version?"version":"package",z=!!k?.manifestLocation,N=!!k?.materialization?.freshness,B=_?lT(_):null,I=z?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[B?B.valid?`${B.description} (${_}), next run ${p6(B.nextRun)}`:`Unrecognized cron expression (${_})`:N?"Refreshed by a freshness policy; a cron schedule does not apply":"On demand only, no schedule set",`scope: ${R}`].join(" · ");return p.jsxs(p.Fragment,{children:[p.jsxs(Ns,{title:"Materializations",count:g.isSuccess?P.length:void 0,action:r&&p.jsxs(Yn,{direction:"row",spacing:1,alignItems:"center",children:[!z&&!t&&p.jsx(xSe,{scope:R,disabled:!!_,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:O.isPending,onChange:H=>O.mutateAsync(H==="version"?Cb.Version:Cb.Package)}),!z&&!t&&p.jsx(SSe,{currentSchedule:_,isSubmitting:T.isPending,disabled:N,disabledReason:"This package declares a freshness policy; a schedule and freshness are mutually exclusive.",onSubmit:H=>T.mutateAsync(H)}),p.jsx(Bwe,{onSubmit:H=>S.mutateAsync(H),isSubmitting:S.isPending,disabled:A,disabledReason:"A materialization is already pending or running for this package."})]}),children:[y.isSuccess&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:I}),g.isError&&p.jsx(ja,{error:g.error,context:`${a} > ${i} > Materializations`}),!g.isSuccess&&!g.isError&&p.jsx(Bo,{text:"Loading materializations..."}),g.isSuccess&&p.jsx(gSe,{materializations:P,mutable:r,isMutating:F,onStop:H=>b.mutate(H),onDelete:(H,Y)=>$.mutate({materialization:H,dropTables:Y}),onViewDetails:H=>m(H.id??null)})]}),p.jsx(Ywe,{materialization:D,buildPlan:L,onClose:()=>m(null)}),p.jsx(hh,{open:l!=="",autoHideDuration:6e3,onClose:()=>d(""),message:l})]})}const uT=Jt(p.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5m-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4zm-3-4h8v2H8z"}));function ih(e){return v6(e).join(`
482
- `).trim()||void 0}function v6(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(r){if(r.startsWith('#"'))t.push(r.slice(2).trim());else if(r.startsWith("#(doc)")){let o=r.slice(6).trim();o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),t.push(o)}}}return t.filter(n=>n.trim()!=="")}function FI(e){const t=(e??[]).map(n=>({...n,value:n.value?.trim()??""})).filter(n=>n.value.startsWith('##"')||n.value.startsWith("##(doc)")).map(n=>({...n,value:n.value.slice(1)}));return ih(t)}function $Se(e,t){const n=e.docParts??[],r=t?.docParts??[];return(r.length>0&&r.length<n.length&&r.every((o,a)=>o===n[a])?n.slice(r.length):n).join(`
483
- `).trim()||void 0}function dT(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(!r||r.startsWith('#"')||r.startsWith("#(doc)"))continue;const o=r.replace(/^#+@?\s*/,"").trim();o&&!o.startsWith("(")&&t.push(o)}return t}function RSe(e){const t=new Set;for(const n of e){const{tag:r,log:o}=e1.parseAnnotation([`# ${n}`]);if(o.length>0){const a=/^[A-Za-z_][\w.]*/.exec(n.trim())?.[0];a&&!/^\s*[\w.]+\s*=/.test(n)&&t.add(a);continue}for(const[a,i]of r.entries())i.deleted||(i.eq===void 0?t.add(a):a==="viz"&&typeof i.eq=="string"&&t.add(i.eq))}return[...t]}function TSe(e){return b6(e,"persist")}function ESe(e){return b6(e,"preaggregate")}function b6(e,t){const n=new RegExp(`^#@?\\s*${t}\\b`);return(e??[]).some(r=>n.test(r.value?.trim()??""))}function fT(e){const t=PSe(e);if(!e||!t)return t;switch(e.kind){case"number_type":return e.subtype?`${t} · ${e.subtype}`:t;case"date_type":case"timestamp_type":case"timestamptz_type":return e.timeframe?`${t} · ${e.timeframe}`:t;case"sql_native_type":return e.sql_type?`sql native · ${e.sql_type}`:"sql native";case"array_type":return`array<${fT(e.element_type)??"unknown"}>`;case"record_type":{const n=e.fields.length;return`record · ${n} ${n===1?"field":"fields"}`}default:return t}}function MSe(e){if(e?.kind==="record_type")return e.fields.map(t=>`${t.name} ${fT(t.type)??""}`.trim()).join(`
484
- `)}function OSe(e){const t=(e??[]).filter(n=>/^#@/.test(n.value?.trim()??""));return dT((e??[]).filter(n=>!t.includes(n)))}function PSe(e){return e?.kind?.replace(/_type$/,"")}const Wd=C.forwardRef(function(e,t){return p.jsx(wt,{ref:t,variant:"body2",...e,sx:{color:"text.secondary",...e.sx}})}),ky=C.forwardRef(function(e,t){return p.jsx(wt,{ref:t,variant:"caption",...e,sx:{color:"text.secondary",...e.sx}})});function Kg({message:e,secondary:t,actions:n}){return p.jsxs(Te,{"data-testid":"empty-row",sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",p:2,border:"1px dashed",borderColor:"divider",borderRadius:2},children:[p.jsxs(Te,{sx:{flex:1,minWidth:200},children:[p.jsx(Wd,{children:e}),t&&p.jsx(Wd,{sx:{color:"text.secondary",mt:.5},children:t})]}),n&&p.jsx(Te,{sx:{display:"flex",gap:1,flexShrink:0,alignItems:"center"},children:n})]})}const x6="--model-viewer-mono",os=`var(${x6}, ${Fo})`,w6="inherit",Xa={micro:"0.6875rem",caption:"0.75rem",small:"0.8125rem",body:"0.875rem",bodyLarge:"1rem"},E$={strong:500},qb=e=>({tint:`color-mix(in srgb, ${e} 12%, transparent)`,onTint:e}),xo={text:{secondary:"text.secondary",tertiary:"text.disabled"},background:{muted:"action.hover",strong:"action.selected"},accent:{sage:qb(hr.lime)},warning:qb(hr.amber),error:qb(hr.red),info:qb(hr.blue)},F1=xo.text.tertiary,jSe={positive:{bg:xo.accent.sage.tint,fg:xo.accent.sage.onTint},neutral:{bg:xo.background.strong,fg:xo.text.secondary},warning:{bg:xo.warning.tint,fg:xo.warning.onTint},negative:{bg:xo.error.tint,fg:xo.error.onTint},info:{bg:xo.info.tint,fg:xo.info.onTint},quiet:{bg:xo.background.muted,fg:xo.text.secondary}},fs=C.forwardRef(function({tone:e="neutral",voice:t="state",size:n="inline",busy:r=!1,children:o,sx:a,...i},s){const{bg:l,fg:d}=jSe[e],u=Xa.micro;return p.jsxs(Ta,{ref:s,component:"span","data-pill-tone":e,"data-pill-placement":n,...i,sx:[{display:"inline-flex",alignItems:"center",gap:r?"4px":0,padding:"2px 8px",borderRadius:"999px",bgcolor:l,color:d,flexShrink:0,whiteSpace:"nowrap",...t==="token"?{fontFamily:os,fontSize:u}:{fontFamily:w6,fontSize:u,fontWeight:E$.strong}},...Array.isArray(a)?a:[a]],children:[r&&p.jsx(M2,{size:9,thickness:5,sx:{color:"info.main",flexShrink:0},"aria-hidden":!0}),o]})}),ASe={width:"100%",maxWidth:"1200px",mx:"auto"},M$=3,$y=1.5,kh={display:"flex",flexDirection:"column",minWidth:0,minHeight:0,border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",cursor:"default"},DSe={...kh,border:"none",borderRadius:0,bgcolor:"transparent",overflow:"visible"};function oc({label:e,value:t,mono:n}){return p.jsxs(p.Fragment,{children:[p.jsx(Te,{component:"span",sx:{color:F1,fontSize:Xa.caption},children:e}),p.jsx(Te,{component:"span",sx:{fontFamily:n?os:void 0,wordBreak:"break-all"},children:t})]})}function NSe(e){const t=e.map(n=>n.name).join(", ");return`Reads the ${e.length===1?"given":"givens"} ${t}, set in the Givens section above`}function S6({givens:e}){return e.length===0?null:p.jsx(Br,{title:NSe(e),children:p.jsx(fs,{voice:"token",tone:"quiet",sx:{alignSelf:"center",flexShrink:0},children:"given"})})}function ISe(e){const t=P1(e.type,e.default);return t===void 0?"none — a value is required":t===""?"(empty)":t}function pT({givens:e,framed:t=!0}){return e.length===0?null:p.jsx(Te,{"data-testid":"model-viewer-given-card",sx:{...t?kh:{},p:$y,display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:"16px",rowGap:"6px",alignItems:"baseline",fontFamily:w6,fontSize:Xa.small,color:"text.primary"},children:e.map(n=>p.jsxs(Te,{sx:{display:"contents"},children:[p.jsx(oc,{label:"Given",value:n.name,mono:!0}),n.label&&p.jsx(oc,{label:"Label",value:n.label}),p.jsx(oc,{label:"Type",value:n.type,mono:!0}),p.jsx(oc,{label:"Default",value:ISe(n)}),n.description&&p.jsx(oc,{label:"Description",value:n.description})]},n.name))})}const C6=C.createContext({});function _1(){return C.useContext(C6)}function LSe(e,t,n=new Set){const r=t?.givens;if(!Array.isArray(r))return[];const o=[];for(const a of r){if(!a||typeof a!="object")continue;const i=a;if(typeof i.name!="string"||!i.name||typeof i.type!="string"||!i.type||n.has(i.name))continue;const s=Array.isArray(i.annotations)?i.annotations.filter(l=>typeof l=="string"):void 0;o.push({name:i.name,type:i.type,modelFile:e,...s&&{annotations:s},...typeof i.default=="string"&&{default:i.default},...i.required===!0&&{required:!0},...typeof i.label=="string"&&i.label&&{label:i.label},...typeof i.description=="string"&&i.description&&{description:i.description},...(i.control==="select"||i.control==="multiselect")&&{control:i.control},...typeof i.rangeMin=="number"&&{rangeMin:i.rangeMin},...typeof i.rangeMax=="number"&&{rangeMax:i.rangeMax},...i.suggest&&typeof i.suggest=="object"&&{suggest:i.suggest}})}return o}function zSe(e){return new Map(e.map(t=>[t.name,t.type]))}function FSe(e,t){const n=new Map(Array.from(e).filter(([a,i])=>t.has(a)&&!(i===""&&t.get(a)==="string"))),r=Jd(n,t),o=Object.entries(r).sort(([a],[i])=>a<i?-1:a>i?1:0);return o.length>0?Object.fromEntries(o):void 0}function hT(e){return e&&Object.keys(e).length>0?JSON.stringify(e):""}function _Se(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(!r||!r.startsWith("#(filter)"))continue;const o=USe(r.slice(9).trim());o&&t.push(o)}return t}const BSe=new Set(["equal","in","like","greater_than","less_than"]);function USe(e){let t,n,r,o=!1,a=!1;for(const i of qSe(e)){if(i==="implicit"){o=!0;continue}if(i==="required"){a=!0;continue}const s=i.indexOf("=");if(s<=0)continue;const l=i.slice(0,s).trim();let d=i.slice(s+1).trim();d.length>=2&&d.startsWith('"')&&d.endsWith('"')&&(d=d.slice(1,-1)),l==="name"?t=d:l==="dimension"?n=d:l==="type"&&BSe.has(d)&&(r=d)}return!n||!r?null:{name:t??n,dimension:n,type:r,implicit:o,required:a}}function qSe(e){const t=[];let n="",r=!1;for(const o of e){if(o==='"'){r=!r,n+=o;continue}if(!r&&/\s/.test(o)){n&&t.push(n),n="";continue}n+=o}return n&&t.push(n),t}const HSe=/^#\(index(_values)?\b/;function VSe(e){return!("annotations"in e)||!e.annotations?!1:e.annotations.some(t=>HSe.test(t.value?.trim()??""))}function WSe(e){const t=new Map;for(const n of e){const r=_Se(n.annotations).filter(o=>o.required&&!o.implicit).map(o=>o.name);r.length>0&&t.set(n.name,r)}return t}function YSe(e){return new Set(e.map(t=>t.name))}function GSe(e){const t=new Map;for(const n of e){if(!n.source)continue;let r=t.get(n.source);r||(r=new Map,t.set(n.source,r)),r.set(n.name,n)}return t}function iv(e){let t="",n=0;const r=(o,a)=>{t+=e.slice(o,a).replace(/[^\n]/g," "),n=a};for(;n<e.length;){const o=e[n],a=e.slice(n,n+2);if(a==="//"||a==="--"){const i=e.indexOf(`
480
+ `)};function hI(){const[e,t]=C.useState(!1),{apiClients:n}=tr(),r=()=>{t(!0)},o=()=>{t(!1)},a=Ch({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:c6({name:s.name,readme:""},s.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),i=async s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString();if(!d)throw new Error("Name is required");a.mutate({name:d,description:u})};return p.jsxs(kn.Fragment,{children:[p.jsx(Qy,{label:"Environment",onClick:r}),p.jsx(Oo,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:a.isPending,onClick:o,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:p.jsx("form",{onSubmit:i,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",placeholder:"Explore semantic models, run queries, and build reports",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}function vwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=tr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(Ci,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete environment",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:i,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>s.mutate(),loading:s.isPending,children:"Delete environment"})]}),children:p.jsxs(Sr,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),s.notice]})}function bwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=tr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn(d){return o.environments.updateEnvironment(e.name,{name:e.name,readme:c6({name:e.name,readme:e.readme},d.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"update"}),l=d=>{d.preventDefault();const u=new FormData(d.currentTarget).get("description")?.toString();s.mutate({description:u})};return p.jsxs(kn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(r2,{fontSize:"small"})}),p.jsx(Ci,{children:"Edit"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{disabled:s.isPending,onClick:i,children:"Cancel"}),p.jsx(Co,{type:"submit",form:"environment-form",variant:"contained",loading:s.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:l,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:l6(e.readme),InputLabelProps:{shrink:!0}})]})})}),s.notice]})}const xwe=[{title:"Model",body:"An agent writes what the data means in Malloy — sources, joins, measures — from a warehouse or a file, and validates each edit without a restart.",href:tu.publishing},{title:"Analyze",body:"Claude, Cursor, Codex or an agent you build asks over MCP; applications and BI tools use REST. Every question runs against the model, never the raw tables.",href:tu.mcpAgents},{title:"Surface",body:"Reports declared in Malloy, laid out as a grid or read top to bottom, and no-build HTML data apps, all shipped inside the package, plus this Console for browsing them.",href:tu.surfaces},{title:"Govern",body:"Runtime parameters, row-level filters and per-source gates are declared in the model, so every surface reads the same rules rather than writing its own.",href:tu.givens},{title:"Optimize",body:"One annotation materializes an expensive source into a table, and another rolls a measure up to a coarser grain, rebuilt on demand or on a schedule.",href:tu.materialization},{title:"Run anywhere",body:"DuckDB is built in for CSV, Parquet, JSON and Excel; BigQuery, Snowflake, Postgres, Databricks, MotherDuck and more connect by configuration.",href:tu.connections}];function wwe({href:e,children:t}){return p.jsx(Te,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function KTe({onClickEnvironment:e}){const{apiClients:t,mutable:n}=tr(),{data:r,isSuccess:o,isError:a,error:i}=co({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return p.jsx(ja,{error:i,context:"Environments List"});if(!o)return p.jsx(Bo,{text:"Loading environments..."});const s=r.data??[];return p.jsxs(O0,{maxWidth:"md",sx:{py:6},children:[p.jsxs(Te,{sx:{mb:5},children:[p.jsx(wt,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),p.jsx(wt,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6},children:"One data model, served over MCP and REST to AI agents, applications and BI tools. Write down what your data means — the sources, the joins, the measures, who may see what — and every surface asks the same model, so the same question returns the same numbers tomorrow."})]}),p.jsx(Cp,{container:!0,spacing:4,sx:{mb:5},children:xwe.map(l=>p.jsx(Cp,{size:{xs:12,sm:6},children:p.jsxs(Yn,{spacing:1,children:[p.jsx(wt,{variant:"body2",component:"a",href:l.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:l.title}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:l.body})]})},l.title))}),p.jsx(wl,{sx:{my:4}}),s.length>0?p.jsx(Ns,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:p.jsx(hI,{})}:{},children:p.jsx(Yn,{children:s.map(l=>p.jsx(Swe,{environment:l,...e?{onClickEnvironment:e}:{}},l.name))})}):p.jsxs(Te,{sx:{mb:4},children:[p.jsx(wt,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:3,maxWidth:600},children:"Create your first Malloy environment to start exploring semantic models and building data experiences."}),n?p.jsx(hI,{}):p.jsx(Vn,{variant:"contained",color:"primary",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),p.jsx(wl,{sx:{my:4}}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",p.jsx(wwe,{href:"https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw",children:"Malloy Slack community"})," ","to ask questions, share ideas, and contribute."]})]})}function Swe({environment:e,onClickEnvironment:t}){const{mutable:n}=tr(),[r,o]=C.useState(null),a=!!r,i=l6(e.readme),s=d=>{d.stopPropagation(),o(d.currentTarget)},l=()=>o(null);return p.jsx(L1,{icon:p.jsx(ywe,{sx:{fontSize:18}}),tint:ZR.environment,label:e.name??"",ariaLabel:e.name??"",...i?{description:i}:{},...e.name&&t?{onClick:d=>t(`/${e.name}/`,d)}:{},...n?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small",onClick:s,"aria-label":`Environment actions for ${e.name}`,children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:r,open:a,onClose:l,onClick:d=>d.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(bwe,{environment:e,onCloseDialog:l}),p.jsx(vwe,{environment:e,onCloseDialog:l})]})]})}:{}})}var fp={},hi={},ig={},pp={},mI={},gI;function Cwe(){return gI||(gI=1,Object.defineProperty(mI,"__esModule",{value:!0})),mI}var sg={},lg={},yI;function rf(){if(yI)return lg;yI=1,Object.defineProperty(lg,"__esModule",{value:!0}),lg.CronField=void 0;let e=class u6{#e=!1;#t=!1;#n=!1;#o=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(n,r={rawValue:""}){if(!Array.isArray(n))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(n.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...r,rawValue:r.rawValue??""},this.#o=n.sort(u6.sorter),this.#n=this.options.wildcard!==void 0?this.options.wildcard:this.#r(),this.#e=this.options.rawValue.includes("L")||n.includes("L"),this.#t=this.options.rawValue.includes("?")||n.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#o}static sorter(n,r){const o=typeof n=="number",a=typeof r=="number";return o&&a?n-r:!o&&!a?n.localeCompare(r):o?-1:1}static findNearestValueInList(n,r,o){if(o){for(let a=n.length-1;a>=0;a--)if(n[a]<r)return n[a];return null}for(let a=0;a<n.length;a++)if(n[a]>r)return n[a];return null}findNearestValue(n,r){return this.constructor.findNearestValueInList(this.values,n,r)}serialize(){return{wildcard:this.#n,values:this.#o}}validate(){let n;const r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",o=s=>l=>new RegExp(`^\\d{0,2}${l}$`).test(s),a=s=>(n=s,typeof s=="number"?s>=this.min&&s<=this.max:this.chars.some(o(s)));if(!this.#o.every(a))throw new Error(`${this.constructor.name} Validation error, got value ${n} expected range ${this.min}-${this.max}${r}`);const i=this.#o.find((s,l)=>this.#o.indexOf(s)!==l);if(i)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${i}`)}#r(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(n,r)=>r+this.min).every(n=>this.#o.includes(n))}};return lg.CronField=e,lg}var vI;function kwe(){if(vI)return sg;vI=1,Object.defineProperty(sg,"__esModule",{value:!0}),sg.CronDayOfMonth=void 0;const e=rf(),t=1,n=31,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return sg.CronDayOfMonth=o,sg}var cg={},bI;function $we(){if(bI)return cg;bI=1,Object.defineProperty(cg,"__esModule",{value:!0}),cg.CronDayOfWeek=void 0;const e=rf(),t=0,n=7,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};return cg.CronDayOfWeek=o,cg}var ug={},xI;function Rwe(){if(xI)return ug;xI=1,Object.defineProperty(ug,"__esModule",{value:!0}),ug.CronHour=void 0;const e=rf(),t=0,n=23,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return ug.CronHour=o,ug}var dg={},wI;function Twe(){if(wI)return dg;wI=1,Object.defineProperty(dg,"__esModule",{value:!0}),dg.CronMinute=void 0;const e=rf(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return dg.CronMinute=o,dg}var fg={},SI={},Ba={},CI;function Ewe(){if(CI)return Ba;CI=1,Object.defineProperty(Ba,"__esModule",{value:!0});class e extends Error{}class t extends e{constructor(M){super(`Invalid DateTime: ${M.toMessage()}`)}}class n extends e{constructor(M){super(`Invalid Interval: ${M.toMessage()}`)}}class r extends e{constructor(M){super(`Invalid Duration: ${M.toMessage()}`)}}class o extends e{}class a extends e{constructor(M){super(`Invalid unit ${M}`)}}class i extends e{}class s extends e{constructor(){super("Zone is an abstract class")}}const l="numeric",d="short",u="long",m={year:l,month:l,day:l},g={year:l,month:d,day:l},y={year:l,month:d,day:l,weekday:d},x={year:l,month:u,day:l},w={year:l,month:u,day:l,weekday:u},S={hour:l,minute:l},b={hour:l,minute:l,second:l},$={hour:l,minute:l,second:l,timeZoneName:d},k={hour:l,minute:l,second:l,timeZoneName:u},T={hour:l,minute:l,hourCycle:"h23"},O={hour:l,minute:l,second:l,hourCycle:"h23"},P={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:d},D={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:u},A={year:l,month:l,day:l,hour:l,minute:l},F={year:l,month:l,day:l,hour:l,minute:l,second:l},L={year:l,month:d,day:l,hour:l,minute:l},_={year:l,month:d,day:l,hour:l,minute:l,second:l},R={year:l,month:d,day:l,weekday:d,hour:l,minute:l},z={year:l,month:u,day:l,hour:l,minute:l,timeZoneName:d},N={year:l,month:u,day:l,hour:l,minute:l,second:l,timeZoneName:d},B={year:l,month:u,day:l,weekday:u,hour:l,minute:l,timeZoneName:u},I={year:l,month:u,day:l,weekday:u,hour:l,minute:l,second:l,timeZoneName:u};class H{get type(){throw new s}get name(){throw new s}get ianaName(){return this.name}get isUniversal(){throw new s}offsetName(M,q){throw new s}formatOffset(M,q){throw new s}offset(M){throw new s}equals(M){throw new s}get isValid(){throw new s}}let Y=null;class ae extends H{static get instance(){return Y===null&&(Y=new ae),Y}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(M,{format:q,locale:J}){return Ou(M,q,J)}formatOffset(M,q){return Us(this.offset(M),q)}offset(M){return-new Date(M).getTimezoneOffset()}equals(M){return M.type==="system"}get isValid(){return!0}}const K=new Map;function oe(W){let M=K.get(W);return M===void 0&&(M=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:W,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),K.set(W,M)),M}const ue={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function G(W,M){const q=W.format(M).replace(/\u200E/g,""),J=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(q),[,ce,Ce,Ne,qe,Xe,At,Mn]=J;return[Ne,ce,Ce,qe,Xe,At,Mn]}function ie(W,M){const q=W.formatToParts(M),J=[];for(let ce=0;ce<q.length;ce++){const{type:Ce,value:Ne}=q[ce],qe=ue[Ce];Ce==="era"?J[qe]=Ne:We(qe)||(J[qe]=parseInt(Ne,10))}return J}const Q=new Map;class ee extends H{static create(M){let q=Q.get(M);return q===void 0&&Q.set(M,q=new ee(M)),q}static resetCache(){Q.clear(),K.clear()}static isValidSpecifier(M){return this.isValidZone(M)}static isValidZone(M){if(!M)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:M}).format(),!0}catch{return!1}}constructor(M){super(),this.zoneName=M,this.valid=ee.isValidZone(M)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(M,{format:q,locale:J}){return Ou(M,q,J,this.name)}formatOffset(M,q){return Us(this.offset(M),q)}offset(M){if(!this.valid)return NaN;const q=new Date(M);if(isNaN(q))return NaN;const J=oe(this.name);let[ce,Ce,Ne,qe,Xe,At,Mn]=J.formatToParts?ie(J,q):G(J,q);qe==="BC"&&(ce=-Math.abs(ce)+1);const Fn=ti({year:ce,month:Ce,day:Ne,hour:Xe===24?0:Xe,minute:At,second:Mn,millisecond:0});let pr=+q;const An=pr%1e3;return pr-=An>=0?An:1e3+An,(Fn-pr)/(60*1e3)}equals(M){return M.type==="iana"&&M.name===this.name}get isValid(){return this.valid}}let Z={};function de(W,M={}){const q=JSON.stringify([W,M]);let J=Z[q];return J||(J=new Intl.ListFormat(W,M),Z[q]=J),J}const le=new Map;function fe(W,M={}){const q=JSON.stringify([W,M]);let J=le.get(q);return J===void 0&&(J=new Intl.DateTimeFormat(W,M),le.set(q,J)),J}const he=new Map;function me(W,M={}){const q=JSON.stringify([W,M]);let J=he.get(q);return J===void 0&&(J=new Intl.NumberFormat(W,M),he.set(q,J)),J}const se=new Map;function ve(W,M={}){const{base:q,...J}=M,ce=JSON.stringify([W,J]);let Ce=se.get(ce);return Ce===void 0&&(Ce=new Intl.RelativeTimeFormat(W,M),se.set(ce,Ce)),Ce}let Le=null;function Ae(){return Le||(Le=new Intl.DateTimeFormat().resolvedOptions().locale,Le)}const Re=new Map;function re(W){let M=Re.get(W);return M===void 0&&(M=new Intl.DateTimeFormat(W).resolvedOptions(),Re.set(W,M)),M}const _e=new Map;function Me(W){let M=_e.get(W);if(!M){const q=new Intl.Locale(W);M="getWeekInfo"in q?q.getWeekInfo():q.weekInfo,"minimalDays"in M||(M={...Ve,...M}),_e.set(W,M)}return M}function Ge(W){const M=W.indexOf("-x-");M!==-1&&(W=W.substring(0,M));const q=W.indexOf("-u-");if(q===-1)return[W];{let J,ce;try{J=fe(W).resolvedOptions(),ce=W}catch{const qe=W.substring(0,q);J=fe(qe).resolvedOptions(),ce=qe}const{numberingSystem:Ce,calendar:Ne}=J;return[ce,Ce,Ne]}}function Je(W,M,q){return(q||M)&&(W.includes("-u-")||(W+="-u"),q&&(W+=`-ca-${q}`),M&&(W+=`-nu-${M}`)),W}function St(W){const M=[];for(let q=1;q<=12;q++){const J=En.utc(2009,q,1);M.push(W(J))}return M}function Ut(W){const M=[];for(let q=1;q<=7;q++){const J=En.utc(2016,11,13+q);M.push(W(J))}return M}function at(W,M,q,J){const ce=W.listingMode();return ce==="error"?null:ce==="en"?q(M):J(M)}function tt(W){return W.numberingSystem&&W.numberingSystem!=="latn"?!1:W.numberingSystem==="latn"||!W.locale||W.locale.startsWith("en")||re(W.locale).numberingSystem==="latn"}class pt{constructor(M,q,J){this.padTo=J.padTo||0,this.floor=J.floor||!1;const{padTo:ce,floor:Ce,...Ne}=J;if(!q||Object.keys(Ne).length>0){const qe={useGrouping:!1,...J};J.padTo>0&&(qe.minimumIntegerDigits=J.padTo),this.inf=me(M,qe)}}format(M){if(this.inf){const q=this.floor?Math.floor(M):M;return this.inf.format(q)}else{const q=this.floor?Math.floor(M):vs(M,3);return tn(q,this.padTo)}}}class ze{constructor(M,q,J){this.opts=J,this.originalZone=void 0;let ce;if(this.opts.timeZone)this.dt=M;else if(M.zone.type==="fixed"){const Ne=-1*(M.offset/60),qe=Ne>=0?`Etc/GMT+${Ne}`:`Etc/GMT${Ne}`;M.offset!==0&&ee.create(qe).valid?(ce=qe,this.dt=M):(ce="UTC",this.dt=M.offset===0?M:M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone)}else M.zone.type==="system"?this.dt=M:M.zone.type==="iana"?(this.dt=M,ce=M.zone.name):(ce="UTC",this.dt=M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone);const Ce={...this.opts};Ce.timeZone=Ce.timeZone||ce,this.dtf=fe(q,Ce)}format(){return this.originalZone?this.formatToParts().map(({value:M})=>M).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const M=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?M.map(q=>{if(q.type==="timeZoneName"){const J=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...q,value:J}}else return q}):M}resolvedOptions(){return this.dtf.resolvedOptions()}}class be{constructor(M,q,J){this.opts={style:"long",...J},!q&&Pe()&&(this.rtf=ve(M,J))}format(M,q){return this.rtf?this.rtf.format(M,q):Sc(q,M,this.opts.numeric,this.opts.style!=="long")}formatToParts(M,q){return this.rtf?this.rtf.formatToParts(M,q):[]}}const Ve={firstDay:1,minimalDays:4,weekend:[6,7]};class Oe{static fromOpts(M){return Oe.create(M.locale,M.numberingSystem,M.outputCalendar,M.weekSettings,M.defaultToEN)}static create(M,q,J,ce,Ce=!1){const Ne=M||mn.defaultLocale,qe=Ne||(Ce?"en-US":Ae()),Xe=q||mn.defaultNumberingSystem,At=J||mn.defaultOutputCalendar,Mn=on(ce)||mn.defaultWeekSettings;return new Oe(qe,Xe,At,Mn,Ne)}static resetCache(){Le=null,le.clear(),he.clear(),se.clear(),Re.clear(),_e.clear()}static fromObject({locale:M,numberingSystem:q,outputCalendar:J,weekSettings:ce}={}){return Oe.create(M,q,J,ce)}constructor(M,q,J,ce,Ce){const[Ne,qe,Xe]=Ge(M);this.locale=Ne,this.numberingSystem=q||qe||null,this.outputCalendar=J||Xe||null,this.weekSettings=ce,this.intl=Je(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=Ce,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=tt(this)),this.fastNumbersCached}listingMode(){const M=this.isEnglish(),q=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return M&&q?"en":"intl"}clone(M){return!M||Object.getOwnPropertyNames(M).length===0?this:Oe.create(M.locale||this.specifiedLocale,M.numberingSystem||this.numberingSystem,M.outputCalendar||this.outputCalendar,on(M.weekSettings)||this.weekSettings,M.defaultToEN||!1)}redefaultToEN(M={}){return this.clone({...M,defaultToEN:!0})}redefaultToSystem(M={}){return this.clone({...M,defaultToEN:!1})}months(M,q=!1){return at(this,M,Pl,()=>{const J=this.intl==="ja"||this.intl.startsWith("ja-");q&=!J;const ce=q?{month:M,day:"numeric"}:{month:M},Ce=q?"format":"standalone";if(!this.monthsCache[Ce][M]){const Ne=J?qe=>this.dtFormatter(qe,ce).format():qe=>this.extract(qe,ce,"month");this.monthsCache[Ce][M]=St(Ne)}return this.monthsCache[Ce][M]})}weekdays(M,q=!1){return at(this,M,ws,()=>{const J=q?{weekday:M,year:"numeric",month:"long",day:"numeric"}:{weekday:M},ce=q?"format":"standalone";return this.weekdaysCache[ce][M]||(this.weekdaysCache[ce][M]=Ut(Ce=>this.extract(Ce,J,"weekday"))),this.weekdaysCache[ce][M]})}meridiems(){return at(this,void 0,()=>ju,()=>{if(!this.meridiemCache){const M={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[En.utc(2016,11,13,9),En.utc(2016,11,13,19)].map(q=>this.extract(q,M,"dayperiod"))}return this.meridiemCache})}eras(M){return at(this,M,Da,()=>{const q={era:M};return this.eraCache[M]||(this.eraCache[M]=[En.utc(-40,1,1),En.utc(2017,1,1)].map(J=>this.extract(J,q,"era"))),this.eraCache[M]})}extract(M,q,J){const ce=this.dtFormatter(M,q),Ce=ce.formatToParts(),Ne=Ce.find(qe=>qe.type.toLowerCase()===J);return Ne?Ne.value:null}numberFormatter(M={}){return new pt(this.intl,M.forceSimple||this.fastNumbers,M)}dtFormatter(M,q={}){return new ze(M,this.intl,q)}relFormatter(M={}){return new be(this.intl,this.isEnglish(),M)}listFormatter(M={}){return de(this.intl,M)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||re(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ft()?Me(this.locale):Ve}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(M){return this.locale===M.locale&&this.numberingSystem===M.numberingSystem&&this.outputCalendar===M.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let $t=null;class Rt extends H{static get utcInstance(){return $t===null&&($t=new Rt(0)),$t}static instance(M){return M===0?Rt.utcInstance:new Rt(M)}static parseSpecifier(M){if(M){const q=M.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(q)return new Rt(Ml(q[1],q[2]))}return null}constructor(M){super(),this.fixed=M}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Us(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Us(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(M,q){return Us(this.fixed,q)}get isUniversal(){return!0}offset(){return this.fixed}equals(M){return M.type==="fixed"&&M.fixed===this.fixed}get isValid(){return!0}}class vt extends H{constructor(M){super(),this.zoneName=M}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function it(W,M){if(We(W)||W===null)return M;if(W instanceof H)return W;if(hn(W)){const q=W.toLowerCase();return q==="default"?M:q==="local"||q==="system"?ae.instance:q==="utc"||q==="gmt"?Rt.utcInstance:Rt.parseSpecifier(q)||ee.create(W)}else return Nt(W)?Rt.instance(W):typeof W=="object"&&"offset"in W&&typeof W.offset=="function"?W:new vt(W)}const st={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Dt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},nn=st.hanidec.replace(/[\[|\]]/g,"").split("");function Bt(W){let M=parseInt(W,10);if(isNaN(M)){M="";for(let q=0;q<W.length;q++){const J=W.charCodeAt(q);if(W[q].search(st.hanidec)!==-1)M+=nn.indexOf(W[q]);else for(const ce in Dt){const[Ce,Ne]=Dt[ce];J>=Ce&&J<=Ne&&(M+=J-Ce)}}return parseInt(M,10)}else return M}const pn=new Map;function $n(){pn.clear()}function qt({numberingSystem:W},M=""){const q=W||"latn";let J=pn.get(q);J===void 0&&(J=new Map,pn.set(q,J));let ce=J.get(M);return ce===void 0&&(ce=new RegExp(`${st[q]}${M}`),J.set(M,ce)),ce}let Pn=()=>Date.now(),Se="system",jn=null,Rn=null,en=null,jt=60,Ur,qn=null;class mn{static get now(){return Pn}static set now(M){Pn=M}static set defaultZone(M){Se=M}static get defaultZone(){return it(Se,ae.instance)}static get defaultLocale(){return jn}static set defaultLocale(M){jn=M}static get defaultNumberingSystem(){return Rn}static set defaultNumberingSystem(M){Rn=M}static get defaultOutputCalendar(){return en}static set defaultOutputCalendar(M){en=M}static get defaultWeekSettings(){return qn}static set defaultWeekSettings(M){qn=on(M)}static get twoDigitCutoffYear(){return jt}static set twoDigitCutoffYear(M){jt=M%100}static get throwOnInvalid(){return Ur}static set throwOnInvalid(M){Ur=M}static resetCaches(){Oe.resetCache(),ee.resetCache(),En.resetCache(),$n()}}class Bn{constructor(M,q){this.reason=M,this.explanation=q}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xe=[0,31,59,90,120,151,181,212,243,273,304,334],Ee=[0,31,60,91,121,152,182,213,244,274,305,335];function Be(W,M){return new Bn("unit out of range",`you specified ${M} (of type ${typeof M}) as a ${W}, which is invalid`)}function Ye(W,M,q){const J=new Date(Date.UTC(W,M-1,q));W<100&&W>=0&&J.setUTCFullYear(J.getUTCFullYear()-1900);const ce=J.getUTCDay();return ce===0?7:ce}function ut(W,M,q){return q+(ca(W)?Ee:xe)[M-1]}function Et(W,M){const q=ca(W)?Ee:xe,J=q.findIndex(Ce=>Ce<M),ce=M-q[J];return{month:J+1,day:ce}}function Ct(W,M){return(W-M+7)%7+1}function Mt(W,M=4,q=1){const{year:J,month:ce,day:Ce}=W,Ne=ut(J,ce,Ce),qe=Ct(Ye(J,ce,Ce),q);let Xe=Math.floor((Ne-qe+14-M)/7),At;return Xe<1?(At=J-1,Xe=bs(At,M,q)):Xe>bs(J,M,q)?(At=J+1,Xe=1):At=J,{weekYear:At,weekNumber:Xe,weekday:qe,...Ol(W)}}function Lt(W,M=4,q=1){const{weekYear:J,weekNumber:ce,weekday:Ce}=W,Ne=Ct(Ye(J,1,M),q),qe=fr(J);let Xe=ce*7+Ce-Ne-7+M,At;Xe<1?(At=J-1,Xe+=fr(At)):Xe>qe?(At=J+1,Xe-=fr(J)):At=J;const{month:Mn,day:Fn}=Et(At,Xe);return{year:At,month:Mn,day:Fn,...Ol(W)}}function Xt(W){const{year:M,month:q,day:J}=W,ce=ut(M,q,J);return{year:M,ordinal:ce,...Ol(W)}}function zt(W){const{year:M,ordinal:q}=W,{month:J,day:ce}=Et(M,q);return{year:M,month:J,day:ce,...Ol(W)}}function Vt(W,M){if(!We(W.localWeekday)||!We(W.localWeekNumber)||!We(W.localWeekYear)){if(!We(W.weekday)||!We(W.weekNumber)||!We(W.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return We(W.localWeekday)||(W.weekday=W.localWeekday),We(W.localWeekNumber)||(W.weekNumber=W.localWeekNumber),We(W.localWeekYear)||(W.weekYear=W.localWeekYear),delete W.localWeekday,delete W.localWeekNumber,delete W.localWeekYear,{minDaysInFirstWeek:M.getMinDaysInFirstWeek(),startOfWeek:M.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ge(W,M=4,q=1){const J=Kt(W.weekYear),ce=On(W.weekNumber,1,bs(W.weekYear,M,q)),Ce=On(W.weekday,1,7);return J?ce?Ce?!1:Be("weekday",W.weekday):Be("week",W.weekNumber):Be("weekYear",W.weekYear)}function ye(W){const M=Kt(W.year),q=On(W.ordinal,1,fr(W.year));return M?q?!1:Be("ordinal",W.ordinal):Be("year",W.year)}function Ue(W){const M=Kt(W.year),q=On(W.month,1,12),J=On(W.day,1,qr(W.year,W.month));return M?q?J?!1:Be("day",W.day):Be("month",W.month):Be("year",W.year)}function gt(W){const{hour:M,minute:q,second:J,millisecond:ce}=W,Ce=On(M,0,23)||M===24&&q===0&&J===0&&ce===0,Ne=On(q,0,59),qe=On(J,0,59),Xe=On(ce,0,999);return Ce?Ne?qe?Xe?!1:Be("millisecond",ce):Be("second",J):Be("minute",q):Be("hour",M)}function We(W){return typeof W>"u"}function Nt(W){return typeof W=="number"}function Kt(W){return typeof W=="number"&&W%1===0}function hn(W){return typeof W=="string"}function we(W){return Object.prototype.toString.call(W)==="[object Date]"}function Pe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ft(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function kt(W){return Array.isArray(W)?W:[W]}function Ot(W,M,q){if(W.length!==0)return W.reduce((J,ce)=>{const Ce=[M(ce),ce];return J&&q(J[0],Ce[0])===J[0]?J:Ce},null)[1]}function Pt(W,M){return M.reduce((q,J)=>(q[J]=W[J],q),{})}function Ft(W,M){return Object.prototype.hasOwnProperty.call(W,M)}function on(W){if(W==null)return null;if(typeof W!="object")throw new i("Week settings must be an object");if(!On(W.firstDay,1,7)||!On(W.minimalDays,1,7)||!Array.isArray(W.weekend)||W.weekend.some(M=>!On(M,1,7)))throw new i("Invalid week settings");return{firstDay:W.firstDay,minimalDays:W.minimalDays,weekend:Array.from(W.weekend)}}function On(W,M,q){return Kt(W)&&W>=M&&W<=q}function or(W,M){return W-M*Math.floor(W/M)}function tn(W,M=2){const q=W<0;let J;return q?J="-"+(""+-W).padStart(M,"0"):J=(""+W).padStart(M,"0"),J}function Dr(W){if(!(We(W)||W===null||W===""))return parseInt(W,10)}function fo(W){if(!(We(W)||W===null||W===""))return parseFloat(W)}function Do(W){if(!(We(W)||W===null||W==="")){const M=parseFloat("0."+W)*1e3;return Math.floor(M)}}function vs(W,M,q="round"){const J=10**M;switch(q){case"expand":return W>0?Math.ceil(W*J)/J:Math.floor(W*J)/J;case"trunc":return Math.trunc(W*J)/J;case"round":return Math.round(W*J)/J;case"floor":return Math.floor(W*J)/J;case"ceil":return Math.ceil(W*J)/J;default:throw new RangeError(`Value rounding ${q} is out of range`)}}function ca(W){return W%4===0&&(W%100!==0||W%400===0)}function fr(W){return ca(W)?366:365}function qr(W,M){const q=or(M-1,12)+1,J=W+(M-q)/12;return q===2?ca(J)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][q-1]}function ti(W){let M=Date.UTC(W.year,W.month-1,W.day,W.hour,W.minute,W.second,W.millisecond);return W.year<100&&W.year>=0&&(M=new Date(M),M.setUTCFullYear(W.year,W.month-1,W.day)),+M}function El(W,M,q){return-Ct(Ye(W,1,M),q)+M-1}function bs(W,M=4,q=1){const J=El(W,M,q),ce=El(W+1,M,q);return(fr(W)-J+ce)/7}function Di(W){return W>99?W:W>mn.twoDigitCutoffYear?1900+W:2e3+W}function Ou(W,M,q,J=null){const ce=new Date(W),Ce={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};J&&(Ce.timeZone=J);const Ne={timeZoneName:M,...Ce},qe=new Intl.DateTimeFormat(q,Ne).formatToParts(ce).find(Xe=>Xe.type.toLowerCase()==="timezonename");return qe?qe.value:null}function Ml(W,M){let q=parseInt(W,10);Number.isNaN(q)&&(q=0);const J=parseInt(M,10)||0,ce=q<0||Object.is(q,-0)?-J:J;return q*60+ce}function xs(W){const M=Number(W);if(typeof W=="boolean"||W===""||!Number.isFinite(M))throw new i(`Invalid unit value ${W}`);return M}function bc(W,M){const q={};for(const J in W)if(Ft(W,J)){const ce=W[J];if(ce==null)continue;q[M(J)]=xs(ce)}return q}function Us(W,M){const q=Math.trunc(Math.abs(W/60)),J=Math.trunc(Math.abs(W%60)),ce=W>=0?"+":"-";switch(M){case"short":return`${ce}${tn(q,2)}:${tn(J,2)}`;case"narrow":return`${ce}${q}${J>0?`:${J}`:""}`;case"techie":return`${ce}${tn(q,2)}${tn(J,2)}`;default:throw new RangeError(`Value format ${M} is out of range for property format`)}}function Ol(W){return Pt(W,["hour","minute","second","millisecond"])}const Pu=["January","February","March","April","May","June","July","August","September","October","November","December"],af=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$h=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pl(W){switch(W){case"narrow":return[...$h];case"short":return[...af];case"long":return[...Pu];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const xc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],wc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qs=["M","T","W","T","F","S","S"];function ws(W){switch(W){case"narrow":return[...qs];case"short":return[...wc];case"long":return[...xc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const ju=["AM","PM"],Au=["Before Christ","Anno Domini"],sf=["BC","AD"],jl=["B","A"];function Da(W){switch(W){case"narrow":return[...jl];case"short":return[...sf];case"long":return[...Au];default:return null}}function Du(W){return ju[W.hour<12?0:1]}function Al(W,M){return ws(M)[W.weekday-1]}function Ni(W,M){return Pl(M)[W.month-1]}function Nu(W,M){return Da(M)[W.year<0?0:1]}function Sc(W,M,q="always",J=!1){const ce={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},Ce=["hours","minutes","seconds"].indexOf(W)===-1;if(q==="auto"&&Ce){const Fn=W==="days";switch(M){case 1:return Fn?"tomorrow":`next ${ce[W][0]}`;case-1:return Fn?"yesterday":`last ${ce[W][0]}`;case 0:return Fn?"today":`this ${ce[W][0]}`}}const Ne=Object.is(M,-0)||M<0,qe=Math.abs(M),Xe=qe===1,At=ce[W],Mn=J?Xe?At[1]:At[2]||At[1]:Xe?ce[W][0]:W;return Ne?`${qe} ${Mn} ago`:`in ${qe} ${Mn}`}function Iu(W,M){let q="";for(const J of W)J.literal?q+=J.val:q+=M(J.val);return q}const Cc={D:m,DD:g,DDD:x,DDDD:w,t:S,tt:b,ttt:$,tttt:k,T,TT:O,TTT:P,TTTT:D,f:A,ff:L,fff:z,ffff:B,F,FF:_,FFF:N,FFFF:I};class oo{static create(M,q={}){return new oo(M,q)}static parseFormat(M){let q=null,J="",ce=!1;const Ce=[];for(let Ne=0;Ne<M.length;Ne++){const qe=M.charAt(Ne);qe==="'"?((J.length>0||ce)&&Ce.push({literal:ce||/^\s+$/.test(J),val:J===""?"'":J}),q=null,J="",ce=!ce):ce||qe===q?J+=qe:(J.length>0&&Ce.push({literal:/^\s+$/.test(J),val:J}),J=qe,q=qe)}return J.length>0&&Ce.push({literal:ce||/^\s+$/.test(J),val:J}),Ce}static macroTokenToFormatOpts(M){return Cc[M]}constructor(M,q){this.opts=q,this.loc=M,this.systemLoc=null}formatWithSystemDefault(M,q){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(M,{...this.opts,...q}).format()}dtFormatter(M,q={}){return this.loc.dtFormatter(M,{...this.opts,...q})}formatDateTime(M,q){return this.dtFormatter(M,q).format()}formatDateTimeParts(M,q){return this.dtFormatter(M,q).formatToParts()}formatInterval(M,q){return this.dtFormatter(M.start,q).dtf.formatRange(M.start.toJSDate(),M.end.toJSDate())}resolvedOptions(M,q){return this.dtFormatter(M,q).resolvedOptions()}num(M,q=0,J=void 0){if(this.opts.forceSimple)return tn(M,q);const ce={...this.opts};return q>0&&(ce.padTo=q),J&&(ce.signDisplay=J),this.loc.numberFormatter(ce).format(M)}formatDateTimeFromString(M,q){const J=this.loc.listingMode()==="en",ce=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",Ce=(An,Jr)=>this.loc.extract(M,An,Jr),Ne=An=>M.isOffsetFixed&&M.offset===0&&An.allowZ?"Z":M.isValid?M.zone.formatOffset(M.ts,An.format):"",qe=()=>J?Du(M):Ce({hour:"numeric",hourCycle:"h12"},"dayperiod"),Xe=(An,Jr)=>J?Ni(M,An):Ce(Jr?{month:An}:{month:An,day:"numeric"},"month"),At=(An,Jr)=>J?Al(M,An):Ce(Jr?{weekday:An}:{weekday:An,month:"long",day:"numeric"},"weekday"),Mn=An=>{const Jr=oo.macroTokenToFormatOpts(An);return Jr?this.formatWithSystemDefault(M,Jr):An},Fn=An=>J?Nu(M,An):Ce({era:An},"era"),pr=An=>{switch(An){case"S":return this.num(M.millisecond);case"u":case"SSS":return this.num(M.millisecond,3);case"s":return this.num(M.second);case"ss":return this.num(M.second,2);case"uu":return this.num(Math.floor(M.millisecond/10),2);case"uuu":return this.num(Math.floor(M.millisecond/100));case"m":return this.num(M.minute);case"mm":return this.num(M.minute,2);case"h":return this.num(M.hour%12===0?12:M.hour%12);case"hh":return this.num(M.hour%12===0?12:M.hour%12,2);case"H":return this.num(M.hour);case"HH":return this.num(M.hour,2);case"Z":return Ne({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return Ne({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return Ne({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return M.zone.offsetName(M.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return M.zone.offsetName(M.ts,{format:"long",locale:this.loc.locale});case"z":return M.zoneName;case"a":return qe();case"d":return ce?Ce({day:"numeric"},"day"):this.num(M.day);case"dd":return ce?Ce({day:"2-digit"},"day"):this.num(M.day,2);case"c":return this.num(M.weekday);case"ccc":return At("short",!0);case"cccc":return At("long",!0);case"ccccc":return At("narrow",!0);case"E":return this.num(M.weekday);case"EEE":return At("short",!1);case"EEEE":return At("long",!1);case"EEEEE":return At("narrow",!1);case"L":return ce?Ce({month:"numeric",day:"numeric"},"month"):this.num(M.month);case"LL":return ce?Ce({month:"2-digit",day:"numeric"},"month"):this.num(M.month,2);case"LLL":return Xe("short",!0);case"LLLL":return Xe("long",!0);case"LLLLL":return Xe("narrow",!0);case"M":return ce?Ce({month:"numeric"},"month"):this.num(M.month);case"MM":return ce?Ce({month:"2-digit"},"month"):this.num(M.month,2);case"MMM":return Xe("short",!1);case"MMMM":return Xe("long",!1);case"MMMMM":return Xe("narrow",!1);case"y":return ce?Ce({year:"numeric"},"year"):this.num(M.year);case"yy":return ce?Ce({year:"2-digit"},"year"):this.num(M.year.toString().slice(-2),2);case"yyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,4);case"yyyyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,6);case"G":return Fn("short");case"GG":return Fn("long");case"GGGGG":return Fn("narrow");case"kk":return this.num(M.weekYear.toString().slice(-2),2);case"kkkk":return this.num(M.weekYear,4);case"W":return this.num(M.weekNumber);case"WW":return this.num(M.weekNumber,2);case"n":return this.num(M.localWeekNumber);case"nn":return this.num(M.localWeekNumber,2);case"ii":return this.num(M.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(M.localWeekYear,4);case"o":return this.num(M.ordinal);case"ooo":return this.num(M.ordinal,3);case"q":return this.num(M.quarter);case"qq":return this.num(M.quarter,2);case"X":return this.num(Math.floor(M.ts/1e3));case"x":return this.num(M.ts);default:return Mn(An)}};return Iu(oo.parseFormat(q),pr)}formatDurationFromString(M,q){const J=this.opts.signMode==="negativeLargestOnly"?-1:1,ce=Mn=>{switch(Mn[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},Ce=(Mn,Fn)=>pr=>{const An=ce(pr);if(An){const Jr=Fn.isNegativeDuration&&An!==Fn.largestUnit?J:1;let Qo;return this.opts.signMode==="negativeLargestOnly"&&An!==Fn.largestUnit?Qo="never":this.opts.signMode==="all"?Qo="always":Qo="auto",this.num(Mn.get(An)*Jr,pr.length,Qo)}else return pr},Ne=oo.parseFormat(q),qe=Ne.reduce((Mn,{literal:Fn,val:pr})=>Fn?Mn:Mn.concat(pr),[]),Xe=M.shiftTo(...qe.map(ce).filter(Mn=>Mn)),At={isNegativeDuration:Xe<0,largestUnit:Object.keys(Xe.values)[0]};return Iu(Ne,Ce(Xe,At))}}const Lu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function U(...W){const M=W.reduce((q,J)=>q+J.source,"");return RegExp(`^${M}$`)}function $o(...W){return M=>W.reduce(([q,J,ce],Ce)=>{const[Ne,qe,Xe]=Ce(M,ce);return[{...q,...Ne},qe||J,Xe]},[{},null,1]).slice(0,2)}function ao(W,...M){if(W==null)return[null,null];for(const[q,J]of M){const ce=q.exec(W);if(ce)return J(ce)}return[null,null]}function ni(...W){return(M,q)=>{const J={};let ce;for(ce=0;ce<W.length;ce++)J[W[ce]]=Dr(M[q+ce]);return[J,null,q+ce]}}const je=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Ss=`(?:${je.source}?(?:\\[(${Lu.source})\\])?)?`,zn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ko=RegExp(`${zn.source}${Ss}`),Hs=RegExp(`(?:[Tt]${Ko.source})?`),zu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,lf=/(\d{4})-?W(\d\d)(?:-?(\d))?/,cf=/(\d{4})-?(\d{3})/,ot=ni("weekYear","weekNumber","weekDay"),Fu=ni("year","ordinal"),_u=/(\d{4})-(\d\d)-(\d\d)/,kc=RegExp(`${zn.source} ?(?:${je.source}|(${Lu.source}))?`),uf=RegExp(`(?: ${kc.source})?`);function Vs(W,M,q){const J=W[M];return We(J)?q:Dr(J)}function Dl(W,M){return[{year:Vs(W,M),month:Vs(W,M+1,1),day:Vs(W,M+2,1)},null,M+3]}function Cs(W,M){return[{hours:Vs(W,M,0),minutes:Vs(W,M+1,0),seconds:Vs(W,M+2,0),milliseconds:Do(W[M+3])},null,M+4]}function Ws(W,M){const q=!W[M]&&!W[M+1],J=Ml(W[M+1],W[M+2]),ce=q?null:Rt.instance(J);return[{},ce,M+3]}function ua(W,M){const q=W[M]?ee.create(W[M]):null;return[{},q,M+1]}const Rh=RegExp(`^T?${zn.source}$`),Th=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Nl(W){const[M,q,J,ce,Ce,Ne,qe,Xe,At]=W,Mn=M[0]==="-",Fn=Xe&&Xe[0]==="-",pr=(An,Jr=!1)=>An!==void 0&&(Jr||An&&Mn)?-An:An;return[{years:pr(fo(q)),months:pr(fo(J)),weeks:pr(fo(ce)),days:pr(fo(Ce)),hours:pr(fo(Ne)),minutes:pr(fo(qe)),seconds:pr(fo(Xe),Xe==="-0"),milliseconds:pr(Do(At),Fn)}]}const df={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Bu(W,M,q,J,ce,Ce,Ne){const qe={year:M.length===2?Di(Dr(M)):Dr(M),month:af.indexOf(q)+1,day:Dr(J),hour:Dr(ce),minute:Dr(Ce)};return Ne&&(qe.second=Dr(Ne)),W&&(qe.weekday=W.length>3?xc.indexOf(W)+1:wc.indexOf(W)+1),qe}const Eh=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function ff(W){const[,M,q,J,ce,Ce,Ne,qe,Xe,At,Mn,Fn]=W,pr=Bu(M,ce,J,q,Ce,Ne,qe);let An;return Xe?An=df[Xe]:At?An=0:An=Ml(Mn,Fn),[pr,new Rt(An)]}function Mh(W){return W.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const pf=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Uu=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Oh=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function $c(W){const[,M,q,J,ce,Ce,Ne,qe]=W;return[Bu(M,ce,J,q,Ce,Ne,qe),Rt.utcInstance]}function Ph(W){const[,M,q,J,ce,Ce,Ne,qe]=W;return[Bu(M,qe,q,J,ce,Ce,Ne),Rt.utcInstance]}const jh=U(zu,Hs),Ah=U(lf,Hs),Dh=U(cf,Hs),qu=U(Ko),Ys=$o(Dl,Cs,Ws,ua),Nh=$o(ot,Cs,Ws,ua),hf=$o(Fu,Cs,Ws,ua),mf=$o(Cs,Ws,ua);function gf(W){return ao(W,[jh,Ys],[Ah,Nh],[Dh,hf],[qu,mf])}function yf(W){return ao(Mh(W),[Eh,ff])}function vf(W){return ao(W,[pf,$c],[Uu,$c],[Oh,Ph])}function Gs(W){return ao(W,[Th,Nl])}const Ih=$o(Cs);function Lh(W){return ao(W,[Rh,Ih])}const zh=U(_u,uf),bf=U(kc),xf=$o(Cs,Ws,ua);function Il(W){return ao(W,[zh,Ys],[bf,xf])}const ar="Invalid Duration",ks={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Zr={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ks},V=146097/400,te=146097/4800,X={years:{quarters:4,months:12,weeks:V/7,days:V,hours:V*24,minutes:V*24*60,seconds:V*24*60*60,milliseconds:V*24*60*60*1e3},quarters:{months:3,weeks:V/28,days:V/4,hours:V*24/4,minutes:V*24*60/4,seconds:V*24*60*60/4,milliseconds:V*24*60*60*1e3/4},months:{weeks:te/7,days:te,hours:te*24,minutes:te*24*60,seconds:te*24*60*60,milliseconds:te*24*60*60*1e3},...ks},$e=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Zt=$e.slice(0).reverse();function Gt(W,M,q=!1){const J={values:q?M.values:{...W.values,...M.values||{}},loc:W.loc.clone(M.loc),conversionAccuracy:M.conversionAccuracy||W.conversionAccuracy,matrix:M.matrix||W.matrix};return new Qt(J)}function Dn(W,M){var q;let J=(q=M.milliseconds)!=null?q:0;for(const ce of Zt.slice(1))M[ce]&&(J+=M[ce]*W[ce].milliseconds);return J}function Qn(W,M){const q=Dn(W,M)<0?-1:1;$e.reduceRight((J,ce)=>{if(We(M[ce]))return J;if(J){const Ce=M[J]*q,Ne=W[ce][J],qe=Math.floor(Ce/Ne);M[ce]+=qe*q,M[J]-=qe*Ne*q}return ce},null),$e.reduce((J,ce)=>{if(We(M[ce]))return J;if(J){const Ce=M[J]%1;M[J]-=Ce,M[ce]+=Ce*W[J][ce]}return ce},null)}function Xn(W){const M={};for(const[q,J]of Object.entries(W))J!==0&&(M[q]=J);return M}class Qt{constructor(M){const q=M.conversionAccuracy==="longterm"||!1;let J=q?X:Zr;M.matrix&&(J=M.matrix),this.values=M.values,this.loc=M.loc||Oe.create(),this.conversionAccuracy=q?"longterm":"casual",this.invalid=M.invalid||null,this.matrix=J,this.isLuxonDuration=!0}static fromMillis(M,q){return Qt.fromObject({milliseconds:M},q)}static fromObject(M,q={}){if(M==null||typeof M!="object")throw new i(`Duration.fromObject: argument expected to be an object, got ${M===null?"null":typeof M}`);return new Qt({values:bc(M,Qt.normalizeUnit),loc:Oe.fromObject(q),conversionAccuracy:q.conversionAccuracy,matrix:q.matrix})}static fromDurationLike(M){if(Nt(M))return Qt.fromMillis(M);if(Qt.isDuration(M))return M;if(typeof M=="object")return Qt.fromObject(M);throw new i(`Unknown duration argument ${M} of type ${typeof M}`)}static fromISO(M,q){const[J]=Gs(M);return J?Qt.fromObject(J,q):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static fromISOTime(M,q){const[J]=Lh(M);return J?Qt.fromObject(J,q):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static invalid(M,q=null){if(!M)throw new i("need to specify a reason the Duration is invalid");const J=M instanceof Bn?M:new Bn(M,q);if(mn.throwOnInvalid)throw new r(J);return new Qt({invalid:J})}static normalizeUnit(M){const q={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[M&&M.toLowerCase()];if(!q)throw new a(M);return q}static isDuration(M){return M&&M.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(M,q={}){const J={...q,floor:q.round!==!1&&q.floor!==!1};return this.isValid?oo.create(this.loc,J).formatDurationFromString(this,M):ar}toHuman(M={}){if(!this.isValid)return ar;const q=M.showZeros!==!1,J=$e.map(ce=>{const Ce=this.values[ce];return We(Ce)||Ce===0&&!q?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...M,unit:ce.slice(0,-1)}).format(Ce)}).filter(ce=>ce);return this.loc.listFormatter({type:"conjunction",style:M.listStyle||"narrow",...M}).format(J)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let M="P";return this.years!==0&&(M+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(M+=this.months+this.quarters*3+"M"),this.weeks!==0&&(M+=this.weeks+"W"),this.days!==0&&(M+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(M+="T"),this.hours!==0&&(M+=this.hours+"H"),this.minutes!==0&&(M+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(M+=vs(this.seconds+this.milliseconds/1e3,3)+"S"),M==="P"&&(M+="T0S"),M}toISOTime(M={}){if(!this.isValid)return null;const q=this.toMillis();return q<0||q>=864e5?null:(M={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...M,includeOffset:!1},En.fromMillis(q,{zone:"UTC"}).toISOTime(M))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Dn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M),J={};for(const ce of $e)(Ft(q.values,ce)||Ft(this.values,ce))&&(J[ce]=q.get(ce)+this.get(ce));return Gt(this,{values:J},!0)}minus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M);return this.plus(q.negate())}mapUnits(M){if(!this.isValid)return this;const q={};for(const J of Object.keys(this.values))q[J]=xs(M(this.values[J],J));return Gt(this,{values:q},!0)}get(M){return this[Qt.normalizeUnit(M)]}set(M){if(!this.isValid)return this;const q={...this.values,...bc(M,Qt.normalizeUnit)};return Gt(this,{values:q})}reconfigure({locale:M,numberingSystem:q,conversionAccuracy:J,matrix:ce}={}){const Ce={loc:this.loc.clone({locale:M,numberingSystem:q}),matrix:ce,conversionAccuracy:J};return Gt(this,Ce)}as(M){return this.isValid?this.shiftTo(M).get(M):NaN}normalize(){if(!this.isValid)return this;const M=this.toObject();return Qn(this.matrix,M),Gt(this,{values:M},!0)}rescale(){if(!this.isValid)return this;const M=Xn(this.normalize().shiftToAll().toObject());return Gt(this,{values:M},!0)}shiftTo(...M){if(!this.isValid)return this;if(M.length===0)return this;M=M.map(Ne=>Qt.normalizeUnit(Ne));const q={},J={},ce=this.toObject();let Ce;for(const Ne of $e)if(M.indexOf(Ne)>=0){Ce=Ne;let qe=0;for(const At in J)qe+=this.matrix[At][Ne]*J[At],J[At]=0;Nt(ce[Ne])&&(qe+=ce[Ne]);const Xe=Math.trunc(qe);q[Ne]=Xe,J[Ne]=(qe*1e3-Xe*1e3)/1e3}else Nt(ce[Ne])&&(J[Ne]=ce[Ne]);for(const Ne in J)J[Ne]!==0&&(q[Ce]+=Ne===Ce?J[Ne]:J[Ne]/this.matrix[Ce][Ne]);return Qn(this.matrix,q),Gt(this,{values:q},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const M={};for(const q of Object.keys(this.values))M[q]=this.values[q]===0?0:-this.values[q];return Gt(this,{values:M},!0)}removeZeros(){if(!this.isValid)return this;const M=Xn(this.values);return Gt(this,{values:M},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(M){if(!this.isValid||!M.isValid||!this.loc.equals(M.loc))return!1;function q(J,ce){return J===void 0||J===0?ce===void 0||ce===0:J===ce}for(const J of $e)if(!q(this.values[J],M.values[J]))return!1;return!0}}const $r="Invalid Interval";function Rr(W,M){return!W||!W.isValid?xn.invalid("missing or invalid start"):!M||!M.isValid?xn.invalid("missing or invalid end"):M<W?xn.invalid("end before start",`The end of an interval must be after its start, but you had start=${W.toISO()} and end=${M.toISO()}`):null}class xn{constructor(M){this.s=M.start,this.e=M.end,this.invalid=M.invalid||null,this.isLuxonInterval=!0}static invalid(M,q=null){if(!M)throw new i("need to specify a reason the Interval is invalid");const J=M instanceof Bn?M:new Bn(M,q);if(mn.throwOnInvalid)throw new n(J);return new xn({invalid:J})}static fromDateTimes(M,q){const J=li(M),ce=li(q);return Rr(J,ce)??new xn({start:J,end:ce})}static after(M,q){const J=Qt.fromDurationLike(q),ce=li(M);return xn.fromDateTimes(ce,ce.plus(J))}static before(M,q){const J=Qt.fromDurationLike(q),ce=li(M);return xn.fromDateTimes(ce.minus(J),ce)}static fromISO(M,q){const[J,ce]=(M||"").split("/",2);if(J&&ce){let Ce,Ne;try{Ce=En.fromISO(J,q),Ne=Ce.isValid}catch{Ne=!1}let qe,Xe;try{qe=En.fromISO(ce,q),Xe=qe.isValid}catch{Xe=!1}if(Ne&&Xe)return xn.fromDateTimes(Ce,qe);if(Ne){const At=Qt.fromISO(ce,q);if(At.isValid)return xn.after(Ce,At)}else if(Xe){const At=Qt.fromISO(J,q);if(At.isValid)return xn.before(qe,At)}}return xn.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static isInterval(M){return M&&M.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(M="milliseconds"){return this.isValid?this.toDuration(M).get(M):NaN}count(M="milliseconds",q){if(!this.isValid)return NaN;const J=this.start.startOf(M,q);let ce;return q!=null&&q.useLocaleWeeks?ce=this.end.reconfigure({locale:J.locale}):ce=this.end,ce=ce.startOf(M,q),Math.floor(ce.diff(J,M).get(M))+(ce.valueOf()!==this.end.valueOf())}hasSame(M){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,M):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(M){return this.isValid?this.s>M:!1}isBefore(M){return this.isValid?this.e<=M:!1}contains(M){return this.isValid?this.s<=M&&this.e>M:!1}set({start:M,end:q}={}){return this.isValid?xn.fromDateTimes(M||this.s,q||this.e):this}splitAt(...M){if(!this.isValid)return[];const q=M.map(li).filter(Ne=>this.contains(Ne)).sort((Ne,qe)=>Ne.toMillis()-qe.toMillis()),J=[];let{s:ce}=this,Ce=0;for(;ce<this.e;){const Ne=q[Ce]||this.e,qe=+Ne>+this.e?this.e:Ne;J.push(xn.fromDateTimes(ce,qe)),ce=qe,Ce+=1}return J}splitBy(M){const q=Qt.fromDurationLike(M);if(!this.isValid||!q.isValid||q.as("milliseconds")===0)return[];let{s:J}=this,ce=1,Ce;const Ne=[];for(;J<this.e;){const qe=this.start.plus(q.mapUnits(Xe=>Xe*ce));Ce=+qe>+this.e?this.e:qe,Ne.push(xn.fromDateTimes(J,Ce)),J=Ce,ce+=1}return Ne}divideEqually(M){return this.isValid?this.splitBy(this.length()/M).slice(0,M):[]}overlaps(M){return this.e>M.s&&this.s<M.e}abutsStart(M){return this.isValid?+this.e==+M.s:!1}abutsEnd(M){return this.isValid?+M.e==+this.s:!1}engulfs(M){return this.isValid?this.s<=M.s&&this.e>=M.e:!1}equals(M){return!this.isValid||!M.isValid?!1:this.s.equals(M.s)&&this.e.equals(M.e)}intersection(M){if(!this.isValid)return this;const q=this.s>M.s?this.s:M.s,J=this.e<M.e?this.e:M.e;return q>=J?null:xn.fromDateTimes(q,J)}union(M){if(!this.isValid)return this;const q=this.s<M.s?this.s:M.s,J=this.e>M.e?this.e:M.e;return xn.fromDateTimes(q,J)}static merge(M){const[q,J]=M.sort((ce,Ce)=>ce.s-Ce.s).reduce(([ce,Ce],Ne)=>Ce?Ce.overlaps(Ne)||Ce.abutsStart(Ne)?[ce,Ce.union(Ne)]:[ce.concat([Ce]),Ne]:[ce,Ne],[[],null]);return J&&q.push(J),q}static xor(M){let q=null,J=0;const ce=[],Ce=M.map(Xe=>[{time:Xe.s,type:"s"},{time:Xe.e,type:"e"}]),Ne=Array.prototype.concat(...Ce),qe=Ne.sort((Xe,At)=>Xe.time-At.time);for(const Xe of qe)J+=Xe.type==="s"?1:-1,J===1?q=Xe.time:(q&&+q!=+Xe.time&&ce.push(xn.fromDateTimes(q,Xe.time)),q=null);return xn.merge(ce)}difference(...M){return xn.xor([this].concat(M)).map(q=>this.intersection(q)).filter(q=>q&&!q.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:$r}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(M=m,q={}){return this.isValid?oo.create(this.s.loc.clone(q),M).formatInterval(this):$r}toISO(M){return this.isValid?`${this.s.toISO(M)}/${this.e.toISO(M)}`:$r}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:$r}toISOTime(M){return this.isValid?`${this.s.toISOTime(M)}/${this.e.toISOTime(M)}`:$r}toFormat(M,{separator:q=" – "}={}){return this.isValid?`${this.s.toFormat(M)}${q}${this.e.toFormat(M)}`:$r}toDuration(M,q){return this.isValid?this.e.diff(this.s,M,q):Qt.invalid(this.invalidReason)}mapEndpoints(M){return xn.fromDateTimes(M(this.s),M(this.e))}}class br{static hasDST(M=mn.defaultZone){const q=En.now().setZone(M).set({month:12});return!M.isUniversal&&q.offset!==q.set({month:6}).offset}static isValidIANAZone(M){return ee.isValidZone(M)}static normalizeZone(M){return it(M,mn.defaultZone)}static getStartOfWeek({locale:M=null,locObj:q=null}={}){return(q||Oe.create(M)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:M=null,locObj:q=null}={}){return(q||Oe.create(M)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:M=null,locObj:q=null}={}){return(q||Oe.create(M)).getWeekendDays().slice()}static months(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Oe.create(q,J,Ce)).months(M)}static monthsFormat(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Oe.create(q,J,Ce)).months(M,!0)}static weekdays(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null}={}){return(ce||Oe.create(q,J,null)).weekdays(M)}static weekdaysFormat(M="long",{locale:q=null,numberingSystem:J=null,locObj:ce=null}={}){return(ce||Oe.create(q,J,null)).weekdays(M,!0)}static meridiems({locale:M=null}={}){return Oe.create(M).meridiems()}static eras(M="short",{locale:q=null}={}){return Oe.create(q,null,"gregory").eras(M)}static features(){return{relative:Pe(),localeWeek:ft()}}}function Wr(W,M){const q=ce=>ce.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),J=q(M)-q(W);return Math.floor(Qt.fromMillis(J).as("days"))}function Gr(W,M,q){const J=[["years",(Xe,At)=>At.year-Xe.year],["quarters",(Xe,At)=>At.quarter-Xe.quarter+(At.year-Xe.year)*4],["months",(Xe,At)=>At.month-Xe.month+(At.year-Xe.year)*12],["weeks",(Xe,At)=>{const Mn=Wr(Xe,At);return(Mn-Mn%7)/7}],["days",Wr]],ce={},Ce=W;let Ne,qe;for(const[Xe,At]of J)q.indexOf(Xe)>=0&&(Ne=Xe,ce[Xe]=At(W,M),qe=Ce.plus(ce),qe>M?(ce[Xe]--,W=Ce.plus(ce),W>M&&(qe=W,ce[Xe]--,W=Ce.plus(ce))):W=qe);return[W,ce,qe,Ne]}function ri(W,M,q,J){let[ce,Ce,Ne,qe]=Gr(W,M,q);const Xe=M-ce,At=q.filter(Fn=>["hours","minutes","seconds","milliseconds"].indexOf(Fn)>=0);At.length===0&&(Ne<M&&(Ne=ce.plus({[qe]:1})),Ne!==ce&&(Ce[qe]=(Ce[qe]||0)+Xe/(Ne-ce)));const Mn=Qt.fromObject(Ce,J);return At.length>0?Qt.fromMillis(Xe,J).shiftTo(...At).plus(Mn):Mn}const wa="missing Intl.DateTimeFormat.formatToParts support";function Un(W,M=q=>q){return{regex:W,deser:([q])=>M(Bt(q))}}const Ll="[  ]",Sa=new RegExp(Ll,"g");function $s(W){return W.replace(/\./g,"\\.?").replace(Sa,Ll)}function da(W){return W.replace(/\./g,"").replace(Sa," ").toLowerCase()}function io(W,M){return W===null?null:{regex:RegExp(W.map($s).join("|")),deser:([q])=>W.findIndex(J=>da(q)===da(J))+M}}function zl(W,M){return{regex:W,deser:([,q,J])=>Ml(q,J),groups:M}}function Ro(W){return{regex:W,deser:([M])=>M}}function Rc(W){return W.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Fh(W,M){const q=qt(M),J=qt(M,"{2}"),ce=qt(M,"{3}"),Ce=qt(M,"{4}"),Ne=qt(M,"{6}"),qe=qt(M,"{1,2}"),Xe=qt(M,"{1,3}"),At=qt(M,"{1,6}"),Mn=qt(M,"{1,9}"),Fn=qt(M,"{2,4}"),pr=qt(M,"{4,6}"),An=Qo=>({regex:RegExp(Rc(Qo.val)),deser:([Na])=>Na,literal:!0}),Jr=(Qo=>{if(W.literal)return An(Qo);switch(Qo.val){case"G":return io(M.eras("short"),0);case"GG":return io(M.eras("long"),0);case"y":return Un(At);case"yy":return Un(Fn,Di);case"yyyy":return Un(Ce);case"yyyyy":return Un(pr);case"yyyyyy":return Un(Ne);case"M":return Un(qe);case"MM":return Un(J);case"MMM":return io(M.months("short",!0),1);case"MMMM":return io(M.months("long",!0),1);case"L":return Un(qe);case"LL":return Un(J);case"LLL":return io(M.months("short",!1),1);case"LLLL":return io(M.months("long",!1),1);case"d":return Un(qe);case"dd":return Un(J);case"o":return Un(Xe);case"ooo":return Un(ce);case"HH":return Un(J);case"H":return Un(qe);case"hh":return Un(J);case"h":return Un(qe);case"mm":return Un(J);case"m":return Un(qe);case"q":return Un(qe);case"qq":return Un(J);case"s":return Un(qe);case"ss":return Un(J);case"S":return Un(Xe);case"SSS":return Un(ce);case"u":return Ro(Mn);case"uu":return Ro(qe);case"uuu":return Un(q);case"a":return io(M.meridiems(),0);case"kkkk":return Un(Ce);case"kk":return Un(Fn,Di);case"W":return Un(qe);case"WW":return Un(J);case"E":case"c":return Un(q);case"EEE":return io(M.weekdays("short",!1),1);case"EEEE":return io(M.weekdays("long",!1),1);case"ccc":return io(M.weekdays("short",!0),1);case"cccc":return io(M.weekdays("long",!0),1);case"Z":case"ZZ":return zl(new RegExp(`([+-]${qe.source})(?::(${J.source}))?`),2);case"ZZZ":return zl(new RegExp(`([+-]${qe.source})(${J.source})?`),2);case"z":return Ro(/[a-z_+-/]{1,256}?/i);case" ":return Ro(/[^\S\n\r]/);default:return An(Qo)}})(W)||{invalidReason:wa};return Jr.token=W,Jr}const sv={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Fl(W,M,q){const{type:J,value:ce}=W;if(J==="literal"){const Xe=/^\s+$/.test(ce);return{literal:!Xe,val:Xe?" ":ce}}const Ce=M[J];let Ne=J;J==="hour"&&(M.hour12!=null?Ne=M.hour12?"hour12":"hour24":M.hourCycle!=null?M.hourCycle==="h11"||M.hourCycle==="h12"?Ne="hour12":Ne="hour24":Ne=q.hour12?"hour12":"hour24");let qe=sv[Ne];if(typeof qe=="object"&&(qe=qe[Ce]),qe)return{literal:!1,val:qe}}function lv(W){return[`^${W.map(M=>M.regex).reduce((M,q)=>`${M}(${q.source})`,"")}$`,W]}function cv(W,M,q){const J=W.match(M);if(J){const ce={};let Ce=1;for(const Ne in q)if(Ft(q,Ne)){const qe=q[Ne],Xe=qe.groups?qe.groups+1:1;!qe.literal&&qe.token&&(ce[qe.token.val[0]]=qe.deser(J.slice(Ce,Ce+Xe))),Ce+=Xe}return[J,ce]}else return[J,{}]}function uv(W){const M=ce=>{switch(ce){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let q=null,J;return We(W.z)||(q=ee.create(W.z)),We(W.Z)||(q||(q=new Rt(W.Z)),J=W.Z),We(W.q)||(W.M=(W.q-1)*3+1),We(W.h)||(W.h<12&&W.a===1?W.h+=12:W.h===12&&W.a===0&&(W.h=0)),W.G===0&&W.y&&(W.y=-W.y),We(W.u)||(W.S=Do(W.u)),[Object.keys(W).reduce((ce,Ce)=>{const Ne=M(Ce);return Ne&&(ce[Ne]=W[Ce]),ce},{}),q,J]}let _h=null;function H1(){return _h||(_h=En.fromMillis(1555555555555)),_h}function V1(W,M){if(W.literal)return W;const q=oo.macroTokenToFormatOpts(W.val),J=qh(q,M);return J==null||J.includes(void 0)?W:J}function Bh(W,M){return Array.prototype.concat(...W.map(q=>V1(q,M)))}class Uh{constructor(M,q){if(this.locale=M,this.format=q,this.tokens=Bh(oo.parseFormat(q),M),this.units=this.tokens.map(J=>Fh(J,M)),this.disqualifyingUnit=this.units.find(J=>J.invalidReason),!this.disqualifyingUnit){const[J,ce]=lv(this.units);this.regex=RegExp(J,"i"),this.handlers=ce}}explainFromTokens(M){if(this.isValid){const[q,J]=cv(M,this.regex,this.handlers),[ce,Ce,Ne]=J?uv(J):[null,null,void 0];if(Ft(J,"a")&&Ft(J,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:M,tokens:this.tokens,regex:this.regex,rawMatches:q,matches:J,result:ce,zone:Ce,specificOffset:Ne}}else return{input:M,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function wf(W,M,q){return new Uh(W,q).explainFromTokens(M)}function oi(W,M,q){const{result:J,zone:ce,specificOffset:Ce,invalidReason:Ne}=wf(W,M,q);return[J,ce,Ce,Ne]}function qh(W,M){if(!W)return null;const q=oo.create(M,W).dtFormatter(H1()),J=q.formatToParts(),ce=q.resolvedOptions();return J.map(Ce=>Fl(Ce,W,ce))}const fa="Invalid DateTime",Ca=864e13;function Ii(W){return new Bn("unsupported zone",`the zone "${W.name}" is not supported`)}function Hu(W){return W.weekData===null&&(W.weekData=Mt(W.c)),W.weekData}function Tc(W){return W.localWeekData===null&&(W.localWeekData=Mt(W.c,W.loc.getMinDaysInFirstWeek(),W.loc.getStartOfWeek())),W.localWeekData}function Li(W,M){const q={ts:W.ts,zone:W.zone,c:W.c,o:W.o,loc:W.loc,invalid:W.invalid};return new En({...q,...M,old:q})}function Sf(W,M,q){let J=W-M*60*1e3;const ce=q.offset(J);if(M===ce)return[J,M];J-=(ce-M)*60*1e3;const Ce=q.offset(J);return ce===Ce?[J,ce]:[W-Math.min(ce,Ce)*60*1e3,Math.max(ce,Ce)]}function Rs(W,M){W+=M*60*1e3;const q=new Date(W);return{year:q.getUTCFullYear(),month:q.getUTCMonth()+1,day:q.getUTCDate(),hour:q.getUTCHours(),minute:q.getUTCMinutes(),second:q.getUTCSeconds(),millisecond:q.getUTCMilliseconds()}}function Vu(W,M,q){return Sf(ti(W),M,q)}function Wu(W,M){const q=W.o,J=W.c.year+Math.trunc(M.years),ce=W.c.month+Math.trunc(M.months)+Math.trunc(M.quarters)*3,Ce={...W.c,year:J,month:ce,day:Math.min(W.c.day,qr(J,ce))+Math.trunc(M.days)+Math.trunc(M.weeks)*7},Ne=Qt.fromObject({years:M.years-Math.trunc(M.years),quarters:M.quarters-Math.trunc(M.quarters),months:M.months-Math.trunc(M.months),weeks:M.weeks-Math.trunc(M.weeks),days:M.days-Math.trunc(M.days),hours:M.hours,minutes:M.minutes,seconds:M.seconds,milliseconds:M.milliseconds}).as("milliseconds"),qe=ti(Ce);let[Xe,At]=Sf(qe,q,W.zone);return Ne!==0&&(Xe+=Ne,At=W.zone.offset(Xe)),{ts:Xe,o:At}}function ai(W,M,q,J,ce,Ce){const{setZone:Ne,zone:qe}=q;if(W&&Object.keys(W).length!==0||M){const Xe=M||qe,At=En.fromObject(W,{...q,zone:Xe,specificOffset:Ce});return Ne?At:At.setZone(qe)}else return En.invalid(new Bn("unparsable",`the input "${ce}" can't be parsed as ${J}`))}function Cf(W,M,q=!0){return W.isValid?oo.create(Oe.create("en-US"),{allowZ:q,forceSimple:!0}).formatDateTimeFromString(W,M):null}function ra(W,M,q){const J=W.c.year>9999||W.c.year<0;let ce="";if(J&&W.c.year>=0&&(ce+="+"),ce+=tn(W.c.year,J?6:4),q==="year")return ce;if(M){if(ce+="-",ce+=tn(W.c.month),q==="month")return ce;ce+="-"}else if(ce+=tn(W.c.month),q==="month")return ce;return ce+=tn(W.c.day),ce}function kf(W,M,q,J,ce,Ce,Ne){let qe=!q||W.c.millisecond!==0||W.c.second!==0,Xe="";switch(Ne){case"day":case"month":case"year":break;default:if(Xe+=tn(W.c.hour),Ne==="hour")break;if(M){if(Xe+=":",Xe+=tn(W.c.minute),Ne==="minute")break;qe&&(Xe+=":",Xe+=tn(W.c.second))}else{if(Xe+=tn(W.c.minute),Ne==="minute")break;qe&&(Xe+=tn(W.c.second))}if(Ne==="second")break;qe&&(!J||W.c.millisecond!==0)&&(Xe+=".",Xe+=tn(W.c.millisecond,3))}return ce&&(W.isOffsetFixed&&W.offset===0&&!Ce?Xe+="Z":W.o<0?(Xe+="-",Xe+=tn(Math.trunc(-W.o/60)),Xe+=":",Xe+=tn(Math.trunc(-W.o%60))):(Xe+="+",Xe+=tn(Math.trunc(W.o/60)),Xe+=":",Xe+=tn(Math.trunc(W.o%60)))),Ce&&(Xe+="["+W.zone.ianaName+"]"),Xe}const zi={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},dv={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},$f={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Fi=["year","month","day","hour","minute","second","millisecond"],Hh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Vh=["year","ordinal","hour","minute","second","millisecond"];function Ts(W){const M={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[W.toLowerCase()];if(!M)throw new a(W);return M}function _l(W){switch(W.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Ts(W)}}function Rf(W){if(ii===void 0&&(ii=mn.now()),W.type!=="iana")return W.offset(ii);const M=W.name;let q=si.get(M);return q===void 0&&(q=W.offset(ii),si.set(M,q)),q}function Yu(W,M){const q=it(M.zone,mn.defaultZone);if(!q.isValid)return En.invalid(Ii(q));const J=Oe.fromObject(M);let ce,Ce;if(We(W.year))ce=mn.now();else{for(const Xe of Fi)We(W[Xe])&&(W[Xe]=zi[Xe]);const Ne=Ue(W)||gt(W);if(Ne)return En.invalid(Ne);const qe=Rf(q);[ce,Ce]=Vu(W,qe,q)}return new En({ts:ce,zone:q,loc:J,o:Ce})}function ka(W,M,q){const J=We(q.round)?!0:q.round,ce=We(q.rounding)?"trunc":q.rounding,Ce=(qe,Xe)=>(qe=vs(qe,J||q.calendary?0:2,q.calendary?"round":ce),M.loc.clone(q).relFormatter(q).format(qe,Xe)),Ne=qe=>q.calendary?M.hasSame(W,qe)?0:M.startOf(qe).diff(W.startOf(qe),qe).get(qe):M.diff(W,qe).get(qe);if(q.unit)return Ce(Ne(q.unit),q.unit);for(const qe of q.units){const Xe=Ne(qe);if(Math.abs(Xe)>=1)return Ce(Xe,qe)}return Ce(W>M?-0:0,q.units[q.units.length-1])}function $a(W){let M={},q;return W.length>0&&typeof W[W.length-1]=="object"?(M=W[W.length-1],q=Array.from(W).slice(0,W.length-1)):q=Array.from(W),[M,q]}let ii;const si=new Map;class En{constructor(M){const q=M.zone||mn.defaultZone;let J=M.invalid||(Number.isNaN(M.ts)?new Bn("invalid input"):null)||(q.isValid?null:Ii(q));this.ts=We(M.ts)?mn.now():M.ts;let ce=null,Ce=null;if(!J)if(M.old&&M.old.ts===this.ts&&M.old.zone.equals(q))[ce,Ce]=[M.old.c,M.old.o];else{const Ne=Nt(M.o)&&!M.old?M.o:q.offset(this.ts);ce=Rs(this.ts,Ne),J=Number.isNaN(ce.year)?new Bn("invalid input"):null,ce=J?null:ce,Ce=J?null:Ne}this._zone=q,this.loc=M.loc||Oe.create(),this.invalid=J,this.weekData=null,this.localWeekData=null,this.c=ce,this.o=Ce,this.isLuxonDateTime=!0}static now(){return new En({})}static local(){const[M,q]=$a(arguments),[J,ce,Ce,Ne,qe,Xe,At]=q;return Yu({year:J,month:ce,day:Ce,hour:Ne,minute:qe,second:Xe,millisecond:At},M)}static utc(){const[M,q]=$a(arguments),[J,ce,Ce,Ne,qe,Xe,At]=q;return M.zone=Rt.utcInstance,Yu({year:J,month:ce,day:Ce,hour:Ne,minute:qe,second:Xe,millisecond:At},M)}static fromJSDate(M,q={}){const J=we(M)?M.valueOf():NaN;if(Number.isNaN(J))return En.invalid("invalid input");const ce=it(q.zone,mn.defaultZone);return ce.isValid?new En({ts:J,zone:ce,loc:Oe.fromObject(q)}):En.invalid(Ii(ce))}static fromMillis(M,q={}){if(Nt(M))return M<-Ca||M>Ca?En.invalid("Timestamp out of range"):new En({ts:M,zone:it(q.zone,mn.defaultZone),loc:Oe.fromObject(q)});throw new i(`fromMillis requires a numerical input, but received a ${typeof M} with value ${M}`)}static fromSeconds(M,q={}){if(Nt(M))return new En({ts:M*1e3,zone:it(q.zone,mn.defaultZone),loc:Oe.fromObject(q)});throw new i("fromSeconds requires a numerical input")}static fromObject(M,q={}){M=M||{};const J=it(q.zone,mn.defaultZone);if(!J.isValid)return En.invalid(Ii(J));const ce=Oe.fromObject(q),Ce=bc(M,_l),{minDaysInFirstWeek:Ne,startOfWeek:qe}=Vt(Ce,ce),Xe=mn.now(),At=We(q.specificOffset)?J.offset(Xe):q.specificOffset,Mn=!We(Ce.ordinal),Fn=!We(Ce.year),pr=!We(Ce.month)||!We(Ce.day),An=Fn||pr,Jr=Ce.weekYear||Ce.weekNumber;if((An||Mn)&&Jr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(pr&&Mn)throw new o("Can't mix ordinal dates with month/day");const Qo=Jr||Ce.weekday&&!An;let Na,Ia,La=Rs(Xe,At);Qo?(Na=Hh,Ia=dv,La=Mt(La,Ne,qe)):Mn?(Na=Vh,Ia=$f,La=Xt(La)):(Na=Fi,Ia=zi);let _i=!1;for(const Ks of Na){const pv=Ce[Ks];We(pv)?_i?Ce[Ks]=Ia[Ks]:Ce[Ks]=La[Ks]:_i=!0}const Wh=Qo?ge(Ce,Ne,qe):Mn?ye(Ce):Ue(Ce),Tf=Wh||gt(Ce);if(Tf)return En.invalid(Tf);const Gu=Qo?Lt(Ce,Ne,qe):Mn?zt(Ce):Ce,[Ef,Bl]=Vu(Gu,At,J),po=new En({ts:Ef,zone:J,o:Bl,loc:ce});return Ce.weekday&&An&&M.weekday!==po.weekday?En.invalid("mismatched weekday",`you can't specify both a weekday of ${Ce.weekday} and a date of ${po.toISO()}`):po.isValid?po:En.invalid(po.invalid)}static fromISO(M,q={}){const[J,ce]=gf(M);return ai(J,ce,q,"ISO 8601",M)}static fromRFC2822(M,q={}){const[J,ce]=yf(M);return ai(J,ce,q,"RFC 2822",M)}static fromHTTP(M,q={}){const[J,ce]=vf(M);return ai(J,ce,q,"HTTP",q)}static fromFormat(M,q,J={}){if(We(M)||We(q))throw new i("fromFormat requires an input string and a format");const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0}),[qe,Xe,At,Mn]=oi(Ne,M,q);return Mn?En.invalid(Mn):ai(qe,Xe,J,`format ${q}`,M,At)}static fromString(M,q,J={}){return En.fromFormat(M,q,J)}static fromSQL(M,q={}){const[J,ce]=Il(M);return ai(J,ce,q,"SQL",M)}static invalid(M,q=null){if(!M)throw new i("need to specify a reason the DateTime is invalid");const J=M instanceof Bn?M:new Bn(M,q);if(mn.throwOnInvalid)throw new t(J);return new En({invalid:J})}static isDateTime(M){return M&&M.isLuxonDateTime||!1}static parseFormatForOpts(M,q={}){const J=qh(M,Oe.fromObject(q));return J?J.map(ce=>ce?ce.val:null).join(""):null}static expandFormat(M,q={}){return Bh(oo.parseFormat(M),Oe.fromObject(q)).map(J=>J.val).join("")}static resetCache(){ii=void 0,si.clear()}get(M){return this[M]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Hu(this).weekYear:NaN}get weekNumber(){return this.isValid?Hu(this).weekNumber:NaN}get weekday(){return this.isValid?Hu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Tc(this).weekday:NaN}get localWeekNumber(){return this.isValid?Tc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Tc(this).weekYear:NaN}get ordinal(){return this.isValid?Xt(this.c).ordinal:NaN}get monthShort(){return this.isValid?br.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?br.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?br.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?br.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const M=864e5,q=6e4,J=ti(this.c),ce=this.zone.offset(J-M),Ce=this.zone.offset(J+M),Ne=this.zone.offset(J-ce*q),qe=this.zone.offset(J-Ce*q);if(Ne===qe)return[this];const Xe=J-Ne*q,At=J-qe*q,Mn=Rs(Xe,Ne),Fn=Rs(At,qe);return Mn.hour===Fn.hour&&Mn.minute===Fn.minute&&Mn.second===Fn.second&&Mn.millisecond===Fn.millisecond?[Li(this,{ts:Xe}),Li(this,{ts:At})]:[this]}get isInLeapYear(){return ca(this.year)}get daysInMonth(){return qr(this.year,this.month)}get daysInYear(){return this.isValid?fr(this.year):NaN}get weeksInWeekYear(){return this.isValid?bs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?bs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(M={}){const{locale:q,numberingSystem:J,calendar:ce}=oo.create(this.loc.clone(M),M).resolvedOptions(this);return{locale:q,numberingSystem:J,outputCalendar:ce}}toUTC(M=0,q={}){return this.setZone(Rt.instance(M),q)}toLocal(){return this.setZone(mn.defaultZone)}setZone(M,{keepLocalTime:q=!1,keepCalendarTime:J=!1}={}){if(M=it(M,mn.defaultZone),M.equals(this.zone))return this;if(M.isValid){let ce=this.ts;if(q||J){const Ce=M.offset(this.ts),Ne=this.toObject();[ce]=Vu(Ne,Ce,M)}return Li(this,{ts:ce,zone:M})}else return En.invalid(Ii(M))}reconfigure({locale:M,numberingSystem:q,outputCalendar:J}={}){const ce=this.loc.clone({locale:M,numberingSystem:q,outputCalendar:J});return Li(this,{loc:ce})}setLocale(M){return this.reconfigure({locale:M})}set(M){if(!this.isValid)return this;const q=bc(M,_l),{minDaysInFirstWeek:J,startOfWeek:ce}=Vt(q,this.loc),Ce=!We(q.weekYear)||!We(q.weekNumber)||!We(q.weekday),Ne=!We(q.ordinal),qe=!We(q.year),Xe=!We(q.month)||!We(q.day),At=qe||Xe,Mn=q.weekYear||q.weekNumber;if((At||Ne)&&Mn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Xe&&Ne)throw new o("Can't mix ordinal dates with month/day");let Fn;Ce?Fn=Lt({...Mt(this.c,J,ce),...q},J,ce):We(q.ordinal)?(Fn={...this.toObject(),...q},We(q.day)&&(Fn.day=Math.min(qr(Fn.year,Fn.month),Fn.day))):Fn=zt({...Xt(this.c),...q});const[pr,An]=Vu(Fn,this.o,this.zone);return Li(this,{ts:pr,o:An})}plus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M);return Li(this,Wu(this,q))}minus(M){if(!this.isValid)return this;const q=Qt.fromDurationLike(M).negate();return Li(this,Wu(this,q))}startOf(M,{useLocaleWeeks:q=!1}={}){if(!this.isValid)return this;const J={},ce=Qt.normalizeUnit(M);switch(ce){case"years":J.month=1;case"quarters":case"months":J.day=1;case"weeks":case"days":J.hour=0;case"hours":J.minute=0;case"minutes":J.second=0;case"seconds":J.millisecond=0;break}if(ce==="weeks")if(q){const Ce=this.loc.getStartOfWeek(),{weekday:Ne}=this;Ne<Ce&&(J.weekNumber=this.weekNumber-1),J.weekday=Ce}else J.weekday=1;if(ce==="quarters"){const Ce=Math.ceil(this.month/3);J.month=(Ce-1)*3+1}return this.set(J)}endOf(M,q){return this.isValid?this.plus({[M]:1}).startOf(M,q).minus(1):this}toFormat(M,q={}){return this.isValid?oo.create(this.loc.redefaultToEN(q)).formatDateTimeFromString(this,M):fa}toLocaleString(M=m,q={}){return this.isValid?oo.create(this.loc.clone(q),M).formatDateTime(this):fa}toLocaleParts(M={}){return this.isValid?oo.create(this.loc.clone(M),M).formatDateTimeParts(this):[]}toISO({format:M="extended",suppressSeconds:q=!1,suppressMilliseconds:J=!1,includeOffset:ce=!0,extendedZone:Ce=!1,precision:Ne="milliseconds"}={}){if(!this.isValid)return null;Ne=Ts(Ne);const qe=M==="extended";let Xe=ra(this,qe,Ne);return Fi.indexOf(Ne)>=3&&(Xe+="T"),Xe+=kf(this,qe,q,J,ce,Ce,Ne),Xe}toISODate({format:M="extended",precision:q="day"}={}){return this.isValid?ra(this,M==="extended",Ts(q)):null}toISOWeekDate(){return Cf(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:M=!1,suppressSeconds:q=!1,includeOffset:J=!0,includePrefix:ce=!1,extendedZone:Ce=!1,format:Ne="extended",precision:qe="milliseconds"}={}){return this.isValid?(qe=Ts(qe),(ce&&Fi.indexOf(qe)>=3?"T":"")+kf(this,Ne==="extended",q,M,J,Ce,qe)):null}toRFC2822(){return Cf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Cf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ra(this,!0):null}toSQLTime({includeOffset:M=!0,includeZone:q=!1,includeOffsetSpace:J=!0}={}){let ce="HH:mm:ss.SSS";return(q||M)&&(J&&(ce+=" "),q?ce+="z":M&&(ce+="ZZ")),Cf(this,ce,!0)}toSQL(M={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(M)}`:null}toString(){return this.isValid?this.toISO():fa}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(M={}){if(!this.isValid)return{};const q={...this.c};return M.includeConfig&&(q.outputCalendar=this.outputCalendar,q.numberingSystem=this.loc.numberingSystem,q.locale=this.loc.locale),q}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(M,q="milliseconds",J={}){if(!this.isValid||!M.isValid)return Qt.invalid("created by diffing an invalid DateTime");const ce={locale:this.locale,numberingSystem:this.numberingSystem,...J},Ce=kt(q).map(Qt.normalizeUnit),Ne=M.valueOf()>this.valueOf(),qe=Ne?this:M,Xe=Ne?M:this,At=ri(qe,Xe,Ce,ce);return Ne?At.negate():At}diffNow(M="milliseconds",q={}){return this.diff(En.now(),M,q)}until(M){return this.isValid?xn.fromDateTimes(this,M):this}hasSame(M,q,J){if(!this.isValid)return!1;const ce=M.valueOf(),Ce=this.setZone(M.zone,{keepLocalTime:!0});return Ce.startOf(q,J)<=ce&&ce<=Ce.endOf(q,J)}equals(M){return this.isValid&&M.isValid&&this.valueOf()===M.valueOf()&&this.zone.equals(M.zone)&&this.loc.equals(M.loc)}toRelative(M={}){if(!this.isValid)return null;const q=M.base||En.fromObject({},{zone:this.zone}),J=M.padding?this<q?-M.padding:M.padding:0;let ce=["years","months","days","hours","minutes","seconds"],Ce=M.unit;return Array.isArray(M.unit)&&(ce=M.unit,Ce=void 0),ka(q,this.plus(J),{...M,numeric:"always",units:ce,unit:Ce})}toRelativeCalendar(M={}){return this.isValid?ka(M.base||En.fromObject({},{zone:this.zone}),this,{...M,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...M){if(!M.every(En.isDateTime))throw new i("min requires all arguments be DateTimes");return Ot(M,q=>q.valueOf(),Math.min)}static max(...M){if(!M.every(En.isDateTime))throw new i("max requires all arguments be DateTimes");return Ot(M,q=>q.valueOf(),Math.max)}static fromFormatExplain(M,q,J={}){const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});return wf(Ne,M,q)}static fromStringExplain(M,q,J={}){return En.fromFormatExplain(M,q,J)}static buildFormatParser(M,q={}){const{locale:J=null,numberingSystem:ce=null}=q,Ce=Oe.fromOpts({locale:J,numberingSystem:ce,defaultToEN:!0});return new Uh(Ce,M)}static fromFormatParser(M,q,J={}){if(We(M)||We(q))throw new i("fromFormatParser requires an input string and a format parser");const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});if(!Ne.equals(q.locale))throw new i(`fromFormatParser called with a locale of ${Ne}, but the format parser was created for ${q.locale}`);const{result:qe,zone:Xe,specificOffset:At,invalidReason:Mn}=q.explainFromTokens(M);return Mn?En.invalid(Mn):ai(qe,Xe,J,`format ${q.format}`,M,At)}static get DATE_SHORT(){return m}static get DATE_MED(){return g}static get DATE_MED_WITH_WEEKDAY(){return y}static get DATE_FULL(){return x}static get DATE_HUGE(){return w}static get TIME_SIMPLE(){return S}static get TIME_WITH_SECONDS(){return b}static get TIME_WITH_SHORT_OFFSET(){return $}static get TIME_WITH_LONG_OFFSET(){return k}static get TIME_24_SIMPLE(){return T}static get TIME_24_WITH_SECONDS(){return O}static get TIME_24_WITH_SHORT_OFFSET(){return P}static get TIME_24_WITH_LONG_OFFSET(){return D}static get DATETIME_SHORT(){return A}static get DATETIME_SHORT_WITH_SECONDS(){return F}static get DATETIME_MED(){return L}static get DATETIME_MED_WITH_SECONDS(){return _}static get DATETIME_MED_WITH_WEEKDAY(){return R}static get DATETIME_FULL(){return z}static get DATETIME_FULL_WITH_SECONDS(){return N}static get DATETIME_HUGE(){return B}static get DATETIME_HUGE_WITH_SECONDS(){return I}}function li(W){if(En.isDateTime(W))return W;if(W&&W.valueOf&&Nt(W.valueOf()))return En.fromJSDate(W);if(W&&typeof W=="object")return En.fromObject(W);throw new i(`Unknown datetime argument: ${W}, of type ${typeof W}`)}const fv="3.7.2";return Ba.DateTime=En,Ba.Duration=Qt,Ba.FixedOffsetZone=Rt,Ba.IANAZone=ee,Ba.Info=br,Ba.Interval=xn,Ba.InvalidZone=vt,Ba.Settings=mn,Ba.SystemZone=ae,Ba.VERSION=fv,Ba.Zone=H,Ba}var kI;function iT(){return kI||(kI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=Ewe();var n;(function(a){a.Second="Second",a.Minute="Minute",a.Hour="Hour",a.Day="Day",a.Month="Month",a.Year="Year"})(n||(e.TimeUnit=n={}));var r;(function(a){a.Add="Add",a.Subtract="Subtract"})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);class o{#e;#t=null;#n=null;constructor(i,s){const l={zone:s};if(i?i instanceof o?(this.#e=i.#e,this.#t=i.#t,this.#n=i.#n):i instanceof Date?this.#e=t.DateTime.fromJSDate(i,l):typeof i=="number"?this.#e=t.DateTime.fromMillis(i,l):(this.#e=t.DateTime.fromISO(i,l),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(i,"EEE, d MMM yyyy HH:mm:ss",l))):this.#e=t.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${i}`);s&&s!==this.#e.zoneName&&(this.#e=this.#e.setZone(s))}static#o(i){return i%4===0&&i%100!==0||i%400===0}get dstStart(){return this.#t}set dstStart(i){this.#t=i}get dstEnd(){return this.#n}set dstEnd(i){this.#n=i}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(i){switch(i){case n.Year:return this.addYear();case n.Month:return this.addMonth();case n.Day:return this.addDay();case n.Hour:return this.addHour();case n.Minute:return this.addMinute();case n.Second:return this.addSecond()}}subtractUnit(i){switch(i){case n.Year:return this.subtractYear();case n.Month:return this.subtractMonth();case n.Day:return this.subtractDay();case n.Hour:return this.subtractHour();case n.Minute:return this.subtractMinute();case n.Second:return this.subtractSecond()}}invokeDateOperation(i,s){if(i===r.Add){this.addUnit(s);return}if(i===r.Subtract){this.subtractUnit(s);return}throw new Error(`Invalid verb: ${i}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){const i=this.#e.weekday;return i===7?0:i}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#r().day}getUTCFullYear(){return this.#r().year}getUTCDay(){const i=this.#r().weekday;return i===7?0:i}getUTCMonth(){return this.#r().month-1}getUTCHours(){return this.#r().hour}getUTCMinutes(){return this.#r().minute}getUTCSeconds(){return this.#r().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(i){this.#e=this.#e.set({day:i})}setFullYear(i){this.#e=this.#e.set({year:i})}setDay(i){this.#e=this.#e.set({weekday:i})}setMonth(i){this.#e=this.#e.set({month:i+1})}setHours(i){this.#e=this.#e.set({hour:i})}setMinutes(i){this.#e=this.#e.set({minute:i})}setSeconds(i){this.#e=this.#e.set({second:i})}setMilliseconds(i){this.#e=this.#e.set({millisecond:i})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){const{day:i,month:s}=this.#e;if(s===2){const l=o.#o(this.#e.year);return i===e.DAYS_IN_MONTH[s-1]-(l?0:1)}return i===e.DAYS_IN_MONTH[s-1]}isLastWeekdayOfMonth(){const{day:i,month:s}=this.#e;let l;return s===2?l=e.DAYS_IN_MONTH[s-1]-(o.#o(this.#e.year)?0:1):l=e.DAYS_IN_MONTH[s-1],i>l-7}applyDateOperation(i,s,l){if(s===n.Month||s===n.Day){this.invokeDateOperation(i,s);return}const d=this.getHours();this.invokeDateOperation(i,s);const u=this.getHours(),m=u-d;m===2?l!==24&&(this.dstStart=d+1):m===0&&this.getMinutes()===0&&this.getSeconds()===0&&l!==24&&(this.dstEnd=u)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(SI)),SI}var $I;function Mwe(){if($I)return fg;$I=1,Object.defineProperty(fg,"__esModule",{value:!0}),fg.CronMonth=void 0;const e=iT(),t=rf(),n=1,r=12,o=Object.freeze([]);let a=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return o}static get daysInMonth(){return e.DAYS_IN_MONTH}constructor(i,s){super(i,s),this.validate()}get values(){return super.values}};return fg.CronMonth=a,fg}var pg={},RI;function Owe(){if(RI)return pg;RI=1,Object.defineProperty(pg,"__esModule",{value:!0}),pg.CronSecond=void 0;const e=rf(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return pg.CronSecond=o,pg}var TI;function sT(){return TI||(TI=1,(function(e){var t=pp&&pp.__createBinding||(Object.create?(function(r,o,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(o,a);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,i,s)}):(function(r,o,a,i){i===void 0&&(i=a),r[i]=o[a]})),n=pp&&pp.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,r,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(Cwe(),e),n(kwe(),e),n($we(),e),n(rf(),e),n(Rwe(),e),n(Twe(),e),n(Mwe(),e),n(Owe(),e)})(pp)),pp}var EI;function d6(){if(EI)return ig;EI=1,Object.defineProperty(ig,"__esModule",{value:!0}),ig.CronFieldCollection=void 0;const e=sT();let t=class Pg{#e;#t;#n;#o;#r;#a;static from(r,o){return new Pg({second:this.resolveField(e.CronSecond,r.second,o.second),minute:this.resolveField(e.CronMinute,r.minute,o.minute),hour:this.resolveField(e.CronHour,r.hour,o.hour),dayOfMonth:this.resolveField(e.CronDayOfMonth,r.dayOfMonth,o.dayOfMonth),month:this.resolveField(e.CronMonth,r.month,o.month),dayOfWeek:this.resolveField(e.CronDayOfWeek,r.dayOfWeek,o.dayOfWeek)})}static resolveField(r,o,a){return a?a instanceof e.CronField?a:new r(a):o}constructor({second:r,minute:o,hour:a,dayOfMonth:i,month:s,dayOfWeek:l}){if(!r)throw new Error("Validation error, Field second is missing");if(!o)throw new Error("Validation error, Field minute is missing");if(!a)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!s)throw new Error("Validation error, Field month is missing");if(!l)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&l.isWildcard&&!(parseInt(i.values[0],10)<=e.CronMonth.daysInMonth[s.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=r,this.#t=o,this.#n=a,this.#r=s,this.#a=l,this.#o=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#o}get month(){return this.#r}get dayOfWeek(){return this.#a}static compactField(r){if(r.length===0)return[];const o=[];let a;return r.forEach((i,s,l)=>{if(a===void 0){a={start:i,count:1};return}const d=l[s-1]||a.start,u=l[s+1];if(i==="L"||i==="W"){o.push(a),o.push({start:i,count:1}),a=void 0;return}if(a.step===void 0&&u!==void 0){const m=i-d,g=u-i;if(m<=g){a={...a,count:2,end:i,step:m};return}a.step=1}i-(a.end??0)===a.step?(a.count++,a.end=i):(a.count===1?o.push({start:a.start,count:1}):a.count===2?(o.push({start:a.start,count:1}),o.push({start:a.end??d,count:1})):o.push(a),a={start:i,count:1})}),a&&o.push(a),o}static#s(r,o,a){const i=o.step;return i?i===1&&o.start===r.min&&o.end&&o.end>=a?r.hasQuestionMarkChar?"?":"*":i!==1&&o.start===r.min&&o.end&&o.end>=a-i+1?`*/${i}`:null:null}static#i(r,o){const a=r.step;if(a===1)return`${r.start}-${r.end}`;const i=r.start===0?r.count-1:r.count;if(!a)throw new Error("Unexpected range step");if(!r.end)throw new Error("Unexpected range end");if(a*i>r.end){const s=(d,u)=>{if(typeof r.start!="number")throw new Error("Unexpected range start");return u%a===0?r.start+u:null};if(typeof r.start!="number")throw new Error("Unexpected range start");const l={length:r.end-r.start+1};return Array.from(l,s).filter(d=>d!==null).join(",")}return r.end===o-a+1?`${r.start}/${a}`:`${r.start}-${r.end}/${a}`}stringifyField(r){let o=r.max,a=r.values;if(r instanceof e.CronDayOfWeek){o=6;const s=this.#a.values;a=s[s.length-1]===7?s.slice(0,-1):s}r instanceof e.CronDayOfMonth&&(o=this.#r.values.length===1?e.CronMonth.daysInMonth[this.#r.values[0]-1]:r.max);const i=Pg.compactField(a);if(i.length===1){const s=Pg.#s(r,i[0],o);if(s)return s}return i.map(s=>{const l=s.count===1?s.start.toString():Pg.#i(s,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${l}#${r.nthDay}`:l}).join(",")}stringify(r=!1){const o=[];return r&&o.push(this.stringifyField(this.#e)),o.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#o),this.stringifyField(this.#r),this.stringifyField(this.#a)),o.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#o.serialize(),month:this.#r.serialize(),dayOfWeek:this.#a.serialize()}}};return ig.CronFieldCollection=t,ig}var MI={},OI;function f6(){return OI||(OI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpression=e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;const t=iT();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range",e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";const n=1e4;class r{#e;#t;#n;#o;#r;#a;#s=null;#i=!1;constructor(a,i){this.#e=i,this.#t=i.tz,this.#o=i.startDate?new t.CronDate(i.startDate,this.#t):null,this.#r=i.endDate?new t.CronDate(i.endDate,this.#t):null;let s=i.currentDate??i.startDate;if(s){const l=new t.CronDate(s,this.#t);this.#o&&l.getTime()<this.#o.getTime()?s=this.#o:this.#r&&l.getTime()>this.#r.getTime()&&(s=this.#r)}this.#n=new t.CronDate(s,this.#t),this.#a=a}get fields(){return this.#a}static fieldsToExpression(a,i){return new r(a,i||{})}static#c(a,i){return i.some(s=>s===a)}#l(a,i){return a[i?a.length-1:0]}#d(a){const i=`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`;if(this.#s===i)return this.#i;const s=new t.CronDate(a);s.setStartOfDay();const l=new t.CronDate(a);return l.setEndOfDay(),this.#s=i,this.#i=s.getUTCOffset()!==l.getUTCOffset(),this.#i}#u(a,i,s){const l=this.#a.second.values,d=a.getSeconds(),u=this.#a.second.findNearestValue(d,s);if(u!==null){a.setSeconds(u);return}a.applyDateOperation(i,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(l,s))}#p(a,i,s){const l=this.#a.minute.values,d=this.#a.second.values,u=a.getMinutes(),m=this.#a.minute.findNearestValue(u,s);if(m!==null){a.setMinutes(m),a.setSeconds(this.#l(d,s));return}a.applyDateOperation(i,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(l,s)),a.setSeconds(this.#l(d,s))}static#f(a,i){const s=i.isLastWeekdayOfMonth();return a.some(l=>{const d=parseInt(l.toString().charAt(0),10)%7;if(Number.isNaN(d))throw new Error(`Invalid last weekday of the month expression: ${l}`);return i.getDay()===d&&s})}next(){return this.#h()}prev(){return this.#h(!0)}hasNext(){const a=this.#n;try{return this.#h(),!0}catch{return!1}finally{this.#n=a}}hasPrev(){const a=this.#n;try{return this.#h(!0),!0}catch{return!1}finally{this.#n=a}}take(a){const i=[];if(a>=0)for(let s=0;s<a;s++)try{i.push(this.next())}catch{return i}else for(let s=0;s>a;s--)try{i.push(this.prev())}catch{return i}return i}reset(a){this.#n=new t.CronDate(a||this.#e.currentDate,this.#t)}stringify(a=!1){return this.#a.stringify(a)}includesDate(a){const{second:i,minute:s,hour:l,month:d}=this.#a,u=new t.CronDate(a,this.#t);return!(!i.values.includes(u.getSeconds())||!s.values.includes(u.getMinutes())||!l.values.includes(u.getHours())||!d.values.includes(u.getMonth()+1)||!this.#m(u)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(u.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(a){const i=this.#a.dayOfMonth.isWildcard,s=!i,l=this.#a.dayOfWeek.isWildcard,d=!l,u=r.#c(a.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&a.isLastDayOfMonth(),m=r.#c(a.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#f(this.#a.dayOfWeek.values,a);return!!(s&&d&&(u||m)||u&&!d||i&&!l&&m)}#g(a,i,s){const l=this.#a.hour.values,d=l,u=a.getHours(),m=r.#c(u,l),g=a.dstEnd===u;if(a.dstStart!==null&&a.dstStart===u-1&&r.#c(a.dstStart,l))return!0;if(g&&!s)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,d.length),!1;if(m)return!0;a.dstStart=null;const y=this.#a.hour.findNearestValue(u,s);if(y===null)return a.applyDateOperation(i,t.TimeUnit.Day,d.length),!1;if(this.#d(a)){const x=s?u-y:y-u;for(let w=0;w<x&&(a.applyDateOperation(i,t.TimeUnit.Hour,d.length),!(!s&&a.getHours()>=y||s&&a.getHours()<=y));w++);}else a.setHours(y);return a.setMinutes(this.#l(this.#a.minute.values,s)),a.setSeconds(this.#l(this.#a.second.values,s)),!1}#y(a){if(!this.#o&&!this.#r)return;const i=a.getTime();if(this.#o&&i<this.#o.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#r&&i>this.#r.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#h(a=!1){const i=a?t.DateMathOp.Subtract:t.DateMathOp.Add,s=new t.CronDate(this.#n),l=s.getTime();let d=0;for(;++d<n;){if(this.#y(s),!this.#m(s)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(s.getDate()/7)===this.#a.dayOfWeek.nthDay)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(s.getMonth()+1,this.#a.month.values)){s.applyDateOperation(i,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#g(s,i,a)){if(!r.#c(s.getMinutes(),this.#a.minute.values)){this.#p(s,i,a);continue}if(!r.#c(s.getSeconds(),this.#a.second.values)){this.#u(s,i,a);continue}if(l===s.getTime()){(i==="Add"||s.getMilliseconds()===0)&&s.applyDateOperation(i,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(d>n)throw new Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return s.getMilliseconds()!==0&&s.setMilliseconds(0),this.#n=s,s}[Symbol.iterator](){return{next:()=>{try{return{value:this.#h(),done:!1}}catch{return{value:void 0,done:!0}}}}}}e.CronExpression=r,e.default=r})(MI)),MI}var Ub={},PI;function Pwe(){if(PI)return Ub;PI=1,Object.defineProperty(Ub,"__esModule",{value:!0}),Ub.seededRandom=n;function e(r){let o=2166136261;for(let a=0;a<r.length;a++)o^=r.charCodeAt(a),o=Math.imul(o,16777619);return()=>o>>>0}function t(r){return()=>{let o=r+=1831565813;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296}}function n(r){const o=r?e(r)():Math.floor(Math.random()*1e10);return t(o)}return Ub}var jI;function $$(){if(jI)return hi;jI=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.CronExpressionParser=hi.DayOfWeek=hi.Months=hi.CronUnit=hi.PredefinedExpressions=void 0;const e=d6(),t=f6(),n=Pwe(),r=sT();var o;(function(d){d["@yearly"]="0 0 0 1 1 *",d["@annually"]="0 0 0 1 1 *",d["@monthly"]="0 0 0 1 * *",d["@weekly"]="0 0 0 * * 0",d["@daily"]="0 0 0 * * *",d["@hourly"]="0 0 * * * *",d["@minutely"]="0 * * * * *",d["@secondly"]="* * * * * *",d["@weekdays"]="0 0 0 * * 1-5",d["@weekends"]="0 0 0 * * 0,6"})(o||(hi.PredefinedExpressions=o={}));var a;(function(d){d.Second="Second",d.Minute="Minute",d.Hour="Hour",d.DayOfMonth="DayOfMonth",d.Month="Month",d.DayOfWeek="DayOfWeek"})(a||(hi.CronUnit=a={}));var i;(function(d){d[d.jan=1]="jan",d[d.feb=2]="feb",d[d.mar=3]="mar",d[d.apr=4]="apr",d[d.may=5]="may",d[d.jun=6]="jun",d[d.jul=7]="jul",d[d.aug=8]="aug",d[d.sep=9]="sep",d[d.oct=10]="oct",d[d.nov=11]="nov",d[d.dec=12]="dec"})(i||(hi.Months=i={}));var s;(function(d){d[d.sun=0]="sun",d[d.mon=1]="mon",d[d.tue=2]="tue",d[d.wed=3]="wed",d[d.thu=4]="thu",d[d.fri=5]="fri",d[d.sat=6]="sat"})(s||(hi.DayOfWeek=s={}));let l=class mi{static parse(u,m={}){const{strict:g=!1,hashSeed:y}=m,x=(0,n.seededRandom)(y);u=o[u]||u;const w=mi.#e(u,g);if(!(w.dayOfMonth==="*"||w.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const S=mi.#t(a.Second,w.second,r.CronSecond.constraints,x),b=mi.#t(a.Minute,w.minute,r.CronMinute.constraints,x),$=mi.#t(a.Hour,w.hour,r.CronHour.constraints,x),k=mi.#t(a.Month,w.month,r.CronMonth.constraints,x),T=mi.#t(a.DayOfMonth,w.dayOfMonth,r.CronDayOfMonth.constraints,x),{dayOfWeek:O,nthDayOfWeek:P}=mi.#d(w.dayOfWeek),D=mi.#t(a.DayOfWeek,O,r.CronDayOfWeek.constraints,x),A=new e.CronFieldCollection({second:new r.CronSecond(S,{rawValue:w.second}),minute:new r.CronMinute(b,{rawValue:w.minute}),hour:new r.CronHour($,{rawValue:w.hour}),dayOfMonth:new r.CronDayOfMonth(T,{rawValue:w.dayOfMonth}),month:new r.CronMonth(k,{rawValue:w.month}),dayOfWeek:new r.CronDayOfWeek(D,{rawValue:w.dayOfWeek,nthDayOfWeek:P})});return new t.CronExpression(A,{...m,expression:u})}static#e(u,m){if(m&&!u.length)throw new Error("Invalid cron expression");u=u||"0 * * * * *";const g=u.trim().split(/\s+/);if(m&&g.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(g.length>6)throw new Error("Invalid cron expression, too many fields");const y=["*","*","*","*","*","0"];g.length<y.length&&g.unshift(...y.slice(g.length));const[x,w,S,b,$,k]=g;return{second:x,minute:w,hour:S,dayOfMonth:b,month:$,dayOfWeek:k}}static#t(u,m,g,y){if((u===a.Month||u===a.DayOfWeek)&&(m=m.replace(/[a-z]{3}/gi,x=>{x=x.toLowerCase();const w=i[x]||s[x];if(w===void 0)throw new Error(`Validation error, cannot resolve alias "${x}"`);return w.toString()})),!g.validChars.test(m))throw new Error(`Invalid characters, got value: ${m}`);return m=this.#n(m,g),m=this.#o(m,g,y),this.#r(u,m,g)}static#n(u,m){return u.replace(/[*?]/g,m.min+"-"+m.max)}static#o(u,m,g){const y=g();return u.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(x,w,S,b)=>{if(w&&S&&b){const $=parseInt(w,10),k=parseInt(S,10),T=parseInt(b,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);if(T<=0)throw new Error(`Invalid step: ${T}, must be positive`);const O=Math.max($,m.min),P=Math.floor(y*T),D=[];for(let A=Math.floor(O/T)*T+P;A<=k;A+=T)A>=O&&D.push(A);return D.join(",")}else if(w&&S){const $=parseInt(w,10),k=parseInt(S,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);return String(Math.floor(y*(k-$+1))+$)}else if(b){const $=parseInt(b,10);if($<=0)throw new Error(`Invalid step: ${$}, must be positive`);const k=Math.floor(y*$),T=[];for(let O=Math.floor(m.min/$)*$+k;O<=m.max;O+=$)O>=m.min&&T.push(O);return T.join(",")}else return String(Math.floor(y*(m.max-m.min+1)+m.min))})}static#r(u,m,g){const y=[];function x(w,S){if(Array.isArray(w))y.push(...w);else if(mi.#u(S,w))y.push(w);else{const b=parseInt(w.toString(),10);if(!(b>=S.min&&b<=S.max))throw new Error(`Constraint error, got value ${w} expected range ${S.min}-${S.max}`);y.push(u===a.DayOfWeek?b%7:w)}}return m.split(",").forEach(w=>{if(!(w.length>0))throw new Error("Invalid list value format");x(mi.#a(u,w,g),g)}),y}static#a(u,m,g){const y=m.split("/");if(y.length>2)throw new Error(`Invalid repeat: ${m}`);return y.length===2?(y[0].includes("-")||(y[0]=`${y[0]}-${g.max}`),mi.#l(u,y[0],parseInt(y[1],10),g)):mi.#l(u,m,1,g)}static#s(u,m,g){if(!(!isNaN(u)&&!isNaN(m)&&u>=g.min&&m<=g.max))throw new Error(`Constraint error, got range ${u}-${m} expected range ${g.min}-${g.max}`);if(u>m)throw new Error(`Invalid range: ${u}-${m}, min(${u}) > max(${m})`)}static#i(u){if(!(!isNaN(u)&&u>0))throw new Error(`Constraint error, cannot repeat at every ${u} time.`)}static#c(u,m,g,y){const x=[];u===a.DayOfWeek&&g%7===0&&x.push(0);for(let w=m;w<=g;w+=y)x.indexOf(w)===-1&&x.push(w);return x}static#l(u,m,g,y){const x=m.split("-");if(x.length<=1)return isNaN(+m)?m:+m;const[w,S]=x.map(b=>parseInt(b,10));return this.#s(w,S,y),this.#i(g),this.#c(u,w,S,g)}static#d(u){const m=u.split("#");if(m.length<=1)return{dayOfWeek:m[0]};const g=+m[m.length-1],y=u.match(/([,-/])/);if(y!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${y?.[0]}\` special characters are incompatible`);if(!(m.length<=2&&!isNaN(g)&&g>=1&&g<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:m[0],nthDayOfWeek:g}}static#u(u,m){return u.chars.some(g=>m.toString().includes(g))}};return hi.CronExpressionParser=l,hi}var As={};const jwe={},Awe=Object.freeze(Object.defineProperty({__proto__:null,default:jwe},Symbol.toStringTag,{value:"Module"})),AI=Eae(Awe);var DI;function Dwe(){if(DI)return As;DI=1;var e=As&&As.__createBinding||(Object.create?(function(a,i,s,l){l===void 0&&(l=s);var d=Object.getOwnPropertyDescriptor(i,s);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(a,l,d)}):(function(a,i,s,l){l===void 0&&(l=s),a[l]=i[s]})),t=As&&As.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=As&&As.__importStar||(function(){var a=function(i){return a=Object.getOwnPropertyNames||function(s){var l=[];for(var d in s)Object.prototype.hasOwnProperty.call(s,d)&&(l[l.length]=d);return l},a(i)};return function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var l=a(i),d=0;d<l.length;d++)l[d]!=="default"&&e(s,i,l[d]);return t(s,i),s}})();Object.defineProperty(As,"__esModule",{value:!0}),As.CronFileParser=void 0;const r=$$();let o=class y0{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(AI)),l=await s(i,"utf8");return y0.#e(l)}static parseFileSync(i){const{readFileSync:s}=AI,l=s(i,"utf8");return y0.#e(l)}static#e(i){const s=i.split(`
481
+ `),l={variables:{},expressions:[],errors:{}};for(const d of s){const u=d.trim();if(u.length===0||u.startsWith("#"))continue;const m=u.match(/^(.*)=(.*)$/);if(m){const[,g,y]=m;l.variables[g]=y.replace(/["']/g,"");continue}try{const g=y0.#t(u);l.expressions.push(g.interval)}catch(g){l.errors[u]=g}}return l}static#t(i){const s=i.split(" ");return{interval:r.CronExpressionParser.parse(s.slice(0,5).join(" ")),command:s.slice(5,s.length)}}};return As.CronFileParser=o,As}var NI;function Nwe(){return NI||(NI=1,(function(e){var t=fp&&fp.__createBinding||(Object.create?(function(d,u,m,g){g===void 0&&(g=m);var y=Object.getOwnPropertyDescriptor(u,m);(!y||("get"in y?!u.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return u[m]}}),Object.defineProperty(d,g,y)}):(function(d,u,m,g){g===void 0&&(g=m),d[g]=u[m]})),n=fp&&fp.__exportStar||function(d,u){for(var m in d)m!=="default"&&!Object.prototype.hasOwnProperty.call(u,m)&&t(u,d,m)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;const r=$$();var o=iT();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=d6();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var i=f6();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return i.CronExpression}});var s=$$();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var l=Dwe();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return l.CronFileParser}}),n(sT(),e),e.default=r.CronExpressionParser})(fp)),fp}var Iwe=Nwe(),II={exports:{}},LI;function Lwe(){return LI||(LI=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,()=>(()=>{var n={949:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var d=l(515),u=(function(){function m(g,y,x){y===void 0&&(y=!0),x===void 0&&(x=!1),this.expression=g,this.dayOfWeekStartIndexZero=y,this.monthStartIndexZero=x}return m.prototype.parse=function(){var g,y,x=(g=this.expression)!==null&&g!==void 0?g:"";if(x==="@reboot")return y=["@reboot","","","","","",""],y;if(x.startsWith("@")){var w=this.parseSpecial(this.expression);y=this.extractParts(w)}else y=this.extractParts(this.expression);return this.normalize(y),this.validate(y),y},m.prototype.parseSpecial=function(g){var y={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},x=y[g];if(!x)throw new Error("Unknown special expression.");return x},m.prototype.extractParts=function(g){if(!this.expression)throw new Error("cron expression is empty");for(var y=g.trim().split(/[ ]+/),x=0;x<y.length;x++)if(y[x].includes(",")){var w=y[x].split(",").map(function(b){return b.trim()}).filter(function(b){return b!==""}).map(function(b){return isNaN(Number(b))?b:Number(b)}).filter(function(b){return b!==null&&b!==""});w.length===0&&w.push("*"),w.sort(function(b,$){return b!==null&&$!==null?b-$:0}),y[x]=w.map(function(b){return b!==null?b.toString():""}).join(",")}if(y.length<5)throw new Error("Expression has only ".concat(y.length," part").concat(y.length==1?"":"s",". At least 5 parts are required."));if(y.length==5)y.unshift(""),y.push("");else if(y.length==6){var S=/\d{4}$/.test(y[5])||y[4]=="?"||y[2]=="?";S?y.unshift(""):y.push("")}else if(y.length>7)throw new Error("Expression has ".concat(y.length," parts; too many!"));return y},m.prototype.normalize=function(g){var y=this;if(g[3]=g[3].replace("?","*"),g[5]=g[5].replace("?","*"),g[2]=g[2].replace("?","*"),g[0].indexOf("0/")==0&&(g[0]=g[0].replace("0/","*/")),g[1].indexOf("0/")==0&&(g[1]=g[1].replace("0/","*/")),g[2].indexOf("0/")==0&&(g[2]=g[2].replace("0/","*/")),g[3].indexOf("1/")==0&&(g[3]=g[3].replace("1/","*/")),g[4].indexOf("1/")==0&&(g[4]=g[4].replace("1/","*/")),g[6].indexOf("1/")==0&&(g[6]=g[6].replace("1/","*/")),g[5]=g[5].replace(/(^\d)|([^#/\s]\d)/g,function(O){var P=O.replace(/\D/,""),D=P;return y.dayOfWeekStartIndexZero?P=="7"&&(D="0"):D=(parseInt(P)-1).toString(),O.replace(P,D)}),g[5]=="L"&&(g[5]="6"),g[3]=="?"&&(g[3]="*"),g[3].indexOf("W")>-1&&(g[3].indexOf(",")>-1||g[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var x={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var w in x)g[5]=g[5].replace(new RegExp(w,"gi"),x[w].toString());g[4]=g[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(O){var P=O.replace(/\D/,""),D=P;return y.monthStartIndexZero&&(D=(parseInt(P)+1).toString()),O.replace(P,D)});var S={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var b in S)g[4]=g[4].replace(new RegExp(b,"gi"),S[b].toString());g[0]=="0"&&(g[0]=""),!/\*|\-|\,|\//.test(g[2])&&(/\*|\//.test(g[1])||/\*|\//.test(g[0]))&&(g[2]+="-".concat(g[2]));for(var $=0;$<g.length;$++)if(g[$].indexOf(",")!=-1&&(g[$]=g[$].split(",").filter(function(O){return O!==""}).join(",")||"*"),g[$]=="*/1"&&(g[$]="*"),g[$].indexOf("/")>-1&&!/^\*|\-|\,/.test(g[$])){var k=null;switch($){case 4:k="12";break;case 5:k="6";break;case 6:k="9999";break;default:k=null;break}if(k!==null){var T=g[$].split("/");g[$]="".concat(T[0],"-").concat(k,"/").concat(T[1])}}},m.prototype.validate=function(g){var y="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(g[0],y),this.validateOnlyExpectedCharactersFound(g[1],y),this.validateOnlyExpectedCharactersFound(g[2],y),this.validateOnlyExpectedCharactersFound(g[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(g[4],y),this.validateOnlyExpectedCharactersFound(g[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(g[6],y),this.validateAnyRanges(g)},m.prototype.validateAnyRanges=function(g){d.default.secondRange(g[0]),d.default.minuteRange(g[1]),d.default.hourRange(g[2]),d.default.dayOfMonthRange(g[3]),d.default.monthRange(g[4],this.monthStartIndexZero),d.default.dayOfWeekRange(g[5],this.dayOfWeekStartIndexZero)},m.prototype.validateOnlyExpectedCharactersFound=function(g,y){var x=g.match(new RegExp("[^".concat(y,"]+"),"gi"));if(x&&x.length)throw new Error("Expression contains invalid values: '".concat(x.toString(),"'"))},m})();s.CronParser=u}),333:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var d=l(823),u=l(949),m=(function(){function g(y,x){if(this.expression=y,this.options=x,this.expressionParts=new Array(5),!this.options.locale&&g.defaultLocale&&(this.options.locale=g.defaultLocale),!g.locales[this.options.locale]){var w=Object.keys(g.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(w,"'.")),this.options.locale=w}this.i18n=g.locales[this.options.locale],x.use24HourTimeFormat===void 0&&(x.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return g.toString=function(y,x){var w=x===void 0?{}:x,S=w.throwExceptionOnParseError,b=S===void 0?!0:S,$=w.verbose,k=$===void 0?!1:$,T=w.dayOfWeekStartIndexZero,O=T===void 0?!0:T,P=w.monthStartIndexZero,D=P===void 0?!1:P,A=w.use24HourTimeFormat,F=w.locale,L=F===void 0?null:F,_={throwExceptionOnParseError:b,verbose:k,dayOfWeekStartIndexZero:O,monthStartIndexZero:D,use24HourTimeFormat:A,locale:L};_.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var R=new g(y,_);return R.getFullDescription()},g.initialize=function(y,x){x===void 0&&(x="en"),g.specialCharacters=["/","-",",","*"],g.defaultLocale=x,y.load(g.locales)},g.prototype.getFullDescription=function(){var y,x,w="";try{var S=new u.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=S.parse(),this.expressionParts[0]==="@reboot")return((x=(y=this.i18n).atReboot)===null||x===void 0?void 0:x.call(y))||"Run once, at startup";var b=this.getTimeOfDayDescription(),$=this.getDayOfMonthDescription(),k=this.getMonthDescription(),T=this.getDayOfWeekDescription(),O=this.getYearDescription();w+=b+$+T+k+O,w=this.transformVerbosity(w,!!this.options.verbose),w=w.charAt(0).toLocaleUpperCase()+w.substr(1)}catch(P){if(!this.options.throwExceptionOnParseError)w=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(P)}return w},g.prototype.getTimeOfDayDescription=function(){var y=this.expressionParts[0],x=this.expressionParts[1],w=this.expressionParts[2],S="";if(!d.StringUtilities.containsAny(x,g.specialCharacters)&&!d.StringUtilities.containsAny(w,g.specialCharacters)&&!d.StringUtilities.containsAny(y,g.specialCharacters))S+=this.i18n.atSpace()+this.formatTime(w,x,y);else if(!y&&x.indexOf("-")>-1&&!(x.indexOf(",")>-1)&&!(x.indexOf("/")>-1)&&!d.StringUtilities.containsAny(w,g.specialCharacters)){var b=x.split("-");S+=d.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(w,b[0],""),this.formatTime(w,b[1],""))}else if(!y&&w.indexOf(",")>-1&&w.indexOf("-")==-1&&w.indexOf("/")==-1&&!d.StringUtilities.containsAny(x,g.specialCharacters)){var $=w.split(",");S+=this.i18n.at();for(var k=0;k<$.length;k++)S+=" ",S+=this.formatTime($[k],x,""),k<$.length-2&&(S+=","),k==$.length-2&&(S+=this.i18n.spaceAnd())}else{var T=this.getSecondsDescription(),O=this.getMinutesDescription(),P=this.getHoursDescription();if(S+=T,S&&O&&(S+=", "),S+=O,O===P)return S;S&&P&&(S+=", "),S+=P}return S},g.prototype.getSecondsDescription=function(){var y=this,x=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(w){return w},function(w){return d.StringUtilities.format(y.i18n.everyX0Seconds(w),w)},function(w){return y.i18n.secondsX0ThroughX1PastTheMinute()},function(w){return w=="0"?"":parseInt(w)<20?y.i18n.atX0SecondsPastTheMinute(w):y.i18n.atX0SecondsPastTheMinuteGt20()||y.i18n.atX0SecondsPastTheMinute(w)});return x},g.prototype.getMinutesDescription=function(){var y=this,x=this.expressionParts[0],w=this.expressionParts[2],S=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(b){return b},function(b){return d.StringUtilities.format(y.i18n.everyX0Minutes(b),b)},function(b){return y.i18n.minutesX0ThroughX1PastTheHour()},function(b){try{return b=="0"&&w.indexOf("/")==-1&&x==""?y.i18n.everyHour():parseInt(b)<20?y.i18n.atX0MinutesPastTheHour(b):y.i18n.atX0MinutesPastTheHourGt20()||y.i18n.atX0MinutesPastTheHour(b)}catch{return y.i18n.atX0MinutesPastTheHour(b)}});return S},g.prototype.getHoursDescription=function(){var y=this,x=this.expressionParts[2],w=0,S=[];x.split("/")[0].split(",").forEach(function(k){var T=k.split("-");T.length===2&&S.push({value:T[1],index:w+1}),w+=T.length});var b=0,$=this.getSegmentDescription(x,this.i18n.everyHour(),function(k){var T=S.find(function(P){return P.value===k&&P.index===b}),O=T&&y.expressionParts[1]!=="0";return b++,O?y.formatTime(k,"59",""):y.formatTime(k,"0","")},function(k){return d.StringUtilities.format(y.i18n.everyX0Hours(k),k)},function(k){return y.i18n.betweenX0AndX1()},function(k){return y.i18n.atX0()});return $},g.prototype.getDayOfWeekDescription=function(){var y=this,x=this.i18n.daysOfTheWeek(),w=null;return this.expressionParts[5]=="*"?w="":w=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(S,b){var $=S;S.indexOf("#")>-1?$=S.substring(0,S.indexOf("#")):S.indexOf("L")>-1&&($=$.replace("L",""));var k=parseInt($),T=y.i18n.daysOfTheWeekInCase?y.i18n.daysOfTheWeekInCase(b)[k]:x[k];if(S.indexOf("#")>-1){var O=null,P=S.substring(S.indexOf("#")+1),D=S.substring(0,S.indexOf("#"));switch(P){case"1":O=y.i18n.first(D);break;case"2":O=y.i18n.second(D);break;case"3":O=y.i18n.third(D);break;case"4":O=y.i18n.fourth(D);break;case"5":O=y.i18n.fifth(D);break}T=O+" "+T}return T},function(S){return parseInt(S)==1?"":d.StringUtilities.format(y.i18n.commaEveryX0DaysOfTheWeek(S),S)},function(S){var b=S.substring(0,S.indexOf("-")),$=y.expressionParts[3]!="*";return $?y.i18n.commaAndX0ThroughX1(b):y.i18n.commaX0ThroughX1(b)},function(S){var b=null;if(S.indexOf("#")>-1){var $=S.substring(S.indexOf("#")+1),k=S.substring(0,S.indexOf("#"));b=y.i18n.commaOnThe($,k).trim()+y.i18n.spaceX0OfTheMonth()}else if(S.indexOf("L")>-1)b=y.i18n.commaOnTheLastX0OfTheMonth(S.replace("L",""));else{var T=y.expressionParts[3]!="*";b=T?y.i18n.commaAndOnX0():y.i18n.commaOnlyOnX0(S)}return b}),w},g.prototype.getMonthDescription=function(){var y=this,x=this.i18n.monthsOfTheYear(),w=this.getSegmentDescription(this.expressionParts[4],"",function(S,b){return b&&y.i18n.monthsOfTheYearInCase?y.i18n.monthsOfTheYearInCase(b)[parseInt(S)-1]:x[parseInt(S)-1]},function(S){return parseInt(S)==1?"":d.StringUtilities.format(y.i18n.commaEveryX0Months(S),S)},function(S){return y.i18n.commaMonthX0ThroughMonthX1()||y.i18n.commaX0ThroughX1()},function(S){return y.i18n.commaOnlyInMonthX0?y.i18n.commaOnlyInMonthX0():y.i18n.commaOnlyInX0()});return w},g.prototype.getDayOfMonthDescription=function(){var y=this,x=null,w=this.expressionParts[3];switch(w){case"L":x=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":x=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var S=w.match(/(\d{1,2}W)|(W\d{1,2})/);if(S){var b=parseInt(S[0].replace("W","")),$=b==1?this.i18n.firstWeekday():d.StringUtilities.format(this.i18n.weekdayNearestDayX0(),b.toString());x=d.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),$);break}else{var k=w.match(/L-(\d{1,2})/);if(k){var T=k[1];x=d.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(T),T);break}else{if(w=="*"&&this.expressionParts[5]!="*")return"";x=this.getSegmentDescription(w,this.i18n.commaEveryDay(),function(O){return O=="L"?y.i18n.lastDay():y.i18n.dayX0?d.StringUtilities.format(y.i18n.dayX0(),O):O},function(O){return O=="1"?y.i18n.commaEveryDay():y.i18n.commaEveryX0Days(O)},function(O){return y.i18n.commaBetweenDayX0AndX1OfTheMonth(O)},function(O){return y.i18n.commaOnDayX0OfTheMonth(O)})}break}}return x},g.prototype.getYearDescription=function(){var y=this,x=this.getSegmentDescription(this.expressionParts[6],"",function(w){return/^\d+$/.test(w)?new Date(parseInt(w),1).getFullYear().toString():w},function(w){return d.StringUtilities.format(y.i18n.commaEveryX0Years(w),w)},function(w){return y.i18n.commaYearX0ThroughYearX1()||y.i18n.commaX0ThroughX1()},function(w){return y.i18n.commaOnlyInYearX0?y.i18n.commaOnlyInYearX0():y.i18n.commaOnlyInX0()});return x},g.prototype.getSegmentDescription=function(y,x,w,S,b,$){var k=null,T=y.indexOf("/")>-1,O=y.indexOf("-")>-1,P=y.indexOf(",")>-1;if(!y)k="";else if(y==="*")k=x;else if(!T&&!O&&!P)k=d.StringUtilities.format($(y),w(y));else if(P){for(var D=y.split(","),A="",F=0;F<D.length;F++)if(F>0&&D.length>2&&(A+=",",F<D.length-1&&(A+=" ")),F>0&&D.length>1&&(F==D.length-1||D.length==2)&&(A+="".concat(this.i18n.spaceAnd()," ")),D[F].indexOf("/")>-1||D[F].indexOf("-")>-1){var L=D[F].indexOf("-")>-1&&D[F].indexOf("/")==-1,_=this.getSegmentDescription(D[F],x,w,S,L?this.i18n.commaX0ThroughX1:b,$);L&&(_=_.replace(", ","")),A+=_}else T?A+=this.getSegmentDescription(D[F],x,w,S,b,$):A+=w(D[F]);T?k=A:k=d.StringUtilities.format($(y),A)}else if(T){var D=y.split("/");if(k=d.StringUtilities.format(S(D[1]),D[1]),D[0].indexOf("-")>-1){var R=this.generateRangeSegmentDescription(D[0],b,w);R.indexOf(", ")!=0&&(k+=", "),k+=R}else if(D[0].indexOf("*")==-1){var z=d.StringUtilities.format($(D[0]),w(D[0]));z=z.replace(", ",""),k+=d.StringUtilities.format(this.i18n.commaStartingX0(),z)}}else O&&(k=this.generateRangeSegmentDescription(y,b,w));return k},g.prototype.generateRangeSegmentDescription=function(y,x,w){var S="",b=y.split("-"),$=w(b[0],1),k=w(b[1],2),T=x(y);return S+=d.StringUtilities.format(T,$,k),S},g.prototype.formatTime=function(y,x,w){var S=0,b=0,$=parseInt(y)+S,k=parseInt(x)+b;k>=60?(k-=60,$+=1):k<0&&(k+=60,$-=1),$>=24?$=$-24:$<0&&($=24+$);var T="",O=!1;this.options.use24HourTimeFormat||(O=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),T=O?"".concat(this.getPeriod($)," "):" ".concat(this.getPeriod($)),$>12&&($-=12),$===0&&($=12));var P="";return w&&(P=":".concat(("00"+w).substring(w.length))),"".concat(O?T:"").concat(("00"+$.toString()).substring($.toString().length),":").concat(("00"+k.toString()).substring(k.toString().length)).concat(P).concat(O?"":T)},g.prototype.transformVerbosity=function(y,x){if(!x&&(y=y.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),y=y.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),y=y.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),y=y.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var w=0,S=Object.entries(this.i18n.conciseVerbosityReplacements());w<S.length;w++){var b=S[w],$=b[0],k=b[1];y=y.replace(new RegExp($,"g"),k)}return y},g.prototype.getPeriod=function(y){return y>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},g.locales={},g})();s.ExpressionDescriptor=m}),747:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.enLocaleLoader=void 0;var d=l(486),u=(function(){function m(){}return m.prototype.load=function(g){g.en=new d.en},m})();s.enLocaleLoader=u}),486:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var l=(function(){function d(){}return d.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},d.prototype.atX0MinutesPastTheHourGt20=function(){return null},d.prototype.commaMonthX0ThroughMonthX1=function(){return null},d.prototype.commaYearX0ThroughYearX1=function(){return null},d.prototype.use24HourTimeFormatByDefault=function(){return!1},d.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},d.prototype.everyMinute=function(){return"every minute"},d.prototype.everyHour=function(){return"every hour"},d.prototype.atSpace=function(){return"At "},d.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},d.prototype.at=function(){return"At"},d.prototype.spaceAnd=function(){return" and"},d.prototype.everySecond=function(){return"every second"},d.prototype.everyX0Seconds=function(){return"every %s seconds"},d.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},d.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},d.prototype.everyX0Minutes=function(){return"every %s minutes"},d.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},d.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},d.prototype.everyX0Hours=function(){return"every %s hours"},d.prototype.betweenX0AndX1=function(){return"between %s and %s"},d.prototype.atX0=function(){return"at %s"},d.prototype.commaEveryDay=function(){return", every day"},d.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},d.prototype.commaX0ThroughX1=function(){return", %s through %s"},d.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},d.prototype.first=function(){return"first"},d.prototype.second=function(){return"second"},d.prototype.third=function(){return"third"},d.prototype.fourth=function(){return"fourth"},d.prototype.fifth=function(){return"fifth"},d.prototype.commaOnThe=function(){return", on the "},d.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},d.prototype.lastDay=function(){return"the last day"},d.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},d.prototype.commaOnlyOnX0=function(){return", only on %s"},d.prototype.commaAndOnX0=function(){return", and on %s"},d.prototype.commaEveryX0Months=function(){return", every %s months"},d.prototype.commaOnlyInX0=function(){return", only in %s"},d.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},d.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},d.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},d.prototype.firstWeekday=function(){return"first weekday"},d.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},d.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},d.prototype.commaEveryX0Days=function(){return", every %s days"},d.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},d.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},d.prototype.commaEveryHour=function(){return", every hour"},d.prototype.commaEveryX0Years=function(){return", every %s years"},d.prototype.commaStartingX0=function(){return", starting %s"},d.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},d.prototype.atReboot=function(){return"Run once, at startup"},d})();s.en=l}),515:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0});function l(u,m){if(!u)throw new Error(m)}var d=(function(){function u(){}return u.secondRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=59,"seconds part must be >= 0 and <= 59")}},u.minuteRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=59,"minutes part must be >= 0 and <= 59")}},u.hourRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=23,"hours part must be >= 0 and <= 23")}},u.dayOfMonthRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=1&&x<=31,"DOM part must be >= 1 and <= 31")}},u.monthRange=function(m,g){for(var y=m.split(","),x=0;x<y.length;x++)if(!isNaN(parseInt(y[x],10))){var w=parseInt(y[x],10);l(w>=1&&w<=12,g?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},u.dayOfWeekRange=function(m,g){for(var y=m.split(","),x=0;x<y.length;x++)if(!isNaN(parseInt(y[x],10))){var w=parseInt(y[x],10);l(w>=0&&w<=6,g?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},u})();s.default=d}),823:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var l=(function(){function d(){}return d.format=function(u){for(var m=[],g=1;g<arguments.length;g++)m[g-1]=arguments[g];return u.replace(/%s/g,function(y){return m.shift()})},d.containsAny=function(u,m){return m.some(function(g){return u.indexOf(g)>-1})},d})();s.StringUtilities=l})},r={};function o(i){var s=r[i];if(s!==void 0)return s.exports;var l=r[i]={exports:{}};return n[i](l,l.exports,o),l.exports}var a={};return(()=>{var i=a;Object.defineProperty(i,"__esModule",{value:!0}),i.toString=void 0;var s=o(333),l=o(747);s.ExpressionDescriptor.initialize(new l.enLocaleLoader),i.default=s.ExpressionDescriptor;var d=s.ExpressionDescriptor.toString;i.toString=d})(),a})())})(II)),II.exports}var zwe=Lwe();const Fwe=yc(zwe),_we=new Set(["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","SUN","MON","TUE","WED","THU","FRI","SAT"]);function Bwe(e){for(const t of e.trim().split(/\s+/)){if(/[#?]/.test(t))return!1;for(const n of t.split(/[,\-/]/))if(!(n===""||n==="*")&&/[A-Za-z]/.test(n)&&!_we.has(n.toUpperCase()))return!1}return!0}function lT(e){const t=(e??"").trim();if(t.split(/\s+/).filter(Boolean).length!==5)return{valid:!1,description:"",nextRun:null,error:"Expected a 5-field UNIX cron: minute hour day-of-month month day-of-week."};if(!Bwe(t))return{valid:!1,description:"",nextRun:null,error:"Unsupported cron syntax: L, W, #, and ? extensions are not allowed (plain 5-field UNIX cron only)."};try{const n=Fwe.toString(t,{use24HourTimeFormat:!0,verbose:!1}),r=Iwe.CronExpressionParser.parse(t,{tz:"UTC"}).next().toDate();return{valid:!0,description:n,nextRun:r}}catch(n){return{valid:!1,description:"",nextRun:null,error:n instanceof Error?n.message:"Invalid cron expression."}}}function p6(e){return e?e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC":"—"}function Uwe({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),l=()=>a(!1),d=async()=>{try{await e({forceRefresh:i}),a(!1)}catch{}},u=p.jsx("span",{children:p.jsx(Qy,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return p.jsxs(p.Fragment,{children:[n&&r?p.jsx(Br,{title:r,children:u}):u,p.jsx(Oo,{open:o,onClose:l,title:"New materialization",description:"Compile the package, build a table for every persist source, and load them so queries serve from the tables.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{onClick:l,children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:t,onClick:d,children:"Materialize"})]}),children:p.jsx(uX,{children:p.jsx(MR,{control:p.jsx(Cz,{checked:i,onChange:m=>s(m.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function v0({children:e}){return p.jsx(wt,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function tx(e){return e===Ea.Pending||e===Ea.ManifestRowsReady}function qwe(e){return e===Ea.ManifestFileReady||e===Ea.Failed||e===Ea.Cancelled}function h6(e){switch(e){case Ea.ManifestFileReady:return"Done";case Ea.Failed:return"Failed";case Ea.Cancelled:return"Cancelled";case Ea.Pending:case Ea.ManifestRowsReady:return"Pending";default:return"Unknown"}}function R$(e){switch(e){case Ea.ManifestRowsReady:return"info";case Ea.ManifestFileReady:return"success";case Ea.Failed:return"error";case Ea.Cancelled:return"warning";case Ea.Pending:default:return"default"}}function Hwe(e){const t=Object.values(cT(e).refusedSources??{}).map(r=>({name:r.name,message:r.message})),n=Object.values(e.manifest?.failures??{}).filter(r=>r.refused).map(r=>({name:r.sourceName??r.sourceEntityId,message:r.reason}));return[...t,...n].sort((r,o)=>r.name.localeCompare(o.name))}function m6(e,t){const n=[`${e.sourcesBuilt??0} built`,`${e.sourcesReused??0} reused`];return e.sourcesRefused&&n.push(`${e.sourcesRefused} refused`),n.join(t)}function cT(e){return e.metadata??{}}function Vwe(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function g6(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),o=Math.max(0,r-n);if(o<1e3)return`${o}ms`;const a=Math.round(o/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),s=a%60;if(i<60)return`${i}m ${s}s`;const l=Math.floor(i/60),d=i%60;return`${l}h ${d}m`}function T$(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Wwe(e){if(!e)return"-";const t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Ywe({entries:e,builtAt:t}){const n=Object.entries(e??{});return p.jsxs(Te,{children:[p.jsxs(Yn,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[p.jsx(v0,{children:"Build manifest"}),t&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["Built ",T$(t)]})]}),n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):p.jsxs(Bx,{size:"small",children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"Source"}),p.jsx(dr,{children:"Table name"}),p.jsx(dr,{children:"Connection"}),p.jsx(dr,{children:"Realization"}),p.jsx(dr,{align:"right",children:"Rows"})]})}),p.jsx(qx,{children:n.map(([r,o])=>p.jsxs(vu,{children:[p.jsx(dr,{sx:{fontFamily:Fo},children:o.sourceName??r}),p.jsx(dr,{sx:{fontFamily:Fo},children:o.physicalTableName??"-"}),p.jsx(dr,{sx:{fontFamily:Fo},children:o.connectionName??"-"}),p.jsx(dr,{children:o.realization??"-"}),p.jsx(dr,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function y6({meta:e}){const t=e.trigger==="SCHEDULER";return p.jsx(Br,{title:t?"Fired by the materialization schedule":"Triggered manually",children:p.jsx(wt,{variant:"body2",color:"text.secondary",children:Vwe(e)})})}function Gwe({materialization:e,buildPlan:t,onClose:n}){const r=e?cT(e):{},o=e?Hwe(e):[],a=t.status==="ready"?Object.values(t.plan?.sources??{}):[];return p.jsx(zx,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&p.jsxs(p.Fragment,{children:[p.jsxs(_x,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[p.jsx(TR,{size:"small",label:h6(e.status),color:R$(e.status),variant:tx(e.status)?"filled":"outlined"}),p.jsx(y6,{meta:r})]}),p.jsx(wt,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo,wordBreak:"break-all"},children:e.id}),p.jsx(ro,{"aria-label":"close",onClick:n,sx:{position:"absolute",right:8,top:8},children:p.jsx(xh,{fontSize:"small"})})]}),p.jsxs(Fx,{dividers:!0,children:[p.jsxs(Te,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[p.jsx(hg,{label:"Started",value:T$(e.startedAt??e.createdAt)}),p.jsx(hg,{label:"Completed",value:T$(e.completedAt)}),p.jsx(hg,{label:"Duration",value:g6(e.startedAt,e.completedAt)}),p.jsx(hg,{label:"Sources",value:m6(r," · ")}),p.jsx(hg,{label:"Force refresh",value:r.forceRefresh?"Yes":"No"})]}),e.error&&p.jsxs(Te,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[p.jsx(v0,{children:p.jsx(Te,{component:"span",sx:{color:"error.main"},children:"Error"})}),p.jsx(wt,{variant:"body2",sx:{fontFamily:Fo,whiteSpace:"pre-wrap"},children:e.error})]}),o.length>0&&p.jsxs(Te,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"warning.main"},children:[p.jsx(v0,{children:p.jsx(Te,{component:"span",sx:{color:"warning.main"},children:"Refused sources"})}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1},children:"Not built, because materializing them would be unsafe. They serve live until the model changes."}),o.map(i=>p.jsxs(Te,{sx:{mt:1},children:[p.jsx(wt,{variant:"body2",sx:{fontFamily:Fo},children:i.name}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-wrap"},children:i.message})]},i.name))]}),p.jsxs(Te,{sx:{mb:3},children:[p.jsx(v0,{children:"Build plan"}),t.status==="loading"?p.jsx(Bo,{text:wu.loading,size:16,centered:!1}):t.status==="unavailable"?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"The build plan is unavailable."}):a.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):p.jsxs(Bx,{size:"small",children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"Source"}),p.jsx(dr,{children:"Connection"}),p.jsx(dr,{children:"Dialect"}),p.jsx(dr,{align:"right",children:"Columns"}),p.jsx(dr,{children:"Source Entity ID"})]})}),p.jsx(qx,{children:a.map(i=>p.jsxs(vu,{children:[p.jsx(dr,{sx:{fontFamily:Fo},children:i.name}),p.jsx(dr,{sx:{fontFamily:Fo},children:i.connectionName}),p.jsx(dr,{children:i.dialect??"-"}),p.jsx(dr,{align:"right",children:i.columns?.length??0}),p.jsx(dr,{sx:{fontFamily:Fo,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:i.sourceEntityId})]},i.sourceID))})]})]}),p.jsx(Ywe,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function hg({label:e,value:t}){return p.jsxs(Te,{children:[p.jsx(wt,{variant:"caption",color:"text.secondary",display:"block",children:e}),p.jsx(wt,{variant:"body2",children:t})]})}const Kwe=Jt(p.jsx("path",{d:"M6 6h12v12H6z"}));function Qwe(e){return Cn("PrivateSwitchBase",e)}fn("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Xwe=e=>{const{classes:t,checked:n,disabled:r,edge:o}=e,a={root:["root",n&&"checked",r&&"disabled",o&&`edge${Tt(o)}`],input:["input"]};return bn(a,Qwe,t)},Zwe=nt(qd,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e==="start"&&t.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e==="end"&&t.size!=="small",style:{marginRight:-12}}]}),Jwe=nt("input",{name:"MuiSwitchBase",shouldForwardProp:ei})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),eSe=C.forwardRef(function(e,t){const{autoFocus:n,checked:r,checkedIcon:o,defaultChecked:a,disabled:i,disableFocusRipple:s=!1,edge:l=!1,icon:d,id:u,inputProps:m,inputRef:g,name:y,onBlur:x,onChange:w,onFocus:S,readOnly:b,required:$=!1,tabIndex:k,type:T,value:O,slots:P={},slotProps:D={},...A}=e,[F,L]=Ti({controlled:r,default:!!a,name:"SwitchBase",state:"checked"}),_=Ai(),R=ie=>{S&&S(ie),_&&_.onFocus&&_.onFocus(ie)},z=ie=>{x&&x(ie),_&&_.onBlur&&_.onBlur(ie)},N=ie=>{if(ie.nativeEvent.defaultPrevented)return;const Q=ie.target.checked;L(Q),w&&w(ie,Q)};let B=i;_&&typeof B>"u"&&(B=_.disabled);const I=T==="checkbox"||T==="radio",H={...e,checked:F,disabled:B,disableFocusRipple:s,edge:l},Y=Xwe(H),ae={slots:P,slotProps:{input:m,...D}},[K,oe]=ur("root",{ref:t,elementType:Zwe,className:Y.root,shouldForwardComponentProp:!0,externalForwardedProps:{...ae,component:"span",...A},getSlotProps:ie=>({...ie,onFocus:Q=>{ie.onFocus?.(Q),R(Q)},onBlur:Q=>{ie.onBlur?.(Q),z(Q)}}),ownerState:H,additionalProps:{centerRipple:!0,focusRipple:!s,disabled:B,role:void 0,tabIndex:null}}),[ue,G]=ur("input",{ref:g,elementType:Jwe,className:Y.input,externalForwardedProps:ae,getSlotProps:ie=>({...ie,onChange:Q=>{ie.onChange?.(Q),N(Q)}}),ownerState:H,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:B,id:I?u:void 0,name:y,readOnly:b,required:$,tabIndex:k,type:T,...T==="checkbox"&&O===void 0?{}:{value:O}}});return p.jsxs(K,{...oe,children:[p.jsx(ue,{...G}),F?o:d]})}),tSe=Jt(p.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),nSe=Jt(p.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),rSe=Jt(p.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function oSe(e){return Cn("MuiCheckbox",e)}const MC=fn("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),aSe=e=>{const{classes:t,indeterminate:n,color:r,size:o}=e,a={root:["root",n&&"indeterminate",`color${Tt(r)}`,`size${Tt(o)}`]},i=bn(a,oSe,t);return{...t,...i}},iSe=nt(eSe,{shouldForwardProp:e=>ei(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Tt(n.size)}`],n.color!=="default"&&t[`color${Tt(n.color)}`]]}})(Gn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ma()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ma()).map(([t])=>({props:{color:t},style:{[`&.${MC.checked}, &.${MC.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${MC.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),sSe=p.jsx(nSe,{}),lSe=p.jsx(tSe,{}),cSe=p.jsx(rSe,{}),uSe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiCheckbox"}),{checkedIcon:r=sSe,color:o="primary",icon:a=lSe,indeterminate:i=!1,indeterminateIcon:s=cSe,inputProps:l,size:d="medium",disableRipple:u=!1,className:m,slots:g={},slotProps:y={},...x}=n,w=i?s:a,S=i?s:r,b={...n,disableRipple:u,color:o,indeterminate:i,size:d},$=aSe(b),k=y.input??l,[T,O]=ur("root",{ref:t,elementType:iSe,className:Ht($.root,m),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...x},ownerState:b,additionalProps:{type:"checkbox",icon:C.cloneElement(w,{fontSize:w.props.fontSize??d}),checkedIcon:C.cloneElement(S,{fontSize:S.props.fontSize??d}),disableRipple:u,slots:g,slotProps:{input:aF(typeof k=="function"?k(b):k,{"data-indeterminate":i})}}});return p.jsx(T,{...O,classes:$})});function dSe(e){return Cn("MuiFormControlLabel",e)}const jg=fn("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),fSe=e=>{const{classes:t,disabled:n,labelPlacement:r,error:o,required:a}=e,i={root:["root",n&&"disabled",`labelPlacement${Tt(r)}`,o&&"error",a&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",o&&"error"]};return bn(i,dSe,t)},pSe=nt("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${jg.label}`]:t.label},t.root,t[`labelPlacement${Tt(n.labelPlacement)}`]]}})(Gn(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${jg.disabled}`]:{cursor:"default"},[`& .${jg.label}`]:{[`&.${jg.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:"start"},style:{flexDirection:"row-reverse",marginRight:-11}},{props:{labelPlacement:"top"},style:{flexDirection:"column-reverse"}},{props:{labelPlacement:"bottom"},style:{flexDirection:"column"}},{props:({labelPlacement:t})=>t==="start"||t==="top"||t==="bottom",style:{marginLeft:16}}]}))),hSe=nt("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(Gn(({theme:e})=>({[`&.${jg.error}`]:{color:(e.vars||e).palette.error.main}}))),mSe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFormControlLabel"}),{checked:r,className:o,componentsProps:a={},control:i,disabled:s,disableTypography:l,inputRef:d,label:u,labelPlacement:m="end",name:g,onChange:y,required:x,slots:w={},slotProps:S={},value:b,...$}=n,k=Ai(),T=s??i.props.disabled??k?.disabled,O=x??i.props.required,P={disabled:T,required:O};["checked","name","onChange","value","inputRef"].forEach(N=>{typeof i.props[N]>"u"&&typeof n[N]<"u"&&(P[N]=n[N])});const D=nf({props:n,muiFormControl:k,states:["error"]}),A={...n,disabled:T,labelPlacement:m,required:O,error:D.error},F=fSe(A),L={slots:w,slotProps:{...a,...S}},[_,R]=ur("typography",{elementType:Sr,externalForwardedProps:L,ownerState:A});let z=u;return z!=null&&z.type!==Sr&&!l&&(z=p.jsx(_,{component:"span",...R,className:Ht(F.label,R?.className),children:z})),p.jsxs(pSe,{className:Ht(F.root,o),ownerState:A,ref:t,...$,children:[C.cloneElement(i,P),O?p.jsxs("div",{children:[z,p.jsxs(hSe,{ownerState:A,"aria-hidden":!0,className:F.asterisk,children:[" ","*"]})]}):z]})});function gSe({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),l=()=>a(!0),d=()=>{a(!1),s(!1),t()};return p.jsxs(kn.Fragment,{children:[p.jsxs(Vo,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:u=>{u.stopPropagation(),l()},sx:{color:"error.main"},children:[p.jsx(oT,{sx:{color:"inherit"},children:p.jsx(Zx,{fontSize:"small"})}),p.jsx(aT,{children:"Delete"})]}),p.jsxs(Oo,{open:o,onClose:d,title:"Delete materialization",actions:p.jsxs(p.Fragment,{children:[p.jsx(Co,{onClick:d,children:"Cancel"}),p.jsx(Co,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(i),loading:n,children:"Delete run"})]}),children:[p.jsx(Sr,{variant:"body2",children:"Delete this run's record? This cannot be undone."}),p.jsx(mSe,{control:p.jsx(uSe,{checked:i,onChange:u=>s(u.target.checked)}),label:"Also drop the materialized tables this run produced"})]})]})}function ySe({materializations:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){return e.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:"No materializations yet."}):p.jsxs(Bx,{size:"small",sx:{"& td, & th":{borderColor:"divider"},"& td:first-of-type, & th:first-of-type":{pl:0},"& td:last-of-type, & th:last-of-type":{pr:0},"& th":{color:"text.secondary",fontWeight:600}},children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(dr,{children:"Status"}),p.jsx(dr,{children:"Trigger"}),p.jsx(dr,{children:"Started"}),p.jsx(dr,{children:"Duration"}),p.jsx(dr,{children:"Sources"}),p.jsx(dr,{align:"right",children:"Actions"})]})}),p.jsx(qx,{children:e.map(i=>p.jsx(vSe,{materialization:i,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},i.id))})]})}function vSe({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[i,s]=C.useState(null),l=!!i,d=()=>s(null),u=cT(e),m=u.sourcesBuilt!==void 0||u.sourcesReused!==void 0?m6(u,", "):"-",g=tx(e.status),y=qwe(e.status),x=e.error??void 0,w=t&&(g||y);return p.jsxs(vu,{hover:!0,sx:{cursor:"pointer","&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},onClick:()=>a(e),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),a(e))},role:"button",tabIndex:0,"aria-label":`View materialization ${e.id??""} details`.trim(),children:[p.jsx(dr,{children:p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:.5},children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:500,color:R$(e.status)==="default"?"text.primary":`${R$(e.status)}.main`},children:h6(e.status)}),x&&p.jsx(Br,{title:x,children:p.jsx(w_,{fontSize:"small",color:"error"})})]})}),p.jsx(dr,{children:p.jsx(y6,{meta:u})}),p.jsx(dr,{children:Wwe(e.startedAt??e.createdAt)}),p.jsx(dr,{children:g6(e.startedAt,e.completedAt)}),p.jsx(dr,{children:m}),p.jsx(dr,{align:"right",onClick:S=>S.stopPropagation(),children:w&&p.jsxs(p.Fragment,{children:[p.jsx(ro,{size:"small","aria-label":`Materialization actions for ${e.id??""}`.trim(),onClick:S=>s(S.currentTarget),children:p.jsx(Jx,{fontSize:"small"})}),p.jsxs(uc,{anchorEl:i,open:l,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[t&&g&&p.jsxs(ea,{"aria-label":`Stop materialization ${e.id??""}`.trim(),disabled:n,onClick:()=>{d(),r(e)},children:[p.jsx(ml,{children:p.jsx(Kwe,{fontSize:"small"})}),p.jsx(Ci,{children:"Stop"})]}),t&&y&&p.jsx(gSe,{materialization:e,isMutating:n,onCloseDialog:d,onDelete:S=>o(e,S)})]})]})})]})}const bSe=Jt(p.jsx("path",{d:"m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27zm0-11.47L17.74 9 12 13.47 6.26 9z"})),xSe={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function wSe({scope:e,disabled:t,disabledReason:n,isSubmitting:r,onChange:o}){const[a,i]=C.useState(null),s=async l=>{i(null),l!==e&&await o(l).catch(()=>{})};return p.jsxs(p.Fragment,{children:[p.jsx(Xy,{label:"Scope",icon:p.jsx(bSe,{}),onClick:l=>i(l.currentTarget),disabled:t||r,...n?{disabledReason:n}:{},ariaHasPopup:"menu",ariaLabel:`Scope: ${e}`}),p.jsx(uc,{anchorEl:a,open:!!a,onClose:()=>i(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:["package","version"].map(l=>p.jsxs(ea,{selected:l===e,onClick:()=>void s(l),children:[p.jsx(ml,{sx:{minWidth:32},children:l===e&&p.jsx(pF,{fontSize:"small"})}),p.jsx(Ci,{primary:l,secondary:xSe[l]})]},l))})]})}const SSe=Jt([p.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),p.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),zI="0 6 * * *";function CSe({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,i]=C.useState(!1),[s,l]=C.useState(e??zI),d=()=>{l(e??zI),i(!0)},u=()=>i(!1),m=lT(s),g=async y=>{try{await o(y),i(!1)}catch{}};return p.jsxs(p.Fragment,{children:[p.jsx(Xy,{label:"Schedule",icon:p.jsx(SSe,{}),onClick:d,disabled:n,...r?{disabledReason:r}:{},ariaHasPopup:"dialog",ariaLabel:e?"Edit schedule":"Set schedule"}),p.jsxs(Oo,{open:a,onClose:u,title:e?"Edit schedule":"Set schedule",description:"The publisher rebuilds this package's materializations on this cadence: a 5-field UNIX cron, in UTC. In a hosted deployment the change takes effect on your next publish.",actions:p.jsxs(p.Fragment,{children:[e&&p.jsx(Vn,{color:"error",loading:t,onClick:()=>g(null),sx:{mr:"auto"},children:"Clear schedule"}),p.jsx(Vn,{onClick:u,children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:t,disabled:!m.valid,onClick:()=>g(s.trim()),children:"Save schedule"})]}),children:[p.jsx(Ri,{autoFocus:!0,fullWidth:!0,size:"small",label:"Cron expression",value:s,onChange:y=>l(y.target.value),error:s.trim()!==""&&!m.valid,helperText:m.valid?`${m.description} · next run ${p6(m.nextRun)}`:m.error,slotProps:{htmlInput:{style:{fontFamily:Fo}}}}),p.jsxs(lo,{severity:"info",children:["A schedule runs only on version-scoped packages, so saving one sets ",p.jsx("code",{children:"scope: version"})," for this package."]})]})]})}const kSe=3e3;function $Se({resourceUri:e,versioned:t=!1}){const{apiClients:n,mutable:r}=tr(),o=Tl(),{environmentName:a,packageName:i,versionId:s}=Xr(e),[l,d]=C.useState(""),[u,m]=C.useState(null);if(!i)throw new Error("Materializations requires a package in the resource URI");const g=co({queryKey:["materializations",a,i,s],queryFn:()=>n.materializations.listMaterializations(a,i,void 0,void 0,s),refetchInterval:H=>(H.state.data?.data??[]).some(Y=>tx(Y.status))?kSe:!1}),y=co({queryKey:["package",a,i,s],queryFn:()=>n.packages.getPackage(a,i,s)}),x=co({queryKey:["package-build-plan",a,i,s],queryFn:async({signal:H})=>{try{return{inline:!1,plan:(await n.packages.getPackageBuildPlan(a,i,s,{signal:H})).data}}catch(Y){if(Y?.response?.status===404)return{inline:!0,plan:null};throw Y}},enabled:u!==null}),w=()=>o.invalidateQueries({queryKey:["materializations",a,i]}),S=hl({mutationFn:rc("materialization","create",H=>n.materializations.createMaterialization(a,i,{forceRefresh:H.forceRefresh,...s!==void 0?{versionId:s}:{}})),onSuccess(){d("Materialization requested"),w()},onError(H){d(H.message),w()}}),b=hl({mutationFn:rc("materialization","update",H=>n.materializations.materializationAction(a,i,H.id,xre.Stop,s)),onSuccess(){d("Materialization stopped"),w()},onError(H){d(H.message)}}),$=hl({mutationFn:rc("materialization","delete",({materialization:H,dropTables:Y})=>n.materializations.deleteMaterialization(a,i,H.id,Y,s)),onSuccess(){d("Materialization deleted"),w()},onError(H){d(H.message)}}),k=y.data?.data,T=hl({mutationFn:rc("schedule","update",H=>n.packages.updatePackage(a,i,{name:i,description:k?.description,...H?{scope:Cb.Version}:{},materialization:{schedule:H}})),onSuccess(H,Y){d(Y?"Schedule updated":"Schedule cleared"),o.invalidateQueries({queryKey:["package",a,i]})},onError(H){d(H.message)}}),O=hl({mutationFn:rc("scope","update",H=>n.packages.updatePackage(a,i,{name:i,description:k?.description,scope:H})),onSuccess(){d("Scope updated"),o.invalidateQueries({queryKey:["package",a,i]})},onError(H){d(H.message)}}),P=g.data?.data??[],D=P.find(H=>H.id===u)??null,A=P.some(H=>tx(H.status)),F=S.isPending||b.isPending||$.isPending,L=x.isError?{status:"unavailable"}:x.isSuccess?x.data.inline?y.isSuccess?{status:"ready",plan:k?.buildPlan??null}:y.isError?{status:"unavailable"}:{status:"loading"}:{status:"ready",plan:x.data.plan}:{status:"loading"},_=k?.materialization?.schedule??null,R=k?.scope===Cb.Version?"version":"package",z=!!k?.manifestLocation,N=!!k?.materialization?.freshness,B=_?lT(_):null,I=z?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[B?B.valid?`${B.description} (${_}), next run ${p6(B.nextRun)}`:`Unrecognized cron expression (${_})`:N?"Refreshed by a freshness policy; a cron schedule does not apply":"On demand only, no schedule set",`scope: ${R}`].join(" · ");return p.jsxs(p.Fragment,{children:[p.jsxs(Ns,{title:"Materializations",count:g.isSuccess?P.length:void 0,action:r&&p.jsxs(Yn,{direction:"row",spacing:1,alignItems:"center",children:[!z&&!t&&p.jsx(wSe,{scope:R,disabled:!!_,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:O.isPending,onChange:H=>O.mutateAsync(H==="version"?Cb.Version:Cb.Package)}),!z&&!t&&p.jsx(CSe,{currentSchedule:_,isSubmitting:T.isPending,disabled:N,disabledReason:"This package declares a freshness policy; a schedule and freshness are mutually exclusive.",onSubmit:H=>T.mutateAsync(H)}),p.jsx(Uwe,{onSubmit:H=>S.mutateAsync(H),isSubmitting:S.isPending,disabled:A,disabledReason:"A materialization is already pending or running for this package."})]}),children:[y.isSuccess&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:I}),g.isError&&p.jsx(ja,{error:g.error,context:`${a} > ${i} > Materializations`}),!g.isSuccess&&!g.isError&&p.jsx(Bo,{text:"Loading materializations..."}),g.isSuccess&&p.jsx(ySe,{materializations:P,mutable:r,isMutating:F,onStop:H=>b.mutate(H),onDelete:(H,Y)=>$.mutate({materialization:H,dropTables:Y}),onViewDetails:H=>m(H.id??null)})]}),p.jsx(Gwe,{materialization:D,buildPlan:L,onClose:()=>m(null)}),p.jsx(hh,{open:l!=="",autoHideDuration:6e3,onClose:()=>d(""),message:l})]})}const uT=Jt(p.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5m-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4zm-3-4h8v2H8z"}));function ih(e){return v6(e).join(`
482
+ `).trim()||void 0}function v6(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(r){if(r.startsWith('#"'))t.push(r.slice(2).trim());else if(r.startsWith("#(doc)")){let o=r.slice(6).trim();o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),t.push(o)}}}return t.filter(n=>n.trim()!=="")}function FI(e){const t=(e??[]).map(n=>({...n,value:n.value?.trim()??""})).filter(n=>n.value.startsWith('##"')||n.value.startsWith("##(doc)")).map(n=>({...n,value:n.value.slice(1)}));return ih(t)}function RSe(e,t){const n=e.docParts??[],r=t?.docParts??[];return(r.length>0&&r.length<n.length&&r.every((o,a)=>o===n[a])?n.slice(r.length):n).join(`
483
+ `).trim()||void 0}function dT(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(!r||r.startsWith('#"')||r.startsWith("#(doc)"))continue;const o=r.replace(/^#+@?\s*/,"").trim();o&&!o.startsWith("(")&&t.push(o)}return t}function TSe(e){const t=new Set;for(const n of e){const{tag:r,log:o}=e1.parseAnnotation([`# ${n}`]);if(o.length>0){const a=/^[A-Za-z_][\w.]*/.exec(n.trim())?.[0];a&&!/^\s*[\w.]+\s*=/.test(n)&&t.add(a);continue}for(const[a,i]of r.entries())i.deleted||(i.eq===void 0?t.add(a):a==="viz"&&typeof i.eq=="string"&&t.add(i.eq))}return[...t]}function ESe(e){return b6(e,"persist")}function MSe(e){return b6(e,"preaggregate")}function b6(e,t){const n=new RegExp(`^#@?\\s*${t}\\b`);return(e??[]).some(r=>n.test(r.value?.trim()??""))}function fT(e){const t=jSe(e);if(!e||!t)return t;switch(e.kind){case"number_type":return e.subtype?`${t} · ${e.subtype}`:t;case"date_type":case"timestamp_type":case"timestamptz_type":return e.timeframe?`${t} · ${e.timeframe}`:t;case"sql_native_type":return e.sql_type?`sql native · ${e.sql_type}`:"sql native";case"array_type":return`array<${fT(e.element_type)??"unknown"}>`;case"record_type":{const n=e.fields.length;return`record · ${n} ${n===1?"field":"fields"}`}default:return t}}function OSe(e){if(e?.kind==="record_type")return e.fields.map(t=>`${t.name} ${fT(t.type)??""}`.trim()).join(`
484
+ `)}function PSe(e){const t=(e??[]).filter(n=>/^#@/.test(n.value?.trim()??""));return dT((e??[]).filter(n=>!t.includes(n)))}function jSe(e){return e?.kind?.replace(/_type$/,"")}const Wd=C.forwardRef(function(e,t){return p.jsx(wt,{ref:t,variant:"body2",...e,sx:{color:"text.secondary",...e.sx}})}),ky=C.forwardRef(function(e,t){return p.jsx(wt,{ref:t,variant:"caption",...e,sx:{color:"text.secondary",...e.sx}})});function Kg({message:e,secondary:t,actions:n}){return p.jsxs(Te,{"data-testid":"empty-row",sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",p:2,border:"1px dashed",borderColor:"divider",borderRadius:2},children:[p.jsxs(Te,{sx:{flex:1,minWidth:200},children:[p.jsx(Wd,{children:e}),t&&p.jsx(Wd,{sx:{color:"text.secondary",mt:.5},children:t})]}),n&&p.jsx(Te,{sx:{display:"flex",gap:1,flexShrink:0,alignItems:"center"},children:n})]})}const x6="--model-viewer-mono",os=`var(${x6}, ${Fo})`,w6="inherit",Xa={micro:"0.6875rem",caption:"0.75rem",small:"0.8125rem",body:"0.875rem",bodyLarge:"1rem"},E$={strong:500},qb=e=>({tint:`color-mix(in srgb, ${e} 12%, transparent)`,onTint:e}),xo={text:{secondary:"text.secondary",tertiary:"text.disabled"},background:{muted:"action.hover",strong:"action.selected"},accent:{sage:qb(hr.lime)},warning:qb(hr.amber),error:qb(hr.red),info:qb(hr.blue)},F1=xo.text.tertiary,ASe={positive:{bg:xo.accent.sage.tint,fg:xo.accent.sage.onTint},neutral:{bg:xo.background.strong,fg:xo.text.secondary},warning:{bg:xo.warning.tint,fg:xo.warning.onTint},negative:{bg:xo.error.tint,fg:xo.error.onTint},info:{bg:xo.info.tint,fg:xo.info.onTint},quiet:{bg:xo.background.muted,fg:xo.text.secondary}},fs=C.forwardRef(function({tone:e="neutral",voice:t="state",size:n="inline",busy:r=!1,children:o,sx:a,...i},s){const{bg:l,fg:d}=ASe[e],u=Xa.micro;return p.jsxs(Ta,{ref:s,component:"span","data-pill-tone":e,"data-pill-placement":n,...i,sx:[{display:"inline-flex",alignItems:"center",gap:r?"4px":0,padding:"2px 8px",borderRadius:"999px",bgcolor:l,color:d,flexShrink:0,whiteSpace:"nowrap",...t==="token"?{fontFamily:os,fontSize:u}:{fontFamily:w6,fontSize:u,fontWeight:E$.strong}},...Array.isArray(a)?a:[a]],children:[r&&p.jsx(M2,{size:9,thickness:5,sx:{color:"info.main",flexShrink:0},"aria-hidden":!0}),o]})}),DSe={width:"100%",maxWidth:"1200px",mx:"auto"},M$=3,$y=1.5,kh={display:"flex",flexDirection:"column",minWidth:0,minHeight:0,border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",cursor:"default"},NSe={...kh,border:"none",borderRadius:0,bgcolor:"transparent",overflow:"visible"};function oc({label:e,value:t,mono:n}){return p.jsxs(p.Fragment,{children:[p.jsx(Te,{component:"span",sx:{color:F1,fontSize:Xa.caption},children:e}),p.jsx(Te,{component:"span",sx:{fontFamily:n?os:void 0,wordBreak:"break-all"},children:t})]})}function ISe(e){const t=e.map(n=>n.name).join(", ");return`Reads the ${e.length===1?"given":"givens"} ${t}, set in the Givens section above`}function S6({givens:e}){return e.length===0?null:p.jsx(Br,{title:ISe(e),children:p.jsx(fs,{voice:"token",tone:"quiet",sx:{alignSelf:"center",flexShrink:0},children:"given"})})}function LSe(e){const t=P1(e.type,e.default);return t===void 0?"none — a value is required":t===""?"(empty)":t}function pT({givens:e,framed:t=!0}){return e.length===0?null:p.jsx(Te,{"data-testid":"model-viewer-given-card",sx:{...t?kh:{},p:$y,display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:"16px",rowGap:"6px",alignItems:"baseline",fontFamily:w6,fontSize:Xa.small,color:"text.primary"},children:e.map(n=>p.jsxs(Te,{sx:{display:"contents"},children:[p.jsx(oc,{label:"Given",value:n.name,mono:!0}),n.label&&p.jsx(oc,{label:"Label",value:n.label}),p.jsx(oc,{label:"Type",value:n.type,mono:!0}),p.jsx(oc,{label:"Default",value:LSe(n)}),n.description&&p.jsx(oc,{label:"Description",value:n.description})]},n.name))})}const C6=C.createContext({});function _1(){return C.useContext(C6)}function zSe(e,t,n=new Set){const r=t?.givens;if(!Array.isArray(r))return[];const o=[];for(const a of r){if(!a||typeof a!="object")continue;const i=a;if(typeof i.name!="string"||!i.name||typeof i.type!="string"||!i.type||n.has(i.name))continue;const s=Array.isArray(i.annotations)?i.annotations.filter(l=>typeof l=="string"):void 0;o.push({name:i.name,type:i.type,modelFile:e,...s&&{annotations:s},...typeof i.default=="string"&&{default:i.default},...i.required===!0&&{required:!0},...typeof i.label=="string"&&i.label&&{label:i.label},...typeof i.description=="string"&&i.description&&{description:i.description},...(i.control==="select"||i.control==="multiselect")&&{control:i.control},...typeof i.rangeMin=="number"&&{rangeMin:i.rangeMin},...typeof i.rangeMax=="number"&&{rangeMax:i.rangeMax},...i.suggest&&typeof i.suggest=="object"&&{suggest:i.suggest}})}return o}function FSe(e){return new Map(e.map(t=>[t.name,t.type]))}function _Se(e,t){const n=new Map(Array.from(e).filter(([a,i])=>t.has(a)&&!(i===""&&t.get(a)==="string"))),r=Jd(n,t),o=Object.entries(r).sort(([a],[i])=>a<i?-1:a>i?1:0);return o.length>0?Object.fromEntries(o):void 0}function hT(e){return e&&Object.keys(e).length>0?JSON.stringify(e):""}function BSe(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(!r||!r.startsWith("#(filter)"))continue;const o=qSe(r.slice(9).trim());o&&t.push(o)}return t}const USe=new Set(["equal","in","like","greater_than","less_than"]);function qSe(e){let t,n,r,o=!1,a=!1;for(const i of HSe(e)){if(i==="implicit"){o=!0;continue}if(i==="required"){a=!0;continue}const s=i.indexOf("=");if(s<=0)continue;const l=i.slice(0,s).trim();let d=i.slice(s+1).trim();d.length>=2&&d.startsWith('"')&&d.endsWith('"')&&(d=d.slice(1,-1)),l==="name"?t=d:l==="dimension"?n=d:l==="type"&&USe.has(d)&&(r=d)}return!n||!r?null:{name:t??n,dimension:n,type:r,implicit:o,required:a}}function HSe(e){const t=[];let n="",r=!1;for(const o of e){if(o==='"'){r=!r,n+=o;continue}if(!r&&/\s/.test(o)){n&&t.push(n),n="";continue}n+=o}return n&&t.push(n),t}const VSe=/^#\(index(_values)?\b/;function WSe(e){return!("annotations"in e)||!e.annotations?!1:e.annotations.some(t=>VSe.test(t.value?.trim()??""))}function YSe(e){const t=new Map;for(const n of e){const r=BSe(n.annotations).filter(o=>o.required&&!o.implicit).map(o=>o.name);r.length>0&&t.set(n.name,r)}return t}function GSe(e){return new Set(e.map(t=>t.name))}function KSe(e){const t=new Map;for(const n of e){if(!n.source)continue;let r=t.get(n.source);r||(r=new Map,t.set(n.source,r)),r.set(n.name,n)}return t}function iv(e){let t="",n=0;const r=(o,a)=>{t+=e.slice(o,a).replace(/[^\n]/g," "),n=a};for(;n<e.length;){const o=e[n],a=e.slice(n,n+2);if(a==="//"||a==="--"){const i=e.indexOf(`
485
485
  `,n);r(n,i===-1?e.length:i)}else if(a==="/*"){const i=e.indexOf("*/",n+2);r(n,i===-1?e.length:i+2)}else if(e.startsWith('"""',n)){const i=e.indexOf('"""',n+3),s=i===-1?e.length:i;t+='"""',n+=3,r(n,s),i!==-1&&(t+='"""',n+=3)}else if(o==="'"||o==='"'){t+=o;let i=n+1;for(;i<e.length&&e[i]!==o&&e[i]!==`
486
486
  `;)i+=e[i]==="\\"&&e[i+1]!==`
487
487
  `?2:1;r(n+1,Math.min(i,e.length)),e[n]===o&&(t+=o,n+=1)}else if(o==="`"){let i=n+1;for(;i<e.length&&e[i]!=="`"&&e[i]!==`
488
- `;)i+=e[i]==="\\"?2:1;const s=Math.min(i+1,e.length);t+=e.slice(n,s),n=s}else t+=o,n+=1}return t}function of(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yd(e,t){if(!e||t.length===0)return[];const n=iv(e);return t.filter(r=>new RegExp(`\\$${of(r.name)}(?![A-Za-z0-9_])`).test(n))}function KSe(e,t){if(!e)return new Set;const n=iv(e);return new Set(t.filter(r=>new RegExp(`(?<![A-Za-z0-9_$.])\`?${of(r.name)}\`?\\s*::`).test(n)).map(r=>r.name))}function QSe(e,t,n,r){if(!e)return{givens:[...t],unknown:new Set(t.map(m=>m.name))};const o=iv(e),a=new Set(Yd(e,t).map(m=>m.name)),i=new Set(a),s=new Set,l=m=>{i.add(m),a.has(m)||s.add(m)};for(const[m,g]of n??[])if(new RegExp(`(?<![A-Za-z0-9_$.])\`?${of(m)}\`?(?![A-Za-z0-9_])`).test(o)){for(const y of g)i.add(y.name);for(const y of r?.get(m)??[])l(y)}const d=/^\s*query\s*:\s*`?[A-Za-z_]\w*`?\s+is\s+/.exec(o),u=d?O$(o.slice(d[0].length)):void 0;if(u===void 0||u!==null&&!n?.has(u))for(const m of t)l(m.name);return{givens:t.filter(m=>i.has(m.name)),unknown:s}}function XSe(e,t,n){if(n.length===0)return{givens:[],unknown:new Set};const r=k6(e,t,n);return r?r.unresolved?{givens:[...n],unknown:new Set(n.filter(o=>!r.readHere.has(o.name)).map(o=>o.name))}:{givens:n.filter(o=>r.readHere.has(o.name)||!r.readByAnySource.has(o.name)),unknown:new Set}:{givens:[...n],unknown:new Set(n.map(o=>o.name))}}function ZSe(e,t,n,r){const o=new Map,a=k6(e,t,n);if(!a)return o;const i=new Set;for(const s of a.reached)if(!(s!==t&&!r.has(s)))for(const l of Yd(a.blocks.get(s),n))i.add(l.name);for(const s of a.reached)if(!(s===t||r.has(s)))for(const l of Yd(a.blocks.get(s),n))i.has(l.name)||o.set(l.name,[...o.get(l.name)??[],s]);return o}function k6(e,t,n){if(!e||n.length===0)return;const r=eCe(iv(e));if(!r.has(t))return;const o=new Set;for(const d of r.values())for(const u of Yd(d,n))o.add(u.name);const a=new Set;let i=!1;const s=d=>{if(a.has(d))return;a.add(d);const u=r.get(d);if(!u)return;const m=tCe(u,d,r);m.unresolved&&(i=!0);for(const g of m.sources)s(g)};s(t);const l=new Set;for(const d of a)for(const u of Yd(r.get(d),n))l.add(u.name);return{blocks:r,reached:a,readHere:l,readByAnySource:o,unresolved:i}}const JSe=/^(?:source|query|run|given|import)\b|^#/;function eCe(e){const t=new Map;let n,r=0;const o=()=>{n&&t.set(n.name,n.lines.join(`
488
+ `;)i+=e[i]==="\\"?2:1;const s=Math.min(i+1,e.length);t+=e.slice(n,s),n=s}else t+=o,n+=1}return t}function of(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yd(e,t){if(!e||t.length===0)return[];const n=iv(e);return t.filter(r=>new RegExp(`\\$${of(r.name)}(?![A-Za-z0-9_])`).test(n))}function QSe(e,t){if(!e)return new Set;const n=iv(e);return new Set(t.filter(r=>new RegExp(`(?<![A-Za-z0-9_$.])\`?${of(r.name)}\`?\\s*::`).test(n)).map(r=>r.name))}function XSe(e,t,n,r){if(!e)return{givens:[...t],unknown:new Set(t.map(m=>m.name))};const o=iv(e),a=new Set(Yd(e,t).map(m=>m.name)),i=new Set(a),s=new Set,l=m=>{i.add(m),a.has(m)||s.add(m)};for(const[m,g]of n??[])if(new RegExp(`(?<![A-Za-z0-9_$.])\`?${of(m)}\`?(?![A-Za-z0-9_])`).test(o)){for(const y of g)i.add(y.name);for(const y of r?.get(m)??[])l(y)}const d=/^\s*query\s*:\s*`?[A-Za-z_]\w*`?\s+is\s+/.exec(o),u=d?O$(o.slice(d[0].length)):void 0;if(u===void 0||u!==null&&!n?.has(u))for(const m of t)l(m.name);return{givens:t.filter(m=>i.has(m.name)),unknown:s}}function ZSe(e,t,n){if(n.length===0)return{givens:[],unknown:new Set};const r=k6(e,t,n);return r?r.unresolved?{givens:[...n],unknown:new Set(n.filter(o=>!r.readHere.has(o.name)).map(o=>o.name))}:{givens:n.filter(o=>r.readHere.has(o.name)||!r.readByAnySource.has(o.name)),unknown:new Set}:{givens:[...n],unknown:new Set(n.map(o=>o.name))}}function JSe(e,t,n,r){const o=new Map,a=k6(e,t,n);if(!a)return o;const i=new Set;for(const s of a.reached)if(!(s!==t&&!r.has(s)))for(const l of Yd(a.blocks.get(s),n))i.add(l.name);for(const s of a.reached)if(!(s===t||r.has(s)))for(const l of Yd(a.blocks.get(s),n))i.has(l.name)||o.set(l.name,[...o.get(l.name)??[],s]);return o}function k6(e,t,n){if(!e||n.length===0)return;const r=tCe(iv(e));if(!r.has(t))return;const o=new Set;for(const d of r.values())for(const u of Yd(d,n))o.add(u.name);const a=new Set;let i=!1;const s=d=>{if(a.has(d))return;a.add(d);const u=r.get(d);if(!u)return;const m=nCe(u,d,r);m.unresolved&&(i=!0);for(const g of m.sources)s(g)};s(t);const l=new Set;for(const d of a)for(const u of Yd(r.get(d),n))l.add(u.name);return{blocks:r,reached:a,readHere:l,readByAnySource:o,unresolved:i}}const eCe=/^(?:source|query|run|given|import)\b|^#/;function tCe(e){const t=new Map;let n,r=0;const o=()=>{n&&t.set(n.name,n.lines.join(`
489
489
  `)),n=void 0};for(const a of e.split(`
490
- `)){const i=r===0?/^source\s*:\s*`?([A-Za-z_]\w*)`?\s+is\b/.exec(a):null;i?(o(),n={name:i[1],lines:[a]}):r===0&&JSe.test(a)?o():n&&n.lines.push(a);for(const s of a)s==="{"?r+=1:s==="}"&&(r=Math.max(0,r-1))}return o(),t}function tCe(e,t,n){const r=[];let o=!1;const a=l=>{l===null||l===t||(l!==void 0&&n.has(l)?r.push(l):o=!0)},i=new RegExp(`source\\s*:\\s*\`?${of(t)}\`?\\s+is\\s+`).exec(e);i&&a(O$(e.slice(i.index+i[0].length)));const s=/join_\w+\s*:\s*`?([A-Za-z_]\w*)`?(\s+is\s+)?/g;for(let l=s.exec(e);l;l=s.exec(e))a(l[2]?O$(e.slice(l.index+l[0].length)):l[1]);return{sources:r,unresolved:o}}function O$(e){const t=/^`?([A-Za-z_]\w*)`?/.exec(e);if(!t)return;const n=e.slice(t[0].length).trimStart();if(n.startsWith("."))return null;if(!n.startsWith("("))return t[1]}const Ry={"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},$6=C.createContext(void 0);function mT({layer:e,title:t,children:n,testId:r}){const o=C.useContext($6);if(!o||!e||!o.layers.includes(e))return p.jsx(Br,{title:t,children:p.jsx(Te,{component:"span",tabIndex:0,role:"img","aria-label":t,"data-testid":r,sx:{display:"inline-flex",borderRadius:1,...Ry},children:n})});const a=o.openLayer===e;return p.jsx(Br,{title:t,children:p.jsx(Te,{component:"button",type:"button",onClick:()=>o.toggle(e),"aria-expanded":a,"aria-controls":o.cardId,"aria-label":`${t} ${a?"Hide":"Show"} details.`,"data-testid":r,"data-header-chip":e,sx:{appearance:"none",border:"none",background:"none",font:"inherit",p:0,cursor:"pointer",display:"inline-flex",alignItems:"center",borderRadius:1,"& [data-pill-tone]":{transition:"filter 120ms ease",...a?{filter:"brightness(0.9)"}:{}},"&:hover [data-pill-tone]":{filter:a?"brightness(0.9)":"brightness(0.94)"},...Ry},children:n})})}function nCe(e){try{const{data:t}=JSON.parse(e);return t?.kind==="array_cell"?t.array_value.length:t?.kind==="record_cell"?1:0}catch{return}}const rCe={authorize:[],accessFilter:[]};function _I(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[]}function oCe(e){const t=new Map,n=e?.sources;if(!Array.isArray(n))return t;for(const r of n){if(!r||typeof r!="object")continue;const o=r;if(typeof o.name!="string"||!o.name)continue;const a=_I(o.authorize),i=_I(o.accessFilter);a.length===0&&i.length===0||t.set(o.name,{authorize:a,accessFilter:i})}return t}function b0(e,t){return t&&e?.get(t)||rCe}function mc(e){return!!e&&e.authorize.some(t=>t.trim()!=="true")}function Mu(e){return!!e&&e.accessFilter.length>0}const BI=/^\(?\s*(?:'([^']*)'|"([^"]*)")\s+in\s+\$GROUPS\s*\)?$/;function aCe(e){const t=e.trim();if(t==="false")return"no one";const n=BI.exec(t);if(n)return`members of ${n[1]??n[2]}`;for(const r of["or","and"]){const o=t.split(new RegExp(`\\s+${r}\\s+`));if(o.length<2)continue;const a=o.map(i=>BI.exec(i.trim()));if(a.every(i=>i)){const i=a.map(s=>s[1]??s[2]);return r==="or"?`members of ${i.slice(0,-1).join(", ")} or ${i[i.length-1]}`:`members of all of ${i.join(", ")}`}}}function R6(e){const t=e.authorize.filter(n=>n.trim()!=="true").map(n=>aCe(n)??"readers its access rule admits");return Array.from(new Set(t)).join(", and ")}const T6="Only some readers can query this source",E6="Each reader sees only the rows they're allowed to see";function iCe(e,t){return e?mc(t)?`You can't access ${e}. It is restricted to ${R6(t)}; ask an administrator of this package for access.`:`You can't access ${e}. Ask an administrator of this package for access.`:"You don't have access to run this. Ask an administrator of this package for access."}function sCe(e,t){if(!(!Mu(e)||t===void 0))return nCe(t)===0?"Filtered to your rows: this source shows each reader only the rows they're allowed to see.":void 0}function M6(e){return mc(e)||Mu(e)}function lCe(e,t){return`This join doesn't apply the ${mc(t)&&Mu(t)?"access rule and row filter":mc(t)?"access rule":"row filter"} on ${e}: its rows are read under this source's rules.`}function cCe({access:e}){return p.jsxs(p.Fragment,{children:[mc(e)&&p.jsx(UI,{label:"Restricted",meaning:T6}),Mu(e)&&p.jsx(UI,{label:"Row filtered",meaning:E6})]})}function UI({label:e,meaning:t}){return p.jsx(mT,{layer:"access",title:`${e}: ${t}`,testId:`source-access-chip-${e==="Restricted"?"restricted":"row-filtered"}`,children:p.jsx(fs,{tone:"neutral",size:"header",children:e})})}function O6({access:e}){return p.jsxs(p.Fragment,{children:[mc(e)&&p.jsx(Br,{title:`Restricted: ${T6}`,children:p.jsx(fs,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Restricted"})}),Mu(e)&&p.jsx(Br,{title:`Row filtered: ${E6}`,children:p.jsx(fs,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Row filtered"})})]})}function uCe(e){return[mc(e)&&"restricted",Mu(e)&&"row filtered"].filter(Boolean).map(t=>`, ${t}`).join("")}function dCe({access:e,showRules:t}){const n=mc(e),r=Mu(e);return!n&&!r?null:p.jsxs(Te,{"data-testid":"source-access-facts",sx:{display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:"16px",rowGap:"6px",alignItems:"baseline"},children:[n&&p.jsx(oc,{label:"Restricted to",value:R6(e)}),n&&t&&e.authorize.filter(o=>o.trim()!=="true").map((o,a)=>p.jsx(oc,{label:"Access rule",value:o,mono:!0},`a${a}`)),r&&p.jsx(oc,{label:"Rows",value:"Rows are filtered for each reader"}),r&&t&&e.accessFilter.map((o,a)=>p.jsx(oc,{label:"Row filter",value:o,mono:!0},`f${a}`))]})}const qI="Private",fCe="index.malloy doesn't export this file, so only people who can edit the package see it.";function HI(){return p.jsx(mT,{title:`${qI}: ${fCe}`,testId:"model-viewer-off-surface",children:p.jsx(fs,{tone:"warning",size:"header",children:qI})})}const VI="Public",pCe="index.malloy exports this source, so everyone who can read the package can query it.";function hCe(){return p.jsx(mT,{title:`${VI}: ${pCe}`,testId:"model-viewer-public-surface",children:p.jsx(fs,{tone:"positive",size:"header",children:VI})})}function mCe(e){const t=C.useRef(e);return e!==void 0&&(t.current=e),t.current}function OC({title:e,titleAdornments:t,kindLabel:n,meta:r,doc:o,provenance:a,actions:i,status:s,headingLevel:l="h1",modelDoc:d,access:u,showRules:m=!1,isSource:g=!0,offSurface:y,publicSurface:x=!1}){const w=mc(u)||Mu(u),S=w?["access"]:[],[b,$]=C.useState(void 0),k=b!==void 0&&S.includes(b)?b:void 0,T=mCe(k),O=C.useId(),P={openLayer:k,layers:S,toggle:L=>$(_=>_===L?void 0:L),cardId:O},D=w||y||x||!!s,A=Vr().theme.ui.type.pageTitle,F=typeof A.fontSize=="number"?`${A.fontSize}px`:A.fontSize;return p.jsxs(Te,{children:[p.jsxs(Te,{"data-testid":"model-viewer-source-heading",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,pt:M$,pb:.5},children:[p.jsx(Te,{component:l,sx:{m:0,fontSize:l==="h1"?F:`calc(${F} * 0.8)`,fontWeight:A.fontWeight??600,lineHeight:1.25,color:"text.primary",fontFamily:os,minWidth:0,overflowWrap:"anywhere"},children:e}),t,i&&p.jsx(Te,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1},children:i})]}),!g&&y&&p.jsx(Te,{sx:{display:"flex",alignItems:"center",pt:.5,pb:1},children:p.jsx(HI,{})}),g&&D&&p.jsx($6.Provider,{value:P,children:p.jsxs(Te,{"data-testid":"model-viewer-status-row",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,pt:.5,pb:1},children:[p.jsx(cCe,{access:u}),y&&p.jsx(HI,{}),x&&p.jsx(hCe,{}),s]})}),d&&p.jsx(WI,{doc:d,label:"model description",testId:"model-viewer-model-doc"},`model:${d}`),o&&p.jsx(WI,{doc:o},o),(n!==void 0||r!==void 0||a)&&p.jsxs(Te,{"data-testid":"model-viewer-source-meta",sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,pb:2,fontSize:Xa.body,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n!==void 0&&p.jsx(Te,{component:"span","data-testid":"model-viewer-source-kind",children:n}),n!==void 0&&(r!==void 0||a)&&p.jsx(Te,{component:"span","aria-hidden":!0,children:"·"}),r!==void 0&&p.jsx(Te,{component:"span",children:r}),r!==void 0&&a&&p.jsx(Te,{component:"span","aria-hidden":!0,children:"·"}),a&&p.jsx(Te,{component:"span",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:a})]}),p.jsx(Up,{in:k!==void 0,timeout:"auto",unmountOnExit:!0,children:p.jsx(Te,{id:O,"data-testid":"model-viewer-source-detail","data-layer":T??void 0,sx:{...kh,p:$y,mb:2},children:T==="access"&&u&&p.jsx(dCe,{access:u,showRules:m})})})]})}const gCe=2;function WI({doc:e,label:t="description",testId:n="model-viewer-source-doc"}){const[r,o]=C.useState(!1),[a,i]=C.useState(!1),s=C.useRef(null);return C.useEffect(()=>{const l=s.current;if(!l||r)return;const d=()=>i(l.scrollHeight>l.clientHeight+1);if(d(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(d);return u.observe(l),()=>u.disconnect()},[r,e]),p.jsxs(Te,{"data-testid":n,sx:{pb:.5},children:[p.jsx(Te,{ref:s,sx:{fontSize:Xa.body,lineHeight:1.5,color:"text.secondary",whiteSpace:"pre-line",...r?{}:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:gCe,overflow:"hidden"}},children:P6(e)}),(a||r)&&p.jsx(Te,{component:"button",type:"button",onClick:()=>o(!r),"aria-expanded":r,"aria-label":r?`Show less of the ${t}`:`Show the full ${t}`,sx:{all:"unset",cursor:"pointer",fontSize:Xa.small,color:"text.secondary",textDecoration:"underline","&:hover":{color:"text.primary"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}},children:r?"Less":"More"})]})}function P6(e){return e.split(/(`[^`\n]+`)/g).map((t,n)=>/^`[^`]+`$/.test(t)?p.jsx(Te,{component:"code",sx:{fontFamily:os,fontSize:"0.92em",color:"text.primary"},children:t.slice(1,-1)},n):t)}function B1(e){const t=e?.response?.status;return typeof t=="number"?t:void 0}function yCe(e){const t=B1(e);return t===403||t===404}function vCe(e,t){if(!e?.modelPath||!e.sourceName)return{kind:"unknown"};const n=t.get(e.modelPath);return n?n.has(e.sourceName)?{kind:"link"}:{kind:"join-only"}:{kind:"unknown"}}const gT=C.createContext([]),nx="text.primary",mg=e=>({main:e,tint:`color-mix(in srgb, ${e} 12%, transparent)`,onTint:e}),Tp={steel:mg(hr.cyan),sage:mg(hr.lime),brown:mg(hr.slate),olive:mg(hr.violet),amber:mg(hr.amber)};function YI(e){return e==="measure"?Tp.sage:e==="calculate"?Tp.amber:e==="view"?Tp.olive:Tp.steel}const GI=["steel","brown","olive","sage"];function bCe(e){return GI[e%GI.length]}const j6={small:13,caption:12},xCe={fontFamily:os,fontSize:j6.small,fontWeight:500,color:nx},A6={fontSize:j6.caption,color:"text.secondary"};function sh({label:e,count:t,level:n="h2",testId:r,action:o,children:a}){return t===0?null:n==="h3"?p.jsxs(Te,{component:"section","aria-label":e,"data-testid":r,sx:{mb:2},children:[p.jsx(Te,{component:"h3",sx:{m:0,mb:1,fontSize:Xa.bodyLarge,fontWeight:E$.strong,color:nx},children:e}),a]}):p.jsxs(Te,{component:"section","aria-label":e,"data-testid":r,sx:{mb:3},children:[p.jsxs(Te,{sx:{mb:2},children:[p.jsx(Te,{component:"h2",sx:{m:0,fontSize:"1.25rem",fontWeight:E$.strong,color:nx},children:e}),o&&p.jsx(Te,{sx:{...A6,mt:.25,display:"flex",alignItems:"center"},children:o})]}),a]})}function Qg(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e.at(-1)}`}function KI(e,t){return`${e.label??e.name}: ${t0e(e,t)}`}const Hb=e=>e.label??e.name;function D6(e,t,n=void 0,r=void 0,o=!1,a="source"){const i=e??[],s=k=>n?.[k.name]!==void 0,l=k=>r?.has(k.name)===!0,d=i.filter(k=>!s(k)&&k.default===void 0),u=t??[],m=u.length===0&&d.length>0&&d.every(k=>l(k)),g=o&&m?d:[];if(g.length===0&&(d.length>0||u.length>0)){const k=d.length>0?`a value for ${d.length===1?"the given":"the givens"} ${d.map(Hb).join(", ")}`:"",T=u.length>0?`${u.length===1?"the required filter":"the required filters"} ${u.join(", ")}`:"",O=d.filter(l),P=O.length===0?"":O.length===d.length?` This page can't tell whether this ${a} reads ${d.length===1?"it":"them"}.`:` This page can't tell whether this ${a} reads ${Qg(O.map(Hb),"or")}.`;let D;return T===""?D=`This needs ${k}. Set ${d.length===1?"it":"them"} in the Givens section above.${P}`:k===""?D=`This needs ${T}, which this page can't set; open the source in a dashboard or notebook.`:D=`This needs ${k} (set ${d.length===1?"it":"them"} in the Givens section above) and ${T}, which this page can't set; open the source in a dashboard or notebook.${P}`,{kind:"blocked",reason:D,canRunAnyway:m}}const y=k=>k.length>0?`${k.length===1?"the default":"the defaults"} ${k.map(T=>KI(T)).join(", ")}`:"",x=[];g.length>0&&x.push(`Ran without a value for ${g.length===1?"the given":"the givens"} ${Qg(g.map(Hb),"and")}, which this page can't tell this ${a} reads.`);const w=i.filter(k=>!g.includes(k)),S=w.filter(k=>!l(k)),b=y(S.filter(k=>!s(k)));b!==""&&x.push(`Ran with ${b}.`);const $=w.filter(l);if($.length>0){const k=[$.filter(s).map(T=>KI(T,n?.[T.name])).join(", "),y($.filter(T=>!s(T)))].filter(T=>T!=="").join(" and ");x.push($.length===w.length?`This page can't tell which givens this ${a} reads. Where it reads one, it ran with ${k}.`:`This page can't tell whether this ${a} reads ${Qg($.map(Hb),"or")}. Where it does, it ran with ${k}.`)}return x.length>0?{kind:"noted",note:x.join(" ")}:{kind:"ok"}}const wCe=400;function SCe({givens:e,unknown:t,inheritedFrom:n,values:r,onChange:o,onReset:a,environmentName:i,packageName:s,modelPath:l,versionId:d,declaredTypes:u}){const m=C.useMemo(()=>[...e],[e]),g=C.useMemo(()=>{const D=e.filter(A=>t?.has(A.name));if(D.length!==0)return D.length===e.length?"This page can't tell which of these givens this source reads, so a value set here may not apply to it.":`This page can't tell whether this source reads ${Qg(D.map(A=>A.label??A.name),"or")}, so a value set for ${D.length===1?"it":"them"} may not apply.`},[e,t]),[y,x]=C.useState(()=>new Set),w=C.useCallback(D=>x(A=>A.has(D)?A:new Set([...A,D])),[]),S=u_(r,wCe),b=C.useMemo(()=>({values:S,declaredTypes:u}),[S,u]),{options:$,isLoading:k,failed:T,truncated:O,search:P}=qF(i,s,l,m,d,b,void 0,y,!0);return p.jsxs(sh,{label:"Givens",count:e.length,testId:"model-givens-section",children:[p.jsx(Te,{sx:{"& .MuiPaper-root":{borderColor:"divider"}},children:p.jsx(j1,{layout:"bar",givens:m,values:r,onChange:o,onReset:a,options:$,optionsLoading:k,optionsFailed:T,optionsTruncated:O,optionSearch:P,onControlOpen:w})}),g&&p.jsx(Wd,{"data-testid":"model-givens-unknown",sx:{mt:1},children:g}),n&&n.size>0&&p.jsx(Wd,{"data-testid":"model-givens-inherited",sx:{mt:1},children:[...n].map(([D,A])=>A.length===1?`${D} is inherited from ${A[0]}, which this model doesn't export.`:`${D} is inherited from ${A.slice(0,-1).join(", ")} and ${A.at(-1)}, none of which this model exports.`).join(" ")})]})}const CCe="A source is a queryable entry point into the model — pick one to browse its dimensions, measures, views and joins.";function kCe(e,t=!1){return e===0?"No sources":`${e} ${t?"public ":""}source${e===1?"":"s"}`}const $Ce=Jt(p.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),RCe=Jt(p.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),TCe=Jt(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),ECe=Jt([p.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V5h14z"},"0"),p.jsx("path",{d:"M6.25 7.72h5v1.5h-5zM13 15.75h5v1.5h-5zm0-2.5h5v1.5h-5zM8 18h1.5v-2h2v-1.5h-2v-2H8v2H6V16h2zm6.09-7.05 1.41-1.41 1.41 1.41 1.06-1.06-1.41-1.42 1.41-1.41L16.91 6 15.5 7.41 14.09 6l-1.06 1.06 1.41 1.41-1.41 1.42z"},"1")]),N6=Jt(p.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"})),MCe=Jt(p.jsx("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"})),OCe=Jt(p.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),PCe=Jt(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),jCe=Jt(p.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),ACe=Jt(p.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),DCe=Jt(p.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"})),I6=Jt(p.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"})),NCe=Jt(p.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"})),ICe=Jt(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),L6=Jt(p.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"})),LCe=Jt([p.jsx("path",{d:"m21.41 11.41-8.83-8.83c-.37-.37-.88-.58-1.41-.58H4c-1.1 0-2 .9-2 2v7.17c0 .53.21 1.04.59 1.41l8.83 8.83c.78.78 2.05.78 2.83 0l7.17-7.17c.78-.78.78-2.04-.01-2.83M12.83 20 4 11.17V4h7.17L20 12.83z"},"0"),p.jsx("circle",{cx:"6.5",cy:"6.5",r:"1.5"},"1")]),z6=Jt(p.jsx("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4m0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),zCe=Jt(p.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),F6=Jt(p.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),FCe=Jt(p.jsx("path",{d:"M12 5.99 19.53 19H4.47zM12 2 1 21h22zm1 14h-2v2h2zm0-6h-2v4h2z"}));function Ao(e,t){const n=({size:r,...o})=>p.jsx(e,{...o,sx:{fontSize:r}});return n.displayName=t,n}const _Ce=Ao($Ce,"IconText"),QI=Ao(RCe,"IconOpen"),_6=Ao(TCe,"IconResult"),BCe=Ao(ECe,"IconCalculation"),UCe=Ao(N6,"IconDate"),qCe=Ao(MCe,"IconJoin"),HCe=Ao(OCe,"IconCode"),VCe=Ao(PCe,"IconList"),WCe=Ao(jCe,"IconRecord"),YCe=Ao(ACe,"IconCollapse"),GCe=Ao(hF,"IconExpand"),KCe=Ao(DCe,"IconFields"),QCe=Ao(I6,"IconDropdown"),XCe=Ao(NCe,"IconLock"),B6=Ao(ICe,"IconNumber"),ZCe=Ao(L6,"IconTimestamp"),JCe=Ao(LCe,"IconValues"),eke=Ao(z6,"IconBoolean"),tke=Ao(zCe,"IconGivens"),U6=Ao(F6,"IconColumn");Ao(FCe,"IconWarning");const Ty=C.createContext(void 0);function yT(){const[e,t]=C.useState(!1),n=C.useContext(Ty),[r,o]=C.useState(n?.n);return n&&n.n!==r&&(o(n.n),t(n.open)),[e,t]}function nke({allOpen:e,onToggle:t,noun:n,disabledReason:r}){const o=e?p.jsx(YCe,{size:16,"aria-hidden":!0}):p.jsx(GCe,{size:16,"aria-hidden":!0});return p.jsx(Br,{title:r??"",children:p.jsx("span",{children:p.jsxs(is,{disabled:!!r,onClick:t,"aria-label":r??`${e?"Collapse":"Expand"} all ${n[1]}`,sx:{font:"inherit",color:"text.secondary",gap:.25,borderRadius:1,"&:hover":{color:"text.primary",textDecoration:"underline"},...Ry,"&.Mui-disabled":{opacity:.5}},children:[o,e?"Collapse all":"Expand all"]})})})}function rx({noun:e,disabledReason:t}){const[n,r]=C.useState(void 0),o=n?.open??!1;return{command:n,action:p.jsx(nke,{allOpen:o,onToggle:()=>r({open:!o,n:(n?.n??0)+1}),noun:e,disabledReason:t})}}let PC;function rke(e,t){if(PC?.text===t)return PC.parsed;const n=t.replace(/\r\n/g,`
490
+ `)){const i=r===0?/^source\s*:\s*`?([A-Za-z_]\w*)`?\s+is\b/.exec(a):null;i?(o(),n={name:i[1],lines:[a]}):r===0&&eCe.test(a)?o():n&&n.lines.push(a);for(const s of a)s==="{"?r+=1:s==="}"&&(r=Math.max(0,r-1))}return o(),t}function nCe(e,t,n){const r=[];let o=!1;const a=l=>{l===null||l===t||(l!==void 0&&n.has(l)?r.push(l):o=!0)},i=new RegExp(`source\\s*:\\s*\`?${of(t)}\`?\\s+is\\s+`).exec(e);i&&a(O$(e.slice(i.index+i[0].length)));const s=/join_\w+\s*:\s*`?([A-Za-z_]\w*)`?(\s+is\s+)?/g;for(let l=s.exec(e);l;l=s.exec(e))a(l[2]?O$(e.slice(l.index+l[0].length)):l[1]);return{sources:r,unresolved:o}}function O$(e){const t=/^`?([A-Za-z_]\w*)`?/.exec(e);if(!t)return;const n=e.slice(t[0].length).trimStart();if(n.startsWith("."))return null;if(!n.startsWith("("))return t[1]}const Ry={"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},$6=C.createContext(void 0);function mT({layer:e,title:t,children:n,testId:r}){const o=C.useContext($6);if(!o||!e||!o.layers.includes(e))return p.jsx(Br,{title:t,children:p.jsx(Te,{component:"span",tabIndex:0,role:"img","aria-label":t,"data-testid":r,sx:{display:"inline-flex",borderRadius:1,...Ry},children:n})});const a=o.openLayer===e;return p.jsx(Br,{title:t,children:p.jsx(Te,{component:"button",type:"button",onClick:()=>o.toggle(e),"aria-expanded":a,"aria-controls":o.cardId,"aria-label":`${t} ${a?"Hide":"Show"} details.`,"data-testid":r,"data-header-chip":e,sx:{appearance:"none",border:"none",background:"none",font:"inherit",p:0,cursor:"pointer",display:"inline-flex",alignItems:"center",borderRadius:1,"& [data-pill-tone]":{transition:"filter 120ms ease",...a?{filter:"brightness(0.9)"}:{}},"&:hover [data-pill-tone]":{filter:a?"brightness(0.9)":"brightness(0.94)"},...Ry},children:n})})}function rCe(e){try{const{data:t}=JSON.parse(e);return t?.kind==="array_cell"?t.array_value.length:t?.kind==="record_cell"?1:0}catch{return}}const oCe={authorize:[],accessFilter:[]};function _I(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[]}function aCe(e){const t=new Map,n=e?.sources;if(!Array.isArray(n))return t;for(const r of n){if(!r||typeof r!="object")continue;const o=r;if(typeof o.name!="string"||!o.name)continue;const a=_I(o.authorize),i=_I(o.accessFilter);a.length===0&&i.length===0||t.set(o.name,{authorize:a,accessFilter:i})}return t}function b0(e,t){return t&&e?.get(t)||oCe}function mc(e){return!!e&&e.authorize.some(t=>t.trim()!=="true")}function Mu(e){return!!e&&e.accessFilter.length>0}const BI=/^\(?\s*(?:'([^']*)'|"([^"]*)")\s+in\s+\$GROUPS\s*\)?$/;function iCe(e){const t=e.trim();if(t==="false")return"no one";const n=BI.exec(t);if(n)return`members of ${n[1]??n[2]}`;for(const r of["or","and"]){const o=t.split(new RegExp(`\\s+${r}\\s+`));if(o.length<2)continue;const a=o.map(i=>BI.exec(i.trim()));if(a.every(i=>i)){const i=a.map(s=>s[1]??s[2]);return r==="or"?`members of ${i.slice(0,-1).join(", ")} or ${i[i.length-1]}`:`members of all of ${i.join(", ")}`}}}function R6(e){const t=e.authorize.filter(n=>n.trim()!=="true").map(n=>iCe(n)??"readers its access rule admits");return Array.from(new Set(t)).join(", and ")}const T6="Only some readers can query this source",E6="Each reader sees only the rows they're allowed to see";function sCe(e,t){return e?mc(t)?`You can't access ${e}. It is restricted to ${R6(t)}; ask an administrator of this package for access.`:`You can't access ${e}. Ask an administrator of this package for access.`:"You don't have access to run this. Ask an administrator of this package for access."}function lCe(e,t){if(!(!Mu(e)||t===void 0))return rCe(t)===0?"Filtered to your rows: this source shows each reader only the rows they're allowed to see.":void 0}function M6(e){return mc(e)||Mu(e)}function cCe(e,t){return`This join doesn't apply the ${mc(t)&&Mu(t)?"access rule and row filter":mc(t)?"access rule":"row filter"} on ${e}: its rows are read under this source's rules.`}function uCe({access:e}){return p.jsxs(p.Fragment,{children:[mc(e)&&p.jsx(UI,{label:"Restricted",meaning:T6}),Mu(e)&&p.jsx(UI,{label:"Row filtered",meaning:E6})]})}function UI({label:e,meaning:t}){return p.jsx(mT,{layer:"access",title:`${e}: ${t}`,testId:`source-access-chip-${e==="Restricted"?"restricted":"row-filtered"}`,children:p.jsx(fs,{tone:"neutral",size:"header",children:e})})}function O6({access:e}){return p.jsxs(p.Fragment,{children:[mc(e)&&p.jsx(Br,{title:`Restricted: ${T6}`,children:p.jsx(fs,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Restricted"})}),Mu(e)&&p.jsx(Br,{title:`Row filtered: ${E6}`,children:p.jsx(fs,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Row filtered"})})]})}function dCe(e){return[mc(e)&&"restricted",Mu(e)&&"row filtered"].filter(Boolean).map(t=>`, ${t}`).join("")}function fCe({access:e,showRules:t}){const n=mc(e),r=Mu(e);return!n&&!r?null:p.jsxs(Te,{"data-testid":"source-access-facts",sx:{display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:"16px",rowGap:"6px",alignItems:"baseline"},children:[n&&p.jsx(oc,{label:"Restricted to",value:R6(e)}),n&&t&&e.authorize.filter(o=>o.trim()!=="true").map((o,a)=>p.jsx(oc,{label:"Access rule",value:o,mono:!0},`a${a}`)),r&&p.jsx(oc,{label:"Rows",value:"Rows are filtered for each reader"}),r&&t&&e.accessFilter.map((o,a)=>p.jsx(oc,{label:"Row filter",value:o,mono:!0},`f${a}`))]})}const qI="Private",pCe="index.malloy doesn't export this file, so only people who can edit the package see it.";function HI(){return p.jsx(mT,{title:`${qI}: ${pCe}`,testId:"model-viewer-off-surface",children:p.jsx(fs,{tone:"warning",size:"header",children:qI})})}const VI="Public",hCe="index.malloy exports this source, so everyone who can read the package can query it.";function mCe(){return p.jsx(mT,{title:`${VI}: ${hCe}`,testId:"model-viewer-public-surface",children:p.jsx(fs,{tone:"positive",size:"header",children:VI})})}function gCe(e){const t=C.useRef(e);return e!==void 0&&(t.current=e),t.current}function OC({title:e,titleAdornments:t,kindLabel:n,meta:r,doc:o,provenance:a,actions:i,status:s,headingLevel:l="h1",modelDoc:d,access:u,showRules:m=!1,isSource:g=!0,offSurface:y,publicSurface:x=!1}){const w=mc(u)||Mu(u),S=w?["access"]:[],[b,$]=C.useState(void 0),k=b!==void 0&&S.includes(b)?b:void 0,T=gCe(k),O=C.useId(),P={openLayer:k,layers:S,toggle:L=>$(_=>_===L?void 0:L),cardId:O},D=w||y||x||!!s,A=Vr().theme.ui.type.pageTitle,F=typeof A.fontSize=="number"?`${A.fontSize}px`:A.fontSize;return p.jsxs(Te,{children:[p.jsxs(Te,{"data-testid":"model-viewer-source-heading",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,pt:M$,pb:.5},children:[p.jsx(Te,{component:l,sx:{m:0,fontSize:l==="h1"?F:`calc(${F} * 0.8)`,fontWeight:A.fontWeight??600,lineHeight:1.25,color:"text.primary",fontFamily:os,minWidth:0,overflowWrap:"anywhere"},children:e}),t,i&&p.jsx(Te,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1},children:i})]}),!g&&y&&p.jsx(Te,{sx:{display:"flex",alignItems:"center",pt:.5,pb:1},children:p.jsx(HI,{})}),g&&D&&p.jsx($6.Provider,{value:P,children:p.jsxs(Te,{"data-testid":"model-viewer-status-row",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,pt:.5,pb:1},children:[p.jsx(uCe,{access:u}),y&&p.jsx(HI,{}),x&&p.jsx(mCe,{}),s]})}),d&&p.jsx(WI,{doc:d,label:"model description",testId:"model-viewer-model-doc"},`model:${d}`),o&&p.jsx(WI,{doc:o},o),(n!==void 0||r!==void 0||a)&&p.jsxs(Te,{"data-testid":"model-viewer-source-meta",sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,pb:2,fontSize:Xa.body,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n!==void 0&&p.jsx(Te,{component:"span","data-testid":"model-viewer-source-kind",children:n}),n!==void 0&&(r!==void 0||a)&&p.jsx(Te,{component:"span","aria-hidden":!0,children:"·"}),r!==void 0&&p.jsx(Te,{component:"span",children:r}),r!==void 0&&a&&p.jsx(Te,{component:"span","aria-hidden":!0,children:"·"}),a&&p.jsx(Te,{component:"span",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:a})]}),p.jsx(Up,{in:k!==void 0,timeout:"auto",unmountOnExit:!0,children:p.jsx(Te,{id:O,"data-testid":"model-viewer-source-detail","data-layer":T??void 0,sx:{...kh,p:$y,mb:2},children:T==="access"&&u&&p.jsx(fCe,{access:u,showRules:m})})})]})}const yCe=2;function WI({doc:e,label:t="description",testId:n="model-viewer-source-doc"}){const[r,o]=C.useState(!1),[a,i]=C.useState(!1),s=C.useRef(null);return C.useEffect(()=>{const l=s.current;if(!l||r)return;const d=()=>i(l.scrollHeight>l.clientHeight+1);if(d(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(d);return u.observe(l),()=>u.disconnect()},[r,e]),p.jsxs(Te,{"data-testid":n,sx:{pb:.5},children:[p.jsx(Te,{ref:s,sx:{fontSize:Xa.body,lineHeight:1.5,color:"text.secondary",whiteSpace:"pre-line",...r?{}:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:yCe,overflow:"hidden"}},children:P6(e)}),(a||r)&&p.jsx(Te,{component:"button",type:"button",onClick:()=>o(!r),"aria-expanded":r,"aria-label":r?`Show less of the ${t}`:`Show the full ${t}`,sx:{all:"unset",cursor:"pointer",fontSize:Xa.small,color:"text.secondary",textDecoration:"underline","&:hover":{color:"text.primary"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}},children:r?"Less":"More"})]})}function P6(e){return e.split(/(`[^`\n]+`)/g).map((t,n)=>/^`[^`]+`$/.test(t)?p.jsx(Te,{component:"code",sx:{fontFamily:os,fontSize:"0.92em",color:"text.primary"},children:t.slice(1,-1)},n):t)}function B1(e){const t=e?.response?.status;return typeof t=="number"?t:void 0}function vCe(e){const t=B1(e);return t===403||t===404}function bCe(e,t){if(!e?.modelPath||!e.sourceName)return{kind:"unknown"};const n=t.get(e.modelPath);return n?n.has(e.sourceName)?{kind:"link"}:{kind:"join-only"}:{kind:"unknown"}}const gT=C.createContext([]),nx="text.primary",mg=e=>({main:e,tint:`color-mix(in srgb, ${e} 12%, transparent)`,onTint:e}),Tp={steel:mg(hr.cyan),sage:mg(hr.lime),brown:mg(hr.slate),olive:mg(hr.violet),amber:mg(hr.amber)};function YI(e){return e==="measure"?Tp.sage:e==="calculate"?Tp.amber:e==="view"?Tp.olive:Tp.steel}const GI=["steel","brown","olive","sage"];function xCe(e){return GI[e%GI.length]}const j6={small:13,caption:12},wCe={fontFamily:os,fontSize:j6.small,fontWeight:500,color:nx},A6={fontSize:j6.caption,color:"text.secondary"};function sh({label:e,count:t,level:n="h2",testId:r,action:o,children:a}){return t===0?null:n==="h3"?p.jsxs(Te,{component:"section","aria-label":e,"data-testid":r,sx:{mb:2},children:[p.jsx(Te,{component:"h3",sx:{m:0,mb:1,fontSize:Xa.bodyLarge,fontWeight:E$.strong,color:nx},children:e}),a]}):p.jsxs(Te,{component:"section","aria-label":e,"data-testid":r,sx:{mb:3},children:[p.jsxs(Te,{sx:{mb:2},children:[p.jsx(Te,{component:"h2",sx:{m:0,fontSize:"1.25rem",fontWeight:E$.strong,color:nx},children:e}),o&&p.jsx(Te,{sx:{...A6,mt:.25,display:"flex",alignItems:"center"},children:o})]}),a]})}function Qg(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e.at(-1)}`}function KI(e,t){return`${e.label??e.name}: ${t0e(e,t)}`}const Hb=e=>e.label??e.name;function D6(e,t,n=void 0,r=void 0,o=!1,a="source"){const i=e??[],s=k=>n?.[k.name]!==void 0,l=k=>r?.has(k.name)===!0,d=i.filter(k=>!s(k)&&k.default===void 0),u=t??[],m=u.length===0&&d.length>0&&d.every(k=>l(k)),g=o&&m?d:[];if(g.length===0&&(d.length>0||u.length>0)){const k=d.length>0?`a value for ${d.length===1?"the given":"the givens"} ${d.map(Hb).join(", ")}`:"",T=u.length>0?`${u.length===1?"the required filter":"the required filters"} ${u.join(", ")}`:"",O=d.filter(l),P=O.length===0?"":O.length===d.length?` This page can't tell whether this ${a} reads ${d.length===1?"it":"them"}.`:` This page can't tell whether this ${a} reads ${Qg(O.map(Hb),"or")}.`;let D;return T===""?D=`This needs ${k}. Set ${d.length===1?"it":"them"} in the Givens section above.${P}`:k===""?D=`This needs ${T}, which this page can't set; open the source in a dashboard or notebook.`:D=`This needs ${k} (set ${d.length===1?"it":"them"} in the Givens section above) and ${T}, which this page can't set; open the source in a dashboard or notebook.${P}`,{kind:"blocked",reason:D,canRunAnyway:m}}const y=k=>k.length>0?`${k.length===1?"the default":"the defaults"} ${k.map(T=>KI(T)).join(", ")}`:"",x=[];g.length>0&&x.push(`Ran without a value for ${g.length===1?"the given":"the givens"} ${Qg(g.map(Hb),"and")}, which this page can't tell this ${a} reads.`);const w=i.filter(k=>!g.includes(k)),S=w.filter(k=>!l(k)),b=y(S.filter(k=>!s(k)));b!==""&&x.push(`Ran with ${b}.`);const $=w.filter(l);if($.length>0){const k=[$.filter(s).map(T=>KI(T,n?.[T.name])).join(", "),y($.filter(T=>!s(T)))].filter(T=>T!=="").join(" and ");x.push($.length===w.length?`This page can't tell which givens this ${a} reads. Where it reads one, it ran with ${k}.`:`This page can't tell whether this ${a} reads ${Qg($.map(Hb),"or")}. Where it does, it ran with ${k}.`)}return x.length>0?{kind:"noted",note:x.join(" ")}:{kind:"ok"}}const SCe=400;function CCe({givens:e,unknown:t,inheritedFrom:n,values:r,onChange:o,onReset:a,environmentName:i,packageName:s,modelPath:l,versionId:d,declaredTypes:u}){const m=C.useMemo(()=>[...e],[e]),g=C.useMemo(()=>{const D=e.filter(A=>t?.has(A.name));if(D.length!==0)return D.length===e.length?"This page can't tell which of these givens this source reads, so a value set here may not apply to it.":`This page can't tell whether this source reads ${Qg(D.map(A=>A.label??A.name),"or")}, so a value set for ${D.length===1?"it":"them"} may not apply.`},[e,t]),[y,x]=C.useState(()=>new Set),w=C.useCallback(D=>x(A=>A.has(D)?A:new Set([...A,D])),[]),S=u_(r,SCe),b=C.useMemo(()=>({values:S,declaredTypes:u}),[S,u]),{options:$,isLoading:k,failed:T,truncated:O,search:P}=qF(i,s,l,m,d,b,void 0,y,!0);return p.jsxs(sh,{label:"Givens",count:e.length,testId:"model-givens-section",children:[p.jsx(Te,{sx:{"& .MuiPaper-root":{borderColor:"divider"}},children:p.jsx(j1,{layout:"bar",givens:m,values:r,onChange:o,onReset:a,options:$,optionsLoading:k,optionsFailed:T,optionsTruncated:O,optionSearch:P,onControlOpen:w})}),g&&p.jsx(Wd,{"data-testid":"model-givens-unknown",sx:{mt:1},children:g}),n&&n.size>0&&p.jsx(Wd,{"data-testid":"model-givens-inherited",sx:{mt:1},children:[...n].map(([D,A])=>A.length===1?`${D} is inherited from ${A[0]}, which this model doesn't export.`:`${D} is inherited from ${A.slice(0,-1).join(", ")} and ${A.at(-1)}, none of which this model exports.`).join(" ")})]})}const kCe="A source is a queryable entry point into the model — pick one to browse its dimensions, measures, views and joins.";function $Ce(e,t=!1){return e===0?"No sources":`${e} ${t?"public ":""}source${e===1?"":"s"}`}const RCe=Jt(p.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),TCe=Jt(p.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),ECe=Jt(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),MCe=Jt([p.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V5h14z"},"0"),p.jsx("path",{d:"M6.25 7.72h5v1.5h-5zM13 15.75h5v1.5h-5zm0-2.5h5v1.5h-5zM8 18h1.5v-2h2v-1.5h-2v-2H8v2H6V16h2zm6.09-7.05 1.41-1.41 1.41 1.41 1.06-1.06-1.41-1.42 1.41-1.41L16.91 6 15.5 7.41 14.09 6l-1.06 1.06 1.41 1.41-1.41 1.42z"},"1")]),N6=Jt(p.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"})),OCe=Jt(p.jsx("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"})),PCe=Jt(p.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),jCe=Jt(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),ACe=Jt(p.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),DCe=Jt(p.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),NCe=Jt(p.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"})),I6=Jt(p.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"})),ICe=Jt(p.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"})),LCe=Jt(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),L6=Jt(p.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"})),zCe=Jt([p.jsx("path",{d:"m21.41 11.41-8.83-8.83c-.37-.37-.88-.58-1.41-.58H4c-1.1 0-2 .9-2 2v7.17c0 .53.21 1.04.59 1.41l8.83 8.83c.78.78 2.05.78 2.83 0l7.17-7.17c.78-.78.78-2.04-.01-2.83M12.83 20 4 11.17V4h7.17L20 12.83z"},"0"),p.jsx("circle",{cx:"6.5",cy:"6.5",r:"1.5"},"1")]),z6=Jt(p.jsx("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4m0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),FCe=Jt(p.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),F6=Jt(p.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),_Ce=Jt(p.jsx("path",{d:"M12 5.99 19.53 19H4.47zM12 2 1 21h22zm1 14h-2v2h2zm0-6h-2v4h2z"}));function Ao(e,t){const n=({size:r,...o})=>p.jsx(e,{...o,sx:{fontSize:r}});return n.displayName=t,n}const BCe=Ao(RCe,"IconText"),QI=Ao(TCe,"IconOpen"),_6=Ao(ECe,"IconResult"),UCe=Ao(MCe,"IconCalculation"),qCe=Ao(N6,"IconDate"),HCe=Ao(OCe,"IconJoin"),VCe=Ao(PCe,"IconCode"),WCe=Ao(jCe,"IconList"),YCe=Ao(ACe,"IconRecord"),GCe=Ao(DCe,"IconCollapse"),KCe=Ao(hF,"IconExpand"),QCe=Ao(NCe,"IconFields"),XCe=Ao(I6,"IconDropdown"),ZCe=Ao(ICe,"IconLock"),B6=Ao(LCe,"IconNumber"),JCe=Ao(L6,"IconTimestamp"),eke=Ao(zCe,"IconValues"),tke=Ao(z6,"IconBoolean"),nke=Ao(FCe,"IconGivens"),U6=Ao(F6,"IconColumn");Ao(_Ce,"IconWarning");const Ty=C.createContext(void 0);function yT(){const[e,t]=C.useState(!1),n=C.useContext(Ty),[r,o]=C.useState(n?.n);return n&&n.n!==r&&(o(n.n),t(n.open)),[e,t]}function rke({allOpen:e,onToggle:t,noun:n,disabledReason:r}){const o=e?p.jsx(GCe,{size:16,"aria-hidden":!0}):p.jsx(KCe,{size:16,"aria-hidden":!0});return p.jsx(Br,{title:r??"",children:p.jsx("span",{children:p.jsxs(is,{disabled:!!r,onClick:t,"aria-label":r??`${e?"Collapse":"Expand"} all ${n[1]}`,sx:{font:"inherit",color:"text.secondary",gap:.25,borderRadius:1,"&:hover":{color:"text.primary",textDecoration:"underline"},...Ry,"&.Mui-disabled":{opacity:.5}},children:[o,e?"Collapse all":"Expand all"]})})})}function rx({noun:e,disabledReason:t}){const[n,r]=C.useState(void 0),o=n?.open??!1;return{command:n,action:p.jsx(rke,{allOpen:o,onToggle:()=>r({open:!o,n:(n?.n??0)+1}),noun:e,disabledReason:t})}}let PC;function oke(e,t){if(PC?.text===t)return PC.parsed;const n=t.replace(/\r\n/g,`
491
491
  `);let r;try{r={lines:n.split(`
492
492
  `),symbols:e.Malloy.parse({source:n}).symbols}}catch{r=void 0}return PC={text:t,parsed:r},r}function U1(e,t){const{start:n,end:r}=t;return n.line===r.line?(e[n.line]??"").slice(n.character,r.character):[(e[n.line]??"").slice(n.character),...e.slice(n.line+1,r.line),(e[r.line]??"").slice(0,r.character)].join(`
493
- `)}let q6,Vb;function oke(){return Vb??=wo(()=>import("./index-diN_kmcj.js").then(e=>e.i),__vite__mapDeps([0,1])).then(e=>{const t="Malloy"in e?e:e.default;return q6=t,t}),Vb.catch(()=>{Vb=void 0}),Vb}function H6(e,t=!0){const[n,r]=C.useState(q6),[o,a]=C.useState(!1),i=!!e&&t;return C.useEffect(()=>{if(!i||n)return;let s=!0;return oke().then(l=>s&&r(l),()=>s&&a(!0)),()=>{s=!1}},[i,n]),{parsed:C.useMemo(()=>i&&n&&e?rke(n,e):void 0,[i,n,e]),pending:i&&!n&&!o}}function ake(e,t){if(!e)return;const n=e.symbols.filter(r=>r.type==="query"&&r.name.replace(/^`(.*)`$/,"$1")===t);if(n.length===1)return`query: ${U1(e.lines,n[0].range).trimEnd()}`}function V6(e){const t=e.replace(/^\n+/,"").split(`
493
+ `)}let q6,Vb;function ake(){return Vb??=wo(()=>import("./index-BiZnC_i6.js").then(e=>e.i),__vite__mapDeps([0,1])).then(e=>{const t="Malloy"in e?e:e.default;return q6=t,t}),Vb.catch(()=>{Vb=void 0}),Vb}function H6(e,t=!0){const[n,r]=C.useState(q6),[o,a]=C.useState(!1),i=!!e&&t;return C.useEffect(()=>{if(!i||n)return;let s=!0;return ake().then(l=>s&&r(l),()=>s&&a(!0)),()=>{s=!1}},[i,n]),{parsed:C.useMemo(()=>i&&n&&e?oke(n,e):void 0,[i,n,e]),pending:i&&!n&&!o}}function ike(e,t){if(!e)return;const n=e.symbols.filter(r=>r.type==="query"&&r.name.replace(/^`(.*)`$/,"$1")===t);if(n.length===1)return`query: ${U1(e.lines,n[0].range).trimEnd()}`}function V6(e){const t=e.replace(/^\n+/,"").split(`
494
494
  `),n=[];let r=0;for(;r<t.length;){const o=t[r].trim();if(!o.startsWith("#"))break;!o.startsWith('#"')&&!o.startsWith("#(doc)")&&n.push(t[r]),r+=1}return[...n,...t.slice(r)].join(`
495
- `).trim()}function ike(e,t){const n=V6(t),r=of(e),o=new RegExp(`^(?:(?:dimension|measure|view)\\s*:\\s*)?${r}\\s+is\\s+`),a=n.replace(o,"");if(a===n||!(a.startsWith("{")&&a.endsWith("}")))return n;const i=a.slice(1,-1).replace(/^\n/,"").replace(/\s+$/,"").split(`
495
+ `).trim()}function ske(e,t){const n=V6(t),r=of(e),o=new RegExp(`^(?:(?:dimension|measure|view)\\s*:\\s*)?${r}\\s+is\\s+`),a=n.replace(o,"");if(a===n||!(a.startsWith("{")&&a.endsWith("}")))return n;const i=a.slice(1,-1).replace(/^\n/,"").replace(/\s+$/,"").split(`
496
496
  `),s=i.filter(d=>d.trim()).map(d=>d.match(/^[ \t]*/)[0].length),l=s.length?Math.min(...s):0;return i.map(d=>d.slice(l)).join(`
497
- `).trim()||n}function ske(e,t){const n=V6(t),r=n.split(`
497
+ `).trim()||n}function lke(e,t){const n=V6(t),r=n.split(`
498
498
  `),o=r.findIndex(s=>!s.trim().startsWith("#"));if(o<0)return n;const a=r[o];if(/^\s*view\s*:/.test(a))return XI(r,o).join(`
499
499
  `);const i=of(e);return new RegExp(`^\\s*${i}\\s+is\\b`).test(a)?(r[o]=a.replace(/^(\s*)/,"$1view: "),XI(r,o).join(`
500
- `)):n}function XI(e,t){const n=e.slice(t+1).filter(o=>o.trim()!=="");if(n.length===0)return e;const r=Math.min(...n.map(o=>o.length-o.trimStart().length));return r===0?e:e.map((o,a)=>a<=t?o:o.slice(Math.min(r,o.length-o.trimStart().length)))}function vT(e){return e.kind==="dimension"&&e.indexed===!0}function bT(e){return!!e&&(e.loading||!!e.code||!!e.inheritedFrom||!!e.error)}function lke(e,t){const n=[],r=[];for(const o of e){const a=t(o);(a&&!a.loading&&(a.code||a.error)||vT(o)?n:r).push(o)}return r.length===0||n.length===0?e:[...n,...r]}function cke(e,t){return t.includes(`
501
- `)||e.scrollWidth>e.clientWidth}const uke={dimension:U6,measure:B6,calculate:BCe,view:_6,join:qCe};function dke(e){switch(e){case"dimension":case"measure":case"calculate":case"view":return YI(e).main;case"column":return YI("dimension").main;case"join":return Tp.brown.main}}function fke(e){const t=e?.trim().toLowerCase()??"";if(t){if(t.startsWith("array"))return VCe;if(t.startsWith("record")||/\bfields?\b/.test(t))return WCe;switch(t.split(/[\s·<]/)[0]){case"string":return _Ce;case"number":return B6;case"date":return UCe;case"timestamp":case"timestamptz":return ZCe;case"boolean":return eke;default:return}}}const pke=16;function xT({kind:e,dataType:t}){const n=e==="dimension"||e==="measure"||e==="calculate"||e==="column"?fke(t):void 0;return p.jsx(Te,{component:"span","aria-hidden":!0,"data-row-glyph":e,sx:{display:"inline-flex",alignSelf:"center",flexShrink:0,color:dke(e)},children:C.createElement(n??uke[e==="column"?"dimension":e],{size:pke})})}function wT(e,t){return(t?e.givensBySource?.get(t):void 0)??e.givens}function W6(e,t){if(!e.givenValues||!t)return e;const n=new Set(t.map(o=>o.name)),r=Object.entries(e.givenValues).filter(([o])=>n.has(o));return{...e,givenValues:r.length>0?Object.fromEntries(r):void 0}}function hke({run:e,modelPath:t,query:n,enabled:r}){const{server:o,apiClients:a}=tr(),i=zd({...G6({server:o,apiClients:a,run:e,modelPath:t,query:n}),enabled:r,refetchOnWindowFocus:!1,refetchOnReconnect:!1});return{result:i.data?.data.result,isSuccess:i.isSuccess,isLoading:i.isLoading,isFetching:i.isFetching,isError:i.isError,error:i.error,refetch:i.refetch}}function Y6(e,t,n,r){return["model-viewer-run",e,t.projectName,t.packageName,n,t.versionId??"",r,hT(t.givenValues),...t.includeHiddenFilesAndSources?["off-surface"]:[]]}function G6({server:e,apiClients:t,run:n,modelPath:r,query:o}){const a=hT(n.givenValues)===""?void 0:n.givenValues;return{queryKey:Y6(e,n,r,o),queryFn:async({signal:i})=>{const s=performance.now(),l=()=>Math.round(performance.now()-s);try{const d=await t.models.executeQueryModel(n.projectName,n.packageName,r,{query:o,versionId:n.versionId,...a&&{givens:a},...n.queryMetadata&&{queryMetadata:{...n.queryMetadata}}},n.includeHiddenFilesAndSources?!0:void 0,{signal:i});return n.onQueryRun?.({outcome:"success",durationMs:l()}),d}catch(d){throw i?.aborted||n.onQueryRun?.({outcome:"error",durationMs:l()}),d}},staleTime:1/0,retry:!1}}const jC=12,mke=5*6e4;function gke(e){const t=B1(e);return t===void 0?!1:t>=400&&t<500&&t!==401&&t!==408&&t!==429}function yke(e){if(!e)return[];const{data:t}=JSON.parse(e);return t?.kind!=="array_cell"?[]:t.array_value.flatMap(n=>{if(n.kind!=="record_cell")return[];const r=n.record_value[0];if(!r)return[];switch(r.kind){case"string_cell":return[r.string_value];case"number_cell":return[String(r.number_value)];case"boolean_cell":return[String(r.boolean_value)];case"date_cell":return[r.date_value];case"timestamp_cell":return[r.timestamp_value];default:return[]}})}function vke({run:e,modelPath:t,sourceName:n,field:r,fetchSamples:o,generation:a}){const{server:i,apiClients:s}=tr(),l=r?.kind==="dimension"&&r.indexed===!0,d=wT(e,n),u=l&&!o?D6(d,e.requiredFiltersBySource?.get(n),e.givenValues):void 0,m=u?.kind==="blocked"?u.reason:void 0,g=l&&!m?r.name:void 0,y=zd({...G6({server:i,apiClients:s,run:W6(e,d),modelPath:t,query:jce(n,g??"",jC)}),enabled:!!g&&!o,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),x=zd({queryKey:["model-viewer-samples",i,e.projectName,e.packageName,e.versionId??"",t,n,g,a??"host"],enabled:!!g&&!!o,staleTime:mke,retry:!1,refetchOnWindowFocus:!1,queryFn:async({signal:b})=>{try{const $=await o({modelPath:t,sourceName:n,fieldName:g,limit:jC,signal:b}),k=Array.isArray($)?{values:$}:$;return{...k,values:k.values.slice(0,jC)}}catch($){if(gke($))return{values:[]};throw $}}}),w=o?x:y,S=o?x.data:y.data&&{values:yke(y.data.data.result)};return{samples:S?.values??[],total:S?.total,unavailable:m??S?.unavailable,loading:!!g&&w.isPending,failed:w.isError}}function bke({children:e}){return p.jsx(Te,{component:"span",sx:{fontFamily:os,fontSize:Xa.caption,color:"text.primary",bgcolor:xo.background.muted,border:"1px solid",borderColor:"divider",borderRadius:1,padding:"2px 8px"},children:e})}function xke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a}){const{samples:i,total:s,unavailable:l,loading:d,failed:u}=vke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a});return p.jsxs(Te,{"data-testid":"model-viewer-values",sx:{fontSize:Xa.small},children:[p.jsx(Te,{component:"div",sx:{color:F1,fontSize:Xa.caption,mb:"6px"},children:s!=null?`The most common of ${s.toLocaleString()} ${s===1?"value":"values"}`:"The most common values"}),d?p.jsx(ku,{size:12,sx:{color:"text.secondary"}}):l?p.jsx(Te,{component:"span","data-testid":"model-viewer-values-unavailable",sx:{color:"text.secondary"},children:l}):u?p.jsx(Te,{component:"span",sx:{fontStyle:"italic",color:"text.secondary"},children:"Sample values couldn't be loaded."}):i.length===0?p.jsx(Te,{component:"span",sx:{fontStyle:"italic",color:"text.secondary"},children:"No values found."}):p.jsx(Te,{sx:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.map(m=>p.jsx(bke,{children:m},m))})]})}const AC={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},wke={...AC,patterns:[...AC.patterns,{include:"#docvar"}],repository:{...AC.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Ske={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},Cke="github-light",kke="github-dark";let DC;function $ke(){return DC||(DC=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a},{default:i}]=await Promise.all([wo(()=>import("./core-B8oMW4sm.es-hOkwvru5.js"),__vite__mapDeps([3,4])),wo(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),wo(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),wo(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),wo(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),wo(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[]),wo(()=>import("./github-dark-DenFmJkN.es-DHJKELXO.js"),[])]);return e({engine:t(wo(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a,i],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...wke},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Ske}]})})()),DC}async function ST(e,t,n="light"){return(await $ke()).codeToHtml(e,{lang:t,theme:n==="dark"?kke:Cke})}function Ey({code:e,testId:t,framed:n=!0}){const{mode:r}=Vr(),[o,a]=C.useState(void 0);return C.useEffect(()=>{let i=!0;return ST(e,"malloy",r).then(s=>i&&a(s)).catch(()=>i&&a(void 0)),()=>{i=!1}},[e,r]),p.jsx(Te,{"data-testid":t,sx:{fontFamily:os,fontSize:"0.75rem",overflowX:"auto","& pre":{m:0,background:"transparent !important"},...n&&{border:"1px solid",borderColor:"divider",borderRadius:1,px:1.5,py:1,bgcolor:"background.default"}},children:o?p.jsx("div",{dangerouslySetInnerHTML:{__html:o}}):p.jsx(Te,{component:"pre",sx:{whiteSpace:"pre"},children:e})})}function q1({message:e,onRetry:t,severity:n="error"}){return p.jsx(lo,{severity:n,action:t&&p.jsx(Vn,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:e})}function K6(e){const t=e?.response?.data?.message;return typeof t=="string"&&t?t:void 0}function Q6(e,t){const n=K6(t);return n?`${e}: ${n}`:`${e}.`}function Rke(e){const t=B1(e);return!(t===400||t===401||t===403||t===404||t===422)}function Tke({query:e,error:t,onRetry:n,testId:r,forbiddenMessage:o}){const a=o!==void 0&&B1(t)===403;return p.jsxs(Te,{"data-testid":r,sx:{display:"flex",flexDirection:"column",gap:1},children:[e&&p.jsx(Ey,{code:e,testId:"query-failure-code"}),p.jsx(q1,{message:a?o:Q6("Query failed",t),onRetry:n&&Rke(t)?n:void 0})]})}const ZI=C.forwardRef(function(e,t){return p.jsx(Vn,{ref:t,variant:"contained",size:"small",disableElevation:!0,...e,sx:{textTransform:"none",...e.sx}})}),Eke=C.forwardRef(function(e,t){return p.jsx(Vn,{ref:t,variant:"outlined",size:"small",color:"inherit",...e,sx:{textTransform:"none",borderRadius:999,borderColor:"divider",color:"text.secondary",...e.sx}})}),Ag=10,Mke="clamp(340px, 40%, 520px)";function Oke({field:e,run:t,modelPath:n,sourceName:r,fieldCode:o,joined:a=!1}){const[i,s]=yT(),{fetchSamples:l,samplesGeneration:d,renderFieldStatus:u,renderFieldAction:m,renderFieldDetail:g}=_1(),y={modelPath:n,sourceName:r,field:e,joined:a},x=u?.(y),w=m?.(y),S=e.doc?void 0:o?.columnDoc,b=e.doc??S,$=bT(o),k=C.useContext(gT),T=C.useMemo(()=>Yd(o?.code,k),[o?.code,k]),O=vT(e)&&!a&&!!t,P=[...$?["code"]:[],...O?["values"]:[],...T.length>0?["givens"]:[]],D=R=>P.includes(R),A=e.kind==="measure"?"measure":e.kind==="calculate"?"calculate":"dimension",F=P.length>0?p.jsxs(Te,{"data-testid":"model-viewer-field-card",sx:{...kh,"& > * + *":{borderTop:1,borderColor:"divider"}},children:[D("code")&&(o?.loading?p.jsx(Te,{sx:{p:$y,display:"flex"},children:p.jsx(ku,{size:12,sx:{color:"text.secondary"}})}):o?.code?p.jsx(Ey,{testId:"model-viewer-definition",code:ike(e.name,o.code),framed:!1}):o?.inheritedFrom?p.jsx(Ey,{testId:"model-viewer-definition",code:`${o.inheritedFrom.fromTable?"// A column of the table this source reads, as it is":"// Passed through from the query this source is built on"}
502
- ${o.inheritedFrom.code}`,framed:!1}):p.jsx(Te,{sx:{p:1},children:p.jsx(q1,{message:"Couldn't load this model's code right now."})})),D("values")&&t&&p.jsx(Te,{sx:{p:$y},children:p.jsx(xke,{run:t,fetchSamples:l,generation:d,modelPath:n,sourceName:r,field:e})}),D("givens")&&p.jsx(pT,{givens:T,framed:!1})]}):void 0,L=g?g(y,F):F,_=L!=null&&L!==!1;return p.jsxs(Te,{"data-testid":"model-viewer-field-row","data-name":e.name,sx:i&&_?{pb:1.25}:void 0,children:[p.jsx(CT,{glyph:p.jsx(xT,{kind:A,dataType:e.dataType}),name:e.name,typeLabel:e.dataType,typeTip:e.typeTip,typeAsChip:!0,stackPills:!0,doc:b,generatedDoc:!!S,open:i,expandable:_,onToggle:()=>s(R=>!R),descriptors:p.jsx(S6,{givens:T}),pills:x,action:w}),_&&p.jsx(Up,{in:i,timeout:"auto",unmountOnExit:!0,children:p.jsx(Te,{"data-testid":"model-viewer-field-detail",sx:{mx:`${Ag}px`,mt:"2px",display:"flex",flexDirection:"column",gap:1.5},children:L})})]})}function CT({glyph:e,name:t,typeLabel:n,typeAsChip:r=!1,stackPills:o=!1,typeTip:a,descriptors:i,pills:s,action:l,trailing:d,doc:u,generatedDoc:m=!1,open:g,expandable:y,onToggle:x}){const w=C.useId();return p.jsxs(Te,{onClick:S=>{if(!y||S.target.closest("[data-row-action]"))return;const b=S.target.closest("button, a, [role='button']");b&&!b.hasAttribute("data-field-toggle")||x()},sx:{display:"flex",alignItems:g?"flex-start":"center",borderRadius:1.5,transition:"background 0.1s",cursor:y?"pointer":"default",...y?{"&:hover":{bgcolor:xo.background.muted},"&:hover [data-pill-tone='quiet']":{bgcolor:xo.background.strong}}:{}},children:[p.jsxs(Te,{sx:{display:"flex",flexDirection:o?"column":"row",alignItems:o?"stretch":"center",minWidth:0,flexShrink:0,width:{md:Mke},overflow:{md:"hidden"}},children:[p.jsxs(Te,{component:y?"button":"div",type:y?"button":void 0,"aria-expanded":y?g:void 0,"aria-describedby":o?w:void 0,"data-field-toggle":y?"":void 0,sx:{appearance:"none",border:"none",background:"none",font:"inherit",color:"inherit",textAlign:"left",minWidth:0,px:`${Ag}px`,py:"6px",borderRadius:1.5,...Ry,display:"flex",alignItems:"baseline",gap:"8px",flexWrap:o?"nowrap":"wrap",rowGap:"4px",cursor:y?"pointer":"default"},children:[e,p.jsxs(Te,{component:"span",sx:{display:"contents","& > *":{flexShrink:0},...o?{"& > *:first-of-type":{flexShrink:1,minWidth:0}}:{}},children:[p.jsx(Te,{component:"span",title:t,sx:{...xCe,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&(r?p.jsx(Br,{title:a?p.jsx(Te,{sx:{whiteSpace:"pre-line"},children:a}):"",children:p.jsx(fs,{voice:"token",tone:"quiet",sx:{alignSelf:"center"},children:n})}):p.jsx(Te,{component:"span",sx:A6,children:n})),i]}),!o&&s]}),o?p.jsxs(Te,{id:w,sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",px:`${Ag}px`,pb:"6px",mt:"-2px","&:empty":{display:"none"}},children:[s,l&&p.jsx(Te,{component:"span","data-row-action":"",sx:{display:"inline-flex"},children:l})]}):l&&p.jsx(Te,{component:"span","data-row-action":"",sx:{display:"inline-flex"},children:l})]}),u&&p.jsxs(Te,{component:"span","data-testid":"model-viewer-field-doc",onMouseEnter:S=>{const b=S.currentTarget;b.title=!g&&cke(b,u)?u:""},sx:{flex:1,minWidth:0,ml:1,pr:`${Ag}px`,py:g?"6px":0,fontSize:Xa.small,color:F1,...g?{whiteSpace:"pre-line"}:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},children:[m&&p.jsx(fs,{voice:"state",tone:"quiet","data-testid":"model-viewer-field-doc-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),g?u:u.split(`
503
- `)[0]]}),d&&p.jsx(Te,{sx:{ml:"auto",flexShrink:0,pl:1,pr:`${Ag}px`,display:"inline-flex",alignItems:"center",height:32},children:d})]})}const Pke=480;function jke({run:e,modelPath:t,query:n,sourceName:r,givens:o,givensUnknown:a,mode:i="result",renderCode:s,onShownChange:l}){const d=hT(e.givenValues),[u,m]=C.useState(i==="result"?d:null);i==="result"&&u===null&&m(d);const g=u!==null&&u!==d,y=r?e.requiredFiltersBySource?.get(r):void 0,[x,w]=C.useState(null),S=x===d,b=C.useMemo(()=>D6(o??wT(e,r),y,e.givenValues,o?a:r?e.unknownGivensBySource?.get(r):void 0,S,o?"query":"source"),[e,r,o,a,y,S]),{result:$,isSuccess:k,isError:T,error:O,refetch:P}=hke({run:e,modelPath:t,query:n,enabled:u===d&&b.kind!=="blocked"});u!==null&&u!==d&&$!==void 0&&m(d);const D=b0(e.accessBySource,r),A=iCe(r,D),F=()=>g?m(d):void P(),[L,_]=C.useState(null);$!==void 0&&(L?.givensKey!==d||L.result!==$)&&_({result:$,givensKey:d});const R=b.kind==="blocked"?void 0:$!==void 0?{result:$,givensKey:d}:g&&L?{result:L.result,givensKey:L.givensKey}:void 0,z=R?.result,N=C.useMemo(()=>sCe(D,z),[D,z]),B=R?.givensKey??"";C.useEffect(()=>{if(l){if(z===void 0)return l(void 0);l({result:z,givensKey:B})}},[l,z,B]);const I=i==="result"&&b.kind!=="blocked";return C.useEffect(()=>{I&&Q2()},[I]),p.jsx(Te,{"data-testid":"model-viewer-run-result","data-mode":i,children:i==="code"?s?.():b.kind==="blocked"?p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[p.jsx(Wd,{"data-testid":"model-viewer-run-blocked",children:b.reason}),b.canRunAnyway&&p.jsx(ZI,{size:"small",onClick:()=>{w(d),m(d)},children:"Run anyway"})]}):T&&!g?p.jsx(Tke,{query:n,error:O,onRetry:()=>void P(),forbiddenMessage:A}):k&&!$&&!g?p.jsx(Kg,{message:"The query returned no result."}):p.jsxs(Te,{"data-testid":"model-viewer-result-card",sx:{...kh,p:$y,overflowX:"auto"},children:[g&&p.jsxs(Te,{"data-testid":"model-viewer-run-stale",sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap",mb:1},children:[p.jsx(Wd,{children:"The given values changed since this ran."}),p.jsx(ZI,{size:"small",onClick:F,"aria-label":"Run with these values",children:"Run"})]}),b.kind==="noted"&&z&&!g&&p.jsx(ky,{"data-testid":"model-viewer-run-defaults",component:"div",sx:{mb:1},children:b.note}),!(g&&!z)&&(z===void 0?p.jsx(Bo,{text:wu.running}):p.jsx(A1,{result:z,maxHeight:Pke,maxResultSize:e.maxResultSize})),N&&p.jsx(ky,{"data-testid":"model-viewer-run-filtered",component:"div",sx:{mt:1},children:N})]})})}function Ake(e){return{p:"3px",borderRadius:1,color:e?"text.primary":"text.secondary",bgcolor:e?xo.background.strong:"transparent","&:hover":{bgcolor:e?xo.background.strong:xo.background.muted,color:"text.primary"},"&.Mui-disabled":{color:"text.disabled"}}}function Dke({value:e,options:t,onChange:n,"aria-label":r}){return p.jsx(Te,{role:"group","aria-label":r,sx:{display:"inline-flex",gap:"2px"},children:t.map(o=>{const a=o.value===e,i=o.disabled===!0;return p.jsx(Br,{title:i?o.disabledReason??o.label:o.label,children:p.jsx("span",{style:{display:"inline-flex"},children:p.jsx(ro,{size:"small",role:"button","aria-pressed":a,"aria-label":i?o.disabledReason??o.label:o.label,disabled:i,onClick:()=>n(o.value),sx:Ake(a),children:o.icon})})},o.value)})})}const Nke=["result","givens","fields","code","values","access"],Ike={result:{icon:p.jsx(_6,{size:14}),label:"Result"},fields:{icon:p.jsx(KCe,{size:14}),label:"Fields"},code:{icon:p.jsx(HCe,{size:14}),label:"Code"},values:{icon:p.jsx(JCe,{size:14}),label:"Values"},givens:{icon:p.jsx(tke,{size:14}),label:"Givens"},access:{icon:p.jsx(XCe,{size:14}),label:"Access"}};function X6(e,t){const n=Nke.filter(i=>e.includes(i)),[r,o]=C.useState(void 0),a=r!==void 0&&n.includes(r)?r:t!==void 0&&n.includes(t)?t:n[0];return{layers:n,layer:a,setLayer:o}}function Z6({layers:e,value:t,onChange:n,"aria-label":r,disabledReasons:o}){return e.length<2||t===void 0?null:p.jsx(Dke,{"aria-label":r,value:t,onChange:n,options:e.map(a=>{const i=o?.[a];return{value:a,...Ike[a],...i?{disabled:!0,disabledReason:i}:{}}})})}function J6({field:e,modelPath:t,sourceName:n,fieldCode:r,run:o,runQuery:a,runGivens:i,runGivensUnknown:s}){const l=a??Oce(n,e.name),d=i??(o&&wT(o,n)),u=C.useMemo(()=>o&&W6(o,d),[o,d]),m=a?"query":"view",[g,y]=yT(),[x,w]=C.useState(void 0),S=bT(r),b=C.useContext(gT),{renderRunActions:$}=_1(),{server:k}=tr(),T=C.useMemo(()=>Yd(r?.code,b),[r?.code,b]),{chartNames:O,tagsInFull:P}=C.useMemo(()=>{const z=e.tags??[],N=RSe(z),B=N.length>0?N:z;return{chartNames:B,tagsInFull:z.join(" ")===B.join(" ")?void 0:z.map(I=>`# ${I}`).join(`
504
- `)}},[e.tags]),D=["result","code",...T.length>0?["givens"]:[]],{layers:A,layer:F,setLayer:L}=X6(D,o?"result":"code"),_=F??"code",R=()=>_==="givens"?p.jsx(pT,{givens:T}):r?.loading?p.jsx(ku,{size:12,sx:{color:"text.secondary"}}):r?.code?p.jsx(Ey,{testId:"model-viewer-definition",code:a?r.code:ske(e.name,r.code)}):r?.error?p.jsx(q1,{message:"Couldn't load this model's code right now."}):p.jsx(Kg,{message:`No Malloy code to show for this ${m}.`});return p.jsxs(Te,{"data-testid":"model-viewer-view-row","data-name":e.name,sx:g?{pb:1.5}:void 0,children:[p.jsx(CT,{glyph:p.jsx(xT,{kind:"view"}),name:e.name,doc:e.doc,open:g,expandable:!0,onToggle:()=>y(z=>!z),trailing:g&&p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:"2px"},children:[p.jsx(Z6,{"aria-label":`Show for ${e.name}`,layers:A,value:_,onChange:L,disabledReasons:{result:o?void 0:`This ${m} can't be run here`,code:S?void 0:`No Malloy code to show for this ${m}`}}),u&&$?.({kind:a?"query":"view",modelPath:t,sourceName:a?"":n,name:e.name,query:l,givens:u.givenValues,queryKey:Y6(k,u,t,l),shown:x})]}),descriptors:p.jsxs(p.Fragment,{children:[O.map(z=>{const N=p.jsx(fs,{voice:"token",tone:"quiet",sx:{alignSelf:"center"},children:z},z);return P?p.jsx(Br,{title:P,slotProps:{tooltip:{sx:{whiteSpace:"pre-line",fontFamily:os}}},children:N},z):N}),p.jsx(S6,{givens:T})]})}),p.jsx(Up,{in:g,timeout:"auto",mountOnEnter:!0,children:p.jsx(Te,{"data-testid":"model-viewer-view-card",sx:{mx:"10px",mt:1,minWidth:0},children:p.jsx(Te,{sx:{minWidth:0,overflowX:"auto"},children:u?p.jsx(jke,{run:u,modelPath:t,query:l,sourceName:n||void 0,givens:i,givensUnknown:s,mode:_==="result"?"result":"code",renderCode:R,onShownChange:w}):R()})})})]})}function Lke({queries:e,sourceText:t,modelPath:n,run:r}){const{parsed:o,pending:a}=H6(t,e.length>0),i=C.useMemo(()=>e.map(l=>{const d=ake(o,l.name),u=l.sourceName||!r?.givens||a?void 0:QSe(d,r.givens,r.givensBySource,r.unknownGivensBySource);return{query:l,field:{name:l.name,kind:"view",doc:l.doc,tags:l.tags},code:{code:d,loading:a},runGivens:u?.givens,runGivensUnknown:u?.unknown}}),[e,o,a,r?.givens,r?.givensBySource,r?.unknownGivensBySource]),s=rx({noun:["query","queries"]});return p.jsx(sh,{label:"Queries",count:e.length,testId:"model-viewer-queries",action:s.action,children:p.jsx(Ty.Provider,{value:s.command,children:i.map(({query:l,field:d,code:u,runGivens:m,runGivensUnknown:g})=>p.jsx(J6,{field:d,modelPath:n,sourceName:l.sourceName??"",fieldCode:u,run:r,runQuery:Pce(l.name),runGivens:m,runGivensUnknown:g},l.name))})})}function eB(e){const{entities:t,loading:n,error:r,columnDescriptions:o,declarations:a,declarationsLoading:i}=e;return s=>{const l=t?.get(s.name),d=a?.get(s.name);if(!l&&!n&&d&&d.kind===s.kind)return{code:d.code,loading:!1,error:!1,inherited:!1};if(!l&&!n&&!r&&i)return{loading:!0,error:!1,inherited:!1};const u=l?.fieldType==="column";return{code:u?void 0:l?.code??void 0,inheritedFrom:u&&l?.code?{code:l.code,fromTable:!!l.table||l.code!==s.name}:void 0,loading:!r&&n,error:r,inherited:u,columnDoc:u?o?.get(s.name):void 0}}}const JI=200;function Xg({label:e,noun:t,items:n,run:r,modelPath:o,sourceName:a,getFieldCode:i,level:s}){const{showField:l}=_1(),d=C.useMemo(()=>l?n.filter($=>l({modelPath:o,sourceName:a,field:$,joined:s==="h3"})):n,[n,l,o,a,s]),[u,m]=C.useState(!1),g=d.some($=>vT($)&&s!=="h3"||bT(i?.($))),{command:y,action:x}=rx({noun:t,disabledReason:g?void 0:`None of these ${t[1]} has anything to show`}),w=s!=="h3"?x:void 0,S=C.useMemo(()=>i?lke(d,i):d,[d,i]),b=u||S.length<=JI?S:S.slice(0,JI);return p.jsx(sh,{label:e,count:d.length,level:s,action:w,children:p.jsx(Ty.Provider,{value:y,children:p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",gap:"3px"},children:[b.map($=>p.jsx(Oke,{field:$,run:r,modelPath:o,sourceName:a,fieldCode:i?.($),joined:s==="h3"},$.name)),b.length<S.length&&p.jsxs(Vn,{size:"small",onClick:()=>m(!0),sx:{alignSelf:"flex-start",textTransform:"none"},children:["Show all ",S.length.toLocaleString()," ",t[1]]})]})})})}function zke(e,t){const n=new Map;if(!e||!t)return n;const r=new Map;for(const a of e.symbols)a.type==="explore"&&r.set(kT(a.name),a);const o=new Set;for(let a=t;a&&!o.has(a);){o.add(a);const i=r.get(a);if(!i)break;for(const[s,l]of _ke(e.lines,i))n.has(s)||n.set(s,l);a=Gke(U1(e.lines,i.range))}return n}const eL=/^\s*(view|measure|dimension)\s*:\s*$/,Fke=/^`?([A-Za-z_]\w*)`?\s+is\b/;function _ke(e,t){const n=new Map;let r,o=t.range.start;for(const i of t.children){const s=U1(e,{start:o,end:i.range.start});r=Vke(s)??r,o=i.range.end;const l=Bke(i,r);if(!l)continue;const d=Uke(e,i,l);if(!d)continue;const u=kT(i.name);n.set(u,n.has(u)?null:d)}const a=new Map;for(const[i,s]of n)s&&a.set(i,s);return a}function Bke(e,t){if(e.type==="query")return t==="view"?"view":void 0;if(e.type==="field"&&(t==="dimension"||t==="measure"))return t}function Uke(e,t,n){const r=U1(e,t.range).split(`
500
+ `)):n}function XI(e,t){const n=e.slice(t+1).filter(o=>o.trim()!=="");if(n.length===0)return e;const r=Math.min(...n.map(o=>o.length-o.trimStart().length));return r===0?e:e.map((o,a)=>a<=t?o:o.slice(Math.min(r,o.length-o.trimStart().length)))}function vT(e){return e.kind==="dimension"&&e.indexed===!0}function bT(e){return!!e&&(e.loading||!!e.code||!!e.inheritedFrom||!!e.error)}function cke(e,t){const n=[],r=[];for(const o of e){const a=t(o);(a&&!a.loading&&(a.code||a.error)||vT(o)?n:r).push(o)}return r.length===0||n.length===0?e:[...n,...r]}function uke(e,t){return t.includes(`
501
+ `)||e.scrollWidth>e.clientWidth}const dke={dimension:U6,measure:B6,calculate:UCe,view:_6,join:HCe};function fke(e){switch(e){case"dimension":case"measure":case"calculate":case"view":return YI(e).main;case"column":return YI("dimension").main;case"join":return Tp.brown.main}}function pke(e){const t=e?.trim().toLowerCase()??"";if(t){if(t.startsWith("array"))return WCe;if(t.startsWith("record")||/\bfields?\b/.test(t))return YCe;switch(t.split(/[\s·<]/)[0]){case"string":return BCe;case"number":return B6;case"date":return qCe;case"timestamp":case"timestamptz":return JCe;case"boolean":return tke;default:return}}}const hke=16;function xT({kind:e,dataType:t}){const n=e==="dimension"||e==="measure"||e==="calculate"||e==="column"?pke(t):void 0;return p.jsx(Te,{component:"span","aria-hidden":!0,"data-row-glyph":e,sx:{display:"inline-flex",alignSelf:"center",flexShrink:0,color:fke(e)},children:C.createElement(n??dke[e==="column"?"dimension":e],{size:hke})})}function wT(e,t){return(t?e.givensBySource?.get(t):void 0)??e.givens}function W6(e,t){if(!e.givenValues||!t)return e;const n=new Set(t.map(o=>o.name)),r=Object.entries(e.givenValues).filter(([o])=>n.has(o));return{...e,givenValues:r.length>0?Object.fromEntries(r):void 0}}function mke({run:e,modelPath:t,query:n,enabled:r}){const{server:o,apiClients:a}=tr(),i=zd({...G6({server:o,apiClients:a,run:e,modelPath:t,query:n}),enabled:r,refetchOnWindowFocus:!1,refetchOnReconnect:!1});return{result:i.data?.data.result,isSuccess:i.isSuccess,isLoading:i.isLoading,isFetching:i.isFetching,isError:i.isError,error:i.error,refetch:i.refetch}}function Y6(e,t,n,r){return["model-viewer-run",e,t.projectName,t.packageName,n,t.versionId??"",r,hT(t.givenValues),...t.includeHiddenFilesAndSources?["off-surface"]:[]]}function G6({server:e,apiClients:t,run:n,modelPath:r,query:o}){const a=hT(n.givenValues)===""?void 0:n.givenValues;return{queryKey:Y6(e,n,r,o),queryFn:async({signal:i})=>{const s=performance.now(),l=()=>Math.round(performance.now()-s);try{const d=await t.models.executeQueryModel(n.projectName,n.packageName,r,{query:o,versionId:n.versionId,...a&&{givens:a},...n.queryMetadata&&{queryMetadata:{...n.queryMetadata}}},n.includeHiddenFilesAndSources?!0:void 0,{signal:i});return n.onQueryRun?.({outcome:"success",durationMs:l()}),d}catch(d){throw i?.aborted||n.onQueryRun?.({outcome:"error",durationMs:l()}),d}},staleTime:1/0,retry:!1}}const jC=12,gke=5*6e4;function yke(e){const t=B1(e);return t===void 0?!1:t>=400&&t<500&&t!==401&&t!==408&&t!==429}function vke(e){if(!e)return[];const{data:t}=JSON.parse(e);return t?.kind!=="array_cell"?[]:t.array_value.flatMap(n=>{if(n.kind!=="record_cell")return[];const r=n.record_value[0];if(!r)return[];switch(r.kind){case"string_cell":return[r.string_value];case"number_cell":return[String(r.number_value)];case"boolean_cell":return[String(r.boolean_value)];case"date_cell":return[r.date_value];case"timestamp_cell":return[r.timestamp_value];default:return[]}})}function bke({run:e,modelPath:t,sourceName:n,field:r,fetchSamples:o,generation:a}){const{server:i,apiClients:s}=tr(),l=r?.kind==="dimension"&&r.indexed===!0,d=wT(e,n),u=l&&!o?D6(d,e.requiredFiltersBySource?.get(n),e.givenValues):void 0,m=u?.kind==="blocked"?u.reason:void 0,g=l&&!m?r.name:void 0,y=zd({...G6({server:i,apiClients:s,run:W6(e,d),modelPath:t,query:jce(n,g??"",jC)}),enabled:!!g&&!o,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),x=zd({queryKey:["model-viewer-samples",i,e.projectName,e.packageName,e.versionId??"",t,n,g,a??"host"],enabled:!!g&&!!o,staleTime:gke,retry:!1,refetchOnWindowFocus:!1,queryFn:async({signal:b})=>{try{const $=await o({modelPath:t,sourceName:n,fieldName:g,limit:jC,signal:b}),k=Array.isArray($)?{values:$}:$;return{...k,values:k.values.slice(0,jC)}}catch($){if(yke($))return{values:[]};throw $}}}),w=o?x:y,S=o?x.data:y.data&&{values:vke(y.data.data.result)};return{samples:S?.values??[],total:S?.total,unavailable:m??S?.unavailable,loading:!!g&&w.isPending,failed:w.isError}}function xke({children:e}){return p.jsx(Te,{component:"span",sx:{fontFamily:os,fontSize:Xa.caption,color:"text.primary",bgcolor:xo.background.muted,border:"1px solid",borderColor:"divider",borderRadius:1,padding:"2px 8px"},children:e})}function wke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a}){const{samples:i,total:s,unavailable:l,loading:d,failed:u}=bke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a});return p.jsxs(Te,{"data-testid":"model-viewer-values",sx:{fontSize:Xa.small},children:[p.jsx(Te,{component:"div",sx:{color:F1,fontSize:Xa.caption,mb:"6px"},children:s!=null?`The most common of ${s.toLocaleString()} ${s===1?"value":"values"}`:"The most common values"}),d?p.jsx(ku,{size:12,sx:{color:"text.secondary"}}):l?p.jsx(Te,{component:"span","data-testid":"model-viewer-values-unavailable",sx:{color:"text.secondary"},children:l}):u?p.jsx(Te,{component:"span",sx:{fontStyle:"italic",color:"text.secondary"},children:"Sample values couldn't be loaded."}):i.length===0?p.jsx(Te,{component:"span",sx:{fontStyle:"italic",color:"text.secondary"},children:"No values found."}):p.jsx(Te,{sx:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.map(m=>p.jsx(xke,{children:m},m))})]})}const AC={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},Ske={...AC,patterns:[...AC.patterns,{include:"#docvar"}],repository:{...AC.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Cke={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},kke="github-light",$ke="github-dark";let DC;function Rke(){return DC||(DC=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a},{default:i}]=await Promise.all([wo(()=>import("./core-B8oMW4sm.es-hOkwvru5.js"),__vite__mapDeps([3,4])),wo(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),wo(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),wo(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),wo(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),wo(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[]),wo(()=>import("./github-dark-DenFmJkN.es-DHJKELXO.js"),[])]);return e({engine:t(wo(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a,i],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...Ske},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Cke}]})})()),DC}async function ST(e,t,n="light"){return(await Rke()).codeToHtml(e,{lang:t,theme:n==="dark"?$ke:kke})}function Ey({code:e,testId:t,framed:n=!0}){const{mode:r}=Vr(),[o,a]=C.useState(void 0);return C.useEffect(()=>{let i=!0;return ST(e,"malloy",r).then(s=>i&&a(s)).catch(()=>i&&a(void 0)),()=>{i=!1}},[e,r]),p.jsx(Te,{"data-testid":t,sx:{fontFamily:os,fontSize:"0.75rem",overflowX:"auto","& pre":{m:0,background:"transparent !important"},...n&&{border:"1px solid",borderColor:"divider",borderRadius:1,px:1.5,py:1,bgcolor:"background.default"}},children:o?p.jsx("div",{dangerouslySetInnerHTML:{__html:o}}):p.jsx(Te,{component:"pre",sx:{whiteSpace:"pre"},children:e})})}function q1({message:e,onRetry:t,severity:n="error"}){return p.jsx(lo,{severity:n,action:t&&p.jsx(Vn,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:e})}function K6(e){const t=e?.response?.data?.message;return typeof t=="string"&&t?t:void 0}function Q6(e,t){const n=K6(t);return n?`${e}: ${n}`:`${e}.`}function Tke(e){const t=B1(e);return!(t===400||t===401||t===403||t===404||t===422)}function Eke({query:e,error:t,onRetry:n,testId:r,forbiddenMessage:o}){const a=o!==void 0&&B1(t)===403;return p.jsxs(Te,{"data-testid":r,sx:{display:"flex",flexDirection:"column",gap:1},children:[e&&p.jsx(Ey,{code:e,testId:"query-failure-code"}),p.jsx(q1,{message:a?o:Q6("Query failed",t),onRetry:n&&Tke(t)?n:void 0})]})}const ZI=C.forwardRef(function(e,t){return p.jsx(Vn,{ref:t,variant:"contained",size:"small",disableElevation:!0,...e,sx:{textTransform:"none",...e.sx}})}),Mke=C.forwardRef(function(e,t){return p.jsx(Vn,{ref:t,variant:"outlined",size:"small",color:"inherit",...e,sx:{textTransform:"none",borderRadius:999,borderColor:"divider",color:"text.secondary",...e.sx}})}),Ag=10,Oke="clamp(340px, 40%, 520px)";function Pke({field:e,run:t,modelPath:n,sourceName:r,fieldCode:o,joined:a=!1}){const[i,s]=yT(),{fetchSamples:l,samplesGeneration:d,renderFieldStatus:u,renderFieldAction:m,renderFieldDetail:g}=_1(),y={modelPath:n,sourceName:r,field:e,joined:a},x=u?.(y),w=m?.(y),S=e.doc?void 0:o?.columnDoc,b=e.doc??S,$=bT(o),k=C.useContext(gT),T=C.useMemo(()=>Yd(o?.code,k),[o?.code,k]),O=vT(e)&&!a&&!!t,P=[...$?["code"]:[],...O?["values"]:[],...T.length>0?["givens"]:[]],D=R=>P.includes(R),A=e.kind==="measure"?"measure":e.kind==="calculate"?"calculate":"dimension",F=P.length>0?p.jsxs(Te,{"data-testid":"model-viewer-field-card",sx:{...kh,"& > * + *":{borderTop:1,borderColor:"divider"}},children:[D("code")&&(o?.loading?p.jsx(Te,{sx:{p:$y,display:"flex"},children:p.jsx(ku,{size:12,sx:{color:"text.secondary"}})}):o?.code?p.jsx(Ey,{testId:"model-viewer-definition",code:ske(e.name,o.code),framed:!1}):o?.inheritedFrom?p.jsx(Ey,{testId:"model-viewer-definition",code:`${o.inheritedFrom.fromTable?"// A column of the table this source reads, as it is":"// Passed through from the query this source is built on"}
502
+ ${o.inheritedFrom.code}`,framed:!1}):p.jsx(Te,{sx:{p:1},children:p.jsx(q1,{message:"Couldn't load this model's code right now."})})),D("values")&&t&&p.jsx(Te,{sx:{p:$y},children:p.jsx(wke,{run:t,fetchSamples:l,generation:d,modelPath:n,sourceName:r,field:e})}),D("givens")&&p.jsx(pT,{givens:T,framed:!1})]}):void 0,L=g?g(y,F):F,_=L!=null&&L!==!1;return p.jsxs(Te,{"data-testid":"model-viewer-field-row","data-name":e.name,sx:i&&_?{pb:1.25}:void 0,children:[p.jsx(CT,{glyph:p.jsx(xT,{kind:A,dataType:e.dataType}),name:e.name,typeLabel:e.dataType,typeTip:e.typeTip,typeAsChip:!0,stackPills:!0,doc:b,generatedDoc:!!S,open:i,expandable:_,onToggle:()=>s(R=>!R),descriptors:p.jsx(S6,{givens:T}),pills:x,action:w}),_&&p.jsx(Up,{in:i,timeout:"auto",unmountOnExit:!0,children:p.jsx(Te,{"data-testid":"model-viewer-field-detail",sx:{mx:`${Ag}px`,mt:"2px",display:"flex",flexDirection:"column",gap:1.5},children:L})})]})}function CT({glyph:e,name:t,typeLabel:n,typeAsChip:r=!1,stackPills:o=!1,typeTip:a,descriptors:i,pills:s,action:l,trailing:d,doc:u,generatedDoc:m=!1,open:g,expandable:y,onToggle:x}){const w=C.useId();return p.jsxs(Te,{onClick:S=>{if(!y||S.target.closest("[data-row-action]"))return;const b=S.target.closest("button, a, [role='button']");b&&!b.hasAttribute("data-field-toggle")||x()},sx:{display:"flex",alignItems:g?"flex-start":"center",borderRadius:1.5,transition:"background 0.1s",cursor:y?"pointer":"default",...y?{"&:hover":{bgcolor:xo.background.muted},"&:hover [data-pill-tone='quiet']":{bgcolor:xo.background.strong}}:{}},children:[p.jsxs(Te,{sx:{display:"flex",flexDirection:o?"column":"row",alignItems:o?"stretch":"center",minWidth:0,flexShrink:0,width:{md:Oke},overflow:{md:"hidden"}},children:[p.jsxs(Te,{component:y?"button":"div",type:y?"button":void 0,"aria-expanded":y?g:void 0,"aria-describedby":o?w:void 0,"data-field-toggle":y?"":void 0,sx:{appearance:"none",border:"none",background:"none",font:"inherit",color:"inherit",textAlign:"left",minWidth:0,px:`${Ag}px`,py:"6px",borderRadius:1.5,...Ry,display:"flex",alignItems:"baseline",gap:"8px",flexWrap:o?"nowrap":"wrap",rowGap:"4px",cursor:y?"pointer":"default"},children:[e,p.jsxs(Te,{component:"span",sx:{display:"contents","& > *":{flexShrink:0},...o?{"& > *:first-of-type":{flexShrink:1,minWidth:0}}:{}},children:[p.jsx(Te,{component:"span",title:t,sx:{...wCe,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&(r?p.jsx(Br,{title:a?p.jsx(Te,{sx:{whiteSpace:"pre-line"},children:a}):"",children:p.jsx(fs,{voice:"token",tone:"quiet",sx:{alignSelf:"center"},children:n})}):p.jsx(Te,{component:"span",sx:A6,children:n})),i]}),!o&&s]}),o?p.jsxs(Te,{id:w,sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",px:`${Ag}px`,pb:"6px",mt:"-2px","&:empty":{display:"none"}},children:[s,l&&p.jsx(Te,{component:"span","data-row-action":"",sx:{display:"inline-flex"},children:l})]}):l&&p.jsx(Te,{component:"span","data-row-action":"",sx:{display:"inline-flex"},children:l})]}),u&&p.jsxs(Te,{component:"span","data-testid":"model-viewer-field-doc",onMouseEnter:S=>{const b=S.currentTarget;b.title=!g&&uke(b,u)?u:""},sx:{flex:1,minWidth:0,ml:1,pr:`${Ag}px`,py:g?"6px":0,fontSize:Xa.small,color:F1,...g?{whiteSpace:"pre-line"}:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},children:[m&&p.jsx(fs,{voice:"state",tone:"quiet","data-testid":"model-viewer-field-doc-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),g?u:u.split(`
503
+ `)[0]]}),d&&p.jsx(Te,{sx:{ml:"auto",flexShrink:0,pl:1,pr:`${Ag}px`,display:"inline-flex",alignItems:"center",height:32},children:d})]})}const jke=480;function Ake({run:e,modelPath:t,query:n,sourceName:r,givens:o,givensUnknown:a,mode:i="result",renderCode:s,onShownChange:l}){const d=hT(e.givenValues),[u,m]=C.useState(i==="result"?d:null);i==="result"&&u===null&&m(d);const g=u!==null&&u!==d,y=r?e.requiredFiltersBySource?.get(r):void 0,[x,w]=C.useState(null),S=x===d,b=C.useMemo(()=>D6(o??wT(e,r),y,e.givenValues,o?a:r?e.unknownGivensBySource?.get(r):void 0,S,o?"query":"source"),[e,r,o,a,y,S]),{result:$,isSuccess:k,isError:T,error:O,refetch:P}=mke({run:e,modelPath:t,query:n,enabled:u===d&&b.kind!=="blocked"});u!==null&&u!==d&&$!==void 0&&m(d);const D=b0(e.accessBySource,r),A=sCe(r,D),F=()=>g?m(d):void P(),[L,_]=C.useState(null);$!==void 0&&(L?.givensKey!==d||L.result!==$)&&_({result:$,givensKey:d});const R=b.kind==="blocked"?void 0:$!==void 0?{result:$,givensKey:d}:g&&L?{result:L.result,givensKey:L.givensKey}:void 0,z=R?.result,N=C.useMemo(()=>lCe(D,z),[D,z]),B=R?.givensKey??"";C.useEffect(()=>{if(l){if(z===void 0)return l(void 0);l({result:z,givensKey:B})}},[l,z,B]);const I=i==="result"&&b.kind!=="blocked";return C.useEffect(()=>{I&&Q2()},[I]),p.jsx(Te,{"data-testid":"model-viewer-run-result","data-mode":i,children:i==="code"?s?.():b.kind==="blocked"?p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[p.jsx(Wd,{"data-testid":"model-viewer-run-blocked",children:b.reason}),b.canRunAnyway&&p.jsx(ZI,{size:"small",onClick:()=>{w(d),m(d)},children:"Run anyway"})]}):T&&!g?p.jsx(Eke,{query:n,error:O,onRetry:()=>void P(),forbiddenMessage:A}):k&&!$&&!g?p.jsx(Kg,{message:"The query returned no result."}):p.jsxs(Te,{"data-testid":"model-viewer-result-card",sx:{...kh,p:$y,overflowX:"auto"},children:[g&&p.jsxs(Te,{"data-testid":"model-viewer-run-stale",sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap",mb:1},children:[p.jsx(Wd,{children:"The given values changed since this ran."}),p.jsx(ZI,{size:"small",onClick:F,"aria-label":"Run with these values",children:"Run"})]}),b.kind==="noted"&&z&&!g&&p.jsx(ky,{"data-testid":"model-viewer-run-defaults",component:"div",sx:{mb:1},children:b.note}),!(g&&!z)&&(z===void 0?p.jsx(Bo,{text:wu.running}):p.jsx(A1,{result:z,maxHeight:jke,maxResultSize:e.maxResultSize})),N&&p.jsx(ky,{"data-testid":"model-viewer-run-filtered",component:"div",sx:{mt:1},children:N})]})})}function Dke(e){return{p:"3px",borderRadius:1,color:e?"text.primary":"text.secondary",bgcolor:e?xo.background.strong:"transparent","&:hover":{bgcolor:e?xo.background.strong:xo.background.muted,color:"text.primary"},"&.Mui-disabled":{color:"text.disabled"}}}function Nke({value:e,options:t,onChange:n,"aria-label":r}){return p.jsx(Te,{role:"group","aria-label":r,sx:{display:"inline-flex",gap:"2px"},children:t.map(o=>{const a=o.value===e,i=o.disabled===!0;return p.jsx(Br,{title:i?o.disabledReason??o.label:o.label,children:p.jsx("span",{style:{display:"inline-flex"},children:p.jsx(ro,{size:"small",role:"button","aria-pressed":a,"aria-label":i?o.disabledReason??o.label:o.label,disabled:i,onClick:()=>n(o.value),sx:Dke(a),children:o.icon})})},o.value)})})}const Ike=["result","givens","fields","code","values","access"],Lke={result:{icon:p.jsx(_6,{size:14}),label:"Result"},fields:{icon:p.jsx(QCe,{size:14}),label:"Fields"},code:{icon:p.jsx(VCe,{size:14}),label:"Code"},values:{icon:p.jsx(eke,{size:14}),label:"Values"},givens:{icon:p.jsx(nke,{size:14}),label:"Givens"},access:{icon:p.jsx(ZCe,{size:14}),label:"Access"}};function X6(e,t){const n=Ike.filter(i=>e.includes(i)),[r,o]=C.useState(void 0),a=r!==void 0&&n.includes(r)?r:t!==void 0&&n.includes(t)?t:n[0];return{layers:n,layer:a,setLayer:o}}function Z6({layers:e,value:t,onChange:n,"aria-label":r,disabledReasons:o}){return e.length<2||t===void 0?null:p.jsx(Nke,{"aria-label":r,value:t,onChange:n,options:e.map(a=>{const i=o?.[a];return{value:a,...Lke[a],...i?{disabled:!0,disabledReason:i}:{}}})})}function J6({field:e,modelPath:t,sourceName:n,fieldCode:r,run:o,runQuery:a,runGivens:i,runGivensUnknown:s}){const l=a??Oce(n,e.name),d=i??(o&&wT(o,n)),u=C.useMemo(()=>o&&W6(o,d),[o,d]),m=a?"query":"view",[g,y]=yT(),[x,w]=C.useState(void 0),S=bT(r),b=C.useContext(gT),{renderRunActions:$}=_1(),{server:k}=tr(),T=C.useMemo(()=>Yd(r?.code,b),[r?.code,b]),{chartNames:O,tagsInFull:P}=C.useMemo(()=>{const z=e.tags??[],N=TSe(z),B=N.length>0?N:z;return{chartNames:B,tagsInFull:z.join(" ")===B.join(" ")?void 0:z.map(I=>`# ${I}`).join(`
504
+ `)}},[e.tags]),D=["result","code",...T.length>0?["givens"]:[]],{layers:A,layer:F,setLayer:L}=X6(D,o?"result":"code"),_=F??"code",R=()=>_==="givens"?p.jsx(pT,{givens:T}):r?.loading?p.jsx(ku,{size:12,sx:{color:"text.secondary"}}):r?.code?p.jsx(Ey,{testId:"model-viewer-definition",code:a?r.code:lke(e.name,r.code)}):r?.error?p.jsx(q1,{message:"Couldn't load this model's code right now."}):p.jsx(Kg,{message:`No Malloy code to show for this ${m}.`});return p.jsxs(Te,{"data-testid":"model-viewer-view-row","data-name":e.name,sx:g?{pb:1.5}:void 0,children:[p.jsx(CT,{glyph:p.jsx(xT,{kind:"view"}),name:e.name,doc:e.doc,open:g,expandable:!0,onToggle:()=>y(z=>!z),trailing:g&&p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:"2px"},children:[p.jsx(Z6,{"aria-label":`Show for ${e.name}`,layers:A,value:_,onChange:L,disabledReasons:{result:o?void 0:`This ${m} can't be run here`,code:S?void 0:`No Malloy code to show for this ${m}`}}),u&&$?.({kind:a?"query":"view",modelPath:t,sourceName:a?"":n,name:e.name,query:l,givens:u.givenValues,queryKey:Y6(k,u,t,l),shown:x})]}),descriptors:p.jsxs(p.Fragment,{children:[O.map(z=>{const N=p.jsx(fs,{voice:"token",tone:"quiet",sx:{alignSelf:"center"},children:z},z);return P?p.jsx(Br,{title:P,slotProps:{tooltip:{sx:{whiteSpace:"pre-line",fontFamily:os}}},children:N},z):N}),p.jsx(S6,{givens:T})]})}),p.jsx(Up,{in:g,timeout:"auto",mountOnEnter:!0,children:p.jsx(Te,{"data-testid":"model-viewer-view-card",sx:{mx:"10px",mt:1,minWidth:0},children:p.jsx(Te,{sx:{minWidth:0,overflowX:"auto"},children:u?p.jsx(Ake,{run:u,modelPath:t,query:l,sourceName:n||void 0,givens:i,givensUnknown:s,mode:_==="result"?"result":"code",renderCode:R,onShownChange:w}):R()})})})]})}function zke({queries:e,sourceText:t,modelPath:n,run:r}){const{parsed:o,pending:a}=H6(t,e.length>0),i=C.useMemo(()=>e.map(l=>{const d=ike(o,l.name),u=l.sourceName||!r?.givens||a?void 0:XSe(d,r.givens,r.givensBySource,r.unknownGivensBySource);return{query:l,field:{name:l.name,kind:"view",doc:l.doc,tags:l.tags},code:{code:d,loading:a},runGivens:u?.givens,runGivensUnknown:u?.unknown}}),[e,o,a,r?.givens,r?.givensBySource,r?.unknownGivensBySource]),s=rx({noun:["query","queries"]});return p.jsx(sh,{label:"Queries",count:e.length,testId:"model-viewer-queries",action:s.action,children:p.jsx(Ty.Provider,{value:s.command,children:i.map(({query:l,field:d,code:u,runGivens:m,runGivensUnknown:g})=>p.jsx(J6,{field:d,modelPath:n,sourceName:l.sourceName??"",fieldCode:u,run:r,runQuery:Pce(l.name),runGivens:m,runGivensUnknown:g},l.name))})})}function eB(e){const{entities:t,loading:n,error:r,columnDescriptions:o,declarations:a,declarationsLoading:i}=e;return s=>{const l=t?.get(s.name),d=a?.get(s.name);if(!l&&!n&&d&&d.kind===s.kind)return{code:d.code,loading:!1,error:!1,inherited:!1};if(!l&&!n&&!r&&i)return{loading:!0,error:!1,inherited:!1};const u=l?.fieldType==="column";return{code:u?void 0:l?.code??void 0,inheritedFrom:u&&l?.code?{code:l.code,fromTable:!!l.table||l.code!==s.name}:void 0,loading:!r&&n,error:r,inherited:u,columnDoc:u?o?.get(s.name):void 0}}}const JI=200;function Xg({label:e,noun:t,items:n,run:r,modelPath:o,sourceName:a,getFieldCode:i,level:s}){const{showField:l}=_1(),d=C.useMemo(()=>l?n.filter($=>l({modelPath:o,sourceName:a,field:$,joined:s==="h3"})):n,[n,l,o,a,s]),[u,m]=C.useState(!1),g=d.some($=>vT($)&&s!=="h3"||bT(i?.($))),{command:y,action:x}=rx({noun:t,disabledReason:g?void 0:`None of these ${t[1]} has anything to show`}),w=s!=="h3"?x:void 0,S=C.useMemo(()=>i?cke(d,i):d,[d,i]),b=u||S.length<=JI?S:S.slice(0,JI);return p.jsx(sh,{label:e,count:d.length,level:s,action:w,children:p.jsx(Ty.Provider,{value:y,children:p.jsxs(Te,{sx:{display:"flex",flexDirection:"column",gap:"3px"},children:[b.map($=>p.jsx(Pke,{field:$,run:r,modelPath:o,sourceName:a,fieldCode:i?.($),joined:s==="h3"},$.name)),b.length<S.length&&p.jsxs(Vn,{size:"small",onClick:()=>m(!0),sx:{alignSelf:"flex-start",textTransform:"none"},children:["Show all ",S.length.toLocaleString()," ",t[1]]})]})})})}function Fke(e,t){const n=new Map;if(!e||!t)return n;const r=new Map;for(const a of e.symbols)a.type==="explore"&&r.set(kT(a.name),a);const o=new Set;for(let a=t;a&&!o.has(a);){o.add(a);const i=r.get(a);if(!i)break;for(const[s,l]of Bke(e.lines,i))n.has(s)||n.set(s,l);a=Kke(U1(e.lines,i.range))}return n}const eL=/^\s*(view|measure|dimension)\s*:\s*$/,_ke=/^`?([A-Za-z_]\w*)`?\s+is\b/;function Bke(e,t){const n=new Map;let r,o=t.range.start;for(const i of t.children){const s=U1(e,{start:o,end:i.range.start});r=Wke(s)??r,o=i.range.end;const l=Uke(i,r);if(!l)continue;const d=qke(e,i,l);if(!d)continue;const u=kT(i.name);n.set(u,n.has(u)?null:d)}const a=new Map;for(const[i,s]of n)s&&a.set(i,s);return a}function Uke(e,t){if(e.type==="query")return t==="view"?"view":void 0;if(e.type==="field"&&(t==="dimension"||t==="measure"))return t}function qke(e,t,n){const r=U1(e,t.range).split(`
505
505
  `),o=[];for(;r.length>1&&/^\s*(#|\/\/|--|$)/.test(r[0]);){const s=r.shift().trim();s.startsWith("#")&&o.push(s)}r[0]=r[0].trimStart();const a=r.join(`
506
- `).trimEnd(),i=Fke.exec(a);if(!(!i||i[1]!==kT(t.name)))return{kind:n,code:[...qke(e,t.range.start),...o,a].join(`
507
- `)}}function qke(e,t){const n=(e[t.line]??"").slice(0,t.character),r=n.trim()==="";if(!r&&!eL.test(n))return[];const o=i=>{const s=[];let l=i;for(;l>=0&&e[l].trim().startsWith("#");)s.unshift(e[l--].trim());return{out:s,next:l}},a=o(t.line-1);return r&&a.next>=0&&eL.test(e[a.next])?[...o(a.next-1).out,...a.out]:a.out}const Hke=/(?<![\w:])([A-Za-z_]\w*)\s*:(?!:)/g;function Vke(e){let t;for(const n of Wke(e).matchAll(Hke))t=n[1];return t}function Wke(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(e.startsWith('"""',n)){const o=e.indexOf('"""',n+3),a=o===-1?e.length:o+3;t+=" ".repeat(a-n),n=a-1}else if(r==='"'||r==="'"||r==="`"){const o=Yke(e,n);t+=" ".repeat(o-n+1),n=o}else if(r==="#"||r==="/"&&e[n+1]==="/"||r==="-"&&e[n+1]==="-"){const o=e.indexOf(`
508
- `,n),a=o===-1?e.length:o;t+=" ".repeat(a-n),n=a-1}else t+=r}return t}function Yke(e,t){const n=e[t];for(let r=t+1;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===n)return r;return e.length}function Gke(e){return/^`?[A-Za-z_]\w*`?\s+is\s+`?([A-Za-z_]\w*)`?\s*(?:extend\b|$)/.exec(e)?.[1]}function kT(e){return e.replace(/^`(.*)`$/,"$1")}const Kke=["fields","code"],tL={display:"inline-flex",alignItems:"center",color:"text.secondary",borderRadius:1,padding:"2px",flexShrink:0,"&:hover":{color:nx}};function Qke({join:e,run:t,modelPath:n,sourceName:r,link:o,entitiesByName:a,entitiesLoading:i,entitiesError:s,code:l,target:d,showRules:u=!1}){const[m,g]=yT(),{layers:y,layer:x,setLayer:w}=X6(Kke),S=C.useMemo(()=>a?eB({entities:a,loading:!!i,error:!!s}):void 0,[a,i,s]),b=e.dimensions.length+e.measures.length,$=p.jsxs(Te,{sx:{display:"inline-flex",alignItems:"center",gap:1},children:[m&&p.jsx(Z6,{"aria-label":`Show for ${e.name}`,layers:y,value:x,onChange:w,disabledReasons:{code:l?void 0:"No Malloy code to show for this join"}}),o?.kind==="link"&&o.href&&p.jsx(P0,{href:o.href,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:tL,children:p.jsx(QI,{size:14})}),o?.kind==="link"&&!o.href&&o.onOpen&&p.jsx(P0,{component:"button",type:"button",onClick:o.onOpen,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:tL,children:p.jsx(QI,{size:14})}),o?.kind==="join-only"&&p.jsx(Te,{component:"span",sx:{fontSize:Xa.micro,fontStyle:"italic",color:"text.secondary",flexShrink:0},children:"only accessible via join"})]});return p.jsxs(Te,{"data-testid":"model-viewer-join-row","data-name":e.name,sx:m?{pb:1.25}:void 0,children:[p.jsx(CT,{glyph:p.jsx(xT,{kind:"join"}),name:e.name,typeLabel:`${b} ${b===1?"field":"fields"}`,stackPills:!0,descriptors:p.jsxs(fs,{tone:"quiet",voice:"token",sx:{alignSelf:"center",flexShrink:0},children:["join_",e.relationship]}),doc:e.doc,open:m,expandable:!0,onToggle:()=>g(k=>!k),trailing:$,pills:d&&p.jsx(O6,{access:d.access})}),p.jsx(Up,{in:m,timeout:"auto",unmountOnExit:!0,children:p.jsx(Te,{sx:{mx:"10px",mt:"2px"},children:x==="code"&&l?p.jsx(Ey,{testId:"model-viewer-join-code",code:l}):p.jsxs(Te,{"data-testid":"model-viewer-join-fields",sx:{...kh,bgcolor:"transparent",p:1.5,pb:0},children:[d&&u&&p.jsx(ky,{component:"div","data-testid":"model-viewer-join-gate-warning",sx:{mb:1},children:lCe(d.sourceName,d.access)}),p.jsx(Xg,{label:"Measures",noun:["measure","measures"],level:"h3",items:e.measures,run:t,modelPath:n,sourceName:r,getFieldCode:S}),p.jsx(Xg,{label:"Dimensions",noun:["dimension","dimensions"],level:"h3",items:e.dimensions,run:t,modelPath:n,sourceName:r,getFieldCode:S})]})})})]})}function Xke({source:e,modelPath:t,entitiesByName:n,entitiesLoading:r,entitiesError:o,modelText:a,joinLinks:i,joinEntities:s,joinCodes:l,joinAccess:d,showRules:u=!1,columnDescriptions:m,run:g,queries:y,givens:x}){const w={run:g,modelPath:t,sourceName:e.name},{showField:S}=_1(),b=C.useMemo(()=>S?e.views.filter(F=>S({modelPath:t,sourceName:e.name,field:F,joined:!1})):e.views,[S,e,t]),$=rx({noun:["view","views"]}),k=rx({noun:["join","joins"]}),T=C.useMemo(()=>!r&&[...e.views,...e.measures,...e.calculations,...e.dimensions].some(F=>!n?.get(F.name)),[r,n,e]),{parsed:O,pending:P}=H6(a,T),D=C.useMemo(()=>zke(O,e.name),[O,e.name]),A=C.useMemo(()=>eB({entities:n,loading:!!r,error:!!o,columnDescriptions:m,declarations:D,declarationsLoading:P}),[n,r,o,m,D,P]);return p.jsxs(Te,{sx:{paddingBottom:"24px"},children:[x,p.jsx(sh,{label:"Views",count:b.length,action:$.action,children:p.jsx(Ty.Provider,{value:$.command,children:b.map(F=>p.jsx(J6,{field:F,modelPath:t,sourceName:e.name,fieldCode:A(F),run:g},F.name))})}),y,p.jsx(Xg,{label:"Measures",noun:["measure","measures"],items:e.measures,getFieldCode:A,...w}),p.jsx(Xg,{label:"Calculations",noun:["calculation","calculations"],items:e.calculations,getFieldCode:A,...w}),p.jsx(Xg,{label:"Dimensions",noun:["dimension","dimensions"],items:e.dimensions,getFieldCode:A,...w}),p.jsx(sh,{label:"Joins",count:e.joins.length,action:k.action,children:p.jsx(Ty.Provider,{value:k.command,children:e.joins.map(F=>p.jsx(Qke,{join:F,run:g,modelPath:t,sourceName:e.name,link:i?.get(F.name),entitiesByName:s?.get(F.name),code:l?.get(F.name),target:d?.get(F.name),showRules:u,entitiesLoading:r,entitiesError:o},F.name))})})]})}function P$(e){return{name:e.name,kind:e.kind,dataType:fT(e.type),typeTip:MSe(e.type),tags:OSe(e.annotations),doc:ih(e.annotations),indexed:e.kind==="dimension"?VSe(e):void 0,preaggregate:e.kind==="measure"?ESe(e.annotations):void 0}}function Zke(e){const t=[],n=[];for(const r of e.schema?.fields??[]){if(r.kind!=="dimension"&&r.kind!=="measure")continue;const o={...P$(r),indexed:!1,preaggregate:!1};r.kind==="dimension"?t.push(o):n.push(o)}return{name:e.name,relationship:e.relationship,doc:ih(e.annotations),dimensions:t,measures:n}}function Jke(e,t){const n={name:e.name,doc:ih(e.annotations),docParts:v6(e.annotations),accent:bCe(t),persist:TSe(e.annotations),dimensions:[],measures:[],calculations:[],views:[],joins:[]};for(const r of e.schema?.fields??[])switch(r.kind){case"dimension":case"measure":n[r.kind==="dimension"?"dimensions":"measures"].push(P$(r));break;case"calculate":n.calculations.push(P$(r));break;case"view":n.views.push({name:r.name,kind:"view",doc:ih(r.annotations),tags:dT(r.annotations)});break;case"join":n.joins.push(Zke(r));break}return n}function e$e(e){const t=[];for(const n of e??[]){if(!n.name)continue;const r=(n.annotations??[]).map(o=>({value:o}));t.push({name:n.name,sourceName:n.sourceName||void 0,doc:ih(r),tags:dT(r)})}return t}function tB(e){return e.dimensions.length+e.measures.length+e.calculations.length+e.views.length}function t$e(e,t){if(e.length===0)return null;const n=d=>d.toLowerCase().replace(/[-_]/g,""),r=t?n((t.split("/").pop()??t).replace(/\.malloy$/,"")):void 0,o=new Map(e.map(d=>[d.name,new Set(d.views.map(u=>u.name))])),a=d=>e.some(u=>{if(u.name===d.name||u.views.length===0)return!1;const m=o.get(d.name);return u.views.length<d.views.length&&[...o.get(u.name)].every(g=>m.has(g))}),i=e.filter(d=>!a(d)),s=i.length>0?i:e;let l=s[0];for(const d of s.slice(1)){if(d.views.length!==l.views.length){d.views.length>l.views.length&&(l=d);continue}r&&n(d.name)===r&&n(l.name)!==r&&(l=d)}return l}function n$e(e,t,n){if(!e||!t)return;const r=new RegExp("source:\\s*`?"+of(t)+"`?\\s+is\\s+`?([A-Za-z_]\\w*)`?\\s*(?:->|extend\\b)").exec(e);if(!r)return;const o=r[1];return n.has(o)?o:void 0}function NC(e,t){return`${e} ${e===1?t:`${t}s`}`}function r$e(e){const t=tB(e),n=[NC(e.views.length,"view"),NC(t,"field")];return e.joins.length>0&&n.push(NC(e.joins.length,"join")),n.join(" · ")}function o$e(e,t,n){if(n){const s=n.exportOrder,l=s.length>0&&e.some(d=>s.includes(d.name));return{sources:s$e(e,d=>d.name,s),curated:!0,exportOrdered:l}}const r=e.map((s,l)=>({source:s,index:l})).filter(({source:s})=>s.name!==t?.name).sort((s,l)=>l.source.views.length-s.source.views.length||s.index-l.index).map(({source:s})=>s),o=t?[t,...r]:r,a=t?.views.length??0,i=t&&a>0&&e.every(s=>s.views.length<=a)?t.name:void 0;return{sources:o,curated:!1,exportOrdered:!1,mostViews:i}}function a$e(e){return/^`.*`$/.test(e)?e.slice(1,-1):e}function i$e(e){if(!e)return[];const t=iv(e),n=[];for(const r of t.matchAll(/(?:^|[\s;])export\s*\{([^}]*)\}/gi))for(const o of r[1].split(",")){const a=a$e(o.trim());a&&!n.includes(a)&&n.push(a)}return n}function s$e(e,t,n){if(n.length===0)return[...e];const r=o=>{const a=n.indexOf(t(o));return a===-1?n.length:a};return e.map((o,a)=>({item:o,index:a})).sort((o,a)=>r(o.item)-r(a.item)||o.index-a.index).map(({item:o})=>o)}function l$e(e,t){const n=e?.trim();if(n)return{text:n,generated:!1};const r=t?.trim();return r?{text:r,generated:!0}:void 0}const c$e="This package's curated sources, in the order its index.malloy exports them.",u$e="This package's public sources.";function d$e(e){return e.mostViews?", most views":""}function f$e({anchorEl:e,onClose:t,sources:n,currentName:r,onPickSource:o,curated:a=!1,exportOrdered:i=!1}){return p.jsxs(DR,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{width:460,maxWidth:"calc(100vw - 32px)",maxHeight:"min(70vh, 560px)",display:"flex",flexDirection:"column",borderRadius:"10px"},"data-testid":"model-sources-dropdown"}},children:[p.jsxs(Te,{sx:{px:2,pt:1.5,pb:1,borderBottom:1,borderColor:"divider"},children:[p.jsx(wt,{variant:"subtitle2",component:"h2",sx:{m:0},children:"Sources"}),p.jsx(ky,{component:"p",sx:{m:0},children:a?i?c$e:u$e:CCe})]}),p.jsx(Te,{sx:{overflowY:"auto",py:.5},children:n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"This model defines no sources."}):n.map(s=>{const l=s.name===r;return p.jsxs(is,{"data-item-name":s.name,"aria-label":`Open source ${s.name}${d$e(s)}${uCe(s.access)}`,"aria-current":l||void 0,onClick:()=>{t(),o(s.name)},sx:{display:"flex",width:"100%",alignItems:"flex-start",justifyContent:"flex-start",textAlign:"left",gap:1.25,px:2,py:1,bgcolor:l?xo.background.muted:void 0,"&:hover":{bgcolor:l?xo.background.strong:xo.background.muted},...Ry},children:[p.jsx(Te,{component:"span","aria-hidden":!0,sx:{color:Tp.steel.main,display:"inline-flex",pt:"2px"},children:p.jsx(U6,{size:16})}),p.jsxs(Te,{component:"span",sx:{minWidth:0,flex:1},children:[p.jsxs(Te,{component:"span",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1},children:[p.jsx(Te,{component:"span",sx:{fontFamily:os,fontSize:Xa.body,fontWeight:500,color:"text.primary"},children:s.name}),s.mostViews&&p.jsx(fs,{tone:"quiet",sx:{alignSelf:"center"},children:p$e}),M6(s.access)&&p.jsx(O6,{access:s.access}),s.status]}),(s.description||s.descriptionPending)&&p.jsxs(Te,{component:"span",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",mt:.25,fontSize:Xa.small,color:"text.secondary",minHeight:s.description?void 0:"1.4em"},children:[s.description?.generated&&p.jsx(fs,{tone:"quiet","data-testid":"model-sources-summary-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),s.description&&P6(s.description.text)]}),p.jsx(ky,{"data-testid":"model-sources-row-meta",sx:{display:"block",mt:.25},children:s.meta})]})]},`source:${s.name}`)})})]})}const p$e="Most views";function h$e({sources:e,currentName:t,countLabel:n,onPickSource:r,curated:o=!1,exportOrdered:a=!1,onWarm:i}){const[s,l]=C.useState(null);return p.jsxs(p.Fragment,{children:[p.jsx(Eke,{size:"small",variant:"outlined",onClick:d=>{i?.(),l(d.currentTarget)},endIcon:p.jsx(QCe,{size:20}),"aria-label":`${n}. Showing ${t}, one of the ${n} in this model`,"aria-haspopup":"dialog","aria-expanded":!!s,onPointerEnter:i,onFocus:i,sx:{ml:1,transition:"none"},children:n}),p.jsx(f$e,{anchorEl:s,onClose:()=>l(null),sources:e,currentName:t,onPickSource:r,curated:o,exportOrdered:a})]})}const m$e=[],g$e=[],y$e=[],v$e=new Map;function b$e(e){const t=e.modelDef;if(typeof t!="string")return!1;try{const n=JSON.parse(t);return Array.isArray(n.imports)&&n.imports.length>0}catch{return!1}}function x$e(e,t){if(typeof e=="string")try{const r=FI(JSON.parse(e).annotations);if(r)return r}catch{}if(!t)return;const n=t.split(`
509
- `).filter(r=>/^##(\(doc\)|")/.test(r.trim())).map(r=>({value:r}));return FI(n)}async function w$e(e,t,n,r,o,a){const i=await e.models.getModel(t,n,r,o,a),s=S$e(i.data);return{sourceInfos:(i.data.sourceInfos??[]).map(l=>JSON.parse(l)),queries:i.data.queries??[],sourceText:s,givens:LSe(r,i.data),access:oCe(i.data),modelDoc:x$e(i.data.modelInfo,s),hasImports:b$e(i.data)}}function S$e(e){const t=e.sourceText;return typeof t=="string"?t:void 0}function C$e(e,t,n,r,o=!1){return["model-viewer-sources",e,t,n,r??"",...o?["off-surface"]:[]]}function k$e(e,t,n,r,o,a=!1){return{queryKey:C$e(t,n,r,o,a),queryFn:()=>w$e(e,t,n,r,o,a),...o&&o!=="latest"?{staleTime:1/0}:{}}}function $$e(e,t,n,r,o=!0,a=!1){const{apiClients:i}=tr(),s=zd({...k$e(i,e,t,n,r,a),enabled:o&&!!(e&&t&&n)});return{sources:s.data?.sourceInfos??m$e,queries:s.data?.queries??g$e,sourceText:s.data?.sourceText,givens:s.data?.givens??y$e,access:s.data?.access??v$e,modelDoc:s.data?.modelDoc,hasImports:s.data?.hasImports??!1,isLoading:s.isLoading,isError:s.isError,error:s.error,refetch:s.refetch}}const R$e=new Map;function nL(e){return(e.split("/").pop()??e).replace(/\.malloy$/,"")}function T$e(e,t){const n=KSe(e,t),r=t.filter(a=>!n.has(a.name)),o="Nothing on this page reads them.";return r.length===0?`Declared here for the models that import this file. ${o}`:r.length===t.length?`Imported from another file, for the models that import this one. ${o}`:`For the models that import this file. ${Qg(r.map(a=>a.name),"and")} ${r.length===1?"comes":"come"} from a file this one imports; the rest are declared here. ${o}`}function E$e({resourceUri:e,sourceName:t,onSourceChange:n,initialSourceName:r,includeHiddenFilesAndSources:o=!1,hostGivenNames:a,givens:i,onGivensChange:s,showAccessRules:l=!1,headingLevel:d="h1",headerActions:u,renderSourceStatus:m,entities:g,entitiesLoading:y=!1,entitiesError:x=!1,columnDescriptions:w,joinHref:S,queryMetadata:b,onQueryRun:$,maxResultSize:k,extensions:T}){const{environmentName:O,packageName:P,modelPath:D="",versionId:A}=Xr(e),F=Vr().theme.ui.font.mono,{sources:L,queries:_,sourceText:R,givens:z,access:N,modelDoc:B,hasImports:I,isLoading:H,isError:Y,error:ae,refetch:K}=$$e(O,P,D,A,!0,o),oe=C.useMemo(()=>new Set(a??[]),[a]),ue=C.useMemo(()=>z.filter(Bt=>!oe.has(Bt.name)),[z,oe]),G=C.useMemo(()=>L.map(Jke),[L]),ie=C.useMemo(()=>e$e(_),[_]),Q=C.useMemo(()=>YSe(G),[G]),ee=C.useMemo(()=>WSe(L),[L]),Z=C.useMemo(()=>zSe(ue),[ue]),de=JSON.stringify(i??null),le=C.useMemo(()=>i&&Object.fromEntries(Object.entries(i).filter(([Bt])=>Z.has(Bt))),[de,Z]),fe=!H&&!Y,he=C.useCallback(Bt=>s?.(Bt,Array.from(Z.keys())),[s,Z]),me=_F({declaredTypes:Z,params:le,onParamsChange:fe&&s?he:void 0,documentKey:`${O}/${P}@${A??""}/${D}`,autorun:!0}),se=C.useMemo(()=>FSe(me.applied,Z),[me.applied,Z]),{givensBySource:ve,unknownGivensBySource:Le}=C.useMemo(()=>{const Bt=new Map,pn=new Map;for(const $n of G){const qt=XSe(R,$n.name,ue);Bt.set($n.name,qt.givens),qt.unknown.size>0&&pn.set($n.name,qt.unknown)}return{givensBySource:Bt,unknownGivensBySource:pn}},[G,R,ue]),Ae=C.useMemo(()=>({projectName:O,packageName:P,versionId:A,givens:ue,givensBySource:ve,unknownGivensBySource:Le,requiredFiltersBySource:ee,givenValues:se,accessBySource:N,includeHiddenFilesAndSources:o,queryMetadata:b,onQueryRun:$,maxResultSize:k}),[O,P,A,ue,ve,Le,ee,se,N,o,b,$,k]),[Re,re]=C.useState(r),_e=t!==void 0,Me=_e?t:Re,Ge=C.useCallback(Bt=>{_e||re(Bt),n?.(Bt)},[_e,n]),Je=C.useMemo(()=>t$e(G,D),[G,D]),St=G.find(Bt=>Bt.name===Me)??(_e?void 0:Je),Ut=C.useMemo(()=>St?ve.get(St.name)??ue:ue,[St,ve,ue]),at=C.useMemo(()=>St?ZSe(R,St.name,ue,Q):new Map,[St,R,ue,Q]),tt=C.useMemo(()=>n$e(R,St?.name,Q),[R,St?.name,Q]),pt=C.useMemo(()=>St?$Se(St,G.find(Bt=>Bt.name===tt)):void 0,[St,G,tt]),ze=C.useMemo(()=>g?GSe(g):R$e,[g]),be=St?ze.get(St.name):void 0,{joinLinks:Ve,joinEntities:Oe,joinCodes:$t,joinAccessRules:Rt}=C.useMemo(()=>{const Bt=new Map,pn=new Map,$n=new Map,qt=new Map,Pn=new Map([[D,new Set(Q)]]);for(const Se of be?.values()??[]){if(Se.fieldType!=="join")continue;Se.code&&$n.set(Se.name,Se.code);const jn=Se.joinTarget;if(jn)if(jn.modelPath===D){const Rn=ze.get(jn.sourceName);Rn&&pn.set(Se.name,Rn);const en=b0(N,jn.sourceName);M6(en)&&qt.set(Se.name,{sourceName:jn.sourceName,access:en});const jt=vCe(jn,Pn);Bt.set(Se.name,jt.kind==="link"?{...jt,onOpen:()=>Ge(jn.sourceName)}:jt)}else{const Rn=S?.(jn);Rn&&Bt.set(Se.name,{kind:"link",href:Rn})}}return{joinLinks:Bt,joinEntities:pn,joinCodes:$n,joinAccessRules:qt}},[be,ze,D,Q,N,Ge,S]),vt=D==="index.malloy"&&!o,it=C.useMemo(()=>o$e(G,Je,vt?{exportOrder:i$e(R)}:void 0),[G,Je,vt,R]),st=T?.describePickerSource,Dt=C.useMemo(()=>it.sources.map(Bt=>{const pn=st?.({modelPath:D,sourceName:Bt.name});return{name:Bt.name,description:l$e(Bt.doc,pn?.summary),descriptionPending:!Bt.doc?.trim()&&!pn?.summary&&!!pn?.summaryPending,meta:r$e(Bt),mostViews:it.mostViews===Bt.name,access:b0(N,Bt.name),status:pn?.status}}),[it,N,st,D]),nn=(()=>{if(H)return p.jsx(Bo,{text:"Fetching Model..."});if(Y)return yCe(ae)?p.jsx(Te,{sx:{pt:M$},children:p.jsx(Kg,{message:K6(ae)??`${P}/${D} doesn't exist, or you don't have access to it.`})}):p.jsx(q1,{message:Q6("Failed to load model",ae),onRetry:()=>void K()});const Bt=ie.length>0&&p.jsx(Lke,{queries:ie,sourceText:R,modelPath:D,run:Ae});if(G.length===0)return ie.length===0?p.jsxs(p.Fragment,{children:[p.jsx(OC,{headingLevel:d,title:nL(D),meta:ue.length>0?`${ue.length} ${ue.length===1?"given":"givens"}`:void 0,actions:u,isSource:!1,offSurface:o}),p.jsx(Kg,{message:"This model defines no sources or queries.",secondary:I&&p.jsxs(p.Fragment,{children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})}),p.jsxs(sh,{label:"Givens",count:ue.length,testId:"model-viewer-declared-givens",children:[p.jsx(Wd,{"data-testid":"model-viewer-declared-givens-where",sx:{mb:1},children:T$e(R,ue)}),p.jsx(pT,{givens:ue})]})]}):p.jsxs(p.Fragment,{children:[p.jsx(OC,{headingLevel:d,title:nL(D),meta:`${ie.length} ${ie.length===1?"query":"queries"}`,actions:u,isSource:!1,offSurface:o}),Bt]});if(!St)return p.jsx(Te,{sx:{pt:M$},children:p.jsx(Kg,{message:`This model has no source named ${Me}.`,secondary:p.jsxs(Te,{component:"span","data-testid":"model-viewer-source-links",children:["Sources in this model: ",G.map((Se,jn)=>p.jsxs("span",{children:[jn>0&&", ",p.jsx(P0,{component:"button",type:"button",onClick:()=>Ge(Se.name),sx:{fontFamily:os,verticalAlign:"baseline"},children:Se.name})]},Se.name))]})})});const pn=tB(St),$n=tt?void 0:[...be?.values()??[]].find(Se=>Se.table)?.table,qt=tt?p.jsxs(p.Fragment,{children:["from ",p.jsx(P0,{component:"button",type:"button",onClick:()=>Ge(tt),sx:{fontFamily:os,color:F1,textDecorationColor:"inherit",verticalAlign:"baseline"},children:tt})]}):$n?p.jsxs(p.Fragment,{children:["reads ",p.jsx(Te,{component:"span","data-testid":"model-viewer-source-table",sx:{fontFamily:os},children:[$n.connectionName,$n.catalogName,$n.schemaName,$n.tableName].filter(Boolean).join(".")})]}):void 0,Pn=T?.renderSourceDetail?.({modelPath:D,sourceName:St.name});return p.jsxs(p.Fragment,{children:[p.jsx(OC,{headingLevel:d,title:St.name,titleAdornments:G.length>1&&p.jsx(h$e,{sources:Dt,currentName:St.name,countLabel:kCe(Dt.length,it.curated),onPickSource:Ge,curated:it.curated,exportOrdered:it.exportOrdered}),actions:u,status:m?.(St.name),kindLabel:"Source",meta:`${pn} ${pn===1?"field":"fields"}`,doc:pt,modelDoc:B,access:b0(N,St.name),showRules:l,offSurface:o,publicSurface:vt,provenance:qt}),Pn&&p.jsx(Te,{"data-testid":"model-viewer-source-detail",sx:{mt:1.5},children:Pn}),p.jsx(gT.Provider,{value:ue,children:p.jsx(Xke,{source:St,modelPath:D,entitiesByName:be,entitiesLoading:y,entitiesError:x,columnDescriptions:w?.get(St.name),modelText:R,joinLinks:Ve,joinAccess:Rt,showRules:l,joinEntities:Oe,joinCodes:$t,run:Ae,queries:Bt,givens:p.jsx(SCe,{givens:Ut,unknown:St?Le.get(St.name):void 0,inheritedFrom:at,values:me.draft,onChange:me.setGiven,onReset:me.reset,environmentName:O,packageName:P,modelPath:D,versionId:A,declaredTypes:Z})},St.name)})]})})();return p.jsx(C6.Provider,{value:T??{},children:p.jsx(Te,{"data-testid":"model-viewer",sx:{...ASe,pb:2,[x6]:F},children:p.jsx(Te,{sx:DSe,children:nn})})})}const M$e=Jt(p.jsx("path",{d:"M8 5v14l11-7z"}));function nB({open:e,onClose:t,result:n,title:r="Results",renderLogs:o,drill:a}){return p.jsx(Oo,{open:e,onClose:t,title:r,maxWidth:!1,showClose:!0,children:p.jsx(Te,{sx:{height:"70vh",overflow:"auto"},children:p.jsx(A1,{result:n,maxHeight:Ile,maxResultSize:1e6,renderLogs:o,drill:a})})})}function O$e({queryName:e,annotations:t,resourceUri:n,runOnDemand:r=!1,maxResultSize:o=0}){const[a,i]=kn.useState(),[s,l]=kn.useState(!1),[d,u]=kn.useState(!1),{packageName:m,environmentName:g,versionId:y,modelPath:x}=Xr(n),w=!r||d,S=rT({environmentName:g,packageName:m,modelPath:x,versionId:y,queryName:e},{enabled:w}),b=S.data,{mode:$}=Vr();return C.useEffect(()=>{if(t&&t.length>0){const k=t.map(T=>`// ${T}`).join(`
510
- `);ST(k,"typescript",$).then(T=>{i(T)})}},[t,$]),p.jsxs(Te,{children:[a&&p.jsx(Te,{sx:{marginBottom:"16px"},children:p.jsx(wt,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:p.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),p.jsxs(Te,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[p.jsx(wt,{variant:"body2",sx:{fontSize:"15px",fontWeight:600,color:"text.primary",px:2,py:1,bgcolor:"action.hover",borderRadius:1.5,border:1,borderColor:"divider"},children:e}),p.jsx(zp,{"aria-label":"Expand results",onClick:()=>l(!0),children:p.jsx(Kp,{})})]}),p.jsxs(x4,{sx:{position:"relative"},children:[r&&!d&&p.jsxs(Te,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),p.jsx(Vn,{variant:"contained",startIcon:p.jsx(M$e,{}),onClick:()=>u(!0),children:"Run Query"})]}),w&&p.jsx(X2,{state:S,context:e,maxHeight:Nle,maxResultSize:o})]}),p.jsx(nB,{open:s,onClose:()=>l(!1),result:b?.data?.result||"",renderLogs:b?.data?.renderLogs,title:`Query: ${e}`})]})}function P$e(e){return e!=null}function j$e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||P$e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=P1(a.type??"string",a.default);i&&r.push(`${a.name} = ${i}`)}const o={missing:n};return r.length>0&&(o.defaultsNote=r.length===1?`Ran with the default ${r[0]}`:`Ran with defaults ${r.join(", ")}`),o}function A$e(e){return e.length===1?`This source may need a value for the given ${e[0]}. Set it in the parameters above.`:`This source may need values for the givens ${e.join(", ")}. Set them in the parameters above.`}function D$e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return kn.useEffect(()=>{o&&o(t)},[t,o]),p.jsx(b4,{children:p.jsxs(C9,{spacing:2,component:"section",children:[p.jsx(I$e,{sourceAndPath:e[t],existingQuery:n,onChange:l=>{r&&r(l)},resourceUri:a,givens:i,gate:s}),p.jsx(g5,{height:"5px"})]})})}function IC(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function N$e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[l,d]=kn.useState(n||IC()),[u,m]=kn.useState(void 0);kn.useEffect(()=>{n&&d(n)},[n]);const[g,y]=kn.useState([]),{MalloyExplorerProvider:x,QueryPanel:w,ResizableCollapsiblePanel:S,ResultPanel:b,SourcePanel:$}=r;kn.useEffect(()=>{t&&t(l)},[t,l]);const{environmentName:k,packageName:T,versionId:O}=Xr(a),{apiClients:P}=tr(),D=kn.useRef(void 0),A=hl({mutationFn:()=>{D.current=s,m({executionState:"running",query:l?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{A.reset(),m(void 0)},response:{}});const R=typeof l?.malloyQuery=="string"?l.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:l?.malloyQuery}).toMalloy();return d({...l,query:R}),P.models.executeQueryModel(k,T,e.modelPath,{query:R,sourceName:void 0,queryName:void 0,versionId:O,...i&&Object.keys(i).length>0?{givens:i}:{}})},onSuccess:R=>{if(R){const z=JSON.parse(R.data.result);d({...l,malloyResult:z});const N=D.current;m(B=>B?{...B,executionState:"finished",response:{result:z,...N?.defaultsNote?{messages:[{severity:"INFO",title:N.defaultsNote}]}:{}}}:void 0)}},onError:R=>{console.error("Query execution error:",R);const z=R?.data?.message??R?.message??"The query could not be run.",N=[{severity:"ERROR",title:z}],B=D.current?.missing??[];(R?.status===403||/Access denied for source/i.test(z))&&B.length>0&&N.push({severity:"WARN",title:A$e(B)}),m(I=>I?{...I,executionState:"finished",response:{messages:N}}:void 0)}}),[F,L]=kn.useState(e.sourceInfo.name);kn.useEffect(()=>{F!==e.sourceInfo.name&&(L(e.sourceInfo.name),d(IC()),m(void 0))},[e,F]);const _=kn.useCallback(R=>{d({...l,malloyQuery:R,malloyResult:void 0})},[l]);return F!==e.sourceInfo.name?p.jsx("div",{children:"Loading..."}):p.jsx(w4,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:p.jsx(x,{source:e.sourceInfo,query:l?.malloyQuery,topValues:[],onFocusedNestViewPathChange:y,focusedNestViewPath:g,onQueryChange:_,children:p.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[p.jsx(S,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:p.jsx($,{onRefresh:()=>d(IC())})}),p.jsx(S,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:p.jsx(w,{runQuery:()=>{console.log(`running query with: ${l?.malloyQuery}`);try{A.mutate()}catch(R){console.error("Error running query:",R)}}})}),p.jsx(b,{source:e.sourceInfo,draftQuery:l?.malloyQuery,setDraftQuery:R=>d({...l,malloyQuery:R}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function I$e(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let s=!0;return Promise.all([wo(()=>import("./index-DYHeNKEh.js"),__vite__mapDeps([5,0,1,2,6])),H0e()]).then(([l,d])=>{s&&(n(l),o(d),i(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?p.jsx(Wne,{children:p.jsx(w4,{children:p.jsx(g5,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):p.jsx(N$e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function rB(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=Xr(e),{apiClients:i}=tr();return co({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function oB({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:l}){const[d,u]=kn.useState(r);kn.useEffect(()=>{u(r)},[r]);const{data:m,isError:g,isLoading:y,error:x}=rB(a,!e),{environmentName:w,packageName:S,modelPath:b,versionId:$}=Xr(a),k=e||m,T=kn.useMemo(()=>k?.givens??[],[k]),O=b2({specs:T,loaded:!!k,params:i,onGivensChange:s,startingValues:l,documentKey:a,autorun:!0,environmentName:w??"",packageName:S??"",modelPath:b,versionId:$,documentName:b}),P=C.useMemo(()=>Jd(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),D=C.useMemo(()=>j$e(T,O.applied),[T,O.applied]);if(y&&!e)return p.jsx(Bo,{text:"Fetching Model..."});if(g&&!e)return console.log("error",x),p.jsx(ja,{error:x,context:`ModelExplorer > ${b}`});if(!k)return p.jsx(Bo,{text:wu.loading});const A=(k?.sourceInfos||[]).map((L,_)=>{try{return JSON.parse(L)?.name||`Source ${_+1}`}catch{return`Source ${_+1}`}}),F=A[d]||"";return p.jsxs(Hne,{variant:"outlined",children:[p.jsx(Vne,{children:p.jsx(Yn,{sx:{flexDirection:"row"},children:p.jsx(mwe,{size:"small",id:"size-small-standard",disablePortal:!0,options:A,value:F,onChange:(L,_)=>{if(!_)return;const R=A.indexOf(_);R>=0&&(u(R),o?.(R))},renderInput:L=>p.jsx(yr,{...L}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),p.jsx(j1,{...O.panel}),p.jsx(b4,{children:p.jsxs(Yn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&p.jsx(D$e,{sourceAndPaths:k.sourceInfos.map(L=>({sourceInfo:JSON.parse(L),modelPath:b})),selectedSourceIndex:d,existingQuery:n,onQueryChange:t,resourceUri:a,givens:P,gate:D}),p.jsx(Te,{height:"5px"})]})})]})}function aB({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}){return p.jsxs(zx,{open:e,onClose:t,fullScreen:!0,children:[p.jsxs(_x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,p.jsx(ro,{onClick:t,sx:{color:"text.secondary"},children:p.jsx(xh,{})})]}),p.jsx(Fx,{children:a?p.jsx(oB,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}):p.jsx("div",{children:"No valid import statement found in cell"})})]})}function L$e({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=Xr(t),{data:s,isError:l,isLoading:d,error:u}=rB(t),[m,g]=kn.useState(!1),[y,x]=kn.useState(),[w,S]=kn.useState(0),[b,$]=C.useState(""),[k,T]=kn.useState({}),O=o??k,P=a??(R=>T(R)),D=s?.modelDef,A=kn.useMemo(()=>{if(!D)return!1;try{const R=JSON.parse(D);return Array.isArray(R.imports)&&R.imports.length>0}catch{return!1}},[D]);if(d)return p.jsx(Bo,{text:"Fetching Model..."});if(l)return console.log("error",u),p.jsx(ja,{error:u,context:`Model > ${i}`});const F=R=>{x(R),e&&e(R)},L=R=>{S(R)},_=()=>{const R=window.location.href;navigator.clipboard.writeText(R).then(()=>$("URL copied to clipboard!")).catch(()=>$("Failed to copy URL"))};return p.jsxs(p.Fragment,{children:[p.jsxs(Te,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&p.jsxs(Yn,{spacing:2,component:"section",children:[p.jsxs(Te,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsx(wt,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),p.jsx(Br,{title:"Copy link",children:p.jsx(ro,{size:"small","aria-label":"Copy link",onClick:_,sx:{color:"text.secondary"},children:p.jsx(uT,{fontSize:"small"})})})]}),p.jsx(oB,{data:s,onChange:F,onSourceChange:L,existingQuery:y,initialSelectedSourceIndex:w,resourceUri:t,givens:O,onGivensChange:P}),p.jsx(zp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:p.jsx(Kp,{})})]}),s?.queries?.length>0&&p.jsxs(Yn,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[p.jsx(Te,{sx:{padding:"0 0 16px 0"},children:p.jsx(wt,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(R=>p.jsx(O$e,{queryName:R.name,annotations:R.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},R.name))]}),(!Array.isArray(s?.sourceInfos)||s.sourceInfos.length===0)&&!(s?.queries&&s.queries.length>0)&&p.jsxs(Te,{sx:{textAlign:"center",py:6},children:[p.jsx(wt,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),A&&p.jsxs(wt,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),p.jsx(aB,{open:m,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:y,initialSelectedSourceIndex:w,onChange:F,onSourceChange:L,givens:O,onGivensChange:P})]}),p.jsx(hh,{open:b!=="",autoHideDuration:6e3,onClose:()=>$(""),message:b})]})}function z$e(){const[e,t]=C.useState("");return p.jsxs(p.Fragment,{children:[p.jsx(Br,{title:"Copy link",children:p.jsx(ro,{size:"small","aria-label":"Copy link",onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>t("URL copied to clipboard!")).catch(()=>t("Failed to copy URL"))},sx:{color:"text.secondary"},children:p.jsx(uT,{fontSize:"small"})})}),p.jsx(hh,{open:e!=="",autoHideDuration:6e3,onClose:()=>t(""),message:e})]})}function GTe(e){const{modelPage:t,isLoadingStatus:n}=tr();if(n)return p.jsx(Bo,{text:"Fetching Model..."});if(t!=="viewer")return p.jsx(L$e,{...e});const{onChange:r,runOnDemand:o,headerActions:a,...i}=e;return p.jsx(E$e,{...i,headerActions:a??p.jsx(z$e,{})})}function F$e({warnings:e}){const[t,n]=C.useState(!1),r=(e??[]).filter(a=>a.severity==="error"),o=(e??[]).filter(a=>a.severity!=="error");return r.length===0&&o.length===0?null:p.jsxs(Yn,{sx:{gap:1,mb:4},children:[r.length>0&&p.jsxs(lo,{severity:"warning",children:[p.jsx(vY,{children:r.length===1?"1 problem in this package":`${r.length} problems in this package`}),p.jsx(rL,{findings:r})]}),o.length>0&&p.jsxs(Te,{children:[p.jsxs(Vn,{size:"small","aria-expanded":t,onClick:()=>n(a=>!a),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",o.length," ",o.length===1?"note":"notes"]}),t&&p.jsx(Te,{sx:{pl:.5,pt:.5},children:p.jsx(rL,{findings:o})})]})]})}function rL({findings:e}){return p.jsx(Yn,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>p.jsxs(wt,{component:"li",variant:"body2",children:[t.model&&p.jsx(Te,{component:"span",sx:{fontFamily:Fo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function _$e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:l,chrome:d,manifestStaleTime:u,actions:m,rowsActions:g}){const y=Xr(e),{apiClients:x}=tr(),w=y.environmentName??"",S=y.packageName??"",b=y.versionId,$=!!y.environmentName&&!!y.packageName,{data:k,isSuccess:T,isError:O,error:P}=co({...uxe(x,{environmentName:w,packageName:S,path:t,versionId:b},u),enabled:$&&t!==""}),D=k?.layout,A=ace({path:t,layout:D},l),F=`${e}|${t}`,L=C.useRef(void 0),_=C.useRef({key:F,at:Pd()});_.current.key!==F&&(_.current={key:F,at:Pd()}),C.useEffect(()=>{L.current!==F&&($?O?(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:U0(P)})):k?.notebook?.format==="malloynb"?(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:"unsupported"})):T&&k&&(L.current=F,A.emit({type:"report.opened",surface:"view",from:"package",tiles:k.tiles?.length??0,durationMs:Pd()-_.current.at})):(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[F,$,O,P,T,k,A]);const R=C.useCallback((B,I)=>{const H=o?.(B,I);H&&A.emit({type:"report.drill",to:"report",outcome:H})},[o,A]),z=o?R:void 0;if(!$)return p.jsxs(lo,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(O)return p.jsx(ja,{context:`${w} > ${S} > ${t}`,error:P});if(!T||!k)return p.jsx(Bo,{text:wu.opening("report")});if(k.notebook?.format==="malloynb")return p.jsxs(lo,{severity:"info",children:[t," is a .malloynb notebook, which Report does not run: render it with Notebook."]});const N=p.jsx(t6,{manifest:k,environmentName:w,packageName:S,versionId:b,documentName:t,givens:n,onGivensChange:r,onNavigate:z,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:d,...m!==void 0?{actions:m}:{},...g!==void 0?{rowsActions:g}:{}});return p.jsx($F.Provider,{value:A,children:N})}function B$e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:l,modelsLoading:d=!1,modelsError:u,onRetryModels:m,target:g,savedAs:y,onClose:x,onCreated:w,onEvent:S}){const b=t??(n?L_(n):"linear"),$=r??o??!0,[k,T]=C.useState(b),[O,P]=C.useState(void 0),[D,A]=C.useState(""),[F,L]=C.useState(""),[_,R]=C.useState(""),z=C.useRef(null),[N,B]=C.useState(""),[I,H]=C.useState(!1),[Y,ae]=C.useState(!1),[K,oe]=C.useState(!1),[ue,G]=C.useState(void 0),ie=u!=null,{choices:Q,isLoading:ee,isSuccess:Z,failed:de,retry:le,canRetry:fe}=lxe({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:l,enabled:e&&l.length>0}),he=C.useMemo(()=>Q.get(D)??[],[Q,D]),me=C.useMemo(()=>new Map([...Q.entries()].flatMap(([st,Dt])=>Dt.map(nn=>[LC(st,nn.source,nn.view),{model:st,source:nn.source,view:nn.view}]))),[Q]),se=C.useMemo(()=>{const st=Q.size>1;return[...Q.entries()].flatMap(([Dt,nn])=>{const Bt=new Map;for(const pn of nn)Bt.set(pn.source,[...Bt.get(pn.source)??[],pn]);return[...Bt.entries()].map(([pn,$n])=>({key:`${Dt}::${pn}`,label:pn,ariaLabel:`${pn} in ${Dt}`,...st||$n[0]?.sourceDescription?{detail:[st?Dt:void 0,$n[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:$n.map(qt=>({key:LC(Dt,qt.source,qt.view),name:qt.view,title:qt.description??vC(qt.view),...qt.chart?{chart:qt.chart}:{}}))}))})},[Q]),ve=st=>{const Dt=me.get(st);Dt&&(A(Dt.model),L(`${Dt.source}::${Dt.view}`))},Le=he.find(st=>`${st.source}::${st.view}`===F),Ae=Le?LC(D,Le.source,Le.view):void 0,Re=U$e(Le,250);C.useEffect(()=>{e&&T(b)},[e,b]),C.useEffect(()=>{if(!e)return;const st=[...Q.keys()];D===""&&st.length>0&&A(st[0])},[e,Q,D]),C.useEffect(()=>{!e||he.length===0||F!==""||L(`${he[0].source}::${he[0].view}`)},[e,he,F]),C.useEffect(()=>{!e||I||Le===void 0||B(vC(Le.view))},[e,I,Le]),C.useEffect(()=>{e||(A(""),L(""),R(""),B(""),H(!1),P(void 0),ae(!1),G(void 0))},[e]);const re=C.useMemo(()=>{if(N.trim()!=="")for(let st=1;st<=nT;st++){const Dt=A_(N,st);if(!g.existing?.includes(Dt))return Dt}},[N,g]),_e=O?.trim(),Me=_e===void 0||_e===""?void 0:_e.endsWith(".malloy")?_e:`${_e}.malloy`,Ge=Me??re,Je=Me===void 0?void 0:D_(Me)??(g.existing?.includes(Me)?`${Me} already exists; choose another location.`:void 0),St=(Le===void 0?void 0:eT({title:N,modelPath:D,source:Le.source,view:Le.view}))??(N.trim()!==""&&Ge===void 0?"No free file name for this title; choose another.":void 0),Ut=St!==void 0&&(Y||N.trim()!==""),at=d||ee,{theme:tt}=Vr(),pt=tt.ui,ze=Zd(tt.cardBorder),be=Q.size===0&&(ie||de.length>0),Ve=at?"Loading the model":be?"Couldn't read the model to start from":Q.size===0?"Nothing in the model to start from yet":Le===void 0?"Pick what to start from":void 0,Oe="report",$t=K?`Creating ${Oe}…`:`Create ${Oe}`,Rt=F!==""&&Le===void 0&&he.length>0,vt=async()=>{if(!(Ve!==void 0||Le===void 0||K)){if(St!==void 0||Je!==void 0){ae(!0);return}oe(!0),G(void 0);try{const st=await rxe({layout:k,...Me!==void 0?{path:Me}:{},document:{title:N,modelPath:D,source:Le.source,view:Le.view},target:g,...S?{onEvent:S}:{}});w(st)}catch(st){const Dt=st.response?.data?.message;G(Dt??(st instanceof Error?st.message:String(st)))}finally{oe(!1)}}},it=st=>p.jsx(Vn,{color:"inherit",size:"small",onClick:st,children:"Retry"});return p.jsx(Oo,{className:`${Sl.dialog} ${Sl.newReportDialog}`,maxWidth:"md",initialFocus:z,open:e,onClose:K?()=>{}:x,title:`New ${Oe}`,description:"A report is a Malloy file in the package that lays out text and queries. Pick what its first query shows; the rest is the builder.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{onClick:x,disabled:K,children:"Cancel"}),p.jsx(Br,{title:K?"":Ve??"",children:p.jsx("span",{children:p.jsx(Vn,{variant:"contained",disabled:K||Ve!==void 0,"aria-label":!K&&Ve!==void 0?`${$t}: ${Ve}`:$t,onClick:()=>void vt(),children:$t})})})]}),children:p.jsxs(Yn,{sx:{gap:1.5},children:[ie?p.jsx(lo,{severity:"error",action:m&&L4(u)?it(m):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):l.length===0?!d&&p.jsxs(lo,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",Oe," from it."]}):de.length>0?p.jsxs(lo,{severity:"warning",action:fe?it(le):void 0,children:["Couldn't read ",de.join(", "),", so nothing from"," ",de.length===1?"it":"them"," is listed."]}):Z&&Q.size===0&&p.jsxs(lo,{severity:"info",children:["A ",Oe," starts from a view of a source, and no model in this package declares one yet. Add a view to a source in a model file and this list fills in."]}),p.jsxs(Te,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${ze}`,borderBottom:`1px solid ${ze}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[p.jsx(Te,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${ze}`},maxHeight:{xs:280,md:"none"}},children:p.jsx(Ele,{groups:se,query:_,onQuery:R,picked:Ae,onPick:ve,onTake:st=>{ve(st)},searchRef:z,disabled:K,empty:p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",p:2},children:at?"Reading the package's models…":"Nothing to start from."})})}),p.jsxs(Te,{sx:st=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${st.palette.text.primary} 3%, ${st.palette.background.paper})`}),children:[$&&p.jsxs(Te,{children:[p.jsx(oL,{children:"Layout"}),p.jsx(Te,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(st=>p.jsx(V$e,{layout:st,checked:k===st,disabled:K,onPick:()=>T(st)},st))}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),p.jsxs(Te,{children:[p.jsx(oL,{children:"First query"}),p.jsx(Te,{role:"region","aria-label":"Preview",sx:st=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:pt.radius.tile,border:`1px solid ${ze}`,bgcolor:st.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${st.palette.background.paper})`}}),children:Le&&Re?p.jsx(Te,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:p.jsx(B_,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:D,tile:`${Re.source} -> ${Re.view}`,label:N.trim()||vC(Re.view),borderless:!0,givens:q$e,declaredTypes:H$e,height:180})}):p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:Rt?"What you picked is no longer in this model; pick something else.":"Pick what to start from."})}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),p.jsx(Ri,{size:"small",label:"Title",value:N,disabled:K,onChange:st=>{H(!0),B(st.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Ut,helperText:Ut?St:g.route==="package"?"Names the file too, unless you type a location.":y??`Saved as a new ${Oe} in the host's store, and opened in the builder.`}),p.jsx(Ri,{size:"small",label:"Location",value:O??re??"",placeholder:"report.malloy",disabled:K,onChange:st=>P(st.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:Je!==void 0,helperText:Je??(Ge?`Written as ${Ge} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),ue&&p.jsx(lo,{severity:"error",children:ue})]})]})]})})}function U$e(e,t){const[n,r]=C.useState(void 0);return C.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}const LC=(e,t,n)=>`${e}::${t}::${n}`,q$e=new Map,H$e=new Map;function oL({children:e}){const t=Vr().theme.ui;return p.jsx(wt,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function V$e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=Vr(),a=o.ui,i=Zd(o.cardBorder),s=t?o.accent:"currentColor";return p.jsxs(is,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:l=>({justifyContent:"flex-start",gap:1.25,px:1.25,py:1,borderRadius:a.radius.tile,border:`1px solid ${t?o.accent:i}`,boxShadow:t?`0 0 0 1px ${o.accent}`:"none",bgcolor:t?`color-mix(in srgb, ${o.accent} 6%, ${l.palette.background.paper})`:l.palette.background.paper,color:l.palette.text.secondary,textAlign:"left"}),children:[p.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),p.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),p.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),p.jsxs(Te,{children:[p.jsx(Te,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),p.jsx(Te,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const W$e=Jt(p.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),Y$e=Jt(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),G$e=Jt(p.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),K$e=Jt(p.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),iB={dashboard:hr.blue,report:hr.violet,model:hr.cyan,dataApp:hr.pink,data:hr.lime,materialization:hr.amber,agent:hr.red};function sB({type:e,size:t=18,sx:n,...r}){return p.jsx(B0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:Q$e[e]()})}const Q$e={report:X$e,model:Z$e,data:J$e,materialization:eRe,dataApp:rRe,dashboard:tRe,agent:nRe};function X$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),p.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),p.jsx("path",{d:"M8 17 v-3"}),p.jsx("path",{d:"M12 17 v-6"}),p.jsx("path",{d:"M16 17 v-4"})]})}function Z$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),p.jsx("path",{d:"M4 7 l8 4 l8 -4"}),p.jsx("path",{d:"M12 11 v10"})]})}function J$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function eRe(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),p.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),p.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function tRe(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M12 9.5 V20.5"}),p.jsx("path",{d:"M12 15 H20.5"})]})}function nRe(){return p.jsxs(p.Fragment,{children:[p.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),p.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function rRe(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M7 13.5 H17"}),p.jsx("path",{d:"M7 16.5 H13"})]})}function lB(e){return e>=1e9?`${(e/1e9).toFixed(1)} B rows`:e>=1e6?`${(e/1e6).toFixed(1)} M rows`:e>=1e3?`${(e/1e3).toFixed(1)} K rows`:`${e} rows`}const oRe=12;function aRe(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return Y$e;if(t.startsWith("record")||t.startsWith("struct"))return G$e;switch(t.split(/[\s(<]/)[0]){case"string":return W$e;case"number":return K$e;case"date":return N6;case"timestamp":case"timestamptz":return L6;case"boolean":return z6;default:return F6}}function iRe({column:e}){const t=aRe(e.type);return p.jsxs(Te,{component:"li",sx:n=>({display:"flex",alignItems:"center",gap:1.25,px:1,py:.625,borderRadius:1,transition:"background-color 0.1s","&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":n.palette.grey[100]}}),children:[p.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),p.jsxs(Te,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[p.jsx(wt,{component:"span",sx:{fontFamily:Fo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function sRe({database:e,onClose:t}){const n=e!==null,[r,o]=C.useState(e);e!==null&&e!==r&&o(e);const[a,i]=C.useState(""),[s,l]=C.useState(r?.path);s!==r?.path&&(l(r?.path),i(""));const d=C.useId(),u=r?.path??"",m=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-m.length-1)),y=r?.info?.rowCount,x=[g,y===void 0?null:lB(y)].filter(Boolean).join(" · "),w=C.useMemo(()=>r?.info?.columns??[],[r]),S=a.trim().toLowerCase(),b=C.useMemo(()=>S?w.filter($=>$.name?.toLowerCase().includes(S)||$.type?.toLowerCase().includes(S)):w,[w,S]);return p.jsxs(Oo,{open:n,onClose:t,showClose:!0,title:p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[p.jsx(Te,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:iB.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:p.jsx(sB,{type:"data",size:18})}),p.jsxs(Te,{sx:{minWidth:0},children:[p.jsx(wt,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:Fo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:m||"Columns"}),x&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:x})]})]}),children:[r?.error&&p.jsx(lo,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&p.jsxs(Te,{component:"section","aria-labelledby":d,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[p.jsxs(wt,{id:d,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",p.jsxs(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",S?`${b.length} of `:"",w.length]})]}),w.length>oRe&&p.jsx(Lx,{value:a,onChange:$=>i($.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:p.jsx(PR,{position:"start",children:p.jsx(Kp,{sx:{fontSize:16,color:"text.secondary"}})}),sx:{ml:"auto !important",width:200,fontSize:"0.8125rem",px:1,py:.25,border:"1px solid",borderColor:"divider",borderRadius:1.5,"&.Mui-focused":{borderColor:"primary.main"}}})]}),p.jsx(Te,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:b.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:S?"No columns match":"No columns"}):p.jsx(Te,{component:"ul","aria-labelledby":d,sx:{listStyle:"none",m:0,p:0},children:b.map(($,k)=>p.jsx(iRe,{column:$},`${$.name}-${k}`))})})]})]})}const cB=(e,t,n)=>["packageVersions",e,t,n];async function uB(e,t,n){try{return(await e.versions.listPackageVersions(t,n)).data}catch(r){const o=r?.response?.status;if(o===404||o===501)return[];throw r}}function lRe(e,t,n={}){const{apiClients:r,server:o}=tr(),a=(n.enabled??!0)&&e!==""&&t!=="",i=zd({queryKey:cB(e,t,o),queryFn:()=>uB(r,e,t),enabled:a,staleTime:3e4,retry:!1}),{refetch:s}=i,l=C.useCallback(()=>void s(),[s]),d=i.data??[];return{versions:d,latest:d.find(u=>u.latest)?.id,isPending:a&&i.isPending,isError:a&&i.isError,refetch:l}}function cRe(e,t){const{apiClients:n,server:r}=tr(),o=Tl();return C.useCallback(()=>o.fetchQuery({queryKey:cB(e,t,r),queryFn:()=>uB(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function uRe(e,t){const n=Tl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const dRe=Jt(p.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.81.97H5.44zM5 19V8h14v11zm8.45-9h-2.9v3H8l4 4 4-4h-2.55z"})),fRe=Jt(p.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),pRe=Jt(p.jsx("path",{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1"})),hRe=Jt(p.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.83 1H5.42zM5 19V8h14v11zm3-5h2.55v3h2.9v-3H16l-4-4z"})),gg=e=>{const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error?e.message:"Unknown error"},mRe=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Ep=e=>e.archiveStatus==="archive",zC="Tables built for this version alone (under scope: version) are dropped.";function aL(e,t){const n=!Ep(e)&&t.filter(o=>!Ep(o)).length<=1,r=t.length<=1;return{archive:e.latest?"The latest version can't be archived":n?"The last version in service can't be archived":void 0,delete:r?void 0:e.latest?"Pin another version as latest first":n?"The last version in service; delete the archived versions first":void 0}}function gRe({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:l}=tr(),d=Tl(),u=uRe(e,t),m=cRe(e,t),[g,y]=C.useState(null),[x,w]=C.useState(null),[S,b]=C.useState(null),[$,k]=C.useState(null),[T,O]=C.useState(null),[P,D]=C.useState(null),A=C.useRef(null),F=C.useRef(null),L=C.useRef(null),_=C.useRef(new Map),R=n.find(fe=>fe.latest)?.id,z=r??R,N=()=>Promise.all([u(),d.invalidateQueries({queryKey:["packages",e]})]),B=async(fe,he)=>{const me=he??await m().catch(()=>{});if(me===void 0)return;const se=me.find(Le=>Le.latest)?.id,ve=se??me.find(Le=>Le.id!==fe&&!Ep(Le))?.id;ve!==void 0&&(a?a(ve===se?void 0:ve):o(ve))},I=a0({mutationFn:fe=>l.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{b(null),await N()},onError:()=>void N()}),H=a0({mutationFn:({id:fe,archiveStatus:he})=>l.versions.updatePackageVersion(e,t,fe,{archiveStatus:he}),onSuccess:async(fe,{id:he,archiveStatus:me})=>{k(null),me==="archive"&&he===z&&await B(he),await N()},onError:(fe,{id:he,archiveStatus:me})=>{me==="unarchive"&&D(`Couldn't unarchive v${he}: ${gg(fe)}`),N()}}),Y=H.isPending?H.variables?.id:void 0,ae=a0({mutationFn:({id:fe})=>l.versions.deletePackageVersion(e,t,fe),onSuccess:async(fe,{id:he,read:me})=>{O(null);const se=await m().catch(()=>{})??me.filter(ve=>ve.id!==he);if(se.length===0){await d.invalidateQueries({queryKey:["packages",e]}),i?.();return}he===z&&await B(he,se),await N()},onError:()=>void N()}),K=()=>w(null),oe=x?aL(x.version,n):{},ue=x!==null&&!Ep(x.version)&&x.version.latest&&oe.archive!==void 0&&oe.delete!==void 0,G=T!==null&&T.versions===void 0,ie=T?.versions!==void 0&&T.versions.length<=1,Q=T?.versions!==void 0?aL(T.version,T.versions).delete:void 0,ee=async fe=>{K(),y(null),ae.reset(),O({version:fe});const he=ve=>O(Le=>Le!==null&&Le.version.id===fe.id&&Le.versions===void 0?ve:Le);let me;try{me=await m()}catch(ve){he(null),D(`Couldn't check v${fe.id} before deleting it: ${gg(ve)}`);return}const se=me.find(ve=>ve.id===fe.id);if(se===void 0){he(null),D(`v${fe.id} is no longer a version of ${t}.`),N();return}he({version:se,versions:me})},Z=(fe,he)=>{!s||Y===fe.id||w({version:fe,anchor:_.current.get(fe.id)??he})},de=(fe,he)=>{const me=fe.key==="ArrowRight"||fe.key==="ContextMenu"||fe.key==="F10"&&fe.shiftKey;!s||!me||(fe.preventDefault(),fe.stopPropagation(),Z(he,fe.currentTarget))},le=x&&p.jsxs(ea,{disabled:oe.delete!==void 0,onClick:()=>void ee(x.version),children:[p.jsx(ml,{children:p.jsx(SF,{fontSize:"small"})}),p.jsx(Ci,{primary:"Delete version",secondary:oe.delete})]},"delete");return p.jsxs(p.Fragment,{children:[p.jsx(Vn,{size:"small",variant:"outlined",endIcon:p.jsx(I6,{}),"aria-label":z?`Version v${z}, change version`:"Select a version","aria-haspopup":"menu",onClick:fe=>y(fe.currentTarget),sx:{borderRadius:999,textTransform:"none",fontWeight:500,px:1.5,minWidth:0,whiteSpace:"nowrap"},children:z?`v${z}`:"Select a version"}),p.jsx(uc,{anchorEl:g,open:g!==null,onClose:()=>y(null),slotProps:{paper:{sx:{minWidth:320,maxWidth:400,mt:1,borderRadius:3}},list:{"aria-label":`Versions of ${t}`,disabledItemsFocusable:!0}},children:n.map(fe=>{const he=fe.id===z,me=Ep(fe),se=[me?"Archived":void 0,mRe(fe.createdAt),fe.gitCommitSha?fe.gitCommitSha.slice(0,7):void 0].filter(Boolean).join(" · ");return p.jsxs(ea,{"aria-current":he?"true":void 0,"aria-disabled":me&&!s?"true":void 0,"aria-haspopup":s?"menu":void 0,"data-testid":"version-row",onKeyDown:ve=>de(ve,fe),onClick:ve=>{if(me){Z(fe,ve.currentTarget);return}he||(y(null),o(fe.id,ve))},sx:ve=>({gap:1,borderLeft:"3px solid",borderLeftColor:he?ve.palette.primary.main:"transparent",backgroundColor:he?as(ve.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[p.jsx(Ci,{primary:fe.id,secondary:se,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&p.jsx(TR,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&p.jsx(Br,{title:Y===fe.id?"Updating this version…":"",children:p.jsx("span",{children:p.jsx(ro,{ref:ve=>{ve?_.current.set(fe.id,ve):_.current.delete(fe.id)},size:"small","aria-label":`More actions for version ${fe.id}`,"aria-haspopup":"menu",disabled:Y===fe.id,onClick:ve=>{ve.stopPropagation(),w({version:fe,anchor:ve.currentTarget})},children:p.jsx(fRe,{fontSize:"small"})})})})]},fe.id)})}),p.jsx(uc,{anchorEl:x?.anchor??null,open:x!==null,onClose:K,slotProps:{list:{"aria-label":x?`Actions for version ${x.version.id}`:void 0,disabledItemsFocusable:!0,autoFocus:ue}},children:x&&Ep(x.version)?[p.jsxs(ea,{onClick:()=>{const{id:fe}=x.version;K(),H.mutate({id:fe,archiveStatus:"unarchive"})},children:[p.jsx(ml,{children:p.jsx(hRe,{fontSize:"small"})}),p.jsx(Ci,{primary:"Unarchive"})]},"unarchive"),p.jsx(wl,{},"divider"),le]:x&&[p.jsxs(ea,{disabled:x.version.latest,onClick:()=>{b(x.version),I.reset(),K(),y(null)},children:[p.jsx(ml,{children:p.jsx(pRe,{fontSize:"small"})}),p.jsx(Ci,{primary:"Pin as latest",secondary:x.version.latest?"Already the latest version":void 0})]},"pin-latest"),p.jsxs(ea,{disabled:oe.archive!==void 0,onClick:()=>{k(x.version),H.reset(),K(),y(null)},children:[p.jsx(ml,{children:p.jsx(dRe,{fontSize:"small"})}),p.jsx(Ci,{primary:"Archive",secondary:oe.archive})]},"archive"),p.jsx(wl,{},"divider"),le]}),p.jsx(Oo,{open:S!==null,onClose:()=>{I.isPending||b(null)},title:S?`Pin v${S.id} as latest`:"",description:S?`Requests that name no version will be served from v${S.id}.`:void 0,initialFocus:A,actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{ref:A,disabled:I.isPending,onClick:()=>b(null),children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:I.isPending,onClick:()=>S&&I.mutate(S.id),children:"Pin as latest"})]}),children:p.jsxs(Yn,{spacing:1.5,children:[R&&S&&R!==S.id&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:`The latest version is v${R} now. Links and requests that name a version keep answering as before.`}),I.isError&&S&&p.jsx(lo,{severity:"error",role:"alert",children:`Couldn't pin v${S.id} as latest: ${gg(I.error)}`})]})}),p.jsx(Oo,{open:$!==null,onClose:()=>{H.isPending||k(null)},title:$?`Archive v${$.id}`:"",description:$?`v${$.id} stops being served and is unloaded. Its files stay, so it can be unarchived.`:void 0,initialFocus:F,actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{ref:F,disabled:H.isPending,onClick:()=>k(null),children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:H.isPending,onClick:()=>$&&H.mutate({id:$.id,archiveStatus:"archive"}),children:"Archive"})]}),children:p.jsxs(Yn,{spacing:1.5,children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:`${zC} Its scheduled builds stop, and once unarchived it serves live until it is built again.`}),H.isError&&$&&p.jsx(lo,{severity:"error",role:"alert",children:`Couldn't archive v${$.id}: ${gg(H.error)}`})]})}),p.jsx(Oo,{open:T!==null,onClose:()=>{ae.isPending||O(null)},title:T?`Delete v${T.version.id}`:"",initialFocus:L,actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{ref:L,disabled:ae.isPending,onClick:()=>O(null),children:"Cancel"}),p.jsx(Vn,{variant:"contained",color:"error",loading:ae.isPending,disabled:G||Q!==void 0,onClick:()=>T?.versions&&ae.mutate({id:T.version.id,read:T.versions}),children:ie?"Delete package":"Delete version"})]}),children:p.jsxs(Yn,{spacing:1.5,children:[G&&T&&p.jsx(wt,{variant:"body2",children:`Checking ${t}'s versions before deleting v${T.version.id}…`}),T&&!G&&p.jsx(wt,{variant:"body2",children:ie?`v${T.version.id} is the only version of ${t}, so deleting it deletes the package. ${zC} This cannot be undone.`:`v${T.version.id} stops being served and its files are removed. ${zC} Links that name it stop working, and this cannot be undone.`}),Q!==void 0&&T&&p.jsx(lo,{severity:"warning",role:"alert",children:`v${T.version.id} can't be deleted now: ${Q}.`}),ae.isError&&T&&p.jsx(lo,{severity:"error",role:"alert",children:`Couldn't delete v${T.version.id}: ${gg(ae.error)}`})]})}),p.jsx(hh,{open:P!==null,autoHideDuration:8e3,onClose:()=>D(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:p.jsx(Te,{children:p.jsx(lo,{severity:"error",variant:"filled",onClose:()=>D(null),children:P})})})]})}const yRe="README.malloynb",vRe=e=>!!e&&!e.includes("/")&&D1(e)?.toLowerCase()==="readme";function KTe({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:l}=tr(),d=Tl(),u=e??(re=>{window.location.href=re}),{environmentName:m,packageName:g,versionId:y}=Xr(n),x=lRe(m,g),{versions:w}=x,S=w.length>0,b=!S&&!x.isPending&&!x.isError,$=o??((re,_e)=>u(`/${encodeURIComponent(m)}/${encodeURIComponent(g)}/${encodeURIComponent(re)}`,_e)),k=t??((re,_e)=>{const Me=re.mode==="edit"?$0e(m,g,re.path):S_(m,g,re.path);_e?u(Me,_e):u(Me)}),[T,O]=C.useState(null),[P,D]=C.useState(!1),A=Cxe(),F=I_()?.documentStorage,[L,_]=C.useState([]),[R,z]=C.useState({state:F?"pending":"ready"}),N=C.useCallback(async()=>{if(!F)return;let re;try{re=await F.listWorkspaces(!1)}catch{z({state:"failed"});return}z({state:"ready",chosen:E_(re)});const _e=[],Me=wy(m,g,"");for(const Ge of re.filter(Je=>Je.writeable))for(const Je of await F.listDocuments(Ge))Je.path.startsWith(Me)&&_e.push({locator:Je,where:Ge.description});_(_e)},[F,m,g]);C.useEffect(()=>{N()},[N]);const B=re=>re.path.slice(wy(m,g,"").length),I=co({queryKey:["package",m,g,y],queryFn:()=>i.packages.getPackage(m,g,y,!1)}),H=co({queryKey:["package-agents",m,g,y],queryFn:()=>i.agents.listAgents(m,g,y)}),Y=C_(m,g,y),ae=co({queryKey:["models",m,g,y],queryFn:()=>i.models.listModels(m,g,y)}),K=co({queryKey:["databases",m,g,y],queryFn:()=>i.databases.listDatabases(m,g,y)}),oe=co({queryKey:["data-apps",m,g,y],queryFn:async()=>{try{return await i.dataApps.listDataApps(m,g,y)}catch(re){const _e=re?.response?.status;if(_e===404||_e===void 0)return{data:[]};throw re}}}).data?.data??[],ue=Y.reports.filter(re=>!!re.path),G=xRe(ue),ie=new Set(ue.map(re=>re.path).filter(re=>re!==void 0)),Q=(ae.data?.data??[]).slice().filter(re=>!ie.has(re.path)).sort((re,_e)=>re.path.localeCompare(_e.path)),ee=(K.data?.data??[]).slice().sort((re,_e)=>re.path.localeCompare(_e.path)),Z=R.state==="ready"?nxe({authoritative:R.chosen?.authoritative===!0,mutable:l&&b,canStore:R.chosen?.writeable===!0,...y===void 0?{}:{versionId:y}}):void 0,de=Y.settled&&(ae.isSuccess||ae.isError),le=Z!==void 0&&de,fe=le&&!A,he=C.useMemo(()=>{if(!le)return;const re=[...Y.reports.flatMap(_e=>_e.path?[_e.path]:[]),...(ae.data?.data??[]).flatMap(_e=>_e.path?[_e.path]:[])];if(Z==="storage"&&F&&R.state==="ready")return R.chosen?{route:Z,storage:F,workspace:R.chosen,environmentName:m,packageName:g,existing:re}:void 0;if(Z==="package")return{route:Z,existing:re,write:async(_e,Me)=>{await i.models.updateModelSource(m,g,_e,{source:Me})}}},[le,Z,F,R,m,g,i,Y.reports,ae.data]),me=I.data?.data?.description??"",se=H.data?.data??[],ve=(ue.find(re=>re.path===yRe)??ue.find(re=>vRe(re.path)))?.path,Le=!Y.settled,Ae=S?p.jsx(gRe,{environmentName:m,packageName:g,versions:w,...y!==void 0?{selectedVersionId:y}:{},onSelectVersion:$,...a?{onReplaceVersion:a}:{},onPackageDeleted:()=>u(`/${encodeURIComponent(m)}`),canManage:l}):null,Re=p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:.5},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:g}),Ae]});if(I.isError){const re=p.jsx(ja,{error:I.error,context:`${m} > ${g}`});return Ae?p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsx(Te,{sx:{mb:4},children:Re}),re]}):re}return p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Te,{sx:{mb:4},children:[Re,me&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:me})]}),p.jsx(F$e,{warnings:I.data?.data?.warnings}),x.isError&&p.jsx(Te,{sx:{mb:4},children:p.jsx(lo,{severity:"warning",action:p.jsx(Vn,{color:"inherit",size:"small",onClick:x.refetch,children:"Retry"}),children:"Could not read this package's versions, so nothing that changes it is offered until they load."})}),Le&&p.jsx(Bo,{text:"Loading package..."}),he&&p.jsx(B$e,{open:P,layout:"linear",environmentName:m,packageName:g,...y!==void 0?{versionId:y}:{},models:Q.map(re=>re.path).filter(re=>typeof re=="string"&&re.endsWith(".malloy")&&!ie.has(re)),modelsLoading:ae.isPending,...ae.isError?{modelsError:ae.error}:{},onRetryModels:()=>void ae.refetch(),target:he,...r?{onEvent:r}:{},onClose:()=>D(!1),onCreated:re=>{D(!1),fxe(d,m,g),d.invalidateQueries({queryKey:["models"]}),k({path:re.path,layout:re.layout,slug:re.slug,mode:"edit"})}}),!Le&&p.jsxs(p.Fragment,{children:[Y.isError&&p.jsx(Te,{sx:{mb:4},children:p.jsx(lo,{severity:"warning",action:p.jsx(Vn,{color:"inherit",size:"small",onClick:()=>void Y.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(G.length>0||le)&&p.jsxs(Ns,{title:"Reports",count:G.length,...fe?{action:p.jsx(Qy,{label:"Report",onClick:()=>D(!0)})}:{},children:[G.length===0&&p.jsx(FC,{label:"No reports yet",...fe?{action:{label:"Add report",onClick:()=>D(!0)}}:{}}),G.map(re=>p.jsx(wp,{type:re.layout==="grid"?"dashboard":"report",label:re.label,rightLabel:re.layout,...re.secondary===void 0?{}:{description:re.secondary},onClick:_e=>re.path.endsWith(".malloynb")?u(`/${m}/${g}/${re.path}`,_e):k({path:re.path,layout:re.layout,slug:re.slug,mode:"view"},_e)},re.path))]}),b&&L.length>0&&p.jsx(Ns,{title:"Drafts",count:L.length,children:L.map(({locator:re,where:_e})=>p.jsx(wp,{type:re.type==="grid"?"dashboard":"report",label:B(re),rightLabel:_e,onClick:Me=>k({path:B(re),layout:re.type,slug:D1(B(re))??"",mode:"edit"},Me),trailingAction:p.jsx(Br,{title:"Delete this draft",children:p.jsx(ro,{size:"small","aria-label":`Delete draft ${B(re)}`,onClick:Me=>{Me.stopPropagation(),F?.deleteDocument(re).then(N)},children:p.jsx(SF,{fontSize:"small"})})})},`${re.workspace}:${re.path}`))}),oe.length>0&&p.jsx(Ns,{title:"Apps",count:oe.length,children:oe.map(re=>{const _e=!!re.title&&re.title!==re.path,Me=`${r6(s)}${re.resource}`;return p.jsx(wp,{type:"dataApp",label:_e?re.title:re.path,rightLabel:_e?re.path:void 0,onClick:Ge=>{e?e(`/${m}/${g}/data-apps/${re.path}`,Ge):Ge&&(Ge.metaKey||Ge.ctrlKey)?window.open(Me,"_blank"):window.location.href=Me},trailingAction:p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(ro,{size:"small",href:Me,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:Ge=>Ge.stopPropagation(),sx:{color:"text.secondary"},children:p.jsx(n6,{fontSize:"small"})})})},re.path)})}),p.jsxs(Ns,{title:"Models",count:Q.length,children:[Q.map(re=>p.jsx(wp,{type:"model",label:re.path,onClick:_e=>u(`/${m}/${g}/${re.path}`,_e)},re.path)),Q.length===0&&p.jsx(FC,{label:"No models"})]}),se.length>0&&p.jsx(Ns,{title:"Agents",count:se.length,description:"Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet.",children:se.map(re=>p.jsx(bRe,{agent:re},re.name))}),p.jsxs(Ns,{title:"Data",count:ee.length,children:[ee.map(re=>p.jsx(wp,{type:"data",label:re.path,rightLabel:re.info?lB(re.info.rowCount):"Unreadable",onClick:()=>O(re)},re.path)),ee.length===0&&p.jsx(FC,{label:"No data files"})]}),p.jsx(kSe,{resourceUri:n,versioned:!b}),ve&&p.jsx(Te,{sx:{mt:6},children:p.jsx(_$e,{resourceUri:I1({environmentName:m,packageName:g,versionId:y}),path:ve,onLinkNavigate:u})})]}),p.jsx(sRe,{database:T,onClose:()=>O(null)})]})}function wp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return p.jsx(L1,{icon:p.jsx(sB,{type:e}),tint:iB[e],label:t,mono:!0,...n===void 0?{}:{description:n},...r===void 0?{}:{rightLabel:r},...o===void 0?{}:{onClick:o},...a===void 0?{}:{trailingAction:a}})}function bRe({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx(wp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=lT(t.cron??"");return p.jsxs(wt,{variant:"caption",color:"text.secondary",sx:{display:"block",ml:6,mb:.5},children:[n.valid?n.description:t.cron," (UTC), task"," ",t.task,". Not run yet."]},`${t.cron}|${t.task}`)})]})}function xRe(e){const t=e.map(r=>({path:r.path??"",layout:Z2(r),slug:D1(r.path)??r.path??"",title:r.title})),n=new Map;for(const r of t)n.set(r.slug,(n.get(r.slug)??0)+1);return t.map(({title:r,...o})=>{const a=!!r&&r!==o.slug&&r!==o.path,i=(n.get(o.slug)??0)>1,s=a?r:o.path.endsWith(".malloynb")?o.path:o.slug;return{...o,label:s,secondary:s!==o.path&&(a||i||o.path.includes("/"))?o.path:void 0}}).sort((r,o)=>r.label.localeCompare(o.label)||r.path.localeCompare(o.path))}function FC({label:e,action:t}){return p.jsxs(Yn,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&p.jsx(Vn,{size:"small",onClick:t.onClick,children:t.label})]})}const iL=/^publisher:document:(dashboard|notebook):(.+)$/;function wRe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&iL.test(o)&&n.push(o)}for(const r of n){const[,o,a]=iL.exec(r),i=e.getItem(r);i!==null&&t(a,L_(o),i)&&e.removeItem(r)}}const _C={name:"Local",description:"Stored in this browser only",writeable:!0},j$="publisher:report:",gd=e=>`${j$}${e}`;function yg(e){const t=localStorage.getItem(e);if(t!==null)try{const n=JSON.parse(t);if(typeof n.content=="string"&&(n.type==="grid"||n.type==="linear"))return{type:n.type,content:n.content}}catch{}}const BC=(e,t)=>localStorage.setItem(gd(e),JSON.stringify(t));class SRe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,wRe(localStorage,(t,n,r)=>yg(gd(t))!==void 0?!1:(BC(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[_C]}async listDocuments(t,n){if(t.name!==_C.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(j$))continue;const i=yg(a);i&&(n===void 0||i.type===n)&&r.push({workspace:_C.name,type:i.type,path:a.slice(j$.length)})}return r}async getDocument(t){this.migrate();const n=yg(gd(t.path));if(n===void 0)throw UC(t);return n.content}async getDocumentType(t){this.migrate();const n=yg(gd(t.path));if(n===void 0)throw UC(t);return n.type}async saveDocument(t,n){this.migrate(),BC(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),yg(gd(t.path))===void 0)throw UC(t);localStorage.removeItem(gd(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);BC(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(gd(t.path))}}function UC(e){return new M_(`No report at ${e.workspace}/${e.path}`)}async function CRe(e,t,n,r){const o=E_(await e.listWorkspaces(!1));if(!o)return;const a=wy(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(O_(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function QTe(e,t,n,r=!0){const o=I_()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),l=wy(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let d=!1;return CRe(o,e,t,n).catch(()=>{}).then(u=>{d||s({key:l,layout:u})}),()=>{d=!0}},[a,o,e,t,n,l]),a?i?.key===l?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function kRe(e){return C.useMemo(()=>{if(!e?.sources?.length)return[];const t=new Map;for(const n of e.sources)if(n.givens?.length)for(const r of n.givens)r.name&&!t.has(r.name)&&t.set(r.name,r);return Array.from(t.values())},[e])}function $Re(e){return e.type==="code"}function RRe(e){return(e.text??"").split(`
506
+ `).trimEnd(),i=_ke.exec(a);if(!(!i||i[1]!==kT(t.name)))return{kind:n,code:[...Hke(e,t.range.start),...o,a].join(`
507
+ `)}}function Hke(e,t){const n=(e[t.line]??"").slice(0,t.character),r=n.trim()==="";if(!r&&!eL.test(n))return[];const o=i=>{const s=[];let l=i;for(;l>=0&&e[l].trim().startsWith("#");)s.unshift(e[l--].trim());return{out:s,next:l}},a=o(t.line-1);return r&&a.next>=0&&eL.test(e[a.next])?[...o(a.next-1).out,...a.out]:a.out}const Vke=/(?<![\w:])([A-Za-z_]\w*)\s*:(?!:)/g;function Wke(e){let t;for(const n of Yke(e).matchAll(Vke))t=n[1];return t}function Yke(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(e.startsWith('"""',n)){const o=e.indexOf('"""',n+3),a=o===-1?e.length:o+3;t+=" ".repeat(a-n),n=a-1}else if(r==='"'||r==="'"||r==="`"){const o=Gke(e,n);t+=" ".repeat(o-n+1),n=o}else if(r==="#"||r==="/"&&e[n+1]==="/"||r==="-"&&e[n+1]==="-"){const o=e.indexOf(`
508
+ `,n),a=o===-1?e.length:o;t+=" ".repeat(a-n),n=a-1}else t+=r}return t}function Gke(e,t){const n=e[t];for(let r=t+1;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===n)return r;return e.length}function Kke(e){return/^`?[A-Za-z_]\w*`?\s+is\s+`?([A-Za-z_]\w*)`?\s*(?:extend\b|$)/.exec(e)?.[1]}function kT(e){return e.replace(/^`(.*)`$/,"$1")}const Qke=["fields","code"],tL={display:"inline-flex",alignItems:"center",color:"text.secondary",borderRadius:1,padding:"2px",flexShrink:0,"&:hover":{color:nx}};function Xke({join:e,run:t,modelPath:n,sourceName:r,link:o,entitiesByName:a,entitiesLoading:i,entitiesError:s,code:l,target:d,showRules:u=!1}){const[m,g]=yT(),{layers:y,layer:x,setLayer:w}=X6(Qke),S=C.useMemo(()=>a?eB({entities:a,loading:!!i,error:!!s}):void 0,[a,i,s]),b=e.dimensions.length+e.measures.length,$=p.jsxs(Te,{sx:{display:"inline-flex",alignItems:"center",gap:1},children:[m&&p.jsx(Z6,{"aria-label":`Show for ${e.name}`,layers:y,value:x,onChange:w,disabledReasons:{code:l?void 0:"No Malloy code to show for this join"}}),o?.kind==="link"&&o.href&&p.jsx(P0,{href:o.href,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:tL,children:p.jsx(QI,{size:14})}),o?.kind==="link"&&!o.href&&o.onOpen&&p.jsx(P0,{component:"button",type:"button",onClick:o.onOpen,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:tL,children:p.jsx(QI,{size:14})}),o?.kind==="join-only"&&p.jsx(Te,{component:"span",sx:{fontSize:Xa.micro,fontStyle:"italic",color:"text.secondary",flexShrink:0},children:"only accessible via join"})]});return p.jsxs(Te,{"data-testid":"model-viewer-join-row","data-name":e.name,sx:m?{pb:1.25}:void 0,children:[p.jsx(CT,{glyph:p.jsx(xT,{kind:"join"}),name:e.name,typeLabel:`${b} ${b===1?"field":"fields"}`,stackPills:!0,descriptors:p.jsxs(fs,{tone:"quiet",voice:"token",sx:{alignSelf:"center",flexShrink:0},children:["join_",e.relationship]}),doc:e.doc,open:m,expandable:!0,onToggle:()=>g(k=>!k),trailing:$,pills:d&&p.jsx(O6,{access:d.access})}),p.jsx(Up,{in:m,timeout:"auto",unmountOnExit:!0,children:p.jsx(Te,{sx:{mx:"10px",mt:"2px"},children:x==="code"&&l?p.jsx(Ey,{testId:"model-viewer-join-code",code:l}):p.jsxs(Te,{"data-testid":"model-viewer-join-fields",sx:{...kh,bgcolor:"transparent",p:1.5,pb:0},children:[d&&u&&p.jsx(ky,{component:"div","data-testid":"model-viewer-join-gate-warning",sx:{mb:1},children:cCe(d.sourceName,d.access)}),p.jsx(Xg,{label:"Measures",noun:["measure","measures"],level:"h3",items:e.measures,run:t,modelPath:n,sourceName:r,getFieldCode:S}),p.jsx(Xg,{label:"Dimensions",noun:["dimension","dimensions"],level:"h3",items:e.dimensions,run:t,modelPath:n,sourceName:r,getFieldCode:S})]})})})]})}function Zke({source:e,modelPath:t,entitiesByName:n,entitiesLoading:r,entitiesError:o,modelText:a,joinLinks:i,joinEntities:s,joinCodes:l,joinAccess:d,showRules:u=!1,columnDescriptions:m,run:g,queries:y,givens:x}){const w={run:g,modelPath:t,sourceName:e.name},{showField:S}=_1(),b=C.useMemo(()=>S?e.views.filter(F=>S({modelPath:t,sourceName:e.name,field:F,joined:!1})):e.views,[S,e,t]),$=rx({noun:["view","views"]}),k=rx({noun:["join","joins"]}),T=C.useMemo(()=>!r&&[...e.views,...e.measures,...e.calculations,...e.dimensions].some(F=>!n?.get(F.name)),[r,n,e]),{parsed:O,pending:P}=H6(a,T),D=C.useMemo(()=>Fke(O,e.name),[O,e.name]),A=C.useMemo(()=>eB({entities:n,loading:!!r,error:!!o,columnDescriptions:m,declarations:D,declarationsLoading:P}),[n,r,o,m,D,P]);return p.jsxs(Te,{sx:{paddingBottom:"24px"},children:[x,p.jsx(sh,{label:"Views",count:b.length,action:$.action,children:p.jsx(Ty.Provider,{value:$.command,children:b.map(F=>p.jsx(J6,{field:F,modelPath:t,sourceName:e.name,fieldCode:A(F),run:g},F.name))})}),y,p.jsx(Xg,{label:"Measures",noun:["measure","measures"],items:e.measures,getFieldCode:A,...w}),p.jsx(Xg,{label:"Calculations",noun:["calculation","calculations"],items:e.calculations,getFieldCode:A,...w}),p.jsx(Xg,{label:"Dimensions",noun:["dimension","dimensions"],items:e.dimensions,getFieldCode:A,...w}),p.jsx(sh,{label:"Joins",count:e.joins.length,action:k.action,children:p.jsx(Ty.Provider,{value:k.command,children:e.joins.map(F=>p.jsx(Xke,{join:F,run:g,modelPath:t,sourceName:e.name,link:i?.get(F.name),entitiesByName:s?.get(F.name),code:l?.get(F.name),target:d?.get(F.name),showRules:u,entitiesLoading:r,entitiesError:o},F.name))})})]})}function P$(e){return{name:e.name,kind:e.kind,dataType:fT(e.type),typeTip:OSe(e.type),tags:PSe(e.annotations),doc:ih(e.annotations),indexed:e.kind==="dimension"?WSe(e):void 0,preaggregate:e.kind==="measure"?MSe(e.annotations):void 0}}function Jke(e){const t=[],n=[];for(const r of e.schema?.fields??[]){if(r.kind!=="dimension"&&r.kind!=="measure")continue;const o={...P$(r),indexed:!1,preaggregate:!1};r.kind==="dimension"?t.push(o):n.push(o)}return{name:e.name,relationship:e.relationship,doc:ih(e.annotations),dimensions:t,measures:n}}function e$e(e,t){const n={name:e.name,doc:ih(e.annotations),docParts:v6(e.annotations),accent:xCe(t),persist:ESe(e.annotations),dimensions:[],measures:[],calculations:[],views:[],joins:[]};for(const r of e.schema?.fields??[])switch(r.kind){case"dimension":case"measure":n[r.kind==="dimension"?"dimensions":"measures"].push(P$(r));break;case"calculate":n.calculations.push(P$(r));break;case"view":n.views.push({name:r.name,kind:"view",doc:ih(r.annotations),tags:dT(r.annotations)});break;case"join":n.joins.push(Jke(r));break}return n}function t$e(e){const t=[];for(const n of e??[]){if(!n.name)continue;const r=(n.annotations??[]).map(o=>({value:o}));t.push({name:n.name,sourceName:n.sourceName||void 0,doc:ih(r),tags:dT(r)})}return t}function tB(e){return e.dimensions.length+e.measures.length+e.calculations.length+e.views.length}function n$e(e,t){if(e.length===0)return null;const n=d=>d.toLowerCase().replace(/[-_]/g,""),r=t?n((t.split("/").pop()??t).replace(/\.malloy$/,"")):void 0,o=new Map(e.map(d=>[d.name,new Set(d.views.map(u=>u.name))])),a=d=>e.some(u=>{if(u.name===d.name||u.views.length===0)return!1;const m=o.get(d.name);return u.views.length<d.views.length&&[...o.get(u.name)].every(g=>m.has(g))}),i=e.filter(d=>!a(d)),s=i.length>0?i:e;let l=s[0];for(const d of s.slice(1)){if(d.views.length!==l.views.length){d.views.length>l.views.length&&(l=d);continue}r&&n(d.name)===r&&n(l.name)!==r&&(l=d)}return l}function r$e(e,t,n){if(!e||!t)return;const r=new RegExp("source:\\s*`?"+of(t)+"`?\\s+is\\s+`?([A-Za-z_]\\w*)`?\\s*(?:->|extend\\b)").exec(e);if(!r)return;const o=r[1];return n.has(o)?o:void 0}function NC(e,t){return`${e} ${e===1?t:`${t}s`}`}function o$e(e){const t=tB(e),n=[NC(e.views.length,"view"),NC(t,"field")];return e.joins.length>0&&n.push(NC(e.joins.length,"join")),n.join(" · ")}function a$e(e,t,n){if(n){const s=n.exportOrder,l=s.length>0&&e.some(d=>s.includes(d.name));return{sources:l$e(e,d=>d.name,s),curated:!0,exportOrdered:l}}const r=e.map((s,l)=>({source:s,index:l})).filter(({source:s})=>s.name!==t?.name).sort((s,l)=>l.source.views.length-s.source.views.length||s.index-l.index).map(({source:s})=>s),o=t?[t,...r]:r,a=t?.views.length??0,i=t&&a>0&&e.every(s=>s.views.length<=a)?t.name:void 0;return{sources:o,curated:!1,exportOrdered:!1,mostViews:i}}function i$e(e){return/^`.*`$/.test(e)?e.slice(1,-1):e}function s$e(e){if(!e)return[];const t=iv(e),n=[];for(const r of t.matchAll(/(?:^|[\s;])export\s*\{([^}]*)\}/gi))for(const o of r[1].split(",")){const a=i$e(o.trim());a&&!n.includes(a)&&n.push(a)}return n}function l$e(e,t,n){if(n.length===0)return[...e];const r=o=>{const a=n.indexOf(t(o));return a===-1?n.length:a};return e.map((o,a)=>({item:o,index:a})).sort((o,a)=>r(o.item)-r(a.item)||o.index-a.index).map(({item:o})=>o)}function c$e(e,t){const n=e?.trim();if(n)return{text:n,generated:!1};const r=t?.trim();return r?{text:r,generated:!0}:void 0}const u$e="This package's curated sources, in the order its index.malloy exports them.",d$e="This package's public sources.";function f$e(e){return e.mostViews?", most views":""}function p$e({anchorEl:e,onClose:t,sources:n,currentName:r,onPickSource:o,curated:a=!1,exportOrdered:i=!1}){return p.jsxs(DR,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{width:460,maxWidth:"calc(100vw - 32px)",maxHeight:"min(70vh, 560px)",display:"flex",flexDirection:"column",borderRadius:"10px"},"data-testid":"model-sources-dropdown"}},children:[p.jsxs(Te,{sx:{px:2,pt:1.5,pb:1,borderBottom:1,borderColor:"divider"},children:[p.jsx(wt,{variant:"subtitle2",component:"h2",sx:{m:0},children:"Sources"}),p.jsx(ky,{component:"p",sx:{m:0},children:a?i?u$e:d$e:kCe})]}),p.jsx(Te,{sx:{overflowY:"auto",py:.5},children:n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"This model defines no sources."}):n.map(s=>{const l=s.name===r;return p.jsxs(is,{"data-item-name":s.name,"aria-label":`Open source ${s.name}${f$e(s)}${dCe(s.access)}`,"aria-current":l||void 0,onClick:()=>{t(),o(s.name)},sx:{display:"flex",width:"100%",alignItems:"flex-start",justifyContent:"flex-start",textAlign:"left",gap:1.25,px:2,py:1,bgcolor:l?xo.background.muted:void 0,"&:hover":{bgcolor:l?xo.background.strong:xo.background.muted},...Ry},children:[p.jsx(Te,{component:"span","aria-hidden":!0,sx:{color:Tp.steel.main,display:"inline-flex",pt:"2px"},children:p.jsx(U6,{size:16})}),p.jsxs(Te,{component:"span",sx:{minWidth:0,flex:1},children:[p.jsxs(Te,{component:"span",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1},children:[p.jsx(Te,{component:"span",sx:{fontFamily:os,fontSize:Xa.body,fontWeight:500,color:"text.primary"},children:s.name}),s.mostViews&&p.jsx(fs,{tone:"quiet",sx:{alignSelf:"center"},children:h$e}),M6(s.access)&&p.jsx(O6,{access:s.access}),s.status]}),(s.description||s.descriptionPending)&&p.jsxs(Te,{component:"span",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",mt:.25,fontSize:Xa.small,color:"text.secondary",minHeight:s.description?void 0:"1.4em"},children:[s.description?.generated&&p.jsx(fs,{tone:"quiet","data-testid":"model-sources-summary-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),s.description&&P6(s.description.text)]}),p.jsx(ky,{"data-testid":"model-sources-row-meta",sx:{display:"block",mt:.25},children:s.meta})]})]},`source:${s.name}`)})})]})}const h$e="Most views";function m$e({sources:e,currentName:t,countLabel:n,onPickSource:r,curated:o=!1,exportOrdered:a=!1,onWarm:i}){const[s,l]=C.useState(null);return p.jsxs(p.Fragment,{children:[p.jsx(Mke,{size:"small",variant:"outlined",onClick:d=>{i?.(),l(d.currentTarget)},endIcon:p.jsx(XCe,{size:20}),"aria-label":`${n}. Showing ${t}, one of the ${n} in this model`,"aria-haspopup":"dialog","aria-expanded":!!s,onPointerEnter:i,onFocus:i,sx:{ml:1,transition:"none"},children:n}),p.jsx(p$e,{anchorEl:s,onClose:()=>l(null),sources:e,currentName:t,onPickSource:r,curated:o,exportOrdered:a})]})}const g$e=[],y$e=[],v$e=[],b$e=new Map;function x$e(e){const t=e.modelDef;if(typeof t!="string")return!1;try{const n=JSON.parse(t);return Array.isArray(n.imports)&&n.imports.length>0}catch{return!1}}function w$e(e,t){if(typeof e=="string")try{const r=FI(JSON.parse(e).annotations);if(r)return r}catch{}if(!t)return;const n=t.split(`
509
+ `).filter(r=>/^##(\(doc\)|")/.test(r.trim())).map(r=>({value:r}));return FI(n)}async function S$e(e,t,n,r,o,a){const i=await e.models.getModel(t,n,r,o,a),s=C$e(i.data);return{sourceInfos:(i.data.sourceInfos??[]).map(l=>JSON.parse(l)),queries:i.data.queries??[],sourceText:s,givens:zSe(r,i.data),access:aCe(i.data),modelDoc:w$e(i.data.modelInfo,s),hasImports:x$e(i.data)}}function C$e(e){const t=e.sourceText;return typeof t=="string"?t:void 0}function k$e(e,t,n,r,o=!1){return["model-viewer-sources",e,t,n,r??"",...o?["off-surface"]:[]]}function $$e(e,t,n,r,o,a=!1){return{queryKey:k$e(t,n,r,o,a),queryFn:()=>S$e(e,t,n,r,o,a),...o&&o!=="latest"?{staleTime:1/0}:{}}}function R$e(e,t,n,r,o=!0,a=!1){const{apiClients:i}=tr(),s=zd({...$$e(i,e,t,n,r,a),enabled:o&&!!(e&&t&&n)});return{sources:s.data?.sourceInfos??g$e,queries:s.data?.queries??y$e,sourceText:s.data?.sourceText,givens:s.data?.givens??v$e,access:s.data?.access??b$e,modelDoc:s.data?.modelDoc,hasImports:s.data?.hasImports??!1,isLoading:s.isLoading,isError:s.isError,error:s.error,refetch:s.refetch}}const T$e=new Map;function nL(e){return(e.split("/").pop()??e).replace(/\.malloy$/,"")}function E$e(e,t){const n=QSe(e,t),r=t.filter(a=>!n.has(a.name)),o="Nothing on this page reads them.";return r.length===0?`Declared here for the models that import this file. ${o}`:r.length===t.length?`Imported from another file, for the models that import this one. ${o}`:`For the models that import this file. ${Qg(r.map(a=>a.name),"and")} ${r.length===1?"comes":"come"} from a file this one imports; the rest are declared here. ${o}`}function M$e({resourceUri:e,sourceName:t,onSourceChange:n,initialSourceName:r,includeHiddenFilesAndSources:o=!1,hostGivenNames:a,givens:i,onGivensChange:s,showAccessRules:l=!1,headingLevel:d="h1",headerActions:u,renderSourceStatus:m,entities:g,entitiesLoading:y=!1,entitiesError:x=!1,columnDescriptions:w,joinHref:S,queryMetadata:b,onQueryRun:$,maxResultSize:k,extensions:T}){const{environmentName:O,packageName:P,modelPath:D="",versionId:A}=Xr(e),F=Vr().theme.ui.font.mono,{sources:L,queries:_,sourceText:R,givens:z,access:N,modelDoc:B,hasImports:I,isLoading:H,isError:Y,error:ae,refetch:K}=R$e(O,P,D,A,!0,o),oe=C.useMemo(()=>new Set(a??[]),[a]),ue=C.useMemo(()=>z.filter(Bt=>!oe.has(Bt.name)),[z,oe]),G=C.useMemo(()=>L.map(e$e),[L]),ie=C.useMemo(()=>t$e(_),[_]),Q=C.useMemo(()=>GSe(G),[G]),ee=C.useMemo(()=>YSe(L),[L]),Z=C.useMemo(()=>FSe(ue),[ue]),de=JSON.stringify(i??null),le=C.useMemo(()=>i&&Object.fromEntries(Object.entries(i).filter(([Bt])=>Z.has(Bt))),[de,Z]),fe=!H&&!Y,he=C.useCallback(Bt=>s?.(Bt,Array.from(Z.keys())),[s,Z]),me=_F({declaredTypes:Z,params:le,onParamsChange:fe&&s?he:void 0,documentKey:`${O}/${P}@${A??""}/${D}`,autorun:!0}),se=C.useMemo(()=>_Se(me.applied,Z),[me.applied,Z]),{givensBySource:ve,unknownGivensBySource:Le}=C.useMemo(()=>{const Bt=new Map,pn=new Map;for(const $n of G){const qt=ZSe(R,$n.name,ue);Bt.set($n.name,qt.givens),qt.unknown.size>0&&pn.set($n.name,qt.unknown)}return{givensBySource:Bt,unknownGivensBySource:pn}},[G,R,ue]),Ae=C.useMemo(()=>({projectName:O,packageName:P,versionId:A,givens:ue,givensBySource:ve,unknownGivensBySource:Le,requiredFiltersBySource:ee,givenValues:se,accessBySource:N,includeHiddenFilesAndSources:o,queryMetadata:b,onQueryRun:$,maxResultSize:k}),[O,P,A,ue,ve,Le,ee,se,N,o,b,$,k]),[Re,re]=C.useState(r),_e=t!==void 0,Me=_e?t:Re,Ge=C.useCallback(Bt=>{_e||re(Bt),n?.(Bt)},[_e,n]),Je=C.useMemo(()=>n$e(G,D),[G,D]),St=G.find(Bt=>Bt.name===Me)??(_e?void 0:Je),Ut=C.useMemo(()=>St?ve.get(St.name)??ue:ue,[St,ve,ue]),at=C.useMemo(()=>St?JSe(R,St.name,ue,Q):new Map,[St,R,ue,Q]),tt=C.useMemo(()=>r$e(R,St?.name,Q),[R,St?.name,Q]),pt=C.useMemo(()=>St?RSe(St,G.find(Bt=>Bt.name===tt)):void 0,[St,G,tt]),ze=C.useMemo(()=>g?KSe(g):T$e,[g]),be=St?ze.get(St.name):void 0,{joinLinks:Ve,joinEntities:Oe,joinCodes:$t,joinAccessRules:Rt}=C.useMemo(()=>{const Bt=new Map,pn=new Map,$n=new Map,qt=new Map,Pn=new Map([[D,new Set(Q)]]);for(const Se of be?.values()??[]){if(Se.fieldType!=="join")continue;Se.code&&$n.set(Se.name,Se.code);const jn=Se.joinTarget;if(jn)if(jn.modelPath===D){const Rn=ze.get(jn.sourceName);Rn&&pn.set(Se.name,Rn);const en=b0(N,jn.sourceName);M6(en)&&qt.set(Se.name,{sourceName:jn.sourceName,access:en});const jt=bCe(jn,Pn);Bt.set(Se.name,jt.kind==="link"?{...jt,onOpen:()=>Ge(jn.sourceName)}:jt)}else{const Rn=S?.(jn);Rn&&Bt.set(Se.name,{kind:"link",href:Rn})}}return{joinLinks:Bt,joinEntities:pn,joinCodes:$n,joinAccessRules:qt}},[be,ze,D,Q,N,Ge,S]),vt=D==="index.malloy"&&!o,it=C.useMemo(()=>a$e(G,Je,vt?{exportOrder:s$e(R)}:void 0),[G,Je,vt,R]),st=T?.describePickerSource,Dt=C.useMemo(()=>it.sources.map(Bt=>{const pn=st?.({modelPath:D,sourceName:Bt.name});return{name:Bt.name,description:c$e(Bt.doc,pn?.summary),descriptionPending:!Bt.doc?.trim()&&!pn?.summary&&!!pn?.summaryPending,meta:o$e(Bt),mostViews:it.mostViews===Bt.name,access:b0(N,Bt.name),status:pn?.status}}),[it,N,st,D]),nn=(()=>{if(H)return p.jsx(Bo,{text:"Fetching Model..."});if(Y)return vCe(ae)?p.jsx(Te,{sx:{pt:M$},children:p.jsx(Kg,{message:K6(ae)??`${P}/${D} doesn't exist, or you don't have access to it.`})}):p.jsx(q1,{message:Q6("Failed to load model",ae),onRetry:()=>void K()});const Bt=ie.length>0&&p.jsx(zke,{queries:ie,sourceText:R,modelPath:D,run:Ae});if(G.length===0)return ie.length===0?p.jsxs(p.Fragment,{children:[p.jsx(OC,{headingLevel:d,title:nL(D),meta:ue.length>0?`${ue.length} ${ue.length===1?"given":"givens"}`:void 0,actions:u,isSource:!1,offSurface:o}),p.jsx(Kg,{message:"This model defines no sources or queries.",secondary:I&&p.jsxs(p.Fragment,{children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})}),p.jsxs(sh,{label:"Givens",count:ue.length,testId:"model-viewer-declared-givens",children:[p.jsx(Wd,{"data-testid":"model-viewer-declared-givens-where",sx:{mb:1},children:E$e(R,ue)}),p.jsx(pT,{givens:ue})]})]}):p.jsxs(p.Fragment,{children:[p.jsx(OC,{headingLevel:d,title:nL(D),meta:`${ie.length} ${ie.length===1?"query":"queries"}`,actions:u,isSource:!1,offSurface:o}),Bt]});if(!St)return p.jsx(Te,{sx:{pt:M$},children:p.jsx(Kg,{message:`This model has no source named ${Me}.`,secondary:p.jsxs(Te,{component:"span","data-testid":"model-viewer-source-links",children:["Sources in this model: ",G.map((Se,jn)=>p.jsxs("span",{children:[jn>0&&", ",p.jsx(P0,{component:"button",type:"button",onClick:()=>Ge(Se.name),sx:{fontFamily:os,verticalAlign:"baseline"},children:Se.name})]},Se.name))]})})});const pn=tB(St),$n=tt?void 0:[...be?.values()??[]].find(Se=>Se.table)?.table,qt=tt?p.jsxs(p.Fragment,{children:["from ",p.jsx(P0,{component:"button",type:"button",onClick:()=>Ge(tt),sx:{fontFamily:os,color:F1,textDecorationColor:"inherit",verticalAlign:"baseline"},children:tt})]}):$n?p.jsxs(p.Fragment,{children:["reads ",p.jsx(Te,{component:"span","data-testid":"model-viewer-source-table",sx:{fontFamily:os},children:[$n.connectionName,$n.catalogName,$n.schemaName,$n.tableName].filter(Boolean).join(".")})]}):void 0,Pn=T?.renderSourceDetail?.({modelPath:D,sourceName:St.name});return p.jsxs(p.Fragment,{children:[p.jsx(OC,{headingLevel:d,title:St.name,titleAdornments:G.length>1&&p.jsx(m$e,{sources:Dt,currentName:St.name,countLabel:$Ce(Dt.length,it.curated),onPickSource:Ge,curated:it.curated,exportOrdered:it.exportOrdered}),actions:u,status:m?.(St.name),kindLabel:"Source",meta:`${pn} ${pn===1?"field":"fields"}`,doc:pt,modelDoc:B,access:b0(N,St.name),showRules:l,offSurface:o,publicSurface:vt,provenance:qt}),Pn&&p.jsx(Te,{"data-testid":"model-viewer-source-detail",sx:{mt:1.5},children:Pn}),p.jsx(gT.Provider,{value:ue,children:p.jsx(Zke,{source:St,modelPath:D,entitiesByName:be,entitiesLoading:y,entitiesError:x,columnDescriptions:w?.get(St.name),modelText:R,joinLinks:Ve,joinAccess:Rt,showRules:l,joinEntities:Oe,joinCodes:$t,run:Ae,queries:Bt,givens:p.jsx(CCe,{givens:Ut,unknown:St?Le.get(St.name):void 0,inheritedFrom:at,values:me.draft,onChange:me.setGiven,onReset:me.reset,environmentName:O,packageName:P,modelPath:D,versionId:A,declaredTypes:Z})},St.name)})]})})();return p.jsx(C6.Provider,{value:T??{},children:p.jsx(Te,{"data-testid":"model-viewer",sx:{...DSe,pb:2,[x6]:F},children:p.jsx(Te,{sx:NSe,children:nn})})})}const O$e=Jt(p.jsx("path",{d:"M8 5v14l11-7z"}));function nB({open:e,onClose:t,result:n,title:r="Results",renderLogs:o,drill:a}){return p.jsx(Oo,{open:e,onClose:t,title:r,maxWidth:!1,showClose:!0,children:p.jsx(Te,{sx:{height:"70vh",overflow:"auto"},children:p.jsx(A1,{result:n,maxHeight:Ile,maxResultSize:1e6,renderLogs:o,drill:a})})})}function P$e({queryName:e,annotations:t,resourceUri:n,runOnDemand:r=!1,maxResultSize:o=0}){const[a,i]=kn.useState(),[s,l]=kn.useState(!1),[d,u]=kn.useState(!1),{packageName:m,environmentName:g,versionId:y,modelPath:x}=Xr(n),w=!r||d,S=rT({environmentName:g,packageName:m,modelPath:x,versionId:y,queryName:e},{enabled:w}),b=S.data,{mode:$}=Vr();return C.useEffect(()=>{if(t&&t.length>0){const k=t.map(T=>`// ${T}`).join(`
510
+ `);ST(k,"typescript",$).then(T=>{i(T)})}},[t,$]),p.jsxs(Te,{children:[a&&p.jsx(Te,{sx:{marginBottom:"16px"},children:p.jsx(wt,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:p.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),p.jsxs(Te,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[p.jsx(wt,{variant:"body2",sx:{fontSize:"15px",fontWeight:600,color:"text.primary",px:2,py:1,bgcolor:"action.hover",borderRadius:1.5,border:1,borderColor:"divider"},children:e}),p.jsx(zp,{"aria-label":"Expand results",onClick:()=>l(!0),children:p.jsx(Kp,{})})]}),p.jsxs(x4,{sx:{position:"relative"},children:[r&&!d&&p.jsxs(Te,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),p.jsx(Vn,{variant:"contained",startIcon:p.jsx(O$e,{}),onClick:()=>u(!0),children:"Run Query"})]}),w&&p.jsx(X2,{state:S,context:e,maxHeight:Nle,maxResultSize:o})]}),p.jsx(nB,{open:s,onClose:()=>l(!1),result:b?.data?.result||"",renderLogs:b?.data?.renderLogs,title:`Query: ${e}`})]})}function j$e(e){return e!=null}function A$e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||j$e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=P1(a.type??"string",a.default);i&&r.push(`${a.name} = ${i}`)}const o={missing:n};return r.length>0&&(o.defaultsNote=r.length===1?`Ran with the default ${r[0]}`:`Ran with defaults ${r.join(", ")}`),o}function D$e(e){return e.length===1?`This source may need a value for the given ${e[0]}. Set it in the parameters above.`:`This source may need values for the givens ${e.join(", ")}. Set them in the parameters above.`}function N$e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return kn.useEffect(()=>{o&&o(t)},[t,o]),p.jsx(b4,{children:p.jsxs(C9,{spacing:2,component:"section",children:[p.jsx(L$e,{sourceAndPath:e[t],existingQuery:n,onChange:l=>{r&&r(l)},resourceUri:a,givens:i,gate:s}),p.jsx(g5,{height:"5px"})]})})}function IC(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function I$e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[l,d]=kn.useState(n||IC()),[u,m]=kn.useState(void 0);kn.useEffect(()=>{n&&d(n)},[n]);const[g,y]=kn.useState([]),{MalloyExplorerProvider:x,QueryPanel:w,ResizableCollapsiblePanel:S,ResultPanel:b,SourcePanel:$}=r;kn.useEffect(()=>{t&&t(l)},[t,l]);const{environmentName:k,packageName:T,versionId:O}=Xr(a),{apiClients:P}=tr(),D=kn.useRef(void 0),A=hl({mutationFn:()=>{D.current=s,m({executionState:"running",query:l?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{A.reset(),m(void 0)},response:{}});const R=typeof l?.malloyQuery=="string"?l.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:l?.malloyQuery}).toMalloy();return d({...l,query:R}),P.models.executeQueryModel(k,T,e.modelPath,{query:R,sourceName:void 0,queryName:void 0,versionId:O,...i&&Object.keys(i).length>0?{givens:i}:{}})},onSuccess:R=>{if(R){const z=JSON.parse(R.data.result);d({...l,malloyResult:z});const N=D.current;m(B=>B?{...B,executionState:"finished",response:{result:z,...N?.defaultsNote?{messages:[{severity:"INFO",title:N.defaultsNote}]}:{}}}:void 0)}},onError:R=>{console.error("Query execution error:",R);const z=R?.data?.message??R?.message??"The query could not be run.",N=[{severity:"ERROR",title:z}],B=D.current?.missing??[];(R?.status===403||/Access denied for source/i.test(z))&&B.length>0&&N.push({severity:"WARN",title:D$e(B)}),m(I=>I?{...I,executionState:"finished",response:{messages:N}}:void 0)}}),[F,L]=kn.useState(e.sourceInfo.name);kn.useEffect(()=>{F!==e.sourceInfo.name&&(L(e.sourceInfo.name),d(IC()),m(void 0))},[e,F]);const _=kn.useCallback(R=>{d({...l,malloyQuery:R,malloyResult:void 0})},[l]);return F!==e.sourceInfo.name?p.jsx("div",{children:"Loading..."}):p.jsx(w4,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:p.jsx(x,{source:e.sourceInfo,query:l?.malloyQuery,topValues:[],onFocusedNestViewPathChange:y,focusedNestViewPath:g,onQueryChange:_,children:p.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[p.jsx(S,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:p.jsx($,{onRefresh:()=>d(IC())})}),p.jsx(S,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:p.jsx(w,{runQuery:()=>{console.log(`running query with: ${l?.malloyQuery}`);try{A.mutate()}catch(R){console.error("Error running query:",R)}}})}),p.jsx(b,{source:e.sourceInfo,draftQuery:l?.malloyQuery,setDraftQuery:R=>d({...l,malloyQuery:R}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function L$e(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let s=!0;return Promise.all([wo(()=>import("./index-jw6yCO3t.js"),__vite__mapDeps([5,0,1,2,6])),H0e()]).then(([l,d])=>{s&&(n(l),o(d),i(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?p.jsx(Wne,{children:p.jsx(w4,{children:p.jsx(g5,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):p.jsx(I$e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function rB(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=Xr(e),{apiClients:i}=tr();return co({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function oB({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:l}){const[d,u]=kn.useState(r);kn.useEffect(()=>{u(r)},[r]);const{data:m,isError:g,isLoading:y,error:x}=rB(a,!e),{environmentName:w,packageName:S,modelPath:b,versionId:$}=Xr(a),k=e||m,T=kn.useMemo(()=>k?.givens??[],[k]),O=b2({specs:T,loaded:!!k,params:i,onGivensChange:s,startingValues:l,documentKey:a,autorun:!0,environmentName:w??"",packageName:S??"",modelPath:b,versionId:$,documentName:b}),P=C.useMemo(()=>Jd(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),D=C.useMemo(()=>A$e(T,O.applied),[T,O.applied]);if(y&&!e)return p.jsx(Bo,{text:"Fetching Model..."});if(g&&!e)return console.log("error",x),p.jsx(ja,{error:x,context:`ModelExplorer > ${b}`});if(!k)return p.jsx(Bo,{text:wu.loading});const A=(k?.sourceInfos||[]).map((L,_)=>{try{return JSON.parse(L)?.name||`Source ${_+1}`}catch{return`Source ${_+1}`}}),F=A[d]||"";return p.jsxs(Hne,{variant:"outlined",children:[p.jsx(Vne,{children:p.jsx(Yn,{sx:{flexDirection:"row"},children:p.jsx(gwe,{size:"small",id:"size-small-standard",disablePortal:!0,options:A,value:F,onChange:(L,_)=>{if(!_)return;const R=A.indexOf(_);R>=0&&(u(R),o?.(R))},renderInput:L=>p.jsx(yr,{...L}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),p.jsx(j1,{...O.panel}),p.jsx(b4,{children:p.jsxs(Yn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&p.jsx(N$e,{sourceAndPaths:k.sourceInfos.map(L=>({sourceInfo:JSON.parse(L),modelPath:b})),selectedSourceIndex:d,existingQuery:n,onQueryChange:t,resourceUri:a,givens:P,gate:D}),p.jsx(Te,{height:"5px"})]})})]})}function aB({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}){return p.jsxs(zx,{open:e,onClose:t,fullScreen:!0,children:[p.jsxs(_x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,p.jsx(ro,{onClick:t,sx:{color:"text.secondary"},children:p.jsx(xh,{})})]}),p.jsx(Fx,{children:a?p.jsx(oB,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}):p.jsx("div",{children:"No valid import statement found in cell"})})]})}function z$e({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=Xr(t),{data:s,isError:l,isLoading:d,error:u}=rB(t),[m,g]=kn.useState(!1),[y,x]=kn.useState(),[w,S]=kn.useState(0),[b,$]=C.useState(""),[k,T]=kn.useState({}),O=o??k,P=a??(R=>T(R)),D=s?.modelDef,A=kn.useMemo(()=>{if(!D)return!1;try{const R=JSON.parse(D);return Array.isArray(R.imports)&&R.imports.length>0}catch{return!1}},[D]);if(d)return p.jsx(Bo,{text:"Fetching Model..."});if(l)return console.log("error",u),p.jsx(ja,{error:u,context:`Model > ${i}`});const F=R=>{x(R),e&&e(R)},L=R=>{S(R)},_=()=>{const R=window.location.href;navigator.clipboard.writeText(R).then(()=>$("URL copied to clipboard!")).catch(()=>$("Failed to copy URL"))};return p.jsxs(p.Fragment,{children:[p.jsxs(Te,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&p.jsxs(Yn,{spacing:2,component:"section",children:[p.jsxs(Te,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsx(wt,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),p.jsx(Br,{title:"Copy link",children:p.jsx(ro,{size:"small","aria-label":"Copy link",onClick:_,sx:{color:"text.secondary"},children:p.jsx(uT,{fontSize:"small"})})})]}),p.jsx(oB,{data:s,onChange:F,onSourceChange:L,existingQuery:y,initialSelectedSourceIndex:w,resourceUri:t,givens:O,onGivensChange:P}),p.jsx(zp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:p.jsx(Kp,{})})]}),s?.queries?.length>0&&p.jsxs(Yn,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[p.jsx(Te,{sx:{padding:"0 0 16px 0"},children:p.jsx(wt,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(R=>p.jsx(P$e,{queryName:R.name,annotations:R.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},R.name))]}),(!Array.isArray(s?.sourceInfos)||s.sourceInfos.length===0)&&!(s?.queries&&s.queries.length>0)&&p.jsxs(Te,{sx:{textAlign:"center",py:6},children:[p.jsx(wt,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),A&&p.jsxs(wt,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),p.jsx(aB,{open:m,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:y,initialSelectedSourceIndex:w,onChange:F,onSourceChange:L,givens:O,onGivensChange:P})]}),p.jsx(hh,{open:b!=="",autoHideDuration:6e3,onClose:()=>$(""),message:b})]})}function F$e(){const[e,t]=C.useState("");return p.jsxs(p.Fragment,{children:[p.jsx(Br,{title:"Copy link",children:p.jsx(ro,{size:"small","aria-label":"Copy link",onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>t("URL copied to clipboard!")).catch(()=>t("Failed to copy URL"))},sx:{color:"text.secondary"},children:p.jsx(uT,{fontSize:"small"})})}),p.jsx(hh,{open:e!=="",autoHideDuration:6e3,onClose:()=>t(""),message:e})]})}function QTe(e){const{modelPage:t,isLoadingStatus:n}=tr();if(n)return p.jsx(Bo,{text:"Fetching Model..."});if(t!=="viewer")return p.jsx(z$e,{...e});const{onChange:r,runOnDemand:o,headerActions:a,...i}=e;return p.jsx(M$e,{...i,headerActions:a??p.jsx(F$e,{})})}function _$e({warnings:e}){const[t,n]=C.useState(!1),r=(e??[]).filter(a=>a.severity==="error"),o=(e??[]).filter(a=>a.severity!=="error");return r.length===0&&o.length===0?null:p.jsxs(Yn,{sx:{gap:1,mb:4},children:[r.length>0&&p.jsxs(lo,{severity:"warning",children:[p.jsx(vY,{children:r.length===1?"1 problem in this package":`${r.length} problems in this package`}),p.jsx(rL,{findings:r})]}),o.length>0&&p.jsxs(Te,{children:[p.jsxs(Vn,{size:"small","aria-expanded":t,onClick:()=>n(a=>!a),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",o.length," ",o.length===1?"note":"notes"]}),t&&p.jsx(Te,{sx:{pl:.5,pt:.5},children:p.jsx(rL,{findings:o})})]})]})}function rL({findings:e}){return p.jsx(Yn,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>p.jsxs(wt,{component:"li",variant:"body2",children:[t.model&&p.jsx(Te,{component:"span",sx:{fontFamily:Fo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function B$e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:l,chrome:d,manifestStaleTime:u,actions:m,rowsActions:g}){const y=Xr(e),{apiClients:x}=tr(),w=y.environmentName??"",S=y.packageName??"",b=y.versionId,$=!!y.environmentName&&!!y.packageName,{data:k,isSuccess:T,isError:O,error:P}=co({...dxe(x,{environmentName:w,packageName:S,path:t,versionId:b},u),enabled:$&&t!==""}),D=k?.layout,A=ace({path:t,layout:D},l),F=`${e}|${t}`,L=C.useRef(void 0),_=C.useRef({key:F,at:Pd()});_.current.key!==F&&(_.current={key:F,at:Pd()}),C.useEffect(()=>{L.current!==F&&($?O?(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:U0(P)})):k?.notebook?.format==="malloynb"?(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:"unsupported"})):T&&k&&(L.current=F,A.emit({type:"report.opened",surface:"view",from:"package",tiles:k.tiles?.length??0,durationMs:Pd()-_.current.at})):(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[F,$,O,P,T,k,A]);const R=C.useCallback((B,I)=>{const H=o?.(B,I);H&&A.emit({type:"report.drill",to:"report",outcome:H})},[o,A]),z=o?R:void 0;if(!$)return p.jsxs(lo,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(O)return p.jsx(ja,{context:`${w} > ${S} > ${t}`,error:P});if(!T||!k)return p.jsx(Bo,{text:wu.opening("report")});if(k.notebook?.format==="malloynb")return p.jsxs(lo,{severity:"info",children:[t," is a .malloynb notebook, which Report does not run: render it with Notebook."]});const N=p.jsx(t6,{manifest:k,environmentName:w,packageName:S,versionId:b,documentName:t,givens:n,onGivensChange:r,onNavigate:z,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:d,...m!==void 0?{actions:m}:{},...g!==void 0?{rowsActions:g}:{}});return p.jsx($F.Provider,{value:A,children:N})}function U$e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:l,modelsLoading:d=!1,modelsError:u,onRetryModels:m,target:g,savedAs:y,onClose:x,onCreated:w,onEvent:S}){const b=t??(n?L_(n):"linear"),$=r??o??!0,[k,T]=C.useState(b),[O,P]=C.useState(void 0),[D,A]=C.useState(""),[F,L]=C.useState(""),[_,R]=C.useState(""),z=C.useRef(null),[N,B]=C.useState(""),[I,H]=C.useState(!1),[Y,ae]=C.useState(!1),[K,oe]=C.useState(!1),[ue,G]=C.useState(void 0),ie=u!=null,{choices:Q,isLoading:ee,isSuccess:Z,failed:de,retry:le,canRetry:fe}=cxe({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:l,enabled:e&&l.length>0}),he=C.useMemo(()=>Q.get(D)??[],[Q,D]),me=C.useMemo(()=>new Map([...Q.entries()].flatMap(([st,Dt])=>Dt.map(nn=>[LC(st,nn.source,nn.view),{model:st,source:nn.source,view:nn.view}]))),[Q]),se=C.useMemo(()=>{const st=Q.size>1;return[...Q.entries()].flatMap(([Dt,nn])=>{const Bt=new Map;for(const pn of nn)Bt.set(pn.source,[...Bt.get(pn.source)??[],pn]);return[...Bt.entries()].map(([pn,$n])=>({key:`${Dt}::${pn}`,label:pn,ariaLabel:`${pn} in ${Dt}`,...st||$n[0]?.sourceDescription?{detail:[st?Dt:void 0,$n[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:$n.map(qt=>({key:LC(Dt,qt.source,qt.view),name:qt.view,title:qt.description??vC(qt.view),...qt.chart?{chart:qt.chart}:{}}))}))})},[Q]),ve=st=>{const Dt=me.get(st);Dt&&(A(Dt.model),L(`${Dt.source}::${Dt.view}`))},Le=he.find(st=>`${st.source}::${st.view}`===F),Ae=Le?LC(D,Le.source,Le.view):void 0,Re=q$e(Le,250);C.useEffect(()=>{e&&T(b)},[e,b]),C.useEffect(()=>{if(!e)return;const st=[...Q.keys()];D===""&&st.length>0&&A(st[0])},[e,Q,D]),C.useEffect(()=>{!e||he.length===0||F!==""||L(`${he[0].source}::${he[0].view}`)},[e,he,F]),C.useEffect(()=>{!e||I||Le===void 0||B(vC(Le.view))},[e,I,Le]),C.useEffect(()=>{e||(A(""),L(""),R(""),B(""),H(!1),P(void 0),ae(!1),G(void 0))},[e]);const re=C.useMemo(()=>{if(N.trim()!=="")for(let st=1;st<=nT;st++){const Dt=A_(N,st);if(!g.existing?.includes(Dt))return Dt}},[N,g]),_e=O?.trim(),Me=_e===void 0||_e===""?void 0:_e.endsWith(".malloy")?_e:`${_e}.malloy`,Ge=Me??re,Je=Me===void 0?void 0:D_(Me)??(g.existing?.includes(Me)?`${Me} already exists; choose another location.`:void 0),St=(Le===void 0?void 0:eT({title:N,modelPath:D,source:Le.source,view:Le.view}))??(N.trim()!==""&&Ge===void 0?"No free file name for this title; choose another.":void 0),Ut=St!==void 0&&(Y||N.trim()!==""),at=d||ee,{theme:tt}=Vr(),pt=tt.ui,ze=Zd(tt.cardBorder),be=Q.size===0&&(ie||de.length>0),Ve=at?"Loading the model":be?"Couldn't read the model to start from":Q.size===0?"Nothing in the model to start from yet":Le===void 0?"Pick what to start from":void 0,Oe="report",$t=K?`Creating ${Oe}…`:`Create ${Oe}`,Rt=F!==""&&Le===void 0&&he.length>0,vt=async()=>{if(!(Ve!==void 0||Le===void 0||K)){if(St!==void 0||Je!==void 0){ae(!0);return}oe(!0),G(void 0);try{const st=await rxe({layout:k,...Me!==void 0?{path:Me}:{},document:{title:N,modelPath:D,source:Le.source,view:Le.view},target:g,...S?{onEvent:S}:{}});w(st)}catch(st){const Dt=st.response?.data?.message;G(Dt??(st instanceof Error?st.message:String(st)))}finally{oe(!1)}}},it=st=>p.jsx(Vn,{color:"inherit",size:"small",onClick:st,children:"Retry"});return p.jsx(Oo,{className:`${Sl.dialog} ${Sl.newReportDialog}`,maxWidth:"md",initialFocus:z,open:e,onClose:K?()=>{}:x,title:`New ${Oe}`,description:"A report is a Malloy file in the package that lays out text and queries. Pick what its first query shows; the rest is the builder.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{onClick:x,disabled:K,children:"Cancel"}),p.jsx(Br,{title:K?"":Ve??"",children:p.jsx("span",{children:p.jsx(Vn,{variant:"contained",disabled:K||Ve!==void 0,"aria-label":!K&&Ve!==void 0?`${$t}: ${Ve}`:$t,onClick:()=>void vt(),children:$t})})})]}),children:p.jsxs(Yn,{sx:{gap:1.5},children:[ie?p.jsx(lo,{severity:"error",action:m&&L4(u)?it(m):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):l.length===0?!d&&p.jsxs(lo,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",Oe," from it."]}):de.length>0?p.jsxs(lo,{severity:"warning",action:fe?it(le):void 0,children:["Couldn't read ",de.join(", "),", so nothing from"," ",de.length===1?"it":"them"," is listed."]}):Z&&Q.size===0&&p.jsxs(lo,{severity:"info",children:["A ",Oe," starts from a view of a source, and no model in this package declares one yet. Add a view to a source in a model file and this list fills in."]}),p.jsxs(Te,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${ze}`,borderBottom:`1px solid ${ze}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[p.jsx(Te,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${ze}`},maxHeight:{xs:280,md:"none"}},children:p.jsx(Ele,{groups:se,query:_,onQuery:R,picked:Ae,onPick:ve,onTake:st=>{ve(st)},searchRef:z,disabled:K,empty:p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",p:2},children:at?"Reading the package's models…":"Nothing to start from."})})}),p.jsxs(Te,{sx:st=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${st.palette.text.primary} 3%, ${st.palette.background.paper})`}),children:[$&&p.jsxs(Te,{children:[p.jsx(oL,{children:"Layout"}),p.jsx(Te,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(st=>p.jsx(W$e,{layout:st,checked:k===st,disabled:K,onPick:()=>T(st)},st))}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),p.jsxs(Te,{children:[p.jsx(oL,{children:"First query"}),p.jsx(Te,{role:"region","aria-label":"Preview",sx:st=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:pt.radius.tile,border:`1px solid ${ze}`,bgcolor:st.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${st.palette.background.paper})`}}),children:Le&&Re?p.jsx(Te,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:p.jsx(B_,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:D,tile:`${Re.source} -> ${Re.view}`,label:N.trim()||vC(Re.view),borderless:!0,givens:H$e,declaredTypes:V$e,height:180})}):p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:Rt?"What you picked is no longer in this model; pick something else.":"Pick what to start from."})}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),p.jsx(Ri,{size:"small",label:"Title",value:N,disabled:K,onChange:st=>{H(!0),B(st.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Ut,helperText:Ut?St:g.route==="package"?"Names the file too, unless you type a location.":y??`Saved as a new ${Oe} in the host's store, and opened in the builder.`}),p.jsx(Ri,{size:"small",label:"Location",value:O??re??"",placeholder:"report.malloy",disabled:K,onChange:st=>P(st.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:Je!==void 0,helperText:Je??(Ge?`Written as ${Ge} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),ue&&p.jsx(lo,{severity:"error",children:ue})]})]})]})})}function q$e(e,t){const[n,r]=C.useState(void 0);return C.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}const LC=(e,t,n)=>`${e}::${t}::${n}`,H$e=new Map,V$e=new Map;function oL({children:e}){const t=Vr().theme.ui;return p.jsx(wt,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function W$e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=Vr(),a=o.ui,i=Zd(o.cardBorder),s=t?o.accent:"currentColor";return p.jsxs(is,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:l=>({justifyContent:"flex-start",gap:1.25,px:1.25,py:1,borderRadius:a.radius.tile,border:`1px solid ${t?o.accent:i}`,boxShadow:t?`0 0 0 1px ${o.accent}`:"none",bgcolor:t?`color-mix(in srgb, ${o.accent} 6%, ${l.palette.background.paper})`:l.palette.background.paper,color:l.palette.text.secondary,textAlign:"left"}),children:[p.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),p.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),p.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),p.jsxs(Te,{children:[p.jsx(Te,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),p.jsx(Te,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const Y$e=Jt(p.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),G$e=Jt(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),K$e=Jt(p.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),Q$e=Jt(p.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),iB={dashboard:hr.blue,report:hr.violet,model:hr.cyan,dataApp:hr.pink,data:hr.lime,materialization:hr.amber,agent:hr.red};function sB({type:e,size:t=18,sx:n,...r}){return p.jsx(B0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:X$e[e]()})}const X$e={report:Z$e,model:J$e,data:eRe,materialization:tRe,dataApp:oRe,dashboard:nRe,agent:rRe};function Z$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),p.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),p.jsx("path",{d:"M8 17 v-3"}),p.jsx("path",{d:"M12 17 v-6"}),p.jsx("path",{d:"M16 17 v-4"})]})}function J$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),p.jsx("path",{d:"M4 7 l8 4 l8 -4"}),p.jsx("path",{d:"M12 11 v10"})]})}function eRe(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function tRe(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),p.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),p.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function nRe(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M12 9.5 V20.5"}),p.jsx("path",{d:"M12 15 H20.5"})]})}function rRe(){return p.jsxs(p.Fragment,{children:[p.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),p.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function oRe(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M7 13.5 H17"}),p.jsx("path",{d:"M7 16.5 H13"})]})}function lB(e){return e>=1e9?`${(e/1e9).toFixed(1)} B rows`:e>=1e6?`${(e/1e6).toFixed(1)} M rows`:e>=1e3?`${(e/1e3).toFixed(1)} K rows`:`${e} rows`}const aRe=12;function iRe(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return G$e;if(t.startsWith("record")||t.startsWith("struct"))return K$e;switch(t.split(/[\s(<]/)[0]){case"string":return Y$e;case"number":return Q$e;case"date":return N6;case"timestamp":case"timestamptz":return L6;case"boolean":return z6;default:return F6}}function sRe({column:e}){const t=iRe(e.type);return p.jsxs(Te,{component:"li",sx:n=>({display:"flex",alignItems:"center",gap:1.25,px:1,py:.625,borderRadius:1,transition:"background-color 0.1s","&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":n.palette.grey[100]}}),children:[p.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),p.jsxs(Te,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[p.jsx(wt,{component:"span",sx:{fontFamily:Fo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function lRe({database:e,onClose:t}){const n=e!==null,[r,o]=C.useState(e);e!==null&&e!==r&&o(e);const[a,i]=C.useState(""),[s,l]=C.useState(r?.path);s!==r?.path&&(l(r?.path),i(""));const d=C.useId(),u=r?.path??"",m=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-m.length-1)),y=r?.info?.rowCount,x=[g,y===void 0?null:lB(y)].filter(Boolean).join(" · "),w=C.useMemo(()=>r?.info?.columns??[],[r]),S=a.trim().toLowerCase(),b=C.useMemo(()=>S?w.filter($=>$.name?.toLowerCase().includes(S)||$.type?.toLowerCase().includes(S)):w,[w,S]);return p.jsxs(Oo,{open:n,onClose:t,showClose:!0,title:p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[p.jsx(Te,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:iB.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:p.jsx(sB,{type:"data",size:18})}),p.jsxs(Te,{sx:{minWidth:0},children:[p.jsx(wt,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:Fo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:m||"Columns"}),x&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:x})]})]}),children:[r?.error&&p.jsx(lo,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&p.jsxs(Te,{component:"section","aria-labelledby":d,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[p.jsxs(wt,{id:d,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",p.jsxs(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",S?`${b.length} of `:"",w.length]})]}),w.length>aRe&&p.jsx(Lx,{value:a,onChange:$=>i($.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:p.jsx(PR,{position:"start",children:p.jsx(Kp,{sx:{fontSize:16,color:"text.secondary"}})}),sx:{ml:"auto !important",width:200,fontSize:"0.8125rem",px:1,py:.25,border:"1px solid",borderColor:"divider",borderRadius:1.5,"&.Mui-focused":{borderColor:"primary.main"}}})]}),p.jsx(Te,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:b.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:S?"No columns match":"No columns"}):p.jsx(Te,{component:"ul","aria-labelledby":d,sx:{listStyle:"none",m:0,p:0},children:b.map(($,k)=>p.jsx(sRe,{column:$},`${$.name}-${k}`))})})]})]})}const cB=(e,t,n)=>["packageVersions",e,t,n];async function uB(e,t,n){try{return(await e.versions.listPackageVersions(t,n)).data}catch(r){const o=r?.response?.status;if(o===404||o===501)return[];throw r}}function cRe(e,t,n={}){const{apiClients:r,server:o}=tr(),a=(n.enabled??!0)&&e!==""&&t!=="",i=zd({queryKey:cB(e,t,o),queryFn:()=>uB(r,e,t),enabled:a,staleTime:3e4,retry:!1}),{refetch:s}=i,l=C.useCallback(()=>void s(),[s]),d=i.data??[];return{versions:d,latest:d.find(u=>u.latest)?.id,isPending:a&&i.isPending,isError:a&&i.isError,refetch:l}}function uRe(e,t){const{apiClients:n,server:r}=tr(),o=Tl();return C.useCallback(()=>o.fetchQuery({queryKey:cB(e,t,r),queryFn:()=>uB(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function dRe(e,t){const n=Tl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const fRe=Jt(p.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.81.97H5.44zM5 19V8h14v11zm8.45-9h-2.9v3H8l4 4 4-4h-2.55z"})),pRe=Jt(p.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),hRe=Jt(p.jsx("path",{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1"})),mRe=Jt(p.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.83 1H5.42zM5 19V8h14v11zm3-5h2.55v3h2.9v-3H16l-4-4z"})),gg=e=>{const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error?e.message:"Unknown error"},gRe=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Ep=e=>e.archiveStatus==="archive",zC="Tables built for this version alone (under scope: version) are dropped.";function aL(e,t){const n=!Ep(e)&&t.filter(o=>!Ep(o)).length<=1,r=t.length<=1;return{archive:e.latest?"The latest version can't be archived":n?"The last version in service can't be archived":void 0,delete:r?void 0:e.latest?"Pin another version as latest first":n?"The last version in service; delete the archived versions first":void 0}}function yRe({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:l}=tr(),d=Tl(),u=dRe(e,t),m=uRe(e,t),[g,y]=C.useState(null),[x,w]=C.useState(null),[S,b]=C.useState(null),[$,k]=C.useState(null),[T,O]=C.useState(null),[P,D]=C.useState(null),A=C.useRef(null),F=C.useRef(null),L=C.useRef(null),_=C.useRef(new Map),R=n.find(fe=>fe.latest)?.id,z=r??R,N=()=>Promise.all([u(),d.invalidateQueries({queryKey:["packages",e]})]),B=async(fe,he)=>{const me=he??await m().catch(()=>{});if(me===void 0)return;const se=me.find(Le=>Le.latest)?.id,ve=se??me.find(Le=>Le.id!==fe&&!Ep(Le))?.id;ve!==void 0&&(a?a(ve===se?void 0:ve):o(ve))},I=a0({mutationFn:fe=>l.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{b(null),await N()},onError:()=>void N()}),H=a0({mutationFn:({id:fe,archiveStatus:he})=>l.versions.updatePackageVersion(e,t,fe,{archiveStatus:he}),onSuccess:async(fe,{id:he,archiveStatus:me})=>{k(null),me==="archive"&&he===z&&await B(he),await N()},onError:(fe,{id:he,archiveStatus:me})=>{me==="unarchive"&&D(`Couldn't unarchive v${he}: ${gg(fe)}`),N()}}),Y=H.isPending?H.variables?.id:void 0,ae=a0({mutationFn:({id:fe})=>l.versions.deletePackageVersion(e,t,fe),onSuccess:async(fe,{id:he,read:me})=>{O(null);const se=await m().catch(()=>{})??me.filter(ve=>ve.id!==he);if(se.length===0){await d.invalidateQueries({queryKey:["packages",e]}),i?.();return}he===z&&await B(he,se),await N()},onError:()=>void N()}),K=()=>w(null),oe=x?aL(x.version,n):{},ue=x!==null&&!Ep(x.version)&&x.version.latest&&oe.archive!==void 0&&oe.delete!==void 0,G=T!==null&&T.versions===void 0,ie=T?.versions!==void 0&&T.versions.length<=1,Q=T?.versions!==void 0?aL(T.version,T.versions).delete:void 0,ee=async fe=>{K(),y(null),ae.reset(),O({version:fe});const he=ve=>O(Le=>Le!==null&&Le.version.id===fe.id&&Le.versions===void 0?ve:Le);let me;try{me=await m()}catch(ve){he(null),D(`Couldn't check v${fe.id} before deleting it: ${gg(ve)}`);return}const se=me.find(ve=>ve.id===fe.id);if(se===void 0){he(null),D(`v${fe.id} is no longer a version of ${t}.`),N();return}he({version:se,versions:me})},Z=(fe,he)=>{!s||Y===fe.id||w({version:fe,anchor:_.current.get(fe.id)??he})},de=(fe,he)=>{const me=fe.key==="ArrowRight"||fe.key==="ContextMenu"||fe.key==="F10"&&fe.shiftKey;!s||!me||(fe.preventDefault(),fe.stopPropagation(),Z(he,fe.currentTarget))},le=x&&p.jsxs(ea,{disabled:oe.delete!==void 0,onClick:()=>void ee(x.version),children:[p.jsx(ml,{children:p.jsx(SF,{fontSize:"small"})}),p.jsx(Ci,{primary:"Delete version",secondary:oe.delete})]},"delete");return p.jsxs(p.Fragment,{children:[p.jsx(Vn,{size:"small",variant:"outlined",endIcon:p.jsx(I6,{}),"aria-label":z?`Version v${z}, change version`:"Select a version","aria-haspopup":"menu",onClick:fe=>y(fe.currentTarget),sx:{borderRadius:999,textTransform:"none",fontWeight:500,px:1.5,minWidth:0,whiteSpace:"nowrap"},children:z?`v${z}`:"Select a version"}),p.jsx(uc,{anchorEl:g,open:g!==null,onClose:()=>y(null),slotProps:{paper:{sx:{minWidth:320,maxWidth:400,mt:1,borderRadius:3}},list:{"aria-label":`Versions of ${t}`,disabledItemsFocusable:!0}},children:n.map(fe=>{const he=fe.id===z,me=Ep(fe),se=[me?"Archived":void 0,gRe(fe.createdAt),fe.gitCommitSha?fe.gitCommitSha.slice(0,7):void 0].filter(Boolean).join(" · ");return p.jsxs(ea,{"aria-current":he?"true":void 0,"aria-disabled":me&&!s?"true":void 0,"aria-haspopup":s?"menu":void 0,"data-testid":"version-row",onKeyDown:ve=>de(ve,fe),onClick:ve=>{if(me){Z(fe,ve.currentTarget);return}he||(y(null),o(fe.id,ve))},sx:ve=>({gap:1,borderLeft:"3px solid",borderLeftColor:he?ve.palette.primary.main:"transparent",backgroundColor:he?as(ve.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[p.jsx(Ci,{primary:fe.id,secondary:se,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&p.jsx(TR,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&p.jsx(Br,{title:Y===fe.id?"Updating this version…":"",children:p.jsx("span",{children:p.jsx(ro,{ref:ve=>{ve?_.current.set(fe.id,ve):_.current.delete(fe.id)},size:"small","aria-label":`More actions for version ${fe.id}`,"aria-haspopup":"menu",disabled:Y===fe.id,onClick:ve=>{ve.stopPropagation(),w({version:fe,anchor:ve.currentTarget})},children:p.jsx(pRe,{fontSize:"small"})})})})]},fe.id)})}),p.jsx(uc,{anchorEl:x?.anchor??null,open:x!==null,onClose:K,slotProps:{list:{"aria-label":x?`Actions for version ${x.version.id}`:void 0,disabledItemsFocusable:!0,autoFocus:ue}},children:x&&Ep(x.version)?[p.jsxs(ea,{onClick:()=>{const{id:fe}=x.version;K(),H.mutate({id:fe,archiveStatus:"unarchive"})},children:[p.jsx(ml,{children:p.jsx(mRe,{fontSize:"small"})}),p.jsx(Ci,{primary:"Unarchive"})]},"unarchive"),p.jsx(wl,{},"divider"),le]:x&&[p.jsxs(ea,{disabled:x.version.latest,onClick:()=>{b(x.version),I.reset(),K(),y(null)},children:[p.jsx(ml,{children:p.jsx(hRe,{fontSize:"small"})}),p.jsx(Ci,{primary:"Pin as latest",secondary:x.version.latest?"Already the latest version":void 0})]},"pin-latest"),p.jsxs(ea,{disabled:oe.archive!==void 0,onClick:()=>{k(x.version),H.reset(),K(),y(null)},children:[p.jsx(ml,{children:p.jsx(fRe,{fontSize:"small"})}),p.jsx(Ci,{primary:"Archive",secondary:oe.archive})]},"archive"),p.jsx(wl,{},"divider"),le]}),p.jsx(Oo,{open:S!==null,onClose:()=>{I.isPending||b(null)},title:S?`Pin v${S.id} as latest`:"",description:S?`Requests that name no version will be served from v${S.id}.`:void 0,initialFocus:A,actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{ref:A,disabled:I.isPending,onClick:()=>b(null),children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:I.isPending,onClick:()=>S&&I.mutate(S.id),children:"Pin as latest"})]}),children:p.jsxs(Yn,{spacing:1.5,children:[R&&S&&R!==S.id&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:`The latest version is v${R} now. Links and requests that name a version keep answering as before.`}),I.isError&&S&&p.jsx(lo,{severity:"error",role:"alert",children:`Couldn't pin v${S.id} as latest: ${gg(I.error)}`})]})}),p.jsx(Oo,{open:$!==null,onClose:()=>{H.isPending||k(null)},title:$?`Archive v${$.id}`:"",description:$?`v${$.id} stops being served and is unloaded. Its files stay, so it can be unarchived.`:void 0,initialFocus:F,actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{ref:F,disabled:H.isPending,onClick:()=>k(null),children:"Cancel"}),p.jsx(Vn,{variant:"contained",loading:H.isPending,onClick:()=>$&&H.mutate({id:$.id,archiveStatus:"archive"}),children:"Archive"})]}),children:p.jsxs(Yn,{spacing:1.5,children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:`${zC} Its scheduled builds stop, and once unarchived it serves live until it is built again.`}),H.isError&&$&&p.jsx(lo,{severity:"error",role:"alert",children:`Couldn't archive v${$.id}: ${gg(H.error)}`})]})}),p.jsx(Oo,{open:T!==null,onClose:()=>{ae.isPending||O(null)},title:T?`Delete v${T.version.id}`:"",initialFocus:L,actions:p.jsxs(p.Fragment,{children:[p.jsx(Vn,{ref:L,disabled:ae.isPending,onClick:()=>O(null),children:"Cancel"}),p.jsx(Vn,{variant:"contained",color:"error",loading:ae.isPending,disabled:G||Q!==void 0,onClick:()=>T?.versions&&ae.mutate({id:T.version.id,read:T.versions}),children:ie?"Delete package":"Delete version"})]}),children:p.jsxs(Yn,{spacing:1.5,children:[G&&T&&p.jsx(wt,{variant:"body2",children:`Checking ${t}'s versions before deleting v${T.version.id}…`}),T&&!G&&p.jsx(wt,{variant:"body2",children:ie?`v${T.version.id} is the only version of ${t}, so deleting it deletes the package. ${zC} This cannot be undone.`:`v${T.version.id} stops being served and its files are removed. ${zC} Links that name it stop working, and this cannot be undone.`}),Q!==void 0&&T&&p.jsx(lo,{severity:"warning",role:"alert",children:`v${T.version.id} can't be deleted now: ${Q}.`}),ae.isError&&T&&p.jsx(lo,{severity:"error",role:"alert",children:`Couldn't delete v${T.version.id}: ${gg(ae.error)}`})]})}),p.jsx(hh,{open:P!==null,autoHideDuration:8e3,onClose:()=>D(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:p.jsx(Te,{children:p.jsx(lo,{severity:"error",variant:"filled",onClose:()=>D(null),children:P})})})]})}const vRe="README.malloynb",bRe=e=>!!e&&!e.includes("/")&&D1(e)?.toLowerCase()==="readme";function XTe({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:l}=tr(),d=Tl(),u=e??(re=>{window.location.href=re}),{environmentName:m,packageName:g,versionId:y}=Xr(n),x=cRe(m,g),{versions:w}=x,S=w.length>0,b=!S&&!x.isPending&&!x.isError,$=o??((re,_e)=>u(`/${encodeURIComponent(m)}/${encodeURIComponent(g)}/${encodeURIComponent(re)}`,_e)),k=t??((re,_e)=>{const Me=re.mode==="edit"?$0e(m,g,re.path):S_(m,g,re.path);_e?u(Me,_e):u(Me)}),[T,O]=C.useState(null),[P,D]=C.useState(!1),A=kxe(),F=I_()?.documentStorage,[L,_]=C.useState([]),[R,z]=C.useState({state:F?"pending":"ready"}),N=C.useCallback(async()=>{if(!F)return;let re;try{re=await F.listWorkspaces(!1)}catch{z({state:"failed"});return}z({state:"ready",chosen:E_(re)});const _e=[],Me=wy(m,g,"");for(const Ge of re.filter(Je=>Je.writeable))for(const Je of await F.listDocuments(Ge))Je.path.startsWith(Me)&&_e.push({locator:Je,where:Ge.description});_(_e)},[F,m,g]);C.useEffect(()=>{N()},[N]);const B=re=>re.path.slice(wy(m,g,"").length),I=co({queryKey:["package",m,g,y],queryFn:()=>i.packages.getPackage(m,g,y,!1)}),H=co({queryKey:["package-agents",m,g,y],queryFn:()=>i.agents.listAgents(m,g,y)}),Y=C_(m,g,y),ae=co({queryKey:["models",m,g,y],queryFn:()=>i.models.listModels(m,g,y)}),K=co({queryKey:["databases",m,g,y],queryFn:()=>i.databases.listDatabases(m,g,y)}),oe=co({queryKey:["data-apps",m,g,y],queryFn:async()=>{try{return await i.dataApps.listDataApps(m,g,y)}catch(re){const _e=re?.response?.status;if(_e===404||_e===void 0)return{data:[]};throw re}}}).data?.data??[],ue=Y.reports.filter(re=>!!re.path),G=wRe(ue),ie=new Set(ue.map(re=>re.path).filter(re=>re!==void 0)),Q=(ae.data?.data??[]).slice().filter(re=>!ie.has(re.path)).sort((re,_e)=>re.path.localeCompare(_e.path)),ee=(K.data?.data??[]).slice().sort((re,_e)=>re.path.localeCompare(_e.path)),Z=R.state==="ready"?nxe({authoritative:R.chosen?.authoritative===!0,mutable:l&&b,canStore:R.chosen?.writeable===!0,...y===void 0?{}:{versionId:y}}):void 0,de=Y.settled&&(ae.isSuccess||ae.isError),le=Z!==void 0&&de,fe=le&&!A,he=C.useMemo(()=>{if(!le)return;const re=[...Y.reports.flatMap(_e=>_e.path?[_e.path]:[]),...(ae.data?.data??[]).flatMap(_e=>_e.path?[_e.path]:[])];if(Z==="storage"&&F&&R.state==="ready")return R.chosen?{route:Z,storage:F,workspace:R.chosen,environmentName:m,packageName:g,existing:re}:void 0;if(Z==="package")return{route:Z,existing:re,write:async(_e,Me)=>{await i.models.updateModelSource(m,g,_e,{source:Me})}}},[le,Z,F,R,m,g,i,Y.reports,ae.data]),me=I.data?.data?.description??"",se=H.data?.data??[],ve=(ue.find(re=>re.path===vRe)??ue.find(re=>bRe(re.path)))?.path,Le=!Y.settled,Ae=S?p.jsx(yRe,{environmentName:m,packageName:g,versions:w,...y!==void 0?{selectedVersionId:y}:{},onSelectVersion:$,...a?{onReplaceVersion:a}:{},onPackageDeleted:()=>u(`/${encodeURIComponent(m)}`),canManage:l}):null,Re=p.jsxs(Yn,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:.5},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:g}),Ae]});if(I.isError){const re=p.jsx(ja,{error:I.error,context:`${m} > ${g}`});return Ae?p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsx(Te,{sx:{mb:4},children:Re}),re]}):re}return p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Te,{sx:{mb:4},children:[Re,me&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:me})]}),p.jsx(_$e,{warnings:I.data?.data?.warnings}),x.isError&&p.jsx(Te,{sx:{mb:4},children:p.jsx(lo,{severity:"warning",action:p.jsx(Vn,{color:"inherit",size:"small",onClick:x.refetch,children:"Retry"}),children:"Could not read this package's versions, so nothing that changes it is offered until they load."})}),Le&&p.jsx(Bo,{text:"Loading package..."}),he&&p.jsx(U$e,{open:P,layout:"linear",environmentName:m,packageName:g,...y!==void 0?{versionId:y}:{},models:Q.map(re=>re.path).filter(re=>typeof re=="string"&&re.endsWith(".malloy")&&!ie.has(re)),modelsLoading:ae.isPending,...ae.isError?{modelsError:ae.error}:{},onRetryModels:()=>void ae.refetch(),target:he,...r?{onEvent:r}:{},onClose:()=>D(!1),onCreated:re=>{D(!1),pxe(d,m,g),d.invalidateQueries({queryKey:["models"]}),k({path:re.path,layout:re.layout,slug:re.slug,mode:"edit"})}}),!Le&&p.jsxs(p.Fragment,{children:[Y.isError&&p.jsx(Te,{sx:{mb:4},children:p.jsx(lo,{severity:"warning",action:p.jsx(Vn,{color:"inherit",size:"small",onClick:()=>void Y.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(G.length>0||le)&&p.jsxs(Ns,{title:"Reports",count:G.length,...fe?{action:p.jsx(Qy,{label:"Report",onClick:()=>D(!0)})}:{},children:[G.length===0&&p.jsx(FC,{label:"No reports yet",...fe?{action:{label:"Add report",onClick:()=>D(!0)}}:{}}),G.map(re=>p.jsx(wp,{type:re.layout==="grid"?"dashboard":"report",label:re.label,rightLabel:re.layout,...re.secondary===void 0?{}:{description:re.secondary},onClick:_e=>re.path.endsWith(".malloynb")?u(`/${m}/${g}/${re.path}`,_e):k({path:re.path,layout:re.layout,slug:re.slug,mode:"view"},_e)},re.path))]}),b&&L.length>0&&p.jsx(Ns,{title:"Drafts",count:L.length,children:L.map(({locator:re,where:_e})=>p.jsx(wp,{type:re.type==="grid"?"dashboard":"report",label:B(re),rightLabel:_e,onClick:Me=>k({path:B(re),layout:re.type,slug:D1(B(re))??"",mode:"edit"},Me),trailingAction:p.jsx(Br,{title:"Delete this draft",children:p.jsx(ro,{size:"small","aria-label":`Delete draft ${B(re)}`,onClick:Me=>{Me.stopPropagation(),F?.deleteDocument(re).then(N)},children:p.jsx(SF,{fontSize:"small"})})})},`${re.workspace}:${re.path}`))}),oe.length>0&&p.jsx(Ns,{title:"Apps",count:oe.length,children:oe.map(re=>{const _e=!!re.title&&re.title!==re.path,Me=`${r6(s)}${re.resource}`;return p.jsx(wp,{type:"dataApp",label:_e?re.title:re.path,rightLabel:_e?re.path:void 0,onClick:Ge=>{e?e(`/${m}/${g}/data-apps/${re.path}`,Ge):Ge&&(Ge.metaKey||Ge.ctrlKey)?window.open(Me,"_blank"):window.location.href=Me},trailingAction:p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(ro,{size:"small",href:Me,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:Ge=>Ge.stopPropagation(),sx:{color:"text.secondary"},children:p.jsx(n6,{fontSize:"small"})})})},re.path)})}),p.jsxs(Ns,{title:"Models",count:Q.length,children:[Q.map(re=>p.jsx(wp,{type:"model",label:re.path,onClick:_e=>u(`/${m}/${g}/${re.path}`,_e)},re.path)),Q.length===0&&p.jsx(FC,{label:"No models"})]}),se.length>0&&p.jsx(Ns,{title:"Agents",count:se.length,description:"Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet.",children:se.map(re=>p.jsx(xRe,{agent:re},re.name))}),p.jsxs(Ns,{title:"Data",count:ee.length,children:[ee.map(re=>p.jsx(wp,{type:"data",label:re.path,rightLabel:re.info?lB(re.info.rowCount):"Unreadable",onClick:()=>O(re)},re.path)),ee.length===0&&p.jsx(FC,{label:"No data files"})]}),p.jsx($Se,{resourceUri:n,versioned:!b}),ve&&p.jsx(Te,{sx:{mt:6},children:p.jsx(B$e,{resourceUri:I1({environmentName:m,packageName:g,versionId:y}),path:ve,onLinkNavigate:u})})]}),p.jsx(lRe,{database:T,onClose:()=>O(null)})]})}function wp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return p.jsx(L1,{icon:p.jsx(sB,{type:e}),tint:iB[e],label:t,mono:!0,...n===void 0?{}:{description:n},...r===void 0?{}:{rightLabel:r},...o===void 0?{}:{onClick:o},...a===void 0?{}:{trailingAction:a}})}function xRe({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx(wp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=lT(t.cron??"");return p.jsxs(wt,{variant:"caption",color:"text.secondary",sx:{display:"block",ml:6,mb:.5},children:[n.valid?n.description:t.cron," (UTC), task"," ",t.task,". Not run yet."]},`${t.cron}|${t.task}`)})]})}function wRe(e){const t=e.map(r=>({path:r.path??"",layout:Z2(r),slug:D1(r.path)??r.path??"",title:r.title})),n=new Map;for(const r of t)n.set(r.slug,(n.get(r.slug)??0)+1);return t.map(({title:r,...o})=>{const a=!!r&&r!==o.slug&&r!==o.path,i=(n.get(o.slug)??0)>1,s=a?r:o.path.endsWith(".malloynb")?o.path:o.slug;return{...o,label:s,secondary:s!==o.path&&(a||i||o.path.includes("/"))?o.path:void 0}}).sort((r,o)=>r.label.localeCompare(o.label)||r.path.localeCompare(o.path))}function FC({label:e,action:t}){return p.jsxs(Yn,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&p.jsx(Vn,{size:"small",onClick:t.onClick,children:t.label})]})}const iL=/^publisher:document:(dashboard|notebook):(.+)$/;function SRe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&iL.test(o)&&n.push(o)}for(const r of n){const[,o,a]=iL.exec(r),i=e.getItem(r);i!==null&&t(a,L_(o),i)&&e.removeItem(r)}}const _C={name:"Local",description:"Stored in this browser only",writeable:!0},j$="publisher:report:",gd=e=>`${j$}${e}`;function yg(e){const t=localStorage.getItem(e);if(t!==null)try{const n=JSON.parse(t);if(typeof n.content=="string"&&(n.type==="grid"||n.type==="linear"))return{type:n.type,content:n.content}}catch{}}const BC=(e,t)=>localStorage.setItem(gd(e),JSON.stringify(t));class CRe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,SRe(localStorage,(t,n,r)=>yg(gd(t))!==void 0?!1:(BC(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[_C]}async listDocuments(t,n){if(t.name!==_C.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(j$))continue;const i=yg(a);i&&(n===void 0||i.type===n)&&r.push({workspace:_C.name,type:i.type,path:a.slice(j$.length)})}return r}async getDocument(t){this.migrate();const n=yg(gd(t.path));if(n===void 0)throw UC(t);return n.content}async getDocumentType(t){this.migrate();const n=yg(gd(t.path));if(n===void 0)throw UC(t);return n.type}async saveDocument(t,n){this.migrate(),BC(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),yg(gd(t.path))===void 0)throw UC(t);localStorage.removeItem(gd(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);BC(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(gd(t.path))}}function UC(e){return new M_(`No report at ${e.workspace}/${e.path}`)}async function kRe(e,t,n,r){const o=E_(await e.listWorkspaces(!1));if(!o)return;const a=wy(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(O_(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function ZTe(e,t,n,r=!0){const o=I_()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),l=wy(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let d=!1;return kRe(o,e,t,n).catch(()=>{}).then(u=>{d||s({key:l,layout:u})}),()=>{d=!0}},[a,o,e,t,n,l]),a?i?.key===l?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function $Re(e){return C.useMemo(()=>{if(!e?.sources?.length)return[];const t=new Map;for(const n of e.sources)if(n.givens?.length)for(const r of n.givens)r.name&&!t.has(r.name)&&t.set(r.name,r);return Array.from(t.values())},[e])}function RRe(e){return e.type==="code"}function TRe(e){return(e.text??"").split(`
511
511
  `).filter(t=>!t.trimStart().startsWith("##")).join(`
512
- `)}const TRe=Jt(p.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}));function ERe({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:l,onDrillNavigate:d,givens:u,givenSpecs:m}){const[g,y]=kn.useState(!1),[x,w]=kn.useState(!1),[S,b]=kn.useState(),[$,k]=kn.useState(!1),{modelPage:T,isLoadingStatus:O}=tr(),P=!O&&T!=="viewer",[D,A]=C.useState(""),{environmentName:F,packageName:L,modelPath:_}=Xr(t),R={environmentName:F,packageName:L,sourcePath:_,onNavigate:i},{drill:z,drillMenu:N}=Z_({onNavigate:d,onSelf:s,canSelf:l}),B=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,I=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,H=!!e.text&&(B.test(e.text)||I.test(e.text)),Y=()=>{if(!e.newSources||e.newSources.length===0)return 0;let G=[],ie="";if(e.text){const Q=e.text.match(B);Q&&(G=Q[1].split(",").map(Z=>Z.trim()));const ee=e.text.match(I);ee&&(ie=ee[1].trim())}for(let Q=0;Q<e.newSources.length;Q++)try{const ee=JSON.parse(e.newSources[Q]);if(G.length>0&&G.includes(ee.name)||ie&&ie===ee.path)return Q}catch{continue}return 0},ae=kn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:m}:void 0,[e.newSources,t,m]),{mode:K}=Vr();C.useEffect(()=>{e.type==="code"&&ST(RRe(e),"malloy",K).then(G=>{b(G)})},[e,K]);const oe=()=>{const G=window.location.href;navigator.clipboard.writeText(G).then(()=>A("URL copied to clipboard!")).catch(()=>A("Failed to copy URL"))},ue=p.jsx(Oo,{open:g,onClose:()=>y(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:p.jsx(Te,{sx:G=>({border:`1px solid ${G.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:Fo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:G.palette.background.paper,color:G.palette.text.primary}),children:p.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:S}})})});return e.type==="markdown"&&p.jsx(Te,{children:p.jsxs(N1,{children:[n?p.jsxs(Yn,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[p.jsx(oh,{variant:"document",links:R,children:e.text}),p.jsx(Br,{title:"Copy link",children:p.jsx(ro,{"aria-label":"Copy link",onClick:oe,sx:{color:"text.secondary",mt:"18px"},children:p.jsx(uT,{sx:{fontSize:"24px"}})})})]}):p.jsx(oh,{variant:"document",links:R,children:e.text}),p.jsx(hh,{open:D!=="",autoHideDuration:6e3,onClose:()=>A(""),message:D})]})})||e.type==="code"&&p.jsxs(Te,{children:[e.newSources&&e.newSources.length>0&&p.jsx(Yn,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:p.jsx(x4,{sx:{position:"relative",padding:"0"},children:p.jsxs(Te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[S&&p.jsx("span",{dangerouslySetInnerHTML:{__html:S},style:{fontFamily:Fo,fontSize:"14px",flex:1,marginRight:"8px"}}),H&&P&&p.jsx(zp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:p.jsx(Kp,{})})]})})}),p.jsx(aB,{open:$&&P,onClose:()=>k(!1),title:"Data Sources",hasValidImport:H,resourceUri:t,data:ae,initialSelectedSourceIndex:Y(),startingGivens:u}),ue,p.jsx(nB,{open:x,onClose:()=>w(!1),result:e.result||"",title:"Results",drill:z}),o&&!e.result&&!e.error&&!H&&!(e.newSources&&e.newSources.length>0)&&p.jsx(X0,{children:p.jsx(Te,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:p.jsx(ku,{size:32})})}),!e.result&&e.error&&p.jsx(CF,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&p.jsx(hz,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&p.jsxs(X0,{children:[p.jsx($_,{title:"",action:p.jsxs(Yn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[p.jsx(zp,{"aria-label":"Malloy code",onClick:G=>{G.stopPropagation(),y(!0)},children:p.jsx(TRe,{})}),p.jsx(zp,{"aria-label":"Expand results",onClick:()=>w(!0),children:p.jsx(Kp,{})})]})}),p.jsx(A1,{result:e.result,maxHeight:jle,maxResultSize:r,drill:z}),N]})]})}function MRe({ready:e,lastRunKey:t,pendingKey:n,runKey:r,documentKey:o}){if(!e)return{cancelPending:n!==void 0,dispatch:"none"};const a=n!==void 0&&n!==r;if(t===r)return{cancelPending:a,dispatch:"none"};if(n===r)return{cancelPending:a,dispatch:"none"};const i=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:i?"now":"settle"}}const ORe=4;function PRe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The server did not say why."}function jRe({resourceUri:e,title:t,description:n,maxResultSize:r=0,givens:o,onGivensChange:a,onNavigate:i,onDrillNavigate:s,notebook:l,error:d,runCell:u}){const{environmentName:m,packageName:g,versionId:y,modelPath:x}=Xr(e),w=l!==void 0,S=!w&&!!d,[b,$]=C.useState([]),[k,T]=C.useState(!1),[O,P]=C.useState(!1),D=C.useRef(void 0),[A,F]=C.useState(null),L=kRe(l),_=l?.autorun!==!1,R=g1(),z=b2({specs:L,loaded:w,startingValues:l?.startingGivens,params:o,onGivensChange:a,documentKey:e,autorun:_,environmentName:m,packageName:g,modelPath:x,versionId:y,documentName:x}),{applied:N,declaredTypes:B,canSelf:I,onSelf:H}=z,Y=C.useCallback(fe=>{const he=Jd(fe,B);return Object.keys(he).length>0?JSON.stringify(he):void 0},[B]),ae=C.useMemo(()=>m0(N,B),[N,B]),K=C.useRef(0),oe=C.useRef(null),ue=C.useRef(null),G=C.useRef(void 0);C.useEffect(()=>()=>{oe.current?.abort(),ue.current=null,clearTimeout(G.current?.timer),G.current=void 0},[]);const ie=C.useCallback(async(fe=new Map)=>{if(!w||!l?.notebookCells)return;const he=++K.current;oe.current?.abort();const me=new AbortController;oe.current=me,$(l.notebookCells.map(se=>({...se}))),T(!0),F(null);try{const se=[];for(let Le=0;Le<l.notebookCells.length;Le++){const Ae=l.notebookCells[Le];if(!$Re(Ae))continue;const Re=Le,re=async()=>{try{const _e=await u({cell:Ae,index:Re,givens:fe,declaredTypes:B,signal:me.signal});if(K.current!==he)return;const Me=_e.result,Ge=Ae.newSources||_e.newSources;$(Je=>{const St=[...Je];return St[Re]||(St[Re]={...Ae}),St[Re]={...St[Re],result:Me,newSources:Ge},St})}catch(_e){if(me.signal.aborted||K.current!==he)return;R.emit({type:"report.query_failed",tile:Re,category:U0(_e)}),R.listening||console.error(`Error executing cell ${Re}:`,_e);const Me=PRe(_e);$(Ge=>{const Je=[...Ge];return Je[Re]||(Je[Re]={...Ae}),Je[Re]={...Je[Re],error:Me},Je})}};se.push(re)}const ve=[];for(const Le of se){const Ae=Le().then(()=>{ve.splice(ve.indexOf(Ae),1)});ve.push(Ae),ve.length>=ORe&&await Promise.race(ve)}await Promise.all(ve)}catch(se){if(me.signal.aborted||K.current!==he)return;R.emit({type:"report.query_failed",category:U0(se)}),R.listening||console.error("Error executing notebook cells:",se),F(se)}finally{K.current===he&&(T(!1),oe.current=null)}},[w,l,B,u,R]),Q=C.useRef(0),ee=C.useRef(void 0);ee.current!==l&&(ee.current=l,Q.current+=1);const Z=Q.current;C.useEffect(()=>{const fe=`${e}|${Z}`,he=`${fe}|${Y(N)??""}`;D.current!==void 0&&D.current!==fe&&(oe.current?.abort(),oe.current=null),D.current=fe;const me=MRe({ready:w&&!!l?.notebookCells,lastRunKey:ue.current,pendingKey:G.current?.key,runKey:he,documentKey:fe});if(me.cancelPending&&(clearTimeout(G.current?.timer),G.current=void 0,P(!1)),me.dispatch==="none")return;const se=()=>{G.current=void 0,P(!1),ue.current=he,ie(N)};if(me.dispatch==="now"){se();return}P(!0),G.current={key:he,timer:setTimeout(se,c_)}},[w,l,Z,e,N,Y,ie]);const de=b.length>0?b:l?.notebookCells||[],le=0;return p.jsxs(b$,{layout:"linear",header:t||n?p.jsx(R_,{title:t??"",description:n?p.jsx(N1,{children:p.jsx(oh,{variant:"document",children:n})}):void 0}):null,controls:z.panel.givens.length>0?p.jsx(T_,{children:p.jsx(j1,{...z.panel,layout:"bar"})}):void 0,children:[!w&&!S&&p.jsx(Bo,{text:wu.opening("report")}),w&&de.map((fe,he)=>p.jsx(ERe,{cell:fe,showCopyLink:he===le,resourceUri:e,maxResultSize:r,isExecuting:k,givens:ae,givenSpecs:L,pendingRerun:O,onNavigate:i,onDrillNavigate:s,onDrillSelf:L.length>0?H:void 0,canDrillSelf:I},he)),S&&d?.status===404&&p.jsxs(wt,{variant:"body2",sx:{color:"text.secondary"},children:[p.jsx("code",{children:`${m} > ${g} > ${x}`})," ","not found."]}),S&&d?.status!==404&&p.jsx(ja,{error:d,context:`${m} > ${g} > ${x}`}),A&&p.jsx(ja,{error:{message:A.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function dB(e){const{apiClients:t}=tr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e);return co({queryKey:[e],queryFn:async()=>(await t.notebooks.getNotebook(n,r,a,o)).data})}function ARe(e){const{apiClients:t}=tr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri),i=dB(e.resourceUri),s=C.useCallback(async({index:l,givens:d,declaredTypes:u,signal:m})=>{const g=Jd(d,u);return(await t.notebooks.executeNotebookCell(n,r,a,l,o,void 0,void 0,Object.keys(g).length>0?JSON.stringify(g):void 0,{signal:m})).data},[t.notebooks,n,r,a,o]);return p.jsx(jRe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function XTe(e){const{data:t}=dB(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri);return p.jsx(t6,{manifest:{...t.dashboard,layout:"linear"},environmentName:n,packageName:r,versionId:o,documentName:a,givens:e.givens,onGivensChange:e.onGivensChange,onNavigate:e.onDrillNavigate,...e.onNavigate?{onLinkNavigate:e.onNavigate}:{},maxResultSize:e.maxResultSize})}return p.jsx(ARe,{...e})}function ZTe(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>D1(a.path)===e),o=r.filter(a=>Z2(a)===n);return o.length===1?{found:v$(o[0])}:r.length===1?{found:v$(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const DRe=/^(dashboards|notebooks)\/([^/]+)$/;function JTe(e){const t=DRe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const sL="[publisher.report]",lL="[publisher.console]";function NRe(e){switch(e.type){case"report.load_failed":case"report.query_failed":case"report.save_refused":case"report.save_undo_refused":case"report.create_refused":return!0;case"report.rows_shown":return!e.ok;case"report.drill":return e.outcome==="unresolved"||e.outcome==="malformed";default:return!1}}function eEe(e){return t=>{const n={...e,...t,at:new Date().toISOString()};NRe(t)?console.warn(sL,n):console.info(sL,n)}}function IRe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(lL,t):console.warn(lL,t)}const Lo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:hr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:hr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:hr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:hr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},Wb='"Inter", "Helvetica Neue", "Arial", sans-serif',Ho={50:Lo.offWhite,100:"#F1F5F9",200:Lo.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Lo.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Lo.black},tEe={headerHeight:56},cL="0 1px 3px rgba(0, 0, 0, 0.1)",LRe="#0f172a",zRe="#1e293b",FRe="#f1f5f9",_Re="#cbd5e1",BRe="#334155",fB=(e="light",t)=>{const n=e==="dark",r=n?LRe:Lo.white,o=n?zRe:Lo.white,a=n?FRe:Lo.black,i=n?_Re:Lo.grey.mid,s=n?BRe:Lo.grey.light,{accent:l,accentHover:d,accentContrast:u}=t??Ik(void 0,e);return Tx({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:l,light:Lo.grey.light,dark:d,contrastText:u},secondary:{main:Lo.grey.mid,light:Lo.grey.light,dark:Lo.black},grey:Ho,success:Lo.semantic.success,warning:Lo.semantic.warning,error:Lo.semantic.error,info:Lo.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:Wb,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:6},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0},styleOverrides:{root:{"&:focus-visible":{outline:`2px solid ${l}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Ho[300]} ${Ho[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Ho[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Ho[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Ho[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Ho[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Ho[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Ho[300],border:"none",borderRadius:"4px"}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:6,textTransform:"none",fontWeight:500,fontSize:13,minHeight:32,paddingTop:0,paddingBottom:0,boxShadow:"none","&:hover":{boxShadow:"none"}},sizeSmall:{minHeight:32,paddingLeft:10,paddingRight:10},sizeMedium:{minHeight:32,paddingLeft:12,paddingRight:12},contained:{"&:hover":{boxShadow:"none"},"&.Mui-disabled":{backgroundColor:n?"rgba(255, 255, 255, 0.06)":Ho[200],color:n?"#64748b":Ho[500]}},outlined:{color:a,borderColor:n?"#475569":Ho[300],"&:hover":{borderColor:n?"#64748b":Ho[400],backgroundColor:n?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:6}}},MuiPopover:{styleOverrides:{paper:{borderRadius:8}}},MuiCard:{styleOverrides:{root:{borderRadius:8,boxShadow:cL,border:"1px solid",borderColor:s,backgroundColor:o}}},MuiChip:{styleOverrides:{root:{borderRadius:6,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:6},"& .MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:12,backgroundColor:o,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiSelect:{styleOverrides:{select:{fontFamily:Wb,fontSize:"0.875rem",color:a}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${n?Ho[600]:Ho[300]}`,borderRadius:6,transition:`border-color ${Zy} ease-in`,...Jy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Ho[400]},"&.Mui-focused":{borderColor:n?Ho[400]:Ho[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:Wb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:Wb}}},MuiMenu:{styleOverrides:{paper:{borderRadius:8,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${s}`,backgroundColor:o,color:a}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Ho[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:6,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.08)":Lo.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":Lo.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":Lo.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:cL}}}}})};fB("light");function URe({children:e}){const{mode:t,theme:n}=Vr(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>fB(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return p.jsxs(r7,{theme:i,children:[p.jsx(dQ,{}),e]})}const qRe=C.lazy(()=>wo(()=>import("./HomePage-lrIG8Qjk.js"),[])),HRe=C.lazy(()=>wo(()=>import("./MainPage-CJf3Uuul.js"),__vite__mapDeps([7,8,9,10]))),VRe=C.lazy(()=>wo(()=>import("./PackageSplatRoute-FyScmoYw.js").then(e=>e.a),__vite__mapDeps([11,10]))),WRe=C.lazy(()=>wo(()=>import("./PackagePage-Cxa0_alv.js"),__vite__mapDeps([12,9,10,13]))),YRe=C.lazy(()=>wo(()=>import("./EnvironmentPage-gNvDKTtA.js"),[])),GRe=C.lazy(()=>wo(()=>import("./RouteError-BZUUKmNE.js"),[])),KRe=C.lazy(()=>wo(()=>import("./ThemeEditorPage-vDnfPmZz.js"),__vite__mapDeps([14,15]))),QRe=(e="/",t=new SRe,n)=>(f1e(IRe),KH([{path:e,element:p.jsx(qre,{children:p.jsx(cxe,{documentStorage:t,children:p.jsx(URe,{children:p.jsx(C.Suspense,{fallback:p.jsx(Bo,{}),children:p.jsx(HRe,{headerProps:n})})})})}),errorElement:p.jsx(GRe,{}),children:[{index:!0,element:p.jsx(qRe,{})},{path:"settings/theme",element:p.jsx(KRe,{})},{path:"settings",element:p.jsx(CH,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:p.jsx(YRe,{})},{path:":environmentName/:packageName",element:p.jsx(WRe,{})},{path:":environmentName/:packageName/*",element:p.jsx(VRe,{})}]}])),XRe=QRe("/");NU.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(lV,{router:XRe})}));export{t2e as $,JRe as A,is as B,Ay as C,Cxe as D,C_ as E,Xy as F,R0e as G,Te as H,TR as I,ro as J,Br as K,AR as L,dz as M,tr as N,zd as O,Qa as P,tu as Q,Vr as R,rk as S,wt as T,mz as U,ml as V,Ci as W,oee as X,tEe as Y,YTe as Z,qTe as _,wn as a,L_ as a$,Bo as a0,lo as a1,Vn as a2,kn as a3,wo as a4,eEe as a5,CH as a6,I1 as a7,KTe as a8,lRe as a9,Jne as aA,k_ as aB,C2e as aC,hTe as aD,_le as aE,MTe as aF,p0e as aG,TTe as aH,mTe as aI,Ble as aJ,yTe as aK,Ple as aL,pTe as aM,gTe as aN,Zd as aO,mF as aP,wl as aQ,hF as aR,f1 as aS,uc as aT,kTe as aU,qle as aV,uF as aW,tTe as aX,Q2e as aY,vTe as aZ,b$ as a_,WTe as aa,dH as ab,O0 as ac,Yn as ad,_P as ae,Ri as af,DR as ag,C4 as ah,Lk as ai,ea as aj,Tl as ak,a0 as al,DK as am,zK as an,hh as ao,Oo as ap,kae as aq,su as ar,ux as as,jd as at,ji as au,e1 as av,mae as aw,ZRe as ax,A$ as ay,Sl as az,sl as b,ETe as b$,NTe as b0,D1 as b1,Pd as b2,I_ as b3,co as b4,DTe as b5,Kk as b6,U0 as b7,PTe as b8,ja as b9,OTe as bA,ATe as bB,fxe as bC,wTe as bD,uxe as bE,BTe as bF,$Te as bG,b2 as bH,Ybe as bI,X0 as bJ,$_ as bK,B_ as bL,b0e as bM,Gbe as bN,Qbe as bO,rTe as bP,Kbe as bQ,j1 as bR,ble as bS,sxe as bT,F2e as bU,W2e as bV,rae as bW,q2e as bX,H2e as bY,V2e as bZ,G2e as b_,STe as ba,ixe as bb,VN as bc,Zy as bd,Jt as be,wi as bf,dTe as bg,vl as bh,eTe as bi,rle as bj,iF as bk,ile as bl,cF as bm,uTe as bn,T_ as bo,qbe as bp,i0e as bq,s0e as br,R_ as bs,N1 as bt,FTe as bu,E_ as bv,txe as bw,O_ as bx,jTe as by,oce as bz,Za as c,ITe as c$,OA as c0,pF as c1,d2 as c2,J2e as c3,Z2e as c4,nle as c5,Jse as c6,Jy as c7,Hbe as c8,Vbe as c9,Zle as cA,nTe as cB,iTe as cC,sTe as cD,U2e as cE,Qx as cF,aTe as cG,oTe as cH,cTe as cI,K2e as cJ,P_ as cK,N4 as cL,oae as cM,fF as cN,h1 as cO,bTe as cP,gK as cQ,vC as cR,Y2e as cS,_2e as cT,gle as cU,Ule as cV,nT as cW,rxe as cX,nxe as cY,LTe as cZ,eT as c_,X2e as ca,Tg as cb,A0e as cc,Up as cd,oQ as ce,fTe as cf,SF as cg,lTe as ch,dle as ci,WN as cj,sle as ck,Cz as cl,Wy as cm,Ele as cn,Tle as co,oh as cp,Lx as cq,ple as cr,W0e as cs,_Te as ct,zTe as cu,Bz as cv,xTe as cw,xF as cx,Hle as cy,B2e as cz,_t as d,J0e as d0,A_ as d1,X0e as d2,exe as d3,lxe as d4,ay as d5,_r as d6,T0e as d7,E0e as d8,S_ as d9,HTe as da,XTe as db,_$e as dc,e2e as dd,CTe as de,UTe as df,JTe as dg,ZTe as dh,GL as di,Fo as dj,QTe as dk,wu as dl,VTe as dm,Qxe as dn,GTe as dp,P0 as dq,k0e as dr,$0e as ds,JC as e,vn as f,yn as g,gc as h,zs as i,p as j,uo as k,Kd as l,dn as m,F5 as n,lc as o,H5 as p,Bp as q,C as r,ct as s,Fy as t,Sn as u,_5 as v,Ln as w,lt as x,Aa as y,hs as z};
512
+ `)}const ERe=Jt(p.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}));function MRe({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:l,onDrillNavigate:d,givens:u,givenSpecs:m}){const[g,y]=kn.useState(!1),[x,w]=kn.useState(!1),[S,b]=kn.useState(),[$,k]=kn.useState(!1),{modelPage:T,isLoadingStatus:O}=tr(),P=!O&&T!=="viewer",[D,A]=C.useState(""),{environmentName:F,packageName:L,modelPath:_}=Xr(t),R={environmentName:F,packageName:L,sourcePath:_,onNavigate:i},{drill:z,drillMenu:N}=Z_({onNavigate:d,onSelf:s,canSelf:l}),B=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,I=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,H=!!e.text&&(B.test(e.text)||I.test(e.text)),Y=()=>{if(!e.newSources||e.newSources.length===0)return 0;let G=[],ie="";if(e.text){const Q=e.text.match(B);Q&&(G=Q[1].split(",").map(Z=>Z.trim()));const ee=e.text.match(I);ee&&(ie=ee[1].trim())}for(let Q=0;Q<e.newSources.length;Q++)try{const ee=JSON.parse(e.newSources[Q]);if(G.length>0&&G.includes(ee.name)||ie&&ie===ee.path)return Q}catch{continue}return 0},ae=kn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:m}:void 0,[e.newSources,t,m]),{mode:K}=Vr();C.useEffect(()=>{e.type==="code"&&ST(TRe(e),"malloy",K).then(G=>{b(G)})},[e,K]);const oe=()=>{const G=window.location.href;navigator.clipboard.writeText(G).then(()=>A("URL copied to clipboard!")).catch(()=>A("Failed to copy URL"))},ue=p.jsx(Oo,{open:g,onClose:()=>y(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:p.jsx(Te,{sx:G=>({border:`1px solid ${G.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:Fo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:G.palette.background.paper,color:G.palette.text.primary}),children:p.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:S}})})});return e.type==="markdown"&&p.jsx(Te,{children:p.jsxs(N1,{children:[n?p.jsxs(Yn,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[p.jsx(oh,{variant:"document",links:R,children:e.text}),p.jsx(Br,{title:"Copy link",children:p.jsx(ro,{"aria-label":"Copy link",onClick:oe,sx:{color:"text.secondary",mt:"18px"},children:p.jsx(uT,{sx:{fontSize:"24px"}})})})]}):p.jsx(oh,{variant:"document",links:R,children:e.text}),p.jsx(hh,{open:D!=="",autoHideDuration:6e3,onClose:()=>A(""),message:D})]})})||e.type==="code"&&p.jsxs(Te,{children:[e.newSources&&e.newSources.length>0&&p.jsx(Yn,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:p.jsx(x4,{sx:{position:"relative",padding:"0"},children:p.jsxs(Te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[S&&p.jsx("span",{dangerouslySetInnerHTML:{__html:S},style:{fontFamily:Fo,fontSize:"14px",flex:1,marginRight:"8px"}}),H&&P&&p.jsx(zp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:p.jsx(Kp,{})})]})})}),p.jsx(aB,{open:$&&P,onClose:()=>k(!1),title:"Data Sources",hasValidImport:H,resourceUri:t,data:ae,initialSelectedSourceIndex:Y(),startingGivens:u}),ue,p.jsx(nB,{open:x,onClose:()=>w(!1),result:e.result||"",title:"Results",drill:z}),o&&!e.result&&!e.error&&!H&&!(e.newSources&&e.newSources.length>0)&&p.jsx(X0,{children:p.jsx(Te,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:p.jsx(ku,{size:32})})}),!e.result&&e.error&&p.jsx(CF,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&p.jsx(hz,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&p.jsxs(X0,{children:[p.jsx($_,{title:"",action:p.jsxs(Yn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[p.jsx(zp,{"aria-label":"Malloy code",onClick:G=>{G.stopPropagation(),y(!0)},children:p.jsx(ERe,{})}),p.jsx(zp,{"aria-label":"Expand results",onClick:()=>w(!0),children:p.jsx(Kp,{})})]})}),p.jsx(A1,{result:e.result,maxHeight:jle,maxResultSize:r,drill:z}),N]})]})}function ORe({ready:e,lastRunKey:t,pendingKey:n,runKey:r,documentKey:o}){if(!e)return{cancelPending:n!==void 0,dispatch:"none"};const a=n!==void 0&&n!==r;if(t===r)return{cancelPending:a,dispatch:"none"};if(n===r)return{cancelPending:a,dispatch:"none"};const i=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:i?"now":"settle"}}const PRe=4;function jRe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The server did not say why."}function ARe({resourceUri:e,title:t,description:n,maxResultSize:r=0,givens:o,onGivensChange:a,onNavigate:i,onDrillNavigate:s,notebook:l,error:d,runCell:u}){const{environmentName:m,packageName:g,versionId:y,modelPath:x}=Xr(e),w=l!==void 0,S=!w&&!!d,[b,$]=C.useState([]),[k,T]=C.useState(!1),[O,P]=C.useState(!1),D=C.useRef(void 0),[A,F]=C.useState(null),L=$Re(l),_=l?.autorun!==!1,R=g1(),z=b2({specs:L,loaded:w,startingValues:l?.startingGivens,params:o,onGivensChange:a,documentKey:e,autorun:_,environmentName:m,packageName:g,modelPath:x,versionId:y,documentName:x}),{applied:N,declaredTypes:B,canSelf:I,onSelf:H}=z,Y=C.useCallback(fe=>{const he=Jd(fe,B);return Object.keys(he).length>0?JSON.stringify(he):void 0},[B]),ae=C.useMemo(()=>m0(N,B),[N,B]),K=C.useRef(0),oe=C.useRef(null),ue=C.useRef(null),G=C.useRef(void 0);C.useEffect(()=>()=>{oe.current?.abort(),ue.current=null,clearTimeout(G.current?.timer),G.current=void 0},[]);const ie=C.useCallback(async(fe=new Map)=>{if(!w||!l?.notebookCells)return;const he=++K.current;oe.current?.abort();const me=new AbortController;oe.current=me,$(l.notebookCells.map(se=>({...se}))),T(!0),F(null);try{const se=[];for(let Le=0;Le<l.notebookCells.length;Le++){const Ae=l.notebookCells[Le];if(!RRe(Ae))continue;const Re=Le,re=async()=>{try{const _e=await u({cell:Ae,index:Re,givens:fe,declaredTypes:B,signal:me.signal});if(K.current!==he)return;const Me=_e.result,Ge=Ae.newSources||_e.newSources;$(Je=>{const St=[...Je];return St[Re]||(St[Re]={...Ae}),St[Re]={...St[Re],result:Me,newSources:Ge},St})}catch(_e){if(me.signal.aborted||K.current!==he)return;R.emit({type:"report.query_failed",tile:Re,category:U0(_e)}),R.listening||console.error(`Error executing cell ${Re}:`,_e);const Me=jRe(_e);$(Ge=>{const Je=[...Ge];return Je[Re]||(Je[Re]={...Ae}),Je[Re]={...Je[Re],error:Me},Je})}};se.push(re)}const ve=[];for(const Le of se){const Ae=Le().then(()=>{ve.splice(ve.indexOf(Ae),1)});ve.push(Ae),ve.length>=PRe&&await Promise.race(ve)}await Promise.all(ve)}catch(se){if(me.signal.aborted||K.current!==he)return;R.emit({type:"report.query_failed",category:U0(se)}),R.listening||console.error("Error executing notebook cells:",se),F(se)}finally{K.current===he&&(T(!1),oe.current=null)}},[w,l,B,u,R]),Q=C.useRef(0),ee=C.useRef(void 0);ee.current!==l&&(ee.current=l,Q.current+=1);const Z=Q.current;C.useEffect(()=>{const fe=`${e}|${Z}`,he=`${fe}|${Y(N)??""}`;D.current!==void 0&&D.current!==fe&&(oe.current?.abort(),oe.current=null),D.current=fe;const me=ORe({ready:w&&!!l?.notebookCells,lastRunKey:ue.current,pendingKey:G.current?.key,runKey:he,documentKey:fe});if(me.cancelPending&&(clearTimeout(G.current?.timer),G.current=void 0,P(!1)),me.dispatch==="none")return;const se=()=>{G.current=void 0,P(!1),ue.current=he,ie(N)};if(me.dispatch==="now"){se();return}P(!0),G.current={key:he,timer:setTimeout(se,c_)}},[w,l,Z,e,N,Y,ie]);const de=b.length>0?b:l?.notebookCells||[],le=0;return p.jsxs(b$,{layout:"linear",header:t||n?p.jsx(R_,{title:t??"",description:n?p.jsx(N1,{children:p.jsx(oh,{variant:"document",children:n})}):void 0}):null,controls:z.panel.givens.length>0?p.jsx(T_,{children:p.jsx(j1,{...z.panel,layout:"bar"})}):void 0,children:[!w&&!S&&p.jsx(Bo,{text:wu.opening("report")}),w&&de.map((fe,he)=>p.jsx(MRe,{cell:fe,showCopyLink:he===le,resourceUri:e,maxResultSize:r,isExecuting:k,givens:ae,givenSpecs:L,pendingRerun:O,onNavigate:i,onDrillNavigate:s,onDrillSelf:L.length>0?H:void 0,canDrillSelf:I},he)),S&&d?.status===404&&p.jsxs(wt,{variant:"body2",sx:{color:"text.secondary"},children:[p.jsx("code",{children:`${m} > ${g} > ${x}`})," ","not found."]}),S&&d?.status!==404&&p.jsx(ja,{error:d,context:`${m} > ${g} > ${x}`}),A&&p.jsx(ja,{error:{message:A.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function dB(e){const{apiClients:t}=tr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e);return co({queryKey:[e],queryFn:async()=>(await t.notebooks.getNotebook(n,r,a,o)).data})}function DRe(e){const{apiClients:t}=tr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri),i=dB(e.resourceUri),s=C.useCallback(async({index:l,givens:d,declaredTypes:u,signal:m})=>{const g=Jd(d,u);return(await t.notebooks.executeNotebookCell(n,r,a,l,o,void 0,void 0,Object.keys(g).length>0?JSON.stringify(g):void 0,{signal:m})).data},[t.notebooks,n,r,a,o]);return p.jsx(ARe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function JTe(e){const{data:t}=dB(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri);return p.jsx(t6,{manifest:{...t.dashboard,layout:"linear"},environmentName:n,packageName:r,versionId:o,documentName:a,givens:e.givens,onGivensChange:e.onGivensChange,onNavigate:e.onDrillNavigate,...e.onNavigate?{onLinkNavigate:e.onNavigate}:{},maxResultSize:e.maxResultSize})}return p.jsx(DRe,{...e})}function eEe(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>D1(a.path)===e),o=r.filter(a=>Z2(a)===n);return o.length===1?{found:v$(o[0])}:r.length===1?{found:v$(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const NRe=/^(dashboards|notebooks)\/([^/]+)$/;function tEe(e){const t=NRe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const sL="[publisher.report]",lL="[publisher.console]";function IRe(e){switch(e.type){case"report.load_failed":case"report.query_failed":case"report.save_refused":case"report.save_undo_refused":case"report.create_refused":return!0;case"report.rows_shown":return!e.ok;case"report.drill":return e.outcome==="unresolved"||e.outcome==="malformed";default:return!1}}function nEe(e){return t=>{const n={...e,...t,at:new Date().toISOString()};IRe(t)?console.warn(sL,n):console.info(sL,n)}}function LRe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(lL,t):console.warn(lL,t)}const Lo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:hr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:hr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:hr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:hr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},Wb='"Inter", "Helvetica Neue", "Arial", sans-serif',Ho={50:Lo.offWhite,100:"#F1F5F9",200:Lo.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Lo.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Lo.black},rEe={headerHeight:56},cL="0 1px 3px rgba(0, 0, 0, 0.1)",zRe="#0f172a",FRe="#1e293b",_Re="#f1f5f9",BRe="#cbd5e1",URe="#334155",fB=(e="light",t)=>{const n=e==="dark",r=n?zRe:Lo.white,o=n?FRe:Lo.white,a=n?_Re:Lo.black,i=n?BRe:Lo.grey.mid,s=n?URe:Lo.grey.light,{accent:l,accentHover:d,accentContrast:u}=t??Ik(void 0,e);return Tx({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:l,light:Lo.grey.light,dark:d,contrastText:u},secondary:{main:Lo.grey.mid,light:Lo.grey.light,dark:Lo.black},grey:Ho,success:Lo.semantic.success,warning:Lo.semantic.warning,error:Lo.semantic.error,info:Lo.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:Wb,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:6},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0},styleOverrides:{root:{"&:focus-visible":{outline:`2px solid ${l}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Ho[300]} ${Ho[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Ho[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Ho[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Ho[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Ho[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Ho[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Ho[300],border:"none",borderRadius:"4px"}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:6,textTransform:"none",fontWeight:500,fontSize:13,minHeight:32,paddingTop:0,paddingBottom:0,boxShadow:"none","&:hover":{boxShadow:"none"}},sizeSmall:{minHeight:32,paddingLeft:10,paddingRight:10},sizeMedium:{minHeight:32,paddingLeft:12,paddingRight:12},contained:{"&:hover":{boxShadow:"none"},"&.Mui-disabled":{backgroundColor:n?"rgba(255, 255, 255, 0.06)":Ho[200],color:n?"#64748b":Ho[500]}},outlined:{color:a,borderColor:n?"#475569":Ho[300],"&:hover":{borderColor:n?"#64748b":Ho[400],backgroundColor:n?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:6}}},MuiPopover:{styleOverrides:{paper:{borderRadius:8}}},MuiCard:{styleOverrides:{root:{borderRadius:8,boxShadow:cL,border:"1px solid",borderColor:s,backgroundColor:o}}},MuiChip:{styleOverrides:{root:{borderRadius:6,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:6},"& .MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:12,backgroundColor:o,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiSelect:{styleOverrides:{select:{fontFamily:Wb,fontSize:"0.875rem",color:a}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${n?Ho[600]:Ho[300]}`,borderRadius:6,transition:`border-color ${Zy} ease-in`,...Jy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Ho[400]},"&.Mui-focused":{borderColor:n?Ho[400]:Ho[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:Wb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:Wb}}},MuiMenu:{styleOverrides:{paper:{borderRadius:8,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${s}`,backgroundColor:o,color:a}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Ho[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:6,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.08)":Lo.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":Lo.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":Lo.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:cL}}}}})};fB("light");function qRe({children:e}){const{mode:t,theme:n}=Vr(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>fB(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return p.jsxs(r7,{theme:i,children:[p.jsx(dQ,{}),e]})}const HRe=C.lazy(()=>wo(()=>import("./HomePage-BOb2eaod.js"),[])),VRe=C.lazy(()=>wo(()=>import("./MainPage-D6QvMDBc.js"),__vite__mapDeps([7,8,9,10]))),WRe=C.lazy(()=>wo(()=>import("./PackageSplatRoute-BBPH3864.js").then(e=>e.a),__vite__mapDeps([11,10]))),YRe=C.lazy(()=>wo(()=>import("./PackagePage-CpahRMLt.js"),__vite__mapDeps([12,9,10,13]))),GRe=C.lazy(()=>wo(()=>import("./EnvironmentPage-B74sWMJb.js"),[])),KRe=C.lazy(()=>wo(()=>import("./RouteError-r7ydeLAE.js"),[])),QRe=C.lazy(()=>wo(()=>import("./ThemeEditorPage-dxaIYM0S.js"),__vite__mapDeps([14,15]))),XRe=(e="/",t=new CRe,n)=>(p1e(LRe),KH([{path:e,element:p.jsx(qre,{children:p.jsx(uxe,{documentStorage:t,children:p.jsx(qRe,{children:p.jsx(C.Suspense,{fallback:p.jsx(Bo,{}),children:p.jsx(VRe,{headerProps:n})})})})}),errorElement:p.jsx(KRe,{}),children:[{index:!0,element:p.jsx(HRe,{})},{path:"settings/theme",element:p.jsx(QRe,{})},{path:"settings",element:p.jsx(CH,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:p.jsx(GRe,{})},{path:":environmentName/:packageName",element:p.jsx(YRe,{})},{path:":environmentName/:packageName/*",element:p.jsx(WRe,{})}]}])),ZRe=XRe("/");NU.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(lV,{router:ZRe})}));export{n2e as $,e2e as A,is as B,Ay as C,kxe as D,C_ as E,Xy as F,R0e as G,Te as H,TR as I,ro as J,Br as K,AR as L,dz as M,tr as N,zd as O,Qa as P,tu as Q,Vr as R,rk as S,wt as T,mz as U,ml as V,Ci as W,oee as X,rEe as Y,KTe as Z,VTe as _,wn as a,L_ as a$,Bo as a0,lo as a1,Vn as a2,kn as a3,wo as a4,nEe as a5,CH as a6,I1 as a7,XTe as a8,cRe as a9,Jne as aA,k_ as aB,k2e as aC,gTe as aD,_le as aE,PTe as aF,p0e as aG,MTe as aH,yTe as aI,Ble as aJ,bTe as aK,Ple as aL,mTe as aM,vTe as aN,Zd as aO,mF as aP,wl as aQ,hF as aR,f1 as aS,uc as aT,RTe as aU,qle as aV,uF as aW,rTe as aX,Z2e as aY,xTe as aZ,b$ as a_,GTe as aa,dH as ab,O0 as ac,Yn as ad,_P as ae,Ri as af,DR as ag,C4 as ah,Lk as ai,ea as aj,Tl as ak,a0 as al,DK as am,zK as an,hh as ao,Oo as ap,kae as aq,su as ar,ux as as,jd as at,ji as au,e1 as av,mae as aw,JRe as ax,A$ as ay,Sl as az,sl as b,OTe as b$,LTe as b0,D1 as b1,Pd as b2,I_ as b3,co as b4,ITe as b5,Kk as b6,U0 as b7,ATe as b8,ja as b9,jTe as bA,NTe as bB,pxe as bC,CTe as bD,dxe as bE,qTe as bF,TTe as bG,b2 as bH,Ybe as bI,X0 as bJ,$_ as bK,B_ as bL,b0e as bM,Gbe as bN,Qbe as bO,aTe as bP,Kbe as bQ,j1 as bR,ble as bS,lxe as bT,B2e as bU,G2e as bV,rae as bW,V2e as bX,W2e as bY,Y2e as bZ,Q2e as b_,kTe as ba,sxe as bb,VN as bc,Zy as bd,Jt as be,wi as bf,pTe as bg,vl as bh,nTe as bi,rle as bj,iF as bk,ile as bl,cF as bm,fTe as bn,T_ as bo,qbe as bp,i0e as bq,s0e as br,R_ as bs,N1 as bt,BTe as bu,E_ as bv,txe as bw,O_ as bx,DTe as by,oce as bz,Za as c,zTe as c$,OA as c0,pF as c1,d2 as c2,tTe as c3,eTe as c4,nle as c5,Jse as c6,Jy as c7,Hbe as c8,Vbe as c9,Zle as cA,oTe as cB,lTe as cC,cTe as cD,H2e as cE,Qx as cF,sTe as cG,iTe as cH,dTe as cI,X2e as cJ,P_ as cK,N4 as cL,oae as cM,fF as cN,h1 as cO,wTe as cP,gK as cQ,vC as cR,K2e as cS,U2e as cT,gle as cU,Ule as cV,nT as cW,rxe as cX,nxe as cY,FTe as cZ,eT as c_,J2e as ca,Tg as cb,A0e as cc,Up as cd,oQ as ce,hTe as cf,SF as cg,uTe as ch,dle as ci,WN as cj,sle as ck,Cz as cl,Wy as cm,Ele as cn,Tle as co,oh as cp,Lx as cq,ple as cr,W0e as cs,UTe as ct,_Te as cu,Bz as cv,STe as cw,xF as cx,Hle as cy,q2e as cz,_t as d,J0e as d0,A_ as d1,X0e as d2,exe as d3,cxe as d4,ay as d5,_r as d6,T0e as d7,E0e as d8,S_ as d9,WTe as da,JTe as db,B$e as dc,t2e as dd,$Te as de,HTe as df,tEe as dg,eEe as dh,GL as di,Fo as dj,ZTe as dk,wu as dl,YTe as dm,Xxe as dn,QTe as dp,P0 as dq,k0e as dr,$0e as ds,JC as e,vn as f,yn as g,gc as h,zs as i,p as j,uo as k,Kd as l,dn as m,F5 as n,lc as o,H5 as p,Bp as q,C as r,ct as s,Fy as t,Sn as u,_5 as v,Ln as w,lt as x,Aa as y,hs as z};