mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-10 17:10:06 -04:00
1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
var me=Object.defineProperty,we=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var se=(i,e,t)=>e in i?me(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,w=(i,e)=>{for(var t in e||(e={}))re.call(e,t)&&se(i,t,e[t]);if(B)for(var t of B(e))ie.call(e,t)&&se(i,t,e[t]);return i},W=(i,e)=>we(i,be(e));var ne=(i,e)=>{var t={};for(var r in i)re.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&B)for(var r of B(i))e.indexOf(r)<0&&ie.call(i,r)&&(t[r]=i[r]);return t};var ve=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var ae=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)};var Y=(i,e,t)=>(ve(i,e,"access private method"),t);import{S as ye,i as ke,s as $e,e as Ee,c as Se,a as Re,d as $,b as M,f as N,g as R,t as Le,h as Ue,j as xe,k as Ne,l as b,m as Oe,n as C,o as v,p as P,q as y,r as Ae,u as Ce,v as Q,w as L,x as I,y as U,z as D,A as q,B as x,C as z,D as G,E as oe}from"./chunks/vendor-dedc54d0.js";function Pe(i){let e,t,r;const o=[i[1]||{}];var n=i[0][0];function l(s){let a={};for(let c=0;c<o.length;c+=1)a=z(a,o[c]);return{props:a}}return n&&(e=new n(l())),{c(){e&&L(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,a){e&&U(e,s,a),R(s,t,a),r=!0},p(s,a){const c=a&2?D(o,[q(s[1]||{})]):{};if(n!==(n=s[0][0])){if(e){C();const f=e;v(f.$$.fragment,1,0,()=>{x(f,1)}),P()}n?(e=new n(l()),L(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else n&&e.$set(c)},i(s){r||(e&&y(e.$$.fragment,s),r=!0)},o(s){e&&v(e.$$.fragment,s),r=!1},d(s){s&&$(t),e&&x(e,s)}}}function Te(i){let e,t,r;const o=[i[1]||{}];var n=i[0][0];function l(s){let a={$$slots:{default:[De]},$$scope:{ctx:s}};for(let c=0;c<o.length;c+=1)a=z(a,o[c]);return{props:a}}return n&&(e=new n(l(i))),{c(){e&&L(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,a){e&&U(e,s,a),R(s,t,a),r=!0},p(s,a){const c=a&2?D(o,[q(s[1]||{})]):{};if(a&525&&(c.$$scope={dirty:a,ctx:s}),n!==(n=s[0][0])){if(e){C();const f=e;v(f.$$.fragment,1,0,()=>{x(f,1)}),P()}n?(e=new n(l(s)),L(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else n&&e.$set(c)},i(s){r||(e&&y(e.$$.fragment,s),r=!0)},o(s){e&&v(e.$$.fragment,s),r=!1},d(s){s&&$(t),e&&x(e,s)}}}function je(i){let e,t,r;const o=[i[2]||{}];var n=i[0][1];function l(s){let a={};for(let c=0;c<o.length;c+=1)a=z(a,o[c]);return{props:a}}return n&&(e=new n(l())),{c(){e&&L(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,a){e&&U(e,s,a),R(s,t,a),r=!0},p(s,a){const c=a&4?D(o,[q(s[2]||{})]):{};if(n!==(n=s[0][1])){if(e){C();const f=e;v(f.$$.fragment,1,0,()=>{x(f,1)}),P()}n?(e=new n(l()),L(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else n&&e.$set(c)},i(s){r||(e&&y(e.$$.fragment,s),r=!0)},o(s){e&&v(e.$$.fragment,s),r=!1},d(s){s&&$(t),e&&x(e,s)}}}function Ve(i){let e,t,r;const o=[i[2]||{}];var n=i[0][1];function l(s){let a={$$slots:{default:[Ie]},$$scope:{ctx:s}};for(let c=0;c<o.length;c+=1)a=z(a,o[c]);return{props:a}}return n&&(e=new n(l(i))),{c(){e&&L(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,a){e&&U(e,s,a),R(s,t,a),r=!0},p(s,a){const c=a&4?D(o,[q(s[2]||{})]):{};if(a&521&&(c.$$scope={dirty:a,ctx:s}),n!==(n=s[0][1])){if(e){C();const f=e;v(f.$$.fragment,1,0,()=>{x(f,1)}),P()}n?(e=new n(l(s)),L(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else n&&e.$set(c)},i(s){r||(e&&y(e.$$.fragment,s),r=!0)},o(s){e&&v(e.$$.fragment,s),r=!1},d(s){s&&$(t),e&&x(e,s)}}}function Ie(i){let e,t,r;const o=[i[3]||{}];var n=i[0][2];function l(s){let a={};for(let c=0;c<o.length;c+=1)a=z(a,o[c]);return{props:a}}return n&&(e=new n(l())),{c(){e&&L(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,a){e&&U(e,s,a),R(s,t,a),r=!0},p(s,a){const c=a&8?D(o,[q(s[3]||{})]):{};if(n!==(n=s[0][2])){if(e){C();const f=e;v(f.$$.fragment,1,0,()=>{x(f,1)}),P()}n?(e=new n(l()),L(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else n&&e.$set(c)},i(s){r||(e&&y(e.$$.fragment,s),r=!0)},o(s){e&&v(e.$$.fragment,s),r=!1},d(s){s&&$(t),e&&x(e,s)}}}function De(i){let e,t,r,o;const n=[Ve,je],l=[];function s(a,c){return a[0][2]?0:1}return e=s(i),t=l[e]=n[e](i),{c(){t.c(),r=b()},l(a){t.l(a),r=b()},m(a,c){l[e].m(a,c),R(a,r,c),o=!0},p(a,c){let f=e;e=s(a),e===f?l[e].p(a,c):(C(),v(l[f],1,1,()=>{l[f]=null}),P(),t=l[e],t?t.p(a,c):(t=l[e]=n[e](a),t.c()),y(t,1),t.m(r.parentNode,r))},i(a){o||(y(t),o=!0)},o(a){v(t),o=!1},d(a){l[e].d(a),a&&$(r)}}}function le(i){let e,t=i[5]&&ce(i);return{c(){e=Ee("div"),t&&t.c(),this.h()},l(r){e=Se(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var o=Re(e);t&&t.l(o),o.forEach($),this.h()},h(){M(e,"id","svelte-announcer"),M(e,"aria-live","assertive"),M(e,"aria-atomic","true"),N(e,"position","absolute"),N(e,"left","0"),N(e,"top","0"),N(e,"clip","rect(0 0 0 0)"),N(e,"clip-path","inset(50%)"),N(e,"overflow","hidden"),N(e,"white-space","nowrap"),N(e,"width","1px"),N(e,"height","1px")},m(r,o){R(r,e,o),t&&t.m(e,null)},p(r,o){r[5]?t?t.p(r,o):(t=ce(r),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(r){r&&$(e),t&&t.d()}}}function ce(i){let e;return{c(){e=Le(i[6])},l(t){e=Ue(t,i[6])},m(t,r){R(t,e,r)},p(t,r){r&64&&xe(e,t[6])},d(t){t&&$(e)}}}function qe(i){let e,t,r,o,n;const l=[Te,Pe],s=[];function a(f,h){return f[0][1]?0:1}e=a(i),t=s[e]=l[e](i);let c=i[4]&&le(i);return{c(){t.c(),r=Ne(),c&&c.c(),o=b()},l(f){t.l(f),r=Oe(f),c&&c.l(f),o=b()},m(f,h){s[e].m(f,h),R(f,r,h),c&&c.m(f,h),R(f,o,h),n=!0},p(f,[h]){let u=e;e=a(f),e===u?s[e].p(f,h):(C(),v(s[u],1,1,()=>{s[u]=null}),P(),t=s[e],t?t.p(f,h):(t=s[e]=l[e](f),t.c()),y(t,1),t.m(r.parentNode,r)),f[4]?c?c.p(f,h):(c=le(f),c.c(),c.m(o.parentNode,o)):c&&(c.d(1),c=null)},i(f){n||(y(t),n=!0)},o(f){v(t),n=!1},d(f){s[e].d(f),f&&$(r),c&&c.d(f),f&&$(o)}}}function ze(i,e,t){let{stores:r}=e,{page:o}=e,{components:n}=e,{props_0:l=null}=e,{props_1:s=null}=e,{props_2:a=null}=e;Ae("__svelte__",r),Ce(r.page.notify);let c=!1,f=!1,h=null;return Q(()=>{const u=r.page.subscribe(()=>{c&&(t(5,f=!0),t(6,h=document.title||"untitled page"))});return t(4,c=!0),u}),i.$$set=u=>{"stores"in u&&t(7,r=u.stores),"page"in u&&t(8,o=u.page),"components"in u&&t(0,n=u.components),"props_0"in u&&t(1,l=u.props_0),"props_1"in u&&t(2,s=u.props_1),"props_2"in u&&t(3,a=u.props_2)},i.$$.update=()=>{i.$$.dirty&384&&r.page.set(o)},[n,l,s,a,c,f,h,r,o]}class Je extends ye{constructor(e){super();ke(this,e,ze,qe,$e,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const Ke="modulepreload",fe={},Be="/_app/",F=function(e,t){return!t||t.length===0?e():Promise.all(t.map(r=>{if(r=`${Be}${r}`,r in fe)return;fe[r]=!0;const o=r.endsWith(".css"),n=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${n}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":Ke,o||(l.as="script",l.crossOrigin=""),l.href=r,document.head.appendChild(l),o)return new Promise((s,a)=>{l.addEventListener("load",s),l.addEventListener("error",a)})})).then(()=>e())},V=[()=>F(()=>import("./pages/__layout.svelte-b87d0c05.js"),["pages/__layout.svelte-b87d0c05.js","chunks/vendor-dedc54d0.js"]),()=>F(()=>import("./error.svelte-aa63ee3d.js"),["error.svelte-aa63ee3d.js","chunks/vendor-dedc54d0.js"]),()=>F(()=>import("./pages/index.svelte-1502efd3.js"),["pages/index.svelte-1502efd3.js","chunks/vendor-dedc54d0.js"])],We=[[/^\/$/,[V[0],V[2]],[V[1]]]],Ye=[V[0](),V[1]()];function Ge(i){let e=i.baseURI;if(!e){const t=i.getElementsByTagName("base");e=t.length?t[0].href:i.URL}return e}let Z="";function Me(i){Z=i.base,i.assets}function Fe(i,e){return i==="/"||e==="ignore"?i:e==="never"?i.endsWith("/")?i.slice(0,-1):i:e==="always"&&/\/[^./]+$/.test(i)?i+"/":i}const ge="sveltekit:scroll";let j={};try{j=JSON.parse(sessionStorage[ge])}catch{}function X(){return{x:pageXOffset,y:pageYOffset}}function ue(i){return i.composedPath().find(t=>t instanceof Node&&t.nodeName.toUpperCase()==="A")}function he(i){return i instanceof SVGAElement?new URL(i.href.baseVal,document.baseURI):new URL(i.href)}var T,H;class Xe{constructor({base:e,routes:t,trailing_slash:r,renderer:o}){ae(this,T);var l,s;this.base=e,this.routes=t,this.trailing_slash=r,this.navigating=0,this.renderer=o,o.router=this,this.enabled=!0,this.initialized=!1,document.body.setAttribute("tabindex","-1"),this.current_history_index=(s=(l=history.state)==null?void 0:l["sveltekit:index"])!=null?s:0,this.current_history_index===0&&history.replaceState(W(w({},history.state),{"sveltekit:index":0}),"",location.href);const n=j[this.current_history_index];n&&scrollTo(n.x,n.y),this.hash_navigating=!1,this.callbacks={before_navigate:[],after_navigate:[]}}init_listeners(){history.scrollRestoration="manual",addEventListener("beforeunload",o=>{let n=!1;const l={from:this.renderer.current.url,to:null,cancel:()=>n=!0};this.callbacks.before_navigate.forEach(s=>s(l)),n?(o.preventDefault(),o.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){Y(this,T,H).call(this);try{sessionStorage[ge]=JSON.stringify(j)}catch{}}});const e=o=>{const n=ue(o);n&&n.href&&n.hasAttribute("sveltekit:prefetch")&&this.prefetch(he(n))};let t;const r=o=>{clearTimeout(t),t=setTimeout(()=>{var n;(n=o.target)==null||n.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",e),addEventListener("mousemove",r),addEventListener("sveltekit:trigger_prefetch",e),addEventListener("click",o=>{if(!this.enabled||o.button||o.which!==1||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||o.defaultPrevented)return;const n=ue(o);if(!n||!n.href)return;const l=he(n);if(l.toString()===location.href){location.hash||o.preventDefault();return}const a=(n.getAttribute("rel")||"").split(/\s+/);if(n.hasAttribute("download")||a&&a.includes("external")||(n instanceof SVGAElement?n.target.baseVal:n.target))return;const[c,f]=l.href.split("#");if(f!==void 0&&c===location.href.split("#")[0]){this.hash_navigating=!0,Y(this,T,H).call(this),this.renderer.update_page_store(new URL(l.href));return}this._navigate({url:l,scroll:n.hasAttribute("sveltekit:noscroll")?X():null,keepfocus:!1,chain:[],details:{state:{},replaceState:!1},accepted:()=>o.preventDefault(),blocked:()=>o.preventDefault()})}),addEventListener("popstate",o=>{if(o.state&&this.enabled){if(o.state["sveltekit:index"]===this.current_history_index)return;this._navigate({url:new URL(location.href),scroll:j[o.state["sveltekit:index"]],keepfocus:!1,chain:[],details:null,accepted:()=>{this.current_history_index=o.state["sveltekit:index"]},blocked:()=>{const n=this.current_history_index-o.state["sveltekit:index"];history.go(n)}})}}),addEventListener("hashchange",()=>{this.hash_navigating&&(this.hash_navigating=!1,history.replaceState(W(w({},history.state),{"sveltekit:index":++this.current_history_index}),"",location.href))}),this.initialized=!0}owns(e){return e.origin===location.origin&&e.pathname.startsWith(this.base)}parse(e){if(this.owns(e)){const t=decodeURI(e.pathname.slice(this.base.length)||"/");return{id:e.pathname+e.search,routes:this.routes.filter(([r])=>r.test(t)),url:e,path:t,initial:!this.initialized}}}async goto(e,{noscroll:t=!1,replaceState:r=!1,keepfocus:o=!1,state:n={}}={},l){const s=new URL(e,Ge(document));return this.enabled?this._navigate({url:s,scroll:t?X():null,keepfocus:o,chain:l,details:{state:n,replaceState:r},accepted:()=>{},blocked:()=>{}}):(location.href=s.href,new Promise(()=>{}))}enable(){this.enabled=!0}disable(){this.enabled=!1}async prefetch(e){const t=this.parse(e);if(!t)throw new Error("Attempted to prefetch a URL that does not belong to this app");return this.renderer.load(t)}after_navigate(e){Q(()=>(this.callbacks.after_navigate.push(e),()=>{const t=this.callbacks.after_navigate.indexOf(e);this.callbacks.after_navigate.splice(t,1)}))}before_navigate(e){Q(()=>(this.callbacks.before_navigate.push(e),()=>{const t=this.callbacks.before_navigate.indexOf(e);this.callbacks.before_navigate.splice(t,1)}))}async _navigate({url:e,scroll:t,keepfocus:r,chain:o,details:n,accepted:l,blocked:s}){const a=this.renderer.current.url;let c=!1;const f={from:a,to:e,cancel:()=>c=!0};if(this.callbacks.before_navigate.forEach(d=>d(f)),c){s();return}const h=this.parse(e);if(!h)return location.href=e.href,new Promise(()=>{});Y(this,T,H).call(this),l(),this.navigating||dispatchEvent(new CustomEvent("sveltekit:navigation-start")),this.navigating++;const u=Fe(e.pathname,this.trailing_slash);if(h.url=new URL(e.origin+u+e.search+e.hash),n){const d=n.replaceState?0:1;n.state["sveltekit:index"]=this.current_history_index+=d,history[n.replaceState?"replaceState":"pushState"](n.state,"",h.url)}if(await this.renderer.handle_navigation(h,o,!1,{scroll:t,keepfocus:r}),this.navigating--,!this.navigating){dispatchEvent(new CustomEvent("sveltekit:navigation-end"));const d={from:a,to:e};this.callbacks.after_navigate.forEach(_=>_(d))}}}T=new WeakSet,H=function(){j[this.current_history_index]=X()};function de(i){return i instanceof Error||i&&i.name&&i.message?i:new Error(JSON.stringify(i))}function He(i){let e=5381,t=i.length;if(typeof i=="string")for(;t;)e=e*33^i.charCodeAt(--t);else for(;t;)e=e*33^i[--t];return(e>>>0).toString(36)}function _e(i){const e=i.status&&i.status>=400&&i.status<=599&&!i.redirect;if(i.error||e){const t=i.status;if(!i.error&&e)return{status:t||500,error:new Error};const r=typeof i.error=="string"?new Error(i.error):i.error;return r instanceof Error?!t||t<400||t>599?(console.warn('"error" returned from load() without a valid status code \u2014 defaulting to 500'),{status:500,error:r}):{status:t,error:r}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof r}"`)}}if(i.redirect){if(!i.status||Math.floor(i.status/100)!==3)return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if(typeof i.redirect!="string")return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}if(i.context)throw new Error('You are returning "context" from a load function. "context" was renamed to "stuff", please adjust your code accordingly.');return i}function pe(i){const e=G(i);let t=!0;function r(){t=!0,e.update(l=>l)}function o(l){t=!1,e.set(l)}function n(l){let s;return e.subscribe(a=>{(s===void 0||t&&a!==s)&&l(s=a)})}return{notify:r,set:o,subscribe:n}}function Qe(){const{set:i,subscribe:e}=G(!1),t="1645518660819";let r;async function o(){clearTimeout(r);const l=await fetch(`${Z}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(l.ok){const{version:s}=await l.json(),a=s!==t;return a&&(i(!0),clearTimeout(r)),a}else throw new Error(`Version check failed: ${l.status}`)}return{subscribe:e,check:o}}function Ze(i,e){const t=typeof i=="string"?i:i.url;let r=`script[data-type="svelte-data"][data-url=${JSON.stringify(t)}]`;e&&typeof e.body=="string"&&(r+=`[data-body="${He(e.body)}"]`);const o=document.querySelector(r);if(o&&o.textContent){const n=JSON.parse(o.textContent),{body:l}=n,s=ne(n,["body"]);return Promise.resolve(new Response(l,s))}return fetch(i,e)}class et{constructor({Root:e,fallback:t,target:r,session:o}){this.Root=e,this.fallback=t,this.router,this.target=r,this.started=!1,this.session_id=1,this.invalid=new Set,this.invalidating=null,this.autoscroll=!0,this.updating=!1,this.current={url:null,session_id:0,branch:[]},this.cache=new Map,this.loading={id:null,promise:null},this.stores={url:pe({}),page:pe({}),navigating:G(null),session:G(o),updated:Qe()},this.$session=null,this.root=null;let n=!1;this.stores.session.subscribe(async l=>{if(this.$session=l,!n||!this.router)return;this.session_id+=1;const s=this.router.parse(new URL(location.href));s&&this.update(s,[],!0)}),n=!0}disable_scroll_handling(){(this.updating||!this.started)&&(this.autoscroll=!1)}async start({status:e,error:t,nodes:r,params:o}){const n=new URL(location.href),l=[];let s={},a,c;try{for(let f=0;f<r.length;f+=1){const h=f===r.length-1;let u;if(h){const _=document.querySelector('[data-type="svelte-props"]');_&&(u=JSON.parse(_.textContent))}const d=await this._load_node({module:await r[f],url:n,params:o,stuff:s,status:h?e:void 0,error:h?t:void 0,props:u});if(u&&(d.uses.dependencies.add(n.href),d.uses.url=!0),l.push(d),d&&d.loaded)if(d.loaded.error){if(t)throw d.loaded.error;c={status:d.loaded.status,error:d.loaded.error,url:n}}else d.loaded.stuff&&(s=w(w({},s),d.loaded.stuff))}a=c?await this._load_error(c):await this._get_navigation_result_from_branch({url:n,params:o,stuff:s,branch:l,status:e,error:t})}catch(f){if(t)throw f;a=await this._load_error({status:500,error:de(f),url:n})}if(a.redirect){location.href=new URL(a.redirect,location.href).href;return}this._init(a)}async handle_navigation(e,t,r,o){this.started&&this.stores.navigating.set({from:this.current.url,to:e.url}),await this.update(e,t,r,o)}async update(e,t,r,o){var a,c,f;const n=this.token={};let l=await this._get_navigation_result(e,r);if(!l){location.href=e.url.href;return}if(n!==this.token)return;if(this.invalid.clear(),l.redirect)if(t.length>10||t.includes(e.url.pathname))l=await this._load_error({status:500,error:new Error("Redirect loop"),url:e.url});else{this.router?this.router.goto(new URL(l.redirect,e.url).href,{replaceState:!0},[...t,e.url.pathname]):location.href=new URL(l.redirect,location.href).href;return}else if(((c=(a=l.props)==null?void 0:a.page)==null?void 0:c.status)>=400&&await this.stores.updated.check()){location.href=e.url.href;return}if(this.updating=!0,this.started?(this.current=l.state,this.root.$set(l.props),this.stores.navigating.set(null)):this._init(l),o){const{scroll:h,keepfocus:u}=o;if(u||((f=getSelection())==null||f.removeAllRanges(),document.body.focus()),await oe(),this.autoscroll){const d=e.url.hash&&document.getElementById(e.url.hash.slice(1));h?scrollTo(h.x,h.y):d?d.scrollIntoView():scrollTo(0,0)}}else await oe();if(this.loading.promise=null,this.loading.id=null,this.autoscroll=!0,this.updating=!1,l.props.page&&(this.page=l.props.page),!this.router)return;const s=l.state.branch[l.state.branch.length-1];s&&s.module.router===!1?this.router.disable():this.router.enable()}load(e){return this.loading.promise=this._get_navigation_result(e,!1),this.loading.id=e.id,this.loading.promise}invalidate(e){return this.invalid.add(e),this.invalidating||(this.invalidating=Promise.resolve().then(async()=>{const t=this.router&&this.router.parse(new URL(location.href));t&&await this.update(t,[],!0),this.invalidating=null})),this.invalidating}update_page_store(e){this.stores.page.set(W(w({},this.page),{url:e})),this.stores.page.notify()}_init(e){this.current=e.state;const t=document.querySelector("style[data-svelte]");if(t&&t.remove(),this.page=e.props.page,this.root=new this.Root({target:this.target,props:w({stores:this.stores},e.props),hydrate:!0}),this.started=!0,this.router){const r={from:null,to:new URL(location.href)};this.router.callbacks.after_navigate.forEach(o=>o(r))}}async _get_navigation_result(e,t){if(this.loading.id===e.id&&this.loading.promise)return this.loading.promise;for(let r=0;r<e.routes.length;r+=1){const o=e.routes[r];let n=r+1;for(;n<e.routes.length;){const s=e.routes[n];if(s[0].toString()===o[0].toString())s[1].forEach(a=>a()),n+=1;else break}const l=await this._load({route:o,info:e},t);if(l)return l}if(e.initial)return await this._load_error({status:404,error:new Error(`Not found: ${e.url.pathname}`),url:e.url})}async _get_navigation_result_from_branch({url:e,params:t,stuff:r,branch:o,status:n,error:l}){const s=o.filter(Boolean),a=s.find(u=>u.loaded&&u.loaded.redirect),c={redirect:a&&a.loaded?a.loaded.redirect:void 0,state:{url:e,params:t,branch:o,session_id:this.session_id},props:{components:s.map(u=>u.module.default)}};for(let u=0;u<s.length;u+=1){const d=s[u].loaded;c.props[`props_${u}`]=d?await d.props:null}if(!this.current.url||e.href!==this.current.url.href){c.props.page={url:e,params:t,status:n,error:l,stuff:r};const u=(d,_)=>{Object.defineProperty(c.props.page,d,{get:()=>{throw new Error(`$page.${d} has been replaced by $page.url.${_}`)}})};u("origin","origin"),u("path","pathname"),u("query","searchParams")}const f=s[s.length-1],h=f.loaded&&f.loaded.maxage;if(h){const u=e.pathname+e.search;let d=!1;const _=()=>{this.cache.get(u)===c&&this.cache.delete(u),E(),clearTimeout(O)},O=setTimeout(_,h*1e3),E=this.stores.session.subscribe(()=>{d&&_()});d=!0,this.cache.set(u,c)}return c}async _load_node({status:e,error:t,module:r,url:o,params:n,stuff:l,props:s}){const a={module:r,uses:{params:new Set,url:!1,session:!1,stuff:!1,dependencies:new Set},loaded:null,stuff:l};s&&a.uses.dependencies.add(o.href);const c={};for(const h in n)Object.defineProperty(c,h,{get(){return a.uses.params.add(h),n[h]},enumerable:!0});const f=this.$session;if(r.load){const{started:h}=this,u={params:c,props:s||{},get url(){return a.uses.url=!0,o},get session(){return a.uses.session=!0,f},get stuff(){return a.uses.stuff=!0,w({},l)},fetch(_,O){const E=typeof _=="string"?_:_.url,{href:S}=new URL(E,o);return a.uses.dependencies.add(S),h?fetch(_,O):Ze(_,O)}};t&&(u.status=e,u.error=t);const d=await r.load.call(null,u);if(!d)throw new Error("load function must return a value");a.loaded=_e(d),a.loaded.stuff&&(a.stuff=a.loaded.stuff)}else s&&(a.loaded=_e({props:s}));return a}async _load({route:e,info:{url:t,path:r}},o){const n=t.pathname+t.search;if(!o){const p=this.cache.get(n);if(p)return p}const[l,s,a,c,f]=e,h=c?c(l.exec(r)):{},u=this.current.url&&{url:n!==this.current.url.pathname+this.current.url.search,params:Object.keys(h).filter(p=>this.current.params[p]!==h[p]),session:this.session_id!==this.current.session_id};let d=[],_={},O=!1,E=200,S;s.forEach(p=>p());e:for(let p=0;p<s.length;p+=1){let g;try{if(!s[p])continue;const m=await s[p](),k=this.current.branch[p];if(!k||m!==k.module||u.url&&k.uses.url||u.params.some(A=>k.uses.params.has(A))||u.session&&k.uses.session||Array.from(k.uses.dependencies).some(A=>this.invalid.has(A))||O&&k.uses.stuff){let A={};const ee=f&&p===s.length-1;if(ee){const K=await fetch(`${t.pathname}${t.pathname.endsWith("/")?"":"/"}__data.json${t.search}`,{headers:{"x-sveltekit-load":"true"}});if(K.ok){const te=K.headers.get("x-sveltekit-location");if(te)return{redirect:te,props:{},state:this.current};A=await K.json()}else E=K.status,S=new Error("Failed to load data")}if(S||(g=await this._load_node({module:m,url:t,params:h,props:A,stuff:_})),g&&(ee&&(g.uses.url=!0),g.loaded)){if(g.loaded.fallthrough)return;if(g.loaded.error&&(E=g.loaded.status,S=g.loaded.error),g.loaded.redirect)return{redirect:g.loaded.redirect,props:{},state:this.current};g.loaded.stuff&&(O=!0)}}else g=k}catch(m){E=500,S=de(m)}if(S){for(;p--;)if(a[p]){let m,k,J=p;for(;!(k=d[J]);)J-=1;try{if(m=await this._load_node({status:E,error:S,module:await a[p](),url:t,params:h,stuff:k.stuff}),m&&m.loaded&&m.loaded.error)continue;m&&m.loaded&&m.loaded.stuff&&(_=w(w({},_),m.loaded.stuff)),d=d.slice(0,J+1).concat(m);break e}catch{continue}}return await this._load_error({status:E,error:S,url:t})}else g&&g.loaded&&g.loaded.stuff&&(_=w(w({},_),g.loaded.stuff)),d.push(g)}return await this._get_navigation_result_from_branch({url:t,params:h,stuff:_,branch:d,status:E,error:S})}async _load_error({status:e,error:t,url:r}){var c,f;const o={},n=await this._load_node({module:await this.fallback[0],url:r,params:o,stuff:{}}),l=await this._load_node({status:e,error:t,module:await this.fallback[1],url:r,params:o,stuff:n&&n.loaded&&n.loaded.stuff||{}}),s=[n,l],a=w(w({},(c=n==null?void 0:n.loaded)==null?void 0:c.stuff),(f=l==null?void 0:l.loaded)==null?void 0:f.stuff);return await this._get_navigation_result_from_branch({url:r,params:o,stuff:a,branch:s,status:e,error:t})}}async function rt({paths:i,target:e,session:t,route:r,spa:o,trailing_slash:n,hydrate:l}){const s=new et({Root:Je,fallback:Ye,target:e,session:t}),a=r?new Xe({base:i.base,routes:We,trailing_slash:n,renderer:s}):null;Me(i),l&&await s.start(l),a&&(o&&a.goto(location.href,{replaceState:!0},[]),a.init_listeners()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{rt as start};
|