Buckets:

hf-doc-build/doc / diffusers /main /zh /_app /start-hf-doc-builder.js
rtrm's picture
download
raw
24.5 kB
var de=Object.defineProperty,_e=Object.defineProperties;var pe=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var Z=(a,e,t)=>e in a?de(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,w=(a,e)=>{for(var t in e||(e={}))ee.call(e,t)&&Z(a,t,e[t]);if(B)for(var t of B(e))te.call(e,t)&&Z(a,t,e[t]);return a},W=(a,e)=>_e(a,pe(e));var se=(a,e)=>{var t={};for(var r in a)ee.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&B)for(var r of B(a))e.indexOf(r)<0&&te.call(a,r)&&(t[r]=a[r]);return t};import{S as ge,i as me,s as we,e as be,c as ve,a as ye,d as E,b as G,f as N,g as L,t as ke,h as $e,j as Ee,k as Re,l as b,m as Se,n as T,o as v,p as C,q as y,r as Le,u as xe,v as F,w as x,x as I,y as U,z as D,A as q,B as O,C as z,D as Y,E as re}from"./chunks/vendor-hf-doc-builder.js";import{s as Ue,b as Oe}from"./chunks/paths-hf-doc-builder.js";function Ae(a){let e,t,r;const o=[a[1]||{}];var i=a[0][0];function l(s){let n={};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l())),{c(){e&&x(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,n){e&&U(e,s,n),L(s,t,n),r=!0},p(s,n){const c=n&2?D(o,[q(s[1]||{})]):{};if(i!==(i=s[0][0])){if(e){T();const f=e;v(f.$$.fragment,1,0,()=>{O(f,1)}),C()}i?(e=new i(l()),x(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else i&&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&&E(t),e&&O(e,s)}}}function Ne(a){let e,t,r;const o=[a[1]||{}];var i=a[0][0];function l(s){let n={$$slots:{default:[Ve]},$$scope:{ctx:s}};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l(a))),{c(){e&&x(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,n){e&&U(e,s,n),L(s,t,n),r=!0},p(s,n){const c=n&2?D(o,[q(s[1]||{})]):{};if(n&525&&(c.$$scope={dirty:n,ctx:s}),i!==(i=s[0][0])){if(e){T();const f=e;v(f.$$.fragment,1,0,()=>{O(f,1)}),C()}i?(e=new i(l(s)),x(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else i&&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&&E(t),e&&O(e,s)}}}function Pe(a){let e,t,r;const o=[a[2]||{}];var i=a[0][1];function l(s){let n={};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l())),{c(){e&&x(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,n){e&&U(e,s,n),L(s,t,n),r=!0},p(s,n){const c=n&4?D(o,[q(s[2]||{})]):{};if(i!==(i=s[0][1])){if(e){T();const f=e;v(f.$$.fragment,1,0,()=>{O(f,1)}),C()}i?(e=new i(l()),x(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else i&&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&&E(t),e&&O(e,s)}}}function Te(a){let e,t,r;const o=[a[2]||{}];var i=a[0][1];function l(s){let n={$$slots:{default:[Ce]},$$scope:{ctx:s}};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l(a))),{c(){e&&x(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,n){e&&U(e,s,n),L(s,t,n),r=!0},p(s,n){const c=n&4?D(o,[q(s[2]||{})]):{};if(n&521&&(c.$$scope={dirty:n,ctx:s}),i!==(i=s[0][1])){if(e){T();const f=e;v(f.$$.fragment,1,0,()=>{O(f,1)}),C()}i?(e=new i(l(s)),x(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else i&&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&&E(t),e&&O(e,s)}}}function Ce(a){let e,t,r;const o=[a[3]||{}];var i=a[0][2];function l(s){let n={};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l())),{c(){e&&x(e.$$.fragment),t=b()},l(s){e&&I(e.$$.fragment,s),t=b()},m(s,n){e&&U(e,s,n),L(s,t,n),r=!0},p(s,n){const c=n&8?D(o,[q(s[3]||{})]):{};if(i!==(i=s[0][2])){if(e){T();const f=e;v(f.$$.fragment,1,0,()=>{O(f,1)}),C()}i?(e=new i(l()),x(e.$$.fragment),y(e.$$.fragment,1),U(e,t.parentNode,t)):e=null}else i&&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&&E(t),e&&O(e,s)}}}function Ve(a){let e,t,r,o;const i=[Te,Pe],l=[];function s(n,c){return n[0][2]?0:1}return e=s(a),t=l[e]=i[e](a),{c(){t.c(),r=b()},l(n){t.l(n),r=b()},m(n,c){l[e].m(n,c),L(n,r,c),o=!0},p(n,c){let f=e;e=s(n),e===f?l[e].p(n,c):(T(),v(l[f],1,1,()=>{l[f]=null}),C(),t=l[e],t?t.p(n,c):(t=l[e]=i[e](n),t.c()),y(t,1),t.m(r.parentNode,r))},i(n){o||(y(t),o=!0)},o(n){v(t),o=!1},d(n){l[e].d(n),n&&E(r)}}}function ie(a){let e,t=a[5]&&ne(a);return{c(){e=be("div"),t&&t.c(),this.h()},l(r){e=ve(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var o=ye(e);t&&t.l(o),o.forEach(E),this.h()},h(){G(e,"id","svelte-announcer"),G(e,"aria-live","assertive"),G(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){L(r,e,o),t&&t.m(e,null)},p(r,o){r[5]?t?t.p(r,o):(t=ne(r),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(r){r&&E(e),t&&t.d()}}}function ne(a){let e;return{c(){e=ke(a[6])},l(t){e=$e(t,a[6])},m(t,r){L(t,e,r)},p(t,r){r&64&&Ee(e,t[6])},d(t){t&&E(e)}}}function je(a){let e,t,r,o,i;const l=[Ne,Ae],s=[];function n(f,h){return f[0][1]?0:1}e=n(a),t=s[e]=l[e](a);let c=a[4]&&ie(a);return{c(){t.c(),r=Re(),c&&c.c(),o=b()},l(f){t.l(f),r=Se(f),c&&c.l(f),o=b()},m(f,h){s[e].m(f,h),L(f,r,h),c&&c.m(f,h),L(f,o,h),i=!0},p(f,[h]){let u=e;e=n(f),e===u?s[e].p(f,h):(T(),v(s[u],1,1,()=>{s[u]=null}),C(),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=ie(f),c.c(),c.m(o.parentNode,o)):c&&(c.d(1),c=null)},i(f){i||(y(t),i=!0)},o(f){v(t),i=!1},d(f){s[e].d(f),f&&E(r),c&&c.d(f),f&&E(o)}}}function Ie(a,e,t){let{stores:r}=e,{page:o}=e,{components:i}=e,{props_0:l=null}=e,{props_1:s=null}=e,{props_2:n=null}=e;Le("__svelte__",r),xe(r.page.notify);let c=!1,f=!1,h=null;return F(()=>{const u=r.page.subscribe(()=>{c&&(t(5,f=!0),t(6,h=document.title||"untitled page"))});return t(4,c=!0),u}),a.$$set=u=>{"stores"in u&&t(7,r=u.stores),"page"in u&&t(8,o=u.page),"components"in u&&t(0,i=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,n=u.props_2)},a.$$.update=()=>{a.$$.dirty&384&&r.page.set(o)},[i,l,s,n,c,f,h,r,o]}class De extends ge{constructor(e){super();me(this,e,Ie,je,we,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const qe="modulepreload",ae={},ze="/docs/diffusers/main/zh/_app/",V=function(e,t){return!t||t.length===0?e():Promise.all(t.map(r=>{if(r=`${ze}${r}`,r in ae)return;ae[r]=!0;const o=r.endsWith(".css"),i=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${i}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":qe,o||(l.as="script",l.crossOrigin=""),l.href=r,document.head.appendChild(l),o)return new Promise((s,n)=>{l.addEventListener("load",s),l.addEventListener("error",n)})})).then(()=>e())},$=[()=>V(()=>import("./pages/__layout.svelte-hf-doc-builder.js"),["pages/__layout.svelte-hf-doc-builder.js","assets/pages/__layout.svelte-hf-doc-builder.css","chunks/vendor-hf-doc-builder.js","chunks/paths-hf-doc-builder.js"]),()=>V(()=>import("./error.svelte-hf-doc-builder.js"),["error.svelte-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js"]),()=>V(()=>import("./pages/index.mdx-hf-doc-builder.js"),["pages/index.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js"]),()=>V(()=>import("./pages/installation.mdx-hf-doc-builder.js"),["pages/installation.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js"]),()=>V(()=>import("./pages/quicktour.mdx-hf-doc-builder.js"),["pages/quicktour.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js"])],Je=[[/^\/$/,[$[0],$[2]],[$[1]]],[/^\/installation\/?$/,[$[0],$[3]],[$[1]]],[/^\/quicktour\/?$/,[$[0],$[4]],[$[1]]]],Ke=[$[0](),$[1]()];function Be(a){let e=a.baseURI;if(!e){const t=a.getElementsByTagName("base");e=t.length?t[0].href:a.URL}return e}function We(a,e){return a==="/"||e==="ignore"?a:e==="never"?a.endsWith("/")?a.slice(0,-1):a:e==="always"&&/\/[^./]+$/.test(a)?a+"/":a}const he="sveltekit:scroll";let j={};try{j=JSON.parse(sessionStorage[he])}catch{}function M(a){j[a]=X()}function X(){return{x:pageXOffset,y:pageYOffset}}function oe(a){return a.composedPath().find(t=>t instanceof Node&&t.nodeName.toUpperCase()==="A")}function le(a){return a instanceof SVGAElement?new URL(a.href.baseVal,document.baseURI):new URL(a.href)}class Ye{constructor({base:e,routes:t,trailing_slash:r,renderer:o}){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 i=j[this.current_history_index];i&&scrollTo(i.x,i.y),this.hash_navigating=!1,this.callbacks={before_navigate:[],after_navigate:[]}}init_listeners(){history.scrollRestoration="manual",addEventListener("beforeunload",o=>{let i=!1;const l={from:this.renderer.current.url,to:null,cancel:()=>i=!0};this.callbacks.before_navigate.forEach(s=>s(l)),i?(o.preventDefault(),o.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){M(this.current_history_index);try{sessionStorage[he]=JSON.stringify(j)}catch{}}});const e=o=>{const i=oe(o);i&&i.href&&i.hasAttribute("sveltekit:prefetch")&&this.prefetch(le(i))};let t;const r=o=>{clearTimeout(t),t=setTimeout(()=>{var i;(i=o.target)==null||i.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 i=oe(o);if(!i||!i.href)return;const l=i instanceof SVGAElement,s=le(i);if(s.toString()===location.href){location.hash||o.preventDefault();return}if(!l&&s.origin==="null")return;const c=(i.getAttribute("rel")||"").split(/\s+/);if(i.hasAttribute("download")||c&&c.includes("external")||(l?i.target.baseVal:i.target))return;const[f,h]=s.href.split("#");if(h!==void 0&&f===location.href.split("#")[0]){this.hash_navigating=!0,M(this.current_history_index),this.renderer.update_page_store(new URL(s.href));return}this._navigate({url:s,scroll:i.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 i=this.current_history_index-o.state["sveltekit:index"];history.go(i)}})}}),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:i={}}={},l){const s=new URL(e,Be(document));return this.enabled?this._navigate({url:s,scroll:t?X():null,keepfocus:o,chain:l,details:{state:i,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){F(()=>(this.callbacks.after_navigate.push(e),()=>{const t=this.callbacks.after_navigate.indexOf(e);this.callbacks.after_navigate.splice(t,1)}))}before_navigate(e){F(()=>(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:i,accepted:l,blocked:s}){const n=this.renderer.current.url;let c=!1;const f={from:n,to:e,cancel:()=>c=!0};if(this.callbacks.before_navigate.forEach(_=>_(f)),c){s();return}const h=this.parse(e);if(!h)return location.href=e.href,new Promise(()=>{});M(this.current_history_index),l(),this.navigating++;const u=We(e.pathname,this.trailing_slash);h.url=new URL(e.origin+u+e.search+e.hash);const d=this.navigating_token={};if(await this.renderer.handle_navigation(h,o,!1,{scroll:t,keepfocus:r}),this.navigating--,this.navigating_token===d){if(!this.navigating){const _={from:n,to:e};this.callbacks.after_navigate.forEach(A=>A(_))}if(i){const _=i.replaceState?0:1;i.state["sveltekit:index"]=this.current_history_index+=_,history[i.replaceState?"replaceState":"pushState"](i.state,"",h.url)}}}}function ce(a){return a instanceof Error||a&&a.name&&a.message?a:new Error(JSON.stringify(a))}function Ge(a){let e=5381,t=a.length;if(typeof a=="string")for(;t;)e=e*33^a.charCodeAt(--t);else for(;t;)e=e*33^a[--t];return(e>>>0).toString(36)}function fe(a){const e=a.status&&a.status>=400&&a.status<=599&&!a.redirect;if(a.error||e){const t=a.status;if(!a.error&&e)return{status:t||500,error:new Error};const r=typeof a.error=="string"?new Error(a.error):a.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(a.redirect){if(!a.status||Math.floor(a.status/100)!==3)return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if(typeof a.redirect!="string")return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}if(a.context)throw new Error('You are returning "context" from a load function. "context" was renamed to "stuff", please adjust your code accordingly.');return a}function ue(a){const e=Y(a);let t=!0;function r(){t=!0,e.update(l=>l)}function o(l){t=!1,e.set(l)}function i(l){let s;return e.subscribe(n=>{(s===void 0||t&&n!==s)&&l(s=n)})}return{notify:r,set:o,subscribe:i}}function Me(){const{set:a,subscribe:e}=Y(!1),t="1695496514792";let r;async function o(){clearTimeout(r);const l=await fetch(`${Oe}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(l.ok){const{version:s}=await l.json(),n=s!==t;return n&&(a(!0),clearTimeout(r)),n}else throw new Error(`Version check failed: ${l.status}`)}return{subscribe:e,check:o}}function Fe(a,e){const t=typeof a=="string"?a:a.url;let r=`script[data-type="svelte-data"][data-url=${JSON.stringify(t)}]`;e&&typeof e.body=="string"&&(r+=`[data-body="${Ge(e.body)}"]`);const o=document.querySelector(r);if(o&&o.textContent){const i=JSON.parse(o.textContent),{body:l}=i,s=se(i,["body"]);return Promise.resolve(new Response(l,s))}return fetch(a,e)}class Xe{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:ue({}),page:ue({}),navigating:Y(null),session:Y(o),updated:Me()},this.$session=null,this.root=null;let i=!1;this.stores.session.subscribe(async l=>{if(this.$session=l,!i||!this.router)return;this.session_id+=1;const s=this.router.parse(new URL(location.href));s&&this.update(s,[],!0)}),i=!0}disable_scroll_handling(){(this.updating||!this.started)&&(this.autoscroll=!1)}async start({status:e,error:t,nodes:r,params:o}){const i=new URL(location.href),l=[];let s={},n,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:i,params:o,stuff:s,status:h?e:void 0,error:h?t:void 0,props:u});if(u&&(d.uses.dependencies.add(i.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:i}}else d.loaded.stuff&&(s=w(w({},s),d.loaded.stuff))}n=c?await this._load_error(c):await this._get_navigation_result_from_branch({url:i,params:o,stuff:s,branch:l,status:e,error:t})}catch(f){if(t)throw f;n=await this._load_error({status:500,error:ce(f),url:i})}if(n.redirect){location.href=new URL(n.redirect,location.href).href;return}this._init(n)}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 n,c,f;const i=this.token={};let l=await this._get_navigation_result(e,r);if(!l){location.href=e.url.href;return}if(i!==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,{},[...t,e.url.pathname]):location.href=new URL(l.redirect,location.href).href;return}else if(((c=(n=l.props)==null?void 0:n.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 re(),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 re();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 i=r+1;for(;i<e.routes.length;){const s=e.routes[i];if(s[0].toString()===o[0].toString())s[1].forEach(n=>n()),i+=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:i,error:l}){const s=o.filter(Boolean),n=s.find(u=>u.loaded&&u.loaded.redirect),c={redirect:n&&n.loaded?n.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:i,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),R(),clearTimeout(A)},A=setTimeout(_,h*1e3),R=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:i,stuff:l,props:s}){const n={module:r,uses:{params:new Set,url:!1,session:!1,stuff:!1,dependencies:new Set},loaded:null,stuff:l};s&&n.uses.dependencies.add(o.href);const c={};for(const h in i)Object.defineProperty(c,h,{get(){return n.uses.params.add(h),i[h]},enumerable:!0});const f=this.$session;if(r.load){const{started:h}=this,u={params:c,props:s||{},get url(){return n.uses.url=!0,o},get session(){return n.uses.session=!0,f},get stuff(){return n.uses.stuff=!0,w({},l)},fetch(_,A){const R=typeof _=="string"?_:_.url,{href:S}=new URL(R,o);return n.uses.dependencies.add(S),h?fetch(_,A):Fe(_,A)}};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");n.loaded=fe(d),n.loaded.stuff&&(n.stuff=n.loaded.stuff)}else s&&(n.loaded=fe({props:s}));return n}async _load({route:e,info:{url:t,path:r}},o){const i=t.pathname+t.search;if(!o){const p=this.cache.get(i);if(p)return p}const[l,s,n,c,f]=e,h=c?c(l.exec(r)):{},u=this.current.url&&{url:i!==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=[],_={},A=!1,R=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(P=>k.uses.params.has(P))||u.session&&k.uses.session||Array.from(k.uses.dependencies).some(P=>this.invalid.has(P))||A&&k.uses.stuff){let P={};const H=f&&p===s.length-1;if(H){const K=await fetch(`${t.pathname}${t.pathname.endsWith("/")?"":"/"}__data.json${t.search}`,{headers:{"x-sveltekit-load":"true"}});if(K.ok){const Q=K.headers.get("x-sveltekit-location");if(Q)return{redirect:Q,props:{},state:this.current};P=await K.json()}else R=K.status,S=new Error("Failed to load data")}if(S||(g=await this._load_node({module:m,url:t,params:h,props:P,stuff:_})),g&&(H&&(g.uses.url=!0),g.loaded)){if(g.loaded.fallthrough)return;if(g.loaded.error&&(R=g.loaded.status,S=g.loaded.error),g.loaded.redirect)return{redirect:g.loaded.redirect,props:{},state:this.current};g.loaded.stuff&&(A=!0)}}else g=k}catch(m){R=500,S=ce(m)}if(S){for(;p--;)if(n[p]){let m,k,J=p;for(;!(k=d[J]);)J-=1;try{if(m=await this._load_node({status:R,error:S,module:await n[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:R,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:R,error:S})}async _load_error({status:e,error:t,url:r}){var c,f;const o={},i=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:i&&i.loaded&&i.loaded.stuff||{}}),s=[i,l],n=w(w({},(c=i==null?void 0:i.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:n,branch:s,status:e,error:t})}}async function et({paths:a,target:e,session:t,route:r,spa:o,trailing_slash:i,hydrate:l}){const s=new Xe({Root:De,fallback:Ke,target:e,session:t}),n=r?new Ye({base:a.base,routes:Je,trailing_slash:i,renderer:s}):null;Ue(a),l&&await s.start(l),n&&(o&&n.goto(location.href,{replaceState:!0},[]),n.init_listeners()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{et as start};

Xet Storage Details

Size:
24.5 kB
·
Xet hash:
db805897343c0cd51ac2c03c53131857a00c4ddb2b7e0a945a05c2caf79c4ba3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.