@malloy-publisher/app 0.16.0 → 0.17.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.
- package/dist/api-doc.yaml +266 -43
- package/dist/assets/{EnvironmentPage-Y9IWPC9J.js → EnvironmentPage-D2-0ts2G.js} +1 -1
- package/dist/assets/{HomePage-BOUo0MEl.js → HomePage-S_Bkczsx.js} +1 -1
- package/dist/assets/{MainPage-BkM5UDRU.js → MainPage-DEy4SyjJ.js} +1 -1
- package/dist/assets/{ModelPage-PgDTkS5C.js → ModelPage-BVHjDM-u.js} +2 -2
- package/dist/assets/{PackagePage-Dn7FrQ5r.js → PackagePage-Cbrg7o1X.js} +1 -1
- package/dist/assets/{PackageSplatRoute-BLC29ek-.js → PackageSplatRoute-ChFCJOWE.js} +2 -2
- package/dist/assets/{RenderedResult-vyM2wQbC.es-ha8dF24T.js → RenderedResult-BcEDcw0V.es-BD6PNbt6.js} +1 -1
- package/dist/assets/{RouteError-BolMqTuz.js → RouteError-CDSSYdLB.js} +1 -1
- package/dist/assets/{ThemeEditorPage-CPv1eHkI.js → ThemeEditorPage-DO2JWYOR.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-DZtImN0S.js → ToggleButtonGroup-BylAiUaK.js} +1 -1
- package/dist/assets/{documentRoutes-DI5cX3ty.js → documentRoutes-CaOt2rpR.js} +1 -1
- package/dist/assets/{editPageMounted-C--4kcld.js → editPageMounted-79YCIKgP.js} +2 -2
- package/dist/assets/{index-DLToSg1f.js → index-BKjEX4_C.js} +10 -10
- package/dist/assets/{index-DyYEltlF.js → index-BOCBPBsi.js} +1 -1
- package/dist/assets/{index-D9wSfMZN.js → index-CPSEdm5f.js} +1 -1
- package/dist/assets/{index-CbsrzNSp.js → index-keJ8KKBp.js} +1 -1
- package/dist/assets/{index.es-D8SVyfmS.js → index.es-DTreXoC5.js} +1 -1
- package/dist/assets/usePackageLinkNavigate-BfSAqkJS.js +1 -0
- package/dist/assets/{usePackageRoute-A_YQMrax.js → usePackageRoute-G6fA1__J.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/mcp-app/report.js +4 -4
- package/package.json +2 -2
- package/dist/assets/usePackageLinkNavigate-DxHGKrmZ.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CPSEdm5f.js","assets/index-B0BUzE-t.js","assets/index-keJ8KKBp.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-BOCBPBsi.js","assets/index-Co7C9Gew.js","assets/MainPage-DEy4SyjJ.js","assets/editPageMounted-79YCIKgP.js","assets/documentRoutes-CaOt2rpR.js","assets/usePackageRoute-G6fA1__J.js","assets/PackageSplatRoute-ChFCJOWE.js","assets/PackagePage-Cbrg7o1X.js","assets/usePackageLinkNavigate-BfSAqkJS.js","assets/ThemeEditorPage-DO2JWYOR.js","assets/ToggleButtonGroup-BylAiUaK.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function lL(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 LRe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function j$(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vS={exports:{}},Tm={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -271,7 +271,7 @@ export default theme;`}function MP(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=Ud(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&s0.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}:s0.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),s0.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(i4.concat("common"),x=>{delete a[x]}),n.headers=xa.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||YR;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=Ud(this.defaults,t);const n=u4(t.baseURL,t.url,t.allowAbsoluteUrls,t);return n4(n,t.params,t.paramsSerializer)}};De.forEach(["delete","get","head","options"],function(t){Td.prototype[t]=function(n,r){return this.request(Ud(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(Ud(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 Fne=class m4{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 Hy(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 m4(function(o){t=o}),cancel:t}}};function _ne(e){return function(n){return e.apply(null,n)}}function Une(e){return De.isObject(e)&&e.isAxiosError===!0}const l0={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(l0).forEach(([e,t])=>{l0[t]===void 0&&(l0[t]=e)});function g4(e){const t=new Td(e),n=_z(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 g4(Ud(e,o))},n}const At=g4(Vy);At.Axios=Td;At.CanceledError=Hy;At.CancelToken=Fne;At.isCancel=s4;At.VERSION=KR;At.toFormData=qx;At.AxiosError=Wt;At.Cancel=At.CanceledError;At.all=function(t){return Promise.all(t)};At.spread=_ne;At.isAxiosError=Une;At.mergeConfig=Ud;At.AxiosHeaders=xa;At.formToJSON=e=>a4(De.isHTMLForm(e)?new FormData(e):e);At.getAdapter=h4.getAdapter;At.HttpStatusCode=l0;At.default=At;const{Axios:qRe,AxiosError:WRe,CanceledError:YRe,isCancel:GRe,CancelToken:KRe,VERSION:QRe,all:XRe,Cancel:ZRe,isAxiosError:JRe,spread:eTe,toFormData:tTe,AxiosHeaders:nTe,HttpStatusCode:rTe,formToJSON:oTe,getAdapter:aTe,mergeConfig:iTe,create:sTe}=At,dA="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",bi={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:dA}},font:{mono:dA},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function Bne(e){if(!e)return bi;const t={...bi.font,...e.font},n={...bi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...bi.radius,...e.radius},size:{...bi.size,...e.size},type:n,font:t,shadow:{...bi.shadow,...e.shadow}}}const pr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490",slate:"#475569"},XR={environment:pr.emerald,package:pr.teal,connection:pr.orange},Fo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',Vne=ct(AK)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),Hne=ct(LK)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),y4=ct(VK)({padding:"0"}),v4=ct("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),qne=ct("div")({height:"100%"}),b4=ct("div")({height:"75vh",width:"100%",overflowY:"auto"}),Wne={light:{accent:pr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},Yne={light:"#ffffff",dark:"#0f172a"},Gne=3,Fg=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))},x4=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,jk=(e,t,n)=>x4(e.map(r=>r+(t-r)*n)),Ak=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},I0=(e,t)=>{const[n,r]=[Ak(e),Ak(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},Kne=[15,23,42];function Dk(e,t,n=Gne){const r=Fg(e),o=Fg(t);if(!r||!o||I0(r,o)>=n)return e;const a=Ak(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=Fg(jk(r,a,i));if(s&&I0(s,o)>=n)return x4(s)}return a===255?"#ffffff":"#000000"}function Nk(e,t,n=Yne[t]){const r=Wne[t];if(!e||e.toLowerCase()===pr.blue)return r;if(!Fg(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=Dk(e,n),a=Fg(o),i=t==="dark"?jk(a,255,.25):jk(a,0,.2),s=I0(a,[255,255,255]),l=I0(a,Kne);return{accent:o,accentHover:i,accentContrast:s>=l?"#ffffff":"#0f172a"}}const Qne=[pr.blue,pr.orange,pr.emerald,pr.pink,pr.violet,pr.amber,pr.cyan,pr.lime],Xne="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Ik={palette:{series:Qne,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:pr.blue,dark:pr.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:Xne,size:12}},Zne=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function w4(e,t){const n=Ik.palette??{},r=Ik.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 Zne){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")?Dk(l.mapColor.light,g):m("mapColor");return{mode:t,ui:bi,series:u&&a?o.map(x=>Dk(x,g)):o,...Nk(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:Nk(void 0,t).accent}}function lTe(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,Ik.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 Jne(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const S4=C.createContext(void 0);function ere({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),l=C.useMemo(()=>Bne(a),[s]),d=C.useMemo(()=>({...w4(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(S4.Provider,{value:u,children:i})}function qr(){return C.useContext(S4)||{theme:w4([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const tn="http://localhost/api/v0".replace(/\/+$/,"");let Za=class{constructor(t,n=tn,r=At){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},tre=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const rn={},on="https://example.com",Ye=function(e,t,n){if(n==null)throw new tre(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Lk(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>Lk(e,r,n)):Object.keys(t).forEach(r=>Lk(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const an=function(e,...t){const n=new URLSearchParams(e.search);Lk(n,t),e.search=n.toString()},nre=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:{},nre):e||""},sn=function(e){return e.pathname+e.search+e.hash},ln=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)}},C4={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},fA={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},ba={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Sb={Version:"version",Package:"package"},rre=function(e){return{getAgent:async(t,n,r,o,a,i={})=>{Ye("getAgent","environmentName",t),Ye("getAgent","packageName",n),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}},getAgentSkillFile:async(t,n,r,o,a,i={})=>{Ye("getAgentSkillFile","environmentName",t),Ye("getAgentSkillFile","packageName",n),Ye("getAgentSkillFile","agentName",r),Ye("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,on);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m.Accept="application/json",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}},listAgents:async(t,n,r,o={})=>{Ye("listAgents","environmentName",t),Ye("listAgents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/agents".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},XS=function(e){const t=rre(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=rn["AgentsApi.getAgent"]?.[d]?.url;return(m,g)=>ln(l,At,tn,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=rn["AgentsApi.getAgentSkillFile"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async listAgents(n,r,o,a){const i=await t.listAgents(n,r,o,a),s=e?.serverIndex??0,l=rn["AgentsApi.listAgents"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let ore=class extends Za{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 are=function(e){return{createConnection:async(t,n,r,o={})=>{Ye("createConnection","environmentName",t),Ye("createConnection","connectionName",n),Ye("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},deleteConnection:async(t,n,r={})=>{Ye("deleteConnection","environmentName",t),Ye("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},getConnection:async(t,n,r={})=>{Ye("getConnection","environmentName",t),Ye("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},getTable:async(t,n,r,o,a={})=>{Ye("getTable","environmentName",t),Ye("getTable","connectionName",n),Ye("getTable","schemaName",r),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{Ye("getTableInPackage","environmentName",t),Ye("getTableInPackage","packageName",n),Ye("getTableInPackage","connectionName",r),Ye("getTableInPackage","schemaName",o),Ye("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,on);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},listConnections:async(t,n={})=>{Ye("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},listSchemas:async(t,n,r={})=>{Ye("listSchemas","environmentName",t),Ye("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{Ye("listSchemasInPackage","environmentName",t),Ye("listSchemasInPackage","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listTables:async(t,n,r,o,a={})=>{Ye("listTables","environmentName",t),Ye("listTables","connectionName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o&&(m.tableNames=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{Ye("listTablesInPackage","environmentName",t),Ye("listTablesInPackage","packageName",n),Ye("listTablesInPackage","connectionName",r),Ye("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,on);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",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},postQuerydata:async(t,n,r,o={})=>{Ye("postQuerydata","environmentName",t),Ye("postQuerydata","connectionName",n),Ye("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{Ye("postQuerydataInPackage","environmentName",t),Ye("postQuerydataInPackage","packageName",n),Ye("postQuerydataInPackage","connectionName",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},postSqlsource:async(t,n,r,o={})=>{Ye("postSqlsource","environmentName",t),Ye("postSqlsource","connectionName",n),Ye("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{Ye("postSqlsourceInPackage","environmentName",t),Ye("postSqlsourceInPackage","packageName",n),Ye("postSqlsourceInPackage","connectionName",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},postTemporarytable:async(t,n,r,o={})=>{Ye("postTemporarytable","environmentName",t),Ye("postTemporarytable","connectionName",n),Ye("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{Ye("postTemporarytableInPackage","environmentName",t),Ye("postTemporarytableInPackage","packageName",n),Ye("postTemporarytableInPackage","connectionName",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},updateConnection:async(t,n,r,o={})=>{Ye("updateConnection","environmentName",t),Ye("updateConnection","connectionName",n),Ye("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}}}},sa=function(e){const t=are(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.createConnection"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=rn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=rn["ConnectionsApi.getConnection"]?.[i]?.url;return(l,d)=>ln(a,At,tn,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=rn["ConnectionsApi.getTable"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=rn["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=rn["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,d)=>ln(a,At,tn,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=rn["ConnectionsApi.listSchemasInPackage"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ConnectionsApi.listTables"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.postQuerydata"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["ConnectionsApi.postQuerydataInPackage"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.postSqlsource"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["ConnectionsApi.postSqlsourceInPackage"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["ConnectionsApi.postTemporarytableInPackage"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.updateConnection"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let ire=class extends Za{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 sre=function(e){return{getDashboard:async(t,n,r,o,a={})=>{Ye("getDashboard","environmentName",t),Ye("getDashboard","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listDashboards:async(t,n,r,o={})=>{Ye("listDashboards","environmentName",t),Ye("listDashboards","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/dashboards".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},pA=function(e){const t=sre(e);return{async getDashboard(n,r,o,a,i){const s=await t.getDashboard(n,r,o,a,i),l=e?.serverIndex??0,d=rn["DashboardsApi.getDashboard"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async listDashboards(n,r,o,a){const i=await t.listDashboards(n,r,o,a),s=e?.serverIndex??0,l=rn["DashboardsApi.listDashboards"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};class lre extends Za{getDashboard(t,n,r,o,a){return pA(this.configuration).getDashboard(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listDashboards(t,n,r,o){return pA(this.configuration).listDashboards(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const cre=function(e){return{listDataApps:async(t,n,r,o={})=>{Ye("listDataApps","environmentName",t),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},ure=function(e){const t=cre(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,l=rn["DataAppsApi.listDataApps"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let dre=class extends Za{listDataApps(t,n,r,o){return ure(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const fre=function(e){return{listDatabases:async(t,n,r,o={})=>{Ye("listDatabases","environmentName",t),Ye("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},pre=function(e){const t=fre(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=rn["DatabasesApi.listDatabases"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let hre=class extends Za{listDatabases(t,n,r,o){return pre(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const mre=function(e){return{createEnvironment:async(t,n={})=>{Ye("createEnvironment","environment",t);const r="/environments",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:sn(o),options:i}},deleteEnvironment:async(t,n={})=>{Ye("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},l={};s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},getEnvironment:async(t,n,r={})=>{Ye("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};n!==void 0&&(d.reload=n),l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},updateEnvironment:async(t,n,r={})=>{Ye("updateEnvironment","environmentName",t),Ye("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},d={};l["Content-Type"]="application/json",l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},s.data=Mo(n,s,e),{url:sn(a),options:s}}}},Bm=function(e){const t=mre(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=rn["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=rn["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=rn["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=rn["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=rn["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)}}};let gre=class extends Za{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 yre=function(e){return{createMaterialization:async(t,n,r,o={})=>{Ye("createMaterialization","environmentName",t),Ye("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},deleteMaterialization:async(t,n,r,o,a={})=>{Ye("deleteMaterialization","environmentName",t),Ye("deleteMaterialization","packageName",n),Ye("deleteMaterialization","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,on);let l;e&&(l=e.baseOptions);const d={method:"DELETE",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},dropMaterializedTable:async(t,n,r,o,a,i,s={})=>{Ye("dropMaterializedTable","environmentName",t),Ye("dropMaterializedTable","packageName",n),Ye("dropMaterializedTable","connectionName",r),Ye("dropMaterializedTable","tableName",o);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/materializedTables/{tableName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{tableName}",encodeURIComponent(String(o))),d=new URL(l,on);let u;e&&(u=e.baseOptions);const m={method:"DELETE",...u,...s},g={},y={};a!==void 0&&(y.materializationId=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},getMaterialization:async(t,n,r,o,a={})=>{Ye("getMaterialization","environmentName",t),Ye("getMaterialization","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listMaterializations:async(t,n,r,o,a,i={})=>{Ye("listMaterializations","environmentName",t),Ye("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(s,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{Ye("materializationAction","environmentName",t),Ye("materializationAction","packageName",n),Ye("materializationAction","materializationId",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}}}},np=function(e){const t=yre(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,l=rn["MaterializationsApi.createMaterialization"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async deleteMaterialization(n,r,o,a,i){const s=await t.deleteMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=rn["MaterializationsApi.deleteMaterialization"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async dropMaterializedTable(n,r,o,a,i,s,l){const d=await t.dropMaterializedTable(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=rn["MaterializationsApi.dropMaterializedTable"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=rn["MaterializationsApi.getMaterialization"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["MaterializationsApi.listMaterializations"]?.[d]?.url;return(m,g)=>ln(l,At,tn,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=rn["MaterializationsApi.materializationAction"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)}}};let vre=class extends Za{createMaterialization(t,n,r,o){return np(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a){return np(this.configuration).deleteMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}dropMaterializedTable(t,n,r,o,a,i,s){return np(this.configuration).dropMaterializedTable(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return np(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return np(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return np(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const bre={Stop:"stop"},xre=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{Ye("compileModelSource","environmentName",t),Ye("compileModelSource","packageName",n),Ye("compileModelSource","path",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},executeQueryModel:async(t,n,r,o,a,i={})=>{Ye("executeQueryModel","environmentName",t),Ye("executeQueryModel","packageName",n),Ye("executeQueryModel","path",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},getModel:async(t,n,r,o,a,i,s={})=>{Ye("getModel","environmentName",t),Ye("getModel","packageName",n),Ye("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,on);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",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},listModels:async(t,n,r,o,a={})=>{Ye("listModels","environmentName",t),Ye("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,on);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",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},updateModelSource:async(t,n,r,o,a,i={})=>{Ye("updateModelSource","environmentName",t),Ye("updateModelSource","packageName",n),Ye("updateModelSource","path",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}}}},Vm=function(e){const t=xre(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=rn["ModelsApi.compileModelSource"]?.[d]?.url;return(m,g)=>ln(l,At,tn,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=rn["ModelsApi.executeQueryModel"]?.[d]?.url;return(m,g)=>ln(l,At,tn,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=rn["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>ln(d,At,tn,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=rn["ModelsApi.listModels"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ModelsApi.updateModelSource"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)}}};let wre=class extends Za{compileModelSource(t,n,r,o,a,i){return Vm(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i){return Vm(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 Vm(this.configuration).getModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listModels(t,n,r,o,a){return Vm(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return Vm(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Sre=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,s,l,d={})=>{Ye("executeNotebookCell","environmentName",t),Ye("executeNotebookCell","packageName",n),Ye("executeNotebookCell","path",r),Ye("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,on);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",an(m,w);let S=g&&g.headers?g.headers:{};return y.headers={...x,...S,...d.headers},{url:sn(m),options:y}},getNotebook:async(t,n,r,o,a={})=>{Ye("getNotebook","environmentName",t),Ye("getNotebook","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listNotebooks:async(t,n,r,o={})=>{Ye("listNotebooks","environmentName",t),Ye("listNotebooks","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},ZS=function(e){const t=Sre(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=rn["NotebooksApi.executeNotebookCell"]?.[g]?.url;return(x,w)=>ln(m,At,tn,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=rn["NotebooksApi.getNotebook"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,l=rn["NotebooksApi.listNotebooks"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let Cre=class extends Za{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 kre=function(e){return{createPackage:async(t,n,r,o={})=>{Ye("createPackage","environmentName",t),Ye("createPackage","_package",n);const a="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),i=new URL(a,on);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",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(n,l,e),{url:sn(i),options:l}},deletePackage:async(t,n,r={})=>{Ye("deletePackage","environmentName",t),Ye("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Ye("getPackage","environmentName",t),Ye("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,on);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",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},getPackageBuildPlan:async(t,n,r,o={})=>{Ye("getPackageBuildPlan","environmentName",t),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageClassification:async(t,n,r,o={})=>{Ye("getPackageClassification","environmentName",t),Ye("getPackageClassification","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/classification".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageEmbeddingIndex:async(t,n,r,o={})=>{Ye("getPackageEmbeddingIndex","environmentName",t),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageEntities:async(t,n,r,o,a={})=>{Ye("getPackageEntities","environmentName",t),Ye("getPackageEntities","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/entities".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,on);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",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},getPackageStatus:async(t,n,r,o={})=>{Ye("getPackageStatus","environmentName",t),Ye("getPackageStatus","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/status".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},listPackages:async(t,n={})=>{Ye("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},updatePackage:async(t,n,r,o={})=>{Ye("updatePackage","environmentName",t),Ye("updatePackage","packageName",n),Ye("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}}}},nl=function(e){const t=kre(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.createPackage"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=rn["PackagesApi.deletePackage"]?.[i]?.url;return(l,d)=>ln(a,At,tn,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=rn["PackagesApi.getPackage"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async getPackageBuildPlan(n,r,o,a){const i=await t.getPackageBuildPlan(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageBuildPlan"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async getPackageClassification(n,r,o,a){const i=await t.getPackageClassification(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageClassification"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async getPackageEmbeddingIndex(n,r,o,a){const i=await t.getPackageEmbeddingIndex(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageEmbeddingIndex"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["PackagesApi.getPackageEntities"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async getPackageStatus(n,r,o,a){const i=await t.getPackageStatus(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageStatus"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=rn["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.updatePackage"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let $re=class extends Za{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 Rre=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};t!==void 0&&(l.includeLoading=t),s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},updateTheme:async(t,n={})=>{Ye("updateTheme","theme",t);const r="/theme",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:sn(o),options:i}}}},Cb=function(e){const t=Rre(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=rn["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=rn["PublisherApi.getStatus"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=rn["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=rn["PublisherApi.updateTheme"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)}}};let Tre=class extends Za{deleteTheme(t){return Cb(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return Cb(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return Cb(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return Cb(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Ere=function(e){return{getReport:async(t,n,r,o,a={})=>{Ye("getReport","environmentName",t),Ye("getReport","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listReports:async(t,n,r,o={})=>{Ye("listReports","environmentName",t),Ye("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},hA=function(e){const t=Ere(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),l=e?.serverIndex??0,d=rn["ReportsApi.getReport"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,l=rn["ReportsApi.listReports"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let Mre=class extends Za{getReport(t,n,r,o,a){return hA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return hA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ore=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{Ye("deletePackageVersion","environmentName",t),Ye("deletePackageVersion","packageName",n),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"DELETE",...s,...o},d={},u={};d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageVersion:async(t,n,r,o={})=>{Ye("getPackageVersion","environmentName",t),Ye("getPackageVersion","packageName",n),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},listPackageVersions:async(t,n,r={})=>{Ye("listPackageVersions","environmentName",t),Ye("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{Ye("setPackageLatestVersion","environmentName",t),Ye("setPackageLatestVersion","packageName",n),Ye("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"PUT",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},setPackageVersionManifest:async(t,n,r,o,a={})=>{Ye("setPackageVersionManifest","environmentName",t),Ye("setPackageVersionManifest","packageName",n),Ye("setPackageVersionManifest","version",r),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"PUT",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:sn(s),options:d}},updatePackageVersion:async(t,n,r,o,a={})=>{Ye("updatePackageVersion","environmentName",t),Ye("updatePackageVersion","packageName",n),Ye("updatePackageVersion","version",r),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"PATCH",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:sn(s),options:d}}}},rp=function(e){const t=Ore(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,l=rn["VersionsApi.deletePackageVersion"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,l=rn["VersionsApi.getPackageVersion"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=rn["VersionsApi.listPackageVersions"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,l=rn["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["VersionsApi.setPackageVersionManifest"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["VersionsApi.updatePackageVersion"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)}}};let Pre=class extends Za{deletePackageVersion(t,n,r,o){return rp(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return rp(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return rp(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return rp(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return rp(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return rp(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const jre=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},startWatching:async(t,n={})=>{Ye("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:sn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{Ye("streamPackageEvents","environmentName",t),Ye("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);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",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},kb=function(e){const t=jre(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=rn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=rn["WatchModeApi.startWatching"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=rn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,l=rn["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let Are=class extends Za{getWatchStatus(t){return kb(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return kb(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return kb(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return kb(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Dre=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 ZR=new Tee({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),Nre={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function Ire(e,t){return t||e?.modelPage==="viewer"?"viewer":"explorer"}function Lre(e){return{modelPage:Ire(e.data,e.isError&&e.data===void 0),isLoadingStatus:e.isPending}}const zk="publisher:themeMode";function zre(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(zk);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function Fre(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(zk):window.localStorage.setItem(zk,e)}catch{}}function _re(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}At.defaults.baseURL||(At.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const k4=C.createContext(void 0),Ure=(e,t,n)=>{const r=`${window.location.protocol}//${window.location.host}/api/v0`,o=At.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 Dre({basePath:r});return{models:new wre(a,r,o),publisher:new Tre(a,r,o),environments:new gre(a,r,o),packages:new $re(a,r,o),agents:new ore(a,r,o),dashboards:new lre(a,r,o),dataApps:new dre(a,r,o),notebooks:new Cre(a,r,o),reports:new Mre(a,r,o),connections:new ire(a,r,o),databases:new hre(a,r,o),materializations:new vre(a,r,o),watchMode:new Are(a,r,o),versions:new Pre(a,r,o)}},Bre=e=>p.jsx(Eee,{client:ZR,children:p.jsx(Vre,{...e})}),Vre=({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}=Lre(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(zre),[k,T]=C.useState(_re);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),Fre(L)},[]),P=g?.allowUserToggle??!0,D=P?b:void 0,A=C.useMemo(()=>s??Jne(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(k4.Provider,{value:F,children:p.jsx(ere,{layers:S,mode:A,userChoice:D,setMode:O,allowUserToggle:P&&s===void 0,...a?{ui:a}:{},children:e})})},Jn=()=>{const e=C.useContext(k4);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 Hre=["children","options"],mA=["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"}),gA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},qre=["style","script","pre"],Wre=["src","href","data","formAction","srcDoc","action"],Yre=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Gre=/mailto:/i,Kre=/\n{2,}$/,yA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Qre=/^ *> ?/gm,Xre=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Zre=/^ {2,}\n/,Jre=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,vA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,bA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,eoe=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,toe=/^(?:\n *)*\n/,noe=/\r\n?/g,roe=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,ooe=/^\[\^([^\]]+)]/,aoe=/\f/g,ioe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,soe=/^\s*?\[(x|\s)\]/,xA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,wA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,SA=/^([^\n]+)\n *(=|-){3,} *\n/,JS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,loe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,CA=/^<!--[\s\S]*?(?:-->)/,coe=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,eC=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,uoe=/^\{.*\}$/,doe=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,foe=/^<([^ >]+@[^ >]+)>/,poe=/^<([^ >]+:\/[^ >]+)>/,hoe=/-([a-z])?/gi,kA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,moe=/^[^\n]+(?: \n|\n{2,})/,goe=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,yoe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,voe=/^\[([^\]]*)\] ?\[([^\]]*)\]/,boe=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,xoe=/\t/g,woe=/(^ *\||\| *$)/g,Soe=/^ *:-+: *$/,Coe=/^ *:-+ *$/,koe=/^ *-+: *$/,Yx=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,Gx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",$oe=RegExp(`^([*_])\\1${Yx(1)}${Gx}\\1\\1(?!\\1)`),Roe=RegExp(`^([*_])${Yx(0)}${Gx}\\1(?!\\1)`),Toe=RegExp(`^(==)${Yx(0)}${Gx}\\1`),Eoe=RegExp(`^(~~)${Yx(0)}${Gx}\\1`),Moe=/^(:[a-zA-Z0-9-_]+:)/,Ooe=/^\\([^0-9A-Za-z\s])/,Poe=/\\([^0-9A-Za-z\s])/g,joe=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Aoe=/^\n+/,Doe=/^([ \t]*)/,Noe=/(?:^|\n)( *)$/,JR="(?:\\d+\\.)",eT="(?:[*+-])";function $4(e){return"( *)("+(e===1?JR:eT)+") +"}const R4=$4(1),T4=$4(2);function E4(e){return RegExp("^"+(e===1?R4:T4))}const Ioe=E4(1),Loe=E4(2);function M4(e){return RegExp("^"+(e===1?R4:T4)+"[^\\n]*(?:\\n(?!\\1"+(e===1?JR:eT)+" )[^\\n]*)*(\\n|$)","gm")}const zoe=M4(1),Foe=M4(2);function O4(e){const t=e===1?JR:eT;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const P4=O4(1),j4=O4(2);function $A(e,t){const n=t===1,r=n?P4:j4,o=n?zoe:Foe,a=n?Ioe:Loe;return{t:i=>a.test(i),o:Wp(function(i,s){const l=Noe.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(Kre,`
|
|
274
|
+
`+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ud(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&s0.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}:s0.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),s0.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(i4.concat("common"),x=>{delete a[x]}),n.headers=xa.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||YR;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=Ud(this.defaults,t);const n=u4(t.baseURL,t.url,t.allowAbsoluteUrls,t);return n4(n,t.params,t.paramsSerializer)}};De.forEach(["delete","get","head","options"],function(t){Td.prototype[t]=function(n,r){return this.request(Ud(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(Ud(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 Fne=class m4{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 Hy(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 m4(function(o){t=o}),cancel:t}}};function _ne(e){return function(n){return e.apply(null,n)}}function Une(e){return De.isObject(e)&&e.isAxiosError===!0}const l0={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(l0).forEach(([e,t])=>{l0[t]===void 0&&(l0[t]=e)});function g4(e){const t=new Td(e),n=_z(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 g4(Ud(e,o))},n}const At=g4(Vy);At.Axios=Td;At.CanceledError=Hy;At.CancelToken=Fne;At.isCancel=s4;At.VERSION=KR;At.toFormData=qx;At.AxiosError=Wt;At.Cancel=At.CanceledError;At.all=function(t){return Promise.all(t)};At.spread=_ne;At.isAxiosError=Une;At.mergeConfig=Ud;At.AxiosHeaders=xa;At.formToJSON=e=>a4(De.isHTMLForm(e)?new FormData(e):e);At.getAdapter=h4.getAdapter;At.HttpStatusCode=l0;At.default=At;const{Axios:qRe,AxiosError:WRe,CanceledError:YRe,isCancel:GRe,CancelToken:KRe,VERSION:QRe,all:XRe,Cancel:ZRe,isAxiosError:JRe,spread:eTe,toFormData:tTe,AxiosHeaders:nTe,HttpStatusCode:rTe,formToJSON:oTe,getAdapter:aTe,mergeConfig:iTe,create:sTe}=At,dA="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",bi={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:dA}},font:{mono:dA},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function Bne(e){if(!e)return bi;const t={...bi.font,...e.font},n={...bi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...bi.radius,...e.radius},size:{...bi.size,...e.size},type:n,font:t,shadow:{...bi.shadow,...e.shadow}}}const pr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490",slate:"#475569"},XR={environment:pr.emerald,package:pr.teal,connection:pr.orange},Fo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',Vne=ct(AK)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),Hne=ct(LK)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),y4=ct(VK)({padding:"0"}),v4=ct("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),qne=ct("div")({height:"100%"}),b4=ct("div")({height:"75vh",width:"100%",overflowY:"auto"}),Wne={light:{accent:pr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},Yne={light:"#ffffff",dark:"#0f172a"},Gne=3,Fg=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))},x4=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,jk=(e,t,n)=>x4(e.map(r=>r+(t-r)*n)),Ak=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},I0=(e,t)=>{const[n,r]=[Ak(e),Ak(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},Kne=[15,23,42];function Dk(e,t,n=Gne){const r=Fg(e),o=Fg(t);if(!r||!o||I0(r,o)>=n)return e;const a=Ak(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=Fg(jk(r,a,i));if(s&&I0(s,o)>=n)return x4(s)}return a===255?"#ffffff":"#000000"}function Nk(e,t,n=Yne[t]){const r=Wne[t];if(!e||e.toLowerCase()===pr.blue)return r;if(!Fg(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=Dk(e,n),a=Fg(o),i=t==="dark"?jk(a,255,.25):jk(a,0,.2),s=I0(a,[255,255,255]),l=I0(a,Kne);return{accent:o,accentHover:i,accentContrast:s>=l?"#ffffff":"#0f172a"}}const Qne=[pr.blue,pr.orange,pr.emerald,pr.pink,pr.violet,pr.amber,pr.cyan,pr.lime],Xne="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Ik={palette:{series:Qne,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:pr.blue,dark:pr.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:Xne,size:12}},Zne=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function w4(e,t){const n=Ik.palette??{},r=Ik.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 Zne){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")?Dk(l.mapColor.light,g):m("mapColor");return{mode:t,ui:bi,series:u&&a?o.map(x=>Dk(x,g)):o,...Nk(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:Nk(void 0,t).accent}}function lTe(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,Ik.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 Jne(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const S4=C.createContext(void 0);function ere({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),l=C.useMemo(()=>Bne(a),[s]),d=C.useMemo(()=>({...w4(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(S4.Provider,{value:u,children:i})}function qr(){return C.useContext(S4)||{theme:w4([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const tn="http://localhost/api/v0".replace(/\/+$/,"");let Za=class{constructor(t,n=tn,r=At){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},tre=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const rn={},on="https://example.com",Ye=function(e,t,n){if(n==null)throw new tre(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Lk(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>Lk(e,r,n)):Object.keys(t).forEach(r=>Lk(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const an=function(e,...t){const n=new URLSearchParams(e.search);Lk(n,t),e.search=n.toString()},nre=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:{},nre):e||""},sn=function(e){return e.pathname+e.search+e.hash},ln=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)}},C4={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},fA={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},ba={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Sb={Version:"version",Package:"package"},rre=function(e){return{getAgent:async(t,n,r,o,a,i={})=>{Ye("getAgent","environmentName",t),Ye("getAgent","packageName",n),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}},getAgentSkillFile:async(t,n,r,o,a,i={})=>{Ye("getAgentSkillFile","environmentName",t),Ye("getAgentSkillFile","packageName",n),Ye("getAgentSkillFile","agentName",r),Ye("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,on);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m.Accept="application/json",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}},listAgents:async(t,n,r,o={})=>{Ye("listAgents","environmentName",t),Ye("listAgents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/agents".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},XS=function(e){const t=rre(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=rn["AgentsApi.getAgent"]?.[d]?.url;return(m,g)=>ln(l,At,tn,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=rn["AgentsApi.getAgentSkillFile"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async listAgents(n,r,o,a){const i=await t.listAgents(n,r,o,a),s=e?.serverIndex??0,l=rn["AgentsApi.listAgents"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let ore=class extends Za{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 are=function(e){return{createConnection:async(t,n,r,o={})=>{Ye("createConnection","environmentName",t),Ye("createConnection","connectionName",n),Ye("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},deleteConnection:async(t,n,r={})=>{Ye("deleteConnection","environmentName",t),Ye("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},getConnection:async(t,n,r={})=>{Ye("getConnection","environmentName",t),Ye("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},getTable:async(t,n,r,o,a={})=>{Ye("getTable","environmentName",t),Ye("getTable","connectionName",n),Ye("getTable","schemaName",r),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{Ye("getTableInPackage","environmentName",t),Ye("getTableInPackage","packageName",n),Ye("getTableInPackage","connectionName",r),Ye("getTableInPackage","schemaName",o),Ye("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,on);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},listConnections:async(t,n={})=>{Ye("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},listSchemas:async(t,n,r={})=>{Ye("listSchemas","environmentName",t),Ye("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{Ye("listSchemasInPackage","environmentName",t),Ye("listSchemasInPackage","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listTables:async(t,n,r,o,a={})=>{Ye("listTables","environmentName",t),Ye("listTables","connectionName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o&&(m.tableNames=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{Ye("listTablesInPackage","environmentName",t),Ye("listTablesInPackage","packageName",n),Ye("listTablesInPackage","connectionName",r),Ye("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,on);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",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},postQuerydata:async(t,n,r,o={})=>{Ye("postQuerydata","environmentName",t),Ye("postQuerydata","connectionName",n),Ye("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{Ye("postQuerydataInPackage","environmentName",t),Ye("postQuerydataInPackage","packageName",n),Ye("postQuerydataInPackage","connectionName",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},postSqlsource:async(t,n,r,o={})=>{Ye("postSqlsource","environmentName",t),Ye("postSqlsource","connectionName",n),Ye("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{Ye("postSqlsourceInPackage","environmentName",t),Ye("postSqlsourceInPackage","packageName",n),Ye("postSqlsourceInPackage","connectionName",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},postTemporarytable:async(t,n,r,o={})=>{Ye("postTemporarytable","environmentName",t),Ye("postTemporarytable","connectionName",n),Ye("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{Ye("postTemporarytableInPackage","environmentName",t),Ye("postTemporarytableInPackage","packageName",n),Ye("postTemporarytableInPackage","connectionName",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},updateConnection:async(t,n,r,o={})=>{Ye("updateConnection","environmentName",t),Ye("updateConnection","connectionName",n),Ye("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}}}},sa=function(e){const t=are(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.createConnection"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=rn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=rn["ConnectionsApi.getConnection"]?.[i]?.url;return(l,d)=>ln(a,At,tn,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=rn["ConnectionsApi.getTable"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=rn["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=rn["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,d)=>ln(a,At,tn,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=rn["ConnectionsApi.listSchemasInPackage"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ConnectionsApi.listTables"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.postQuerydata"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["ConnectionsApi.postQuerydataInPackage"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.postSqlsource"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["ConnectionsApi.postSqlsourceInPackage"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["ConnectionsApi.postTemporarytableInPackage"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,l=rn["ConnectionsApi.updateConnection"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let ire=class extends Za{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 sre=function(e){return{getDashboard:async(t,n,r,o,a={})=>{Ye("getDashboard","environmentName",t),Ye("getDashboard","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listDashboards:async(t,n,r,o={})=>{Ye("listDashboards","environmentName",t),Ye("listDashboards","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/dashboards".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},pA=function(e){const t=sre(e);return{async getDashboard(n,r,o,a,i){const s=await t.getDashboard(n,r,o,a,i),l=e?.serverIndex??0,d=rn["DashboardsApi.getDashboard"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async listDashboards(n,r,o,a){const i=await t.listDashboards(n,r,o,a),s=e?.serverIndex??0,l=rn["DashboardsApi.listDashboards"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};class lre extends Za{getDashboard(t,n,r,o,a){return pA(this.configuration).getDashboard(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listDashboards(t,n,r,o){return pA(this.configuration).listDashboards(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const cre=function(e){return{listDataApps:async(t,n,r,o={})=>{Ye("listDataApps","environmentName",t),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},ure=function(e){const t=cre(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,l=rn["DataAppsApi.listDataApps"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let dre=class extends Za{listDataApps(t,n,r,o){return ure(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const fre=function(e){return{listDatabases:async(t,n,r,o={})=>{Ye("listDatabases","environmentName",t),Ye("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},pre=function(e){const t=fre(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=rn["DatabasesApi.listDatabases"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let hre=class extends Za{listDatabases(t,n,r,o){return pre(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const mre=function(e){return{createEnvironment:async(t,n={})=>{Ye("createEnvironment","environment",t);const r="/environments",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:sn(o),options:i}},deleteEnvironment:async(t,n={})=>{Ye("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},l={};s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},getEnvironment:async(t,n,r={})=>{Ye("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};n!==void 0&&(d.reload=n),l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},updateEnvironment:async(t,n,r={})=>{Ye("updateEnvironment","environmentName",t),Ye("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},d={};l["Content-Type"]="application/json",l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},s.data=Mo(n,s,e),{url:sn(a),options:s}}}},Bm=function(e){const t=mre(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=rn["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=rn["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=rn["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=rn["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=rn["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)}}};let gre=class extends Za{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 yre=function(e){return{createMaterialization:async(t,n,r,o={})=>{Ye("createMaterialization","environmentName",t),Ye("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},deleteMaterialization:async(t,n,r,o,a={})=>{Ye("deleteMaterialization","environmentName",t),Ye("deleteMaterialization","packageName",n),Ye("deleteMaterialization","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,on);let l;e&&(l=e.baseOptions);const d={method:"DELETE",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},dropMaterializedTable:async(t,n,r,o,a,i,s={})=>{Ye("dropMaterializedTable","environmentName",t),Ye("dropMaterializedTable","packageName",n),Ye("dropMaterializedTable","connectionName",r),Ye("dropMaterializedTable","tableName",o);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/materializedTables/{tableName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{tableName}",encodeURIComponent(String(o))),d=new URL(l,on);let u;e&&(u=e.baseOptions);const m={method:"DELETE",...u,...s},g={},y={};a!==void 0&&(y.materializationId=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},getMaterialization:async(t,n,r,o,a={})=>{Ye("getMaterialization","environmentName",t),Ye("getMaterialization","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listMaterializations:async(t,n,r,o,a,i={})=>{Ye("listMaterializations","environmentName",t),Ye("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(s,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{Ye("materializationAction","environmentName",t),Ye("materializationAction","packageName",n),Ye("materializationAction","materializationId",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:sn(l),options:u}}}},np=function(e){const t=yre(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,l=rn["MaterializationsApi.createMaterialization"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async deleteMaterialization(n,r,o,a,i){const s=await t.deleteMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=rn["MaterializationsApi.deleteMaterialization"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async dropMaterializedTable(n,r,o,a,i,s,l){const d=await t.dropMaterializedTable(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=rn["MaterializationsApi.dropMaterializedTable"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=rn["MaterializationsApi.getMaterialization"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["MaterializationsApi.listMaterializations"]?.[d]?.url;return(m,g)=>ln(l,At,tn,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=rn["MaterializationsApi.materializationAction"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)}}};let vre=class extends Za{createMaterialization(t,n,r,o){return np(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a){return np(this.configuration).deleteMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}dropMaterializedTable(t,n,r,o,a,i,s){return np(this.configuration).dropMaterializedTable(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return np(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return np(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return np(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const bre={Stop:"stop"},xre=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{Ye("compileModelSource","environmentName",t),Ye("compileModelSource","packageName",n),Ye("compileModelSource","path",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}},executeQueryModel:async(t,n,r,o,a,i,s={})=>{Ye("executeQueryModel","environmentName",t),Ye("executeQueryModel","packageName",n),Ye("executeQueryModel","path",r),Ye("executeQueryModel","queryRequest",o);const l="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,on);let u;e&&(u=e.baseOptions);const m={method:"POST",...u,...s},g={},y={};a!==void 0&&(y.includeHiddenFilesAndSources=a),i!==void 0&&(y.versionId=i),g["Content-Type"]="application/json",g.Accept="application/json",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},m.data=Mo(o,m,e),{url:sn(d),options:m}},getModel:async(t,n,r,o,a,i,s={})=>{Ye("getModel","environmentName",t),Ye("getModel","packageName",n),Ye("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,on);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",an(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:sn(d),options:m}},listModels:async(t,n,r,o,a={})=>{Ye("listModels","environmentName",t),Ye("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,on);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",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},updateModelSource:async(t,n,r,o,a,i={})=>{Ye("updateModelSource","environmentName",t),Ye("updateModelSource","packageName",n),Ye("updateModelSource","path",r),Ye("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,on);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",an(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:sn(l),options:u}}}},Vm=function(e){const t=xre(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=rn["ModelsApi.compileModelSource"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)},async executeQueryModel(n,r,o,a,i,s,l){const d=await t.executeQueryModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=rn["ModelsApi.executeQueryModel"]?.[u]?.url;return(g,y)=>ln(d,At,tn,e)(g,m||y)},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=rn["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>ln(d,At,tn,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=rn["ModelsApi.listModels"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["ModelsApi.updateModelSource"]?.[d]?.url;return(m,g)=>ln(l,At,tn,e)(m,u||g)}}};let wre=class extends Za{compileModelSource(t,n,r,o,a,i){return Vm(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i,s){return Vm(this.configuration).executeQueryModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getModel(t,n,r,o,a,i,s){return Vm(this.configuration).getModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listModels(t,n,r,o,a){return Vm(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return Vm(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Sre=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,s,l,d={})=>{Ye("executeNotebookCell","environmentName",t),Ye("executeNotebookCell","packageName",n),Ye("executeNotebookCell","path",r),Ye("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,on);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",an(m,w);let S=g&&g.headers?g.headers:{};return y.headers={...x,...S,...d.headers},{url:sn(m),options:y}},getNotebook:async(t,n,r,o,a={})=>{Ye("getNotebook","environmentName",t),Ye("getNotebook","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listNotebooks:async(t,n,r,o={})=>{Ye("listNotebooks","environmentName",t),Ye("listNotebooks","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},ZS=function(e){const t=Sre(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=rn["NotebooksApi.executeNotebookCell"]?.[g]?.url;return(x,w)=>ln(m,At,tn,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=rn["NotebooksApi.getNotebook"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,l=rn["NotebooksApi.listNotebooks"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let Cre=class extends Za{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 kre=function(e){return{createPackage:async(t,n,r,o={})=>{Ye("createPackage","environmentName",t),Ye("createPackage","_package",n);const a="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),i=new URL(a,on);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",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(n,l,e),{url:sn(i),options:l}},deletePackage:async(t,n,r={})=>{Ye("deletePackage","environmentName",t),Ye("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Ye("getPackage","environmentName",t),Ye("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,on);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",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},getPackageBuildPlan:async(t,n,r,o={})=>{Ye("getPackageBuildPlan","environmentName",t),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageClassification:async(t,n,r,o={})=>{Ye("getPackageClassification","environmentName",t),Ye("getPackageClassification","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/classification".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageEmbeddingIndex:async(t,n,r,o={})=>{Ye("getPackageEmbeddingIndex","environmentName",t),Ye("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,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageEntities:async(t,n,r,o,a={})=>{Ye("getPackageEntities","environmentName",t),Ye("getPackageEntities","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/entities".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,on);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",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},getPackageStatus:async(t,n,r,o={})=>{Ye("getPackageStatus","environmentName",t),Ye("getPackageStatus","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/status".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},listPackages:async(t,n={})=>{Ye("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},updatePackage:async(t,n,r,o={})=>{Ye("updatePackage","environmentName",t),Ye("updatePackage","packageName",n),Ye("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}}}},nl=function(e){const t=kre(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.createPackage"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=rn["PackagesApi.deletePackage"]?.[i]?.url;return(l,d)=>ln(a,At,tn,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=rn["PackagesApi.getPackage"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async getPackageBuildPlan(n,r,o,a){const i=await t.getPackageBuildPlan(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageBuildPlan"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async getPackageClassification(n,r,o,a){const i=await t.getPackageClassification(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageClassification"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async getPackageEmbeddingIndex(n,r,o,a){const i=await t.getPackageEmbeddingIndex(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageEmbeddingIndex"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["PackagesApi.getPackageEntities"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async getPackageStatus(n,r,o,a){const i=await t.getPackageStatus(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.getPackageStatus"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=rn["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=rn["PackagesApi.updatePackage"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let $re=class extends Za{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 Rre=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};t!==void 0&&(l.includeLoading=t),s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:sn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},updateTheme:async(t,n={})=>{Ye("updateTheme","theme",t);const r="/theme",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:sn(o),options:i}}}},Cb=function(e){const t=Rre(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=rn["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=rn["PublisherApi.getStatus"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=rn["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=rn["PublisherApi.updateTheme"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)}}};let Tre=class extends Za{deleteTheme(t){return Cb(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return Cb(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return Cb(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return Cb(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Ere=function(e){return{getReport:async(t,n,r,o,a={})=>{Ye("getReport","environmentName",t),Ye("getReport","packageName",n),Ye("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,on);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:sn(s),options:d}},listReports:async(t,n,r,o={})=>{Ye("listReports","environmentName",t),Ye("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},hA=function(e){const t=Ere(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),l=e?.serverIndex??0,d=rn["ReportsApi.getReport"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,l=rn["ReportsApi.listReports"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let Mre=class extends Za{getReport(t,n,r,o,a){return hA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return hA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ore=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{Ye("deletePackageVersion","environmentName",t),Ye("deletePackageVersion","packageName",n),Ye("deletePackageVersion","versionId",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"DELETE",...s,...o},d={},u={};d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},getPackageVersion:async(t,n,r,o={})=>{Ye("getPackageVersion","environmentName",t),Ye("getPackageVersion","packageName",n),Ye("getPackageVersion","versionId",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}},listPackageVersions:async(t,n,r={})=>{Ye("listPackageVersions","environmentName",t),Ye("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,on);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",an(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:sn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{Ye("setPackageLatestVersion","environmentName",t),Ye("setPackageLatestVersion","packageName",n),Ye("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);let s;e&&(s=e.baseOptions);const l={method:"PUT",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:sn(i),options:l}},setPackageVersionManifest:async(t,n,r,o,a={})=>{Ye("setPackageVersionManifest","environmentName",t),Ye("setPackageVersionManifest","packageName",n),Ye("setPackageVersionManifest","versionId",r),Ye("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{versionId}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),s=new URL(i,on);let l;e&&(l=e.baseOptions);const d={method:"PUT",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:sn(s),options:d}},updatePackageVersion:async(t,n,r,o,a={})=>{Ye("updatePackageVersion","environmentName",t),Ye("updatePackageVersion","packageName",n),Ye("updatePackageVersion","versionId",r),Ye("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),s=new URL(i,on);let l;e&&(l=e.baseOptions);const d={method:"PATCH",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",an(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:sn(s),options:d}}}},rp=function(e){const t=Ore(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,l=rn["VersionsApi.deletePackageVersion"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,l=rn["VersionsApi.getPackageVersion"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=rn["VersionsApi.listPackageVersions"]?.[i]?.url;return(l,d)=>ln(a,At,tn,e)(l,s||d)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,l=rn["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(d,u)=>ln(i,At,tn,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=rn["VersionsApi.setPackageVersionManifest"]?.[l]?.url;return(u,m)=>ln(s,At,tn,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=rn["VersionsApi.updatePackageVersion"]?.[l]?.url;return(u,m)=>ln(s,At,tn,e)(u,d||m)}}};let Pre=class extends Za{deletePackageVersion(t,n,r,o){return rp(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return rp(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return rp(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return rp(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return rp(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return rp(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const jre=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},startWatching:async(t,n={})=>{Ye("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,on);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",an(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:sn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,on);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",an(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:sn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{Ye("streamPackageEvents","environmentName",t),Ye("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,on);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",an(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:sn(i),options:l}}}},kb=function(e){const t=jre(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=rn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=rn["WatchModeApi.startWatching"]?.[a]?.url;return(s,l)=>ln(o,At,tn,e)(s,i||l)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=rn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>ln(r,At,tn,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,l=rn["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(d,u)=>ln(i,At,tn,e)(d,l||u)}}};let Are=class extends Za{getWatchStatus(t){return kb(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return kb(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return kb(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return kb(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Dre=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 ZR=new Tee({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),Nre={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function Ire(e,t){return t||e?.modelPage==="viewer"?"viewer":"explorer"}function Lre(e){return{modelPage:Ire(e.data,e.isError&&e.data===void 0),isLoadingStatus:e.isPending}}const zk="publisher:themeMode";function zre(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(zk);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function Fre(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(zk):window.localStorage.setItem(zk,e)}catch{}}function _re(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}At.defaults.baseURL||(At.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const k4=C.createContext(void 0),Ure=(e,t,n)=>{const r=`${window.location.protocol}//${window.location.host}/api/v0`,o=At.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 Dre({basePath:r});return{models:new wre(a,r,o),publisher:new Tre(a,r,o),environments:new gre(a,r,o),packages:new $re(a,r,o),agents:new ore(a,r,o),dashboards:new lre(a,r,o),dataApps:new dre(a,r,o),notebooks:new Cre(a,r,o),reports:new Mre(a,r,o),connections:new ire(a,r,o),databases:new hre(a,r,o),materializations:new vre(a,r,o),watchMode:new Are(a,r,o),versions:new Pre(a,r,o)}},Bre=e=>p.jsx(Eee,{client:ZR,children:p.jsx(Vre,{...e})}),Vre=({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}=Lre(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(zre),[k,T]=C.useState(_re);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),Fre(L)},[]),P=g?.allowUserToggle??!0,D=P?b:void 0,A=C.useMemo(()=>s??Jne(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(k4.Provider,{value:F,children:p.jsx(ere,{layers:S,mode:A,userChoice:D,setMode:O,allowUserToggle:P&&s===void 0,...a?{ui:a}:{},children:e})})},Jn=()=>{const e=C.useContext(k4);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 Hre=["children","options"],mA=["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"}),gA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},qre=["style","script","pre"],Wre=["src","href","data","formAction","srcDoc","action"],Yre=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Gre=/mailto:/i,Kre=/\n{2,}$/,yA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Qre=/^ *> ?/gm,Xre=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Zre=/^ {2,}\n/,Jre=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,vA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,bA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,eoe=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,toe=/^(?:\n *)*\n/,noe=/\r\n?/g,roe=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,ooe=/^\[\^([^\]]+)]/,aoe=/\f/g,ioe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,soe=/^\s*?\[(x|\s)\]/,xA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,wA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,SA=/^([^\n]+)\n *(=|-){3,} *\n/,JS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,loe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,CA=/^<!--[\s\S]*?(?:-->)/,coe=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,eC=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,uoe=/^\{.*\}$/,doe=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,foe=/^<([^ >]+@[^ >]+)>/,poe=/^<([^ >]+:\/[^ >]+)>/,hoe=/-([a-z])?/gi,kA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,moe=/^[^\n]+(?: \n|\n{2,})/,goe=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,yoe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,voe=/^\[([^\]]*)\] ?\[([^\]]*)\]/,boe=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,xoe=/\t/g,woe=/(^ *\||\| *$)/g,Soe=/^ *:-+: *$/,Coe=/^ *:-+ *$/,koe=/^ *-+: *$/,Yx=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,Gx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",$oe=RegExp(`^([*_])\\1${Yx(1)}${Gx}\\1\\1(?!\\1)`),Roe=RegExp(`^([*_])${Yx(0)}${Gx}\\1(?!\\1)`),Toe=RegExp(`^(==)${Yx(0)}${Gx}\\1`),Eoe=RegExp(`^(~~)${Yx(0)}${Gx}\\1`),Moe=/^(:[a-zA-Z0-9-_]+:)/,Ooe=/^\\([^0-9A-Za-z\s])/,Poe=/\\([^0-9A-Za-z\s])/g,joe=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Aoe=/^\n+/,Doe=/^([ \t]*)/,Noe=/(?:^|\n)( *)$/,JR="(?:\\d+\\.)",eT="(?:[*+-])";function $4(e){return"( *)("+(e===1?JR:eT)+") +"}const R4=$4(1),T4=$4(2);function E4(e){return RegExp("^"+(e===1?R4:T4))}const Ioe=E4(1),Loe=E4(2);function M4(e){return RegExp("^"+(e===1?R4:T4)+"[^\\n]*(?:\\n(?!\\1"+(e===1?JR:eT)+" )[^\\n]*)*(\\n|$)","gm")}const zoe=M4(1),Foe=M4(2);function O4(e){const t=e===1?JR:eT;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const P4=O4(1),j4=O4(2);function $A(e,t){const n=t===1,r=n?P4:j4,o=n?zoe:Foe,a=n?Ioe:Loe;return{t:i=>a.test(i),o:Wp(function(i,s){const l=Noe.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(Kre,`
|
|
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=_g(S)+`
|
|
@@ -356,7 +356,7 @@ ${t}`}function Mce(e){return e?.status===403}function Xp(e){return`\`${e.replace
|
|
|
356
356
|
`+(n===void 0?"":` where: ${Nce(s,n)}
|
|
357
357
|
`)+` order_by: ${l} asc
|
|
358
358
|
limit: ${o}
|
|
359
|
-
}`}function Nce(e,t){return`strpos(lower(${e}::string), ${Ice(t.toLowerCase())}) > 0`}function Ice(e){return`'${e.replace(/[\u0000-\u001f\u007f]/g,"").replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function Lce(e,t){const n=e.suggest?.givenNames;if(!t||!n||n.length===0)return;const r=gT(Zd(t.values,t.declaredTypes,n),zce(t),n);return Object.keys(r).length>0?r:void 0}function zce(e){if(e.host)return Object.fromEntries(Object.entries(e.host).filter(([t])=>!e.declaredTypes.has(t)))}function _F(e,t,n,r,o,a,i,s,l){const{apiClients:d,modelPage:u}=Jn(),m=l??u==="viewer",g=C.useMemo(()=>r.filter(P=>P.name!==void 0&&(P.control==="select"||P.control==="multiselect")&&(P.suggest?.query!==void 0||P.suggest?.source!==void 0&&P.suggest?.dimension!==void 0)),[r]),y=g.map(P=>{const D=Lce(P,a),A=P.suggest??{},F=[e,t,o,n,P.name,A.query,A.source,A.dimension,D===void 0?null:JSON.stringify(D),...i===void 0?[]:[i],...m?["quoteNames"]:[]];return{spec:P,identity:F,run:async(L,_)=>{const R=A.query!==void 0,z=await d.models.executeQueryModel(e,t,n,R&&i===void 0?{queryName:A.query,compactJson:!0,versionId:o,givens:D}:{query:y1(i??"",R?`run: ${A.query}`:Dce(A.source,A.dimension,L,{quoteNames:m})),compactJson:!0,versionId:o,givens:D},void 0,{signal:_});return Fce(z.data.result,A.dimension===void 0?void 0:zF(A.dimension),R?{limit:Md,cutOffAt:Md}:{limit:L===void 0?Md:yT})},searchable:A.query===void 0}}),x=Fz({queries:y.map(({spec:P,identity:D,run:A})=>({queryKey:["givenSuggest",...D],enabled:n!==void 0&&(s===void 0||s.has(P.name)),staleTime:300*1e3,refetchOnWindowFocus:!1,queryFn:({signal:F})=>A(void 0,F)}))}),w=C.useMemo(()=>{const P=new Map;return g.forEach((D,A)=>{const F=x[A]?.data;D.name&&F&&P.set(D.name,F.values)}),P},[g,JSON.stringify(x.map(P=>P.data))]),S=C.useMemo(()=>{const P=new Set;return g.forEach((D,A)=>{D.name&&x[A]?.isError&&P.add(D.name)}),P},[g,x.map(P=>P.isError).join("|")]),b=x.map(P=>!!P.data?.truncated).join("|"),$=C.useMemo(()=>{const P=new Set;return g.forEach((D,A)=>{D.name&&x[A]?.data?.truncated&&P.add(D.name)}),P},[g,b]),k=JSON.stringify(y.map(P=>P.identity)),T=C.useRef(y);T.current=y;const O=C.useMemo(()=>{const P=new Map;return y.forEach(({spec:D,identity:A,searchable:F},L)=>{!D.name||!F||!$.has(D.name)||P.set(D.name,{key:["givenSuggestSearch",...A],run:(_,R)=>T.current[L].run(_,R)})}),P},[k,$]);return{options:w,isLoading:x.some(P=>P.isLoading),failed:S,truncated:$,search:O}}function Fce(e,t,{limit:n,cutOffAt:r}){const o=_ce(e);return{values:Uce(o.slice(0,n),t),truncated:r===void 0?o.length>n:o.length>=r}}function _ce(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{throw new Error("Suggest query returned a result that is not JSON.")}if(!Array.isArray(t))throw new Error("Suggest query returned JSON that is not a list of rows.");return t}function Uce(e,t){const n=[],r=new Set;for(const o of e){if(o===null||typeof o!="object")continue;const a=o,i=Object.keys(a),s=t!==void 0&&Object.prototype.hasOwnProperty.call(a,t)?t:i[0],l=s===void 0?void 0:a[s];if(l==null)continue;const d=String(l);r.has(d)||(r.add(d),n.push(d))}return n}function vT({specs:e,loaded:t,startingValues:n,params:r,onGivensChange:o,documentKey:a,autorun:i,environmentName:s,packageName:l,modelPath:d,versionId:u,documentName:m,preamble:g,hostGivens:y}){const x=C.useMemo(()=>new Map(e.filter(A=>A.name!==void 0).map(A=>[A.name,A.type])),[e]),w=C.useCallback(A=>{t&&o?.(A,Array.from(x.keys()))},[t,o,x]),S=LF({declaredTypes:x,startingValues:n,params:r,onParamsChange:t?w:void 0,documentKey:a,autorun:i}),{options:b,isLoading:$,failed:k,truncated:T,search:O}=_F(s,l,d,e,u,{values:S.applied,declaredTypes:x,...y?{host:y}:{}},g),{canSelf:P,onSelf:D}=xce({declaredTypes:x,setGiven:S.setGiven,documentName:m});return{...S,declaredTypes:x,options:b,optionsLoading:$,optionsFailed:k,optionsTruncated:T,optionSearch:O,canSelf:P,onSelf:D,panel:{givens:e,values:S.draft,onChange:S.setGiven,onReset:S.reset,canReset:!S.atStart,options:b,optionsLoading:$,optionsFailed:k,optionsTruncated:T,optionSearch:O,apply:i?void 0:{onApply:S.apply,pending:S.pending}}}}const Bce=un(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 Fe(){return Fe=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},Fe.apply(null,arguments)}var Jk={exports:{}},Vce=Jk.exports,ID;function Hce(){return ID||(ID=1,(function(e,t){(function(n,r){e.exports=r()})(Vce,(function(){var n="week",r="year";return function(o,a,i){var s=a.prototype;s.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=i(this).startOf(r).add(1,r).date(d),m=i(this).endOf(n);if(u.isBefore(m))return 1}var g=i(this).startOf(r).date(d).startOf(n).subtract(1,"millisecond"),y=this.diff(g,n,!0);return y<0?i(this).startOf("week").week():Math.ceil(y)},s.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Jk)),Jk.exports}var qce=Hce();const Wce=yc(qce);var e$={exports:{}},Yce=e$.exports,LD;function Gce(){return LD||(LD=1,(function(e,t){(function(n,r){e.exports=r()})(Yce,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,o=/\d/,a=/\d\d/,i=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,l={},d=function(S){return(S=+S)+(S>68?1900:2e3)},u=function(S){return function(b){this[S]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=(function(b){if(!b||b==="Z")return 0;var $=b.match(/([+-]|\d\d)/g),k=60*$[1]+(+$[2]||0);return k===0?0:$[0]==="+"?-k:k})(S)}],g=function(S){var b=l[S];return b&&(b.indexOf?b:b.s.concat(b.f))},y=function(S,b){var $,k=l.meridiem;if(k){for(var T=1;T<=24;T+=1)if(S.indexOf(k(T,0,b))>-1){$=T>12;break}}else $=S===(b?"pm":"PM");return $},x={A:[s,function(S){this.afternoon=y(S,!1)}],a:[s,function(S){this.afternoon=y(S,!0)}],Q:[o,function(S){this.month=3*(S-1)+1}],S:[o,function(S){this.milliseconds=100*+S}],SS:[a,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],s:[i,u("seconds")],ss:[i,u("seconds")],m:[i,u("minutes")],mm:[i,u("minutes")],H:[i,u("hours")],h:[i,u("hours")],HH:[i,u("hours")],hh:[i,u("hours")],D:[i,u("day")],DD:[a,u("day")],Do:[s,function(S){var b=l.ordinal,$=S.match(/\d+/);if(this.day=$[0],b)for(var k=1;k<=31;k+=1)b(k).replace(/\[|\]/g,"")===S&&(this.day=k)}],w:[i,u("week")],ww:[a,u("week")],M:[i,u("month")],MM:[a,u("month")],MMM:[s,function(S){var b=g("months"),$=(g("monthsShort")||b.map((function(k){return k.slice(0,3)}))).indexOf(S)+1;if($<1)throw new Error;this.month=$%12||$}],MMMM:[s,function(S){var b=g("months").indexOf(S)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[a,function(S){this.year=d(S)}],YYYY:[/\d{4}/,u("year")],Z:m,ZZ:m};function w(S){var b,$;b=S,$=l&&l.formats;for(var k=(S=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(L,_,R){var z=R&&R.toUpperCase();return _||$[R]||n[R]||$[z].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,U,I){return U||I.slice(1)}))}))).match(r),T=k.length,O=0;O<T;O+=1){var P=k[O],D=x[P],A=D&&D[0],F=D&&D[1];k[O]=F?{regex:A,parser:F}:P.replace(/^\[|\]$/g,"")}return function(L){for(var _={},R=0,z=0;R<T;R+=1){var N=k[R];if(typeof N=="string")z+=N.length;else{var U=N.regex,I=N.parser,H=L.slice(z),Y=U.exec(H)[0];I.call(_,Y),L=L.replace(Y,"")}}return(function(ae){var K=ae.afternoon;if(K!==void 0){var oe=ae.hours;K?oe<12&&(ae.hours+=12):oe===12&&(ae.hours=0),delete ae.afternoon}})(_),_}}return function(S,b,$){$.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(d=S.parseTwoDigitYear);var k=b.prototype,T=k.parse;k.parse=function(O){var P=O.date,D=O.utc,A=O.args;this.$u=D;var F=A[1];if(typeof F=="string"){var L=A[2]===!0,_=A[3]===!0,R=L||_,z=A[2];_&&(z=A[2]),l=this.$locale(),!L&&z&&(l=$.Ls[z]),this.$d=(function(H,Y,ae,K){try{if(["x","X"].indexOf(Y)>-1)return new Date((Y==="X"?1e3:1)*H);var oe=w(Y)(H),ue=oe.year,G=oe.month,ie=oe.day,X=oe.hours,ee=oe.minutes,Z=oe.seconds,de=oe.milliseconds,le=oe.zone,fe=oe.week,he=new Date,me=ie||(ue||G?1:he.getDate()),se=ue||he.getFullYear(),ve=0;ue&&!G||(ve=G>0?G-1:he.getMonth());var Le,Ae=X||0,Re=ee||0,re=Z||0,_e=de||0;return le?new Date(Date.UTC(se,ve,me,Ae,Re,re,_e+60*le.offset*1e3)):ae?new Date(Date.UTC(se,ve,me,Ae,Re,re,_e)):(Le=new Date(se,ve,me,Ae,Re,re,_e),fe&&(Le=K(Le).week(fe).toDate()),Le)}catch{return new Date("")}})(P,F,D,$),this.init(),z&&z!==!0&&(this.$L=this.locale(z).$L),R&&P!=this.format(F)&&(this.$d=new Date("")),l={}}else if(F instanceof Array)for(var N=F.length,U=1;U<=N;U+=1){A[1]=F[U-1];var I=$.apply(this,A);if(I.isValid()){this.$d=I.$d,this.$L=I.$L,this.init();break}U===N&&(this.$d=new Date(""))}else T.call(this,O)}}}))})(e$)),e$.exports}var Kce=Gce();const Qce=yc(Kce);var t$={exports:{}},Xce=t$.exports,zD;function Zce(){return zD||(zD=1,(function(e,t){(function(n,r){e.exports=r()})(Xce,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,a){var i=o.prototype,s=i.format;a.en.formats=n,i.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,u=(function(m,g){return m.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(y,x,w){var S=w&&w.toUpperCase();return x||g[w]||n[w]||g[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(b,$,k){return $||k.slice(1)}))}))})(l,d===void 0?{}:d);return s.call(this,u)}}}))})(t$)),t$.exports}var Jce=Zce();const eue=yc(Jce);var n$={exports:{}},tue=n$.exports,FD;function nue(){return FD||(FD=1,(function(e,t){(function(n,r){e.exports=r()})(tue,(function(){return function(n,r,o){r.prototype.isBetween=function(a,i,s,l){var d=o(a),u=o(i),m=(l=l||"()")[0]==="(",g=l[1]===")";return(m?this.isAfter(d,s):!this.isBefore(d,s))&&(g?this.isBefore(u,s):!this.isAfter(u,s))||(m?this.isBefore(d,s):!this.isAfter(d,s))&&(g?this.isAfter(u,s):!this.isBefore(u,s))}}}))})(n$)),n$.exports}var rue=nue();const oue=yc(rue);var r$={exports:{}},aue=r$.exports,_D;function iue(){return _D||(_D=1,(function(e,t){(function(n,r){e.exports=r()})(aue,(function(){return function(n,r){var o=r.prototype,a=o.format;o.format=function(i){var s=this,l=this.$locale();if(!this.isValid())return a.bind(this)(i);var d=this.$utils(),u=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(m){switch(m){case"Q":return Math.ceil((s.$M+1)/3);case"Do":return l.ordinal(s.$D);case"gggg":return s.weekYear();case"GGGG":return s.isoWeekYear();case"wo":return l.ordinal(s.week(),"W");case"w":case"ww":return d.s(s.week(),m==="w"?1:2,"0");case"W":case"WW":return d.s(s.isoWeek(),m==="W"?1:2,"0");case"k":case"kk":return d.s(String(s.$H===0?24:s.$H),m==="k"?1:2,"0");case"X":return Math.floor(s.$d.getTime()/1e3);case"x":return s.$d.getTime();case"z":return"["+s.offsetName()+"]";case"zzz":return"["+s.offsetName("long")+"]";default:return m}}));return a.bind(this)(u)}}}))})(r$)),r$.exports}var sue=iue();const lue=yc(sue);jr.extend(eue);jr.extend(Wce);jr.extend(oue);jr.extend(lue);const cue={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},uue={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime:"LT",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime:"L LT",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},wC=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join(`
|
|
359
|
+
}`}function Nce(e,t){return`strpos(lower(${e}::string), ${Ice(t.toLowerCase())}) > 0`}function Ice(e){return`'${e.replace(/[\u0000-\u001f\u007f]/g,"").replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function Lce(e,t){const n=e.suggest?.givenNames;if(!t||!n||n.length===0)return;const r=gT(Zd(t.values,t.declaredTypes,n),zce(t),n);return Object.keys(r).length>0?r:void 0}function zce(e){if(e.host)return Object.fromEntries(Object.entries(e.host).filter(([t])=>!e.declaredTypes.has(t)))}function _F(e,t,n,r,o,a,i,s,l){const{apiClients:d,modelPage:u}=Jn(),m=l??u==="viewer",g=C.useMemo(()=>r.filter(P=>P.name!==void 0&&(P.control==="select"||P.control==="multiselect")&&(P.suggest?.query!==void 0||P.suggest?.source!==void 0&&P.suggest?.dimension!==void 0)),[r]),y=g.map(P=>{const D=Lce(P,a),A=P.suggest??{},F=[e,t,o,n,P.name,A.query,A.source,A.dimension,D===void 0?null:JSON.stringify(D),...i===void 0?[]:[i],...m?["quoteNames"]:[]];return{spec:P,identity:F,run:async(L,_)=>{const R=A.query!==void 0,z=await d.models.executeQueryModel(e,t,n,R&&i===void 0?{queryName:A.query,compactJson:!0,versionId:o,givens:D}:{query:y1(i??"",R?`run: ${A.query}`:Dce(A.source,A.dimension,L,{quoteNames:m})),compactJson:!0,versionId:o,givens:D},void 0,void 0,{signal:_});return Fce(z.data.result,A.dimension===void 0?void 0:zF(A.dimension),R?{limit:Md,cutOffAt:Md}:{limit:L===void 0?Md:yT})},searchable:A.query===void 0}}),x=Fz({queries:y.map(({spec:P,identity:D,run:A})=>({queryKey:["givenSuggest",...D],enabled:n!==void 0&&(s===void 0||s.has(P.name)),staleTime:300*1e3,refetchOnWindowFocus:!1,queryFn:({signal:F})=>A(void 0,F)}))}),w=C.useMemo(()=>{const P=new Map;return g.forEach((D,A)=>{const F=x[A]?.data;D.name&&F&&P.set(D.name,F.values)}),P},[g,JSON.stringify(x.map(P=>P.data))]),S=C.useMemo(()=>{const P=new Set;return g.forEach((D,A)=>{D.name&&x[A]?.isError&&P.add(D.name)}),P},[g,x.map(P=>P.isError).join("|")]),b=x.map(P=>!!P.data?.truncated).join("|"),$=C.useMemo(()=>{const P=new Set;return g.forEach((D,A)=>{D.name&&x[A]?.data?.truncated&&P.add(D.name)}),P},[g,b]),k=JSON.stringify(y.map(P=>P.identity)),T=C.useRef(y);T.current=y;const O=C.useMemo(()=>{const P=new Map;return y.forEach(({spec:D,identity:A,searchable:F},L)=>{!D.name||!F||!$.has(D.name)||P.set(D.name,{key:["givenSuggestSearch",...A],run:(_,R)=>T.current[L].run(_,R)})}),P},[k,$]);return{options:w,isLoading:x.some(P=>P.isLoading),failed:S,truncated:$,search:O}}function Fce(e,t,{limit:n,cutOffAt:r}){const o=_ce(e);return{values:Uce(o.slice(0,n),t),truncated:r===void 0?o.length>n:o.length>=r}}function _ce(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{throw new Error("Suggest query returned a result that is not JSON.")}if(!Array.isArray(t))throw new Error("Suggest query returned JSON that is not a list of rows.");return t}function Uce(e,t){const n=[],r=new Set;for(const o of e){if(o===null||typeof o!="object")continue;const a=o,i=Object.keys(a),s=t!==void 0&&Object.prototype.hasOwnProperty.call(a,t)?t:i[0],l=s===void 0?void 0:a[s];if(l==null)continue;const d=String(l);r.has(d)||(r.add(d),n.push(d))}return n}function vT({specs:e,loaded:t,startingValues:n,params:r,onGivensChange:o,documentKey:a,autorun:i,environmentName:s,packageName:l,modelPath:d,versionId:u,documentName:m,preamble:g,hostGivens:y}){const x=C.useMemo(()=>new Map(e.filter(A=>A.name!==void 0).map(A=>[A.name,A.type])),[e]),w=C.useCallback(A=>{t&&o?.(A,Array.from(x.keys()))},[t,o,x]),S=LF({declaredTypes:x,startingValues:n,params:r,onParamsChange:t?w:void 0,documentKey:a,autorun:i}),{options:b,isLoading:$,failed:k,truncated:T,search:O}=_F(s,l,d,e,u,{values:S.applied,declaredTypes:x,...y?{host:y}:{}},g),{canSelf:P,onSelf:D}=xce({declaredTypes:x,setGiven:S.setGiven,documentName:m});return{...S,declaredTypes:x,options:b,optionsLoading:$,optionsFailed:k,optionsTruncated:T,optionSearch:O,canSelf:P,onSelf:D,panel:{givens:e,values:S.draft,onChange:S.setGiven,onReset:S.reset,canReset:!S.atStart,options:b,optionsLoading:$,optionsFailed:k,optionsTruncated:T,optionSearch:O,apply:i?void 0:{onApply:S.apply,pending:S.pending}}}}const Bce=un(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 Fe(){return Fe=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},Fe.apply(null,arguments)}var Jk={exports:{}},Vce=Jk.exports,ID;function Hce(){return ID||(ID=1,(function(e,t){(function(n,r){e.exports=r()})(Vce,(function(){var n="week",r="year";return function(o,a,i){var s=a.prototype;s.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=i(this).startOf(r).add(1,r).date(d),m=i(this).endOf(n);if(u.isBefore(m))return 1}var g=i(this).startOf(r).date(d).startOf(n).subtract(1,"millisecond"),y=this.diff(g,n,!0);return y<0?i(this).startOf("week").week():Math.ceil(y)},s.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Jk)),Jk.exports}var qce=Hce();const Wce=yc(qce);var e$={exports:{}},Yce=e$.exports,LD;function Gce(){return LD||(LD=1,(function(e,t){(function(n,r){e.exports=r()})(Yce,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,o=/\d/,a=/\d\d/,i=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,l={},d=function(S){return(S=+S)+(S>68?1900:2e3)},u=function(S){return function(b){this[S]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=(function(b){if(!b||b==="Z")return 0;var $=b.match(/([+-]|\d\d)/g),k=60*$[1]+(+$[2]||0);return k===0?0:$[0]==="+"?-k:k})(S)}],g=function(S){var b=l[S];return b&&(b.indexOf?b:b.s.concat(b.f))},y=function(S,b){var $,k=l.meridiem;if(k){for(var T=1;T<=24;T+=1)if(S.indexOf(k(T,0,b))>-1){$=T>12;break}}else $=S===(b?"pm":"PM");return $},x={A:[s,function(S){this.afternoon=y(S,!1)}],a:[s,function(S){this.afternoon=y(S,!0)}],Q:[o,function(S){this.month=3*(S-1)+1}],S:[o,function(S){this.milliseconds=100*+S}],SS:[a,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],s:[i,u("seconds")],ss:[i,u("seconds")],m:[i,u("minutes")],mm:[i,u("minutes")],H:[i,u("hours")],h:[i,u("hours")],HH:[i,u("hours")],hh:[i,u("hours")],D:[i,u("day")],DD:[a,u("day")],Do:[s,function(S){var b=l.ordinal,$=S.match(/\d+/);if(this.day=$[0],b)for(var k=1;k<=31;k+=1)b(k).replace(/\[|\]/g,"")===S&&(this.day=k)}],w:[i,u("week")],ww:[a,u("week")],M:[i,u("month")],MM:[a,u("month")],MMM:[s,function(S){var b=g("months"),$=(g("monthsShort")||b.map((function(k){return k.slice(0,3)}))).indexOf(S)+1;if($<1)throw new Error;this.month=$%12||$}],MMMM:[s,function(S){var b=g("months").indexOf(S)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[a,function(S){this.year=d(S)}],YYYY:[/\d{4}/,u("year")],Z:m,ZZ:m};function w(S){var b,$;b=S,$=l&&l.formats;for(var k=(S=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(L,_,R){var z=R&&R.toUpperCase();return _||$[R]||n[R]||$[z].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,U,I){return U||I.slice(1)}))}))).match(r),T=k.length,O=0;O<T;O+=1){var P=k[O],D=x[P],A=D&&D[0],F=D&&D[1];k[O]=F?{regex:A,parser:F}:P.replace(/^\[|\]$/g,"")}return function(L){for(var _={},R=0,z=0;R<T;R+=1){var N=k[R];if(typeof N=="string")z+=N.length;else{var U=N.regex,I=N.parser,H=L.slice(z),Y=U.exec(H)[0];I.call(_,Y),L=L.replace(Y,"")}}return(function(ae){var K=ae.afternoon;if(K!==void 0){var oe=ae.hours;K?oe<12&&(ae.hours+=12):oe===12&&(ae.hours=0),delete ae.afternoon}})(_),_}}return function(S,b,$){$.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(d=S.parseTwoDigitYear);var k=b.prototype,T=k.parse;k.parse=function(O){var P=O.date,D=O.utc,A=O.args;this.$u=D;var F=A[1];if(typeof F=="string"){var L=A[2]===!0,_=A[3]===!0,R=L||_,z=A[2];_&&(z=A[2]),l=this.$locale(),!L&&z&&(l=$.Ls[z]),this.$d=(function(H,Y,ae,K){try{if(["x","X"].indexOf(Y)>-1)return new Date((Y==="X"?1e3:1)*H);var oe=w(Y)(H),ue=oe.year,G=oe.month,ie=oe.day,X=oe.hours,ee=oe.minutes,Z=oe.seconds,de=oe.milliseconds,le=oe.zone,fe=oe.week,he=new Date,me=ie||(ue||G?1:he.getDate()),se=ue||he.getFullYear(),ve=0;ue&&!G||(ve=G>0?G-1:he.getMonth());var Le,Ae=X||0,Re=ee||0,re=Z||0,_e=de||0;return le?new Date(Date.UTC(se,ve,me,Ae,Re,re,_e+60*le.offset*1e3)):ae?new Date(Date.UTC(se,ve,me,Ae,Re,re,_e)):(Le=new Date(se,ve,me,Ae,Re,re,_e),fe&&(Le=K(Le).week(fe).toDate()),Le)}catch{return new Date("")}})(P,F,D,$),this.init(),z&&z!==!0&&(this.$L=this.locale(z).$L),R&&P!=this.format(F)&&(this.$d=new Date("")),l={}}else if(F instanceof Array)for(var N=F.length,U=1;U<=N;U+=1){A[1]=F[U-1];var I=$.apply(this,A);if(I.isValid()){this.$d=I.$d,this.$L=I.$L,this.init();break}U===N&&(this.$d=new Date(""))}else T.call(this,O)}}}))})(e$)),e$.exports}var Kce=Gce();const Qce=yc(Kce);var t$={exports:{}},Xce=t$.exports,zD;function Zce(){return zD||(zD=1,(function(e,t){(function(n,r){e.exports=r()})(Xce,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,a){var i=o.prototype,s=i.format;a.en.formats=n,i.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,u=(function(m,g){return m.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(y,x,w){var S=w&&w.toUpperCase();return x||g[w]||n[w]||g[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(b,$,k){return $||k.slice(1)}))}))})(l,d===void 0?{}:d);return s.call(this,u)}}}))})(t$)),t$.exports}var Jce=Zce();const eue=yc(Jce);var n$={exports:{}},tue=n$.exports,FD;function nue(){return FD||(FD=1,(function(e,t){(function(n,r){e.exports=r()})(tue,(function(){return function(n,r,o){r.prototype.isBetween=function(a,i,s,l){var d=o(a),u=o(i),m=(l=l||"()")[0]==="(",g=l[1]===")";return(m?this.isAfter(d,s):!this.isBefore(d,s))&&(g?this.isBefore(u,s):!this.isAfter(u,s))||(m?this.isBefore(d,s):!this.isAfter(d,s))&&(g?this.isAfter(u,s):!this.isBefore(u,s))}}}))})(n$)),n$.exports}var rue=nue();const oue=yc(rue);var r$={exports:{}},aue=r$.exports,_D;function iue(){return _D||(_D=1,(function(e,t){(function(n,r){e.exports=r()})(aue,(function(){return function(n,r){var o=r.prototype,a=o.format;o.format=function(i){var s=this,l=this.$locale();if(!this.isValid())return a.bind(this)(i);var d=this.$utils(),u=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(m){switch(m){case"Q":return Math.ceil((s.$M+1)/3);case"Do":return l.ordinal(s.$D);case"gggg":return s.weekYear();case"GGGG":return s.isoWeekYear();case"wo":return l.ordinal(s.week(),"W");case"w":case"ww":return d.s(s.week(),m==="w"?1:2,"0");case"W":case"WW":return d.s(s.isoWeek(),m==="W"?1:2,"0");case"k":case"kk":return d.s(String(s.$H===0?24:s.$H),m==="k"?1:2,"0");case"X":return Math.floor(s.$d.getTime()/1e3);case"x":return s.$d.getTime();case"z":return"["+s.offsetName()+"]";case"zzz":return"["+s.offsetName("long")+"]";default:return m}}));return a.bind(this)(u)}}}))})(r$)),r$.exports}var sue=iue();const lue=yc(sue);jr.extend(eue);jr.extend(Wce);jr.extend(oue);jr.extend(lue);const cue={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},uue={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime:"LT",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime:"L LT",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},wC=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join(`
|
|
360
360
|
`),UD=["Missing timezone plugin","To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join(`
|
|
361
361
|
`),due=(e,t)=>t?(...n)=>e(...n).locale(t):e;let fue=class{constructor({locale:t,formats:n}={}){this.isMUIAdapter=!0,this.isTimezoneCompatible=!0,this.lib="dayjs",this.dayjs=void 0,this.locale=void 0,this.formats=void 0,this.escapedCharacters={start:"[",end:"]"},this.formatTokenMap=cue,this.setLocaleToValue=r=>{const o=this.getCurrentLocaleCode();return o===r.locale()?r:r.locale(o)},this.hasUTCPlugin=()=>typeof jr.utc<"u",this.hasTimezonePlugin=()=>typeof jr.tz<"u",this.isSame=(r,o,a)=>{const i=this.setTimezone(o,this.getTimezone(r));return r.format(a)===i.format(a)},this.cleanTimezone=r=>{switch(r){case"default":return;case"system":return jr.tz.guess();default:return r}},this.createSystemDate=r=>{if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const o=jr.tz.guess();return o!=="UTC"?jr.tz(r,o):jr(r)}return jr(r)},this.createUTCDate=r=>{if(!this.hasUTCPlugin())throw new Error(wC);return jr.utc(r)},this.createTZDate=(r,o)=>{if(!this.hasUTCPlugin())throw new Error(wC);if(!this.hasTimezonePlugin())throw new Error(UD);const a=r!==void 0&&!r.endsWith("Z");return jr(r).tz(this.cleanTimezone(o),a)},this.getLocaleFormats=()=>{const r=jr.Ls,o=this.locale||"en";let a=r[o];return a===void 0&&(a=r.en),a.formats},this.adjustOffset=r=>{if(!this.hasTimezonePlugin())return r;const o=this.getTimezone(r);if(o!=="UTC"){const a=r.tz(this.cleanTimezone(o),!0);if(a.$offset===(r.$offset??0))return r;r.$offset=a.$offset}return r},this.date=(r,o="default")=>{if(r===null)return null;let a;return o==="UTC"?a=this.createUTCDate(r):o==="system"||o==="default"&&!this.hasTimezonePlugin()?a=this.createSystemDate(r):a=this.createTZDate(r,o),this.locale===void 0?a:a.locale(this.locale)},this.getInvalidDate=()=>jr(new Date("Invalid date")),this.getTimezone=r=>{if(this.hasTimezonePlugin()){const o=r.$x?.$timezone;if(o)return o}return this.hasUTCPlugin()&&r.isUTC()?"UTC":"system"},this.setTimezone=(r,o)=>{if(this.getTimezone(r)===o)return r;if(o==="UTC"){if(!this.hasUTCPlugin())throw new Error(wC);return r.utc()}if(o==="system")return r.local();if(!this.hasTimezonePlugin()){if(o==="default")return r;throw new Error(UD)}return jr.tz(r,this.cleanTimezone(o))},this.toJsDate=r=>r.toDate(),this.parse=(r,o)=>r===""?null:this.dayjs(r,o,this.locale,!0),this.getCurrentLocaleCode=()=>this.locale||"en",this.is12HourCycleInCurrentLocale=()=>/A|a/.test(this.getLocaleFormats().LT||""),this.expandFormat=r=>{const o=this.getLocaleFormats(),a=i=>i.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(s,l,d)=>l||d.slice(1));return r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(i,s,l)=>{const d=l&&l.toUpperCase();return s||o[l]||a(o[d])})},this.isValid=r=>r==null?!1:r.isValid(),this.format=(r,o)=>this.formatByString(r,this.formats[o]),this.formatByString=(r,o)=>this.dayjs(r).format(o),this.formatNumber=r=>r,this.isEqual=(r,o)=>r===null&&o===null?!0:r===null||o===null?!1:r.toDate().getTime()===o.toDate().getTime(),this.isSameYear=(r,o)=>this.isSame(r,o,"YYYY"),this.isSameMonth=(r,o)=>this.isSame(r,o,"YYYY-MM"),this.isSameDay=(r,o)=>this.isSame(r,o,"YYYY-MM-DD"),this.isSameHour=(r,o)=>r.isSame(o,"hour"),this.isAfter=(r,o)=>r>o,this.isAfterYear=(r,o)=>this.hasUTCPlugin()?!this.isSameYear(r,o)&&r.utc()>o.utc():r.isAfter(o,"year"),this.isAfterDay=(r,o)=>this.hasUTCPlugin()?!this.isSameDay(r,o)&&r.utc()>o.utc():r.isAfter(o,"day"),this.isBefore=(r,o)=>r<o,this.isBeforeYear=(r,o)=>this.hasUTCPlugin()?!this.isSameYear(r,o)&&r.utc()<o.utc():r.isBefore(o,"year"),this.isBeforeDay=(r,o)=>this.hasUTCPlugin()?!this.isSameDay(r,o)&&r.utc()<o.utc():r.isBefore(o,"day"),this.isWithinRange=(r,[o,a])=>r>=o&&r<=a,this.startOfYear=r=>this.adjustOffset(r.startOf("year")),this.startOfMonth=r=>this.adjustOffset(r.startOf("month")),this.startOfWeek=r=>this.adjustOffset(this.setLocaleToValue(r).startOf("week")),this.startOfDay=r=>this.adjustOffset(r.startOf("day")),this.endOfYear=r=>this.adjustOffset(r.endOf("year")),this.endOfMonth=r=>this.adjustOffset(r.endOf("month")),this.endOfWeek=r=>this.adjustOffset(this.setLocaleToValue(r).endOf("week")),this.endOfDay=r=>this.adjustOffset(r.endOf("day")),this.addYears=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"year"):r.add(o,"year")),this.addMonths=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"month"):r.add(o,"month")),this.addWeeks=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"week"):r.add(o,"week")),this.addDays=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"day"):r.add(o,"day")),this.addHours=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"hour"):r.add(o,"hour")),this.addMinutes=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"minute"):r.add(o,"minute")),this.addSeconds=(r,o)=>this.adjustOffset(o<0?r.subtract(Math.abs(o),"second"):r.add(o,"second")),this.getYear=r=>r.year(),this.getMonth=r=>r.month(),this.getDate=r=>r.date(),this.getHours=r=>r.hour(),this.getMinutes=r=>r.minute(),this.getSeconds=r=>r.second(),this.getMilliseconds=r=>r.millisecond(),this.setYear=(r,o)=>this.adjustOffset(r.set("year",o)),this.setMonth=(r,o)=>this.adjustOffset(r.set("month",o)),this.setDate=(r,o)=>this.adjustOffset(r.set("date",o)),this.setHours=(r,o)=>this.adjustOffset(r.set("hour",o)),this.setMinutes=(r,o)=>this.adjustOffset(r.set("minute",o)),this.setSeconds=(r,o)=>this.adjustOffset(r.set("second",o)),this.setMilliseconds=(r,o)=>this.adjustOffset(r.set("millisecond",o)),this.getDaysInMonth=r=>r.daysInMonth(),this.getWeekArray=r=>{const o=this.startOfWeek(this.startOfMonth(r)),a=this.endOfWeek(this.endOfMonth(r));let i=0,s=o;const l=[];for(;s<a;){const d=Math.floor(i/7);l[d]=l[d]||[],l[d].push(s),s=this.addDays(s,1),i+=1}return l},this.getWeekNumber=r=>r.week(),this.getYearRange=([r,o])=>{const a=this.startOfYear(r),i=this.endOfYear(o),s=[];let l=a;for(;this.isBefore(l,i);)s.push(l),l=this.addYears(l,1);return s},this.dayjs=due(jr,t),this.locale=t,this.formats=Fe({},uue,n),jr.extend(Qce)}getDayOfWeek(t){return t.day()+1}};function Hn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function UF(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:py(t.components[n].defaultProps,r)}function pue({props:e,name:t,defaultTheme:n,themeId:r}){let o=ise(n);return o=o[r]||o,UF({theme:o,name:t,props:e})}function hue(e,t,n,r,o){const[a,i]=C.useState(()=>o&&n?n(e).matches:r?r(e).matches:t);return Go(()=>{if(!n)return;const s=n(e),l=()=>{i(s.matches)};return l(),s.addEventListener("change",l),()=>{s.removeEventListener("change",l)}},[e,n]),a}const mue={...jd},BF=mue.useSyncExternalStore;function gue(e,t,n,r,o){const a=C.useCallback(()=>t,[t]),i=C.useMemo(()=>{if(o&&n)return()=>n(e).matches;if(r!==null){const{matches:d}=r(e);return()=>d}return a},[a,e,r,o,n]),[s,l]=C.useMemo(()=>{if(n===null)return[a,()=>()=>{}];const d=n(e);return[()=>d.matches,u=>(d.addEventListener("change",u),()=>{d.removeEventListener("change",u)})]},[a,n,e]);return BF(l,s,i)}function VF(e={}){const{themeId:t}=e;return function(n,r={}){let o=K4();o&&t&&(o=o[t]||o);const a=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:i=!1,matchMedia:s=a?window.matchMedia:null,ssrMatchMedia:l=null,noSsr:d=!1}=UF({name:"MuiUseMediaQuery",props:r,theme:o});let u=typeof n=="function"?n(o):n;return u=u.replace(/^@media( ?)/m,""),u.includes("print")&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.","Using the print media query to modify print styles can lead to unexpected results.","Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
|
|
362
362
|
`)),(BF!==void 0?gue:hue)(u,i,s,l,d)}}VF();const HF=VF({themeId:bh});function Kr({props:e,name:t}){return pue({props:e,name:t,defaultTheme:u1,themeId:bh})}const qF=dt.oneOfType([dt.func,dt.object]),BD={};function WF(e,t){const n=C.useRef(BD);return n.current===BD&&(n.current=e(t)),n}const yue=[];function vue(e){C.useEffect(e,yue)}class bT{static create(){return new bT}currentId=null;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function xT(){const e=WF(bT.create).current;return vue(e.disposeEffect),e}function VD(e){try{return e.matches(":focus-visible")}catch{}return!1}function YF(e=window){const t=e.document.documentElement.clientWidth;return e.innerWidth-t}const bue={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function Zp(e){return typeof e=="string"}function GF(e,t,n){return e===void 0||Zp(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function B0(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function HD(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function KF(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:a}=e;if(!t){const y=qt(n?.className,a,o?.className,r?.className),x={...n?.style,...o?.style,...r?.style},w={...n,...o,...r};return y.length>0&&(w.className=y),Object.keys(x).length>0&&(w.style=x),{props:w,internalRef:void 0}}const i=B0({...o,...r}),s=HD(r),l=HD(o),d=t(i),u=qt(d?.className,n?.className,a,o?.className,r?.className),m={...d?.style,...n?.style,...o?.style,...r?.style},g={...d,...n,...l,...s};return u.length>0&&(g.className=u),Object.keys(m).length>0&&(g.style=m),{props:g,internalRef:d.ref}}function v1(e,t,n){return typeof e=="function"?e(t,n):e}function Sr(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:o=!1,...a}=e,i=o?{}:v1(n,r),{props:s,internalRef:l}=KF({...a,externalSlotProps:i}),d=vr(l,i?.ref,e.additionalProps?.ref);return GF(t,{...s,ref:d},r)}function wh(e){return parseInt(C.version,10)>=19?e?.props?.ref||null:e?.ref||null}const Km=(e,t)=>e.length!==t.length?!1:t.every(n=>e.includes(n)),xue=({openTo:e,defaultOpenTo:t,views:n,defaultViews:r})=>{const o=n??r;let a;if(e!=null)a=e;else if(o.includes(t))a=t;else if(o.length>0)a=o[0];else throw new Error("MUI X: The `views` prop must contain at least one view.");return{views:o,openTo:a}},V0=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n)),r},Bg=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:a,utils:i,timezone:s})=>{const l=V0(i,i.date(void 0,s),e);n&&i.isBefore(o,l)&&(o=l),t&&i.isAfter(r,l)&&(r=l);let d=e,u=e;for(i.isBefore(e,o)&&(d=o,u=null),i.isAfter(e,r)&&(u&&(u=r),d=null);d||u;){if(d&&i.isAfter(d,r)&&(d=null),u&&i.isBefore(u,o)&&(u=null),d){if(!a(d))return d;d=i.addDays(d,1)}if(u){if(!a(u))return u;u=i.addDays(u,-1)}}return null},wue=(e,t)=>t==null||!e.isValid(t)?null:t,ss=(e,t,n)=>t==null||!e.isValid(t)?n:t,Sue=(e,t,n)=>!e.isValid(t)&&t!=null&&!e.isValid(n)&&n!=null?!0:e.isEqual(t,n),wT=(e,t)=>{const n=[e.startOfYear(t)];for(;n.length<12;){const r=n[n.length-1];n.push(e.addMonths(r,1))}return n},QF=(e,t,n)=>n==="date"?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),Cue=["year","month","day"],qD=e=>Cue.includes(e),ST=(e,{format:t,views:n},r)=>{if(t!=null)return t;const o=e.formats;return Km(n,["year"])?o.year:Km(n,["month"])?o.month:Km(n,["day"])?o.dayOfMonth:Km(n,["month","year"])?`${o.month} ${o.year}`:Km(n,["day","month"])?`${o.month} ${o.dayOfMonth}`:r?/en/.test(e.getCurrentLocaleCode())?o.normalDateWithWeekday:o.normalDate:o.keyboardDate},kue=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(r=>e.addDays(n,r))},$ue=["hours","minutes","seconds"],Rue=e=>$ue.includes(e),WD=(e,t)=>t.getHours(e)*3600+t.getMinutes(e)*60+t.getSeconds(e),Tue=(e,t)=>(n,r)=>e?t.isAfter(n,r):WD(n,t)>WD(r,t),dl={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},Eue=e=>Math.max(...e.map(t=>dl[t.type]??1)),Qm=(e,t,n)=>{if(t===dl.year)return e.startOfYear(n);if(t===dl.month)return e.startOfMonth(n);if(t===dl.day)return e.startOfDay(n);let r=n;return t<dl.minutes&&(r=e.setMinutes(r,0)),t<dl.seconds&&(r=e.setSeconds(r,0)),t<dl.milliseconds&&(r=e.setMilliseconds(r,0)),r},Mue=({props:e,utils:t,granularity:n,timezone:r,getTodayDate:o})=>{let a=o?o():Qm(t,n,QF(t,r));e.minDate!=null&&t.isAfterDay(e.minDate,a)&&(a=Qm(t,n,e.minDate)),e.maxDate!=null&&t.isBeforeDay(e.maxDate,a)&&(a=Qm(t,n,e.maxDate));const i=Tue(e.disableIgnoringDatePartForTimeValidation??!1,t);return e.minTime!=null&&i(e.minTime,a)&&(a=Qm(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:V0(t,a,e.minTime))),e.maxTime!=null&&i(a,e.maxTime)&&(a=Qm(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:V0(t,a,e.maxTime))),a},XF=(e,t)=>{const n=e.formatTokenMap[t];if(n==null)throw new Error([`MUI X: The token "${t}" is not supported by the Date and Time Pickers.`,"Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported."].join(`
|
|
@@ -469,13 +469,13 @@ ${t}`}function Mce(e){return e?.status===403}function Xp(e){return`\`${e.replace
|
|
|
469
469
|
`));u&&A.current&&A.current.getSectionContent(O.startIndex).focus()},[]),{interactions:U,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}}},kp=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=kT(s,n?"input-rtl":"input-ltr",t),d=`${s.startSeparator}${l}${s.endSeparator}`,u=kp(d).length,m=d.length,g=kp(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=zs(),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]),U=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)&&U.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=kp(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=kp(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-kp(Ae.endSeparator||"").length;me=he.slice(Ae.start+kp(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]),X=!(R.current&&R.current===Ua(document))&&L;return{interactions:U,returnedValue:{readOnly:u,onBlur:K,onClick:Y,onFocus:H,onPaste:ae,inputRef:z,enableAccessibleFieldDOMStructure:!1,placeholder:ue,inputMode:ie,autoComplete:"off",value:X?"":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=zs(),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),U=a?Nge:Lge,I=C.useMemo(()=>Uue(b.sections,w&&!a),[b.sections,w,a]),{returnedValue:H,interactions:Y}=U(Fe({},e,S,R,{areAllSectionsEmpty:N,sectionOrder:I})),ae=Yt(X=>{if(l?.(X),!i)switch(!0){case((X.ctrlKey||X.metaKey)&&String.fromCharCode(X.keyCode)==="A"&&!X.shiftKey&&!X.altKey):{X.preventDefault(),T("all");break}case X.key==="ArrowRight":{if(X.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 X.key==="ArrowLeft":{if(X.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 X.key==="Delete":{if(X.preventDefault(),s)break;k==null||k==="all"?O():P(),z();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(X.key):{if(X.preventDefault(),s||$==null)break;k==="all"&&T($);const ee=b.sections[$],Z=g.getActiveDateManager(t,b,ee),de=Aue(t,_,ee,X.key,F,L,Z.date,{minutesStep:o});D({activeSection:ee,newSectionValue:de,shouldGoToNextSection:!1});break}}});Go(()=>{Y.syncSelectionToDOM()});const{hasValidationError:K}=l3({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((X,...ee)=>{X.preventDefault(),m?.(X,...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"],Uge=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=Sr({elementType:d,externalSlotProps:s?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),m=Hn(u,_ge),g=i?.clearIcon??Qhe,y=Sr({elementType:g,externalSlotProps:s?.clearIcon,ownerState:{}});return Fe({},l,{InputProps:Fe({},o,{endAdornment:p.jsxs(C.Fragment,{children:[n&&p.jsx(c3,{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]]})},Bge=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],Vge=(e,t)=>C.useMemo(()=>{const n=Fe({},e),r={},o=a=>{n.hasOwnProperty(a)&&(r[a]=n[a],delete n[a])};return Bge.forEach(o),i3.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),Hge=e=>{const t=Qr(),n=Jy();return Fe({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:ss(t,e.minDate,n.minDate),maxDate:ss(t,e.maxDate,n.maxDate)})},qge=e=>{const t=Hge(e),{forwardedProps:n,internalProps:r}=Vge(t,"date");return zge({forwardedProps:n,internalProps:r,valueManager:Cl,fieldValueManager:que,validator:ev,valueType:"date"})};function Wge(e){return kn("MuiPickersTextField",e)}vn("MuiPickersTextField",["root","focused","disabled","error","required"]);function Yge(e){return kn("MuiPickersInputBase",e)}const Np=vn("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function Gge(e){return kn("MuiPickersSectionList",e)}const eg=vn("MuiPickersSectionList",["root","section","sectionContent"]),Kge=["slots","slotProps","elements","sectionListRef"],q3=ot("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),W3=ot("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),Y3=ot("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),G3=ot("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),Qge=e=>{const{classes:t}=e;return Sn({root:["root"],section:["section"],sectionContent:["sectionContent"]},Gge,t)};function Xge(e){const{slots:t,slotProps:n,element:r,classes:o}=e,a=t?.section??W3,i=Sr({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),s=t?.sectionContent??G3,l=Sr({elementType:s,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),d=t?.sectionSeparator??Y3,u=Sr({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),m=Sr({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??q3,y=Sr({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,M1=ot("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%"}}]})),WT=ot(q3,{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=ot(W3,{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=ot(G3,{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=ot(Y3,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),oye=ot("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${Ft(s)}`,l==="small"&&"inputSizeSmall",!!u&&"adornedStart",!!d&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return Sn(m,Yge,o)},YT=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),_=zs(),R=_s();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:_}),U=aye(N),I=m?.root||M1,H=Sr({elementType:I,externalSlotProps:g?.root,externalForwardedProps:D,additionalProps:{"aria-invalid":R.error,ref:F},className:U.root,ownerState:N}),Y=m?.input||WT;return p.jsxs(I,Fe({},H,{children:[d,p.jsx(Zge,{sectionListRef:P,elements:r,contentEditable:y,tabIndex:x,className:U.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:Np.sectionContent},sectionSeparator:({position:ae})=>({className:ae==="before"?Np.sectionBefore:Np.sectionAfter})}}),l,u?u(Fe({},R)):null,p.jsx(oye,Fe({name:$,className:U.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 kn("MuiPickersOutlinedInput",e)}const Ps=Fe({},Np,vn("MuiPickersOutlinedInput",["root","notchedOutline","input"])),sye=["children","className","label","notched","shrink"],lye=ot("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}}),IN=ot("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),cye=ot("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(IN,{children:n}):p.jsx(IN,{className:"notranslate",children:""})})}))}const dye=["label","autoFocus","ownerState","notched"],fye=ot(M1,{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 .${Ps.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${Ps.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${Ps.focused} .${Ps.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${Ps.disabled}`]:{[`& .${Ps.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${Ps.error} .${Ps.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:{[`&.${Ps.focused}:not(.${Ps.error}) .${Ps.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),pye=ot(WT,{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=Sn({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},iye,t);return Fe({},t,n)},K3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:a}=n,i=Hn(n,dye),s=_s(),l=Fe({},n,o,s,{color:s?.color||"primary"}),d=hye(l);return p.jsx(YT,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}))});K3.muiName="Input";function mye(e){return kn("MuiPickersFilledInput",e)}const cd=Fe({},Np,vn("MuiPickersFilledInput",["root","underline","input"])),gye=["label","autoFocus","disableUnderline","ownerState"],yye=ot(M1,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>Jb(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=ot(WT,{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=Sn({root:["root",!n&&"underline"],input:["input"]},mye,t);return Fe({},t,r)},Q3=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=_s(),l=Fe({},n,a,s,{color:s?.color||"primary"}),d=bye(l);return p.jsx(YT,Fe({slots:{root:yye,input:vye},slotProps:{root:{disableUnderline:o}}},i,{label:r,classes:d,ref:t}))});Q3.muiName="Input";function xye(e){return kn("MuiPickersFilledInput",e)}const tg=Fe({},Np,vn("MuiPickersInput",["root","input"])),wye=["label","autoFocus","disableUnderline","ownerState"],Sye=ot(M1,{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=Sn({root:["root",!n&&"underline"],input:["input"]},xye,t);return Fe({},t,r)},X3=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=_s(),l=Fe({},n,a,s,{disableUnderline:o,color:s?.color||"primary"}),d=Cye(l);return p.jsx(YT,Fe({slots:{root:Sye}},i,{label:r,classes:d,ref:t}))});X3.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:X3,filled:Q3,outlined:K3},Rye=ot(D3,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),Tye=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return Sn({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:U,helperText:I,FormHelperTextProps:H,label:Y,InputLabelProps:ae}=n,K=Hn(n,kye),oe=C.useRef(null),ue=vr(t,oe),G=Fs(N),ie=I&&G?`${G}-helper-text`:void 0,X=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:qt(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(A3,Fe({htmlFor:G,id:X},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:U,role:"group","aria-labelledby":X,"aria-describedby":ie,"aria-live":ie?"polite":void 0},m)),I&&p.jsx(N3,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"],Z3=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=Sr({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=qge(u),g=jye(m),y=Uge(Fe({},g,{slots:r,slotProps:o}));return p.jsx(d,Fe({},y))}),J3=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i,timezone:s})=>{const l=Jd();return C.useCallback(d=>ev({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=J3({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=>kn("MuiPickersFadeTransitionGroup",e);vn("MuiPickersFadeTransitionGroup",["root"]);const Lye=e=>{const{classes:t}=e;return Sn({root:["root"]},Iye,t)},zye=ot(tv,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function e_(e){const t=Kr({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Lye(t),s=Qd();return o?n:p.jsx(zye,{className:qt(i.root,r),children:p.jsx(Vd,{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 kn("MuiPickersDay",e)}const ud=vn("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"],Uye=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:a,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:s,classes:l}=e,d=i&&!s;return Sn({root:["root",t&&!d&&"selected",a&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",i&&s&&"dayOutsideMonth",d&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},Fye,l)},t_=({theme:e})=>Fe({},e.typography.caption,{width:vy,height:vy,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})`:rs(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:rs(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 ${C1}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}`}}}]}),n_=(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]},Bye=ot(Jp,{name:"MuiPickersDay",slot:"Root",overridesResolver:n_})(t_),Vye=ot("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:n_})(({theme:e})=>Fe({},t_({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=Uye(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(Vye,{className:qt(A.root,A.hiddenDaySpacingFiller,o),ownerState:D,role:P.role}):p.jsx(Bye,Fe({className:qt(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")}))}),qye=C.memo(Hye),Wye=e=>kn("MuiPickersSlideTransition",e),Ui=vn("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 Sn(r,Wye,t)},Kye=ot(tv,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${Ui["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${Ui["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${Ui.slideEnterActive}`]:t.slideEnterActive},{[`.${Ui.slideExit}`]:t.slideExit},{[`.${Ui["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${Ui["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},[`& .${Ui["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${Ui["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${Ui.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${Ui.slideExit}`]:{transform:"translate(0%)"},[`& .${Ui["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${Ui["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=Qd();if(o)return p.jsx("div",{className:qt(s.root,r),children:n});const d={exit:s.exit,enterActive:s.enterActive,enter:s.enter,exitActive:s.exitActive};return p.jsx(Kye,{className:qt(s.root,r),childFactory:u=>C.cloneElement(u,{classNames:d}),role:"presentation",children:p.jsx(RT,Fe({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:d},i,{children:n}),a)})}const Xye=e=>kn("MuiDayCalendar",e);vn("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 Sn({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Xye,t)},r_=(vy+C1*2)*6,tve=ot("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),nve=ot("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),rve=ot(Ar,{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=ot(Ar,{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=ot(Ar,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>Fe({},e.typography.caption,{width:vy,height:vy,padding:0,margin:`0 ${C1}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),ive=ot("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:r_}),sve=ot(Qye,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:r_}),lve=ot("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),cve=ot("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${C1}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=x1(w),$=r!==null&&S.isSameDay(n,r),k=o.some(R=>S.isSameDay(R,n)),T=S.isSameDay(n,b),O=y?.day??qye,P=Sr({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,U=x1(N),I=eve(t),H=zs(),Y=J3({shouldDisableDate:T,shouldDisableMonth:O,shouldDisableYear:P,minDate:$,maxDate:k,disablePast:S,disableFuture:b,timezone:N}),ae=vc(),[K,oe]=es({name:"DayCalendar",state:"hasFocus",controlled:A,default:z??!1}),[ue,G]=C.useState(()=>s||U),ie=Yt(Ae=>{m||d(Ae)}),X=Ae=>{Y(Ae)||(r(Ae),G(Ae),F?.(!0),oe(!0))},ee=Yt((Ae,Re)=>{switch(Ae.key){case"ArrowUp":X(n.addDays(Re,-7)),Ae.preventDefault();break;case"ArrowDown":X(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=Bg({utils:n,date:re,minDate:H?re:n.startOfMonth(_e),maxDate:H?n.endOfMonth(_e):re,isDateDisabled:Y,timezone:N});X(Me||re),Ae.preventDefault();break}case"ArrowRight":{const re=n.addDays(Re,H?-1:1),_e=n.addMonths(Re,H?-1:1),Me=Bg({utils:n,date:re,minDate:H?n.startOfMonth(_e):re,maxDate:H?re:n.endOfMonth(_e),isDateDisabled:Y,timezone:N});X(Me||re),Ae.preventDefault();break}case"Home":X(n.startOfWeek(Re)),Ae.preventDefault();break;case"End":X(n.endOfWeek(Re)),Ae.preventDefault();break;case"PageUp":X(n.addMonths(Re,1)),Ae.preventDefault();break;case"PageDown":X(n.addMonths(Re,-1)),Ae.preventDefault();break}}),Z=Yt((Ae,Re)=>X(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)?Bg({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,U).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:qt(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 kn("MuiPickersMonth",e)}const Nb=vn("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 Sn({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},fve,r)},mve=ot("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=ot("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Nb.disabled}`]:t.disabled},{[`&.${Nb.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})`:rs(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:rs(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Nb.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Nb.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=Sr({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:qt(k.root,r),ownerState:t},b,{children:p.jsx(T,Fe({},O))}))});function vve(e){return kn("MuiMonthCalendar",e)}vn("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 Sn({root:["root"]},vve,t)};function wve(e,t){const n=Qr(),r=Jy(),o=Kr({props:e,name:t});return Fe({disableFuture:!1,disablePast:!1},o,{minDate:ss(n,o.minDate,r.minDate),maxDate:ss(n,o.maxDate,r.maxDate)})}const Sve=ot("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:k1,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:_}=zT({name:"MonthCalendar",timezone:T,value:o,defaultValue:a,referenceDate:i,onChange:g,valueManager:Cl}),R=x1(_),z=zs(),N=Qr(),U=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(U)),[ue,G]=es({name:"MonthCalendar",state:"hasFocus",controlled:b,default:w??!1}),ie=Yt(he=>{G(he),$&&$(he)}),X=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??U,me);L(se)}),Z=Yt(he=>{X(N.setMonth(F??U,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:qt(H.root,r),ownerState:I,role:"radiogroup","aria-labelledby":O},A,{children:wT(N,F??U).map(he=>{const me=N.getMonth(he),se=N.format(he,"monthShort"),ve=N.format(he,"month"),Le=me===ae,Ae=s||X(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 kn("MuiPickersYear",e)}const Ib=vn("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 Sn({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},kve,r)},Tve=ot("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=ot("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${Ib.disabled}`]:t.disabled},{[`&.${Ib.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})`:rs(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:rs(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}}})),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=Sr({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:qt($.root,r),ownerState:t},S,{children:p.jsx(k,Fe({},T))}))});function Ove(e){return kn("MuiYearCalendar",e)}vn("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 Sn({root:["root"]},Ove,t)};function Ave(e,t){const n=Qr(),r=Jy(),o=Kr({props:e,name:t});return Fe({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:ss(n,o.minDate,r.minDate),maxDate:ss(n,o.maxDate,r.maxDate)})}const Dve=ot("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:k1,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}=zT({name:"YearCalendar",timezone:O,value:a,defaultValue:i,referenceDate:s,onChange:y,valueManager:Cl}),z=x1(R),N=zs(),U=Qr(),I=C.useMemo(()=>Cl.getInitialReferenceValue({value:L,utils:U,props:n,timezone:R,referenceDate:s,granularity:dl.year}),[]),H=n,Y=jve(H),ae=C.useMemo(()=>U.getYear(z),[U,z]),K=C.useMemo(()=>L!=null?U.getYear(L):null,[L,U]),[oe,ue]=C.useState(()=>K||U.getYear(I)),[G,ie]=es({name:"YearCalendar",state:"hasFocus",controlled:b,default:r??!1}),X=Yt(Re=>{ie(Re),$&&$(Re)}),ee=C.useCallback(Re=>{if(u&&U.isBeforeYear(Re,z)||d&&U.isAfterYear(Re,z)||g&&U.isBeforeYear(Re,g)||m&&U.isAfterYear(Re,m))return!0;if(!w)return!1;const re=U.startOfYear(Re);return w(re)},[d,u,m,g,z,w,U]),Z=Yt((Re,re)=>{if(x)return;const _e=U.setYear(L??I,re);_(_e)}),de=Yt(Re=>{ee(U.setYear(L??I,Re))||(ue(Re),X(!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&&X(!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,Ke=ve.current.scrollTop,Je=_e+re;re>Me||_e<Ke||(ve.current.scrollTop=Je-Me/2-re/2)},[r]);const Ae=U.getYearRange([g,m]);return k==="desc"&&Ae.reverse(),p.jsx(Dve,Fe({ref:Le,className:qt(Y.root,o),ownerState:H,role:"radiogroup","aria-labelledby":P},F,{children:Ae.map(Re=>{const re=U.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:U.format(Re,"year")},U.format(Re,"year"))})}))}),Ive=e=>kn("MuiPickersCalendarHeader",e),Lve=vn("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function zve(e){return kn("MuiPickersArrowSwitcher",e)}vn("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"],Uve=["ownerState"],Bve=ot("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),Vve=ot("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),LN=ot(Tu,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),Hve=e=>{const{classes:t}=e;return Sn({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},zve,t)},qve=C.forwardRef(function(e,t){const n=zs(),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??LN,D=Sr({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:qt(k.button,k.previousIconButton)}),A=i?.nextIconButton??LN,F=Sr({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:qt(k.button,k.nextIconButton)}),L=i?.leftArrowIcon??Yhe,_=Sr({elementType:L,externalSlotProps:s?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:$,className:k.leftArrowIcon}),R=Hn(_,_ve),z=i?.rightArrowIcon??Ghe,N=Sr({elementType:z,externalSlotProps:s?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:$,className:k.rightArrowIcon}),U=Hn(N,Uve);return p.jsxs(Bve,Fe({ref:t,className:qt(k.root,a),ownerState:$},b,{children:[p.jsx(P,Fe({},D,{children:n?p.jsx(z,Fe({},U)):p.jsx(L,Fe({},R))})),o?p.jsx(Ar,{variant:"subtitle1",component:"span",id:S,children:o}):p.jsx(Vve,{className:k.spacer,ownerState:$}),p.jsx(A,Fe({},F,{children:n?p.jsx(L,Fe({},R)):p.jsx(z,Fe({},U))}))]}))});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 Sn({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},Ive,t)},Xve=ot("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=ot("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=ot("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),ebe=ot(Tu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Lve.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),tbe=ot(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=Sr({elementType:F,externalSlotProps:i?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(w)},ownerState:D,className:A.switchViewButton}),_=a?.switchViewIcon??tbe,R=Sr({elementType:_,externalSlotProps:i?.switchViewIcon,ownerState:D,className:A.switchViewIcon}),z=Hn(R,Kve),N=()=>y(r.addMonths(s,1),"left"),U=()=>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:qt(A.root,k),ref:t,children:[p.jsxs(Zve,{role:"presentation",onClick:Y,ownerState:D,"aria-live":"polite",className:A.labelContainer,children:[p.jsx(e_,{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(Vd,{in:w==="day",appear:!S,enter:!S,children:p.jsx(qve,{slots:a,slotProps:i,onGoToPrevious:U,isPreviousDisabled:H,previousLabel:n.previousMonth,onGoToNext:N,isNextDisabled:I,nextLabel:n.nextMonth})})]}))}),rbe=ot("div")({overflow:"hidden",width:k1,maxHeight:FT,display:"flex",flexDirection:"column",margin:"0 auto"}),obe=e=>kn("MuiDateCalendar",e);vn("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 Sn({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},obe,t)};function sbe(e,t){const n=Qr(),r=Jy(),o=C3(),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:ss(n,a.minDate,r.minDate),maxDate:ss(n,a.maxDate,r.maxDate)})}const lbe=ot(rbe,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:FT}),cbe=ot(e_,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),ube=C.forwardRef(function(e,t){const n=Qr(),r=Fs(),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:U,dayOfWeekFormatter:I,slots:H,slotProps:Y,loading:ae,renderLoading:K,displayWeekNumber:oe,yearsOrder:ue,yearsPerRow:G,monthsPerRow:ie,timezone:X}=o,ee=Hn(o,abe),{value:Z,handleValueChange:de,timezone:le}=zT({name:"DateCalendar",timezone:X,value:s,defaultValue:l,referenceDate:d,onChange:g,valueManager:Cl}),{view:fe,setView:he,focusedView:me,setFocusedView:se,goToNextView:ve,setValueAndGoToNextView:Le}=k3({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:Ke,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,Bt=D&&Z||L,at=`${r}-grid-label`,tt=me!==null,pt=H?.calendarHeader??nbe,ze=Sr({elementType:pt,externalSlotProps:Y?.calendarHeader,additionalProps:{views:T,view:fe,currentMonth:Re.currentMonth,onViewChange:he,onMonthChange:(nn,Ut)=>Me({newMonth:nn,direction:Ut}),minDate:St,maxDate:Bt,disabled:D,disablePast:m,disableFuture:u,reduceAnimations:w,timezone:le,labelId:at},ownerState:o}),be=Yt(nn=>{const Ut=n.startOfMonth(nn),fn=n.endOfMonth(nn),$n=Ke(nn)?Bg({utils:n,date:nn,minDate:n.isBefore(F,Ut)?Ut:F,maxDate:n.isAfter(L,fn)?fn:L,disablePast:m,disableFuture:u,isDateDisabled:Ke,timezone:le}):nn;$n?(Le($n,"finish"),x?.(Ut)):(ve(),_e(Ut)),re($n,!0)}),qe=Yt(nn=>{const Ut=n.startOfYear(nn),fn=n.endOfYear(nn),$n=Ke(nn)?Bg({utils:n,date:nn,minDate:n.isBefore(F,Ut)?Ut:F,maxDate:n.isAfter(L,fn)?fn:L,disablePast:m,disableFuture:u,isDateDisabled:Ke,timezone:le}):nn;$n?(Le($n,"finish"),y?.($n)):(ve(),_e(Ut)),re($n,!0)}),Oe=Yt(nn=>de(nn&&V0(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:qt(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:qe,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:U,dayOfWeekFormatter:I,displayWeekNumber:oe,loading:ae,renderLoading:K}))]})})]}))}),Ip=({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:U,dayOfWeekFormatter:I,sx:H,autoFocus:Y,fixedWeekNumber:ae,displayWeekNumber:K,timezone:oe})=>p.jsx(ube,{view:e,onViewChange:t,views:n.filter(qD),focusedView:r&&qD(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:U,dayOfWeekFormatter:I,sx:H,autoFocus:Y,fixedWeekNumber:ae,displayWeekNumber:K,timezone:oe}),o_=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=a3(e,"MuiDesktopDatePicker"),a=Fe({day:Ip,month:Ip,year:Ip},o.viewRenderers),i=Fe({},o,{viewRenderers:a,format:ST(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:Fe({openPickerIcon:Khe,field:Z3},o.slots),slotProps:Fe({},o.slotProps,{field:l=>Fe({},v1(o.slotProps?.field,l),s3(o),{ref:t}),toolbar:Fe({hidden:!0},o.slotProps?.toolbar)})}),{renderPicker:s}=qhe({props:i,valueManager:Cl,valueType:"date",getOpenDialogAriaText:r3({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:ev});return s()});o_.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:qF,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 kn("MuiDialogContent",e)}vn("MuiDialogContent",["root","dividers"]);const fbe=vn("MuiDialogTitle",["root"]),pbe=e=>{const{classes:t,dividers:n}=e;return Sn({root:["root",n&&"dividers"]},dbe,t)},hbe=ot("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(rr(({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=tr({props:e,name:"MuiDialogContent"}),{className:r,dividers:o=!1,...a}=n,i={...n,dividers:o},s=pbe(i);return p.jsx(hbe,{className:qt(s.root,r),ownerState:i,ref:t,...a})});function gbe(e){return kn("MuiDialog",e)}const Yg=vn("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),ybe=C.createContext({}),vbe=ot(L3,{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${Ft(n)}`],paper:["paper",`paperScroll${Ft(n)}`,`paperWidth${Ft(String(r))}`,o&&"paperFullWidth",a&&"paperFullScreen"]};return Sn(i,gbe,t)},xbe=ot(z3,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),wbe=ot("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Ft(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=ot(ef,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Ft(n.scroll)}`],t[`paperWidth${Ft(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(rr(({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)`,[`&.${Yg.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}`,[`&.${Yg.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,[`&.${Yg.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),Cbe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiDialog"}),r=Qd(),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=ef,PaperProps:T={},scroll:O="paper",slots:P={},slotProps:D={},TransitionComponent:A=Vd,transitionDuration:F=o,TransitionProps:L,..._}=n,R={...n,disableEscapeKeyDown:g,fullScreen:y,fullWidth:x,maxWidth:w,scroll:O},z=bbe(R),N=C.useRef(),U=me=>{N.current=me.target===me.currentTarget},I=me=>{S&&S(me),N.current&&(N.current=null,b&&b(me,"backdropClick"))},H=Fs(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]=mr("root",{elementType:xbe,shouldForwardComponentProp:!0,externalForwardedProps:oe,ownerState:R,className:qt(z.root,m),ref:t}),[ie,X]=mr("backdrop",{elementType:vbe,shouldForwardComponentProp:!0,externalForwardedProps:oe,ownerState:R}),[ee,Z]=mr("paper",{elementType:Sbe,shouldForwardComponentProp:!0,externalForwardedProps:oe,ownerState:R,className:qt(z.paper,T.className)}),[de,le]=mr("container",{elementType:wbe,externalForwardedProps:oe,ownerState:R,className:z.container}),[fe,he]=mr("transition",{elementType:Vd,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,...X}},disableEscapeKeyDown:g,onClose:b,open:$,onClick:I,...G,..._,children:p.jsx(fe,{...he,children:p.jsx(de,{onMouseDown:U,...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=ot(Cbe)({[`& .${Yg.container}`]:{outline:0},[`& .${Yg.paper}`]:{outline:0,minWidth:k1}}),$be=ot(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??Vd;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=Fs(),P=a?.toolbar?.hidden??!1,{open:D,actions:A,layoutProps:F,renderCurrentView:L,fieldProps:_,contextValue:R}=$3(Fe({},r,{props:t,fieldRef:T,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),z=o.field,N=Sr({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 U=Fe({textField:o.textField},N.slots),I=o.layout??P3;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(j3,{contextValue:R,localeText:k,children:[p.jsx(z,Fe({},N,{slots:U,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()}))}))]})}},a_=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=a3(e,"MuiMobileDatePicker"),a=Fe({day:Ip,month:Ip,year:Ip},o.viewRenderers),i=Fe({},o,{viewRenderers:a,format:ST(r,o,!1),slots:Fe({field:Z3},o.slots),slotProps:Fe({},o.slotProps,{field:l=>Fe({},v1(o.slotProps?.field,l),s3(o),{ref:t}),toolbar:Fe({hidden:!1},o.slotProps?.toolbar)})}),{renderPicker:s}=Ebe({props:i,valueManager:Cl,valueType:"date",getOpenDialogAriaText:r3({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:ev});return s()});a_.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:qF,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 HF(r,{defaultMatches:!0})?p.jsx(o_,Fe({ref:t},o)):p.jsx(a_,Fe({ref:t},o))}),i_=400;function s_(e,t){const[n,r]=C.useState(e);return C.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function l_(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]),$=s_(b,i_);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(VR),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 O1(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}jr.extend(pT);const zN=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
471
|
`):void 0}function c_({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}=qr(),m=e.type??"string",g=Ibe(e),y=O1(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"||kF(t),$=X=>p.jsx($i,{label:d,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:p.jsxs(p.Fragment,{children:[`Not a ${X}. Clear it to pick one.`,w?p.jsx("br",{}):null,w]}),slotProps:{input:{endAdornment:p.jsx(u_,{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"?CF(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 X=Z=>{const de=O?hT(Z):void 0;if(Z.length===0||de===""){n(null);return}n(O?de:Z[0])},ee=Bbe(z,i,s);return p.jsx(d_.Provider,{value:ee,children:p.jsx(mK,{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:Ube},value:T?D:D[0]??null,onChange:(Z,de)=>X(de===null?[]:Array.isArray(de)?de:[de]),renderInput:Z=>p.jsx($i,{...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)&&X([...D,le])}}}}),fullWidth:!0})})}const N=ou(m)&&uu(m)==="number",{rangeMin:U,rangeMax:I}=e,H=N&&typeof t=="string"?RF(t):void 0,Y=N&&typeof t=="string"?TF(t):void 0;if((N||m==="number")&&U!==void 0&&I!==void 0&&(!N||t===void 0||t===null||t===""||H!==void 0||Y!==void 0)){const X=Y??(H!==void 0?[H,I]:void 0),ee=N?X?.[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??U,le=Array.isArray(L)?[L[0],L[1]]:X??[U,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(mk,{fullWidth:!0,children:[p.jsxs(Te,{component:"fieldset",sx:se=>({m:0,minWidth:0,border:u.cardBorder,borderRadius:2,px:`${zN}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(by,{onClear:()=>n(null),sx:{p:0}})]}),p.jsx(lJ,{size:"small",min:U,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<=U&&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:U}),p.jsx(wt,{variant:"caption",color:"text.secondary",children:I})]})]}),w&&p.jsx(gk,{sx:{mx:`${zN}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 X=Fbe(t);if(X!==void 0)return p.jsx(_be,{label:d,state:X,onChange:n,helperNode:w,defaultDisplay:y})}if(K&&ue){const X=oe?jr.utc(t):null;return p.jsx(G0,{label:d,committed:X?.isValid()?X:null,toValue:ee=>ee.format("YYYY-MM-DD"),onChange:n,helperText:w})}if(uu(m)==="boolean"){const X=typeof t=="string"?fce(t):void 0;if(t==null||t===""||X!==void 0)return p.jsx(zbe,{label:d,picked:X,emptyOverride:t==="",onChange:n,helperNode:w,defaultDisplay:y})}if(m==="boolean"){const X=typeof t=="boolean";if(!X&&t!==void 0&&t!==null)return $("true or false");const ee=e.default?.trim()==="true";return p.jsxs(mk,{children:[p.jsxs(Yn,{direction:"row",alignItems:"center",children:[p.jsx(ER,{control:p.jsx(rQ,{checked:X?t:ee,onChange:Z=>n(Z.target.checked)}),label:d}),X&&p.jsx(by,{onClear:()=>n(null),edge:"end"})]}),w&&p.jsx(gk,{children:w})]})}if(m==="number"){const X=t!=null;return X&&t!==""&&typeof t!="number"?$("number"):p.jsx(FN,{label:d,type:"number",committed:typeof t=="number"?String(t):"",onCommit:ee=>n(ee===""?null:Number(ee)),placeholder:y,helperText:w,isOverridden:X,onClear:()=>n(null)})}if(m==="date"||m==="timestamp"||m==="timestamptz"){const X=t instanceof Date?t:typeof t=="string"?(Z=>Z instanceof Date?Z:null)(IF(m,t)):null,ee=X?jr.utc(X):null;return t!=null&&t!==""&&X===null?$("date"):p.jsx(G0,{label:d,committed:ee,toValue:Z=>wce(Z,X??void 0),onChange:n,helperText:w})}const G=typeof t=="string"?t:"",ie=t!=null;return p.jsx(FN,{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 FN({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}=l_(n,r,{unset:s&&!i});return p.jsx($i,{label:e,type:t,value:d,onChange:y=>u(y.target.value),placeholder:o,helperText:a,slotProps:{input:{endAdornment:i&&p.jsx(u_,{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 G0({label:e,committed:t,toValue:n,onChange:r,helperText:o,minDate:a}){const{draft:i,change:s,reset:l,bind:d}=l_(t,u=>{u===null?r(null):u.isValid()&&r(n(u))},{same:Lbe});return p.jsx(n3,{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 by({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(Bce,{fontSize:"small"})})}function u_({onClear:e}){return p.jsx(OR,{position:"end",onMouseDown:t=>t.preventDefault(),children:p.jsx(by,{onClear:e,edge:"end"})})}const Lb="__any__";function zbe({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:a}){const i=t??(n?Lb:"");return p.jsx(Te,{"data-testid":"boolean-filter",children:p.jsxs($i,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:s=>s==="true"||s==="false"?s:s===Lb?"Any":a||"Any"},input:{endAdornment:i!==""?p.jsx(by,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:s=>{s.target.value!==Lb&&r(s.target.value)},children:[n&&p.jsx(ea,{value:Lb,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=EF(e);if(t!==void 0)return{kind:"preset",key:t};const n=MF(e);if(n!==void 0)return{kind:"days",...n}}const zb="__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?zb:t.kind==="preset"?t.key:t.kind==="any"?RC:"",g=x=>{d(x),x.from&&x.to&&!jr.utc(x.to).isBefore(jr.utc(x.from))&&n(yce(x.from,x.to))},y=x=>{const w=x?jr.utc(x):null;return w?.isValid()?w:null};return p.jsxs(Yn,{direction:"row",spacing:1,"data-testid":"time-range",children:[p.jsxs($i,{select:!0,label:e,value:m,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:x=>{if(x===zb)return"Custom range";if(x===RC)return"Any time";const w=hy.find(S=>S.key===x);return w?w.label:o??"Any time"}},input:{endAdornment:u?p.jsx(by,{onClear:()=>{s(!1),d({}),n(null)},sx:{mr:2}}):void 0}},onChange:x=>{const w=x.target.value;if(w===zb){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"}),hy.map(x=>p.jsx(ea,{value:x.key,children:x.label},x.key)),p.jsx(ea,{value:zb,children:"Custom range"})]}),i&&p.jsxs(p.Fragment,{children:[p.jsx(G0,{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(G0,{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 d_=C.createContext(void 0);function Ube({children:e,...t}){const n=C.useContext(d_);return p.jsxs(Ka,{...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 Fb=e=>e.toLocaleString("en-US");function Bbe(e,t,n){if(e.active)return e.searching?"Searching all values…":e.failed?`Could not search all values. Showing matches in the first ${Fb(Md)}.`:e.page?.truncated?`Showing the first ${Fb(yT)} matches. Keep typing to narrow them.`:void 0;if(t)return n?`Showing the first ${Fb(Md)} values. Type to search them all.`:`Showing the first ${Fb(Md)} values. A value not listed can still be typed.`}const Vbe=C.createContext(void 0),Ch=()=>C.useContext(Vbe),Tg="remove-badge",Hbe={[`& .${Tg}`]:{opacity:0},[`&:hover .${Tg}, &:focus-within .${Tg}`]:{opacity:1},"@media (hover: none)":{[`& .${Tg}`]:{opacity:1}}};function qbe({label:e,onRemove:t,disabledReason:n,inset:r=0}){const{theme:o}=qr(),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 ${Xd(o.cardBorder)}`,bgcolor:s.palette.background.paper,color:s.palette.text.secondary,cursor:a?"default":"pointer",transition:`opacity ${Xy}`,...Zy,"&:hover":{bgcolor:s.palette.background.paper,color:a?s.palette.text.secondary:s.palette.text.primary,borderColor:fF(o.cardBorder,o.tileTitle)}}),children:p.jsx(xh,{sx:{fontSize:12}})});return a?p.jsx(Ur,{title:n,children:i}):i}const GT=e=>e.required===!0,Wbe=(e,t)=>e==null||e===""&&!NF(t);function Ybe(e,t,n){return e.filter(r=>r.name!==void 0&>(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 f_=e=>e.label??e.name??"";function p_(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Kbe(e){const t=e.map(f_);return`Pick a value for ${p_(t)} to see this report.`}function Qbe(e){return`Waiting for ${p_(e.map(f_))}.`}const g$=28,Xbe=/^\d{4}-\d{2}-\d{2}$/,h_=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:h_.format(t)}function Zbe(e,t){if(e.length===0)return"";const n=e.join(", ");return t?n:n.length<=g$||e.length===1?K0(n,t):`${K0(e[0]??"",t)} +${e.length-1}`}function K0(e,t){return!t&&e.length>g$?`${e.slice(0,g$-1)}…`:e}function Jbe(e,t){if(GT(e))return"Required";const n=e.type??"string",r=O1(n,e.default);if(r!==void 0&&r!=="")return m_(n,r,t);const o=uu(n)??n;return e.control==="select"||e.control==="multiselect"||o==="string"?"All":"Any"}function m_(e,t,n){if(!ou(e))return K0(TC(t),n);const r=uu(e);if(r==="string"&&kF(t))return Zbe(CF(t),n);if(r==="number"){const o=TF(t);if(o)return`${o[0]}–${o[1]}`;const a=RF(t);if(a!==void 0)return`≥ ${a}`}if(r==="date"||r==="timestamp"||r==="timestamptz"){const o=EF(t);if(o)return hy.find(i=>i.key===o)?.label??t;const a=MF(t);if(a)return`${TC(a.firstDay)} – ${TC(a.lastDay)}`}return K0(t,n)}function g_(e,t,n){return t==null?Jbe(e,n):t instanceof Date?Number.isNaN(t.getTime())?"":h_.format(t):typeof t=="boolean"?t?"Yes":"No":typeof t=="number"?String(t):t===""?"(empty)":m_(e.type??"string",t,n)}function e0e(e,t){return g_(e,t,!1)}function t0e(e,t){return g_(e,t,!0)}function n0e(e){const{given:t,value:n,onChange:r}=e,{theme:o}=qr(),a=o.ui,i=Ch(),[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(y_,{name:d,set:m,open:y,problem:w,fixed:S!==void 0,required:!m&>(t),children:[p.jsxs(os,{"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(dF,{"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(Ur,{title:w,children:b}):b,p.jsxs(AR,{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(c_,{...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(qn,{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(qn,{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 AF(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=Ch(),o=qr().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(uF,{"aria-hidden":!0,sx:{fontSize:14}}),"Report default"]}),n!==void 0&&n!==i&&p.jsx(qn,{size:"small",onClick:()=>a(e,n),sx:l,children:"Make this the report's default"}),i!==void 0&&p.jsx(qn,{size:"small",onClick:()=>a(e,void 0),sx:l,children:s?"Use the filter's default":"Use the model's default"})]})}function y_({name:e,set:t=!1,open:n=!1,unused:r=!1,problem:o,fixed:a=!1,required:i=!1,children:s}){const{theme:l}=qr(),d=l.ui,u=Ch();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:Xd(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 ${Xy}`,...Zy,"&:hover":{borderColor:t||n||o?void 0:fF(l.cardBorder,l.tileTitle)},maxWidth:"100%",...Hbe}),children:[s,u&&!a&&p.jsx(qbe,{label:`Remove filter ${e}`,onRemove:()=>u.onRemove(e)})]})}function i0e({name:e,label:t,unused:n=!0}){const r=Ch(),o=qr().theme.ui;if(!r)return null;const a=r.stateOf(e)?.problem,i=p.jsx(y_,{name:e,unused:n,problem:a,children:p.jsxs(os,{"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(Ur,{title:a,children:i}):i}function s0e(){const{theme:e}=qr(),t=e.ui,n=Ch();if(!n)return null;const r=n.addDisabledReason!==void 0;return p.jsx(Ur,{title:n.addDisabledReason??"",children:p.jsx("span",{children:p.jsx(qn,{variant:"outlined",startIcon:p.jsx(d1,{}),"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:Xd(e.cardBorder),color:o.palette.text.secondary,boxShadow:"none",...t.type.control,"& .MuiButton-startIcon":{mr:.5},"& .MuiButton-startIcon svg":{fontSize:16}}),children:"Filter"})})})}function P1({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=Ch();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(c_,{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(qn,{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(qn,{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(Ka,{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}=qr();return p.jsx(Te,{sx:[d0e(o.ui)[t],{fontFamily:o.font.family},...Array.isArray(r)?r:[r]],children:p.jsx(Xoe,{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 Uo({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 KT(){typeof window>"u"||p0e().catch(()=>{})}const v_=un(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 Lp({sx:e,...t}){const{theme:n}=qr();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-vyM2wQbC.es-ha8dF24T.js"),[]).then(e=>e.c));function j1({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(()=>KT(),[]);const[u,m]=C.useState(void 0),[g,y]=C.useState(void 0),[x,w]=C.useState(void 0),S=C.useCallback((U,I)=>{m(U),w(I)},[]),[b,$]=C.useState(!1),[k,T]=C.useState(void 0),O=m0e(a);C.useEffect(()=>{const U=d.current;if(!s||!U)return;const I=new ResizeObserver(([H])=>{T(Math.round(H.contentRect.height)),F(Math.round(H.contentRect.width))});return I.observe(U),()=>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(mae,{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(qn,{variant:"contained",color:"primary",onClick:()=>$(!0),children:"Proceed"})]});const _=p.jsx(Uo,{text:wu.loading,centered:!0,size:32}),R=Dle({renderAs:x,maxHeight:t,tableMaxHeight:n}),z=TD({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 ${TD({sizing:u,contentHeight:g,maxHeight:R,firstPaintHeight:r})}px`,minHeight:0}},children:[s?p.jsx(Te,{className:Ule,...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(Ur,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:p.jsx(Lp,{"aria-label":"Render tag warnings",children:p.jsx(v_,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function QT({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&&KT()},[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(Pa,{context:t,error:x})});if(!g)return p.jsx(Uo,{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(j1,{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(fz,{"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=un(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}=qr();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)?$/,A1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(S0e,"")||void 0,C0e=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),b_=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${C0e(n)}`,k0e="edit",$0e=(e,t,n)=>`${b_(e,t,n)}?${k0e}`,XT=e=>e.layout==="linear"?"linear":"grid",y$=e=>({layout:XT(e),path:e.path,editable:e.editable!==!1});function R0e(e,t){const n=t.find(r=>r.path===e);return n?.path?y$({...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 x_(e,t,n,r=!0){const{apiClients:o}=Jn(),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 w_=20,P0e={radius:"8px",padding:`${w_}px`};function p2e(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 Q0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=qr(),s=i.ui,l=e||t==="none";return p.jsx(Ka,{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":`${w_}px`},...Array.isArray(r)?r:[r]],children:a})}const A0e=Sl.tileHeading;function S_({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=qr(),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 v$({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 C_({title:e,description:t,actions:n}){const r=qr().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 D1({sx:e,children:t}){return p.jsx(Q0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function k_({children:e}){const{theme:t}=qr(),{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 ${Xd(t.cardBorder)}`:"none",transition:`box-shadow ${Xy}`,...Zy},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},N1=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 ZT(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const U0e=e=>ZT(e,"MalloyTranslator"),B0e=e=>ZT(e,"parseAnnotation"),V0e=e=>ZT(e,"ASTQuery");async function h2e(){return U0e(await wo(()=>import("./index-D9wSfMZN.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function m2e(){return B0e(await wo(()=>Promise.resolve().then(()=>$ae),void 0))}async function H0e(){return V0e(await wo(()=>import("./index-CbsrzNSp.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function q0e(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){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 g2e(e,t){return e??(t===void 0?void 0:await q0e(t))}function y2e({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 v2e(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 b2e({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 x2e(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function w2e(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 R_ extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const T_=e=>e instanceof R_||e instanceof Error&&e.name==="DocumentNotFoundError",G0e=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function E_(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=>qy(e)?e:`\`${e}\``;function JT(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=E_("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)},_N=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Q0e="report.malloy";function e2(e,t,n=Q0e){const r=JT(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),l=_N(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 "${vF(o,n)}"`,"",`source: ${d} is ${og(a)} extend {`,` # label=${_N(K0e(i))}`,` view: ${u} is ${og(i)}`,"}",""].join(`
|
|
473
|
-
`)}function S2e(e,t){return e2(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(!qy(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.`:E_("title",e)}function C2e(e,t){const n=Z0e(e);if(n)throw new Error(n);return e2(e,"grid",t)}const M_=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function J0e(e,t){const n=M_(t);return`${n===""?"":`${n}/`}${e}.malloy`}function exe(e){return X0e(e)||"untitled"}function O_(e,t=1,n){const r=exe(e);return J0e(t>1?`${r}-${t}`:r,n)}const xy=(e,t,n)=>`${e}/${t}/${n}`,txe=(e,t,n,r,o)=>({workspace:t,type:e,path:xy(n,r,o)}),t2=20;function nxe(e){const{savesTo:t,writer:n}=W0e({...e,readFailed:!1});return t==="browser"?void 0:n}const UN=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function P_(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 Gk({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return Gk({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=JT(n);if(o)throw new Error(o);const a=M_(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:t2},(w,S)=>O_(n.title,S+1,a));for(const w of i){const S=P_(w);if(S)throw new Error(S)}const s=w=>e2(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 BN(n.title,e.path);return{layout:t,path:S,slug:UN(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(!T_(k))throw k;$=!1}if(!$){x={layout:t,path:b,slug:UN(b),locator:S};break}}if(x===void 0)throw BN(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 BN=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${t2} 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&&lF.includes(n))return n}}function cxe({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=Jn(),s=Fz({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&&N4(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 j_=C.createContext(void 0);function uxe({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return p.jsx(j_.Provider,{value:n,children:e})}function A_(){return C.useContext(j_)}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 k2e=1e4,D_=e=>e==="notebook"?"linear":"grid",$2e=(e,t)=>`${e}s/${t}.malloy`;function fxe(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[N1({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}=Jn(),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,ZR)}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 o0(t,ZR)}function hxe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function R2e(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function n2(e,{enabled:t=!0}={}){const{apiClients:n}=Jn(),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,...Nre})}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 N_(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])N_(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=Jx.parseAnnotation(t)}catch{return""}return n.log.length>0?"":N_(n.tag)?`${n.tag.toString()}
|
|
472
|
+
`)}}const g0e=C.lazy(()=>wo(()=>import("./RenderedResult-BcEDcw0V.es-BD6PNbt6.js"),[]).then(e=>e.c));function j1({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(()=>KT(),[]);const[u,m]=C.useState(void 0),[g,y]=C.useState(void 0),[x,w]=C.useState(void 0),S=C.useCallback((U,I)=>{m(U),w(I)},[]),[b,$]=C.useState(!1),[k,T]=C.useState(void 0),O=m0e(a);C.useEffect(()=>{const U=d.current;if(!s||!U)return;const I=new ResizeObserver(([H])=>{T(Math.round(H.contentRect.height)),F(Math.round(H.contentRect.width))});return I.observe(U),()=>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(mae,{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(qn,{variant:"contained",color:"primary",onClick:()=>$(!0),children:"Proceed"})]});const _=p.jsx(Uo,{text:wu.loading,centered:!0,size:32}),R=Dle({renderAs:x,maxHeight:t,tableMaxHeight:n}),z=TD({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 ${TD({sizing:u,contentHeight:g,maxHeight:R,firstPaintHeight:r})}px`,minHeight:0}},children:[s?p.jsx(Te,{className:Ule,...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(Ur,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:p.jsx(Lp,{"aria-label":"Render tag warnings",children:p.jsx(v_,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function QT({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&&KT()},[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(Pa,{context:t,error:x})});if(!g)return p.jsx(Uo,{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(j1,{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(fz,{"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=un(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}=qr();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)?$/,A1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(S0e,"")||void 0,C0e=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),b_=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${C0e(n)}`,k0e="edit",$0e=(e,t,n)=>`${b_(e,t,n)}?${k0e}`,XT=e=>e.layout==="linear"?"linear":"grid",y$=e=>({layout:XT(e),path:e.path,editable:e.editable!==!1});function R0e(e,t){const n=t.find(r=>r.path===e);return n?.path?y$({...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 x_(e,t,n,r=!0){const{apiClients:o}=Jn(),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 w_=20,P0e={radius:"8px",padding:`${w_}px`};function p2e(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 Q0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=qr(),s=i.ui,l=e||t==="none";return p.jsx(Ka,{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":`${w_}px`},...Array.isArray(r)?r:[r]],children:a})}const A0e=Sl.tileHeading;function S_({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=qr(),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 v$({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 C_({title:e,description:t,actions:n}){const r=qr().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 D1({sx:e,children:t}){return p.jsx(Q0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function k_({children:e}){const{theme:t}=qr(),{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 ${Xd(t.cardBorder)}`:"none",transition:`box-shadow ${Xy}`,...Zy},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},N1=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 ZT(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const U0e=e=>ZT(e,"MalloyTranslator"),B0e=e=>ZT(e,"parseAnnotation"),V0e=e=>ZT(e,"ASTQuery");async function h2e(){return U0e(await wo(()=>import("./index-CPSEdm5f.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function m2e(){return B0e(await wo(()=>Promise.resolve().then(()=>$ae),void 0))}async function H0e(){return V0e(await wo(()=>import("./index-keJ8KKBp.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function q0e(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){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 g2e(e,t){return e??(t===void 0?void 0:await q0e(t))}function y2e({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 v2e(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 b2e({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 x2e(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function w2e(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 R_ extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const T_=e=>e instanceof R_||e instanceof Error&&e.name==="DocumentNotFoundError",G0e=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function E_(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=>qy(e)?e:`\`${e}\``;function JT(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=E_("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)},_N=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Q0e="report.malloy";function e2(e,t,n=Q0e){const r=JT(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),l=_N(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 "${vF(o,n)}"`,"",`source: ${d} is ${og(a)} extend {`,` # label=${_N(K0e(i))}`,` view: ${u} is ${og(i)}`,"}",""].join(`
|
|
473
|
+
`)}function S2e(e,t){return e2(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(!qy(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.`:E_("title",e)}function C2e(e,t){const n=Z0e(e);if(n)throw new Error(n);return e2(e,"grid",t)}const M_=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function J0e(e,t){const n=M_(t);return`${n===""?"":`${n}/`}${e}.malloy`}function exe(e){return X0e(e)||"untitled"}function O_(e,t=1,n){const r=exe(e);return J0e(t>1?`${r}-${t}`:r,n)}const xy=(e,t,n)=>`${e}/${t}/${n}`,txe=(e,t,n,r,o)=>({workspace:t,type:e,path:xy(n,r,o)}),t2=20;function nxe(e){const{savesTo:t,writer:n}=W0e({...e,readFailed:!1});return t==="browser"?void 0:n}const UN=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function P_(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 Gk({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return Gk({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=JT(n);if(o)throw new Error(o);const a=M_(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:t2},(w,S)=>O_(n.title,S+1,a));for(const w of i){const S=P_(w);if(S)throw new Error(S)}const s=w=>e2(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 BN(n.title,e.path);return{layout:t,path:S,slug:UN(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(!T_(k))throw k;$=!1}if(!$){x={layout:t,path:b,slug:UN(b),locator:S};break}}if(x===void 0)throw BN(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 BN=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${t2} 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&&lF.includes(n))return n}}function cxe({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=Jn(),s=Fz({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&&N4(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 j_=C.createContext(void 0);function uxe({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return p.jsx(j_.Provider,{value:n,children:e})}function A_(){return C.useContext(j_)}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 k2e=1e4,D_=e=>e==="notebook"?"linear":"grid",$2e=(e,t)=>`${e}s/${t}.malloy`;function fxe(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[N1({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}=Jn(),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,ZR)}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 o0(t,ZR)}function hxe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function R2e(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function n2(e,{enabled:t=!0}={}){const{apiClients:n}=Jn(),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,void 0,{signal:o}),enabled:t,placeholderData:(o,a)=>a&&gxe(a.queryKey,r)?o:void 0,...Nre})}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 N_(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])N_(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=Jx.parseAnnotation(t)}catch{return""}return n.log.length>0?"":N_(n.tag)?`${n.tag.toString()}
|
|
474
474
|
`:e}function b$(e){if(Array.isArray(e)){for(const n of e)b$(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 b$(r)}function I_(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);b$(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
475
|
`};function wxe(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(r=>Yk(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=f1(n.slice(1));for(const o of r.split(/[\s{}=.,[\]]+/))if(bxe.has(o))return!0}return!1}function L_(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=>I_(L_(e));function HN(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?PF(t):e}function z_({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:_}=qr(),[R,z]=Gle(),N=n2({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?y1(D??"",`${i?`${i}
|
|
476
476
|
`:""}run: ${a}`):void 0,givens:gT(Zd(m,y,x),g,x)},{enabled:z&&A!==!0&&F===void 0}),{emit:U}=m1(),I=N.isError?N.error:void 0;C.useEffect(()=>{I!==void 0&&U({type:"report.query_failed",...L!==void 0?{tile:L}:{},category:U0(I)})},[I,U,L]);const H=A===!0||D!==void 0&&N.isError&&Mce(N.error);return p.jsxs(Q0,{cardRef:R,borderless:u,chrome:O,sx:{"& .malloy-render, & .malloy-table":{width:"100%"},"& .publisher-tile-explore":{opacity:0,transition:`opacity ${Xy}`,...Zy,...fle},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&p.jsx(S_,{title:d?.title??s??HN(a),subtitle:d?d.subtitle:l,quiet:O==="none",tooltip:a,action:T&&p.jsx(Ur,{title:"Explore from here",children:p.jsx(ro,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??HN(a)}`,onClick:T,sx:{mt:-.5,mr:-.5,color:_.tileTitle},children:p.jsx(qle,{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(QT,{fill:!0,state:N,context:a??o??r,maxHeight:w,tableMaxHeight:S,compactToFit:b,firstPaintHeight:hF,maxResultSize:$,drill:k,transform:D!==void 0?a!==void 0?Cxe:I_:a!==void 0?L_:void 0})]})}function T2e(e,{enabled:t=!0}={}){const{apiClients:n}=Jn();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})}un(p.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));const F_="(max-width:599.95px)";function kxe(){return ree(F_,{noSsr:!0})}function $xe(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(F_).matches}function E2e({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(qn,{variant:"outlined",onClick:()=>r(!0),children:"Edit anyway"})]})}function M2e(){const e=jy();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 __(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 U_(e,t){switch(e.kind){case"string_literal":return`'${fT(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=B_(e.date_value);return n&&`@${n[0]}-${n[1]}-${n[2]}`}case"timestamp_literal":{const n=H_(e.timestamp_value,t);return n&&`@${n[0]}-${n[1]}-${n[2]} ${n[3]}:${n[4]}:${n[5]}${V_(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=B_(e.date_value);return n&&qN([...n,"00","00","00"],e.granularity??"day")}case"timestamp_literal":{const n=H_(e.timestamp_value,t);return n&&qN(n,e.granularity??"second")+(e.granularity===void 0?V_(e.timestamp_value):"")}default:return U_(e)}}function B_(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?[t[1],t[2],t[3]]:void 0}function V_(e){const t=/:\d{2}\.(\d+)/.exec(e)?.[1]?.replace(/0+$/,"");return t?`.${t}`:""}function H_(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 qN([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",X0=e=>e,ah=e=>{try{return e?.()}catch{return}},q_=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 Z0(e){const t=e.metadataTag?.text("drill_expression","code");return t===void 0||t.trim()===""?void 0:t}function W_(e){const t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t}function Y_(e){const t=W_(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 ov(e){const t=new Set;for(const n of W_(e))for(const r of n.fields??[])q_(r)&&t.add(r);return[...t]}function G_(e){const t=new Set(ov(e).filter(n=>ah(n.isTime?.bind(n))===!0).map(n=>ah(n.getEffectiveQueryTimezone?.bind(n))));return t.size>1?null:[...t][0]}function WN(e){return!q_(e)||Z0(e)===void 0||Y_(e)===void 0||G_(e)===null?!1:ov(e).every(t=>Z0(t)!==void 0&&t.drillStableExpression!==void 0&&Exe(t))}function Mxe(e,t){const n=ov(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&&Z0(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 x$(e){return e?e.getLabel?.()??e.tag?.text("label")??X0(e).metadataTag?.text("label")??e.name:""}function Pxe(e,t){const n=e.drillClauses?__(e.drillClauses,e.timezone):[];if(n.length===0)return`${x$(t)}: ${e.label}`;const r=ov(X0(t));return n.map(o=>{const a=JSON.stringify(o.expression),i=r.find(s=>JSON.stringify(s.drillStableExpression)===a);return`${i?x$(i):o.field}: ${o.label}`}).join(", ")}function K_({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=X0(S.field);if(!WN(b))return;const $=Y_(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=Z0(b);if(P===void 0||ov(b).length!==1||g1(S.value)===void 0||typeof S.value=="number"&&Number.isInteger(S.value)&&!Number.isSafeInteger(S.value))return;T={code:P}}const O=G_(b)??void 0;return{field:S.field.name,rawValue:S.value,label:Xk(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=`${x$(S.field)}: ${b?.label??Xk(S.value)}`,O=k.map(P=>({key:`to:${P}`,label:P===Gm?`Filter to ${T}`:`Open ${n?.(P)??PF(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(OF(S),jF(S)).length>0,[s]),g=C.useCallback(S=>o!==void 0&&WN(X0(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 O2e(){const[e]=tq(),t=jy(),n=fs(),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=un(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 Q_(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(","),...Q_(e).map(n=>t.map((r,o)=>Dxe(n[o])).join(","))].join(`\r
|
|
477
477
|
`)}\r
|
|
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 YN="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 Uxe({query:e,preamble:t,environmentName:n,packageName:r,modelPath:o,versionId:a,givens:i,fileName:s}){const{apiClients:l}=Jn(),[d,u]=C.useState(!1),[m,g]=C.useState(YN),[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:y1(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(Q_(T).length,k.queryRowLimit,k.queryRowLimitSource);g(O===void 0?YN:`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(Ur,{title:m,children:p.jsx("span",{children:p.jsx(qn,{size:"small",startIcon:p.jsx(Axe,{fontSize:"small"}),onClick:()=>void S(),disabled:d,children:"Download CSV"})})})]})}const X_=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 GN(e,t=X_){const n=Hxe(e);if(n===void 0)return;const r=[...e.target.filters,...n].join(", "),o=e.timezone?`timezone: '${fT(e.timezone)}'; `:"",a=t===null?"":`; limit: ${t}`,i=Vxe(e.target.source);if(i!==void 0)return`run: ${i} -> { ${o}where: ${r}; select: *${a} }`}function Vxe(e){return qy(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=U_(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 qxe="This value cannot be written as a filter, so its rows cannot be fetched.";function KN(e){const t=e.drillClauses?__(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}=qr(),m=e?GN(e):void 0,g=e?GN(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,KN(e).map(x=>x.label))}:void 0;return p.jsxs(Lx,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[p.jsxs(Fx,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[p.jsxs(Te,{children:[e?p.jsxs(p.Fragment,{children:["Rows where"," ",KN(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 ${X_} 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(Uxe,{...y})),p.jsx(ro,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary"},children:p.jsx(xh,{fontSize:"small"})})]})]}),p.jsxs(zx,{dividers:!0,sx:{p:0,minHeight:240},children:[m===void 0&&e&&p.jsx(wt,{variant:"body2",sx:{p:2},children:qxe}),m!==void 0&&p.jsx(Yxe,{query:a===void 0?m:y1(a,m),environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:i,...l?{onDone:l}:{}})]}),p.jsxs(dz,{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(qn,{onClick:s,children:"Close"})]})]})}function Yxe({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:i}){const s=n2({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(QT,{state:s,context:e})})}function Z_({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=vT({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=m1(),_=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)},[]),U=C.useMemo(()=>gT(Zd(P,D),_),[P,D,_]),{reports:I}=x_(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}=K_({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}=Vle(e.layout,e.dashboardColumns),X=C.useMemo(()=>Ybe(k,P,a),[k,P,a]);if(e.error)return p.jsx(v$,{layout:ue,header:p.jsx(QN,{manifest:e,links:$,actions:S}),children:p.jsx(lo,{severity:"error",children:e.error})});const ee=g??e.path,Z=e.tiles??[],de=sF(Z);return p.jsxs(v$,{layout:ue,header:p.jsx(QN,{manifest:e,links:$,actions:S}),controls:k.length>0?p.jsx(k_,{children:p.jsx(P1,{...O.panel,layout:u})}):void 0,children:[X.length>0&&p.jsx(lo,{severity:"info",children:Kbe(X)}),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:oF,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(z_,{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?rF(le.rowspan??iF.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(X,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:U,...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(D1,{children:p.jsx(oh,{variant:"document",links:t,children:e})})}function QN({manifest:e,links:t,actions:n}){return p.jsx(C_,{title:e.title??e.name,actions:n,description:e.description?p.jsx(D1,{children:p.jsx(oh,{variant:"document",links:t,children:e.description})}):void 0})}const J_=un(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 e6(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=`${e6(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 P2e({resourceUri:e}){const{server:t,apiClients:n}=Jn(),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(Ur,{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(J_,{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 Ds({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}=Jn(),[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(Uo,{text:"Fetching About..."}),s&&u&&p.jsxs(Ds,{title:"Readme",children:[p.jsx(oh,{variant:"caption",children:r||!g?u:y}),g&&p.jsx(Te,{sx:{mt:1},children:p.jsx(Qy,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),l&&p.jsx(Pa,{error:d,context:`${t} > About`})]})}function e1e(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,i=xT();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={...B0(e),...B0(S)};return{role:"presentation",...S,...b,onBlur:g(b),onFocus:y(b),onMouseEnter:x(b),onMouseLeave:w(b)}},onClickAway:d}}function XN(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=XN(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=XN(r),w=Yo(s.current);return w.addEventListener(x,m),()=>{w.removeEventListener(x,m)}}},[m,r]),C.cloneElement(t,y)}function r1e(e){return kn("MuiSnackbarContent",e)}vn("MuiSnackbarContent",["root","message","action"]);const o1e=e=>{const{classes:t}=e;return Sn({root:["root"],action:["action"],message:["message"]},r1e,t)},a1e=ot(ef,{name:"MuiSnackbarContent",slot:"Root"})(rr(({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(_k(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:_k(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=ot("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),s1e=ot("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),l1e=C.forwardRef(function(e,t){const n=tr({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:qt(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 kn("MuiSnackbar",e)}vn("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const u1e=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${Ft(n.vertical)}${Ft(n.horizontal)}`]};return Sn(r,c1e,t)},d1e=ot("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${Ft(n.anchorOrigin.vertical)}${Ft(n.anchorOrigin.horizontal)}`]]}})(rr(({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=tr({props:e,name:"MuiSnackbar"}),r=Qd(),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},U=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]=mr("root",{ref:t,className:[U.root,u],elementType:d1e,getSlotProps:I,externalForwardedProps:{...ue,...z},ownerState:N}),[X,{ownerState:ee,...Z}]=mr("clickAwayListener",{elementType:n1e,externalForwardedProps:ue,getSlotProps:me=>({onClickAway:(...se)=>{const ve=se[0];me.onClickAway?.(...se),!ve?.defaultMuiPrevented&&H(...se)}}),ownerState:N}),[de,le]=mr("content",{elementType:l1e,shouldForwardComponentProp:!0,externalForwardedProps:ue,additionalProps:{message:x,action:a},ownerState:N}),[fe,he]=mr("transition",{elementType:my,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(X,{...Z,...P.clickAwayListener&&{ownerState:ee},children:p.jsx(G,{...ie,children:p.jsx(fe,{...he,children:d||p.jsx(de,{...le})})})})});let w$;function p1e(e){w$=e}function ZN(e){if(w$)try{w$(e)}catch{}}function rc(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return ZN({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw ZN({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 kh({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 t6="https://docs.malloydata.dev/documentation",JN=`${t6}/user_guides/publishing`,_b="https://github.com/malloydata/publisher/blob/main/docs",tu={docsHome:`${t6}/`,publishing:`${JN}/publishing`,mcpAgents:`${JN}/mcp_agents`,surfaces:`${_b}/choosing-a-surface.md`,givens:`${_b}/givens.md`,materialization:`${_b}/materialization.md`,connections:`${_b}/connections.md`};function h1e({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=Jn(),{environmentName:o}=Xr(e),a=kh({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(Ky,{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(qn,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),p.jsx(qn,{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($i,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx($i,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx($i,{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=un(p.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function I1({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 n6=un(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=vn("MuiBox",["root"]),y1e=J4(),Ea=iR({themeId:bh,defaultTheme:y1e,defaultClassName:g1e.root,generateClassName:F4.generate}),L1=pR({createStyledComponent:ot("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>tr({props:e,name:"MuiStack"})}),eI=vn("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function v1e(e){return kn("MuiListItemIcon",e)}const tI=vn("MuiListItemIcon",["root","alignItemsFlexStart"]),b1e=e=>{const{alignItems:t,classes:n}=e;return Sn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},v1e,n)},x1e=ot("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(rr(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),r2=C.forwardRef(function(e,t){const n=tr({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:qt(s.root,r),ownerState:i,ref:t,...o})});function w1e(e){return kn("MuiListItemText",e)}const $p=vn("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),S1e=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return Sn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},w1e,t)},C1e=ot("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${$p.primary}`]:t.primary},{[`& .${$p.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,[`.${ZD.root}:where(& .${$p.primary})`]:{display:"block"},[`.${ZD.root}:where(& .${$p.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),o2=C.forwardRef(function(e,t){const n=tr({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]=mr("root",{className:qt($.root,o),elementType:C1e,externalForwardedProps:{...k,...y},ownerState:b,ref:t}),[P,D]=mr("primary",{className:$.primary,elementType:Ar,externalForwardedProps:k,ownerState:b}),[A,F]=mr("secondary",{className:$.secondary,elementType:Ar,externalForwardedProps:k,ownerState:b});return w!=null&&w.type!==Ar&&!a&&(w=p.jsx(P,{variant:x?"body2":"body1",component:D?.variant?void 0:"span",...D,children:w})),S!=null&&S.type!==Ar&&!a&&(S=p.jsx(A,{variant:"body2",color:"textSecondary",...F,children:S})),p.jsxs(T,{...O,children:[w,S]})});function k1e(e){return kn("MuiMenuItem",e)}const ag=vn("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=Sn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},k1e,i);return{...i,...s}},T1e=ot(Jp,{shouldForwardProp:e=>gs(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:$1e})(rr(({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},[`& + .${eI.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${eI.inset}`]:{marginLeft:52},[`& .${$p.root}`]:{marginTop:0,marginBottom:0},[`& .${$p.inset}`]:{paddingLeft:36},[`& .${tI.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,[`& .${tI.root} svg`]:{fontSize:"1.25rem"}}}]}))),qo=C.forwardRef(function(e,t){const n=tr({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:qt(b.focusVisible,l),className:qt(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 r6(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 o6=Object.values(fA).filter(e=>e!==fA.Publisher),S$={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},wy=[{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"}}],Sy=[{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 J0(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?ac[e]||[]:e==="s3"?wy:e==="gcs"?Sy: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(U=>{const I=O.get(`ducklake_pg_${U.name}`)?.toString();I&&(N[U.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(wy.forEach(N=>{const U=O.get(`ducklake_s3_${N.name}`)?.toString();U&&(z[N.name]=U)}),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(Sy.forEach(N=>{const U=O.get(`ducklake_gcs_${N.name}`)?.toString();U&&(z[N.name]=U)}),!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 U={name:N,type:z},I=J0(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=S$[z];Y&&(U[Y]=H)}return U});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]]:r6(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(Cn.Fragment,{children:[p.jsx(Ky,{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(L1,{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:o6.map(T=>p.jsx(qo,{value:T,children:T},T))}),o==="ducklake"?p.jsxs(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{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(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{value:"s3",children:"S3"}),p.jsx(qo,{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(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),wy.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(qo,{value:O.value,children:O.label},O.value))},`s3_${T.name}`))]}),u==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Sy.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(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Qy,{label:"Database",icon:p.jsx(d1,{}),onClick:b,ariaLabel:"Add database"})]}),i.length===0&&p.jsx(Ar,{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=J0(T.dbType);return p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{variant:"subtitle2",children:["Database ",O+1]}),p.jsx(Tu,{onClick:()=>$(O),size:"small",color:"error",children:p.jsx(n6,{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(C4).map(D=>p.jsx(qo,{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(qo,{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(qo,{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(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(r2,{sx:{color:"inherit"},children:p.jsx(Xx,{fontSize:"small"})}),p.jsx(o2,{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(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const nI=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function rI(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function oI(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=Cn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[d,u]=C.useState(()=>rI(e)),[m,g]=C.useState("postgres"),[y,x]=C.useState(()=>oI(e)),[w,S]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),b=()=>{u(rI(e)),s(e.type),S(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),g("postgres"),x(oI(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 U={};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");U.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={};wy.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={};Sy.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:U,storage:H}}}else if(R==="duckdb"){if(d.length===0)throw new Error("DuckDB connection must have at least one attached database");const U=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=J0(Y);if(oe&&oe.length>0){const ue={};if(oe.forEach(ie=>{const X=L.get(`attachedDb_${H}_${ie.name}`)?.toString();X&&(ue[ie.name]=X)}),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=S$[Y];G&&(K[G]=ue)}return K});N={name:_,type:R,duckdbConnection:{attachedDatabases:U}}}else{const U=e[Og[R]]||{},I={};if(z.forEach(H=>{const Y=L.get(H.name)?.toString(),ae=U[H.name];Y?I[H.name]=Y:nI.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]]:r6(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=S$[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(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:F=>{F.preventDefault(),F.stopPropagation(),b()},children:[p.jsx(r2,{children:p.jsx(nT,{fontSize:"small"})}),p.jsx(o2,{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(L1,{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:o6.map(F=>p.jsx(qo,{value:F,children:F},F))}),i==="ducklake"?p.jsxs(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{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(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{value:"s3",children:"S3"}),p.jsx(qo,{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(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),wy.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(qo,{value:L.value,children:L.label},L.value))},`s3_${F.name}`))]}),y==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Sy.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(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Qy,{label:"Database",icon:p.jsx(d1,{}),onClick:T,ariaLabel:"Add database"})]}),d.length===0&&p.jsx(Ar,{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 _=J0(F.dbType);return p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{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(n6,{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(C4).map(R=>p.jsx(qo,{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(qo,{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"||nI.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(qo,{value:N.value,children:N.label},N.value))},F.name)})]})})})]})}function aI(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}=Jn(),{environmentName:a}=Xr(t),[i,s]=Cn.useState(null),[l,d]=Cn.useState(n||null),[u,m]=Cn.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(Sp,{container:!0,spacing:1,children:[!n&&p.jsx(Sp,{size:{xs:12,md:4},children:p.jsxs(Ka,{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(ER,{control:p.jsx(wz,{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(Uo,{text:"Loading schemas..."}),y&&p.jsx(Pa,{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(jR,{dense:!0,disablePadding:!0,children:S.map(b=>{const $=b.name;return b.isHidden&&!u?null:p.jsx(pz,{selected:l===$,onClick:()=>{d($),s(null)},children:p.jsx(wi,{primary:$})},$)})})]})]})}),p.jsx(Sp,{size:{xs:12,md:n?6:4},children:l&&p.jsx(Ka,{sx:{p:1,m:0},children:p.jsx(z1e,{connectionName:e,schemaName:l,onTableSelect:b=>{s(b)},resourceUri:t,connection:r})})}),p.jsx(Sp,{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}=Jn(),{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(Ka,{sx:{p:1,m:0},children:[s&&p.jsx(Pa,{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(Uo,{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(qJ,{children:p.jsxs(_x,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[p.jsx(Vx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"NAME"}),p.jsx(ur,{children:"TYPE"})]})}),p.jsx(Bx,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>p.jsxs(vu,{children:[p.jsx(ur,{children:n.name}),p.jsx(ur,{children:n.type})]},n.name))})]})})})]})}function z1e({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=Xr(r),{apiClients:i}=Jn(),[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=aI(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)||aI(o,t)?`Files in ${t}`:`Tables in ${t}`}),p.jsx(wl,{}),p.jsx(Te,{sx:{mt:1,mb:1},children:p.jsx($i,{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(Uo,{text:"Fetching Tables..."}),m&&p.jsx(Pa,{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(jR,{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(pz,{onClick:()=>n(b.resource),children:p.jsx(wi,{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 U1e({resourceUri:e}){const{apiClients:t,mutable:n}=Jn(),r=Tl(),{environmentName:o}=Xr(e),[a,i]=C.useState(""),[s,l]=C.useState(null),d=N1({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(Ds,{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(Pa,{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(N1e,{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(I1,{icon:p.jsx(m1e,{sx:{fontSize:18}}),tint:XR.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(Zx,{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 V1e=un([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}=Jn(),a=()=>{r(!0)},i=()=>{r(!1),t()},{environmentName:s,packageName:l}=Xr(e),d=kh({mutationFn:()=>o.packages.deletePackage(s,l),success:"Package deleted",invalidates:[["packages",s]],closeDialog:i,resource:"package",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Xx,{fontSize:"small"})}),p.jsx(wi,{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(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:l}),"? The package stops being served and this cannot be undone."]})}),d.notice]})}function q1e({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=Jn(),i=()=>{o(!0)},s=()=>{o(!1),n()},{packageName:l,environmentName:d}=Xr(t),u=kh({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(Cn.Fragment,{children:[p.jsxs(ea,{onClick:i,children:[p.jsx(ml,{children:p.jsx(nT,{fontSize:"small"})}),p.jsx(wi,{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}=Jn(),{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(Pa,{error:s,context:`${r} > Packages`});if(!a)return p.jsx(Uo,{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=N1({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}=Jn(),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(I1,{icon:p.jsx(V1e,{sx:{fontSize:18}}),tint:XR.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(Zx,{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(q1e,{package:e,resourceUri:t,onCloseDialog:d}),p.jsx(H1e,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function j2e({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=Jn(),{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(M0,{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(Ds,{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(U1e,{resourceUri:t}),p.jsx(Jxe,{resourceUri:t})]})}function iI({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 sI(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=sI(u));const m=u?s.filter(g=>{let y=(a||d)(g);return n&&(y=y.toLowerCase()),t&&(y=sI(y)),o==="start"?y.startsWith(u):y.includes(u)}):s;return typeof r=="number"?m.slice(0,r):m}}const K1e=G1e(),lI=5,Q1e=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),X1e=[];function cI(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:U,onInputChange:I,onOpen:H,open:Y,openOnFocus:ae=!1,options:K,readOnly:oe=!1,renderValue:ue,selectOnFocus:G=!e.freeSolo,value:ie}=e,X=Fs(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(cI(u??ie,R,ee)).current,[re,_e]=es({controlled:ie,default:u,name:d}),[Me,Ke]=es({controlled:L,default:Re,name:d,state:"inputValue"}),[Je,St]=C.useState(!1),Bt=C.useCallback((ge,ye,Be)=>{if(!(R?re.length<ye.length:ye!==null)&&!s)return;const gt=cI(ye,R,ee,ue);Me!==gt&&(Ke(gt),I&&I(ge,gt,Be))},[ee,Me,R,I,Ke,s,re,ue]),[at,tt]=es({controlled:Y,default:!1,name:d,state:"open"}),[pt,ze]=C.useState(!0),be=!R&&re!=null&&Me===ee(re),qe=at&&!oe,Oe=qe?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||Bt(null,re,"reset")},[re,Bt,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 Be=ge;for(;;){const gt=fe.current.querySelector(`[data-option-index="${Be}"]`),We=x?!1:!gt||gt.disabled||gt.getAttribute("aria-disabled")==="true";if(gt&>.hasAttribute("tabindex")&&!We)return Be;if(ye==="next"?Be=(Be+1)%Oe.length:Be=(Be-1+Oe.length)%Oe.length,Be===ge)return-1}}const st=Yt(({event:ge,index:ye,reason:Be})=>{if(Ae.current=ye,ye===-1?le.current.removeAttribute("aria-activedescendant"):le.current.setAttribute("aria-activedescendant",`${X}-option-${ye}`),U&&["mouse","keyboard","touch"].includes(Be)&&U(ge,ye===-1?null:Oe[ye],Be),!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`),Be==="keyboard"&&Nt.classList.add(`${n}-focusVisible`),We.scrollHeight>We.clientHeight&&Be!=="mouse"&&Be!=="touch")){const Kt=Nt,pn=We.clientHeight+We.scrollTop,we=Kt.offsetTop+Kt.offsetHeight;we>pn?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:Be="next",reason:gt})=>{if(!qe)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})(),Be);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=!iI({array1:$t.filteredOptions,array2:Oe,parser:ee}),Ut=()=>{const ge=(ye,Be)=>{const gt=ye?ee(ye):"",We=Be?ee(Be):"";return gt===We};if(Ae.current!==-1&&!iI({array1:$t.filteredOptions,array2:Oe,parser:ee})&&$t.inputValue===Me&&(R?re.length===$t.value.length&&$t.value.every((ye,Be)=>ee(re[Be])===ee(ye)):ge($t.value,re))){const ye=$t.filteredOptions[Ae.current];if(ye)return Oe.findIndex(Be=>ee(Be)===ee(ye))}return-1},fn=C.useCallback(()=>{if(!qe)return;const ge=Ut();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 Be=Oe[Ae.current];if(R&&Be&&re.findIndex(We=>_(Be,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,qe,Me,R]),$n=Yt(ge=>{Hk(fe,ge),ge&&fn()});C.useEffect(()=>{nn&&fn()},[fn,nn]);const Vt=ge=>{at||(tt(!0),ze(!0),H&&H(ge))},Pn=(ge,ye)=>{at&&(tt(!1),N&&N(ge,ye))},Se=(ge,ye,Be,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,Be,gt),_e(ye)},jn=C.useRef(!1),Rn=(ge,ye,Be="selectOption",gt="options")=>{let We=Be,Nt=ye;if(R){Nt=Array.isArray(re)?re.slice():[];const Kt=Nt.findIndex(pn=>_(ye,pn));Kt===-1?Nt.push(ye):gt!=="freeSolo"&&(Nt.splice(Kt,1),We="removeOption")}Bt(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 Jt(ge,ye){if(ge===-1)return-1;let Be=ge;for(;;){if(ye==="next"&&Be===re.length||ye==="previous"&&Be===-1)return-1;const gt=ue?"data-item-index":"data-tag-index",We=he.querySelector(`[${gt}="${Be}"]`);if(!We||!We.hasAttribute("tabindex")||We.disabled||We.getAttribute("aria-disabled")==="true")Be+=ye==="next"?1:-1;else return Be}}const Pt=(ge,ye)=>{if(!R)return;Me===""&&Pn(ge,"toggleInput");let Be=se;se===-1?Me===""&&ye==="previous"&&(Be=re.length-1):(Be+=ye==="next"?1:-1,Be<0&&(Be=0),Be===re.length&&(Be=-1)),Be=Jt(Be,ye),ve(Be),vt(Be)},Br=ge=>{Z.current=!0,Ke(""),I&&I(ge,"","clear"),Se(ge,R?[]:null,"clear")},Vn=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":qe&&D&&(ye.preventDefault(),Dt({diff:"start",direction:"next",reason:"keyboard",event:ye}));break;case"End":qe&&D&&(ye.preventDefault(),Dt({diff:"end",direction:"previous",reason:"keyboard",event:ye}));break;case"PageUp":ye.preventDefault(),Dt({diff:-lI,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"PageDown":ye.preventDefault(),Dt({diff:lI,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowDown":ye.preventDefault(),Dt({diff:1,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowUp":ye.preventDefault(),Dt({diff:-1,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowLeft":!R&&ue?vt(0):Pt(ye,"previous");break;case"ArrowRight":!R&&ue?vt(-1):Pt(ye,"next");break;case"Enter":if(Ae.current!==-1&&qe){const Be=Oe[Ae.current],gt=k?k(Be):!1;if(ye.preventDefault(),gt)return;Rn(ye,Be,"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":qe?(ye.preventDefault(),ye.stopPropagation(),Pn(ye,"escape")):l&&(Me!==""||R&&re.length>0||ue)&&(ye.preventDefault(),ye.stopPropagation(),Br(ye));break;case"Backspace":if(R&&!oe&&Me===""&&re.length>0){const Be=se===-1?re.length-1:se,gt=re.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:re[Be]})}!R&&ue&&!oe&&(_e(null),vt(-1));break;case"Delete":if(R&&!oe&&Me===""&&re.length>0&&se!==-1){const Be=se,gt=re.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:re[Be]})}!R&&ue&&!oe&&(_e(null),vt(-1));break}},hn=ge=>{St(!0),ae&&!Z.current&&Vt(ge)},Un=ge=>{if(t(fe)){le.current.focus();return}St(!1),de.current=!0,Z.current=!1,a&&Ae.current!==-1&&qe?Rn(ge,Oe[Ae.current],"blur"):a&&$&&Me!==""?Rn(ge,Me,"blur","freeSolo"):s&&Bt(ge,re,"blur"),Pn(ge,"blur")},xe=ge=>{const ye=ge.target.value;Me!==ye&&(Ke(ye),ze(!1),I&&I(ge,ye,"input")),ye===""?!m&&!R&&Se(ge,null,"clear"):Vt(ge)},Ee=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Ae.current!==ye&&st({event:ge,index:ye,reason:"mouse"})},Ue=ge=>{st({event:ge,index:Number(ge.currentTarget.getAttribute("data-option-index")),reason:"touch"}),jn.current=!0},Ge=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Rn(ge,Oe[ye],"selectOption"),jn.current=!1},ut=ge=>ye=>{const Be=re.slice();Be.splice(ge,1),Se(ye,Be,"removeOption",{option:re[ge]})},Tt=ge=>{Se(ge,null,"removeOption",{option:re})},Ct=ge=>{at?Pn(ge,"toggleInput"):Vt(ge)},Et=ge=>{ge.currentTarget.contains(ge.target)&&ge.target.getAttribute("id")!==X&&ge.preventDefault()},It=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 Lt=$&&Me.length>0;Lt=Lt||(R?re.length>0:re!==null);let Ht=Oe;return P&&(Ht=Oe.reduce((ge,ye,Be)=>{const gt=P(ye);return ge.length>0&&ge[ge.length-1].group===gt?ge[ge.length-1].options.push(ye):ge.push({key:Be,index:Be,group:gt,options:[ye]}),ge},[])),y&&Je&&Un(),{getRootProps:(ge={})=>({...ge,onKeyDown:Vn(ge),onMouseDown:Et,onClick:It}),getInputLabelProps:()=>({id:`${X}-label`,htmlFor:X}),getInputProps:()=>({id:X,value:Me,onBlur:Un,onFocus:hn,onChange:xe,onMouseDown:Xt,"aria-activedescendant":qe?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Rt?`${X}-listbox`:void 0,"aria-expanded":Rt,autoComplete:"off",ref:le,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:y}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Br}),getItemProps:({index:ge=0}={})=>({...R&&{key:ge},...ue?{"data-item-index":ge}:{"data-tag-index":ge},tabIndex:-1,...!oe&&{onDelete:R?ut(ge):Tt}}),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:`${X}-listbox`,"aria-labelledby":`${X}-label`,ref:$n,onMouseDown:ge=>{ge.preventDefault()}}),getOptionProps:({index:ge,option:ye})=>{const Be=(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:`${X}-option-${ge}`,onMouseMove:Ee,onClick:Ge,onTouchStart:Ue,"data-option-index":ge,"aria-disabled":gt,"aria-selected":Be}},id:X,inputValue:Me,value:re,dirty:Lt,expanded:qe&&he,popupOpen:qe,focused:Je||se!==-1,anchorEl:he,setAnchorEl:me,focusedItem:se,focusedTag:se,groupedOptions:Ht}}function J1e(e){return kn("MuiListSubheader",e)}vn("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${Ft(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return Sn(i,J1e,t)},twe=ot("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Ft(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(rr(({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}}]}))),C$=C.forwardRef(function(e,t){const n=tr({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:qt(m.root,r),ref:t,ownerState:u,...d})});C$&&(C$.muiSkipListHighlight=!0);const nwe=un(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 kn("MuiAutocomplete",e)}const Xn=vn("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 uI,dI;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${Ft(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 Sn(m,rwe,t)},awe=ot("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:i,size:s}=n;return[{[`& .${Xn.tag}`]:t.tag},{[`& .${Xn.tag}`]:t[`tagSize${Ft(s)}`]},{[`& .${Xn.inputRoot}`]:t.inputRoot},{[`& .${Xn.input}`]:t.input},{[`& .${Xn.input}`]:i&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Xn.focused} .${Xn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Xn.clearIndicator}`]:{visibility:"visible"}},[`& .${Xn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Xn.inputRoot}`]:{[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:30},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:56},[`& .${Xn.input}`]:{width:0,minWidth:30}},[`& .${au.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${au.root}.${yi.sizeSmall}`]:{[`& .${au.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Vi.root}`]:{padding:9,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${Xn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${Vi.root}.${yi.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Xn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${vi.root}`]:{paddingTop:19,paddingLeft:8,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${vi.input}`]:{padding:"7px 4px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${vi.root}.${yi.sizeSmall}`]:{paddingBottom:1,[`& .${vi.input}`]:{padding:"2.5px 4px"}},[`& .${yi.hiddenLabel}`]:{paddingTop:8},[`& .${vi.root}.${yi.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Xn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${vi.root}.${yi.hiddenLabel}.${yi.sizeSmall}`]:{[`& .${Xn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Xn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Xn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Xn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Xn.inputRoot}`]:{flexWrap:"wrap"}}}]}),iwe=ot("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),swe=ot(Tu,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),lwe=ot(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=ot(IT,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Xn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(rr(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),uwe=ot(ef,{name:"MuiAutocomplete",slot:"Paper"})(rr(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),dwe=ot("div",{name:"MuiAutocomplete",slot:"Loading"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),fwe=ot("div",{name:"MuiAutocomplete",slot:"NoOptions"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),pwe=ot("ul",{name:"MuiAutocomplete",slot:"Listbox"})(rr(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Xn.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"},[`&.${Xn.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"},[`&.${Xn.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),[`&.${Xn.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}},[`&.${Xn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),hwe=ot(C$,{name:"MuiAutocomplete",slot:"GroupLabel"})(rr(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),mwe=ot("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Xn.option}`]:{paddingLeft:24}}),gwe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,ChipProps:s,className:l,clearIcon:d=uI||(uI=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:U,groupBy:I,handleHomeEndKeys:H=!n.freeSolo,id:Y,includeInputInList:ae=!1,inputValue:K,limitTags:oe=-1,ListboxComponent:ue,ListboxProps:G,loading:ie=!1,loadingText:X="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=dI||(dI=p.jsx(V3,{})),readOnly:Me=!1,renderGroup:Ke,renderInput:Je,renderOption:St,renderTags:Bt,renderValue:at,selectOnFocus:tt=!n.freeSolo,size:pt="medium",slots:ze={},slotProps:be={},value:qe,...Oe}=n,{getRootProps:$t,getInputProps:Rt,getInputLabelProps:vt,getPopupIndicatorProps:it,getClearProps:st,getItemProps:Dt,getListboxProps:nn,getOptionProps:Ut,value:fn,dirty:$n,expanded:Vt,id:Pn,popupOpen:Se,focused:jn,focusedItem:Rn,anchorEl:Jt,setAnchorEl:Pt,inputValue:Br,groupedOptions:Vn}=Z1e({...n,componentName:"Autocomplete"}),hn=!S&&!$&&$n&&!Me,Un=(!F||A===!0)&&A!==!1,{onMouseDown:xe}=Rt(),{ref:Ee,...Ue}=nn(),Ge=N||(we=>we.label??we),ut={...n,disablePortal:O,expanded:Vt,focused:jn,fullWidth:L,getOptionLabel:Ge,hasClearIcon:hn,hasPopupIcon:Un,inputFocused:Rn===-1,popupOpen:Se,size:pt},Tt=owe(ut),Ct={slots:{paper:Re,popper:re,...ze},slotProps:{chip:s,listbox:G,...x,...be}},[Et,It]=mr("listbox",{elementType:pwe,externalForwardedProps:Ct,ownerState:ut,className:Tt.listbox,additionalProps:Ue,ref:Ee}),[Xt,Lt]=mr("paper",{elementType:ef,externalForwardedProps:Ct,ownerState:ut,className:Tt.paper}),[Ht,ge]=mr("popper",{elementType:IT,externalForwardedProps:Ct,ownerState:ut,className:Tt.popper,additionalProps:{disablePortal:O,style:{width:Jt?Jt.clientWidth:null},role:"presentation",anchorEl:Jt,open:Se}});let ye;const Be=we=>({className:Tt.tag,disabled:$,...Dt(we)});if(ee?fn.length>0&&(Bt?ye=Bt(fn,Be,ut):at?ye=at(fn,Be,ut):ye=fn.map((we,Pe)=>{const{key:ft,...kt}=Be({index:Pe});return p.jsx(O3,{label:Ge(we),size:pt,...kt,...Ct.slotProps.chip},ft)})):at&&fn!=null&&(ye=at(fn,Be,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:Tt.tag,children:_(we)},ye.length)))}const gt=Ke||(we=>p.jsxs("li",{children:[p.jsx(hwe,{className:Tt.groupLabel,ownerState:ut,component:"div",children:we.group}),p.jsx(mwe,{className:Tt.groupUl,ownerState:ut,children:we.children})]},we.key)),We=St||((we,Pe)=>{const{key:ft,...kt}=we;return p.jsx("li",{...kt,children:Ge(Pe)},ft)}),Nt=(we,Pe)=>{const ft=Ut({option:we,index:Pe});return We({...ft,className:Tt.option},we,{selected:ft["aria-selected"],index:Pe,inputValue:Br},ut)},Kt=Ct.slotProps.clearIndicator,pn=Ct.slotProps.popupIndicator;return p.jsxs(C.Fragment,{children:[p.jsx(awe,{ref:t,className:qt(Tt.root,l),ownerState:ut,...$t(Oe),children:Je({id:Pn,disabled:$,fullWidth:!0,size:pt==="small"?"small":void 0,InputLabelProps:vt(),InputProps:{ref:Pt,className:Tt.inputRoot,startAdornment:ye,onMouseDown:we=>{we.target===we.currentTarget&&xe(we)},...(hn||Un)&&{endAdornment:p.jsxs(iwe,{className:Tt.endAdornment,ownerState:ut,children:[hn?p.jsx(swe,{...st(),"aria-label":g,title:g,ownerState:ut,...Kt,className:qt(Tt.clearIndicator,Kt?.className),children:d}):null,Un?p.jsx(lwe,{...it(),disabled:$,"aria-label":Se?y:Le,title:Se?y:Le,ownerState:ut,...pn,className:qt(Tt.popupIndicator,pn?.className),children:_e}):null]})}},inputProps:{className:Tt.input,disabled:$,readOnly:Me,...Rt()}})}),Jt?p.jsx(cwe,{as:Ht,...ge,children:p.jsxs(uwe,{as:Xt,...Lt,children:[ie&&Vn.length===0?p.jsx(dwe,{className:Tt.loading,ownerState:ut,children:X}):null,Vn.length===0&&!F&&!ie?p.jsx(fwe,{className:Tt.noOptions,ownerState:ut,role:"presentation",onMouseDown:we=>{we.preventDefault()},children:Z}):null,Vn.length>0?p.jsx(Et,{as:ue,...It,children:Vn.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]})});jr.extend(pT);const ywe=un(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"})),a6=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(" ")+"..."},i6=(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 YN="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 Uxe({query:e,preamble:t,environmentName:n,packageName:r,modelPath:o,versionId:a,givens:i,fileName:s}){const{apiClients:l}=Jn(),[d,u]=C.useState(!1),[m,g]=C.useState(YN),[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:y1(t,e),givens:i,versionId:a},void 0,void 0,{signal:b.signal});if(b.signal.aborted)return;const k=$.data,T=JSON.parse(k.result??"{}"),O=Lxe(Q_(T).length,k.queryRowLimit,k.queryRowLimitSource);g(O===void 0?YN:`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(Ur,{title:m,children:p.jsx("span",{children:p.jsx(qn,{size:"small",startIcon:p.jsx(Axe,{fontSize:"small"}),onClick:()=>void S(),disabled:d,children:"Download CSV"})})})]})}const X_=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 GN(e,t=X_){const n=Hxe(e);if(n===void 0)return;const r=[...e.target.filters,...n].join(", "),o=e.timezone?`timezone: '${fT(e.timezone)}'; `:"",a=t===null?"":`; limit: ${t}`,i=Vxe(e.target.source);if(i!==void 0)return`run: ${i} -> { ${o}where: ${r}; select: *${a} }`}function Vxe(e){return qy(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=U_(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 qxe="This value cannot be written as a filter, so its rows cannot be fetched.";function KN(e){const t=e.drillClauses?__(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}=qr(),m=e?GN(e):void 0,g=e?GN(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,KN(e).map(x=>x.label))}:void 0;return p.jsxs(Lx,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[p.jsxs(Fx,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[p.jsxs(Te,{children:[e?p.jsxs(p.Fragment,{children:["Rows where"," ",KN(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 ${X_} 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(Uxe,{...y})),p.jsx(ro,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary"},children:p.jsx(xh,{fontSize:"small"})})]})]}),p.jsxs(zx,{dividers:!0,sx:{p:0,minHeight:240},children:[m===void 0&&e&&p.jsx(wt,{variant:"body2",sx:{p:2},children:qxe}),m!==void 0&&p.jsx(Yxe,{query:a===void 0?m:y1(a,m),environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:i,...l?{onDone:l}:{}})]}),p.jsxs(dz,{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(qn,{onClick:s,children:"Close"})]})]})}function Yxe({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:i}){const s=n2({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(QT,{state:s,context:e})})}function Z_({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=vT({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=m1(),_=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)},[]),U=C.useMemo(()=>gT(Zd(P,D),_),[P,D,_]),{reports:I}=x_(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}=K_({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}=Vle(e.layout,e.dashboardColumns),X=C.useMemo(()=>Ybe(k,P,a),[k,P,a]);if(e.error)return p.jsx(v$,{layout:ue,header:p.jsx(QN,{manifest:e,links:$,actions:S}),children:p.jsx(lo,{severity:"error",children:e.error})});const ee=g??e.path,Z=e.tiles??[],de=sF(Z);return p.jsxs(v$,{layout:ue,header:p.jsx(QN,{manifest:e,links:$,actions:S}),controls:k.length>0?p.jsx(k_,{children:p.jsx(P1,{...O.panel,layout:u})}):void 0,children:[X.length>0&&p.jsx(lo,{severity:"info",children:Kbe(X)}),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:oF,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(z_,{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?rF(le.rowspan??iF.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(X,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:U,...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(D1,{children:p.jsx(oh,{variant:"document",links:t,children:e})})}function QN({manifest:e,links:t,actions:n}){return p.jsx(C_,{title:e.title??e.name,actions:n,description:e.description?p.jsx(D1,{children:p.jsx(oh,{variant:"document",links:t,children:e.description})}):void 0})}const J_=un(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 e6(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=`${e6(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 P2e({resourceUri:e}){const{server:t,apiClients:n}=Jn(),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(Ur,{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(J_,{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 Ds({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}=Jn(),[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(Uo,{text:"Fetching About..."}),s&&u&&p.jsxs(Ds,{title:"Readme",children:[p.jsx(oh,{variant:"caption",children:r||!g?u:y}),g&&p.jsx(Te,{sx:{mt:1},children:p.jsx(Qy,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),l&&p.jsx(Pa,{error:d,context:`${t} > About`})]})}function e1e(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,i=xT();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={...B0(e),...B0(S)};return{role:"presentation",...S,...b,onBlur:g(b),onFocus:y(b),onMouseEnter:x(b),onMouseLeave:w(b)}},onClickAway:d}}function XN(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=XN(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=XN(r),w=Yo(s.current);return w.addEventListener(x,m),()=>{w.removeEventListener(x,m)}}},[m,r]),C.cloneElement(t,y)}function r1e(e){return kn("MuiSnackbarContent",e)}vn("MuiSnackbarContent",["root","message","action"]);const o1e=e=>{const{classes:t}=e;return Sn({root:["root"],action:["action"],message:["message"]},r1e,t)},a1e=ot(ef,{name:"MuiSnackbarContent",slot:"Root"})(rr(({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(_k(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:_k(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=ot("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),s1e=ot("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),l1e=C.forwardRef(function(e,t){const n=tr({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:qt(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 kn("MuiSnackbar",e)}vn("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const u1e=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${Ft(n.vertical)}${Ft(n.horizontal)}`]};return Sn(r,c1e,t)},d1e=ot("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${Ft(n.anchorOrigin.vertical)}${Ft(n.anchorOrigin.horizontal)}`]]}})(rr(({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=tr({props:e,name:"MuiSnackbar"}),r=Qd(),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},U=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]=mr("root",{ref:t,className:[U.root,u],elementType:d1e,getSlotProps:I,externalForwardedProps:{...ue,...z},ownerState:N}),[X,{ownerState:ee,...Z}]=mr("clickAwayListener",{elementType:n1e,externalForwardedProps:ue,getSlotProps:me=>({onClickAway:(...se)=>{const ve=se[0];me.onClickAway?.(...se),!ve?.defaultMuiPrevented&&H(...se)}}),ownerState:N}),[de,le]=mr("content",{elementType:l1e,shouldForwardComponentProp:!0,externalForwardedProps:ue,additionalProps:{message:x,action:a},ownerState:N}),[fe,he]=mr("transition",{elementType:my,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(X,{...Z,...P.clickAwayListener&&{ownerState:ee},children:p.jsx(G,{...ie,children:p.jsx(fe,{...he,children:d||p.jsx(de,{...le})})})})});let w$;function p1e(e){w$=e}function ZN(e){if(w$)try{w$(e)}catch{}}function rc(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return ZN({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw ZN({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 kh({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 t6="https://docs.malloydata.dev/documentation",JN=`${t6}/user_guides/publishing`,_b="https://github.com/malloydata/publisher/blob/main/docs",tu={docsHome:`${t6}/`,publishing:`${JN}/publishing`,mcpAgents:`${JN}/mcp_agents`,surfaces:`${_b}/choosing-a-surface.md`,givens:`${_b}/givens.md`,materialization:`${_b}/materialization.md`,connections:`${_b}/connections.md`};function h1e({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=Jn(),{environmentName:o}=Xr(e),a=kh({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(Ky,{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(qn,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),p.jsx(qn,{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($i,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx($i,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx($i,{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=un(p.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function I1({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 n6=un(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=vn("MuiBox",["root"]),y1e=J4(),Ea=iR({themeId:bh,defaultTheme:y1e,defaultClassName:g1e.root,generateClassName:F4.generate}),L1=pR({createStyledComponent:ot("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>tr({props:e,name:"MuiStack"})}),eI=vn("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function v1e(e){return kn("MuiListItemIcon",e)}const tI=vn("MuiListItemIcon",["root","alignItemsFlexStart"]),b1e=e=>{const{alignItems:t,classes:n}=e;return Sn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},v1e,n)},x1e=ot("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(rr(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),r2=C.forwardRef(function(e,t){const n=tr({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:qt(s.root,r),ownerState:i,ref:t,...o})});function w1e(e){return kn("MuiListItemText",e)}const $p=vn("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),S1e=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return Sn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},w1e,t)},C1e=ot("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${$p.primary}`]:t.primary},{[`& .${$p.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,[`.${ZD.root}:where(& .${$p.primary})`]:{display:"block"},[`.${ZD.root}:where(& .${$p.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),o2=C.forwardRef(function(e,t){const n=tr({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]=mr("root",{className:qt($.root,o),elementType:C1e,externalForwardedProps:{...k,...y},ownerState:b,ref:t}),[P,D]=mr("primary",{className:$.primary,elementType:Ar,externalForwardedProps:k,ownerState:b}),[A,F]=mr("secondary",{className:$.secondary,elementType:Ar,externalForwardedProps:k,ownerState:b});return w!=null&&w.type!==Ar&&!a&&(w=p.jsx(P,{variant:x?"body2":"body1",component:D?.variant?void 0:"span",...D,children:w})),S!=null&&S.type!==Ar&&!a&&(S=p.jsx(A,{variant:"body2",color:"textSecondary",...F,children:S})),p.jsxs(T,{...O,children:[w,S]})});function k1e(e){return kn("MuiMenuItem",e)}const ag=vn("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=Sn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},k1e,i);return{...i,...s}},T1e=ot(Jp,{shouldForwardProp:e=>gs(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:$1e})(rr(({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},[`& + .${eI.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${eI.inset}`]:{marginLeft:52},[`& .${$p.root}`]:{marginTop:0,marginBottom:0},[`& .${$p.inset}`]:{paddingLeft:36},[`& .${tI.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,[`& .${tI.root} svg`]:{fontSize:"1.25rem"}}}]}))),qo=C.forwardRef(function(e,t){const n=tr({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:qt(b.focusVisible,l),className:qt(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 r6(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 o6=Object.values(fA).filter(e=>e!==fA.Publisher),S$={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},wy=[{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"}}],Sy=[{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 J0(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?ac[e]||[]:e==="s3"?wy:e==="gcs"?Sy: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(U=>{const I=O.get(`ducklake_pg_${U.name}`)?.toString();I&&(N[U.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(wy.forEach(N=>{const U=O.get(`ducklake_s3_${N.name}`)?.toString();U&&(z[N.name]=U)}),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(Sy.forEach(N=>{const U=O.get(`ducklake_gcs_${N.name}`)?.toString();U&&(z[N.name]=U)}),!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 U={name:N,type:z},I=J0(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=S$[z];Y&&(U[Y]=H)}return U});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]]:r6(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(Cn.Fragment,{children:[p.jsx(Ky,{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(L1,{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:o6.map(T=>p.jsx(qo,{value:T,children:T},T))}),o==="ducklake"?p.jsxs(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{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(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{value:"s3",children:"S3"}),p.jsx(qo,{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(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),wy.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(qo,{value:O.value,children:O.label},O.value))},`s3_${T.name}`))]}),u==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Sy.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(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Qy,{label:"Database",icon:p.jsx(d1,{}),onClick:b,ariaLabel:"Add database"})]}),i.length===0&&p.jsx(Ar,{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=J0(T.dbType);return p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{variant:"subtitle2",children:["Database ",O+1]}),p.jsx(Tu,{onClick:()=>$(O),size:"small",color:"error",children:p.jsx(n6,{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(C4).map(D=>p.jsx(qo,{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(qo,{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(qo,{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(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(r2,{sx:{color:"inherit"},children:p.jsx(Xx,{fontSize:"small"})}),p.jsx(o2,{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(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const nI=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function rI(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function oI(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=Cn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[d,u]=C.useState(()=>rI(e)),[m,g]=C.useState("postgres"),[y,x]=C.useState(()=>oI(e)),[w,S]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),b=()=>{u(rI(e)),s(e.type),S(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),g("postgres"),x(oI(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 U={};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");U.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={};wy.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={};Sy.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:U,storage:H}}}else if(R==="duckdb"){if(d.length===0)throw new Error("DuckDB connection must have at least one attached database");const U=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=J0(Y);if(oe&&oe.length>0){const ue={};if(oe.forEach(ie=>{const X=L.get(`attachedDb_${H}_${ie.name}`)?.toString();X&&(ue[ie.name]=X)}),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=S$[Y];G&&(K[G]=ue)}return K});N={name:_,type:R,duckdbConnection:{attachedDatabases:U}}}else{const U=e[Og[R]]||{},I={};if(z.forEach(H=>{const Y=L.get(H.name)?.toString(),ae=U[H.name];Y?I[H.name]=Y:nI.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]]:r6(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=S$[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(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:F=>{F.preventDefault(),F.stopPropagation(),b()},children:[p.jsx(r2,{children:p.jsx(nT,{fontSize:"small"})}),p.jsx(o2,{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(L1,{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:o6.map(F=>p.jsx(qo,{value:F,children:F},F))}),i==="ducklake"?p.jsxs(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{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(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{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(qo,{value:"s3",children:"S3"}),p.jsx(qo,{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(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),wy.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(qo,{value:L.value,children:L.label},L.value))},`s3_${F.name}`))]}),y==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Sy.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(Ea,{sx:{mt:2},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Qy,{label:"Database",icon:p.jsx(d1,{}),onClick:T,ariaLabel:"Add database"})]}),d.length===0&&p.jsx(Ar,{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 _=J0(F.dbType);return p.jsxs(Ea,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ea,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{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(n6,{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(C4).map(R=>p.jsx(qo,{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(qo,{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"||nI.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(qo,{value:N.value,children:N.label},N.value))},F.name)})]})})})]})}function aI(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}=Jn(),{environmentName:a}=Xr(t),[i,s]=Cn.useState(null),[l,d]=Cn.useState(n||null),[u,m]=Cn.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(Sp,{container:!0,spacing:1,children:[!n&&p.jsx(Sp,{size:{xs:12,md:4},children:p.jsxs(Ka,{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(ER,{control:p.jsx(wz,{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(Uo,{text:"Loading schemas..."}),y&&p.jsx(Pa,{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(jR,{dense:!0,disablePadding:!0,children:S.map(b=>{const $=b.name;return b.isHidden&&!u?null:p.jsx(pz,{selected:l===$,onClick:()=>{d($),s(null)},children:p.jsx(wi,{primary:$})},$)})})]})]})}),p.jsx(Sp,{size:{xs:12,md:n?6:4},children:l&&p.jsx(Ka,{sx:{p:1,m:0},children:p.jsx(z1e,{connectionName:e,schemaName:l,onTableSelect:b=>{s(b)},resourceUri:t,connection:r})})}),p.jsx(Sp,{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}=Jn(),{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(Ka,{sx:{p:1,m:0},children:[s&&p.jsx(Pa,{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(Uo,{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(qJ,{children:p.jsxs(_x,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[p.jsx(Vx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"NAME"}),p.jsx(ur,{children:"TYPE"})]})}),p.jsx(Bx,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>p.jsxs(vu,{children:[p.jsx(ur,{children:n.name}),p.jsx(ur,{children:n.type})]},n.name))})]})})})]})}function z1e({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=Xr(r),{apiClients:i}=Jn(),[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=aI(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)||aI(o,t)?`Files in ${t}`:`Tables in ${t}`}),p.jsx(wl,{}),p.jsx(Te,{sx:{mt:1,mb:1},children:p.jsx($i,{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(Uo,{text:"Fetching Tables..."}),m&&p.jsx(Pa,{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(jR,{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(pz,{onClick:()=>n(b.resource),children:p.jsx(wi,{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 U1e({resourceUri:e}){const{apiClients:t,mutable:n}=Jn(),r=Tl(),{environmentName:o}=Xr(e),[a,i]=C.useState(""),[s,l]=C.useState(null),d=N1({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(Ds,{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(Pa,{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(N1e,{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(I1,{icon:p.jsx(m1e,{sx:{fontSize:18}}),tint:XR.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(Zx,{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 V1e=un([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}=Jn(),a=()=>{r(!0)},i=()=>{r(!1),t()},{environmentName:s,packageName:l}=Xr(e),d=kh({mutationFn:()=>o.packages.deletePackage(s,l),success:"Package deleted",invalidates:[["packages",s]],closeDialog:i,resource:"package",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Xx,{fontSize:"small"})}),p.jsx(wi,{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(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:l}),"? The package stops being served and this cannot be undone."]})}),d.notice]})}function q1e({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=Jn(),i=()=>{o(!0)},s=()=>{o(!1),n()},{packageName:l,environmentName:d}=Xr(t),u=kh({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(Cn.Fragment,{children:[p.jsxs(ea,{onClick:i,children:[p.jsx(ml,{children:p.jsx(nT,{fontSize:"small"})}),p.jsx(wi,{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}=Jn(),{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(Pa,{error:s,context:`${r} > Packages`});if(!a)return p.jsx(Uo,{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=N1({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}=Jn(),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(I1,{icon:p.jsx(V1e,{sx:{fontSize:18}}),tint:XR.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(Zx,{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(q1e,{package:e,resourceUri:t,onCloseDialog:d}),p.jsx(H1e,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function j2e({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=Jn(),{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(M0,{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(Ds,{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(U1e,{resourceUri:t}),p.jsx(Jxe,{resourceUri:t})]})}function iI({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 sI(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=sI(u));const m=u?s.filter(g=>{let y=(a||d)(g);return n&&(y=y.toLowerCase()),t&&(y=sI(y)),o==="start"?y.startsWith(u):y.includes(u)}):s;return typeof r=="number"?m.slice(0,r):m}}const K1e=G1e(),lI=5,Q1e=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),X1e=[];function cI(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:U,onInputChange:I,onOpen:H,open:Y,openOnFocus:ae=!1,options:K,readOnly:oe=!1,renderValue:ue,selectOnFocus:G=!e.freeSolo,value:ie}=e,X=Fs(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(cI(u??ie,R,ee)).current,[re,_e]=es({controlled:ie,default:u,name:d}),[Me,Ke]=es({controlled:L,default:Re,name:d,state:"inputValue"}),[Je,St]=C.useState(!1),Bt=C.useCallback((ge,ye,Be)=>{if(!(R?re.length<ye.length:ye!==null)&&!s)return;const gt=cI(ye,R,ee,ue);Me!==gt&&(Ke(gt),I&&I(ge,gt,Be))},[ee,Me,R,I,Ke,s,re,ue]),[at,tt]=es({controlled:Y,default:!1,name:d,state:"open"}),[pt,ze]=C.useState(!0),be=!R&&re!=null&&Me===ee(re),qe=at&&!oe,Oe=qe?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||Bt(null,re,"reset")},[re,Bt,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 Be=ge;for(;;){const gt=fe.current.querySelector(`[data-option-index="${Be}"]`),We=x?!1:!gt||gt.disabled||gt.getAttribute("aria-disabled")==="true";if(gt&>.hasAttribute("tabindex")&&!We)return Be;if(ye==="next"?Be=(Be+1)%Oe.length:Be=(Be-1+Oe.length)%Oe.length,Be===ge)return-1}}const st=Yt(({event:ge,index:ye,reason:Be})=>{if(Ae.current=ye,ye===-1?le.current.removeAttribute("aria-activedescendant"):le.current.setAttribute("aria-activedescendant",`${X}-option-${ye}`),U&&["mouse","keyboard","touch"].includes(Be)&&U(ge,ye===-1?null:Oe[ye],Be),!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`),Be==="keyboard"&&Nt.classList.add(`${n}-focusVisible`),We.scrollHeight>We.clientHeight&&Be!=="mouse"&&Be!=="touch")){const Kt=Nt,pn=We.clientHeight+We.scrollTop,we=Kt.offsetTop+Kt.offsetHeight;we>pn?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:Be="next",reason:gt})=>{if(!qe)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})(),Be);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=!iI({array1:$t.filteredOptions,array2:Oe,parser:ee}),Ut=()=>{const ge=(ye,Be)=>{const gt=ye?ee(ye):"",We=Be?ee(Be):"";return gt===We};if(Ae.current!==-1&&!iI({array1:$t.filteredOptions,array2:Oe,parser:ee})&&$t.inputValue===Me&&(R?re.length===$t.value.length&&$t.value.every((ye,Be)=>ee(re[Be])===ee(ye)):ge($t.value,re))){const ye=$t.filteredOptions[Ae.current];if(ye)return Oe.findIndex(Be=>ee(Be)===ee(ye))}return-1},fn=C.useCallback(()=>{if(!qe)return;const ge=Ut();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 Be=Oe[Ae.current];if(R&&Be&&re.findIndex(We=>_(Be,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,qe,Me,R]),$n=Yt(ge=>{Hk(fe,ge),ge&&fn()});C.useEffect(()=>{nn&&fn()},[fn,nn]);const Vt=ge=>{at||(tt(!0),ze(!0),H&&H(ge))},Pn=(ge,ye)=>{at&&(tt(!1),N&&N(ge,ye))},Se=(ge,ye,Be,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,Be,gt),_e(ye)},jn=C.useRef(!1),Rn=(ge,ye,Be="selectOption",gt="options")=>{let We=Be,Nt=ye;if(R){Nt=Array.isArray(re)?re.slice():[];const Kt=Nt.findIndex(pn=>_(ye,pn));Kt===-1?Nt.push(ye):gt!=="freeSolo"&&(Nt.splice(Kt,1),We="removeOption")}Bt(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 Jt(ge,ye){if(ge===-1)return-1;let Be=ge;for(;;){if(ye==="next"&&Be===re.length||ye==="previous"&&Be===-1)return-1;const gt=ue?"data-item-index":"data-tag-index",We=he.querySelector(`[${gt}="${Be}"]`);if(!We||!We.hasAttribute("tabindex")||We.disabled||We.getAttribute("aria-disabled")==="true")Be+=ye==="next"?1:-1;else return Be}}const Pt=(ge,ye)=>{if(!R)return;Me===""&&Pn(ge,"toggleInput");let Be=se;se===-1?Me===""&&ye==="previous"&&(Be=re.length-1):(Be+=ye==="next"?1:-1,Be<0&&(Be=0),Be===re.length&&(Be=-1)),Be=Jt(Be,ye),ve(Be),vt(Be)},Br=ge=>{Z.current=!0,Ke(""),I&&I(ge,"","clear"),Se(ge,R?[]:null,"clear")},Vn=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":qe&&D&&(ye.preventDefault(),Dt({diff:"start",direction:"next",reason:"keyboard",event:ye}));break;case"End":qe&&D&&(ye.preventDefault(),Dt({diff:"end",direction:"previous",reason:"keyboard",event:ye}));break;case"PageUp":ye.preventDefault(),Dt({diff:-lI,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"PageDown":ye.preventDefault(),Dt({diff:lI,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowDown":ye.preventDefault(),Dt({diff:1,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowUp":ye.preventDefault(),Dt({diff:-1,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowLeft":!R&&ue?vt(0):Pt(ye,"previous");break;case"ArrowRight":!R&&ue?vt(-1):Pt(ye,"next");break;case"Enter":if(Ae.current!==-1&&qe){const Be=Oe[Ae.current],gt=k?k(Be):!1;if(ye.preventDefault(),gt)return;Rn(ye,Be,"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":qe?(ye.preventDefault(),ye.stopPropagation(),Pn(ye,"escape")):l&&(Me!==""||R&&re.length>0||ue)&&(ye.preventDefault(),ye.stopPropagation(),Br(ye));break;case"Backspace":if(R&&!oe&&Me===""&&re.length>0){const Be=se===-1?re.length-1:se,gt=re.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:re[Be]})}!R&&ue&&!oe&&(_e(null),vt(-1));break;case"Delete":if(R&&!oe&&Me===""&&re.length>0&&se!==-1){const Be=se,gt=re.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:re[Be]})}!R&&ue&&!oe&&(_e(null),vt(-1));break}},hn=ge=>{St(!0),ae&&!Z.current&&Vt(ge)},Un=ge=>{if(t(fe)){le.current.focus();return}St(!1),de.current=!0,Z.current=!1,a&&Ae.current!==-1&&qe?Rn(ge,Oe[Ae.current],"blur"):a&&$&&Me!==""?Rn(ge,Me,"blur","freeSolo"):s&&Bt(ge,re,"blur"),Pn(ge,"blur")},xe=ge=>{const ye=ge.target.value;Me!==ye&&(Ke(ye),ze(!1),I&&I(ge,ye,"input")),ye===""?!m&&!R&&Se(ge,null,"clear"):Vt(ge)},Ee=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Ae.current!==ye&&st({event:ge,index:ye,reason:"mouse"})},Ue=ge=>{st({event:ge,index:Number(ge.currentTarget.getAttribute("data-option-index")),reason:"touch"}),jn.current=!0},Ge=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Rn(ge,Oe[ye],"selectOption"),jn.current=!1},ut=ge=>ye=>{const Be=re.slice();Be.splice(ge,1),Se(ye,Be,"removeOption",{option:re[ge]})},Tt=ge=>{Se(ge,null,"removeOption",{option:re})},Ct=ge=>{at?Pn(ge,"toggleInput"):Vt(ge)},Et=ge=>{ge.currentTarget.contains(ge.target)&&ge.target.getAttribute("id")!==X&&ge.preventDefault()},It=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 Lt=$&&Me.length>0;Lt=Lt||(R?re.length>0:re!==null);let Ht=Oe;return P&&(Ht=Oe.reduce((ge,ye,Be)=>{const gt=P(ye);return ge.length>0&&ge[ge.length-1].group===gt?ge[ge.length-1].options.push(ye):ge.push({key:Be,index:Be,group:gt,options:[ye]}),ge},[])),y&&Je&&Un(),{getRootProps:(ge={})=>({...ge,onKeyDown:Vn(ge),onMouseDown:Et,onClick:It}),getInputLabelProps:()=>({id:`${X}-label`,htmlFor:X}),getInputProps:()=>({id:X,value:Me,onBlur:Un,onFocus:hn,onChange:xe,onMouseDown:Xt,"aria-activedescendant":qe?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Rt?`${X}-listbox`:void 0,"aria-expanded":Rt,autoComplete:"off",ref:le,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:y}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Br}),getItemProps:({index:ge=0}={})=>({...R&&{key:ge},...ue?{"data-item-index":ge}:{"data-tag-index":ge},tabIndex:-1,...!oe&&{onDelete:R?ut(ge):Tt}}),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:`${X}-listbox`,"aria-labelledby":`${X}-label`,ref:$n,onMouseDown:ge=>{ge.preventDefault()}}),getOptionProps:({index:ge,option:ye})=>{const Be=(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:`${X}-option-${ge}`,onMouseMove:Ee,onClick:Ge,onTouchStart:Ue,"data-option-index":ge,"aria-disabled":gt,"aria-selected":Be}},id:X,inputValue:Me,value:re,dirty:Lt,expanded:qe&&he,popupOpen:qe,focused:Je||se!==-1,anchorEl:he,setAnchorEl:me,focusedItem:se,focusedTag:se,groupedOptions:Ht}}function J1e(e){return kn("MuiListSubheader",e)}vn("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${Ft(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return Sn(i,J1e,t)},twe=ot("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Ft(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(rr(({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}}]}))),C$=C.forwardRef(function(e,t){const n=tr({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:qt(m.root,r),ref:t,ownerState:u,...d})});C$&&(C$.muiSkipListHighlight=!0);const nwe=un(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 kn("MuiAutocomplete",e)}const Xn=vn("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 uI,dI;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${Ft(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 Sn(m,rwe,t)},awe=ot("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:i,size:s}=n;return[{[`& .${Xn.tag}`]:t.tag},{[`& .${Xn.tag}`]:t[`tagSize${Ft(s)}`]},{[`& .${Xn.inputRoot}`]:t.inputRoot},{[`& .${Xn.input}`]:t.input},{[`& .${Xn.input}`]:i&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Xn.focused} .${Xn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Xn.clearIndicator}`]:{visibility:"visible"}},[`& .${Xn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Xn.inputRoot}`]:{[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:30},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:56},[`& .${Xn.input}`]:{width:0,minWidth:30}},[`& .${au.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${au.root}.${yi.sizeSmall}`]:{[`& .${au.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Vi.root}`]:{padding:9,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${Xn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${Vi.root}.${yi.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Xn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${vi.root}`]:{paddingTop:19,paddingLeft:8,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${vi.input}`]:{padding:"7px 4px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${vi.root}.${yi.sizeSmall}`]:{paddingBottom:1,[`& .${vi.input}`]:{padding:"2.5px 4px"}},[`& .${yi.hiddenLabel}`]:{paddingTop:8},[`& .${vi.root}.${yi.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Xn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${vi.root}.${yi.hiddenLabel}.${yi.sizeSmall}`]:{[`& .${Xn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Xn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Xn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Xn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Xn.inputRoot}`]:{flexWrap:"wrap"}}}]}),iwe=ot("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),swe=ot(Tu,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),lwe=ot(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=ot(IT,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Xn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(rr(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),uwe=ot(ef,{name:"MuiAutocomplete",slot:"Paper"})(rr(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),dwe=ot("div",{name:"MuiAutocomplete",slot:"Loading"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),fwe=ot("div",{name:"MuiAutocomplete",slot:"NoOptions"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),pwe=ot("ul",{name:"MuiAutocomplete",slot:"Listbox"})(rr(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Xn.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"},[`&.${Xn.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"},[`&.${Xn.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),[`&.${Xn.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}},[`&.${Xn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),hwe=ot(C$,{name:"MuiAutocomplete",slot:"GroupLabel"})(rr(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),mwe=ot("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Xn.option}`]:{paddingLeft:24}}),gwe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,ChipProps:s,className:l,clearIcon:d=uI||(uI=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:U,groupBy:I,handleHomeEndKeys:H=!n.freeSolo,id:Y,includeInputInList:ae=!1,inputValue:K,limitTags:oe=-1,ListboxComponent:ue,ListboxProps:G,loading:ie=!1,loadingText:X="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=dI||(dI=p.jsx(V3,{})),readOnly:Me=!1,renderGroup:Ke,renderInput:Je,renderOption:St,renderTags:Bt,renderValue:at,selectOnFocus:tt=!n.freeSolo,size:pt="medium",slots:ze={},slotProps:be={},value:qe,...Oe}=n,{getRootProps:$t,getInputProps:Rt,getInputLabelProps:vt,getPopupIndicatorProps:it,getClearProps:st,getItemProps:Dt,getListboxProps:nn,getOptionProps:Ut,value:fn,dirty:$n,expanded:Vt,id:Pn,popupOpen:Se,focused:jn,focusedItem:Rn,anchorEl:Jt,setAnchorEl:Pt,inputValue:Br,groupedOptions:Vn}=Z1e({...n,componentName:"Autocomplete"}),hn=!S&&!$&&$n&&!Me,Un=(!F||A===!0)&&A!==!1,{onMouseDown:xe}=Rt(),{ref:Ee,...Ue}=nn(),Ge=N||(we=>we.label??we),ut={...n,disablePortal:O,expanded:Vt,focused:jn,fullWidth:L,getOptionLabel:Ge,hasClearIcon:hn,hasPopupIcon:Un,inputFocused:Rn===-1,popupOpen:Se,size:pt},Tt=owe(ut),Ct={slots:{paper:Re,popper:re,...ze},slotProps:{chip:s,listbox:G,...x,...be}},[Et,It]=mr("listbox",{elementType:pwe,externalForwardedProps:Ct,ownerState:ut,className:Tt.listbox,additionalProps:Ue,ref:Ee}),[Xt,Lt]=mr("paper",{elementType:ef,externalForwardedProps:Ct,ownerState:ut,className:Tt.paper}),[Ht,ge]=mr("popper",{elementType:IT,externalForwardedProps:Ct,ownerState:ut,className:Tt.popper,additionalProps:{disablePortal:O,style:{width:Jt?Jt.clientWidth:null},role:"presentation",anchorEl:Jt,open:Se}});let ye;const Be=we=>({className:Tt.tag,disabled:$,...Dt(we)});if(ee?fn.length>0&&(Bt?ye=Bt(fn,Be,ut):at?ye=at(fn,Be,ut):ye=fn.map((we,Pe)=>{const{key:ft,...kt}=Be({index:Pe});return p.jsx(O3,{label:Ge(we),size:pt,...kt,...Ct.slotProps.chip},ft)})):at&&fn!=null&&(ye=at(fn,Be,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:Tt.tag,children:_(we)},ye.length)))}const gt=Ke||(we=>p.jsxs("li",{children:[p.jsx(hwe,{className:Tt.groupLabel,ownerState:ut,component:"div",children:we.group}),p.jsx(mwe,{className:Tt.groupUl,ownerState:ut,children:we.children})]},we.key)),We=St||((we,Pe)=>{const{key:ft,...kt}=we;return p.jsx("li",{...kt,children:Ge(Pe)},ft)}),Nt=(we,Pe)=>{const ft=Ut({option:we,index:Pe});return We({...ft,className:Tt.option},we,{selected:ft["aria-selected"],index:Pe,inputValue:Br},ut)},Kt=Ct.slotProps.clearIndicator,pn=Ct.slotProps.popupIndicator;return p.jsxs(C.Fragment,{children:[p.jsx(awe,{ref:t,className:qt(Tt.root,l),ownerState:ut,...$t(Oe),children:Je({id:Pn,disabled:$,fullWidth:!0,size:pt==="small"?"small":void 0,InputLabelProps:vt(),InputProps:{ref:Pt,className:Tt.inputRoot,startAdornment:ye,onMouseDown:we=>{we.target===we.currentTarget&&xe(we)},...(hn||Un)&&{endAdornment:p.jsxs(iwe,{className:Tt.endAdornment,ownerState:ut,children:[hn?p.jsx(swe,{...st(),"aria-label":g,title:g,ownerState:ut,...Kt,className:qt(Tt.clearIndicator,Kt?.className),children:d}):null,Un?p.jsx(lwe,{...it(),disabled:$,"aria-label":Se?y:Le,title:Se?y:Le,ownerState:ut,...pn,className:qt(Tt.popupIndicator,pn?.className),children:_e}):null]})}},inputProps:{className:Tt.input,disabled:$,readOnly:Me,...Rt()}})}),Jt?p.jsx(cwe,{as:Ht,...ge,children:p.jsxs(uwe,{as:Xt,...Lt,children:[ie&&Vn.length===0?p.jsx(dwe,{className:Tt.loading,ownerState:ut,children:X}):null,Vn.length===0&&!F&&!ie?p.jsx(fwe,{className:Tt.noOptions,ownerState:ut,role:"presentation",onMouseDown:we=>{we.preventDefault()},children:Z}):null,Vn.length>0?p.jsx(Et,{as:ue,...It,children:Vn.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]})});jr.extend(pT);const ywe=un(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"})),a6=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(" ")+"..."},i6=(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
480
|
`)};function fI(){const[e,t]=C.useState(!1),{apiClients:n}=Jn(),r=()=>{t(!0)},o=()=>{t(!1)},a=kh({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:i6({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(Cn.Fragment,{children:[p.jsx(Ky,{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(L1,{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}=Jn(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=kh({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Xx,{fontSize:"small"})}),p.jsx(wi,{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(Ar,{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}=Jn(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=kh({mutationFn(d){return o.environments.updateEnvironment(e.name,{name:e.name,readme:i6({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(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(nT,{fontSize:"small"})}),p.jsx(wi,{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(L1,{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:a6(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 A2e({onClickEnvironment:e}){const{apiClients:t,mutable:n}=Jn(),{data:r,isSuccess:o,isError:a,error:i}=co({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return p.jsx(Pa,{error:i,context:"Environments List"});if(!o)return p.jsx(Uo,{text:"Loading environments..."});const s=r.data??[];return p.jsxs(M0,{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(Sp,{container:!0,spacing:4,sx:{mb:5},children:xwe.map(l=>p.jsx(Sp,{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(Ds,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:p.jsx(fI,{})}:{},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(fI,{}):p.jsx(qn,{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}=Jn(),[r,o]=C.useState(null),a=!!r,i=a6(e.readme),s=d=>{d.stopPropagation(),o(d.currentTarget)},l=()=>o(null);return p.jsx(I1,{icon:p.jsx(ywe,{sx:{fontSize:18}}),tint:XR.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(Zx,{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 dp={},fi={},ig={},fp={},pI={},hI;function Cwe(){return hI||(hI=1,Object.defineProperty(pI,"__esModule",{value:!0})),pI}var sg={},lg={},mI;function tf(){if(mI)return lg;mI=1,Object.defineProperty(lg,"__esModule",{value:!0}),lg.CronField=void 0;let e=class s6{#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(s6.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 gI;function kwe(){if(gI)return sg;gI=1,Object.defineProperty(sg,"__esModule",{value:!0}),sg.CronDayOfMonth=void 0;const e=tf(),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={},yI;function $we(){if(yI)return cg;yI=1,Object.defineProperty(cg,"__esModule",{value:!0}),cg.CronDayOfWeek=void 0;const e=tf(),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={},vI;function Rwe(){if(vI)return ug;vI=1,Object.defineProperty(ug,"__esModule",{value:!0}),ug.CronHour=void 0;const e=tf(),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={},bI;function Twe(){if(bI)return dg;bI=1,Object.defineProperty(dg,"__esModule",{value:!0}),dg.CronMinute=void 0;const e=tf(),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={},xI={},_a={},wI;function Ewe(){if(wI)return _a;wI=1,Object.defineProperty(_a,"__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},U={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,V){throw new s}formatOffset(M,V){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:V,locale:J}){return Ou(M,V,J)}formatOffset(M,V){return Bs(this.offset(M),V)}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 V=W.format(M).replace(/\u200E/g,""),J=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(V),[,ce,Ce,Ne,Ve,Xe,jt,Mn]=J;return[Ne,ce,Ce,Ve,Xe,jt,Mn]}function ie(W,M){const V=W.formatToParts(M),J=[];for(let ce=0;ce<V.length;ce++){const{type:Ce,value:Ne}=V[ce],Ve=ue[Ce];Ce==="era"?J[Ve]=Ne:We(Ve)||(J[Ve]=parseInt(Ne,10))}return J}const X=new Map;class ee extends H{static create(M){let V=X.get(M);return V===void 0&&X.set(M,V=new ee(M)),V}static resetCache(){X.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:V,locale:J}){return Ou(M,V,J,this.name)}formatOffset(M,V){return Bs(this.offset(M),V)}offset(M){if(!this.valid)return NaN;const V=new Date(M);if(isNaN(V))return NaN;const J=oe(this.name);let[ce,Ce,Ne,Ve,Xe,jt,Mn]=J.formatToParts?ie(J,V):G(J,V);Ve==="BC"&&(ce=-Math.abs(ce)+1);const Fn=Ja({year:ce,month:Ce,day:Ne,hour:Xe===24?0:Xe,minute:jt,second:Mn,millisecond:0});let fr=+V;const An=fr%1e3;return fr-=An>=0?An:1e3+An,(Fn-fr)/(60*1e3)}equals(M){return M.type==="iana"&&M.name===this.name}get isValid(){return this.valid}}let Z={};function de(W,M={}){const V=JSON.stringify([W,M]);let J=Z[V];return J||(J=new Intl.ListFormat(W,M),Z[V]=J),J}const le=new Map;function fe(W,M={}){const V=JSON.stringify([W,M]);let J=le.get(V);return J===void 0&&(J=new Intl.DateTimeFormat(W,M),le.set(V,J)),J}const he=new Map;function me(W,M={}){const V=JSON.stringify([W,M]);let J=he.get(V);return J===void 0&&(J=new Intl.NumberFormat(W,M),he.set(V,J)),J}const se=new Map;function ve(W,M={}){const{base:V,...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 V=new Intl.Locale(W);M="getWeekInfo"in V?V.getWeekInfo():V.weekInfo,"minimalDays"in M||(M={...qe,...M}),_e.set(W,M)}return M}function Ke(W){const M=W.indexOf("-x-");M!==-1&&(W=W.substring(0,M));const V=W.indexOf("-u-");if(V===-1)return[W];{let J,ce;try{J=fe(W).resolvedOptions(),ce=W}catch{const Ve=W.substring(0,V);J=fe(Ve).resolvedOptions(),ce=Ve}const{numberingSystem:Ce,calendar:Ne}=J;return[ce,Ce,Ne]}}function Je(W,M,V){return(V||M)&&(W.includes("-u-")||(W+="-u"),V&&(W+=`-ca-${V}`),M&&(W+=`-nu-${M}`)),W}function St(W){const M=[];for(let V=1;V<=12;V++){const J=En.utc(2009,V,1);M.push(W(J))}return M}function Bt(W){const M=[];for(let V=1;V<=7;V++){const J=En.utc(2016,11,13+V);M.push(W(J))}return M}function at(W,M,V,J){const ce=W.listingMode();return ce==="error"?null:ce==="en"?V(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,V,J){this.padTo=J.padTo||0,this.floor=J.floor||!1;const{padTo:ce,floor:Ce,...Ne}=J;if(!V||Object.keys(Ne).length>0){const Ve={useGrouping:!1,...J};J.padTo>0&&(Ve.minimumIntegerDigits=J.padTo),this.inf=me(M,Ve)}}format(M){if(this.inf){const V=this.floor?Math.floor(M):M;return this.inf.format(V)}else{const V=this.floor?Math.floor(M):ys(M,3);return en(V,this.padTo)}}}class ze{constructor(M,V,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),Ve=Ne>=0?`Etc/GMT+${Ne}`:`Etc/GMT${Ne}`;M.offset!==0&&ee.create(Ve).valid?(ce=Ve,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(V,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(V=>{if(V.type==="timeZoneName"){const J=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...V,value:J}}else return V}):M}resolvedOptions(){return this.dtf.resolvedOptions()}}class be{constructor(M,V,J){this.opts={style:"long",...J},!V&&Pe()&&(this.rtf=ve(M,J))}format(M,V){return this.rtf?this.rtf.format(M,V):Sc(V,M,this.opts.numeric,this.opts.style!=="long")}formatToParts(M,V){return this.rtf?this.rtf.formatToParts(M,V):[]}}const qe={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,V,J,ce,Ce=!1){const Ne=M||hn.defaultLocale,Ve=Ne||(Ce?"en-US":Ae()),Xe=V||hn.defaultNumberingSystem,jt=J||hn.defaultOutputCalendar,Mn=cn(ce)||hn.defaultWeekSettings;return new Oe(Ve,Xe,jt,Mn,Ne)}static resetCache(){Le=null,le.clear(),he.clear(),se.clear(),Re.clear(),_e.clear()}static fromObject({locale:M,numberingSystem:V,outputCalendar:J,weekSettings:ce}={}){return Oe.create(M,V,J,ce)}constructor(M,V,J,ce,Ce){const[Ne,Ve,Xe]=Ke(M);this.locale=Ne,this.numberingSystem=V||Ve||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(),V=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return M&&V?"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,cn(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,V=!1){return at(this,M,Pl,()=>{const J=this.intl==="ja"||this.intl.startsWith("ja-");V&=!J;const ce=V?{month:M,day:"numeric"}:{month:M},Ce=V?"format":"standalone";if(!this.monthsCache[Ce][M]){const Ne=J?Ve=>this.dtFormatter(Ve,ce).format():Ve=>this.extract(Ve,ce,"month");this.monthsCache[Ce][M]=St(Ne)}return this.monthsCache[Ce][M]})}weekdays(M,V=!1){return at(this,M,xs,()=>{const J=V?{weekday:M,year:"numeric",month:"long",day:"numeric"}:{weekday:M},ce=V?"format":"standalone";return this.weekdaysCache[ce][M]||(this.weekdaysCache[ce][M]=Bt(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(V=>this.extract(V,M,"dayperiod"))}return this.meridiemCache})}eras(M){return at(this,M,Aa,()=>{const V={era:M};return this.eraCache[M]||(this.eraCache[M]=[En.utc(-40,1,1),En.utc(2017,1,1)].map(J=>this.extract(J,V,"era"))),this.eraCache[M]})}extract(M,V,J){const ce=this.dtFormatter(M,V),Ce=ce.formatToParts(),Ne=Ce.find(Ve=>Ve.type.toLowerCase()===J);return Ne?Ne.value:null}numberFormatter(M={}){return new pt(this.intl,M.forceSimple||this.fastNumbers,M)}dtFormatter(M,V={}){return new ze(M,this.intl,V)}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):qe}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 V=M.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(V)return new Rt(Ml(V[1],V[2]))}return null}constructor(M){super(),this.fixed=M}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Bs(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Bs(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(M,V){return Bs(this.fixed,V)}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(pn(W)){const V=W.toLowerCase();return V==="default"?M:V==="local"||V==="system"?ae.instance:V==="utc"||V==="gmt"?Rt.utcInstance:Rt.parseSpecifier(V)||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 Ut(W){let M=parseInt(W,10);if(isNaN(M)){M="";for(let V=0;V<W.length;V++){const J=W.charCodeAt(V);if(W[V].search(st.hanidec)!==-1)M+=nn.indexOf(W[V]);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 fn=new Map;function $n(){fn.clear()}function Vt({numberingSystem:W},M=""){const V=W||"latn";let J=fn.get(V);J===void 0&&(J=new Map,fn.set(V,J));let ce=J.get(M);return ce===void 0&&(ce=new RegExp(`${st[V]}${M}`),J.set(M,ce)),ce}let Pn=()=>Date.now(),Se="system",jn=null,Rn=null,Jt=null,Pt=60,Br,Vn=null;class hn{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 Jt}static set defaultOutputCalendar(M){Jt=M}static get defaultWeekSettings(){return Vn}static set defaultWeekSettings(M){Vn=cn(M)}static get twoDigitCutoffYear(){return Pt}static set twoDigitCutoffYear(M){Pt=M%100}static get throwOnInvalid(){return Br}static set throwOnInvalid(M){Br=M}static resetCaches(){Oe.resetCache(),ee.resetCache(),En.resetCache(),$n()}}class Un{constructor(M,V){this.reason=M,this.explanation=V}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 Ue(W,M){return new Un("unit out of range",`you specified ${M} (of type ${typeof M}) as a ${W}, which is invalid`)}function Ge(W,M,V){const J=new Date(Date.UTC(W,M-1,V));W<100&&W>=0&&J.setUTCFullYear(J.getUTCFullYear()-1900);const ce=J.getUTCDay();return ce===0?7:ce}function ut(W,M,V){return V+(ca(W)?Ee:xe)[M-1]}function Tt(W,M){const V=ca(W)?Ee:xe,J=V.findIndex(Ce=>Ce<M),ce=M-V[J];return{month:J+1,day:ce}}function Ct(W,M){return(W-M+7)%7+1}function Et(W,M=4,V=1){const{year:J,month:ce,day:Ce}=W,Ne=ut(J,ce,Ce),Ve=Ct(Ge(J,ce,Ce),V);let Xe=Math.floor((Ne-Ve+14-M)/7),jt;return Xe<1?(jt=J-1,Xe=vs(jt,M,V)):Xe>vs(J,M,V)?(jt=J+1,Xe=1):jt=J,{weekYear:jt,weekNumber:Xe,weekday:Ve,...Ol(W)}}function It(W,M=4,V=1){const{weekYear:J,weekNumber:ce,weekday:Ce}=W,Ne=Ct(Ge(J,1,M),V),Ve=dr(J);let Xe=ce*7+Ce-Ne-7+M,jt;Xe<1?(jt=J-1,Xe+=dr(jt)):Xe>Ve?(jt=J+1,Xe-=dr(J)):jt=J;const{month:Mn,day:Fn}=Tt(jt,Xe);return{year:jt,month:Mn,day:Fn,...Ol(W)}}function Xt(W){const{year:M,month:V,day:J}=W,ce=ut(M,V,J);return{year:M,ordinal:ce,...Ol(W)}}function Lt(W){const{year:M,ordinal:V}=W,{month:J,day:ce}=Tt(M,V);return{year:M,month:J,day:ce,...Ol(W)}}function Ht(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,V=1){const J=Kt(W.weekYear),ce=On(W.weekNumber,1,vs(W.weekYear,M,V)),Ce=On(W.weekday,1,7);return J?ce?Ce?!1:Ue("weekday",W.weekday):Ue("week",W.weekNumber):Ue("weekYear",W.weekYear)}function ye(W){const M=Kt(W.year),V=On(W.ordinal,1,dr(W.year));return M?V?!1:Ue("ordinal",W.ordinal):Ue("year",W.year)}function Be(W){const M=Kt(W.year),V=On(W.month,1,12),J=On(W.day,1,Vr(W.year,W.month));return M?V?J?!1:Ue("day",W.day):Ue("month",W.month):Ue("year",W.year)}function gt(W){const{hour:M,minute:V,second:J,millisecond:ce}=W,Ce=On(M,0,23)||M===24&&V===0&&J===0&&ce===0,Ne=On(V,0,59),Ve=On(J,0,59),Xe=On(ce,0,999);return Ce?Ne?Ve?Xe?!1:Ue("millisecond",ce):Ue("second",J):Ue("minute",V):Ue("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 pn(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 Mt(W,M,V){if(W.length!==0)return W.reduce((J,ce)=>{const Ce=[M(ce),ce];return J&&V(J[0],Ce[0])===J[0]?J:Ce},null)[1]}function Ot(W,M){return M.reduce((V,J)=>(V[J]=W[J],V),{})}function zt(W,M){return Object.prototype.hasOwnProperty.call(W,M)}function cn(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,V){return Kt(W)&&W>=M&&W<=V}function or(W,M){return W-M*Math.floor(W/M)}function en(W,M=2){const V=W<0;let J;return V?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 ys(W,M,V="round"){const J=10**M;switch(V){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 ${V} is out of range`)}}function ca(W){return W%4===0&&(W%100!==0||W%400===0)}function dr(W){return ca(W)?366:365}function Vr(W,M){const V=or(M-1,12)+1,J=W+(M-V)/12;return V===2?ca(J)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][V-1]}function Ja(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,V){return-Ct(Ge(W,1,M),V)+M-1}function vs(W,M=4,V=1){const J=El(W,M,V),ce=El(W+1,M,V);return(dr(W)-J+ce)/7}function Pi(W){return W>99?W:W>hn.twoDigitCutoffYear?1900+W:2e3+W}function Ou(W,M,V,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},Ve=new Intl.DateTimeFormat(V,Ne).formatToParts(ce).find(Xe=>Xe.type.toLowerCase()==="timezonename");return Ve?Ve.value:null}function Ml(W,M){let V=parseInt(W,10);Number.isNaN(V)&&(V=0);const J=parseInt(M,10)||0,ce=V<0||Object.is(V,-0)?-J:J;return V*60+ce}function bs(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 V={};for(const J in W)if(zt(W,J)){const ce=W[J];if(ce==null)continue;V[M(J)]=bs(ce)}return V}function Bs(W,M){const V=Math.trunc(Math.abs(W/60)),J=Math.trunc(Math.abs(W%60)),ce=W>=0?"+":"-";switch(M){case"short":return`${ce}${en(V,2)}:${en(J,2)}`;case"narrow":return`${ce}${V}${J>0?`:${J}`:""}`;case"techie":return`${ce}${en(V,2)}${en(J,2)}`;default:throw new RangeError(`Value format ${M} is out of range for property format`)}}function Ol(W){return Ot(W,["hour","minute","second","millisecond"])}const Pu=["January","February","March","April","May","June","July","August","September","October","November","December"],rf=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Rh=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pl(W){switch(W){case"narrow":return[...Rh];case"short":return[...rf];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"],Vs=["M","T","W","T","F","S","S"];function xs(W){switch(W){case"narrow":return[...Vs];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"],of=["BC","AD"],jl=["B","A"];function Aa(W){switch(W){case"narrow":return[...jl];case"short":return[...of];case"long":return[...Au];default:return null}}function Du(W){return ju[W.hour<12?0:1]}function Al(W,M){return xs(M)[W.weekday-1]}function ji(W,M){return Pl(M)[W.month-1]}function Nu(W,M){return Aa(M)[W.year<0?0:1]}function Sc(W,M,V="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(V==="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,Ve=Math.abs(M),Xe=Ve===1,jt=ce[W],Mn=J?Xe?jt[1]:jt[2]||jt[1]:Xe?ce[W][0]:W;return Ne?`${Ve} ${Mn} ago`:`in ${Ve} ${Mn}`}function Iu(W,M){let V="";for(const J of W)J.literal?V+=J.val:V+=M(J.val);return V}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:U,F,FF:_,FFF:N,FFFF:I};class oo{static create(M,V={}){return new oo(M,V)}static parseFormat(M){let V=null,J="",ce=!1;const Ce=[];for(let Ne=0;Ne<M.length;Ne++){const Ve=M.charAt(Ne);Ve==="'"?((J.length>0||ce)&&Ce.push({literal:ce||/^\s+$/.test(J),val:J===""?"'":J}),V=null,J="",ce=!ce):ce||Ve===V?J+=Ve:(J.length>0&&Ce.push({literal:/^\s+$/.test(J),val:J}),J=Ve,V=Ve)}return J.length>0&&Ce.push({literal:ce||/^\s+$/.test(J),val:J}),Ce}static macroTokenToFormatOpts(M){return Cc[M]}constructor(M,V){this.opts=V,this.loc=M,this.systemLoc=null}formatWithSystemDefault(M,V){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(M,{...this.opts,...V}).format()}dtFormatter(M,V={}){return this.loc.dtFormatter(M,{...this.opts,...V})}formatDateTime(M,V){return this.dtFormatter(M,V).format()}formatDateTimeParts(M,V){return this.dtFormatter(M,V).formatToParts()}formatInterval(M,V){return this.dtFormatter(M.start,V).dtf.formatRange(M.start.toJSDate(),M.end.toJSDate())}resolvedOptions(M,V){return this.dtFormatter(M,V).resolvedOptions()}num(M,V=0,J=void 0){if(this.opts.forceSimple)return en(M,V);const ce={...this.opts};return V>0&&(ce.padTo=V),J&&(ce.signDisplay=J),this.loc.numberFormatter(ce).format(M)}formatDateTimeFromString(M,V){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):"",Ve=()=>J?Du(M):Ce({hour:"numeric",hourCycle:"h12"},"dayperiod"),Xe=(An,Jr)=>J?ji(M,An):Ce(Jr?{month:An}:{month:An,day:"numeric"},"month"),jt=(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"),fr=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 Ve();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 jt("short",!0);case"cccc":return jt("long",!0);case"ccccc":return jt("narrow",!0);case"E":return this.num(M.weekday);case"EEE":return jt("short",!1);case"EEEE":return jt("long",!1);case"EEEEE":return jt("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(V),fr)}formatDurationFromString(M,V){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)=>fr=>{const An=ce(fr);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,fr.length,Qo)}else return fr},Ne=oo.parseFormat(V),Ve=Ne.reduce((Mn,{literal:Fn,val:fr})=>Fn?Mn:Mn.concat(fr),[]),Xe=M.shiftTo(...Ve.map(ce).filter(Mn=>Mn)),jt={isNegativeDuration:Xe<0,largestUnit:Object.keys(Xe.values)[0]};return Iu(Ne,Ce(Xe,jt))}}const Lu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function B(...W){const M=W.reduce((V,J)=>V+J.source,"");return RegExp(`^${M}$`)}function $o(...W){return M=>W.reduce(([V,J,ce],Ce)=>{const[Ne,Ve,Xe]=Ce(M,ce);return[{...V,...Ne},Ve||J,Xe]},[{},null,1]).slice(0,2)}function ao(W,...M){if(W==null)return[null,null];for(const[V,J]of M){const ce=V.exec(W);if(ce)return J(ce)}return[null,null]}function ei(...W){return(M,V)=>{const J={};let ce;for(ce=0;ce<W.length;ce++)J[W[ce]]=Dr(M[V+ce]);return[J,null,V+ce]}}const je=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ws=`(?:${je.source}?(?:\\[(${Lu.source})\\])?)?`,zn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ko=RegExp(`${zn.source}${ws}`),Hs=RegExp(`(?:[Tt]${Ko.source})?`),zu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,af=/(\d{4})-?W(\d\d)(?:-?(\d))?/,sf=/(\d{4})-?(\d{3})/,rt=ei("weekYear","weekNumber","weekDay"),Fu=ei("year","ordinal"),_u=/(\d{4})-(\d\d)-(\d\d)/,kc=RegExp(`${zn.source} ?(?:${je.source}|(${Lu.source}))?`),lf=RegExp(`(?: ${kc.source})?`);function qs(W,M,V){const J=W[M];return We(J)?V:Dr(J)}function Dl(W,M){return[{year:qs(W,M),month:qs(W,M+1,1),day:qs(W,M+2,1)},null,M+3]}function Ss(W,M){return[{hours:qs(W,M,0),minutes:qs(W,M+1,0),seconds:qs(W,M+2,0),milliseconds:Do(W[M+3])},null,M+4]}function Ws(W,M){const V=!W[M]&&!W[M+1],J=Ml(W[M+1],W[M+2]),ce=V?null:Rt.instance(J);return[{},ce,M+3]}function ua(W,M){const V=W[M]?ee.create(W[M]):null;return[{},V,M+1]}const Th=RegExp(`^T?${zn.source}$`),Eh=/^-?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,V,J,ce,Ce,Ne,Ve,Xe,jt]=W,Mn=M[0]==="-",Fn=Xe&&Xe[0]==="-",fr=(An,Jr=!1)=>An!==void 0&&(Jr||An&&Mn)?-An:An;return[{years:fr(fo(V)),months:fr(fo(J)),weeks:fr(fo(ce)),days:fr(fo(Ce)),hours:fr(fo(Ne)),minutes:fr(fo(Ve)),seconds:fr(fo(Xe),Xe==="-0"),milliseconds:fr(Do(jt),Fn)}]}const cf={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Uu(W,M,V,J,ce,Ce,Ne){const Ve={year:M.length===2?Pi(Dr(M)):Dr(M),month:rf.indexOf(V)+1,day:Dr(J),hour:Dr(ce),minute:Dr(Ce)};return Ne&&(Ve.second=Dr(Ne)),W&&(Ve.weekday=W.length>3?xc.indexOf(W)+1:wc.indexOf(W)+1),Ve}const Mh=/^(?:(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 uf(W){const[,M,V,J,ce,Ce,Ne,Ve,Xe,jt,Mn,Fn]=W,fr=Uu(M,ce,J,V,Ce,Ne,Ve);let An;return Xe?An=cf[Xe]:jt?An=0:An=Ml(Mn,Fn),[fr,new Rt(An)]}function Oh(W){return W.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const df=/^(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$/,Bu=/^(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$/,Ph=/^(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,V,J,ce,Ce,Ne,Ve]=W;return[Uu(M,ce,J,V,Ce,Ne,Ve),Rt.utcInstance]}function jh(W){const[,M,V,J,ce,Ce,Ne,Ve]=W;return[Uu(M,Ve,V,J,ce,Ce,Ne),Rt.utcInstance]}const Ah=B(zu,Hs),Dh=B(af,Hs),Nh=B(sf,Hs),Vu=B(Ko),Ys=$o(Dl,Ss,Ws,ua),Ih=$o(rt,Ss,Ws,ua),ff=$o(Fu,Ss,Ws,ua),pf=$o(Ss,Ws,ua);function hf(W){return ao(W,[Ah,Ys],[Dh,Ih],[Nh,ff],[Vu,pf])}function mf(W){return ao(Oh(W),[Mh,uf])}function gf(W){return ao(W,[df,$c],[Bu,$c],[Ph,jh])}function Gs(W){return ao(W,[Eh,Nl])}const Lh=$o(Ss);function zh(W){return ao(W,[Th,Lh])}const Fh=B(_u,lf),yf=B(kc),vf=$o(Ss,Ws,ua);function Il(W){return ao(W,[Fh,Ys],[yf,vf])}const ar="Invalid Duration",Cs={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},...Cs},q=146097/400,te=146097/4800,Q={years:{quarters:4,months:12,weeks:q/7,days:q,hours:q*24,minutes:q*24*60,seconds:q*24*60*60,milliseconds:q*24*60*60*1e3},quarters:{months:3,weeks:q/28,days:q/4,hours:q*24/4,minutes:q*24*60/4,seconds:q*24*60*60/4,milliseconds:q*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},...Cs},$e=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Zt=$e.slice(0).reverse();function Gt(W,M,V=!1){const J={values:V?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 V;let J=(V=M.milliseconds)!=null?V:0;for(const ce of Zt.slice(1))M[ce]&&(J+=M[ce]*W[ce].milliseconds);return J}function Gn(W,M){const V=Dn(W,M)<0?-1:1;$e.reduceRight((J,ce)=>{if(We(M[ce]))return J;if(J){const Ce=M[J]*V,Ne=W[ce][J],Ve=Math.floor(Ce/Ne);M[ce]+=Ve*V,M[J]-=Ve*Ne*V}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 Kn(W){const M={};for(const[V,J]of Object.entries(W))J!==0&&(M[V]=J);return M}class Qt{constructor(M){const V=M.conversionAccuracy==="longterm"||!1;let J=V?Q:Zr;M.matrix&&(J=M.matrix),this.values=M.values,this.loc=M.loc||Oe.create(),this.conversionAccuracy=V?"longterm":"casual",this.invalid=M.invalid||null,this.matrix=J,this.isLuxonDuration=!0}static fromMillis(M,V){return Qt.fromObject({milliseconds:M},V)}static fromObject(M,V={}){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(V),conversionAccuracy:V.conversionAccuracy,matrix:V.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,V){const[J]=Gs(M);return J?Qt.fromObject(J,V):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static fromISOTime(M,V){const[J]=zh(M);return J?Qt.fromObject(J,V):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the Duration is invalid");const J=M instanceof Un?M:new Un(M,V);if(hn.throwOnInvalid)throw new r(J);return new Qt({invalid:J})}static normalizeUnit(M){const V={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(!V)throw new a(M);return V}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,V={}){const J={...V,floor:V.round!==!1&&V.floor!==!1};return this.isValid?oo.create(this.loc,J).formatDurationFromString(this,M):ar}toHuman(M={}){if(!this.isValid)return ar;const V=M.showZeros!==!1,J=$e.map(ce=>{const Ce=this.values[ce];return We(Ce)||Ce===0&&!V?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+=ys(this.seconds+this.milliseconds/1e3,3)+"S"),M==="P"&&(M+="T0S"),M}toISOTime(M={}){if(!this.isValid)return null;const V=this.toMillis();return V<0||V>=864e5?null:(M={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...M,includeOffset:!1},En.fromMillis(V,{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 V=Qt.fromDurationLike(M),J={};for(const ce of $e)(zt(V.values,ce)||zt(this.values,ce))&&(J[ce]=V.get(ce)+this.get(ce));return Gt(this,{values:J},!0)}minus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M);return this.plus(V.negate())}mapUnits(M){if(!this.isValid)return this;const V={};for(const J of Object.keys(this.values))V[J]=bs(M(this.values[J],J));return Gt(this,{values:V},!0)}get(M){return this[Qt.normalizeUnit(M)]}set(M){if(!this.isValid)return this;const V={...this.values,...bc(M,Qt.normalizeUnit)};return Gt(this,{values:V})}reconfigure({locale:M,numberingSystem:V,conversionAccuracy:J,matrix:ce}={}){const Ce={loc:this.loc.clone({locale:M,numberingSystem:V}),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 Gn(this.matrix,M),Gt(this,{values:M},!0)}rescale(){if(!this.isValid)return this;const M=Kn(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 V={},J={},ce=this.toObject();let Ce;for(const Ne of $e)if(M.indexOf(Ne)>=0){Ce=Ne;let Ve=0;for(const jt in J)Ve+=this.matrix[jt][Ne]*J[jt],J[jt]=0;Nt(ce[Ne])&&(Ve+=ce[Ne]);const Xe=Math.trunc(Ve);V[Ne]=Xe,J[Ne]=(Ve*1e3-Xe*1e3)/1e3}else Nt(ce[Ne])&&(J[Ne]=ce[Ne]);for(const Ne in J)J[Ne]!==0&&(V[Ce]+=Ne===Ce?J[Ne]:J[Ne]/this.matrix[Ce][Ne]);return Gn(this.matrix,V),Gt(this,{values:V},!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 V of Object.keys(this.values))M[V]=this.values[V]===0?0:-this.values[V];return Gt(this,{values:M},!0)}removeZeros(){if(!this.isValid)return this;const M=Kn(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 V(J,ce){return J===void 0||J===0?ce===void 0||ce===0:J===ce}for(const J of $e)if(!V(this.values[J],M.values[J]))return!1;return!0}}const kr="Invalid Interval";function $r(W,M){return!W||!W.isValid?bn.invalid("missing or invalid start"):!M||!M.isValid?bn.invalid("missing or invalid end"):M<W?bn.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 bn{constructor(M){this.s=M.start,this.e=M.end,this.invalid=M.invalid||null,this.isLuxonInterval=!0}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the Interval is invalid");const J=M instanceof Un?M:new Un(M,V);if(hn.throwOnInvalid)throw new n(J);return new bn({invalid:J})}static fromDateTimes(M,V){const J=ii(M),ce=ii(V);return $r(J,ce)??new bn({start:J,end:ce})}static after(M,V){const J=Qt.fromDurationLike(V),ce=ii(M);return bn.fromDateTimes(ce,ce.plus(J))}static before(M,V){const J=Qt.fromDurationLike(V),ce=ii(M);return bn.fromDateTimes(ce.minus(J),ce)}static fromISO(M,V){const[J,ce]=(M||"").split("/",2);if(J&&ce){let Ce,Ne;try{Ce=En.fromISO(J,V),Ne=Ce.isValid}catch{Ne=!1}let Ve,Xe;try{Ve=En.fromISO(ce,V),Xe=Ve.isValid}catch{Xe=!1}if(Ne&&Xe)return bn.fromDateTimes(Ce,Ve);if(Ne){const jt=Qt.fromISO(ce,V);if(jt.isValid)return bn.after(Ce,jt)}else if(Xe){const jt=Qt.fromISO(J,V);if(jt.isValid)return bn.before(Ve,jt)}}return bn.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",V){if(!this.isValid)return NaN;const J=this.start.startOf(M,V);let ce;return V!=null&&V.useLocaleWeeks?ce=this.end.reconfigure({locale:J.locale}):ce=this.end,ce=ce.startOf(M,V),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:V}={}){return this.isValid?bn.fromDateTimes(M||this.s,V||this.e):this}splitAt(...M){if(!this.isValid)return[];const V=M.map(ii).filter(Ne=>this.contains(Ne)).sort((Ne,Ve)=>Ne.toMillis()-Ve.toMillis()),J=[];let{s:ce}=this,Ce=0;for(;ce<this.e;){const Ne=V[Ce]||this.e,Ve=+Ne>+this.e?this.e:Ne;J.push(bn.fromDateTimes(ce,Ve)),ce=Ve,Ce+=1}return J}splitBy(M){const V=Qt.fromDurationLike(M);if(!this.isValid||!V.isValid||V.as("milliseconds")===0)return[];let{s:J}=this,ce=1,Ce;const Ne=[];for(;J<this.e;){const Ve=this.start.plus(V.mapUnits(Xe=>Xe*ce));Ce=+Ve>+this.e?this.e:Ve,Ne.push(bn.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 V=this.s>M.s?this.s:M.s,J=this.e<M.e?this.e:M.e;return V>=J?null:bn.fromDateTimes(V,J)}union(M){if(!this.isValid)return this;const V=this.s<M.s?this.s:M.s,J=this.e>M.e?this.e:M.e;return bn.fromDateTimes(V,J)}static merge(M){const[V,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&&V.push(J),V}static xor(M){let V=null,J=0;const ce=[],Ce=M.map(Xe=>[{time:Xe.s,type:"s"},{time:Xe.e,type:"e"}]),Ne=Array.prototype.concat(...Ce),Ve=Ne.sort((Xe,jt)=>Xe.time-jt.time);for(const Xe of Ve)J+=Xe.type==="s"?1:-1,J===1?V=Xe.time:(V&&+V!=+Xe.time&&ce.push(bn.fromDateTimes(V,Xe.time)),V=null);return bn.merge(ce)}difference(...M){return bn.xor([this].concat(M)).map(V=>this.intersection(V)).filter(V=>V&&!V.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:kr}[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,V={}){return this.isValid?oo.create(this.s.loc.clone(V),M).formatInterval(this):kr}toISO(M){return this.isValid?`${this.s.toISO(M)}/${this.e.toISO(M)}`:kr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kr}toISOTime(M){return this.isValid?`${this.s.toISOTime(M)}/${this.e.toISOTime(M)}`:kr}toFormat(M,{separator:V=" – "}={}){return this.isValid?`${this.s.toFormat(M)}${V}${this.e.toFormat(M)}`:kr}toDuration(M,V){return this.isValid?this.e.diff(this.s,M,V):Qt.invalid(this.invalidReason)}mapEndpoints(M){return bn.fromDateTimes(M(this.s),M(this.e))}}class br{static hasDST(M=hn.defaultZone){const V=En.now().setZone(M).set({month:12});return!M.isUniversal&&V.offset!==V.set({month:6}).offset}static isValidIANAZone(M){return ee.isValidZone(M)}static normalizeZone(M){return it(M,hn.defaultZone)}static getStartOfWeek({locale:M=null,locObj:V=null}={}){return(V||Oe.create(M)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:M=null,locObj:V=null}={}){return(V||Oe.create(M)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:M=null,locObj:V=null}={}){return(V||Oe.create(M)).getWeekendDays().slice()}static months(M="long",{locale:V=null,numberingSystem:J=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Oe.create(V,J,Ce)).months(M)}static monthsFormat(M="long",{locale:V=null,numberingSystem:J=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Oe.create(V,J,Ce)).months(M,!0)}static weekdays(M="long",{locale:V=null,numberingSystem:J=null,locObj:ce=null}={}){return(ce||Oe.create(V,J,null)).weekdays(M)}static weekdaysFormat(M="long",{locale:V=null,numberingSystem:J=null,locObj:ce=null}={}){return(ce||Oe.create(V,J,null)).weekdays(M,!0)}static meridiems({locale:M=null}={}){return Oe.create(M).meridiems()}static eras(M="short",{locale:V=null}={}){return Oe.create(V,null,"gregory").eras(M)}static features(){return{relative:Pe(),localeWeek:ft()}}}function Wr(W,M){const V=ce=>ce.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),J=V(M)-V(W);return Math.floor(Qt.fromMillis(J).as("days"))}function Gr(W,M,V){const J=[["years",(Xe,jt)=>jt.year-Xe.year],["quarters",(Xe,jt)=>jt.quarter-Xe.quarter+(jt.year-Xe.year)*4],["months",(Xe,jt)=>jt.month-Xe.month+(jt.year-Xe.year)*12],["weeks",(Xe,jt)=>{const Mn=Wr(Xe,jt);return(Mn-Mn%7)/7}],["days",Wr]],ce={},Ce=W;let Ne,Ve;for(const[Xe,jt]of J)V.indexOf(Xe)>=0&&(Ne=Xe,ce[Xe]=jt(W,M),Ve=Ce.plus(ce),Ve>M?(ce[Xe]--,W=Ce.plus(ce),W>M&&(Ve=W,ce[Xe]--,W=Ce.plus(ce))):W=Ve);return[W,ce,Ve,Ne]}function ti(W,M,V,J){let[ce,Ce,Ne,Ve]=Gr(W,M,V);const Xe=M-ce,jt=V.filter(Fn=>["hours","minutes","seconds","milliseconds"].indexOf(Fn)>=0);jt.length===0&&(Ne<M&&(Ne=ce.plus({[Ve]:1})),Ne!==ce&&(Ce[Ve]=(Ce[Ve]||0)+Xe/(Ne-ce)));const Mn=Qt.fromObject(Ce,J);return jt.length>0?Qt.fromMillis(Xe,J).shiftTo(...jt).plus(Mn):Mn}const Sa="missing Intl.DateTimeFormat.formatToParts support";function Bn(W,M=V=>V){return{regex:W,deser:([V])=>M(Ut(V))}}const Ll="[ ]",Ca=new RegExp(Ll,"g");function ks(W){return W.replace(/\./g,"\\.?").replace(Ca,Ll)}function da(W){return W.replace(/\./g,"").replace(Ca," ").toLowerCase()}function io(W,M){return W===null?null:{regex:RegExp(W.map(ks).join("|")),deser:([V])=>W.findIndex(J=>da(V)===da(J))+M}}function zl(W,M){return{regex:W,deser:([,V,J])=>Ml(V,J),groups:M}}function Ro(W){return{regex:W,deser:([M])=>M}}function Rc(W){return W.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function _h(W,M){const V=Vt(M),J=Vt(M,"{2}"),ce=Vt(M,"{3}"),Ce=Vt(M,"{4}"),Ne=Vt(M,"{6}"),Ve=Vt(M,"{1,2}"),Xe=Vt(M,"{1,3}"),jt=Vt(M,"{1,6}"),Mn=Vt(M,"{1,9}"),Fn=Vt(M,"{2,4}"),fr=Vt(M,"{4,6}"),An=Qo=>({regex:RegExp(Rc(Qo.val)),deser:([Da])=>Da,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 Bn(jt);case"yy":return Bn(Fn,Pi);case"yyyy":return Bn(Ce);case"yyyyy":return Bn(fr);case"yyyyyy":return Bn(Ne);case"M":return Bn(Ve);case"MM":return Bn(J);case"MMM":return io(M.months("short",!0),1);case"MMMM":return io(M.months("long",!0),1);case"L":return Bn(Ve);case"LL":return Bn(J);case"LLL":return io(M.months("short",!1),1);case"LLLL":return io(M.months("long",!1),1);case"d":return Bn(Ve);case"dd":return Bn(J);case"o":return Bn(Xe);case"ooo":return Bn(ce);case"HH":return Bn(J);case"H":return Bn(Ve);case"hh":return Bn(J);case"h":return Bn(Ve);case"mm":return Bn(J);case"m":return Bn(Ve);case"q":return Bn(Ve);case"qq":return Bn(J);case"s":return Bn(Ve);case"ss":return Bn(J);case"S":return Bn(Xe);case"SSS":return Bn(ce);case"u":return Ro(Mn);case"uu":return Ro(Ve);case"uuu":return Bn(V);case"a":return io(M.meridiems(),0);case"kkkk":return Bn(Ce);case"kk":return Bn(Fn,Pi);case"W":return Bn(Ve);case"WW":return Bn(J);case"E":case"c":return Bn(V);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(`([+-]${Ve.source})(?::(${J.source}))?`),2);case"ZZZ":return zl(new RegExp(`([+-]${Ve.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:Sa};return Jr.token=W,Jr}const iv={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,V){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=V.hour12?"hour12":"hour24");let Ve=iv[Ne];if(typeof Ve=="object"&&(Ve=Ve[Ce]),Ve)return{literal:!1,val:Ve}}function sv(W){return[`^${W.map(M=>M.regex).reduce((M,V)=>`${M}(${V.source})`,"")}$`,W]}function lv(W,M,V){const J=W.match(M);if(J){const ce={};let Ce=1;for(const Ne in V)if(zt(V,Ne)){const Ve=V[Ne],Xe=Ve.groups?Ve.groups+1:1;!Ve.literal&&Ve.token&&(ce[Ve.token.val[0]]=Ve.deser(J.slice(Ce,Ce+Xe))),Ce+=Xe}return[J,ce]}else return[J,{}]}function cv(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 V=null,J;return We(W.z)||(V=ee.create(W.z)),We(W.Z)||(V||(V=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},{}),V,J]}let Uh=null;function H1(){return Uh||(Uh=En.fromMillis(1555555555555)),Uh}function q1(W,M){if(W.literal)return W;const V=oo.macroTokenToFormatOpts(W.val),J=Hh(V,M);return J==null||J.includes(void 0)?W:J}function Bh(W,M){return Array.prototype.concat(...W.map(V=>q1(V,M)))}class Vh{constructor(M,V){if(this.locale=M,this.format=V,this.tokens=Bh(oo.parseFormat(V),M),this.units=this.tokens.map(J=>_h(J,M)),this.disqualifyingUnit=this.units.find(J=>J.invalidReason),!this.disqualifyingUnit){const[J,ce]=sv(this.units);this.regex=RegExp(J,"i"),this.handlers=ce}}explainFromTokens(M){if(this.isValid){const[V,J]=lv(M,this.regex,this.handlers),[ce,Ce,Ne]=J?cv(J):[null,null,void 0];if(zt(J,"a")&&zt(J,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:M,tokens:this.tokens,regex:this.regex,rawMatches:V,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 bf(W,M,V){return new Vh(W,V).explainFromTokens(M)}function ni(W,M,V){const{result:J,zone:ce,specificOffset:Ce,invalidReason:Ne}=bf(W,M,V);return[J,ce,Ce,Ne]}function Hh(W,M){if(!W)return null;const V=oo.create(M,W).dtFormatter(H1()),J=V.formatToParts(),ce=V.resolvedOptions();return J.map(Ce=>Fl(Ce,W,ce))}const fa="Invalid DateTime",ka=864e13;function Ai(W){return new Un("unsupported zone",`the zone "${W.name}" is not supported`)}function Hu(W){return W.weekData===null&&(W.weekData=Et(W.c)),W.weekData}function Tc(W){return W.localWeekData===null&&(W.localWeekData=Et(W.c,W.loc.getMinDaysInFirstWeek(),W.loc.getStartOfWeek())),W.localWeekData}function Di(W,M){const V={ts:W.ts,zone:W.zone,c:W.c,o:W.o,loc:W.loc,invalid:W.invalid};return new En({...V,...M,old:V})}function xf(W,M,V){let J=W-M*60*1e3;const ce=V.offset(J);if(M===ce)return[J,M];J-=(ce-M)*60*1e3;const Ce=V.offset(J);return ce===Ce?[J,ce]:[W-Math.min(ce,Ce)*60*1e3,Math.max(ce,Ce)]}function $s(W,M){W+=M*60*1e3;const V=new Date(W);return{year:V.getUTCFullYear(),month:V.getUTCMonth()+1,day:V.getUTCDate(),hour:V.getUTCHours(),minute:V.getUTCMinutes(),second:V.getUTCSeconds(),millisecond:V.getUTCMilliseconds()}}function qu(W,M,V){return xf(Ja(W),M,V)}function Wu(W,M){const V=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,Vr(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"),Ve=Ja(Ce);let[Xe,jt]=xf(Ve,V,W.zone);return Ne!==0&&(Xe+=Ne,jt=W.zone.offset(Xe)),{ts:Xe,o:jt}}function ri(W,M,V,J,ce,Ce){const{setZone:Ne,zone:Ve}=V;if(W&&Object.keys(W).length!==0||M){const Xe=M||Ve,jt=En.fromObject(W,{...V,zone:Xe,specificOffset:Ce});return Ne?jt:jt.setZone(Ve)}else return En.invalid(new Un("unparsable",`the input "${ce}" can't be parsed as ${J}`))}function wf(W,M,V=!0){return W.isValid?oo.create(Oe.create("en-US"),{allowZ:V,forceSimple:!0}).formatDateTimeFromString(W,M):null}function ra(W,M,V){const J=W.c.year>9999||W.c.year<0;let ce="";if(J&&W.c.year>=0&&(ce+="+"),ce+=en(W.c.year,J?6:4),V==="year")return ce;if(M){if(ce+="-",ce+=en(W.c.month),V==="month")return ce;ce+="-"}else if(ce+=en(W.c.month),V==="month")return ce;return ce+=en(W.c.day),ce}function Sf(W,M,V,J,ce,Ce,Ne){let Ve=!V||W.c.millisecond!==0||W.c.second!==0,Xe="";switch(Ne){case"day":case"month":case"year":break;default:if(Xe+=en(W.c.hour),Ne==="hour")break;if(M){if(Xe+=":",Xe+=en(W.c.minute),Ne==="minute")break;Ve&&(Xe+=":",Xe+=en(W.c.second))}else{if(Xe+=en(W.c.minute),Ne==="minute")break;Ve&&(Xe+=en(W.c.second))}if(Ne==="second")break;Ve&&(!J||W.c.millisecond!==0)&&(Xe+=".",Xe+=en(W.c.millisecond,3))}return ce&&(W.isOffsetFixed&&W.offset===0&&!Ce?Xe+="Z":W.o<0?(Xe+="-",Xe+=en(Math.trunc(-W.o/60)),Xe+=":",Xe+=en(Math.trunc(-W.o%60))):(Xe+="+",Xe+=en(Math.trunc(W.o/60)),Xe+=":",Xe+=en(Math.trunc(W.o%60)))),Ce&&(Xe+="["+W.zone.ianaName+"]"),Xe}const Ni={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},uv={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Cf={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ii=["year","month","day","hour","minute","second","millisecond"],qh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Wh=["year","ordinal","hour","minute","second","millisecond"];function Rs(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 Rs(W)}}function kf(W){if(oi===void 0&&(oi=hn.now()),W.type!=="iana")return W.offset(oi);const M=W.name;let V=ai.get(M);return V===void 0&&(V=W.offset(oi),ai.set(M,V)),V}function Yu(W,M){const V=it(M.zone,hn.defaultZone);if(!V.isValid)return En.invalid(Ai(V));const J=Oe.fromObject(M);let ce,Ce;if(We(W.year))ce=hn.now();else{for(const Xe of Ii)We(W[Xe])&&(W[Xe]=Ni[Xe]);const Ne=Be(W)||gt(W);if(Ne)return En.invalid(Ne);const Ve=kf(V);[ce,Ce]=qu(W,Ve,V)}return new En({ts:ce,zone:V,loc:J,o:Ce})}function $a(W,M,V){const J=We(V.round)?!0:V.round,ce=We(V.rounding)?"trunc":V.rounding,Ce=(Ve,Xe)=>(Ve=ys(Ve,J||V.calendary?0:2,V.calendary?"round":ce),M.loc.clone(V).relFormatter(V).format(Ve,Xe)),Ne=Ve=>V.calendary?M.hasSame(W,Ve)?0:M.startOf(Ve).diff(W.startOf(Ve),Ve).get(Ve):M.diff(W,Ve).get(Ve);if(V.unit)return Ce(Ne(V.unit),V.unit);for(const Ve of V.units){const Xe=Ne(Ve);if(Math.abs(Xe)>=1)return Ce(Xe,Ve)}return Ce(W>M?-0:0,V.units[V.units.length-1])}function Ra(W){let M={},V;return W.length>0&&typeof W[W.length-1]=="object"?(M=W[W.length-1],V=Array.from(W).slice(0,W.length-1)):V=Array.from(W),[M,V]}let oi;const ai=new Map;class En{constructor(M){const V=M.zone||hn.defaultZone;let J=M.invalid||(Number.isNaN(M.ts)?new Un("invalid input"):null)||(V.isValid?null:Ai(V));this.ts=We(M.ts)?hn.now():M.ts;let ce=null,Ce=null;if(!J)if(M.old&&M.old.ts===this.ts&&M.old.zone.equals(V))[ce,Ce]=[M.old.c,M.old.o];else{const Ne=Nt(M.o)&&!M.old?M.o:V.offset(this.ts);ce=$s(this.ts,Ne),J=Number.isNaN(ce.year)?new Un("invalid input"):null,ce=J?null:ce,Ce=J?null:Ne}this._zone=V,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,V]=Ra(arguments),[J,ce,Ce,Ne,Ve,Xe,jt]=V;return Yu({year:J,month:ce,day:Ce,hour:Ne,minute:Ve,second:Xe,millisecond:jt},M)}static utc(){const[M,V]=Ra(arguments),[J,ce,Ce,Ne,Ve,Xe,jt]=V;return M.zone=Rt.utcInstance,Yu({year:J,month:ce,day:Ce,hour:Ne,minute:Ve,second:Xe,millisecond:jt},M)}static fromJSDate(M,V={}){const J=we(M)?M.valueOf():NaN;if(Number.isNaN(J))return En.invalid("invalid input");const ce=it(V.zone,hn.defaultZone);return ce.isValid?new En({ts:J,zone:ce,loc:Oe.fromObject(V)}):En.invalid(Ai(ce))}static fromMillis(M,V={}){if(Nt(M))return M<-ka||M>ka?En.invalid("Timestamp out of range"):new En({ts:M,zone:it(V.zone,hn.defaultZone),loc:Oe.fromObject(V)});throw new i(`fromMillis requires a numerical input, but received a ${typeof M} with value ${M}`)}static fromSeconds(M,V={}){if(Nt(M))return new En({ts:M*1e3,zone:it(V.zone,hn.defaultZone),loc:Oe.fromObject(V)});throw new i("fromSeconds requires a numerical input")}static fromObject(M,V={}){M=M||{};const J=it(V.zone,hn.defaultZone);if(!J.isValid)return En.invalid(Ai(J));const ce=Oe.fromObject(V),Ce=bc(M,_l),{minDaysInFirstWeek:Ne,startOfWeek:Ve}=Ht(Ce,ce),Xe=hn.now(),jt=We(V.specificOffset)?J.offset(Xe):V.specificOffset,Mn=!We(Ce.ordinal),Fn=!We(Ce.year),fr=!We(Ce.month)||!We(Ce.day),An=Fn||fr,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(fr&&Mn)throw new o("Can't mix ordinal dates with month/day");const Qo=Jr||Ce.weekday&&!An;let Da,Na,Ia=$s(Xe,jt);Qo?(Da=qh,Na=uv,Ia=Et(Ia,Ne,Ve)):Mn?(Da=Wh,Na=Cf,Ia=Xt(Ia)):(Da=Ii,Na=Ni);let Li=!1;for(const Ks of Da){const fv=Ce[Ks];We(fv)?Li?Ce[Ks]=Na[Ks]:Ce[Ks]=Ia[Ks]:Li=!0}const Yh=Qo?ge(Ce,Ne,Ve):Mn?ye(Ce):Be(Ce),$f=Yh||gt(Ce);if($f)return En.invalid($f);const Gu=Qo?It(Ce,Ne,Ve):Mn?Lt(Ce):Ce,[Rf,Ul]=qu(Gu,jt,J),po=new En({ts:Rf,zone:J,o:Ul,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,V={}){const[J,ce]=hf(M);return ri(J,ce,V,"ISO 8601",M)}static fromRFC2822(M,V={}){const[J,ce]=mf(M);return ri(J,ce,V,"RFC 2822",M)}static fromHTTP(M,V={}){const[J,ce]=gf(M);return ri(J,ce,V,"HTTP",V)}static fromFormat(M,V,J={}){if(We(M)||We(V))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}),[Ve,Xe,jt,Mn]=ni(Ne,M,V);return Mn?En.invalid(Mn):ri(Ve,Xe,J,`format ${V}`,M,jt)}static fromString(M,V,J={}){return En.fromFormat(M,V,J)}static fromSQL(M,V={}){const[J,ce]=Il(M);return ri(J,ce,V,"SQL",M)}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the DateTime is invalid");const J=M instanceof Un?M:new Un(M,V);if(hn.throwOnInvalid)throw new t(J);return new En({invalid:J})}static isDateTime(M){return M&&M.isLuxonDateTime||!1}static parseFormatForOpts(M,V={}){const J=Hh(M,Oe.fromObject(V));return J?J.map(ce=>ce?ce.val:null).join(""):null}static expandFormat(M,V={}){return Bh(oo.parseFormat(M),Oe.fromObject(V)).map(J=>J.val).join("")}static resetCache(){oi=void 0,ai.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,V=6e4,J=Ja(this.c),ce=this.zone.offset(J-M),Ce=this.zone.offset(J+M),Ne=this.zone.offset(J-ce*V),Ve=this.zone.offset(J-Ce*V);if(Ne===Ve)return[this];const Xe=J-Ne*V,jt=J-Ve*V,Mn=$s(Xe,Ne),Fn=$s(jt,Ve);return Mn.hour===Fn.hour&&Mn.minute===Fn.minute&&Mn.second===Fn.second&&Mn.millisecond===Fn.millisecond?[Di(this,{ts:Xe}),Di(this,{ts:jt})]:[this]}get isInLeapYear(){return ca(this.year)}get daysInMonth(){return Vr(this.year,this.month)}get daysInYear(){return this.isValid?dr(this.year):NaN}get weeksInWeekYear(){return this.isValid?vs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?vs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(M={}){const{locale:V,numberingSystem:J,calendar:ce}=oo.create(this.loc.clone(M),M).resolvedOptions(this);return{locale:V,numberingSystem:J,outputCalendar:ce}}toUTC(M=0,V={}){return this.setZone(Rt.instance(M),V)}toLocal(){return this.setZone(hn.defaultZone)}setZone(M,{keepLocalTime:V=!1,keepCalendarTime:J=!1}={}){if(M=it(M,hn.defaultZone),M.equals(this.zone))return this;if(M.isValid){let ce=this.ts;if(V||J){const Ce=M.offset(this.ts),Ne=this.toObject();[ce]=qu(Ne,Ce,M)}return Di(this,{ts:ce,zone:M})}else return En.invalid(Ai(M))}reconfigure({locale:M,numberingSystem:V,outputCalendar:J}={}){const ce=this.loc.clone({locale:M,numberingSystem:V,outputCalendar:J});return Di(this,{loc:ce})}setLocale(M){return this.reconfigure({locale:M})}set(M){if(!this.isValid)return this;const V=bc(M,_l),{minDaysInFirstWeek:J,startOfWeek:ce}=Ht(V,this.loc),Ce=!We(V.weekYear)||!We(V.weekNumber)||!We(V.weekday),Ne=!We(V.ordinal),Ve=!We(V.year),Xe=!We(V.month)||!We(V.day),jt=Ve||Xe,Mn=V.weekYear||V.weekNumber;if((jt||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=It({...Et(this.c,J,ce),...V},J,ce):We(V.ordinal)?(Fn={...this.toObject(),...V},We(V.day)&&(Fn.day=Math.min(Vr(Fn.year,Fn.month),Fn.day))):Fn=Lt({...Xt(this.c),...V});const[fr,An]=qu(Fn,this.o,this.zone);return Di(this,{ts:fr,o:An})}plus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M);return Di(this,Wu(this,V))}minus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M).negate();return Di(this,Wu(this,V))}startOf(M,{useLocaleWeeks:V=!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(V){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,V){return this.isValid?this.plus({[M]:1}).startOf(M,V).minus(1):this}toFormat(M,V={}){return this.isValid?oo.create(this.loc.redefaultToEN(V)).formatDateTimeFromString(this,M):fa}toLocaleString(M=m,V={}){return this.isValid?oo.create(this.loc.clone(V),M).formatDateTime(this):fa}toLocaleParts(M={}){return this.isValid?oo.create(this.loc.clone(M),M).formatDateTimeParts(this):[]}toISO({format:M="extended",suppressSeconds:V=!1,suppressMilliseconds:J=!1,includeOffset:ce=!0,extendedZone:Ce=!1,precision:Ne="milliseconds"}={}){if(!this.isValid)return null;Ne=Rs(Ne);const Ve=M==="extended";let Xe=ra(this,Ve,Ne);return Ii.indexOf(Ne)>=3&&(Xe+="T"),Xe+=Sf(this,Ve,V,J,ce,Ce,Ne),Xe}toISODate({format:M="extended",precision:V="day"}={}){return this.isValid?ra(this,M==="extended",Rs(V)):null}toISOWeekDate(){return wf(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:M=!1,suppressSeconds:V=!1,includeOffset:J=!0,includePrefix:ce=!1,extendedZone:Ce=!1,format:Ne="extended",precision:Ve="milliseconds"}={}){return this.isValid?(Ve=Rs(Ve),(ce&&Ii.indexOf(Ve)>=3?"T":"")+Sf(this,Ne==="extended",V,M,J,Ce,Ve)):null}toRFC2822(){return wf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return wf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ra(this,!0):null}toSQLTime({includeOffset:M=!0,includeZone:V=!1,includeOffsetSpace:J=!0}={}){let ce="HH:mm:ss.SSS";return(V||M)&&(J&&(ce+=" "),V?ce+="z":M&&(ce+="ZZ")),wf(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 V={...this.c};return M.includeConfig&&(V.outputCalendar=this.outputCalendar,V.numberingSystem=this.loc.numberingSystem,V.locale=this.loc.locale),V}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(M,V="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(V).map(Qt.normalizeUnit),Ne=M.valueOf()>this.valueOf(),Ve=Ne?this:M,Xe=Ne?M:this,jt=ti(Ve,Xe,Ce,ce);return Ne?jt.negate():jt}diffNow(M="milliseconds",V={}){return this.diff(En.now(),M,V)}until(M){return this.isValid?bn.fromDateTimes(this,M):this}hasSame(M,V,J){if(!this.isValid)return!1;const ce=M.valueOf(),Ce=this.setZone(M.zone,{keepLocalTime:!0});return Ce.startOf(V,J)<=ce&&ce<=Ce.endOf(V,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 V=M.base||En.fromObject({},{zone:this.zone}),J=M.padding?this<V?-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),$a(V,this.plus(J),{...M,numeric:"always",units:ce,unit:Ce})}toRelativeCalendar(M={}){return this.isValid?$a(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 Mt(M,V=>V.valueOf(),Math.min)}static max(...M){if(!M.every(En.isDateTime))throw new i("max requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.max)}static fromFormatExplain(M,V,J={}){const{locale:ce=null,numberingSystem:Ce=null}=J,Ne=Oe.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});return bf(Ne,M,V)}static fromStringExplain(M,V,J={}){return En.fromFormatExplain(M,V,J)}static buildFormatParser(M,V={}){const{locale:J=null,numberingSystem:ce=null}=V,Ce=Oe.fromOpts({locale:J,numberingSystem:ce,defaultToEN:!0});return new Vh(Ce,M)}static fromFormatParser(M,V,J={}){if(We(M)||We(V))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(V.locale))throw new i(`fromFormatParser called with a locale of ${Ne}, but the format parser was created for ${V.locale}`);const{result:Ve,zone:Xe,specificOffset:jt,invalidReason:Mn}=V.explainFromTokens(M);return Mn?En.invalid(Mn):ri(Ve,Xe,J,`format ${V.format}`,M,jt)}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 U}static get DATETIME_HUGE_WITH_SECONDS(){return I}}function ii(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 dv="3.7.2";return _a.DateTime=En,_a.Duration=Qt,_a.FixedOffsetZone=Rt,_a.IANAZone=ee,_a.Info=br,_a.Interval=bn,_a.InvalidZone=vt,_a.Settings=hn,_a.SystemZone=ae,_a.VERSION=dv,_a.Zone=H,_a}var SI;function a2(){return SI||(SI=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})(xI)),xI}var CI;function Mwe(){if(CI)return fg;CI=1,Object.defineProperty(fg,"__esModule",{value:!0}),fg.CronMonth=void 0;const e=a2(),t=tf(),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={},kI;function Owe(){if(kI)return pg;kI=1,Object.defineProperty(pg,"__esModule",{value:!0}),pg.CronSecond=void 0;const e=tf(),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 $I;function i2(){return $I||($I=1,(function(e){var t=fp&&fp.__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=fp&&fp.__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(tf(),e),n(Rwe(),e),n(Twe(),e),n(Mwe(),e),n(Owe(),e)})(fp)),fp}var RI;function l6(){if(RI)return ig;RI=1,Object.defineProperty(ig,"__esModule",{value:!0}),ig.CronFieldCollection=void 0;const e=i2();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 TI={},EI;function c6(){return EI||(EI=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=a2();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})(TI)),TI}var Ub={},MI;function Pwe(){if(MI)return Ub;MI=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 OI;function k$(){if(OI)return fi;OI=1,Object.defineProperty(fi,"__esModule",{value:!0}),fi.CronExpressionParser=fi.DayOfWeek=fi.Months=fi.CronUnit=fi.PredefinedExpressions=void 0;const e=l6(),t=c6(),n=Pwe(),r=i2();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||(fi.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||(fi.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||(fi.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||(fi.DayOfWeek=s={}));let l=class pi{static parse(u,m={}){const{strict:g=!1,hashSeed:y}=m,x=(0,n.seededRandom)(y);u=o[u]||u;const w=pi.#e(u,g);if(!(w.dayOfMonth==="*"||w.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const S=pi.#t(a.Second,w.second,r.CronSecond.constraints,x),b=pi.#t(a.Minute,w.minute,r.CronMinute.constraints,x),$=pi.#t(a.Hour,w.hour,r.CronHour.constraints,x),k=pi.#t(a.Month,w.month,r.CronMonth.constraints,x),T=pi.#t(a.DayOfMonth,w.dayOfMonth,r.CronDayOfMonth.constraints,x),{dayOfWeek:O,nthDayOfWeek:P}=pi.#d(w.dayOfWeek),D=pi.#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(pi.#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(pi.#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}`),pi.#l(u,y[0],parseInt(y[1],10),g)):pi.#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 fi.CronExpressionParser=l,fi}var js={};const jwe={},Awe=Object.freeze(Object.defineProperty({__proto__:null,default:jwe},Symbol.toStringTag,{value:"Module"})),PI=Tae(Awe);var jI;function Dwe(){if(jI)return js;jI=1;var e=js&&js.__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=js&&js.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=js&&js.__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(js,"__esModule",{value:!0}),js.CronFileParser=void 0;const r=k$();let o=class g0{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(PI)),l=await s(i,"utf8");return g0.#e(l)}static parseFileSync(i){const{readFileSync:s}=PI,l=s(i,"utf8");return g0.#e(l)}static#e(i){const s=i.split(`
|
|
481
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=g0.#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 js.CronFileParser=o,js}var AI;function Nwe(){return AI||(AI=1,(function(e){var t=dp&&dp.__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=dp&&dp.__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=k$();var o=a2();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=l6();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var i=c6();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return i.CronExpression}});var s=k$();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(i2(),e),e.default=r.CronExpressionParser})(dp)),dp}var Iwe=Nwe(),DI={exports:{}},NI;function Lwe(){return NI||(NI=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})())})(DI)),DI.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 Uwe(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 s2(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(!Uwe(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 u6(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(Ky,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return p.jsxs(p.Fragment,{children:[n&&r?p.jsx(Ur,{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(qn,{onClick:l,children:"Cancel"}),p.jsx(qn,{variant:"contained",loading:t,onClick:d,children:"Materialize"})]}),children:p.jsx(cX,{children:p.jsx(ER,{control:p.jsx(wz,{checked:i,onChange:m=>s(m.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function y0({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 ex(e){return e===ba.Pending||e===ba.ManifestRowsReady}function Vwe(e){return e===ba.ManifestFileReady||e===ba.Failed||e===ba.Cancelled}function Hwe(e){switch(e){case ba.ManifestFileReady:return"Done";case ba.Failed:return"Failed";case ba.Cancelled:return"Cancelled";case ba.Pending:case ba.ManifestRowsReady:return"Pending";default:return"Unknown"}}function qwe(e){switch(e){case ba.ManifestRowsReady:return"info";case ba.ManifestFileReady:return"success";case ba.Failed:return"error";case ba.Cancelled:return"warning";case ba.Pending:default:return"default"}}function d6(e){return e.status===ba.ManifestFileReady&&z1(e).autoLoad==="failed"}function f6(e){return d6(e)?"Built, not served":Hwe(e.status)}function $$(e){return d6(e)?"warning":qwe(e.status)}function Wwe(e){const t=Object.values(z1(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 p6(e,t){const n=[`${e.sourcesBuilt??0} built`,`${e.sourcesReused??0} reused`];return e.sourcesRefused&&n.push(`${e.sourcesRefused} refused`),n.join(t)}function z1(e){return e.metadata??{}}function h6(e){return e.trigger==="scheduler"||e.trigger==="SCHEDULER"}function Ywe(e){return h6(e)?"Scheduled":"Manual"}function m6(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 R$(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 Gwe(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 Kwe({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(y0,{children:"Build manifest"}),t&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["Built ",R$(t)]})]}),n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):p.jsxs(_x,{size:"small",children:[p.jsx(Vx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"Source"}),p.jsx(ur,{children:"Table name"}),p.jsx(ur,{children:"Connection"}),p.jsx(ur,{children:"Realization"}),p.jsx(ur,{align:"right",children:"Rows"})]})}),p.jsx(Bx,{children:n.map(([r,o])=>p.jsxs(vu,{children:[p.jsx(ur,{sx:{fontFamily:Fo},children:o.sourceName??r}),p.jsx(ur,{sx:{fontFamily:Fo},children:o.physicalTableName??"-"}),p.jsx(ur,{sx:{fontFamily:Fo},children:o.connectionName??"-"}),p.jsx(ur,{children:o.realization??"-"}),p.jsx(ur,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function g6({meta:e}){const t=h6(e);return p.jsx(Ur,{title:t?"Fired by the materialization schedule":"Triggered manually",children:p.jsx(wt,{variant:"body2",color:"text.secondary",children:Ywe(e)})})}function Qwe({materialization:e,buildPlan:t,onClose:n}){const r=e?z1(e):{},o=e?Wwe(e):[],a=t.status==="ready"?Object.values(t.plan?.sources??{}):[];return p.jsx(Lx,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&p.jsxs(p.Fragment,{children:[p.jsxs(Fx,{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(RR,{size:"small",label:f6(e),color:$$(e),variant:ex(e.status)?"filled":"outlined"}),p.jsx(g6,{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(zx,{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:R$(e.startedAt??e.createdAt)}),p.jsx(hg,{label:"Completed",value:R$(e.completedAt)}),p.jsx(hg,{label:"Duration",value:m6(e.startedAt,e.completedAt)}),p.jsx(hg,{label:"Sources",value:p6(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(y0,{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(y0,{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(y0,{children:"Build plan"}),t.status==="loading"?p.jsx(Uo,{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(_x,{size:"small",children:[p.jsx(Vx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"Source"}),p.jsx(ur,{children:"Connection"}),p.jsx(ur,{children:"Dialect"}),p.jsx(ur,{align:"right",children:"Columns"}),p.jsx(ur,{children:"Source Entity ID"})]})}),p.jsx(Bx,{children:a.map(i=>p.jsxs(vu,{children:[p.jsx(ur,{sx:{fontFamily:Fo},children:i.name}),p.jsx(ur,{sx:{fontFamily:Fo},children:i.connectionName}),p.jsx(ur,{children:i.dialect??"-"}),p.jsx(ur,{align:"right",children:i.columns?.length??0}),p.jsx(ur,{sx:{fontFamily:Fo,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:i.sourceEntityId})]},i.sourceID))})]})]}),p.jsx(Kwe,{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 Xwe=un(p.jsx("path",{d:"M6 6h12v12H6z"}));function Zwe({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),i=()=>a(!0),s=()=>{a(!1),t()};return p.jsxs(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(r2,{sx:{color:"inherit"},children:p.jsx(Xx,{fontSize:"small"})}),p.jsx(o2,{children:"Delete"})]}),p.jsx(Oo,{open:o,onClose:s,title:"Delete materialization",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 run"})]}),children:p.jsx(Ar,{variant:"body2",children:"Delete this run's record? This cannot be undone. The tables it built stay in place: drop any you no longer need through their connection."})})]})}function Jwe({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(_x,{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(Vx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"Status"}),p.jsx(ur,{children:"Trigger"}),p.jsx(ur,{children:"Started"}),p.jsx(ur,{children:"Duration"}),p.jsx(ur,{children:"Sources"}),p.jsx(ur,{align:"right",children:"Actions"})]})}),p.jsx(Bx,{children:e.map(i=>p.jsx(eSe,{materialization:i,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},i.id))})]})}function eSe({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[i,s]=C.useState(null),l=!!i,d=()=>s(null),u=z1(e),m=u.sourcesBuilt!==void 0||u.sourcesReused!==void 0?p6(u,", "):"-",g=ex(e.status),y=Vwe(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(ur,{children:p.jsxs(Te,{sx:{display:"flex",alignItems:"center",gap:.5},children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:500,color:$$(e)==="default"?"text.primary":`${$$(e)}.main`},children:f6(e)}),x&&p.jsx(Ur,{title:x,children:p.jsx(v_,{fontSize:"small",color:"error"})})]})}),p.jsx(ur,{children:p.jsx(g6,{meta:u})}),p.jsx(ur,{children:Gwe(e.startedAt??e.createdAt)}),p.jsx(ur,{children:m6(e.startedAt,e.completedAt)}),p.jsx(ur,{children:m}),p.jsx(ur,{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(Zx,{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(Xwe,{fontSize:"small"})}),p.jsx(wi,{children:"Stop"})]}),t&&y&&p.jsx(Zwe,{materialization:e,isMutating:n,onCloseDialog:d,onDelete:()=>o(e)})]})]})})]})}const tSe=un(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"})),nSe={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function rSe({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(Qy,{label:"Scope",icon:p.jsx(tSe,{}),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(uF,{fontSize:"small"})}),p.jsx(wi,{primary:l,secondary:nSe[l]})]},l))})]})}const oSe=un([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")]),II="0 6 * * *";function aSe({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,i]=C.useState(!1),[s,l]=C.useState(e??II),d=()=>{l(e??II),i(!0)},u=()=>i(!1),m=s2(s),g=async y=>{try{await o(y),i(!1)}catch{}};return p.jsxs(p.Fragment,{children:[p.jsx(Qy,{label:"Schedule",icon:p.jsx(oSe,{}),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(qn,{color:"error",loading:t,onClick:()=>g(null),sx:{mr:"auto"},children:"Clear schedule"}),p.jsx(qn,{onClick:u,children:"Cancel"}),p.jsx(qn,{variant:"contained",loading:t,disabled:!m.valid,onClick:()=>g(s.trim()),children:"Save schedule"})]}),children:[p.jsx($i,{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 ${u6(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 iSe=3e3;function sSe({resourceUri:e,versioned:t=!1}){const{apiClients:n,mutable:r}=Jn(),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=>ex(Y.status))?iSe:!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,bre.Stop,s)),onSuccess(){d("Materialization stopped"),w()},onError(H){d(H.message)}}),$=hl({mutationFn:rc("materialization","delete",H=>n.materializations.deleteMaterialization(a,i,H.id,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:Sb.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=>ex(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===Sb.Version?"version":"package",z=!!k?.manifestLocation,N=!!k?.materialization?.freshness,U=_?s2(_):null,I=z?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[U?U.valid?`${U.description} (${_}), next run ${u6(U.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(Ds,{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(rSe,{scope:R,disabled:!!_,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:O.isPending,onChange:H=>O.mutateAsync(H==="version"?Sb.Version:Sb.Package)}),!z&&!t&&p.jsx(aSe,{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(Pa,{error:g.error,context:`${a} > ${i} > Materializations`}),!g.isSuccess&&!g.isError&&p.jsx(Uo,{text:"Loading materializations..."}),g.isSuccess&&p.jsx(Jwe,{materializations:P,mutable:r,isMutating:F,onStop:H=>b.mutate(H),onDelete:H=>$.mutate(H),onViewDetails:H=>m(H.id??null)})]}),p.jsx(Qwe,{materialization:D,buildPlan:L,onClose:()=>m(null)}),p.jsx(hh,{open:l!=="",autoHideDuration:6e3,onClose:()=>d(""),message:l})]})}const l2=un(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 y6(e).join(`
|
|
@@ -490,7 +490,7 @@ ${t}`}function Mce(e){return e?.status===403}function Xp(e){return`\`${e.replace
|
|
|
490
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&&ISe.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 zSe(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*\`?${nf(t)}\`?\\s+is\\s+`).exec(e);i&&a(M$(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]?M$(e.slice(l.index+l[0].length)):l[1]);return{sources:r,unresolved:o}}function M$(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 $y={"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},k6=C.createContext(void 0);function p2({layer:e,title:t,children:n,testId:r}){const o=C.useContext(k6);if(!o||!e||!o.layers.includes(e))return p.jsx(Ur,{title:t,children:p.jsx(Te,{component:"span",tabIndex:0,role:"img","aria-label":t,"data-testid":r,sx:{display:"inline-flex",borderRadius:1,...$y},children:n})});const a=o.openLayer===e;return p.jsx(Ur,{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)"},...$y},children:n})})}function FSe(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 _Se={authorize:[],accessFilter:[]};function zI(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[]}function USe(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=zI(o.authorize),i=zI(o.accessFilter);a.length===0&&i.length===0||t.set(o.name,{authorize:a,accessFilter:i})}return t}function v0(e,t){return t&&e?.get(t)||_Se}function mc(e){return!!e&&e.authorize.some(t=>t.trim()!=="true")}function Mu(e){return!!e&&e.accessFilter.length>0}const FI=/^\(?\s*(?:'([^']*)'|"([^"]*)")\s+in\s+\$GROUPS\s*\)?$/;function BSe(e){const t=e.trim();if(t==="false")return"no one";const n=FI.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=>FI.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 $6(e){const t=e.authorize.filter(n=>n.trim()!=="true").map(n=>BSe(n)??"readers its access rule admits");return Array.from(new Set(t)).join(", and ")}const R6="Only some readers can query this source",T6="Each reader sees only the rows they're allowed to see";function VSe(e,t){return e?mc(t)?`You can't access ${e}. It is restricted to ${$6(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 HSe(e,t){if(!(!Mu(e)||t===void 0))return FSe(t)===0?"Filtered to your rows: this source shows each reader only the rows they're allowed to see.":void 0}function E6(e){return mc(e)||Mu(e)}function qSe(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 WSe({access:e}){return p.jsxs(p.Fragment,{children:[mc(e)&&p.jsx(_I,{label:"Restricted",meaning:R6}),Mu(e)&&p.jsx(_I,{label:"Row filtered",meaning:T6})]})}function _I({label:e,meaning:t}){return p.jsx(p2,{layer:"access",title:`${e}: ${t}`,testId:`source-access-chip-${e==="Restricted"?"restricted":"row-filtered"}`,children:p.jsx(us,{tone:"neutral",size:"header",children:e})})}function M6({access:e}){return p.jsxs(p.Fragment,{children:[mc(e)&&p.jsx(Ur,{title:`Restricted: ${R6}`,children:p.jsx(us,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Restricted"})}),Mu(e)&&p.jsx(Ur,{title:`Row filtered: ${T6}`,children:p.jsx(us,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Row filtered"})})]})}function YSe(e){return[mc(e)&&"restricted",Mu(e)&&"row filtered"].filter(Boolean).map(t=>`, ${t}`).join("")}function GSe({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:$6(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 UI="Private",KSe="index.malloy doesn't export this file, so only people who can edit the package see it.";function BI(){return p.jsx(p2,{title:`${UI}: ${KSe}`,testId:"model-viewer-off-surface",children:p.jsx(us,{tone:"warning",size:"header",children:UI})})}const VI="Public",QSe="index.malloy exports this source, so everyone who can read the package can query it.";function XSe(){return p.jsx(p2,{title:`${VI}: ${QSe}`,testId:"model-viewer-public-surface",children:p.jsx(us,{tone:"positive",size:"header",children:VI})})}function ZSe(e){const t=C.useRef(e);return e!==void 0&&(t.current=e),t.current}function MC({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=ZSe(k),O=C.useId(),P={openLayer:k,layers:S,toggle:L=>$(_=>_===L?void 0:L),cardId:O},D=w||y||x||!!s,A=qr().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:E$,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:ns,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(BI,{})}),g&&D&&p.jsx(k6.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(WSe,{access:u}),y&&p.jsx(BI,{}),x&&p.jsx(XSe,{}),s]})}),d&&p.jsx(HI,{doc:d,label:"model description",testId:"model-viewer-model-doc"},`model:${d}`),o&&p.jsx(HI,{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:Qa.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:{...$h,p:ky,mb:2},children:T==="access"&&u&&p.jsx(GSe,{access:u,showRules:m})})})]})}const JSe=2;function HI({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:Qa.body,lineHeight:1.5,color:"text.secondary",whiteSpace:"pre-line",...r?{}:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:JSe,overflow:"hidden"}},children:O6(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:Qa.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 O6(e){return e.split(/(`[^`\n]+`)/g).map((t,n)=>/^`[^`]+`$/.test(t)?p.jsx(Te,{component:"code",sx:{fontFamily:ns,fontSize:"0.92em",color:"text.primary"},children:t.slice(1,-1)},n):t)}function U1(e){const t=e?.response?.status;return typeof t=="number"?t:void 0}function eCe(e){const t=U1(e);return t===403||t===404}function tCe(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 h2=C.createContext([]),tx="text.primary",mg=e=>({main:e,tint:`color-mix(in srgb, ${e} 12%, transparent)`,onTint:e}),Rp={steel:mg(pr.cyan),sage:mg(pr.lime),brown:mg(pr.slate),olive:mg(pr.violet),amber:mg(pr.amber)};function qI(e){return e==="measure"?Rp.sage:e==="calculate"?Rp.amber:e==="view"?Rp.olive:Rp.steel}const WI=["steel","brown","olive","sage"];function nCe(e){return WI[e%WI.length]}const P6={small:13,caption:12},rCe={fontFamily:ns,fontSize:P6.small,fontWeight:500,color:tx},j6={fontSize:P6.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:Qa.bodyLarge,fontWeight:T$.strong,color:tx},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:T$.strong,color:tx},children:e}),o&&p.jsx(Te,{sx:{...j6,mt:.25,display:"flex",alignItems:"center"},children:o})]}),a]})}function Kg(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e.at(-1)}`}function YI(e,t){return`${e.label??e.name}: ${t0e(e,t)}`}const Vb=e=>e.label??e.name;function A6(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(Vb).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 ${Kg(O.map(Vb),"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=>YI(T)).join(", ")}`:"",x=[];g.length>0&&x.push(`Ran without a value for ${g.length===1?"the given":"the givens"} ${Kg(g.map(Vb),"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=>YI(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 ${Kg($.map(Vb),"or")}. Where it does, it ran with ${k}.`)}return x.length>0?{kind:"noted",note:x.join(" ")}:{kind:"ok"}}const oCe=400;function aCe({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 ${Kg(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=s_(r,oCe),b=C.useMemo(()=>({values:S,declaredTypes:u}),[S,u]),{options:$,isLoading:k,failed:T,truncated:O,search:P}=_F(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(P1,{layout:"bar",givens:m,values:r,onChange:o,onReset:a,options:$,optionsLoading:k,optionsFailed:T,optionsTruncated:O,optionSearch:P,onControlOpen:w})}),g&&p.jsx(qd,{"data-testid":"model-givens-unknown",sx:{mt:1},children:g}),n&&n.size>0&&p.jsx(qd,{"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 iCe="A source is a queryable entry point into the model — pick one to browse its dimensions, measures, views and joins.";function sCe(e,t=!1){return e===0?"No sources":`${e} ${t?"public ":""}source${e===1?"":"s"}`}const lCe=un(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"})),cCe=un(p.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),uCe=un(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),dCe=un([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")]),D6=un(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"})),fCe=un(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=un(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"})),hCe=un(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),mCe=un(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"})),gCe=un(p.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),yCe=un(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"})),N6=un(p.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"})),vCe=un(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"})),bCe=un(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"})),I6=un(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"})),xCe=un([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")]),L6=un(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"})),wCe=un(p.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),z6=un(p.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),SCe=un(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 CCe=Ao(lCe,"IconText"),GI=Ao(cCe,"IconOpen"),F6=Ao(uCe,"IconResult"),kCe=Ao(dCe,"IconCalculation"),$Ce=Ao(D6,"IconDate"),RCe=Ao(fCe,"IconJoin"),TCe=Ao(pCe,"IconCode"),ECe=Ao(hCe,"IconList"),MCe=Ao(mCe,"IconRecord"),OCe=Ao(gCe,"IconCollapse"),PCe=Ao(dF,"IconExpand"),jCe=Ao(yCe,"IconFields"),ACe=Ao(N6,"IconDropdown"),DCe=Ao(vCe,"IconLock"),_6=Ao(bCe,"IconNumber"),NCe=Ao(I6,"IconTimestamp"),ICe=Ao(xCe,"IconValues"),LCe=Ao(L6,"IconBoolean"),zCe=Ao(wCe,"IconGivens"),U6=Ao(z6,"IconColumn");Ao(SCe,"IconWarning");const Ry=C.createContext(void 0);function m2(){const[e,t]=C.useState(!1),n=C.useContext(Ry),[r,o]=C.useState(n?.n);return n&&n.n!==r&&(o(n.n),t(n.open)),[e,t]}function FCe({allOpen:e,onToggle:t,noun:n,disabledReason:r}){const o=e?p.jsx(OCe,{size:16,"aria-hidden":!0}):p.jsx(PCe,{size:16,"aria-hidden":!0});return p.jsx(Ur,{title:r??"",children:p.jsx("span",{children:p.jsxs(os,{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"},...$y,"&.Mui-disabled":{opacity:.5}},children:[o,e?"Collapse all":"Expand all"]})})})}function nx({noun:e,disabledReason:t}){const[n,r]=C.useState(void 0),o=n?.open??!1;return{command:n,action:p.jsx(FCe,{allOpen:o,onToggle:()=>r({open:!o,n:(n?.n??0)+1}),noun:e,disabledReason:t})}}let OC;function _Ce(e,t){if(OC?.text===t)return OC.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 OC={text:t,parsed:r},r}function B1(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 B6,Hb;function UCe(){return Hb??=wo(()=>import("./index-
|
|
493
|
+
`)}let B6,Hb;function UCe(){return Hb??=wo(()=>import("./index-CPSEdm5f.js").then(e=>e.i),__vite__mapDeps([0,1])).then(e=>{const t="Malloy"in e?e:e.default;return B6=t,t}),Hb.catch(()=>{Hb=void 0}),Hb}function V6(e,t=!0){const[n,r]=C.useState(B6),[o,a]=C.useState(!1),i=!!e&&t;return C.useEffect(()=>{if(!i||n)return;let s=!0;return UCe().then(l=>s&&r(l),()=>s&&a(!0)),()=>{s=!1}},[i,n]),{parsed:C.useMemo(()=>i&&n&&e?_Ce(n,e):void 0,[i,n,e]),pending:i&&!n&&!o}}function BCe(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: ${B1(e.lines,n[0].range).trimEnd()}`}function H6(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
495
|
`).trim()}function VCe(e,t){const n=H6(t),r=nf(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(`
|
|
@@ -498,7 +498,7 @@ ${t}`}function Mce(e){return e?.status===403}function Xp(e){return`\`${e.replace
|
|
|
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 KI(r,o).join(`
|
|
499
499
|
`);const i=nf(e);return new RegExp(`^\\s*${i}\\s+is\\b`).test(a)?(r[o]=a.replace(/^(\s*)/,"$1view: "),KI(r,o).join(`
|
|
500
500
|
`)):n}function KI(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 g2(e){return e.kind==="dimension"&&e.indexed===!0}function y2(e){return!!e&&(e.loading||!!e.code||!!e.inheritedFrom||!!e.error)}function qCe(e,t){const n=[],r=[];for(const o of e){const a=t(o);(a&&!a.loading&&(a.code||a.error)||g2(o)?n:r).push(o)}return r.length===0||n.length===0?e:[...n,...r]}function WCe(e,t){return t.includes(`
|
|
501
|
-
`)||e.scrollWidth>e.clientWidth}const YCe={dimension:U6,measure:_6,calculate:kCe,view:F6,join:RCe};function GCe(e){switch(e){case"dimension":case"measure":case"calculate":case"view":return qI(e).main;case"column":return qI("dimension").main;case"join":return Rp.brown.main}}function KCe(e){const t=e?.trim().toLowerCase()??"";if(t){if(t.startsWith("array"))return ECe;if(t.startsWith("record")||/\bfields?\b/.test(t))return MCe;switch(t.split(/[\s·<]/)[0]){case"string":return CCe;case"number":return _6;case"date":return $Ce;case"timestamp":case"timestamptz":return NCe;case"boolean":return LCe;default:return}}}const QCe=16;function v2({kind:e,dataType:t}){const n=e==="dimension"||e==="measure"||e==="calculate"||e==="column"?KCe(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:GCe(e)},children:C.createElement(n??YCe[e==="column"?"dimension":e],{size:QCe})})}function b2(e,t){return(t?e.givensBySource?.get(t):void 0)??e.givens}function q6(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 XCe({run:e,modelPath:t,query:n,enabled:r}){const{server:o,apiClients:a}=Jn(),i=zd({...Y6({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 W6(e,t,n,r){return["model-viewer-run",e,t.projectName,t.packageName,n,t.versionId??"",r,f2(t.givenValues),...t.includeHiddenFilesAndSources?["off-surface"]:[]]}function Y6({server:e,apiClients:t,run:n,modelPath:r,query:o}){const a=f2(n.givenValues)===""?void 0:n.givenValues;return{queryKey:W6(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 PC=12,ZCe=5*6e4;function JCe(e){const t=U1(e);return t===void 0?!1:t>=400&&t<500&&t!==401&&t!==408&&t!==429}function eke(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 tke({run:e,modelPath:t,sourceName:n,field:r,fetchSamples:o,generation:a}){const{server:i,apiClients:s}=Jn(),l=r?.kind==="dimension"&&r.indexed===!0,d=b2(e,n),u=l&&!o?A6(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({...Y6({server:i,apiClients:s,run:q6(e,d),modelPath:t,query:jce(n,g??"",PC)}),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:ZCe,retry:!1,refetchOnWindowFocus:!1,queryFn:async({signal:b})=>{try{const $=await o({modelPath:t,sourceName:n,fieldName:g,limit:PC,signal:b}),k=Array.isArray($)?{values:$}:$;return{...k,values:k.values.slice(0,PC)}}catch($){if(JCe($))return{values:[]};throw $}}}),w=o?x:y,S=o?x.data:y.data&&{values:eke(y.data.data.result)};return{samples:S?.values??[],total:S?.total,unavailable:m??S?.unavailable,loading:!!g&&w.isPending,failed:w.isError}}function nke({children:e}){return p.jsx(Te,{component:"span",sx:{fontFamily:ns,fontSize:Qa.caption,color:"text.primary",bgcolor:xo.background.muted,border:"1px solid",borderColor:"divider",borderRadius:1,padding:"2px 8px"},children:e})}function rke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a}){const{samples:i,total:s,unavailable:l,loading:d,failed:u}=tke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a});return p.jsxs(Te,{"data-testid":"model-viewer-values",sx:{fontSize:Qa.small},children:[p.jsx(Te,{component:"div",sx:{color:F1,fontSize:Qa.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(nke,{children:m},m))})]})}const jC={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"}]}}},oke={...jC,patterns:[...jC.patterns,{include:"#docvar"}],repository:{...jC.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},ake={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"}]}}},ike="github-light",ske="github-dark";let AC;function lke(){return AC||(AC=(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"],...oke},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...ake}]})})()),AC}async function x2(e,t,n="light"){return(await lke()).codeToHtml(e,{lang:t,theme:n==="dark"?ske:ike})}function Ty({code:e,testId:t,framed:n=!0}){const{mode:r}=qr(),[o,a]=C.useState(void 0);return C.useEffect(()=>{let i=!0;return x2(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:ns,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 V1({message:e,onRetry:t,severity:n="error"}){return p.jsx(lo,{severity:n,action:t&&p.jsx(qn,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:e})}function G6(e){const t=e?.response?.data?.message;return typeof t=="string"&&t?t:void 0}function K6(e,t){const n=G6(t);return n?`${e}: ${n}`:`${e}.`}function cke(e){const t=U1(e);return!(t===400||t===401||t===403||t===404||t===422)}function uke({query:e,error:t,onRetry:n,testId:r,forbiddenMessage:o}){const a=o!==void 0&&U1(t)===403;return p.jsxs(Te,{"data-testid":r,sx:{display:"flex",flexDirection:"column",gap:1},children:[e&&p.jsx(Ty,{code:e,testId:"query-failure-code"}),p.jsx(V1,{message:a?o:K6("Query failed",t),onRetry:n&&cke(t)?n:void 0})]})}const QI=C.forwardRef(function(e,t){return p.jsx(qn,{ref:t,variant:"contained",size:"small",disableElevation:!0,...e,sx:{textTransform:"none",...e.sx}})}),dke=C.forwardRef(function(e,t){return p.jsx(qn,{ref:t,variant:"outlined",size:"small",color:"inherit",...e,sx:{textTransform:"none",borderRadius:999,borderColor:"divider",color:"text.secondary",...e.sx}})}),jg=10,fke="clamp(340px, 40%, 520px)";function pke({field:e,run:t,modelPath:n,sourceName:r,fieldCode:o,joined:a=!1}){const[i,s]=m2(),{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,$=y2(o),k=C.useContext(h2),T=C.useMemo(()=>Wd(o?.code,k),[o?.code,k]),O=g2(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:{...$h,"& > * + *":{borderTop:1,borderColor:"divider"}},children:[D("code")&&(o?.loading?p.jsx(Te,{sx:{p:ky,display:"flex"},children:p.jsx(ku,{size:12,sx:{color:"text.secondary"}})}):o?.code?p.jsx(Ty,{testId:"model-viewer-definition",code:VCe(e.name,o.code),framed:!1}):o?.inheritedFrom?p.jsx(Ty,{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"}
|
|
501
|
+
`)||e.scrollWidth>e.clientWidth}const YCe={dimension:U6,measure:_6,calculate:kCe,view:F6,join:RCe};function GCe(e){switch(e){case"dimension":case"measure":case"calculate":case"view":return qI(e).main;case"column":return qI("dimension").main;case"join":return Rp.brown.main}}function KCe(e){const t=e?.trim().toLowerCase()??"";if(t){if(t.startsWith("array"))return ECe;if(t.startsWith("record")||/\bfields?\b/.test(t))return MCe;switch(t.split(/[\s·<]/)[0]){case"string":return CCe;case"number":return _6;case"date":return $Ce;case"timestamp":case"timestamptz":return NCe;case"boolean":return LCe;default:return}}}const QCe=16;function v2({kind:e,dataType:t}){const n=e==="dimension"||e==="measure"||e==="calculate"||e==="column"?KCe(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:GCe(e)},children:C.createElement(n??YCe[e==="column"?"dimension":e],{size:QCe})})}function b2(e,t){return(t?e.givensBySource?.get(t):void 0)??e.givens}function q6(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 XCe({run:e,modelPath:t,query:n,enabled:r}){const{server:o,apiClients:a}=Jn(),i=zd({...Y6({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 W6(e,t,n,r){return["model-viewer-run",e,t.projectName,t.packageName,n,t.versionId??"",r,f2(t.givenValues),...t.includeHiddenFilesAndSources?["off-surface"]:[]]}function Y6({server:e,apiClients:t,run:n,modelPath:r,query:o}){const a=f2(n.givenValues)===""?void 0:n.givenValues;return{queryKey:W6(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,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 PC=12,ZCe=5*6e4;function JCe(e){const t=U1(e);return t===void 0?!1:t>=400&&t<500&&t!==401&&t!==408&&t!==429}function eke(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 tke({run:e,modelPath:t,sourceName:n,field:r,fetchSamples:o,generation:a}){const{server:i,apiClients:s}=Jn(),l=r?.kind==="dimension"&&r.indexed===!0,d=b2(e,n),u=l&&!o?A6(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({...Y6({server:i,apiClients:s,run:q6(e,d),modelPath:t,query:jce(n,g??"",PC)}),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:ZCe,retry:!1,refetchOnWindowFocus:!1,queryFn:async({signal:b})=>{try{const $=await o({modelPath:t,sourceName:n,fieldName:g,limit:PC,signal:b}),k=Array.isArray($)?{values:$}:$;return{...k,values:k.values.slice(0,PC)}}catch($){if(JCe($))return{values:[]};throw $}}}),w=o?x:y,S=o?x.data:y.data&&{values:eke(y.data.data.result)};return{samples:S?.values??[],total:S?.total,unavailable:m??S?.unavailable,loading:!!g&&w.isPending,failed:w.isError}}function nke({children:e}){return p.jsx(Te,{component:"span",sx:{fontFamily:ns,fontSize:Qa.caption,color:"text.primary",bgcolor:xo.background.muted,border:"1px solid",borderColor:"divider",borderRadius:1,padding:"2px 8px"},children:e})}function rke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a}){const{samples:i,total:s,unavailable:l,loading:d,failed:u}=tke({run:e,fetchSamples:t,modelPath:n,sourceName:r,field:o,generation:a});return p.jsxs(Te,{"data-testid":"model-viewer-values",sx:{fontSize:Qa.small},children:[p.jsx(Te,{component:"div",sx:{color:F1,fontSize:Qa.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(nke,{children:m},m))})]})}const jC={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"}]}}},oke={...jC,patterns:[...jC.patterns,{include:"#docvar"}],repository:{...jC.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},ake={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"}]}}},ike="github-light",ske="github-dark";let AC;function lke(){return AC||(AC=(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"],...oke},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...ake}]})})()),AC}async function x2(e,t,n="light"){return(await lke()).codeToHtml(e,{lang:t,theme:n==="dark"?ske:ike})}function Ty({code:e,testId:t,framed:n=!0}){const{mode:r}=qr(),[o,a]=C.useState(void 0);return C.useEffect(()=>{let i=!0;return x2(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:ns,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 V1({message:e,onRetry:t,severity:n="error"}){return p.jsx(lo,{severity:n,action:t&&p.jsx(qn,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:e})}function G6(e){const t=e?.response?.data?.message;return typeof t=="string"&&t?t:void 0}function K6(e,t){const n=G6(t);return n?`${e}: ${n}`:`${e}.`}function cke(e){const t=U1(e);return!(t===400||t===401||t===403||t===404||t===422)}function uke({query:e,error:t,onRetry:n,testId:r,forbiddenMessage:o}){const a=o!==void 0&&U1(t)===403;return p.jsxs(Te,{"data-testid":r,sx:{display:"flex",flexDirection:"column",gap:1},children:[e&&p.jsx(Ty,{code:e,testId:"query-failure-code"}),p.jsx(V1,{message:a?o:K6("Query failed",t),onRetry:n&&cke(t)?n:void 0})]})}const QI=C.forwardRef(function(e,t){return p.jsx(qn,{ref:t,variant:"contained",size:"small",disableElevation:!0,...e,sx:{textTransform:"none",...e.sx}})}),dke=C.forwardRef(function(e,t){return p.jsx(qn,{ref:t,variant:"outlined",size:"small",color:"inherit",...e,sx:{textTransform:"none",borderRadius:999,borderColor:"divider",color:"text.secondary",...e.sx}})}),jg=10,fke="clamp(340px, 40%, 520px)";function pke({field:e,run:t,modelPath:n,sourceName:r,fieldCode:o,joined:a=!1}){const[i,s]=m2(),{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,$=y2(o),k=C.useContext(h2),T=C.useMemo(()=>Wd(o?.code,k),[o?.code,k]),O=g2(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:{...$h,"& > * + *":{borderTop:1,borderColor:"divider"}},children:[D("code")&&(o?.loading?p.jsx(Te,{sx:{p:ky,display:"flex"},children:p.jsx(ku,{size:12,sx:{color:"text.secondary"}})}):o?.code?p.jsx(Ty,{testId:"model-viewer-definition",code:VCe(e.name,o.code),framed:!1}):o?.inheritedFrom?p.jsx(Ty,{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
502
|
${o.inheritedFrom.code}`,framed:!1}):p.jsx(Te,{sx:{p:1},children:p.jsx(V1,{message:"Couldn't load this model's code right now."})})),D("values")&&t&&p.jsx(Te,{sx:{p:ky},children:p.jsx(rke,{run:t,fetchSamples:l,generation:d,modelPath:n,sourceName:r,field:e})}),D("givens")&&p.jsx(d2,{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(w2,{glyph:p.jsx(v2,{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(w6,{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:`${jg}px`,mt:"2px",display:"flex",flexDirection:"column",gap:1.5},children:L})})]})}function w2({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:fke},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:`${jg}px`,py:"6px",borderRadius:1.5,...$y,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:{...rCe,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&(r?p.jsx(Ur,{title:a?p.jsx(Te,{sx:{whiteSpace:"pre-line"},children:a}):"",children:p.jsx(us,{voice:"token",tone:"quiet",sx:{alignSelf:"center"},children:n})}):p.jsx(Te,{component:"span",sx:j6,children:n})),i]}),!o&&s]}),o?p.jsxs(Te,{id:w,sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",px:`${jg}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&&WCe(b,u)?u:""},sx:{flex:1,minWidth:0,ml:1,pr:`${jg}px`,py:g?"6px":0,fontSize:Qa.small,color:F1,...g?{whiteSpace:"pre-line"}:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},children:[m&&p.jsx(us,{voice:"state",tone:"quiet","data-testid":"model-viewer-field-doc-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),g?u:u.split(`
|
|
503
503
|
`)[0]]}),d&&p.jsx(Te,{sx:{ml:"auto",flexShrink:0,pl:1,pr:`${jg}px`,display:"inline-flex",alignItems:"center",height:32},children:d})]})}const hke=480;function mke({run:e,modelPath:t,query:n,sourceName:r,givens:o,givensUnknown:a,mode:i="result",renderCode:s,onShownChange:l}){const d=f2(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(()=>A6(o??b2(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}=XCe({run:e,modelPath:t,query:n,enabled:u===d&&b.kind!=="blocked"});u!==null&&u!==d&&$!==void 0&&m(d);const D=v0(e.accessBySource,r),A=VSe(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(()=>HSe(D,z),[D,z]),U=R?.givensKey??"";C.useEffect(()=>{if(l){if(z===void 0)return l(void 0);l({result:z,givensKey:U})}},[l,z,U]);const I=i==="result"&&b.kind!=="blocked";return C.useEffect(()=>{I&&KT()},[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(qd,{"data-testid":"model-viewer-run-blocked",children:b.reason}),b.canRunAnyway&&p.jsx(QI,{size:"small",onClick:()=>{w(d),m(d)},children:"Run anyway"})]}):T&&!g?p.jsx(uke,{query:n,error:O,onRetry:()=>void P(),forbiddenMessage:A}):k&&!$&&!g?p.jsx(Gg,{message:"The query returned no result."}):p.jsxs(Te,{"data-testid":"model-viewer-result-card",sx:{...$h,p:ky,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(qd,{children:"The given values changed since this ran."}),p.jsx(QI,{size:"small",onClick:F,"aria-label":"Run with these values",children:"Run"})]}),b.kind==="noted"&&z&&!g&&p.jsx(Cy,{"data-testid":"model-viewer-run-defaults",component:"div",sx:{mb:1},children:b.note}),!(g&&!z)&&(z===void 0?p.jsx(Uo,{text:wu.running}):p.jsx(j1,{result:z,maxHeight:hke,maxResultSize:e.maxResultSize})),N&&p.jsx(Cy,{"data-testid":"model-viewer-run-filtered",component:"div",sx:{mt:1},children:N})]})})}function gke(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 yke({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(Ur,{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:gke(a),children:o.icon})})},o.value)})})}const vke=["result","givens","fields","code","values","access"],bke={result:{icon:p.jsx(F6,{size:14}),label:"Result"},fields:{icon:p.jsx(jCe,{size:14}),label:"Fields"},code:{icon:p.jsx(TCe,{size:14}),label:"Code"},values:{icon:p.jsx(ICe,{size:14}),label:"Values"},givens:{icon:p.jsx(zCe,{size:14}),label:"Givens"},access:{icon:p.jsx(DCe,{size:14}),label:"Access"}};function Q6(e,t){const n=vke.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 X6({layers:e,value:t,onChange:n,"aria-label":r,disabledReasons:o}){return e.length<2||t===void 0?null:p.jsx(yke,{"aria-label":r,value:t,onChange:n,options:e.map(a=>{const i=o?.[a];return{value:a,...bke[a],...i?{disabled:!0,disabledReason:i}:{}}})})}function Z6({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&&b2(o,n)),u=C.useMemo(()=>o&&q6(o,d),[o,d]),m=a?"query":"view",[g,y]=m2(),[x,w]=C.useState(void 0),S=y2(r),b=C.useContext(h2),{renderRunActions:$}=_1(),{server:k}=Jn(),T=C.useMemo(()=>Wd(r?.code,b),[r?.code,b]),{chartNames:O,tagsInFull:P}=C.useMemo(()=>{const z=e.tags??[],N=cSe(z),U=N.length>0?N:z;return{chartNames:U,tagsInFull:z.join(" ")===U.join(" ")?void 0:z.map(I=>`# ${I}`).join(`
|
|
504
504
|
`)}},[e.tags]),D=["result","code",...T.length>0?["givens"]:[]],{layers:A,layer:F,setLayer:L}=Q6(D,o?"result":"code"),_=F??"code",R=()=>_==="givens"?p.jsx(d2,{givens:T}):r?.loading?p.jsx(ku,{size:12,sx:{color:"text.secondary"}}):r?.code?p.jsx(Ty,{testId:"model-viewer-definition",code:a?r.code:HCe(e.name,r.code)}):r?.error?p.jsx(V1,{message:"Couldn't load this model's code right now."}):p.jsx(Gg,{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(w2,{glyph:p.jsx(v2,{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(X6,{"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:W6(k,u,t,l),shown:x})]}),descriptors:p.jsxs(p.Fragment,{children:[O.map(z=>{const N=p.jsx(us,{voice:"token",tone:"quiet",sx:{alignSelf:"center"},children:z},z);return P?p.jsx(Ur,{title:P,slotProps:{tooltip:{sx:{whiteSpace:"pre-line",fontFamily:ns}}},children:N},z):N}),p.jsx(w6,{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(mke,{run:u,modelPath:t,query:l,sourceName:n||void 0,givens:i,givensUnknown:s,mode:_==="result"?"result":"code",renderCode:R,onShownChange:w}):R()})})})]})}function xke({queries:e,sourceText:t,modelPath:n,run:r}){const{parsed:o,pending:a}=V6(t,e.length>0),i=C.useMemo(()=>e.map(l=>{const d=BCe(o,l.name),u=l.sourceName||!r?.givens||a?void 0:ASe(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=nx({noun:["query","queries"]});return p.jsx(sh,{label:"Queries",count:e.length,testId:"model-viewer-queries",action:s.action,children:p.jsx(Ry.Provider,{value:s.command,children:i.map(({query:l,field:d,code:u,runGivens:m,runGivensUnknown:g})=>p.jsx(Z6,{field:d,modelPath:n,sourceName:l.sourceName??"",fieldCode:u,run:r,runQuery:Pce(l.name),runGivens:m,runGivensUnknown:g},l.name))})})}function J6(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 XI=200;function Qg({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($=>g2($)&&s!=="h3"||y2(i?.($))),{command:y,action:x}=nx({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?qCe(d,i):d,[d,i]),b=u||S.length<=XI?S:S.slice(0,XI);return p.jsx(sh,{label:e,count:d.length,level:s,action:w,children:p.jsx(Ry.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(qn,{size:"small",onClick:()=>m(!0),sx:{alignSelf:"flex-start",textTransform:"none"},children:["Show all ",S.length.toLocaleString()," ",t[1]]})]})})})}function wke(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(S2(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 Cke(e.lines,i))n.has(s)||n.set(s,l);a=Pke(B1(e.lines,i.range))}return n}const ZI=/^\s*(view|measure|dimension)\s*:\s*$/,Ske=/^`?([A-Za-z_]\w*)`?\s+is\b/;function Cke(e,t){const n=new Map;let r,o=t.range.start;for(const i of t.children){const s=B1(e,{start:o,end:i.range.start});r=Eke(s)??r,o=i.range.end;const l=kke(i,r);if(!l)continue;const d=$ke(e,i,l);if(!d)continue;const u=S2(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 kke(e,t){if(e.type==="query")return t==="view"?"view":void 0;if(e.type==="field"&&(t==="dimension"||t==="measure"))return t}function $ke(e,t,n){const r=B1(e,t.range).split(`
|
|
@@ -507,6 +507,6 @@ ${o.inheritedFrom.code}`,framed:!1}):p.jsx(Te,{sx:{p:1},children:p.jsx(V1,{messa
|
|
|
507
507
|
`)}}function Rke(e,t){const n=(e[t.line]??"").slice(0,t.character),r=n.trim()==="";if(!r&&!ZI.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&&ZI.test(e[a.next])?[...o(a.next-1).out,...a.out]:a.out}const Tke=/(?<![\w:])([A-Za-z_]\w*)\s*:(?!:)/g;function Eke(e){let t;for(const n of Mke(e).matchAll(Tke))t=n[1];return t}function Mke(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=Oke(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
508
|
`,n),a=o===-1?e.length:o;t+=" ".repeat(a-n),n=a-1}else t+=r}return t}function Oke(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 Pke(e){return/^`?[A-Za-z_]\w*`?\s+is\s+`?([A-Za-z_]\w*)`?\s*(?:extend\b|$)/.exec(e)?.[1]}function S2(e){return e.replace(/^`(.*)`$/,"$1")}const jke=["fields","code"],JI={display:"inline-flex",alignItems:"center",color:"text.secondary",borderRadius:1,padding:"2px",flexShrink:0,"&:hover":{color:tx}};function Ake({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]=m2(),{layers:y,layer:x,setLayer:w}=Q6(jke),S=C.useMemo(()=>a?J6({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(X6,{"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(O0,{href:o.href,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:JI,children:p.jsx(GI,{size:14})}),o?.kind==="link"&&!o.href&&o.onOpen&&p.jsx(O0,{component:"button",type:"button",onClick:o.onOpen,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:JI,children:p.jsx(GI,{size:14})}),o?.kind==="join-only"&&p.jsx(Te,{component:"span",sx:{fontSize:Qa.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(w2,{glyph:p.jsx(v2,{kind:"join"}),name:e.name,typeLabel:`${b} ${b===1?"field":"fields"}`,stackPills:!0,descriptors:p.jsxs(us,{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(M6,{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(Ty,{testId:"model-viewer-join-code",code:l}):p.jsxs(Te,{"data-testid":"model-viewer-join-fields",sx:{...$h,bgcolor:"transparent",p:1.5,pb:0},children:[d&&u&&p.jsx(Cy,{component:"div","data-testid":"model-viewer-join-gate-warning",sx:{mb:1},children:qSe(d.sourceName,d.access)}),p.jsx(Qg,{label:"Measures",noun:["measure","measures"],level:"h3",items:e.measures,run:t,modelPath:n,sourceName:r,getFieldCode:S}),p.jsx(Qg,{label:"Dimensions",noun:["dimension","dimensions"],level:"h3",items:e.dimensions,run:t,modelPath:n,sourceName:r,getFieldCode:S})]})})})]})}function Dke({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]),$=nx({noun:["view","views"]}),k=nx({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}=V6(a,T),D=C.useMemo(()=>wke(O,e.name),[O,e.name]),A=C.useMemo(()=>J6({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(Ry.Provider,{value:$.command,children:b.map(F=>p.jsx(Z6,{field:F,modelPath:t,sourceName:e.name,fieldCode:A(F),run:g},F.name))})}),y,p.jsx(Qg,{label:"Measures",noun:["measure","measures"],items:e.measures,getFieldCode:A,...w}),p.jsx(Qg,{label:"Calculations",noun:["calculation","calculations"],items:e.calculations,getFieldCode:A,...w}),p.jsx(Qg,{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(Ry.Provider,{value:k.command,children:e.joins.map(F=>p.jsx(Ake,{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 O$(e){return{name:e.name,kind:e.kind,dataType:u2(e.type),typeTip:fSe(e.type),tags:pSe(e.annotations),doc:ih(e.annotations),indexed:e.kind==="dimension"?ESe(e):void 0,preaggregate:e.kind==="measure"?dSe(e.annotations):void 0}}function Nke(e){const t=[],n=[];for(const r of e.schema?.fields??[]){if(r.kind!=="dimension"&&r.kind!=="measure")continue;const o={...O$(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 Ike(e,t){const n={name:e.name,doc:ih(e.annotations),docParts:y6(e.annotations),accent:nCe(t),persist:uSe(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(O$(r));break;case"calculate":n.calculations.push(O$(r));break;case"view":n.views.push({name:r.name,kind:"view",doc:ih(r.annotations),tags:c2(r.annotations)});break;case"join":n.joins.push(Nke(r));break}return n}function Lke(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:c2(r)})}return t}function eU(e){return e.dimensions.length+e.measures.length+e.calculations.length+e.views.length}function zke(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 Fke(e,t,n){if(!e||!t)return;const r=new RegExp("source:\\s*`?"+nf(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 DC(e,t){return`${e} ${e===1?t:`${t}s`}`}function _ke(e){const t=eU(e),n=[DC(e.views.length,"view"),DC(t,"field")];return e.joins.length>0&&n.push(DC(e.joins.length,"join")),n.join(" · ")}function Uke(e,t,n){if(n){const s=n.exportOrder,l=s.length>0&&e.some(d=>s.includes(d.name));return{sources:Hke(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 Bke(e){return/^`.*`$/.test(e)?e.slice(1,-1):e}function Vke(e){if(!e)return[];const t=av(e),n=[];for(const r of t.matchAll(/(?:^|[\s;])export\s*\{([^}]*)\}/gi))for(const o of r[1].split(",")){const a=Bke(o.trim());a&&!n.includes(a)&&n.push(a)}return n}function Hke(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 qke(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 Wke="This package's curated sources, in the order its index.malloy exports them.",Yke="This package's public sources.";function Gke(e){return e.mostViews?", most views":""}function Kke({anchorEl:e,onClose:t,sources:n,currentName:r,onPickSource:o,curated:a=!1,exportOrdered:i=!1}){return p.jsxs(AR,{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(Cy,{component:"p",sx:{m:0},children:a?i?Wke:Yke:iCe})]}),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(os,{"data-item-name":s.name,"aria-label":`Open source ${s.name}${Gke(s)}${YSe(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},...$y},children:[p.jsx(Te,{component:"span","aria-hidden":!0,sx:{color:Rp.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:ns,fontSize:Qa.body,fontWeight:500,color:"text.primary"},children:s.name}),s.mostViews&&p.jsx(us,{tone:"quiet",sx:{alignSelf:"center"},children:Qke}),E6(s.access)&&p.jsx(M6,{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:Qa.small,color:"text.secondary",minHeight:s.description?void 0:"1.4em"},children:[s.description?.generated&&p.jsx(us,{tone:"quiet","data-testid":"model-sources-summary-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),s.description&&O6(s.description.text)]}),p.jsx(Cy,{"data-testid":"model-sources-row-meta",sx:{display:"block",mt:.25},children:s.meta})]})]},`source:${s.name}`)})})]})}const Qke="Most views";function Xke({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(dke,{size:"small",variant:"outlined",onClick:d=>{i?.(),l(d.currentTarget)},endIcon:p.jsx(ACe,{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(Kke,{anchorEl:s,onClose:()=>l(null),sources:e,currentName:t,onPickSource:r,curated:o,exportOrdered:a})]})}const Zke=[],Jke=[],e$e=[],t$e=new Map;function n$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 r$e(e,t){if(typeof e=="string")try{const r=LI(JSON.parse(e).annotations);if(r)return r}catch{}if(!t)return;const n=t.split(`
|
|
509
509
|
`).filter(r=>/^##(\(doc\)|")/.test(r.trim())).map(r=>({value:r}));return LI(n)}async function o$e(e,t,n,r,o,a){const i=await e.models.getModel(t,n,r,o,a),s=a$e(i.data);return{sourceInfos:(i.data.sourceInfos??[]).map(l=>JSON.parse(l)),queries:i.data.queries??[],sourceText:s,givens:xSe(r,i.data),access:USe(i.data),modelDoc:r$e(i.data.modelInfo,s),hasImports:n$e(i.data)}}function a$e(e){const t=e.sourceText;return typeof t=="string"?t:void 0}function i$e(e,t,n,r,o=!1){return["model-viewer-sources",e,t,n,r??"",...o?["off-surface"]:[]]}function s$e(e,t,n,r,o,a=!1){return{queryKey:i$e(t,n,r,o,a),queryFn:()=>o$e(e,t,n,r,o,a),...o&&o!=="latest"?{staleTime:1/0}:{}}}function l$e(e,t,n,r,o=!0,a=!1){const{apiClients:i}=Jn(),s=zd({...s$e(i,e,t,n,r,a),enabled:o&&!!(e&&t&&n)});return{sources:s.data?.sourceInfos??Zke,queries:s.data?.queries??Jke,sourceText:s.data?.sourceText,givens:s.data?.givens??e$e,access:s.data?.access??t$e,modelDoc:s.data?.modelDoc,hasImports:s.data?.hasImports??!1,isLoading:s.isLoading,isError:s.isError,error:s.error,refetch:s.refetch}}const c$e=new Map;function eL(e){return(e.split("/").pop()??e).replace(/\.malloy$/,"")}function u$e(e,t){const n=jSe(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. ${Kg(r.map(a=>a.name),"and")} ${r.length===1?"comes":"come"} from a file this one imports; the rest are declared here. ${o}`}function d$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=qr().theme.ui.font.mono,{sources:L,queries:_,sourceText:R,givens:z,access:N,modelDoc:U,hasImports:I,isLoading:H,isError:Y,error:ae,refetch:K}=l$e(O,P,D,A,!0,o),oe=C.useMemo(()=>new Set(a??[]),[a]),ue=C.useMemo(()=>z.filter(Ut=>!oe.has(Ut.name)),[z,oe]),G=C.useMemo(()=>L.map(Ike),[L]),ie=C.useMemo(()=>Lke(_),[_]),X=C.useMemo(()=>OSe(G),[G]),ee=C.useMemo(()=>MSe(L),[L]),Z=C.useMemo(()=>wSe(ue),[ue]),de=JSON.stringify(i??null),le=C.useMemo(()=>i&&Object.fromEntries(Object.entries(i).filter(([Ut])=>Z.has(Ut))),[de,Z]),fe=!H&&!Y,he=C.useCallback(Ut=>s?.(Ut,Array.from(Z.keys())),[s,Z]),me=LF({declaredTypes:Z,params:le,onParamsChange:fe&&s?he:void 0,documentKey:`${O}/${P}@${A??""}/${D}`,autorun:!0}),se=C.useMemo(()=>SSe(me.applied,Z),[me.applied,Z]),{givensBySource:ve,unknownGivensBySource:Le}=C.useMemo(()=>{const Ut=new Map,fn=new Map;for(const $n of G){const Vt=DSe(R,$n.name,ue);Ut.set($n.name,Vt.givens),Vt.unknown.size>0&&fn.set($n.name,Vt.unknown)}return{givensBySource:Ut,unknownGivensBySource:fn}},[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,Ke=C.useCallback(Ut=>{_e||re(Ut),n?.(Ut)},[_e,n]),Je=C.useMemo(()=>zke(G,D),[G,D]),St=G.find(Ut=>Ut.name===Me)??(_e?void 0:Je),Bt=C.useMemo(()=>St?ve.get(St.name)??ue:ue,[St,ve,ue]),at=C.useMemo(()=>St?NSe(R,St.name,ue,X):new Map,[St,R,ue,X]),tt=C.useMemo(()=>Fke(R,St?.name,X),[R,St?.name,X]),pt=C.useMemo(()=>St?lSe(St,G.find(Ut=>Ut.name===tt)):void 0,[St,G,tt]),ze=C.useMemo(()=>g?PSe(g):c$e,[g]),be=St?ze.get(St.name):void 0,{joinLinks:qe,joinEntities:Oe,joinCodes:$t,joinAccessRules:Rt}=C.useMemo(()=>{const Ut=new Map,fn=new Map,$n=new Map,Vt=new Map,Pn=new Map([[D,new Set(X)]]);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&&fn.set(Se.name,Rn);const Jt=v0(N,jn.sourceName);E6(Jt)&&Vt.set(Se.name,{sourceName:jn.sourceName,access:Jt});const Pt=tCe(jn,Pn);Ut.set(Se.name,Pt.kind==="link"?{...Pt,onOpen:()=>Ke(jn.sourceName)}:Pt)}else{const Rn=S?.(jn);Rn&&Ut.set(Se.name,{kind:"link",href:Rn})}}return{joinLinks:Ut,joinEntities:fn,joinCodes:$n,joinAccessRules:Vt}},[be,ze,D,X,N,Ke,S]),vt=D==="index.malloy"&&!o,it=C.useMemo(()=>Uke(G,Je,vt?{exportOrder:Vke(R)}:void 0),[G,Je,vt,R]),st=T?.describePickerSource,Dt=C.useMemo(()=>it.sources.map(Ut=>{const fn=st?.({modelPath:D,sourceName:Ut.name});return{name:Ut.name,description:qke(Ut.doc,fn?.summary),descriptionPending:!Ut.doc?.trim()&&!fn?.summary&&!!fn?.summaryPending,meta:_ke(Ut),mostViews:it.mostViews===Ut.name,access:v0(N,Ut.name),status:fn?.status}}),[it,N,st,D]),nn=(()=>{if(H)return p.jsx(Uo,{text:"Fetching Model..."});if(Y)return eCe(ae)?p.jsx(Te,{sx:{pt:E$},children:p.jsx(Gg,{message:G6(ae)??`${P}/${D} doesn't exist, or you don't have access to it.`})}):p.jsx(V1,{message:K6("Failed to load model",ae),onRetry:()=>void K()});const Ut=ie.length>0&&p.jsx(xke,{queries:ie,sourceText:R,modelPath:D,run:Ae});if(G.length===0)return ie.length===0?p.jsxs(p.Fragment,{children:[p.jsx(MC,{headingLevel:d,title:eL(D),meta:ue.length>0?`${ue.length} ${ue.length===1?"given":"givens"}`:void 0,actions:u,isSource:!1,offSurface:o}),p.jsx(Gg,{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(qd,{"data-testid":"model-viewer-declared-givens-where",sx:{mb:1},children:u$e(R,ue)}),p.jsx(d2,{givens:ue})]})]}):p.jsxs(p.Fragment,{children:[p.jsx(MC,{headingLevel:d,title:eL(D),meta:`${ie.length} ${ie.length===1?"query":"queries"}`,actions:u,isSource:!1,offSurface:o}),Ut]});if(!St)return p.jsx(Te,{sx:{pt:E$},children:p.jsx(Gg,{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(O0,{component:"button",type:"button",onClick:()=>Ke(Se.name),sx:{fontFamily:ns,verticalAlign:"baseline"},children:Se.name})]},Se.name))]})})});const fn=eU(St),$n=tt?void 0:[...be?.values()??[]].find(Se=>Se.table)?.table,Vt=tt?p.jsxs(p.Fragment,{children:["from ",p.jsx(O0,{component:"button",type:"button",onClick:()=>Ke(tt),sx:{fontFamily:ns,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:ns},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(MC,{headingLevel:d,title:St.name,titleAdornments:G.length>1&&p.jsx(Xke,{sources:Dt,currentName:St.name,countLabel:sCe(Dt.length,it.curated),onPickSource:Ke,curated:it.curated,exportOrdered:it.exportOrdered}),actions:u,status:m?.(St.name),kindLabel:"Source",meta:`${fn} ${fn===1?"field":"fields"}`,doc:pt,modelDoc:U,access:v0(N,St.name),showRules:l,offSurface:o,publicSurface:vt,provenance:Vt}),Pn&&p.jsx(Te,{"data-testid":"model-viewer-source-detail",sx:{mt:1.5},children:Pn}),p.jsx(h2.Provider,{value:ue,children:p.jsx(Dke,{source:St,modelPath:D,entitiesByName:be,entitiesLoading:y,entitiesError:x,columnDescriptions:w?.get(St.name),modelText:R,joinLinks:qe,joinAccess:Rt,showRules:l,joinEntities:Oe,joinCodes:$t,run:Ae,queries:Ut,givens:p.jsx(aCe,{givens:Bt,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(S6.Provider,{value:T??{},children:p.jsx(Te,{"data-testid":"model-viewer",sx:{...gSe,pb:2,[b6]:F},children:p.jsx(Te,{sx:ySe,children:nn})})})}const f$e=un(p.jsx("path",{d:"M8 5v14l11-7z"}));function tU({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(j1,{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]=Cn.useState(),[s,l]=Cn.useState(!1),[d,u]=Cn.useState(!1),{packageName:m,environmentName:g,versionId:y,modelPath:x}=Xr(n),w=!r||d,S=n2({environmentName:g,packageName:m,modelPath:x,versionId:y,queryName:e},{enabled:w}),b=S.data,{mode:$}=qr();return C.useEffect(()=>{if(t&&t.length>0){const k=t.map(T=>`// ${T}`).join(`
|
|
510
|
-
`);x2(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(Lp,{"aria-label":"Expand results",onClick:()=>l(!0),children:p.jsx(Gp,{})})]}),p.jsxs(v4,{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(qn,{variant:"contained",startIcon:p.jsx(f$e,{}),onClick:()=>u(!0),children:"Run Query"})]}),w&&p.jsx(QT,{state:S,context:e,maxHeight:Nle,maxResultSize:o})]}),p.jsx(tU,{open:s,onClose:()=>l(!1),result:b?.data?.result||"",renderLogs:b?.data?.renderLogs,title:`Query: ${e}`})]})}function h$e(e){return e!=null}function m$e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||h$e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=O1(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 g$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 y$e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return Cn.useEffect(()=>{o&&o(t)},[t,o]),p.jsx(y4,{children:p.jsxs(S9,{spacing:2,component:"section",children:[p.jsx(b$e,{sourceAndPath:e[t],existingQuery:n,onChange:l=>{r&&r(l)},resourceUri:a,givens:i,gate:s}),p.jsx(h5,{height:"5px"})]})})}function NC(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function v$e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[l,d]=Cn.useState(n||NC()),[u,m]=Cn.useState(void 0);Cn.useEffect(()=>{n&&d(n)},[n]);const[g,y]=Cn.useState([]),{MalloyExplorerProvider:x,QueryPanel:w,ResizableCollapsiblePanel:S,ResultPanel:b,SourcePanel:$}=r;Cn.useEffect(()=>{t&&t(l)},[t,l]);const{environmentName:k,packageName:T,versionId:O}=Xr(a),{apiClients:P}=Jn(),D=Cn.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(U=>U?{...U,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}],U=D.current?.missing??[];(R?.status===403||/Access denied for source/i.test(z))&&U.length>0&&N.push({severity:"WARN",title:g$e(U)}),m(I=>I?{...I,executionState:"finished",response:{messages:N}}:void 0)}}),[F,L]=Cn.useState(e.sourceInfo.name);Cn.useEffect(()=>{F!==e.sourceInfo.name&&(L(e.sourceInfo.name),d(NC()),m(void 0))},[e,F]);const _=Cn.useCallback(R=>{d({...l,malloyQuery:R,malloyResult:void 0})},[l]);return F!==e.sourceInfo.name?p.jsx("div",{children:"Loading..."}):p.jsx(b4,{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(NC())})}),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 b$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-DyYEltlF.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(qne,{children:p.jsx(b4,{children:p.jsx(h5,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):p.jsx(v$e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function nU(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=Xr(e),{apiClients:i}=Jn();return co({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function rU({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:l}){const[d,u]=Cn.useState(r);Cn.useEffect(()=>{u(r)},[r]);const{data:m,isError:g,isLoading:y,error:x}=nU(a,!e),{environmentName:w,packageName:S,modelPath:b,versionId:$}=Xr(a),k=e||m,T=Cn.useMemo(()=>k?.givens??[],[k]),O=vT({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(()=>Zd(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),D=C.useMemo(()=>m$e(T,O.applied),[T,O.applied]);if(y&&!e)return p.jsx(Uo,{text:"Fetching Model..."});if(g&&!e)return console.log("error",x),p.jsx(Pa,{error:x,context:`ModelExplorer > ${b}`});if(!k)return p.jsx(Uo,{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(Vne,{variant:"outlined",children:[p.jsx(Hne,{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(P1,{...O.panel}),p.jsx(y4,{children:p.jsxs(Yn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&p.jsx(y$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 oU({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(Lx,{open:e,onClose:t,fullScreen:!0,children:[p.jsxs(Fx,{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(zx,{children:a?p.jsx(rU,{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 x$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}=nU(t),[m,g]=Cn.useState(!1),[y,x]=Cn.useState(),[w,S]=Cn.useState(0),[b,$]=C.useState(""),[k,T]=Cn.useState({}),O=o??k,P=a??(R=>T(R)),D=s?.modelDef,A=Cn.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(Uo,{text:"Fetching Model..."});if(l)return console.log("error",u),p.jsx(Pa,{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(Ur,{title:"Copy link",children:p.jsx(ro,{size:"small","aria-label":"Copy link",onClick:_,sx:{color:"text.secondary"},children:p.jsx(l2,{fontSize:"small"})})})]}),p.jsx(rU,{data:s,onChange:F,onSourceChange:L,existingQuery:y,initialSelectedSourceIndex:w,resourceUri:t,givens:O,onGivensChange:P}),p.jsx(Lp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:p.jsx(Gp,{})})]}),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(oU,{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 w$e(){const[e,t]=C.useState("");return p.jsxs(p.Fragment,{children:[p.jsx(Ur,{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(l2,{fontSize:"small"})})}),p.jsx(hh,{open:e!=="",autoHideDuration:6e3,onClose:()=>t(""),message:e})]})}function D2e(e){const{modelPage:t,isLoadingStatus:n}=Jn();if(n)return p.jsx(Uo,{text:"Fetching Model..."});if(t!=="viewer")return p.jsx(x$e,{...e});const{onChange:r,runOnDemand:o,headerActions:a,...i}=e;return p.jsx(d$e,{...i,headerActions:a??p.jsx(w$e,{})})}const S$e={"persist-source-refused":"persist-not-built","preaggregate-not-built":"rollup-not-built","preaggregate-join-one-key-repeated":"rollup-join-one-key-repeated","stored-native-schema-missing":"database-native-type-missing"};function C$e(e){const t=(r,o)=>`${r}\0${o.subject??""}\0${o.message??""}`,n=new Set(e.map(r=>t(r.code,r)));return e.filter(r=>{const o=r.code!==void 0?S$e[r.code]:void 0;return o===void 0||!n.has(t(o,r))})}function k$e({warnings:e}){const[t,n]=C.useState(!1),r=C$e(e??[]),o=r.filter(i=>i.severity==="error"),a=r.filter(i=>i.severity!=="error");return o.length===0&&a.length===0?null:p.jsxs(Yn,{sx:{gap:1,mb:4},children:[o.length>0&&p.jsxs(lo,{severity:"warning",children:[p.jsx(yY,{children:o.length===1?"1 problem in this package":`${o.length} problems in this package`}),p.jsx(tL,{findings:o})]}),a.length>0&&p.jsxs(Te,{children:[p.jsxs(qn,{size:"small","aria-expanded":t,onClick:()=>n(i=>!i),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",a.length," ",a.length===1?"note":"notes"]}),t&&p.jsx(Te,{sx:{pl:.5,pt:.5},children:p.jsx(tL,{findings:a})})]})]})}function tL({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}=Jn(),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((U,I)=>{const H=o?.(U,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(Pa,{context:`${w} > ${S} > ${t}`,error:P});if(!T||!k)return p.jsx(Uo,{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(Z_,{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(SF.Provider,{value:A,children:N})}function R$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?D_(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,U]=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:X,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(()=>X.get(D)??[],[X,D]),me=C.useMemo(()=>new Map([...X.entries()].flatMap(([st,Dt])=>Dt.map(nn=>[IC(st,nn.source,nn.view),{model:st,source:nn.source,view:nn.view}]))),[X]),se=C.useMemo(()=>{const st=X.size>1;return[...X.entries()].flatMap(([Dt,nn])=>{const Ut=new Map;for(const fn of nn)Ut.set(fn.source,[...Ut.get(fn.source)??[],fn]);return[...Ut.entries()].map(([fn,$n])=>({key:`${Dt}::${fn}`,label:fn,ariaLabel:`${fn} in ${Dt}`,...st||$n[0]?.sourceDescription?{detail:[st?Dt:void 0,$n[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:$n.map(Vt=>({key:IC(Dt,Vt.source,Vt.view),name:Vt.view,title:Vt.description??vC(Vt.view),...Vt.chart?{chart:Vt.chart}:{}}))}))})},[X]),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?IC(D,Le.source,Le.view):void 0,Re=T$e(Le,250);C.useEffect(()=>{e&&T(b)},[e,b]),C.useEffect(()=>{if(!e)return;const st=[...X.keys()];D===""&&st.length>0&&A(st[0])},[e,X,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||U(vC(Le.view))},[e,I,Le]),C.useEffect(()=>{e||(A(""),L(""),R(""),U(""),H(!1),P(void 0),ae(!1),G(void 0))},[e]);const re=C.useMemo(()=>{if(N.trim()!=="")for(let st=1;st<=t2;st++){const Dt=O_(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`,Ke=Me??re,Je=Me===void 0?void 0:P_(Me)??(g.existing?.includes(Me)?`${Me} already exists; choose another location.`:void 0),St=(Le===void 0?void 0:JT({title:N,modelPath:D,source:Le.source,view:Le.view}))??(N.trim()!==""&&Ke===void 0?"No free file name for this title; choose another.":void 0),Bt=St!==void 0&&(Y||N.trim()!==""),at=d||ee,{theme:tt}=qr(),pt=tt.ui,ze=Xd(tt.cardBorder),be=X.size===0&&(ie||de.length>0),qe=at?"Loading the model":be?"Couldn't read the model to start from":X.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(!(qe!==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(qn,{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(qn,{onClick:x,disabled:K,children:"Cancel"}),p.jsx(Ur,{title:K?"":qe??"",children:p.jsx("span",{children:p.jsx(qn,{variant:"contained",disabled:K||qe!==void 0,"aria-label":!K&&qe!==void 0?`${$t}: ${qe}`:$t,onClick:()=>void vt(),children:$t})})})]}),children:p.jsxs(Yn,{sx:{gap:1.5},children:[ie?p.jsx(lo,{severity:"error",action:m&&N4(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&&X.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(nL,{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(O$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(nL,{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(z_,{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:E$e,declaredTypes:M$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($i,{size:"small",label:"Title",value:N,disabled:K,onChange:st=>{H(!0),U(st.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Bt,helperText:Bt?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($i,{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??(Ke?`Written as ${Ke} 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 T$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 IC=(e,t,n)=>`${e}::${t}::${n}`,E$e=new Map,M$e=new Map;function nL({children:e}){const t=qr().theme.ui;return p.jsx(wt,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function O$e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=qr(),a=o.ui,i=Xd(o.cardBorder),s=t?o.accent:"currentColor";return p.jsxs(os,{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 P$e=un(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"})),j$e=un(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),A$e=un(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"})),D$e=un(p.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),aU={dashboard:pr.blue,report:pr.violet,model:pr.cyan,dataApp:pr.pink,data:pr.lime,materialization:pr.amber,agent:pr.red};function iU({type:e,size:t=18,sx:n,...r}){return p.jsx(_0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:N$e[e]()})}const N$e={report:I$e,model:L$e,data:z$e,materialization:F$e,dataApp:B$e,dashboard:_$e,agent:U$e};function I$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 L$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 z$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 F$e(){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 _$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:"M12 9.5 V20.5"}),p.jsx("path",{d:"M12 15 H20.5"})]})}function U$e(){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 B$e(){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 sU(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 V$e=12;function H$e(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return j$e;if(t.startsWith("record")||t.startsWith("struct"))return A$e;switch(t.split(/[\s(<]/)[0]){case"string":return P$e;case"number":return D$e;case"date":return D6;case"timestamp":case"timestamptz":return I6;case"boolean":return L6;default:return z6}}function q$e({column:e}){const t=H$e(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 W$e({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:sU(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:aU.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:p.jsx(iU,{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>V$e&&p.jsx(Ix,{value:a,onChange:$=>i($.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:p.jsx(OR,{position:"start",children:p.jsx(Gp,{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(q$e,{column:$},`${$.name}-${k}`))})})]})]})}const lU=(e,t,n)=>["packageVersions",e,t,n];async function cU(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 Y$e(e,t,n={}){const{apiClients:r,server:o}=Jn(),a=(n.enabled??!0)&&e!==""&&t!=="",i=zd({queryKey:lU(e,t,o),queryFn:()=>cU(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 G$e(e,t){const{apiClients:n,server:r}=Jn(),o=Tl();return C.useCallback(()=>o.fetchQuery({queryKey:lU(e,t,r),queryFn:()=>cU(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function K$e(e,t){const n=Tl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const Q$e=un(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"})),X$e=un(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"})),Z$e=un(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"})),J$e=un(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"},eRe=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Tp=e=>e.archiveStatus==="archive",LC="Tables built for this version alone (under scope: version) are dropped.";function rL(e,t){const n=!Tp(e)&&t.filter(o=>!Tp(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 tRe({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:l}=Jn(),d=Tl(),u=K$e(e,t),m=G$e(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]})]),U=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&&!Tp(Le))?.id;ve!==void 0&&(a?a(ve===se?void 0:ve):o(ve))},I=o0({mutationFn:fe=>l.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{b(null),await N()},onError:()=>void N()}),H=o0({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 U(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=o0({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 U(he,se),await N()},onError:()=>void N()}),K=()=>w(null),oe=x?rL(x.version,n):{},ue=x!==null&&!Tp(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,X=T?.versions!==void 0?rL(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(bF,{fontSize:"small"})}),p.jsx(wi,{primary:"Delete version",secondary:oe.delete})]},"delete");return p.jsxs(p.Fragment,{children:[p.jsx(qn,{size:"small",variant:"outlined",endIcon:p.jsx(N6,{}),"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=Tp(fe),se=[me?"Archived":void 0,eRe(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?rs(ve.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[p.jsx(wi,{primary:fe.id,secondary:se,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&p.jsx(RR,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&p.jsx(Ur,{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(X$e,{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&&Tp(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(J$e,{fontSize:"small"})}),p.jsx(wi,{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(Z$e,{fontSize:"small"})}),p.jsx(wi,{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(Q$e,{fontSize:"small"})}),p.jsx(wi,{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(qn,{ref:A,disabled:I.isPending,onClick:()=>b(null),children:"Cancel"}),p.jsx(qn,{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(qn,{ref:F,disabled:H.isPending,onClick:()=>k(null),children:"Cancel"}),p.jsx(qn,{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:`${LC} 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(qn,{ref:L,disabled:ae.isPending,onClick:()=>O(null),children:"Cancel"}),p.jsx(qn,{variant:"contained",color:"error",loading:ae.isPending,disabled:G||X!==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. ${LC} This cannot be undone.`:`v${T.version.id} stops being served and its files are removed. ${LC} Links that name it stop working, and this cannot be undone.`}),X!==void 0&&T&&p.jsx(lo,{severity:"warning",role:"alert",children:`v${T.version.id} can't be deleted now: ${X}.`}),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 nRe="README.malloynb",rRe=e=>!!e&&!e.includes("/")&&A1(e)?.toLowerCase()==="readme";function N2e({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:l}=Jn(),d=Tl(),u=e??(re=>{window.location.href=re}),{environmentName:m,packageName:g,versionId:y}=Xr(n),x=Y$e(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):b_(m,g,re.path);_e?u(Me,_e):u(Me)}),[T,O]=C.useState(null),[P,D]=C.useState(!1),A=kxe(),F=A_()?.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:$_(re)});const _e=[],Me=xy(m,g,"");for(const Ke of re.filter(Je=>Je.writeable))for(const Je of await F.listDocuments(Ke))Je.path.startsWith(Me)&&_e.push({locator:Je,where:Ke.description});_(_e)},[F,m,g]);C.useEffect(()=>{N()},[N]);const U=re=>re.path.slice(xy(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=x_(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=aRe(ue),ie=new Set(ue.map(re=>re.path).filter(re=>re!==void 0)),X=(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===nRe)??ue.find(re=>rRe(re.path)))?.path,Le=!Y.settled,Ae=S?p.jsx(tRe,{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(Pa,{error:I.error,context:`${m} > ${g}`});return Ae?p.jsxs(M0,{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(M0,{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(k$e,{warnings:I.data?.data?.warnings}),x.isError&&p.jsx(Te,{sx:{mb:4},children:p.jsx(lo,{severity:"warning",action:p.jsx(qn,{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(Uo,{text:"Loading package..."}),he&&p.jsx(R$e,{open:P,layout:"linear",environmentName:m,packageName:g,...y!==void 0?{versionId:y}:{},models:X.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(qn,{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(Ds,{title:"Reports",count:G.length,...fe?{action:p.jsx(Ky,{label:"Report",onClick:()=>D(!0)})}:{},children:[G.length===0&&p.jsx(zC,{label:"No reports yet",...fe?{action:{label:"Add report",onClick:()=>D(!0)}}:{}}),G.map(re=>p.jsx(xp,{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(Ds,{title:"Drafts",count:L.length,children:L.map(({locator:re,where:_e})=>p.jsx(xp,{type:re.type==="grid"?"dashboard":"report",label:U(re),rightLabel:_e,onClick:Me=>k({path:U(re),layout:re.type,slug:A1(U(re))??"",mode:"edit"},Me),trailingAction:p.jsx(Ur,{title:"Delete this draft",children:p.jsx(ro,{size:"small","aria-label":`Delete draft ${U(re)}`,onClick:Me=>{Me.stopPropagation(),F?.deleteDocument(re).then(N)},children:p.jsx(bF,{fontSize:"small"})})})},`${re.workspace}:${re.path}`))}),oe.length>0&&p.jsx(Ds,{title:"Apps",count:oe.length,children:oe.map(re=>{const _e=!!re.title&&re.title!==re.path,Me=`${e6(s)}${re.resource}`;return p.jsx(xp,{type:"dataApp",label:_e?re.title:re.path,rightLabel:_e?re.path:void 0,onClick:Ke=>{e?e(`/${m}/${g}/data-apps/${re.path}`,Ke):Ke&&(Ke.metaKey||Ke.ctrlKey)?window.open(Me,"_blank"):window.location.href=Me},trailingAction:p.jsx(Ur,{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:Ke=>Ke.stopPropagation(),sx:{color:"text.secondary"},children:p.jsx(J_,{fontSize:"small"})})})},re.path)})}),p.jsxs(Ds,{title:"Models",count:X.length,children:[X.map(re=>p.jsx(xp,{type:"model",label:re.path,onClick:_e=>u(`/${m}/${g}/${re.path}`,_e)},re.path)),X.length===0&&p.jsx(zC,{label:"No models"})]}),se.length>0&&p.jsx(Ds,{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(oRe,{agent:re},re.name))}),p.jsxs(Ds,{title:"Data",count:ee.length,children:[ee.map(re=>p.jsx(xp,{type:"data",label:re.path,rightLabel:re.info?sU(re.info.rowCount):"Unreadable",onClick:()=>O(re)},re.path)),ee.length===0&&p.jsx(zC,{label:"No data files"})]}),p.jsx(sSe,{resourceUri:n,versioned:!b}),ve&&p.jsx(Te,{sx:{mt:6},children:p.jsx($$e,{resourceUri:N1({environmentName:m,packageName:g,versionId:y}),path:ve,onLinkNavigate:u})})]}),p.jsx(W$e,{database:T,onClose:()=>O(null)})]})}function xp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return p.jsx(I1,{icon:p.jsx(iU,{type:e}),tint:aU[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 oRe({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx(xp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=s2(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 aRe(e){const t=e.map(r=>({path:r.path??"",layout:XT(r),slug:A1(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 zC({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(qn,{size:"small",onClick:t.onClick,children:t.label})]})}const oL=/^publisher:document:(dashboard|notebook):(.+)$/;function iRe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&oL.test(o)&&n.push(o)}for(const r of n){const[,o,a]=oL.exec(r),i=e.getItem(r);i!==null&&t(a,D_(o),i)&&e.removeItem(r)}}const FC={name:"Local",description:"Stored in this browser only",writeable:!0},P$="publisher:report:",gd=e=>`${P$}${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 _C=(e,t)=>localStorage.setItem(gd(e),JSON.stringify(t));class sRe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,iRe(localStorage,(t,n,r)=>yg(gd(t))!==void 0?!1:(_C(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[FC]}async listDocuments(t,n){if(t.name!==FC.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(P$))continue;const i=yg(a);i&&(n===void 0||i.type===n)&&r.push({workspace:FC.name,type:i.type,path:a.slice(P$.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(),_C(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);_C(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(gd(t.path))}}function UC(e){return new R_(`No report at ${e.workspace}/${e.path}`)}async function lRe(e,t,n,r){const o=$_(await e.listWorkspaces(!1));if(!o)return;const a=xy(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(T_(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function I2e(e,t,n,r=!0){const o=A_()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),l=xy(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let d=!1;return lRe(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 cRe(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 uRe(e){return e.type==="code"}function dRe(e){return(e.text??"").split(`
|
|
510
|
+
`);x2(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(Lp,{"aria-label":"Expand results",onClick:()=>l(!0),children:p.jsx(Gp,{})})]}),p.jsxs(v4,{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(qn,{variant:"contained",startIcon:p.jsx(f$e,{}),onClick:()=>u(!0),children:"Run Query"})]}),w&&p.jsx(QT,{state:S,context:e,maxHeight:Nle,maxResultSize:o})]}),p.jsx(tU,{open:s,onClose:()=>l(!1),result:b?.data?.result||"",renderLogs:b?.data?.renderLogs,title:`Query: ${e}`})]})}function h$e(e){return e!=null}function m$e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||h$e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=O1(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 g$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 y$e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return Cn.useEffect(()=>{o&&o(t)},[t,o]),p.jsx(y4,{children:p.jsxs(S9,{spacing:2,component:"section",children:[p.jsx(b$e,{sourceAndPath:e[t],existingQuery:n,onChange:l=>{r&&r(l)},resourceUri:a,givens:i,gate:s}),p.jsx(h5,{height:"5px"})]})})}function NC(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function v$e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[l,d]=Cn.useState(n||NC()),[u,m]=Cn.useState(void 0);Cn.useEffect(()=>{n&&d(n)},[n]);const[g,y]=Cn.useState([]),{MalloyExplorerProvider:x,QueryPanel:w,ResizableCollapsiblePanel:S,ResultPanel:b,SourcePanel:$}=r;Cn.useEffect(()=>{t&&t(l)},[t,l]);const{environmentName:k,packageName:T,versionId:O}=Xr(a),{apiClients:P}=Jn(),D=Cn.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(U=>U?{...U,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}],U=D.current?.missing??[];(R?.status===403||/Access denied for source/i.test(z))&&U.length>0&&N.push({severity:"WARN",title:g$e(U)}),m(I=>I?{...I,executionState:"finished",response:{messages:N}}:void 0)}}),[F,L]=Cn.useState(e.sourceInfo.name);Cn.useEffect(()=>{F!==e.sourceInfo.name&&(L(e.sourceInfo.name),d(NC()),m(void 0))},[e,F]);const _=Cn.useCallback(R=>{d({...l,malloyQuery:R,malloyResult:void 0})},[l]);return F!==e.sourceInfo.name?p.jsx("div",{children:"Loading..."}):p.jsx(b4,{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(NC())})}),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 b$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-BOCBPBsi.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(qne,{children:p.jsx(b4,{children:p.jsx(h5,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):p.jsx(v$e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function nU(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=Xr(e),{apiClients:i}=Jn();return co({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function rU({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:l}){const[d,u]=Cn.useState(r);Cn.useEffect(()=>{u(r)},[r]);const{data:m,isError:g,isLoading:y,error:x}=nU(a,!e),{environmentName:w,packageName:S,modelPath:b,versionId:$}=Xr(a),k=e||m,T=Cn.useMemo(()=>k?.givens??[],[k]),O=vT({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(()=>Zd(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),D=C.useMemo(()=>m$e(T,O.applied),[T,O.applied]);if(y&&!e)return p.jsx(Uo,{text:"Fetching Model..."});if(g&&!e)return console.log("error",x),p.jsx(Pa,{error:x,context:`ModelExplorer > ${b}`});if(!k)return p.jsx(Uo,{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(Vne,{variant:"outlined",children:[p.jsx(Hne,{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(P1,{...O.panel}),p.jsx(y4,{children:p.jsxs(Yn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&p.jsx(y$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 oU({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(Lx,{open:e,onClose:t,fullScreen:!0,children:[p.jsxs(Fx,{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(zx,{children:a?p.jsx(rU,{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 x$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}=nU(t),[m,g]=Cn.useState(!1),[y,x]=Cn.useState(),[w,S]=Cn.useState(0),[b,$]=C.useState(""),[k,T]=Cn.useState({}),O=o??k,P=a??(R=>T(R)),D=s?.modelDef,A=Cn.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(Uo,{text:"Fetching Model..."});if(l)return console.log("error",u),p.jsx(Pa,{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(Ur,{title:"Copy link",children:p.jsx(ro,{size:"small","aria-label":"Copy link",onClick:_,sx:{color:"text.secondary"},children:p.jsx(l2,{fontSize:"small"})})})]}),p.jsx(rU,{data:s,onChange:F,onSourceChange:L,existingQuery:y,initialSelectedSourceIndex:w,resourceUri:t,givens:O,onGivensChange:P}),p.jsx(Lp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:p.jsx(Gp,{})})]}),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(oU,{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 w$e(){const[e,t]=C.useState("");return p.jsxs(p.Fragment,{children:[p.jsx(Ur,{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(l2,{fontSize:"small"})})}),p.jsx(hh,{open:e!=="",autoHideDuration:6e3,onClose:()=>t(""),message:e})]})}function D2e(e){const{modelPage:t,isLoadingStatus:n}=Jn();if(n)return p.jsx(Uo,{text:"Fetching Model..."});if(t!=="viewer")return p.jsx(x$e,{...e});const{onChange:r,runOnDemand:o,headerActions:a,...i}=e;return p.jsx(d$e,{...i,headerActions:a??p.jsx(w$e,{})})}const S$e={"persist-source-refused":"persist-not-built","preaggregate-not-built":"rollup-not-built","preaggregate-join-one-key-repeated":"rollup-join-one-key-repeated","stored-native-schema-missing":"database-native-type-missing"};function C$e(e){const t=(r,o)=>`${r}\0${o.subject??""}\0${o.message??""}`,n=new Set(e.map(r=>t(r.code,r)));return e.filter(r=>{const o=r.code!==void 0?S$e[r.code]:void 0;return o===void 0||!n.has(t(o,r))})}function k$e({warnings:e}){const[t,n]=C.useState(!1),r=C$e(e??[]),o=r.filter(i=>i.severity==="error"),a=r.filter(i=>i.severity!=="error");return o.length===0&&a.length===0?null:p.jsxs(Yn,{sx:{gap:1,mb:4},children:[o.length>0&&p.jsxs(lo,{severity:"warning",children:[p.jsx(yY,{children:o.length===1?"1 problem in this package":`${o.length} problems in this package`}),p.jsx(tL,{findings:o})]}),a.length>0&&p.jsxs(Te,{children:[p.jsxs(qn,{size:"small","aria-expanded":t,onClick:()=>n(i=>!i),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",a.length," ",a.length===1?"note":"notes"]}),t&&p.jsx(Te,{sx:{pl:.5,pt:.5},children:p.jsx(tL,{findings:a})})]})]})}function tL({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}=Jn(),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((U,I)=>{const H=o?.(U,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(Pa,{context:`${w} > ${S} > ${t}`,error:P});if(!T||!k)return p.jsx(Uo,{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(Z_,{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(SF.Provider,{value:A,children:N})}function R$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?D_(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,U]=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:X,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(()=>X.get(D)??[],[X,D]),me=C.useMemo(()=>new Map([...X.entries()].flatMap(([st,Dt])=>Dt.map(nn=>[IC(st,nn.source,nn.view),{model:st,source:nn.source,view:nn.view}]))),[X]),se=C.useMemo(()=>{const st=X.size>1;return[...X.entries()].flatMap(([Dt,nn])=>{const Ut=new Map;for(const fn of nn)Ut.set(fn.source,[...Ut.get(fn.source)??[],fn]);return[...Ut.entries()].map(([fn,$n])=>({key:`${Dt}::${fn}`,label:fn,ariaLabel:`${fn} in ${Dt}`,...st||$n[0]?.sourceDescription?{detail:[st?Dt:void 0,$n[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:$n.map(Vt=>({key:IC(Dt,Vt.source,Vt.view),name:Vt.view,title:Vt.description??vC(Vt.view),...Vt.chart?{chart:Vt.chart}:{}}))}))})},[X]),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?IC(D,Le.source,Le.view):void 0,Re=T$e(Le,250);C.useEffect(()=>{e&&T(b)},[e,b]),C.useEffect(()=>{if(!e)return;const st=[...X.keys()];D===""&&st.length>0&&A(st[0])},[e,X,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||U(vC(Le.view))},[e,I,Le]),C.useEffect(()=>{e||(A(""),L(""),R(""),U(""),H(!1),P(void 0),ae(!1),G(void 0))},[e]);const re=C.useMemo(()=>{if(N.trim()!=="")for(let st=1;st<=t2;st++){const Dt=O_(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`,Ke=Me??re,Je=Me===void 0?void 0:P_(Me)??(g.existing?.includes(Me)?`${Me} already exists; choose another location.`:void 0),St=(Le===void 0?void 0:JT({title:N,modelPath:D,source:Le.source,view:Le.view}))??(N.trim()!==""&&Ke===void 0?"No free file name for this title; choose another.":void 0),Bt=St!==void 0&&(Y||N.trim()!==""),at=d||ee,{theme:tt}=qr(),pt=tt.ui,ze=Xd(tt.cardBorder),be=X.size===0&&(ie||de.length>0),qe=at?"Loading the model":be?"Couldn't read the model to start from":X.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(!(qe!==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(qn,{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(qn,{onClick:x,disabled:K,children:"Cancel"}),p.jsx(Ur,{title:K?"":qe??"",children:p.jsx("span",{children:p.jsx(qn,{variant:"contained",disabled:K||qe!==void 0,"aria-label":!K&&qe!==void 0?`${$t}: ${qe}`:$t,onClick:()=>void vt(),children:$t})})})]}),children:p.jsxs(Yn,{sx:{gap:1.5},children:[ie?p.jsx(lo,{severity:"error",action:m&&N4(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&&X.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(nL,{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(O$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(nL,{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(z_,{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:E$e,declaredTypes:M$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($i,{size:"small",label:"Title",value:N,disabled:K,onChange:st=>{H(!0),U(st.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Bt,helperText:Bt?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($i,{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??(Ke?`Written as ${Ke} 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 T$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 IC=(e,t,n)=>`${e}::${t}::${n}`,E$e=new Map,M$e=new Map;function nL({children:e}){const t=qr().theme.ui;return p.jsx(wt,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function O$e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=qr(),a=o.ui,i=Xd(o.cardBorder),s=t?o.accent:"currentColor";return p.jsxs(os,{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 P$e=un(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"})),j$e=un(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),A$e=un(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"})),D$e=un(p.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),aU={dashboard:pr.blue,report:pr.violet,model:pr.cyan,dataApp:pr.pink,data:pr.lime,materialization:pr.amber,agent:pr.red};function iU({type:e,size:t=18,sx:n,...r}){return p.jsx(_0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:N$e[e]()})}const N$e={report:I$e,model:L$e,data:z$e,materialization:F$e,dataApp:B$e,dashboard:_$e,agent:U$e};function I$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 L$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 z$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 F$e(){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 _$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:"M12 9.5 V20.5"}),p.jsx("path",{d:"M12 15 H20.5"})]})}function U$e(){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 B$e(){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 sU(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 V$e=12;function H$e(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return j$e;if(t.startsWith("record")||t.startsWith("struct"))return A$e;switch(t.split(/[\s(<]/)[0]){case"string":return P$e;case"number":return D$e;case"date":return D6;case"timestamp":case"timestamptz":return I6;case"boolean":return L6;default:return z6}}function q$e({column:e}){const t=H$e(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 W$e({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:sU(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:aU.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:p.jsx(iU,{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>V$e&&p.jsx(Ix,{value:a,onChange:$=>i($.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:p.jsx(OR,{position:"start",children:p.jsx(Gp,{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(q$e,{column:$},`${$.name}-${k}`))})})]})]})}const lU=(e,t,n)=>["packageVersions",e,t,n];async function cU(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 Y$e(e,t,n={}){const{apiClients:r,server:o}=Jn(),a=(n.enabled??!0)&&e!==""&&t!=="",i=zd({queryKey:lU(e,t,o),queryFn:()=>cU(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 G$e(e,t){const{apiClients:n,server:r}=Jn(),o=Tl();return C.useCallback(()=>o.fetchQuery({queryKey:lU(e,t,r),queryFn:()=>cU(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function K$e(e,t){const n=Tl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const Q$e=un(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"})),X$e=un(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"})),Z$e=un(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"})),J$e=un(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"},eRe=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Tp=e=>e.archiveStatus==="archive",LC="Tables built for this version alone (under scope: version) are dropped.";function rL(e,t){const n=!Tp(e)&&t.filter(o=>!Tp(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 tRe({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:l}=Jn(),d=Tl(),u=K$e(e,t),m=G$e(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]})]),U=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&&!Tp(Le))?.id;ve!==void 0&&(a?a(ve===se?void 0:ve):o(ve))},I=o0({mutationFn:fe=>l.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{b(null),await N()},onError:()=>void N()}),H=o0({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 U(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=o0({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 U(he,se),await N()},onError:()=>void N()}),K=()=>w(null),oe=x?rL(x.version,n):{},ue=x!==null&&!Tp(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,X=T?.versions!==void 0?rL(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(bF,{fontSize:"small"})}),p.jsx(wi,{primary:"Delete version",secondary:oe.delete})]},"delete");return p.jsxs(p.Fragment,{children:[p.jsx(qn,{size:"small",variant:"outlined",endIcon:p.jsx(N6,{}),"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=Tp(fe),se=[me?"Archived":void 0,eRe(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?rs(ve.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[p.jsx(wi,{primary:fe.id,secondary:se,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&p.jsx(RR,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&p.jsx(Ur,{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(X$e,{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&&Tp(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(J$e,{fontSize:"small"})}),p.jsx(wi,{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(Z$e,{fontSize:"small"})}),p.jsx(wi,{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(Q$e,{fontSize:"small"})}),p.jsx(wi,{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(qn,{ref:A,disabled:I.isPending,onClick:()=>b(null),children:"Cancel"}),p.jsx(qn,{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(qn,{ref:F,disabled:H.isPending,onClick:()=>k(null),children:"Cancel"}),p.jsx(qn,{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:`${LC} 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(qn,{ref:L,disabled:ae.isPending,onClick:()=>O(null),children:"Cancel"}),p.jsx(qn,{variant:"contained",color:"error",loading:ae.isPending,disabled:G||X!==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. ${LC} This cannot be undone.`:`v${T.version.id} stops being served and its files are removed. ${LC} Links that name it stop working, and this cannot be undone.`}),X!==void 0&&T&&p.jsx(lo,{severity:"warning",role:"alert",children:`v${T.version.id} can't be deleted now: ${X}.`}),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 nRe="README.malloynb",rRe=e=>!!e&&!e.includes("/")&&A1(e)?.toLowerCase()==="readme";function N2e({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:l}=Jn(),d=Tl(),u=e??(re=>{window.location.href=re}),{environmentName:m,packageName:g,versionId:y}=Xr(n),x=Y$e(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):b_(m,g,re.path);_e?u(Me,_e):u(Me)}),[T,O]=C.useState(null),[P,D]=C.useState(!1),A=kxe(),F=A_()?.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:$_(re)});const _e=[],Me=xy(m,g,"");for(const Ke of re.filter(Je=>Je.writeable))for(const Je of await F.listDocuments(Ke))Je.path.startsWith(Me)&&_e.push({locator:Je,where:Ke.description});_(_e)},[F,m,g]);C.useEffect(()=>{N()},[N]);const U=re=>re.path.slice(xy(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=x_(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=aRe(ue),ie=new Set(ue.map(re=>re.path).filter(re=>re!==void 0)),X=(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===nRe)??ue.find(re=>rRe(re.path)))?.path,Le=!Y.settled,Ae=S?p.jsx(tRe,{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(Pa,{error:I.error,context:`${m} > ${g}`});return Ae?p.jsxs(M0,{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(M0,{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(k$e,{warnings:I.data?.data?.warnings}),x.isError&&p.jsx(Te,{sx:{mb:4},children:p.jsx(lo,{severity:"warning",action:p.jsx(qn,{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(Uo,{text:"Loading package..."}),he&&p.jsx(R$e,{open:P,layout:"linear",environmentName:m,packageName:g,...y!==void 0?{versionId:y}:{},models:X.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(qn,{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(Ds,{title:"Reports",count:G.length,...fe?{action:p.jsx(Ky,{label:"Report",onClick:()=>D(!0)})}:{},children:[G.length===0&&p.jsx(zC,{label:"No reports yet",...fe?{action:{label:"Add report",onClick:()=>D(!0)}}:{}}),G.map(re=>p.jsx(xp,{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(Ds,{title:"Drafts",count:L.length,children:L.map(({locator:re,where:_e})=>p.jsx(xp,{type:re.type==="grid"?"dashboard":"report",label:U(re),rightLabel:_e,onClick:Me=>k({path:U(re),layout:re.type,slug:A1(U(re))??"",mode:"edit"},Me),trailingAction:p.jsx(Ur,{title:"Delete this draft",children:p.jsx(ro,{size:"small","aria-label":`Delete draft ${U(re)}`,onClick:Me=>{Me.stopPropagation(),F?.deleteDocument(re).then(N)},children:p.jsx(bF,{fontSize:"small"})})})},`${re.workspace}:${re.path}`))}),oe.length>0&&p.jsx(Ds,{title:"Apps",count:oe.length,children:oe.map(re=>{const _e=!!re.title&&re.title!==re.path,Me=`${e6(s)}${re.resource}`;return p.jsx(xp,{type:"dataApp",label:_e?re.title:re.path,rightLabel:_e?re.path:void 0,onClick:Ke=>{e?e(`/${m}/${g}/data-apps/${re.path}`,Ke):Ke&&(Ke.metaKey||Ke.ctrlKey)?window.open(Me,"_blank"):window.location.href=Me},trailingAction:p.jsx(Ur,{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:Ke=>Ke.stopPropagation(),sx:{color:"text.secondary"},children:p.jsx(J_,{fontSize:"small"})})})},re.path)})}),p.jsxs(Ds,{title:"Models",count:X.length,children:[X.map(re=>p.jsx(xp,{type:"model",label:re.path,onClick:_e=>u(`/${m}/${g}/${re.path}`,_e)},re.path)),X.length===0&&p.jsx(zC,{label:"No models"})]}),se.length>0&&p.jsx(Ds,{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(oRe,{agent:re},re.name))}),p.jsxs(Ds,{title:"Data",count:ee.length,children:[ee.map(re=>p.jsx(xp,{type:"data",label:re.path,rightLabel:re.info?sU(re.info.rowCount):"Unreadable",onClick:()=>O(re)},re.path)),ee.length===0&&p.jsx(zC,{label:"No data files"})]}),p.jsx(sSe,{resourceUri:n,versioned:!b}),ve&&p.jsx(Te,{sx:{mt:6},children:p.jsx($$e,{resourceUri:N1({environmentName:m,packageName:g,versionId:y}),path:ve,onLinkNavigate:u})})]}),p.jsx(W$e,{database:T,onClose:()=>O(null)})]})}function xp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return p.jsx(I1,{icon:p.jsx(iU,{type:e}),tint:aU[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 oRe({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx(xp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=s2(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 aRe(e){const t=e.map(r=>({path:r.path??"",layout:XT(r),slug:A1(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 zC({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(qn,{size:"small",onClick:t.onClick,children:t.label})]})}const oL=/^publisher:document:(dashboard|notebook):(.+)$/;function iRe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&oL.test(o)&&n.push(o)}for(const r of n){const[,o,a]=oL.exec(r),i=e.getItem(r);i!==null&&t(a,D_(o),i)&&e.removeItem(r)}}const FC={name:"Local",description:"Stored in this browser only",writeable:!0},P$="publisher:report:",gd=e=>`${P$}${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 _C=(e,t)=>localStorage.setItem(gd(e),JSON.stringify(t));class sRe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,iRe(localStorage,(t,n,r)=>yg(gd(t))!==void 0?!1:(_C(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[FC]}async listDocuments(t,n){if(t.name!==FC.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(P$))continue;const i=yg(a);i&&(n===void 0||i.type===n)&&r.push({workspace:FC.name,type:i.type,path:a.slice(P$.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(),_C(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);_C(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(gd(t.path))}}function UC(e){return new R_(`No report at ${e.workspace}/${e.path}`)}async function lRe(e,t,n,r){const o=$_(await e.listWorkspaces(!1));if(!o)return;const a=xy(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(T_(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function I2e(e,t,n,r=!0){const o=A_()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),l=xy(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let d=!1;return lRe(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 cRe(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 uRe(e){return e.type==="code"}function dRe(e){return(e.text??"").split(`
|
|
511
511
|
`).filter(t=>!t.trimStart().startsWith("##")).join(`
|
|
512
|
-
`)}const fRe=un(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 pRe({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]=Cn.useState(!1),[x,w]=Cn.useState(!1),[S,b]=Cn.useState(),[$,k]=Cn.useState(!1),{modelPage:T,isLoadingStatus:O}=Jn(),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}=K_({onNavigate:d,onSelf:s,canSelf:l}),U=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,I=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,H=!!e.text&&(U.test(e.text)||I.test(e.text)),Y=()=>{if(!e.newSources||e.newSources.length===0)return 0;let G=[],ie="";if(e.text){const X=e.text.match(U);X&&(G=X[1].split(",").map(Z=>Z.trim()));const ee=e.text.match(I);ee&&(ie=ee[1].trim())}for(let X=0;X<e.newSources.length;X++)try{const ee=JSON.parse(e.newSources[X]);if(G.length>0&&G.includes(ee.name)||ie&&ie===ee.path)return X}catch{continue}return 0},ae=Cn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:m}:void 0,[e.newSources,t,m]),{mode:K}=qr();C.useEffect(()=>{e.type==="code"&&x2(dRe(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(D1,{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(Ur,{title:"Copy link",children:p.jsx(ro,{"aria-label":"Copy link",onClick:oe,sx:{color:"text.secondary",mt:"18px"},children:p.jsx(l2,{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(v4,{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(Lp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:p.jsx(Gp,{})})]})})}),p.jsx(oU,{open:$&&P,onClose:()=>k(!1),title:"Data Sources",hasValidImport:H,resourceUri:t,data:ae,initialSelectedSourceIndex:Y(),startingGivens:u}),ue,p.jsx(tU,{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(Q0,{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(xF,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&p.jsx(fz,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&p.jsxs(Q0,{children:[p.jsx(S_,{title:"",action:p.jsxs(Yn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[p.jsx(Lp,{"aria-label":"Malloy code",onClick:G=>{G.stopPropagation(),y(!0)},children:p.jsx(fRe,{})}),p.jsx(Lp,{"aria-label":"Expand results",onClick:()=>w(!0),children:p.jsx(Gp,{})})]})}),p.jsx(j1,{result:e.result,maxHeight:jle,maxResultSize:r,drill:z}),N]})]})}function hRe({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 mRe=4;function gRe(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 yRe({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=cRe(l),_=l?.autorun!==!1,R=m1(),z=vT({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:U,canSelf:I,onSelf:H}=z,Y=C.useCallback(fe=>{const he=Zd(fe,U);return Object.keys(he).length>0?JSON.stringify(he):void 0},[U]),ae=C.useMemo(()=>h0(N,U),[N,U]),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(!uRe(Ae))continue;const Re=Le,re=async()=>{try{const _e=await u({cell:Ae,index:Re,givens:fe,declaredTypes:U,signal:me.signal});if(K.current!==he)return;const Me=_e.result,Ke=Ae.newSources||_e.newSources;$(Je=>{const St=[...Je];return St[Re]||(St[Re]={...Ae}),St[Re]={...St[Re],result:Me,newSources:Ke},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=gRe(_e);$(Ke=>{const Je=[...Ke];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>=mRe&&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,U,u,R]),X=C.useRef(0),ee=C.useRef(void 0);ee.current!==l&&(ee.current=l,X.current+=1);const Z=X.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=hRe({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,i_)}},[w,l,Z,e,N,Y,ie]);const de=b.length>0?b:l?.notebookCells||[],le=0;return p.jsxs(v$,{layout:"linear",header:t||n?p.jsx(C_,{title:t??"",description:n?p.jsx(D1,{children:p.jsx(oh,{variant:"document",children:n})}):void 0}):null,controls:z.panel.givens.length>0?p.jsx(k_,{children:p.jsx(P1,{...z.panel,layout:"bar"})}):void 0,children:[!w&&!S&&p.jsx(Uo,{text:wu.opening("report")}),w&&de.map((fe,he)=>p.jsx(pRe,{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(Pa,{error:d,context:`${m} > ${g} > ${x}`}),A&&p.jsx(Pa,{error:{message:A.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function uU(e){const{apiClients:t}=Jn(),{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 vRe(e){const{apiClients:t}=Jn(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri),i=uU(e.resourceUri),s=C.useCallback(async({index:l,givens:d,declaredTypes:u,signal:m})=>{const g=Zd(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(yRe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function L2e(e){const{data:t}=uU(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri);return p.jsx(Z_,{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(vRe,{...e})}function z2e(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>A1(a.path)===e),o=r.filter(a=>XT(a)===n);return o.length===1?{found:y$(o[0])}:r.length===1?{found:y$(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const bRe=/^(dashboards|notebooks)\/([^/]+)$/;function F2e(e){const t=bRe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const aL="[publisher.report]",iL="[publisher.console]";function xRe(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 _2e(e){return t=>{const n={...e,...t,at:new Date().toISOString()};xRe(t)?console.warn(aL,n):console.info(aL,n)}}function wRe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(iL,t):console.warn(iL,t)}const Lo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:pr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:pr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:pr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:pr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},qb='"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},U2e={headerHeight:56},sL="0 1px 3px rgba(0, 0, 0, 0.1)",SRe="#0f172a",CRe="#1e293b",kRe="#f1f5f9",$Re="#cbd5e1",RRe="#334155",dU=(e="light",t)=>{const n=e==="dark",r=n?SRe:Lo.white,o=n?CRe:Lo.white,a=n?kRe:Lo.black,i=n?$Re:Lo.grey.mid,s=n?RRe:Lo.grey.light,{accent:l,accentHover:d,accentContrast:u}=t??Nk(void 0,e);return Rx({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:qb,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:sL,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:qb,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 ${Xy} ease-in`,...Zy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Ho[400]},"&.Mui-focused":{borderColor:n?Ho[400]:Ho[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:qb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:qb}}},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:sL}}}}})};dU("light");function TRe({children:e}){const{mode:t,theme:n}=qr(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>dU(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return p.jsxs(n7,{theme:i,children:[p.jsx(uQ,{}),e]})}const ERe=C.lazy(()=>wo(()=>import("./HomePage-BOUo0MEl.js"),[])),MRe=C.lazy(()=>wo(()=>import("./MainPage-BkM5UDRU.js"),__vite__mapDeps([7,8,9,10]))),ORe=C.lazy(()=>wo(()=>import("./PackageSplatRoute-BLC29ek-.js").then(e=>e.a),__vite__mapDeps([11,10]))),PRe=C.lazy(()=>wo(()=>import("./PackagePage-Dn7FrQ5r.js"),__vite__mapDeps([12,9,10,13]))),jRe=C.lazy(()=>wo(()=>import("./EnvironmentPage-Y9IWPC9J.js"),[])),ARe=C.lazy(()=>wo(()=>import("./RouteError-BolMqTuz.js"),[])),DRe=C.lazy(()=>wo(()=>import("./ThemeEditorPage-CPv1eHkI.js"),__vite__mapDeps([14,15]))),NRe=(e="/",t=new sRe,n)=>(p1e(wRe),GH([{path:e,element:p.jsx(Bre,{children:p.jsx(uxe,{documentStorage:t,children:p.jsx(TRe,{children:p.jsx(C.Suspense,{fallback:p.jsx(Uo,{}),children:p.jsx(MRe,{headerProps:n})})})})}),errorElement:p.jsx(ARe,{}),children:[{index:!0,element:p.jsx(ERe,{})},{path:"settings/theme",element:p.jsx(DRe,{})},{path:"settings",element:p.jsx(SH,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:p.jsx(jRe,{})},{path:":environmentName/:packageName",element:p.jsx(PRe,{})},{path:":environmentName/:packageName/*",element:p.jsx(ORe,{})}]}])),IRe=NRe("/");DB.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(sq,{router:IRe})}));export{_Re as $,fs as A,os as B,zRe as C,jy as D,kxe as E,x_ as F,Qy as G,R0e as H,A2e as I,Te as J,RR as K,ro as L,cz as M,Ur as N,jR as O,Ka as P,Jn as Q,zd as R,nk as S,wt as T,tu as U,qr as V,pz as W,ml as X,wi as Y,ree as Z,U2e as _,xn as a,D_ as a$,Uo as a0,lo as a1,qn as a2,Cn as a3,wo as a4,_2e as a5,SH as a6,N1 as a7,N2e as a8,Y$e as a9,Zne as aA,w_ as aB,lTe as aC,e2e as aD,_le as aE,m2e as aF,p0e as aG,p2e as aH,t2e as aI,Ule as aJ,r2e as aK,Ple as aL,JTe as aM,n2e as aN,Xd as aO,fF as aP,wl as aQ,dF as aR,d1 as aS,uc as aT,u2e as aU,Vle as aV,sF as aW,UTe as aX,ITe as aY,o2e as aZ,v$ as a_,j2e as aa,uH as ab,M0 as ac,Yn as ad,zP as ae,$i as af,AR as ag,w4 as ah,Ik as ai,ea as aj,Tl as ak,o0 as al,AK as am,LK as an,hh as ao,Oo as ap,Cae as aq,su as ar,cx as as,jd as at,Oi as au,Jx as av,hae as aw,LRe as ax,j$ as ay,Sl as az,sl as b,h2e as b$,w2e as b0,A1 as b1,Pd as b2,A_ as b3,co as b4,x2e as b5,Gk as b6,U0 as b7,y2e as b8,Pa as b9,g2e as bA,b2e as bB,pxe as bC,s2e as bD,dxe as bE,T2e as bF,d2e as bG,vT as bH,Ybe as bI,Q0 as bJ,S_ as bK,z_ as bL,b0e as bM,Gbe as bN,Qbe as bO,VTe as bP,Kbe as bQ,P1 as bR,ble as bS,lxe as bT,$Te as bU,jTe as bV,nae as bW,MTe as bX,OTe as bY,PTe as bZ,DTe as b_,l2e as ba,sxe as bb,VN as bc,Xy as bd,un as be,bi as bf,XTe as bg,vl as bh,_Te as bi,rle as bj,rF as bk,ile as bl,iF as bm,QTe as bn,k_ as bo,Vbe as bp,i0e as bq,s0e as br,C_ as bs,D1 as bt,$2e as bu,$_ as bv,txe as bw,T_ as bx,v2e as by,oce as bz,Xa as c,S2e as c$,EA as c0,uF as c1,uT as c2,FTe as c3,zTe as c4,nle as c5,Jse as c6,Zy as c7,Hbe as c8,qbe as c9,Zle as cA,BTe as cB,WTe as cC,YTe as cD,ETe as cE,Kx as cF,qTe as cG,HTe as cH,KTe as cI,NTe as cJ,E_ as cK,A4 as cL,rae as cM,cF as cN,p1 as cO,a2e as cP,mK as cQ,vC as cR,ATe as cS,RTe as cT,gle as cU,Ble as cV,t2 as cW,rxe as cX,nxe as cY,C2e as cZ,JT as c_,LTe as ca,Tg as cb,A0e as cc,Up as cd,rQ as ce,ZTe as cf,bF as cg,GTe as ch,dle as ci,HN as cj,sle as ck,wz as cl,qy as cm,Ele as cn,Tle as co,oh as cp,Ix as cq,ple as cr,W0e as cs,R2e as ct,k2e as cu,Fz as cv,i2e as cw,yF as cx,Hle as cy,TTe as cz,_t as d,J0e as d0,O_ as d1,X0e as d2,exe as d3,cxe as d4,oy as d5,_r as d6,T0e as d7,E0e as d8,b_ as d9,O2e as da,L2e as db,$$e as dc,FRe as dd,c2e as de,E2e as df,F2e as dg,z2e as dh,WL as di,Fo as dj,I2e as dk,wu as dl,P2e as dm,Xxe as dn,D2e as dp,O0 as dq,k0e as dr,$0e as ds,ZC as e,yn as f,gn as g,gc as h,Ls as i,p as j,uo as k,Gd as l,dn as m,L5 as n,lc as o,B5 as p,_p as q,C as r,ct as s,zy as t,wn as u,z5 as v,Ln as w,lt as x,M2e as y,ja as z};
|
|
512
|
+
`)}const fRe=un(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 pRe({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]=Cn.useState(!1),[x,w]=Cn.useState(!1),[S,b]=Cn.useState(),[$,k]=Cn.useState(!1),{modelPage:T,isLoadingStatus:O}=Jn(),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}=K_({onNavigate:d,onSelf:s,canSelf:l}),U=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,I=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,H=!!e.text&&(U.test(e.text)||I.test(e.text)),Y=()=>{if(!e.newSources||e.newSources.length===0)return 0;let G=[],ie="";if(e.text){const X=e.text.match(U);X&&(G=X[1].split(",").map(Z=>Z.trim()));const ee=e.text.match(I);ee&&(ie=ee[1].trim())}for(let X=0;X<e.newSources.length;X++)try{const ee=JSON.parse(e.newSources[X]);if(G.length>0&&G.includes(ee.name)||ie&&ie===ee.path)return X}catch{continue}return 0},ae=Cn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:m}:void 0,[e.newSources,t,m]),{mode:K}=qr();C.useEffect(()=>{e.type==="code"&&x2(dRe(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(D1,{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(Ur,{title:"Copy link",children:p.jsx(ro,{"aria-label":"Copy link",onClick:oe,sx:{color:"text.secondary",mt:"18px"},children:p.jsx(l2,{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(v4,{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(Lp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:p.jsx(Gp,{})})]})})}),p.jsx(oU,{open:$&&P,onClose:()=>k(!1),title:"Data Sources",hasValidImport:H,resourceUri:t,data:ae,initialSelectedSourceIndex:Y(),startingGivens:u}),ue,p.jsx(tU,{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(Q0,{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(xF,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&p.jsx(fz,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&p.jsxs(Q0,{children:[p.jsx(S_,{title:"",action:p.jsxs(Yn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[p.jsx(Lp,{"aria-label":"Malloy code",onClick:G=>{G.stopPropagation(),y(!0)},children:p.jsx(fRe,{})}),p.jsx(Lp,{"aria-label":"Expand results",onClick:()=>w(!0),children:p.jsx(Gp,{})})]})}),p.jsx(j1,{result:e.result,maxHeight:jle,maxResultSize:r,drill:z}),N]})]})}function hRe({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 mRe=4;function gRe(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 yRe({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=cRe(l),_=l?.autorun!==!1,R=m1(),z=vT({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:U,canSelf:I,onSelf:H}=z,Y=C.useCallback(fe=>{const he=Zd(fe,U);return Object.keys(he).length>0?JSON.stringify(he):void 0},[U]),ae=C.useMemo(()=>h0(N,U),[N,U]),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(!uRe(Ae))continue;const Re=Le,re=async()=>{try{const _e=await u({cell:Ae,index:Re,givens:fe,declaredTypes:U,signal:me.signal});if(K.current!==he)return;const Me=_e.result,Ke=Ae.newSources||_e.newSources;$(Je=>{const St=[...Je];return St[Re]||(St[Re]={...Ae}),St[Re]={...St[Re],result:Me,newSources:Ke},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=gRe(_e);$(Ke=>{const Je=[...Ke];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>=mRe&&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,U,u,R]),X=C.useRef(0),ee=C.useRef(void 0);ee.current!==l&&(ee.current=l,X.current+=1);const Z=X.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=hRe({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,i_)}},[w,l,Z,e,N,Y,ie]);const de=b.length>0?b:l?.notebookCells||[],le=0;return p.jsxs(v$,{layout:"linear",header:t||n?p.jsx(C_,{title:t??"",description:n?p.jsx(D1,{children:p.jsx(oh,{variant:"document",children:n})}):void 0}):null,controls:z.panel.givens.length>0?p.jsx(k_,{children:p.jsx(P1,{...z.panel,layout:"bar"})}):void 0,children:[!w&&!S&&p.jsx(Uo,{text:wu.opening("report")}),w&&de.map((fe,he)=>p.jsx(pRe,{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(Pa,{error:d,context:`${m} > ${g} > ${x}`}),A&&p.jsx(Pa,{error:{message:A.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function uU(e){const{apiClients:t}=Jn(),{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 vRe(e){const{apiClients:t}=Jn(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri),i=uU(e.resourceUri),s=C.useCallback(async({index:l,givens:d,declaredTypes:u,signal:m})=>{const g=Zd(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(yRe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function L2e(e){const{data:t}=uU(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=Xr(e.resourceUri);return p.jsx(Z_,{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(vRe,{...e})}function z2e(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>A1(a.path)===e),o=r.filter(a=>XT(a)===n);return o.length===1?{found:y$(o[0])}:r.length===1?{found:y$(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const bRe=/^(dashboards|notebooks)\/([^/]+)$/;function F2e(e){const t=bRe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const aL="[publisher.report]",iL="[publisher.console]";function xRe(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 _2e(e){return t=>{const n={...e,...t,at:new Date().toISOString()};xRe(t)?console.warn(aL,n):console.info(aL,n)}}function wRe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(iL,t):console.warn(iL,t)}const Lo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:pr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:pr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:pr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:pr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},qb='"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},U2e={headerHeight:56},sL="0 1px 3px rgba(0, 0, 0, 0.1)",SRe="#0f172a",CRe="#1e293b",kRe="#f1f5f9",$Re="#cbd5e1",RRe="#334155",dU=(e="light",t)=>{const n=e==="dark",r=n?SRe:Lo.white,o=n?CRe:Lo.white,a=n?kRe:Lo.black,i=n?$Re:Lo.grey.mid,s=n?RRe:Lo.grey.light,{accent:l,accentHover:d,accentContrast:u}=t??Nk(void 0,e);return Rx({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:qb,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:sL,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:qb,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 ${Xy} ease-in`,...Zy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Ho[400]},"&.Mui-focused":{borderColor:n?Ho[400]:Ho[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:qb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:qb}}},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:sL}}}}})};dU("light");function TRe({children:e}){const{mode:t,theme:n}=qr(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>dU(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return p.jsxs(n7,{theme:i,children:[p.jsx(uQ,{}),e]})}const ERe=C.lazy(()=>wo(()=>import("./HomePage-S_Bkczsx.js"),[])),MRe=C.lazy(()=>wo(()=>import("./MainPage-DEy4SyjJ.js"),__vite__mapDeps([7,8,9,10]))),ORe=C.lazy(()=>wo(()=>import("./PackageSplatRoute-ChFCJOWE.js").then(e=>e.a),__vite__mapDeps([11,10]))),PRe=C.lazy(()=>wo(()=>import("./PackagePage-Cbrg7o1X.js"),__vite__mapDeps([12,9,10,13]))),jRe=C.lazy(()=>wo(()=>import("./EnvironmentPage-D2-0ts2G.js"),[])),ARe=C.lazy(()=>wo(()=>import("./RouteError-CDSSYdLB.js"),[])),DRe=C.lazy(()=>wo(()=>import("./ThemeEditorPage-DO2JWYOR.js"),__vite__mapDeps([14,15]))),NRe=(e="/",t=new sRe,n)=>(p1e(wRe),GH([{path:e,element:p.jsx(Bre,{children:p.jsx(uxe,{documentStorage:t,children:p.jsx(TRe,{children:p.jsx(C.Suspense,{fallback:p.jsx(Uo,{}),children:p.jsx(MRe,{headerProps:n})})})})}),errorElement:p.jsx(ARe,{}),children:[{index:!0,element:p.jsx(ERe,{})},{path:"settings/theme",element:p.jsx(DRe,{})},{path:"settings",element:p.jsx(SH,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:p.jsx(jRe,{})},{path:":environmentName/:packageName",element:p.jsx(PRe,{})},{path:":environmentName/:packageName/*",element:p.jsx(ORe,{})}]}])),IRe=NRe("/");DB.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(sq,{router:IRe})}));export{_Re as $,fs as A,os as B,zRe as C,jy as D,kxe as E,x_ as F,Qy as G,R0e as H,A2e as I,Te as J,RR as K,ro as L,cz as M,Ur as N,jR as O,Ka as P,Jn as Q,zd as R,nk as S,wt as T,tu as U,qr as V,pz as W,ml as X,wi as Y,ree as Z,U2e as _,xn as a,D_ as a$,Uo as a0,lo as a1,qn as a2,Cn as a3,wo as a4,_2e as a5,SH as a6,N1 as a7,N2e as a8,Y$e as a9,Zne as aA,w_ as aB,lTe as aC,e2e as aD,_le as aE,m2e as aF,p0e as aG,p2e as aH,t2e as aI,Ule as aJ,r2e as aK,Ple as aL,JTe as aM,n2e as aN,Xd as aO,fF as aP,wl as aQ,dF as aR,d1 as aS,uc as aT,u2e as aU,Vle as aV,sF as aW,UTe as aX,ITe as aY,o2e as aZ,v$ as a_,j2e as aa,uH as ab,M0 as ac,Yn as ad,zP as ae,$i as af,AR as ag,w4 as ah,Ik as ai,ea as aj,Tl as ak,o0 as al,AK as am,LK as an,hh as ao,Oo as ap,Cae as aq,su as ar,cx as as,jd as at,Oi as au,Jx as av,hae as aw,LRe as ax,j$ as ay,Sl as az,sl as b,h2e as b$,w2e as b0,A1 as b1,Pd as b2,A_ as b3,co as b4,x2e as b5,Gk as b6,U0 as b7,y2e as b8,Pa as b9,g2e as bA,b2e as bB,pxe as bC,s2e as bD,dxe as bE,T2e as bF,d2e as bG,vT as bH,Ybe as bI,Q0 as bJ,S_ as bK,z_ as bL,b0e as bM,Gbe as bN,Qbe as bO,VTe as bP,Kbe as bQ,P1 as bR,ble as bS,lxe as bT,$Te as bU,jTe as bV,nae as bW,MTe as bX,OTe as bY,PTe as bZ,DTe as b_,l2e as ba,sxe as bb,VN as bc,Xy as bd,un as be,bi as bf,XTe as bg,vl as bh,_Te as bi,rle as bj,rF as bk,ile as bl,iF as bm,QTe as bn,k_ as bo,Vbe as bp,i0e as bq,s0e as br,C_ as bs,D1 as bt,$2e as bu,$_ as bv,txe as bw,T_ as bx,v2e as by,oce as bz,Xa as c,S2e as c$,EA as c0,uF as c1,uT as c2,FTe as c3,zTe as c4,nle as c5,Jse as c6,Zy as c7,Hbe as c8,qbe as c9,Zle as cA,BTe as cB,WTe as cC,YTe as cD,ETe as cE,Kx as cF,qTe as cG,HTe as cH,KTe as cI,NTe as cJ,E_ as cK,A4 as cL,rae as cM,cF as cN,p1 as cO,a2e as cP,mK as cQ,vC as cR,ATe as cS,RTe as cT,gle as cU,Ble as cV,t2 as cW,rxe as cX,nxe as cY,C2e as cZ,JT as c_,LTe as ca,Tg as cb,A0e as cc,Up as cd,rQ as ce,ZTe as cf,bF as cg,GTe as ch,dle as ci,HN as cj,sle as ck,wz as cl,qy as cm,Ele as cn,Tle as co,oh as cp,Ix as cq,ple as cr,W0e as cs,R2e as ct,k2e as cu,Fz as cv,i2e as cw,yF as cx,Hle as cy,TTe as cz,_t as d,J0e as d0,O_ as d1,X0e as d2,exe as d3,cxe as d4,oy as d5,_r as d6,T0e as d7,E0e as d8,b_ as d9,O2e as da,L2e as db,$$e as dc,FRe as dd,c2e as de,E2e as df,F2e as dg,z2e as dh,WL as di,Fo as dj,I2e as dk,wu as dl,P2e as dm,Xxe as dn,D2e as dp,O0 as dq,k0e as dr,$0e as ds,ZC as e,yn as f,gn as g,gc as h,Ls as i,p as j,uo as k,Gd as l,dn as m,L5 as n,lc as o,B5 as p,_p as q,C as r,ct as s,zy as t,wn as u,z5 as v,Ln as w,lt as x,M2e as y,ja as z};
|