1var Je=Object.defineProperty;var Se=t=>{throw TypeError(t)};var Ze=(t,e,r)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var u=(t,e,r)=>Ze(t,typeof e!="symbol"?e+"":e,r),je=(t,e,r)=>e.has(t)||Se("Cannot "+r);var pe=(t,e,r)=>(je(t,e,"read from private field"),r?r.call(t):e.get(t)),Re=(t,e,r)=>e.has(t)?Se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ze=(t,e,r,s)=>(je(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r);import{r as v,i as J,k as Z,l as Y,j as n,q as X,t as Q,v as _,w as we,s as W,ah as Ye,a3 as ae,ag as Xe,a0 as $,bP as Qe,aY as H,a_ as ke,bQ as te,b0 as ne,bR as _e,b2 as Pe,aV as z,aS as re,aU as M,az as G,aW as he,aN as Te,B as k,ao as et,T as I,u as ye,at as tt,au as rt,av as nt,b8 as fe,b9 as Ce,bS as st,P as ot,I as at,E as it,D as lt,b1 as ct,b as Ie}from"./index-Dh4wjoSj.js";import{S as dt}from"./StatisticsSidebar-Qo7K-RVS.js";import{A as xe,I as qe,D as De,g as Le,C as ut,a as pt,u as ht}from"./portal-CuhV-ihB.js";import"./ListItemText-DXFPf7Ln.js";const Oe=v.createContext();function ft(t){return J("MuiTable",t)}Z("MuiTable",["root","stickyHeader"]);const gt=t=>{const{classes:e,stickyHeader:r}=t;return Q({root:["root",r&&"stickyHeader"]},ft,e)},mt=_("table",{name:"MuiTable",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,r.stickyHeader&&e.stickyHeader]}})(we(({theme:t})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...t.typography.body2,padding:t.spacing(2),color:(t.vars||t).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:"separate"}}]}))),Ee="table",wt=v.forwardRef(function(e,r){const s=Y({props:e,name:"MuiTable"}),{className:o,component:a=Ee,padding:c="normal",size:i="medium",stickyHeader:l=!1,...y}=s,p={...s,component:a,padding:c,size:i,stickyHeader:l},w=gt(p),g=v.useMemo(()=>({padding:c,size:i,stickyHeader:l}),[c,i,l]);return n.jsx(Oe.Provider,{value:g,children:n.jsx(mt,{as:a,role:a===Ee?null:"table",ref:r,className:X(w.root,o),ownerState:p,...y})})}),le=v.createContext();function yt(t){return J("MuiTableBody",t)}Z("MuiTableBody",["root"]);const xt=t=>{const{classes:e}=t;return Q({root:["root"]},yt,e)},bt=_("tbody",{name:"MuiTableBody",slot:"Root",overridesResolver:(t,e)=>e.root})({display:"table-row-group"}),vt={variant:"body"},Ae="tbody",St=v.forwardRef(function(e,r){const s=Y({props:e,name:"MuiTableBody"}),{className:o,component:a=Ae,...c}=s,i={...s,component:a},l=xt(i);return n.jsx(le.Provider,{value:vt,children:n.jsx(bt,{className:X(l.root,o),as:a,ref:r,role:a===Ae?null:"rowgroup",ownerState:i,...c})})});function jt(t){return J("MuiTableCell",t)}const Rt=Z("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),zt=t=>{const{classes:e,variant:r,align:s,padding:o,size:a,stickyHeader:c}=t,i={root:["root",r,c&&"stickyHeader",s!=="inherit"&&`align${W(s)}`,o!=="normal"&&`padding${W(o)}`,`size${W(a)}`]};return Q(i,jt,e)},kt=_("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,e[r.variant],e[`size${W(r.size)}`],r.padding!=="normal"&&e[`padding${W(r.padding)}`],r.align!=="inherit"&&e[`align${W(r.align)}`],r.stickyHeader&&e.stickyHeader]}})(we(({theme:t})=>({...t.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:t.vars?`1px solid ${t.vars.palette.TableCell.border}`:`1px solid 2 ${t.palette.mode==="light"?Ye(ae(t.palette.divider,1),.88):Xe(ae(t.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(t.vars||t).palette.text.primary,lineHeight:t.typography.pxToRem(24),fontWeight:t.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(t.vars||t).palette.text.primary}},{props:{variant:"footer"},style:{color:(t.vars||t).palette.text.secondary,lineHeight:t.typography.pxToRem(21),fontSize:t.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${Rt.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:e})=>e.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(t.vars||t).palette.background.default}}]}))),U=v.forwardRef(function(e,r){const s=Y({props:e,name:"MuiTableCell"}),{align:o="inherit",className:a,component:c,padding:i,scope:l,size:y,sortDirection:p,variant:w,...g}=s,b=v.useContext(Oe),P=v.useContext(le),q=P&&P.variant==="head";let h;c?h=c:h=q?"th":"td";let j=l;h==="td"?j=void 0:!j&&q&&(j="col");const x=w||P&&P.variant,T={...s,align:o,component:h,padding:i||(b&&b.padding?b.padding:"normal"),size:y||(b&&b.size?b.size:"medium"),sortDirection:p,stickyHeader:x==="head"&&b&&b.stickyHeader,variant:x},R=zt(T);let S=null;return p&&(S=p==="asc"?"ascending":"descending"),n.jsx(kt,{as:h,ref:r,className:X(R.root,a),"aria-sort":S,scope:j,ownerState:T,...g})});function Tt(t){return J("MuiTableContainer",t)}Z("MuiTableContainer",["root"]);const Ct=t=>{const{classes:e}=t;return Q({root:["root"]},Tt,e)},It=_("div",{name:"MuiTableContainer",slot:"Root",overridesResolver:(t,e)=>e.root})({width:"100%",overflowX:"auto"}),Dt=v.forwardRef(function(e,r){const s=Y({props:e,name:"MuiTableContainer"}),{className:o,component:a="div",...c}=s,i={...s,component:a},l=Ct(i);return n.jsx(It,{ref:r,as:a,className:X(l.root,o),ownerState:i,...c})});function Et(t){return J("MuiTableHead",t)}Z("MuiTableHead",["root"]);const At=t=>{const{classes:e}=t;return Q({root:["root"]},Et,e)},Mt=_("thead",{name:"MuiTableHead",slot:"Root",overridesResolver:(t,e)=>e.root})({display:"table-header-group"}),Nt={variant:"head"},Me="thead",Ht=v.forwardRef(function(e,r){const s=Y({props:e,name:"MuiTableHead"}),{className:o,component:a=Me,...c}=s,i={...s,component:a},l=At(i);return n.jsx(le.Provider,{value:Nt,children:n.jsx(Mt,{as:a,className:X(l.root,o),ref:r,role:a===Me?null:"rowgroup",ownerState:i,...c})})});function Ft(t){return J("MuiTableRow",t)}const Ne=Z("MuiTableRow",["root","selected","hover","head","footer"]),$t=t=>{const{classes:e,selected:r,hover:s,head:o,footer:a}=t;return Q({root:["root",r&&"selected",s&&"hover",o&&"head",a&&"footer"]},Ft,e)},Pt=_("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,r.head&&e.head,r.footer&&e.footer]}})(we(({theme:t})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${Ne.hover}:hover`]:{backgroundColor:(t.vars||t).palette.action.hover},[`&.${Ne.selected}`]:{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})`:ae(t.palette.primary.main,t.palette.action.selectedOpacity),"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.hoverOpacity}))`:ae(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity)}}}))),He="tr",Fe=v.forwardRef(function(e,r){const s=Y({props:e,name:"MuiTableRow"}),{className:o,component:a=He,hover:c=!1,selected:i=!1,...l}=s,y=v.useContext(le),p={...s,component:a,hover:c,selected:i,head:y&&y.variant==="head",footer
2:y&&y.variant==="footer"},w=$t(p);return n.jsx(Pt,{as:a,ref:r,className:X(w.root,o),role:a===He?null:"row",ownerState:p,...l})}),qt=$(n.jsx("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V10h14zM9 14H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2zm-8 4H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2z"}),"CalendarMonth"),Lt=$(n.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"DoNotDisturb"),Ot=$(n.jsx("path",{d:"M20.13 5.41 18.72 4l-9.19 9.19-4.25-4.24-1.41 1.41 5.66 5.66zM5 18h14v2H5z"}),"DownloadDone"),Ut=$(n.jsx("path",{d:"M18.32 4.26C16.84 3.05 15.01 2.25 13 2.05v2.02c1.46.18 2.79.76 3.9 1.62zM19.93 11h2.02c-.2-2.01-1-3.84-2.21-5.32L18.31 7.1c.86 1.11 1.44 2.44 1.62 3.9m-1.62 5.9 1.43 1.43c1.21-1.48 2.01-3.32 2.21-5.32h-2.02c-.18 1.45-.76 2.78-1.62 3.89M13 19.93v2.02c2.01-.2 3.84-1 5.32-2.21l-1.43-1.43c-1.1.86-2.43 1.44-3.89 1.62M13 12V7h-2v5H7l5 5 5-5zm-2 7.93v2.02c-5.05-.5-9-4.76-9-9.95s3.95-9.45 9-9.95v2.02C7.05 4.56 4 7.92 4 12s3.05 7.44 7 7.93"}),"Downloading"),Bt=$(n.jsx("path",{d:"M9 6.17V3h6v6h4l-3.59 3.59zm12.19 15.02L2.81 2.81 1.39 4.22 6.17 9H5l7 7 .59-.59L15.17 18H5v2h12.17l2.61 2.61z"}),"FileDownloadOff"),Wt=$(n.jsx("path",{d:"M2 20h20v4H2zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5zm4.42-5.61 2.03-5.79h.12l2.03 5.79z"}),"FormatColorText"),Gt=$(n.jsx("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered"),ge=$(n.jsx("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"}),"InsertDriveFile"),Vt=$(n.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"}),"Key"),Kt=$(n.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"}),"Numbers"),Jt=Qe("status",[H({status:te("WAITING"),data:H({elements_in_queue:ke()})}),H({status:te("PROCESSING"),data:H({}).optional()}),H({status:te("READY"),data:H({token:ne(),file_size:ke()})}),H({status:te("ERR"),data:H({reason:ne()})})]),Ue=_e([H({ARS:ne()}),te("All")]),Zt=H({mbtiles_source:ne(),extract_type:ne(),dimension:Ue});var V;const B=class B{constructor(e,r){u(this,"type");Re(this,V);this.type=e,ze(this,V,r)}isAll(){return this.type==E.all}isArs(){return this.type==E.ars}ars(){return this.isArs()?pe(this,V):void 0}toRequestString(){switch(this.type){case E.all:return"ALL";case E.ars:return`ARS_${pe(this,V).value()}`}return""}static fromRequestString(e){const r=e.indexOf("_");if(r<1)return E.fromString(e)===E.all?B.newAll():void 0;const s=E.fromString(e.substring(0,r));if(s&&s===E.ars){const o=xe.fromString(e.substring(r+1));return o.isErr()?void 0:B.newArs(o.value)}}static newAll(){return new B(E.all,null)}static newArs(e){return new B(E.ars,e)}};V=new WeakMap;let K=B;const F=class F extends Pe.Enumify{static fromString(e){switch(e.toUpperCase()){case"ALL":return F.all;case"ARS":return F.ars}}};u(F,"all",new F),u(F,"ars",new F),u(F,"_",F.closeEnum());let E=F;class be{constructor(e,r,s){u(this,"dimension");u(this,"source");u(this,"sourceType");this.dimension=e,this.source=r,this.sourceType=s}toParams(){return{dimension:this.dimension.toRequestString(),source:this.source,type:this.sourceType.getSuffix()}}toShortId(){return`DLR_${this.source}_${this.dimension.toRequestString()}`}toDisplay(){return`Dimension: ${this.dimension.toRequestString()}, Source: ${this.source}, Type: ${this.sourceType.getSuffix()}`}static toParamsMulti(e){const r=new URLSearchParams;for(const s of e)r.append("dimension",s.dimension.toRequestString()),r.append("source",s.source),r.append("type",s.sourceType.getSuffix());return r}}class Yt{static fromJSON(e){const r=Zt.safeParse(e);if(!r.success)return z(new Error(r.error.message));const s=r.data,o=Xt.fromJSON(s.dimension);if(o.isErr())return z(o.error);const a=re.fromString(s.extract_type);return a.isErr()?z(new Error("Invalid source type")):M(new be(o.value,s.mbtiles_source,a.value))}}class Xt{static fromJSON(e){const r=Ue.safeParse(e);if(!r.success)return z(new Error(r.error.message));const s=r.data;if(s==="All")return M(K.newAll());const o=xe.fromString(s.ARS);if(o.isErr())return z(o.error);const a=K.newArs(o.value);return M(a)}}class Be{static fromJSON(e){if(!e||typeof e!="object"||!("status"in e))return z(new Error("Invalid response: not an object"));const r={...e,status:typeof e.status=="string"?e.status.toUpperCase():e.status},s=Jt.safeParse(r);if(!s.success)return z(new Error(s.error.message));const o=s.data;switch(o.status){case"WAITING":return M(new m({status:d.waiting,inner:new We(o.data.elements_in_queue)}));case"PROCESSING":return M(new m({status:d.processing,inner:new _t}));case"READY":return M(new m({status:d.ready,inner:new Ge(o.data.token,o.data.file_size)}));case"ERR":return o.data.reason.includes("No features found for request")?M(new m({status:d.noFeatures,inner:new me(o.data.reason)}
2)):M(new m({status:d.error,inner:new me(o.data.reason)}))}}}class Qt{static fromJSON(e){if(!Array.isArray(e))return z(new Error("Expected an array of download status items"));const r={};for(const s of e){if(!s||typeof s!="object"||!("request"in s)||!("response"in s))continue;const o=s,a=Yt.fromJSON(o.request);if(a.isErr())continue;const c=a.value,i=Be.fromJSON(o.response);i.isErr()||(r[c.toShortId()]=new A(c,i.value))}return M(new Ke(r))}}class m{constructor({status:e,inner:r,payload:s}){u(this,"status");u(this,"inner");u(this,"payload");this.status=e,this.inner=r,this.payload=s}isReady(){return this.status==d.ready}isUnknown(){return this.status==d.unknown}isPending(){return this.status==d.waiting||this.status==d.processing}static newUnknown(e=null){return new m({status:d.unknown,payload:e})}static newError(e){return e||(e=""),new m({status:d.error,inner:new me(e)})}static newDownloading(){return new m({status:d.downloading})}static newDownloadDelegated(){return new m({status:d.download_delegated})}static fromJSON(e){return Be.fromJSON(e)}}const f=class f extends Pe.Enumify{static fromString(e){switch(e.toUpperCase()){case"WAITING":return f.waiting;case"PROCESSING":return f.processing;case"READY":return f.ready;case"ERR":return f.error;default:return f.unknown}}};u(f,"waiting",new f),u(f,"processing",new f),u(f,"ready",new f),u(f,"downloading",new f),u(f,"download_delegated",new f),u(f,"noFeatures",new f),u(f,"error",new f),u(f,"unknown",new f),u(f,"_",f.closeEnum());let d=f;class We{constructor(e){u(this,"queuedElements");this.queuedElements=e}}class _t{constructor(){}}class Ge{constructor(e,r){u(this,"token");u(this,"fileSize");this.token=e,this.fileSize=r}toDownloading(){return new m({status:d.downloading,inner:new er(this.fileSize)})}toDownload_delegated(){return new m({status:d.download_delegated,inner:new Ve(this.fileSize)})}}class er{constructor(e){u(this,"fileSize");this.fileSize=e}toDownloaded(){return new m({status:d.download_delegated,inner:new Ve(this.fileSize)})}}class Ve{constructor(e){u(this,"fileSize");this.fileSize=e}}class me{constructor(e){u(this,"reason");this.reason=e??"Unknown reason"}}class Ke{constructor(e={}){u(this,"states");this.states=e}isEmpty(){return Object.keys(this.states).length===0}hasStatus(e){return e.toShortId()in this.states}getStatus(e){return this.states[e.toShortId()]}hasStatusById(e){return e in this.states}getStatusById(e){return this.states[e]}static fromJSON(e){return Qt.fromJSON(e)}}class A{constructor(e,r){u(this,"request");u(this,"response");this.request=e,this.response=r}}const tr=({id:t,request:e,viewSource:r,state:s,onClick:o})=>{s||(s=m.newUnknown());const{label:a,color:c,StateIcon:i,disabled:l,InfoComponent:y}=(()=>{var p,w,g;switch(s.status){case d.unknown:return{label:"Download",color:"success",StateIcon:De,disabled:!1};case d.waiting:return{label:"Angefragt..",color:"secondary",StateIcon:Te,disabled:!0,InfoComponent:s.inner instanceof We?n.jsxs(n.Fragment,{children:["Warteschlange: Position ",s.inner.queuedElements]}):null,isLoadingState:!0};case d.processing:return{label:"Verarbeite..",color:"secondary",StateIcon:Te,disabled:!0};case d.ready:return{label:"Download",color:"success",StateIcon:De,disabled:!1,InfoComponent:n.jsx(n.Fragment,{children:n.jsx(G,{title:"DateigröÃe",children:n.jsxs("span",{children:[n.jsx(ge,{sx:{fontSize:18}})," ",he.displayNiceFileSize((p=s.inner)==null?void 0:p.fileSize)]})})})};case d.downloading:return{label:"Downloade..",color:"success",StateIcon:Ut,disabled:!0,InfoComponent:n.jsx(n.Fragment,{children:n.jsx(G,{title:"DateigröÃe",children:n.jsxs("span",{children:[n.jsx(ge,{sx:{fontSize:18}})," ",he.displayNiceFileSize((w=s.inner)==null?void 0:w.fileSize)]})})})};case d.download_delegated:return{label:"Daten bereitgestellt",color:"success",StateIcon:Ot,disabled:!0,InfoComponent:n.jsx(n.Fragment,{children:n.jsx(G,{title:"DateigröÃe",children:n.jsxs("span",{children:[n.jsx(ge,{sx:{fontSize:18}})," ",he.displayNiceFileSize((g=s.inner)==null?void 0:g.fileSize)]})})})};case d.error:return{label:"Download",color:"error",StateIcon:Bt,disabled:!1};case d.noFeatures:return{label:"Keine Daten",color:"error",StateIcon:Lt,disabled:!0};default:return{label:"Anfragen",color:"primary",StateIcon:qe,disabled:!1}}})();return n.jsxs(k,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",ml:"auto",gap:1},children:[n.jsxs(et,{id:t,variant:"contained",color:c,disabled:l,onClick:()=>o({id:t,viewSource:r,state:s,request:e}),children:[n.jsx(i,{fontSize:"small",size:16,thickness:5,sx:{color:"inherit",mr:1}}),a]}),y?n.jsx(I,{variant:"body2",sx:{fontWeight:500,color:"inherit"},children:y}):null]})};function rr({regionArs:t,subscriptionSource:e,viewSource:r,downloadStates:s,handleDownload:o}){var w,g,b;const a=Le(e.sourceType),c=e.sourceType.description(),i=ye();let l;t.isAll()?l=K.newAll():l=K.newArs(t);const y=new be(l,r.tag,e.sourceType),p=y.toShortId();return n.jsx(ut,{sx:{mb:1,p:1,display:"flex",flexDirection:"column",backgroundColor:i.palette.background.paper,border:`1px solid ${i.palette.divider}`,color:"inherit"},children:n.jsxs(k,{sx:{display:"flex",alignItems:"flex-start",ga
2p:1},children:[n.jsxs(k,{sx:{display:"flex",alignItems:"flex-start",pt:1,gap:1},children:[a&&n.jsx(a,{sx:{fontSize:24,color:i.palette.primary.main}}),n.jsx(I,{variant:"body2",sx:{fontWeight:500,color:"inherit",paddingRight:2},children:c}),n.jsx(qt,{sx:{fontSize:24}}),n.jsx(G,{title:`Kampagnenjahr ${(w=r.year)==null?void 0:w.value()}`,children:n.jsx(I,{variant:"body2",sx:{fontWeight:500,color:"inherit",paddingRight:2},children:(g=r.year)==null?void 0:g.value()})})]}),n.jsx(k,{sx:{display:"flex",alignItems:"center",gap:2,ml:"auto"},children:n.jsx(tr,{id:p,request:y,viewSource:r,state:((b=s[p])==null?void 0:b.response)||m.newUnknown(),onClick:o})})]})})}function nr({regionArs:t,subscriptionSource:e,downloadStates:r,handleDownload:s,setSourceInfoType:o}){const a=Le(e.sourceType),c=e.sourceType.description(),i=ye();return n.jsxs(tt,{disableGutters:!0,sx:{bgcolor:"background.paper",borderRadius:1,mb:1,border:1,borderColor:i.palette.divider,"&:before":{display:"none"}},children:[n.jsxs(rt,{expandIcon:n.jsx(pt,{}),onClick:()=>{o(e.sourceType)},children:[n.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:1},children:[a&&n.jsx(a,{sx:{fontSize:24,color:i.palette.primary.main}}),n.jsx(I,{sx:{fontWeight:500,color:"inherit"},children:c})]}),n.jsx(k,{sx:{ml:"auto",mr:2,display:"flex",alignItems:"center",cursor:"pointer",color:i.palette.info.main,fontWeight:500,"&:hover":{textDecoration:"underline"}},onClick:l=>{l.stopPropagation(),o(e.sourceType)},children:n.jsx(G,{title:"Attributbeschreibung öffnen",placement:"top",children:n.jsx(qe,{sx:{fontSize:20}})})})]}),n.jsx(nt,{sx:{p:2},children:n.jsx(k,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.sources.map(l=>{var y;return n.jsx(rr,{regionArs:t,subscriptionSource:e,viewSource:l,downloadStates:r,handleDownload:s},(y=l.year)==null?void 0:y.value())})})})]})}class sr{constructor(){}async extract(e){try{if(fe.isDemoMode())return z(new Error("Demoservice not allowed to download data"));const r=await Ce.post("datadl/extract",null,{params:e.toParams()});if(!r)return z(new Error(`Response to extract request ${e.toDisplay()} is null`));const s=m.fromJSON(r.data.data);return s.isErr()?(console.error("Error parsing download response: ",s.error),z(s.error)):M(s.value)}catch(r){return console.error("Error fetching download: ",r),z(r instanceof Error?r:new Error("Unknown error"))}}async status(e){try{const r=be.toParamsMulti(e);if(fe.isDemoMode())return z(new Error("Demoservice not allowed to download data"));const s=await Ce.get("datadl/status",{params:r});if(!s)return z(new Error(`Response to status request ${r.toString()} is null`));const o=Ke.fromJSON(s.data.data);return o.isErr()?(console.error("Error parsing download status response: ",o.error),z(o.error)):M(o.value)}catch(r){return console.error("Error parsing download response: ",r),z(r instanceof Error?r:new Error("Unknown error"))}}delegate_download(e,r){if(fe.isDemoMode())return z(new Error("Demoservice not allowed to download data"));const s=new URL("/api/datadl/download",st.defaults.baseURL);s.searchParams.set("token",e.token),s.searchParams.set("file_name",r);const o=document.createElement("a");return o.href=s.toString(),o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),M(void 0)}}const ie=new sr,or=({userData:t,region:e,downloadStates:r,setDownloadStates:s,setSourceInfoType:o})=>{const a=xe.fromString(e.ars);if(a.isErr())return n.jsx(k,{children:n.jsx(I,{children:"Ungültiger ARS Code"})});const c=a.value,i=async p=>{var q;const{state:w,request:g,id:b,viewSource:P}=p;switch(w.status){case d.unknown:case d.error:try{const h=await ie.extract(g);if(h.isErr()){s(j=>({...j,[b]:new A(g,m.newError(h.error.message))}));return}s(j=>{const x={...j};return x[b]=new A(g,h.value),x})}catch(h){console.error("Download failed:",h);const j=h instanceof Error?h:new Error(typeof h=="string"?h:"Unknown error");s(x=>{const T={...x};return T[b]=new A(g,m.newError(j.message)),T})}break;case d.waiting:case d.processing:break;case d.ready:try{s(T=>{const R={...T};return R[b]=new A(g,m.newDownloading()),R});let h;e.city==""?h="Gesamt":h=e.city;const j=`SR${(q=P.year)==null?void 0:q.toShortString()}_${h}_${g.sourceType.description()}.gpkg`.replace(", ","_").replace(" ","_"),x=ie.delegate_download(w.inner,j);s(T=>{const R={...T};return x.isOk()?R[b]=new A(g,m.newDownloadDelegated()):R[b]=new A(g,m.newError(x.error.message)),R})}catch(h){console.error("Download failed:",h);const j=h instanceof Error?h:new Error(typeof h=="string"?h:"Unknown error");s(x=>{const T={...x};return T[b]=new A(g,m.newError(j.message)),T})}break}},l=t.subscriptions.find(p=>p.hasBikedata());if(!l)return n.jsx(k,{children:n.jsx(I,{children:"Keine Downloaddaten vorhanden."})});const y=l.getSubscriptionSourceViews();return n.jsx(k,{sx:{display:"flex",flexDirection:"column",pt:1,gap:2,minWidth:{sm:350,md:450},maxWidth:600},children:y.map(p=>n.jsx(nr,{regionArs:c,subscriptionSource:p,downloadStates:r,handleDownload:i,setSourceInfoType:o}
2,p.sourceType.enumKey))})},ce=({title:t,icon:e,...r})=>n.jsx(G,{title:t,children:n.jsx(at,{...r,children:n.jsx(e,{sx:{fontSize:18}})})}),oe=ce({title:"Schlüssel",icon:Vt}),C=ce({title:"Ganzzahl",icon:Gt}),$e=ce({title:"Gleitkommazahl",icon:Kt}),ar=ce({title:"Text",icon:Wt}),ir=({sourceType:t})=>{let e=[];switch(t){case re.vmsp:e=[["fid",oe,"Feature-ID"],["KantenId",C,"ID der StraÃennetzkante"],["GrundlagenId",C,"ID der Kante des zugrundeliegenden Netzes [OSM]"],["Verkehrsmenge",C,"Anzahl Radfahrende während der STADTRADELN-Kampagne"],["VerkehrsmengeIn",C,"Anzahl Radfahrende während der STADTRADELN-Kampagne in Geometrierichtung"],["VerkehrsmengeGegen",C,"Anzahl Radfahrende während der STADTRADELN-Kampagne gegen Geometrierichtung"],["GeschwIn",$e,"Durchschnittsgeschwindigkeit auf der Kante in km/h in Geometrierichtung"],["GeschwGegen",$e,"Durchschnittsgeschwindigkeit auf der Kante in km/h gegen Geometrierichtung"],["DTV",C,"Modellierter Durchschnittlicher täglicher Radverkehr (DTV Rad) auf der Kante"]];break;case re.heatmap:e=[["fid",oe,"Feature-ID"],["Anzahl",C,"Anzahl der GPS-Punkte in der Zelle"]];break;case re.waitingtimes:e=[["fid",oe,"Feature-ID"],["Anzahl",C,"Anzahl der registrierten Warteereignisse innerhalb dieser Zelle"],["WartezeitMedian",C,"Median aller Wartezeiten innerhalb dieser Zelle in Sekunden"],["WartezeitP80",C,"80-Perzentil aller Wartezeiten innerhalb dieser Zelle in Sekunden"],["WartezeitMax",C,"Maximale Wartezeit innerhalb dieser Zelle in Sekunden"]];break;case re.od:e=[["fid",oe,"Feature-ID"],["ZellenID",ar,"H3-Index-ID der Zelle"],["Quellfahrten",C,"Anzahl der Fahrten, die in dieser Zelle beginnen, aber nicht enden"],["Zielfahrten",C,"Anzahl der Fahrten, die in dieser Zelle enden, aber nicht beginnen"],["Binnenfahrten",C,"Anzahl der Fahrten, die sowohl in dieser Zelle beginnen als auch enden"]];break}return n.jsxs(n.Fragment,{children:[n.jsxs(I,{variant:"h6",gutterBottom:!0,children:["Attributbeschreibung für ",t.description(),"-Daten"]}),n.jsx(Dt,{component:ot,children:n.jsxs(wt,{children:[n.jsx(Ht,{children:n.jsxs(Fe,{children:[n.jsx(U,{sx:{fontWeight:"bold"},children:"Typ"}),n.jsx(U,{sx:{fontWeight:"bold"},children:"Attribut"}),n.jsx(U,{sx:{fontWeight:"bold"},children:"Beschreibung"})]})}),n.jsx(St,{children:e.map((r,s)=>n.jsxs(Fe,{children:[n.jsx(U,{children:r[1]}),n.jsx(U,{children:r[0]}),n.jsx(U,{children:r[2]})]},s))})]})})]})},hr=({categoryData:t,userData:e,downloadStates:r,setDownloadStates:s})=>{var j;const[o,a]=v.useState(null),[c,i]=v.useState(null),l=v.useRef(new Set),{communeStats:y,selectedRegion:p}=ht(),w=ye(),g=v.useRef(null),b=it.getTracer("bikemonitor");lt(),v.useEffect(()=>{const x=b.startSpan("ui.stats.view");return g.current=x,()=>{try{x.end()}catch{}g.current=null}},[]),v.useEffect(()=>{const x=setInterval(()=>{const R=[];for(const S of Object.values(r))S.response.isPending()&&R.push(S.request);R.length!=0&&ie.status(R).then(S=>{s(N=>{const D={...N},O=S;if(O.isErr())return console.error("Error fetching download status: ",O.error),N;const ee=O.value;for(const L of Object.values(ee.states))D[L.request.toShortId()]=L;return D})})},5e3);return(async()=>{var R;for(const S of Object.values(r))if(S.response.isReady()){const N=S.request.toShortId();if(l.current.has(N))continue;l.current.add(N);try{s(de=>{var ue;return{...de,[N]:new A(S.request,(ue=S.response.inner)==null?void 0:ue.toDownloading())}});let D;(o==null?void 0:o.city)==""?D="Gesamt":D=o==null?void 0:o.city;const ee=`SR${((R=S.request.source.match(/\d{2}/))==null?void 0:R[0])??"XX"}_${D}_${S.request.sourceType.description()}.gpkg`.replace(", ","_").replace(" ","_"),L=S.response.inner;if(!L||!(L instanceof Ge)){console.error("Download state is not ready: ",S);return}const ve=ie.delegate_download(L,ee);s(de=>{let se;return ve?se=new A(S.request,L.toDownload_delegated()):(se=new A(S.request,m.newError(ve)),l.current.delete(N)),{...de,[N]:se}})}catch(D){console.error("Download failed:",D);
2const O=D instanceof Error?D:new Error(typeof D=="string"?D:"Unknown error");l.current.delete(N),s(ee=>({...ee,[N]:new A(S.request,m.newError(O.message))}))}}})(),()=>{clearInterval(x)}},[r]),v.useEffect(()=>{y&&(p!=null&&p.ars)&&a(p)},[y,p]),v.useEffect(()=>{if(g.current&&o)try{g.current.addEvent("ui.stats.region.change",{"stats.regionId":(o==null?void 0:o.id)??String(o)})}catch{}},[o]);const P=e.subscriptions.find(x=>x.hasBikedata());let q=!1;P&&(P.views[0].regionsArs.isAll()?q=!1:q=!0);const h=(j=e.featureBundles)==null?void 0:j.some(x=>{var T;return(T=x.features)==null?void 0:T.some(R=>R.type==="download")});return n.jsxs(k,{className:"no-focus-outline",sx:{display:"flex",overflow:"hidden",width:"100%"},children:[n.jsx(dt,{onRegionChange:a,categoryData:t,userData:e,header:"Download",showYearSelect:!1,fetchStats:!1,allSwitch:q,hasStatisticsFeature:h}),n.jsx(k,{component:"main",sx:{flexGrow:1,display:"flex",overflow:"auto",justifyContent:"normal",px:{xs:2,sm:3,md:4},py:7,backgroundColor:w.palette.background.default,color:w.palette.text.primary},children:h?n.jsx(k,{display:"flex",children:o?n.jsx(n.Fragment,{children:n.jsxs(k,{sx:{display:"flex",gap:4,flexWrap:"wrap"},children:[n.jsxs(k,{children:[n.jsx(k,{children:n.jsxs(I,{variant:"h5",sx:{fontFamily:w.typography.fontFamily},gutterBottom:!0,children:["Radverkehrsdaten ",o!=null&&o.city?`für ${o.city}`:""]})}),n.jsx(or,{userData:e,region:o,downloadStates:r,setDownloadStates:s,setSourceInfoType:i})]}),n.jsxs(k,{sx:{flex:"1 1 300px",minWidth:400,maxWidth:800},children:[" ",n.jsx(I,{variant:"h5",sx:{fontFamily:w.typography.fontFamily},gutterBottom:!0,children:"Infomationen zu den Daten"}),n.jsxs(I,{textAlign:"justify",sx:{fontFamily:w.typography.fontFamily},gutterBottom:!0,children:["Die bereitgestellten Radverkehrsdaten stehen im"," ",n.jsx(Ie,{href:"https://www.geopackage.org/",target:"_blank",rel:"noopener noreferrer",children:"GeoPackage-Format (GPKG)"})," ","zum Download zur Verfügung. GeoPackages sind ein weit verbreitetes, offenes und effizientes GIS-Format, welches in gängigen GIS-Systemen direkt nutzbar ist."]}),n.jsxs(I,{textAlign:"justify",sx:{fontFamily:w.typography.fontFamily,mb:2},gutterBottom:!0,children:["Alle Datensätze liegen im Referenzsystem ETRS89 / UTM Zone 32N (",n.jsx(Ie,{href:"https://epsg.io/25832",target:"_blank",rel:"noopener noreferrer",children:"EPSG: 25832"}),") vor und sind damit für Anwendungen im mitteleuropäischen Raum geeignet."]}),c?n.jsx(ir,{sourceType:c}):n.jsx(I,{textAlign:"justify",sx:{fontStyle:"italic",fontFamily:w.typography.fontFamily},gutterBottom:!0,children:"Downloadquelle auswählen, um Informationen zu den jeweiligen Attributen zu erhalten."})]})]})}):n.jsx(I,{sx:{fontFamily:w.typography.fontFamily},gutterBottom:!0,children:"Region auswählen, um zu starten."})}):n.jsx(ct,{spacing:2,children:n.jsx(I,{variant:"body1",children:"Für die Downloadfunktion benötigen Sie ein zusätzliches Abonnement."})})})]})};export{hr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.