htmlark 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/admin/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  2. package/admin/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  3. package/admin/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  4. package/admin/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  5. package/admin/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  6. package/admin/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  7. package/admin/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  8. package/admin/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  9. package/admin/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  10. package/admin/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  11. package/admin/assets/ibm-plex-sans-cyrillic-400-normal-BTotfTJu.woff +0 -0
  12. package/admin/assets/ibm-plex-sans-cyrillic-400-normal-DZqxrq2p.woff2 +0 -0
  13. package/admin/assets/ibm-plex-sans-cyrillic-500-normal-ByOcLdNv.woff +0 -0
  14. package/admin/assets/ibm-plex-sans-cyrillic-500-normal-CocWQlwt.woff2 +0 -0
  15. package/admin/assets/ibm-plex-sans-cyrillic-600-normal-71GNu3SW.woff2 +0 -0
  16. package/admin/assets/ibm-plex-sans-cyrillic-600-normal-BGq0mW3O.woff +0 -0
  17. package/admin/assets/ibm-plex-sans-cyrillic-ext-400-normal-Dsrv2Tcn.woff +0 -0
  18. package/admin/assets/ibm-plex-sans-cyrillic-ext-400-normal-g30qAdWV.woff2 +0 -0
  19. package/admin/assets/ibm-plex-sans-cyrillic-ext-500-normal-Cs5J6C77.woff2 +0 -0
  20. package/admin/assets/ibm-plex-sans-cyrillic-ext-500-normal-DB5PtV2g.woff +0 -0
  21. package/admin/assets/ibm-plex-sans-cyrillic-ext-600-normal-Bz0x94Yp.woff +0 -0
  22. package/admin/assets/ibm-plex-sans-cyrillic-ext-600-normal-DUMzJB7m.woff2 +0 -0
  23. package/admin/assets/ibm-plex-sans-greek-400-normal-D9ESIMu3.woff +0 -0
  24. package/admin/assets/ibm-plex-sans-greek-400-normal-_efipK4i.woff2 +0 -0
  25. package/admin/assets/ibm-plex-sans-greek-500-normal-CuWXN6rf.woff +0 -0
  26. package/admin/assets/ibm-plex-sans-greek-500-normal-JMMifIXV.woff2 +0 -0
  27. package/admin/assets/ibm-plex-sans-greek-600-normal-D-CqTdkO.woff +0 -0
  28. package/admin/assets/ibm-plex-sans-greek-600-normal-DzTrcv_p.woff2 +0 -0
  29. package/admin/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
  30. package/admin/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
  31. package/admin/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
  32. package/admin/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
  33. package/admin/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
  34. package/admin/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
  35. package/admin/assets/ibm-plex-sans-latin-ext-400-normal-C5H60-Va.woff2 +0 -0
  36. package/admin/assets/ibm-plex-sans-latin-ext-400-normal-RBey6euL.woff +0 -0
  37. package/admin/assets/ibm-plex-sans-latin-ext-500-normal-D0aIdm-b.woff +0 -0
  38. package/admin/assets/ibm-plex-sans-latin-ext-500-normal-DakdToA3.woff2 +0 -0
  39. package/admin/assets/ibm-plex-sans-latin-ext-600-normal-DIrixKbi.woff +0 -0
  40. package/admin/assets/ibm-plex-sans-latin-ext-600-normal-DOrvGEcy.woff2 +0 -0
  41. package/admin/assets/ibm-plex-sans-vietnamese-400-normal-DG4YqDda.woff2 +0 -0
  42. package/admin/assets/ibm-plex-sans-vietnamese-400-normal-fK1oJ5dG.woff +0 -0
  43. package/admin/assets/ibm-plex-sans-vietnamese-500-normal-BEb3_waV.woff +0 -0
  44. package/admin/assets/ibm-plex-sans-vietnamese-500-normal-e4dixQRQ.woff2 +0 -0
  45. package/admin/assets/ibm-plex-sans-vietnamese-600-normal-DgdngZtN.woff +0 -0
  46. package/admin/assets/ibm-plex-sans-vietnamese-600-normal-DpPYBSTl.woff2 +0 -0
  47. package/admin/assets/index-D8MQRCUC.js +2 -0
  48. package/admin/assets/index-lZId_dDk.css +1 -0
  49. package/admin/index.html +2 -2
  50. package/htmlark.mjs +1 -1
  51. package/package.json +1 -1
  52. package/admin/assets/index-D4C2Oc5R.css +0 -1
  53. package/admin/assets/index-DVVG6s3V.js +0 -2
@@ -0,0 +1,2 @@
1
+ (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible,d=()=>{};function f(e){for(var t=0;t<e.length;t++)e[t]()}function p(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var m=1024,h=2048,g=4096,_=8192,v=16384,y=32768,b=1<<25,x=65536,S=1<<19,ee=1<<20,te=1<<25,C=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`component`),se=Symbol(`legacy props`),ce=Symbol(``),le=Symbol(`attributes`),ue=Symbol(`class`),de=Symbol(`style`),fe=Symbol(`text`),pe=Symbol(`form reset`),me=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},he=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),ge={},w=Symbol(`uninitialized`),_e=`http://www.w3.org/1999/xhtml`;function ve(){console.warn(`https://svelte.dev/e/derived_inert`)}function ye(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function be(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function xe(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var T=!1;function Se(e){T=e}var E;function D(e){if(e===null)throw ye(),ge;return E=e}function Ce(){return D(cn(E))}function O(e){if(T){if(cn(E)!==null)throw ye(),ge;E=e}}function we(e=1){if(T){for(var t=e,n=E;t--;)n=cn(n);E=n}}function Te(e=!0){for(var t=0,n=E;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=cn(n);e&&n.remove(),n=i}}function Ee(e){if(!e||e.nodeType!==8)throw ye(),ge;return e.data}function De(e){return e===this.v}function Oe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function ke(e){return!Oe(e,this.v)}function Ae(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function je(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Me(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ne(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Pe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Fe(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ie(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Le(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Re(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ze(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Be(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ve(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}function He(e){let t=e.p;for(;t!==null&&t.c===null;)t=t.p;return t?.c??null}function Ue(e,t){return e===null&&Ae(t),e.c??=new Map(He(e)||void 0)}var k=null;function We(e){k=e}function Ge(e){return Ue(k,`getContext`).get(e)}function Ke(e,t){return Ue(k,`setContext`).set(e,t),t}function qe(e,t=!1,n){k={p:k,i:!1,c:null,e:null,s:e,x:null,r:U,l:null}}function Je(e){var t=k,n=t.e;if(n!==null){t.e=null;for(var r of n)Cn(r)}return e!==void 0&&(t.x=e),t.i=!0,k=t.p,Ye(e)}function Ye(e={}){return i(e,oe,{value:!0}),e}function Xe(){return!0}var Ze=[];function Qe(){var e=Ze;Ze=[],f(e)}function $e(e){if(Ze.length===0&&!Ot){var t=Ze;queueMicrotask(()=>{t===Ze&&Qe()})}Ze.push(e)}function et(){for(;Ze.length>0;)Qe()}var tt=~(h|g|m);function A(e,t){e.f=e.f&tt|t}function nt(e){e.f&512||e.deps===null?A(e,m):A(e,g)}function rt(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=C,rt(t.deps))}function it(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),rt(e.deps),A(e,m)}var at=!1;function ot(e){var t=at;try{return at=!1,[e(),at]}finally{at=t}}var st=!1;function ct(){st||(st=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[pe]?.()})},{capture:!0}))}function lt(e){var t=B,n=U;H(null),Gn(null);try{return e()}finally{H(t),Gn(n)}}function ut(e,t,n,r=n){e.addEventListener(t,()=>lt(n));let i=e[pe];e[pe]=i?()=>{i(),r(!0)}:()=>r(!0),ct()}function dt(e,t,n,r){let i=Xe()?ht:yt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=U,c=ft(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){gn(e,s)}pt()}}var d=mt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>_t(e))).then(u).catch(e=>gn(e,s)).finally(d)}l?l.then(()=>{c(),f(),pt()}):f()}function ft(){var e=U,t=B,n=k,r=j;return function(i=!0){Gn(e),H(t),We(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function pt(e=!0){Gn(null),H(null),We(null),e&&j?.deactivate()}function mt(){var e=U,t=e.b,n=j,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function ht(e){var t=2|h;return U!==null&&(U.f|=S),{ctx:k,deps:null,effects:null,equals:De,f:t,fn:e,reactions:null,rv:0,v:w,wv:0,parent:U,ac:null}}var gt=Symbol(`obsolete`);function _t(e,t,n){let r=U;r===null&&je();var i=void 0,a=Gt(w),o=!B,s=new Set;return Dn(()=>{var t=U,n=p();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==me&&n.reject(e)}).finally(pt)}catch(e){n.reject(e),pt()}var c=j;if(o){if(t.f&32768)var l=mt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(gt);else for(let e of s.values())e.reject(gt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==gt&&(c.activate(),t?(a.f|=ie,qt(a,t)):(a.f&8388608&&(a.f^=ie),qt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),xn(()=>{for(let e of s)e.reject(gt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function vt(e){let t=ht(e);return qn(t),t}function yt(e){let t=ht(e);return t.equals=ke,t}function bt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)z(t[n])}}function xt(e){var t,n=U,r=e.parent;if(!Un&&r!==null&&e.v!==w&&r.f&24576)return ve(),e.v;Gn(r);try{e.f&=~C,bt(e),t=nr(e)}finally{Gn(n)}return t}function St(e){var t=xt(e);if(!e.equals(t)&&(e.wv=$n(),(!j?.is_fork||e.deps===null)&&(j===null?e.v=t:(j.capture(e,t,!0),Et?.capture(e,t,!0)),e.deps===null))){A(e,m);return}Un||(M===null?nt(e):(bn()||j?.is_fork)&&M.set(e,t))}function Ct(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&lt(()=>{t.ac.abort(me),t.ac=null}),t.fn!==null&&(t.teardown=d),ar(t,0),Mn(t))}function wt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&or(t)}var Tt=null,j=null,Et=null,M=null,Dt=null,Ot=!1,kt=!1,At=null,jt=null,Mt=0,Nt=1,Pt=class e{id=Nt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){Tt===null?Tt=this:(Tt.#n=this,this.#t=Tt),Tt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)A(r,h),t(r);for(r of n.m)A(r,g),t(r)}this.#p.add(e)}#g(){this.#e=!0,Mt++>1e3&&(this.#x(),It());for(let e of this.#u)this.#d.delete(e),A(e,h),this.schedule(e);for(let e of this.#d)A(e,g),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=At=[],r=[],i=jt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Vt(e),this.#h()||this.discard(),t}if(j=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(At=null,jt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Bt(e,t);i.length>0&&j.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Et=this,Rt(r),Rt(n),Et=null,this.#s?.resolve();var s=j;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Ut.clear(),s.#g())}#_(e,t,n){e.f^=m;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=m:i&4?t.push(r):er(r)&&(i&16&&this.#d.add(r),or(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),A(i,h),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),j=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)it(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==w&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),M?.set(e,t)),this.is_fork||(e.v=t)}activate(){j=this}deactivate(){j=null,M=null}flush(){try{kt=!0,j=this,this.#g()}finally{Mt=0,Dt=null,At=null,jt=null,kt=!1,j=null,M=null,Ut.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(gt);this.#x(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,$e(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=p()).promise}static ensure(){if(j===null){let t=j=new e;!kt&&!Ot&&$e(()=>{t.#e||t.flush()})}return j}apply(){M=null}schedule(e){if(Dt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(At!==null&&t===U&&(B===null||!(B.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=m}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?Tt=e:t.#t=e,this.linked=!1}}};function Ft(e){var t=Ot;Ot=!0;try{var n;for(e&&(j!==null&&!j.is_fork&&j.flush(),n=e());;){if(et(),j===null)return n;j.flush()}}finally{Ot=t}}function It(){try{Ie()}catch(e){gn(e,Dt)}}var Lt=null;function Rt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&er(r)&&(Lt=new Set,or(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Fn(r),Lt?.size>0)){Ut.clear();for(let e of Lt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Lt.has(n)&&(Lt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||or(n)}}Lt.clear()}}Lt=null}}function zt(e){j.schedule(e)}function Bt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),A(e,m);for(var n=e.first;n!==null;)Bt(n,t),n=n.next}}function Vt(e){A(e,m);for(var t=e.first;t!==null;)Vt(t),t=t.next}var Ht=new Set,Ut=new Map,Wt=!1;function Gt(e,t){return{f:0,v:e,reactions:null,equals:De,rv:0,wv:0}}function N(e,t){let n=Gt(e,t);return qn(n),n}function Kt(e,t=!1,n=!0){let r=Gt(e);return t||(r.equals=ke),r}function P(e,t,n=!1){return B!==null&&(!V||B.f&131072)&&Xe()&&B.f&4325394&&(Kn===null||!Kn.has(e))&&Be(),qt(e,n?Qt(t):t,jt)}function qt(e,t,n=null){if(!e.equals(t)){Un?Ut.set(e,t):Ut.has(e)||Ut.set(e,e.v);var r=Pt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&xt(t),M===null&&nt(t)}e.wv=$n(),Zt(e,h,n),Xe()&&U!==null&&U.f&1024&&!(U.f&96)&&(K===null?Jn([e]):K.push(e)),!r.is_fork&&Ht.size>0&&!Wt&&Jt()}return t}function Jt(){Wt=!1;for(let e of Ht){e.f&1024&&A(e,g);let t;try{t=er(e)}catch{t=!0}t&&or(e)}Ht.clear()}function Yt(e,t=1){var n=q(e),r=t===1?n++:n--;return P(e,n),r}function Xt(e){P(e,e.v+1)}function Zt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Xe(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==U){var l=(c&h)===0;if(l&&A(s,t),c&131072)Ht.add(s);else if(c&2){var u=s;M?.delete(u),c&65536||(c&512&&(U===null||!(U.f&2097152))&&(s.f|=C),Zt(u,g,n))}else if(l){var d=s;c&16&&Lt!==null&&Lt.add(d),n===null?zt(d):n.push(d)}}}}function Qt(t){if(typeof t!=`object`||!t||ae in t||oe in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=N(0),u=null,d=Zn,f=e=>{if(Zn===d)return e();var t=B,n=Zn;H(null),Qn(d);var r=e();return H(t),Qn(n),r};return i&&r.set(`length`,N(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Re();var i=r.get(t);return i===void 0?f(()=>{var e=N(n.value,u);return r.set(t,e),e}):P(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>N(w,u));r.set(t,e),Xt(o)}}else P(n,w),Xt(o);return!0},get(e,n,i){if(n===ae)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>N(Qt(s?e[n]:w),u)),r.set(n,o)),o!==void 0){var c=q(o);return c===w?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=q(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==w)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ae)return!0;var n=r.get(t),i=n!==void 0&&n.v!==w||Reflect.has(e,t);return(n!==void 0||U!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>N(i?Qt(e[t]):w,u)),r.set(t,n)),q(n)===w)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>N(w,u)),r.set(d+``,p)):P(p,w)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>N(void 0,u)),P(c,Qt(n)),r.set(t,c));else{l=c.v!==w;var m=f(()=>Qt(n));P(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&P(g,_+1)}Xt(o)}return!0},ownKeys(e){q(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==w});for(var[n,i]of r)i.v!==w&&!(n in e)&&t.push(n);return t},setPrototypeOf(){ze()}})}function $t(e){try{if(typeof e==`object`&&e&&ae in e)return e[ae]}catch{}return e}function en(e,t){return Object.is($t(e),$t(t))}var tn,nn,rn,an;function on(){if(tn===void 0){tn=window,nn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;rn=a(t,`firstChild`).get,an=a(t,`nextSibling`).get,u(e)&&(e[ue]=void 0,e[le]=null,e[de]=void 0,e.__e=void 0),u(n)&&(n[fe]=void 0)}}function F(e=``){return document.createTextNode(e)}function sn(e){return rn.call(e)}function cn(e){return an.call(e)}function I(e,t){if(!T)return sn(e);var n=sn(E);if(n===null)n=E.appendChild(F());else if(t&&n.nodeType!==3){var r=F();return n?.before(r),D(r),r}return t&&mn(n),D(n),n}function ln(e,t=!1){if(!T){var n=sn(e);return n instanceof Comment&&n.data===``?cn(n):n}if(t){if(E?.nodeType!==3){var r=F();return E?.before(r),D(r),r}mn(E)}return E}function un(e,t=!1){if(!T)return sn(e);var n=I(e,t);return O(e),n}function L(e,t=1,n=!1){let r=T?E:e;for(var i;t--;)i=r,r=cn(r);if(!T)return r;if(n){if(r?.nodeType!==3){var a=F();return r===null?i?.after(a):r.before(a),D(a),a}mn(r)}return D(r),r}function dn(e){e.textContent=``}function fn(){return!1}function pn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function mn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function hn(e){var t=U;if(t===null)return B.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;gn(e,t)}function gn(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function _n(e){U===null&&(B===null&&Fe(e),Pe()),Un&&Ne(e)}function vn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function yn(e,t){var n=U;n!==null&&n.f&8192&&(e|=_);var r={ctx:k,deps:null,nodes:null,f:e|h|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};j?.register_created_effect(r);var i=r;if(e&4)At===null?Pt.ensure().schedule(r):At.push(r);else if(t!==null){try{or(r)}catch(e){throw z(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=x))}if(i!==null&&(i.parent=n,n!==null&&vn(i,n),B!==null&&B.f&2&&!(e&64))){var a=B;(a.effects??=[]).push(i)}return r}function bn(){return B!==null&&!V}function xn(e){let t=yn(8,null);return A(t,m),t.teardown=e,t}function Sn(e){_n(`$effect`);var t=U.f;if(!B&&t&32&&k!==null&&!k.i){var n=k;(n.e??=[]).push(e)}else return Cn(e)}function Cn(e){return yn(4|ee,e)}function wn(e){return _n(`$effect.pre`),yn(8|ee,e)}function Tn(e){Pt.ensure();let t=yn(64|S,e);return(e={})=>new Promise(n=>{e.outro?In(t,()=>{z(t),n(void 0)}):(z(t),n(void 0))})}function En(e){return yn(4,e)}function Dn(e){return yn(re|S,e)}function On(e,t=0){return yn(8|t,e)}function kn(e,t=[],n=[],r=[]){dt(r,t,n,t=>{yn(8,()=>{e(...t.map(q))})})}function An(e,t=0){return yn(16|t,e)}function R(e){return yn(32|S,e)}function jn(e){var t=e.teardown;if(t!==null){let n=Un,r=B;Wn(!0),H(null);try{t.call(null)}catch(t){gn(t,e.parent)}finally{Wn(n),H(r)}}}function Mn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&lt(()=>{e.abort(me)});var r=n.next;n.f&64?n.parent=null:z(n,t),n=r}}function Nn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||z(t),t=n}}function z(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Pn(e.nodes.start,e.nodes.end),n=!0),e.f|=b,Mn(e,t&&!n),ar(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();jn(e),e.f^=b,e.f|=v;var i=e.parent;i!==null&&i.first!==null&&Fn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Pn(e,t){for(;e!==null;){var n=e===t?null:cn(e);e.remove(),e=n}}function Fn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function In(e,t,n=!0){var r=[];e.f|=256,Ln(e,r,!0);var i=()=>{n&&z(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Ln(e,t,n){if(!(e.f&8192)){e.f^=_;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Ln(i,t,o?n:!1)}i=a}}}function Rn(e){e.f&=-257,zn(e,!0)}function zn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=_,e.f&1024||(A(e,h),Pt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);zn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Bn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:cn(n);t.append(n),n=i}}var Vn=null,Hn=!1,Un=!1;function Wn(e){Un=e}var B=null,V=!1;function H(e){B=e}var U=null;function Gn(e){U=e}var Kn=null;function qn(e){B!==null&&(Kn??=new Set).add(e)}var W=null,G=0,K=null;function Jn(e){K=e}var Yn=1,Xn=0,Zn=Xn;function Qn(e){Zn=e}function $n(){return++Yn}function er(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~C),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(er(a)&&St(a),a.wv>e.wv)return!0}t&512&&M===null&&A(e,m)}return!1}function tr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Kn!==null&&Kn.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?tr(a,t,!1):t===a&&(n?A(a,h):a.f&1024&&A(a,g),zt(a))}}function nr(e){var t=W,n=G,r=K,i=B,a=Kn,o=k,s=V,c=Zn,l=e.f;W=null,G=0,K=null,B=l&96?null:e,Kn=null,We(e.ctx),V=!1,Zn=++Xn,e.ac!==null&&(lt(()=>{e.ac.abort(me)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=y;var f=rr(e);if(Xe()&&K!==null&&!V&&f!==null&&!(e.f&6146))for(var p=0;p<K.length;p++)tr(K[p],e);if(i!==null&&i!==e){if(Xn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Xn;if(t!==null)for(let e of t)e.rv=Xn;K!==null&&(r===null?r=K:r.push(...K))}return e.f&8388608&&(e.f^=ie),d}catch(t){return rr(e),hn(t)}finally{e.f^=ne,W=t,G=n,K=r,B=i,Kn=a,We(o),V=s,Zn=c}}function rr(e){var t=e.deps,n=j?.is_fork;if(W!==null){var r;if(n||ar(e,G),t!==null&&G>0)for(t.length=G+W.length,r=0;r<W.length;r++)t[G+r]=W[r];else e.deps=t=W;if(bn()&&e.f&512)for(r=G;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&G<t.length&&(ar(e,G),t.length=G);return t}function ir(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(W===null||!n.call(W,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~C),s.v!==w&&nt(s),s.ac!==null&&lt(()=>{s.ac.abort(me),s.ac=null,A(s,h)}),Ct(s),ar(s,0)}}function ar(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)ir(e,n[r])}function or(e){var t=e.f;if(!(t&16384)){A(e,m);var n=U,r=Hn;U=e,Hn=!(t&96);try{t&16777232?Nn(e):Mn(e),jn(e);var i=nr(e);e.teardown=typeof i==`function`?i:null,e.wv=Yn}finally{Hn=r,U=n}}}async function sr(){await Promise.resolve(),Ft()}function q(e){var t=!!(e.f&2);if(Vn?.add(e),B!==null&&!V&&!(U!==null&&U.f&16384)&&(Kn===null||!Kn.has(e))){var r=B.deps;if(B.f&2097152)e.rv<Xn&&(e.rv=Xn,W===null&&r!==null&&r[G]===e?G++:W===null?W=[e]:W.push(e));else{B.deps??=[],n.call(B.deps,e)||B.deps.push(e);var i=e.reactions;i===null?e.reactions=[B]:n.call(i,B)||i.push(B)}}if(Un&&Ut.has(e))return Ut.get(e);if(t){var a=e;if(Un){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||lr(a))&&(o=xt(a)),Ut.set(a,o),o}var s=!(a.f&512)&&!V&&B!==null&&(Hn||!!(B.f&512)),c=(a.f&y)===0;er(a)&&(s&&(a.f|=512),St(a)),s&&!c&&(wt(a),cr(a))}if(M?.has(e))return M.get(e);if(e.f&8388608)throw e.v;return e.v}function cr(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(wt(t),cr(t))}function lr(e){if(e.v===w)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Ut.has(t)||t.f&2&&lr(t))return!0;return!1}function ur(e){var t=V;try{return V=!0,e()}finally{V=t}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var dr=[`touchstart`,`touchmove`];function fr(e){return dr.includes(e)}var pr=Symbol(`events`),mr=new Set,hr=new Set;function gr(e,t,n){(t[pr]??={})[e]=n}function _r(e){for(var t=0;t<e.length;t++)mr.add(e[t]);for(var n of hr)n(e)}var vr=null,yr=!1;function br(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;vr=e,yr||(yr=!0,setTimeout(()=>{yr=!1,vr=null}));var s=0,c=vr===e&&e[pr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[pr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=B,f=U;H(null),Gn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[pr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[pr]=t,delete e.currentTarget,H(d),Gn(f)}}}var xr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Sr(e){return xr?.createHTML(e)??e}function Cr(e){var t=pn(`template`);return t.innerHTML=Sr(e.replaceAll(`<!>`,`<!---->`)),t.content}function wr(e,t){var n=U;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function J(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(T)return wr(E,null),E;i===void 0&&(i=Cr(a?e:`<!>`+e),n||(i=sn(i)));var t=r||nn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=sn(t),s=t.lastChild;wr(o,s)}else wr(t,t);return t}}function Tr(){if(T)return wr(E,null),E;var e=document.createDocumentFragment(),t=document.createComment(``),n=F();return e.append(t,n),wr(t,n),e}function Y(e,t){if(T){var n=U;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=E),Ce();return}e!==null&&e.before(t)}function Er(e){let t=0,n=Gt(0),r;return()=>{bn()&&(q(n),On(()=>(t===0&&(r=ur(()=>e(()=>Xt(n)))),t+=1,()=>{$e(()=>{--t,t===0&&(r?.(),r=void 0,Xt(n))})})))}}var Dr=x|S;function Or(e,t,n,r){new kr(e,t,n,r)}var kr=class{parent;is_pending=!1;transform_error;#e;#t=T?E:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Er(()=>(this.#m=Gt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=U;t.b=this,t.f|=128,n(e)},this.parent=U.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=An(()=>{if(T){let e=this.#t;Ce();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},Dr),T&&(this.#e=E)}#g(){try{this.#a=R(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);$e(r),t&&(this.#s=R(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){xe();return}t=!0,n&&Ve(),this.#s!==null&&In(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){gn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=R(()=>e(this.#e)),$e(()=>{var e=this.#c=document.createDocumentFragment(),t=F(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return R(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){gn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(j);return}this.#u===0&&(this.#e.before(e),this.#c=null,In(this.#o,()=>{this.#o=null}),this.#x(j))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=R(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Bn(this.#a,e);let t=this.#n.pending;this.#o=R(()=>t(this.#e))}else this.#x(j)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){it(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=U,n=B,r=k;Gn(this.#i),H(this.#i),We(this.#i.ctx);try{return Pt.ensure(),e()}finally{Gn(t),H(n),We(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&In(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,$e(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),q(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;j?.is_fork?(this.#a&&j.skip_effect(this.#a),this.#o&&j.skip_effect(this.#o),this.#s&&j.skip_effect(this.#s),j.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(z(this.#a),null),this.#o&&=(z(this.#o),null),this.#s&&=(z(this.#s),null),T&&(D(this.#t),we(),D(Te()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return R(()=>{var r=U;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return gn(e,this.#i.parent),null}}))};$e(()=>{var t;try{t=this.transform_error(e)}catch(e){gn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>gn(e,this.#i&&this.#i.parent)):n(t)})}};function X(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[fe]??=e.nodeValue)&&(e[fe]=n,e.nodeValue=`${n}`)}function Ar(e,t){return Mr(e,t)}var jr=new Map;function Mr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){on();var l=void 0,u=Tn(()=>{var s=n??t.appendChild(F());Or(s,{pending:()=>{}},t=>{qe({});var n=k;if(o&&(n.c=o),a&&(i.$$events=a),T&&wr(t,null),l=e(t,i)||Ye(),T&&(U.nodes.end=E,E===null||E.nodeType!==8||E.data!==`]`))throw ye(),ge;Je()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=fr(r);for(let e of[t,document]){var a=jr.get(e);a===void 0&&(a=new Map,jr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,br,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(mr)),hr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=jr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,br),r.delete(e),r.size===0&&jr.delete(n)):r.set(e,i)}hr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Nr.set(l,u),l}var Nr=new WeakMap,Pr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Rn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Rn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(z(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Bn(r,t),t.append(F()),this.#n.set(e,{effect:r,fragment:t})}else z(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),In(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(z(n.effect),this.#n.delete(e))};ensure(e,t){var n=j,r=fn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=F();i.append(a),this.#n.set(e,{effect:R(()=>t(a)),fragment:i})}else this.#t.set(e,R(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else T&&(this.anchor=E),this.#a(n)}};function Fr(e,t,n=!1){var r;T&&(r=E,Ce());var i=new Pr(e),a=n?x:0;function o(e,t){if(T){var n=Ee(r);if(e!==parseInt(n.substring(1))){var a=Te();D(a),i.anchor=a,Se(!1),i.ensure(e,t),Se(!0);return}}i.ensure(e,t)}An(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function Ir(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];In(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Lr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;dn(d),d.append(u),e.items.clear()}Lr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Lr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=te,Bn(a,document.createDocumentFragment())):z(t[i],n)}}var Rr;function zr(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=T?D(sn(u)):u.appendChild(F())}T&&Ce();var d=null,f=yt(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Vr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=te,Ur(d,null,c)):Rn(d):In(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:An(()=>{p=q(f);var e=p.length;let t=!1;T&&Ee(c)===`[!`!=(e===0)&&(c=Te(),D(c),Se(!1),t=!0);for(var r=new Set,u=j,v=fn(),y=0;y<e;y+=1){T&&E.nodeType===8&&E.data===`]`&&(c=E,t=!0,Se(!1));var b=p[y],x=a(b,y),S=h?null:l.get(x);S?(S.v&&qt(S.v,b),S.i&&qt(S.i,y),v&&u.unskip_effect(S.e)):(S=Hr(l,h?c:Rr??=F(),b,x,y,o,n,i),h||(S.e.f|=te),l.set(x,S)),r.add(x)}if(e===0&&s&&!d&&(h?d=R(()=>s(c)):(d=R(()=>s(Rr??=F())),d.f|=te)),e>r.size&&Me(``,``,``),T&&e>0&&D(Te()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&Se(!0),q(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,T&&(c=E)}function Br(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Vr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Br(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(Rn(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=te,_===l)Ur(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Wr(e,d,_),Wr(e,_,y),Ur(_,y,n),d=_,p=[],m=[],l=Br(d.next);continue}}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],ee=p[p.length-1];for(x=0;x<p.length;x+=1)Ur(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Wr(e,S.prev,ee.next),Wr(e,d,S),Wr(e,ee,b),l=b,d=ee,--v,p=[],m=[]}else u.delete(_),Ur(_,l,n),Wr(e,_.prev,_.next),Wr(e,_,d===null?e.effect.first:d.next),Wr(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=Br(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=Br(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Lr(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var C=[];if(u!==void 0)for(_ of u)_.f&8192||C.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&C.push(l),l=Br(l.next);var ne=C.length;if(ne>0){var re=i&4&&s===0?n:null;if(o){for(v=0;v<ne;v+=1)C[v].nodes?.a?.measure();for(v=0;v<ne;v+=1)C[v].nodes?.a?.fix()}Ir(e,C,re)}}o&&$e(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Hr(e,t,n,r,i,a,o,s){var c=o&1?o&16?Gt(n):Kt(n,!1,!1):null,l=o&2?Gt(i):null;return{v:c,i:l,e:R(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Ur(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=cn(r);if(a.before(r),r===i)return;r=o}}function Wr(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Gr(e,t,...n){var r=new Pr(e);An(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},x)}var Kr=[...`
2
+ \r\f\xA0\v`];function qr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||Kr.includes(r[o-1]))&&(s===r.length||Kr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Jr(e,t,n,r,i,a){var o=e[ue];if(T||o!==n||o===void 0){var s=qr(n,r,a);(!T||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[ue]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Yr(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function Xr(t,n){var r=t.__defaultValue,i=t.multiple,a=i?r??[]:null;if(!i||e(a)){var o=t.selectedIndex,s=n&&i?new Set(t.selectedOptions):null;for(var c of t.options){var l=ei(c);Yr(c,i?a.includes(l):en(l,r))}if(n){if(s!==null)for(c of t.options){var u=s.has(c);c.selected!==u&&(c.selected=u)}else t.selectedIndex!==o&&(t.selectedIndex=o)}}}function Zr(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return be();for(var i of t.options)i.selected=n.includes(ei(i));return}for(i of t.options)if(en(ei(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function Qr(e){var t=new MutationObserver(t=>{t.every(ti)||(`__defaultValue`in e&&Xr(e,!1),`__value`in e&&Zr(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),xn(()=>{t.disconnect()})}function $r(e,t,n=t){var r=new WeakSet,i=!0;ut(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),ei);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&ei(o)}n(a),e.__value=a,j!==null&&r.add(j)}),En(()=>{var a=t();if(e===document.activeElement){var o=j;if(r.has(o))return}if(Zr(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=ei(s),n(a))}e.__value=a,i=!1})}function ei(e){return`__value`in e?e.__value:e.value}function ti(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var ni=Symbol(`is custom element`),ri=Symbol(`is html`),ii=he?`link`:`LINK`;function ai(e){if(T){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;oi(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;oi(e,`checked`,null),e.checked=r}}};e[pe]=n,$e(n),ct()}}function oi(e,t,n,r){var i=si(e);T&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===ii)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ce]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&li(e).has(t)?e[t]=n:e.setAttribute(t,n))}function si(e){return e[le]??={[ni]:e.nodeName.includes(`-`),[ri]:e.namespaceURI===_e}}var ci=new Map;function li(e){var t=e.getAttribute(`is`)||e.nodeName,n=ci.get(t);if(n)return n;ci.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function ui(e,t,n=t){var r=new WeakSet;ut(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=di(e)?fi(a):a,n(a),j!==null&&r.add(j),await sr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(T&&e.defaultValue!==e.value||ur(t)==null&&e.value)&&(n(di(e)?fi(e.value):e.value),j!==null&&r.add(j)),On(()=>{var n=t();if(e===document.activeElement){var i=j;if(r.has(i))return}di(e)&&n===fi(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}function di(e){var t=e.type;return t===`number`||t===`range`}function fi(e){return e===``?null:+e}function pi(e,t,n,r){var i=!0,o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ht(r),q(u)):(l&&(l=!1,c=s?ur(r):r),c);let f;if(o){var p=ae in e||se in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=ot(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Le(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?ht:yt)(()=>(v=!1,g()));o&&q(y);var b=U;return(function(e,t){if(arguments.length>0){let n=t?q(y):i&&o?Qt(e):e;return P(y,n),v=!0,c!==void 0&&(c=n),e}return Un&&v||b.f&16384?y.v:q(y)})}function mi(e){k===null&&Ae(`onMount`),Sn(()=>{let t=ur(e);if(typeof t==`function`)return t})}function hi(e){k===null&&Ae(`onDestroy`),mi(()=>()=>ur(e))}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var gi={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_i=new class{#e=gi;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function vi(e){setTimeout(e,0)}var yi=typeof window>`u`||`Deno`in globalThis;function Z(){}function bi(e,t){return typeof e==`function`?e(t):e}function xi(e){return typeof e==`number`&&e>=0&&e!==1/0}function Si(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Q(e,t){return typeof e==`function`?e(t):e}function Ci(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Ti(o,t.options))return!1}else if(!Di(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function wi(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ei(t.options.mutationKey)!==Ei(a))return!1}else if(!Di(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ti(e,t){return(t?.queryKeyHashFn||Ei)(e)}function Ei(e){return JSON.stringify(e,(e,t)=>Mi(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Di(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Di(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Di(e[r],t[r]))return!1;return!0}return!1}var Oi=Object.prototype.hasOwnProperty;function ki(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ji(e)&&ji(t);if(!r&&!(Mi(e)&&Mi(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Oi.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ki(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ai(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ji(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Mi(e){if(!Ni(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ni(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ni(e){return Object.prototype.toString.call(e)===`[object Object]`}function Pi(e){return new Promise(t=>{_i.setTimeout(t,e)})}function Fi(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ki(e,t)}function Ii(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Li(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ri=Symbol();function zi(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ri?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Bi(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Vi=()=>yi,Hi=()=>Vi(),Ui=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Wi=new class extends Ui{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Gi=vi;function Ki(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Gi,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var $=Ki(),qi=new class extends Ui{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ji(e){return Math.min(1e3*2**e,3e4)}function Yi(e){return(e??`online`)!==`online`||qi.isOnline()}var Xi=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Zi(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Z);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Xi(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Wi.isFocused()&&(e.networkMode===`always`||qi.isOnline())&&e.canRun(),p=()=>Yi(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Hi()?0:3),a=e.retryDelay??Ji,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Pi(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Qi=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xi(this.gcTime)&&(this.#e=_i.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hi()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_i.clearTimeout(this.#e),this.#e=void 0)}};function $i(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Bi(e,()=>t.signal,()=>n=!0)},u=zi(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Li:Ii;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?ta:ea,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ea(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function ea(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ta(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var na=class extends Qi{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=aa(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=aa(this.options);e.data!==void 0&&(this.setState(ia(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Fi(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Z).catch(Z):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Q(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ri||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Q(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Si(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=zi(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?$i(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Zi({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Xi&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Xi){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...ra(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ia(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),$.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ra(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Yi(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ia(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function aa(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var oa=class extends Ui{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ca(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return la(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return la(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Q(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ai(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ua(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Q(this.options.enabled,this.#t)!==Q(t.enabled,this.#t)||Q(this.options.staleTime,this.#t)!==Q(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Q(this.options.enabled,this.#t)!==Q(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ai(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Z)),t}#h(e){return!Hi()&&Q(this.options.enabled,this.#t)!==!1&&xi(e)}#g(){this.#b();let e=Q(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Si(this.#r.dataUpdatedAt,e)+1;this.#u=_i.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_i.setInterval(()=>{(this.options.refetchIntervalInBackground||Wi.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_i.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_i.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ca(e,t),o=i&&ua(e,n,t,r);(a||o)&&(l={...l,...ra(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Fi(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Fi(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:da(e,t),refetch:this.refetch,isEnabled:Q(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Ai(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();$.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function sa(e,t){return Q(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Q(t.retryOnMount,e)!==!1)}function ca(e,t){return sa(e,t)||e.state.data!==void 0&&la(e,t,t.refetchOnMount)}function la(e,t,n){if(Q(t.enabled,e)!==!1&&Q(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&da(e,t)}return!1}function ua(e,t,n,r){return(e!==t||Q(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&da(e,n)}function da(e,t){return Q(t.enabled,e)!==!1&&e.isStaleByTime(Q(t.staleTime,e))}var fa=class extends Qi{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||pa(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Zi({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),$.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function pa(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ma=class extends Ui{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new fa({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ha(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ha(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ha(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ha(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){$.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>wi(t,e))}findAll(e={}){return this.getAll().filter(t=>wi(e,t))}notify(e){$.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return $.batch(()=>Promise.all(e.map(e=>e.continue().catch(Z))))}};function ha(e){return e.options.scope?.id}var ga=class extends Ui{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ai(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ei(t.mutationKey)!==Ei(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??pa();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){$.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},_a=class extends Ui{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ti(r,t),a=this.get(i);return a||(a=new na({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){$.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ci(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ci(e,t)):t}notify(e){$.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){$.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){$.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},va=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new _a,this.#t=e.mutationCache||new ma,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Wi.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=qi.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Q(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=bi(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return $.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;$.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return $.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=$.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Z).catch(Z)}invalidateQueries(e,t={}){return $.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=$.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Z)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Z)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Q(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Q(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Z).catch(Z)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Z).catch(Z)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return qi.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Ei(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Di(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ei(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Di(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Ti(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ri&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ya=Symbol(`QueryClient`),ba=()=>{let e=Ge(ya);if(!e)throw Error(`No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?`);return e},xa=e=>{Ke(ya,e)},Sa=Symbol(`isRestoring`),Ca=()=>{try{return Ge(Sa)??{current:!1}}catch{return{current:!1}}};function wa(){return Ca()}function Ta(e){return e||ba()}var Ea=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],Da=[`difference`,`intersection`,`symmetricDifference`,`union`],Oa=!1,ka=class e extends Set{#e=new Map;#t=N(0);#n=N(0);#r=Zn||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}Oa||this.#a()}#i(e){return Zn===this.#r?N(e):Gt(e)}#a(){Oa=!0;var t=e.prototype,n=Set.prototype;for(let e of Ea)t[e]=function(...t){return q(this.#t),n[e].apply(this,t)};for(let r of Da)t[r]=function(...t){q(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return q(this.#t),!1;r=this.#i(!0),n.set(e,r)}return q(r),t}add(e){return super.has(e)||(super.add(e),P(this.#n,super.size),Xt(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),P(r,!1)),t&&(P(this.#n,super.size),Xt(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())P(t,!1);e.clear(),P(this.#n,0),Xt(this.#t)}}keys(){return this.values()}values(){return q(this.#t),super.values()}entries(){return q(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return q(this.#n)}};function Aa(e){let t=Array.isArray(e)?[]:{},n=new ka,r=N(0),i=()=>q(r),a=new Proxy(t,{get(e,t,r){return(n.has(t)||!(t in e)||Array.isArray(e)&&t===`length`)&&i(),Reflect.get(e,t,r)},set(e,t,r,i){if(n.delete(t),t in e)return Reflect.set(e,t,r,i);let a=N(r);return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>q(a)&&Na(q(a))?q(a)():q(a),set:e=>{P(a,e)}}),!0},has:(e,t)=>!n.has(t)&&t in e,ownKeys(e){return Reflect.ownKeys(e).filter(e=>!n.has(e))},getOwnPropertyDescriptor(e,t){if(!n.has(t))return Reflect.getOwnPropertyDescriptor(e,t)},deleteProperty(e,t){return t in e&&(e[t]=void 0,n.add(t),Array.isArray(e)&&e.length--,!0)}});function o(e){let t=Object.keys(a),n=Object.keys(e),i=t.filter(e=>!n.includes(e));Array.isArray(e)&&i.sort((e,t)=>Number(t)-Number(e));let o=n.some(e=>!t.includes(e));for(let e of i)delete a[e];for(let t of n)a[t]=Ma(()=>e[t]);(o||i.length>0)&&Yt(r)}return o(e),[a,o]}var ja=Symbol(`LazyValue`);function Ma(e){return e[ja]=!0,e}function Na(e){return!!e[ja]}function Pa(e,t){switch(e){case`post`:Sn(t);break;case`pre`:wn(t)}}var Fa=(e,t,n)=>{let r=!1,i=Array.isArray(e)?[]:void 0;Pa(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!r){r=!0,i=t;return}let a=ur(()=>n(t,i));return i=t,a})};function Ia(e,t,n){let r=vt(()=>Ta(n?.())),i=wa(),a=vt(()=>{let t=q(r).defaultQueryOptions(e());return t._optimisticResults=i.current?`isRestoring`:`optimistic`,t}),o=N(Qt(new t(q(r),q(a))));Fa(()=>q(r),`pre`,()=>{P(o,new t(q(r),q(a)),!0)});function s(){let e=q(o).getOptimisticResult(q(a));return q(a).notifyOnChangeProps?e:q(o).trackResult(e)}let[c,l]=Aa(s());return Sn(()=>{let e=i.current?()=>void 0:q(o).subscribe(()=>l(s()));return q(o).updateResult(),e}),Fa(()=>q(a),`pre`,()=>{q(o).setOptions(q(a))}),Fa(()=>[q(a),q(o)],`pre`,()=>{l(s())}),c}function La(e,t){return Ia(e,oa,t)}function Ra(e,t){let n=vt(()=>Ta(t?.())),r=N(Qt(new ga(q(n),e())));Fa(()=>q(n),`pre`,()=>{P(r,new ga(q(n),e()),!0)}),wn(()=>{q(r).setOptions(e())});let i=(...e)=>{q(r).mutate(e[0],e[1]).catch(Z)},a=N(Qt(q(r).getCurrentResult()));return Fa(()=>q(r),`pre`,()=>{P(a,q(r).getCurrentResult(),!0)}),wn(()=>q(r).subscribe(e=>{$.batchCalls(()=>{Object.assign(q(a),e)})()})),q(vt(()=>new Proxy(q(a),{get:(e,t)=>{let n={...q(a),mutate:i,mutateAsync:q(a).mutate};return t==`value`?n:n[t]}})))}function za(e,t){qe(t,!0);let n=pi(t,`client`,19,()=>new va);mi(()=>{n().mount()}),xa(n()),hi(()=>{n().unmount()});var r=Tr();Gr(ln(r),()=>t.children),Y(e,r),Je()}function Ba(){return document.querySelector(`meta[name="htmlark-token"]`)?.getAttribute(`content`)??``}async function Va(e,t={}){let n=new Headers(t.headers);n.set(`X-Htmlark-Token`,Ba()),t.body&&!n.has(`content-type`)&&n.set(`content-type`,`application/json`);let r=await fetch(e,{...t,headers:n}),i=await r.json();if(!r.ok)throw Error(i.error??`${r.status}`);return i}function Ha(e){return Va(`/v1/artifacts${e?`?search=${encodeURIComponent(e)}`:``}`)}function Ua(e){return Va(`/v1/artifacts/${e}`)}function Wa(e,t,n){return Va(`/v1/artifacts/${e}/diff?from=${t}&to=${n}`)}function Ga(e,t){return Va(`/v1/artifacts/${e}/restore`,{method:`POST`,body:JSON.stringify({version:t})})}function Ka(e){return Va(`/v1/artifacts/${e}`,{method:`DELETE`})}function qa(e,t,n){return Va(`/v1/import`,{method:`POST`,body:JSON.stringify({key:e,content:t,name:n})})}var Ja=J(`<p class="err svelte-9bibt2"> </p>`),Ya=J(`<p class="mute svelte-9bibt2">Loading library</p>`),Xa=J(`<p class="mute svelte-9bibt2">Empty. Put a page with htmlark put --key, or Import.</p>`),Za=J(`<span class="dirty svelte-9bibt2">dirty</span>`),Qa=J(`<tr><td class="svelte-9bibt2"> <!></td><td class="mono svelte-9bibt2"> </td><td class="svelte-9bibt2"> </td><td class="mute svelte-9bibt2"> </td></tr>`),$a=J(`<table class="svelte-9bibt2"><thead><tr class="svelte-9bibt2"><th class="svelte-9bibt2">Name</th><th class="svelte-9bibt2">Key / id</th><th class="svelte-9bibt2">v</th><th class="svelte-9bibt2">Updated</th></tr></thead><tbody></tbody></table>`),eo=J(`<p class="mute pad svelte-9bibt2">Select a page. The inspector shows the sandboxed render, source, and versions.</p>`),to=J(`<p class="mute pad svelte-9bibt2">Loading</p>`),no=J(`<iframe title="preview" class="svelte-9bibt2"></iframe>`),ro=J(`<pre class="source svelte-9bibt2"> </pre>`),io=J(`<li><button type="button"> </button></li>`),ao=J(`<option> </option>`),oo=J(`<label class="difflab svelte-9bibt2">Diff from <select class="svelte-9bibt2"><option>none</option><!></select></label> <!>`,1),so=J(`<ul class="versions svelte-9bibt2"></ul> <!>`,1),co=J(`<div class="frame svelte-9bibt2"><div class="frame-bar svelte-9bibt2" role="tablist"><button class="tab svelte-9bibt2" type="button" role="tab">Preview</button> <button class="tab svelte-9bibt2" type="button" role="tab">Source</button> <button class="tab svelte-9bibt2" type="button" role="tab">Versions</button> <span class="meta svelte-9bibt2"> </span></div> <!></div> <div class="actions svelte-9bibt2"><a class="ghost svelte-9bibt2" target="_blank" rel="noreferrer">Open</a> <button type="button" class="svelte-9bibt2"> </button> <button type="button" class="danger svelte-9bibt2">Delete</button></div>`,1),lo=J(`<div class="shell svelte-9bibt2"><header class="top svelte-9bibt2"><a class="wordmark svelte-9bibt2" href="/">htmlark</a> <input class="search svelte-9bibt2" placeholder="Search name or id"/> <input class="key svelte-9bibt2" placeholder="key"/> <label class="import svelte-9bibt2">Import <input type="file" accept=".html,.htm,.md,text/html,text/markdown" class="svelte-9bibt2"/></label></header> <!> <div class="body svelte-9bibt2"><div class="list svelte-9bibt2"><!></div> <aside class="inspect svelte-9bibt2"><!></aside></div></div>`);function uo(e,t){qe(t,!0);let n=Ta(),r=N(``),i=N(null),a=N(null),o=N(`preview`),s=N(``),c=N(``),l=N(null),u=La(()=>({queryKey:[`artifacts`,q(r)],queryFn:()=>Ha(q(r))})),d=La(()=>({queryKey:[`artifact`,q(i)],queryFn:()=>Ua(q(i)),enabled:!!q(i)})),f=vt(()=>d.data?.artifact.version??1),p=vt(()=>q(a)??q(f)),m=La(()=>({queryKey:[`diff`,q(i),q(s),q(p)],queryFn:()=>Wa(q(i),Number(q(s)),q(p)),enabled:!!(q(i)&&q(s)&&Number(q(s))!==q(p))})),h=Ra(()=>({mutationFn:e=>Ga(q(i),e),onSuccess:()=>{n.invalidateQueries({queryKey:[`artifacts`]}),n.invalidateQueries({queryKey:[`artifact`,q(i)]})}})),g=Ra(()=>({mutationFn:()=>Ka(q(i)),onSuccess:()=>{P(i,null),n.invalidateQueries({queryKey:[`artifacts`]})}})),_=Ra(()=>({mutationFn:e=>qa(e.key,e.content,e.name),onSuccess:()=>{P(l,null),P(c,``),n.invalidateQueries({queryKey:[`artifacts`]})},onError:e=>{P(l,e.message,!0)}}));function v(e){P(i,e.id,!0),P(a,null),P(o,`preview`),P(s,``)}async function y(e){let t=e.target.files?.[0];if(!t)return;let n=await t.text(),r=q(c).trim()||t.name.replace(/\.[^.]+$/,``);_.mutate({key:r,content:n,name:r})}var b=lo(),x=I(b),S=L(I(x),2);ai(S);var ee=L(S,2);ai(ee);var te=L(ee,2),C=L(I(te));O(te),O(x);var ne=L(x,2),re=e=>{var t=Ja(),n=un(t,!0);kn(()=>X(n,q(l))),Y(e,t)};Fr(ne,e=>{q(l)&&e(re)});var ie=L(ne,2),ae=I(ie),oe=I(ae),se=e=>{Y(e,Ya())},ce=e=>{var t=Ja(),n=un(t,!0);kn(()=>X(n,u.error.message)),Y(e,t)},le=e=>{Y(e,Xa())},ue=e=>{var t=$a(),n=L(I(t));zr(n,21,()=>u.data?.artifacts??[],e=>e.id,(e,t)=>{var n=Qa();let r;var a=I(n),o=I(a),s=L(o),c=e=>{Y(e,Za())};Fr(s,e=>{q(t).dirty&&e(c)}),O(a);var l=L(a),u=un(l,!0),d=L(l),f=un(d,!0),p=un(L(d),!0);O(n),kn(e=>{r=Jr(n,1,`svelte-9bibt2`,null,r,{sel:q(i)===q(t).id}),X(o,`${q(t).name??``} `),X(u,q(t).id),X(f,q(t).version),X(p,e)},[()=>q(t).updatedAt.slice(0,16).replace(`T`,` `)]),gr(`click`,n,()=>v(q(t))),Y(e,n)}),O(n),O(t),Y(e,t)};Fr(oe,e=>{u.isPending?e(se):u.isError?e(ce,1):(u.data?.artifacts.length??0)===0?e(le,2):e(ue,-1)}),O(ae);var de=L(ae,2),fe=I(de),pe=e=>{Y(e,eo())},me=e=>{Y(e,to())},he=e=>{let t=vt(()=>d.data.artifact);var n=co(),r=ln(n),i=I(r),c=I(i),l=L(c,2),u=L(l,2),f=un(L(u,2));O(i);var _=L(i,2),v=e=>{var n=no();kn(()=>oi(n,`src`,`/render/${q(t).id??``}/${q(p)??``}`)),Y(e,n)},y=e=>{var t=ro(),n=un(t,!0);kn(()=>X(n,d.data.preview)),Y(e,t)},b=e=>{var n=so(),r=ln(n);zr(r,21,()=>q(t).versions,e=>e.version,(e,n)=>{var r=io(),i=I(r);let o;var s=un(i);O(r),kn(()=>{o=Jr(i,1,`svelte-9bibt2`,null,o,{on:q(p)===q(n).version}),X(s,`v${q(n).version??``}${q(n).version===q(t).version?` head`:``}${q(n).dirty?` dirty`:``}${q(n).restoredFrom?` from v${q(n).restoredFrom}`:``}`)}),gr(`click`,i,()=>P(a,q(n).version,!0)),Y(e,r)}),O(r);var i=L(r,2),o=e=>{var n=oo(),r=ln(n),i=L(I(r)),a=I(i);a.value=a.__value=``,zr(L(a),17,()=>q(t).versions,e=>e.version,(e,t)=>{var n=ao(),r=un(n),i={};kn(e=>{X(r,`v${q(t).version??``}`),i!==(i=e)&&(n.value=(n.__value=i)??``)},[()=>String(q(t).version)]),Y(e,n)}),O(i),Qr(i),O(r);var o=L(r,2),c=e=>{var t=ro(),n=un(t,!0);kn(()=>X(n,m.data.diff)),Y(e,t)};Fr(o,e=>{m.data?.diff&&e(c)}),$r(i,()=>q(s),e=>P(s,e)),Y(e,n)};Fr(i,e=>{q(t).versions.length>1&&e(o)}),Y(e,n)};Fr(_,e=>{q(o)===`preview`?e(v):q(o)===`source`?e(y,1):e(b,-1)}),O(r);var x=L(r,2),S=I(x),ee=L(S,2),te=un(ee),C=L(ee,2);O(x),kn(()=>{oi(c,`aria-selected`,q(o)===`preview`),oi(l,`aria-selected`,q(o)===`source`),oi(u,`aria-selected`,q(o)===`versions`),X(f,`${q(t).name??``} · v${q(p)??``}`),oi(S,`href`,`/a/${q(t).id??``}${q(a)?`?v=${q(a)}`:``}`),X(te,`Restore v${q(p)??``}`)}),gr(`click`,c,()=>P(o,`preview`)),gr(`click`,l,()=>P(o,`source`)),gr(`click`,u,()=>P(o,`versions`)),gr(`click`,ee,()=>h.mutate(q(p))),gr(`click`,C,()=>g.mutate()),Y(e,n)};Fr(fe,e=>{q(i)?d.isPending?e(me,1):d.data&&e(he,2):e(pe)}),O(de),O(ie),O(b),ui(S,()=>q(r),e=>P(r,e)),ui(ee,()=>q(c),e=>P(c,e)),gr(`change`,C,y),Y(e,b),Je()}_r([`change`,`click`]);function fo(e,t){qe(t,!0);let n=new va;za(e,{get client(){return n},children:(e,t)=>{uo(e,{})},$$slots:{default:!0}}),Je()}Ar(fo,{target:document.getElementById(`app`)});
@@ -0,0 +1 @@
1
+ @font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-sans-cyrillic-ext-400-normal-g30qAdWV.woff2)format("woff2"),url(/assets/ibm-plex-sans-cyrillic-ext-400-normal-Dsrv2Tcn.woff)format("woff");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-sans-cyrillic-400-normal-DZqxrq2p.woff2)format("woff2"),url(/assets/ibm-plex-sans-cyrillic-400-normal-BTotfTJu.woff)format("woff");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-sans-greek-400-normal-_efipK4i.woff2)format("woff2"),url(/assets/ibm-plex-sans-greek-400-normal-D9ESIMu3.woff)format("woff");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-sans-vietnamese-400-normal-DG4YqDda.woff2)format("woff2"),url(/assets/ibm-plex-sans-vietnamese-400-normal-fK1oJ5dG.woff)format("woff");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-sans-latin-ext-400-normal-C5H60-Va.woff2)format("woff2"),url(/assets/ibm-plex-sans-latin-ext-400-normal-RBey6euL.woff)format("woff");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2)format("woff2"),url(/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff)format("woff");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(/assets/ibm-plex-sans-cyrillic-ext-500-normal-Cs5J6C77.woff2)format("woff2"),url(/assets/ibm-plex-sans-cyrillic-ext-500-normal-DB5PtV2g.woff)format("woff");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(/assets/ibm-plex-sans-cyrillic-500-normal-CocWQlwt.woff2)format("woff2"),url(/assets/ibm-plex-sans-cyrillic-500-normal-ByOcLdNv.woff)format("woff");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(/assets/ibm-plex-sans-greek-500-normal-JMMifIXV.woff2)format("woff2"),url(/assets/ibm-plex-sans-greek-500-normal-CuWXN6rf.woff)format("woff");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(/assets/ibm-plex-sans-vietnamese-500-normal-e4dixQRQ.woff2)format("woff2"),url(/assets/ibm-plex-sans-vietnamese-500-normal-BEb3_waV.woff)format("woff");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(/assets/ibm-plex-sans-latin-ext-500-normal-DakdToA3.woff2)format("woff2"),url(/assets/ibm-plex-sans-latin-ext-500-normal-D0aIdm-b.woff)format("woff");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:500;src:url(/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2)format("woff2"),url(/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff)format("woff");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(/assets/ibm-plex-sans-cyrillic-ext-600-normal-DUMzJB7m.woff2)format("woff2"),url(/assets/ibm-plex-sans-cyrillic-ext-600-normal-Bz0x94Yp.woff)format("woff");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(/assets/ibm-plex-sans-cyrillic-600-normal-71GNu3SW.woff2)format("woff2"),url(/assets/ibm-plex-sans-cyrillic-600-normal-BGq0mW3O.woff)format("woff");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(/assets/ibm-plex-sans-greek-600-normal-DzTrcv_p.woff2)format("woff2"),url(/assets/ibm-plex-sans-greek-600-normal-D-CqTdkO.woff)format("woff");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(/assets/ibm-plex-sans-vietnamese-600-normal-DpPYBSTl.woff2)format("woff2"),url(/assets/ibm-plex-sans-vietnamese-600-normal-DgdngZtN.woff)format("woff");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(/assets/ibm-plex-sans-latin-ext-600-normal-DOrvGEcy.woff2)format("woff2"),url(/assets/ibm-plex-sans-latin-ext-600-normal-DIrixKbi.woff)format("woff");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans;font-style:normal;font-display:swap;font-weight:600;src:url(/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2)format("woff2"),url(/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff)format("woff");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2)format("woff2"),url(/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff)format("woff");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2)format("woff2"),url(/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff)format("woff");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2)format("woff2"),url(/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff)format("woff");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2)format("woff2"),url(/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff)format("woff");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2)format("woff2"),url(/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff)format("woff");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}html,body,#app{height:100%;margin:0}body{color:#121417;background:#f6f7f8;font-family:IBM Plex Sans,ui-sans-serif,system-ui,sans-serif}.shell.svelte-9bibt2{flex-direction:column;height:100%;display:flex}.top.svelte-9bibt2{background:#fff;border-bottom:1px solid #d8dee6;align-items:center;gap:10px;height:48px;padding:0 14px;display:flex}.wordmark.svelte-9bibt2{color:#121417;width:88px;font-weight:600;text-decoration:none}.search.svelte-9bibt2{flex:1}.key.svelte-9bibt2{width:140px}input.svelte-9bibt2,select.svelte-9bibt2,button.svelte-9bibt2,.import.svelte-9bibt2{color:#121417;background:#fff;border:1px solid #d8dee6;border-radius:0;padding:6px 8px;font:500 13px/1.2 IBM Plex Sans,ui-sans-serif,sans-serif}input.svelte-9bibt2:focus-visible,select.svelte-9bibt2:focus-visible,button.svelte-9bibt2:focus-visible,.import.svelte-9bibt2:focus-within{outline-offset:1px;outline:2px solid #2f6fed}.import.svelte-9bibt2{cursor:pointer;position:relative;overflow:hidden}.import.svelte-9bibt2 input:where(.svelte-9bibt2){opacity:0;cursor:pointer;position:absolute;inset:0}.body.svelte-9bibt2{flex:1;grid-template-columns:minmax(0,1fr) 420px;min-height:0;display:grid}.list.svelte-9bibt2{background:#fff;border-right:1px solid #d8dee6;overflow:auto}table.svelte-9bibt2{border-collapse:collapse;width:100%;font-size:13px}th.svelte-9bibt2,td.svelte-9bibt2{text-align:left;white-space:nowrap;border-bottom:1px solid #e6ebf0;height:36px;padding:0 12px}th.svelte-9bibt2{color:#5c6570;background:#f6f7f8;font-weight:500;position:sticky;top:0}td.mono.svelte-9bibt2{color:#5c6570;text-overflow:ellipsis;max-width:280px;font-family:IBM Plex Mono,ui-monospace,monospace;font-size:12px;overflow:hidden}tr.svelte-9bibt2{cursor:pointer}tr.svelte-9bibt2:hover td:where(.svelte-9bibt2){background:#f0f3f6}tr.sel.svelte-9bibt2 td:where(.svelte-9bibt2){background:#e8eefc}.dirty.svelte-9bibt2{color:#9a5b12;margin-left:6px;font-size:11px}.inspect.svelte-9bibt2{background:#f6f7f8;flex-direction:column;gap:10px;min-width:0;padding:12px;display:flex}.frame.svelte-9bibt2{background:#fff;border:1px solid #d8dee6;border-radius:8px;flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.frame-bar.svelte-9bibt2{background:#f6f7f8;border-bottom:1px solid #d8dee6;align-items:center;gap:2px;padding:6px 8px;display:flex}.tab.svelte-9bibt2{color:#5c6570;background:0 0;border:0;padding:4px 8px}.tab[aria-selected=true].svelte-9bibt2{color:#2f6fed;box-shadow:inset 0 -2px #2f6fed}.meta.svelte-9bibt2{color:#5c6570;margin-left:auto;font-family:IBM Plex Mono,ui-monospace,monospace;font-size:12px}iframe.svelte-9bibt2{background:#fff;border:0;flex:1;width:100%;min-height:220px}.source.svelte-9bibt2{color:#e8eaed;background:#121417;flex:1;margin:0;padding:12px;font:12px/1.45 IBM Plex Mono,ui-monospace,monospace;overflow:auto}.versions.svelte-9bibt2{margin:0;padding:8px;list-style:none}.versions.svelte-9bibt2 button:where(.svelte-9bibt2){text-align:left;background:#fff;width:100%;margin-bottom:4px}.versions.svelte-9bibt2 button.on:where(.svelte-9bibt2){color:#2f6fed;border-color:#2f6fed}.difflab.svelte-9bibt2{color:#5c6570;align-items:center;gap:8px;padding:0 8px 8px;font-size:13px;display:flex}.actions.svelte-9bibt2{gap:8px;display:flex}.ghost.svelte-9bibt2{color:#121417;background:#fff;border:1px solid #d8dee6;align-items:center;padding:6px 8px;text-decoration:none;display:inline-flex}.danger.svelte-9bibt2{color:#8a1f1f;border-color:#e3b6b6;margin-left:auto}button.svelte-9bibt2:active,.import.svelte-9bibt2:active,.ghost.svelte-9bibt2:active{transform:translateY(1px)}.err.svelte-9bibt2{color:#8a1f1f;background:#f8e8e8;margin:0;padding:8px 14px}.mute.svelte-9bibt2{color:#5c6570;font-size:13px}.pad.svelte-9bibt2{padding:16px}
package/admin/index.html CHANGED
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <title>htmlark</title>
6
- <script type="module" crossorigin src="/assets/index-DVVG6s3V.js"></script>
7
- <link rel="stylesheet" crossorigin href="/assets/index-D4C2Oc5R.css">
6
+ <script type="module" crossorigin src="/assets/index-D8MQRCUC.js"></script>
7
+ <link rel="stylesheet" crossorigin href="/assets/index-lZId_dDk.css">
8
8
  </head>
9
9
  <body>
10
10
  <div id="app"></div>
package/htmlark.mjs CHANGED
@@ -360,7 +360,7 @@ From the htmlark checkout:
360
360
 
361
361
  Point remotes.json origin.url at the Worker origin (https://a.example.com).
362
362
  GET /a/:id is public. POST /v1/publish requires Bearer PUBLISH_TOKEN.
363
- `),t}import{spawn as cb}from"node:child_process";import{basename as zx}from"node:path";var lb="0.1.2";function Cx(){let e=zx(process.execPath).replace(/\.exe$/i,"");return e==="htmlark"||e.startsWith("htmlark-")}function bm(e){if(Cx())return{command:process.execPath,args:e};let t=process.argv[1];if(!t)return{command:process.execPath,args:e};return{command:process.execPath,args:[t,...e]}}function db(e){(process.platform==="darwin"?cb("open",[e],{detached:!0,stdio:"ignore"}):process.platform==="win32"?cb("cmd",["/c","start","",e],{detached:!0,stdio:"ignore"}):cb("xdg-open",[e],{detached:!0,stdio:"ignore"})).unref()}import{spawn as Ux}from"node:child_process";import{existsSync as Pz,readFileSync as Bx,writeFileSync as Tz,unlinkSync as Vx}from"node:fs";import{createServer as Hx}from"node:http";import{join as Fs}from"node:path";import{setTimeout as Zx}from"node:timers/promises";import{existsSync as kz,readFileSync as Rz}from"node:fs";import{join as Iz}from"node:path";var mb=(e,t,n)=>(o,r)=>{let i=-1;return a(0);async function a(s){if(s<=i)throw Error("next() called multiple times");i=s;let u,c=!1,l;if(e[s])l=e[s][0][0],o.req.routeIndex=s;else l=s===e.length&&r||void 0;if(l)try{u=await l(o,()=>a(s+1))}catch(d){if(d instanceof Error&&t)o.error=d,u=await t(d,o),c=!0;else throw d}else if(o.finalized===!1&&n)u=await n(o);if(u&&(o.finalized===!1||c))o.res=u;return o}};var nz=Symbol();var oz=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,(o)=>o.toLowerCase())}}).formData();var iz=32,kx=1e4,$m=(e)=>("headers"in e),uz=async(e,t=Object.create(null))=>{let{all:n=!1,dot:o=!1}=t,a=($m(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(a==="multipart/form-data"||a==="application/x-www-form-urlencoded")return Rx(e,{all:n,dot:o});return{}};async function Rx(e,t){if(!$m(e)&&e.bodyCache.formData)return az(await e.bodyCache.formData,t);let n=$m(e)?e.headers:e.raw.headers,o=await e.arrayBuffer(),r=oz(o,n.get("Content-Type")||"");if(!$m(e))e.bodyCache.formData=r;let i=await r;if(i)return az(i,t);return{}}function az(e,t){let n=Object.create(null),o={count:0};if(e.forEach((r,i)=>{if(!(t.all||i.endsWith("[]")))n[i]=r;else Ix(n,i,r)}),t.dot)Object.entries(n).forEach(([r,i])=>{if(r.includes("."))Fx(n,r,i,o),delete n[r]});return n}var Ix=(e,t,n)=>{if(e[t]!==void 0)if(Array.isArray(e[t]))e[t].push(n);else e[t]=[e[t],n];else if(!t.endsWith("[]"))e[t]=n;else e[t]=[n]},Fx=(e,t,n,o)=>{if(/(?:^|\.)__proto__\./.test(t))return;let r=e,i=t.split(".",iz+2);if(i.length>iz+1)sz();i.forEach((a,s)=>{if(s===i.length-1)r[a]=n;else{if(!r[a]||typeof r[a]!=="object"||Array.isArray(r[a])||r[a]instanceof File){if(o.count++>=kx)sz();r[a]=Object.create(null)}r=r[a]}})},sz=()=>{throw Error("Nesting limit exceeded")};var fb=(e)=>{let t=e.split("/");if(t[0]==="")t.shift();return t},cz=(e)=>{let{groups:t,path:n}=Px(e),o=fb(n);return Tx(o,t)},Px=(e)=>{let t=[];return e=e.replace(/\{[^}]+\}/g,(n,o)=>{let r=`@${o}`;return t.push([r,n]),r}),{groups:t,path:e}},Tx=(e,t)=>{for(let n=t.length-1;n>=0;n--){let[o]=t[n];for(let r=e.length-1;r>=0;r--)if(e[r].includes(o)){e[r]=e[r].replace(o,t[n][1]);break}}return e},Sm={},lz=(e,t)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let o=`${e}#${t}`;if(!Sm[o])if(n[2])Sm[o]=t&&t[0]!==":"&&t[0]!=="*"?[o,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)];else Sm[o]=[e,n[1],!0];return Sm[o]}return null},dz=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(n)=>{try{return t(n)}catch{return n}})}},Ax=(e)=>dz(e,decodeURI),hb=(e)=>{let t=e.url,n=t.indexOf("/",t.indexOf(":")+4),o=n;for(;o<t.length;o++){let r=t.charCodeAt(o);if(r===37){let i=t.indexOf("?",o),a=t.indexOf("#",o),s=i===-1?a===-1?void 0:a:a===-1?i:Math.min(i,a),u=t.slice(n,s);return Ax(u.includes("%25")?u.replace(/%25/g,"%2525"):u)}else if(r===63||r===35)break}return t.slice(n,o)};var mz=(e)=>{let t=hb(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},pn=(e,t,...n)=>{if(n.length)t=pn(t,...n);return`${e?.[0]==="/"?"":"/"}${e}${t==="/"?"":`${e?.at(-1)==="/"?"":"/"}${t?.[0]==="/"?t.slice(1):t}`}`},wm=(e)=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let t=e.split("/"),n=[],o="";return t.forEach((r)=>{if(r!==""&&!/\:/.test(r))o+="/"+r;else if(/\:/.test(r))if(r.charCodeAt(r.length-1)===63){if(n.length===0&&o==="")n.push("/");else n.push(o);let i=r.slice(0,-1);o+="/"+i,n.push(o)}else o+="/"+r}),n.filter((r,i,a)=>a.indexOf(r)===i)},Em=(e)=>e.indexOf("%")!==-1?dz(e,xx):e,pb=(e)=>{if(e.indexOf("+")!==-1)e=e.replace(/\+/g," ");return Em(e)},pz=(e,t,n)=>{let o=e.indexOf("#",8);if(o!==-1)e=e.slice(0,o);let r;if(!n&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let s=e.indexOf("?",8);if(s===-1)return;if(!e.startsWith(t,s+1))s=e.indexOf(`&${t}`,s+1);while(s!==-1){let u=e.charCodeAt(s+t.length+1);if(u===61){let c=s+t.length+2,l=e.indexOf("&",c);return pb(e.slice(c,l===-1?void 0:l))}else if(u==38||isNaN(u))return"";s=e.indexOf(`&${t}`,s+1)}if(r=/[%+]/.test(e),!r)return}let i=Object.create(null);r??=/[%+]/.test(e);let a=e.indexOf("?",8);while(a!==-1){let s=e.indexOf("&",a+1),u=e.indexOf("=",a);if(u>s&&s!==-1)u=-1;let c=e.slice(a+1,u===-1?s===-1?void 0:s:u);if(r)c=pb(c);if(a=s,c==="")continue;let l;if(u===-1)l="";else if(l=e.slice(u+1,s===-1?void 0:s),r)l=pb(l);if(n){if(!(i[c]&&Array.isArray(i[c])))i[c]=[];i[c].push(l)}else i[c]??=l}return t?i[t]:i},fz=pz,hz=(e,t)=>pz(e,t,!0),xx=decodeURIComponent;var gz=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#e=n}param(e){return e?this.#r(e):this.#i()}#r(e){let t=this.#e[0][this.routeIndex]?.[1][e],n=this.#n(t);return n&&Em(n)}#i(){let e={},t=Object.keys(this.#e[0][this.routeIndex]?.[1]??{});for(let n of t){let o=this.#n(this.#e[0][this.routeIndex][1][n]);if(o!==void 0)e[n]=Em(o)}return e}#n(e){return this.#e[1]?this.#e[1][e]:e}query(e){return fz(this.url,e)}queries(e){return hz(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((n,o)=>{t[o]=n}),t}async parseBody(e){return uz(this,e)}#o=(e)=>{let{bodyCache:t,raw:n}=this,o=t[e];if(o)return o;for(let r in t)return t[r].then((i)=>{if(r==="json")i=JSON.stringify(i);return new Response(i)[e]()});return t[e]=n[e]()};json(){return this.#o("text").then((e)=>JSON.parse(e))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(e,t){(this.#t??={})[e]=t}valid(e){return this.#t?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[nz](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,e]])=>e)}get routePath(){return this.#e[0].map(([[,e]])=>e)[this.routeIndex].path}};var vz={Stringify:1,BeforeStream:2,Stream:3},Ox=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n};var gb=async(e,t,n,o,r)=>{if(typeof e==="object"&&!(e instanceof String)){if(!(e instanceof Promise))e=e.toString();if(e instanceof Promise)e=await e}let i=e.callbacks;if(!i?.length)return Promise.resolve(e);if(r)r[0]+=e;else r=[e];let a=Promise.all(i.map((s)=>s({phase:t,buffer:r,context:o}))).then((s)=>Promise.all(s.filter(Boolean).map((u)=>gb(u,t,!1,o,r))).then(()=>r[0]));if(n)return Ox(await a,i);else return a};var Nx="text/plain; charset=UTF-8",vb=(e,t)=>({"Content-Type":e,...t}),Is=(e,t)=>new Response(e,t),Db=class{#t;#e;env={};#r;finalized=!1;error;#i;#n;#o;#l;#u;#c;#s;#d;#m;constructor(e,t){if(this.#t=e,t)this.#n=t.executionCtx,this.env=t.env,this.#c=t.notFoundHandler,this.#m=t.path,this.#d=t.matchResult}get req(){return this.#e??=new gz(this.#t,this.#m,this.#d),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;else throw Error("This context has no ExecutionContext")}get res(){return this.#o||=Is(null,{headers:this.#s??=new Headers})}set res(e){if(this.#o&&e){e=Is(e.body,e);for(let[t,n]of this.#o.headers.entries()){if(t==="content-type")continue;if(t==="set-cookie"){let o=this.#o.headers.getSetCookie();e.headers.delete("set-cookie");for(let r of o)e.headers.append("set-cookie",r)}else e.headers.set(t,n)}}this.#o=e,this.finalized=!0}render=(...e)=>(this.#u??=(t)=>this.html(t),this.#u(...e));setLayout=(e)=>this.#l=e;getLayout=()=>this.#l;setRenderer=(e)=>{this.#u=e};header=(e,t,n)=>{if(this.finalized)this.#o=Is(this.#o.body,this.#o);let o=this.#o?this.#o.headers:this.#s??=new Headers;if(t===void 0)o.delete(e);else if(n?.append)o.append(e,t);else o.set(e,t)};status=(e)=>{this.#i=e};set=(e,t)=>{this.#r??=new Map,this.#r.set(e,t)};get=(e)=>this.#r?this.#r.get(e):void 0;get var(){if(!this.#r)return{};return Object.fromEntries(this.#r)}#a(e,t,n){let o=this.#o?new Headers(this.#o.headers):this.#s;if(typeof t==="object"&&t.headers){o??=new Headers;for(let[i,a]of new Headers(t.headers))if(i==="set-cookie")o.append(i,a);else o.set(i,a)}if(n){if(!o){let i=0;for(let a in n)if(++i>1||typeof n[a]!=="string"){o=new Headers;break}}if(o)for(let i in n){let a=n[i];if(typeof a==="string")o.set(i,a);else{o.delete(i);for(let s of a)o.append(i,s)}}}let r=typeof t==="number"?t:t?.status??this.#i;return Is(e,{status:r,headers:o??n})}newResponse=(...e)=>this.#a(...e);body=(e,t,n)=>this.#a(e,t,n);text=(e,t,n)=>!this.#s&&!this.#i&&!t&&!n&&!this.finalized?new Response(e):this.#a(e,t,vb(Nx,n));json=(e,t,n)=>this.#a(JSON.stringify(e),t,vb("application/json",n));html=(e,t,n)=>{let o=(r)=>this.#a(r,t,vb("text/html; charset=UTF-8",n));return typeof e==="object"?gb(e,vz.Stringify,!1,{}).then(o):o(e)};redirect=(e,t)=>{let n=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,t??302)};notFound=()=>(this.#c??=()=>Is(),this.#c(this))};var ft="ALL",Dz="all",yz=["get","post","put","delete","options","patch","query"],zm="Can not add a route since the matcher is already built.",Cm=class extends Error{};var _z="__COMPOSED_HANDLER";var jx=(e)=>e.text("404 Not Found",404),bz=(e,t)=>{if("getResponse"in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},$z=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(t={}){[...yz,Dz].forEach((i)=>{this[i]=(a,...s)=>{if(typeof a==="string")this.#t=a;else this.#i(i,this.#t,a);return s.forEach((u)=>{this.#i(i,this.#t,u)}),this}}),this.on=(i,a,...s)=>{for(let u of[a].flat()){this.#t=u;for(let c of[i].flat())s.map((l)=>{this.#i(c.toUpperCase(),this.#t,l)})}return this},this.use=(i,...a)=>{if(typeof i==="string")this.#t=i;else this.#t="*",a.unshift(i);return a.forEach((s)=>{this.#i(ft,this.#t,s)}),this};let{strict:o,...r}=t;Object.assign(this,r),this.getPath=o??!0?t.getPath??hb:mz}#e(){let t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#r=this.#r,t.routes=this.routes,t}#r=jx;errorHandler=bz;route(t,n){let o=this.basePath(t);return n.routes.map((r)=>{let i;if(n.errorHandler===bz)i=r.handler;else i=async(a,s)=>(await mb([],n.errorHandler)(a,()=>r.handler(a,s))).res,i[_z]=r.handler;o.#i(r.method,r.path,i,r.basePath)}),this}basePath(t){let n=this.#e();return n._basePath=pn(this._basePath,t),n}onError=(t)=>(this.errorHandler=t,this);notFound=(t)=>(this.#r=t,this);mount(t,n,o){let r,i;if(o)if(typeof o==="function")i=o;else if(i=o.optionHandler,o.replaceRequest===!1)r=(u)=>u;else r=o.replaceRequest;let a=i?(u)=>{let c=i(u);return Array.isArray(c)?c:[c]}:(u)=>{let c=void 0;try{c=u.executionCtx}catch{}return[u.env,c]};r||=(()=>{let u=pn(this._basePath,t),c=u==="/"?0:u.length;return(l)=>{let d=new URL(l.url);return d.pathname=this.getPath(l).slice(c)||"/",new Request(d,l)}})();let s=async(u,c)=>{let l=await n(r(u.req.raw),...a(u));if(l)return l;await c()};return this.#i(ft,pn(t,"*"),s),this}#i(t,n,o,r){t=t.toUpperCase(),n=pn(this._basePath,n);let i={basePath:r!==void 0?pn(this._basePath,r):this._basePath,path:n,method:t,handler:o};this.router.add(t,n,[o,i]),this.routes.push(i)}#n(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#o(t,n,o,r){if(r==="HEAD")return(async()=>new Response(null,await this.#o(t,n,o,"GET")))();let i=this.getPath(t,{env:o}),a=this.router.match(r,i),s=new Db(t,{path:i,matchResult:a,env:o,executionCtx:n,notFoundHandler:this.#r});if(a[0].length===1){let c;try{c=a[0][0][0][0](s,async()=>{s.res=await this.#r(s)})}catch(l){return this.#n(l,s)}return c instanceof Promise?c.then((l)=>l||(s.finalized?s.res:this.#r(s))).catch((l)=>this.#n(l,s)):c??this.#r(s)}let u=mb(a[0],this.errorHandler,this.#r);return(async()=>{try{let c=await u(s);if(!c.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#n(c,s)}})()}fetch=(t,...n)=>this.#o(t,n[1],n[0],t.method);request=(t,n,o,r)=>{if(t instanceof Request)return this.fetch(n?new Request(t,n):t,o,r);return t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${pn("/",t)}`,n),o,r)};fire=()=>{addEventListener("fetch",(t)=>{t.respondWith(this.#o(t.request,t,void 0,t.request.method))})}};var dt=()=>Object.create(null);var km=[];function yb(e,t){let n=this.buildAllMatchers(),o=(r,i)=>{let a=n[r]||n[ft],s=a[2][i];if(s)return s;let u=i.match(a[0]);if(!u)return[[],km];let c=u.indexOf("",1);return[a[1][c],u]};return this.match=o,o(e,t)}var hi="[^/]+",hn=".*",Ir="(?:|/.*)",fn=Symbol(),Sz=new Set(".\\+*[^]$()");function Lx(e,t){if(e.length===1)return t.length===1?e<t?-1:1:-1;if(t.length===1)return 1;if(e===hn||e===Ir)return t===Ir?-1:1;else if(t===hn||t===Ir)return-1;if(e===hi)return 1;else if(t===hi)return-1;return e.length===t.length?e<t?-1:1:t.length-e.length}var wz=class e{#t;#e;#r=dt();insert(t,n,o,r,i){let a=this;for(let s=0,u=t.length;s<u;s++){let c=t[s],l=c.length===1?c==="*"?s===u-1?["","",hn]:["","",hi]:null:c==="/*"?["","",Ir]:c.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),d;if(l){let m=l[1],p=l[2]||hi;if(m&&l[2]){if(p===".*")throw fn;if(p=p.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(p))throw fn;if(p.length===1&&Sz.has(p))throw fn}if(d=a.#r[p],!d){if(p!==hn&&p!==Ir){for(let h in a.#r)if((p.length>1||h.length>1)&&h!==hn&&h!==Ir)throw fn}d=a.#r[p]=new e}if(m!=="")d.#e??=r.varIndex++,o.push([m,d.#e])}else if(d=a.#r[c],!d){for(let m in a.#r)if(m.length>1&&m!==hn&&m!==Ir)throw fn;d=a.#r[c]=new e}a=d}if(a.#t!==void 0)throw fn;a.#t=i?-1:n}buildRegExpStr(){let n=Object.keys(this.#r).sort(Lx).map((o)=>{let r=this.#r[o],i=r.buildRegExpStr();return i===""?"":(typeof r.#e==="number"?`(${o})@${r.#e}`:Sz.has(o)?`\\${o}`:o)+i}).filter(Boolean);if(typeof this.#t==="number"&&this.#t!==-1)n.unshift(`#${this.#t}`);if(n.length===0)return"";if(n.length===1)return n[0];return"(?:"+n.join("|")+")"}};var _b=class{#t={varIndex:0};#e=new wz;#r=0;paths=dt();insert(e,t){if(t){this.#e.insert(e.split(""),0,[],this.#t,!0);return}let n=[],o=[],r=e;for(let a=0;;){let s=!1;if(r=r.replace(/\{[^}]+\}/g,(u)=>{let c=`@\\${a}`;return o[a]=[c,u],a++,s=!0,c}),!s)break}let i=r.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=o.length-1;a>=0;a--){let[s]=o[a];for(let u=i.length-1;u>=0;u--)if(i[u].indexOf(s)!==-1){i[u]=i[u].replace(s,o[a][1]);break}}this.#e.insert(i,this.#r,n,this.#t,!1),this.paths[e]=[this.#r++,n]}buildRegExp(){let e=this.#e.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,n=[],o=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(r,i,a)=>{if(i!==void 0)return n[++t]=Number(i),"$()";if(a!==void 0)return o[Number(a)]=++t,"";return""}),[new RegExp(`^${e}`),n,o]}};var Ez=dt();function zz(e){return Ez[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,n)=>n?`\\${n}`:t==="/*"?Ir:t==="*"?hn:`/:${hi}`)}$`)}function Rm(e,t){for(let n of Object.keys(e).sort((o,r)=>r.length-o.length))if(zz(n).test(t))return[...e[n]];return}var Im=class{name="RegExpRouter";#t;#e;#r;constructor(){this.#t={[ft]:dt()},this.#e={[ft]:dt()},this.#r={[ft]:new _b}}#i(e,t){try{this.#r[e].insert(t,!/\*|\/:/.test(t))}catch(n){throw n===fn?new Cm(t):n}}add(e,t,n){let o=this.#t,r=this.#e;if(!o)throw Error(zm);if(!o[e]){this.#r[e]=new _b;for(let s of[o,r]){s[e]=dt();for(let u in s[ft])s[e][u]=[...s[ft][u]],this.#i(e,u)}}if(t==="/*")t="*";let i=e===ft?Object.keys(o):[e];if(/\*$/.test(t)){let s=zz(t);for(let u of i)if(!o[u][t])this.#i(u,t),o[u][t]=Rm(o[u],t)||Rm(o[ft],t)||[];for(let u of[o,r])for(let c of i)for(let l in u[c])s.test(l)&&u[c][l].push([n,t]);return}let a=wm(t)||[t];for(let s of a)for(let u of i){if(!r[u][s])this.#i(u,s),r[u][s]=Rm(o[u],s)||Rm(o[ft],s)||[];r[u][s].push([n,s])}}match=yb;buildAllMatchers(){let e=dt();for(let t of Object.keys(this.#e))e[t]=this.#n(t);return this.#t=this.#e=this.#r=void 0,Ez=dt(),e}#n(e){let t=this.#t[e],n=this.#e[e],o=this.#r[e],r=dt(),i=[],[a,s,u]=o.buildRegExp();for(let c of[t,n])for(let l in c){let d=c[l],m=o.paths[l];if(!m){r[l]=[d.map(([p])=>[p,dt()]),km];continue}i[m[0]]=d.map(([p,h])=>[p,o.paths[h][1].reduceRight((v,[D],g)=>(v[D]=u[m[1][g][1]],v),dt())])}return[a,s.map((c)=>i[c]),r]}};var bb=class{name="SmartRouter";#t=[];#e=[];constructor(e){this.#t=e.routers}add(e,t,n){if(!this.#e)throw Error(zm);this.#e.push([e,t,n])}match(e,t){if(!this.#e)throw Error("Fatal error");let n=this.#t,o=this.#e,r=n.length,i=0,a;for(;i<r;i++){let s=n[i];try{for(let u=0,c=o.length;u<c;u++)s.add(...o[u]);a=s.match(e,t)}catch(u){if(u instanceof Cm)continue;throw u}this.match=s.match.bind(s),this.#t=[s],this.#e=void 0;break}if(i===r)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#e||this.#t.length!==1)throw Error("No active router has been determined yet.");return this.#t[0]}};var $b=dt(),Mx=0,Cz=class e{#t=[];#e=dt();#r=[];#i;#n=$b;insert(t,n,o){let r=this,i=cz(n),a=new Set,s=0;for(let u of i){let c=i[++s],l=lz(u,c)||(c===void 0&&u&&u.indexOf("*")===u.length-1?u:null),d=Array.isArray(l),m=d?l[0]:l||u,p=r.#e[m]||=new e;if(l&&!p.#i)p.#i=l,r.#r.push(p);if(r=p,d)a.add(l[1])}r.#t.push({[t]:{handler:o,possibleKeys:[...a],score:++Mx}})}#o(t,n,o,r,i){for(let a=0,s=n.#t.length;a<s;a++){let u=n.#t[a],c=u[o]||u[ft];if(c){c.params=dt(),t.push(c);for(let l=0,d=c.possibleKeys.length;l<d;l++){let m=c.possibleKeys[l];c.params[m]=i?.[m]&&!l?i[m]:r[m]??i?.[m]}}}}search(t,n){let o=[];this.#n=$b;let i=[this],a=fb(n),s=[],u=a.length,c=null;for(let l=0;l<u;l++){let d=a[l],m=l===u-1,p=[];for(let v=0,D=i.length;v<D;v++){let g=i[v],_=g.#e[d];if(_)if(_.#n=g.#n,m){if(_.#e["*"])this.#o(o,_.#e["*"],t,g.#n);this.#o(o,_,t,g.#n)}else p.push(_);for(let y of g.#r){let w=y.#i,C=g.#n===$b?{}:{...g.#n};if(typeof w==="string"){if(w==="*"||d.startsWith(w.slice(0,-1))){if(this.#o(o,y,t,g.#n),w==="*")y.#n=C,p.push(y)}continue}let[,S,b]=w;if(!d&&b===!0)continue;if(b!==!0){if(!c){c=[];let q=n[0]==="/"?1:0;for(let x=0;x<u;x++)c[x]=q,q+=a[x].length+1}let E=n.slice(c[l]),P=b.exec(E);if(P){if(C[S]=P[0],this.#o(o,y,t,g.#n,C),P[0].length===E.length&&y.#e["*"])this.#o(o,y.#e["*"],t,g.#n,C);for(let q in y.#e){y.#n=C;let x=P[0].match(/\//g)?.length??0;(s[x]||=[]).push(y);break}continue}}if(b===!0||b.test(d))if(C[S]=d,m){if(this.#o(o,y,t,C,g.#n),y.#e["*"])this.#o(o,y.#e["*"],t,C,g.#n)}else y.#n=C,p.push(y)}}let h=s.shift();i=h?p.concat(h):p}if(o[1])o.sort((l,d)=>l.score-d.score);return[o.map(({handler:l,params:d})=>[l,d])]}};var Sb=class{name="TrieRouter";#t=new Cz;add(e,t,n){for(let o of wm(t)||[t])this.#t.insert(e,o,n)}match(e,t){return this.#t.search(e,t)}};var Fm=class extends $z{constructor(e={}){super(e);this.router=e.router??new bb({routers:[new Im,new Sb]})}};function ot(e,t,n){return e.json(t,n)}function qx(e,t){return new Set([`http://${e}:${t}`,`http://localhost:${t}`,`http://[::1]:${t}`])}function wb(e){return new Fm().use("/*",async(n,o)=>{let r=n.req.header("host")??"";if(![`${e.bindHost}:${e.port}`,`localhost:${e.port}`,`[::1]:${e.port}`].includes(r))return ot(n,{ok:!1,error:"bad host",code:"VALIDATION"},400);for(let[a,s]of Object.entries(el))n.header(a,s);await o()}).use("/v1/*",async(n,o)=>{if(n.req.path==="/v1/csp-report"){await o();return}if(n.req.method==="OPTIONS")return ot(n,{ok:!1,error:"cors",code:"VALIDATION"},403);let r=/\/versions\/\d+\/raw$/.test(n.req.path),i=n.req.method==="GET"||n.req.method==="HEAD";if(i&&r){await o();return}if(!i&&n.req.method!=="DELETE"){if(!(n.req.header("content-type")??"").includes("application/json"))return ot(n,{ok:!1,error:"content-type",code:"VALIDATION"},400)}if(!i){let a=n.req.header("origin");if(a&&!qx(e.bindHost,e.port).has(a))return ot(n,{ok:!1,error:"origin",code:"VALIDATION"},403)}if(n.req.header("x-htmlark-token")!==e.token)return ot(n,{ok:!1,error:"unauthorized",code:"VALIDATION"},401);await o()}).onError((n,o)=>{if(n instanceof De)return ot(o,n.toJSON(),n.httpStatus);return ot(o,{ok:!1,error:n.message,code:"INTERNAL"},500)}).get("/health",(n)=>ot(n,{ok:!0,schema:1,bind:e.bindHost,port:e.port},200)).get("/",(n)=>{n.header("Content-Security-Policy","frame-ancestors 'none'");let o=e.webRoot?Iz(e.webRoot,"index.html"):"";if(o&&kz(o)){let r=Rz(o,"utf8");if(!r.includes('name="htmlark-token"'))r=r.replace("<head>",`<head><meta name="htmlark-token" content="${e.token}">`);return n.html(r)}return n.html(`<!doctype html><html><head><meta charset="utf-8"><meta name="htmlark-token" content="${e.token}"><title>htmlark</title>
363
+ `),t}import{spawn as cb}from"node:child_process";import{basename as zx}from"node:path";var lb="0.1.3";function Cx(){let e=zx(process.execPath).replace(/\.exe$/i,"");return e==="htmlark"||e.startsWith("htmlark-")}function bm(e){if(Cx())return{command:process.execPath,args:e};let t=process.argv[1];if(!t)return{command:process.execPath,args:e};return{command:process.execPath,args:[t,...e]}}function db(e){(process.platform==="darwin"?cb("open",[e],{detached:!0,stdio:"ignore"}):process.platform==="win32"?cb("cmd",["/c","start","",e],{detached:!0,stdio:"ignore"}):cb("xdg-open",[e],{detached:!0,stdio:"ignore"})).unref()}import{spawn as Ux}from"node:child_process";import{existsSync as Pz,readFileSync as Bx,writeFileSync as Tz,unlinkSync as Vx}from"node:fs";import{createServer as Hx}from"node:http";import{join as Fs}from"node:path";import{setTimeout as Zx}from"node:timers/promises";import{existsSync as kz,readFileSync as Rz}from"node:fs";import{join as Iz}from"node:path";var mb=(e,t,n)=>(o,r)=>{let i=-1;return a(0);async function a(s){if(s<=i)throw Error("next() called multiple times");i=s;let u,c=!1,l;if(e[s])l=e[s][0][0],o.req.routeIndex=s;else l=s===e.length&&r||void 0;if(l)try{u=await l(o,()=>a(s+1))}catch(d){if(d instanceof Error&&t)o.error=d,u=await t(d,o),c=!0;else throw d}else if(o.finalized===!1&&n)u=await n(o);if(u&&(o.finalized===!1||c))o.res=u;return o}};var nz=Symbol();var oz=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,(o)=>o.toLowerCase())}}).formData();var iz=32,kx=1e4,$m=(e)=>("headers"in e),uz=async(e,t=Object.create(null))=>{let{all:n=!1,dot:o=!1}=t,a=($m(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(a==="multipart/form-data"||a==="application/x-www-form-urlencoded")return Rx(e,{all:n,dot:o});return{}};async function Rx(e,t){if(!$m(e)&&e.bodyCache.formData)return az(await e.bodyCache.formData,t);let n=$m(e)?e.headers:e.raw.headers,o=await e.arrayBuffer(),r=oz(o,n.get("Content-Type")||"");if(!$m(e))e.bodyCache.formData=r;let i=await r;if(i)return az(i,t);return{}}function az(e,t){let n=Object.create(null),o={count:0};if(e.forEach((r,i)=>{if(!(t.all||i.endsWith("[]")))n[i]=r;else Ix(n,i,r)}),t.dot)Object.entries(n).forEach(([r,i])=>{if(r.includes("."))Fx(n,r,i,o),delete n[r]});return n}var Ix=(e,t,n)=>{if(e[t]!==void 0)if(Array.isArray(e[t]))e[t].push(n);else e[t]=[e[t],n];else if(!t.endsWith("[]"))e[t]=n;else e[t]=[n]},Fx=(e,t,n,o)=>{if(/(?:^|\.)__proto__\./.test(t))return;let r=e,i=t.split(".",iz+2);if(i.length>iz+1)sz();i.forEach((a,s)=>{if(s===i.length-1)r[a]=n;else{if(!r[a]||typeof r[a]!=="object"||Array.isArray(r[a])||r[a]instanceof File){if(o.count++>=kx)sz();r[a]=Object.create(null)}r=r[a]}})},sz=()=>{throw Error("Nesting limit exceeded")};var fb=(e)=>{let t=e.split("/");if(t[0]==="")t.shift();return t},cz=(e)=>{let{groups:t,path:n}=Px(e),o=fb(n);return Tx(o,t)},Px=(e)=>{let t=[];return e=e.replace(/\{[^}]+\}/g,(n,o)=>{let r=`@${o}`;return t.push([r,n]),r}),{groups:t,path:e}},Tx=(e,t)=>{for(let n=t.length-1;n>=0;n--){let[o]=t[n];for(let r=e.length-1;r>=0;r--)if(e[r].includes(o)){e[r]=e[r].replace(o,t[n][1]);break}}return e},Sm={},lz=(e,t)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let o=`${e}#${t}`;if(!Sm[o])if(n[2])Sm[o]=t&&t[0]!==":"&&t[0]!=="*"?[o,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)];else Sm[o]=[e,n[1],!0];return Sm[o]}return null},dz=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(n)=>{try{return t(n)}catch{return n}})}},Ax=(e)=>dz(e,decodeURI),hb=(e)=>{let t=e.url,n=t.indexOf("/",t.indexOf(":")+4),o=n;for(;o<t.length;o++){let r=t.charCodeAt(o);if(r===37){let i=t.indexOf("?",o),a=t.indexOf("#",o),s=i===-1?a===-1?void 0:a:a===-1?i:Math.min(i,a),u=t.slice(n,s);return Ax(u.includes("%25")?u.replace(/%25/g,"%2525"):u)}else if(r===63||r===35)break}return t.slice(n,o)};var mz=(e)=>{let t=hb(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},pn=(e,t,...n)=>{if(n.length)t=pn(t,...n);return`${e?.[0]==="/"?"":"/"}${e}${t==="/"?"":`${e?.at(-1)==="/"?"":"/"}${t?.[0]==="/"?t.slice(1):t}`}`},wm=(e)=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let t=e.split("/"),n=[],o="";return t.forEach((r)=>{if(r!==""&&!/\:/.test(r))o+="/"+r;else if(/\:/.test(r))if(r.charCodeAt(r.length-1)===63){if(n.length===0&&o==="")n.push("/");else n.push(o);let i=r.slice(0,-1);o+="/"+i,n.push(o)}else o+="/"+r}),n.filter((r,i,a)=>a.indexOf(r)===i)},Em=(e)=>e.indexOf("%")!==-1?dz(e,xx):e,pb=(e)=>{if(e.indexOf("+")!==-1)e=e.replace(/\+/g," ");return Em(e)},pz=(e,t,n)=>{let o=e.indexOf("#",8);if(o!==-1)e=e.slice(0,o);let r;if(!n&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let s=e.indexOf("?",8);if(s===-1)return;if(!e.startsWith(t,s+1))s=e.indexOf(`&${t}`,s+1);while(s!==-1){let u=e.charCodeAt(s+t.length+1);if(u===61){let c=s+t.length+2,l=e.indexOf("&",c);return pb(e.slice(c,l===-1?void 0:l))}else if(u==38||isNaN(u))return"";s=e.indexOf(`&${t}`,s+1)}if(r=/[%+]/.test(e),!r)return}let i=Object.create(null);r??=/[%+]/.test(e);let a=e.indexOf("?",8);while(a!==-1){let s=e.indexOf("&",a+1),u=e.indexOf("=",a);if(u>s&&s!==-1)u=-1;let c=e.slice(a+1,u===-1?s===-1?void 0:s:u);if(r)c=pb(c);if(a=s,c==="")continue;let l;if(u===-1)l="";else if(l=e.slice(u+1,s===-1?void 0:s),r)l=pb(l);if(n){if(!(i[c]&&Array.isArray(i[c])))i[c]=[];i[c].push(l)}else i[c]??=l}return t?i[t]:i},fz=pz,hz=(e,t)=>pz(e,t,!0),xx=decodeURIComponent;var gz=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#e=n}param(e){return e?this.#r(e):this.#i()}#r(e){let t=this.#e[0][this.routeIndex]?.[1][e],n=this.#n(t);return n&&Em(n)}#i(){let e={},t=Object.keys(this.#e[0][this.routeIndex]?.[1]??{});for(let n of t){let o=this.#n(this.#e[0][this.routeIndex][1][n]);if(o!==void 0)e[n]=Em(o)}return e}#n(e){return this.#e[1]?this.#e[1][e]:e}query(e){return fz(this.url,e)}queries(e){return hz(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((n,o)=>{t[o]=n}),t}async parseBody(e){return uz(this,e)}#o=(e)=>{let{bodyCache:t,raw:n}=this,o=t[e];if(o)return o;for(let r in t)return t[r].then((i)=>{if(r==="json")i=JSON.stringify(i);return new Response(i)[e]()});return t[e]=n[e]()};json(){return this.#o("text").then((e)=>JSON.parse(e))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(e,t){(this.#t??={})[e]=t}valid(e){return this.#t?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[nz](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,e]])=>e)}get routePath(){return this.#e[0].map(([[,e]])=>e)[this.routeIndex].path}};var vz={Stringify:1,BeforeStream:2,Stream:3},Ox=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n};var gb=async(e,t,n,o,r)=>{if(typeof e==="object"&&!(e instanceof String)){if(!(e instanceof Promise))e=e.toString();if(e instanceof Promise)e=await e}let i=e.callbacks;if(!i?.length)return Promise.resolve(e);if(r)r[0]+=e;else r=[e];let a=Promise.all(i.map((s)=>s({phase:t,buffer:r,context:o}))).then((s)=>Promise.all(s.filter(Boolean).map((u)=>gb(u,t,!1,o,r))).then(()=>r[0]));if(n)return Ox(await a,i);else return a};var Nx="text/plain; charset=UTF-8",vb=(e,t)=>({"Content-Type":e,...t}),Is=(e,t)=>new Response(e,t),Db=class{#t;#e;env={};#r;finalized=!1;error;#i;#n;#o;#l;#u;#c;#s;#d;#m;constructor(e,t){if(this.#t=e,t)this.#n=t.executionCtx,this.env=t.env,this.#c=t.notFoundHandler,this.#m=t.path,this.#d=t.matchResult}get req(){return this.#e??=new gz(this.#t,this.#m,this.#d),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;else throw Error("This context has no ExecutionContext")}get res(){return this.#o||=Is(null,{headers:this.#s??=new Headers})}set res(e){if(this.#o&&e){e=Is(e.body,e);for(let[t,n]of this.#o.headers.entries()){if(t==="content-type")continue;if(t==="set-cookie"){let o=this.#o.headers.getSetCookie();e.headers.delete("set-cookie");for(let r of o)e.headers.append("set-cookie",r)}else e.headers.set(t,n)}}this.#o=e,this.finalized=!0}render=(...e)=>(this.#u??=(t)=>this.html(t),this.#u(...e));setLayout=(e)=>this.#l=e;getLayout=()=>this.#l;setRenderer=(e)=>{this.#u=e};header=(e,t,n)=>{if(this.finalized)this.#o=Is(this.#o.body,this.#o);let o=this.#o?this.#o.headers:this.#s??=new Headers;if(t===void 0)o.delete(e);else if(n?.append)o.append(e,t);else o.set(e,t)};status=(e)=>{this.#i=e};set=(e,t)=>{this.#r??=new Map,this.#r.set(e,t)};get=(e)=>this.#r?this.#r.get(e):void 0;get var(){if(!this.#r)return{};return Object.fromEntries(this.#r)}#a(e,t,n){let o=this.#o?new Headers(this.#o.headers):this.#s;if(typeof t==="object"&&t.headers){o??=new Headers;for(let[i,a]of new Headers(t.headers))if(i==="set-cookie")o.append(i,a);else o.set(i,a)}if(n){if(!o){let i=0;for(let a in n)if(++i>1||typeof n[a]!=="string"){o=new Headers;break}}if(o)for(let i in n){let a=n[i];if(typeof a==="string")o.set(i,a);else{o.delete(i);for(let s of a)o.append(i,s)}}}let r=typeof t==="number"?t:t?.status??this.#i;return Is(e,{status:r,headers:o??n})}newResponse=(...e)=>this.#a(...e);body=(e,t,n)=>this.#a(e,t,n);text=(e,t,n)=>!this.#s&&!this.#i&&!t&&!n&&!this.finalized?new Response(e):this.#a(e,t,vb(Nx,n));json=(e,t,n)=>this.#a(JSON.stringify(e),t,vb("application/json",n));html=(e,t,n)=>{let o=(r)=>this.#a(r,t,vb("text/html; charset=UTF-8",n));return typeof e==="object"?gb(e,vz.Stringify,!1,{}).then(o):o(e)};redirect=(e,t)=>{let n=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,t??302)};notFound=()=>(this.#c??=()=>Is(),this.#c(this))};var ft="ALL",Dz="all",yz=["get","post","put","delete","options","patch","query"],zm="Can not add a route since the matcher is already built.",Cm=class extends Error{};var _z="__COMPOSED_HANDLER";var jx=(e)=>e.text("404 Not Found",404),bz=(e,t)=>{if("getResponse"in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},$z=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(t={}){[...yz,Dz].forEach((i)=>{this[i]=(a,...s)=>{if(typeof a==="string")this.#t=a;else this.#i(i,this.#t,a);return s.forEach((u)=>{this.#i(i,this.#t,u)}),this}}),this.on=(i,a,...s)=>{for(let u of[a].flat()){this.#t=u;for(let c of[i].flat())s.map((l)=>{this.#i(c.toUpperCase(),this.#t,l)})}return this},this.use=(i,...a)=>{if(typeof i==="string")this.#t=i;else this.#t="*",a.unshift(i);return a.forEach((s)=>{this.#i(ft,this.#t,s)}),this};let{strict:o,...r}=t;Object.assign(this,r),this.getPath=o??!0?t.getPath??hb:mz}#e(){let t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#r=this.#r,t.routes=this.routes,t}#r=jx;errorHandler=bz;route(t,n){let o=this.basePath(t);return n.routes.map((r)=>{let i;if(n.errorHandler===bz)i=r.handler;else i=async(a,s)=>(await mb([],n.errorHandler)(a,()=>r.handler(a,s))).res,i[_z]=r.handler;o.#i(r.method,r.path,i,r.basePath)}),this}basePath(t){let n=this.#e();return n._basePath=pn(this._basePath,t),n}onError=(t)=>(this.errorHandler=t,this);notFound=(t)=>(this.#r=t,this);mount(t,n,o){let r,i;if(o)if(typeof o==="function")i=o;else if(i=o.optionHandler,o.replaceRequest===!1)r=(u)=>u;else r=o.replaceRequest;let a=i?(u)=>{let c=i(u);return Array.isArray(c)?c:[c]}:(u)=>{let c=void 0;try{c=u.executionCtx}catch{}return[u.env,c]};r||=(()=>{let u=pn(this._basePath,t),c=u==="/"?0:u.length;return(l)=>{let d=new URL(l.url);return d.pathname=this.getPath(l).slice(c)||"/",new Request(d,l)}})();let s=async(u,c)=>{let l=await n(r(u.req.raw),...a(u));if(l)return l;await c()};return this.#i(ft,pn(t,"*"),s),this}#i(t,n,o,r){t=t.toUpperCase(),n=pn(this._basePath,n);let i={basePath:r!==void 0?pn(this._basePath,r):this._basePath,path:n,method:t,handler:o};this.router.add(t,n,[o,i]),this.routes.push(i)}#n(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#o(t,n,o,r){if(r==="HEAD")return(async()=>new Response(null,await this.#o(t,n,o,"GET")))();let i=this.getPath(t,{env:o}),a=this.router.match(r,i),s=new Db(t,{path:i,matchResult:a,env:o,executionCtx:n,notFoundHandler:this.#r});if(a[0].length===1){let c;try{c=a[0][0][0][0](s,async()=>{s.res=await this.#r(s)})}catch(l){return this.#n(l,s)}return c instanceof Promise?c.then((l)=>l||(s.finalized?s.res:this.#r(s))).catch((l)=>this.#n(l,s)):c??this.#r(s)}let u=mb(a[0],this.errorHandler,this.#r);return(async()=>{try{let c=await u(s);if(!c.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#n(c,s)}})()}fetch=(t,...n)=>this.#o(t,n[1],n[0],t.method);request=(t,n,o,r)=>{if(t instanceof Request)return this.fetch(n?new Request(t,n):t,o,r);return t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${pn("/",t)}`,n),o,r)};fire=()=>{addEventListener("fetch",(t)=>{t.respondWith(this.#o(t.request,t,void 0,t.request.method))})}};var dt=()=>Object.create(null);var km=[];function yb(e,t){let n=this.buildAllMatchers(),o=(r,i)=>{let a=n[r]||n[ft],s=a[2][i];if(s)return s;let u=i.match(a[0]);if(!u)return[[],km];let c=u.indexOf("",1);return[a[1][c],u]};return this.match=o,o(e,t)}var hi="[^/]+",hn=".*",Ir="(?:|/.*)",fn=Symbol(),Sz=new Set(".\\+*[^]$()");function Lx(e,t){if(e.length===1)return t.length===1?e<t?-1:1:-1;if(t.length===1)return 1;if(e===hn||e===Ir)return t===Ir?-1:1;else if(t===hn||t===Ir)return-1;if(e===hi)return 1;else if(t===hi)return-1;return e.length===t.length?e<t?-1:1:t.length-e.length}var wz=class e{#t;#e;#r=dt();insert(t,n,o,r,i){let a=this;for(let s=0,u=t.length;s<u;s++){let c=t[s],l=c.length===1?c==="*"?s===u-1?["","",hn]:["","",hi]:null:c==="/*"?["","",Ir]:c.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),d;if(l){let m=l[1],p=l[2]||hi;if(m&&l[2]){if(p===".*")throw fn;if(p=p.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(p))throw fn;if(p.length===1&&Sz.has(p))throw fn}if(d=a.#r[p],!d){if(p!==hn&&p!==Ir){for(let h in a.#r)if((p.length>1||h.length>1)&&h!==hn&&h!==Ir)throw fn}d=a.#r[p]=new e}if(m!=="")d.#e??=r.varIndex++,o.push([m,d.#e])}else if(d=a.#r[c],!d){for(let m in a.#r)if(m.length>1&&m!==hn&&m!==Ir)throw fn;d=a.#r[c]=new e}a=d}if(a.#t!==void 0)throw fn;a.#t=i?-1:n}buildRegExpStr(){let n=Object.keys(this.#r).sort(Lx).map((o)=>{let r=this.#r[o],i=r.buildRegExpStr();return i===""?"":(typeof r.#e==="number"?`(${o})@${r.#e}`:Sz.has(o)?`\\${o}`:o)+i}).filter(Boolean);if(typeof this.#t==="number"&&this.#t!==-1)n.unshift(`#${this.#t}`);if(n.length===0)return"";if(n.length===1)return n[0];return"(?:"+n.join("|")+")"}};var _b=class{#t={varIndex:0};#e=new wz;#r=0;paths=dt();insert(e,t){if(t){this.#e.insert(e.split(""),0,[],this.#t,!0);return}let n=[],o=[],r=e;for(let a=0;;){let s=!1;if(r=r.replace(/\{[^}]+\}/g,(u)=>{let c=`@\\${a}`;return o[a]=[c,u],a++,s=!0,c}),!s)break}let i=r.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=o.length-1;a>=0;a--){let[s]=o[a];for(let u=i.length-1;u>=0;u--)if(i[u].indexOf(s)!==-1){i[u]=i[u].replace(s,o[a][1]);break}}this.#e.insert(i,this.#r,n,this.#t,!1),this.paths[e]=[this.#r++,n]}buildRegExp(){let e=this.#e.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,n=[],o=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(r,i,a)=>{if(i!==void 0)return n[++t]=Number(i),"$()";if(a!==void 0)return o[Number(a)]=++t,"";return""}),[new RegExp(`^${e}`),n,o]}};var Ez=dt();function zz(e){return Ez[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,n)=>n?`\\${n}`:t==="/*"?Ir:t==="*"?hn:`/:${hi}`)}$`)}function Rm(e,t){for(let n of Object.keys(e).sort((o,r)=>r.length-o.length))if(zz(n).test(t))return[...e[n]];return}var Im=class{name="RegExpRouter";#t;#e;#r;constructor(){this.#t={[ft]:dt()},this.#e={[ft]:dt()},this.#r={[ft]:new _b}}#i(e,t){try{this.#r[e].insert(t,!/\*|\/:/.test(t))}catch(n){throw n===fn?new Cm(t):n}}add(e,t,n){let o=this.#t,r=this.#e;if(!o)throw Error(zm);if(!o[e]){this.#r[e]=new _b;for(let s of[o,r]){s[e]=dt();for(let u in s[ft])s[e][u]=[...s[ft][u]],this.#i(e,u)}}if(t==="/*")t="*";let i=e===ft?Object.keys(o):[e];if(/\*$/.test(t)){let s=zz(t);for(let u of i)if(!o[u][t])this.#i(u,t),o[u][t]=Rm(o[u],t)||Rm(o[ft],t)||[];for(let u of[o,r])for(let c of i)for(let l in u[c])s.test(l)&&u[c][l].push([n,t]);return}let a=wm(t)||[t];for(let s of a)for(let u of i){if(!r[u][s])this.#i(u,s),r[u][s]=Rm(o[u],s)||Rm(o[ft],s)||[];r[u][s].push([n,s])}}match=yb;buildAllMatchers(){let e=dt();for(let t of Object.keys(this.#e))e[t]=this.#n(t);return this.#t=this.#e=this.#r=void 0,Ez=dt(),e}#n(e){let t=this.#t[e],n=this.#e[e],o=this.#r[e],r=dt(),i=[],[a,s,u]=o.buildRegExp();for(let c of[t,n])for(let l in c){let d=c[l],m=o.paths[l];if(!m){r[l]=[d.map(([p])=>[p,dt()]),km];continue}i[m[0]]=d.map(([p,h])=>[p,o.paths[h][1].reduceRight((v,[D],g)=>(v[D]=u[m[1][g][1]],v),dt())])}return[a,s.map((c)=>i[c]),r]}};var bb=class{name="SmartRouter";#t=[];#e=[];constructor(e){this.#t=e.routers}add(e,t,n){if(!this.#e)throw Error(zm);this.#e.push([e,t,n])}match(e,t){if(!this.#e)throw Error("Fatal error");let n=this.#t,o=this.#e,r=n.length,i=0,a;for(;i<r;i++){let s=n[i];try{for(let u=0,c=o.length;u<c;u++)s.add(...o[u]);a=s.match(e,t)}catch(u){if(u instanceof Cm)continue;throw u}this.match=s.match.bind(s),this.#t=[s],this.#e=void 0;break}if(i===r)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#e||this.#t.length!==1)throw Error("No active router has been determined yet.");return this.#t[0]}};var $b=dt(),Mx=0,Cz=class e{#t=[];#e=dt();#r=[];#i;#n=$b;insert(t,n,o){let r=this,i=cz(n),a=new Set,s=0;for(let u of i){let c=i[++s],l=lz(u,c)||(c===void 0&&u&&u.indexOf("*")===u.length-1?u:null),d=Array.isArray(l),m=d?l[0]:l||u,p=r.#e[m]||=new e;if(l&&!p.#i)p.#i=l,r.#r.push(p);if(r=p,d)a.add(l[1])}r.#t.push({[t]:{handler:o,possibleKeys:[...a],score:++Mx}})}#o(t,n,o,r,i){for(let a=0,s=n.#t.length;a<s;a++){let u=n.#t[a],c=u[o]||u[ft];if(c){c.params=dt(),t.push(c);for(let l=0,d=c.possibleKeys.length;l<d;l++){let m=c.possibleKeys[l];c.params[m]=i?.[m]&&!l?i[m]:r[m]??i?.[m]}}}}search(t,n){let o=[];this.#n=$b;let i=[this],a=fb(n),s=[],u=a.length,c=null;for(let l=0;l<u;l++){let d=a[l],m=l===u-1,p=[];for(let v=0,D=i.length;v<D;v++){let g=i[v],_=g.#e[d];if(_)if(_.#n=g.#n,m){if(_.#e["*"])this.#o(o,_.#e["*"],t,g.#n);this.#o(o,_,t,g.#n)}else p.push(_);for(let y of g.#r){let w=y.#i,C=g.#n===$b?{}:{...g.#n};if(typeof w==="string"){if(w==="*"||d.startsWith(w.slice(0,-1))){if(this.#o(o,y,t,g.#n),w==="*")y.#n=C,p.push(y)}continue}let[,S,b]=w;if(!d&&b===!0)continue;if(b!==!0){if(!c){c=[];let q=n[0]==="/"?1:0;for(let x=0;x<u;x++)c[x]=q,q+=a[x].length+1}let E=n.slice(c[l]),P=b.exec(E);if(P){if(C[S]=P[0],this.#o(o,y,t,g.#n,C),P[0].length===E.length&&y.#e["*"])this.#o(o,y.#e["*"],t,g.#n,C);for(let q in y.#e){y.#n=C;let x=P[0].match(/\//g)?.length??0;(s[x]||=[]).push(y);break}continue}}if(b===!0||b.test(d))if(C[S]=d,m){if(this.#o(o,y,t,C,g.#n),y.#e["*"])this.#o(o,y.#e["*"],t,C,g.#n)}else y.#n=C,p.push(y)}}let h=s.shift();i=h?p.concat(h):p}if(o[1])o.sort((l,d)=>l.score-d.score);return[o.map(({handler:l,params:d})=>[l,d])]}};var Sb=class{name="TrieRouter";#t=new Cz;add(e,t,n){for(let o of wm(t)||[t])this.#t.insert(e,o,n)}match(e,t){return this.#t.search(e,t)}};var Fm=class extends $z{constructor(e={}){super(e);this.router=e.router??new bb({routers:[new Im,new Sb]})}};function ot(e,t,n){return e.json(t,n)}function qx(e,t){return new Set([`http://${e}:${t}`,`http://localhost:${t}`,`http://[::1]:${t}`])}function wb(e){return new Fm().use("/*",async(n,o)=>{let r=n.req.header("host")??"";if(![`${e.bindHost}:${e.port}`,`localhost:${e.port}`,`[::1]:${e.port}`].includes(r))return ot(n,{ok:!1,error:"bad host",code:"VALIDATION"},400);for(let[a,s]of Object.entries(el))n.header(a,s);await o()}).use("/v1/*",async(n,o)=>{if(n.req.path==="/v1/csp-report"){await o();return}if(n.req.method==="OPTIONS")return ot(n,{ok:!1,error:"cors",code:"VALIDATION"},403);let r=/\/versions\/\d+\/raw$/.test(n.req.path),i=n.req.method==="GET"||n.req.method==="HEAD";if(i&&r){await o();return}if(!i&&n.req.method!=="DELETE"){if(!(n.req.header("content-type")??"").includes("application/json"))return ot(n,{ok:!1,error:"content-type",code:"VALIDATION"},400)}if(!i){let a=n.req.header("origin");if(a&&!qx(e.bindHost,e.port).has(a))return ot(n,{ok:!1,error:"origin",code:"VALIDATION"},403)}if(n.req.header("x-htmlark-token")!==e.token)return ot(n,{ok:!1,error:"unauthorized",code:"VALIDATION"},401);await o()}).onError((n,o)=>{if(n instanceof De)return ot(o,n.toJSON(),n.httpStatus);return ot(o,{ok:!1,error:n.message,code:"INTERNAL"},500)}).get("/health",(n)=>ot(n,{ok:!0,schema:1,bind:e.bindHost,port:e.port},200)).get("/",(n)=>{n.header("Content-Security-Policy","frame-ancestors 'none'");let o=e.webRoot?Iz(e.webRoot,"index.html"):"";if(o&&kz(o)){let r=Rz(o,"utf8");if(!r.includes('name="htmlark-token"'))r=r.replace("<head>",`<head><meta name="htmlark-token" content="${e.token}">`);return n.html(r)}return n.html(`<!doctype html><html><head><meta charset="utf-8"><meta name="htmlark-token" content="${e.token}"><title>htmlark</title>
364
364
  <style>body{font-family:sans-serif;background:#111;color:#eee;margin:24px}a{color:#8ab4f8}</style>
365
365
  </head><body><h1>htmlark</h1><div id="list">loading…</div>
366
366
  <script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htmlark",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first runtime for AI-generated HTML artifacts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- html,body,#app{height:100%;margin:0}body{color:#e8eaed;background:#0f1114;font-family:ui-sans-serif,system-ui,sans-serif}.shell.svelte-9bibt2{grid-template-columns:200px 1fr;height:100%;display:grid}aside.svelte-9bibt2{background:#16181c;border-right:1px solid #2a2e34;padding:16px 12px}.brand.svelte-9bibt2{margin-bottom:18px;font-weight:650}nav.svelte-9bibt2 .on:where(.svelte-9bibt2){background:#2a3140;border-radius:4px;padding:6px 8px;display:block}.hint.svelte-9bibt2{color:#8b919a;margin-top:24px;font-size:12px}.main.svelte-9bibt2{flex-direction:column;min-width:0;display:flex}.bar.svelte-9bibt2{border-bottom:1px solid #2a2e34;gap:8px;padding:12px;display:flex}input.svelte-9bibt2,select.svelte-9bibt2,button.svelte-9bibt2{font:inherit;color:inherit;background:#1c1f24;border:1px solid #3a4048;border-radius:4px;padding:6px 8px}.bar.svelte-9bibt2 input:where(.svelte-9bibt2){flex:1}.key.svelte-9bibt2{max-width:180px}.import.svelte-9bibt2{cursor:pointer;border:1px solid #3a4048;border-radius:4px;padding:6px 10px;position:relative;overflow:hidden}.import.svelte-9bibt2 input:where(.svelte-9bibt2){opacity:0;cursor:pointer;position:absolute;inset:0}table.svelte-9bibt2{border-collapse:collapse;width:100%;font-size:13px}th.svelte-9bibt2,td.svelte-9bibt2{text-align:left;border-bottom:1px solid #2a2e34;padding:8px 10px}th.svelte-9bibt2{color:#8b919a;font-weight:550}tr.svelte-9bibt2{cursor:pointer}tr.sel.svelte-9bibt2,tr.svelte-9bibt2:hover{background:#1c222b}.mono.svelte-9bibt2{color:#9aa3ad;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.dirty.svelte-9bibt2{color:#e0a154}.split.svelte-9bibt2{flex:1;grid-template-columns:minmax(0,1fr) 420px;min-height:0;display:grid}.detail.svelte-9bibt2{border-left:1px solid #2a2e34;padding:12px;overflow:auto}.detail-h.svelte-9bibt2{justify-content:space-between;gap:8px;display:flex}a.svelte-9bibt2{color:#8ab4f8}.vers.svelte-9bibt2{flex-wrap:wrap;gap:4px;margin:8px 0;display:flex}.vers.svelte-9bibt2 button.on:where(.svelte-9bibt2){background:#2f6fed;border-color:#2f6fed}iframe.svelte-9bibt2{background:#fff;border:1px solid #2a2e34;width:100%;height:220px}.src.svelte-9bibt2{background:#12141a;max-height:180px;padding:8px;font-size:11px;overflow:auto}.actions.svelte-9bibt2{gap:8px;margin-top:12px;display:flex}.danger.svelte-9bibt2{color:#f0a0a0;border-color:#8a3030}.err.svelte-9bibt2{color:#f28b82;padding:0 12px}.mute.svelte-9bibt2{color:#8b919a;padding:12px}
@@ -1,2 +0,0 @@
1
- (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible,d=()=>{};function f(e){for(var t=0;t<e.length;t++)e[t]()}function p(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var m=1024,h=2048,g=4096,_=8192,v=16384,y=32768,b=1<<25,x=65536,S=1<<19,C=1<<20,ee=1<<25,w=65536,te=1<<21,ne=1<<22,re=1<<23,ie=Symbol(`$state`),ae=Symbol(`component`),oe=Symbol(`legacy props`),se=Symbol(``),ce=Symbol(`attributes`),le=Symbol(`class`),ue=Symbol(`style`),de=Symbol(`text`),fe=Symbol(`form reset`),pe=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},me=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),he={},T=Symbol(`uninitialized`),ge=`http://www.w3.org/1999/xhtml`;function _e(){console.warn(`https://svelte.dev/e/derived_inert`)}function ve(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ye(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function be(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var E=!1;function xe(e){E=e}var D;function O(e){if(e===null)throw ve(),he;return D=e}function Se(){return O(cn(D))}function k(e){if(E){if(cn(D)!==null)throw ve(),he;D=e}}function Ce(e=1){if(E){for(var t=e,n=D;t--;)n=cn(n);D=n}}function we(e=!0){for(var t=0,n=D;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=cn(n);e&&n.remove(),n=i}}function Te(e){if(!e||e.nodeType!==8)throw ve(),he;return e.data}function Ee(e){return e===this.v}function De(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Oe(e){return!De(e,this.v)}function ke(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Ae(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function je(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Me(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ne(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Pe(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Fe(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ie(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Le(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Re(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function ze(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Be(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}function Ve(e){let t=e.p;for(;t!==null&&t.c===null;)t=t.p;return t?.c??null}function He(e,t){return e===null&&ke(t),e.c??=new Map(Ve(e)||void 0)}var A=null;function Ue(e){A=e}function We(e){return He(A,`getContext`).get(e)}function Ge(e,t){return He(A,`setContext`).set(e,t),t}function Ke(e,t=!1,n){A={p:A,i:!1,c:null,e:null,s:e,x:null,r:W,l:null}}function qe(e){var t=A,n=t.e;if(n!==null){t.e=null;for(var r of n)Sn(r)}return e!==void 0&&(t.x=e),t.i=!0,A=t.p,Je(e)}function Je(e={}){return i(e,ae,{value:!0}),e}function Ye(){return!0}var Xe=[];function Ze(){var e=Xe;Xe=[],f(e)}function Qe(e){if(Xe.length===0&&!Ot){var t=Xe;queueMicrotask(()=>{t===Xe&&Ze()})}Xe.push(e)}function $e(){for(;Xe.length>0;)Ze()}var et=~(h|g|m);function j(e,t){e.f=e.f&et|t}function tt(e){e.f&512||e.deps===null?j(e,m):j(e,g)}function nt(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=w,nt(t.deps))}function rt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),nt(e.deps),j(e,m)}var it=!1;function at(e){var t=it;try{return it=!1,[e(),it]}finally{it=t}}var ot=!1;function st(){ot||(ot=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[fe]?.()})},{capture:!0}))}function ct(e){var t=V,n=W;U(null),Wn(null);try{return e()}finally{U(t),Wn(n)}}function lt(e,t,n,r=n){e.addEventListener(t,()=>ct(n));let i=e[fe];e[fe]=i?()=>{i(),r(!0)}:()=>r(!0),st()}function ut(e,t,n,r){let i=Ye()?mt:vt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=W,c=dt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){hn(e,s)}ft()}}var d=pt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>gt(e))).then(u).catch(e=>hn(e,s)).finally(d)}l?l.then(()=>{c(),f(),ft()}):f()}function dt(){var e=W,t=V,n=A,r=M;return function(i=!0){Wn(e),U(t),Ue(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ft(e=!0){Wn(null),U(null),Ue(null),e&&M?.deactivate()}function pt(){var e=W,t=e.b,n=M,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function mt(e){var t=2|h;return W!==null&&(W.f|=S),{ctx:A,deps:null,effects:null,equals:Ee,f:t,fn:e,reactions:null,rv:0,v:T,wv:0,parent:W,ac:null}}var ht=Symbol(`obsolete`);function gt(e,t,n){let r=W;r===null&&Ae();var i=void 0,a=Gt(T),o=!V,s=new Set;return En(()=>{var t=W,n=p();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==pe&&n.reject(e)}).finally(ft)}catch(e){n.reject(e),ft()}var c=M;if(o){if(t.f&32768)var l=pt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(ht);else for(let e of s.values())e.reject(ht);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==ht&&(c.activate(),t?(a.f|=re,qt(a,t)):(a.f&8388608&&(a.f^=re),qt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),bn(()=>{for(let e of s)e.reject(ht)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function _t(e){let t=mt(e);return Kn(t),t}function vt(e){let t=mt(e);return t.equals=Oe,t}function yt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)B(t[n])}}function bt(e){var t,n=W,r=e.parent;if(!Hn&&r!==null&&e.v!==T&&r.f&24576)return _e(),e.v;Wn(r);try{e.f&=~w,yt(e),t=tr(e)}finally{Wn(n)}return t}function xt(e){var t=bt(e);if(!e.equals(t)&&(e.wv=Qn(),(!M?.is_fork||e.deps===null)&&(M===null?e.v=t:(M.capture(e,t,!0),Tt?.capture(e,t,!0)),e.deps===null))){j(e,m);return}Hn||(Et===null?tt(e):(yn()||M?.is_fork)&&Et.set(e,t))}function St(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&ct(()=>{t.ac.abort(pe),t.ac=null}),t.fn!==null&&(t.teardown=d),ir(t,0),jn(t))}function Ct(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&ar(t)}var wt=null,M=null,Tt=null,Et=null,Dt=null,Ot=!1,kt=!1,At=null,jt=null,Mt=0,Nt=1,Pt=class e{id=Nt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){wt===null?wt=this:(wt.#n=this,this.#t=wt),wt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)j(r,h),t(r);for(r of n.m)j(r,g),t(r)}this.#p.add(e)}#g(){this.#e=!0,Mt++>1e3&&(this.#x(),It());for(let e of this.#u)this.#d.delete(e),j(e,h),this.schedule(e);for(let e of this.#d)j(e,g),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=At=[],r=[],i=jt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Vt(e),this.#h()||this.discard(),t}if(M=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(At=null,jt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Bt(e,t);i.length>0&&M.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Tt=this,Rt(r),Rt(n),Tt=null,this.#s?.resolve();var s=M;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Ut.clear(),s.#g())}#_(e,t,n){e.f^=m;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=m:i&4?t.push(r):$n(r)&&(i&16&&this.#d.add(r),ar(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),j(i,h),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),M=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)rt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==T&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),Et?.set(e,t)),this.is_fork||(e.v=t)}activate(){M=this}deactivate(){M=null,Et=null}flush(){try{kt=!0,M=this,this.#g()}finally{Mt=0,Dt=null,At=null,jt=null,kt=!1,M=null,Et=null,Ut.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(ht);this.#x(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,Qe(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=p()).promise}static ensure(){if(M===null){let t=M=new e;!kt&&!Ot&&Qe(()=>{t.#e||t.flush()})}return M}apply(){Et=null}schedule(e){if(Dt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(At!==null&&t===W&&(V===null||!(V.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=m}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?wt=e:t.#t=e,this.linked=!1}}};function Ft(e){var t=Ot;Ot=!0;try{var n;for(e&&(M!==null&&!M.is_fork&&M.flush(),n=e());;){if($e(),M===null)return n;M.flush()}}finally{Ot=t}}function It(){try{Fe()}catch(e){hn(e,Dt)}}var Lt=null;function Rt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&$n(r)&&(Lt=new Set,ar(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Pn(r),Lt?.size>0)){Ut.clear();for(let e of Lt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Lt.has(n)&&(Lt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||ar(n)}}Lt.clear()}}Lt=null}}function zt(e){M.schedule(e)}function Bt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),j(e,m);for(var n=e.first;n!==null;)Bt(n,t),n=n.next}}function Vt(e){j(e,m);for(var t=e.first;t!==null;)Vt(t),t=t.next}var Ht=new Set,Ut=new Map,Wt=!1;function Gt(e,t){return{f:0,v:e,reactions:null,equals:Ee,rv:0,wv:0}}function N(e,t){let n=Gt(e,t);return Kn(n),n}function Kt(e,t=!1,n=!0){let r=Gt(e);return t||(r.equals=Oe),r}function P(e,t,n=!1){return V!==null&&(!H||V.f&131072)&&Ye()&&V.f&4325394&&(Gn===null||!Gn.has(e))&&ze(),qt(e,n?Qt(t):t,jt)}function qt(e,t,n=null){if(!e.equals(t)){Hn?Ut.set(e,t):Ut.has(e)||Ut.set(e,e.v);var r=Pt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&bt(t),Et===null&&tt(t)}e.wv=Qn(),Zt(e,h,n),Ye()&&W!==null&&W.f&1024&&!(W.f&96)&&(q===null?qn([e]):q.push(e)),!r.is_fork&&Ht.size>0&&!Wt&&Jt()}return t}function Jt(){Wt=!1;for(let e of Ht){e.f&1024&&j(e,g);let t;try{t=$n(e)}catch{t=!0}t&&ar(e)}Ht.clear()}function Yt(e,t=1){var n=J(e),r=t===1?n++:n--;return P(e,n),r}function Xt(e){P(e,e.v+1)}function Zt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ye(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==W){var l=(c&h)===0;if(l&&j(s,t),c&131072)Ht.add(s);else if(c&2){var u=s;Et?.delete(u),c&65536||(c&512&&(W===null||!(W.f&2097152))&&(s.f|=w),Zt(u,g,n))}else if(l){var d=s;c&16&&Lt!==null&&Lt.add(d),n===null?zt(d):n.push(d)}}}}function Qt(t){if(typeof t!=`object`||!t||ie in t||ae in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=N(0),u=null,d=Xn,f=e=>{if(Xn===d)return e();var t=V,n=Xn;U(null),Zn(d);var r=e();return U(t),Zn(n),r};return i&&r.set(`length`,N(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Le();var i=r.get(t);return i===void 0?f(()=>{var e=N(n.value,u);return r.set(t,e),e}):P(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>N(T,u));r.set(t,e),Xt(o)}}else P(n,T),Xt(o);return!0},get(e,n,i){if(n===ie)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>N(Qt(s?e[n]:T),u)),r.set(n,o)),o!==void 0){var c=J(o);return c===T?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=J(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==T)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ie)return!0;var n=r.get(t),i=n!==void 0&&n.v!==T||Reflect.has(e,t);return(n!==void 0||W!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>N(i?Qt(e[t]):T,u)),r.set(t,n)),J(n)===T)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>N(T,u)),r.set(d+``,p)):P(p,T)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>N(void 0,u)),P(c,Qt(n)),r.set(t,c));else{l=c.v!==T;var m=f(()=>Qt(n));P(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&P(g,_+1)}Xt(o)}return!0},ownKeys(e){J(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==T});for(var[n,i]of r)i.v!==T&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Re()}})}function $t(e){try{if(typeof e==`object`&&e&&ie in e)return e[ie]}catch{}return e}function en(e,t){return Object.is($t(e),$t(t))}var tn,nn,rn,an;function on(){if(tn===void 0){tn=window,nn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;rn=a(t,`firstChild`).get,an=a(t,`nextSibling`).get,u(e)&&(e[le]=void 0,e[ce]=null,e[ue]=void 0,e.__e=void 0),u(n)&&(n[de]=void 0)}}function F(e=``){return document.createTextNode(e)}function sn(e){return rn.call(e)}function cn(e){return an.call(e)}function I(e,t){if(!E)return sn(e);var n=sn(D);if(n===null)n=D.appendChild(F());else if(t&&n.nodeType!==3){var r=F();return n?.before(r),O(r),r}return t&&pn(n),O(n),n}function ln(e,t=!1){if(!E){var n=sn(e);return n instanceof Comment&&n.data===``?cn(n):n}if(t){if(D?.nodeType!==3){var r=F();return D?.before(r),O(r),r}pn(D)}return D}function L(e,t=!1){if(!E)return sn(e);var n=I(e,t);return k(e),n}function R(e,t=1,n=!1){let r=E?D:e;for(var i;t--;)i=r,r=cn(r);if(!E)return r;if(n){if(r?.nodeType!==3){var a=F();return r===null?i?.after(a):r.before(a),O(a),a}pn(r)}return O(r),r}function un(e){e.textContent=``}function dn(){return!1}function fn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function pn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function mn(e){var t=W;if(t===null)return V.f|=re,e;if(!(t.f&32768)&&!(t.f&4))throw e;hn(e,t)}function hn(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function gn(e){W===null&&(V===null&&Pe(e),Ne()),Hn&&Me(e)}function _n(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function vn(e,t){var n=W;n!==null&&n.f&8192&&(e|=_);var r={ctx:A,deps:null,nodes:null,f:e|h|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};M?.register_created_effect(r);var i=r;if(e&4)At===null?Pt.ensure().schedule(r):At.push(r);else if(t!==null){try{ar(r)}catch(e){throw B(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=x))}if(i!==null&&(i.parent=n,n!==null&&_n(i,n),V!==null&&V.f&2&&!(e&64))){var a=V;(a.effects??=[]).push(i)}return r}function yn(){return V!==null&&!H}function bn(e){let t=vn(8,null);return j(t,m),t.teardown=e,t}function xn(e){gn(`$effect`);var t=W.f;if(!V&&t&32&&A!==null&&!A.i){var n=A;(n.e??=[]).push(e)}else return Sn(e)}function Sn(e){return vn(4|C,e)}function Cn(e){return gn(`$effect.pre`),vn(8|C,e)}function wn(e){Pt.ensure();let t=vn(64|S,e);return(e={})=>new Promise(n=>{e.outro?Fn(t,()=>{B(t),n(void 0)}):(B(t),n(void 0))})}function Tn(e){return vn(4,e)}function En(e){return vn(ne|S,e)}function Dn(e,t=0){return vn(8|t,e)}function On(e,t=[],n=[],r=[]){ut(r,t,n,t=>{vn(8,()=>{e(...t.map(J))})})}function kn(e,t=0){return vn(16|t,e)}function z(e){return vn(32|S,e)}function An(e){var t=e.teardown;if(t!==null){let n=Hn,r=V;Un(!0),U(null);try{t.call(null)}catch(t){hn(t,e.parent)}finally{Un(n),U(r)}}}function jn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&ct(()=>{e.abort(pe)});var r=n.next;n.f&64?n.parent=null:B(n,t),n=r}}function Mn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||B(t),t=n}}function B(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Nn(e.nodes.start,e.nodes.end),n=!0),e.f|=b,jn(e,t&&!n),ir(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();An(e),e.f^=b,e.f|=v;var i=e.parent;i!==null&&i.first!==null&&Pn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Nn(e,t){for(;e!==null;){var n=e===t?null:cn(e);e.remove(),e=n}}function Pn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Fn(e,t,n=!0){var r=[];e.f|=256,In(e,r,!0);var i=()=>{n&&B(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function In(e,t,n){if(!(e.f&8192)){e.f^=_;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);In(i,t,o?n:!1)}i=a}}}function Ln(e){e.f&=-257,Rn(e,!0)}function Rn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=_,e.f&1024||(j(e,h),Pt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Rn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function zn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:cn(n);t.append(n),n=i}}var Bn=null,Vn=!1,Hn=!1;function Un(e){Hn=e}var V=null,H=!1;function U(e){V=e}var W=null;function Wn(e){W=e}var Gn=null;function Kn(e){V!==null&&(Gn??=new Set).add(e)}var G=null,K=0,q=null;function qn(e){q=e}var Jn=1,Yn=0,Xn=Yn;function Zn(e){Xn=e}function Qn(){return++Jn}function $n(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~w),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if($n(a)&&xt(a),a.wv>e.wv)return!0}t&512&&Et===null&&j(e,m)}return!1}function er(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Gn!==null&&Gn.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?er(a,t,!1):t===a&&(n?j(a,h):a.f&1024&&j(a,g),zt(a))}}function tr(e){var t=G,n=K,r=q,i=V,a=Gn,o=A,s=H,c=Xn,l=e.f;G=null,K=0,q=null,V=l&96?null:e,Gn=null,Ue(e.ctx),H=!1,Xn=++Yn,e.ac!==null&&(ct(()=>{e.ac.abort(pe)}),e.ac=null);try{e.f|=te;var u=e.fn,d=u();e.f|=y;var f=nr(e);if(Ye()&&q!==null&&!H&&f!==null&&!(e.f&6146))for(var p=0;p<q.length;p++)er(q[p],e);if(i!==null&&i!==e){if(Yn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Yn;if(t!==null)for(let e of t)e.rv=Yn;q!==null&&(r===null?r=q:r.push(...q))}return e.f&8388608&&(e.f^=re),d}catch(t){return nr(e),mn(t)}finally{e.f^=te,G=t,K=n,q=r,V=i,Gn=a,Ue(o),H=s,Xn=c}}function nr(e){var t=e.deps,n=M?.is_fork;if(G!==null){var r;if(n||ir(e,K),t!==null&&K>0)for(t.length=K+G.length,r=0;r<G.length;r++)t[K+r]=G[r];else e.deps=t=G;if(yn()&&e.f&512)for(r=K;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&K<t.length&&(ir(e,K),t.length=K);return t}function rr(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(G===null||!n.call(G,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~w),s.v!==T&&tt(s),s.ac!==null&&ct(()=>{s.ac.abort(pe),s.ac=null,j(s,h)}),St(s),ir(s,0)}}function ir(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)rr(e,n[r])}function ar(e){var t=e.f;if(!(t&16384)){j(e,m);var n=W,r=Vn;W=e,Vn=!(t&96);try{t&16777232?Mn(e):jn(e),An(e);var i=tr(e);e.teardown=typeof i==`function`?i:null,e.wv=Jn}finally{Vn=r,W=n}}}async function or(){await Promise.resolve(),Ft()}function J(e){var t=!!(e.f&2);if(Bn?.add(e),V!==null&&!H&&!(W!==null&&W.f&16384)&&(Gn===null||!Gn.has(e))){var r=V.deps;if(V.f&2097152)e.rv<Yn&&(e.rv=Yn,G===null&&r!==null&&r[K]===e?K++:G===null?G=[e]:G.push(e));else{V.deps??=[],n.call(V.deps,e)||V.deps.push(e);var i=e.reactions;i===null?e.reactions=[V]:n.call(i,V)||i.push(V)}}if(Hn&&Ut.has(e))return Ut.get(e);if(t){var a=e;if(Hn){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||cr(a))&&(o=bt(a)),Ut.set(a,o),o}var s=!(a.f&512)&&!H&&V!==null&&(Vn||!!(V.f&512)),c=(a.f&y)===0;$n(a)&&(s&&(a.f|=512),xt(a)),s&&!c&&(Ct(a),sr(a))}if(Et?.has(e))return Et.get(e);if(e.f&8388608)throw e.v;return e.v}function sr(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(Ct(t),sr(t))}function cr(e){if(e.v===T)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Ut.has(t)||t.f&2&&cr(t))return!0;return!1}function lr(e){var t=H;try{return H=!0,e()}finally{H=t}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var ur=[`touchstart`,`touchmove`];function dr(e){return ur.includes(e)}var fr=Symbol(`events`),pr=new Set,mr=new Set;function hr(e,t,n){(t[fr]??={})[e]=n}function gr(e){for(var t=0;t<e.length;t++)pr.add(e[t]);for(var n of mr)n(e)}var _r=null,vr=!1;function yr(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;_r=e,vr||(vr=!0,setTimeout(()=>{vr=!1,_r=null}));var s=0,c=_r===e&&e[fr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[fr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=V,f=W;U(null),Wn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[fr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[fr]=t,delete e.currentTarget,U(d),Wn(f)}}}var br=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function xr(e){return br?.createHTML(e)??e}function Sr(e){var t=fn(`template`);return t.innerHTML=xr(e.replaceAll(`<!>`,`<!---->`)),t.content}function Cr(e,t){var n=W;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function wr(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(E)return Cr(D,null),D;i===void 0&&(i=Sr(a?e:`<!>`+e),n||(i=sn(i)));var t=r||nn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=sn(t),s=t.lastChild;Cr(o,s)}else Cr(t,t);return t}}function Tr(e=``){if(!E){var t=F(e+``);return Cr(t,t),t}var n=D;return n.nodeType===3?pn(n):(n.before(n=F()),O(n)),Cr(n,n),n}function Er(){if(E)return Cr(D,null),D;var e=document.createDocumentFragment(),t=document.createComment(``),n=F();return e.append(t,n),Cr(t,n),e}function Y(e,t){if(E){var n=W;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=D),Se();return}e!==null&&e.before(t)}function Dr(e){let t=0,n=Gt(0),r;return()=>{yn()&&(J(n),Dn(()=>(t===0&&(r=lr(()=>e(()=>Xt(n)))),t+=1,()=>{Qe(()=>{--t,t===0&&(r?.(),r=void 0,Xt(n))})})))}}var Or=x|S;function kr(e,t,n,r){new Ar(e,t,n,r)}var Ar=class{parent;is_pending=!1;transform_error;#e;#t=E?D:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Dr(()=>(this.#m=Gt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=W;t.b=this,t.f|=128,n(e)},this.parent=W.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=kn(()=>{if(E){let e=this.#t;Se();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},Or),E&&(this.#e=D)}#g(){try{this.#a=z(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Qe(r),t&&(this.#s=z(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){be();return}t=!0,n&&Be(),this.#s!==null&&Fn(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){hn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=z(()=>e(this.#e)),Qe(()=>{var e=this.#c=document.createDocumentFragment(),t=F(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return z(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){hn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(M);return}this.#u===0&&(this.#e.before(e),this.#c=null,Fn(this.#o,()=>{this.#o=null}),this.#x(M))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=z(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();zn(this.#a,e);let t=this.#n.pending;this.#o=z(()=>t(this.#e))}else this.#x(M)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){rt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=W,n=V,r=A;Wn(this.#i),U(this.#i),Ue(this.#i.ctx);try{return Pt.ensure(),e()}finally{Wn(t),U(n),Ue(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Fn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Qe(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),J(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;M?.is_fork?(this.#a&&M.skip_effect(this.#a),this.#o&&M.skip_effect(this.#o),this.#s&&M.skip_effect(this.#s),M.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(B(this.#a),null),this.#o&&=(B(this.#o),null),this.#s&&=(B(this.#s),null),E&&(O(this.#t),Ce(),O(we()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return z(()=>{var r=W;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return hn(e,this.#i.parent),null}}))};Qe(()=>{var t;try{t=this.transform_error(e)}catch(e){hn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>hn(e,this.#i&&this.#i.parent)):n(t)})}};function X(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[de]??=e.nodeValue)&&(e[de]=n,e.nodeValue=`${n}`)}function jr(e,t){return Nr(e,t)}var Mr=new Map;function Nr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){on();var l=void 0,u=wn(()=>{var s=n??t.appendChild(F());kr(s,{pending:()=>{}},t=>{Ke({});var n=A;if(o&&(n.c=o),a&&(i.$$events=a),E&&Cr(t,null),l=e(t,i)||Je(),E&&(W.nodes.end=D,D===null||D.nodeType!==8||D.data!==`]`))throw ve(),he;qe()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=dr(r);for(let e of[t,document]){var a=Mr.get(e);a===void 0&&(a=new Map,Mr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,yr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(pr)),mr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=Mr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,yr),r.delete(e),r.size===0&&Mr.delete(n)):r.set(e,i)}mr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Pr.set(l,u),l}var Pr=new WeakMap,Fr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Ln(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Ln(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(B(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();zn(r,t),t.append(F()),this.#n.set(e,{effect:r,fragment:t})}else B(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Fn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(B(n.effect),this.#n.delete(e))};ensure(e,t){var n=M,r=dn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=F();i.append(a),this.#n.set(e,{effect:z(()=>t(a)),fragment:i})}else this.#t.set(e,z(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else E&&(this.anchor=D),this.#a(n)}};function Ir(e,t,n=!1){var r;E&&(r=D,Se());var i=new Fr(e),a=n?x:0;function o(e,t){if(E){var n=Te(r);if(e!==parseInt(n.substring(1))){var a=we();O(a),i.anchor=a,xe(!1),i.ensure(e,t),xe(!0);return}}i.ensure(e,t)}kn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function Lr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];Fn(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Rr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;un(d),d.append(u),e.items.clear()}Rr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Rr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ee,zn(a,document.createDocumentFragment())):B(t[i],n)}}var zr;function Br(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=E?O(sn(u)):u.appendChild(F())}E&&Se();var d=null,f=vt(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Hr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ee,Wr(d,null,c)):Ln(d):Fn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:kn(()=>{p=J(f);var e=p.length;let t=!1;E&&Te(c)===`[!`!=(e===0)&&(c=we(),O(c),xe(!1),t=!0);for(var r=new Set,u=M,v=dn(),y=0;y<e;y+=1){E&&D.nodeType===8&&D.data===`]`&&(c=D,t=!0,xe(!1));var b=p[y],x=a(b,y),S=h?null:l.get(x);S?(S.v&&qt(S.v,b),S.i&&qt(S.i,y),v&&u.unskip_effect(S.e)):(S=Ur(l,h?c:zr??=F(),b,x,y,o,n,i),h||(S.e.f|=ee),l.set(x,S)),r.add(x)}if(e===0&&s&&!d&&(h?d=z(()=>s(c)):(d=z(()=>s(zr??=F())),d.f|=ee)),e>r.size&&je(``,``,``),E&&e>0&&O(we()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&xe(!0),J(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,E&&(c=D)}function Vr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Hr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Vr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(Ln(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=ee,_===l)Wr(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Gr(e,d,_),Gr(e,_,y),Wr(_,y,n),d=_,p=[],m=[],l=Vr(d.next);continue}}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],C=p[p.length-1];for(x=0;x<p.length;x+=1)Wr(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Gr(e,S.prev,C.next),Gr(e,d,S),Gr(e,C,b),l=b,d=C,--v,p=[],m=[]}else u.delete(_),Wr(_,l,n),Gr(e,_.prev,_.next),Gr(e,_,d===null?e.effect.first:d.next),Gr(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=Vr(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=Vr(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Rr(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var w=[];if(u!==void 0)for(_ of u)_.f&8192||w.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&w.push(l),l=Vr(l.next);var te=w.length;if(te>0){var ne=i&4&&s===0?n:null;if(o){for(v=0;v<te;v+=1)w[v].nodes?.a?.measure();for(v=0;v<te;v+=1)w[v].nodes?.a?.fix()}Lr(e,w,ne)}}o&&Qe(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Ur(e,t,n,r,i,a,o,s){var c=o&1?o&16?Gt(n):Kt(n,!1,!1):null,l=o&2?Gt(i):null;return{v:c,i:l,e:z(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Wr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=cn(r);if(a.before(r),r===i)return;r=o}}function Gr(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Kr(e,t,...n){var r=new Fr(e);kn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},x)}var qr=[...`
2
- \r\f\xA0\v`];function Jr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||qr.includes(r[o-1]))&&(s===r.length||qr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Yr(e,t,n,r,i,a){var o=e[le];if(E||o!==n||o===void 0){var s=Jr(n,r,a);(!E||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[le]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Xr(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function Zr(t,n){var r=t.__defaultValue,i=t.multiple,a=i?r??[]:null;if(!i||e(a)){var o=t.selectedIndex,s=n&&i?new Set(t.selectedOptions):null;for(var c of t.options){var l=ti(c);Xr(c,i?a.includes(l):en(l,r))}if(n){if(s!==null)for(c of t.options){var u=s.has(c);c.selected!==u&&(c.selected=u)}else t.selectedIndex!==o&&(t.selectedIndex=o)}}}function Qr(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return ye();for(var i of t.options)i.selected=n.includes(ti(i));return}for(i of t.options)if(en(ti(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function $r(e){var t=new MutationObserver(t=>{t.every(ni)||(`__defaultValue`in e&&Zr(e,!1),`__value`in e&&Qr(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),bn(()=>{t.disconnect()})}function ei(e,t,n=t){var r=new WeakSet,i=!0;lt(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),ti);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&ti(o)}n(a),e.__value=a,M!==null&&r.add(M)}),Tn(()=>{var a=t();if(e===document.activeElement){var o=M;if(r.has(o))return}if(Qr(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=ti(s),n(a))}e.__value=a,i=!1})}function ti(e){return`__value`in e?e.__value:e.value}function ni(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var ri=Symbol(`is custom element`),ii=Symbol(`is html`),ai=me?`link`:`LINK`;function oi(e){if(E){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;si(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;si(e,`checked`,null),e.checked=r}}};e[fe]=n,Qe(n),st()}}function si(e,t,n,r){var i=ci(e);E&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===ai)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[se]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&ui(e).has(t)?e[t]=n:e.setAttribute(t,n))}function ci(e){return e[ce]??={[ri]:e.nodeName.includes(`-`),[ii]:e.namespaceURI===ge}}var li=new Map;function ui(e){var t=e.getAttribute(`is`)||e.nodeName,n=li.get(t);if(n)return n;li.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function di(e,t,n=t){var r=new WeakSet;lt(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=fi(e)?pi(a):a,n(a),M!==null&&r.add(M),await or(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(E&&e.defaultValue!==e.value||lr(t)==null&&e.value)&&(n(fi(e)?pi(e.value):e.value),M!==null&&r.add(M)),Dn(()=>{var n=t();if(e===document.activeElement){var i=M;if(r.has(i))return}fi(e)&&n===pi(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}function fi(e){var t=e.type;return t===`number`||t===`range`}function pi(e){return e===``?null:+e}function mi(e,t,n,r){var i=!0,o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=mt(r),J(u)):(l&&(l=!1,c=s?lr(r):r),c);let f;if(o){var p=ie in e||oe in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=at(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Ie(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?mt:vt)(()=>(v=!1,g()));o&&J(y);var b=W;return(function(e,t){if(arguments.length>0){let n=t?J(y):i&&o?Qt(e):e;return P(y,n),v=!0,c!==void 0&&(c=n),e}return Hn&&v||b.f&16384?y.v:J(y)})}function hi(e){A===null&&ke(`onMount`),xn(()=>{let t=lr(e);if(typeof t==`function`)return t})}function gi(e){A===null&&ke(`onDestroy`),hi(()=>()=>lr(e))}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var _i={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},vi=new class{#e=_i;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function yi(e){setTimeout(e,0)}var bi=typeof window>`u`||`Deno`in globalThis;function Z(){}function xi(e,t){return typeof e==`function`?e(t):e}function Si(e){return typeof e==`number`&&e>=0&&e!==1/0}function Ci(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Q(e,t){return typeof e==`function`?e(t):e}function wi(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Ei(o,t.options))return!1}else if(!Oi(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ti(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Di(t.options.mutationKey)!==Di(a))return!1}else if(!Oi(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ei(e,t){return(t?.queryKeyHashFn||Di)(e)}function Di(e){return JSON.stringify(e,(e,t)=>Ni(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Oi(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Oi(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Oi(e[r],t[r]))return!1;return!0}return!1}var ki=Object.prototype.hasOwnProperty;function Ai(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Mi(e)&&Mi(t);if(!r&&!(Ni(e)&&Ni(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ki.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ai(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ji(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Mi(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ni(e){if(!Pi(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Pi(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Pi(e){return Object.prototype.toString.call(e)===`[object Object]`}function Fi(e){return new Promise(t=>{vi.setTimeout(t,e)})}function Ii(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ai(e,t)}function Li(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Ri(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var zi=Symbol();function Bi(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===zi?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Vi(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Hi=()=>bi,Ui=()=>Hi(),Wi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Gi=new class extends Wi{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ki=yi;function qi(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ki,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var $=qi(),Ji=new class extends Wi{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Yi(e){return Math.min(1e3*2**e,3e4)}function Xi(e){return(e??`online`)!==`online`||Ji.isOnline()}var Zi=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Qi(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Z);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Zi(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Gi.isFocused()&&(e.networkMode===`always`||Ji.isOnline())&&e.canRun(),p=()=>Xi(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Ui()?0:3),a=e.retryDelay??Yi,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Fi(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var $i=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Si(this.gcTime)&&(this.#e=vi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ui()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(vi.clearTimeout(this.#e),this.#e=void 0)}};function ea(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Vi(e,()=>t.signal,()=>n=!0)},u=Bi(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Ri:Li;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?na:ta,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ta(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function ta(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function na(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ra=class extends $i{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=oa(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=oa(this.options);e.data!==void 0&&(this.setState(aa(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ii(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Z).catch(Z):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Q(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Q(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Ci(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Bi(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ea(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Qi({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Zi&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Zi){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...ia(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...aa(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),$.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ia(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xi(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function aa(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function oa(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var sa=class extends Wi{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),la(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ua(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ua(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Q(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ji(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&da(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Q(this.options.enabled,this.#t)!==Q(t.enabled,this.#t)||Q(this.options.staleTime,this.#t)!==Q(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Q(this.options.enabled,this.#t)!==Q(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ji(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Z)),t}#h(e){return!Ui()&&Q(this.options.enabled,this.#t)!==!1&&Si(e)}#g(){this.#b();let e=Q(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Ci(this.#r.dataUpdatedAt,e)+1;this.#u=vi.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=vi.setInterval(()=>{(this.options.refetchIntervalInBackground||Gi.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(vi.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(vi.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&la(e,t),o=i&&da(e,n,t,r);(a||o)&&(l={...l,...ia(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Ii(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Ii(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:fa(e,t),refetch:this.refetch,isEnabled:Q(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ji(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();$.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function ca(e,t){return Q(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Q(t.retryOnMount,e)!==!1)}function la(e,t){return ca(e,t)||e.state.data!==void 0&&ua(e,t,t.refetchOnMount)}function ua(e,t,n){if(Q(t.enabled,e)!==!1&&Q(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&fa(e,t)}return!1}function da(e,t,n,r){return(e!==t||Q(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&fa(e,n)}function fa(e,t){return Q(t.enabled,e)!==!1&&e.isStaleByTime(Q(t.staleTime,e))}var pa=class extends $i{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ma(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Qi({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),$.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ma(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ha=class extends Wi{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new pa({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ga(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ga(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ga(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ga(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){$.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ti(t,e))}findAll(e={}){return this.getAll().filter(t=>Ti(e,t))}notify(e){$.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return $.batch(()=>Promise.all(e.map(e=>e.continue().catch(Z))))}};function ga(e){return e.options.scope?.id}var _a=class extends Wi{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),ji(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Di(t.mutationKey)!==Di(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ma();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){$.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},va=class extends Wi{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ei(r,t),a=this.get(i);return a||(a=new ra({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){$.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>wi(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>wi(e,t)):t}notify(e){$.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){$.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){$.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ya=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new va,this.#t=e.mutationCache||new ha,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Gi.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ji.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Q(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=xi(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return $.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;$.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return $.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=$.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Z).catch(Z)}invalidateQueries(e,t={}){return $.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=$.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Z)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Z)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Q(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Q(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Z).catch(Z)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Z).catch(Z)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ji.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Di(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Oi(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Di(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Oi(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Ei(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===zi&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ba=Symbol(`QueryClient`),xa=()=>{let e=We(ba);if(!e)throw Error(`No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?`);return e},Sa=e=>{Ge(ba,e)},Ca=Symbol(`isRestoring`),wa=()=>{try{return We(Ca)??{current:!1}}catch{return{current:!1}}};function Ta(){return wa()}function Ea(e){return e||xa()}var Da=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],Oa=[`difference`,`intersection`,`symmetricDifference`,`union`],ka=!1,Aa=class e extends Set{#e=new Map;#t=N(0);#n=N(0);#r=Xn||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}ka||this.#a()}#i(e){return Xn===this.#r?N(e):Gt(e)}#a(){ka=!0;var t=e.prototype,n=Set.prototype;for(let e of Da)t[e]=function(...t){return J(this.#t),n[e].apply(this,t)};for(let r of Oa)t[r]=function(...t){J(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return J(this.#t),!1;r=this.#i(!0),n.set(e,r)}return J(r),t}add(e){return super.has(e)||(super.add(e),P(this.#n,super.size),Xt(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),P(r,!1)),t&&(P(this.#n,super.size),Xt(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())P(t,!1);e.clear(),P(this.#n,0),Xt(this.#t)}}keys(){return this.values()}values(){return J(this.#t),super.values()}entries(){return J(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return J(this.#n)}};function ja(e){let t=Array.isArray(e)?[]:{},n=new Aa,r=N(0),i=()=>J(r),a=new Proxy(t,{get(e,t,r){return(n.has(t)||!(t in e)||Array.isArray(e)&&t===`length`)&&i(),Reflect.get(e,t,r)},set(e,t,r,i){if(n.delete(t),t in e)return Reflect.set(e,t,r,i);let a=N(r);return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>J(a)&&Pa(J(a))?J(a)():J(a),set:e=>{P(a,e)}}),!0},has:(e,t)=>!n.has(t)&&t in e,ownKeys(e){return Reflect.ownKeys(e).filter(e=>!n.has(e))},getOwnPropertyDescriptor(e,t){if(!n.has(t))return Reflect.getOwnPropertyDescriptor(e,t)},deleteProperty(e,t){return t in e&&(e[t]=void 0,n.add(t),Array.isArray(e)&&e.length--,!0)}});function o(e){let t=Object.keys(a),n=Object.keys(e),i=t.filter(e=>!n.includes(e));Array.isArray(e)&&i.sort((e,t)=>Number(t)-Number(e));let o=n.some(e=>!t.includes(e));for(let e of i)delete a[e];for(let t of n)a[t]=Na(()=>e[t]);(o||i.length>0)&&Yt(r)}return o(e),[a,o]}var Ma=Symbol(`LazyValue`);function Na(e){return e[Ma]=!0,e}function Pa(e){return!!e[Ma]}function Fa(e,t){switch(e){case`post`:xn(t);break;case`pre`:Cn(t)}}var Ia=(e,t,n)=>{let r=!1,i=Array.isArray(e)?[]:void 0;Fa(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!r){r=!0,i=t;return}let a=lr(()=>n(t,i));return i=t,a})};function La(e,t,n){let r=_t(()=>Ea(n?.())),i=Ta(),a=_t(()=>{let t=J(r).defaultQueryOptions(e());return t._optimisticResults=i.current?`isRestoring`:`optimistic`,t}),o=N(Qt(new t(J(r),J(a))));Ia(()=>J(r),`pre`,()=>{P(o,new t(J(r),J(a)),!0)});function s(){let e=J(o).getOptimisticResult(J(a));return J(a).notifyOnChangeProps?e:J(o).trackResult(e)}let[c,l]=ja(s());return xn(()=>{let e=i.current?()=>void 0:J(o).subscribe(()=>l(s()));return J(o).updateResult(),e}),Ia(()=>J(a),`pre`,()=>{J(o).setOptions(J(a))}),Ia(()=>[J(a),J(o)],`pre`,()=>{l(s())}),c}function Ra(e,t){return La(e,sa,t)}function za(e,t){let n=_t(()=>Ea(t?.())),r=N(Qt(new _a(J(n),e())));Ia(()=>J(n),`pre`,()=>{P(r,new _a(J(n),e()),!0)}),Cn(()=>{J(r).setOptions(e())});let i=(...e)=>{J(r).mutate(e[0],e[1]).catch(Z)},a=N(Qt(J(r).getCurrentResult()));return Ia(()=>J(r),`pre`,()=>{P(a,J(r).getCurrentResult(),!0)}),Cn(()=>J(r).subscribe(e=>{$.batchCalls(()=>{Object.assign(J(a),e)})()})),J(_t(()=>new Proxy(J(a),{get:(e,t)=>{let n={...J(a),mutate:i,mutateAsync:J(a).mutate};return t==`value`?n:n[t]}})))}function Ba(e,t){Ke(t,!0);let n=mi(t,`client`,19,()=>new ya);hi(()=>{n().mount()}),Sa(n()),gi(()=>{n().unmount()});var r=Er();Kr(ln(r),()=>t.children),Y(e,r),qe()}function Va(){return document.querySelector(`meta[name="htmlark-token"]`)?.getAttribute(`content`)??``}async function Ha(e,t={}){let n=new Headers(t.headers);n.set(`X-Htmlark-Token`,Va()),t.body&&!n.has(`content-type`)&&n.set(`content-type`,`application/json`);let r=await fetch(e,{...t,headers:n}),i=await r.json();if(!r.ok)throw Error(i.error??`${r.status}`);return i}function Ua(e){return Ha(`/v1/artifacts${e?`?search=${encodeURIComponent(e)}`:``}`)}function Wa(e){return Ha(`/v1/artifacts/${e}`)}function Ga(e,t,n){return Ha(`/v1/artifacts/${e}/diff?from=${t}&to=${n}`)}function Ka(e,t){return Ha(`/v1/artifacts/${e}/restore`,{method:`POST`,body:JSON.stringify({version:t})})}function qa(e){return Ha(`/v1/artifacts/${e}`,{method:`DELETE`})}function Ja(e,t,n){return Ha(`/v1/import`,{method:`POST`,body:JSON.stringify({key:e,content:t,name:n})})}var Ya=wr(`<p class="err svelte-9bibt2"> </p>`),Xa=wr(`<p class="mute svelte-9bibt2">Loading…</p>`),Za=wr(`<span class="dirty svelte-9bibt2">dirty</span>`),Qa=wr(`<tr><td class="svelte-9bibt2"> <!></td><td class="mono svelte-9bibt2"> </td><td class="svelte-9bibt2"> </td><td class="svelte-9bibt2"> </td><td class="svelte-9bibt2"> </td></tr>`),$a=wr(`<button type="button"> <!></button>`),eo=wr(`<option> </option>`),to=wr(`<pre class="src svelte-9bibt2"> </pre>`),no=wr(`<label>Diff from <select class="svelte-9bibt2"><option>—</option><!></select></label> <!>`,1),ro=wr(`<div class="detail svelte-9bibt2"><div class="detail-h svelte-9bibt2"><strong> </strong> <a target="_blank" rel="noreferrer" class="svelte-9bibt2">Open viewer</a></div> <p class="mono svelte-9bibt2"> </p> <div class="vers svelte-9bibt2"></div> <iframe title="preview" class="svelte-9bibt2"></iframe> <pre class="src svelte-9bibt2"> </pre> <!> <div class="actions svelte-9bibt2"><button type="button" class="svelte-9bibt2"> </button> <button type="button" class="danger svelte-9bibt2">Delete</button></div></div>`),io=wr(`<div class="split svelte-9bibt2"><table class="svelte-9bibt2"><thead><tr class="svelte-9bibt2"><th class="svelte-9bibt2">Name</th><th class="svelte-9bibt2">Id</th><th class="svelte-9bibt2">Ver</th><th class="svelte-9bibt2">Type</th><th class="svelte-9bibt2">Updated</th></tr></thead><tbody></tbody></table> <!></div>`),ao=wr(`<div class="shell svelte-9bibt2"><aside class="svelte-9bibt2"><div class="brand svelte-9bibt2">htmlark</div> <nav class="svelte-9bibt2"><span class="on svelte-9bibt2">Artifacts</span></nav> <p class="hint svelte-9bibt2">Loopback admin. CLI remains the source of truth.</p></aside> <section class="main svelte-9bibt2"><header class="bar svelte-9bibt2"><input placeholder="Search name or id" class="svelte-9bibt2"/> <label class="import svelte-9bibt2">Import <input type="file" accept=".html,.htm,.md,text/html,text/markdown" class="svelte-9bibt2"/></label> <input class="key svelte-9bibt2" placeholder="import --key"/></header> <!> <!></section></div>`);function oo(e,t){Ke(t,!0);let n=Ea(),r=N(``),i=N(null),a=N(null),o=N(``),s=N(``),c=N(``),l=N(null),u=Ra(()=>({queryKey:[`artifacts`,J(r)],queryFn:()=>Ua(J(r))})),d=Ra(()=>({queryKey:[`artifact`,J(i)],queryFn:()=>Wa(J(i)),enabled:!!J(i)})),f=_t(()=>d.data?.artifact.version??1),p=_t(()=>J(a)??J(f)),m=Ra(()=>({queryKey:[`diff`,J(i),J(o),J(p)],queryFn:()=>Ga(J(i),Number(J(o)),J(p)),enabled:!!(J(i)&&J(o)&&Number(J(o))!==J(p))})),h=za(()=>({mutationFn:e=>Ka(J(i),e),onSuccess:()=>{n.invalidateQueries({queryKey:[`artifacts`]}),n.invalidateQueries({queryKey:[`artifact`,J(i)]})}})),g=za(()=>({mutationFn:()=>qa(J(i)),onSuccess:()=>{P(i,null),n.invalidateQueries({queryKey:[`artifacts`]})}})),_=za(()=>({mutationFn:e=>Ja(e.key,e.content,e.name),onSuccess:()=>{P(l,null),P(s,``),P(c,``),n.invalidateQueries({queryKey:[`artifacts`]})},onError:e=>{P(l,e.message,!0)}}));function v(e){P(i,e.id,!0),P(a,null),P(o,``)}async function y(e){let t=e.target.files?.[0];if(!t)return;let n=await t.text(),r=J(s).trim()||t.name.replace(/\.[^.]+$/,``);_.mutate({key:r,content:n,name:J(c).trim()||r})}var b=ao(),x=R(I(b),2),S=I(x),C=I(S);oi(C);var ee=R(C,2),w=R(I(ee));k(ee);var te=R(ee,2);oi(te),k(S);var ne=R(S,2),re=e=>{var t=Ya(),n=L(t,!0);On(()=>X(n,J(l))),Y(e,t)};Ir(ne,e=>{J(l)&&e(re)});var ie=R(ne,2),ae=e=>{Y(e,Xa())},oe=e=>{var t=Ya(),n=L(t,!0);On(()=>X(n,u.error.message)),Y(e,t)},se=e=>{var t=io(),n=I(t),r=R(I(n));Br(r,21,()=>u.data?.artifacts??[],e=>e.id,(e,t)=>{var n=Qa();let r;var a=I(n),o=I(a,!0),s=R(o),c=e=>{Y(e,Za())};Ir(s,e=>{J(t).dirty&&e(c)}),k(a);var l=R(a),u=L(l,!0),d=R(l),f=L(d),p=R(d),m=L(p,!0),h=L(R(p),!0);k(n),On(e=>{r=Yr(n,1,`svelte-9bibt2`,null,r,{sel:J(i)===J(t).id}),X(o,J(t).name),X(u,J(t).id),X(f,`v${J(t).version??``}`),X(m,J(t).type),X(h,e)},[()=>J(t).updatedAt.slice(0,19).replace(`T`,` `)]),hr(`click`,n,()=>v(J(t))),Y(e,n)}),k(r),k(n);var s=R(n,2),c=e=>{let t=_t(()=>d.data.artifact);var n=ro(),r=I(n),i=I(r),s=L(i,!0),c=R(i,2);k(r);var l=R(r,2),u=L(l,!0),f=R(l,2);Br(f,21,()=>J(t).versions,e=>e.version,(e,t)=>{var n=$a();let r;var i=I(n),o=R(i),s=e=>{Y(e,Tr(`*`))};Ir(o,e=>{J(t).dirty&&e(s)}),k(n),On(()=>{r=Yr(n,1,`svelte-9bibt2`,null,r,{on:J(p)===J(t).version}),X(i,`v${J(t).version??``}`)}),hr(`click`,n,()=>P(a,J(t).version,!0)),Y(e,n)}),k(f);var _=R(f,2),v=R(_,2),y=L(v,!0),b=R(v,2),x=e=>{var n=no(),r=ln(n),i=R(I(r)),a=I(i);a.value=a.__value=``,Br(R(a),17,()=>J(t).versions,e=>e.version,(e,t)=>{var n=eo(),r=L(n),i={};On(e=>{X(r,`v${J(t).version??``}`),i!==(i=e)&&(n.value=(n.__value=i)??``)},[()=>String(J(t).version)]),Y(e,n)}),k(i),$r(i),k(r);var s=R(r,2),c=e=>{var t=to(),n=L(t,!0);On(()=>X(n,m.data.diff)),Y(e,t)};Ir(s,e=>{m.data?.diff&&e(c)}),ei(i,()=>J(o),e=>P(o,e)),Y(e,n)};Ir(b,e=>{J(t).versions.length>1&&e(x)});var S=R(b,2),C=I(S),ee=L(C),w=R(C,2);k(S),k(n),On(()=>{X(s,J(t).name),si(c,`href`,`/a/${J(t).id??``}${J(a)?`?v=${J(a)}`:``}`),X(u,J(t).id),si(_,`src`,`/render/${J(t).id??``}/${J(p)??``}`),X(y,d.data.preview),X(ee,`Restore v${J(p)??``}`)}),hr(`click`,C,()=>h.mutate(J(p))),hr(`click`,w,()=>g.mutate()),Y(e,n)};Ir(s,e=>{J(i)&&d.data&&e(c)}),k(t),Y(e,t)};Ir(ie,e=>{u.isPending?e(ae):u.isError?e(oe,1):e(se,-1)}),k(x),k(b),di(C,()=>J(r),e=>P(r,e)),hr(`change`,w,y),di(te,()=>J(s),e=>P(s,e)),Y(e,b),qe()}gr([`change`,`click`]);function so(e,t){Ke(t,!0);let n=new ya;Ba(e,{get client(){return n},children:(e,t)=>{oo(e,{})},$$slots:{default:!0}}),qe()}jr(so,{target:document.getElementById(`app`)});