wherever-dev 0.22.1 → 0.23.0

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 (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/delta-coalescer.d.ts +77 -0
  3. package/dist/delta-coalescer.d.ts.map +1 -0
  4. package/dist/delta-coalescer.js +117 -0
  5. package/dist/delta-coalescer.js.map +1 -0
  6. package/dist/frame-chunks.d.ts +41 -0
  7. package/dist/frame-chunks.d.ts.map +1 -0
  8. package/dist/frame-chunks.js +61 -0
  9. package/dist/frame-chunks.js.map +1 -0
  10. package/dist/history-images.d.ts +33 -0
  11. package/dist/history-images.d.ts.map +1 -0
  12. package/dist/history-images.js +47 -0
  13. package/dist/history-images.js.map +1 -0
  14. package/dist/index.js +116 -6
  15. package/dist/index.js.map +1 -1
  16. package/dist/session-transcript.d.ts +19 -0
  17. package/dist/session-transcript.d.ts.map +1 -1
  18. package/dist/session-transcript.js +67 -0
  19. package/dist/session-transcript.js.map +1 -1
  20. package/dist/session-types.d.ts +21 -2
  21. package/dist/session-types.d.ts.map +1 -1
  22. package/dist/static-compression.d.ts +15 -0
  23. package/dist/static-compression.d.ts.map +1 -0
  24. package/dist/static-compression.js +87 -0
  25. package/dist/static-compression.js.map +1 -0
  26. package/package.json +1 -1
  27. package/public/_app/immutable/chunks/{DEUwJYqt.js → BHw5ar2A.js} +2 -2
  28. package/public/_app/immutable/chunks/{DEUwJYqt.js.map → BHw5ar2A.js.map} +1 -1
  29. package/public/_app/immutable/chunks/{DSPDB3Gw.js → CLKlGLL7.js} +2 -2
  30. package/public/_app/immutable/chunks/{DSPDB3Gw.js.map → CLKlGLL7.js.map} +1 -1
  31. package/public/_app/immutable/chunks/{Cuh9gHb6.js → FePVnZ_7.js} +2 -2
  32. package/public/_app/immutable/chunks/{Cuh9gHb6.js.map → FePVnZ_7.js.map} +1 -1
  33. package/public/_app/immutable/entry/{app.BkV4f8p8.js → app.BJxkSaKZ.js} +3 -3
  34. package/public/_app/immutable/entry/{app.BkV4f8p8.js.map → app.BJxkSaKZ.js.map} +1 -1
  35. package/public/_app/immutable/entry/start.CRP1MCwE.js +2 -0
  36. package/public/_app/immutable/entry/start.CRP1MCwE.js.map +1 -0
  37. package/public/_app/immutable/nodes/{0.DR4K9Ylw.js → 0.DGFJlad5.js} +2 -2
  38. package/public/_app/immutable/nodes/{0.DR4K9Ylw.js.map → 0.DGFJlad5.js.map} +1 -1
  39. package/public/_app/immutable/nodes/{1.DdqkeKC4.js → 1.Cy3IVwDh.js} +2 -2
  40. package/public/_app/immutable/nodes/{1.DdqkeKC4.js.map → 1.Cy3IVwDh.js.map} +1 -1
  41. package/public/_app/immutable/nodes/2.eb9p7ShF.js +123 -0
  42. package/public/_app/immutable/nodes/2.eb9p7ShF.js.map +1 -0
  43. package/public/_app/version.json +1 -1
  44. package/public/index.html +10 -10
  45. package/public/service-worker.js +1 -1
  46. package/public/_app/immutable/entry/start.D5TsAoxn.js +0 -2
  47. package/public/_app/immutable/entry/start.D5TsAoxn.js.map +0 -1
  48. package/public/_app/immutable/nodes/2.n5lfdeec.js +0 -122
  49. package/public/_app/immutable/nodes/2.n5lfdeec.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{c as e,p as r}from"./DEUwJYqt.js";const t={get error(){return r.error},get status(){return r.status},get url(){return r.url}};e.updated.check;const a=t;export{a as p};
2
- //# sourceMappingURL=DSPDB3Gw.js.map
1
+ import{c as e,p as r}from"./BHw5ar2A.js";const t={get error(){return r.error},get status(){return r.status},get url(){return r.url}};e.updated.check;const a=t;export{a as p};
2
+ //# sourceMappingURL=CLKlGLL7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DSPDB3Gw.js","sources":["../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/client.js","../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/index.js"],"sourcesContent":["import {\n\tpage as _page,\n\tnavigating as _navigating,\n\tupdated as _updated\n} from '../../client/state.svelte.js';\nimport { stores } from '../../client/client.js';\n\nexport const page = {\n\tget data() {\n\t\treturn _page.data;\n\t},\n\tget error() {\n\t\treturn _page.error;\n\t},\n\tget form() {\n\t\treturn _page.form;\n\t},\n\tget params() {\n\t\treturn _page.params;\n\t},\n\tget route() {\n\t\treturn _page.route;\n\t},\n\tget state() {\n\t\treturn _page.state;\n\t},\n\tget status() {\n\t\treturn _page.status;\n\t},\n\tget url() {\n\t\treturn _page.url;\n\t}\n};\n\nexport const navigating = {\n\tget from() {\n\t\treturn _navigating.current ? _navigating.current.from : null;\n\t},\n\tget to() {\n\t\treturn _navigating.current ? _navigating.current.to : null;\n\t},\n\tget type() {\n\t\treturn _navigating.current ? _navigating.current.type : null;\n\t},\n\tget willUnload() {\n\t\treturn _navigating.current ? _navigating.current.willUnload : null;\n\t},\n\tget delta() {\n\t\treturn _navigating.current ? _navigating.current.delta : null;\n\t},\n\tget complete() {\n\t\treturn _navigating.current ? _navigating.current.complete : null;\n\t}\n};\n\nObject.defineProperty(navigating, 'current', {\n\tget() {\n\t\t// between 2.12.0 and 2.12.1 `navigating.current` existed\n\t\tthrow new Error('Replace navigating.current.<prop> with navigating.<prop>');\n\t}\n});\n\nexport const updated = {\n\tget current() {\n\t\treturn _updated.current;\n\t},\n\tcheck: stores.updated.check\n};\n","import {\n\tpage as client_page,\n\tnavigating as client_navigating,\n\tupdated as client_updated\n} from './client.js';\nimport {\n\tpage as server_page,\n\tnavigating as server_navigating,\n\tupdated as server_updated\n} from './server.js';\nimport { BROWSER } from 'esm-env';\n\n/**\n * A read-only reactive object with information about the current page, serving several use cases:\n * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))\n * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))\n * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))\n * - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error\n *\n * ```svelte\n * <!--- file: +layout.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * </script>\n *\n * <p>Currently at {page.url.pathname}</p>\n *\n * {#if page.error}\n * \t<span class=\"red\">Problem detected</span>\n * {:else}\n * \t<span class=\"small\">All systems operational</span>\n * {/if}\n * ```\n *\n * Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes)\n *\n * ```svelte\n * <!--- file: +page.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * \tconst id = $derived(page.params.id); // This will correctly update id for usage on this page\n * \t$: badId = page.params.id; // Do not use; will never update after initial load\n * </script>\n * ```\n *\n * On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.\n *\n * @type {import('@sveltejs/kit').Page}\n */\nexport const page = BROWSER ? client_page : server_page;\n\n/**\n * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.\n * Values are `null` when no navigation is occurring, or during server rendering.\n * @type {import('@sveltejs/kit').Navigation | { from: null, to: null, type: null, willUnload: null, delta: null, complete: null }}\n */\n// @ts-expect-error\nexport const navigating = BROWSER ? client_navigating : server_navigating;\n\n/**\n * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.\n * @type {{ get current(): boolean; check(): Promise<boolean>; }}\n */\nexport const updated = BROWSER ? client_updated : server_updated;\n"],"names":["page","_page","stores","client_page"],"mappings":"yCAOO,MAAMA,EAAO,CAInB,IAAI,OAAQ,CACX,OAAOC,EAAM,KACd,EAaA,IAAI,QAAS,CACZ,OAAOA,EAAM,MACd,EACA,IAAI,KAAM,CACT,OAAOA,EAAM,GACd,CACD,EAkCQC,EAAO,QAAQ,MCjBX,MAACF,EAAiBG","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"CLKlGLL7.js","sources":["../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/client.js","../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/index.js"],"sourcesContent":["import {\n\tpage as _page,\n\tnavigating as _navigating,\n\tupdated as _updated\n} from '../../client/state.svelte.js';\nimport { stores } from '../../client/client.js';\n\nexport const page = {\n\tget data() {\n\t\treturn _page.data;\n\t},\n\tget error() {\n\t\treturn _page.error;\n\t},\n\tget form() {\n\t\treturn _page.form;\n\t},\n\tget params() {\n\t\treturn _page.params;\n\t},\n\tget route() {\n\t\treturn _page.route;\n\t},\n\tget state() {\n\t\treturn _page.state;\n\t},\n\tget status() {\n\t\treturn _page.status;\n\t},\n\tget url() {\n\t\treturn _page.url;\n\t}\n};\n\nexport const navigating = {\n\tget from() {\n\t\treturn _navigating.current ? _navigating.current.from : null;\n\t},\n\tget to() {\n\t\treturn _navigating.current ? _navigating.current.to : null;\n\t},\n\tget type() {\n\t\treturn _navigating.current ? _navigating.current.type : null;\n\t},\n\tget willUnload() {\n\t\treturn _navigating.current ? _navigating.current.willUnload : null;\n\t},\n\tget delta() {\n\t\treturn _navigating.current ? _navigating.current.delta : null;\n\t},\n\tget complete() {\n\t\treturn _navigating.current ? _navigating.current.complete : null;\n\t}\n};\n\nObject.defineProperty(navigating, 'current', {\n\tget() {\n\t\t// between 2.12.0 and 2.12.1 `navigating.current` existed\n\t\tthrow new Error('Replace navigating.current.<prop> with navigating.<prop>');\n\t}\n});\n\nexport const updated = {\n\tget current() {\n\t\treturn _updated.current;\n\t},\n\tcheck: stores.updated.check\n};\n","import {\n\tpage as client_page,\n\tnavigating as client_navigating,\n\tupdated as client_updated\n} from './client.js';\nimport {\n\tpage as server_page,\n\tnavigating as server_navigating,\n\tupdated as server_updated\n} from './server.js';\nimport { BROWSER } from 'esm-env';\n\n/**\n * A read-only reactive object with information about the current page, serving several use cases:\n * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))\n * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))\n * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))\n * - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error\n *\n * ```svelte\n * <!--- file: +layout.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * </script>\n *\n * <p>Currently at {page.url.pathname}</p>\n *\n * {#if page.error}\n * \t<span class=\"red\">Problem detected</span>\n * {:else}\n * \t<span class=\"small\">All systems operational</span>\n * {/if}\n * ```\n *\n * Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes)\n *\n * ```svelte\n * <!--- file: +page.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * \tconst id = $derived(page.params.id); // This will correctly update id for usage on this page\n * \t$: badId = page.params.id; // Do not use; will never update after initial load\n * </script>\n * ```\n *\n * On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.\n *\n * @type {import('@sveltejs/kit').Page}\n */\nexport const page = BROWSER ? client_page : server_page;\n\n/**\n * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.\n * Values are `null` when no navigation is occurring, or during server rendering.\n * @type {import('@sveltejs/kit').Navigation | { from: null, to: null, type: null, willUnload: null, delta: null, complete: null }}\n */\n// @ts-expect-error\nexport const navigating = BROWSER ? client_navigating : server_navigating;\n\n/**\n * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.\n * @type {{ get current(): boolean; check(): Promise<boolean>; }}\n */\nexport const updated = BROWSER ? client_updated : server_updated;\n"],"names":["page","_page","stores","client_page"],"mappings":"yCAOO,MAAMA,EAAO,CAInB,IAAI,OAAQ,CACX,OAAOC,EAAM,KACd,EAaA,IAAI,QAAS,CACZ,OAAOA,EAAM,MACd,EACA,IAAI,KAAM,CACT,OAAOA,EAAM,GACd,CACD,EAkCQC,EAAO,QAAQ,MCjBX,MAACF,EAAiBG","x_google_ignoreList":[0,1]}
@@ -1,2 +1,2 @@
1
- import{W as J,J as Re,ao as L,aU as Y,ai as Ue,am as Fe,af as ae,aK as Le,m as Me,a$ as ie,aV as q,an as B,b as Ne,j as Oe,aq as ce,X as Pe,h as _,K as ee,a6 as He,aY as De,a4 as We,as as xe,z as oe,g as je,f as ze,az as Be,b0 as le,E as Ke,D as Ve,aP as be,aE as ke,I as G,a as Je,O as Ye,ay as qe,a5 as Ge,aj as Xe,e as ye,aJ as Ee,d as Qe,A as Ze,N as et,ak as tt,F as nt,x as rt,o as ot,ah as st,n as _e,ae as C,be as S}from"./CAL8yDNt.js";import{b as at,r as it,v as ct}from"./DEUwJYqt.js";function Xt(e,t){return t}function lt(e,t,n){for(var o=[],r=t.length,a,s=t.length,l=0;l<r;l++){let b=t[l];ke(b,()=>{if(a){if(a.pending.delete(b),a.done.add(b),a.pending.size===0){var p=e.outrogroups;te(e,oe(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var i=o.length===0&&n!==null;if(i){var u=n,f=u.parentNode;Ye(f),f.append(u),e.items.clear()}te(e,t,!i)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function te(e,t,n=!0){var o;if(e.pending.size>0){o=new Set;for(const s of e.pending.values())for(const l of s)o.add(e.items.get(l).e)}for(var r=0;r<t.length;r++){var a=t[r];if(o?.has(a)){a.f|=_;const s=document.createDocumentFragment();qe(a,s)}else Ge(t[r],n)}}var fe;function Qt(e,t,n,o,r,a=null){var s=e,l=new Map,i=(t&ye)!==0;if(i){var u=e;s=L?Y(Ue(u)):u.appendChild(J())}L&&Fe();var f=null,b=We(()=>{var h=n();return xe(h)?h:h==null?[]:oe(h)}),p,k=new Map,y=!0;function N(h){(I.effect.f&Ve)===0&&(I.pending.delete(h),I.fallback=f,ft(I,p,s,t,o),f!==null&&(p.length===0?(f.f&_)===0?be(f):(f.f^=_,W(f,null,s)):ke(f,()=>{f=null})))}function c(h){I.pending.delete(h)}var d=Re(()=>{p=ae(b);var h=p.length;let m=!1;if(L){var j=Le(s)===Me;j!==(h===0)&&(s=ie(),Y(s),q(!1),m=!0)}for(var R=new Set,g=Pe,P=De(),U=0;U<h;U+=1){L&&B.nodeType===Ne&&B.data===Oe&&(s=B,m=!0,q(!1));var E=p[U],z=o(E,U),A=y?null:l.get(z);A?(A.v&&ce(A.v,E),A.i&&ce(A.i,U),P&&g.unskip_effect(A.e)):(A=ut(l,y?s:fe??=J(),E,z,U,r,t,n),y||(A.e.f|=_),l.set(z,A)),R.add(z)}if(h===0&&a&&!f&&(y?f=ee(()=>a(s)):(f=ee(()=>a(fe??=J())),f.f|=_)),h>R.size&&He(),L&&h>0&&Y(ie()),!y)if(k.set(g,R),P){for(const[Ce,Ie]of l)R.has(Ce)||g.skip_effect(Ie.e);g.oncommit(N),g.ondiscard(c)}else N(g);m&&q(!0),ae(b)}),I={effect:d,items:l,pending:k,outrogroups:null,fallback:f};y=!1,L&&(s=B)}function H(e){for(;e!==null&&(e.f&Je)===0;)e=e.next;return e}function ft(e,t,n,o,r){var a=(o&Qe)!==0,s=t.length,l=e.items,i=H(e.effect.first),u,f=null,b,p=[],k=[],y,N,c,d;if(a)for(d=0;d<s;d+=1)y=t[d],N=r(y,d),c=l.get(N).e,(c.f&_)===0&&(c.nodes?.a?.measure(),(b??=new Set).add(c));for(d=0;d<s;d+=1){if(y=t[d],N=r(y,d),c=l.get(N).e,e.outrogroups!==null)for(const E of e.outrogroups)E.pending.delete(c),E.done.delete(c);if((c.f&G)!==0&&(be(c),a&&(c.nodes?.a?.unfix(),(b??=new Set).delete(c))),(c.f&_)!==0)if(c.f^=_,c===i)W(c,null,n);else{var I=f?f.next:i;c===e.effect.last&&(e.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),F(e,f,c),F(e,c,I),W(c,I,n),f=c,p=[],k=[],i=H(f.next);continue}if(c!==i){if(u!==void 0&&u.has(c)){if(p.length<k.length){var h=k[0],m;f=h.prev;var j=p[0],R=p[p.length-1];for(m=0;m<p.length;m+=1)W(p[m],h,n);for(m=0;m<k.length;m+=1)u.delete(k[m]);F(e,j.prev,R.next),F(e,f,j),F(e,R,h),i=h,f=R,d-=1,p=[],k=[]}else u.delete(c),W(c,i,n),F(e,c.prev,c.next),F(e,c,f===null?e.effect.first:f.next),F(e,f,c),f=c;continue}for(p=[],k=[];i!==null&&i!==c;)(u??=new Set).add(i),k.push(i),i=H(i.next);if(i===null)continue}(c.f&_)===0&&p.push(c),f=c,i=H(c.next)}if(e.outrogroups!==null){for(const E of e.outrogroups)E.pending.size===0&&(te(e,oe(E.done)),e.outrogroups?.delete(E));e.outrogroups.size===0&&(e.outrogroups=null)}if(i!==null||u!==void 0){var g=[];if(u!==void 0)for(c of u)(c.f&G)===0&&g.push(c);for(;i!==null;)(i.f&G)===0&&i!==e.fallback&&g.push(i),i=H(i.next);var P=g.length;if(P>0){var U=(o&ye)!==0&&s===0?n:null;if(a){for(d=0;d<P;d+=1)g[d].nodes?.a?.measure();for(d=0;d<P;d+=1)g[d].nodes?.a?.fix()}lt(e,g,U)}}a&&Ee(()=>{if(b!==void 0)for(c of b)c.nodes?.a?.apply()})}function ut(e,t,n,o,r,a,s,l){var i=(s&je)!==0?(s&ze)===0?Be(n,!1,!1):le(n):null,u=(s&Ke)!==0?le(r):null;return{v:i,i:u,e:ee(()=>(a(t,i??n,u??r,l),()=>{e.delete(o)}))}}function W(e,t,n){if(e.nodes)for(var o=e.nodes.start,r=e.nodes.end,a=t&&(t.f&_)===0?t.nodes.start:n;o!==null;){var s=Xe(o);if(a.before(o),o===r)return;o=s}}function F(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const dt=Symbol("is custom element"),pt=Symbol("is html"),ht=_e?"link":"LINK",gt=_e?"progress":"PROGRESS";function Zt(e){if(L){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var o=e.value;ue(e,"value",null),e.value=o}if(e.hasAttribute("checked")){var r=e.checked;ue(e,"checked",null),e.checked=r}}};e[nt]=n,Ee(n),rt()}}function en(e,t){var n=se(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==gt)||(e.value=t??"")}function tn(e,t){var n=se(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function ue(e,t,n,o){var r=se(e);L&&(r[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===ht)||r[t]!==(r[t]=n)&&(t==="loading"&&(e[ot]=n),n==null?e.removeAttribute(t):typeof n!="string"&&vt(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function se(e){return e[Ze]??={[dt]:e.nodeName.includes("-"),[pt]:e.namespaceURI===et}}var de=new Map;function vt(e){var t=e.getAttribute("is")||e.nodeName,n=de.get(t);if(n)return n;de.set(t,n=[]);for(var o,r=e,a=Element.prototype;a!==r;){o=st(r);for(var s in o)o[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&n.push(s);r=tt(r)}return n}const wt="";function mt(...e){if(!e[0].startsWith("/"))throw new Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return at+wt+it(e[0],e[1])}const v=()=>{},St={assert:v,error:v,warn:v,info:v,log:v,debug:v,dir:v,table:v,trace:v,write:v,time:v,timeEnd:v,timeLog:v};function bt(){return globalThis?._logFactory}function kt(e,t){const n=bt();return n?n(e,{decoration:t?.decoration}):St}function yt(e,t){let n=performance.now();function o(r){const a=performance.now();a-n>t.idle&&e.update(),n=a}return["focus","pointerdown"].forEach(r=>window.addEventListener(r,o)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e.update()}),e.update(),setInterval(()=>e.update(),t.checks)}function Et(e,t){function n(){e.installing&&e.installing.addEventListener("statechange",function(){this.state==="installed"&&t(e)})}if(e){if(e.waiting)return t(e);e.installing?n():e.addEventListener("updatefound",n)}}function _t(e,t){let n;try{n=new URL(e,t.href)}catch{return}if(n.origin===t.origin&&(n.pathname===t.pathname||n.pathname==="/")&&n.hash){t.hash=n.hash;return}t.assign(n.href)}const Tt=()=>window.location;function $t(e=Tt){let t=1;const n=S([]);function o(s){n.update(l=>[...l,{...s,id:++t}])}function r(s){n.update(l=>l.filter(i=>i.id!==s))}function a(s){const l=C(n).find(i=>i.id==s);if(r(s),l?.type==="push-notification"){const i=l.data.options.data?.navigate;typeof i=="string"&&i&&_t(i,e())}}return{subscribe:n.subscribe,add:o,remove:r,onClick:a}}const At=$t(),w=kt("service-worker");function X(e){e&&(w.enabled?w.debug(`enabling logging for service worker, level: ${w.level}`):w.debug(`disabling logging for service worker, level: ${w.level}`),e.postMessage({type:"debug",level:w.level,enabled:w.enabled}))}const Ct=180*1e3,It=1800*1e3;function Rt(){const e=S(void 0);function t(s="active"){n({type:"ping"},s)}function n(s,l="active"){const i=C(e);if(!i)throw new Error("not loaded");if(i.notSupported)throw new Error("not supported");if(i.registering)throw new Error("is registering...");const u=i.registration;if(!u)throw new Error("no registration");if(!u[l])throw new Error(`no registration in state: ${l}`);u[l].postMessage(s)}function o(){w.log("accepting update...");const s=C(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");if(s.updateAvailable&&s.registration){const l=s.registration;if(!l)throw new Error("no registration");l.waiting?(w.log("was waiting, skipping..."),l.waiting.postMessage("skipWaiting")):(w.log("was not waiting, should we reload?"),w.error("not waiting..., todo reload?")),w.log("update store"),e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}}function r(){const s=C(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}function a(){if(typeof navigator<"u"&&"serviceWorker"in navigator){e.set({notSupported:!1,registering:!0});let s=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{s||(s=!0,window.location.reload())}),navigator.serviceWorker.onmessage=i=>{i.data&&i.data.type==="notification"&&(console.log(i),At.add({type:"push-notification",data:i.data.notification}))};const l=mt("/service-worker.js");navigator.serviceWorker.register(l,{type:"classic"}).then(i=>{try{yt(i,{idle:Ct,checks:It})}catch{}e.set({notSupported:!1,updateAvailable:!1,registration:i,registering:!1}),X(i.installing),X(i.waiting),X(i.active),Et(i,()=>{e.set({notSupported:!1,updateAvailable:!0,registration:i,registering:!1})})}).catch(i=>{console.error(i),e.set({registering:!1,notSupported:!1,updateAvailable:!1,registration:void 0,error:{message:"failed to register service-worker",cause:i.message||i}}),w.error("Failed to register service worker",i)})}else typeof window<"u"&&e.set({notSupported:!0})}return{subscribe:e.subscribe,set:e.set,get registration(){const s=C(e);if(s&&"registration"in s)return s.registration},get updateAvailable(){const s=C(e);return s&&"updateAvailable"in s?s.updateAvailable:!1},register:a,pingServideWorker:t,sendMessage:n,skipWaiting:o,skip:r}}function Ut(e){if(!e)return{params:{},pathname:""};const t={},n=e.lastIndexOf("#");let o=e;n!==-1&&(o=o.slice(0,n));const r=o.indexOf("?");r!==-1&&o.slice(r+1).split("&").forEach(s=>{const[l,i=""]=s.split("=");t[decodeURIComponent(l)]=i===""?"true":decodeURIComponent(i)});let a=o.slice(0,r)||"";return a&&!a.endsWith("/")&&(a+="/"),{params:t,pathname:a}}function Ft(){return typeof window>"u"?{params:{}}:Ut(window.location.href)}function Lt(e){if(typeof window>"u")return{};const t=window.location.hash,n={},o=t.lastIndexOf("#");return o!==-1&&t.slice(o+1).split("&").forEach(r=>{const[a,s=""]=r.split("=");n[decodeURIComponent(a)]=decodeURIComponent(s)}),n}const nn=Rt();Lt();const{params:rn}=Ft();console.log(`VERSION: ${ct}`);const pe={brandDark:"--color-brand-dark",brandSurface:"--color-brand-surface",brandSurface2:"--color-brand-surface-2",brandSurface3:"--color-brand-surface-3",brandBorder:"--color-brand-border",brandText:"--color-brand-text",brandTextMuted:"--color-brand-text-muted",brandCyan:"--color-brand-cyan",brandBlue:"--color-brand-blue",brandPurple:"--color-brand-purple"},Mt=["--color-brand-cyan","--color-brand-blue","--color-brand-purple"],Nt={label:"",accent:null,colors:null,frame:!1,pattern:"none"};function on(e){if(typeof document>"u")return;const t=document.documentElement;for(const n of Object.values(pe))t.style.removeProperty(n);if(t.classList.remove("wherever-framed"),delete t.dataset.whereverPattern,e.accent){for(const n of Mt)t.style.setProperty(n,e.accent);document.querySelector('meta[name="theme-color"]')?.setAttribute("content",e.accent)}if(e.frame&&t.classList.add("wherever-framed"),e.pattern&&e.pattern!=="none"&&(t.dataset.whereverPattern=e.pattern),e.colors)for(const[n,o]of Object.entries(e.colors)){const r=pe[n];r&&typeof o=="string"&&t.style.setProperty(r,o)}}const he="wherever-config",Ot="token";function ge(e,t){const n=e.startsWith(t)?e.slice(1):e;if(!n)return{present:!1,value:"",rest:e};const o=new URLSearchParams(n),r=[...new Set([...o.keys()].filter(i=>i.toLowerCase()===Ot))];if(r.length===0)return{present:!1,value:"",rest:e};const s=r.flatMap(i=>o.getAll(i)).find(i=>i.trim())??"";for(const i of r)o.delete(i);const l=o.toString();return{present:!0,value:s,rest:l?`${t}${l}`:""}}function Te(e,t){const n=ge(t||"","#"),o=ge(e||"","?"),r=n.value||o.value;return{token:r||null,present:n.present||o.present,search:o.rest,hash:n.rest}}function Pt(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=Te(e.search||"",e.hash||"");if(!t.present)return!1;try{const n=window.history;if(n&&typeof n.replaceState=="function"){const o=e.pathname||"/";return n.replaceState(n.state??null,"",`${o}${t.search}${t.hash}`),!0}}catch{}return!1}function Ht(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=Te(e.search||"",e.hash||"");if(!t.present||(Pt(),!t.token))return!1;let n={};try{const o=localStorage.getItem(he);if(o){const r=JSON.parse(o);r&&typeof r=="object"&&(n=r)}}catch{n={}}try{return localStorage.setItem(he,JSON.stringify({...n,token:t.token})),!0}catch{return!1}}let ve=!1;function Dt(){return ve?!1:(ve=!0,Ht())}Dt();const M=S({folders:[],activeSessions:[],currentSession:null,loading:!1}),Q=S({models:[],loading:!1}),O=S({folders:[],activeSessions:[],currentSession:null,loading:!1});function Z(){if(typeof window<"u"&&window.location){const e=window.location;if(e.port)return Number(e.port);if(e.protocol==="https:")return 443;if(e.protocol==="http:")return 80}return 31415}function T(){const e=localStorage.getItem("wherever-config"),t=typeof window<"u"&&window.location&&window.location.hostname?window.location.hostname:"localhost";if(e){const n=JSON.parse(e),o=window.location.protocol==="https:"?"https:":"http:";let r=n.host||t;(r==="localhost"||r==="127.0.0.1")&&t&&t!=="localhost"&&t!=="127.0.0.1"&&(r=t),r=r.startsWith("http")?r.replace(/^wss?:\/\//,""):r;let a=n.port;return(a===31415||a===void 0)&&Z()!==31415&&(a=Z()),`${o}//${r}:${a||Z()}`}return`${window.location.protocol}//${window.location.host}`}let D=null,x=[],ne=!1,re=!1,we=0;const Wt=150,xt=1e3;async function jt(){ne=!0;try{const e=T(),t=$(),n=`${e}/sessions${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();M.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:C(M).currentSession,loading:!1})}catch(e){M.update(t=>({...t,loading:!1})),console.error("Failed to fetch sessions:",e)}finally{ne=!1}}function sn(){M.update(n=>({...n,loading:!0}));const e=new Promise(n=>{x.push(n)});if(ne)return re=!0,e;const t=Date.now();if(!D)we=t;else if(clearTimeout(D),t-we>=xt)return D=null,me(),e;return D=setTimeout(()=>{D=null,me()},Wt),e}async function me(){try{do{re=!1;const e=x;x=[];try{await jt()}finally{for(const t of e)t()}}while(re)}finally{const e=x;x=[];for(const t of e)t()}}function K(e,t,n){let o;return e.update(r=>({...r,folders:r.folders.map(a=>a.sessions.some(s=>s.path===t)?{...a,sessions:a.sessions.map(s=>s.path!==t?s:(o=!!s.starred,{...s,starred:n}))}:a)})),o}async function an(e,t){const n=K(M,e,t),o=K(O,e,t);try{const r=T(),a=$(),s=`${r}/sessions/star${a?`?token=${encodeURIComponent(a)}`:""}`,l=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionFile:e,starred:t})});if(!l.ok){const i=await l.json().catch(()=>({}));throw new Error(i.error||`Star failed with status ${l.status}`)}}catch(r){throw n!==void 0&&K(M,e,n),o!==void 0&&K(O,e,o),console.error("Failed to update star:",r),r}}async function cn(){O.update(e=>({...e,loading:!0}));try{const e=T(),t=$(),n=`${e}/sessions?view=readonly${t?`&token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();O.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:C(O).currentSession,loading:!1})}catch(e){O.update(t=>({...t,loading:!1})),console.error("Failed to fetch read-only sessions:",e)}}let V=null;async function ln(e,t="default"){V?.abort();const n=new AbortController;V=n;try{const o=T(),r=$(),a=new URLSearchParams({q:e});t==="readonly"&&a.set("view","readonly"),r&&a.set("token",r);const s=await fetch(`${o}/search?${a.toString()}`,{signal:n.signal});return s.ok?await s.json():{status:"error",query:e,hits:[],message:s.status===401?"Unauthorized: check the token in Connection Settings.":`Search failed (HTTP ${s.status}).`}}catch(o){return o?.name==="AbortError"?null:{status:"error",query:e,hits:[],message:o?.message||"Search request failed."}}finally{V===n&&(V=null)}}async function fn(){Q.update(e=>({...e,loading:!0}));try{const e=T(),t=$(),n=`${e}/models${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();Q.set({models:r.models||[],loading:!1})}catch(e){Q.update(t=>({...t,loading:!1})),console.error("Failed to fetch models:",e)}}function $(){try{const e=localStorage.getItem("wherever-config");if(e)return JSON.parse(e).token||""}catch{}return""}const zt=S(!1),Bt=S("websocket"),Kt=S(null),Vt=S(!1),Jt=S(null),$e={configured:!1,folder:null,active:!1,lock:null},Ae=S($e);function un(e){Ae.update(t=>t.active?{...t,currentSessionId:e.currentSessionId,currentSessionFile:e.currentSessionFile,...e.timezone!==void 0?{timezone:e.timezone}:{}}:t)}function dn(e,t){return e.active&&!!t&&!!e.currentSessionFile&&e.currentSessionFile===t}const Yt=S(Nt);async function pn(e){if(!e.trim())return null;try{const t=T(),n=$(),o=`${t}/check-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check path:",t),null}}async function hn(e){if(!e.trim())return null;try{const t=T(),n=$(),o=`${t}/check-remote-repo?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check remote repo:",t),null}}async function gn(e){if(!e.trim())return[];try{const t=T(),n=$(),o=`${t}/remote-candidates?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();return Array.isArray(a.candidates)?a.candidates:[]}catch(t){return console.error("Failed to resolve remote candidates:",t),[]}}async function vn(e){try{const t=T(),n=$(),o=`${t}/autocomplete-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).completions||[]}catch(t){return console.error("Failed to autocomplete path:",t),[]}}async function wn(){try{const e=T(),t=$(),n=`${e}/config${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();zt.set(!!r.gitInitDefault),Bt.set(r.uploadMethod||"websocket"),Kt.set(r.searchFolder||null),Vt.set(!!r.searchCreateRemote),Jt.set(r.searchDefaultModel||null),Ae.set(r.assistant&&typeof r.assistant=="object"?r.assistant:$e);const a={label:r.appearance?.label||"",accent:r.appearance?.accent||null,colors:r.appearance?.colors||null,frame:!!r.appearance?.frame,pattern:r.appearance?.pattern||"none"};Yt.set(a)}catch(e){console.error("Failed to fetch config:",e)}}function mn(e,t){Se(M,e,t),Se(O,e,t)}function Se(e,t,n){const o=C(e);o.folders.some(a=>a.sessions.some(s=>s.path===t&&!!s.isWorking!==n))&&e.set({...o,folders:o.folders.map(a=>a.sessions.some(s=>s.path===t)?{...a,sessions:a.sessions.map(s=>s.path===t?{...s,isWorking:n}:s)}:a)})}function Sn(e){M.update(t=>({...t,currentSession:e}))}export{Vt as A,Jt as B,Kt as C,nn as D,M as E,Sn as F,an as G,mn as H,ue as I,tn as J,en as K,Bt as L,Dt as a,Yt as b,on as c,un as d,Ae as e,vn as f,Q as g,pn as h,hn as i,Qt as j,wn as k,fn as l,cn as m,gn as n,sn as o,T as p,$ as q,zt as r,Xt as s,dn as t,At as u,O as v,Zt as w,mt as x,Pt as y,ln as z};
2
- //# sourceMappingURL=Cuh9gHb6.js.map
1
+ import{W as J,J as Re,ao as L,aU as Y,ai as Ue,am as Fe,af as ae,aK as Le,m as Me,a$ as ie,aV as q,an as B,b as Ne,j as Oe,aq as ce,X as Pe,h as _,K as ee,a6 as He,aY as De,a4 as We,as as xe,z as oe,g as je,f as ze,az as Be,b0 as le,E as Ke,D as Ve,aP as be,aE as ke,I as G,a as Je,O as Ye,ay as qe,a5 as Ge,aj as Xe,e as ye,aJ as Ee,d as Qe,A as Ze,N as et,ak as tt,F as nt,x as rt,o as ot,ah as st,n as _e,ae as C,be as S}from"./CAL8yDNt.js";import{b as at,r as it,v as ct}from"./BHw5ar2A.js";function Xt(e,t){return t}function lt(e,t,n){for(var o=[],r=t.length,a,s=t.length,l=0;l<r;l++){let b=t[l];ke(b,()=>{if(a){if(a.pending.delete(b),a.done.add(b),a.pending.size===0){var p=e.outrogroups;te(e,oe(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var i=o.length===0&&n!==null;if(i){var u=n,f=u.parentNode;Ye(f),f.append(u),e.items.clear()}te(e,t,!i)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function te(e,t,n=!0){var o;if(e.pending.size>0){o=new Set;for(const s of e.pending.values())for(const l of s)o.add(e.items.get(l).e)}for(var r=0;r<t.length;r++){var a=t[r];if(o?.has(a)){a.f|=_;const s=document.createDocumentFragment();qe(a,s)}else Ge(t[r],n)}}var fe;function Qt(e,t,n,o,r,a=null){var s=e,l=new Map,i=(t&ye)!==0;if(i){var u=e;s=L?Y(Ue(u)):u.appendChild(J())}L&&Fe();var f=null,b=We(()=>{var h=n();return xe(h)?h:h==null?[]:oe(h)}),p,k=new Map,y=!0;function N(h){(I.effect.f&Ve)===0&&(I.pending.delete(h),I.fallback=f,ft(I,p,s,t,o),f!==null&&(p.length===0?(f.f&_)===0?be(f):(f.f^=_,W(f,null,s)):ke(f,()=>{f=null})))}function c(h){I.pending.delete(h)}var d=Re(()=>{p=ae(b);var h=p.length;let m=!1;if(L){var j=Le(s)===Me;j!==(h===0)&&(s=ie(),Y(s),q(!1),m=!0)}for(var R=new Set,g=Pe,P=De(),U=0;U<h;U+=1){L&&B.nodeType===Ne&&B.data===Oe&&(s=B,m=!0,q(!1));var E=p[U],z=o(E,U),A=y?null:l.get(z);A?(A.v&&ce(A.v,E),A.i&&ce(A.i,U),P&&g.unskip_effect(A.e)):(A=ut(l,y?s:fe??=J(),E,z,U,r,t,n),y||(A.e.f|=_),l.set(z,A)),R.add(z)}if(h===0&&a&&!f&&(y?f=ee(()=>a(s)):(f=ee(()=>a(fe??=J())),f.f|=_)),h>R.size&&He(),L&&h>0&&Y(ie()),!y)if(k.set(g,R),P){for(const[Ce,Ie]of l)R.has(Ce)||g.skip_effect(Ie.e);g.oncommit(N),g.ondiscard(c)}else N(g);m&&q(!0),ae(b)}),I={effect:d,items:l,pending:k,outrogroups:null,fallback:f};y=!1,L&&(s=B)}function H(e){for(;e!==null&&(e.f&Je)===0;)e=e.next;return e}function ft(e,t,n,o,r){var a=(o&Qe)!==0,s=t.length,l=e.items,i=H(e.effect.first),u,f=null,b,p=[],k=[],y,N,c,d;if(a)for(d=0;d<s;d+=1)y=t[d],N=r(y,d),c=l.get(N).e,(c.f&_)===0&&(c.nodes?.a?.measure(),(b??=new Set).add(c));for(d=0;d<s;d+=1){if(y=t[d],N=r(y,d),c=l.get(N).e,e.outrogroups!==null)for(const E of e.outrogroups)E.pending.delete(c),E.done.delete(c);if((c.f&G)!==0&&(be(c),a&&(c.nodes?.a?.unfix(),(b??=new Set).delete(c))),(c.f&_)!==0)if(c.f^=_,c===i)W(c,null,n);else{var I=f?f.next:i;c===e.effect.last&&(e.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),F(e,f,c),F(e,c,I),W(c,I,n),f=c,p=[],k=[],i=H(f.next);continue}if(c!==i){if(u!==void 0&&u.has(c)){if(p.length<k.length){var h=k[0],m;f=h.prev;var j=p[0],R=p[p.length-1];for(m=0;m<p.length;m+=1)W(p[m],h,n);for(m=0;m<k.length;m+=1)u.delete(k[m]);F(e,j.prev,R.next),F(e,f,j),F(e,R,h),i=h,f=R,d-=1,p=[],k=[]}else u.delete(c),W(c,i,n),F(e,c.prev,c.next),F(e,c,f===null?e.effect.first:f.next),F(e,f,c),f=c;continue}for(p=[],k=[];i!==null&&i!==c;)(u??=new Set).add(i),k.push(i),i=H(i.next);if(i===null)continue}(c.f&_)===0&&p.push(c),f=c,i=H(c.next)}if(e.outrogroups!==null){for(const E of e.outrogroups)E.pending.size===0&&(te(e,oe(E.done)),e.outrogroups?.delete(E));e.outrogroups.size===0&&(e.outrogroups=null)}if(i!==null||u!==void 0){var g=[];if(u!==void 0)for(c of u)(c.f&G)===0&&g.push(c);for(;i!==null;)(i.f&G)===0&&i!==e.fallback&&g.push(i),i=H(i.next);var P=g.length;if(P>0){var U=(o&ye)!==0&&s===0?n:null;if(a){for(d=0;d<P;d+=1)g[d].nodes?.a?.measure();for(d=0;d<P;d+=1)g[d].nodes?.a?.fix()}lt(e,g,U)}}a&&Ee(()=>{if(b!==void 0)for(c of b)c.nodes?.a?.apply()})}function ut(e,t,n,o,r,a,s,l){var i=(s&je)!==0?(s&ze)===0?Be(n,!1,!1):le(n):null,u=(s&Ke)!==0?le(r):null;return{v:i,i:u,e:ee(()=>(a(t,i??n,u??r,l),()=>{e.delete(o)}))}}function W(e,t,n){if(e.nodes)for(var o=e.nodes.start,r=e.nodes.end,a=t&&(t.f&_)===0?t.nodes.start:n;o!==null;){var s=Xe(o);if(a.before(o),o===r)return;o=s}}function F(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const dt=Symbol("is custom element"),pt=Symbol("is html"),ht=_e?"link":"LINK",gt=_e?"progress":"PROGRESS";function Zt(e){if(L){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var o=e.value;ue(e,"value",null),e.value=o}if(e.hasAttribute("checked")){var r=e.checked;ue(e,"checked",null),e.checked=r}}};e[nt]=n,Ee(n),rt()}}function en(e,t){var n=se(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==gt)||(e.value=t??"")}function tn(e,t){var n=se(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function ue(e,t,n,o){var r=se(e);L&&(r[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===ht)||r[t]!==(r[t]=n)&&(t==="loading"&&(e[ot]=n),n==null?e.removeAttribute(t):typeof n!="string"&&vt(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function se(e){return e[Ze]??={[dt]:e.nodeName.includes("-"),[pt]:e.namespaceURI===et}}var de=new Map;function vt(e){var t=e.getAttribute("is")||e.nodeName,n=de.get(t);if(n)return n;de.set(t,n=[]);for(var o,r=e,a=Element.prototype;a!==r;){o=st(r);for(var s in o)o[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&n.push(s);r=tt(r)}return n}const wt="";function mt(...e){if(!e[0].startsWith("/"))throw new Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return at+wt+it(e[0],e[1])}const v=()=>{},St={assert:v,error:v,warn:v,info:v,log:v,debug:v,dir:v,table:v,trace:v,write:v,time:v,timeEnd:v,timeLog:v};function bt(){return globalThis?._logFactory}function kt(e,t){const n=bt();return n?n(e,{decoration:t?.decoration}):St}function yt(e,t){let n=performance.now();function o(r){const a=performance.now();a-n>t.idle&&e.update(),n=a}return["focus","pointerdown"].forEach(r=>window.addEventListener(r,o)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e.update()}),e.update(),setInterval(()=>e.update(),t.checks)}function Et(e,t){function n(){e.installing&&e.installing.addEventListener("statechange",function(){this.state==="installed"&&t(e)})}if(e){if(e.waiting)return t(e);e.installing?n():e.addEventListener("updatefound",n)}}function _t(e,t){let n;try{n=new URL(e,t.href)}catch{return}if(n.origin===t.origin&&(n.pathname===t.pathname||n.pathname==="/")&&n.hash){t.hash=n.hash;return}t.assign(n.href)}const Tt=()=>window.location;function $t(e=Tt){let t=1;const n=S([]);function o(s){n.update(l=>[...l,{...s,id:++t}])}function r(s){n.update(l=>l.filter(i=>i.id!==s))}function a(s){const l=C(n).find(i=>i.id==s);if(r(s),l?.type==="push-notification"){const i=l.data.options.data?.navigate;typeof i=="string"&&i&&_t(i,e())}}return{subscribe:n.subscribe,add:o,remove:r,onClick:a}}const At=$t(),w=kt("service-worker");function X(e){e&&(w.enabled?w.debug(`enabling logging for service worker, level: ${w.level}`):w.debug(`disabling logging for service worker, level: ${w.level}`),e.postMessage({type:"debug",level:w.level,enabled:w.enabled}))}const Ct=180*1e3,It=1800*1e3;function Rt(){const e=S(void 0);function t(s="active"){n({type:"ping"},s)}function n(s,l="active"){const i=C(e);if(!i)throw new Error("not loaded");if(i.notSupported)throw new Error("not supported");if(i.registering)throw new Error("is registering...");const u=i.registration;if(!u)throw new Error("no registration");if(!u[l])throw new Error(`no registration in state: ${l}`);u[l].postMessage(s)}function o(){w.log("accepting update...");const s=C(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");if(s.updateAvailable&&s.registration){const l=s.registration;if(!l)throw new Error("no registration");l.waiting?(w.log("was waiting, skipping..."),l.waiting.postMessage("skipWaiting")):(w.log("was not waiting, should we reload?"),w.error("not waiting..., todo reload?")),w.log("update store"),e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}}function r(){const s=C(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}function a(){if(typeof navigator<"u"&&"serviceWorker"in navigator){e.set({notSupported:!1,registering:!0});let s=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{s||(s=!0,window.location.reload())}),navigator.serviceWorker.onmessage=i=>{i.data&&i.data.type==="notification"&&(console.log(i),At.add({type:"push-notification",data:i.data.notification}))};const l=mt("/service-worker.js");navigator.serviceWorker.register(l,{type:"classic"}).then(i=>{try{yt(i,{idle:Ct,checks:It})}catch{}e.set({notSupported:!1,updateAvailable:!1,registration:i,registering:!1}),X(i.installing),X(i.waiting),X(i.active),Et(i,()=>{e.set({notSupported:!1,updateAvailable:!0,registration:i,registering:!1})})}).catch(i=>{console.error(i),e.set({registering:!1,notSupported:!1,updateAvailable:!1,registration:void 0,error:{message:"failed to register service-worker",cause:i.message||i}}),w.error("Failed to register service worker",i)})}else typeof window<"u"&&e.set({notSupported:!0})}return{subscribe:e.subscribe,set:e.set,get registration(){const s=C(e);if(s&&"registration"in s)return s.registration},get updateAvailable(){const s=C(e);return s&&"updateAvailable"in s?s.updateAvailable:!1},register:a,pingServideWorker:t,sendMessage:n,skipWaiting:o,skip:r}}function Ut(e){if(!e)return{params:{},pathname:""};const t={},n=e.lastIndexOf("#");let o=e;n!==-1&&(o=o.slice(0,n));const r=o.indexOf("?");r!==-1&&o.slice(r+1).split("&").forEach(s=>{const[l,i=""]=s.split("=");t[decodeURIComponent(l)]=i===""?"true":decodeURIComponent(i)});let a=o.slice(0,r)||"";return a&&!a.endsWith("/")&&(a+="/"),{params:t,pathname:a}}function Ft(){return typeof window>"u"?{params:{}}:Ut(window.location.href)}function Lt(e){if(typeof window>"u")return{};const t=window.location.hash,n={},o=t.lastIndexOf("#");return o!==-1&&t.slice(o+1).split("&").forEach(r=>{const[a,s=""]=r.split("=");n[decodeURIComponent(a)]=decodeURIComponent(s)}),n}const nn=Rt();Lt();const{params:rn}=Ft();console.log(`VERSION: ${ct}`);const pe={brandDark:"--color-brand-dark",brandSurface:"--color-brand-surface",brandSurface2:"--color-brand-surface-2",brandSurface3:"--color-brand-surface-3",brandBorder:"--color-brand-border",brandText:"--color-brand-text",brandTextMuted:"--color-brand-text-muted",brandCyan:"--color-brand-cyan",brandBlue:"--color-brand-blue",brandPurple:"--color-brand-purple"},Mt=["--color-brand-cyan","--color-brand-blue","--color-brand-purple"],Nt={label:"",accent:null,colors:null,frame:!1,pattern:"none"};function on(e){if(typeof document>"u")return;const t=document.documentElement;for(const n of Object.values(pe))t.style.removeProperty(n);if(t.classList.remove("wherever-framed"),delete t.dataset.whereverPattern,e.accent){for(const n of Mt)t.style.setProperty(n,e.accent);document.querySelector('meta[name="theme-color"]')?.setAttribute("content",e.accent)}if(e.frame&&t.classList.add("wherever-framed"),e.pattern&&e.pattern!=="none"&&(t.dataset.whereverPattern=e.pattern),e.colors)for(const[n,o]of Object.entries(e.colors)){const r=pe[n];r&&typeof o=="string"&&t.style.setProperty(r,o)}}const he="wherever-config",Ot="token";function ge(e,t){const n=e.startsWith(t)?e.slice(1):e;if(!n)return{present:!1,value:"",rest:e};const o=new URLSearchParams(n),r=[...new Set([...o.keys()].filter(i=>i.toLowerCase()===Ot))];if(r.length===0)return{present:!1,value:"",rest:e};const s=r.flatMap(i=>o.getAll(i)).find(i=>i.trim())??"";for(const i of r)o.delete(i);const l=o.toString();return{present:!0,value:s,rest:l?`${t}${l}`:""}}function Te(e,t){const n=ge(t||"","#"),o=ge(e||"","?"),r=n.value||o.value;return{token:r||null,present:n.present||o.present,search:o.rest,hash:n.rest}}function Pt(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=Te(e.search||"",e.hash||"");if(!t.present)return!1;try{const n=window.history;if(n&&typeof n.replaceState=="function"){const o=e.pathname||"/";return n.replaceState(n.state??null,"",`${o}${t.search}${t.hash}`),!0}}catch{}return!1}function Ht(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=Te(e.search||"",e.hash||"");if(!t.present||(Pt(),!t.token))return!1;let n={};try{const o=localStorage.getItem(he);if(o){const r=JSON.parse(o);r&&typeof r=="object"&&(n=r)}}catch{n={}}try{return localStorage.setItem(he,JSON.stringify({...n,token:t.token})),!0}catch{return!1}}let ve=!1;function Dt(){return ve?!1:(ve=!0,Ht())}Dt();const M=S({folders:[],activeSessions:[],currentSession:null,loading:!1}),Q=S({models:[],loading:!1}),O=S({folders:[],activeSessions:[],currentSession:null,loading:!1});function Z(){if(typeof window<"u"&&window.location){const e=window.location;if(e.port)return Number(e.port);if(e.protocol==="https:")return 443;if(e.protocol==="http:")return 80}return 31415}function T(){const e=localStorage.getItem("wherever-config"),t=typeof window<"u"&&window.location&&window.location.hostname?window.location.hostname:"localhost";if(e){const n=JSON.parse(e),o=window.location.protocol==="https:"?"https:":"http:";let r=n.host||t;(r==="localhost"||r==="127.0.0.1")&&t&&t!=="localhost"&&t!=="127.0.0.1"&&(r=t),r=r.startsWith("http")?r.replace(/^wss?:\/\//,""):r;let a=n.port;return(a===31415||a===void 0)&&Z()!==31415&&(a=Z()),`${o}//${r}:${a||Z()}`}return`${window.location.protocol}//${window.location.host}`}let D=null,x=[],ne=!1,re=!1,we=0;const Wt=150,xt=1e3;async function jt(){ne=!0;try{const e=T(),t=$(),n=`${e}/sessions${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();M.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:C(M).currentSession,loading:!1})}catch(e){M.update(t=>({...t,loading:!1})),console.error("Failed to fetch sessions:",e)}finally{ne=!1}}function sn(){M.update(n=>({...n,loading:!0}));const e=new Promise(n=>{x.push(n)});if(ne)return re=!0,e;const t=Date.now();if(!D)we=t;else if(clearTimeout(D),t-we>=xt)return D=null,me(),e;return D=setTimeout(()=>{D=null,me()},Wt),e}async function me(){try{do{re=!1;const e=x;x=[];try{await jt()}finally{for(const t of e)t()}}while(re)}finally{const e=x;x=[];for(const t of e)t()}}function K(e,t,n){let o;return e.update(r=>({...r,folders:r.folders.map(a=>a.sessions.some(s=>s.path===t)?{...a,sessions:a.sessions.map(s=>s.path!==t?s:(o=!!s.starred,{...s,starred:n}))}:a)})),o}async function an(e,t){const n=K(M,e,t),o=K(O,e,t);try{const r=T(),a=$(),s=`${r}/sessions/star${a?`?token=${encodeURIComponent(a)}`:""}`,l=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionFile:e,starred:t})});if(!l.ok){const i=await l.json().catch(()=>({}));throw new Error(i.error||`Star failed with status ${l.status}`)}}catch(r){throw n!==void 0&&K(M,e,n),o!==void 0&&K(O,e,o),console.error("Failed to update star:",r),r}}async function cn(){O.update(e=>({...e,loading:!0}));try{const e=T(),t=$(),n=`${e}/sessions?view=readonly${t?`&token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();O.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:C(O).currentSession,loading:!1})}catch(e){O.update(t=>({...t,loading:!1})),console.error("Failed to fetch read-only sessions:",e)}}let V=null;async function ln(e,t="default"){V?.abort();const n=new AbortController;V=n;try{const o=T(),r=$(),a=new URLSearchParams({q:e});t==="readonly"&&a.set("view","readonly"),r&&a.set("token",r);const s=await fetch(`${o}/search?${a.toString()}`,{signal:n.signal});return s.ok?await s.json():{status:"error",query:e,hits:[],message:s.status===401?"Unauthorized: check the token in Connection Settings.":`Search failed (HTTP ${s.status}).`}}catch(o){return o?.name==="AbortError"?null:{status:"error",query:e,hits:[],message:o?.message||"Search request failed."}}finally{V===n&&(V=null)}}async function fn(){Q.update(e=>({...e,loading:!0}));try{const e=T(),t=$(),n=`${e}/models${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();Q.set({models:r.models||[],loading:!1})}catch(e){Q.update(t=>({...t,loading:!1})),console.error("Failed to fetch models:",e)}}function $(){try{const e=localStorage.getItem("wherever-config");if(e)return JSON.parse(e).token||""}catch{}return""}const zt=S(!1),Bt=S("websocket"),Kt=S(null),Vt=S(!1),Jt=S(null),$e={configured:!1,folder:null,active:!1,lock:null},Ae=S($e);function un(e){Ae.update(t=>t.active?{...t,currentSessionId:e.currentSessionId,currentSessionFile:e.currentSessionFile,...e.timezone!==void 0?{timezone:e.timezone}:{}}:t)}function dn(e,t){return e.active&&!!t&&!!e.currentSessionFile&&e.currentSessionFile===t}const Yt=S(Nt);async function pn(e){if(!e.trim())return null;try{const t=T(),n=$(),o=`${t}/check-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check path:",t),null}}async function hn(e){if(!e.trim())return null;try{const t=T(),n=$(),o=`${t}/check-remote-repo?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check remote repo:",t),null}}async function gn(e){if(!e.trim())return[];try{const t=T(),n=$(),o=`${t}/remote-candidates?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();return Array.isArray(a.candidates)?a.candidates:[]}catch(t){return console.error("Failed to resolve remote candidates:",t),[]}}async function vn(e){try{const t=T(),n=$(),o=`${t}/autocomplete-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).completions||[]}catch(t){return console.error("Failed to autocomplete path:",t),[]}}async function wn(){try{const e=T(),t=$(),n=`${e}/config${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();zt.set(!!r.gitInitDefault),Bt.set(r.uploadMethod||"websocket"),Kt.set(r.searchFolder||null),Vt.set(!!r.searchCreateRemote),Jt.set(r.searchDefaultModel||null),Ae.set(r.assistant&&typeof r.assistant=="object"?r.assistant:$e);const a={label:r.appearance?.label||"",accent:r.appearance?.accent||null,colors:r.appearance?.colors||null,frame:!!r.appearance?.frame,pattern:r.appearance?.pattern||"none"};Yt.set(a)}catch(e){console.error("Failed to fetch config:",e)}}function mn(e,t){Se(M,e,t),Se(O,e,t)}function Se(e,t,n){const o=C(e);o.folders.some(a=>a.sessions.some(s=>s.path===t&&!!s.isWorking!==n))&&e.set({...o,folders:o.folders.map(a=>a.sessions.some(s=>s.path===t)?{...a,sessions:a.sessions.map(s=>s.path===t?{...s,isWorking:n}:s)}:a)})}function Sn(e){M.update(t=>({...t,currentSession:e}))}export{Vt as A,Jt as B,Kt as C,nn as D,M as E,Sn as F,an as G,mn as H,ue as I,tn as J,en as K,Bt as L,Dt as a,Yt as b,on as c,un as d,Ae as e,vn as f,Q as g,pn as h,hn as i,Qt as j,wn as k,fn as l,cn as m,gn as n,sn as o,T as p,$ as q,zt as r,Xt as s,dn as t,At as u,O as v,Zt as w,mt as x,Pt as y,ln as z};
2
+ //# sourceMappingURL=FePVnZ_7.js.map