@malloy-publisher/sdk 0.9.8 → 0.9.9

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.
@@ -3,7 +3,7 @@ import { Box as Re, Dialog as vl, DialogTitle as Sl, IconButton as Mr, DialogCon
3
3
  import * as b from "react";
4
4
  import yt, { useRef as Lt, useState as bt, useEffect as lt, useMemo as We, createContext as Pl, useContext as Fs, useId as qu, useCallback as Ye, isValidElement as Xr, cloneElement as Qr, Children as Xu, Suspense as Qu, lazy as Zu } from "react";
5
5
  import { useQueries as kl, useQuery as Ju, useMutation as ed } from "@tanstack/react-query";
6
- import { aV as _t, aZ as Ls, aW as Yn, aU as Ml, bd as td } from "./ServerProvider-B_bPAsu2.es.js";
6
+ import { b4 as _t, b8 as Ls, b5 as Yn, b3 as Ml, bo as td } from "./ServerProvider-CQy4jVYK.es.js";
7
7
  import nd from "markdown-to-jsx";
8
8
  import { h as rd, k as Ti, i as Dl, n as od } from "./text-entry-72YFLeNk.es.js";
9
9
  import { ThemeContext as sd } from "@emotion/react";
@@ -22073,7 +22073,7 @@ function RP(e) {
22073
22073
  `)
22074
22074
  };
22075
22075
  }
22076
- const IP = Zu(() => import("./RenderedResult-DZj-FnOJ.es.js").then((e) => e.c));
22076
+ const IP = Zu(() => import("./RenderedResult-BHuJpdSn.es.js").then((e) => e.c));
22077
22077
  function $P({
22078
22078
  result: e,
22079
22079
  maxHeight: t,
@@ -1,4 +1,4 @@
1
- "use strict";var Id=Object.create;var Ri=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Od=Object.getOwnPropertyNames;var $d=Object.getPrototypeOf,Ad=Object.prototype.hasOwnProperty;var Fd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Od(t))!Ad.call(e,o)&&o!==n&&Ri(e,o,{get:()=>t[o],enumerable:!(r=Ed(t,o))||r.enumerable});return e};var Ar=(e,t,n)=>(n=e!=null?Id($d(e)):{},Fd(t||!e||!e.__esModule?Ri(n,"default",{value:e,enumerable:!0}):n,e));const g=require("react/jsx-runtime"),Q=require("@mui/material"),ne=require("react"),go=require("@tanstack/react-query"),ze=require("./ServerProvider-DuEOzwPc.cjs.js"),Ld=require("markdown-to-jsx"),Tn=require("./text-entry-BJwltZiy.cjs.js"),Nd=require("@emotion/react"),We=require("@mui/system"),tr=require("react-dom"),jd=require("@emotion/styled"),tt=require("@malloydata/malloy-filter"),Bd=require("@mui/icons-material"),Vd=require("@malloydata/malloy-tag");function gl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const v=gl(ne),zd=gl(tr),Ii=e=>e,_d=()=>{let e=Ii;return{configure(t){e=t},generate(t){return e(t)},reset(){e=Ii}}},yl=_d();function Ot(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Minified MUI error #${e}; visit ${n} for the full message.`}function le(e){if(typeof e!="string")throw new Error(Ot(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Ei(...e){return e.reduce((t,n)=>n==null?t:function(...o){t.apply(this,o),n.apply(this,o)},()=>{})}function Lt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wd(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Wo={exports:{}},Ho,Oi;function Hd(){if(Oi)return Ho;Oi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ho=e,Ho}var Uo,$i;function Ud(){if($i)return Uo;$i=1;var e=Hd();function t(){}function n(){}return n.resetWarningCache=t,Uo=function(){function r(i,a,l,c,u,m){if(m!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},Uo}var Ai;function Yd(){return Ai||(Ai=1,Wo.exports=Ud()()),Wo.exports}var Gd=Yd();const _=Lt(Gd);function bl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=bl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function de(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=bl(e))&&(r&&(r+=" "),r+=t);return r}function he(e,t,n=void 0){const r={};for(const o in e){const s=e[o];let i="",a=!0;for(let l=0;l<s.length;l+=1){const c=s[l];c&&(i+=(a===!0?"":" ")+t(c),a=!1,n&&n[c]&&(i+=" "+n[c]))}r[o]=i}return r}var Yo={exports:{}},Re={};/**
1
+ "use strict";var Id=Object.create;var Ri=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Od=Object.getOwnPropertyNames;var $d=Object.getPrototypeOf,Ad=Object.prototype.hasOwnProperty;var Fd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Od(t))!Ad.call(e,o)&&o!==n&&Ri(e,o,{get:()=>t[o],enumerable:!(r=Ed(t,o))||r.enumerable});return e};var Ar=(e,t,n)=>(n=e!=null?Id($d(e)):{},Fd(t||!e||!e.__esModule?Ri(n,"default",{value:e,enumerable:!0}):n,e));const g=require("react/jsx-runtime"),Q=require("@mui/material"),ne=require("react"),go=require("@tanstack/react-query"),ze=require("./ServerProvider-B0dUY8be.cjs.js"),Ld=require("markdown-to-jsx"),Tn=require("./text-entry-BJwltZiy.cjs.js"),Nd=require("@emotion/react"),We=require("@mui/system"),tr=require("react-dom"),jd=require("@emotion/styled"),tt=require("@malloydata/malloy-filter"),Bd=require("@mui/icons-material"),Vd=require("@malloydata/malloy-tag");function gl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const v=gl(ne),zd=gl(tr),Ii=e=>e,_d=()=>{let e=Ii;return{configure(t){e=t},generate(t){return e(t)},reset(){e=Ii}}},yl=_d();function Ot(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Minified MUI error #${e}; visit ${n} for the full message.`}function le(e){if(typeof e!="string")throw new Error(Ot(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Ei(...e){return e.reduce((t,n)=>n==null?t:function(...o){t.apply(this,o),n.apply(this,o)},()=>{})}function Lt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wd(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Wo={exports:{}},Ho,Oi;function Hd(){if(Oi)return Ho;Oi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ho=e,Ho}var Uo,$i;function Ud(){if($i)return Uo;$i=1;var e=Hd();function t(){}function n(){}return n.resetWarningCache=t,Uo=function(){function r(i,a,l,c,u,m){if(m!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},Uo}var Ai;function Yd(){return Ai||(Ai=1,Wo.exports=Ud()()),Wo.exports}var Gd=Yd();const _=Lt(Gd);function bl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=bl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function de(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=bl(e))&&(r&&(r+=" "),r+=t);return r}function he(e,t,n=void 0){const r={};for(const o in e){const s=e[o];let i="",a=!0;for(let l=0;l<s.length;l+=1){const c=s[l];c&&(i+=(a===!0?"":" ")+t(c),a=!1,n&&n[c]&&(i+=" "+n[c]))}r[o]=i}return r}var Yo={exports:{}},Re={};/**
2
2
  * @license React
3
3
  * react-is.production.js
4
4
  *
@@ -134,7 +134,7 @@ ${t}`}function bh(e){return e?.status===403}const vh=1e3;function fc(e){const t=
134
134
  `));u&&I.current&&I.current.getSectionContent(T.startIndex).focus()},[]),{interactions:P,returnedValue:{autoFocus:u,readOnly:n,focused:c??E,sectionListRef:N,onBlur:q,onClick:A,onFocus:V,onInput:$,onPaste:F,enableAccessibleFieldDOMStructure:!0,elements:G,tabIndex:p===0?-1:0,contentEditable:W,value:J,onChange:ee,areAllSectionsEmpty:k}}},Mn=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),yS=(e,t,n)=>{let r=0,o=n?1:0;const s=[];for(let i=0;i<e.length;i+=1){const a=e[i],l=qs(a,n?"input-rtl":"input-ltr",t),c=`${a.startSeparator}${l}${a.endSeparator}`,u=Mn(c).length,m=c.length,f=Mn(l),b=o+(f===""?0:l.indexOf(f[0]))+a.startSeparator.length,d=b+f.length;s.push(j({},a,{start:r,end:r+u,startInInput:b,endInInput:d})),r+=u,o+=m}return s},bS=e=>{const t=vt(),n=v.useRef(void 0),r=v.useRef(void 0),{forwardedProps:{onFocus:o,onClick:s,onPaste:i,onBlur:a,inputRef:l,placeholder:c},internalProps:{readOnly:u=!1,disabled:m=!1},parsedSelectedSections:f,activeSectionIndex:b,state:d,fieldValueManager:p,valueManager:h,applyCharacterEditing:S,resetCharacterQuery:C,updateSectionValue:w,updateValueFromValueStr:x,clearActiveSection:T,clearValue:k,setTempAndroidValueStr:O,setSelectedSections:I,getSectionsFromValue:N,areAllSectionsEmpty:L,localizedDigits:R}=e,y=v.useRef(null),E=Pe(l,y),D=v.useMemo(()=>yS(d.sections,R,t),[d.sections,R,t]),P=v.useMemo(()=>({syncSelectionToDOM:()=>{if(!y.current)return;if(f==null){y.current.scrollLeft&&(y.current.scrollLeft=0);return}if(y.current!==qe(document))return;const X=y.current.scrollTop;if(f==="all")y.current.select();else{const Y=D[f],W=Y.type==="empty"?Y.startInInput-Y.startSeparator.length:Y.startInInput,G=Y.type==="empty"?Y.endInInput+Y.endSeparator.length:Y.endInInput;(W!==y.current.selectionStart||G!==y.current.selectionEnd)&&y.current===qe(document)&&y.current.setSelectionRange(W,G),clearTimeout(r.current),r.current=setTimeout(()=>{y.current&&y.current===qe(document)&&y.current.selectionStart===y.current.selectionEnd&&(y.current.selectionStart!==W||y.current.selectionEnd!==G)&&P.syncSelectionToDOM()})}y.current.scrollTop=X},getActiveSectionIndexFromDOM:()=>{const X=y.current.selectionStart??0,Y=y.current.selectionEnd??0;if(X===0&&Y===0)return null;const W=X<=D[0].startInInput?1:D.findIndex(G=>G.startInInput-G.startSeparator.length>X);return W===-1?D.length-1:W-1},focusField:(X=0)=>{qe(document)!==y.current&&(y.current?.focus(),I(X))},setSelectedSections:X=>I(X),isFieldFocused:()=>y.current===qe(document)}),[y,f,D,I]),M=()=>{const X=y.current.selectionStart??0;let Y;X<=D[0].startInInput||X>=D[D.length-1].endInInput?Y=1:Y=D.findIndex(G=>G.startInInput-G.startSeparator.length>X);const W=Y===-1?D.length-1:Y-1;I(W)},A=ue((...X)=>{o?.(...X);const Y=y.current;clearTimeout(n.current),n.current=setTimeout(()=>{!Y||Y!==y.current||b==null&&(Y.value.length&&Number(Y.selectionEnd)-Number(Y.selectionStart)===Y.value.length?I("all"):M())})}),$=ue((X,...Y)=>{X.isDefaultPrevented()||(s?.(X,...Y),M())}),F=ue(X=>{if(i?.(X),X.preventDefault(),u||m)return;const Y=X.clipboardData.getData("text");if(typeof f=="number"){const W=d.sections[f],G=/^[a-zA-Z]+$/.test(Y),ee=/^[0-9]+$/.test(Y),J=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(Y);if(W.contentType==="letter"&&G||W.contentType==="digit"&&ee||W.contentType==="digit-with-letter"&&J){C(),w({activeSection:W,newSectionValue:Y,shouldGoToNextSection:!0});return}if(G||ee)return}C(),x(Y)}),V=ue((...X)=>{a?.(...X),I(null)}),q=ue(X=>{if(u)return;const Y=X.target.value;if(Y===""){C(),k();return}const W=X.nativeEvent.data,G=W&&W.length>1,ee=G?W:Y,J=Mn(ee);if(f==="all"&&I(b),b==null||G){x(G?W:J);return}let B;if(f==="all"&&J.length===1)B=J;else{const K=Mn(p.getV6InputValueFromSections(D,R,t));let oe=-1,te=-1;for(let be=0;be<K.length;be+=1)oe===-1&&K[be]!==J[be]&&(oe=be),te===-1&&K[K.length-be-1]!==J[J.length-be-1]&&(te=be);const ce=D[b];if(oe<ce.start||K.length-te-1>ce.end)return;const fe=J.length-K.length+ce.end-Mn(ce.endSeparator||"").length;B=J.slice(ce.start+Mn(ce.startSeparator||"").length,fe)}if(B.length===0){Sg()&&O(ee),C(),T();return}S({keyPressed:B,sectionIndex:b})}),re=v.useMemo(()=>c!==void 0?c:p.getV6InputValueFromSections(N(h.emptyValue),R,t),[c,p,N,h.emptyValue,R,t]),ae=v.useMemo(()=>d.tempValueStrAndroid??p.getV6InputValueFromSections(d.sections,R,t),[d.sections,p,d.tempValueStrAndroid,R,t]);v.useEffect(()=>(y.current&&y.current===qe(document)&&I("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);const ie=v.useMemo(()=>b==null||d.sections[b].contentType==="letter"?"text":"numeric",[b,d.sections]),Z=!(y.current&&y.current===qe(document))&&L;return{interactions:P,returnedValue:{readOnly:u,onBlur:V,onClick:$,onFocus:A,onPaste:F,inputRef:E,enableAccessibleFieldDOMStructure:!1,placeholder:re,inputMode:ie,autoComplete:"off",value:Z?"":ae,onChange:q}}},vS=e=>{const t=Ae(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:o,enableAccessibleFieldDOMStructure:s=!1,disabled:i=!1,readOnly:a=!1},forwardedProps:{onKeyDown:l,error:c,clearable:u,onClear:m},fieldValueManager:f,valueManager:b,validator:d}=e,p=vt(),h=fS(e),{state:S,activeSectionIndex:C,parsedSelectedSections:w,setSelectedSections:x,clearValue:T,clearActiveSection:k,updateSectionValue:O,setTempAndroidValueStr:I,sectionsValueBoundaries:N,localizedDigits:L,timezone:R}=h,y=hS({sections:S.sections,updateSectionValue:O,sectionsValueBoundaries:N,localizedDigits:L,setTempAndroidValueStr:I,timezone:R}),{resetCharacterQuery:E}=y,D=b.areValuesEqual(t,S.value,b.emptyValue),P=s?gS:bS,M=v.useMemo(()=>wg(S.sections,p&&!s),[S.sections,p,s]),{returnedValue:A,interactions:$}=P(j({},e,h,y,{areAllSectionsEmpty:D,sectionOrder:M})),F=ue(z=>{if(l?.(z),!i)switch(!0){case((z.ctrlKey||z.metaKey)&&String.fromCharCode(z.keyCode)==="A"&&!z.shiftKey&&!z.altKey):{z.preventDefault(),x("all");break}case z.key==="ArrowRight":{if(z.preventDefault(),w==null)x(M.startIndex);else if(w==="all")x(M.endIndex);else{const Z=M.neighbors[w].rightIndex;Z!==null&&x(Z)}break}case z.key==="ArrowLeft":{if(z.preventDefault(),w==null)x(M.endIndex);else if(w==="all")x(M.startIndex);else{const Z=M.neighbors[w].leftIndex;Z!==null&&x(Z)}break}case z.key==="Delete":{if(z.preventDefault(),a)break;w==null||w==="all"?T():k(),E();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(z.key):{if(z.preventDefault(),a||C==null)break;w==="all"&&x(C);const Z=S.sections[C],X=f.getActiveDateManager(t,S,Z),Y=mg(t,R,Z,z.key,N,L,X.date,{minutesStep:o});O({activeSection:Z,newSectionValue:Y,shouldGoToNextSection:!1});break}}});He(()=>{$.syncSelectionToDOM()});const{hasValidationError:V}=Nc({props:n,validator:d,timezone:R,value:S.value,onError:n.onError}),q=v.useMemo(()=>c!==void 0?c:V,[V,c]);v.useEffect(()=>{!q&&C==null&&E()},[S.referenceValue,C,q]),v.useEffect(()=>{S.tempValueStrAndroid!=null&&C!=null&&(E(),k())},[S.sections]),v.useImperativeHandle(r,()=>({getSections:()=>S.sections,getActiveSectionIndex:$.getActiveSectionIndexFromDOM,setSelectedSections:$.setSelectedSections,focusField:$.focusField,isFieldFocused:$.isFieldFocused}));const re=ue((z,...Z)=>{z.preventDefault(),m?.(z,...Z),T(),$.isFieldFocused()?x(M.startIndex):$.focusField(0)}),ae={onKeyDown:F,onClear:re,error:q,clearable:!!(u&&!D&&!a&&!i)},ie={disabled:i,readOnly:a};return j({},e.forwardedProps,ae,ie,A)},xS=["clearable","onClear","InputProps","sx","slots","slotProps"],SS=["ownerState"],wS=e=>{const t=Nt(),{clearable:n,onClear:r,InputProps:o,sx:s,slots:i,slotProps:a}=e,l=ve(e,xS),c=i?.clearButton??Ir,u=Ce({elementType:c,externalSlotProps:a?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),m=ve(u,SS),f=i?.clearIcon??Ex,b=Ce({elementType:f,externalSlotProps:a?.clearIcon,ownerState:{}});return j({},l,{InputProps:j({},o,{endAdornment:g.jsxs(v.Fragment,{children:[n&&g.jsx(jc,{position:"end",sx:{marginRight:o?.endAdornment?-1:-1.5},children:g.jsx(c,j({},m,{onClick:r,children:g.jsx(f,j({fontSize:"small"},b))}))}),o?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(s)?s:[s]]})},CS=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],PS=(e,t)=>v.useMemo(()=>{const n=j({},e),r={},o=s=>{n.hasOwnProperty(s)&&(r[s]=n[s],delete n[s])};return CS.forEach(o),Fc.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),kS=e=>{const t=Ae(),n=Tr();return j({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:lt(t,e.minDate,n.minDate),maxDate:lt(t,e.maxDate,n.maxDate)})},MS=e=>{const t=kS(e),{forwardedProps:n,internalProps:r}=PS(t,"date");return vS({forwardedProps:n,internalProps:r,valueManager:Dt,fieldValueManager:Mg,validator:Dr,valueType:"date"})};function TS(e){return ge("MuiPickersTextField",e)}me("MuiPickersTextField",["root","focused","disabled","error","required"]);function DS(e){return ge("MuiPickersInputBase",e)}const En=me("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function RS(e){return ge("MuiPickersSectionList",e)}const Xn=me("MuiPickersSectionList",["root","section","sectionContent"]),IS=["slots","slotProps","elements","sectionListRef"],vu=U("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),xu=U("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),Su=U("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),wu=U("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),ES=e=>{const{classes:t}=e;return he({root:["root"],section:["section"],sectionContent:["sectionContent"]},RS,t)};function OS(e){const{slots:t,slotProps:n,element:r,classes:o}=e,s=t?.section??xu,i=Ce({elementType:s,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),a=t?.sectionContent??wu,l=Ce({elementType:a,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),c=t?.sectionSeparator??Su,u=Ce({elementType:c,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),m=Ce({elementType:c,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return g.jsxs(s,j({},i,{children:[g.jsx(c,j({},u)),g.jsx(a,j({},l)),g.jsx(c,j({},m))]}))}const $S=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersSectionList"}),{slots:o,slotProps:s,elements:i,sectionListRef:a}=r,l=ve(r,IS),c=ES(r),u=v.useRef(null),m=Pe(n,u),f=p=>{if(!u.current)throw new Error(`MUI X: Cannot call sectionListRef.${p} before the mount of the component.`);return u.current};v.useImperativeHandle(a,()=>({getRoot(){return f("getRoot")},getSectionContainer(p){return f("getSectionContainer").querySelector(`.${Xn.section}[data-sectionindex="${p}"]`)},getSectionContent(p){return f("getSectionContent").querySelector(`.${Xn.section}[data-sectionindex="${p}"] .${Xn.sectionContent}`)},getSectionIndexFromDOMElement(p){const h=f("getSectionIndexFromDOMElement");if(p==null||!h.contains(p))return null;let S=null;return p.classList.contains(Xn.section)?S=p:p.classList.contains(Xn.sectionContent)&&(S=p.parentElement),S==null?null:Number(S.dataset.sectionindex)}}));const b=o?.root??vu,d=Ce({elementType:b,externalSlotProps:s?.root,externalForwardedProps:l,additionalProps:{ref:m,suppressContentEditableWarning:!0},className:c.root,ownerState:{}});return g.jsx(b,j({},d,{children:d.contentEditable?i.map(({content:p,before:h,after:S})=>`${h.children}${p.children}${S.children}`).join(""):g.jsx(v.Fragment,{children:i.map((p,h)=>g.jsx(OS,{slots:o,slotProps:s,element:p,classes:c},h))})}))}),AS=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],FS=e=>Math.round(e*1e5)/1e5,zo=U("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>j({},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:`${FS(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),vi=U(vu,{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}}]})),LS=U(xu,{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"})),NS=U(wu,{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"})),jS=U(Su,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),BS=U("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(j({},eg)),VS=e=>{const{focused:t,disabled:n,error:r,classes:o,fullWidth:s,readOnly:i,color:a,size:l,endAdornment:c,startAdornment:u}=e,m={root:["root",t&&!n&&"focused",n&&"disabled",i&&"readOnly",r&&"error",s&&"fullWidth",`color${le(a)}`,l==="small"&&"inputSizeSmall",!!u&&"adornedStart",!!c&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return he(m,DS,o)},xi=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersInputBase"}),{elements:o,areAllSectionsEmpty:s,value:i,onChange:a,id:l,endAdornment:c,startAdornment:u,renderSuffix:m,slots:f,slotProps:b,contentEditable:d,tabIndex:p,onInput:h,onPaste:S,onKeyDown:C,name:w,readOnly:x,inputProps:T,inputRef:k,sectionListRef:O}=r,I=ve(r,AS),N=v.useRef(null),L=Pe(n,N),R=Pe(T?.ref,k),y=vt(),E=ft();if(!E)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const D=V=>{if(E.disabled){V.stopPropagation();return}E.onFocus?.(V)};v.useEffect(()=>{E&&E.setAdornedStart(!!u)},[E,u]),v.useEffect(()=>{E&&(s?E.onEmpty():E.onFilled())},[E,s]);const P=j({},r,E,{isRtl:y}),M=VS(P),A=f?.root||zo,$=Ce({elementType:A,externalSlotProps:b?.root,externalForwardedProps:I,additionalProps:{"aria-invalid":E.error,ref:L},className:M.root,ownerState:P}),F=f?.input||vi;return g.jsxs(A,j({},$,{children:[u,g.jsx($S,{sectionListRef:O,elements:o,contentEditable:d,tabIndex:p,className:M.sectionsContainer,onFocus:D,onBlur:E.onBlur,onInput:h,onPaste:S,onKeyDown:C,slots:{root:F,section:LS,sectionContent:NS,sectionSeparator:jS},slotProps:{root:{ownerState:P},sectionContent:{className:En.sectionContent},sectionSeparator:({position:V})=>({className:V==="before"?En.sectionBefore:En.sectionAfter})}}),c,m?m(j({},E)):null,g.jsx(BS,j({name:w,className:M.input,value:i,onChange:a,id:l,"aria-hidden":"true",tabIndex:-1,readOnly:x,required:E.required,disabled:E.disabled},T,{ref:R}))]}))});function zS(e){return ge("MuiPickersOutlinedInput",e)}const yt=j({},En,me("MuiPickersOutlinedInput",["root","notchedOutline","input"])),_S=["children","className","label","notched","shrink"],WS=U("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}}),cl=U("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),HS=U("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 US(e){const{className:t,label:n}=e,r=ve(e,_S),o=n!=null&&n!=="",s=j({},e,{withLabel:o});return g.jsx(WS,j({"aria-hidden":!0,className:t},r,{ownerState:s,children:g.jsx(HS,{ownerState:s,children:o?g.jsx(cl,{children:n}):g.jsx(cl,{className:"notranslate",children:"​"})})}))}const YS=["label","autoFocus","ownerState","notched"],GS=U(zo,{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 .${yt.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${yt.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${yt.focused} .${yt.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${yt.disabled}`]:{[`& .${yt.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${yt.error} .${yt.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:{[`&.${yt.focused}:not(.${yt.error}) .${yt.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),KS=U(vi,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),qS=e=>{const{classes:t}=e,r=he({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},zS,t);return j({},t,r)},Cu=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersOutlinedInput"}),{label:o,ownerState:s,notched:i}=r,a=ve(r,YS),l=ft(),c=j({},r,s,l,{color:l?.color||"primary"}),u=qS(c);return g.jsx(xi,j({slots:{root:GS,input:KS},renderSuffix:m=>g.jsx(US,{shrink:!!(i||m.adornedStart||m.focused||m.filled),notched:!!(i||m.adornedStart||m.focused||m.filled),className:u.notchedOutline,label:o!=null&&o!==""&&l?.required?g.jsxs(v.Fragment,{children:[o," ","*"]}):o,ownerState:c})},a,{label:o,classes:u,ref:n}))});Cu.muiName="Input";function XS(e){return ge("MuiPickersFilledInput",e)}const Zt=j({},En,me("MuiPickersFilledInput",["root","underline","input"])),QS=["label","autoFocus","disableUnderline","ownerState"],ZS=U(zo,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>We.shouldForwardProp(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)",s=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}},[`&.${Zt.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${Zt.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:s},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"},[`&.${Zt.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Zt.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(.${Zt.disabled}, .${Zt.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${Zt.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:i})=>!!i,style:{paddingLeft:12}},{props:({endAdornment:i})=>!!i,style:{paddingRight:12}}]}}),JS=U(vi,{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}}]}),ew=e=>{const{classes:t,disableUnderline:n}=e,o=he({root:["root",!n&&"underline"],input:["input"]},XS,t);return j({},t,o)},Pu=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersFilledInput"}),{label:o,disableUnderline:s=!1,ownerState:i}=r,a=ve(r,QS),l=ft(),c=j({},r,i,l,{color:l?.color||"primary"}),u=ew(c);return g.jsx(xi,j({slots:{root:ZS,input:JS},slotProps:{root:{disableUnderline:s}}},a,{label:o,classes:u,ref:n}))});Pu.muiName="Input";function tw(e){return ge("MuiPickersFilledInput",e)}const Qn=j({},En,me("MuiPickersInput",["root","input"])),nw=["label","autoFocus","disableUnderline","ownerState"],rw=U(zo,{name:"MuiPickersInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let n=e.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(n=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(r=>(e.vars??e).palette[r].main).map(r=>({props:{color:r},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[r].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"},[`&.${Qn.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Qn.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${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(.${Qn.disabled}, .${Qn.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${n}`}},[`&.${Qn.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),ow=e=>{const{classes:t,disableUnderline:n}=e,o=he({root:["root",!n&&"underline"],input:["input"]},tw,t);return j({},t,o)},ku=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersInput"}),{label:o,disableUnderline:s=!1,ownerState:i}=r,a=ve(r,nw),l=ft(),c=j({},r,i,l,{disableUnderline:s,color:l?.color||"primary"}),u=ow(c);return g.jsx(xi,j({slots:{root:rw}},a,{label:o,classes:u,ref:n}))});ku.muiName="Input";const sw=["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"],iw={standard:ku,filled:Pu,outlined:Cu},aw=U(hi,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),lw=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return he({root:["root",t&&!n&&"focused",n&&"disabled",o&&"required"]},TS,r)},cw=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersTextField"}),{onFocus:o,onBlur:s,className:i,color:a="primary",disabled:l=!1,error:c=!1,variant:u="outlined",required:m=!1,InputProps:f,inputProps:b,inputRef:d,sectionListRef:p,elements:h,areAllSectionsEmpty:S,onClick:C,onKeyDown:w,onKeyUp:x,onPaste:T,onInput:k,endAdornment:O,startAdornment:I,tabIndex:N,contentEditable:L,focused:R,value:y,onChange:E,fullWidth:D,id:P,name:M,helperText:A,FormHelperTextProps:$,label:F,InputLabelProps:V}=r,q=ve(r,sw),re=v.useRef(null),ae=Pe(n,re),ie=xt(P),z=A&&ie?`${ie}-helper-text`:void 0,Z=F&&ie?`${ie}-label`:void 0,X=j({},r,{color:a,disabled:l,error:c,focused:R,required:m,variant:u}),Y=lw(X),W=iw[u];return g.jsxs(aw,j({className:de(Y.root,i),ref:ae,focused:R,onFocus:o,onBlur:s,disabled:l,variant:u,error:c,color:a,fullWidth:D,required:m,ownerState:X},q,{children:[g.jsx(mi,j({htmlFor:ie,id:Z},V,{children:F})),g.jsx(W,j({elements:h,areAllSectionsEmpty:S,onClick:C,onKeyDown:w,onKeyUp:x,onInput:k,onPaste:T,endAdornment:O,startAdornment:I,tabIndex:N,contentEditable:L,value:y,onChange:E,id:ie,fullWidth:D,inputProps:b,inputRef:d,sectionListRef:p,label:F,name:M,role:"group","aria-labelledby":Z,"aria-describedby":z,"aria-live":z?"polite":void 0},f)),A&&g.jsx(cu,j({id:z},$,{children:A}))]}))}),uw=["enableAccessibleFieldDOMStructure"],dw=["InputProps","readOnly"],pw=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],fw=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=ve(e,uw);if(t){const{InputProps:m,readOnly:f}=n,b=ve(n,dw);return j({},b,{InputProps:j({},m??{},{readOnly:f})})}const{onPaste:r,onKeyDown:o,inputMode:s,readOnly:i,InputProps:a,inputProps:l,inputRef:c}=n,u=ve(n,pw);return j({},u,{InputProps:j({},a??{},{readOnly:i}),inputProps:j({},l??{},{inputMode:s,onPaste:r,onKeyDown:o,ref:c})})},mw=["slots","slotProps","InputProps","inputProps"],Mu=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiDateField"}),{slots:o,slotProps:s,InputProps:i,inputProps:a}=r,l=ve(r,mw),c=r,u=o?.textField??(t.enableAccessibleFieldDOMStructure?cw:bu),m=Ce({elementType:u,externalSlotProps:s?.textField,externalForwardedProps:l,additionalProps:{ref:n},ownerState:c});m.inputProps=j({},a,m.inputProps),m.InputProps=j({},i,m.InputProps);const f=MS(m),b=fw(f),d=wS(j({},b,{slots:o,slotProps:s}));return g.jsx(u,j({},d))}),Tu=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:s,disablePast:i,timezone:a})=>{const l=mn();return v.useCallback(c=>Dr({adapter:l,value:c,timezone:a,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:s,disablePast:i}})!==null,[l,e,t,n,r,o,s,i,a])},hw=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return j({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const s=o.newTimezone;if(n.getTimezone(r.currentMonth)===s)return r;let i=n.setTimezone(r.currentMonth,s);return n.getMonth(i)!==n.getMonth(r.currentMonth)&&(i=n.setMonth(i,n.getMonth(r.currentMonth))),j({},r,{currentMonth:i})}case"finishMonthSwitchingAnimation":return j({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const s=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return j({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:s&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:s?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},gw=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:s=!1,maxDate:i,minDate:a,onMonthChange:l,reduceAnimations:c,shouldDisableDate:u,timezone:m}=e,f=Ae(),b=v.useRef(hw(!!c,s,f)).current,d=v.useMemo(()=>Dt.getInitialReferenceValue({value:t,utils:f,timezone:m,props:e,referenceDate:n,granularity:Pt.day}),[n,m]),[p,h]=v.useReducer(b,{isMonthSwitchingAnimating:!1,focusedDay:d,currentMonth:f.startOfMonth(d),slideDirection:"left"});v.useEffect(()=>{h({type:"changeMonthTimezone",newTimezone:f.getTimezone(d)})},[d,f]);const S=v.useCallback(k=>{h(j({type:"changeMonth"},k)),l&&l(k.newMonth)},[l]),C=v.useCallback(k=>{const O=k;f.isSameMonth(O,p.currentMonth)||S({newMonth:f.startOfMonth(O),direction:f.isAfterDay(O,p.currentMonth)?"left":"right"})},[p.currentMonth,S,f]),w=Tu({shouldDisableDate:u,minDate:a,maxDate:i,disableFuture:r,disablePast:o,timezone:m}),x=v.useCallback(()=>{h({type:"finishMonthSwitchingAnimation"})},[]),T=ue((k,O)=>{w(k)||h({type:"changeFocusedDay",focusedDay:k,withoutMonthSwitchingAnimation:O})});return{referenceDate:d,calendarState:p,changeMonth:C,changeFocusedDay:T,isDateDisabled:w,onMonthSwitchingAnimationEnd:x,handleChangeMonth:S}},yw=e=>ge("MuiPickersFadeTransitionGroup",e);me("MuiPickersFadeTransitionGroup",["root"]);const bw=e=>{const{classes:t}=e;return he({root:["root"]},yw,t)},vw=U(Rr,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function Du(e){const t=$e({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:s}=t,i=bw(t),a=fn();return o?n:g.jsx(vw,{className:de(i.root,r),children:g.jsx(un,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:a.transitions.duration.enteringScreen,enter:a.transitions.duration.enteringScreen,exit:0},children:n},s)})}function xw(e){return ge("MuiPickersDay",e)}const Jt=me("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),Sw=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],ww=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:s,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:a,classes:l}=e,c=i&&!a;return he({root:["root",t&&!c&&"selected",s&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",i&&a&&"dayOutsideMonth",c&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},xw,l)},Ru=({theme:e})=>j({},e.typography.caption,{width:vr,height:vr,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})`:We.alpha(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:We.alpha(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${Jt.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${Jt.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}},[`&.${Jt.disabled}:not(.${Jt.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${Jt.disabled}&.${Jt.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${Fo}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${Jt.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),Iu=(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]},Cw=U(Fn,{name:"MuiPickersDay",slot:"Root",overridesResolver:Iu})(Ru),Pw=U("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:Iu})(({theme:e})=>j({},Ru({theme:e}),{opacity:0,pointerEvents:"none"})),Zn=()=>{},kw=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiPickersDay"}),{autoFocus:o=!1,className:s,day:i,disabled:a=!1,disableHighlightToday:l=!1,disableMargin:c=!1,isAnimating:u,onClick:m,onDaySelect:f,onFocus:b=Zn,onBlur:d=Zn,onKeyDown:p=Zn,onMouseDown:h=Zn,onMouseEnter:S=Zn,outsideCurrentMonth:C,selected:w=!1,showDaysOutsideCurrentMonth:x=!1,children:T,today:k=!1}=r,O=ve(r,Sw),I=j({},r,{autoFocus:o,disabled:a,disableHighlightToday:l,disableMargin:c,selected:w,showDaysOutsideCurrentMonth:x,today:k}),N=ww(I),L=Ae(),R=v.useRef(null),y=Pe(R,n);He(()=>{o&&!a&&!u&&!C&&R.current.focus()},[o,a,u,C]);const E=P=>{h(P),C&&P.preventDefault()},D=P=>{a||f(i),C&&P.currentTarget.focus(),m&&m(P)};return C&&!x?g.jsx(Pw,{className:de(N.root,N.hiddenDaySpacingFiller,s),ownerState:I,role:O.role}):g.jsx(Cw,j({className:de(N.root,s),ref:y,centerRipple:!0,disabled:a,tabIndex:w?0:-1,onKeyDown:P=>p(P,i),onFocus:P=>b(P,i),onBlur:P=>d(P,i),onMouseEnter:P=>S(P,i),onClick:D,onMouseDown:E},O,{ownerState:I,children:T||L.format(i,"dayOfMonth")}))}),Mw=v.memo(kw),Tw=e=>ge("MuiPickersSlideTransition",e),ot=me("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Dw=["children","className","reduceAnimations","slideDirection","transKey","classes"],Rw=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return he(r,Tw,t)},Iw=U(Rr,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${ot["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${ot["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${ot.slideEnterActive}`]:t.slideEnterActive},{[`.${ot.slideExit}`]:t.slideExit},{[`.${ot["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${ot["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},[`& .${ot["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${ot["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${ot.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${ot.slideExit}`]:{transform:"translate(0%)"},[`& .${ot["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${ot["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function Ew(e){const t=$e({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:s}=t,i=ve(t,Dw),a=Rw(t),l=fn();if(o)return g.jsx("div",{className:de(a.root,r),children:n});const c={exit:a.exit,enterActive:a.enterActive,enter:a.enter,exitActive:a.exitActive};return g.jsx(Iw,{className:de(a.root,r),childFactory:u=>v.cloneElement(u,{classNames:c}),role:"presentation",children:g.jsx(Qs,j({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:c},i,{children:n}),s)})}const Ow=e=>ge("MuiDayCalendar",e);me("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const $w=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Aw=["ownerState"],Fw=e=>{const{classes:t}=e;return he({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Ow,t)},Eu=(vr+Fo*2)*6,Lw=U("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Nw=U("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),jw=U(Gt,{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})),Bw=U(Gt,{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})),Vw=U(Gt,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>j({},e.typography.caption,{width:vr,height:vr,padding:0,margin:`0 ${Fo}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),zw=U("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:Eu}),_w=U(Ew,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:Eu}),Ww=U("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),Hw=U("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${Fo}px 0`,display:"flex",justifyContent:"center"});function Uw(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:s,currentMonthNumber:i,isViewFocused:a}=e,l=ve(e,$w);const{disabled:c,disableHighlightToday:u,isMonthSwitchingAnimating:m,showDaysOutsideCurrentMonth:f,slots:b,slotProps:d,timezone:p}=t,h=Ae(),S=Oo(p),C=r!==null&&h.isSameDay(n,r),w=o.some(y=>h.isSameDay(y,n)),x=h.isSameDay(n,S),T=b?.day??Mw,k=Ce({elementType:T,externalSlotProps:d?.day,additionalProps:j({disableHighlightToday:u,showDaysOutsideCurrentMonth:f,role:"gridcell",isAnimating:m,"data-timestamp":h.toJsDate(n).valueOf()},l),ownerState:j({},t,{day:n,selected:w})}),O=ve(k,Aw),I=v.useMemo(()=>c||s(n),[c,s,n]),N=v.useMemo(()=>h.getMonth(n)!==i,[h,n,i]),L=v.useMemo(()=>{const y=h.startOfMonth(h.setMonth(n,i));return f?h.isSameDay(n,h.startOfWeek(y)):h.isSameDay(n,y)},[i,n,f,h]),R=v.useMemo(()=>{const y=h.endOfMonth(h.setMonth(n,i));return f?h.isSameDay(n,h.endOfWeek(y)):h.isSameDay(n,y)},[i,n,f,h]);return g.jsx(T,j({},O,{day:n,disabled:I,autoFocus:a&&C,today:x,outsideCurrentMonth:N,isFirstVisibleCell:L,isLastVisibleCell:R,selected:w,tabIndex:C?0:-1,"aria-selected":w,"aria-current":x?"date":void 0}))}function Yw(e){const t=$e({props:e,name:"MuiDayCalendar"}),n=Ae(),{onFocusedDayChange:r,className:o,currentMonth:s,selectedDays:i,focusedDay:a,loading:l,onSelectedDaysChange:c,onMonthSwitchingAnimationEnd:u,readOnly:m,reduceAnimations:f,renderLoading:b=()=>g.jsx("span",{children:"..."}),slideDirection:d,TransitionProps:p,disablePast:h,disableFuture:S,minDate:C,maxDate:w,shouldDisableDate:x,shouldDisableMonth:T,shouldDisableYear:k,dayOfWeekFormatter:O=te=>n.format(te,"weekdayShort").charAt(0).toUpperCase(),hasFocus:I,onFocusedViewChange:N,gridLabelId:L,displayWeekNumber:R,fixedWeekNumber:y,autoFocus:E,timezone:D}=t,P=Oo(D),M=Fw(t),A=vt(),$=Tu({shouldDisableDate:x,shouldDisableMonth:T,shouldDisableYear:k,minDate:C,maxDate:w,disablePast:h,disableFuture:S,timezone:D}),F=Nt(),[V,q]=Tt({name:"DayCalendar",state:"hasFocus",controlled:I,default:E??!1}),[re,ae]=v.useState(()=>a||P),ie=ue(te=>{m||c(te)}),z=te=>{$(te)||(r(te),ae(te),N?.(!0),q(!0))},Z=ue((te,ce)=>{switch(te.key){case"ArrowUp":z(n.addDays(ce,-7)),te.preventDefault();break;case"ArrowDown":z(n.addDays(ce,7)),te.preventDefault();break;case"ArrowLeft":{const se=n.addDays(ce,A?1:-1),fe=n.addMonths(ce,A?1:-1),be=ar({utils:n,date:se,minDate:A?se:n.startOfMonth(fe),maxDate:A?n.endOfMonth(fe):se,isDateDisabled:$,timezone:D});z(be||se),te.preventDefault();break}case"ArrowRight":{const se=n.addDays(ce,A?-1:1),fe=n.addMonths(ce,A?-1:1),be=ar({utils:n,date:se,minDate:A?n.startOfMonth(fe):se,maxDate:A?se:n.endOfMonth(fe),isDateDisabled:$,timezone:D});z(be||se),te.preventDefault();break}case"Home":z(n.startOfWeek(ce)),te.preventDefault();break;case"End":z(n.endOfWeek(ce)),te.preventDefault();break;case"PageUp":z(n.addMonths(ce,1)),te.preventDefault();break;case"PageDown":z(n.addMonths(ce,-1)),te.preventDefault();break}}),X=ue((te,ce)=>z(ce)),Y=ue((te,ce)=>{V&&n.isSameDay(re,ce)&&N?.(!1)}),W=n.getMonth(s),G=n.getYear(s),ee=v.useMemo(()=>i.filter(te=>!!te).map(te=>n.startOfDay(te)),[n,i]),J=`${G}-${W}`,B=v.useMemo(()=>v.createRef(),[J]),K=v.useMemo(()=>{const te=n.startOfMonth(s),ce=n.endOfMonth(s);return $(re)||n.isAfterDay(re,ce)||n.isBeforeDay(re,te)?ar({utils:n,date:re,minDate:te,maxDate:ce,disablePast:h,disableFuture:S,isDateDisabled:$,timezone:D}):re},[s,S,h,re,$,n,D]),oe=v.useMemo(()=>{const te=n.getWeekArray(s);let ce=n.addMonths(s,1);for(;y&&te.length<y;){const se=n.getWeekArray(ce),fe=n.isSameDay(te[te.length-1][0],se[0][0]);se.slice(fe?1:0).forEach(be=>{te.length<y&&te.push(be)}),ce=n.addMonths(ce,1)}return te},[s,y,n]);return g.jsxs(Lw,{role:"grid","aria-labelledby":L,className:M.root,children:[g.jsxs(Nw,{role:"row",className:M.header,children:[R&&g.jsx(Bw,{variant:"caption",role:"columnheader","aria-label":F.calendarWeekNumberHeaderLabel,className:M.weekNumberLabel,children:F.calendarWeekNumberHeaderText}),sg(n,P).map((te,ce)=>g.jsx(jw,{variant:"caption",role:"columnheader","aria-label":n.format(te,"weekday"),className:M.weekDayLabel,children:O(te)},ce.toString()))]}),l?g.jsx(zw,{className:M.loadingContainer,children:b()}):g.jsx(_w,j({transKey:J,onExited:u,reduceAnimations:f,slideDirection:d,className:de(o,M.slideTransition)},p,{nodeRef:B,children:g.jsx(Ww,{ref:B,role:"rowgroup",className:M.monthContainer,children:oe.map((te,ce)=>g.jsxs(Hw,{role:"row",className:M.weekContainer,"aria-rowindex":ce+1,children:[R&&g.jsx(Vw,{className:M.weekNumber,role:"rowheader","aria-label":F.calendarWeekNumberAriaLabelText(n.getWeekNumber(te[0])),children:F.calendarWeekNumberText(n.getWeekNumber(te[0]))}),te.map((se,fe)=>g.jsx(Uw,{parentProps:t,day:se,selectedDays:ee,focusableDay:K,onKeyDown:Z,onFocus:X,onBlur:Y,onDaySelect:ie,isDateDisabled:$,currentMonthNumber:W,isViewFocused:V,"aria-colindex":fe+1},se.toString()))]},`week-${te[0]}`))})}))]})}function Gw(e){return ge("MuiPickersMonth",e)}const Vr=me("MuiPickersMonth",["root","monthButton","disabled","selected"]),Kw=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],qw=e=>{const{disabled:t,selected:n,classes:r}=e;return he({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},Gw,r)},Xw=U("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%"}}]}),Qw=U("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Vr.disabled}`]:t.disabled},{[`&.${Vr.selected}`]:t.selected}]})(({theme:e})=>j({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})`:We.alpha(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:We.alpha(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Vr.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Vr.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Zw=v.memo(function(t){const n=$e({props:t,name:"MuiPickersMonth"}),{autoFocus:r,className:o,children:s,disabled:i,selected:a,value:l,tabIndex:c,onClick:u,onKeyDown:m,onFocus:f,onBlur:b,"aria-current":d,"aria-label":p,slots:h,slotProps:S}=n,C=ve(n,Kw),w=v.useRef(null),x=qw(n);He(()=>{r&&w.current?.focus()},[r]);const T=h?.monthButton??Qw,k=Ce({elementType:T,externalSlotProps:S?.monthButton,additionalProps:{children:s,disabled:i,tabIndex:c,ref:w,type:"button",role:"radio","aria-current":d,"aria-checked":a,"aria-label":p,onClick:O=>u(O,l),onKeyDown:O=>m(O,l),onFocus:O=>f(O,l),onBlur:O=>b(O,l)},ownerState:n,className:x.monthButton});return g.jsx(Xw,j({className:de(x.root,o),ownerState:n},C,{children:g.jsx(T,j({},k))}))});function Jw(e){return ge("MuiMonthCalendar",e)}me("MuiMonthCalendar",["root"]);const eC=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],tC=e=>{const{classes:t}=e;return he({root:["root"]},Jw,t)};function nC(e,t){const n=Ae(),r=Tr(),o=$e({props:e,name:t});return j({disableFuture:!1,disablePast:!1},o,{minDate:lt(n,o.minDate,r.minDate),maxDate:lt(n,o.maxDate,r.maxDate)})}const rC=U("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:Lo,boxSizing:"border-box"}),oC=v.forwardRef(function(t,n){const r=nC(t,"MuiMonthCalendar"),{className:o,value:s,defaultValue:i,referenceDate:a,disabled:l,disableFuture:c,disablePast:u,maxDate:m,minDate:f,onChange:b,shouldDisableMonth:d,readOnly:p,autoFocus:h=!1,onMonthFocus:S,hasFocus:C,onFocusedViewChange:w,monthsPerRow:x=3,timezone:T,gridLabelId:k,slots:O,slotProps:I}=r,N=ve(r,eC),{value:L,handleValueChange:R,timezone:y}=li({name:"MonthCalendar",timezone:T,value:s,defaultValue:i,referenceDate:a,onChange:b,valueManager:Dt}),E=Oo(y),D=vt(),P=Ae(),M=v.useMemo(()=>Dt.getInitialReferenceValue({value:L,utils:P,props:r,timezone:y,referenceDate:a,granularity:Pt.month}),[]),A=r,$=tC(A),F=v.useMemo(()=>P.getMonth(E),[P,E]),V=v.useMemo(()=>L!=null?P.getMonth(L):null,[L,P]),[q,re]=v.useState(()=>V||P.getMonth(M)),[ae,ie]=Tt({name:"MonthCalendar",state:"hasFocus",controlled:C,default:h??!1}),z=ue(J=>{ie(J),w&&w(J)}),Z=v.useCallback(J=>{const B=P.startOfMonth(u&&P.isAfter(E,f)?E:f),K=P.startOfMonth(c&&P.isBefore(E,m)?E:m),oe=P.startOfMonth(J);return P.isBefore(oe,B)||P.isAfter(oe,K)?!0:d?d(oe):!1},[c,u,m,f,E,d,P]),X=ue((J,B)=>{if(p)return;const K=P.setMonth(L??M,B);R(K)}),Y=ue(J=>{Z(P.setMonth(L??M,J))||(re(J),z(!0),S&&S(J))});v.useEffect(()=>{re(J=>V!==null&&J!==V?V:J)},[V]);const W=ue((J,B)=>{switch(J.key){case"ArrowUp":Y((12+B-3)%12),J.preventDefault();break;case"ArrowDown":Y((12+B+3)%12),J.preventDefault();break;case"ArrowLeft":Y((12+B+(D?1:-1))%12),J.preventDefault();break;case"ArrowRight":Y((12+B+(D?-1:1))%12),J.preventDefault();break}}),G=ue((J,B)=>{Y(B)}),ee=ue((J,B)=>{q===B&&z(!1)});return g.jsx(rC,j({ref:n,className:de($.root,o),ownerState:A,role:"radiogroup","aria-labelledby":k},N,{children:Ys(P,L??M).map(J=>{const B=P.getMonth(J),K=P.format(J,"monthShort"),oe=P.format(J,"month"),te=B===V,ce=l||Z(J);return g.jsx(Zw,{selected:te,value:B,onClick:X,onKeyDown:W,autoFocus:ae&&B===q,disabled:ce,tabIndex:B===q&&!ce?0:-1,onFocus:G,onBlur:ee,"aria-current":F===B?"date":void 0,"aria-label":oe,monthsPerRow:x,slots:O,slotProps:I,children:K},K)})}))});function sC(e){return ge("MuiPickersYear",e)}const zr=me("MuiPickersYear",["root","yearButton","selected","disabled"]),iC=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],aC=e=>{const{disabled:t,selected:n,classes:r}=e;return he({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},sC,r)},lC=U("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%"}}]}),cC=U("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${zr.disabled}`]:t.disabled},{[`&.${zr.selected}`]:t.selected}]})(({theme:e})=>j({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})`:We.alpha(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:We.alpha(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${zr.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${zr.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),uC=v.memo(function(t){const n=$e({props:t,name:"MuiPickersYear"}),{autoFocus:r,className:o,children:s,disabled:i,selected:a,value:l,tabIndex:c,onClick:u,onKeyDown:m,onFocus:f,onBlur:b,"aria-current":d,slots:p,slotProps:h}=n,S=ve(n,iC),C=v.useRef(null),w=aC(n);He(()=>{r&&C.current?.focus()},[r]);const x=p?.yearButton??cC,T=Ce({elementType:x,externalSlotProps:h?.yearButton,additionalProps:{children:s,disabled:i,tabIndex:c,ref:C,type:"button",role:"radio","aria-current":d,"aria-checked":a,onClick:k=>u(k,l),onKeyDown:k=>m(k,l),onFocus:k=>f(k,l),onBlur:k=>b(k,l)},ownerState:n,className:w.yearButton});return g.jsx(lC,j({className:de(w.root,o),ownerState:n},S,{children:g.jsx(x,j({},T))}))});function dC(e){return ge("MuiYearCalendar",e)}me("MuiYearCalendar",["root"]);const pC=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],fC=e=>{const{classes:t}=e;return he({root:["root"]},dC,t)};function mC(e,t){const n=Ae(),r=Tr(),o=$e({props:e,name:t});return j({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:lt(n,o.minDate,r.minDate),maxDate:lt(n,o.maxDate,r.maxDate)})}const hC=U("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:Lo,maxHeight:px,boxSizing:"border-box",position:"relative"}),gC=v.forwardRef(function(t,n){const r=mC(t,"MuiYearCalendar"),{autoFocus:o,className:s,value:i,defaultValue:a,referenceDate:l,disabled:c,disableFuture:u,disablePast:m,maxDate:f,minDate:b,onChange:d,readOnly:p,shouldDisableYear:h,onYearFocus:S,hasFocus:C,onFocusedViewChange:w,yearsOrder:x="asc",yearsPerRow:T,timezone:k,gridLabelId:O,slots:I,slotProps:N}=r,L=ve(r,pC),{value:R,handleValueChange:y,timezone:E}=li({name:"YearCalendar",timezone:k,value:i,defaultValue:a,referenceDate:l,onChange:d,valueManager:Dt}),D=Oo(E),P=vt(),M=Ae(),A=v.useMemo(()=>Dt.getInitialReferenceValue({value:R,utils:M,props:r,timezone:E,referenceDate:l,granularity:Pt.year}),[]),$=r,F=fC($),V=v.useMemo(()=>M.getYear(D),[M,D]),q=v.useMemo(()=>R!=null?M.getYear(R):null,[R,M]),[re,ae]=v.useState(()=>q||M.getYear(A)),[ie,z]=Tt({name:"YearCalendar",state:"hasFocus",controlled:C,default:o??!1}),Z=ue(se=>{z(se),w&&w(se)}),X=v.useCallback(se=>{if(m&&M.isBeforeYear(se,D)||u&&M.isAfterYear(se,D)||b&&M.isBeforeYear(se,b)||f&&M.isAfterYear(se,f))return!0;if(!h)return!1;const fe=M.startOfYear(se);return h(fe)},[u,m,f,b,D,h,M]),Y=ue((se,fe)=>{if(p)return;const be=M.setYear(R??A,fe);y(be)}),W=ue(se=>{X(M.setYear(R??A,se))||(ae(se),Z(!0),S?.(se))});v.useEffect(()=>{ae(se=>q!==null&&se!==q?q:se)},[q]);const G=x!=="desc"?T*1:T*-1,ee=P&&x==="asc"||!P&&x==="desc"?-1:1,J=ue((se,fe)=>{switch(se.key){case"ArrowUp":W(fe-G),se.preventDefault();break;case"ArrowDown":W(fe+G),se.preventDefault();break;case"ArrowLeft":W(fe-ee),se.preventDefault();break;case"ArrowRight":W(fe+ee),se.preventDefault();break}}),B=ue((se,fe)=>{W(fe)}),K=ue((se,fe)=>{re===fe&&Z(!1)}),oe=v.useRef(null),te=Pe(n,oe);v.useEffect(()=>{if(o||oe.current===null)return;const se=oe.current.querySelector('[tabindex="0"]');if(!se)return;const fe=se.offsetHeight,be=se.offsetTop,Se=oe.current.clientHeight,pe=oe.current.scrollTop,Ke=be+fe;fe>Se||be<pe||(oe.current.scrollTop=Ke-Se/2-fe/2)},[o]);const ce=M.getYearRange([b,f]);return x==="desc"&&ce.reverse(),g.jsx(hC,j({ref:te,className:de(F.root,s),ownerState:$,role:"radiogroup","aria-labelledby":O},L,{children:ce.map(se=>{const fe=M.getYear(se),be=fe===q,Se=c||X(se);return g.jsx(uC,{selected:be,value:fe,onClick:Y,onKeyDown:J,autoFocus:ie&&fe===re,disabled:Se,tabIndex:fe===re&&!Se?0:-1,onFocus:B,onBlur:K,"aria-current":V===fe?"date":void 0,yearsPerRow:T,slots:I,slotProps:N,children:M.format(se,"year")},M.format(se,"year"))})}))}),yC=e=>ge("MuiPickersCalendarHeader",e),bC=me("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function vC(e){return ge("MuiPickersArrowSwitcher",e)}me("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const xC=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],SC=["ownerState"],wC=["ownerState"],CC=U("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),PC=U("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),ul=U(Ir,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),kC=e=>{const{classes:t}=e;return he({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},vC,t)},MC=v.forwardRef(function(t,n){const r=vt(),o=$e({props:t,name:"MuiPickersArrowSwitcher"}),{children:s,className:i,slots:a,slotProps:l,isNextDisabled:c,isNextHidden:u,onGoToNext:m,nextLabel:f,isPreviousDisabled:b,isPreviousHidden:d,onGoToPrevious:p,previousLabel:h,labelId:S}=o,C=ve(o,xC),w=o,x=kC(w),T={isDisabled:c,isHidden:u,goTo:m,label:f},k={isDisabled:b,isHidden:d,goTo:p,label:h},O=a?.previousIconButton??ul,I=Ce({elementType:O,externalSlotProps:l?.previousIconButton,additionalProps:{size:"medium",title:k.label,"aria-label":k.label,disabled:k.isDisabled,edge:"end",onClick:k.goTo},ownerState:j({},w,{hidden:k.isHidden}),className:de(x.button,x.previousIconButton)}),N=a?.nextIconButton??ul,L=Ce({elementType:N,externalSlotProps:l?.nextIconButton,additionalProps:{size:"medium",title:T.label,"aria-label":T.label,disabled:T.isDisabled,edge:"start",onClick:T.goTo},ownerState:j({},w,{hidden:T.isHidden}),className:de(x.button,x.nextIconButton)}),R=a?.leftArrowIcon??Dx,y=Ce({elementType:R,externalSlotProps:l?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:w,className:x.leftArrowIcon}),E=ve(y,SC),D=a?.rightArrowIcon??Rx,P=Ce({elementType:D,externalSlotProps:l?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:w,className:x.rightArrowIcon}),M=ve(P,wC);return g.jsxs(CC,j({ref:n,className:de(x.root,i),ownerState:w},C,{children:[g.jsx(O,j({},I,{children:r?g.jsx(D,j({},M)):g.jsx(R,j({},E))})),s?g.jsx(Gt,{variant:"subtitle1",component:"span",id:S,children:s}):g.jsx(PC,{className:x.spacer,ownerState:w}),g.jsx(N,j({},L,{children:r?g.jsx(R,j({},E)):g.jsx(D,j({},M))}))]}))});function TC(e,{disableFuture:t,maxDate:n,timezone:r}){const o=Ae();return v.useMemo(()=>{const s=o.date(void 0,r),i=o.startOfMonth(t&&o.isBefore(s,n)?s:n);return!o.isAfter(i,e)},[t,n,e,o,r])}function DC(e,{disablePast:t,minDate:n,timezone:r}){const o=Ae();return v.useMemo(()=>{const s=o.date(void 0,r),i=o.startOfMonth(t&&o.isAfter(s,n)?s:n);return!o.isBefore(i,e)},[t,n,e,o,r])}const RC=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],IC=["ownerState"],EC=e=>{const{classes:t}=e;return he({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},yC,t)},OC=U("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}),$C=U("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>j({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),AC=U("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),FC=U(Ir,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${bC.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),LC=U(Tx,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),NC=v.forwardRef(function(t,n){const r=Nt(),o=Ae(),s=$e({props:t,name:"MuiPickersCalendarHeader"}),{slots:i,slotProps:a,currentMonth:l,disabled:c,disableFuture:u,disablePast:m,maxDate:f,minDate:b,onMonthChange:d,onViewChange:p,view:h,reduceAnimations:S,views:C,labelId:w,className:x,timezone:T,format:k=`${o.formats.month} ${o.formats.year}`}=s,O=ve(s,RC),I=s,N=EC(s),L=i?.switchViewButton??FC,R=Ce({elementType:L,externalSlotProps:a?.switchViewButton,additionalProps:{size:"small","aria-label":r.calendarViewSwitchingButtonAriaLabel(h)},ownerState:I,className:N.switchViewButton}),y=i?.switchViewIcon??LC,E=Ce({elementType:y,externalSlotProps:a?.switchViewIcon,ownerState:I,className:N.switchViewIcon}),D=ve(E,IC),P=()=>d(o.addMonths(l,1),"left"),M=()=>d(o.addMonths(l,-1),"right"),A=TC(l,{disableFuture:u,maxDate:f,timezone:T}),$=DC(l,{disablePast:m,minDate:b,timezone:T}),F=()=>{if(!(C.length===1||!p||c))if(C.length===2)p(C.find(q=>q!==h)||C[0]);else{const q=C.indexOf(h)!==0?0:1;p(C[q])}};if(C.length===1&&C[0]==="year")return null;const V=o.formatByString(l,k);return g.jsxs(OC,j({},O,{ownerState:I,className:de(N.root,x),ref:n,children:[g.jsxs($C,{role:"presentation",onClick:F,ownerState:I,"aria-live":"polite",className:N.labelContainer,children:[g.jsx(Du,{reduceAnimations:S,transKey:V,children:g.jsx(AC,{id:w,ownerState:I,className:N.label,children:V})}),C.length>1&&!c&&g.jsx(L,j({},R,{children:g.jsx(y,j({},D))}))]}),g.jsx(un,{in:h==="day",appear:!S,enter:!S,children:g.jsx(MC,{slots:i,slotProps:a,onGoToPrevious:M,isPreviousDisabled:$,previousLabel:r.previousMonth,onGoToNext:P,isNextDisabled:A,nextLabel:r.nextMonth})})]}))}),jC=U("div")({overflow:"hidden",width:Lo,maxHeight:ci,display:"flex",flexDirection:"column",margin:"0 auto"}),BC=e=>ge("MuiDateCalendar",e);me("MuiDateCalendar",["root","viewTransitionContainer"]);const VC=["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"],zC=e=>{const{classes:t}=e;return he({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},BC,t)};function _C(e,t){const n=Ae(),r=Tr(),o=Jc(),s=$e({props:e,name:t});return j({},s,{loading:s.loading??!1,disablePast:s.disablePast??!1,disableFuture:s.disableFuture??!1,openTo:s.openTo??"day",views:s.views??["year","day"],reduceAnimations:s.reduceAnimations??o,renderLoading:s.renderLoading??(()=>g.jsx("span",{children:"..."})),minDate:lt(n,s.minDate,r.minDate),maxDate:lt(n,s.maxDate,r.maxDate)})}const WC=U(jC,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:ci}),HC=U(Du,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),UC=v.forwardRef(function(t,n){const r=Ae(),o=xt(),s=_C(t,"MuiDateCalendar"),{autoFocus:i,onViewChange:a,value:l,defaultValue:c,referenceDate:u,disableFuture:m,disablePast:f,onChange:b,onYearChange:d,onMonthChange:p,reduceAnimations:h,shouldDisableDate:S,shouldDisableMonth:C,shouldDisableYear:w,view:x,views:T,openTo:k,className:O,disabled:I,readOnly:N,minDate:L,maxDate:R,disableHighlightToday:y,focusedView:E,onFocusedViewChange:D,showDaysOutsideCurrentMonth:P,fixedWeekNumber:M,dayOfWeekFormatter:A,slots:$,slotProps:F,loading:V,renderLoading:q,displayWeekNumber:re,yearsOrder:ae,yearsPerRow:ie,monthsPerRow:z,timezone:Z}=s,X=ve(s,VC),{value:Y,handleValueChange:W,timezone:G}=li({name:"DateCalendar",timezone:Z,value:l,defaultValue:c,referenceDate:u,onChange:b,valueManager:Dt}),{view:ee,setView:J,focusedView:B,setFocusedView:K,goToNextView:oe,setValueAndGoToNextView:te}=eu({view:x,views:T,openTo:k,onChange:W,onViewChange:a,autoFocus:i,focusedView:E,onFocusedViewChange:D}),{referenceDate:ce,calendarState:se,changeFocusedDay:fe,changeMonth:be,handleChangeMonth:Se,isDateDisabled:pe,onMonthSwitchingAnimationEnd:Ke}=gw({value:Y,referenceDate:u,reduceAnimations:h,onMonthChange:p,minDate:L,maxDate:R,shouldDisableDate:S,disablePast:f,disableFuture:m,timezone:G}),Ne=I&&Y||L,mt=I&&Y||R,ht=`${o}-grid-label`,nt=B!==null,rt=$?.calendarHeader??NC,jt=Ce({elementType:rt,externalSlotProps:F?.calendarHeader,additionalProps:{views:T,view:ee,currentMonth:se.currentMonth,onViewChange:J,onMonthChange:(Oe,wt)=>Se({newMonth:Oe,direction:wt}),minDate:Ne,maxDate:mt,disabled:I,disablePast:f,disableFuture:m,reduceAnimations:h,timezone:G,labelId:ht},ownerState:s}),gt=ue(Oe=>{const wt=r.startOfMonth(Oe),Wn=r.endOfMonth(Oe),_t=pe(Oe)?ar({utils:r,date:Oe,minDate:r.isBefore(L,wt)?wt:L,maxDate:r.isAfter(R,Wn)?Wn:R,disablePast:f,disableFuture:m,isDateDisabled:pe,timezone:G}):Oe;_t?(te(_t,"finish"),p?.(wt)):(oe(),be(wt)),fe(_t,!0)}),Ee=ue(Oe=>{const wt=r.startOfYear(Oe),Wn=r.endOfYear(Oe),_t=pe(Oe)?ar({utils:r,date:Oe,minDate:r.isBefore(L,wt)?wt:L,maxDate:r.isAfter(R,Wn)?Wn:R,disablePast:f,disableFuture:m,isDateDisabled:pe,timezone:G}):Oe;_t?(te(_t,"finish"),d?.(_t)):(oe(),be(wt)),fe(_t,!0)}),Bt=ue(Oe=>W(Oe&&lo(r,Oe,Y??ce),"finish",ee));v.useEffect(()=>{Y!=null&&r.isValid(Y)&&be(Y)},[Y]);const Vt=s,_n=zC(Vt),ye={disablePast:f,disableFuture:m,maxDate:R,minDate:L},ke={disableHighlightToday:y,readOnly:N,disabled:I,timezone:G,gridLabelId:ht,slots:$,slotProps:F},Ve=v.useRef(ee);v.useEffect(()=>{Ve.current!==ee&&(B===Ve.current&&K(ee,!0),Ve.current=ee)},[B,K,ee]);const zt=v.useMemo(()=>[Y],[Y]);return g.jsxs(WC,j({ref:n,className:de(_n.root,O),ownerState:Vt},X,{children:[g.jsx(rt,j({},jt,{slots:$,slotProps:F})),g.jsx(HC,{reduceAnimations:h,className:_n.viewTransitionContainer,transKey:ee,ownerState:Vt,children:g.jsxs("div",{children:[ee==="year"&&g.jsx(gC,j({},ye,ke,{value:Y,onChange:Ee,shouldDisableYear:w,hasFocus:nt,onFocusedViewChange:Oe=>K("year",Oe),yearsOrder:ae,yearsPerRow:ie,referenceDate:ce})),ee==="month"&&g.jsx(oC,j({},ye,ke,{hasFocus:nt,className:O,value:Y,onChange:gt,shouldDisableMonth:C,onFocusedViewChange:Oe=>K("month",Oe),monthsPerRow:z,referenceDate:ce})),ee==="day"&&g.jsx(Yw,j({},se,ye,ke,{onMonthSwitchingAnimationEnd:Ke,onFocusedDayChange:fe,reduceAnimations:h,selectedDays:zt,onSelectedDaysChange:Bt,shouldDisableDate:S,shouldDisableMonth:C,shouldDisableYear:w,hasFocus:nt,onFocusedViewChange:Oe=>K("day",Oe),showDaysOutsideCurrentMonth:P,fixedWeekNumber:M,dayOfWeekFormatter:A,displayWeekNumber:re,loading:V,renderLoading:q}))]})})]}))}),On=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:s,defaultValue:i,referenceDate:a,onChange:l,className:c,classes:u,disableFuture:m,disablePast:f,minDate:b,maxDate:d,shouldDisableDate:p,shouldDisableMonth:h,shouldDisableYear:S,reduceAnimations:C,onMonthChange:w,monthsPerRow:x,onYearChange:T,yearsOrder:k,yearsPerRow:O,slots:I,slotProps:N,loading:L,renderLoading:R,disableHighlightToday:y,readOnly:E,disabled:D,showDaysOutsideCurrentMonth:P,dayOfWeekFormatter:M,sx:A,autoFocus:$,fixedWeekNumber:F,displayWeekNumber:V,timezone:q})=>g.jsx(UC,{view:e,onViewChange:t,views:n.filter(va),focusedView:r&&va(r)?r:null,onFocusedViewChange:o,value:s,defaultValue:i,referenceDate:a,onChange:l,className:c,classes:u,disableFuture:m,disablePast:f,minDate:b,maxDate:d,shouldDisableDate:p,shouldDisableMonth:h,shouldDisableYear:S,reduceAnimations:C,onMonthChange:w,monthsPerRow:x,onYearChange:T,yearsOrder:k,yearsPerRow:O,slots:I,slotProps:N,loading:L,renderLoading:R,disableHighlightToday:y,readOnly:E,disabled:D,showDaysOutsideCurrentMonth:P,dayOfWeekFormatter:M,sx:A,autoFocus:$,fixedWeekNumber:F,displayWeekNumber:V,timezone:q}),Ou=v.forwardRef(function(t,n){const r=Nt(),o=Ae(),s=Ac(t,"MuiDesktopDatePicker"),i=j({day:On,month:On,year:On},s.viewRenderers),a=j({},s,{viewRenderers:i,format:Gs(o,s,!1),yearsPerRow:s.yearsPerRow??4,slots:j({openPickerIcon:Ix,field:Mu},s.slots),slotProps:j({},s.slotProps,{field:c=>j({},Io(s.slotProps?.field,c),Lc(s),{ref:n}),toolbar:j({hidden:!0},s.slotProps?.toolbar)})}),{renderPicker:l}=Mx({props:a,valueManager:Dt,valueType:"date",getOpenDialogAriaText:Oc({utils:o,formatKey:"fullDate",contextTranslation:r.openDatePickerDialogue,propsTranslation:a.localeText?.openDatePickerDialogue}),validator:Dr});return l()});Ou.propTypes={autoFocus:_.bool,className:_.string,closeOnSelect:_.bool,dayOfWeekFormatter:_.func,defaultValue:_.object,disabled:_.bool,disableFuture:_.bool,disableHighlightToday:_.bool,disableOpenPicker:_.bool,disablePast:_.bool,displayWeekNumber:_.bool,enableAccessibleFieldDOMStructure:_.any,fixedWeekNumber:_.number,format:_.string,formatDensity:_.oneOf(["dense","spacious"]),inputRef:Sc,label:_.node,loading:_.bool,localeText:_.object,maxDate:_.object,minDate:_.object,monthsPerRow:_.oneOf([3,4]),name:_.string,onAccept:_.func,onChange:_.func,onClose:_.func,onError:_.func,onMonthChange:_.func,onOpen:_.func,onSelectedSectionsChange:_.func,onViewChange:_.func,onYearChange:_.func,open:_.bool,openTo:_.oneOf(["day","month","year"]),orientation:_.oneOf(["landscape","portrait"]),readOnly:_.bool,reduceAnimations:_.bool,referenceDate:_.object,renderLoading:_.func,selectedSections:_.oneOfType([_.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),_.number]),shouldDisableDate:_.func,shouldDisableMonth:_.func,shouldDisableYear:_.func,showDaysOutsideCurrentMonth:_.bool,slotProps:_.object,slots:_.object,sx:_.oneOfType([_.arrayOf(_.oneOfType([_.func,_.object,_.bool])),_.func,_.object]),timezone:_.string,value:_.object,view:_.oneOf(["day","month","year"]),viewRenderers:_.shape({day:_.func,month:_.func,year:_.func}),views:_.arrayOf(_.oneOf(["day","month","year"]).isRequired),yearsOrder:_.oneOf(["asc","desc"]),yearsPerRow:_.oneOf([3,4])};function YC(e){return ge("MuiDialogContent",e)}me("MuiDialogContent",["root","dividers"]);const GC=me("MuiDialogTitle",["root"]),KC=e=>{const{classes:t,dividers:n}=e;return he({root:["root",n&&"dividers"]},YC,t)},qC=U("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Ie(({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:{[`.${GC.root} + &`]:{paddingTop:0}}}]}))),XC=v.forwardRef(function(t,n){const r=we({props:t,name:"MuiDialogContent"}),{className:o,dividers:s=!1,...i}=r,a={...r,dividers:s},l=KC(a);return g.jsx(qC,{className:de(l.root,o),ownerState:a,ref:n,...i})});function QC(e){return ge("MuiDialog",e)}const pr=me("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),ZC=v.createContext({}),JC=U(du,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),eP=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:s}=e,i={root:["root"],container:["container",`scroll${le(n)}`],paper:["paper",`paperScroll${le(n)}`,`paperWidth${le(String(r))}`,o&&"paperFullWidth",s&&"paperFullScreen"]};return he(i,QC,t)},tP=U(pu,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),nP=U("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${le(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"}}}]}),rP=U(Er,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${le(n.scroll)}`],t[`paperWidth${le(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Ie(({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)`,[`&.${pr.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}`,[`&.${pr.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,[`&.${pr.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),oP=v.forwardRef(function(t,n){const r=we({props:t,name:"MuiDialog"}),o=fn(),s={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{"aria-describedby":i,"aria-labelledby":a,"aria-modal":l=!0,BackdropComponent:c,BackdropProps:u,children:m,className:f,disableEscapeKeyDown:b=!1,fullScreen:d=!1,fullWidth:p=!1,maxWidth:h="sm",onClick:S,onClose:C,open:w,PaperComponent:x=Er,PaperProps:T={},scroll:k="paper",slots:O={},slotProps:I={},TransitionComponent:N=un,transitionDuration:L=s,TransitionProps:R,...y}=r,E={...r,disableEscapeKeyDown:b,fullScreen:d,fullWidth:p,maxWidth:h,scroll:k},D=eP(E),P=v.useRef(),M=B=>{P.current=B.target===B.currentTarget},A=B=>{S&&S(B),P.current&&(P.current=null,C&&C(B,"backdropClick"))},$=xt(a),F=v.useMemo(()=>({titleId:$}),[$]),V={transition:N,...O},q={transition:R,paper:T,backdrop:u,...I},re={slots:V,slotProps:q},[ae,ie]=Le("root",{elementType:tP,shouldForwardComponentProp:!0,externalForwardedProps:re,ownerState:E,className:de(D.root,f),ref:n}),[z,Z]=Le("backdrop",{elementType:JC,shouldForwardComponentProp:!0,externalForwardedProps:re,ownerState:E}),[X,Y]=Le("paper",{elementType:rP,shouldForwardComponentProp:!0,externalForwardedProps:re,ownerState:E,className:de(D.paper,T.className)}),[W,G]=Le("container",{elementType:nP,externalForwardedProps:re,ownerState:E,className:D.container}),[ee,J]=Le("transition",{elementType:un,externalForwardedProps:re,ownerState:E,additionalProps:{appear:!0,in:w,timeout:L,role:"presentation"}});return g.jsx(ae,{closeAfterTransition:!0,slots:{backdrop:z},slotProps:{backdrop:{transitionDuration:L,as:c,...Z}},disableEscapeKeyDown:b,onClose:C,open:w,onClick:A,...ie,...y,children:g.jsx(ee,{...J,children:g.jsx(W,{onMouseDown:M,...G,children:g.jsx(X,{as:x,elevation:24,role:"dialog","aria-describedby":i,"aria-labelledby":$,"aria-modal":l,...Y,children:g.jsx(ZC.Provider,{value:F,children:m})})})})})}),sP=U(oP)({[`& .${pr.container}`]:{outline:0},[`& .${pr.paper}`]:{outline:0,minWidth:Lo}}),iP=U(XC)({"&:first-of-type":{padding:0}});function aP(e){const{children:t,onDismiss:n,open:r,slots:o,slotProps:s}=e,i=o?.dialog??sP,a=o?.mobileTransition??un;return g.jsx(i,j({open:r,onClose:n},s?.dialog,{TransitionComponent:a,TransitionProps:s?.mobileTransition,PaperComponent:o?.mobilePaper,PaperProps:s?.mobilePaper,children:g.jsx(iP,{children:t})}))}const lP=["props","getOpenDialogAriaText"],cP=e=>{let{props:t,getOpenDialogAriaText:n}=e,r=ve(e,lP);const{slots:o,slotProps:s,className:i,sx:a,format:l,formatDensity:c,enableAccessibleFieldDOMStructure:u,selectedSections:m,onSelectedSectionsChange:f,timezone:b,name:d,label:p,inputRef:h,readOnly:S,disabled:C,localeText:w}=t,x=v.useRef(null),T=xt(),k=s?.toolbar?.hidden??!1,{open:O,actions:I,layoutProps:N,renderCurrentView:L,fieldProps:R,contextValue:y}=tu(j({},r,{props:t,fieldRef:x,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),E=o.field,D=Ce({elementType:E,externalSlotProps:s?.field,additionalProps:j({},R,k&&{id:T},!(C||S)&&{onClick:I.onOpen,onKeyDown:pv(I.onOpen)},{readOnly:S??!0,disabled:C,className:i,sx:a,format:l,formatDensity:c,enableAccessibleFieldDOMStructure:u,selectedSections:m,onSelectedSectionsChange:f,timezone:b,label:p,name:d},h?{inputRef:h}:{}),ownerState:t});D.inputProps=j({},D.inputProps,{"aria-label":n(R.value)});const P=j({textField:o.textField},D.slots),M=o.layout??au;let A=T;k&&(p?A=`${T}-label`:A=void 0);const $=j({},s,{toolbar:j({},s?.toolbar,{titleId:T}),mobilePaper:j({"aria-labelledby":A},s?.mobilePaper)}),F=Pe(x,D.unstableFieldRef);return{renderPicker:()=>g.jsxs(lu,{contextValue:y,localeText:w,children:[g.jsx(E,j({},D,{slots:P,slotProps:$,unstableFieldRef:F})),g.jsx(aP,j({},I,{open:O,slots:o,slotProps:$,children:g.jsx(M,j({},N,$?.layout,{slots:o,slotProps:$,children:L()}))}))]})}},$u=v.forwardRef(function(t,n){const r=Nt(),o=Ae(),s=Ac(t,"MuiMobileDatePicker"),i=j({day:On,month:On,year:On},s.viewRenderers),a=j({},s,{viewRenderers:i,format:Gs(o,s,!1),slots:j({field:Mu},s.slots),slotProps:j({},s.slotProps,{field:c=>j({},Io(s.slotProps?.field,c),Lc(s),{ref:n}),toolbar:j({hidden:!1},s.slotProps?.toolbar)})}),{renderPicker:l}=cP({props:a,valueManager:Dt,valueType:"date",getOpenDialogAriaText:Oc({utils:o,formatKey:"fullDate",contextTranslation:r.openDatePickerDialogue,propsTranslation:a.localeText?.openDatePickerDialogue}),validator:Dr});return l()});$u.propTypes={autoFocus:_.bool,className:_.string,closeOnSelect:_.bool,dayOfWeekFormatter:_.func,defaultValue:_.object,disabled:_.bool,disableFuture:_.bool,disableHighlightToday:_.bool,disableOpenPicker:_.bool,disablePast:_.bool,displayWeekNumber:_.bool,enableAccessibleFieldDOMStructure:_.any,fixedWeekNumber:_.number,format:_.string,formatDensity:_.oneOf(["dense","spacious"]),inputRef:Sc,label:_.node,loading:_.bool,localeText:_.object,maxDate:_.object,minDate:_.object,monthsPerRow:_.oneOf([3,4]),name:_.string,onAccept:_.func,onChange:_.func,onClose:_.func,onError:_.func,onMonthChange:_.func,onOpen:_.func,onSelectedSectionsChange:_.func,onViewChange:_.func,onYearChange:_.func,open:_.bool,openTo:_.oneOf(["day","month","year"]),orientation:_.oneOf(["landscape","portrait"]),readOnly:_.bool,reduceAnimations:_.bool,referenceDate:_.object,renderLoading:_.func,selectedSections:_.oneOfType([_.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),_.number]),shouldDisableDate:_.func,shouldDisableMonth:_.func,shouldDisableYear:_.func,showDaysOutsideCurrentMonth:_.bool,slotProps:_.object,slots:_.object,sx:_.oneOfType([_.arrayOf(_.oneOfType([_.func,_.object,_.bool])),_.func,_.object]),timezone:_.string,value:_.object,view:_.oneOf(["day","month","year"]),viewRenderers:_.shape({day:_.func,month:_.func,year:_.func}),views:_.arrayOf(_.oneOf(["day","month","year"]).isRequired),yearsOrder:_.oneOf(["asc","desc"]),yearsPerRow:_.oneOf([3,4])};const uP=["desktopModeMediaQuery"],xr=v.forwardRef(function(t,n){const r=$e({props:t,name:"MuiDatePicker"}),{desktopModeMediaQuery:o=fv}=r,s=ve(r,uP);return xc(o,{defaultMatches:!0})?g.jsx(Ou,j({ref:n},s)):g.jsx($u,j({ref:n},s))});function Au(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(?=['"])/,""),s=o.match(/^'([^'\\]*)'$/)??o.match(/^"([^"\\]*)"$/);return s?s[1]:o}return r==="string"?dP(n):n}function dP(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"?`
135
135
  `:r==="t"?" ":r==="r"?"\r":r):e}De.extend(Ls);const dl=14,pP=42;function fP(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(),s=o.match(/description="([^"]*)"/);if(s){n.push(s[1]);continue}const i=o.replace(/^#\(/,"").replace(/\)\s*$/,"").trim();i&&n.push(i)}return n.length>0?n.join(`
136
136
  `):void 0}function Fu({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:s}){const i=e.label??e.name??"",{theme:a}=ze.usePublisherTheme(),l=e.type??"string",c=fP(e),u=Au(l,e.default),m=u!==void 0?`Default: ${u===""?"(empty)":u}`:void 0,f=c||m?g.jsxs(g.Fragment,{children:[c,c&&m?g.jsx("br",{}):null,m]}):void 0,b=l==="string"||kn(l)==="string",d=!nn(l)||typeof t!="string"||Jm(t),p=A=>g.jsx(Q.TextField,{label:i,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:g.jsxs(g.Fragment,{children:[`Not a ${A}. Clear it to pick one.`,f?g.jsx("br",{}):null,f]}),slotProps:{input:{endAdornment:g.jsx(ns,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),h=nn(l),S=e.control==="multiselect"&&h,C=nn(l),w=e.control==="select"||e.control==="multiselect",x=w?C?typeof t=="string"?Zm(t):[]:typeof t=="string"&&t!==""?[t]:[]:[];if(w&&b&&d&&!(!S&&x.length>1)){const A=$=>{const F=C?Ns($):void 0;if($.length===0||F===""){n(null);return}n(C?F:$[0])};return g.jsx(Q.Autocomplete,{multiple:S,disableCloseOnSelect:S,freeSolo:!0,forcePopupIcon:!0,autoSelect:!0,options:r??[],loading:o,noOptionsText:s?"Options unavailable":"No matching values",value:S?x:x[0]??null,onChange:($,F)=>A(F===null?[]:Array.isArray(F)?F:[F]),renderInput:$=>g.jsx(Q.TextField,{...$,label:i,size:"small",placeholder:x.length!==0?void 0:t===""?"All":u??"All",error:s,helperText:s?g.jsxs(g.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",f?g.jsx("br",{}):null,f]}):f,slotProps:{input:{...$.InputProps,endAdornment:g.jsxs(g.Fragment,{children:[o&&g.jsx(Q.CircularProgress,{size:16}),$.InputProps.endAdornment]})}}}),fullWidth:!0})}const T=nn(l)&&kn(l)==="number",{rangeMin:k,rangeMax:O}=e,I=T&&typeof t=="string"?th(t):void 0,N=T&&typeof t=="string"?rh(t):void 0;if((T||l==="number")&&k!==void 0&&O!==void 0&&(!T||t===void 0||t===null||t===""||I!==void 0||N!==void 0)){const A=N??(I!==void 0?[I,O]:void 0),$=T?A?.[0]:typeof t=="number"?t:void 0;if($===void 0&&t!==void 0&&t!==null&&t!=="")return p("number");const F=$??k,V=A??[k,O],q=V[1]>=O?`≥ ${V[0]}`:`${V[0]} to ${V[1]}`,re=T&&t==="",ae=$!==void 0||re;return g.jsxs(Q.FormControl,{fullWidth:!0,children:[g.jsxs(Q.Box,{component:"fieldset",sx:ie=>({m:0,minWidth:0,border:a.cardBorder,borderRadius:2,px:`${dl}px`,pt:0,pb:.75,minHeight:pP,transition:"border-color 120ms ease-in","&:hover":{borderColor:ie.palette.text.secondary},"&:focus-within":{borderColor:ie.palette.text.primary}}),children:[g.jsx(Q.Typography,{component:"legend",variant:"caption",color:"text.secondary",sx:{px:.5,lineHeight:1},children:i}),g.jsxs(Q.Stack,{direction:"row",alignItems:"center",spacing:1,children:[g.jsx(Q.Typography,{variant:"body2",sx:{fontWeight:"fontWeightMedium"},children:ae?re?"Any":T?q:String(F):T?"Any":u??"Unset"}),ae&&g.jsx(Sr,{onClear:()=>n(null),sx:{p:0}})]}),g.jsx(Q.Slider,{size:"small",min:k,max:O,value:T?V:F,disableSwap:T,valueLabelDisplay:"auto","aria-label":T?void 0:i,getAriaLabel:T?ie=>ie===0?`${i} from`:`${i} to`:void 0,sx:{py:0,mt:.5},onChange:(ie,z)=>{if(T){const[Z,X]=Array.isArray(z)?[z[0],z[1]]:[z,z];if(Z<=k&&X>=O){n(null);return}n(X>=O?eh(Z):nh(Z,X));return}n(Array.isArray(z)?z[0]:z)}}),g.jsxs(Q.Stack,{direction:"row",justifyContent:"space-between",children:[g.jsx(Q.Typography,{variant:"caption",color:"text.secondary",children:k}),g.jsx(Q.Typography,{variant:"caption",color:"text.secondary",children:O})]})]}),f&&g.jsx(Q.FormHelperText,{sx:{mx:`${dl}px`},children:f})]})}const R=nn(l)?kn(l):void 0,y=R==="date"||R==="timestamp"||R==="timestamptz",E=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),D=t==null||E;if(y&&!E){const A=hP(t);if(A!==void 0)return g.jsx(gP,{label:i,state:A,onChange:n,helperNode:f,defaultDisplay:u})}if(y&&D){const A=E?De.utc(t):null;return g.jsx(hr,{dateAdapter:ao,children:g.jsx(xr,{label:i,value:A?.isValid()?A:null,onChange:$=>n($?$.format("YYYY-MM-DD"):null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:f},field:{clearable:!0,onClear:()=>n(null)}}})})}if(kn(l)==="boolean"){const A=typeof t=="string"?Qm(t):void 0;if(t==null||t===""||A!==void 0)return g.jsx(mP,{label:i,picked:A,emptyOverride:t==="",onChange:n,helperNode:f,defaultDisplay:u})}if(l==="boolean"){const A=typeof t=="boolean";if(!A&&t!==void 0&&t!==null)return p("true or false");const $=e.default?.trim()==="true",F=A?t:$;return g.jsxs(Q.FormControl,{children:[g.jsxs(Q.Stack,{direction:"row",alignItems:"center",children:[g.jsx(Q.FormControlLabel,{control:g.jsx(Q.Checkbox,{checked:F,onChange:V=>n(V.target.checked)}),label:i}),A&&g.jsx(Sr,{onClear:()=>n(null),edge:"end"})]}),f&&g.jsx(Q.FormHelperText,{children:f})]})}if(l==="number"){const A=typeof t=="number"?t:"",$=t!=null;return $&&t!==""&&typeof t!="number"?p("number"):g.jsx(Q.TextField,{label:i,type:"number",value:A,onChange:F=>{const V=F.target.value;n(V===""?null:Number(V))},placeholder:u,helperText:f,slotProps:{input:{endAdornment:$&&g.jsx(ns,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}if(l==="date"||l==="timestamp"||l==="timestamptz"){const A=t instanceof Date?t:typeof t=="string"?(V=>V instanceof Date?V:null)(cc(l,t)):null,$=A?De.utc(A):null;return t!=null&&t!==""&&A===null?p("date"):g.jsx(hr,{dateAdapter:ao,children:g.jsx(xr,{label:i,value:$,onChange:V=>n(V?uh(V,A??void 0):null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:f},field:{clearable:!0,onClear:()=>n(null)}}})})}const P=typeof t=="string"?t:"",M=t!=null;return g.jsx(Q.TextField,{label:i,value:P,onChange:A=>n(A.target.value),placeholder:M?void 0:u??(l.startsWith("filter<")?l:void 0),helperText:f,slotProps:{input:{endAdornment:M&&g.jsx(ns,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}function Sr({onClear:e,edge:t,sx:n}){return g.jsx(Q.IconButton,{size:"small","aria-label":"Clear value",onClick:e,edge:t,sx:[{minWidth:24,minHeight:24},...Array.isArray(n)?n:[n]],children:g.jsx(Ph,{fontSize:"small"})})}function ns({onClear:e}){return g.jsx(Q.InputAdornment,{position:"end",children:g.jsx(Sr,{onClear:e,edge:"end"})})}const _r="__any__";function mP({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:s}){const i=t??(n?_r:""),a=i!=="";return g.jsx(Q.Box,{"data-testid":"boolean-filter",children:g.jsxs(Q.TextField,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:l=>l==="true"||l==="false"?l:l===_r?"Any":s||"Any"},input:{endAdornment:a?g.jsx(Sr,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:l=>{l.target.value!==_r&&r(l.target.value)},children:[n&&g.jsx(Q.MenuItem,{value:_r,children:"Any"}),g.jsx(Q.MenuItem,{value:"true",children:"true"}),g.jsx(Q.MenuItem,{value:"false",children:"false"})]})})}function hP(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=sh(e);if(t!==void 0)return{kind:"preset",key:t};const n=lh(e);if(n!==void 0)return{kind:"days",...n}}const Wr="__custom__",rs="__any__";function gP({label:e,state:t,onChange:n,helperNode:r,defaultDisplay:o}){const s=t.kind==="days"?`days:${t.firstDay}/${t.lastDay}`:t.kind==="preset"?`preset:${t.key}`:t.kind,[i,a]=ne.useState(t.kind==="days"),[l,c]=ne.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});ne.useEffect(()=>{t.kind==="days"?(a(!0),c({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&a(!1)},[s]);const u=t.kind!=="unset",m=i?Wr:t.kind==="preset"?t.key:t.kind==="any"?rs:"",f=d=>{c(d),d.from&&d.to&&!De.utc(d.to).isBefore(De.utc(d.from))&&n(ah(d.from,d.to))},b=d=>{const p=d?De.utc(d):null;return p?.isValid()?p:null};return g.jsxs(Q.Stack,{direction:"row",spacing:1,"data-testid":"time-range",children:[g.jsxs(Q.TextField,{select:!0,label:e,value:m,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:d=>{if(d===Wr)return"Custom range";if(d===rs)return"Any time";const p=io.find(h=>h.key===d);return p?p.label:o??"Any time"}},input:{endAdornment:u?g.jsx(Sr,{onClear:()=>{a(!1),c({}),n(null)},sx:{mr:2}}):void 0}},onChange:d=>{const p=d.target.value;if(p===Wr){a(!0);return}a(!1);const h=oh(p);h!==void 0&&n(h)},children:[t.kind==="any"&&g.jsx(Q.MenuItem,{value:rs,children:"Any time"}),io.map(d=>g.jsx(Q.MenuItem,{value:d.key,children:d.label},d.key)),g.jsx(Q.MenuItem,{value:Wr,children:"Custom range"})]}),i&&g.jsxs(hr,{dateAdapter:ao,children:[g.jsx(xr,{label:"From",value:b(l.from),onChange:d=>f({...l,from:d?d.format("YYYY-MM-DD"):void 0}),slotProps:{textField:{size:"small"}}}),g.jsx(xr,{label:"To",value:b(l.to),minDate:b(l.from)??void 0,onChange:d=>f({...l,to:d?d.format("YYYY-MM-DD"):void 0}),slotProps:{textField:{size:"small"}}})]})]})}function Lu({givens:e,values:t,onChange:n,onReset:r,layout:o="panel",options:s,optionsLoading:i,optionsFailed:a,apply:l,title:c}){const{theme:u}=ze.usePublisherTheme();if(e.length===0)return null;const m=Array.from(t.values()).some(d=>d!==null),f=e.map(d=>g.jsx(Q.Box,{sx:o==="bar"?{minWidth:200,flex:"1 1 200px",maxWidth:320}:void 0,children:g.jsx(Fu,{given:d,value:d.name?t.get(d.name):void 0,onChange:p=>d.name&&n(d.name,p),options:d.name?s?.get(d.name):void 0,optionsLoading:i,optionsFailed:d.name?a?.has(d.name):void 0})},d.name)),b=g.jsxs(Q.Stack,{direction:"row",alignItems:"center",spacing:1,children:[l&&g.jsx(Q.Button,{variant:"contained",size:"small",disableElevation:!0,onClick:l.onApply,disabled:!l.pending,children:"Apply"}),m&&g.jsx(Q.Button,{variant:"text",size:"small",onClick:r,children:"Reset"})]});return o==="bar"?g.jsx(Q.Paper,{elevation:0,sx:{p:2,border:u.cardBorder,borderRadius:1,backgroundColor:"transparent"},children:g.jsxs(Q.Stack,{direction:"row",alignItems:"flex-start",spacing:2,useFlexGap:!0,sx:{flexWrap:"wrap"},children:[f,g.jsx(Q.Box,{sx:{flex:"0 0 auto",ml:"auto",pt:.5},children:b})]})}):g.jsxs(Q.Paper,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[g.jsxs(Q.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[g.jsx(Q.Typography,{variant:"subtitle2",sx:{fontWeight:"fontWeightMedium",color:"text.primary"},children:c??"Filters"}),b]}),g.jsx(Q.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:f})]})}const yP=new Set(["bar","line","chart","scatter_chart"]),bP=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function vP(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":yP.has(e)?"container":"content"}function xP(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&bP.has(e)}function SP(e){return e==="dashboard"?3:2}function Nu(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function wP(e,t){const n=Nu(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const ju=400,CP=700,PP=600,kP=800,Bu=400,xs=2e3;function Vu(e){return e===void 0?xs:Math.min(e,xs)}function Ss({sizing:e,contentHeight:t,maxHeight:n,fillHeight:r}){if(e==="container")return n??Bu;if(t===void 0||t<=0)return Vu(n);const o=n===void 0?t:Math.min(n,t);return r===void 0?o:Math.max(o,r)}function zu(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function _u(e,t){if(e==null||e==="")return;const n=o=>`'${zu(o)}'`;switch(t===void 0?MP(e):t.startsWith("filter<")?"filter":t){case"filter":return`f${n(String(e))}`;case"string":return n(String(e));case"number":{const o=typeof e=="number"?e:Number(e);return Number.isFinite(o)?String(o):void 0}case"boolean":return e===!0||e==="true"?"true":"false";case"date":{const o=pl(e);return o&&`@${o}`}case"timestamp":{const o=pl(e);if(!o)return;const s=e instanceof Date?e.toISOString().slice(11,19):/[T ](\d{2}:\d{2}(?::\d{2})?)/.exec(String(e))?.[1]??"00:00:00";return`@${o} ${s}`}default:return}}function MP(e){if(typeof e=="string")return"string";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.toISOString().slice(11,19)==="00:00:00"?"date":"timestamp"}function pl(e){return e instanceof Date?Number.isNaN(e.getTime())?void 0:e.toISOString().slice(0,10):/^(\d{4}-\d{2}-\d{2})/.exec(String(e))?.[1]}const ho={opening:e=>e?`Opening the ${e}…`:"Opening…",running:"Running…",loading:"Loading…"};function Si({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:s=2,textVariant:i="body2"}){const a=g.jsxs(Q.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:s},children:[g.jsx(Q.CircularProgress,{size:t,color:n,thickness:r}),e&&g.jsx(Q.Typography,{variant:i,color:"text.secondary",children:e})]});return o?g.jsx(Q.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:a}):a}let Jn;function Wu(){return Jn||(Jn=import("@malloydata/render"),Jn.catch(()=>{Jn=void 0})),Jn}function Hu(){typeof window>"u"||Wu().catch(()=>{})}const Uu=Ue(g.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 Yu({sx:e,...t}){const{theme:n}=ze.usePublisherTheme();return g.jsx(Q.IconButton,{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 TP=new Set(["warn","error"]);function DP(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!TP.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(`
137
- `)}}const RP=ne.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-BrvrMDAP.cjs.js")).then(e=>e.RenderedResult$1));function Gu({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r,drill:o,fill:s=!1}){const i=ne.useRef(null);ne.useEffect(()=>Hu(),[]);const[a,l]=ne.useState(void 0),[c,u]=ne.useState(void 0),[m,f]=ne.useState(!1),[b,d]=ne.useState(void 0),p=DP(r),h=!!e;if(ne.useEffect(()=>{const T=i.current;if(!s||!T)return;const k=new ResizeObserver(([O])=>d(Math.round(O.contentRect.height)));return k.observe(T),()=>k.disconnect()},[s,h,m]),!e)return null;if(n>0&&e.length>n&&!m)return g.jsxs(Q.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[g.jsx(Bd.Warning,{sx:{fontSize:48,color:"#757575"}}),g.jsx(Q.Typography,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),g.jsx(Q.Button,{variant:"contained",color:"primary",onClick:()=>f(!0),children:"Proceed"})]});const C=g.jsx(Si,{text:ho.loading,centered:!0,size:32}),w=Ss({sizing:a,contentHeight:c,maxHeight:t,fillHeight:s?b:void 0}),x=g.jsx(ne.Suspense,{fallback:C,children:g.jsx(RP,{result:e,height:w,onSizeChange:u,onSizing:l,drill:o,fill:s})});return g.jsxs(Q.Box,{ref:i,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden",...s&&{flex:`1 1 ${Ss({sizing:a,contentHeight:c,maxHeight:t})}px`,minHeight:0}},children:[s?g.jsx(Q.Box,{sx:{position:"absolute",inset:0},children:x}):x,p&&g.jsx(Q.Box,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:g.jsx(Q.Tooltip,{title:p.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:g.jsx(Yu,{"aria-label":"Render tag warnings",children:g.jsx(Uu,{fontSize:"small",color:p.severity==="error"?"error":"warning"})})})})]})}function wi({state:e,context:t,loadingText:n=ho.running,maxHeight:r,maxResultSize:o,drill:s,fill:i,transform:a}){const{data:l,isSuccess:c,isError:u,error:m,fetchStatus:f}=e,b=c||f==="fetching";ne.useEffect(()=>{b&&Hu()},[b]);const d=l?.data.result,p=ne.useMemo(()=>d!==void 0&&a?a(d):d,[d,a]);return u?g.jsx(Q.Box,{sx:{p:2},children:g.jsx(tc,{context:t,error:m})}):c?g.jsx(Gu,{result:p,maxHeight:r,maxResultSize:o,renderLogs:l.data.renderLogs,drill:s,fill:i}):g.jsx(Si,{text:f==="idle"?ho.loading:n})}const wr=()=>typeof performance<"u"?performance.now():Date.now(),Ku=200;function IP(e){const t=_u(e.rawValue);if(t!==void 0)return`run: ${e.source} -> { drill: ${e.view}.${e.field} = ${t}; select: *; limit: ${Ku} }`}function EP(e){const t=Tn.tileSteps(e);if(!(!t||t.refinement!==void 0||!Tn.isIdentifier(t.source)||!Tn.isIdentifier(t.view)))return{source:t.source,view:t.view}}function OP({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:s,onClose:i,onDone:a}){const{theme:l}=ze.usePublisherTheme(),c=e?IP(e):void 0;return g.jsxs(Q.Dialog,{open:e!==void 0,onClose:i,maxWidth:"lg",fullWidth:!0,children:[g.jsxs(Q.DialogTitle,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[g.jsxs(Q.Box,{children:[e?g.jsxs(g.Fragment,{children:["Rows where"," ",g.jsx(Q.Box,{component:"code",sx:{fontSize:"0.9em"},children:e.field})," ","is ",e.label]}):"Rows",g.jsx(Q.Typography,{component:"div",variant:"caption",sx:{color:l.tileTitle,mt:.25},children:e?`The first ${Ku} rows of ${e.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),g.jsx(Q.IconButton,{onClick:i,"aria-label":"Close",size:"small",sx:{color:"text.secondary",ml:1},children:g.jsx(Es,{fontSize:"small"})})]}),g.jsxs(Q.DialogContent,{dividers:!0,sx:{p:0,minHeight:240},children:[c===void 0&&e&&g.jsx(Q.Typography,{variant:"body2",sx:{p:2},children:"This value cannot be written as a filter, so its rows cannot be fetched."}),c!==void 0&&g.jsx($P,{query:c,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:s,...a?{onDone:a}:{}})]}),g.jsxs(Q.DialogActions,{sx:{px:3,py:1.5},children:[c!==void 0&&g.jsx(Q.Typography,{variant:"caption",sx:{mr:"auto",color:l.tileTitle,fontFamily:ze.MONO_FONT_FAMILY,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:c,children:c}),g.jsx(Q.Button,{onClick:i,children:"Close"})]})]})}function $P({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:s,onDone:i}){const a=Di({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:s}),{isSuccess:l,isError:c}=a,u=ne.useRef(void 0);return ne.useEffect(()=>{u.current=wr()},[e]),ne.useEffect(()=>{u.current===void 0||!l&&!c||(i?.(l,wr()-u.current),u.current=void 0)},[l,c,i]),g.jsx(Q.Box,{sx:{p:1},children:g.jsx(wi,{state:a,context:e})})}const AP=Ue(g.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"})),FP=3;function qu(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 LP(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function Xu({ignored:e}){const{theme:t}=ze.usePublisherTheme();if(e.length===0)return null;const n=e.length>FP?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return g.jsxs(Q.Box,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${LP(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:[g.jsx(AP,{sx:{fontSize:12}}),g.jsx(Q.Box,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const NP=240,Qu=4;function jP({manifest:e,environmentName:t,packageName:n,versionId:r,documentName:o,givens:s,onGivensChange:i,onNavigate:a,height:l,maxResultSize:c,chrome:u="card",controlsLayout:m="bar",preamble:f,runModelPath:b,hiddenGivens:d}){const p=ne.useMemo(()=>(e.givens??[]).filter($=>!(f!==void 0&&$.secure===!0)&&!($.name!==void 0&&d?.includes($.name))),[e,d,f]),h=ne.useMemo(()=>s===void 0?void 0:Object.fromEntries(Object.entries(s).filter(([,$])=>typeof $=="string")),[s]),S=hc({specs:p,loaded:!0,startingValues:e.startingGivens,params:h,onGivensChange:i,documentKey:`${t}/${n}/${r??""}/${o}`,autorun:e.autorun!==!1,environmentName:t,packageName:n,modelPath:b??e.path,versionId:r,documentName:o,...f!==void 0?{preamble:f}:{},...s?{hostGivens:s}:{}}),{applied:C,declaredTypes:w,canSelf:x,onSelf:T}=S,k=Do(),O=ne.useMemo(()=>{const $=new Set((e.tiles??[]).flatMap(F=>F.givenNames??[]));return Object.fromEntries(Object.entries(s??{}).filter(([F])=>$.has(F)&&!w.has(F)))},[e,s,w]),[I,N]=ne.useState(void 0),L=ne.useCallback($=>{const F=EP($.context);F!==void 0&&N({...F,field:$.field,rawValue:$.rawValue,label:$.label})},[]),R=ne.useMemo(()=>zs(Ro(C,w),O),[C,w,O]),{drill:y,drillMenu:E}=gc({onNavigate:a,onSelf:T,canSelf:x,selfLabel:"Filter this report",...f===void 0?{onRows:L}:{}}),D=ne.useCallback($=>({canDrill:y.canDrill,onClick:F=>y.onClick({...F,context:$})}),[y]);if(e.error)return g.jsxs(Q.Stack,{spacing:2,children:[g.jsx(fl,{manifest:e,chrome:u}),g.jsx(Q.Alert,{severity:"error",children:e.error})]});const P=b??e.path,M=e.tiles??[],A=e.dashboardColumns??jl;return g.jsxs(Q.Stack,{spacing:2,children:[u==="card"&&g.jsx(fl,{manifest:e,chrome:u}),p.length>0&&g.jsx(Q.Box,{sx:{position:"sticky",top:0,zIndex:Qu,bgcolor:"background.default"},children:g.jsx(Lu,{...S.panel,layout:m})}),P===void 0?g.jsx(Q.Alert,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):M.length>0?g.jsx(_l,{tiles:M,columns:A,minTilePx:NP,rowGapPx:u==="none"?Bl:an,keyOf:($,F)=>`${F}:${$.kind==="text"?`text:${$.name}`:$.query}`,renderTile:($,F)=>$.kind==="text"||$.query===void 0?g.jsx(Zu,{markdown:$.markdown??"",chrome:u}):g.jsx(Rd,{index:F,environmentName:t,packageName:n,versionId:r,modelPath:P,tile:$.query,label:$.label,subtitle:$.subtitle,borderless:$.borderless,givens:C,hostGivens:O,declaredTypes:w,givenNames:$.givenNames,height:l??ju,maxResultSize:c,drill:D($.query),chrome:u,ignoredFilters:qu($.givenNames,p),...f!==void 0?{preamble:f,restricted:$.restricted}:{}})}):g.jsx(Q.Alert,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),E,P!==void 0&&g.jsx(OP,{request:I,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:P,givens:R,onClose:()=>N(void 0),onDone:($,F)=>{I&&k.emit({type:"report.rows_shown",source:I.source,view:I.view,field:I.field,ok:$,durationMs:F})}})]})}function Zu({markdown:e,chrome:t}){return g.jsx($s,{chrome:t,kind:"text",children:g.jsx(Jl,{variant:"document",children:e})})}function fl({manifest:e,chrome:t}){return g.jsx(Ju,{chrome:t,title:e.title??e.name,...e.description?{description:e.description}:{}})}function Ju({title:e,description:t,chrome:n="card"}){return g.jsxs(Q.Stack,{sx:{gap:2},children:[g.jsx(Q.Typography,{variant:"h5",children:e}),t&&g.jsx(Q.Box,{sx:n==="none"?{my:`${zl}px`}:void 0,children:g.jsx(Zu,{markdown:t,chrome:n})})]})}const ed=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 s=r[o];s==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:s==="packages"?n.packageName=decodeURI(r[o+1])||void 0:s==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:s==="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},td=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=${e.versionId}`),t},BP=Ue(g.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));async function VP(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 zP(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function nd({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const s=e?"host":t?"package":"browser",i=n!==void 0&&s==="package";return{savesTo:s,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function _P(e,t){return e??(t===void 0?void 0:await VP(t))}function WP({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:s}){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 ${s}: 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 HP(e){return e instanceof Error?e.message:String(e)}function UP(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function YP({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:s,expectedHash:i,invalidateOnError:a,invalidate:l,afterWrite:c}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:s,expectedHash:i})}catch(f){for(const b of a)t.invalidateQueries({queryKey:b});throw new Error(UP(f))}const m=u.data.contentHash;await c?.(m);for(const{queryKey:f,refetchType:b,wait:d}of l){const p=t.invalidateQueries({queryKey:f,...b?{refetchType:b}:{}});d&&await p}return m}function GP(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function KP(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=ed(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class rd extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const od=e=>e instanceof rd||e instanceof Error&&e.name==="DocumentNotFoundError",sd="document.malloy",id=e=>e.slice(0,e.lastIndexOf("/")+1),ad=(e,t)=>new URL(e,`https://malloy.invalid/${id(t)}`).pathname.slice(1);function ld(e,t){const n=id(t).split("/").filter(Boolean),r=e.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const s=n.length-o;return`${"../".repeat(s)}${r.slice(o).join("/")}`}function qP(e,t,n,r=sd,o=[n]){return e.sources.some(s=>s.base===t)?!0:e.imports.some(s=>s.kind==="names"?s.names.includes(t):o.includes(ad(s.from,r)))}function XP(e,t,n,r=sd,o=[n]){const{imports:s}=e;if(qP(e,t,n,r,o))return s;const i=s.findIndex(a=>a.kind==="names"&&o.includes(ad(a.from,r)));return i<0?[...s,{kind:"names",names:[t],from:ld(n,r)}]:s.map((a,l)=>l===i&&a.kind==="names"?{...a,names:[...a.names,t]}:a)}const er=e=>Tn.isBareName(e)?e:`\`${e}\``;function Ci(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const s=As("title",t);if(s)return s;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,a]of[["source",r],["view",o]])if(a.trim()===""||/[`\r\n\\]/.test(a))return`The ${i} name ${JSON.stringify(a)} cannot be written as a Malloy name.`}const QP="report.malloy";function Pi(e,t,n=QP){const r=Ci(e);if(r)throw new Error(r);const{modelPath:o,source:s,view:i}=e,a=e.title.trim(),l=`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,c=er(`${s}_tiles`),u=er(`${i}_tile`),m=`"${c} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${l}`," tiles=["," intro { kind=text },",` ${m}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${er(s)} } from "${ld(o,n)}"`,"","##|(markdown) intro",`# ${a}`,"Say what this report is for, then let the queries below answer it.","|##","",`source: ${c} is ${er(s)} extend {`,` view: ${u} is ${er(i)}`,"}",""].join(`
137
+ `)}}const RP=ne.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-Bw7EQc42.cjs.js")).then(e=>e.RenderedResult$1));function Gu({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r,drill:o,fill:s=!1}){const i=ne.useRef(null);ne.useEffect(()=>Hu(),[]);const[a,l]=ne.useState(void 0),[c,u]=ne.useState(void 0),[m,f]=ne.useState(!1),[b,d]=ne.useState(void 0),p=DP(r),h=!!e;if(ne.useEffect(()=>{const T=i.current;if(!s||!T)return;const k=new ResizeObserver(([O])=>d(Math.round(O.contentRect.height)));return k.observe(T),()=>k.disconnect()},[s,h,m]),!e)return null;if(n>0&&e.length>n&&!m)return g.jsxs(Q.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[g.jsx(Bd.Warning,{sx:{fontSize:48,color:"#757575"}}),g.jsx(Q.Typography,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),g.jsx(Q.Button,{variant:"contained",color:"primary",onClick:()=>f(!0),children:"Proceed"})]});const C=g.jsx(Si,{text:ho.loading,centered:!0,size:32}),w=Ss({sizing:a,contentHeight:c,maxHeight:t,fillHeight:s?b:void 0}),x=g.jsx(ne.Suspense,{fallback:C,children:g.jsx(RP,{result:e,height:w,onSizeChange:u,onSizing:l,drill:o,fill:s})});return g.jsxs(Q.Box,{ref:i,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden",...s&&{flex:`1 1 ${Ss({sizing:a,contentHeight:c,maxHeight:t})}px`,minHeight:0}},children:[s?g.jsx(Q.Box,{sx:{position:"absolute",inset:0},children:x}):x,p&&g.jsx(Q.Box,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:g.jsx(Q.Tooltip,{title:p.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:g.jsx(Yu,{"aria-label":"Render tag warnings",children:g.jsx(Uu,{fontSize:"small",color:p.severity==="error"?"error":"warning"})})})})]})}function wi({state:e,context:t,loadingText:n=ho.running,maxHeight:r,maxResultSize:o,drill:s,fill:i,transform:a}){const{data:l,isSuccess:c,isError:u,error:m,fetchStatus:f}=e,b=c||f==="fetching";ne.useEffect(()=>{b&&Hu()},[b]);const d=l?.data.result,p=ne.useMemo(()=>d!==void 0&&a?a(d):d,[d,a]);return u?g.jsx(Q.Box,{sx:{p:2},children:g.jsx(tc,{context:t,error:m})}):c?g.jsx(Gu,{result:p,maxHeight:r,maxResultSize:o,renderLogs:l.data.renderLogs,drill:s,fill:i}):g.jsx(Si,{text:f==="idle"?ho.loading:n})}const wr=()=>typeof performance<"u"?performance.now():Date.now(),Ku=200;function IP(e){const t=_u(e.rawValue);if(t!==void 0)return`run: ${e.source} -> { drill: ${e.view}.${e.field} = ${t}; select: *; limit: ${Ku} }`}function EP(e){const t=Tn.tileSteps(e);if(!(!t||t.refinement!==void 0||!Tn.isIdentifier(t.source)||!Tn.isIdentifier(t.view)))return{source:t.source,view:t.view}}function OP({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:s,onClose:i,onDone:a}){const{theme:l}=ze.usePublisherTheme(),c=e?IP(e):void 0;return g.jsxs(Q.Dialog,{open:e!==void 0,onClose:i,maxWidth:"lg",fullWidth:!0,children:[g.jsxs(Q.DialogTitle,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[g.jsxs(Q.Box,{children:[e?g.jsxs(g.Fragment,{children:["Rows where"," ",g.jsx(Q.Box,{component:"code",sx:{fontSize:"0.9em"},children:e.field})," ","is ",e.label]}):"Rows",g.jsx(Q.Typography,{component:"div",variant:"caption",sx:{color:l.tileTitle,mt:.25},children:e?`The first ${Ku} rows of ${e.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),g.jsx(Q.IconButton,{onClick:i,"aria-label":"Close",size:"small",sx:{color:"text.secondary",ml:1},children:g.jsx(Es,{fontSize:"small"})})]}),g.jsxs(Q.DialogContent,{dividers:!0,sx:{p:0,minHeight:240},children:[c===void 0&&e&&g.jsx(Q.Typography,{variant:"body2",sx:{p:2},children:"This value cannot be written as a filter, so its rows cannot be fetched."}),c!==void 0&&g.jsx($P,{query:c,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:s,...a?{onDone:a}:{}})]}),g.jsxs(Q.DialogActions,{sx:{px:3,py:1.5},children:[c!==void 0&&g.jsx(Q.Typography,{variant:"caption",sx:{mr:"auto",color:l.tileTitle,fontFamily:ze.MONO_FONT_FAMILY,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:c,children:c}),g.jsx(Q.Button,{onClick:i,children:"Close"})]})]})}function $P({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:s,onDone:i}){const a=Di({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:s}),{isSuccess:l,isError:c}=a,u=ne.useRef(void 0);return ne.useEffect(()=>{u.current=wr()},[e]),ne.useEffect(()=>{u.current===void 0||!l&&!c||(i?.(l,wr()-u.current),u.current=void 0)},[l,c,i]),g.jsx(Q.Box,{sx:{p:1},children:g.jsx(wi,{state:a,context:e})})}const AP=Ue(g.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"})),FP=3;function qu(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 LP(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function Xu({ignored:e}){const{theme:t}=ze.usePublisherTheme();if(e.length===0)return null;const n=e.length>FP?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return g.jsxs(Q.Box,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${LP(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:[g.jsx(AP,{sx:{fontSize:12}}),g.jsx(Q.Box,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const NP=240,Qu=4;function jP({manifest:e,environmentName:t,packageName:n,versionId:r,documentName:o,givens:s,onGivensChange:i,onNavigate:a,height:l,maxResultSize:c,chrome:u="card",controlsLayout:m="bar",preamble:f,runModelPath:b,hiddenGivens:d}){const p=ne.useMemo(()=>(e.givens??[]).filter($=>!(f!==void 0&&$.secure===!0)&&!($.name!==void 0&&d?.includes($.name))),[e,d,f]),h=ne.useMemo(()=>s===void 0?void 0:Object.fromEntries(Object.entries(s).filter(([,$])=>typeof $=="string")),[s]),S=hc({specs:p,loaded:!0,startingValues:e.startingGivens,params:h,onGivensChange:i,documentKey:`${t}/${n}/${r??""}/${o}`,autorun:e.autorun!==!1,environmentName:t,packageName:n,modelPath:b??e.path,versionId:r,documentName:o,...f!==void 0?{preamble:f}:{},...s?{hostGivens:s}:{}}),{applied:C,declaredTypes:w,canSelf:x,onSelf:T}=S,k=Do(),O=ne.useMemo(()=>{const $=new Set((e.tiles??[]).flatMap(F=>F.givenNames??[]));return Object.fromEntries(Object.entries(s??{}).filter(([F])=>$.has(F)&&!w.has(F)))},[e,s,w]),[I,N]=ne.useState(void 0),L=ne.useCallback($=>{const F=EP($.context);F!==void 0&&N({...F,field:$.field,rawValue:$.rawValue,label:$.label})},[]),R=ne.useMemo(()=>zs(Ro(C,w),O),[C,w,O]),{drill:y,drillMenu:E}=gc({onNavigate:a,onSelf:T,canSelf:x,selfLabel:"Filter this report",...f===void 0?{onRows:L}:{}}),D=ne.useCallback($=>({canDrill:y.canDrill,onClick:F=>y.onClick({...F,context:$})}),[y]);if(e.error)return g.jsxs(Q.Stack,{spacing:2,children:[g.jsx(fl,{manifest:e,chrome:u}),g.jsx(Q.Alert,{severity:"error",children:e.error})]});const P=b??e.path,M=e.tiles??[],A=e.dashboardColumns??jl;return g.jsxs(Q.Stack,{spacing:2,children:[u==="card"&&g.jsx(fl,{manifest:e,chrome:u}),p.length>0&&g.jsx(Q.Box,{sx:{position:"sticky",top:0,zIndex:Qu,bgcolor:"background.default"},children:g.jsx(Lu,{...S.panel,layout:m})}),P===void 0?g.jsx(Q.Alert,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):M.length>0?g.jsx(_l,{tiles:M,columns:A,minTilePx:NP,rowGapPx:u==="none"?Bl:an,keyOf:($,F)=>`${F}:${$.kind==="text"?`text:${$.name}`:$.query}`,renderTile:($,F)=>$.kind==="text"||$.query===void 0?g.jsx(Zu,{markdown:$.markdown??"",chrome:u}):g.jsx(Rd,{index:F,environmentName:t,packageName:n,versionId:r,modelPath:P,tile:$.query,label:$.label,subtitle:$.subtitle,borderless:$.borderless,givens:C,hostGivens:O,declaredTypes:w,givenNames:$.givenNames,height:l??ju,maxResultSize:c,drill:D($.query),chrome:u,ignoredFilters:qu($.givenNames,p),...f!==void 0?{preamble:f,restricted:$.restricted}:{}})}):g.jsx(Q.Alert,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),E,P!==void 0&&g.jsx(OP,{request:I,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:P,givens:R,onClose:()=>N(void 0),onDone:($,F)=>{I&&k.emit({type:"report.rows_shown",source:I.source,view:I.view,field:I.field,ok:$,durationMs:F})}})]})}function Zu({markdown:e,chrome:t}){return g.jsx($s,{chrome:t,kind:"text",children:g.jsx(Jl,{variant:"document",children:e})})}function fl({manifest:e,chrome:t}){return g.jsx(Ju,{chrome:t,title:e.title??e.name,...e.description?{description:e.description}:{}})}function Ju({title:e,description:t,chrome:n="card"}){return g.jsxs(Q.Stack,{sx:{gap:2},children:[g.jsx(Q.Typography,{variant:"h5",children:e}),t&&g.jsx(Q.Box,{sx:n==="none"?{my:`${zl}px`}:void 0,children:g.jsx(Zu,{markdown:t,chrome:n})})]})}const ed=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 s=r[o];s==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:s==="packages"?n.packageName=decodeURI(r[o+1])||void 0:s==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:s==="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},td=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=${e.versionId}`),t},BP=Ue(g.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));async function VP(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 zP(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function nd({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const s=e?"host":t?"package":"browser",i=n!==void 0&&s==="package";return{savesTo:s,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function _P(e,t){return e??(t===void 0?void 0:await VP(t))}function WP({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:s}){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 ${s}: 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 HP(e){return e instanceof Error?e.message:String(e)}function UP(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function YP({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:s,expectedHash:i,invalidateOnError:a,invalidate:l,afterWrite:c}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:s,expectedHash:i})}catch(f){for(const b of a)t.invalidateQueries({queryKey:b});throw new Error(UP(f))}const m=u.data.contentHash;await c?.(m);for(const{queryKey:f,refetchType:b,wait:d}of l){const p=t.invalidateQueries({queryKey:f,...b?{refetchType:b}:{}});d&&await p}return m}function GP(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function KP(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=ed(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class rd extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const od=e=>e instanceof rd||e instanceof Error&&e.name==="DocumentNotFoundError",sd="document.malloy",id=e=>e.slice(0,e.lastIndexOf("/")+1),ad=(e,t)=>new URL(e,`https://malloy.invalid/${id(t)}`).pathname.slice(1);function ld(e,t){const n=id(t).split("/").filter(Boolean),r=e.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const s=n.length-o;return`${"../".repeat(s)}${r.slice(o).join("/")}`}function qP(e,t,n,r=sd,o=[n]){return e.sources.some(s=>s.base===t)?!0:e.imports.some(s=>s.kind==="names"?s.names.includes(t):o.includes(ad(s.from,r)))}function XP(e,t,n,r=sd,o=[n]){const{imports:s}=e;if(qP(e,t,n,r,o))return s;const i=s.findIndex(a=>a.kind==="names"&&o.includes(ad(a.from,r)));return i<0?[...s,{kind:"names",names:[t],from:ld(n,r)}]:s.map((a,l)=>l===i&&a.kind==="names"?{...a,names:[...a.names,t]}:a)}const er=e=>Tn.isBareName(e)?e:`\`${e}\``;function Ci(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const s=As("title",t);if(s)return s;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,a]of[["source",r],["view",o]])if(a.trim()===""||/[`\r\n\\]/.test(a))return`The ${i} name ${JSON.stringify(a)} cannot be written as a Malloy name.`}const QP="report.malloy";function Pi(e,t,n=QP){const r=Ci(e);if(r)throw new Error(r);const{modelPath:o,source:s,view:i}=e,a=e.title.trim(),l=`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,c=er(`${s}_tiles`),u=er(`${i}_tile`),m=`"${c} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${l}`," tiles=["," intro { kind=text },",` ${m}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${er(s)} } from "${ld(o,n)}"`,"","##|(markdown) intro",`# ${a}`,"Say what this report is for, then let the queries below answer it.","|##","",`source: ${c} is ${er(s)} extend {`,` view: ${u} is ${er(i)}`,"}",""].join(`
138
138
  `)}function ZP(e,t){return Pi(e,"linear",t)}function cd(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function JP({title:e,modelPath:t,source:n,view:r}){for(const[o,s]of[["source",n],["view",r]])if(!Tn.isBareName(s))return`The ${o} name ${JSON.stringify(s)} cannot be written as a Malloy name.`;return/["\\\r\n]/.test(t)?`The model path ${JSON.stringify(t)} cannot be written into an import.`:As("title",e)}function e1(e,t){const n=JP(e);if(n)throw new Error(n);return Pi(e,"grid",t)}const ud=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function dd(e,t){const n=ud(t);return`${n===""?"":`${n}/`}${e}.malloy`}function pd(e){return cd(e)||"untitled"}function fd(e,t=1,n){const r=pd(e);return dd(t>1?`${r}-${t}`:r,n)}const md=(e,t,n)=>`${e}/${t}/${n}`,hd=(e,t,n,r,o)=>({workspace:t,type:e,path:md(n,r,o)}),ki=20;function t1(e){const{savesTo:t,writer:n}=nd({...e,readFailed:!1});return t==="browser"?void 0:n}const ml=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function gd(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 n1(e){const t=e.layout??"linear",n=wr();let r;try{r=await r1(e,t)}catch(o){throw so({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return so({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:wr()-n}),e.onCreated?.(r),r}async function r1(e,t){const{document:n,target:r}=e,o=Ci(n);if(o)throw new Error(o);const s=ud(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:ki},(p,h)=>fd(n.title,h+1,s));for(const p of i){const h=gd(p);if(h)throw new Error(h)}const a=p=>Pi(n,t,p);if(r.route==="package"){const p=new Set(r.existing);let h;for(const S of i)if(!p.has(S))try{await r.write(S,a(S)),h=S;break}catch(C){if(!o1(C))throw C}if(h===void 0)throw hl(n.title,e.path);return{layout:t,path:h,slug:ml(h)}}const{storage:l,workspace:c,environmentName:u,packageName:m}=r,f=new Set(r.existing),b=new Set((await l.listDocuments(c)).map(p=>p.path));let d;for(const p of i){const h=hd(t,c.name,u,m,p),S=await l.resolveDocumentPath?.(h)??p;if(b.has(h.path)||f.has(p)||f.has(S))continue;let C=!0;try{await l.getDocument(h)}catch(w){if(!od(w))throw w;C=!1}if(!C){d={layout:t,path:S,slug:ml(S),locator:h};break}}if(d===void 0)throw hl(n.title,e.path);return await l.saveDocument(d.locator,a(d.path)),d}const o1=e=>e?.response?.status===409,hl=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${ki} tries. Fix: choose a different title.`);function yd(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 s1({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:s,server:i}=ze.useServer(),a=go.useQueries({queries:r.map(d=>({queryKey:["new-document-model",e,t,n,d,i],queryFn:async()=>(await s.models.getModel(e,t,d,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),l=a.map(d=>d.dataUpdatedAt).join(),c=ne.useMemo(()=>{const d=new Map;return a.forEach((p,h)=>{const S=[],C=yd(p.data?.modelInfo);for(const w of p.data?.sources??[])if(!(typeof w.name!="string"||!C.has(w.name)))for(const x of w.views??[])typeof x.name=="string"&&S.push({source:w.name,view:x.name});S.length>0&&d.set(r[h],S)}),d},[l,r]),u=a.some(d=>d.isLoading),m=u?[]:r.filter((d,p)=>a[p]?.isError),f=!u&&a.some(d=>d.isError&&Tn.canRetryRequest(d.error)),b=()=>{a.forEach(d=>{d.isError&&d.refetch()})};return{choices:c,isLoading:u,isSuccess:a.length>0&&a.every(d=>!d.isPending),failed:m,retry:b,canRetry:f}}const Mi=ne.createContext(void 0);function i1({children:e,documentStorage:t}){const n=ne.useMemo(()=>({documentStorage:t}),[t]);return g.jsx(Mi.Provider,{value:n,children:e})}function a1(){const e=ne.useContext(Mi);if(!e)throw new Error("useDocumentStorage must be used within a DocumentStorageProvider");return e}function l1(){return ne.useContext(Mi)}const c1=e=>e==="notebook"?"linear":"grid",u1=(e,t)=>`${e}s/${t}.malloy`,d1=/\.malloy(nb)?$/,p1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(d1,"")||void 0,bd=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),vd=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${bd(n)}`,xd="edit",f1=(e,t,n)=>`${vd(e,t,n)}?${xd}`,Sd=e=>e.layout==="linear"?"linear":"grid",wd=e=>({layout:Sd(e),path:e.path,editable:e.editable!==!1});function Ti(e,t){const n=t.find(r=>r.path===e);return n?.path?wd({...n,path:n.path}):void 0}function Cd(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function m1(e,t){if(!Cd(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=Ti(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}function h1(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[td({environmentName:e,packageName:t,modelPath:n})]]]}function g1(e,t,n,r){for(const o of[["report"],["reports"],...h1(t,n,r)])e.invalidateQueries({queryKey:o})}const y1=(e,t,n)=>["reports",e,t,n];async function b1(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 Pd(e,t,n,r=!0){const{apiClients:o}=ze.useServer(),s=_o({queryKey:y1(e,t,n),queryFn:()=>b1(o,e,t,n),enabled:r,staleTime:6e4});return{reports:s.data??[],settled:s.isSuccess||s.isError,isFetching:s.isFetching,isError:s.isError,error:s.error,refetch:s.refetch}}function v1(e,t,n,r){const{reports:o,settled:s}=Pd(e,t,r);return{settled:s,reports:o,location:s?Ti(n,o):void 0}}function _o(e){const{server:t}=ze.useServer(),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 s=o;if(s.response?.data){const i=new Error(s.response.data.message||s.message);throw i.status=s.response.status,i.data=s.response.data,i}}throw o}},retry:!1,throwOnError:!1};return go.useQuery(n,ze.globalQueryClient)}function x1(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 s=new Error(o.response.data.message||o.message);throw s.status=o.response.status,s.data=o.response.data,s}}throw r}},retry:!1,throwOnError:!1};return go.useMutation(t,ze.globalQueryClient)}function kd(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function S1(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function Di(e,{enabled:t=!0}={}){const{apiClients:n}=ze.useServer();return _o({queryKey:kd(e),queryFn:({signal:r})=>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:r}),enabled:t,...ze.CHART_RESULT_QUERY_OPTIONS})}const w1=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function Md(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 s;try{s=e.text("label")}catch{s=void 0}if(s!==void 0&&w1.test(s)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const s of[r,...o])Md(s)&&(t=!0)}return t}function C1(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=Vd.parseAnnotation(t)}catch{return""}return n.log.length>0?"":Md(n.tag)?`${n.tag.toString()}
139
139
  `:e}function ws(e){if(Array.isArray(e)){for(const n of e)ws(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 s=o;typeof s?.value=="string"&&(s.value=C1(s.value))}else ws(r)}function Td(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);ws(t);const r=JSON.stringify(t);return r===n?e:r}const P1=new Set(["bar_chart","line_chart","scatter_chart","shape_map","segment_map","point_map","big_value","sparkline","list","list_detail","dashboard","transpose","table","json","image","link","text"]),k1={value:`# big_value
140
140
  `},M1=/^#\(malloy\)[\s\S]*\bcalculation\b/;function T1(e){return e?e.kind==="measure"?!0:(e.annotations??[]).some(t=>typeof t?.value=="string"&&M1.test(t.value.trim())):!1}function D1(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(T1))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 R1(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=n.slice(1).replace(/"(?:[^"\\]|\\.)*"/g,'""');for(const o of r.split(/[\s{}=.,[\]]+/))if(P1.has(o))return!0}return!1}function Dd(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!D1(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return R1(r)?e:JSON.stringify({...t,annotations:[k1,...n]})}const I1=e=>Td(Dd(e));function Cs(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?Bs(t):e}function Rd({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:s,annotation:i,label:a,subtitle:l,heading:c,borderless:u,givens:m,hostGivens:f,declaredTypes:b,givenNames:d,height:p,maxResultSize:h,drill:S,onExplore:C,chrome:w="card",ignoredFilters:x,preamble:T,restricted:k,index:O}){const{theme:I}=ze.usePublisherTheme(),[N,L]=_m(),R=Di({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:s!==void 0?_s(T??"",`${i?`${i}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.9.8",
4
+ "version": "0.9.9",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -10,14 +10,15 @@ export type ContentType =
10
10
  | "data"
11
11
  | "materialization"
12
12
  | "dataApp"
13
- | "dashboard";
13
+ | "dashboard"
14
+ | "agent";
14
15
 
15
16
  /**
16
17
  * The backplate color behind each icon. One per content type and no repeats: on
17
- * a page that lists all six, a shared color reads as a shared kind, and the
18
+ * a page that lists all seven, a shared color reads as a shared kind, and the
18
19
  * glyphs are small enough that color does most of the telling apart.
19
20
  *
20
- * Six hues from `PALETTE`, spaced far enough apart to survive being 18px of
21
+ * Seven hues from `PALETTE`, spaced far enough apart to survive being 18px of
21
22
  * white on a 32px plate, and disjoint from the three `SURFACE_TINT` uses so a
22
23
  * colour means one kind of thing everywhere in the Console.
23
24
  *
@@ -32,6 +33,7 @@ export const CONTENT_TINT: Record<ContentType, string> = {
32
33
  dataApp: PALETTE.pink,
33
34
  data: PALETTE.lime,
34
35
  materialization: PALETTE.amber,
36
+ agent: PALETTE.red,
35
37
  };
36
38
 
37
39
  interface ContentTypeIconProps extends Omit<SvgIconProps, "fontSize"> {
@@ -90,6 +92,7 @@ const CONTENT_GLYPH: Record<ContentType, () => React.ReactElement> = {
90
92
  materialization: StackPath,
91
93
  dataApp: BrowserWindowPath,
92
94
  dashboard: DashboardGridPath,
95
+ agent: PersonPath,
93
96
  };
94
97
 
95
98
  /** File outline with a folded top-right corner and three chart bars inside. */
@@ -162,6 +165,16 @@ function DashboardGridPath() {
162
165
  );
163
166
  }
164
167
 
168
+ /** A head and shoulders: someone who works with the package. */
169
+ function PersonPath() {
170
+ return (
171
+ <>
172
+ <circle cx="12" cy="8" r="3.5" />
173
+ <path d="M5 20 a7 7 0 0 1 14 0" />
174
+ </>
175
+ );
176
+ }
177
+
165
178
  /** Browser-window outline with an address-bar separator and content lines. */
166
179
  function BrowserWindowPath() {
167
180
  return (
@@ -0,0 +1,76 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ /** The package page's Agents section: what a package declares, read-only. */
5
+ import { render, screen } from "@testing-library/react";
6
+ import { beforeEach, expect, it } from "bun:test";
7
+ import {
8
+ clearCache,
9
+ mockServerProvider,
10
+ pending,
11
+ serverWrapper,
12
+ } from "../../../test/serverProvider";
13
+
14
+ let agents: unknown[] | undefined;
15
+
16
+ mockServerProvider(
17
+ {
18
+ packages: {
19
+ getPackage: () =>
20
+ Promise.resolve({
21
+ data: { name: "pkg", ...(agents ? { agents } : {}) },
22
+ }),
23
+ },
24
+ reports: { listReports: () => Promise.resolve({ data: [] }) },
25
+ models: { listModels: () => Promise.resolve({ data: [] }) },
26
+ databases: { listDatabases: () => Promise.resolve({ data: [] }) },
27
+ dataApps: { listDataApps: () => Promise.resolve({ data: [] }) },
28
+ materializations: { listMaterializations: pending },
29
+ },
30
+ { mutable: true },
31
+ );
32
+
33
+ const { default: Package } = await import("./Package");
34
+
35
+ const mount = () =>
36
+ render(<Package resourceUri="publisher://environments/env/packages/pkg" />, {
37
+ wrapper: serverWrapper,
38
+ });
39
+
40
+ beforeEach(() => {
41
+ clearCache();
42
+ agents = undefined;
43
+ });
44
+
45
+ it("lists each agent with its description, a non-default model, and its schedules as not run yet", async () => {
46
+ agents = [
47
+ {
48
+ name: "analyst",
49
+ description: "Answers revenue questions",
50
+ model: "sonnet",
51
+ schedules: [
52
+ { cron: "0 13 * * MON", task: "agents/analyst/weekly.md" },
53
+ ],
54
+ },
55
+ { name: "plain", description: "No schedule", model: "inherit" },
56
+ ];
57
+
58
+ mount();
59
+
60
+ const section = await screen.findByRole("region", { name: "Agents" });
61
+ expect(section.textContent).toContain("analyst");
62
+ expect(section.textContent).toContain("Answers revenue questions");
63
+ expect(section.textContent).toContain("sonnet");
64
+ expect(section.textContent).toContain("13:00");
65
+ expect(section.textContent).toContain("agents/analyst/weekly.md");
66
+ expect(section.textContent).toContain("Not run yet");
67
+ expect(section.textContent).not.toContain("inherit");
68
+ expect(section.querySelectorAll('[role="button"]')).toHaveLength(0);
69
+ });
70
+
71
+ it("shows no section for a package that declares no agents", async () => {
72
+ mount();
73
+
74
+ await screen.findByRole("region", { name: "Models" });
75
+ expect(screen.queryByRole("region", { name: "Agents" })).toBeNull();
76
+ });