@malloy-publisher/app 0.12.5 → 0.12.6

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 (23) hide show
  1. package/dist/api-doc.yaml +111 -38
  2. package/dist/assets/{EnvironmentPage-gNvDKTtA.js → EnvironmentPage-DFozqUjF.js} +1 -1
  3. package/dist/assets/{HomePage-lrIG8Qjk.js → HomePage-Bad32fax.js} +1 -1
  4. package/dist/assets/{MainPage-CJf3Uuul.js → MainPage-BAwxr_X1.js} +1 -1
  5. package/dist/assets/{ModelPage-t_Ln0qr1.js → ModelPage-CuW71DWw.js} +2 -2
  6. package/dist/assets/{PackagePage-Cxa0_alv.js → PackagePage-DtP6BtnP.js} +1 -1
  7. package/dist/assets/{PackageSplatRoute-FyScmoYw.js → PackageSplatRoute-EsC7l_nR.js} +2 -2
  8. package/dist/assets/{RenderedResult-DqPvGZgL.es-BNxk46Vn.js → RenderedResult-DAW_Cfc-.es-BYEbDD8i.js} +3 -3
  9. package/dist/assets/{RouteError-BZUUKmNE.js → RouteError--h2XhIM0.js} +1 -1
  10. package/dist/assets/{ThemeEditorPage-vDnfPmZz.js → ThemeEditorPage-B1e_-WV5.js} +1 -1
  11. package/dist/assets/{ToggleButtonGroup-DdUWm7cB.js → ToggleButtonGroup-CuyU-wPN.js} +1 -1
  12. package/dist/assets/{documentRoutes-DtWdqG6B.js → documentRoutes-BUqz3gK5.js} +1 -1
  13. package/dist/assets/{editPageMounted-vEdUjhAX.js → editPageMounted-mt7xJomn.js} +2 -2
  14. package/dist/assets/{index-diN_kmcj.js → index-DZD8qhzO.js} +1 -1
  15. package/dist/assets/{index-DYHeNKEh.js → index-DzSE-Kxp.js} +1 -1
  16. package/dist/assets/{index-dUom3Bdm.js → index-YeH6QPnQ.js} +1 -1
  17. package/dist/assets/{index-D-htCO4q.js → index-oAv7JJIj.js} +37 -37
  18. package/dist/assets/{index.es-DpNxHwgw.js → index.es-DdMQ3KvM.js} +1 -1
  19. package/dist/assets/usePackageLinkNavigate-Y0cmkFp3.js +1 -0
  20. package/dist/assets/{usePackageRoute-CjGpnrTp.js → usePackageRoute-lzkkk2Fh.js} +1 -1
  21. package/dist/index.html +1 -1
  22. package/package.json +2 -2
  23. package/dist/assets/usePackageLinkNavigate-D2TepxAX.js +0 -1
package/dist/api-doc.yaml CHANGED
@@ -298,7 +298,15 @@ paths:
298
298
  $ref: "#/components/schemas/IdentifierPattern"
299
299
  - name: reload
300
300
  in: query
301
+ deprecated: true
301
302
  description: |
303
+ **Deprecated.** Re-reads the environment's block of `publisher.config.json` and reloads
304
+ the environment from it. Nothing first-party calls it, and the v1 API has no environment
305
+ reload. A response to `reload=true` carries `Deprecation: true`, and each use is counted in
306
+ `publisher_deprecated_usage_total{feature="environment_reload"}`; it is removed once that
307
+ reads zero (#1540). Under `frozenConfig` it is refused with 403, like any change to an
308
+ environment. To pick up a package's changed files, reload the package.
309
+
302
310
  Load / reload the environment before returning result.
303
311
 
304
312
  Only the two spellings OpenAPI serializes a boolean as are accepted:
@@ -1693,6 +1701,23 @@ paths:
1693
1701
  At EITHER home, omitting it preserves the package's tags and so does sending
1694
1702
  null — a client that serializes unset fields as null must not untag a package
1695
1703
  by accident. Send an empty object to clear.
1704
+
1705
+ A package fetched from a `location` keeps none of these on reload: a reload fetches
1706
+ it again and replaces its files, `publisher.json` included, keeping only its
1707
+ `location` and manifest binding. So when the package will be fetched from a
1708
+ location once this request is applied (the `location` it sends, or else the one it
1709
+ was installed from), a change to `description`, `explores`, `queryableSources`,
1710
+ `scope`, `queryMetadata` or `materialization` is refused with 409 (`reason`
1711
+ `PACKAGE_INSTALLED_FROM_LOCATION`). A change is judged by the value the request
1712
+ would leave in force: clearing a set field is a change, a null is omitted, and a
1713
+ value equal to the current one (`explores` normalized as stored) is not. A request
1714
+ that names a new `location` is judged against the tree fetched from it, and a
1715
+ refusal leaves the previous install serving. When the package it replaces was
1716
+ itself installed from a location, a field sent with that package's value is the
1717
+ package sent back, not a change: it is left out and the new tree's value serves,
1718
+ so a whole package read back with only its `location` changed is accepted.
1719
+ Make the change in the package's
1720
+ source and reload it, or publish it as a version.
1696
1721
  parameters:
1697
1722
  - name: environmentName
1698
1723
  in: path
@@ -2242,8 +2267,9 @@ paths:
2242
2267
  with `includeHiddenFilesAndSources=true`. When the file on disk no
2243
2268
  longer hashes to it, the write is refused with 409 and nothing is
2244
2269
  merged: the caller re-opens and reapplies its change. Omit it to CREATE
2245
- the file: a file that already exists is then refused with 409 too, so
2246
- an unconditional overwrite is not something a caller can ask for by
2270
+ the file: a file that already exists is then refused with 409 too,
2271
+ `reason` `FILE_EXISTS`, so a caller choosing a name can try the next,
2272
+ and an unconditional overwrite is not something a caller can ask for by
2247
2273
  leaving a field out. A path over an existing file the package does not
2248
2274
  read as a report answers 400 instead, with or without a hash, because
2249
2275
  that check comes before the hash. The check, the write,
@@ -2267,6 +2293,11 @@ paths:
2267
2293
  `versionId` names: change the file in the package's source and publish
2268
2294
  a new version. A `versionId` on a package with no versions answers 404
2269
2295
  (`reason` `VERSION_NOT_FOUND`).
2296
+
2297
+ A package installed from a `location` is fetched again from there on
2298
+ reload, which replaces its files, so it refuses this write with 409
2299
+ (`reason` `PACKAGE_INSTALLED_FROM_LOCATION`): add the report to the
2300
+ package's source and reload it, or publish it as a version.
2270
2301
  parameters:
2271
2302
  - name: environmentName
2272
2303
  in: path
@@ -2316,8 +2347,10 @@ paths:
2316
2347
  $ref: "#/components/responses/NotFound"
2317
2348
  "409":
2318
2349
  description:
2319
- The file changed since the caller opened it, or already exists and
2320
- no `expectedHash` was sent
2350
+ The file changed since the caller opened it; or it already exists
2351
+ and no `expectedHash` was sent (`reason` `FILE_EXISTS`); or the
2352
+ package cannot take the write in place (`reason`
2353
+ `PACKAGE_IS_VERSIONED` or `PACKAGE_INSTALLED_FROM_LOCATION`)
2321
2354
  content:
2322
2355
  application/json:
2323
2356
  schema:
@@ -4237,6 +4270,11 @@ components:
4237
4270
  content. Bump the `version` in publisher.json and publish again.
4238
4271
  * PACKAGE_IS_VERSIONED: the package has published versions, which are
4239
4272
  immutable, so it cannot be changed in place.
4273
+ * PACKAGE_INSTALLED_FROM_LOCATION: the package is fetched again from
4274
+ the location it was installed from on reload, which would discard
4275
+ the change. Make it in the package's source and reload.
4276
+ * FILE_EXISTS: a create-only report write found a file at the path.
4277
+ Choose another path.
4240
4278
  * VERSION_IS_LATEST: the version is the package's `latest` and cannot
4241
4279
  be archived, or deleted while other versions remain. Move `latest` first.
4242
4280
  * VERSION_IS_LAST_ACTIVE: the version is the package's last one in
@@ -6254,14 +6292,14 @@ components:
6254
6292
  starts every package's index again, but vectors already stored for
6255
6293
  unchanged content are reused, so a restart over an unchanged package
6256
6294
  embeds nothing new.
6257
- Every count is scoped to the embedding model currently configured, so
6258
- rows left behind by an earlier model are never counted. Read `status`
6259
- for readiness and the counts for progress: they answer different
6260
- questions, and only `status` tracks what the search path will do. The
6261
- first read after a package loads builds the package's entity index and
6262
- its content fingerprint, which is work a metadata read would not
6263
- otherwise do. After that a read is two row counts and never waits on a
6264
- sync, so polling is cheap.
6295
+ The counts are the search index's own: the vectors it holds in
6296
+ `catalog_embeddings` under the embedding model currently configured,
6297
+ so rows left behind by an earlier model are never counted. Every count
6298
+ is 0 until the index build reaches its vectors step, and 0 again while
6299
+ `status` is `error`. Read `status` for readiness and the counts for
6300
+ progress: they answer different questions, and only `status` tracks
6301
+ what the search path will do. A read is answered from memory and never
6302
+ waits on a build, so polling is cheap.
6265
6303
  properties:
6266
6304
  status:
6267
6305
  type: string
@@ -6388,38 +6426,35 @@ components:
6388
6426
  embeddedRows:
6389
6427
  type: integer
6390
6428
  description: >-
6391
- Cached vectors for this package under the current embedding model.
6392
- With the default `retrieval.representation` of `single` an entity
6393
- contributes one row, so this equals `totalEntities` once indexed.
6394
- With `facets` an entity contributes one row for its name plus one
6395
- per chunk of its documentation, so this exceeds `totalEntities` on
6396
- a documented model and is not a count of entities. A keyphrase row
6397
- is an extra on top of those and is not counted here or in
6398
- `totalRows`. Scoped by model only, not by
6399
- vector length, so it counts what is cached rather than what a
6400
- search could read today: after a change to `EMBEDDING_DIMENSIONS`
6401
- that no question has probed yet, rows of the old length are still
6402
- counted here until the next search discards them. `status` is
6403
- already `indexing` in that window.
6429
+ Vectors the index holds for this package under the current
6430
+ embedding model, reused or newly embedded; it rises batch by batch
6431
+ while `indexing`. With the default `retrieval.representation` of
6432
+ `single` an entity contributes one row, so this equals
6433
+ `totalEntities` once indexed. With `facets` an entity contributes
6434
+ one row for its name plus one per chunk of its documentation, so
6435
+ this exceeds `totalEntities` on a documented model and is not a
6436
+ count of entities. A vector stored under another embedding model or
6437
+ `EMBEDDING_DIMENSIONS` is embedded again rather than counted.
6404
6438
  totalRows:
6405
6439
  type: integer
6406
6440
  description: >-
6407
- Rows the package wants cached: the denominator for `embeddedRows`.
6408
- `embeddedRows` of `totalRows` is the progress of a first index.
6441
+ Rows the index wants for this package: the denominator for
6442
+ `embeddedRows`. `embeddedRows` of `totalRows` is the progress of a
6443
+ build.
6409
6444
  totalEntities:
6410
6445
  type: integer
6411
- description: Entities the package currently exposes to retrieval.
6446
+ description: >-
6447
+ Entities the package exposes to retrieval, each of which wants at
6448
+ least one row.
6412
6449
  embeddedEntities:
6413
6450
  type: integer
6414
6451
  description: >-
6415
- Of `totalEntities`, how many have at least one usable vector.
6416
- Reported because a row count cannot show a model edit that removes
6417
- two entities and adds two others: the row total is unchanged while
6418
- the new entities have no vector at all. Coverage by identity, so
6419
- equality does NOT imply `ready`: an edit that rewrote every doc
6420
- without renaming anything leaves each entity holding its stale
6421
- name vector. Read `status` for readiness and this pair for how
6422
- much of the package is covered.
6452
+ Of `totalEntities`, how many have at least one vector. Reported
6453
+ because a row count cannot show a model edit that removes two
6454
+ entities and adds two others: the row total is unchanged while the
6455
+ new entities have no vector at all. Coverage by identity, so
6456
+ equality does NOT imply `ready`. Read `status` for readiness and
6457
+ this pair for how much of the package is covered.
6423
6458
  lastSyncedAt:
6424
6459
  type: string
6425
6460
  format: date-time
@@ -9304,10 +9339,41 @@ components:
9304
9339
  type: string
9305
9340
  description: Table source as a JSON string.
9306
9341
  columns:
9307
- description: Table fields
9342
+ description: |
9343
+ The table's columns. A record column (a BigQuery RECORD, a DuckDB
9344
+ STRUCT, a Trino ROW, a Databricks STRUCT) is followed by its members, named by their
9345
+ dotted path (`delivery.city`, `delivery.address.zip`). A member
9346
+ that follows an `array` column belongs to a repeated record: it
9347
+ has one value per element of the array, not one per row. A member
9348
+ whose name is not a plain identifier (`a.b`, `two words`) is not
9349
+ listed, nor anything under it.
9350
+
9351
+ Types: a member always has Malloy's type name (`string`,
9352
+ `number`, `record`, `array`). A top-level column has the type the
9353
+ database reports in a schema listing on a dialect read through
9354
+ INFORMATION_SCHEMA (DuckDB, Trino, Postgres and others; on
9355
+ Databricks a STRUCT or ARRAY column reports its full_data_type,
9356
+ `struct<city:string>`), and
9357
+ Malloy's type name in a BigQuery listing and from the single-table
9358
+ route.
9308
9359
  type: array
9309
9360
  items:
9310
9361
  $ref: "#/components/schemas/Column"
9362
+ membersUnread:
9363
+ type: boolean
9364
+ description: >-
9365
+ Present, and true, when the table has a record column (a DuckDB
9366
+ STRUCT, a Trino ROW, a Databricks STRUCT) whose members this
9367
+ listing did not add to `columns`: the table's schema read failed,
9368
+ or had not finished within the listing's time limit. Either can
9369
+ clear on a later listing. `columns` then holds the database's
9370
+ top-level columns only, so a missing member is not a removed one.
9371
+ Absent when every record's members are listed, and when they are
9372
+ never listed: a column type that declares none (a plain array,
9373
+ a Snowflake OBJECT), or a table name that needs quoting.
9374
+ Never set on BigQuery, whose listing reads each table's whole
9375
+ schema: a table whose read failed there is listed with no
9376
+ columns.
9311
9377
 
9312
9378
  TemporaryTable:
9313
9379
  type: object
@@ -9393,6 +9459,12 @@ components:
9393
9459
  * PACKAGE_IS_VERSIONED (409): the package has published versions,
9394
9460
  so it cannot be changed in place (a write, or a publish with
9395
9461
  package versioning off).
9462
+ * PACKAGE_INSTALLED_FROM_LOCATION (409): the package is fetched
9463
+ again from a `location` on reload, which would discard a report
9464
+ write or a package update's change to its settings.
9465
+ * FILE_EXISTS (409): a report write with no `expectedHash` (a
9466
+ create) found a file already at the path; another path may be
9467
+ free. A stale `expectedHash` answers 409 with no `reason`.
9396
9468
  * VERSION_IS_LATEST (409): the package's `latest` version cannot be
9397
9469
  archived, or deleted while other versions remain.
9398
9470
  * VERSION_IS_LAST_ACTIVE (409): the package's last version in
@@ -9411,7 +9483,8 @@ components:
9411
9483
  Known values: TABLE_NOT_FOUND, CONNECTION_FAILED,
9412
9484
  CONNECTION_AUTH_FAILED, CONNECTION_NOT_FOUND,
9413
9485
  MANIFEST_VERSION_MISSING, MANIFEST_VERSION_INVALID,
9414
- VERSION_CONFLICT, PACKAGE_IS_VERSIONED, VERSION_IS_LATEST,
9486
+ VERSION_CONFLICT, PACKAGE_IS_VERSIONED,
9487
+ PACKAGE_INSTALLED_FROM_LOCATION, FILE_EXISTS, VERSION_IS_LATEST,
9415
9488
  VERSION_IS_LAST_ACTIVE, VERSION_BUILDING, VERSION_ID_INVALID,
9416
9489
  VERSION_NOT_LATEST, VERSION_NOT_FOUND, VERSION_ARCHIVED.
9417
9490
  problems:
@@ -1 +1 @@
1
- import{_ as r,A as t,j as e,a7 as i,aa as o}from"./index-D-htCO4q.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{_ as r,A as t,j as e,a7 as i,aa as o}from"./index-oAv7JJIj.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{_ as t,j as o,Z as a}from"./index-D-htCO4q.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
1
+ import{_ as t,j as o,Z as a}from"./index-oAv7JJIj.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,x as $,M as Le,P as He,y as $e,S as Ne,z as J,A as Z,C as Ae,D as Oe,E as We,F as pe,G as Ve,_ as ee,H as u,I as Fe,J as Y,K as V,L as te,N as _e,O as Ue,Q 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-D-htCO4q.js";import{u as Ge,l as he}from"./editPageMounted-vEdUjhAX.js";import{i as Je,w as Ze,a as et}from"./documentRoutes-DtWdqG6B.js";import{u as ve,p as tt}from"./usePackageRoute-CjGpnrTp.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)}),_=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=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}=_e(),o=Z(),{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}=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(_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 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 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,x as $,M as Le,P as He,y as $e,S as Ne,z as J,A as Z,C as Ae,D as Oe,E as We,F as pe,G as Ve,_ as ee,H as u,I as Fe,J as Y,K as V,L as te,N as _e,O as Ue,Q 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-oAv7JJIj.js";import{u as Ge,l as he}from"./editPageMounted-mt7xJomn.js";import{i as Je,w as Ze,a as et}from"./documentRoutes-BUqz3gK5.js";import{u as ve,p as tt}from"./usePackageRoute-lzkkk2Fh.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)}),_=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=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}=_e(),o=Z(),{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}=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(_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 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,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-DpNxHwgw.js","assets/index-D-htCO4q.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-DdUWm7cB.js"])))=>i.map(i=>d[i]);
2
- import{_ as te,E as F,r as f,d7 as se,d8 as ne,d9 as U,da as W,a5 as q,D as z,j as t,H as x,db as re,a7 as E,dc as I,a4 as oe,az as ae,dd as ie,bn as ce,de as le,C as de,z as R,df as ue,as as fe,a2 as O,a3 as G,dg as he,dh as pe,a6 as N,T as w,di as xe,dj as H,G as me,dk as ge,a1 as ve,a0 as P,dl as _,A as je,N as ye,dm as be,dn as L,dp as we,dq as Ee}from"./index-D-htCO4q.js";import{i as D,w as ke,a as V,l as Re}from"./documentRoutes-DtWdqG6B.js";import{v as Se,w as A,u as X}from"./usePackageRoute-CjGpnrTp.js";import{u as Ce}from"./usePackageLinkNavigate-D2TepxAX.js";import{T as Y,P as S}from"./PackageSplatRoute-FyScmoYw.js";import{a as De,l as K}from"./editPageMounted-vEdUjhAX.js";function Ae(e,s,n){const r=te(),{reports:a,settled:h,isError:c}=F(e,s,Se(n)),o=h&&!c;return f.useCallback((i,l)=>{const u=i.path;if(!se(u))return"malformed";const d=ne(u,a),p=A(U(e,s,d.kind==="path"?d.report.path:u),e,s,n),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,s,n,a,o])}const $e='[data-tile-kind="query"]',Te=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Me=3e3;function Z(e,s,n,r){const a=f.useRef(n);a.current=n;const h=f.useRef(!1);f.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(u),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},u=setTimeout(l,Me);if(!s)return()=>clearTimeout(u);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll($e)].filter(m=>{if(m.getBoundingClientRect().top>=g)return!1;const j=m.querySelector(Te);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},[s,e,r])}function J({environmentName:e,packageName:s,versionId:n,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=f.useRef(null);Z(c,!0,h,`.${ae.report}`);const{params:o,onGivensChange:i}=W(),{versionSegment:l}=X(),u=Ae(e,s,l),d=Ce(e,s,l),p=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),g=z();return f.useEffect(()=>{if(!a||g)return;const y=()=>void oe(()=>import("./index.es-DpNxHwgw.js"),__vite__mapDeps([0,1,2,3])),m=window.requestIdleCallback;if(m){const j=m(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(x,{ref:c,sx:Y,children:r.endsWith(".malloynb")?t.jsx(re,{resourceUri:E({environmentName:e,packageName:s,modelPath:r,versionId:n}),givens:o,onGivensChange:i,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):t.jsx(I,{resourceUri:E({environmentName:e,packageName:s,versionId:n}),path:r,givens:o,onGivensChange:i,onNavigate:u,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Pe(){const[e,s]=f.useState(!1),n=f.useRef(!1),r=f.useRef(!1),a=f.useCallback(i=>{n.current=i,s(i)},[]),h=f.useCallback(()=>{r.current=!0},[]),c=ie(f.useCallback(({currentLocation:i,nextLocation:l})=>n.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));f.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(ce,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const _e=G.lazy(()=>K().then(e=>({default:e.ReportEditor}))),Le=G.lazy(()=>K().then(e=>({default:e.BuilderBar})));function Be(){const[e,s]=f.useState(null);return f.useEffect(()=>{s(document.getElementById("header-actions-portal"))},[]),e}function Q({environmentName:e,packageName:s,path:n,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Pe();De();const[i]=f.useState(le),l=de(),{pathname:u,search:d}=R(),p=Be(),[g,y]=f.useState(),m=f.useRef(null),v=z();Z(m,g!==void 0||v,a);const j=()=>l(`${u.replace(/\/$/,"")}${ke(d)}`),C=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),k=t.jsx(I,{resourceUri:E({environmentName:e,packageName:s}),path:n,manifestStaleTime:1e4});return t.jsxs(x,{ref:m,sx:Y,children:[t.jsx(ue,{children:t.jsx(f.Suspense,{fallback:h?null:k,children:t.jsx(_e,{resourceUri:E({environmentName:e,packageName:s}),path:n,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:b=>l(`/${[e,s,...b.split("/")].map(encodeURIComponent).join("/")}`),onEvent:C,loading:h?null:k,onControlsChange:y},`${e}/${s}/${n}`)})}),o.dialog,p&&!c&&fe.createPortal(t.jsx(f.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(Le,{controls:g,onDone:j})}),p)]})}function Fe({environmentName:e,packageName:s,versionSegment:n,routePath:r,edit:a,reports:h,children:c}){const{search:o}=R(),i=d=>A(U(e,s,d),e,s,n),l=he(r);if(!l)return t.jsx(t.Fragment,{children:c});const u=pe(l.name,h,l.prefer);return"found"in u?t.jsx(N,{replace:!0,to:`${i(u.found.path)}${a?V(o):o}`}):"ambiguous"in u?t.jsxs(x,{sx:S,children:[t.jsxs(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(w,{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(x,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>t.jsx("li",{children:t.jsx(xe,{to:i(d),style:{fontFamily:H},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Ue({environmentName:e,packageName:s,routePath:n,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:u,isFetching:d,isError:p,refetch:g}=F(e,s,c),{search:y}=R(),m=`${n}.malloy`,v=u?me(m,l):void 0,j=u&&!d&&!p,[C,k]=f.useState();f.useEffect(()=>{j&&k(m)},[j,m]);const b=v!==void 0||j||C===m,$=ge(e,s,m,r&&!i&&b&&!v),T=ee=>t.jsx(Fe,{environmentName:e,packageName:s,...o!==void 0?{versionSegment:o}:{},routePath:n,edit:r,reports:l,children:ee});if(!b&&(h&&!r&&!v))return T(a);if(!b&&p&&!d)return t.jsx(x,{sx:S,children:t.jsxs(ve,{severity:"warning",action:t.jsx(O,{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 ",n,"."]})});if(!b)return t.jsx(P,{text:_.opening()});if(v)return t.jsx(We,{environmentName:e,packageName:s,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:Re(n);return M!==void 0?t.jsx(N,{replace:!0,to:`${A(`/${e}/${s}/${M.split("/").map(encodeURIComponent).join("/")}`,e,s,o)}${V(y)}`}):T(r&&!i?$.settled?t.jsx(Q,{environmentName:e,packageName:s,path:m,layout:$.layout??"grid"}):t.jsx(P,{text:_.opening()}):a)}function We({environmentName:e,packageName:s,versionId:n,path:r,editable:a,layout:h,edit:c}){const[o,i]=f.useState(c?"editor":"reader"),l=c?"editor":"reader",u=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(x,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&t.jsx(x,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(J,{environmentName:e,packageName:s,...n!==void 0?{versionId:n}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(x,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Q,{environmentName:e,packageName:s,path:r,...h?{layout:h}:{},quietLoading:u,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function Ve(){const e=je(),{search:s}=R(),{path:n,versionId:r,versionSegment:a,writable:h}=X({always:!0}),{server:c}=ye(),{params:o,onGivensChange:i,setParam:l}=W();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(n!==void 0&&n!==""&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const d=n.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(be,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n,staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n,...r!==void 0?{versionId:r}:{}})});return t.jsx(Ue,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(s),notFound:g,notFoundUntilListed:p})}const u=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:n,versionId:r});return n?.endsWith(".malloy")?t.jsx(x,{sx:S,children:t.jsx(we,{resourceUri:u,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):n?.endsWith(".malloynb")?t.jsx(J,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:n,editable:!1}):t.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n??"",staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n??"",...r!==void 0?{versionId:r}:{}})})}function B({packageName:e,modelPath:s,staticUrl:n}){const r=/\.[^./]+$/.test(s),a={fontFamily:H};return t.jsxs(x,{sx:S,children:[t.jsx(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(x,{component:"span",sx:a,children:s})," ","does not name a report, a"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(x,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(x,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ee,{href:n,children:n}),"."]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{Ve as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-DdMQ3KvM.js","assets/index-oAv7JJIj.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-CuyU-wPN.js"])))=>i.map(i=>d[i]);
2
+ import{_ as te,E as F,r as f,d7 as se,d8 as ne,d9 as U,da as W,a5 as q,D as z,j as t,H as x,db as re,a7 as E,dc as I,a4 as oe,az as ae,dd as ie,bn as ce,de as le,C as de,z as R,df as ue,as as fe,a2 as O,a3 as G,dg as he,dh as pe,a6 as N,T as w,di as xe,dj as H,G as me,dk as ge,a1 as ve,a0 as P,dl as _,A as je,N as ye,dm as be,dn as L,dp as we,dq as Ee}from"./index-oAv7JJIj.js";import{i as D,w as ke,a as V,l as Re}from"./documentRoutes-BUqz3gK5.js";import{v as Se,w as A,u as K}from"./usePackageRoute-lzkkk2Fh.js";import{u as Ce}from"./usePackageLinkNavigate-Y0cmkFp3.js";import{T as X,P as S}from"./PackageSplatRoute-EsC7l_nR.js";import{a as De,l as Y}from"./editPageMounted-mt7xJomn.js";function Ae(e,s,n){const r=te(),{reports:a,settled:h,isError:c}=F(e,s,Se(n)),o=h&&!c;return f.useCallback((i,l)=>{const u=i.path;if(!se(u))return"malformed";const d=ne(u,a),p=A(U(e,s,d.kind==="path"?d.report.path:u),e,s,n),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,s,n,a,o])}const Te='[data-tile-kind="query"]',$e=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Me=3e3;function Z(e,s,n,r){const a=f.useRef(n);a.current=n;const h=f.useRef(!1);f.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(u),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},u=setTimeout(l,Me);if(!s)return()=>clearTimeout(u);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(m=>{if(m.getBoundingClientRect().top>=g)return!1;const j=m.querySelector($e);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},[s,e,r])}function J({environmentName:e,packageName:s,versionId:n,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=f.useRef(null);Z(c,!0,h,`.${ae.report}`);const{params:o,onGivensChange:i}=W(),{versionSegment:l}=K(),u=Ae(e,s,l),d=Ce(e,s,l),p=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),g=z();return f.useEffect(()=>{if(!a||g)return;const y=()=>void oe(()=>import("./index.es-DdMQ3KvM.js"),__vite__mapDeps([0,1,2,3])),m=window.requestIdleCallback;if(m){const j=m(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(x,{ref:c,sx:X,children:r.endsWith(".malloynb")?t.jsx(re,{resourceUri:E({environmentName:e,packageName:s,modelPath:r,versionId:n}),givens:o,onGivensChange:i,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):t.jsx(I,{resourceUri:E({environmentName:e,packageName:s,versionId:n}),path:r,givens:o,onGivensChange:i,onNavigate:u,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Pe(){const[e,s]=f.useState(!1),n=f.useRef(!1),r=f.useRef(!1),a=f.useCallback(i=>{n.current=i,s(i)},[]),h=f.useCallback(()=>{r.current=!0},[]),c=ie(f.useCallback(({currentLocation:i,nextLocation:l})=>n.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));f.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(ce,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const _e=G.lazy(()=>Y().then(e=>({default:e.ReportEditor}))),Le=G.lazy(()=>Y().then(e=>({default:e.BuilderBar})));function Be(){const[e,s]=f.useState(null);return f.useEffect(()=>{s(document.getElementById("header-actions-portal"))},[]),e}function Q({environmentName:e,packageName:s,path:n,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Pe();De();const[i]=f.useState(le),l=de(),{pathname:u,search:d}=R(),p=Be(),[g,y]=f.useState(),m=f.useRef(null),v=z();Z(m,g!==void 0||v,a);const j=()=>l(`${u.replace(/\/$/,"")}${ke(d)}`),C=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),k=t.jsx(I,{resourceUri:E({environmentName:e,packageName:s}),path:n,manifestStaleTime:1e4});return t.jsxs(x,{ref:m,sx:X,children:[t.jsx(ue,{children:t.jsx(f.Suspense,{fallback:h?null:k,children:t.jsx(_e,{resourceUri:E({environmentName:e,packageName:s}),path:n,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:b=>l(`/${[e,s,...b.split("/")].map(encodeURIComponent).join("/")}`),onEvent:C,loading:h?null:k,onControlsChange:y},`${e}/${s}/${n}`)})}),o.dialog,p&&!c&&fe.createPortal(t.jsx(f.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(Le,{controls:g,onDone:j})}),p)]})}function Fe({environmentName:e,packageName:s,versionSegment:n,routePath:r,edit:a,reports:h,children:c}){const{search:o}=R(),i=d=>A(U(e,s,d),e,s,n),l=he(r);if(!l)return t.jsx(t.Fragment,{children:c});const u=pe(l.name,h,l.prefer);return"found"in u?t.jsx(N,{replace:!0,to:`${i(u.found.path)}${a?V(o):o}`}):"ambiguous"in u?t.jsxs(x,{sx:S,children:[t.jsxs(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(w,{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(x,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>t.jsx("li",{children:t.jsx(xe,{to:i(d),style:{fontFamily:H},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Ue({environmentName:e,packageName:s,routePath:n,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:u,isFetching:d,isError:p,refetch:g}=F(e,s,c),{search:y}=R(),m=`${n}.malloy`,v=u?me(m,l):void 0,j=u&&!d&&!p,[C,k]=f.useState();f.useEffect(()=>{j&&k(m)},[j,m]);const b=v!==void 0||j||C===m,T=ge(e,s,m,r&&!i&&b&&!v),$=ee=>t.jsx(Fe,{environmentName:e,packageName:s,...o!==void 0?{versionSegment:o}:{},routePath:n,edit:r,reports:l,children:ee});if(!b&&(h&&!r&&!v))return $(a);if(!b&&p&&!d)return t.jsx(x,{sx:S,children:t.jsxs(ve,{severity:"warning",action:t.jsx(O,{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 ",n,"."]})});if(!b)return t.jsx(P,{text:_.opening()});if(v)return t.jsx(We,{environmentName:e,packageName:s,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:Re(n);return M!==void 0?t.jsx(N,{replace:!0,to:`${A(`/${e}/${s}/${M.split("/").map(encodeURIComponent).join("/")}`,e,s,o)}${V(y)}`}):$(r&&!i?T.settled?t.jsx(Q,{environmentName:e,packageName:s,path:m,layout:T.layout??"grid"}):t.jsx(P,{text:_.opening()}):a)}function We({environmentName:e,packageName:s,versionId:n,path:r,editable:a,layout:h,edit:c}){const[o,i]=f.useState(c?"editor":"reader"),l=c?"editor":"reader",u=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(x,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&t.jsx(x,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(J,{environmentName:e,packageName:s,...n!==void 0?{versionId:n}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(x,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Q,{environmentName:e,packageName:s,path:r,...h?{layout:h}:{},quietLoading:u,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function Ve(){const e=je(),{search:s}=R(),{path:n,versionId:r,versionSegment:a,writable:h}=K({always:!0}),{server:c}=ye(),{params:o,onGivensChange:i,setParam:l}=W();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(n!==void 0&&n!==""&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const d=n.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(be,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n,staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n,...r!==void 0?{versionId:r}:{}})});return t.jsx(Ue,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(s),notFound:g,notFoundUntilListed:p})}const u=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:n,versionId:r});return n?.endsWith(".malloy")?t.jsx(x,{sx:S,children:t.jsx(we,{resourceUri:u,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):n?.endsWith(".malloynb")?t.jsx(J,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:n,editable:!1}):t.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n??"",staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n??"",...r!==void 0?{versionId:r}:{}})})}function B({packageName:e,modelPath:s,staticUrl:n}){const r=/\.[^./]+$/.test(s),a={fontFamily:H};return t.jsxs(x,{sx:S,children:[t.jsx(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(x,{component:"span",sx:a,children:s})," ","does not name a report, a"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(x,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(x,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ee,{href:n,children:n}),"."]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{Ve as default};
@@ -1 +1 @@
1
- import{z as x,_ as N,C as f,r as h,a5 as j,j as n,a6 as E,a7 as P,a8 as L}from"./index-D-htCO4q.js";import{d as M}from"./documentRoutes-DtWdqG6B.js";import{u as R,p as r,L as c}from"./usePackageRoute-CjGpnrTp.js";import{u as S}from"./usePackageLinkNavigate-D2TepxAX.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(()=>j({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(E,{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};
1
+ import{z as x,_ as N,C as f,r as h,a5 as j,j as n,a6 as E,a7 as P,a8 as L}from"./index-oAv7JJIj.js";import{d as M}from"./documentRoutes-BUqz3gK5.js";import{u as R,p as r,L as c}from"./usePackageRoute-lzkkk2Fh.js";import{u as S}from"./usePackageLinkNavigate-Y0cmkFp3.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(()=>j({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(E,{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};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-t_Ln0qr1.js","assets/index-D-htCO4q.js","assets/index-DUqldpo0.css","assets/documentRoutes-DtWdqG6B.js","assets/usePackageRoute-CjGpnrTp.js","assets/usePackageLinkNavigate-D2TepxAX.js","assets/editPageMounted-vEdUjhAX.js","assets/PackagePage-Cxa0_alv.js"])))=>i.map(i=>d[i]);
2
- import{z as P,C as g,r as h,j as e,H as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-D-htCO4q.js";import{u as R,w as S,L as T}from"./usePackageRoute-CjGpnrTp.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},b={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-t_Ln0qr1.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-Cxa0_alv.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 D=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,b as T,D as a};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-CuW71DWw.js","assets/index-oAv7JJIj.js","assets/index-DUqldpo0.css","assets/documentRoutes-BUqz3gK5.js","assets/usePackageRoute-lzkkk2Fh.js","assets/usePackageLinkNavigate-Y0cmkFp3.js","assets/editPageMounted-mt7xJomn.js","assets/PackagePage-DtP6BtnP.js"])))=>i.map(i=>d[i]);
2
+ import{z as P,C as g,r as h,j as e,H as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-oAv7JJIj.js";import{u as R,w as S,L as T}from"./usePackageRoute-lzkkk2Fh.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},b={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-CuW71DWw.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-DtP6BtnP.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 D=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,b as T,D as a};
@@ -1,5 +1,5 @@
1
- import{az as fe,j as O,H as ie,r as g,aA as pe,R as ge,aB as ve,ah as we,aC as ke,aD as G,aE as Y,aF as xe,aG as Ce,aH as Ae,aI as ze,aJ as Ee,aK as Se,aL as De,aM as ue,aN as se}from"./index-D-htCO4q.js";const v=fe.drillCell;function $e(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 Fe(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 Re(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 de(e,t){const r=Re(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 je(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 Te(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 Me(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 pe){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 Q=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function _e(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Oe=e=>Q(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Be=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Le=e=>e.type?.element_type?.fields??e.type?.fields;function me(e,t){let r=!1;return{fields:e.map(a=>{const o=Le(a);if(o){const l=me(o,ue(Q(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||Oe(a))return a;const n=_e(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Be(n)}
2
- `},...a.annotations??[]]})}),changed:r}}function qe(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}=me(r,ue(Q(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const ce=320,Ie=10,Ne=96,Pe=4e3;function He(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return ce;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Ie+Ne;return Math.min(Math.max(ce,a),Pe)}function Ye(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 Ue(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",Ve=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ce();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:Te(e),theme:je(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function We(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 xe())}catch{return}try{const{tag:o}=a(r);return Me(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Xe(e,t,r){const a=Ae(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Je=`
1
+ import{az as fe,j as O,H as ie,r as g,aA as pe,R as ge,aB as ve,ah as we,aC as ke,aD as G,aE as Y,aF as xe,aG as Ce,aH as Ae,aI as ze,aJ as Ee,aK as Se,aL as De,aM as ue,aN as se}from"./index-oAv7JJIj.js";const v=fe.drillCell;function $e(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 Fe(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 Re(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 de(e,t){const r=Re(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 je(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 Te(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 Me(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 pe){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 Q=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function _e(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Oe=e=>Q(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Be=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Le=e=>e.type?.element_type?.fields??e.type?.fields;function me(e,t){let r=!1;return{fields:e.map(a=>{const o=Le(a);if(o){const l=me(o,ue(Q(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||Oe(a))return a;const n=_e(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Be(n)}
2
+ `},...a.annotations??[]]})}),changed:r}}function qe(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}=me(r,ue(Q(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const ce=320,Ie=10,Ne=96,Pe=4e3;function He(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return ce;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Ie+Ne;return Math.min(Math.max(ce,a),Pe)}function Ye(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 Ue(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",Ve=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ce();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:Te(e),theme:je(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function We(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 xe())}catch{return}try{const{tag:o}=a(r);return Me(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Je(e,t,r){const a=Ae(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Xe=`
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
- `,he="publisher-malloy-renderer-overrides";function Ge(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=Je,document.head.appendChild(e)}function Qe({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(()=>Ye(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),K=g.useRef(0),{theme:q,layers:U,mode:Z}=ge(),ee=g.useMemo(()=>({radius:q.ui.radius.tile,padding:`${ve}px`}),[q.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;Ge();const d=l.current,be=K.current+=1;let V=!1;const W=()=>!V&&be===K.current;let c,y,I=null,X=0,N=null,P=null,H=null,R=null,j=null,T=null,te=null,re=0,S=null;x.current=!1;let p,D;const J=w=>{if(V||!w.firstElementChild||G(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(`.${Ee}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const $=Se(w,se(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),$>0&&(x.current=!0,a&&$!==re&&(re=$,a($)));const A=De(w,se(p));M&&A&&te!==A&&(te=A,T?.disconnect(),T=new ResizeObserver(()=>J(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 We(w),_=M?we([...U,ke(U,M)],Z):q;if(!W())return;try{y=await Ve(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!W()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Xe(c,_,ee),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;R=new MutationObserver(()=>{j&&clearTimeout(j),j=setTimeout(()=>{J(h),x.current&&R?.disconnect()},100)}),R.observe(c,{childList:!0,subtree:!0,attributes:!0});const $=y;let A=!1;const ae=()=>{if(!(A||!W())){A=!0,S&&(clearTimeout(S),S=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},J(h)}};try{y.setResult(qe(w));try{const z=y.getMetadata(),E=z?.getRootField();f&&Ue(E),p=E?.renderAs(),D=E?z?.getPluginsForField(E.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(G(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=G(p,D);const m=He(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 oe=i.current;try{if(oe){const z=$e(y,oe.canDrill),E=()=>{try{Fe(h,z)}catch(s){console.warn("Drill affordance skipped:",s)}};E();const ne=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)}))},le=s=>s.target?.closest?.(`.${v}`)??null,ye=(s,u)=>{de(s,u)?.focus()};N=s=>{const u=le(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(),ye(u,F);return}s.key==="Enter"?(s.preventDefault(),ne(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=le(s);u&&(s.preventDefault(),ne(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&de(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),z.size>0&&typeof MutationObserver<"u"&&(I=new MutationObserver(()=>{cancelAnimationFrame(X),X=requestAnimationFrame(E)}),I.observe(h,{childList:!0,subtree:!0}))}}catch(z){console.warn("Drill affordance skipped:",z)}y.onReady(ae),S=setTimeout(ae,1e4)}catch(m){console.error("Error rendering visualization:",m),R?.disconnect(),T?.disconnect(),I?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{V=!0,R?.disconnect(),T?.disconnect(),j&&clearTimeout(j),S&&clearTimeout(S),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),I?.disconnect(),cancelAnimationFrame(X),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,q,U,Z,ee]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function Ze(e){return typeof window>"u"?O.jsx(ie,{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(ie,{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(Qe,{...e})})}const tt=Object.freeze(Object.defineProperty({__proto__:null,default:Ze},Symbol.toStringTag,{value:"Module"}));export{v as D,Ze as R,Te as a,je as b,tt as c,$e as d,Fe as m,Me as r};
179
+ `,he="publisher-malloy-renderer-overrides";function Ge(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=Xe,document.head.appendChild(e)}function Qe({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(()=>Ye(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),K=g.useRef(0),{theme:q,layers:U,mode:Z}=ge(),ee=g.useMemo(()=>({radius:q.ui.radius.tile,padding:`${ve}px`}),[q.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;Ge();const d=l.current,be=K.current+=1;let V=!1;const W=()=>!V&&be===K.current;let c,y,I=null,J=0,N=null,P=null,H=null,R=null,j=null,T=null,te=null,re=0,S=null;x.current=!1;let p,D;const X=w=>{if(V||!w.firstElementChild||G(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(`.${Ee}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const $=Se(w,se(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),$>0&&(x.current=!0,a&&$!==re&&(re=$,a($)));const A=De(w,se(p));M&&A&&te!==A&&(te=A,T?.disconnect(),T=new ResizeObserver(()=>X(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 We(w),_=M?we([...U,ke(U,M)],Z):q;if(!W())return;try{y=await Ve(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!W()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Je(c,_,ee),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;R=new MutationObserver(()=>{j&&clearTimeout(j),j=setTimeout(()=>{X(h),x.current&&R?.disconnect()},100)}),R.observe(c,{childList:!0,subtree:!0,attributes:!0});const $=y;let A=!1;const ae=()=>{if(!(A||!W())){A=!0,S&&(clearTimeout(S),S=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},X(h)}};try{y.setResult(qe(w));try{const z=y.getMetadata(),E=z?.getRootField();f&&Ue(E),p=E?.renderAs(),D=E?z?.getPluginsForField(E.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(G(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=G(p,D);const m=He(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 oe=i.current;try{if(oe){const z=$e(y,oe.canDrill),E=()=>{try{Fe(h,z)}catch(s){console.warn("Drill affordance skipped:",s)}};E();const ne=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)}))},le=s=>s.target?.closest?.(`.${v}`)??null,ye=(s,u)=>{de(s,u)?.focus()};N=s=>{const u=le(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(),ye(u,F);return}s.key==="Enter"?(s.preventDefault(),ne(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=le(s);u&&(s.preventDefault(),ne(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&de(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),z.size>0&&typeof MutationObserver<"u"&&(I=new MutationObserver(()=>{cancelAnimationFrame(J),J=requestAnimationFrame(E)}),I.observe(h,{childList:!0,subtree:!0}))}}catch(z){console.warn("Drill affordance skipped:",z)}y.onReady(ae),S=setTimeout(ae,1e4)}catch(m){console.error("Error rendering visualization:",m),R?.disconnect(),T?.disconnect(),I?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{V=!0,R?.disconnect(),T?.disconnect(),j&&clearTimeout(j),S&&clearTimeout(S),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),I?.disconnect(),cancelAnimationFrame(J),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,q,U,Z,ee]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function Ze(e){return typeof window>"u"?O.jsx(ie,{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(ie,{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(Qe,{...e})})}const tt=Object.freeze(Object.defineProperty({__proto__:null,default:Ze},Symbol.toStringTag,{value:"Module"}));export{v as D,Ze as R,Te as a,je as b,tt as c,$e as d,Fe as m,Me 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-D-htCO4q.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,H as t,T as a}from"./index-oAv7JJIj.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};