@malloy-publisher/server 0.17.3 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/admin-api-doc.yaml +757 -22
  2. package/dist/app/api-doc.yaml +160 -28
  3. package/dist/app/assets/{EnvironmentPage-Cpetyfj1.js → EnvironmentPage-CsFUI8IX.js} +1 -1
  4. package/dist/app/assets/{HomePage-RlrpQRV8.js → HomePage-B_FVtnN-.js} +1 -1
  5. package/dist/app/assets/{MainPage-C1559_mQ.js → MainPage-wFF9nPEr.js} +1 -1
  6. package/dist/app/assets/{ModelPage-D8T03Bd7.js → ModelPage-CxenqDcz.js} +2 -2
  7. package/dist/app/assets/PackagePage-dcF6vrvw.js +1 -0
  8. package/dist/app/assets/PackageSplatRoute-CASBZk0k.js +2 -0
  9. package/dist/app/assets/{RenderedResult-Cm0Wwtek.es-CfBPkvGU.js → RenderedResult--fYcsY1h.es-DzOt5Lwv.js} +3 -3
  10. package/dist/app/assets/{RouteError-DRuMstfb.js → RouteError-CUIolYwb.js} +1 -1
  11. package/dist/app/assets/{ThemeEditorPage-ss_tmVWo.js → ThemeEditorPage-DgU2YYq6.js} +1 -1
  12. package/dist/app/assets/{ToggleButtonGroup-DA9EfQQB.js → ToggleButtonGroup-Dmr-hVlD.js} +1 -1
  13. package/dist/app/assets/{documentRoutes-_ma0jaCp.js → documentRoutes-Drv-WDwO.js} +1 -1
  14. package/dist/app/assets/{editPageMounted-DxNTqmFg.js → editPageMounted-C5yJiIVi.js} +2 -2
  15. package/dist/app/assets/{index-w1w5RvZI.js → index-BIoSdsU9.js} +1 -1
  16. package/dist/app/assets/{index-BL_7q21Q.js → index-BSyL0zds.js} +97 -97
  17. package/dist/app/assets/{index-BZA1HAyp.js → index-Dtw4eTxH.js} +1 -1
  18. package/dist/app/assets/{index-DrkXqbpl.js → index-DxF3kMLJ.js} +1 -1
  19. package/dist/app/assets/{index.es-XV_AUlWO.js → index.es-CX9m4CBD.js} +10 -10
  20. package/dist/app/assets/usePackageLinkNavigate-qNjcXPcY.js +1 -0
  21. package/dist/app/assets/{usePackageRoute-ev5b1KRn.js → usePackageRoute-wJGaZEiY.js} +1 -1
  22. package/dist/app/index.html +1 -1
  23. package/dist/instrumentation.mjs +31 -17
  24. package/dist/package_load_worker.mjs +528 -377
  25. package/dist/runtime/publisher.colorScheme.spec.ts +167 -0
  26. package/dist/runtime/publisher.js +173 -3
  27. package/dist/runtime/publisher_embed.spec.ts +108 -0
  28. package/dist/server.mjs +10361 -4009
  29. package/package.json +2 -1
  30. package/dist/app/assets/PackagePage-BIl1r9eP.js +0 -1
  31. package/dist/app/assets/PackageSplatRoute-DJlJXk6p.js +0 -2
  32. package/dist/app/assets/usePackageLinkNavigate-BKkPNdJ4.js +0 -1
@@ -1687,6 +1687,15 @@ paths:
1687
1687
  `PACKAGE_IS_VERSIONED`), as is a package with no `latest` yet: publish a new version to
1688
1688
  change content.
1689
1689
 
1690
+ A `manifestLocation` URI that cannot be fetched or bound is refused as on the version
1691
+ route: 400 `MANIFEST_NOT_FOUND` when nothing is at it, 422 `MANIFEST_INVALID` when what is
1692
+ there is not a build manifest, and otherwise 500 `MANIFEST_BIND_FAILED`. That holds on a
1693
+ versioned package, and on an unversioned one with nothing of the PATCH applied: its metadata and publisher.json stay as
1694
+ they were, and it serves what it served before, the manifest it had bound or, with none,
1695
+ live (or this server's own store, where the server restores unversioned packages from it).
1696
+ A manifest that binds with some of its tables declined (one the warehouse does not hold,
1697
+ say) is not a failure: it answers 200, and those sources answer live.
1698
+
1690
1699
  It keeps working, so that callers which predate versions do not break, and says it is
1691
1700
  deprecated: every response carries `Deprecation: true` and a `Link` to the package
1692
1701
  versions reference, every request is counted in `publisher_deprecated_usage_total`
@@ -1762,8 +1771,24 @@ paths:
1762
1771
  $ref: "#/components/responses/NotFound"
1763
1772
  "409":
1764
1773
  $ref: "#/components/responses/Conflict"
1774
+ "422":
1775
+ description: >-
1776
+ The `manifestLocation` holds no build manifest: it does not parse,
1777
+ or is not a manifest (`reason` `MANIFEST_INVALID`; nothing of the
1778
+ PATCH was applied).
1779
+ content:
1780
+ application/json:
1781
+ schema:
1782
+ $ref: "#/components/schemas/Error"
1765
1783
  "500":
1766
- $ref: "#/components/responses/InternalServerError"
1784
+ description: >-
1785
+ The `manifestLocation` could not be fetched or bound (`reason`
1786
+ `MANIFEST_BIND_FAILED`; nothing of it was applied), or another
1787
+ internal error.
1788
+ content:
1789
+ application/json:
1790
+ schema:
1791
+ $ref: "#/components/schemas/Error"
1767
1792
  "503":
1768
1793
  $ref: "#/components/responses/ServiceUnavailable"
1769
1794
  delete:
@@ -2029,6 +2054,25 @@ paths:
2029
2054
  a PUT replaces the binding, and many generated clients drop a null field from the JSON
2030
2055
  they send. `manifestLocation` is the body's only field, so any other field is refused
2031
2056
  with 400 naming it, rather than read as a clear.
2057
+
2058
+ A manifest that cannot be fetched or bound is refused with the cause in the message:
2059
+ 400 with `reason` `MANIFEST_NOT_FOUND` when nothing is at the location (no such file, or
2060
+ an object store's no such object or bucket); 422 with `reason` `MANIFEST_INVALID` when
2061
+ what is there does not parse, is not a JSON object, or has an `entries` that is not an
2062
+ object; and 500 with `reason` `MANIFEST_BIND_FAILED` otherwise (the fetch timed out, the
2063
+ network failed, the store refused the server's credentials, or the bind threw). The
2064
+ first two are the caller's input and fail the same way until it changes; the last is the
2065
+ server's. Whichever it is, nothing of it is applied: the version's `manifestLocation` stays what it was, the version
2066
+ is not marked host-owned, and it serves what it served before the request, the manifest
2067
+ it had bound or, with none, live (or this server's own runs' tables, for a version no
2068
+ host has bound). Its status says the same: `manifestBindingStatus`, `boundManifestUri` and
2069
+ `manifestEntryCount` describe that previous binding. One exception: when the failure came
2070
+ after the version's models moved, the previous manifest is fetched and bound again, and if
2071
+ that fails too the version reports `bind_failed`, as any failed rebind does (see
2072
+ `manifestBindingStatus`), and the server logs that failed bind.
2073
+ Releases before this one answered 200 here and reported the failure only as
2074
+ `manifestBindingStatus` `bind_failed`. A publish that names a `manifestLocation` still
2075
+ loads the version and reports a failed bind that way.
2032
2076
  parameters:
2033
2077
  - $ref: "#/components/parameters/environmentName"
2034
2078
  - $ref: "#/components/parameters/packageName"
@@ -2059,10 +2103,26 @@ paths:
2059
2103
  $ref: "#/components/responses/NotFound"
2060
2104
  "410":
2061
2105
  $ref: "#/components/responses/Gone"
2106
+ "422":
2107
+ description: >-
2108
+ The manifest at `manifestLocation` does not parse, or is not a
2109
+ build manifest (`reason` `MANIFEST_INVALID`; nothing of it was
2110
+ applied).
2111
+ content:
2112
+ application/json:
2113
+ schema:
2114
+ $ref: "#/components/schemas/Error"
2062
2115
  "424":
2063
2116
  $ref: "#/components/responses/PackageManifestError"
2064
2117
  "500":
2065
- $ref: "#/components/responses/InternalServerError"
2118
+ description: >-
2119
+ The manifest could not be fetched or bound (`reason`
2120
+ `MANIFEST_BIND_FAILED`; nothing of it was applied), or another
2121
+ internal error.
2122
+ content:
2123
+ application/json:
2124
+ schema:
2125
+ $ref: "#/components/schemas/Error"
2066
2126
  "503":
2067
2127
  $ref: "#/components/responses/ServiceUnavailable"
2068
2128
 
@@ -3954,7 +4014,12 @@ paths:
3954
4014
  (`admin-api-doc.yaml`); this route is removed in a later release.
3955
4015
 
3956
4016
  Drops one named table from a storage destination. Idempotent: a table that
3957
- does not exist answers 204 as well, so a retried drop is free.
4017
+ does not exist answers 204 as well, so a retried drop is free. The path's
4018
+ schema qualifies the table. On a destination whose `destinationSchema` is
4019
+ set and is not `main`, a `main` path answers `400` naming the
4020
+ `destinationSchema` (an earlier release read `main` as the destination's
4021
+ own schema): name the `destinationSchema` to drop a build table, and drop
4022
+ a table in `main` through the admin API.
3958
4023
 
3959
4024
  For a DuckLake destination this retires the table in the catalog; its data
3960
4025
  files stay in storage until a file cleanup reclaims them (see
@@ -5051,13 +5116,14 @@ components:
5051
5116
  type: boolean
5052
5117
  deprecated: true
5053
5118
  description: >-
5054
- DEPRECATED, removed in a later release: a bind now compiles every
5055
- model's served copy over the new tables before they are swapped
5056
- in, and models read the previous tables until then, so a verdict
5057
- read after a bind returns is never pending. Present, and `true`,
5058
- only while some model holding this source has yet to compile its
5059
- copy over the tables bound now, which a server's own binds never
5060
- leave behind.
5119
+ Retained, no longer produced. A bind compiles each model's served
5120
+ copy over the new tables before they are swapped in. A freshness
5121
+ window that lapses changes the tables a query reads with no bind:
5122
+ from that edge, each query compiles its own copy without the
5123
+ lapsed table, the package recompiles each served copy at the edge,
5124
+ and until that compile lands a verdict leaves the lapsed table
5125
+ out by its recorded window, judged against the clock. A verdict
5126
+ is therefore never pending, and this field is never present.
5061
5127
  message:
5062
5128
  type: string
5063
5129
  description: What the verdict means for this source, in a sentence.
@@ -6175,6 +6241,24 @@ components:
6175
6241
  `malloynb-cell-refused` (`off_surface`, `caller_annotation`,
6176
6242
  `required_filter`, `restricted_mode`, `compile_error`). Always snake_case. An open
6177
6243
  string; absent on a finding that has none.
6244
+ sourceEntityId:
6245
+ type: string
6246
+ description: >-
6247
+ The content address (its manifest key) of the stored table a
6248
+ finding is about, so a client routes it without reading the
6249
+ message: set on `database-table-unread` and
6250
+ `storage-table-unread`, where `subject` names the source a
6251
+ query names (a rollup's base) and this names the unread
6252
+ table's own source. Absent on every other finding.
6253
+ sourceName:
6254
+ type: string
6255
+ description: >-
6256
+ The name of the source whose stored table a finding is about,
6257
+ beside `sourceEntityId`: for a rollup's table, the rollup's
6258
+ own source (`<base>__rollup__…`), not the base `subject`
6259
+ names. Set on `database-table-unread` and
6260
+ `storage-table-unread` when the build plan knows the table;
6261
+ absent otherwise.
6178
6262
  severity:
6179
6263
  type: string
6180
6264
  enum:
@@ -9127,9 +9211,11 @@ components:
9127
9211
  This is a rule on statements, not on what a SELECT reads: that is
9128
9212
  bounded by the catalog role and by the session's storage secret,
9129
9213
  which on a managed connection attached read-only is scoped to the
9130
- `main` schema's recorded path, so a SELECT reads only that schema's
9131
- files; another schema's files, and any other object in the bucket,
9132
- are unsigned (403). Absent or false is the pre-existing behavior.
9214
+ recorded paths of the `main` schema and of the schemas
9215
+ `ducklakeConnection.readableSchemas` lists, so a SELECT reads only
9216
+ those schemas' files; another schema's files, and any other object
9217
+ in the bucket, are unsigned (403). Absent or false is the
9218
+ pre-existing behavior.
9133
9219
  fingerprint:
9134
9220
  type: string
9135
9221
  description: >
@@ -9660,13 +9746,47 @@ components:
9660
9746
  Storage destinations only; ignored on a connection. The schema a
9661
9747
  destination builds its tables into and binds them from, so an
9662
9748
  orchestrator can keep the tables it owns apart from a catalog's `main`
9663
- (where people put their own). Absent means `main`, the pre-existing
9749
+ (a table PUT may write people's own tables there; a load may not, so
9750
+ loads go in a schema created through the admin API). Absent means
9751
+ `main`, the pre-existing
9664
9752
  layout. The schema must already exist in the catalog: a build does not
9665
9753
  create it. A `#@ persist name=` that already names a schema keeps that
9666
9754
  schema. Must be a plain identifier (`[A-Za-z_][A-Za-z0-9_]*`).
9667
9755
  Serving reads the schema configured now, not the one a table was
9668
9756
  built into, so changing it on a destination re-points every bound
9669
9757
  table at once: rebuild or rebind as you change it.
9758
+ readableSchemas:
9759
+ type: array
9760
+ items:
9761
+ type: string
9762
+ pattern: "^[a-z_][a-z0-9_]*$"
9763
+ description: >-
9764
+ Additional schemas a managed read-only view may read. Only on a
9765
+ connection with `managed: true` and a read-only attach (never on a
9766
+ storage destination). `main` is always readable and may be omitted.
9767
+ The view's storage secret is scoped to the recorded path of `main`
9768
+ and of each schema listed here, so a SELECT reads those schemas'
9769
+ files and nothing else in the bucket. Each name is a plain lowercase
9770
+ identifier (`[a-z_][a-z0-9_]*`); order and duplicates are ignored. A
9771
+ schema the catalog does not record, or whose recorded path is not
9772
+ under the catalog's data path, is left out of the scope. On a local
9773
+ data path the view's file allowlist is scoped the same way. SQL on
9774
+ the connection may name a listed schema's tables as it does
9775
+ `main`'s, its schema and table listings show the listed schemas
9776
+ beside `main`, and every other schema stays refused. `main` is
9777
+ implicit, and the request is refused with a 400 when it lists
9778
+ `memory`, `information_schema`, `pg_catalog`, `temp`, `system` or a
9779
+ name starting with `__ducklake_metadata_`, or a schema that a storage
9780
+ destination of the same environment on the same catalog builds into
9781
+ (that destination's stored copies, gated sources' rows among them,
9782
+ would be readable by name without their gate); the same pair in a
9783
+ configured environment fails that environment's load at startup. A
9784
+ destination that shares the catalog and builds into `main` must set
9785
+ `destinationSchema`. Create a schema in the
9786
+ catalog before listing it: a schema listed before it exists gets no
9787
+ file access until the connection is next edited or the server
9788
+ restarts. Removing a schema from the list takes effect for
9789
+ already-loaded packages only after they reload.
9670
9790
  readOnly:
9671
9791
  type: boolean
9672
9792
  default: true
@@ -10075,7 +10195,12 @@ components:
10075
10195
  recorded on the run instead: as a `SourceFailure` with `refused`
10076
10196
  and `refusalReason` on a run with `buildInstructions`, otherwise
10077
10197
  in the run's `metadata.refusedSources`, or its `error` when
10078
- nothing else was left to build.
10198
+ nothing else was left to build. `failures` holds one outcome per
10199
+ address, so on a run with `buildInstructions` a refused source
10200
+ whose address holds another outcome (a table an eligible source
10201
+ built, another source's build failure, or another source's
10202
+ refusal) is in `metadata.refusedSources` instead, with its own
10203
+ reason, on a FAILED run too.
10079
10204
 
10080
10205
  TABLE_OWNED_ELSEWHERE and TABLE_OWNERSHIP_UNVERIFIED, on a 400,
10081
10206
  mean a build was refused before it wrote because its `name=` is
@@ -10112,6 +10237,22 @@ components:
10112
10237
  package's versions share (name tables of its own in
10113
10238
  `buildInstructions`). The message says which.
10114
10239
 
10240
+ MANIFEST_BIND_FAILED, on a 500 from
10241
+ `set-package-version-manifest` or the deprecated `update-package`
10242
+ PATCH that names a `manifestLocation` (on a versioned or an
10243
+ unversioned package), means the manifest could not be fetched or
10244
+ bound, so nothing of it was applied: the `manifestLocation` stays
10245
+ what it was (an unversioned package's whole PATCH is undone,
10246
+ publisher.json included), and the package or version serves what
10247
+ it served before. The message carries the cause.
10248
+
10249
+ MANIFEST_NOT_FOUND, on a 400 from the same routes, means nothing
10250
+ is at the `manifestLocation` (no such file, object or bucket),
10251
+ and MANIFEST_INVALID, on a 422, that what is there does not parse
10252
+ or is not a build manifest. Both are the caller's input: nothing
10253
+ of the manifest was applied, as with MANIFEST_BIND_FAILED, and
10254
+ sending it unchanged fails the same way.
10255
+
10115
10256
  Deliberately an open string rather than an enum. Generators render
10116
10257
  an enum closed, so adding a second value here would break every
10117
10258
  client generated before it -- on the one field whose purpose is to
@@ -11774,17 +11915,6 @@ components:
11774
11915
  the upstreams a named source reads when it cannot carry them)
11775
11916
  fails the build, and a downstream is never built by recomputing
11776
11917
  its upstreams from raw.
11777
- warehouseReach:
11778
- type: string
11779
- default: recompute
11780
- deprecated: true
11781
- description: >-
11782
- Deprecated: accepted and ignored. No build recomputes a stored
11783
- upstream from the source warehouse, so there is nothing for it to
11784
- choose; a request that sends it (or `strictUpstreams`) logs one
11785
- deprecation warning. The values are still validated: `recompute`
11786
- and `refuse` are accepted, null reads as absent, and any other
11787
- value is a 400.
11788
11918
  ledger:
11789
11919
  type: array
11790
11920
  items:
@@ -12929,8 +13059,10 @@ components:
12929
13059
  in: path
12930
13060
  required: true
12931
13061
  description: |
12932
- Schema within the storage destination. A table built from a bare
12933
- physical name lives in `main`.
13062
+ Schema within the storage destination: the path's table is `{schemaName}.{tableName}`.
13063
+ A build writes a bare physical name into the destination's `destinationSchema`
13064
+ (`main` when it declares none), so a drop in `main` on a destination that sets
13065
+ another `destinationSchema` answers `400` naming it.
12934
13066
  schema:
12935
13067
  $ref: "#/components/schemas/IdentifierPattern"
12936
13068
  materializationId:
@@ -1 +1 @@
1
- import{x as r,C as t,j as e,a7 as i,aa as o}from"./index-BL_7q21Q.js";function m(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{m as default};
1
+ import{E as r,C as t,j as e,a7 as i,aa as o}from"./index-BSyL0zds.js";function m(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{m as default};
@@ -1 +1 @@
1
- import{x as t,j as o,N as a}from"./index-BL_7q21Q.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
1
+ import{E as t,j as o,q as a}from"./index-BSyL0zds.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
@@ -1 +1 @@
1
- import{c as j,j as t,s as C,B as Ee,m as Q,e as ce,g as me,a as fe,r as x,u as ge,b as Me,d as W,f as ye,T as K,h as G,i as ze,k as Ie,l as Ce,o as be,n as De,p as Te,q as de,t as Be,v as Re,w as A,y as $,M as Le,P as He,z as $e,S as Ne,A as J,C as Z,D as Ae,Y as Oe,E as We,F as pe,G as Ve,x as ee,H as u,I as Fe,J as Y,K as V,L as te,O as Ue,Q as _e,R as ue,U as Xe,V as re,W as ne,X as oe,Z as Ye,_ as qe,$ as Qe,a0 as Ke}from"./index-BL_7q21Q.js";import{u as Ge,l as he}from"./editPageMounted-DxNTqmFg.js";import{i as Je,w as Ze,a as et}from"./documentRoutes-_ma0jaCp.js";import{u as ve,p as tt}from"./usePackageRoute-ev5b1KRn.js";const rt=j(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),nt=C(Ee,{name:"MuiBreadcrumbCollapsed"})(Q(({theme:e})=>({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`,...e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}},"&:active":{boxShadow:e.shadows[0],...e.palette.mode==="light"?{backgroundColor:ce(e.palette.grey[200],.12)}:{backgroundColor:ce(e.palette.grey[600],.12)}}}))),ot=C(rt)({width:24,height:16});function st(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(nt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(ot,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function at(e){return me("MuiBreadcrumbs",e)}const it=fe("MuiBreadcrumbs",["root","ol","li","separator"]),lt=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},at,r)},ct=C(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${it.li}`]:r.li},r.root]})({}),dt=C("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),pt=C("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,r,o,n){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(pt,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(a),s),[])}const ht=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:d={},slotProps:m={},expandText:p="Show path",itemsAfterCollapse:h=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:w="/",...D}=n,[k,S]=x.useState(!1),v={...n,component:i,expanded:k,expandText:p,itemsAfterCollapse:h,itemsBeforeCollapse:b,maxItems:g,separator:w},z=lt(v),T=Me({elementType:d.CollapsedIcon,externalSlotProps:m.collapsedIcon,ownerState:v}),P=x.useRef(null),E=c=>{const M=()=>{S(!0);const y=P.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+h>=c.length?c:[...c.slice(0,b),t.jsx(st,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-h,c.length)]},B=x.Children.toArray(s).filter(c=>x.isValidElement(c)).map((c,M)=>t.jsx("li",{className:z.li,children:c},`child-${M}`));return t.jsx(ct,{ref:o,component:i,color:"textSecondary",className:W(z.root,a),ownerState:v,...D,children:t.jsx(dt,{className:z.ol,ref:P,ownerState:v,children:ut(k||g&&B.length<=g?B:E(B),z.separator,w,v)})})});function xt(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),a=be(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const p=a.getComputedStyle(r);i=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,m=0;if(i&&i!=="none"&&typeof i=="string"){const p=i.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),m=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${a.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+m-n.top}px)`:`translateY(${a.innerHeight+m-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-m}px)`:`translateY(-${n.top+n.height-m}px)`}function mt(e){return typeof e=="function"?e():e}function O(e,r,o){const n=mt(o),s=xt(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ft=x.forwardRef(function(r,o){const n=G(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:m,container:p,direction:h="down",easing:b=s,in:g,onEnter:w,onEntered:D,onEntering:k,onExit:S,onExited:v,onExiting:z,style:T,timeout:P=a,TransitionComponent:E=ze,...B}=r,c=x.useRef(null),M=Ie(Ce(m),c,o),y=l=>f=>{l&&(f===void 0?l(c.current):l(c.current,f))},F=y((l,f)=>{O(h,l,p),Te(l),w&&w(l,f)}),ae=y((l,f)=>{const H=de({timeout:P,style:T,easing:b},{mode:"enter"});l.style.webkitTransition=n.transitions.create("-webkit-transform",{...H}),l.style.transition=n.transitions.create("transform",{...H}),l.style.webkitTransform="none",l.style.transform="none",k&&k(l,f)}),R=y(D),L=y(z),I=y(l=>{const f=de({timeout:P,style:T,easing:b},{mode:"exit"});l.style.webkitTransition=n.transitions.create("-webkit-transform",f),l.style.transition=n.transitions.create("transform",f),O(h,l,p),S&&S(l)}),U=y(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),_=l=>{i&&i(c.current,l)},N=x.useCallback(()=>{c.current&&O(h,c.current,p)},[h,p]);return x.useEffect(()=>{if(g||h==="down"||h==="right")return;const l=De(()=>{c.current&&O(h,c.current,p)}),f=be(c.current);return f.addEventListener("resize",l),()=>{l.clear(),f.removeEventListener("resize",l)}},[h,g,p]),x.useEffect(()=>{g||N()},[g,N]),t.jsx(E,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:I,onExited:U,onExiting:L,addEndListener:_,appear:d,in:g,timeout:P,...B,children:(l,{ownerState:f,...H})=>x.cloneElement(m,{ref:M,style:{visibility:l==="exited"&&!g?"hidden":void 0,...T,...m.props.style},...H})})});function gt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const je=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},yt=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${$(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${$(o)}`,n!=="temporary"&&`paperAnchorDocked${$(o)}`]};return ye(s,gt,r)},bt=C(Le,{name:"MuiDrawer",slot:"Root",overridesResolver:je})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),vt=C("div",{shouldForwardProp:$e,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:je})({flex:"0 0 auto"}),jt=C(He,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${$(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${$(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),ke={left:"right",right:"left",top:"down",bottom:"up"};function kt(e){return["left","right"].includes(e)}function wt({direction:e},r){return e==="rtl"&&kt(r)?ke[r]:r}const St=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=G(),a=Be(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:m,children:p,className:h,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:w,...D}={},onClose:k,open:S=!1,PaperProps:v={},SlideProps:z,TransitionComponent:T,transitionDuration:P=i,variant:E="temporary",slots:B={},slotProps:c={},...M}=n,y=x.useRef(!1);x.useEffect(()=>{y.current=!0},[]);const F=wt({direction:a?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:S,variant:E,...M},L=yt(R),I={slots:{transition:T,...B},slotProps:{paper:v,transition:z,...c,backdrop:Re(c.backdrop||{...m,...w},{transitionDuration:P})}},[U,_]=A("root",{ref:o,elementType:bt,className:W(L.root,L.modal,h),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...I,...M,...D},additionalProps:{open:S,onClose:k,hideBackdrop:g,slots:{backdrop:I.slots.backdrop},slotProps:{backdrop:I.slotProps.backdrop}}}),[N,l]=A("paper",{elementType:jt,shouldForwardComponentProp:!0,className:W(L.paper,v.className),ownerState:R,externalForwardedProps:I,additionalProps:{elevation:E==="temporary"?b:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,H]=A("docked",{elementType:vt,ref:o,className:W(L.root,L.docked,h),ownerState:R,externalForwardedProps:I,additionalProps:M}),[Se,Pe]=A("transition",{elementType:ft,ownerState:R,externalForwardedProps:I,additionalProps:{in:S,direction:ke[F],timeout:P,appear:y.current}}),ie=t.jsx(N,{...l,children:p});if(E==="permanent")return t.jsx(f,{...H,children:ie});const le=t.jsx(Se,{...Pe,children:ie});return E==="persistent"?t.jsx(f,{...H,children:le}):t.jsx(U,{..._,children:le})}),Pt=j([t.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),t.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Et=j(t.jsx("path",{d:"M10.85 12.65h2.3L12 9zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9z"})),Mt=j(t.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),zt=j(t.jsx("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),It=j(t.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"})),Ct=j(t.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),Dt=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Tt=j(t.jsx("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Bt=j(t.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Rt=j([t.jsx("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),t.jsx("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),t.jsx("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),t.jsx("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),t.jsx("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")]);function q(e){return t.jsxs(Ne,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const Lt=/\.malloy(nb)?$/;function Ht(){const{pathname:e,search:r}=J(),o=Z(),n=Ae(),s=Oe(),a=Ge(),i=o.environmentName??"",d=o.packageName??"",m=ve({always:!0}),p=m.path??"",h=i!==""&&d!==""&&p!==""&&m.writable&&!Lt.test(p),{reports:b,settled:g}=We(i,d,void 0,h);if(!h||s)return null;const w=p.replace(/\/$/,""),D=Je(r),k=e.replace(/\/$/,"");return D?a?null:t.jsx(pe,{label:"View",onClick:()=>n(`${k}${Ze(r)}`)}):(g?Ve(`${w}.malloy`,b):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(It,{}),onClick:()=>n(`${k}${et(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Fe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,"aria-current":o?"page":void 0,sx:n=>({backgroundColor:"transparent",border:"none",color:o?"text.primary":"text.secondary",fontWeight:o?500:400,fontSize:13,height:28,cursor:"pointer",borderRadius:"6px",maxWidth:320,"& .MuiChip-label":{px:.75,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function $t(){const e=Z(),r=ve(),o=e.environmentName&&e.packageName?tt(e.environmentName,e.packageName,r.versionSegment):"",n=r.path?r.path.replace(/\/$/,""):void 0,s=ee();return!e.environmentName&&!e.packageName&&!n?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ht,{"aria-label":"breadcrumb",separator:t.jsx(u,{component:"span","aria-hidden":!0,sx:{color:"text.disabled"},children:"/"}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,current:!e.packageName&&!n,onClick:a=>s(`/${e.environmentName}/`,a)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!n,onClick:a=>s(`${o}/`,a)}),n&&t.jsx(X,{label:n,current:!0,onClick:a=>s(`${o}/${n}`,a)})]})})}const Nt=260,At=64;function we({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?At:Nt,flexShrink:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden"},children:[t.jsx(Ot,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Wt,{isCollapsed:e}),t.jsx(Vt,{isCollapsed:e})]}),t.jsx(Ft,{isCollapsed:e})]})}function Ot({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=ee();return o?t.jsxs(u,{sx:{height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:e?0:2,flexShrink:0},children:[o,t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})]}):t.jsxs(u,{sx:{minHeight:56,display:"flex",flexDirection:e?"column":"row",alignItems:"center",justifyContent:e?"center":"space-between",gap:e?.5:0,py:e?1:0,px:e?0:2,flexShrink:0},children:[t.jsxs(u,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(u,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(K,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(V,{title:e?"Expand sidebar":"Collapse sidebar",placement:"right",children:t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})})]})}function Wt({isCollapsed:e}){const o=J().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(Dt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Vt({isCollapsed:e}){const{apiClients:r}=Ue(),o=Z(),{data:n}=_e({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(K,{variant:"caption",sx:{display:"block",px:3,py:1,color:"text.secondary",fontWeight:500,textTransform:"uppercase",fontSize:"0.6875rem",letterSpacing:"0.5px"},children:"Environments"}),t.jsx(te,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(se,{icon:t.jsx(Ct,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Ft({isCollapsed:e}){const{pathname:r}=J(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Bt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Rt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Yt,{isCollapsed:e}),o.map(n=>t.jsx(Ut,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function se({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const a=ee(),i=t.jsxs(re,{selected:n,onClick:d=>a(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(oe,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:r,placement:"right",children:t.jsx(u,{children:i})}):i}function Ut({label:e,href:r,icon:o,external:n,isCollapsed:s}){const a=t.jsxs(re,{component:"a",href:r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(oe,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:e,placement:"right",children:t.jsx(u,{children:a})}):a}const _t={light:"dark",dark:"auto",auto:"light"},Xt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},xe={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Yt({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=Xe();if(!s)return null;const a=o??r,i=a==="auto"?Et:a==="dark"?zt:Tt,d=t.jsxs(re,{"aria-label":xe[a],onClick:()=>n(_t[a]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(ne,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Xt[a],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[a],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function qt({open:e,onClose:r,logoHeader:o}){return t.jsx(St,{anchor:"left",open:e,onClose:r,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:260}},children:t.jsx(we,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Zt({headerProps:e}){const r=G(),o=Ye(r.breakpoints.up("md")),[n,s]=x.useState(!1),[a,i]=x.useState(!1);return x.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(we,{isCollapsed:a,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(u,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(u,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:qe.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(u,{sx:{display:{xs:"flex",md:"none"},alignItems:"center",mr:1},children:t.jsx(Y,{size:"small",onClick:()=>s(!0),"aria-label":"Open navigation",children:t.jsx(q,{fontSize:"small"})})}),t.jsx(u,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx($t,{})}),t.jsxs(u,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Ht,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(x.Suspense,{fallback:t.jsx(Ke,{}),children:t.jsx(Qe,{})})})]}),t.jsx(qt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Zt as default};
1
+ import{c as j,j as t,s as C,B as Ee,m as Q,e as ce,g as me,a as fe,r as x,u as ge,b as Me,d as W,f as ye,T as K,h as Z,i as ze,k as Ie,l as Ce,o as be,n as De,p as Te,t as de,v as Be,w as Re,x as A,y as $,M as Le,P as He,z as $e,S as Ne,A as G,C as J,D as Ae,Z as Oe,F as We,G as pe,H as Ve,E as ee,I as u,J as Fe,K as Y,L as V,N as te,O as _e,Q as Ue,_ as ue,R as Xe,U as re,V as ne,W as oe,X as Ye,Y as qe,$ as Qe,a0 as Ke}from"./index-BSyL0zds.js";import{u as Ze,l as he}from"./editPageMounted-C5yJiIVi.js";import{i as Ge,w as Je,a as et}from"./documentRoutes-Drv-WDwO.js";import{u as ve,p as tt}from"./usePackageRoute-wJGaZEiY.js";const rt=j(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),nt=C(Ee,{name:"MuiBreadcrumbCollapsed"})(Q(({theme:e})=>({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`,...e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}},"&:active":{boxShadow:e.shadows[0],...e.palette.mode==="light"?{backgroundColor:ce(e.palette.grey[200],.12)}:{backgroundColor:ce(e.palette.grey[600],.12)}}}))),ot=C(rt)({width:24,height:16});function st(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(nt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(ot,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function at(e){return me("MuiBreadcrumbs",e)}const it=fe("MuiBreadcrumbs",["root","ol","li","separator"]),lt=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},at,r)},ct=C(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${it.li}`]:r.li},r.root]})({}),dt=C("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),pt=C("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,r,o,n){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(pt,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(a),s),[])}const ht=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:d={},slotProps:m={},expandText:p="Show path",itemsAfterCollapse:h=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:w="/",...D}=n,[k,S]=x.useState(!1),v={...n,component:i,expanded:k,expandText:p,itemsAfterCollapse:h,itemsBeforeCollapse:b,maxItems:g,separator:w},z=lt(v),T=Me({elementType:d.CollapsedIcon,externalSlotProps:m.collapsedIcon,ownerState:v}),P=x.useRef(null),E=c=>{const M=()=>{S(!0);const y=P.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+h>=c.length?c:[...c.slice(0,b),t.jsx(st,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-h,c.length)]},B=x.Children.toArray(s).filter(c=>x.isValidElement(c)).map((c,M)=>t.jsx("li",{className:z.li,children:c},`child-${M}`));return t.jsx(ct,{ref:o,component:i,color:"textSecondary",className:W(z.root,a),ownerState:v,...D,children:t.jsx(dt,{className:z.ol,ref:P,ownerState:v,children:ut(k||g&&B.length<=g?B:E(B),z.separator,w,v)})})});function xt(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),a=be(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const p=a.getComputedStyle(r);i=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,m=0;if(i&&i!=="none"&&typeof i=="string"){const p=i.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),m=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${a.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+m-n.top}px)`:`translateY(${a.innerHeight+m-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-m}px)`:`translateY(-${n.top+n.height-m}px)`}function mt(e){return typeof e=="function"?e():e}function O(e,r,o){const n=mt(o),s=xt(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ft=x.forwardRef(function(r,o){const n=Z(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:m,container:p,direction:h="down",easing:b=s,in:g,onEnter:w,onEntered:D,onEntering:k,onExit:S,onExited:v,onExiting:z,style:T,timeout:P=a,TransitionComponent:E=ze,...B}=r,c=x.useRef(null),M=Ie(Ce(m),c,o),y=l=>f=>{l&&(f===void 0?l(c.current):l(c.current,f))},F=y((l,f)=>{O(h,l,p),Te(l),w&&w(l,f)}),ae=y((l,f)=>{const H=de({timeout:P,style:T,easing:b},{mode:"enter"});l.style.webkitTransition=n.transitions.create("-webkit-transform",{...H}),l.style.transition=n.transitions.create("transform",{...H}),l.style.webkitTransform="none",l.style.transform="none",k&&k(l,f)}),R=y(D),L=y(z),I=y(l=>{const f=de({timeout:P,style:T,easing:b},{mode:"exit"});l.style.webkitTransition=n.transitions.create("-webkit-transform",f),l.style.transition=n.transitions.create("transform",f),O(h,l,p),S&&S(l)}),_=y(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),U=l=>{i&&i(c.current,l)},N=x.useCallback(()=>{c.current&&O(h,c.current,p)},[h,p]);return x.useEffect(()=>{if(g||h==="down"||h==="right")return;const l=De(()=>{c.current&&O(h,c.current,p)}),f=be(c.current);return f.addEventListener("resize",l),()=>{l.clear(),f.removeEventListener("resize",l)}},[h,g,p]),x.useEffect(()=>{g||N()},[g,N]),t.jsx(E,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:I,onExited:_,onExiting:L,addEndListener:U,appear:d,in:g,timeout:P,...B,children:(l,{ownerState:f,...H})=>x.cloneElement(m,{ref:M,style:{visibility:l==="exited"&&!g?"hidden":void 0,...T,...m.props.style},...H})})});function gt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const je=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},yt=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${$(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${$(o)}`,n!=="temporary"&&`paperAnchorDocked${$(o)}`]};return ye(s,gt,r)},bt=C(Le,{name:"MuiDrawer",slot:"Root",overridesResolver:je})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),vt=C("div",{shouldForwardProp:$e,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:je})({flex:"0 0 auto"}),jt=C(He,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${$(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${$(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),ke={left:"right",right:"left",top:"down",bottom:"up"};function kt(e){return["left","right"].includes(e)}function wt({direction:e},r){return e==="rtl"&&kt(r)?ke[r]:r}const St=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=Z(),a=Be(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:m,children:p,className:h,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:w,...D}={},onClose:k,open:S=!1,PaperProps:v={},SlideProps:z,TransitionComponent:T,transitionDuration:P=i,variant:E="temporary",slots:B={},slotProps:c={},...M}=n,y=x.useRef(!1);x.useEffect(()=>{y.current=!0},[]);const F=wt({direction:a?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:S,variant:E,...M},L=yt(R),I={slots:{transition:T,...B},slotProps:{paper:v,transition:z,...c,backdrop:Re(c.backdrop||{...m,...w},{transitionDuration:P})}},[_,U]=A("root",{ref:o,elementType:bt,className:W(L.root,L.modal,h),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...I,...M,...D},additionalProps:{open:S,onClose:k,hideBackdrop:g,slots:{backdrop:I.slots.backdrop},slotProps:{backdrop:I.slotProps.backdrop}}}),[N,l]=A("paper",{elementType:jt,shouldForwardComponentProp:!0,className:W(L.paper,v.className),ownerState:R,externalForwardedProps:I,additionalProps:{elevation:E==="temporary"?b:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,H]=A("docked",{elementType:vt,ref:o,className:W(L.root,L.docked,h),ownerState:R,externalForwardedProps:I,additionalProps:M}),[Se,Pe]=A("transition",{elementType:ft,ownerState:R,externalForwardedProps:I,additionalProps:{in:S,direction:ke[F],timeout:P,appear:y.current}}),ie=t.jsx(N,{...l,children:p});if(E==="permanent")return t.jsx(f,{...H,children:ie});const le=t.jsx(Se,{...Pe,children:ie});return E==="persistent"?t.jsx(f,{...H,children:le}):t.jsx(_,{...U,children:le})}),Pt=j([t.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),t.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Et=j(t.jsx("path",{d:"M10.85 12.65h2.3L12 9zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9z"})),Mt=j(t.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),zt=j(t.jsx("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),It=j(t.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"})),Ct=j(t.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),Dt=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Tt=j(t.jsx("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Bt=j(t.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Rt=j([t.jsx("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),t.jsx("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),t.jsx("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),t.jsx("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),t.jsx("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")]);function q(e){return t.jsxs(Ne,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const Lt=/\.malloy(nb)?$/;function Ht(){const{pathname:e,search:r}=G(),o=J(),n=Ae(),s=Oe(),a=Ze(),i=o.environmentName??"",d=o.packageName??"",m=ve({always:!0}),p=m.path??"",h=i!==""&&d!==""&&p!==""&&m.writable&&!Lt.test(p),{reports:b,settled:g}=We(i,d,void 0,h);if(!h||s)return null;const w=p.replace(/\/$/,""),D=Ge(r),k=e.replace(/\/$/,"");return D?a?null:t.jsx(pe,{label:"View",onClick:()=>n(`${k}${Je(r)}`)}):(g?Ve(`${w}.malloy`,b):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(It,{}),onClick:()=>n(`${k}${et(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Fe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,"aria-current":o?"page":void 0,sx:n=>({backgroundColor:"transparent",border:"none",color:o?"text.primary":"text.secondary",fontWeight:o?500:400,fontSize:13,height:28,cursor:"pointer",borderRadius:"6px",maxWidth:320,"& .MuiChip-label":{px:.75,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function $t(){const e=J(),r=ve(),o=e.environmentName&&e.packageName?tt(e.environmentName,e.packageName,r.versionSegment):"",n=r.path?r.path.replace(/\/$/,""):void 0,s=ee();return!e.environmentName&&!e.packageName&&!n?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ht,{"aria-label":"breadcrumb",separator:t.jsx(u,{component:"span","aria-hidden":!0,sx:{color:"text.disabled"},children:"/"}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,current:!e.packageName&&!n,onClick:a=>s(`/${e.environmentName}/`,a)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!n,onClick:a=>s(`${o}/`,a)}),n&&t.jsx(X,{label:n,current:!0,onClick:a=>s(`${o}/${n}`,a)})]})})}const Nt=260,At=64;function we({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?At:Nt,flexShrink:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden"},children:[t.jsx(Ot,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Wt,{isCollapsed:e}),t.jsx(Vt,{isCollapsed:e})]}),t.jsx(Ft,{isCollapsed:e})]})}function Ot({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=ee();return o?t.jsxs(u,{sx:{height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:e?0:2,flexShrink:0},children:[o,t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})]}):t.jsxs(u,{sx:{minHeight:56,display:"flex",flexDirection:e?"column":"row",alignItems:"center",justifyContent:e?"center":"space-between",gap:e?.5:0,py:e?1:0,px:e?0:2,flexShrink:0},children:[t.jsxs(u,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(u,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(K,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(V,{title:e?"Expand sidebar":"Collapse sidebar",placement:"right",children:t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})})]})}function Wt({isCollapsed:e}){const o=G().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(Dt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Vt({isCollapsed:e}){const{apiClients:r}=_e(),o=J(),{data:n}=Ue({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(K,{variant:"caption",sx:{display:"block",px:3,py:1,color:"text.secondary",fontWeight:500,textTransform:"uppercase",fontSize:"0.6875rem",letterSpacing:"0.5px"},children:"Environments"}),t.jsx(te,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(se,{icon:t.jsx(Ct,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Ft({isCollapsed:e}){const{pathname:r}=G(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Bt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Rt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Yt,{isCollapsed:e}),o.map(n=>t.jsx(_t,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function se({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const a=ee(),i=t.jsxs(re,{selected:n,onClick:d=>a(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(oe,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:r,placement:"right",children:t.jsx(u,{children:i})}):i}function _t({label:e,href:r,icon:o,external:n,isCollapsed:s}){const a=t.jsxs(re,{component:"a",href:r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(oe,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:e,placement:"right",children:t.jsx(u,{children:a})}):a}const Ut={light:"dark",dark:"auto",auto:"light"},Xt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},xe={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Yt({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=Xe();if(!s)return null;const a=o??r,i=a==="auto"?Et:a==="dark"?zt:Tt,d=t.jsxs(re,{"aria-label":xe[a],onClick:()=>n(Ut[a]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(ne,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Xt[a],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[a],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function qt({open:e,onClose:r,logoHeader:o}){return t.jsx(St,{anchor:"left",open:e,onClose:r,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:260}},children:t.jsx(we,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Jt({headerProps:e}){const r=Z(),o=Ye(r.breakpoints.up("md")),[n,s]=x.useState(!1),[a,i]=x.useState(!1);return x.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(we,{isCollapsed:a,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(u,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(u,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:qe.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(u,{sx:{display:{xs:"flex",md:"none"},alignItems:"center",mr:1},children:t.jsx(Y,{size:"small",onClick:()=>s(!0),"aria-label":"Open navigation",children:t.jsx(q,{fontSize:"small"})})}),t.jsx(u,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx($t,{})}),t.jsxs(u,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Ht,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(x.Suspense,{fallback:t.jsx(Ke,{}),children:t.jsx(Qe,{})})})]}),t.jsx(qt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Jt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-XV_AUlWO.js","assets/index-BL_7q21Q.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-DA9EfQQB.js"])))=>i.map(i=>d[i]);
2
- import{x as te,E as F,r as u,d7 as ne,d8 as se,d9 as U,da as q,a5 as W,Y as I,j as t,H as m,db as O,a7 as E,a4 as re,az as oe,dc as ae,bn as ie,dd as ce,D as le,A as R,de,as as ue,a2 as G,a3 as z,df as fe,dg as he,a6 as N,T as b,dh as pe,di as H,G as me,dj as xe,a1 as ge,a0 as P,dk as _,C as ve,O as je,dl as ye,dm as L,dn as we,dp as be}from"./index-BL_7q21Q.js";import{i as D,w as Ee,a as V,l as ke}from"./documentRoutes-_ma0jaCp.js";import{v as Re,w as T,u as Y}from"./usePackageRoute-ev5b1KRn.js";import{u as Se}from"./usePackageLinkNavigate-BKkPNdJ4.js";import{T as X,P as S}from"./PackageSplatRoute-DJlJXk6p.js";import{a as Ce,l as K}from"./editPageMounted-DxNTqmFg.js";function De(e,n,s){const r=te(),{reports:a,settled:h,isError:c}=F(e,n,Re(s)),o=h&&!c;return u.useCallback((i,l)=>{const f=i.path;if(!ne(f))return"malformed";const d=se(f,a),p=T(U(e,n,d.kind==="path"?d.report.path:f),e,n,s),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,n,s,a,o])}const Te='[data-tile-kind="query"]',Ae=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",$e=3e3;function J(e,n,s,r){const a=u.useRef(s);a.current=s;const h=u.useRef(!1);u.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(f),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},f=setTimeout(l,$e);if(!n)return()=>clearTimeout(f);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(x=>{if(x.getBoundingClientRect().top>=g)return!1;const j=x.querySelector(Ae);return!j||j.getBoundingClientRect().height<8}).length===0&&c===0&&(c=requestAnimationFrame(()=>{c=requestAnimationFrame(l)}))};return o.observer=new MutationObserver(d),e.current&&o.observer.observe(e.current,{childList:!0,subtree:!0}),o.beat=setInterval(d,50),d(),i},[n,e,r])}function Q({environmentName:e,packageName:n,versionId:s,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=u.useRef(null);J(c,!0,h,`.${oe.report}`);const{params:o,onGivensChange:i}=q(),{versionSegment:l}=Y(),f=De(e,n,l),d=Se(e,n,l),p=u.useMemo(()=>W({environmentName:e,packageName:n}),[e,n]),g=I();return u.useEffect(()=>{if(!a||g)return;const y=()=>void re(()=>import("./index.es-XV_AUlWO.js"),__vite__mapDeps([0,1,2,3])),x=window.requestIdleCallback;if(x){const j=x(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(m,{ref:c,sx:X,children:t.jsx(O,{resourceUri:E({environmentName:e,packageName:n,versionId:s}),path:r,givens:o,onGivensChange:i,onNavigate:f,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Me(){const[e,n]=u.useState(!1),s=u.useRef(!1),r=u.useRef(!1),a=u.useCallback(i=>{s.current=i,n(i)},[]),h=u.useCallback(()=>{r.current=!0},[]),c=ae(u.useCallback(({currentLocation:i,nextLocation:l})=>s.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));u.useEffect(()=>{if(!e)return;const i=l=>{l.preventDefault(),l.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const o=t.jsx(ie,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const Pe=z.lazy(()=>K().then(e=>({default:e.ReportEditor}))),_e=z.lazy(()=>K().then(e=>({default:e.BuilderBar})));function Le(){const[e,n]=u.useState(null);return u.useEffect(()=>{n(document.getElementById("header-actions-portal"))},[]),e}function Z({environmentName:e,packageName:n,path:s,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Me();Ce();const[i]=u.useState(ce),l=le(),{pathname:f,search:d}=R(),p=Le(),[g,y]=u.useState(),x=u.useRef(null),v=I();J(x,g!==void 0||v,a);const j=()=>l(`${f.replace(/\/$/,"")}${Ee(d)}`),C=u.useMemo(()=>W({environmentName:e,packageName:n}),[e,n]),k=t.jsx(O,{resourceUri:E({environmentName:e,packageName:n}),path:s,manifestStaleTime:1e4});return t.jsxs(m,{ref:x,sx:X,children:[t.jsx(de,{children:t.jsx(u.Suspense,{fallback:h?null:k,children:t.jsx(Pe,{resourceUri:E({environmentName:e,packageName:n}),path:s,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:w=>l(`/${[e,n,...w.split("/")].map(encodeURIComponent).join("/")}`),onEvent:C,loading:h?null:k,onControlsChange:y},`${e}/${n}/${s}`)})}),o.dialog,p&&!c&&ue.createPortal(t.jsx(u.Suspense,{fallback:t.jsx(G,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(_e,{controls:g,onDone:j})}),p)]})}function Be({environmentName:e,packageName:n,versionSegment:s,routePath:r,edit:a,reports:h,children:c}){const{search:o}=R(),i=d=>T(U(e,n,d),e,n,s),l=fe(r);if(!l)return t.jsx(t.Fragment,{children:c});const f=he(l.name,h,l.prefer);return"found"in f?t.jsx(N,{replace:!0,to:`${i(f.found.path)}${a?V(o):o}`}):"ambiguous"in f?t.jsxs(m,{sx:S,children:[t.jsxs(b,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"This is an old link, which names a report by its file name alone. Open one by its path:"}),t.jsx(m,{component:"ul",sx:{mt:1},children:f.ambiguous.map(d=>t.jsx("li",{children:t.jsx(pe,{to:i(d),style:{fontFamily:H},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Fe({environmentName:e,packageName:n,routePath:s,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:f,isFetching:d,isError:p,refetch:g}=F(e,n,c),{search:y}=R(),x=`${s}.malloy`,v=f?me(x,l):void 0,j=f&&!d&&!p,[C,k]=u.useState();u.useEffect(()=>{j&&k(x)},[j,x]);const w=v!==void 0||j||C===x,A=xe(e,n,x,r&&!i&&w&&!v),$=ee=>t.jsx(Be,{environmentName:e,packageName:n,...o!==void 0?{versionSegment:o}:{},routePath:s,edit:r,reports:l,children:ee});if(!w&&(h&&!r&&!v))return $(a);if(!w&&p&&!d)return t.jsx(m,{sx:S,children:t.jsxs(ge,{severity:"warning",action:t.jsx(G,{color:"inherit",size:"small",onClick:()=>void g(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",s,"."]})});if(!w)return t.jsx(P,{text:_.opening()});if(v)return t.jsx(Ue,{environmentName:e,packageName:n,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:ke(s);return M!==void 0?t.jsx(N,{replace:!0,to:`${T(`/${e}/${n}/${M.split("/").map(encodeURIComponent).join("/")}`,e,n,o)}${V(y)}`}):$(r&&!i?A.settled?t.jsx(Z,{environmentName:e,packageName:n,path:x,layout:A.layout??"grid"}):t.jsx(P,{text:_.opening()}):a)}function Ue({environmentName:e,packageName:n,versionId:s,path:r,editable:a,layout:h,edit:c}){const[o,i]=u.useState(c?"editor":"reader"),l=c?"editor":"reader",f=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(m,{sx:{position:"relative"},"data-switching":f&&d||void 0,children:[f&&t.jsx(m,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(Q,{environmentName:e,packageName:n,...s!==void 0?{versionId:s}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(m,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Z,{environmentName:e,packageName:n,path:r,...h?{layout:h}:{},quietLoading:f,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function He(){const e=ve(),{search:n}=R(),{path:s,versionId:r,versionSegment:a,writable:h}=Y({always:!0}),{server:c}=je(),{params:o,onGivensChange:i,setParam:l}=q();if(!e.environmentName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing package name"})});if(s!==void 0&&s!==""&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const d=s.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(ye,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s,staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s,...r!==void 0?{versionId:r}:{}})});return t.jsx(Fe,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(n),notFound:g,notFoundUntilListed:p})}const f=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:s,versionId:r});return s?.endsWith(".malloy")?t.jsx(m,{sx:S,children:t.jsx(we,{resourceUri:f,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):s?.endsWith(".malloynb")?t.jsx(Q,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:s,editable:!1}):t.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s??"",staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s??"",...r!==void 0?{versionId:r}:{}})})}function B({packageName:e,modelPath:n,staticUrl:s}){const r=/\.[^./]+$/.test(n),a={fontFamily:H};return t.jsxs(m,{sx:S,children:[t.jsx(b,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(m,{component:"span",sx:a,children:n})," ","does not name a report, a"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(m,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(m,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(be,{href:s,children:s}),"."]}),t.jsx(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{He as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-CX9m4CBD.js","assets/index-BSyL0zds.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-Dmr-hVlD.js"])))=>i.map(i=>d[i]);
2
+ import{E as te,F as I,r as u,d7 as ne,d8 as se,d9 as B,da as U,a5 as W,Z as q,j as t,I as m,db as O,a7 as E,a4 as re,az as oe,dc as ae,bn as ie,dd as ce,D as le,A as R,de,as as ue,a2 as z,a3 as G,df as fe,dg as he,a6 as N,T as b,dh as pe,di as H,H as me,dj as xe,a1 as ge,a0 as P,dk as _,C as ve,O as je,dl as ye,dm as L,dn as we,dp as be}from"./index-BSyL0zds.js";import{i as S,w as Ee,a as V,l as ke}from"./documentRoutes-Drv-WDwO.js";import{v as Re,w as T,u as K}from"./usePackageRoute-wJGaZEiY.js";import{u as Ce}from"./usePackageLinkNavigate-qNjcXPcY.js";import{T as X,P as C}from"./PackageSplatRoute-CASBZk0k.js";import{a as De,l as Z}from"./editPageMounted-C5yJiIVi.js";function Se(e,n,s){const r=te(),{reports:a,settled:h,isError:c}=I(e,n,Re(s)),o=h&&!c;return u.useCallback((i,l)=>{const f=i.path;if(!ne(f))return"malformed";const d=se(f,a),p=T(B(e,n,d.kind==="path"?d.report.path:f),e,n,s),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,n,s,a,o])}const Te='[data-tile-kind="query"]',Ae=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",$e=3e3;function J(e,n,s,r){const a=u.useRef(s);a.current=s;const h=u.useRef(!1);u.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(f),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},f=setTimeout(l,$e);if(!n)return()=>clearTimeout(f);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(x=>{if(x.getBoundingClientRect().top>=g)return!1;const j=x.querySelector(Ae);return!j||j.getBoundingClientRect().height<8}).length===0&&c===0&&(c=requestAnimationFrame(()=>{c=requestAnimationFrame(l)}))};return o.observer=new MutationObserver(d),e.current&&o.observer.observe(e.current,{childList:!0,subtree:!0}),o.beat=setInterval(d,50),d(),i},[n,e,r])}function Q({environmentName:e,packageName:n,versionId:s,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=u.useRef(null);J(c,!0,h,`.${oe.report}`);const{params:o,onGivensChange:i}=U(),{versionSegment:l}=K(),f=Se(e,n,l),d=Ce(e,n,l),p=u.useMemo(()=>W({environmentName:e,packageName:n}),[e,n]),g=q();return u.useEffect(()=>{if(!a||g)return;const y=()=>void re(()=>import("./index.es-CX9m4CBD.js"),__vite__mapDeps([0,1,2,3])),x=window.requestIdleCallback;if(x){const j=x(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(m,{ref:c,sx:X,children:t.jsx(O,{resourceUri:E({environmentName:e,packageName:n,versionId:s}),path:r,givens:o,onGivensChange:i,onNavigate:f,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Me(){const[e,n]=u.useState(!1),s=u.useRef(!1),r=u.useRef(!1),a=u.useCallback(i=>{s.current=i,n(i)},[]),h=u.useCallback(()=>{r.current=!0},[]),c=ae(u.useCallback(({currentLocation:i,nextLocation:l})=>s.current&&!r.current&&(i.pathname!==l.pathname||S(i.search)!==S(l.search)),[]));u.useEffect(()=>{if(!e)return;const i=l=>{l.preventDefault(),l.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const o=t.jsx(ie,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const Pe=G.lazy(()=>Z().then(e=>({default:e.ReportEditor}))),_e=G.lazy(()=>Z().then(e=>({default:e.BuilderBar})));function Le(){const[e,n]=u.useState(null);return u.useEffect(()=>{n(document.getElementById("header-actions-portal"))},[]),e}function Y({environmentName:e,packageName:n,path:s,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Me();De();const[i]=u.useState(ce),l=le(),{pathname:f,search:d}=R(),p=Le(),[g,y]=u.useState(),x=u.useRef(null),v=q();J(x,g!==void 0||v,a);const j=()=>l(`${f.replace(/\/$/,"")}${Ee(d)}`),D=u.useMemo(()=>W({environmentName:e,packageName:n}),[e,n]),k=t.jsx(O,{resourceUri:E({environmentName:e,packageName:n}),path:s,manifestStaleTime:1e4});return t.jsxs(m,{ref:x,sx:X,children:[t.jsx(de,{children:t.jsx(u.Suspense,{fallback:h?null:k,children:t.jsx(Pe,{resourceUri:E({environmentName:e,packageName:n}),path:s,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:w=>l(`/${[e,n,...w.split("/")].map(encodeURIComponent).join("/")}`),onEvent:D,loading:h?null:k,onControlsChange:y},`${e}/${n}/${s}`)})}),o.dialog,p&&!c&&ue.createPortal(t.jsx(u.Suspense,{fallback:t.jsx(z,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(_e,{controls:g,onDone:j})}),p)]})}function Fe({environmentName:e,packageName:n,versionSegment:s,routePath:r,edit:a,reports:h,children:c}){const{search:o}=R(),i=d=>T(B(e,n,d),e,n,s),l=fe(r);if(!l)return t.jsx(t.Fragment,{children:c});const f=he(l.name,h,l.prefer);return"found"in f?t.jsx(N,{replace:!0,to:`${i(f.found.path)}${a?V(o):o}`}):"ambiguous"in f?t.jsxs(m,{sx:C,children:[t.jsxs(b,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"This is an old link, which names a report by its file name alone. Open one by its path:"}),t.jsx(m,{component:"ul",sx:{mt:1},children:f.ambiguous.map(d=>t.jsx("li",{children:t.jsx(pe,{to:i(d),style:{fontFamily:H},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Ie({environmentName:e,packageName:n,routePath:s,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:f,isFetching:d,isError:p,refetch:g}=I(e,n,c),{search:y}=R(),x=`${s}.malloy`,v=f?me(x,l):void 0,j=f&&!d&&!p,[D,k]=u.useState();u.useEffect(()=>{j&&k(x)},[j,x]);const w=v!==void 0||j||D===x,A=xe(e,n,x,r&&!i&&w&&!v),$=ee=>t.jsx(Fe,{environmentName:e,packageName:n,...o!==void 0?{versionSegment:o}:{},routePath:s,edit:r,reports:l,children:ee});if(!w&&(h&&!r&&!v))return $(a);if(!w&&p&&!d)return t.jsx(m,{sx:C,children:t.jsxs(ge,{severity:"warning",action:t.jsx(z,{color:"inherit",size:"small",onClick:()=>void g(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",s,"."]})});if(!w)return t.jsx(P,{text:_.opening()});if(v)return t.jsx(Be,{environmentName:e,packageName:n,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:ke(s);return M!==void 0?t.jsx(N,{replace:!0,to:`${T(`/${e}/${n}/${M.split("/").map(encodeURIComponent).join("/")}`,e,n,o)}${V(y)}`}):$(r&&!i?A.settled?t.jsx(Y,{environmentName:e,packageName:n,path:x,layout:A.layout??"grid"}):t.jsx(P,{text:_.opening()}):a)}function Be({environmentName:e,packageName:n,versionId:s,path:r,editable:a,layout:h,edit:c}){const[o,i]=u.useState(c?"editor":"reader"),l=c?"editor":"reader",f=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(m,{sx:{position:"relative"},"data-switching":f&&d||void 0,children:[f&&t.jsx(m,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(Q,{environmentName:e,packageName:n,...s!==void 0?{versionId:s}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(m,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Y,{environmentName:e,packageName:n,path:r,...h?{layout:h}:{},quietLoading:f,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function He(){const e=ve(),{search:n}=R(),{path:s,versionId:r,versionSegment:a,writable:h}=K({always:!0}),{server:c}=je(),{params:o,onGivensChange:i,setParam:l}=U();if(!e.environmentName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing package name"})});if(s!==void 0&&s!==""&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const d=s.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(ye,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s,staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s,...r!==void 0?{versionId:r}:{}})});return t.jsx(Ie,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:S(n),notFound:g,notFoundUntilListed:p})}const f=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:s,versionId:r});return s?.endsWith(".malloy")?t.jsx(m,{sx:C,children:t.jsx(we,{resourceUri:f,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):s?.endsWith(".malloynb")?t.jsx(Q,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:s,editable:!1}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s??"",staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s??"",...r!==void 0?{versionId:r}:{}})})}function F({packageName:e,modelPath:n,staticUrl:s}){const r=/\.[^./]+$/.test(n),a={fontFamily:H};return t.jsxs(m,{sx:C,children:[t.jsx(b,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(m,{component:"span",sx:a,children:n})," ","does not name a report, a"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(m,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(m,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(be,{href:s,children:s}),"."]}),t.jsx(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{He as default};
@@ -0,0 +1 @@
1
+ import{A as x,E as N,D as f,r as h,a5 as E,j as n,a6 as j,a7 as P,a8 as L}from"./index-BSyL0zds.js";import{d as M}from"./documentRoutes-Drv-WDwO.js";import{u as R,p as r,L as c}from"./usePackageRoute-wJGaZEiY.js";import{u as S}from"./usePackageLinkNavigate-qNjcXPcY.js";function V(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=R({always:!0}),{search:g}=x(),p=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>E({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(j,{to:`${r(e,a,c)}${g}`,replace:!0});const d=P({environmentName:e,packageName:a,versionId:m});return n.jsx(L,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(M(e,a,s,t),k),onSelectVersion:(s,t)=>p(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{V as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-CxenqDcz.js","assets/index-BSyL0zds.js","assets/index-DUqldpo0.css","assets/documentRoutes-Drv-WDwO.js","assets/usePackageRoute-wJGaZEiY.js","assets/usePackageLinkNavigate-qNjcXPcY.js","assets/editPageMounted-C5yJiIVi.js","assets/PackagePage-dcF6vrvw.js"])))=>i.map(i=>d[i]);
2
+ import{A as P,D as g,r as h,j as e,I as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-BSyL0zds.js";import{u as R,w as S,L as T}from"./usePackageRoute-wJGaZEiY.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},I={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-CxenqDcz.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-dcF6vrvw.js"),__vite__mapDeps([7,1,2,3,4,5])));function L(){const{environmentName:l,packageName:_,versionSegment:s,path:a,versioned:p,deciding:m,undecided:v,retry:E}=R({always:!0}),{pathname:o,search:r,hash:n}=P(),i=g(),t=p&&s===void 0?S(o,l??"",_??"",T):void 0;return h.useEffect(()=>{t!==void 0&&t!==o&&i(`${t}${r}${n}`,{replace:!0})},[t,o,r,n,i]),m?null:v?e.jsx(x,{sx:u,children:e.jsx(f,{severity:"error",action:e.jsx(A,{color:"inherit",size:"small",onClick:E,children:"Retry"}),children:"Could not read this package's versions, so this address can't be opened yet."})}):s!==void 0&&(a===void 0||a===""||a==="/")?e.jsx(k,{}):e.jsx(y,{})}const b=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,I as T,b as a};
@@ -1,5 +1,5 @@
1
- import{az as ge,j as O,H as se,r as g,aA as ve,U as we,aB as ke,ah as xe,aC as Ce,aD as Q,aE as Y,aF as Ae,aG as Ee,aH as Se,aI as ze,aJ as De,aK as $e,aL as Fe,aM as me,aN as de}from"./index-BL_7q21Q.js";const v=ge.drillCell;function je(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const n of a)!n||t(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!t(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||r.add(l)}return r}function L(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Re(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===r,o=new Set;for(const l of r.querySelectorAll(".column-cell.th")){if(!a(l))continue;const i=(l.textContent??"").replace(/\u200b/g,"").trim(),b=L(l);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=L(l);i&&(n.has(i)?l.tabIndex=-1:n.add(i))}for(const l of r.querySelectorAll(".column-cell.td")){if(!a(l))continue;const i=L(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const f=n.has(i);f||n.add(i),l.tabIndex=f?-1:0}l.setAttribute("role","button")}}}}function Te(e){const t=e.closest(".malloy-table"),r=L(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&L(a)===r)}function ce(e,t){const r=Te(e),a=r.indexOf(e);if(a===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(o){for(const n of r)n.tabIndex=n===o?0:-1;return o}}function Me(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function _e(e){const{foreground:t,axisFaint:r,gridline:a,font:o}=e,n={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:a,labelFont:o.family,titleFont:o.family},legend:{labelColor:t,titleColor:t,labelFont:o.family,titleFont:o.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},l={...n,legend:{...n.legend,orient:"bottom"}};return i=>i==="shape_map"?l:n}function Oe(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const i of ve){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),k=b.text("dark");x&&(f.light=x),k&&(f.dark=k),Object.keys(f).length>0&&(n[i]=f)}Object.keys(n).length>0&&(r.palette=n)}const o=t.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(n.size=i),Object.keys(n).length>0&&(r.font=n)}return Object.keys(r).length>0?r:void 0}const Z=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Be(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Le=e=>Z(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ie=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,qe=e=>e.type?.element_type?.fields??e.type?.fields;function be(e,t){let r=!1;return{fields:e.map(a=>{const o=qe(a);if(o){const l=be(o,me(Z(a.annotations)));if(!l.changed)return a;r=!0;const i=a.type?.element_type?{...a.type,element_type:{...a.type.element_type,fields:l.fields}}:{...a.type,fields:l.fields};return{...a,type:i}}if(!t||!a.name||Le(a))return a;const n=Be(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Ie(n)}
2
- `},...a.annotations??[]]})}),changed:r}}function Ne(e){if(!e||typeof e!="object")return e;const t=e,r=t.schema?.fields;if(!Array.isArray(r))return e;const{fields:a,changed:o}=be(r,me(Z(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const he=320,Pe=10,He=96,Ye=4e3;function Ue(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return he;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Pe+He;return Math.min(Math.max(he,a),Ye)}function Ve(e){let t;return{onClick:r=>{const a={...r,...Ke(r)};t=a,queueMicrotask(()=>{t===a&&(t=void 0),e(a)})},onDrill:r=>{const a=t;t=void 0,a&&r.stableDrillClauses!==void 0&&(a.drillClauses=r.stableDrillClauses)}}}function Ke(e){const t=e.field;try{const r=t?.getEffectiveQueryTimezone?.();return r?{timezone:r}:{}}catch{return{}}}function We(e){const t=r=>{let a=!1;try{a=r.isArray?.()===!0}catch{a=!1}a&&"stableDrillFilters"in r&&Object.defineProperty(r,"stableDrillFilters",{configurable:!0,get:()=>[]});for(const o of r.fields??[])t(o)};e&&t(e)}const B="data-publisher-fill";let U;function ye(){if(U===void 0)try{U=new Function("return true")()===!0}catch{U=!1}return U}const Xe=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ee();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:_e(e),...ye()?{}:{useVegaInterpreter:!0},theme:Me(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function Je(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(r.length===0)return;let a;try{({parseAnnotation:a}=await Ae())}catch{return}try{const{tag:o}=a(r);return Oe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Ge(e,t,r){const a=Se(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Qe=`
1
+ import{az as ge,j as O,I as se,r as g,aA as ve,R as we,aB as ke,ah as xe,aC as Ce,aD as Q,aE as Y,aF as Ae,aG as Ee,aH as Se,aI as ze,aJ as De,aK as $e,aL as Fe,aM as me,aN as de}from"./index-BSyL0zds.js";const v=ge.drillCell;function je(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const n of a)!n||t(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!t(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||r.add(l)}return r}function L(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Re(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===r,o=new Set;for(const l of r.querySelectorAll(".column-cell.th")){if(!a(l))continue;const i=(l.textContent??"").replace(/\u200b/g,"").trim(),b=L(l);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=L(l);i&&(n.has(i)?l.tabIndex=-1:n.add(i))}for(const l of r.querySelectorAll(".column-cell.td")){if(!a(l))continue;const i=L(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const f=n.has(i);f||n.add(i),l.tabIndex=f?-1:0}l.setAttribute("role","button")}}}}function Te(e){const t=e.closest(".malloy-table"),r=L(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&L(a)===r)}function ce(e,t){const r=Te(e),a=r.indexOf(e);if(a===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(o){for(const n of r)n.tabIndex=n===o?0:-1;return o}}function Me(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function _e(e){const{foreground:t,axisFaint:r,gridline:a,font:o}=e,n={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:a,labelFont:o.family,titleFont:o.family},legend:{labelColor:t,titleColor:t,labelFont:o.family,titleFont:o.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},l={...n,legend:{...n.legend,orient:"bottom"}};return i=>i==="shape_map"?l:n}function Oe(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const i of ve){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),k=b.text("dark");x&&(f.light=x),k&&(f.dark=k),Object.keys(f).length>0&&(n[i]=f)}Object.keys(n).length>0&&(r.palette=n)}const o=t.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(n.size=i),Object.keys(n).length>0&&(r.font=n)}return Object.keys(r).length>0?r:void 0}const Z=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Be(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Le=e=>Z(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ie=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,qe=e=>e.type?.element_type?.fields??e.type?.fields;function be(e,t){let r=!1;return{fields:e.map(a=>{const o=qe(a);if(o){const l=be(o,me(Z(a.annotations)));if(!l.changed)return a;r=!0;const i=a.type?.element_type?{...a.type,element_type:{...a.type.element_type,fields:l.fields}}:{...a.type,fields:l.fields};return{...a,type:i}}if(!t||!a.name||Le(a))return a;const n=Be(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Ie(n)}
2
+ `},...a.annotations??[]]})}),changed:r}}function Ne(e){if(!e||typeof e!="object")return e;const t=e,r=t.schema?.fields;if(!Array.isArray(r))return e;const{fields:a,changed:o}=be(r,me(Z(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const he=320,Pe=10,He=96,Ye=4e3;function Ve(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return he;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Pe+He;return Math.min(Math.max(he,a),Ye)}function Ke(e){let t;return{onClick:r=>{const a={...r,...Ue(r)};t=a,queueMicrotask(()=>{t===a&&(t=void 0),e(a)})},onDrill:r=>{const a=t;t=void 0,a&&r.stableDrillClauses!==void 0&&(a.drillClauses=r.stableDrillClauses)}}}function Ue(e){const t=e.field;try{const r=t?.getEffectiveQueryTimezone?.();return r?{timezone:r}:{}}catch{return{}}}function We(e){const t=r=>{let a=!1;try{a=r.isArray?.()===!0}catch{a=!1}a&&"stableDrillFilters"in r&&Object.defineProperty(r,"stableDrillFilters",{configurable:!0,get:()=>[]});for(const o of r.fields??[])t(o)};e&&t(e)}const B="data-publisher-fill";let V;function ye(){if(V===void 0)try{V=new Function("return true")()===!0}catch{V=!1}return V}const Xe=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ee();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:_e(e),...ye()?{}:{useVegaInterpreter:!0},theme:Me(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function Je(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(r.length===0)return;let a;try{({parseAnnotation:a}=await Ae())}catch{return}try{const{tag:o}=a(r);return Oe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Ge(e,t,r){const a=Se(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Qe=`
3
3
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
4
4
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
5
5
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -176,4 +176,4 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
176
176
  .malloy-render .malloy-table .td.highlight:not(.${v}) {
177
177
  cursor: inherit;
178
178
  }
179
- `,ue="publisher-malloy-renderer-overrides";function Ze(){if(typeof document>"u"||document.getElementById(ue))return;const e=document.createElement("style");e.id=ue,e.textContent=Qe,document.head.appendChild(e)}function et({result:e,height:t,drill:r,onSizeChange:a,onSizing:o,fill:n}){const l=g.useRef(null),i=g.useRef(r);i.current=r;const b=g.useMemo(()=>Ve(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),V=g.useRef(0),{theme:I,layers:K,mode:ee}=we(),te=g.useMemo(()=>({radius:I.ui.radius.tile,padding:`${ke}px`}),[I.ui.radius.tile]);return g.useEffect(()=>()=>{V.current+=1;const d=k.current;d?.viz.remove(),d?.node.remove(),k.current=null},[]),g.useLayoutEffect(()=>{if(!l.current||!e)return;Ze();const d=l.current,fe=V.current+=1;let W=!1;const X=()=>!W&&fe===V.current;let c,y,q=null,J=0,N=null,P=null,H=null,j=null,R=null,T=null,re=null,ae=0,z=null;x.current=!1;let p,D;const G=w=>{if(W||!w.firstElementChild||Q(p,D)==="container")return;const M=ze(p,D);if(x.current&&!M)return;const _=d.hasAttribute(B);_&&d.removeAttribute(B);const C=d.closest(`.${De}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const $=$e(w,de(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),$>0&&(x.current=!0,a&&$!==ae&&(ae=$,a($)));const A=Fe(w,de(p));M&&A&&re!==A&&(re=A,T?.disconnect(),T=new ResizeObserver(()=>G(w)),T.observe(A))};return(async()=>{let w;try{w=JSON.parse(e)}catch(m){console.error("Error parsing visualization result:",m);return}const M=await Je(w),_=M?xe([...K,Ce(K,M)],ee):I;if(!X())return;try{y=await Xe(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!X()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Ge(c,_,te),d.childElementCount>0&&(d.style.position="relative",c.style.position="absolute",c.style.inset="0",c.style.visibility="hidden"),d.appendChild(c);const h=c;j=new MutationObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{G(h),x.current&&j?.disconnect()},100)}),j.observe(c,{childList:!0,subtree:!0,attributes:!0});const $=y;let A=!1;const oe=()=>{if(!(A||!X())){A=!0,z&&(clearTimeout(z),z=null),C?.viz.remove();for(const m of Array.from(d.children))m!==h&&d.removeChild(m);h.style.position="",h.style.inset="",h.style.visibility="",d.style.position="",k.current={viz:$,node:h},G(h)}};try{y.setResult(Ne(w));try{const E=y.getMetadata(),S=E?.getRootField();f&&We(S),p=S?.renderAs(),D=S?E?.getPluginsForField(S.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(Q(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=Q(p,D);const m=Ue(p,w);c.style.minWidth=m===void 0?"":`${m}px`,d.style.overflowX=m===void 0?"":"auto",d.style.overflowY=m===void 0?"":"hidden",y.render(c);const ne=i.current;try{if(ne){const E=je(y,ne.canDrill),S=()=>{try{Re(h,E)}catch(s){console.warn("Drill affordance skipped:",s)}};S();const le=s=>{const u=s.querySelector(".cell-content")??s,F=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(F.left+F.width/2),clientY:Math.round(F.bottom)}))},ie=s=>s.target?.closest?.(`.${v}`)??null,pe=(s,u)=>{ce(s,u)?.focus()};N=s=>{const u=ie(s);if(!u)return;const F=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(F!==void 0){s.preventDefault(),pe(u,F);return}s.key==="Enter"?(s.preventDefault(),le(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=ie(s);u&&(s.preventDefault(),le(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&ce(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),E.size>0&&typeof MutationObserver<"u"&&(q=new MutationObserver(()=>{cancelAnimationFrame(J),J=requestAnimationFrame(S)}),q.observe(h,{childList:!0,subtree:!0}))}}catch(E){console.warn("Drill affordance skipped:",E)}y.onReady(oe),z=setTimeout(oe,1e4)}catch(m){console.error("Error rendering visualization:",m),j?.disconnect(),T?.disconnect(),q?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{W=!0,j?.disconnect(),T?.disconnect(),R&&clearTimeout(R),z&&clearTimeout(z),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),q?.disconnect(),cancelAnimationFrame(J),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,I,K,ee,te]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function tt(e){return typeof window>"u"?O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):O.jsx(g.Suspense,{fallback:O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:O.jsx(et,{...e})})}const at=Object.freeze(Object.defineProperty({__proto__:null,default:tt,pageAllowsEval:ye},Symbol.toStringTag,{value:"Module"}));export{v as D,tt as R,_e as a,Me as b,at as c,je as d,Re as m,Oe as r};
179
+ `,ue="publisher-malloy-renderer-overrides";function Ze(){if(typeof document>"u"||document.getElementById(ue))return;const e=document.createElement("style");e.id=ue,e.textContent=Qe,document.head.appendChild(e)}function et({result:e,height:t,drill:r,onSizeChange:a,onSizing:o,fill:n}){const l=g.useRef(null),i=g.useRef(r);i.current=r;const b=g.useMemo(()=>Ke(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),K=g.useRef(0),{theme:I,layers:U,mode:ee}=we(),te=g.useMemo(()=>({radius:I.ui.radius.tile,padding:`${ke}px`}),[I.ui.radius.tile]);return g.useEffect(()=>()=>{K.current+=1;const d=k.current;d?.viz.remove(),d?.node.remove(),k.current=null},[]),g.useLayoutEffect(()=>{if(!l.current||!e)return;Ze();const d=l.current,fe=K.current+=1;let W=!1;const X=()=>!W&&fe===K.current;let c,y,q=null,J=0,N=null,P=null,H=null,j=null,R=null,T=null,re=null,ae=0,z=null;x.current=!1;let p,D;const G=w=>{if(W||!w.firstElementChild||Q(p,D)==="container")return;const M=ze(p,D);if(x.current&&!M)return;const _=d.hasAttribute(B);_&&d.removeAttribute(B);const C=d.closest(`.${De}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const $=$e(w,de(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),$>0&&(x.current=!0,a&&$!==ae&&(ae=$,a($)));const A=Fe(w,de(p));M&&A&&re!==A&&(re=A,T?.disconnect(),T=new ResizeObserver(()=>G(w)),T.observe(A))};return(async()=>{let w;try{w=JSON.parse(e)}catch(m){console.error("Error parsing visualization result:",m);return}const M=await Je(w),_=M?xe([...U,Ce(U,M)],ee):I;if(!X())return;try{y=await Xe(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!X()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Ge(c,_,te),d.childElementCount>0&&(d.style.position="relative",c.style.position="absolute",c.style.inset="0",c.style.visibility="hidden"),d.appendChild(c);const h=c;j=new MutationObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{G(h),x.current&&j?.disconnect()},100)}),j.observe(c,{childList:!0,subtree:!0,attributes:!0});const $=y;let A=!1;const oe=()=>{if(!(A||!X())){A=!0,z&&(clearTimeout(z),z=null),C?.viz.remove();for(const m of Array.from(d.children))m!==h&&d.removeChild(m);h.style.position="",h.style.inset="",h.style.visibility="",d.style.position="",k.current={viz:$,node:h},G(h)}};try{y.setResult(Ne(w));try{const E=y.getMetadata(),S=E?.getRootField();f&&We(S),p=S?.renderAs(),D=S?E?.getPluginsForField(S.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(Q(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=Q(p,D);const m=Ve(p,w);c.style.minWidth=m===void 0?"":`${m}px`,d.style.overflowX=m===void 0?"":"auto",d.style.overflowY=m===void 0?"":"hidden",y.render(c);const ne=i.current;try{if(ne){const E=je(y,ne.canDrill),S=()=>{try{Re(h,E)}catch(s){console.warn("Drill affordance skipped:",s)}};S();const le=s=>{const u=s.querySelector(".cell-content")??s,F=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(F.left+F.width/2),clientY:Math.round(F.bottom)}))},ie=s=>s.target?.closest?.(`.${v}`)??null,pe=(s,u)=>{ce(s,u)?.focus()};N=s=>{const u=ie(s);if(!u)return;const F=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(F!==void 0){s.preventDefault(),pe(u,F);return}s.key==="Enter"?(s.preventDefault(),le(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=ie(s);u&&(s.preventDefault(),le(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&ce(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),E.size>0&&typeof MutationObserver<"u"&&(q=new MutationObserver(()=>{cancelAnimationFrame(J),J=requestAnimationFrame(S)}),q.observe(h,{childList:!0,subtree:!0}))}}catch(E){console.warn("Drill affordance skipped:",E)}y.onReady(oe),z=setTimeout(oe,1e4)}catch(m){console.error("Error rendering visualization:",m),j?.disconnect(),T?.disconnect(),q?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{W=!0,j?.disconnect(),T?.disconnect(),R&&clearTimeout(R),z&&clearTimeout(z),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),q?.disconnect(),cancelAnimationFrame(J),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,I,U,ee,te]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function tt(e){return typeof window>"u"?O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):O.jsx(g.Suspense,{fallback:O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:O.jsx(et,{...e})})}const at=Object.freeze(Object.defineProperty({__proto__:null,default:tt,pageAllowsEval:ye},Symbol.toStringTag,{value:"Module"}));export{v as D,tt as R,_e as a,Me as b,at as c,je as d,Re as m,Oe as r};
@@ -1 +1 @@
1
- import{ab as o,j as r,ac as s,ad as n,H as t,T as a}from"./index-BL_7q21Q.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};
1
+ import{ab as o,j as r,ac as s,ad as n,I as t,T as a}from"./index-BSyL0zds.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};