diff --git a/build/bundle.js b/build/bundle.js index 9a644df..46a02b5 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -1,2 +1,2 @@ -var app=function(){"use strict";function t(){}const e=t=>t;function n(t){return t()}function r(){return Object.create(null)}function o(t){t.forEach(n)}function s(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function l(t,e,n,r){return t[1]&&r?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](r(e))):n.ctx}const a="undefined"!=typeof window;let c=a?()=>window.performance.now():()=>Date.now(),u=a?t=>requestAnimationFrame(t):t;const f=new Set;function d(t){f.forEach((e=>{e.c(t)||(f.delete(e),e.f())})),0!==f.size&&u(d)}function m(t){let e;return 0===f.size&&u(d),{promise:new Promise((n=>{f.add(e={c:t,f:n})})),abort(){f.delete(e)}}}function p(t,e){t.appendChild(e)}function h(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function $(t){const e=k("style");return function(t,e){p(t.head||t,e),e.sheet}(h(t),e),e.sheet}function g(t,e,n){t.insertBefore(e,n||null)}function b(t){t.parentNode&&t.parentNode.removeChild(t)}function w(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function C(t){return function(e){return e.preventDefault(),t.call(this,e)}}function M(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function _(t){return""===t?null:+t}function D(t,e){e=""+e,t.data!==e&&(t.data=e)}function P(t,e){t.value=null==e?"":e}function L(t,e,n){for(let n=0;n>>0}(u)}_${l}`,d=h(t),{stylesheet:m,rules:p}=A.get(d)||function(t,e){const n={stylesheet:$(e),rules:{}};return A.set(t,n),n}(d,t);p[f]||(p[f]=!0,m.insertRule(`@keyframes ${f} ${u}`,m.cssRules.length));const g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${r}ms linear ${o}ms 1 both`,H+=1,f}function j(t,e){const n=(t.style.animation||"").split(", "),r=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),o=n.length-r.length;o&&(t.style.animation=r.join(", "),H-=o,H||u((()=>{H||(A.forEach((t=>{const{ownerNode:e}=t.stylesheet;e&&b(e)})),A.clear())})))}function N(t){F=t}function q(){if(!F)throw new Error("Function called outside component initialization");return F}function G(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t.call(this,e)))}const W=[],R=[];let O=[];const B=[],I=Promise.resolve();let K=!1;function J(t){O.push(t)}function X(t){B.push(t)}const U=new Set;let V,Z=0;function Q(){if(0!==Z)return;const t=F;do{try{for(;Z{V=null}))),V}function et(t,e,n){t.dispatchEvent(z(`${e?"intro":"outro"}${n}`))}const nt=new Set;let rt;function ot(){rt={r:0,c:[],p:rt}}function st(){rt.r||o(rt.c),rt=rt.p}function it(t,e){t&&t.i&&(nt.delete(t),t.i(e))}function lt(t,e,n,r){if(t&&t.o){if(nt.has(t))return;nt.add(t),rt.c.push((()=>{nt.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}else r&&r()}const at={duration:0};function ct(n,r,o){const i={direction:"in"};let l,a,u=r(n,o,i),f=!1,d=0;function p(){l&&j(n,l)}function h(){const{delay:r=0,duration:o=300,easing:s=e,tick:i=t,css:h}=u||at;h&&(l=T(n,0,1,o,r,s,h,d++)),i(0,1);const $=c()+r,g=$+o;a&&a.abort(),f=!0,J((()=>et(n,!0,"start"))),a=m((t=>{if(f){if(t>=g)return i(1,0),et(n,!0,"end"),p(),f=!1;if(t>=$){const e=s((t-$)/o);i(e,1-e)}}return f}))}let $=!1;return{start(){$||($=!0,j(n),s(u)?(u=u(i),tt().then(h)):h())},invalidate(){$=!1},end(){f&&(p(),f=!1)}}}function ut(n,r,i,l){const a={direction:"both"};let u=r(n,i,a),f=l?0:1,d=null,p=null,h=null;function $(){h&&j(n,h)}function g(t,e){const n=t.b-f;return e*=Math.abs(n),{a:f,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function b(r){const{delay:s=0,duration:i=300,easing:l=e,tick:a=t,css:b}=u||at,w={start:c()+s,b:r};r||(w.group=rt,rt.r+=1),d||p?p=w:(b&&($(),h=T(n,f,r,i,s,l,b)),r&&a(0,1),d=g(w,i),J((()=>et(n,r,"start"))),m((t=>{if(p&&t>p.start&&(d=g(p,i),p=null,et(n,d.b,"start"),b&&($(),h=T(n,f,d.b,d.duration,0,l,u.css))),d)if(t>=d.end)a(f=d.b,1-f),et(n,d.b,"end"),p||(d.b?$():--d.group.r||o(d.group.c)),d=null;else if(t>=d.start){const e=t-d.start;f=d.a+d.d*l(e/d.duration),a(f,1-f)}return!(!d&&!p)})))}return{run(t){s(u)?tt().then((()=>{u=u(a),b(t)})):b(t)},end(){$(),d=p=null}}}function ft(t,e){const n=e.token={};function r(t,r,o,s){if(e.token!==n)return;e.resolved=s;let i=e.ctx;void 0!==o&&(i=i.slice(),i[o]=s);const l=t&&(e.current=t)(i);let a=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==r&&t&&(ot(),lt(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),st())})):e.block.d(1),l.c(),it(l,1),l.m(e.mount(),e.anchor),a=!0),e.block=l,e.blocks&&(e.blocks[r]=l),a&&Q()}if(!(o=t)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then){if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}else{const n=q();if(t.then((t=>{N(n),r(e.then,1,e.value,t),N(null)}),(t=>{if(N(n),r(e.catch,2,e.error,t),N(null),!e.hasCatch)throw t})),e.current!==e.pending)return r(e.pending,0),!0}var o}function dt(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function mt(t){t&&t.c()}function pt(t,e,r,i){const{fragment:l,after_update:a}=t.$$;l&&l.m(e,r),i||J((()=>{const e=t.$$.on_mount.map(n).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):o(e),t.$$.on_mount=[]})),a.forEach(J)}function ht(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];O.forEach((r=>-1===t.indexOf(r)?e.push(r):n.push(r))),n.forEach((t=>t())),O=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function $t(t,e){-1===t.$$.dirty[0]&&(W.push(t),K||(K=!0,I.then(Q)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const o=r.length?r[0]:n;return d.ctx&&l(d.ctx[t],d.ctx[t]=o)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](o),m&&$t(e,t)),n})):[],d.update(),m=!0,o(d.before_update),d.fragment=!!i&&i(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(b)}else d.fragment&&d.fragment.c();n.intro&&it(e.$$.fragment),pt(e,n.target,n.anchor,n.customElement),Q()}N(f)}class bt{$destroy(){ht(this,1),this.$destroy=t}$on(e,n){if(!s(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function wt(t){const e=t-1;return e*e*e+1}function kt(t,{delay:n=0,duration:r=400,easing:o=e}={}){const s=+getComputedStyle(t).opacity;return{delay:n,duration:r,easing:o,css:t=>"opacity: "+t*s}}function vt(t,{delay:e=0,duration:n=400,easing:r=wt,axis:o="y"}={}){const s=getComputedStyle(t),i=+s.opacity,l="y"===o?"height":"width",a=parseFloat(s[l]),c="y"===o?["top","bottom"]:["left","right"],u=c.map((t=>`${t[0].toUpperCase()}${t.slice(1)}`)),f=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),m=parseFloat(s[`margin${u[0]}`]),p=parseFloat(s[`margin${u[1]}`]),h=parseFloat(s[`border${u[0]}Width`]),$=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:n,easing:r,css:t=>`overflow: hidden;opacity: ${Math.min(20*t,1)*i};${l}: ${t*a}px;padding-${c[0]}: ${t*f}px;padding-${c[1]}: ${t*d}px;margin-${c[0]}: ${t*m}px;margin-${c[1]}: ${t*p}px;border-${c[0]}-width: ${t*h}px;border-${c[1]}-width: ${t*$}px;`}}const xt="route-v001";function yt(e){let n,r;return{c(){n=k("span"),r=v(e[0]),M(n,"class","material-icons-round svelte-3om24"),E(n,"big",e[1])},m(t,e){g(t,n,e),p(n,r)},p(t,[e]){1&e&&D(r,t[0]),2&e&&E(n,"big",t[1])},i:t,o:t,d(t){t&&b(n)}}}function St(t,e,n){let{name:r}=e,{big:o=!1}=e;return t.$$set=t=>{"name"in t&&n(0,r=t.name),"big"in t&&n(1,o=t.big)},[r,o]}class Ct extends bt{constructor(t){super(),gt(this,t,St,yt,i,{name:0,big:1})}}function Mt(t){const e=t=>Math.round(t);return`${e(t.x)}/${e(t.y)}`}function _t(t){const{h:e,m:n}=Pt(t);return`${e}:${Lt(n)}`}function Dt(t){const{h:e,m:n}=Pt(t);return`${Lt(e%24)}:${Lt(n)}`}function Pt(t){const e=Math.floor(t);return{h:e,m:Math.floor(60*(t-e))}}function Lt(t){return t<10?`0${t}`:t.toString()}function Et(t){window.goatcounter?.count&&window.goatcounter.count({path:t,title:"",event:!0})}function zt(t){Et(`error-${t}`)}function At(t,e){return t.x===e.x&&t.y===e.y}function Ft(t,e){return n=function(t,e){return{x:t.x-e.x,y:t.y-e.y}}(e,t),Math.hypot(n.x,n.y);var n}const Ht="https://api3.geo.admin.ch/rest/services",Tt=2;function jt(t,e,n){const r={type:"LineString",coordinates:t.map((t=>[Math.round(t.x),Math.round(t.y)]))};return fetch(`${Ht}/profile.json`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`sr=21781&distinct_points=${e}&nb_points=${n}&geom=${JSON.stringify(r)}`}).catch(Nt).then((t=>qt(t,"Das Höhenprofil konnten nicht geladen werden."))).then((n=>new Promise((r=>{if(0===n.length)throw{id:"empty-response",message:"Für die Route sind keine Höhendaten verfügbar."};let o=n.map((t=>({point:{x:t.easting,y:t.northing},height:t.alts.COMB})));e&&(o=o.filter((e=>t.some((t=>Ft(e.point,t)t.line[e.index])),!0,t.markers.length),Ot(t),t}async function Rt(t){return t.maps=await function(t,e){const n={paths:[t.map((t=>[Math.round(t.x),Math.round(t.y)]))]},r=`geometry=${JSON.stringify(n)}&geometryType=esriGeometryPolyline&layers=all:ch.swisstopo.pixelkarte-pk${e}.metadata&tolerance=0&returnGeometry=false`;return fetch(`${Ht}/all/MapServer/identify?${r}`).catch(Nt).then((t=>qt(t,"Die Landeskarten konnten nicht geladen werden."))).then((t=>new Promise((e=>{e(t.results.map((t=>({id:t.attributes.tileid,name:t.attributes.lk_name}))))}))))}(t.line,t.mapScale),t}function Ot(t){t.distanceSum=Bt(t.line),t.lineProfileDistanceSum=Bt(t.lineProfile.map((t=>t.point))),t.effort=function(t){const e=[];e[0]=0;for(let n=1;n0?e[n]+=o/100:s<-.2&&(e[n]+=Math.abs(o)/150)}return e}(t),t.effortSum=It(t.effort),t.breakSum=[0,...It(t.markers.map((t=>t.break)))]}function Bt(t){return It(t.map(((e,n)=>Ft(t[Math.max(0,n-1)],t[n]))))}function It(t){const e=[];let n=0;for(let r=0;r{"topic"in t&&n(0,r=t.topic),"label"in t&&n(1,o=t.label)},[r,o]}class Ut extends bt{constructor(t){super(),gt(this,t,Xt,Jt,i,{topic:0,label:1})}}function Vt(t){let e,n,r,o,s,i,a,c,u,f,d,m,h,$,w,y,_,P;const L=t[4].default,E=function(t,e,n,r){if(t){const o=l(t,e,n,r);return t[0](o)}}(L,t,t[3],null);return h=new Ct({props:{name:"done"}}),{c(){e=k("div"),n=k("div"),r=x(),o=k("div"),s=k("h2"),i=v(t[1]),a=x(),c=k("form"),E&&E.c(),u=x(),f=k("br"),d=x(),m=k("button"),mt(h.$$.fragment),$=v(" Fertig"),M(n,"class","background svelte-1v8si1e"),M(s,"class","svelte-1v8si1e"),M(m,"class","svelte-1v8si1e"),M(o,"class","dialog svelte-1v8si1e")},m(l,b){g(l,e,b),p(e,n),p(e,r),p(e,o),p(o,s),p(s,i),p(o,a),p(o,c),E&&E.m(c,null),p(c,u),p(c,f),p(c,d),p(c,m),pt(h,m,null),p(m,$),y=!0,_||(P=S(c,"submit",C(t[2])),_=!0)},p(t,e){(!y||2&e)&&D(i,t[1]),E&&E.p&&(!y||8&e)&&function(t,e,n,r,o,s){if(o){const i=l(e,n,r,s);t.p(i,o)}}(E,L,t,t[3],y?function(t,e,n,r){if(t[2]&&r){const o=t[2](r(n));if(void 0===e.dirty)return o;if("object"==typeof o){const t=[],n=Math.max(e.dirty.length,o.length);for(let r=0;r32){const e=[],n=t.ctx.length/32;for(let t=0;t{y&&(w||(w=ut(e,kt,{duration:100},!0)),w.run(1))})),y=!0)},o(t){lt(E,t),lt(h.$$.fragment,t),w||(w=ut(e,kt,{duration:100},!1)),w.run(0),y=!1},d(t){t&&b(e),E&&E.d(t),ht(h),t&&w&&w.end(),_=!1,P()}}}function Zt(t){let e,n,r=t[0]&&Vt(t);return{c(){r&&r.c(),e=y()},m(t,o){r&&r.m(t,o),g(t,e,o),n=!0},p(t,[n]){t[0]?r?(r.p(t,n),1&n&&it(r,1)):(r=Vt(t),r.c(),it(r,1),r.m(e.parentNode,e)):r&&(ot(),lt(r,1,1,(()=>{r=null})),st())},i(t){n||(it(r),n=!0)},o(t){lt(r),n=!1},d(t){r&&r.d(t),t&&b(e)}}}function Qt(t,e,n){let{$$slots:r={},$$scope:o}=e,{title:s}=e,{show:i=!1}=e;const l=function(){const t=q();return(e,n,{cancelable:r=!1}={})=>{const o=t.$$.callbacks[e];if(o){const s=z(e,n,{cancelable:r});return o.slice().forEach((e=>{e.call(t,s)})),!s.defaultPrevented}return!0}}();return t.$$set=t=>{"title"in t&&n(1,s=t.title),"show"in t&&n(0,i=t.show),"$$scope"in t&&n(3,o=t.$$scope)},[i,s,function(){n(0,i=!1),l("close")},o,r]}class Yt extends bt{constructor(t){super(),gt(this,t,Qt,Zt,i,{title:1,show:0})}}function te(t){let e,n,r,o,s,i,l,a,c,u;return{c(){e=k("label"),e.textContent="Massstab",n=x(),r=k("select"),o=k("option"),o.textContent="1:25'000",s=k("option"),s.textContent="1:50'000",i=k("option"),i.textContent="1:100'000",l=x(),a=k("br"),M(e,"for","scale"),o.__value=25,o.value=o.__value,s.__value=50,s.value=s.__value,i.__value=100,i.value=i.__value,M(r,"id","scale"),r.required=!0,void 0===t[1]&&J((()=>t[2].call(r)))},m(f,d){g(f,e,d),g(f,n,d),g(f,r,d),p(r,o),p(r,s),p(r,i),L(r,t[1],!0),g(f,l,d),g(f,a,d),c||(u=S(r,"change",t[2]),c=!0)},p(t,e){2&e&&L(r,t[1])},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(l),t&&b(a),c=!1,u()}}}function ee(t){let e,n,r;function o(e){t[3](e)}let s={title:"Kartenmassstab wählen",$$slots:{default:[te]},$$scope:{ctx:t}};return void 0!==t[0]&&(s.show=t[0]),e=new Yt({props:s}),R.push((()=>dt(e,"show",o))),e.$on("close",t[4]),{c(){mt(e.$$.fragment)},m(t,n){pt(e,t,n),r=!0},p(t,[r]){const o={};34&r&&(o.$$scope={dirty:r,ctx:t}),!n&&1&r&&(n=!0,o.show=t[0],X((()=>n=!1))),e.$set(o)},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t)}}}function ne(t,e,n){let{show:r}=e,{scale:o}=e;return t.$$set=t=>{"show"in t&&n(0,r=t.show),"scale"in t&&n(1,o=t.scale)},[r,o,function(){o=function(t){const e=t.querySelector(":checked");return e&&e.__value}(this),n(1,o)},function(t){r=t,n(0,r)},function(e){G.call(this,t,e)}]}class re extends bt{constructor(t){super(),gt(this,t,ne,ee,i,{show:0,scale:1})}}function oe(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y;return l=new Ct({props:{name:"remove"}}),f=new Ct({props:{name:"add"}}),{c(){e=k("label"),e.textContent="Geschwindigkeit (Lkm/h)",n=x(),r=k("input"),s=x(),i=k("button"),mt(l.$$.fragment),a=v(" Langsamer"),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" Schneller"),m=x(),h=k("br"),M(e,"for","speed"),M(r,"id","speed"),M(r,"type","number"),M(r,"min","0.1"),M(r,"step","0.1"),r.required=!0,M(i,"type","button"),M(i,"class","pill"),M(u,"type","button"),M(u,"class","pill")},m(o,b){g(o,e,b),g(o,n,b),g(o,r,b),P(r,t[1]),g(o,s,b),g(o,i,b),pt(l,i,null),p(i,a),g(o,c,b),g(o,u,b),pt(f,u,null),p(u,d),g(o,m,b),g(o,h,b),$=!0,w||(y=[S(r,"input",t[3]),S(i,"click",t[4]),S(u,"click",t[5])],w=!0)},p(t,e){2&e&&_(r.value)!==t[1]&&P(r,t[1])},i(t){$||(it(l.$$.fragment,t),it(f.$$.fragment,t),$=!0)},o(t){lt(l.$$.fragment,t),lt(f.$$.fragment,t),$=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),ht(l),t&&b(c),t&&b(u),ht(f),t&&b(m),t&&b(h),w=!1,o(y)}}}function se(t){let e,n,r;function o(e){t[6](e)}let s={title:"Geschwindigkeit anpassen",$$slots:{default:[oe]},$$scope:{ctx:t}};return void 0!==t[0]&&(s.show=t[0]),e=new Yt({props:s}),R.push((()=>dt(e,"show",o))),{c(){mt(e.$$.fragment)},m(t,n){pt(e,t,n),r=!0},p(t,[r]){const o={};130&r&&(o.$$scope={dirty:r,ctx:t}),!n&&1&r&&(n=!0,o.show=t[0],X((()=>n=!1))),e.$set(o)},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t)}}}function ie(t,e,n){let{show:r}=e,{speed:o}=e,s=o;return t.$$set=t=>{"show"in t&&n(0,r=t.show),"speed"in t&&n(2,o=t.speed)},t.$$.update=()=>{2&t.$$.dirty&&!window.isNaN(s)&&s>0&&n(2,o=s)},[r,s,o,function(){s=_(this.value),n(1,s)},()=>n(1,s=Math.max(.5,s-.5)),()=>n(1,s+=.5),function(t){r=t,n(0,r)}]}class le extends bt{constructor(t){super(),gt(this,t,ie,se,i,{show:0,speed:2})}}function ae(e){let n;return{c(){n=k("div"),M(n,"class","svelte-19o0idp"),E(n,"small",e[0])},m(t,e){g(t,n,e)},p(t,[e]){1&e&&E(n,"small",t[0])},i:t,o:t,d(t){t&&b(n)}}}function ce(t,e,n){let{small:r=!1}=e;return t.$$set=t=>{"small"in t&&n(0,r=t.small)},[r]}class ue extends bt{constructor(t){super(),gt(this,t,ce,ae,i,{small:0})}}function fe(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,C,_,D,L;return l=new Ct({props:{name:"brightness_low"}}),f=new Ct({props:{name:"brightness_medium"}}),$=new Ct({props:{name:"brightness_high"}}),{c(){e=k("label"),e.textContent="Abreise",n=x(),r=k("input"),s=x(),i=k("button"),mt(l.$$.fragment),a=v(" 08:00"),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" 12:00"),m=x(),h=k("button"),mt($.$$.fragment),w=v(" 16:00"),y=x(),C=k("br"),M(e,"for","start"),M(r,"id","start"),M(r,"type","time"),r.required=!0,M(i,"type","button"),M(i,"class","pill"),M(u,"type","button"),M(u,"class","pill"),M(h,"type","button"),M(h,"class","pill")},m(o,b){g(o,e,b),g(o,n,b),g(o,r,b),P(r,t[1]),g(o,s,b),g(o,i,b),pt(l,i,null),p(i,a),g(o,c,b),g(o,u,b),pt(f,u,null),p(u,d),g(o,m,b),g(o,h,b),pt($,h,null),p(h,w),g(o,y,b),g(o,C,b),_=!0,D||(L=[S(r,"input",t[3]),S(i,"click",t[4]),S(u,"click",t[5]),S(h,"click",t[6])],D=!0)},p(t,e){2&e&&P(r,t[1])},i(t){_||(it(l.$$.fragment,t),it(f.$$.fragment,t),it($.$$.fragment,t),_=!0)},o(t){lt(l.$$.fragment,t),lt(f.$$.fragment,t),lt($.$$.fragment,t),_=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),ht(l),t&&b(c),t&&b(u),ht(f),t&&b(m),t&&b(h),ht($),t&&b(y),t&&b(C),D=!1,o(L)}}}function de(t){let e,n,r;function o(e){t[7](e)}let s={title:"Abreise anpassen",$$slots:{default:[fe]},$$scope:{ctx:t}};return void 0!==t[0]&&(s.show=t[0]),e=new Yt({props:s}),R.push((()=>dt(e,"show",o))),{c(){mt(e.$$.fragment)},m(t,n){pt(e,t,n),r=!0},p(t,[r]){const o={};258&r&&(o.$$scope={dirty:r,ctx:t}),!n&&1&r&&(n=!0,o.show=t[0],X((()=>n=!1))),e.$set(o)},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t)}}}function me(t,e,n){let{show:r}=e,{start:o}=e,s=Dt(o);return t.$$set=t=>{"show"in t&&n(0,r=t.show),"start"in t&&n(2,o=t.start)},t.$$.update=()=>{2&t.$$.dirty&&n(2,o=s.split(":").map(((t,e)=>Number(t)/60**e)).reduce(((t,e)=>t+e)))},[r,s,o,function(){s=this.value,n(1,s)},()=>n(1,s="08:00"),()=>n(1,s="12:00"),()=>n(1,s="16:00"),function(t){r=t,n(0,r)}]}class pe extends bt{constructor(t){super(),gt(this,t,me,de,i,{show:0,start:2})}}function he(t,e,n){const r=t.slice();return r[19]=e[n],r}function $e(e){let n,r=e[0].maps,o=[];for(let t=0;tdt(e,"show",Xe))),R.push((()=>dt(e,"speed",Ue)));let Ye={};function tn(e){t[14](e)}function en(e){t[15](e)}void 0!==t[2]&&(Ye.show=t[2]),void 0!==t[0].start&&(Ye.start=t[0].start),i=new pe({props:Ye}),R.push((()=>dt(i,"show",Ze))),R.push((()=>dt(i,"start",Qe)));let nn={};void 0!==t[3]&&(nn.show=t[3]),void 0!==t[0].mapScale&&(nn.scale=t[0].mapScale),u=new re({props:nn}),R.push((()=>dt(u,"show",tn))),R.push((()=>dt(u,"scale",en))),u.$on("close",t[7]),W=new Ct({props:{name:"edit"}});const rn=[ge,$e],on=[];function sn(t,e){return t[4]?0:1}return K=sn(t),J=on[K]=rn[K](t),Z=new Ct({props:{name:"swap_vert"}}),Ft=new Ut({props:{topic:"calculation"}}),Ot=new Ct({props:{name:"edit"}}),Qt=new Ct({props:{name:"edit"}}),_e=new Ct({props:{name:"print"}}),Ee=new Ct({props:{name:"table_chart"}}),{c(){mt(e.$$.fragment),s=x(),mt(i.$$.fragment),c=x(),mt(u.$$.fragment),m=x(),h=k("div"),$=k("div"),w=k("span"),w.textContent="Start: ",y=k("b"),C=v(Te),_=k("br"),P=x(),L=k("span"),L.textContent="Ziel: ",E=k("b"),z=v(je),A=k("br"),F=x(),H=k("span"),T=v("Landeskarten 1:"),j=v(Ne),N=v("'000:"),q=x(),G=k("button"),mt(W.$$.fragment),O=x(),B=k("br"),I=x(),J.c(),U=x(),V=k("button"),mt(Z.$$.fragment),Q=v(" Richtung wechseln"),Y=x(),tt=k("div"),et=k("span"),et.textContent="Horizontaldistanz: ",nt=k("b"),rt=v(qe),at=v(" km"),ct=k("br"),ut=x(),ft=k("span"),ft.textContent="Auf-/Abstieg: ",$t=v("↑ "),gt=k("b"),bt=v(Ge),wt=v(" m"),kt=v(" ↓ "),vt=k("b"),xt=v(We),yt=v(" m"),St=k("br"),Mt=x(),Pt=k("span"),Pt.textContent="Aufwand: ",Lt=k("b"),Et=v(Re),zt=v(" Lkm"),At=x(),mt(Ft.$$.fragment),Ht=k("br"),Tt=x(),jt=k("span"),jt.textContent="Geschwindigkeit: ",Nt=k("b"),qt=v(Oe),Gt=v(" Lkm/h"),Wt=x(),Rt=k("button"),mt(Ot.$$.fragment),Bt=x(),It=k("div"),Kt=k("span"),Kt.textContent="Abreise: ",Jt=k("b"),Xt=v(Be),Vt=x(),Zt=k("button"),mt(Qt.$$.fragment),Yt=x(),te=k("br"),ee=x(),ne=k("span"),ne.textContent="Ankunft: ",oe=k("b"),se=v(Ie),ie=k("br"),ae=x(),ce=k("span"),ce.textContent="Gehzeit: ",ue=k("b"),fe=v(Ke),de=v(" h"),me=k("br"),he=x(),be=k("span"),be.textContent="Pausen: ",we=k("b"),ke=v(Je),ve=v(" h"),xe=x(),ye=k("div"),Se=k("br"),Ce=x(),Me=k("button"),mt(_e.$$.fragment),De=v(" Drucken (PDF)"),Pe=v("\n  \n "),Le=k("button"),mt(Ee.$$.fragment),ze=v(" Tabelle exportieren (CSV)"),M(G,"class","pill noprint"),G.disabled=t[4],M(V,"class","pill noprint pad svelte-mpbsbs"),M($,"class","svelte-mpbsbs"),M(Rt,"class","pill noprint"),M(tt,"class","svelte-mpbsbs"),M(Zt,"class","pill noprint"),M(It,"class","svelte-mpbsbs"),M(h,"class","container svelte-mpbsbs"),M(Le,"class","secondary"),M(ye,"class","noprint")},m(n,r){pt(e,n,r),g(n,s,r),pt(i,n,r),g(n,c,r),pt(u,n,r),g(n,m,r),g(n,h,r),p(h,$),p($,w),p($,y),p(y,C),p($,_),p($,P),p($,L),p($,E),p(E,z),p($,A),p($,F),p($,H),p(H,T),p(H,j),p(H,N),p($,q),p($,G),pt(W,G,null),p($,O),p($,B),p($,I),on[K].m($,null),p($,U),p($,V),pt(Z,V,null),p(V,Q),p(h,Y),p(h,tt),p(tt,et),p(tt,nt),p(nt,rt),p(nt,at),p(tt,ct),p(tt,ut),p(tt,ft),p(tt,$t),p(tt,gt),p(gt,bt),p(gt,wt),p(tt,kt),p(tt,vt),p(vt,xt),p(vt,yt),p(tt,St),p(tt,Mt),p(tt,Pt),p(tt,Lt),p(Lt,Et),p(Lt,zt),p(tt,At),pt(Ft,tt,null),p(tt,Ht),p(tt,Tt),p(tt,jt),p(tt,Nt),p(Nt,qt),p(Nt,Gt),p(tt,Wt),p(tt,Rt),pt(Ot,Rt,null),p(h,Bt),p(h,It),p(It,Kt),p(It,Jt),p(Jt,Xt),p(It,Vt),p(It,Zt),pt(Qt,Zt,null),p(It,Yt),p(It,te),p(It,ee),p(It,ne),p(It,oe),p(oe,se),p(It,ie),p(It,ae),p(It,ce),p(It,ue),p(ue,fe),p(ue,de),p(It,me),p(It,he),p(It,be),p(It,we),p(we,ke),p(we,ve),g(n,xe,r),g(n,ye,r),p(ye,Se),p(ye,Ce),p(ye,Me),pt(_e,Me,null),p(Me,De),p(ye,Pe),p(ye,Le),pt(Ee,Le,null),p(Le,ze),Ae=!0,Fe||(He=[S(G,"click",t[16]),S(V,"click",t[6]),S(Rt,"click",t[17]),S(Zt,"click",t[18]),S(Me,"click",t[8]),S(Le,"click",t[9])],Fe=!0)},p(t,[o]){const s={};!n&&2&o&&(n=!0,s.show=t[1],X((()=>n=!1))),!r&&1&o&&(r=!0,s.speed=t[0].speed,X((()=>r=!1))),e.$set(s);const c={};!l&&4&o&&(l=!0,c.show=t[2],X((()=>l=!1))),!a&&1&o&&(a=!0,c.start=t[0].start,X((()=>a=!1))),i.$set(c);const m={};!f&&8&o&&(f=!0,m.show=t[3],X((()=>f=!1))),!d&&1&o&&(d=!0,m.scale=t[0].mapScale,X((()=>d=!1))),u.$set(m),(!Ae||1&o)&&Te!==(Te=t[0].markers[0].name+"")&&D(C,Te),(!Ae||1&o)&&je!==(je=t[0].markers[t[0].markers.length-1].name+"")&&D(z,je),(!Ae||1&o)&&Ne!==(Ne=t[0].mapScale+"")&&D(j,Ne),(!Ae||16&o)&&(G.disabled=t[4]);let p=K;K=sn(t),K===p?on[K].p(t,o):(ot(),lt(on[p],1,1,(()=>{on[p]=null})),st(),J=on[K],J?J.p(t,o):(J=on[K]=rn[K](t),J.c()),it(J,1),J.m($,U)),(!Ae||32&o)&&qe!==(qe=t[5].distance.toFixed(1)+"")&&D(rt,qe),(!Ae||32&o)&&Ge!==(Ge=Math.round(t[5].ascent)+"")&&D(bt,Ge),(!Ae||32&o)&&We!==(We=Math.round(t[5].descent)+"")&&D(xt,We),(!Ae||32&o)&&Re!==(Re=t[5].effort.toFixed(1)+"")&&D(Et,Re),(!Ae||1&o)&&Oe!==(Oe=t[0].speed+"")&&D(qt,Oe),(!Ae||1&o)&&Be!==(Be=Dt(t[0].start)+"")&&D(Xt,Be),(!Ae||33&o)&&Ie!==(Ie=Dt(t[0].start+t[5].duration)+"")&&D(se,Ie),(!Ae||32&o)&&Ke!==(Ke=_t(t[5].walkingDuration)+"")&&D(fe,Ke),(!Ae||32&o)&&Je!==(Je=_t(t[5].breakDuration)+"")&&D(ke,Je)},i(t){Ae||(it(e.$$.fragment,t),it(i.$$.fragment,t),it(u.$$.fragment,t),it(W.$$.fragment,t),it(J),it(Z.$$.fragment,t),it(Ft.$$.fragment,t),it(Ot.$$.fragment,t),it(Qt.$$.fragment,t),it(_e.$$.fragment,t),it(Ee.$$.fragment,t),Ae=!0)},o(t){lt(e.$$.fragment,t),lt(i.$$.fragment,t),lt(u.$$.fragment,t),lt(W.$$.fragment,t),lt(J),lt(Z.$$.fragment,t),lt(Ft.$$.fragment,t),lt(Ot.$$.fragment,t),lt(Qt.$$.fragment,t),lt(_e.$$.fragment,t),lt(Ee.$$.fragment,t),Ae=!1},d(t){ht(e,t),t&&b(s),ht(i,t),t&&b(c),ht(u,t),t&&b(m),t&&b(h),ht(W),on[K].d(),ht(Z),ht(Ft),ht(Ot),ht(Qt),t&&b(xe),t&&b(ye),ht(_e),ht(Ee),Fe=!1,o(He)}}}function ke(t,e,n){let r,o,{route:s}=e,i=!1,l=!1,a=!1;return t.$$set=t=>{"route"in t&&n(0,s=t.route)},t.$$.update=()=>{1&t.$$.dirty&&n(5,r=function(t){const e=t.distanceSum[t.line.length-1]/1e3,n=t.effortSum[t.markers.length-1],r=n/t.speed,o=t.breakSum[t.markers.length-1]/60,s=r+o,{ascent:i,descent:l}=function(t){let e=0,n=0;for(let r=1;r0?e+=o:n-=o}return{ascent:e,descent:n}}(t);return{distance:e,effort:n,walkingDuration:r,breakDuration:o,duration:s,ascent:i,descent:l}}(s))},[s,i,l,a,o,r,function(){!function(t){t.line.reverse(),t.markers.reverse(),t.lineProfile?.reverse(),t.markerProfile?.reverse(),t.markers.forEach((e=>e.index=t.line.length-e.index-1)),Ot(t)}(s),n(0,s)},function(){n(4,o=!0),Rt(s).then((()=>new Promise((t=>{setTimeout(t,300)})))).then((()=>{n(0,s),n(4,o=!1)})).catch((t=>{zt(t.id),alert(t.message)}))},function(){window.print?(Et("print"),window.print()):(zt("print"),alert("Dein Browser unterstützt das Drucken nicht."))},function(){Et("export-csv");const t=[["Nr.","Wegpunkt","Koordinaten","Kommentar","Höhe / m","Differenz Höhe / m","Total Distanz / km","Differenz Distanz / km","Total Aufwand / Lkm","Differenz Aufwand / Lkm","Total Gehzeit / h","Differenz Gehzeit / h","Uhrzeit / hh:mm","Pause / min"],...Kt(s).map((t=>[t.index+1,t.name,Mt(t.coordinates),t.comment??"",t.height,t.diff?.height??0,t.distance,t.diff?.distance??0,t.effort,t.diff?.effort??0,t.duration,t.diff?.duration??0,Dt(t.time),t.break]))].map((t=>t.map((t=>`"${t}"`)).join(","))).join("\n"),e=document.createElement("a");e.href=URL.createObjectURL(new Blob([t],{type:"text/csv"})),e.download=`${s.title||"marschzeittabelle"}.csv`,e.click()},function(t){i=t,n(1,i)},function(e){t.$$.not_equal(s.speed,e)&&(s.speed=e,n(0,s))},function(t){l=t,n(2,l)},function(e){t.$$.not_equal(s.start,e)&&(s.start=e,n(0,s))},function(t){a=t,n(3,a)},function(e){t.$$.not_equal(s.mapScale,e)&&(s.mapScale=e,n(0,s))},()=>n(3,a=!0),()=>n(1,i=!0),()=>n(2,l=!0)]}class ve extends bt{constructor(t){super(),gt(this,t,ke,we,i,{route:0})}}function xe(){for(let t of Object.keys(ye)){const e="--"+t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));ye[t]=window.getComputedStyle(document.body).getPropertyValue(e)}return ye}const ye={backgroundColor:null,textColor:null,darkerAccentColor:null,accentColor:null,lighterAccentColor:null,shadowColor:null};function Se(e){let n;return{c(){n=k("canvas"),M(n,"class","svelte-xd84ci")},m(t,r){g(t,n,r),e[2](n)},p:t,i:t,o:t,d(t){t&&b(n),e[2](null)}}}function Ce(t,e,n){let r,{route:o}=e;return t.$$set=t=>{"route"in t&&n(1,o=t.route)},t.$$.update=()=>{3&t.$$.dirty&&r&&(n(0,r.width=800,r),n(0,r.height=200,r),function(t,e){const n=xe(),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height);const o=12;let s=1/0,i=-1/0;for(let e of t.lineProfile)s=Math.min(s,e.height),i=Math.max(i,e.height);const l={x:t.distanceSum[t.distanceSum.length-1],y:i-s},a=Math.min((e.width-24)/l.x,(e.height-24-40)/l.y);e.width=Math.floor(l.x*a+24),e.height=Math.floor(l.y*a+24+40);const c=(t,n)=>{return r={x:(l={x:t,y:s-n}).x*(c=a),y:l.y*c},i={x:o,y:e.height-o-40},{x:r.x+i.x,y:r.y+i.y};var r,i,l,c},u=()=>{for(let e=0;e{r=t,n(0,r),n(1,o)}))}]}class Me extends bt{constructor(t){super(),gt(this,t,Ce,Se,i,{route:1})}}function _e(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,C,D,L,E;return l=new Ct({props:{name:"block"}}),f=new Ct({props:{name:"hourglass_bottom"}}),$=new Ct({props:{name:"hourglass_full"}}),{c(){e=k("label"),e.textContent="Pause (min)",n=x(),r=k("input"),s=x(),i=k("button"),mt(l.$$.fragment),a=v(" Keine"),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" 5 min"),m=x(),h=k("button"),mt($.$$.fragment),w=v(" 15 min"),y=x(),C=k("br"),M(e,"for","break"),M(r,"id","break"),M(r,"type","number"),M(r,"min","0"),r.required=!0,M(i,"type","button"),M(i,"class","pill"),M(u,"type","button"),M(u,"class","pill"),M(h,"type","button"),M(h,"class","pill")},m(o,b){g(o,e,b),g(o,n,b),g(o,r,b),P(r,t[0].break),g(o,s,b),g(o,i,b),pt(l,i,null),p(i,a),g(o,c,b),g(o,u,b),pt(f,u,null),p(u,d),g(o,m,b),g(o,h,b),pt($,h,null),p(h,w),g(o,y,b),g(o,C,b),D=!0,L||(E=[S(r,"input",t[4]),S(i,"click",t[5]),S(u,"click",t[6]),S(h,"click",t[7])],L=!0)},p(t,e){1&e&&_(r.value)!==t[0].break&&P(r,t[0].break)},i(t){D||(it(l.$$.fragment,t),it(f.$$.fragment,t),it($.$$.fragment,t),D=!0)},o(t){lt(l.$$.fragment,t),lt(f.$$.fragment,t),lt($.$$.fragment,t),D=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),ht(l),t&&b(c),t&&b(u),ht(f),t&&b(m),t&&b(h),ht($),t&&b(y),t&&b(C),L=!1,o(E)}}}function De(t){let e,n,r,s,i,l,a,c,u,f,d,m,p=t[1]&&_e(t);return{c(){e=k("label"),e.textContent="Name",n=x(),r=k("input"),s=x(),i=k("label"),i.textContent="Kommentar",l=x(),a=k("textarea"),c=x(),p&&p.c(),u=y(),M(e,"for","name"),M(r,"id","name"),M(r,"type","text"),r.required=!0,M(i,"for","comment"),M(a,"id","comment"),M(a,"class","svelte-1er4ovm")},m(o,h){g(o,e,h),g(o,n,h),g(o,r,h),P(r,t[0].name),g(o,s,h),g(o,i,h),g(o,l,h),g(o,a,h),P(a,t[0].comment),g(o,c,h),p&&p.m(o,h),g(o,u,h),f=!0,d||(m=[S(r,"input",t[2]),S(a,"input",t[3])],d=!0)},p(t,e){1&e&&r.value!==t[0].name&&P(r,t[0].name),1&e&&P(a,t[0].comment),t[1]?p?(p.p(t,e),2&e&&it(p,1)):(p=_e(t),p.c(),it(p,1),p.m(u.parentNode,u)):p&&(ot(),lt(p,1,1,(()=>{p=null})),st())},i(t){f||(it(p),f=!0)},o(t){lt(p),f=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),t&&b(l),t&&b(a),t&&b(c),p&&p.d(t),t&&b(u),d=!1,o(m)}}}function Pe(t){let e,n;return e=new Yt({props:{title:"Wegpunkt bearbeiten",show:null!=t[0],$$slots:{default:[De]},$$scope:{ctx:t}}}),e.$on("close",t[8]),{c(){mt(e.$$.fragment)},m(t,r){pt(e,t,r),n=!0},p(t,[n]){const r={};1&n&&(r.show=null!=t[0]),515&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(it(e.$$.fragment,t),n=!0)},o(t){lt(e.$$.fragment,t),n=!1},d(t){ht(e,t)}}}function Le(t,e,n){let{marker:r}=e,{showBreak:o}=e;return t.$$set=t=>{"marker"in t&&n(0,r=t.marker),"showBreak"in t&&n(1,o=t.showBreak)},[r,o,function(){r.name=this.value,n(0,r)},function(){r.comment=this.value,n(0,r)},function(){r.break=_(this.value),n(0,r)},()=>n(0,r.break=0,r),()=>n(0,r.break=5,r),()=>n(0,r.break=15,r),function(e){G.call(this,t,e)}]}class Ee extends bt{constructor(t){super(),gt(this,t,Le,Pe,i,{marker:0,showBreak:1})}}function ze(t,e,n){const r=t.slice();return r[6]=e[n],r}function Ae(t){let e,n,r,o,s,i,l,a,c,u,f,d,m,h,$,w=Math.round(t[6].diff.height)+"",y=t[6].diff.distance.toFixed(1)+"",S=t[6].diff.effort.toFixed(1)+"",C=_t(t[6].diff.duration)+"";return{c(){e=k("td"),n=v(w),r=v(" m"),o=x(),s=k("td"),i=v(y),l=v(" km"),a=x(),c=k("td"),u=v(S),f=v(" Lkm"),d=x(),m=k("td"),h=v(C),$=v(" h"),M(e,"class","number svelte-upyeat"),M(s,"class","number svelte-upyeat"),M(c,"class","number svelte-upyeat"),M(m,"class","number svelte-upyeat")},m(t,b){g(t,e,b),p(e,n),p(e,r),g(t,o,b),g(t,s,b),p(s,i),p(s,l),g(t,a,b),g(t,c,b),p(c,u),p(c,f),g(t,d,b),g(t,m,b),p(m,h),p(m,$)},p(t,e){4&e&&w!==(w=Math.round(t[6].diff.height)+"")&&D(n,w),4&e&&y!==(y=t[6].diff.distance.toFixed(1)+"")&&D(i,y),4&e&&S!==(S=t[6].diff.effort.toFixed(1)+"")&&D(u,S),4&e&&C!==(C=_t(t[6].diff.duration)+"")&&D(h,C)},d(t){t&&b(e),t&&b(o),t&&b(s),t&&b(a),t&&b(c),t&&b(d),t&&b(m)}}}function Fe(t){let e,n,r,o=_t(t[6].break/60)+"";return{c(){e=k("td"),n=v("+"),r=v(o),M(e,"class","number svelte-upyeat")},m(t,o){g(t,e,o),p(e,n),p(e,r)},p(t,e){4&e&&o!==(o=_t(t[6].break/60)+"")&&D(r,o)},d(t){t&&b(e)}}}function He(t){let e,n,r,o,s=t[6].comment+"";return{c(){e=k("tr"),n=k("td"),r=v(s),o=x(),M(n,"class","comment svelte-upyeat"),M(n,"colspan","100"),M(e,"class","alt comment svelte-upyeat")},m(t,s){g(t,e,s),p(e,n),p(n,r),p(e,o)},p(t,e){4&e&&s!==(s=t[6].comment+"")&&D(r,s)},d(t){t&&b(e)}}}function Te(t){let e,n,r,o,s,i,l,a,c,u,f,d,m,h,$,w,C,_,P,L,E,z,A,F,H,T,j,N,q,G,W,R,O,B,I,K,J,X,U,V,Z,Q,Y=t[6].index+1+"",tt=t[6].name+"",et=Math.round(t[6].height)+"",nt=t[6].distance.toFixed(1)+"",rt=t[6].effort.toFixed(1)+"",ot=_t(t[6].duration)+"",st=Dt(t[6].time)+"",at=Mt(t[6].coordinates)+"";function ct(){return t[5](t[6])}q=new Ct({props:{name:"edit"}});let ut=t[6].diff&&Ae(t),ft=t[6].break>0&&Fe(t),dt=t[6].comment&&He(t);return{c(){e=k("tr"),n=k("td"),r=k("span"),o=v(Y),s=x(),i=v(tt),l=x(),a=k("td"),c=v(et),u=v(" m"),f=x(),d=k("td"),m=v(nt),h=v(" km"),$=x(),w=k("td"),C=v(rt),_=v(" Lkm"),P=x(),L=k("td"),E=v(ot),z=v(" h"),A=x(),F=k("td"),H=v(st),T=x(),j=k("td"),N=k("button"),mt(q.$$.fragment),G=x(),W=k("tr"),R=k("td"),O=v(at),B=x(),ut&&ut.c(),I=x(),ft&&ft.c(),K=x(),J=k("td"),X=x(),dt&&dt.c(),U=y(),M(r,"class","pill svelte-upyeat"),M(n,"class","name svelte-upyeat"),M(a,"class","number svelte-upyeat"),M(d,"class","number svelte-upyeat"),M(w,"class","number svelte-upyeat"),M(L,"class","number svelte-upyeat"),M(F,"class","number svelte-upyeat"),M(N,"class","pill"),M(j,"class","noprint svelte-upyeat"),M(R,"class","coordinates svelte-upyeat"),M(J,"class","svelte-upyeat"),M(W,"class","alt svelte-upyeat")},m(t,b){g(t,e,b),p(e,n),p(n,r),p(r,o),p(n,s),p(n,i),p(e,l),p(e,a),p(a,c),p(a,u),p(e,f),p(e,d),p(d,m),p(d,h),p(e,$),p(e,w),p(w,C),p(w,_),p(e,P),p(e,L),p(L,E),p(L,z),p(e,A),p(e,F),p(F,H),p(e,T),p(e,j),p(j,N),pt(q,N,null),g(t,G,b),g(t,W,b),p(W,R),p(R,O),p(W,B),ut&&ut.m(W,null),p(W,I),ft&&ft.m(W,null),p(W,K),p(W,J),g(t,X,b),dt&&dt.m(t,b),g(t,U,b),V=!0,Z||(Q=S(N,"click",ct),Z=!0)},p(e,n){t=e,(!V||4&n)&&Y!==(Y=t[6].index+1+"")&&D(o,Y),(!V||4&n)&&tt!==(tt=t[6].name+"")&&D(i,tt),(!V||4&n)&&et!==(et=Math.round(t[6].height)+"")&&D(c,et),(!V||4&n)&&nt!==(nt=t[6].distance.toFixed(1)+"")&&D(m,nt),(!V||4&n)&&rt!==(rt=t[6].effort.toFixed(1)+"")&&D(C,rt),(!V||4&n)&&ot!==(ot=_t(t[6].duration)+"")&&D(E,ot),(!V||4&n)&&st!==(st=Dt(t[6].time)+"")&&D(H,st),(!V||4&n)&&at!==(at=Mt(t[6].coordinates)+"")&&D(O,at),t[6].diff?ut?ut.p(t,n):(ut=Ae(t),ut.c(),ut.m(W,I)):ut&&(ut.d(1),ut=null),t[6].break>0?ft?ft.p(t,n):(ft=Fe(t),ft.c(),ft.m(W,K)):ft&&(ft.d(1),ft=null),t[6].comment?dt?dt.p(t,n):(dt=He(t),dt.c(),dt.m(U.parentNode,U)):dt&&(dt.d(1),dt=null)},i(t){V||(it(q.$$.fragment,t),V=!0)},o(t){lt(q.$$.fragment,t),V=!1},d(t){t&&b(e),ht(q),t&&b(G),t&&b(W),ut&&ut.d(),ft&&ft.d(),t&&b(X),dt&&dt.d(t),t&&b(U),Z=!1,Q()}}}function je(t){let e,n,r,o,s,i;e=new Ee({props:{marker:t[1],showBreak:t[3]}}),e.$on("close",t[4]);let l=t[2],a=[];for(let e=0;elt(a[t],1,1,(()=>{a[t]=null}));return{c(){mt(e.$$.fragment),n=x(),r=k("table"),o=k("tr"),o.innerHTML='Wegpunkt
Kommentar \n Höhe \n Distanz \n Aufwand \n Gehzeit \n Uhrzeit
Pause',s=x();for(let t=0;t{"route"in t&&n(0,s=t.route)},t.$$.update=()=>{1&t.$$.dirty&&n(2,i=Kt(s)),3&t.$$.dirty&&n(3,r=o!==s.markers[s.markers.length-1])},[s,o,i,r,function(){Ot(s),n(0,s),n(1,o=null)},t=>n(1,o=s.markers[t.index])]}class qe extends bt{constructor(t){super(),gt(this,t,Ne,je,i,{route:0})}}function Ge(t){let e,n,r;return e=new Ct({props:{name:"visibility"}}),{c(){mt(e.$$.fragment),n=v(" Anzeigen")},m(t,o){pt(e,t,o),g(t,n,o),r=!0},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t),t&&b(n)}}}function We(t){let e,n,r;return e=new Ct({props:{name:"visibility_off"}}),{c(){mt(e.$$.fragment),n=v(" Ausblenden")},m(t,o){pt(e,t,o),g(t,n,o),r=!0},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t),t&&b(n)}}}function Re(t){let e,n,r,o;return n=new Me({props:{route:t[0]}}),{c(){e=k("div"),mt(n.$$.fragment)},m(t,r){g(t,e,r),pt(n,e,null),o=!0},p(t,e){const r={};1&e&&(r.route=t[0]),n.$set(r)},i(t){o||(it(n.$$.fragment,t),J((()=>{o&&(r||(r=ut(e,vt,{duration:100},!0)),r.run(1))})),o=!0)},o(t){lt(n.$$.fragment,t),r||(r=ut(e,vt,{duration:100},!1)),r.run(0),o=!1},d(t){t&&b(e),ht(n),t&&r&&r.end()}}}function Oe(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,C,_,D,L,z,A,F,H,T,j,N,q,G,W,O,B;function I(e){t[4](e)}a=new Ct({props:{name:"edit"}});let K={};function J(e){t[5](e)}void 0!==t[0]&&(K.route=t[0]),$=new ve({props:K}),R.push((()=>dt($,"route",I)));let U={};void 0!==t[0]&&(U.route=t[0]),L=new qe({props:U}),R.push((()=>dt(L,"route",J)));const V=[We,Ge],Z=[];function Q(t,e){return t[1]?0:1}N=Q(t),q=Z[N]=V[N](t);let Y=t[1]&&Re(t);return{c(){e=k("div"),n=k("h1"),r=k("input"),s=x(),i=k("div"),l=k("button"),mt(a.$$.fragment),c=v(" Titel bearbeiten"),u=x(),f=k("br"),d=x(),m=k("br"),h=x(),mt($.$$.fragment),y=x(),C=k("div"),_=k("h2"),_.textContent="Marschzeittabelle",D=x(),mt(L.$$.fragment),A=x(),F=k("div"),H=k("h2"),H.textContent="Höhenprofil",T=x(),j=k("button"),q.c(),G=x(),Y&&Y.c(),M(r,"id","title"),M(r,"type","text"),M(r,"class","svelte-1284s1r"),M(n,"class","svelte-1284s1r"),M(l,"class","pill"),M(i,"class","noprint"),M(e,"class","options"),M(_,"class","svelte-1284s1r"),M(C,"class","table"),M(H,"class","svelte-1284s1r"),M(j,"class","pill noprint svelte-1284s1r"),M(F,"class","profile"),E(F,"noprint",!t[1])},m(o,b){g(o,e,b),p(e,n),p(n,r),P(r,t[0].title),p(e,s),p(e,i),p(i,l),pt(a,l,null),p(l,c),p(i,u),p(i,f),p(i,d),p(i,m),p(e,h),pt($,e,null),g(o,y,b),g(o,C,b),p(C,_),p(C,D),pt(L,C,null),g(o,A,b),g(o,F,b),p(F,H),p(F,T),p(F,j),Z[N].m(j,null),p(F,G),Y&&Y.m(F,null),W=!0,O||(B=[S(r,"input",t[2]),S(l,"click",t[3]),S(j,"click",t[6])],O=!0)},p(t,[e]){1&e&&r.value!==t[0].title&&P(r,t[0].title);const n={};!w&&1&e&&(w=!0,n.route=t[0],X((()=>w=!1))),$.$set(n);const o={};!z&&1&e&&(z=!0,o.route=t[0],X((()=>z=!1))),L.$set(o);let s=N;N=Q(t),N!==s&&(ot(),lt(Z[s],1,1,(()=>{Z[s]=null})),st(),q=Z[N],q||(q=Z[N]=V[N](t),q.c()),it(q,1),q.m(j,null)),t[1]?Y?(Y.p(t,e),2&e&&it(Y,1)):(Y=Re(t),Y.c(),it(Y,1),Y.m(F,null)):Y&&(ot(),lt(Y,1,1,(()=>{Y=null})),st()),(!W||2&e)&&E(F,"noprint",!t[1])},i(t){W||(it(a.$$.fragment,t),it($.$$.fragment,t),it(L.$$.fragment,t),it(q),it(Y),W=!0)},o(t){lt(a.$$.fragment,t),lt($.$$.fragment,t),lt(L.$$.fragment,t),lt(q),lt(Y),W=!1},d(t){t&&b(e),ht(a),ht($),t&&b(y),t&&b(C),ht(L),t&&b(A),t&&b(F),Z[N].d(),Y&&Y.d(),O=!1,o(B)}}}function Be(t,e,n){let{route:r}=e,o=!0;return t.$$set=t=>{"route"in t&&n(0,r=t.route)},t.$$.update=()=>{1&t.$$.dirty&&function(t){const e={line:t.line,mapScale:t.mapScale,markers:t.markers,speed:t.speed,start:t.start,title:t.title,timestamp:Date.now()};localStorage.setItem(xt,JSON.stringify(e))}(r)},[r,o,function(){r.title=this.value,n(0,r)},()=>document.getElementById("title").select(),function(t){r=t,n(0,r)},function(t){r=t,n(0,r)},()=>n(1,o=!o)]}class Ie extends bt{constructor(t){super(),gt(this,t,Be,Oe,i,{route:0})}}function Ke(e){let n,r,o,s,i,l,a,c,u,f,d,m,h,$,w,y,S,C,_,D,P,L,E,z,A,F;return a=new Ct({props:{name:"draw",big:!0}}),h=new Ct({props:{name:"output",big:!0}}),S=new Ut({props:{topic:"export",label:"Wie geht das?"}}),P=new Ct({props:{name:"upload_file",big:!0}}),{c(){n=k("div"),n.innerHTML='

Marschzeit­tabelle
leicht gemacht.

\n

Übertrage deine Route automatisch in eine Marschzeittabelle.

',r=x(),o=k("div"),s=k("div"),i=k("h2"),l=v("1. Planen "),mt(a.$$.fragment),c=x(),u=k("p"),u.textContent="Route einzeichnen und Wegpunkte benennen - das kennst du bereits.",f=x(),d=k("h2"),m=v("2. Exportieren "),mt(h.$$.fragment),$=x(),w=k("p"),y=v("In wenigen Klicks erledigt. "),mt(S.$$.fragment),C=x(),_=k("h2"),D=v("3. Hochladen "),mt(P.$$.fragment),L=x(),E=k("p"),E.textContent="Jetzt noch Geschwindigkeit, Abreisezeit, Kommentare und Pausen anpassen.",z=x(),A=k("video"),A.innerHTML='',M(n,"class","title svelte-12swpck"),M(i,"class","svelte-12swpck"),M(u,"class","svelte-12swpck"),M(d,"class","svelte-12swpck"),M(w,"class","svelte-12swpck"),M(_,"class","svelte-12swpck"),M(E,"class","svelte-12swpck"),M(s,"class","steps svelte-12swpck"),A.autoplay=!0,A.controls=!0,A.loop=!0,A.muted=!0,M(A,"class","svelte-12swpck"),M(o,"class","tutorial svelte-12swpck")},m(t,e){g(t,n,e),g(t,r,e),g(t,o,e),p(o,s),p(s,i),p(i,l),pt(a,i,null),p(s,c),p(s,u),p(s,f),p(s,d),p(d,m),pt(h,d,null),p(s,$),p(s,w),p(w,y),pt(S,w,null),p(s,C),p(s,_),p(_,D),pt(P,_,null),p(s,L),p(s,E),p(o,z),p(o,A),F=!0},p:t,i(t){F||(it(a.$$.fragment,t),it(h.$$.fragment,t),it(S.$$.fragment,t),it(P.$$.fragment,t),F=!0)},o(t){lt(a.$$.fragment,t),lt(h.$$.fragment,t),lt(S.$$.fragment,t),lt(P.$$.fragment,t),F=!1},d(t){t&&b(n),t&&b(r),t&&b(o),ht(a),ht(h),ht(S),ht(P)}}}class Je extends bt{constructor(t){super(),gt(this,t,null,Ke,i,{})}}class Xe{static WGStoCH(t,e){return[this.WGStoCHy(t,e),this.WGStoCHx(t,e)]}static WGStoCHx(t,e){const n=((t=this.DECtoSEX(t))-169028.66)/1e4,r=((e=this.DECtoSEX(e))-26782.5)/1e4;return 200147.07+308807.95*n+3745.25*Math.pow(r,2)+76.63*Math.pow(n,2)-194.56*Math.pow(r,2)*n+119.79*Math.pow(n,3)}static WGStoCHy(t,e){const n=((t=this.DECtoSEX(t))-169028.66)/1e4,r=((e=this.DECtoSEX(e))-26782.5)/1e4;return 600072.37+211455.93*r-10938.51*r*n-.36*r*Math.pow(n,2)-44.54*Math.pow(r,3)}static CHtoWGS(t,e){return[this.CHtoWGSlng(t,e),this.CHtoWGSlat(t,e)]}static CHtoWGSlat(t,e){const n=(t-6e5)/1e6,r=(e-2e5)/1e6;return 100*(16.9023892+3.238272*r-.270978*Math.pow(n,2)-.002528*Math.pow(r,2)-.0447*Math.pow(n,2)*r-.014*Math.pow(r,3))/36}static CHtoWGSlng(t,e){const n=(t-6e5)/1e6,r=(e-2e5)/1e6;return 100*(2.6779094+4.728982*n+.791484*n*r+.1306*n*Math.pow(r,2)-.0436*Math.pow(n,3))/36}static DECtoSEX(t){const e=parseInt(t),n=parseInt(60*(t-e));return 60*(60*(t-e)-n)+60*n+3600*e}}const Ue=10;function Ve(t){return function(t){return new Promise(((e,n)=>{const r=new FileReader;r.addEventListener("load",(()=>e(r.result))),r.addEventListener("error",n),r.readAsText(t)}))}(t).then((t=>async function(t){const e=(new DOMParser).parseFromString(t,"application/xml");if(e.querySelector("parsererror"))throw{id:"invalid-xml",message:"Die Datei ist nicht in gültigem XML-Format."};return e}(t)),(()=>{throw{id:"file-error",message:"Die Datei konnte nicht gelesen werden."}})).then((e=>t.name.endsWith(".kml")?async function(t){const e=[],n=[],r=t=>{const[e,n]=t.split(",");return Ze(n,e)},o=t.querySelectorAll("Placemark");for(let t of o){const o=t.querySelector(":is(LineString, LinearRing) coordinates");if(o){const t=o.innerHTML.trim().split(" ").map((t=>r(t)));e.push(t)}const s=t.querySelector("Point coordinates");if(s){const e=t.querySelector("name")?.innerHTML?.trim(),o=t.querySelector("description")?.innerHTML?.trim(),i=r(s.innerHTML);null!=e&&n.push({name:e,comment:o,point:i})}}return{lines:e,markers:n}}(e):t.name.endsWith(".gpx")?async function(t){const e=[],n=[],r=t=>Ze(t.getAttribute("lat"),t.getAttribute("lon")),o=t.querySelectorAll("trkseg");for(let t of o){const n=Array.from(t.querySelectorAll("trkpt")).map((t=>r(t)));e.push(n)}const s=t.querySelectorAll("trkpt");for(let t of s){const e=t.querySelector("name")?.innerHTML?.trim(),o=t.querySelector("desc")?.innerHTML?.trim(),s=r(t);null!=e&&n.push({name:e,comment:o,point:s})}if(0===n.length){const e=t.querySelectorAll("wpt");for(let t of e){const e=t.querySelector("name")?.innerHTML?.trim(),o=r(t);null!=e&&n.push({name:e,point:o})}}return{lines:e,markers:n}}(e):void 0)).then((({lines:e,markers:n})=>async function(t,e,n){if(0===t.length)throw{id:"no-line",message:"Die Route enthält keine Linie."};if(e.length<2)throw{id:"no-markers",message:"Die Route enthält weniger als zwei Wegpunkte."};for(;t.length>1;){const e=Qe(t);if(null==e)throw{id:"disjoint-lines",message:"Die Route enthält Linien, die nicht miteinander verbunden sind."};e.reverseFirst&&t[e.i].reverse(),e.reverseSecond&&t[e.j].reverse(),t[e.i].push(...t[e.j]),t.splice(e.j,1)}const r=t[0];let o=null;for(let t=0;tnull==o||!At(t.point,o))).filter((e=>Ft(e.point,r[t])null==t.index&&t!==s));if(e=e.filter((t=>!i.includes(t))),null==s.index)s.index=t;else{const n=Object.assign({},s);n.index=t,e.push(n)}o=s.point}const s=e.filter((t=>null==t.index));if(s.length>0){throw{id:"marker-not-on-line",message:`Wegpunkte nicht in der Nähe von Eckpunkten der Linie: ${s.map((t=>t.name?`"${t.name}"`:Mt(t.point))).join(", ")}.`}}e.sort(((t,e)=>t.index-e.index));for(let t of e)t.break=0;const i=n.substring(0,n.lastIndexOf("."))||n;return{line:r,mapScale:25,markers:e,speed:4,start:0,title:i}}(e,n,t.name))).then((t=>Gt(t)))}function Ze(t,e){const[n,r]=Xe.WGStoCH(Number(t),Number(e));return{x:n,y:r}}function Qe(t){const e=(t,e)=>Ft(t,e)e,s.anchor=null,o=!0},p(e,r){t=e,s.ctx=t,2&r&&n!==(n=t[1])&&ft(n,s)||function(t,e,n){const r=e.slice(),{resolved:o}=t;t.current===t.then&&(r[t.value]=o),t.current===t.catch&&(r[t.error]=o),t.block.p(r,n)}(s,t,r)},i(t){o||(it(s.block),r||J((()=>{r=ct(e,kt,{duration:100}),r.start()})),o=!0)},o(t){for(let t=0;t<3;t+=1){lt(s.blocks[t])}o=!1},d(t){t&&b(e),s.block.d(),s.token=null,s=null}}}function tn(e){let n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,_,D,P;h=new Ct({props:{name:"upload_file"}});let L=e[2]&&function(e){let n,r,o,s,i,l,a,c,u,f,d,m,h,$,w,y,C,_=function(t){const e=(Date.now()-t)/1e3/60,n=e/60,r=n/24,o=r/30,s=o/12;return e<1?"gerade eben":n<1?`vor ${Math.round(e)} Minuten`:r<1?`vor ${Math.round(n)} Stunden`:o<1?`vor ${Math.round(r)} Tagen`:s<1?`vor ${Math.round(o)} Monaten`:`vor ${Math.round(s)} Jahren`}(e[2].timestamp)+"";return c=new Ct({props:{name:"schedule"}}),h=new Ct({props:{name:"file_open"}}),{c(){n=k("div"),r=k("h2"),r.textContent="Zuletzt bearbeitet",o=x(),s=k("p"),i=k("b"),i.textContent=`"${e[2].title}"`,l=k("br"),a=x(),mt(c.$$.fragment),u=x(),f=v(_),d=x(),m=k("button"),mt(h.$$.fragment),$=v(" Öffnen"),M(r,"class","svelte-jxf9x4"),M(m,"class","secondary"),M(n,"class","recent svelte-jxf9x4")},m(t,b){g(t,n,b),p(n,r),p(n,o),p(n,s),p(s,i),p(s,l),p(s,a),pt(c,s,null),p(s,u),p(s,f),p(n,d),p(n,m),pt(h,m,null),p(m,$),w=!0,y||(C=S(m,"click",e[3]),y=!0)},p:t,i(t){w||(it(c.$$.fragment,t),it(h.$$.fragment,t),w=!0)},o(t){lt(c.$$.fragment,t),lt(h.$$.fragment,t),w=!1},d(t){t&&b(n),ht(c),ht(h),y=!1,C()}}}(e);return{c(){n=k("div"),r=k("div"),s=k("h2"),s.textContent="Route hochladen",i=x(),l=k("p"),l.innerHTML='Unterstützt sind KML-Dateien von map.geo.admin.ch oder der swisstopo-App, sowie GPX-Dateien von outdooractive.com.',a=x(),c=k("p"),c.textContent="Datei hierher ziehen oder...",u=x(),f=k("input"),d=x(),m=k("button"),mt(h.$$.fragment),$=v(" Datei auswählen"),w=x(),L&&L.c(),M(s,"class","svelte-jxf9x4"),M(f,"type","file"),M(f,"id","upload"),M(f,"accept",".kml, .gpx"),M(f,"class","svelte-jxf9x4"),M(r,"class","upload svelte-jxf9x4"),M(n,"class","import svelte-jxf9x4")},m(t,o){g(t,n,o),p(n,r),p(r,s),p(r,i),p(r,l),p(r,a),p(r,c),p(r,u),p(r,f),p(r,d),p(r,m),pt(h,m,null),p(m,$),p(n,w),L&&L.m(n,null),_=!0,D||(P=[S(f,"change",e[7]),S(m,"click",e[8]),S(r,"drop",C(e[9])),S(r,"dragover",C(e[6]))],D=!0)},p(t,e){t[2]&&L.p(t,e)},i(t){_||(it(h.$$.fragment,t),it(L),y||J((()=>{y=ct(n,kt,{duration:100}),y.start()})),_=!0)},o(t){lt(h.$$.fragment,t),lt(L),_=!1},d(t){t&&b(n),ht(h),L&&L.d(),D=!1,o(P)}}}function en(t){let e,n,r,o,s,i,l,a,c,u,f,d,m,h,$,w=t[11].message+"";return f=new Ct({props:{name:"refresh"}}),{c(){e=k("h2"),e.textContent="Hoppla!",n=x(),r=k("p"),o=v("Es gab einen Fehler beim Import:"),s=k("br"),i=x(),l=k("b"),a=v(w),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" Nochmal versuchen"),M(e,"class","svelte-jxf9x4"),M(u,"class","secondary")},m(b,w){g(b,e,w),g(b,n,w),g(b,r,w),p(r,o),p(r,s),p(r,i),p(r,l),p(l,a),g(b,c,w),g(b,u,w),pt(f,u,null),p(u,d),m=!0,h||($=S(u,"click",t[4]),h=!0)},p(t,e){(!m||2&e)&&w!==(w=t[11].message+"")&&D(a,w)},i(t){m||(it(f.$$.fragment,t),m=!0)},o(t){lt(f.$$.fragment,t),m=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(c),t&&b(u),ht(f),h=!1,$()}}}function nn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function rn(e){let n,r,o,s,i,l;return i=new ue({}),{c(){n=k("h2"),n.textContent="Route wird gewandert...",r=x(),o=k("br"),s=x(),mt(i.$$.fragment),M(n,"class","svelte-jxf9x4")},m(t,e){g(t,n,e),g(t,r,e),g(t,o,e),g(t,s,e),pt(i,t,e),l=!0},p:t,i(t){l||(it(i.$$.fragment,t),l=!0)},o(t){lt(i.$$.fragment,t),l=!1},d(t){t&&b(n),t&&b(r),t&&b(o),t&&b(s),ht(i,t)}}}function on(t){let e,n,r,o;const s=[tn,Ye],i=[];function l(t,e){return null==t[1]?0:1}return e=l(t),n=i[e]=s[e](t),{c(){n.c(),r=y()},m(t,n){i[e].m(t,n),g(t,r,n),o=!0},p(t,[o]){let a=e;e=l(t),e===a?i[e].p(t,o):(ot(),lt(i[a],1,1,(()=>{i[a]=null})),st(),n=i[e],n?n.p(t,o):(n=i[e]=s[e](t),n.c()),it(n,1),n.m(r.parentNode,r))},i(t){o||(it(n),o=!0)},o(t){lt(n),o=!1},d(t){i[e].d(t),t&&b(r)}}}function sn(t,e,n){let r,o,{route:s=null}=e,i=function(){try{return JSON.parse(localStorage.getItem(xt))}catch{return null}}();function l(t){return t.then((t=>new Promise((e=>{Et("import-success"),setTimeout((()=>e(t)),500)})))).then((t=>n(5,s=t))).catch((t=>{throw zt(t.id),t}))}return t.$$set=t=>{"route"in t&&n(5,s=t.route)},t.$$.update=()=>{1&t.$$.dirty&&r&&r[0]&&(Et("upload-file"),n(1,o=l(Ve(r[0]))))},[r,o,i,function(){Et("open-recent"),n(1,o=l(Gt(i)))},function(){n(0,r=null),n(1,o=null)},s,function(e){G.call(this,t,e)},function(){r=this.files,n(0,r)},()=>document.getElementById("upload").click(),t=>n(0,r=t.dataTransfer.files)]}class ln extends bt{constructor(t){super(),gt(this,t,sn,on,i,{route:5})}}function an(t){let e,n,r,o,s,i,l;function a(e){t[2](e)}let c={};return void 0!==t[0]&&(c.route=t[0]),o=new Ie({props:c}),R.push((()=>dt(o,"route",a))),{c(){e=k("header"),e.innerHTML='❮ startseite',n=x(),r=k("main"),mt(o.$$.fragment),M(e,"class","noprint")},m(t,s){g(t,e,s),g(t,n,s),g(t,r,s),pt(o,r,null),l=!0},p(t,e){const n={};!s&&1&e&&(s=!0,n.route=t[0],X((()=>s=!1))),o.$set(n)},i(t){l||(it(o.$$.fragment,t),J((()=>{l&&(i||(i=ut(r,kt,{},!0)),i.run(1))})),l=!0)},o(t){lt(o.$$.fragment,t),i||(i=ut(r,kt,{},!1)),i.run(0),l=!1},d(t){t&&b(e),t&&b(n),t&&b(r),ht(o),t&&i&&i.end()}}}function cn(t){let e,n,r,o,s,i;function l(e){t[1](e)}n=new Je({});let a={};return void 0!==t[0]&&(a.route=t[0]),o=new ln({props:a}),R.push((()=>dt(o,"route",l))),{c(){e=k("main"),mt(n.$$.fragment),r=x(),mt(o.$$.fragment)},m(t,s){g(t,e,s),pt(n,e,null),p(e,r),pt(o,e,null),i=!0},p(t,e){const n={};!s&&1&e&&(s=!0,n.route=t[0],X((()=>s=!1))),o.$set(n)},i(t){i||(it(n.$$.fragment,t),it(o.$$.fragment,t),i=!0)},o(t){lt(n.$$.fragment,t),lt(o.$$.fragment,t),i=!1},d(t){t&&b(e),ht(n),ht(o)}}}function un(t){let e,n,r,o,s,i,l;document.title=e=(null==t[0]?"":`${t[0].title} - `)+"Marschzeittabelle";const a=[cn,an],c=[];function u(t,e){return null==t[0]?0:1}return r=u(t),o=c[r]=a[r](t),{c(){n=x(),o.c(),s=x(),i=k("footer"),i.innerHTML='marschzeittabelle.ch \n | hilfe\n | quellcode',M(i,"class","svelte-1pxn2rk")},m(t,e){g(t,n,e),c[r].m(t,e),g(t,s,e),g(t,i,e),l=!0},p(t,[n]){(!l||1&n)&&e!==(e=(null==t[0]?"":`${t[0].title} - `)+"Marschzeittabelle")&&(document.title=e);let i=r;r=u(t),r===i?c[r].p(t,n):(ot(),lt(c[i],1,1,(()=>{c[i]=null})),st(),o=c[r],o?o.p(t,n):(o=c[r]=a[r](t),o.c()),it(o,1),o.m(s.parentNode,s))},i(t){l||(it(o),l=!0)},o(t){lt(o),l=!1},d(t){t&&b(n),c[r].d(t),t&&b(s),t&&b(i)}}}function fn(t,e,n){let r;return[r,function(t){r=t,n(0,r)},function(t){r=t,n(0,r)}]}return new class extends bt{constructor(t){super(),gt(this,t,fn,un,i,{})}}({target:document.body})}(); +var app=function(){"use strict";function t(){}const e=t=>t;function n(t){return t()}function r(){return Object.create(null)}function o(t){t.forEach(n)}function s(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function l(t,e,n,r){return t[1]&&r?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](r(e))):n.ctx}const a="undefined"!=typeof window;let c=a?()=>window.performance.now():()=>Date.now(),u=a?t=>requestAnimationFrame(t):t;const f=new Set;function d(t){f.forEach((e=>{e.c(t)||(f.delete(e),e.f())})),0!==f.size&&u(d)}function m(t){let e;return 0===f.size&&u(d),{promise:new Promise((n=>{f.add(e={c:t,f:n})})),abort(){f.delete(e)}}}function p(t,e){t.appendChild(e)}function h(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function $(t){const e=k("style");return function(t,e){p(t.head||t,e),e.sheet}(h(t),e),e.sheet}function g(t,e,n){t.insertBefore(e,n||null)}function b(t){t.parentNode&&t.parentNode.removeChild(t)}function w(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function C(t){return function(e){return e.preventDefault(),t.call(this,e)}}function M(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function _(t){return""===t?null:+t}function D(t,e){e=""+e,t.data!==e&&(t.data=e)}function P(t,e){t.value=null==e?"":e}function L(t,e,n){for(let n=0;n>>0}(u)}_${l}`,d=h(t),{stylesheet:m,rules:p}=A.get(d)||function(t,e){const n={stylesheet:$(e),rules:{}};return A.set(t,n),n}(d,t);p[f]||(p[f]=!0,m.insertRule(`@keyframes ${f} ${u}`,m.cssRules.length));const g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${r}ms linear ${o}ms 1 both`,H+=1,f}function j(t,e){const n=(t.style.animation||"").split(", "),r=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),o=n.length-r.length;o&&(t.style.animation=r.join(", "),H-=o,H||u((()=>{H||(A.forEach((t=>{const{ownerNode:e}=t.stylesheet;e&&b(e)})),A.clear())})))}function N(t){F=t}function q(){if(!F)throw new Error("Function called outside component initialization");return F}function G(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t.call(this,e)))}const W=[],R=[];let O=[];const B=[],I=Promise.resolve();let K=!1;function J(t){O.push(t)}function X(t){B.push(t)}const U=new Set;let V,Z=0;function Q(){if(0!==Z)return;const t=F;do{try{for(;Z{V=null}))),V}function et(t,e,n){t.dispatchEvent(z(`${e?"intro":"outro"}${n}`))}const nt=new Set;let rt;function ot(){rt={r:0,c:[],p:rt}}function st(){rt.r||o(rt.c),rt=rt.p}function it(t,e){t&&t.i&&(nt.delete(t),t.i(e))}function lt(t,e,n,r){if(t&&t.o){if(nt.has(t))return;nt.add(t),rt.c.push((()=>{nt.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}else r&&r()}const at={duration:0};function ct(n,r,o){const i={direction:"in"};let l,a,u=r(n,o,i),f=!1,d=0;function p(){l&&j(n,l)}function h(){const{delay:r=0,duration:o=300,easing:s=e,tick:i=t,css:h}=u||at;h&&(l=T(n,0,1,o,r,s,h,d++)),i(0,1);const $=c()+r,g=$+o;a&&a.abort(),f=!0,J((()=>et(n,!0,"start"))),a=m((t=>{if(f){if(t>=g)return i(1,0),et(n,!0,"end"),p(),f=!1;if(t>=$){const e=s((t-$)/o);i(e,1-e)}}return f}))}let $=!1;return{start(){$||($=!0,j(n),s(u)?(u=u(i),tt().then(h)):h())},invalidate(){$=!1},end(){f&&(p(),f=!1)}}}function ut(n,r,i,l){const a={direction:"both"};let u=r(n,i,a),f=l?0:1,d=null,p=null,h=null;function $(){h&&j(n,h)}function g(t,e){const n=t.b-f;return e*=Math.abs(n),{a:f,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function b(r){const{delay:s=0,duration:i=300,easing:l=e,tick:a=t,css:b}=u||at,w={start:c()+s,b:r};r||(w.group=rt,rt.r+=1),d||p?p=w:(b&&($(),h=T(n,f,r,i,s,l,b)),r&&a(0,1),d=g(w,i),J((()=>et(n,r,"start"))),m((t=>{if(p&&t>p.start&&(d=g(p,i),p=null,et(n,d.b,"start"),b&&($(),h=T(n,f,d.b,d.duration,0,l,u.css))),d)if(t>=d.end)a(f=d.b,1-f),et(n,d.b,"end"),p||(d.b?$():--d.group.r||o(d.group.c)),d=null;else if(t>=d.start){const e=t-d.start;f=d.a+d.d*l(e/d.duration),a(f,1-f)}return!(!d&&!p)})))}return{run(t){s(u)?tt().then((()=>{u=u(a),b(t)})):b(t)},end(){$(),d=p=null}}}function ft(t,e){const n=e.token={};function r(t,r,o,s){if(e.token!==n)return;e.resolved=s;let i=e.ctx;void 0!==o&&(i=i.slice(),i[o]=s);const l=t&&(e.current=t)(i);let a=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==r&&t&&(ot(),lt(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),st())})):e.block.d(1),l.c(),it(l,1),l.m(e.mount(),e.anchor),a=!0),e.block=l,e.blocks&&(e.blocks[r]=l),a&&Q()}if(!(o=t)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then){if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}else{const n=q();if(t.then((t=>{N(n),r(e.then,1,e.value,t),N(null)}),(t=>{if(N(n),r(e.catch,2,e.error,t),N(null),!e.hasCatch)throw t})),e.current!==e.pending)return r(e.pending,0),!0}var o}function dt(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function mt(t){t&&t.c()}function pt(t,e,r,i){const{fragment:l,after_update:a}=t.$$;l&&l.m(e,r),i||J((()=>{const e=t.$$.on_mount.map(n).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):o(e),t.$$.on_mount=[]})),a.forEach(J)}function ht(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];O.forEach((r=>-1===t.indexOf(r)?e.push(r):n.push(r))),n.forEach((t=>t())),O=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function $t(t,e){-1===t.$$.dirty[0]&&(W.push(t),K||(K=!0,I.then(Q)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const o=r.length?r[0]:n;return d.ctx&&l(d.ctx[t],d.ctx[t]=o)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](o),m&&$t(e,t)),n})):[],d.update(),m=!0,o(d.before_update),d.fragment=!!i&&i(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(b)}else d.fragment&&d.fragment.c();n.intro&&it(e.$$.fragment),pt(e,n.target,n.anchor,n.customElement),Q()}N(f)}class bt{$destroy(){ht(this,1),this.$destroy=t}$on(e,n){if(!s(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function wt(t){const e=t-1;return e*e*e+1}function kt(t,{delay:n=0,duration:r=400,easing:o=e}={}){const s=+getComputedStyle(t).opacity;return{delay:n,duration:r,easing:o,css:t=>"opacity: "+t*s}}function vt(t,{delay:e=0,duration:n=400,easing:r=wt,axis:o="y"}={}){const s=getComputedStyle(t),i=+s.opacity,l="y"===o?"height":"width",a=parseFloat(s[l]),c="y"===o?["top","bottom"]:["left","right"],u=c.map((t=>`${t[0].toUpperCase()}${t.slice(1)}`)),f=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),m=parseFloat(s[`margin${u[0]}`]),p=parseFloat(s[`margin${u[1]}`]),h=parseFloat(s[`border${u[0]}Width`]),$=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:n,easing:r,css:t=>`overflow: hidden;opacity: ${Math.min(20*t,1)*i};${l}: ${t*a}px;padding-${c[0]}: ${t*f}px;padding-${c[1]}: ${t*d}px;margin-${c[0]}: ${t*m}px;margin-${c[1]}: ${t*p}px;border-${c[0]}-width: ${t*h}px;border-${c[1]}-width: ${t*$}px;`}}const xt="route-v001";function yt(e){let n,r;return{c(){n=k("span"),r=v(e[0]),M(n,"class","material-icons-round svelte-3om24"),E(n,"big",e[1])},m(t,e){g(t,n,e),p(n,r)},p(t,[e]){1&e&&D(r,t[0]),2&e&&E(n,"big",t[1])},i:t,o:t,d(t){t&&b(n)}}}function St(t,e,n){let{name:r}=e,{big:o=!1}=e;return t.$$set=t=>{"name"in t&&n(0,r=t.name),"big"in t&&n(1,o=t.big)},[r,o]}class Ct extends bt{constructor(t){super(),gt(this,t,St,yt,i,{name:0,big:1})}}function Mt(t){const e=t=>Math.round(t);return`${e(t.x)}/${e(t.y)}`}function _t(t){const{h:e,m:n}=Pt(t);return`${e}:${Lt(n)}`}function Dt(t){const{h:e,m:n}=Pt(t);return`${Lt(e%24)}:${Lt(n)}`}function Pt(t){const e=Math.floor(t);return{h:e,m:Math.floor(60*(t-e))}}function Lt(t){return t<10?`0${t}`:t.toString()}function Et(t){window.goatcounter?.count&&window.goatcounter.count({path:t,title:"",event:!0})}function zt(t){Et(`error-${t}`)}function At(t,e){return t.x===e.x&&t.y===e.y}function Ft(t,e){return n=function(t,e){return{x:t.x-e.x,y:t.y-e.y}}(e,t),Math.hypot(n.x,n.y);var n}const Ht="https://api3.geo.admin.ch/rest/services",Tt=2,jt=100;function Nt(t,e,n){const r={type:"LineString",coordinates:t.map((t=>[Math.round(t.x),Math.round(t.y)]))};return fetch(`${Ht}/profile.json`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`sr=21781&distinct_points=${e}&nb_points=${n}&geom=${JSON.stringify(r)}`}).catch(qt).then((t=>Gt(t,"Das Höhenprofil konnten nicht geladen werden."))).then((n=>new Promise((r=>{if(0===n.length)throw{id:"empty-response",message:"Für die Route sind keine Höhendaten verfügbar."};let o=n.map((t=>({point:{x:t.easting,y:t.northing},height:t.alts.COMB})));e&&(o=o.filter((e=>t.some((t=>Ft(e.point,t)t.line[e.index])),!0,t.markers.length),Bt(t),t}async function Ot(t){return t.maps=await function(t,e){let n=[];const r=t.map((t=>[Math.round(t.x),Math.round(t.y)]));if(r.length>jt)for(let t=0;tGt(t,"Die Landeskarten konnten nicht geladen werden."))).then((t=>new Promise((e=>{e(t.results.map((t=>({id:t.attributes.tileid,name:t.attributes.lk_name}))))}))))}(t.line,t.mapScale),t}function Bt(t){t.distanceSum=It(t.line),t.lineProfileDistanceSum=It(t.lineProfile.map((t=>t.point))),t.effort=function(t){const e=[];e[0]=0;for(let n=1;n0?e[n]+=o/100:s<-.2&&(e[n]+=Math.abs(o)/150)}return e}(t),t.effortSum=Kt(t.effort),t.breakSum=[0,...Kt(t.markers.map((t=>t.break)))]}function It(t){return Kt(t.map(((e,n)=>Ft(t[Math.max(0,n-1)],t[n]))))}function Kt(t){const e=[];let n=0;for(let r=0;r{"topic"in t&&n(0,r=t.topic),"label"in t&&n(1,o=t.label)},[r,o]}class Vt extends bt{constructor(t){super(),gt(this,t,Ut,Xt,i,{topic:0,label:1})}}function Zt(t){let e,n,r,o,s,i,a,c,u,f,d,m,h,$,w,y,_,P;const L=t[4].default,E=function(t,e,n,r){if(t){const o=l(t,e,n,r);return t[0](o)}}(L,t,t[3],null);return h=new Ct({props:{name:"done"}}),{c(){e=k("div"),n=k("div"),r=x(),o=k("div"),s=k("h2"),i=v(t[1]),a=x(),c=k("form"),E&&E.c(),u=x(),f=k("br"),d=x(),m=k("button"),mt(h.$$.fragment),$=v(" Fertig"),M(n,"class","background svelte-1v8si1e"),M(s,"class","svelte-1v8si1e"),M(m,"class","svelte-1v8si1e"),M(o,"class","dialog svelte-1v8si1e")},m(l,b){g(l,e,b),p(e,n),p(e,r),p(e,o),p(o,s),p(s,i),p(o,a),p(o,c),E&&E.m(c,null),p(c,u),p(c,f),p(c,d),p(c,m),pt(h,m,null),p(m,$),y=!0,_||(P=S(c,"submit",C(t[2])),_=!0)},p(t,e){(!y||2&e)&&D(i,t[1]),E&&E.p&&(!y||8&e)&&function(t,e,n,r,o,s){if(o){const i=l(e,n,r,s);t.p(i,o)}}(E,L,t,t[3],y?function(t,e,n,r){if(t[2]&&r){const o=t[2](r(n));if(void 0===e.dirty)return o;if("object"==typeof o){const t=[],n=Math.max(e.dirty.length,o.length);for(let r=0;r32){const e=[],n=t.ctx.length/32;for(let t=0;t{y&&(w||(w=ut(e,kt,{duration:100},!0)),w.run(1))})),y=!0)},o(t){lt(E,t),lt(h.$$.fragment,t),w||(w=ut(e,kt,{duration:100},!1)),w.run(0),y=!1},d(t){t&&b(e),E&&E.d(t),ht(h),t&&w&&w.end(),_=!1,P()}}}function Qt(t){let e,n,r=t[0]&&Zt(t);return{c(){r&&r.c(),e=y()},m(t,o){r&&r.m(t,o),g(t,e,o),n=!0},p(t,[n]){t[0]?r?(r.p(t,n),1&n&&it(r,1)):(r=Zt(t),r.c(),it(r,1),r.m(e.parentNode,e)):r&&(ot(),lt(r,1,1,(()=>{r=null})),st())},i(t){n||(it(r),n=!0)},o(t){lt(r),n=!1},d(t){r&&r.d(t),t&&b(e)}}}function Yt(t,e,n){let{$$slots:r={},$$scope:o}=e,{title:s}=e,{show:i=!1}=e;const l=function(){const t=q();return(e,n,{cancelable:r=!1}={})=>{const o=t.$$.callbacks[e];if(o){const s=z(e,n,{cancelable:r});return o.slice().forEach((e=>{e.call(t,s)})),!s.defaultPrevented}return!0}}();return t.$$set=t=>{"title"in t&&n(1,s=t.title),"show"in t&&n(0,i=t.show),"$$scope"in t&&n(3,o=t.$$scope)},[i,s,function(){n(0,i=!1),l("close")},o,r]}class te extends bt{constructor(t){super(),gt(this,t,Yt,Qt,i,{title:1,show:0})}}function ee(t){let e,n,r,o,s,i,l,a,c,u;return{c(){e=k("label"),e.textContent="Massstab",n=x(),r=k("select"),o=k("option"),o.textContent="1:25'000",s=k("option"),s.textContent="1:50'000",i=k("option"),i.textContent="1:100'000",l=x(),a=k("br"),M(e,"for","scale"),o.__value=25,o.value=o.__value,s.__value=50,s.value=s.__value,i.__value=100,i.value=i.__value,M(r,"id","scale"),r.required=!0,void 0===t[1]&&J((()=>t[2].call(r)))},m(f,d){g(f,e,d),g(f,n,d),g(f,r,d),p(r,o),p(r,s),p(r,i),L(r,t[1],!0),g(f,l,d),g(f,a,d),c||(u=S(r,"change",t[2]),c=!0)},p(t,e){2&e&&L(r,t[1])},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(l),t&&b(a),c=!1,u()}}}function ne(t){let e,n,r;function o(e){t[3](e)}let s={title:"Kartenmassstab wählen",$$slots:{default:[ee]},$$scope:{ctx:t}};return void 0!==t[0]&&(s.show=t[0]),e=new te({props:s}),R.push((()=>dt(e,"show",o))),e.$on("close",t[4]),{c(){mt(e.$$.fragment)},m(t,n){pt(e,t,n),r=!0},p(t,[r]){const o={};34&r&&(o.$$scope={dirty:r,ctx:t}),!n&&1&r&&(n=!0,o.show=t[0],X((()=>n=!1))),e.$set(o)},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t)}}}function re(t,e,n){let{show:r}=e,{scale:o}=e;return t.$$set=t=>{"show"in t&&n(0,r=t.show),"scale"in t&&n(1,o=t.scale)},[r,o,function(){o=function(t){const e=t.querySelector(":checked");return e&&e.__value}(this),n(1,o)},function(t){r=t,n(0,r)},function(e){G.call(this,t,e)}]}class oe extends bt{constructor(t){super(),gt(this,t,re,ne,i,{show:0,scale:1})}}function se(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y;return l=new Ct({props:{name:"remove"}}),f=new Ct({props:{name:"add"}}),{c(){e=k("label"),e.textContent="Geschwindigkeit (Lkm/h)",n=x(),r=k("input"),s=x(),i=k("button"),mt(l.$$.fragment),a=v(" Langsamer"),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" Schneller"),m=x(),h=k("br"),M(e,"for","speed"),M(r,"id","speed"),M(r,"type","number"),M(r,"min","0.1"),M(r,"step","0.1"),r.required=!0,M(i,"type","button"),M(i,"class","pill"),M(u,"type","button"),M(u,"class","pill")},m(o,b){g(o,e,b),g(o,n,b),g(o,r,b),P(r,t[1]),g(o,s,b),g(o,i,b),pt(l,i,null),p(i,a),g(o,c,b),g(o,u,b),pt(f,u,null),p(u,d),g(o,m,b),g(o,h,b),$=!0,w||(y=[S(r,"input",t[3]),S(i,"click",t[4]),S(u,"click",t[5])],w=!0)},p(t,e){2&e&&_(r.value)!==t[1]&&P(r,t[1])},i(t){$||(it(l.$$.fragment,t),it(f.$$.fragment,t),$=!0)},o(t){lt(l.$$.fragment,t),lt(f.$$.fragment,t),$=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),ht(l),t&&b(c),t&&b(u),ht(f),t&&b(m),t&&b(h),w=!1,o(y)}}}function ie(t){let e,n,r;function o(e){t[6](e)}let s={title:"Geschwindigkeit anpassen",$$slots:{default:[se]},$$scope:{ctx:t}};return void 0!==t[0]&&(s.show=t[0]),e=new te({props:s}),R.push((()=>dt(e,"show",o))),{c(){mt(e.$$.fragment)},m(t,n){pt(e,t,n),r=!0},p(t,[r]){const o={};130&r&&(o.$$scope={dirty:r,ctx:t}),!n&&1&r&&(n=!0,o.show=t[0],X((()=>n=!1))),e.$set(o)},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t)}}}function le(t,e,n){let{show:r}=e,{speed:o}=e,s=o;return t.$$set=t=>{"show"in t&&n(0,r=t.show),"speed"in t&&n(2,o=t.speed)},t.$$.update=()=>{2&t.$$.dirty&&!window.isNaN(s)&&s>0&&n(2,o=s)},[r,s,o,function(){s=_(this.value),n(1,s)},()=>n(1,s=Math.max(.5,s-.5)),()=>n(1,s+=.5),function(t){r=t,n(0,r)}]}class ae extends bt{constructor(t){super(),gt(this,t,le,ie,i,{show:0,speed:2})}}function ce(e){let n;return{c(){n=k("div"),M(n,"class","svelte-19o0idp"),E(n,"small",e[0])},m(t,e){g(t,n,e)},p(t,[e]){1&e&&E(n,"small",t[0])},i:t,o:t,d(t){t&&b(n)}}}function ue(t,e,n){let{small:r=!1}=e;return t.$$set=t=>{"small"in t&&n(0,r=t.small)},[r]}class fe extends bt{constructor(t){super(),gt(this,t,ue,ce,i,{small:0})}}function de(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,C,_,D,L;return l=new Ct({props:{name:"brightness_low"}}),f=new Ct({props:{name:"brightness_medium"}}),$=new Ct({props:{name:"brightness_high"}}),{c(){e=k("label"),e.textContent="Abreise",n=x(),r=k("input"),s=x(),i=k("button"),mt(l.$$.fragment),a=v(" 08:00"),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" 12:00"),m=x(),h=k("button"),mt($.$$.fragment),w=v(" 16:00"),y=x(),C=k("br"),M(e,"for","start"),M(r,"id","start"),M(r,"type","time"),r.required=!0,M(i,"type","button"),M(i,"class","pill"),M(u,"type","button"),M(u,"class","pill"),M(h,"type","button"),M(h,"class","pill")},m(o,b){g(o,e,b),g(o,n,b),g(o,r,b),P(r,t[1]),g(o,s,b),g(o,i,b),pt(l,i,null),p(i,a),g(o,c,b),g(o,u,b),pt(f,u,null),p(u,d),g(o,m,b),g(o,h,b),pt($,h,null),p(h,w),g(o,y,b),g(o,C,b),_=!0,D||(L=[S(r,"input",t[3]),S(i,"click",t[4]),S(u,"click",t[5]),S(h,"click",t[6])],D=!0)},p(t,e){2&e&&P(r,t[1])},i(t){_||(it(l.$$.fragment,t),it(f.$$.fragment,t),it($.$$.fragment,t),_=!0)},o(t){lt(l.$$.fragment,t),lt(f.$$.fragment,t),lt($.$$.fragment,t),_=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),ht(l),t&&b(c),t&&b(u),ht(f),t&&b(m),t&&b(h),ht($),t&&b(y),t&&b(C),D=!1,o(L)}}}function me(t){let e,n,r;function o(e){t[7](e)}let s={title:"Abreise anpassen",$$slots:{default:[de]},$$scope:{ctx:t}};return void 0!==t[0]&&(s.show=t[0]),e=new te({props:s}),R.push((()=>dt(e,"show",o))),{c(){mt(e.$$.fragment)},m(t,n){pt(e,t,n),r=!0},p(t,[r]){const o={};258&r&&(o.$$scope={dirty:r,ctx:t}),!n&&1&r&&(n=!0,o.show=t[0],X((()=>n=!1))),e.$set(o)},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t)}}}function pe(t,e,n){let{show:r}=e,{start:o}=e,s=Dt(o);return t.$$set=t=>{"show"in t&&n(0,r=t.show),"start"in t&&n(2,o=t.start)},t.$$.update=()=>{2&t.$$.dirty&&n(2,o=s.split(":").map(((t,e)=>Number(t)/60**e)).reduce(((t,e)=>t+e)))},[r,s,o,function(){s=this.value,n(1,s)},()=>n(1,s="08:00"),()=>n(1,s="12:00"),()=>n(1,s="16:00"),function(t){r=t,n(0,r)}]}class he extends bt{constructor(t){super(),gt(this,t,pe,me,i,{show:0,start:2})}}function $e(t,e,n){const r=t.slice();return r[19]=e[n],r}function ge(e){let n,r=e[0].maps,o=[];for(let t=0;tdt(e,"show",Xe))),R.push((()=>dt(e,"speed",Ue)));let Ye={};function tn(e){t[14](e)}function en(e){t[15](e)}void 0!==t[2]&&(Ye.show=t[2]),void 0!==t[0].start&&(Ye.start=t[0].start),i=new he({props:Ye}),R.push((()=>dt(i,"show",Ze))),R.push((()=>dt(i,"start",Qe)));let nn={};void 0!==t[3]&&(nn.show=t[3]),void 0!==t[0].mapScale&&(nn.scale=t[0].mapScale),u=new oe({props:nn}),R.push((()=>dt(u,"show",tn))),R.push((()=>dt(u,"scale",en))),u.$on("close",t[7]),W=new Ct({props:{name:"edit"}});const rn=[be,ge],on=[];function sn(t,e){return t[4]?0:1}return K=sn(t),J=on[K]=rn[K](t),Z=new Ct({props:{name:"swap_vert"}}),Ft=new Vt({props:{topic:"calculation"}}),Ot=new Ct({props:{name:"edit"}}),Qt=new Ct({props:{name:"edit"}}),_e=new Ct({props:{name:"print"}}),Ee=new Ct({props:{name:"table_chart"}}),{c(){mt(e.$$.fragment),s=x(),mt(i.$$.fragment),c=x(),mt(u.$$.fragment),m=x(),h=k("div"),$=k("div"),w=k("span"),w.textContent="Start: ",y=k("b"),C=v(Te),_=k("br"),P=x(),L=k("span"),L.textContent="Ziel: ",E=k("b"),z=v(je),A=k("br"),F=x(),H=k("span"),T=v("Landeskarten 1:"),j=v(Ne),N=v("'000:"),q=x(),G=k("button"),mt(W.$$.fragment),O=x(),B=k("br"),I=x(),J.c(),U=x(),V=k("button"),mt(Z.$$.fragment),Q=v(" Richtung wechseln"),Y=x(),tt=k("div"),et=k("span"),et.textContent="Horizontaldistanz: ",nt=k("b"),rt=v(qe),at=v(" km"),ct=k("br"),ut=x(),ft=k("span"),ft.textContent="Auf-/Abstieg: ",$t=v("↑ "),gt=k("b"),bt=v(Ge),wt=v(" m"),kt=v(" ↓ "),vt=k("b"),xt=v(We),yt=v(" m"),St=k("br"),Mt=x(),Pt=k("span"),Pt.textContent="Aufwand: ",Lt=k("b"),Et=v(Re),zt=v(" Lkm"),At=x(),mt(Ft.$$.fragment),Ht=k("br"),Tt=x(),jt=k("span"),jt.textContent="Geschwindigkeit: ",Nt=k("b"),qt=v(Oe),Gt=v(" Lkm/h"),Wt=x(),Rt=k("button"),mt(Ot.$$.fragment),Bt=x(),It=k("div"),Kt=k("span"),Kt.textContent="Abreise: ",Jt=k("b"),Xt=v(Be),Ut=x(),Zt=k("button"),mt(Qt.$$.fragment),Yt=x(),te=k("br"),ee=x(),ne=k("span"),ne.textContent="Ankunft: ",re=k("b"),se=v(Ie),ie=k("br"),le=x(),ce=k("span"),ce.textContent="Gehzeit: ",ue=k("b"),fe=v(Ke),de=v(" h"),me=k("br"),pe=x(),$e=k("span"),$e.textContent="Pausen: ",we=k("b"),ke=v(Je),ve=v(" h"),xe=x(),ye=k("div"),Se=k("br"),Ce=x(),Me=k("button"),mt(_e.$$.fragment),De=v(" Drucken (PDF)"),Pe=v("\n  \n "),Le=k("button"),mt(Ee.$$.fragment),ze=v(" Tabelle exportieren (CSV)"),M(G,"class","pill noprint"),G.disabled=t[4],M(V,"class","pill noprint pad svelte-mpbsbs"),M($,"class","svelte-mpbsbs"),M(Rt,"class","pill noprint"),M(tt,"class","svelte-mpbsbs"),M(Zt,"class","pill noprint"),M(It,"class","svelte-mpbsbs"),M(h,"class","container svelte-mpbsbs"),M(Le,"class","secondary"),M(ye,"class","noprint")},m(n,r){pt(e,n,r),g(n,s,r),pt(i,n,r),g(n,c,r),pt(u,n,r),g(n,m,r),g(n,h,r),p(h,$),p($,w),p($,y),p(y,C),p($,_),p($,P),p($,L),p($,E),p(E,z),p($,A),p($,F),p($,H),p(H,T),p(H,j),p(H,N),p($,q),p($,G),pt(W,G,null),p($,O),p($,B),p($,I),on[K].m($,null),p($,U),p($,V),pt(Z,V,null),p(V,Q),p(h,Y),p(h,tt),p(tt,et),p(tt,nt),p(nt,rt),p(nt,at),p(tt,ct),p(tt,ut),p(tt,ft),p(tt,$t),p(tt,gt),p(gt,bt),p(gt,wt),p(tt,kt),p(tt,vt),p(vt,xt),p(vt,yt),p(tt,St),p(tt,Mt),p(tt,Pt),p(tt,Lt),p(Lt,Et),p(Lt,zt),p(tt,At),pt(Ft,tt,null),p(tt,Ht),p(tt,Tt),p(tt,jt),p(tt,Nt),p(Nt,qt),p(Nt,Gt),p(tt,Wt),p(tt,Rt),pt(Ot,Rt,null),p(h,Bt),p(h,It),p(It,Kt),p(It,Jt),p(Jt,Xt),p(It,Ut),p(It,Zt),pt(Qt,Zt,null),p(It,Yt),p(It,te),p(It,ee),p(It,ne),p(It,re),p(re,se),p(It,ie),p(It,le),p(It,ce),p(It,ue),p(ue,fe),p(ue,de),p(It,me),p(It,pe),p(It,$e),p(It,we),p(we,ke),p(we,ve),g(n,xe,r),g(n,ye,r),p(ye,Se),p(ye,Ce),p(ye,Me),pt(_e,Me,null),p(Me,De),p(ye,Pe),p(ye,Le),pt(Ee,Le,null),p(Le,ze),Ae=!0,Fe||(He=[S(G,"click",t[16]),S(V,"click",t[6]),S(Rt,"click",t[17]),S(Zt,"click",t[18]),S(Me,"click",t[8]),S(Le,"click",t[9])],Fe=!0)},p(t,[o]){const s={};!n&&2&o&&(n=!0,s.show=t[1],X((()=>n=!1))),!r&&1&o&&(r=!0,s.speed=t[0].speed,X((()=>r=!1))),e.$set(s);const c={};!l&&4&o&&(l=!0,c.show=t[2],X((()=>l=!1))),!a&&1&o&&(a=!0,c.start=t[0].start,X((()=>a=!1))),i.$set(c);const m={};!f&&8&o&&(f=!0,m.show=t[3],X((()=>f=!1))),!d&&1&o&&(d=!0,m.scale=t[0].mapScale,X((()=>d=!1))),u.$set(m),(!Ae||1&o)&&Te!==(Te=t[0].markers[0].name+"")&&D(C,Te),(!Ae||1&o)&&je!==(je=t[0].markers[t[0].markers.length-1].name+"")&&D(z,je),(!Ae||1&o)&&Ne!==(Ne=t[0].mapScale+"")&&D(j,Ne),(!Ae||16&o)&&(G.disabled=t[4]);let p=K;K=sn(t),K===p?on[K].p(t,o):(ot(),lt(on[p],1,1,(()=>{on[p]=null})),st(),J=on[K],J?J.p(t,o):(J=on[K]=rn[K](t),J.c()),it(J,1),J.m($,U)),(!Ae||32&o)&&qe!==(qe=t[5].distance.toFixed(1)+"")&&D(rt,qe),(!Ae||32&o)&&Ge!==(Ge=Math.round(t[5].ascent)+"")&&D(bt,Ge),(!Ae||32&o)&&We!==(We=Math.round(t[5].descent)+"")&&D(xt,We),(!Ae||32&o)&&Re!==(Re=t[5].effort.toFixed(1)+"")&&D(Et,Re),(!Ae||1&o)&&Oe!==(Oe=t[0].speed+"")&&D(qt,Oe),(!Ae||1&o)&&Be!==(Be=Dt(t[0].start)+"")&&D(Xt,Be),(!Ae||33&o)&&Ie!==(Ie=Dt(t[0].start+t[5].duration)+"")&&D(se,Ie),(!Ae||32&o)&&Ke!==(Ke=_t(t[5].walkingDuration)+"")&&D(fe,Ke),(!Ae||32&o)&&Je!==(Je=_t(t[5].breakDuration)+"")&&D(ke,Je)},i(t){Ae||(it(e.$$.fragment,t),it(i.$$.fragment,t),it(u.$$.fragment,t),it(W.$$.fragment,t),it(J),it(Z.$$.fragment,t),it(Ft.$$.fragment,t),it(Ot.$$.fragment,t),it(Qt.$$.fragment,t),it(_e.$$.fragment,t),it(Ee.$$.fragment,t),Ae=!0)},o(t){lt(e.$$.fragment,t),lt(i.$$.fragment,t),lt(u.$$.fragment,t),lt(W.$$.fragment,t),lt(J),lt(Z.$$.fragment,t),lt(Ft.$$.fragment,t),lt(Ot.$$.fragment,t),lt(Qt.$$.fragment,t),lt(_e.$$.fragment,t),lt(Ee.$$.fragment,t),Ae=!1},d(t){ht(e,t),t&&b(s),ht(i,t),t&&b(c),ht(u,t),t&&b(m),t&&b(h),ht(W),on[K].d(),ht(Z),ht(Ft),ht(Ot),ht(Qt),t&&b(xe),t&&b(ye),ht(_e),ht(Ee),Fe=!1,o(He)}}}function ve(t,e,n){let r,o,{route:s}=e,i=!1,l=!1,a=!1;return t.$$set=t=>{"route"in t&&n(0,s=t.route)},t.$$.update=()=>{1&t.$$.dirty&&n(5,r=function(t){const e=t.distanceSum[t.line.length-1]/1e3,n=t.effortSum[t.markers.length-1],r=n/t.speed,o=t.breakSum[t.markers.length-1]/60,s=r+o,{ascent:i,descent:l}=function(t){let e=0,n=0;for(let r=1;r0?e+=o:n-=o}return{ascent:e,descent:n}}(t);return{distance:e,effort:n,walkingDuration:r,breakDuration:o,duration:s,ascent:i,descent:l}}(s))},[s,i,l,a,o,r,function(){!function(t){t.line.reverse(),t.markers.reverse(),t.lineProfile?.reverse(),t.markerProfile?.reverse(),t.markers.forEach((e=>e.index=t.line.length-e.index-1)),Bt(t)}(s),n(0,s)},function(){n(4,o=!0),Ot(s).then((()=>new Promise((t=>{setTimeout(t,300)})))).then((()=>{n(0,s),n(4,o=!1)})).catch((t=>{zt(t.id),alert(t.message)}))},function(){window.print?(Et("print"),window.print()):(zt("print"),alert("Dein Browser unterstützt das Drucken nicht."))},function(){Et("export-csv");const t=[["Nr.","Wegpunkt","Koordinaten","Kommentar","Höhe / m","Differenz Höhe / m","Total Distanz / km","Differenz Distanz / km","Total Aufwand / Lkm","Differenz Aufwand / Lkm","Total Gehzeit / h","Differenz Gehzeit / h","Uhrzeit / hh:mm","Pause / min"],...Jt(s).map((t=>[t.index+1,t.name,Mt(t.coordinates),t.comment??"",t.height,t.diff?.height??0,t.distance,t.diff?.distance??0,t.effort,t.diff?.effort??0,t.duration,t.diff?.duration??0,Dt(t.time),t.break]))].map((t=>t.map((t=>`"${t}"`)).join(","))).join("\n"),e=document.createElement("a");e.href=URL.createObjectURL(new Blob([t],{type:"text/csv"})),e.download=`${s.title||"marschzeittabelle"}.csv`,e.click()},function(t){i=t,n(1,i)},function(e){t.$$.not_equal(s.speed,e)&&(s.speed=e,n(0,s))},function(t){l=t,n(2,l)},function(e){t.$$.not_equal(s.start,e)&&(s.start=e,n(0,s))},function(t){a=t,n(3,a)},function(e){t.$$.not_equal(s.mapScale,e)&&(s.mapScale=e,n(0,s))},()=>n(3,a=!0),()=>n(1,i=!0),()=>n(2,l=!0)]}class xe extends bt{constructor(t){super(),gt(this,t,ve,ke,i,{route:0})}}function ye(){for(let t of Object.keys(Se)){const e="--"+t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));Se[t]=window.getComputedStyle(document.body).getPropertyValue(e)}return Se}const Se={backgroundColor:null,textColor:null,darkerAccentColor:null,accentColor:null,lighterAccentColor:null,shadowColor:null};function Ce(e){let n;return{c(){n=k("canvas"),M(n,"class","svelte-xd84ci")},m(t,r){g(t,n,r),e[2](n)},p:t,i:t,o:t,d(t){t&&b(n),e[2](null)}}}function Me(t,e,n){let r,{route:o}=e;return t.$$set=t=>{"route"in t&&n(1,o=t.route)},t.$$.update=()=>{3&t.$$.dirty&&r&&(n(0,r.width=800,r),n(0,r.height=200,r),function(t,e){const n=ye(),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height);const o=12;let s=1/0,i=-1/0;for(let e of t.lineProfile)s=Math.min(s,e.height),i=Math.max(i,e.height);const l={x:t.distanceSum[t.distanceSum.length-1],y:i-s},a=Math.min((e.width-24)/l.x,(e.height-24-40)/l.y);e.width=Math.floor(l.x*a+24),e.height=Math.floor(l.y*a+24+40);const c=(t,n)=>{return r={x:(l={x:t,y:s-n}).x*(c=a),y:l.y*c},i={x:o,y:e.height-o-40},{x:r.x+i.x,y:r.y+i.y};var r,i,l,c},u=()=>{for(let e=0;e{r=t,n(0,r),n(1,o)}))}]}class _e extends bt{constructor(t){super(),gt(this,t,Me,Ce,i,{route:1})}}function De(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,C,D,L,E;return l=new Ct({props:{name:"block"}}),f=new Ct({props:{name:"hourglass_bottom"}}),$=new Ct({props:{name:"hourglass_full"}}),{c(){e=k("label"),e.textContent="Pause (min)",n=x(),r=k("input"),s=x(),i=k("button"),mt(l.$$.fragment),a=v(" Keine"),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" 5 min"),m=x(),h=k("button"),mt($.$$.fragment),w=v(" 15 min"),y=x(),C=k("br"),M(e,"for","break"),M(r,"id","break"),M(r,"type","number"),M(r,"min","0"),r.required=!0,M(i,"type","button"),M(i,"class","pill"),M(u,"type","button"),M(u,"class","pill"),M(h,"type","button"),M(h,"class","pill")},m(o,b){g(o,e,b),g(o,n,b),g(o,r,b),P(r,t[0].break),g(o,s,b),g(o,i,b),pt(l,i,null),p(i,a),g(o,c,b),g(o,u,b),pt(f,u,null),p(u,d),g(o,m,b),g(o,h,b),pt($,h,null),p(h,w),g(o,y,b),g(o,C,b),D=!0,L||(E=[S(r,"input",t[4]),S(i,"click",t[5]),S(u,"click",t[6]),S(h,"click",t[7])],L=!0)},p(t,e){1&e&&_(r.value)!==t[0].break&&P(r,t[0].break)},i(t){D||(it(l.$$.fragment,t),it(f.$$.fragment,t),it($.$$.fragment,t),D=!0)},o(t){lt(l.$$.fragment,t),lt(f.$$.fragment,t),lt($.$$.fragment,t),D=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),ht(l),t&&b(c),t&&b(u),ht(f),t&&b(m),t&&b(h),ht($),t&&b(y),t&&b(C),L=!1,o(E)}}}function Pe(t){let e,n,r,s,i,l,a,c,u,f,d,m,p=t[1]&&De(t);return{c(){e=k("label"),e.textContent="Name",n=x(),r=k("input"),s=x(),i=k("label"),i.textContent="Kommentar",l=x(),a=k("textarea"),c=x(),p&&p.c(),u=y(),M(e,"for","name"),M(r,"id","name"),M(r,"type","text"),r.required=!0,M(i,"for","comment"),M(a,"id","comment"),M(a,"class","svelte-1er4ovm")},m(o,h){g(o,e,h),g(o,n,h),g(o,r,h),P(r,t[0].name),g(o,s,h),g(o,i,h),g(o,l,h),g(o,a,h),P(a,t[0].comment),g(o,c,h),p&&p.m(o,h),g(o,u,h),f=!0,d||(m=[S(r,"input",t[2]),S(a,"input",t[3])],d=!0)},p(t,e){1&e&&r.value!==t[0].name&&P(r,t[0].name),1&e&&P(a,t[0].comment),t[1]?p?(p.p(t,e),2&e&&it(p,1)):(p=De(t),p.c(),it(p,1),p.m(u.parentNode,u)):p&&(ot(),lt(p,1,1,(()=>{p=null})),st())},i(t){f||(it(p),f=!0)},o(t){lt(p),f=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(s),t&&b(i),t&&b(l),t&&b(a),t&&b(c),p&&p.d(t),t&&b(u),d=!1,o(m)}}}function Le(t){let e,n;return e=new te({props:{title:"Wegpunkt bearbeiten",show:null!=t[0],$$slots:{default:[Pe]},$$scope:{ctx:t}}}),e.$on("close",t[8]),{c(){mt(e.$$.fragment)},m(t,r){pt(e,t,r),n=!0},p(t,[n]){const r={};1&n&&(r.show=null!=t[0]),515&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(it(e.$$.fragment,t),n=!0)},o(t){lt(e.$$.fragment,t),n=!1},d(t){ht(e,t)}}}function Ee(t,e,n){let{marker:r}=e,{showBreak:o}=e;return t.$$set=t=>{"marker"in t&&n(0,r=t.marker),"showBreak"in t&&n(1,o=t.showBreak)},[r,o,function(){r.name=this.value,n(0,r)},function(){r.comment=this.value,n(0,r)},function(){r.break=_(this.value),n(0,r)},()=>n(0,r.break=0,r),()=>n(0,r.break=5,r),()=>n(0,r.break=15,r),function(e){G.call(this,t,e)}]}class ze extends bt{constructor(t){super(),gt(this,t,Ee,Le,i,{marker:0,showBreak:1})}}function Ae(t,e,n){const r=t.slice();return r[6]=e[n],r}function Fe(t){let e,n,r,o,s,i,l,a,c,u,f,d,m,h,$,w=Math.round(t[6].diff.height)+"",y=t[6].diff.distance.toFixed(1)+"",S=t[6].diff.effort.toFixed(1)+"",C=_t(t[6].diff.duration)+"";return{c(){e=k("td"),n=v(w),r=v(" m"),o=x(),s=k("td"),i=v(y),l=v(" km"),a=x(),c=k("td"),u=v(S),f=v(" Lkm"),d=x(),m=k("td"),h=v(C),$=v(" h"),M(e,"class","number svelte-upyeat"),M(s,"class","number svelte-upyeat"),M(c,"class","number svelte-upyeat"),M(m,"class","number svelte-upyeat")},m(t,b){g(t,e,b),p(e,n),p(e,r),g(t,o,b),g(t,s,b),p(s,i),p(s,l),g(t,a,b),g(t,c,b),p(c,u),p(c,f),g(t,d,b),g(t,m,b),p(m,h),p(m,$)},p(t,e){4&e&&w!==(w=Math.round(t[6].diff.height)+"")&&D(n,w),4&e&&y!==(y=t[6].diff.distance.toFixed(1)+"")&&D(i,y),4&e&&S!==(S=t[6].diff.effort.toFixed(1)+"")&&D(u,S),4&e&&C!==(C=_t(t[6].diff.duration)+"")&&D(h,C)},d(t){t&&b(e),t&&b(o),t&&b(s),t&&b(a),t&&b(c),t&&b(d),t&&b(m)}}}function He(t){let e,n,r,o=_t(t[6].break/60)+"";return{c(){e=k("td"),n=v("+"),r=v(o),M(e,"class","number svelte-upyeat")},m(t,o){g(t,e,o),p(e,n),p(e,r)},p(t,e){4&e&&o!==(o=_t(t[6].break/60)+"")&&D(r,o)},d(t){t&&b(e)}}}function Te(t){let e,n,r,o,s=t[6].comment+"";return{c(){e=k("tr"),n=k("td"),r=v(s),o=x(),M(n,"class","comment svelte-upyeat"),M(n,"colspan","100"),M(e,"class","alt comment svelte-upyeat")},m(t,s){g(t,e,s),p(e,n),p(n,r),p(e,o)},p(t,e){4&e&&s!==(s=t[6].comment+"")&&D(r,s)},d(t){t&&b(e)}}}function je(t){let e,n,r,o,s,i,l,a,c,u,f,d,m,h,$,w,C,_,P,L,E,z,A,F,H,T,j,N,q,G,W,R,O,B,I,K,J,X,U,V,Z,Q,Y=t[6].index+1+"",tt=t[6].name+"",et=Math.round(t[6].height)+"",nt=t[6].distance.toFixed(1)+"",rt=t[6].effort.toFixed(1)+"",ot=_t(t[6].duration)+"",st=Dt(t[6].time)+"",at=Mt(t[6].coordinates)+"";function ct(){return t[5](t[6])}q=new Ct({props:{name:"edit"}});let ut=t[6].diff&&Fe(t),ft=t[6].break>0&&He(t),dt=t[6].comment&&Te(t);return{c(){e=k("tr"),n=k("td"),r=k("span"),o=v(Y),s=x(),i=v(tt),l=x(),a=k("td"),c=v(et),u=v(" m"),f=x(),d=k("td"),m=v(nt),h=v(" km"),$=x(),w=k("td"),C=v(rt),_=v(" Lkm"),P=x(),L=k("td"),E=v(ot),z=v(" h"),A=x(),F=k("td"),H=v(st),T=x(),j=k("td"),N=k("button"),mt(q.$$.fragment),G=x(),W=k("tr"),R=k("td"),O=v(at),B=x(),ut&&ut.c(),I=x(),ft&&ft.c(),K=x(),J=k("td"),X=x(),dt&&dt.c(),U=y(),M(r,"class","pill svelte-upyeat"),M(n,"class","name svelte-upyeat"),M(a,"class","number svelte-upyeat"),M(d,"class","number svelte-upyeat"),M(w,"class","number svelte-upyeat"),M(L,"class","number svelte-upyeat"),M(F,"class","number svelte-upyeat"),M(N,"class","pill"),M(j,"class","noprint svelte-upyeat"),M(R,"class","coordinates svelte-upyeat"),M(J,"class","svelte-upyeat"),M(W,"class","alt svelte-upyeat")},m(t,b){g(t,e,b),p(e,n),p(n,r),p(r,o),p(n,s),p(n,i),p(e,l),p(e,a),p(a,c),p(a,u),p(e,f),p(e,d),p(d,m),p(d,h),p(e,$),p(e,w),p(w,C),p(w,_),p(e,P),p(e,L),p(L,E),p(L,z),p(e,A),p(e,F),p(F,H),p(e,T),p(e,j),p(j,N),pt(q,N,null),g(t,G,b),g(t,W,b),p(W,R),p(R,O),p(W,B),ut&&ut.m(W,null),p(W,I),ft&&ft.m(W,null),p(W,K),p(W,J),g(t,X,b),dt&&dt.m(t,b),g(t,U,b),V=!0,Z||(Q=S(N,"click",ct),Z=!0)},p(e,n){t=e,(!V||4&n)&&Y!==(Y=t[6].index+1+"")&&D(o,Y),(!V||4&n)&&tt!==(tt=t[6].name+"")&&D(i,tt),(!V||4&n)&&et!==(et=Math.round(t[6].height)+"")&&D(c,et),(!V||4&n)&&nt!==(nt=t[6].distance.toFixed(1)+"")&&D(m,nt),(!V||4&n)&&rt!==(rt=t[6].effort.toFixed(1)+"")&&D(C,rt),(!V||4&n)&&ot!==(ot=_t(t[6].duration)+"")&&D(E,ot),(!V||4&n)&&st!==(st=Dt(t[6].time)+"")&&D(H,st),(!V||4&n)&&at!==(at=Mt(t[6].coordinates)+"")&&D(O,at),t[6].diff?ut?ut.p(t,n):(ut=Fe(t),ut.c(),ut.m(W,I)):ut&&(ut.d(1),ut=null),t[6].break>0?ft?ft.p(t,n):(ft=He(t),ft.c(),ft.m(W,K)):ft&&(ft.d(1),ft=null),t[6].comment?dt?dt.p(t,n):(dt=Te(t),dt.c(),dt.m(U.parentNode,U)):dt&&(dt.d(1),dt=null)},i(t){V||(it(q.$$.fragment,t),V=!0)},o(t){lt(q.$$.fragment,t),V=!1},d(t){t&&b(e),ht(q),t&&b(G),t&&b(W),ut&&ut.d(),ft&&ft.d(),t&&b(X),dt&&dt.d(t),t&&b(U),Z=!1,Q()}}}function Ne(t){let e,n,r,o,s,i;e=new ze({props:{marker:t[1],showBreak:t[3]}}),e.$on("close",t[4]);let l=t[2],a=[];for(let e=0;elt(a[t],1,1,(()=>{a[t]=null}));return{c(){mt(e.$$.fragment),n=x(),r=k("table"),o=k("tr"),o.innerHTML='Wegpunkt
Kommentar \n Höhe \n Distanz \n Aufwand \n Gehzeit \n Uhrzeit
Pause',s=x();for(let t=0;t{"route"in t&&n(0,s=t.route)},t.$$.update=()=>{1&t.$$.dirty&&n(2,i=Jt(s)),3&t.$$.dirty&&n(3,r=o!==s.markers[s.markers.length-1])},[s,o,i,r,function(){Bt(s),n(0,s),n(1,o=null)},t=>n(1,o=s.markers[t.index])]}class Ge extends bt{constructor(t){super(),gt(this,t,qe,Ne,i,{route:0})}}function We(t){let e,n,r;return e=new Ct({props:{name:"visibility"}}),{c(){mt(e.$$.fragment),n=v(" Anzeigen")},m(t,o){pt(e,t,o),g(t,n,o),r=!0},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t),t&&b(n)}}}function Re(t){let e,n,r;return e=new Ct({props:{name:"visibility_off"}}),{c(){mt(e.$$.fragment),n=v(" Ausblenden")},m(t,o){pt(e,t,o),g(t,n,o),r=!0},i(t){r||(it(e.$$.fragment,t),r=!0)},o(t){lt(e.$$.fragment,t),r=!1},d(t){ht(e,t),t&&b(n)}}}function Oe(t){let e,n,r,o;return n=new _e({props:{route:t[0]}}),{c(){e=k("div"),mt(n.$$.fragment)},m(t,r){g(t,e,r),pt(n,e,null),o=!0},p(t,e){const r={};1&e&&(r.route=t[0]),n.$set(r)},i(t){o||(it(n.$$.fragment,t),J((()=>{o&&(r||(r=ut(e,vt,{duration:100},!0)),r.run(1))})),o=!0)},o(t){lt(n.$$.fragment,t),r||(r=ut(e,vt,{duration:100},!1)),r.run(0),o=!1},d(t){t&&b(e),ht(n),t&&r&&r.end()}}}function Be(t){let e,n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,C,_,D,L,z,A,F,H,T,j,N,q,G,W,O,B;function I(e){t[4](e)}a=new Ct({props:{name:"edit"}});let K={};function J(e){t[5](e)}void 0!==t[0]&&(K.route=t[0]),$=new xe({props:K}),R.push((()=>dt($,"route",I)));let U={};void 0!==t[0]&&(U.route=t[0]),L=new Ge({props:U}),R.push((()=>dt(L,"route",J)));const V=[Re,We],Z=[];function Q(t,e){return t[1]?0:1}N=Q(t),q=Z[N]=V[N](t);let Y=t[1]&&Oe(t);return{c(){e=k("div"),n=k("h1"),r=k("input"),s=x(),i=k("div"),l=k("button"),mt(a.$$.fragment),c=v(" Titel bearbeiten"),u=x(),f=k("br"),d=x(),m=k("br"),h=x(),mt($.$$.fragment),y=x(),C=k("div"),_=k("h2"),_.textContent="Marschzeittabelle",D=x(),mt(L.$$.fragment),A=x(),F=k("div"),H=k("h2"),H.textContent="Höhenprofil",T=x(),j=k("button"),q.c(),G=x(),Y&&Y.c(),M(r,"id","title"),M(r,"type","text"),M(r,"class","svelte-1284s1r"),M(n,"class","svelte-1284s1r"),M(l,"class","pill"),M(i,"class","noprint"),M(e,"class","options"),M(_,"class","svelte-1284s1r"),M(C,"class","table"),M(H,"class","svelte-1284s1r"),M(j,"class","pill noprint svelte-1284s1r"),M(F,"class","profile"),E(F,"noprint",!t[1])},m(o,b){g(o,e,b),p(e,n),p(n,r),P(r,t[0].title),p(e,s),p(e,i),p(i,l),pt(a,l,null),p(l,c),p(i,u),p(i,f),p(i,d),p(i,m),p(e,h),pt($,e,null),g(o,y,b),g(o,C,b),p(C,_),p(C,D),pt(L,C,null),g(o,A,b),g(o,F,b),p(F,H),p(F,T),p(F,j),Z[N].m(j,null),p(F,G),Y&&Y.m(F,null),W=!0,O||(B=[S(r,"input",t[2]),S(l,"click",t[3]),S(j,"click",t[6])],O=!0)},p(t,[e]){1&e&&r.value!==t[0].title&&P(r,t[0].title);const n={};!w&&1&e&&(w=!0,n.route=t[0],X((()=>w=!1))),$.$set(n);const o={};!z&&1&e&&(z=!0,o.route=t[0],X((()=>z=!1))),L.$set(o);let s=N;N=Q(t),N!==s&&(ot(),lt(Z[s],1,1,(()=>{Z[s]=null})),st(),q=Z[N],q||(q=Z[N]=V[N](t),q.c()),it(q,1),q.m(j,null)),t[1]?Y?(Y.p(t,e),2&e&&it(Y,1)):(Y=Oe(t),Y.c(),it(Y,1),Y.m(F,null)):Y&&(ot(),lt(Y,1,1,(()=>{Y=null})),st()),(!W||2&e)&&E(F,"noprint",!t[1])},i(t){W||(it(a.$$.fragment,t),it($.$$.fragment,t),it(L.$$.fragment,t),it(q),it(Y),W=!0)},o(t){lt(a.$$.fragment,t),lt($.$$.fragment,t),lt(L.$$.fragment,t),lt(q),lt(Y),W=!1},d(t){t&&b(e),ht(a),ht($),t&&b(y),t&&b(C),ht(L),t&&b(A),t&&b(F),Z[N].d(),Y&&Y.d(),O=!1,o(B)}}}function Ie(t,e,n){let{route:r}=e,o=!0;return t.$$set=t=>{"route"in t&&n(0,r=t.route)},t.$$.update=()=>{1&t.$$.dirty&&function(t){const e={line:t.line,mapScale:t.mapScale,markers:t.markers,speed:t.speed,start:t.start,title:t.title,timestamp:Date.now()};localStorage.setItem(xt,JSON.stringify(e))}(r)},[r,o,function(){r.title=this.value,n(0,r)},()=>document.getElementById("title").select(),function(t){r=t,n(0,r)},function(t){r=t,n(0,r)},()=>n(1,o=!o)]}class Ke extends bt{constructor(t){super(),gt(this,t,Ie,Be,i,{route:0})}}function Je(e){let n,r,o,s,i,l,a,c,u,f,d,m,h,$,w,y,S,C,_,D,P,L,E,z,A,F;return a=new Ct({props:{name:"draw",big:!0}}),h=new Ct({props:{name:"output",big:!0}}),S=new Vt({props:{topic:"export",label:"Wie geht das?"}}),P=new Ct({props:{name:"upload_file",big:!0}}),{c(){n=k("div"),n.innerHTML='

Marschzeit­tabelle
leicht gemacht.

\n

Übertrage deine Route automatisch in eine Marschzeittabelle.

',r=x(),o=k("div"),s=k("div"),i=k("h2"),l=v("1. Planen "),mt(a.$$.fragment),c=x(),u=k("p"),u.textContent="Route einzeichnen und Wegpunkte benennen - das kennst du bereits.",f=x(),d=k("h2"),m=v("2. Exportieren "),mt(h.$$.fragment),$=x(),w=k("p"),y=v("In wenigen Klicks erledigt. "),mt(S.$$.fragment),C=x(),_=k("h2"),D=v("3. Hochladen "),mt(P.$$.fragment),L=x(),E=k("p"),E.textContent="Jetzt noch Geschwindigkeit, Abreisezeit, Kommentare und Pausen anpassen.",z=x(),A=k("video"),A.innerHTML='',M(n,"class","title svelte-12swpck"),M(i,"class","svelte-12swpck"),M(u,"class","svelte-12swpck"),M(d,"class","svelte-12swpck"),M(w,"class","svelte-12swpck"),M(_,"class","svelte-12swpck"),M(E,"class","svelte-12swpck"),M(s,"class","steps svelte-12swpck"),A.autoplay=!0,A.controls=!0,A.loop=!0,A.muted=!0,M(A,"class","svelte-12swpck"),M(o,"class","tutorial svelte-12swpck")},m(t,e){g(t,n,e),g(t,r,e),g(t,o,e),p(o,s),p(s,i),p(i,l),pt(a,i,null),p(s,c),p(s,u),p(s,f),p(s,d),p(d,m),pt(h,d,null),p(s,$),p(s,w),p(w,y),pt(S,w,null),p(s,C),p(s,_),p(_,D),pt(P,_,null),p(s,L),p(s,E),p(o,z),p(o,A),F=!0},p:t,i(t){F||(it(a.$$.fragment,t),it(h.$$.fragment,t),it(S.$$.fragment,t),it(P.$$.fragment,t),F=!0)},o(t){lt(a.$$.fragment,t),lt(h.$$.fragment,t),lt(S.$$.fragment,t),lt(P.$$.fragment,t),F=!1},d(t){t&&b(n),t&&b(r),t&&b(o),ht(a),ht(h),ht(S),ht(P)}}}class Xe extends bt{constructor(t){super(),gt(this,t,null,Je,i,{})}}class Ue{static WGStoCH(t,e){return[this.WGStoCHy(t,e),this.WGStoCHx(t,e)]}static WGStoCHx(t,e){const n=((t=this.DECtoSEX(t))-169028.66)/1e4,r=((e=this.DECtoSEX(e))-26782.5)/1e4;return 200147.07+308807.95*n+3745.25*Math.pow(r,2)+76.63*Math.pow(n,2)-194.56*Math.pow(r,2)*n+119.79*Math.pow(n,3)}static WGStoCHy(t,e){const n=((t=this.DECtoSEX(t))-169028.66)/1e4,r=((e=this.DECtoSEX(e))-26782.5)/1e4;return 600072.37+211455.93*r-10938.51*r*n-.36*r*Math.pow(n,2)-44.54*Math.pow(r,3)}static CHtoWGS(t,e){return[this.CHtoWGSlng(t,e),this.CHtoWGSlat(t,e)]}static CHtoWGSlat(t,e){const n=(t-6e5)/1e6,r=(e-2e5)/1e6;return 100*(16.9023892+3.238272*r-.270978*Math.pow(n,2)-.002528*Math.pow(r,2)-.0447*Math.pow(n,2)*r-.014*Math.pow(r,3))/36}static CHtoWGSlng(t,e){const n=(t-6e5)/1e6,r=(e-2e5)/1e6;return 100*(2.6779094+4.728982*n+.791484*n*r+.1306*n*Math.pow(r,2)-.0436*Math.pow(n,3))/36}static DECtoSEX(t){const e=parseInt(t),n=parseInt(60*(t-e));return 60*(60*(t-e)-n)+60*n+3600*e}}const Ve=10;function Ze(t){return function(t){return new Promise(((e,n)=>{const r=new FileReader;r.addEventListener("load",(()=>e(r.result))),r.addEventListener("error",n),r.readAsText(t)}))}(t).then((t=>async function(t){const e=(new DOMParser).parseFromString(t,"application/xml");if(e.querySelector("parsererror"))throw{id:"invalid-xml",message:"Die Datei ist nicht in gültigem XML-Format."};return e}(t)),(()=>{throw{id:"file-error",message:"Die Datei konnte nicht gelesen werden."}})).then((e=>t.name.endsWith(".kml")?async function(t){const e=[],n=[],r=t=>{const[e,n]=t.split(",");return Qe(n,e)},o=t.querySelectorAll("Placemark");for(let t of o){const o=t.querySelector(":is(LineString, LinearRing) coordinates");if(o){const t=o.innerHTML.trim().split(" ").map((t=>r(t)));e.push(t)}const s=t.querySelector("Point coordinates");if(s){const e=t.querySelector("name")?.innerHTML?.trim(),o=t.querySelector("description")?.innerHTML?.trim(),i=r(s.innerHTML);null!=e&&n.push({name:e,comment:o,point:i})}}return{lines:e,markers:n}}(e):t.name.endsWith(".gpx")?async function(t){const e=[],n=[],r=t=>Qe(t.getAttribute("lat"),t.getAttribute("lon")),o=t.querySelectorAll("trkseg");for(let t of o){const n=Array.from(t.querySelectorAll("trkpt")).map((t=>r(t)));e.push(n)}const s=t.querySelectorAll("trkpt");for(let t of s){const e=t.querySelector("name")?.innerHTML?.trim(),o=t.querySelector("desc")?.innerHTML?.trim(),s=r(t);null!=e&&n.push({name:e,comment:o,point:s})}if(0===n.length){const e=t.querySelectorAll("wpt");for(let t of e){const e=t.querySelector("name")?.innerHTML?.trim(),o=r(t);null!=e&&n.push({name:e,point:o})}}return{lines:e,markers:n}}(e):void 0)).then((({lines:e,markers:n})=>async function(t,e,n){if(0===t.length)throw{id:"no-line",message:"Die Route enthält keine Linie."};if(e.length<2)throw{id:"no-markers",message:"Die Route enthält weniger als zwei Wegpunkte."};for(;t.length>1;){const e=Ye(t);if(null==e)throw{id:"disjoint-lines",message:"Die Route enthält Linien, die nicht miteinander verbunden sind."};e.reverseFirst&&t[e.i].reverse(),e.reverseSecond&&t[e.j].reverse(),t[e.i].push(...t[e.j]),t.splice(e.j,1)}const r=t[0];let o=null;for(let t=0;tnull==o||!At(t.point,o))).filter((e=>Ft(e.point,r[t])null==t.index&&t!==s));if(e=e.filter((t=>!i.includes(t))),null==s.index)s.index=t;else{const n=Object.assign({},s);n.index=t,e.push(n)}o=s.point}const s=e.filter((t=>null==t.index));if(s.length>0){throw{id:"marker-not-on-line",message:`Wegpunkte nicht in der Nähe von Eckpunkten der Linie: ${s.map((t=>t.name?`"${t.name}"`:Mt(t.point))).join(", ")}.`}}e.sort(((t,e)=>t.index-e.index));for(let t of e)t.break=0;const i=n.substring(0,n.lastIndexOf("."))||n;return{line:r,mapScale:25,markers:e,speed:4,start:0,title:i}}(e,n,t.name))).then((t=>Wt(t)))}function Qe(t,e){const[n,r]=Ue.WGStoCH(Number(t),Number(e));return{x:n,y:r}}function Ye(t){const e=(t,e)=>Ft(t,e)e,s.anchor=null,o=!0},p(e,r){t=e,s.ctx=t,2&r&&n!==(n=t[1])&&ft(n,s)||function(t,e,n){const r=e.slice(),{resolved:o}=t;t.current===t.then&&(r[t.value]=o),t.current===t.catch&&(r[t.error]=o),t.block.p(r,n)}(s,t,r)},i(t){o||(it(s.block),r||J((()=>{r=ct(e,kt,{duration:100}),r.start()})),o=!0)},o(t){for(let t=0;t<3;t+=1){lt(s.blocks[t])}o=!1},d(t){t&&b(e),s.block.d(),s.token=null,s=null}}}function en(e){let n,r,s,i,l,a,c,u,f,d,m,h,$,w,y,_,D,P;h=new Ct({props:{name:"upload_file"}});let L=e[2]&&function(e){let n,r,o,s,i,l,a,c,u,f,d,m,h,$,w,y,C,_=function(t){const e=(Date.now()-t)/1e3/60,n=e/60,r=n/24,o=r/30,s=o/12;return e<1?"gerade eben":n<1?`vor ${Math.round(e)} Minuten`:r<1?`vor ${Math.round(n)} Stunden`:o<1?`vor ${Math.round(r)} Tagen`:s<1?`vor ${Math.round(o)} Monaten`:`vor ${Math.round(s)} Jahren`}(e[2].timestamp)+"";return c=new Ct({props:{name:"schedule"}}),h=new Ct({props:{name:"file_open"}}),{c(){n=k("div"),r=k("h2"),r.textContent="Zuletzt bearbeitet",o=x(),s=k("p"),i=k("b"),i.textContent=`"${e[2].title}"`,l=k("br"),a=x(),mt(c.$$.fragment),u=x(),f=v(_),d=x(),m=k("button"),mt(h.$$.fragment),$=v(" Öffnen"),M(r,"class","svelte-jxf9x4"),M(m,"class","secondary"),M(n,"class","recent svelte-jxf9x4")},m(t,b){g(t,n,b),p(n,r),p(n,o),p(n,s),p(s,i),p(s,l),p(s,a),pt(c,s,null),p(s,u),p(s,f),p(n,d),p(n,m),pt(h,m,null),p(m,$),w=!0,y||(C=S(m,"click",e[3]),y=!0)},p:t,i(t){w||(it(c.$$.fragment,t),it(h.$$.fragment,t),w=!0)},o(t){lt(c.$$.fragment,t),lt(h.$$.fragment,t),w=!1},d(t){t&&b(n),ht(c),ht(h),y=!1,C()}}}(e);return{c(){n=k("div"),r=k("div"),s=k("h2"),s.textContent="Route hochladen",i=x(),l=k("p"),l.innerHTML='Unterstützt sind KML-Dateien von map.geo.admin.ch oder der swisstopo-App, sowie GPX-Dateien von outdooractive.com.',a=x(),c=k("p"),c.textContent="Datei hierher ziehen oder...",u=x(),f=k("input"),d=x(),m=k("button"),mt(h.$$.fragment),$=v(" Datei auswählen"),w=x(),L&&L.c(),M(s,"class","svelte-jxf9x4"),M(f,"type","file"),M(f,"id","upload"),M(f,"accept",".kml, .gpx"),M(f,"class","svelte-jxf9x4"),M(r,"class","upload svelte-jxf9x4"),M(n,"class","import svelte-jxf9x4")},m(t,o){g(t,n,o),p(n,r),p(r,s),p(r,i),p(r,l),p(r,a),p(r,c),p(r,u),p(r,f),p(r,d),p(r,m),pt(h,m,null),p(m,$),p(n,w),L&&L.m(n,null),_=!0,D||(P=[S(f,"change",e[7]),S(m,"click",e[8]),S(r,"drop",C(e[9])),S(r,"dragover",C(e[6]))],D=!0)},p(t,e){t[2]&&L.p(t,e)},i(t){_||(it(h.$$.fragment,t),it(L),y||J((()=>{y=ct(n,kt,{duration:100}),y.start()})),_=!0)},o(t){lt(h.$$.fragment,t),lt(L),_=!1},d(t){t&&b(n),ht(h),L&&L.d(),D=!1,o(P)}}}function nn(t){let e,n,r,o,s,i,l,a,c,u,f,d,m,h,$,w=t[11].message+"";return f=new Ct({props:{name:"refresh"}}),{c(){e=k("h2"),e.textContent="Hoppla!",n=x(),r=k("p"),o=v("Es gab einen Fehler beim Import:"),s=k("br"),i=x(),l=k("b"),a=v(w),c=x(),u=k("button"),mt(f.$$.fragment),d=v(" Nochmal versuchen"),M(e,"class","svelte-jxf9x4"),M(u,"class","secondary")},m(b,w){g(b,e,w),g(b,n,w),g(b,r,w),p(r,o),p(r,s),p(r,i),p(r,l),p(l,a),g(b,c,w),g(b,u,w),pt(f,u,null),p(u,d),m=!0,h||($=S(u,"click",t[4]),h=!0)},p(t,e){(!m||2&e)&&w!==(w=t[11].message+"")&&D(a,w)},i(t){m||(it(f.$$.fragment,t),m=!0)},o(t){lt(f.$$.fragment,t),m=!1},d(t){t&&b(e),t&&b(n),t&&b(r),t&&b(c),t&&b(u),ht(f),h=!1,$()}}}function rn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function on(e){let n,r,o,s,i,l;return i=new fe({}),{c(){n=k("h2"),n.textContent="Route wird gewandert...",r=x(),o=k("br"),s=x(),mt(i.$$.fragment),M(n,"class","svelte-jxf9x4")},m(t,e){g(t,n,e),g(t,r,e),g(t,o,e),g(t,s,e),pt(i,t,e),l=!0},p:t,i(t){l||(it(i.$$.fragment,t),l=!0)},o(t){lt(i.$$.fragment,t),l=!1},d(t){t&&b(n),t&&b(r),t&&b(o),t&&b(s),ht(i,t)}}}function sn(t){let e,n,r,o;const s=[en,tn],i=[];function l(t,e){return null==t[1]?0:1}return e=l(t),n=i[e]=s[e](t),{c(){n.c(),r=y()},m(t,n){i[e].m(t,n),g(t,r,n),o=!0},p(t,[o]){let a=e;e=l(t),e===a?i[e].p(t,o):(ot(),lt(i[a],1,1,(()=>{i[a]=null})),st(),n=i[e],n?n.p(t,o):(n=i[e]=s[e](t),n.c()),it(n,1),n.m(r.parentNode,r))},i(t){o||(it(n),o=!0)},o(t){lt(n),o=!1},d(t){i[e].d(t),t&&b(r)}}}function ln(t,e,n){let r,o,{route:s=null}=e,i=function(){try{return JSON.parse(localStorage.getItem(xt))}catch{return null}}();function l(t){return t.then((t=>new Promise((e=>{Et("import-success"),setTimeout((()=>e(t)),500)})))).then((t=>n(5,s=t))).catch((t=>{throw zt(t.id),t}))}return t.$$set=t=>{"route"in t&&n(5,s=t.route)},t.$$.update=()=>{1&t.$$.dirty&&r&&r[0]&&(Et("upload-file"),n(1,o=l(Ze(r[0]))))},[r,o,i,function(){Et("open-recent"),n(1,o=l(Wt(i)))},function(){n(0,r=null),n(1,o=null)},s,function(e){G.call(this,t,e)},function(){r=this.files,n(0,r)},()=>document.getElementById("upload").click(),t=>n(0,r=t.dataTransfer.files)]}class an extends bt{constructor(t){super(),gt(this,t,ln,sn,i,{route:5})}}function cn(t){let e,n,r,o,s,i,l;function a(e){t[2](e)}let c={};return void 0!==t[0]&&(c.route=t[0]),o=new Ke({props:c}),R.push((()=>dt(o,"route",a))),{c(){e=k("header"),e.innerHTML='❮ startseite',n=x(),r=k("main"),mt(o.$$.fragment),M(e,"class","noprint")},m(t,s){g(t,e,s),g(t,n,s),g(t,r,s),pt(o,r,null),l=!0},p(t,e){const n={};!s&&1&e&&(s=!0,n.route=t[0],X((()=>s=!1))),o.$set(n)},i(t){l||(it(o.$$.fragment,t),J((()=>{l&&(i||(i=ut(r,kt,{},!0)),i.run(1))})),l=!0)},o(t){lt(o.$$.fragment,t),i||(i=ut(r,kt,{},!1)),i.run(0),l=!1},d(t){t&&b(e),t&&b(n),t&&b(r),ht(o),t&&i&&i.end()}}}function un(t){let e,n,r,o,s,i;function l(e){t[1](e)}n=new Xe({});let a={};return void 0!==t[0]&&(a.route=t[0]),o=new an({props:a}),R.push((()=>dt(o,"route",l))),{c(){e=k("main"),mt(n.$$.fragment),r=x(),mt(o.$$.fragment)},m(t,s){g(t,e,s),pt(n,e,null),p(e,r),pt(o,e,null),i=!0},p(t,e){const n={};!s&&1&e&&(s=!0,n.route=t[0],X((()=>s=!1))),o.$set(n)},i(t){i||(it(n.$$.fragment,t),it(o.$$.fragment,t),i=!0)},o(t){lt(n.$$.fragment,t),lt(o.$$.fragment,t),i=!1},d(t){t&&b(e),ht(n),ht(o)}}}function fn(t){let e,n,r,o,s,i,l;document.title=e=(null==t[0]?"":`${t[0].title} - `)+"Marschzeittabelle";const a=[un,cn],c=[];function u(t,e){return null==t[0]?0:1}return r=u(t),o=c[r]=a[r](t),{c(){n=x(),o.c(),s=x(),i=k("footer"),i.innerHTML='marschzeittabelle.ch \n | hilfe\n | quellcode',M(i,"class","svelte-1pxn2rk")},m(t,e){g(t,n,e),c[r].m(t,e),g(t,s,e),g(t,i,e),l=!0},p(t,[n]){(!l||1&n)&&e!==(e=(null==t[0]?"":`${t[0].title} - `)+"Marschzeittabelle")&&(document.title=e);let i=r;r=u(t),r===i?c[r].p(t,n):(ot(),lt(c[i],1,1,(()=>{c[i]=null})),st(),o=c[r],o?o.p(t,n):(o=c[r]=a[r](t),o.c()),it(o,1),o.m(s.parentNode,s))},i(t){l||(it(o),l=!0)},o(t){lt(o),l=!1},d(t){t&&b(n),c[r].d(t),t&&b(s),t&&b(i)}}}function dn(t,e,n){let r;return[r,function(t){r=t,n(0,r)},function(t){r=t,n(0,r)}]}return new class extends bt{constructor(t){super(),gt(this,t,dn,fn,i,{})}}({target:document.body})}(); //# sourceMappingURL=bundle.js.map diff --git a/build/bundle.js.map b/build/bundle.js.map index 6abe4ab..ef96a9e 100644 --- a/build/bundle.js.map +++ b/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"bundle.js","sources":["../../node_modules/svelte/internal/index.mjs","../../node_modules/svelte/easing/index.mjs","../../node_modules/svelte/transition/index.mjs","../../src/modules/storage.js","../../src/components/Icon.svelte","../../src/modules/formatting.js","../../src/modules/logging.js","../../src/modules/vec.js","../../src/modules/geoadmin.js","../../src/modules/route.js","../../src/modules/table.js","../../src/components/HelpLink.svelte","../../src/components/Dialog.svelte","../../src/components/MapScaleDialog.svelte","../../src/components/SpeedDialog.svelte","../../src/components/Spinner.svelte","../../src/components/StartDialog.svelte","../../src/components/Options.svelte","../../src/modules/theme.js","../../src/components/Profile.svelte","../../src/modules/drawing.js","../../src/components/MarkerDialog.svelte","../../src/components/Table.svelte","../../src/components/Editor.svelte","../../src/components/Introduction.svelte","../../src/modules/swisstopo.js","../../src/modules/import.js","../../src/components/Import.svelte","../../src/components/App.svelte","../../src/main.js"],"sourcesContent":["function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\nfunction is_promise(value) {\n return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\nfunction split_css_unit(value) {\n const split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n return split ? [parseFloat(split[1]), split[2] || 'px'] : [value, 'px'];\n}\nconst contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\n/**\n * Resize observer singleton.\n * One listener per element only!\n * https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ\n */\nclass ResizeObserverSingleton {\n constructor(options) {\n this.options = options;\n this._listeners = 'WeakMap' in globals ? new WeakMap() : undefined;\n }\n observe(element, listener) {\n this._listeners.set(element, listener);\n this._getObserver().observe(element, this.options);\n return () => {\n this._listeners.delete(element);\n this._observer.unobserve(element); // this line can probably be removed\n };\n }\n _getObserver() {\n var _a;\n return (_a = this._observer) !== null && _a !== void 0 ? _a : (this._observer = new ResizeObserver((entries) => {\n var _a;\n for (const entry of entries) {\n ResizeObserverSingleton.entries.set(entry.target, entry);\n (_a = this._listeners.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);\n }\n }));\n }\n}\n// Needs to be written like this to pass the tree-shake-test\nResizeObserverSingleton.entries = 'WeakMap' in globals ? new WeakMap() : undefined;\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not \n let children = target.childNodes;\n // If target is , there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction comment(content) {\n return document.createComment(content);\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_immediate_propagation(fn) {\n return function (event) {\n event.stopImmediatePropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction set_dynamic_element_data(tag) {\n return (/-/.test(tag)) ? set_custom_element_data_map : set_attributes;\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction init_binding_group(group) {\n let _inputs;\n return {\n /* push */ p(...inputs) {\n _inputs = inputs;\n _inputs.forEach(input => group.push(input));\n },\n /* remove */ r() {\n _inputs.forEach(input => group.splice(group.indexOf(input), 1));\n }\n };\n}\nfunction init_binding_group_dynamic(group, indexes) {\n let _group = get_binding_group(group);\n let _inputs;\n function get_binding_group(group) {\n for (let i = 0; i < indexes.length; i++) {\n group = group[indexes[i]] = group[indexes[i]] || [];\n }\n return group;\n }\n function push() {\n _inputs.forEach(input => _group.push(input));\n }\n function remove() {\n _inputs.forEach(input => _group.splice(_group.indexOf(input), 1));\n }\n return {\n /* update */ u(new_indexes) {\n indexes = new_indexes;\n const new_group = get_binding_group(group);\n if (new_group !== _group) {\n remove();\n _group = new_group;\n push();\n }\n },\n /* push */ p(...inputs) {\n _inputs = inputs;\n push();\n },\n /* remove */ r: remove\n };\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction claim_comment(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 8, (node) => {\n node.data = '' + data;\n return undefined;\n }, () => comment(data), true);\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.data === data)\n return;\n text.data = data;\n}\nfunction set_data_contenteditable(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n text.data = data;\n}\nfunction set_data_maybe_contenteditable(text, data, attr_value) {\n if (~contenteditable_truthy_values.indexOf(attr_value)) {\n set_data_contenteditable(text, data);\n }\n else {\n set_data(text, data);\n }\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value == null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value, mounting) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n if (!mounting || value !== undefined) {\n select.selectedIndex = -1; // no option should be selected\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked');\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_iframe_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n // see https://github.com/sveltejs/svelte/issues/4233\n fn();\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nconst resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'content-box' });\nconst resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'border-box' });\nconst resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'device-pixel-content-box' });\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n /** #7364 target for