gitwarren 0.1.8 → 0.1.9

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.
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./main-CzA88P-p.js","./routes-DFoqib84.js","./main-CPEXHyPM.css"])))=>i.map(i=>d[i]);
2
- import{a as U,A as B,i as F,b as j,r as H,c as b,e as I,d as D,l as M,p as N,f as q,H as G,h as J,o as x}from"./routes-DFoqib84.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function o(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=o(r);fetch(r.href,i)}})();const K="modulepreload",V=function(e,t){return new URL(e,t).href},k={},X=function(t,o,n){let r=Promise.resolve();if(o&&o.length>0){let w=function(a){return Promise.all(a.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const c=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),y=f?.nonce||f?.getAttribute("nonce");r=w(o.map(a=>{if(a=V(a,n),a in k)return;k[a]=!0;const p=a.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(n)for(let l=c.length-1;l>=0;l--){const u=c[l];if(u.href===a&&(!p||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${h}`))return;const s=document.createElement("link");if(s.rel=p?"stylesheet":K,p||(s.as="script"),s.crossOrigin="",s.href=a,y&&s.setAttribute("nonce",y),document.head.appendChild(s),p)return new Promise((l,u)=>{s.addEventListener("load",l),s.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return r.then(c=>{for(const f of c||[])f.status==="rejected"&&i(f.reason);return t().catch(i)})},P="/gitwarren",O={socket:`${P}/socket`,appInfo:`${P}/app-info`,attachments:`${P}/attachments/`};function Y(e,t){const o=U(e);if(o===null)return e;const n=`${O.attachments}${o}`;return t===void 0?n:`${n}?${B}=${encodeURIComponent(t)}`}const $=32768;function z(e){let t="";for(let o=0;o<e.length;o+=$)t+=String.fromCharCode(...e.subarray(o,o+$));return btoa(t)}function A(e){const{params:t}=e;if(typeof t!="object"||t===null)return JSON.stringify(e);let o=null;for(const[n,r]of Object.entries(t)){const i=Q(r);i!==null&&(o??={...t},o[n]=z(i))}return JSON.stringify(o===null?e:{...e,params:o})}function Q(e){return e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null}const C=[250,500,1e3,2e3,5e3];function Z(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${O.socket}`}function ee(){let e=null,t=0,o=1;const n=new Map,r=[],i=new Set,c=new Set,f=s=>{for(const l of i)l(s)},y=s=>{e?.readyState===WebSocket.OPEN?e.send(A(s)):r.push(s)},w=()=>{const s=[...n.values()];n.clear();for(const l of s)l.reject(new b("INTERNAL","The connection to GitWarren was lost before this finished. Nothing was retried; try again."))},a=()=>{const s=new WebSocket(Z());e=s,s.addEventListener("open",()=>{t=0;const u=r.splice(0,r.length);for(const d of u)s.send(A(d));f(!0)}),s.addEventListener("message",u=>{let d;try{d=JSON.parse(u.data)}catch{console.error("[carrier] a message from GitWarren was not JSON");return}if(typeof d!="object"||d===null)return;if(j(d)){for(const E of c)E(d);return}const g=d;if(typeof g.id!="number")return;const m=n.get(g.id);m&&(n.delete(g.id),m.resolve(g))});const l=()=>{if(e!==s)return;e=null,w(),f(!1);const u=C[Math.min(t,C.length-1)];t+=1,window.setTimeout(a,u)};s.addEventListener("close",l),s.addEventListener("error",()=>{console.error("[carrier] the connection to GitWarren failed")})};a();const p=new Map,h=(s,l,u)=>{const d=o++;return new Promise((m,E)=>{n.set(d,{resolve:m,reject:E}),y({id:d,method:s,params:l,...u===void 0?{}:{host:u}})}).then(m=>H(m))};return{request(s,l,u){if(!F(s))return h(s,l,u);const d=`${u??""}:${s}:${JSON.stringify(l??null)}`,g=p.get(d);if(g)return g;const m=h(s,l,u).finally(()=>p.delete(d));return p.set(d,m),m},connected:()=>e?.readyState===WebSocket.OPEN,onConnectionChange(s){return i.add(s),()=>i.delete(s)},onEvent(s){return c.add(s),()=>c.delete(s)}}}const R=()=>{};function v(e,t){return Promise.reject(new b("FORBIDDEN",`${e} is not available in a browser tab. ${t}`))}function te(e,t){const o=e.find(n=>n.instanceId===t);if(!o)throw new b("NOT_FOUND",`This GitWarren does not know a host with id ${t}. It may have been removed, or the link may have come from somewhere else.`);return o}async function ne(){const e=await fetch(O.appInfo,{credentials:"same-origin",headers:{Accept:"application/json"}});if(!e.ok)throw new b("INTERNAL",`GitWarren could not describe this install (HTTP ${e.status}).`);return await e.json()}function T(){const e=M();return{editors:e,defaultId:e[0]?.id??null}}const _={state:"unsupported",reason:"GitWarren in a browser is updated by whatever installed it - Homebrew, npm, or the tarball it was unpacked from."};function oe(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/png,image/jpeg,image/gif,image/webp",t.style.position="fixed",t.style.left="-9999px",document.body.append(t);let o=!1;const n=i=>{o||(o=!0,window.removeEventListener("focus",r),t.remove(),e(i))},r=()=>{window.setTimeout(()=>n(t.files?.[0]??null),300)};t.addEventListener("change",()=>n(t.files?.[0]??null)),t.addEventListener("cancel",()=>n(null)),window.addEventListener("focus",r),t.click()})}function re(e){return{capabilities:{pickDirectory:!1,revealPath:!1,openAtLogin:!1},system:{pickDirectory:()=>Promise.resolve(null),revealPath:()=>v("Revealing a folder","Copy the path and open it yourself."),appInfo:ne,editors:()=>Promise.resolve(T()),getOpenAtLogin:()=>Promise.resolve(!1),setOpenAtLogin:()=>v("Starting at login","Run `gitwarren service install` on this machine.")},updates:{getStatus:()=>Promise.resolve(_),check:()=>Promise.resolve(_),installNow:()=>v("Installing an update","Update GitWarren the way you installed it."),subscribe:()=>R},connection:{connected:()=>e.connected(),subscribe:n=>e.onConnectionChange(n)},navigation:{onDeepLink:()=>R},pickAttachment:async n=>{const r=await oe();return r===null?null:await e.request("attachments.ingest",{bytes:await r.arrayBuffer(),originalName:r.name},n)},attachmentSrc:Y,openInEditor:async n=>{const{id:r,path:i,changes:c,line:f,editorId:y,host:w}=n,a=I(y)??I(T().defaultId??void 0);if(!a?.url)return v("Opening a file in an editor","No editor with a URL scheme was chosen for this tab.");if(w!==void 0&&!a.remoteUrl)return v("Opening a file on another machine",`${a.label} has no way to open a file it cannot see. VS Code, Cursor and Windsurf do.`);const p=await e.request("reviews.filePath",{id:r,path:i,changes:c},w),h=w===void 0?void 0:D(te(await e.request("hosts.list",void 0),w));window.location.href=h===void 0?a.url(p,f??1):a.remoteUrl(h,p,f??1)}}}const se="gitwarren",L=`${se}://`,W="review",S="h=";function ie(e){if(!e||e.slice(0,L.length).toLowerCase()!==L)return null;const o=(e.slice(L.length).split(/[?#]/)[0]??"").split("/").filter(Boolean),n=o[0]?.toLowerCase();if(n===W)return N(`#/reviews/${o.slice(1).join("/")}`);if(n!==void 0&&q(n)){const r=o.slice(1);return r.length===0?{name:"repositories",host:n}:r[0]?.toLowerCase()!==W?null:N(`#/h/${n}/reviews/${r.slice(1).join("/")}`)}return null}function ae(e){return e.replace(/^#/,"").startsWith(S)}function ce(e,t){const o=e.replace(/^#/,"");if(!o.startsWith(S))return null;const n=ie(`gitwarren://${o.slice(S.length)}`);if(!n)return G;if(n.host===void 0)return n;if(n.host===t){const{host:r,...i}=n;return i}return n}function le(e){return{request:(t,o,n)=>x(()=>e.request(t,o,n)),onEvent:t=>e.onEvent(t)}}function ue(){const e=ee(),t={carrier:le(e),shell:re(e)};return window.gitwarren=t,t}async function fe(e){if(!ae(window.location.hash))return;const{instanceId:t}=await e.shell.system.appInfo(),o=ce(window.location.hash,t);o&&window.location.replace(J(o))}const de=ue();await fe(de);await X(()=>import("./main-CzA88P-p.js"),__vite__mapDeps([0,1,2]),import.meta.url);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./main-DcbWbSn_.js","./routes-DFoqib84.js","./main-CPEXHyPM.css"])))=>i.map(i=>d[i]);
2
+ import{a as U,A as B,i as F,b as j,r as H,c as b,e as I,d as D,l as M,p as N,f as q,H as G,h as J,o as x}from"./routes-DFoqib84.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function o(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=o(r);fetch(r.href,i)}})();const K="modulepreload",V=function(e,t){return new URL(e,t).href},k={},X=function(t,o,n){let r=Promise.resolve();if(o&&o.length>0){let w=function(a){return Promise.all(a.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const c=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),y=f?.nonce||f?.getAttribute("nonce");r=w(o.map(a=>{if(a=V(a,n),a in k)return;k[a]=!0;const p=a.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(n)for(let l=c.length-1;l>=0;l--){const u=c[l];if(u.href===a&&(!p||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${h}`))return;const s=document.createElement("link");if(s.rel=p?"stylesheet":K,p||(s.as="script"),s.crossOrigin="",s.href=a,y&&s.setAttribute("nonce",y),document.head.appendChild(s),p)return new Promise((l,u)=>{s.addEventListener("load",l),s.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return r.then(c=>{for(const f of c||[])f.status==="rejected"&&i(f.reason);return t().catch(i)})},P="/gitwarren",O={socket:`${P}/socket`,appInfo:`${P}/app-info`,attachments:`${P}/attachments/`};function Y(e,t){const o=U(e);if(o===null)return e;const n=`${O.attachments}${o}`;return t===void 0?n:`${n}?${B}=${encodeURIComponent(t)}`}const $=32768;function z(e){let t="";for(let o=0;o<e.length;o+=$)t+=String.fromCharCode(...e.subarray(o,o+$));return btoa(t)}function A(e){const{params:t}=e;if(typeof t!="object"||t===null)return JSON.stringify(e);let o=null;for(const[n,r]of Object.entries(t)){const i=Q(r);i!==null&&(o??={...t},o[n]=z(i))}return JSON.stringify(o===null?e:{...e,params:o})}function Q(e){return e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null}const C=[250,500,1e3,2e3,5e3];function Z(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${O.socket}`}function ee(){let e=null,t=0,o=1;const n=new Map,r=[],i=new Set,c=new Set,f=s=>{for(const l of i)l(s)},y=s=>{e?.readyState===WebSocket.OPEN?e.send(A(s)):r.push(s)},w=()=>{const s=[...n.values()];n.clear();for(const l of s)l.reject(new b("INTERNAL","The connection to GitWarren was lost before this finished. Nothing was retried; try again."))},a=()=>{const s=new WebSocket(Z());e=s,s.addEventListener("open",()=>{t=0;const u=r.splice(0,r.length);for(const d of u)s.send(A(d));f(!0)}),s.addEventListener("message",u=>{let d;try{d=JSON.parse(u.data)}catch{console.error("[carrier] a message from GitWarren was not JSON");return}if(typeof d!="object"||d===null)return;if(j(d)){for(const E of c)E(d);return}const g=d;if(typeof g.id!="number")return;const m=n.get(g.id);m&&(n.delete(g.id),m.resolve(g))});const l=()=>{if(e!==s)return;e=null,w(),f(!1);const u=C[Math.min(t,C.length-1)];t+=1,window.setTimeout(a,u)};s.addEventListener("close",l),s.addEventListener("error",()=>{console.error("[carrier] the connection to GitWarren failed")})};a();const p=new Map,h=(s,l,u)=>{const d=o++;return new Promise((m,E)=>{n.set(d,{resolve:m,reject:E}),y({id:d,method:s,params:l,...u===void 0?{}:{host:u}})}).then(m=>H(m))};return{request(s,l,u){if(!F(s))return h(s,l,u);const d=`${u??""}:${s}:${JSON.stringify(l??null)}`,g=p.get(d);if(g)return g;const m=h(s,l,u).finally(()=>p.delete(d));return p.set(d,m),m},connected:()=>e?.readyState===WebSocket.OPEN,onConnectionChange(s){return i.add(s),()=>i.delete(s)},onEvent(s){return c.add(s),()=>c.delete(s)}}}const R=()=>{};function v(e,t){return Promise.reject(new b("FORBIDDEN",`${e} is not available in a browser tab. ${t}`))}function te(e,t){const o=e.find(n=>n.instanceId===t);if(!o)throw new b("NOT_FOUND",`This GitWarren does not know a host with id ${t}. It may have been removed, or the link may have come from somewhere else.`);return o}async function ne(){const e=await fetch(O.appInfo,{credentials:"same-origin",headers:{Accept:"application/json"}});if(!e.ok)throw new b("INTERNAL",`GitWarren could not describe this install (HTTP ${e.status}).`);return await e.json()}function T(){const e=M();return{editors:e,defaultId:e[0]?.id??null}}const _={state:"unsupported",reason:"GitWarren in a browser is updated by whatever installed it - Homebrew, npm, or the tarball it was unpacked from."};function oe(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/png,image/jpeg,image/gif,image/webp",t.style.position="fixed",t.style.left="-9999px",document.body.append(t);let o=!1;const n=i=>{o||(o=!0,window.removeEventListener("focus",r),t.remove(),e(i))},r=()=>{window.setTimeout(()=>n(t.files?.[0]??null),300)};t.addEventListener("change",()=>n(t.files?.[0]??null)),t.addEventListener("cancel",()=>n(null)),window.addEventListener("focus",r),t.click()})}function re(e){return{capabilities:{pickDirectory:!1,revealPath:!1,openAtLogin:!1},system:{pickDirectory:()=>Promise.resolve(null),revealPath:()=>v("Revealing a folder","Copy the path and open it yourself."),appInfo:ne,editors:()=>Promise.resolve(T()),getOpenAtLogin:()=>Promise.resolve(!1),setOpenAtLogin:()=>v("Starting at login","Run `gitwarren service install` on this machine.")},updates:{getStatus:()=>Promise.resolve(_),check:()=>Promise.resolve(_),installNow:()=>v("Installing an update","Update GitWarren the way you installed it."),subscribe:()=>R},connection:{connected:()=>e.connected(),subscribe:n=>e.onConnectionChange(n)},navigation:{onDeepLink:()=>R},pickAttachment:async n=>{const r=await oe();return r===null?null:await e.request("attachments.ingest",{bytes:await r.arrayBuffer(),originalName:r.name},n)},attachmentSrc:Y,openInEditor:async n=>{const{id:r,path:i,changes:c,line:f,editorId:y,host:w}=n,a=I(y)??I(T().defaultId??void 0);if(!a?.url)return v("Opening a file in an editor","No editor with a URL scheme was chosen for this tab.");if(w!==void 0&&!a.remoteUrl)return v("Opening a file on another machine",`${a.label} has no way to open a file it cannot see. VS Code, Cursor and Windsurf do.`);const p=await e.request("reviews.filePath",{id:r,path:i,changes:c},w),h=w===void 0?void 0:D(te(await e.request("hosts.list",void 0),w));window.location.href=h===void 0?a.url(p,f??1):a.remoteUrl(h,p,f??1)}}}const se="gitwarren",L=`${se}://`,W="review",S="h=";function ie(e){if(!e||e.slice(0,L.length).toLowerCase()!==L)return null;const o=(e.slice(L.length).split(/[?#]/)[0]??"").split("/").filter(Boolean),n=o[0]?.toLowerCase();if(n===W)return N(`#/reviews/${o.slice(1).join("/")}`);if(n!==void 0&&q(n)){const r=o.slice(1);return r.length===0?{name:"repositories",host:n}:r[0]?.toLowerCase()!==W?null:N(`#/h/${n}/reviews/${r.slice(1).join("/")}`)}return null}function ae(e){return e.replace(/^#/,"").startsWith(S)}function ce(e,t){const o=e.replace(/^#/,"");if(!o.startsWith(S))return null;const n=ie(`gitwarren://${o.slice(S.length)}`);if(!n)return G;if(n.host===void 0)return n;if(n.host===t){const{host:r,...i}=n;return i}return n}function le(e){return{request:(t,o,n)=>x(()=>e.request(t,o,n)),onEvent:t=>e.onEvent(t)}}function ue(){const e=ee(),t={carrier:le(e),shell:re(e)};return window.gitwarren=t,t}async function fe(e){if(!ae(window.location.hash))return;const{instanceId:t}=await e.shell.system.appInfo(),o=ce(window.location.hash,t);o&&window.location.replace(J(o))}const de=ue();await fe(de);await X(()=>import("./main-DcbWbSn_.js"),__vite__mapDeps([0,1,2]),import.meta.url);