@plannotator/pi-extension 0.9.1 → 0.9.2
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.
- package/package.json +1 -1
- package/plannotator.html +2 -2
- package/review-editor.html +2 -2
package/package.json
CHANGED
package/plannotator.html
CHANGED
|
@@ -413,7 +413,7 @@ created: ${new Date().toISOString().slice(0,19)}Z
|
|
|
413
413
|
source: plannotator
|
|
414
414
|
tags: [plan, ...]
|
|
415
415
|
---`})]})]})]}),Y.jsx("div",{className:"border-t border-border"}),Y.jsxs("div",{className:"flex items-center justify-between",children:[Y.jsxs("div",{children:[Y.jsx("div",{className:"text-sm font-medium",children:"Bear Notes"}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:"Auto-save approved plans to Bear"})]}),Y.jsx("button",{role:"switch","aria-checked":x.enabled,onClick:()=>X(!x.enabled),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${x.enabled?"bg-primary":"bg-muted"}`,children:Y.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${x.enabled?"translate-x-6":"translate-x-1"}`})})]})]})]})]})]})}),document.body)]})};function LW(t){if(t?.length)return t.map(e=>{if(typeof e=="string"){const r=e.split("/").pop()?.replace(/\.[^.]+$/,"")||"image";return{path:e,name:r}}return{path:e[0],name:e[1]}})}function Cle(t){if(t?.length)return t.map(e=>[e.path,e.name])}async function O6e(t){const e=JSON.stringify(t),r=new TextEncoder().encode(e),n=new CompressionStream("deflate-raw"),a=n.writable.getWriter();a.write(r),a.close();const i=await new Response(n.readable).arrayBuffer(),s=new Uint8Array(i);return btoa(String.fromCharCode(...s)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function Rle(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=atob(e),n=Uint8Array.from(r,l=>l.charCodeAt(0)),a=new DecompressionStream("deflate-raw"),i=a.writable.getWriter();i.write(n),i.close();const s=await new Response(a.readable).arrayBuffer(),o=new TextDecoder().decode(s);return JSON.parse(o)}function I6e(t){return t.map(e=>{const r=e.author||null,n=Cle(e.images);if(e.type===En.GLOBAL_COMMENT)return["G",e.text||"",r,n];const a=e.type[0];return a==="D"?["D",e.originalText,r,n]:[a,e.originalText,e.text||"",r,n]})}function PW(t){const e={D:En.DELETION,R:En.REPLACEMENT,C:En.COMMENT,I:En.INSERTION,G:En.GLOBAL_COMMENT};return t.map((r,n)=>{const a=r[0];if(a==="G"){const u=r[1],d=r[2],h=r[3];return{id:`shared-${n}-${Date.now()}`,blockId:"",startOffset:0,endOffset:0,type:En.GLOBAL_COMMENT,text:u||void 0,originalText:"",createdA:Date.now()+n,author:d||void 0,images:LW(h)}}const i=r[1],s=a==="D"?void 0:r[2],o=a==="D"?r[2]:r[3],l=a==="D"?r[3]:r[4];return{id:`shared-${n}-${Date.now()}`,blockId:"",startOffset:0,endOffset:0,type:e[a],text:s||void 0,originalText:i,createdA:Date.now()+n,author:o||void 0,images:LW(l)}})}async function N6e(t,e,r,n="https://share.plannotator.ai"){const a={p:t,a:I6e(e),g:r?.length?Cle(r):void 0},i=await O6e(a);return`${n}/#${i}`}async function k6e(){const t=window.location.hash.slice(1);if(!t)return null;try{return await Rle(t)}catch(e){return console.warn("Failed to parse share hash:",e),null}}function M6e(t){const e=new Blob([t]).size;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}function BW(t){return t?.length?t.map((e,r)=>{if(typeof e=="string"){const n=e.split("/").pop()?.replace(/\.[^.]+$/,"")||`image-${r+1}`;return{path:e,name:n}}return Array.isArray(e)&&e.length>=2?{path:e[0],name:e[1]}:{path:String(e),name:`image-${r+1}`}}):[]}function D6e(t,e,r,n,a,i,s,o){const[l,u]=Ie.useState(!1),[d,h]=Ie.useState(!0),[f,p]=Ie.useState(""),[m,y]=Ie.useState(""),[b,E]=Ie.useState(null),[x,T]=Ie.useState(null),R=Ie.useCallback(()=>{E(null),T(null)},[]),A=Ie.useCallback(async()=>{try{const w=await k6e();if(w){n(w.p);const N=PW(w.a);if(a(N),w.g?.length){const P=BW(w.g);i(P),T(P)}return E(N),u(!0),s?.(),window.history.replaceState({},"",window.location.pathname),!0}return!1}catch(w){return console.error("Failed to load from share hash:",w),!1}},[n,a,i,s]);Ie.useEffect(()=>{A().finally(()=>h(!1))},[]),Ie.useEffect(()=>{const w=()=>{window.location.hash.length>1&&A()};return window.addEventListener("hashchange",w),()=>window.removeEventListener("hashchange",w)},[A]);const M=Ie.useCallback(async()=>{try{const w=await N6e(t,e,r,o);p(w),y(M6e(w))}catch(w){console.error("Failed to generate share URL:",w),p(""),y("")}},[t,e,r,o]);Ie.useEffect(()=>{M()},[M]);const I=Ie.useCallback(async w=>{try{const N=w.indexOf("#");if(N===-1)return{success:!1,count:0,planTitle:"",error:"Invalid share URL: no hash fragment found"};const P=w.slice(N+1);if(!P)return{success:!1,count:0,planTitle:"",error:"Invalid share URL: empty hash"};const D=await Rle(P),z=(D.p||"").trim().split(`
|
|
416
|
-
`).find(F=>F.startsWith("#")),k=z?z.replace(/^#+\s*/,"").trim():"Unknown Plan",B=PW(D.a);if(B.length===0)return{success:!0,count:0,planTitle:k,error:"No annotations found in share link"};const L=B.filter(F=>!e.some(U=>U.originalText===F.originalText&&U.type===F.type&&U.text===F.text));if(L.length>0&&(a([...e,...L]),E(L),D.g?.length)){const F=BW(D.g),U=new Set(r.map(W=>W.path)),q=F.filter(W=>!U.has(W.path));q.length>0&&i([...r,...q]),T(F)}return{success:!0,count:L.length,planTitle:k}}catch(N){return{success:!1,count:0,planTitle:"",error:N instanceof Error?N.message:"Failed to decompress share URL"}}},[e,r,a,i]);return{isSharedSession:l,isLoadingShared:d,shareUrl:f,shareUrlSize:m,pendingSharedAnnotations:b,sharedGlobalAttachments:x,clearPendingSharedAnnotations:R,refreshShareUrl:M,importFromShareUrl:I}}function L6e(t,e){const[r,n]=Ie.useState(null),a=Ie.useRef(null);return Ie.useEffect(()=>{const i=t.current;if(!i)return;const s=i.querySelectorAll('[data-block-type="heading"]');if(s.length===0)return;const o=new Map;return a.current=new IntersectionObserver(l=>{l.forEach(h=>{o.set(h.target,h.isIntersecting)});let u=null,d=1/0;for(const[h,f]of o)if(f){const p=h.getBoundingClientRect();p.top<d&&(d=p.top,u=h)}if(u){const h=u.getAttribute("data-block-id");h&&n(h)}},{root:i,rootMargin:"-80px 0px -80% 0px",threshold:[0,.1,.5,1]}),s.forEach(l=>{a.current?.observe(l)}),()=>{a.current?.disconnect()}},[t,e]),r}function FW(t){window.close(),setTimeout(()=>{window.closed||t()},300)}function P6e(t){const[e,r]=Ie.useState({phase:"idle"});Ie.useEffect(()=>{if(!t)return;const a=Qoe();a==="0"?(FW(()=>r({phase:"closeFailed"})),r({phase:"closed"})):r(a!=="off"?{phase:"counting",remaining:Number(a)}:{phase:"prompt"})},[t]),Ie.useEffect(()=>{if(e.phase!=="counting")return;if(e.remaining<=0){FW(()=>r({phase:"closeFailed"}));return}const a=setTimeout(()=>r(i=>i.phase==="counting"?{phase:"counting",remaining:i.remaining-1}:i),1e3);return()=>clearTimeout(a)},[e]);const n=Ie.useCallback(()=>{Xoe("3"),r({phase:"counting",remaining:3})},[]);return{state:e,enableAndStart:n}}const B6e=()=>Y.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),F6e=()=>Y.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})});function _6e({submitted:t,title:e,subtitle:r,agentLabel:n}){const{state:a,enableAndStart:i}=P6e(!!t);if(!t)return null;const s=t==="approved";return Y.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:Y.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[Y.jsx("div",{className:`mx-auto w-16 h-16 rounded-full flex items-center justify-center ${s?"bg-success/20 text-success":"bg-accent/20 text-accent"}`,children:s?Y.jsx(B6e,{}):Y.jsx(F6e,{})}),Y.jsxs("div",{className:"space-y-2",children:[Y.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),Y.jsx("p",{className:"text-muted-foreground",children:r})]}),Y.jsx("div",{className:"pt-4 border-t border-border space-y-2",children:a.phase==="counting"?Y.jsxs(Y.Fragment,{children:[Y.jsxs("p",{className:"text-sm text-muted-foreground",children:["This tab will close in ",Y.jsx("span",{className:"text-foreground font-medium",children:a.remaining})," second",a.remaining!==1?"s":"","..."]}),Y.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change this in Settings."})]}):a.phase==="closeFailed"?Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not close this tab automatically. Please close it manually."}),Y.jsxs("p",{className:"text-xs text-muted-foreground/60",children:["Auto-close works when the tab is opened by ",n,"."]})]}):Y.jsxs(Y.Fragment,{children:[Y.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can close this tab and return to ",Y.jsx("span",{className:"text-foreground font-medium",children:n}),"."]}),a.phase==="prompt"?Y.jsxs(Y.Fragment,{children:[Y.jsxs("label",{className:"flex items-center justify-center gap-2 cursor-pointer group",children:[Y.jsx("input",{type:"checkbox",checked:!1,onChange:i,className:"accent-primary"}),Y.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:"Auto-close this tab after 3 seconds"})]}),Y.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change the delay in Settings."})]}):Y.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Your response has been sent."})]})})]})})}const U6e="https://api.github.com/repos/backnotprop/plannotator/releases/latest",_W={"0.5.0":{title:"Code Review is here!",description:"Review git diffs with inline annotations. Run /plannotator-review to try it."}};function z6e(t,e){const r=i=>i.replace(/^v/,""),n=r(t).split(".").map(Number),a=r(e).split(".").map(Number);for(let i=0;i<Math.max(n.length,a.length);i++){const s=n[i]||0,o=a[i]||0;if(o>s)return!0;if(o<s)return!1}return!1}function G6e(){const[t,e]=Ie.useState(null);return Ie.useEffect(()=>{(async()=>{try{const n="0.9.1",i=new URLSearchParams(window.location.search).get("preview-update");if(i){const f=i.replace(/^v/,"");e({currentVersion:n,latestVersion:i,updateAvailable:!0,releaseUrl:`https://github.com/backnotprop/plannotator/releases/tag/v${f}`,featureHighlight:_W[f]});return}const s=await fetch(U6e);if(!s.ok)return;const o=await s.json(),l=o.tag_name,u=z6e(n,l),d=l.replace(/^v/,""),h=_W[d];e({currentVersion:n,latestVersion:l,updateAvailable:u,releaseUrl:o.html_url,featureHighlight:h})}catch(n){console.debug("Update check failed:",n)}})()},[]),t}const Y6e="curl -fsSL https://plannotator.ai/install.sh | bash",V6e=({origin:t})=>{const e=G6e(),[r,n]=Ie.useState(!1),[a,i]=Ie.useState(!1),u=(new URLSearchParams(window.location.search).get("preview-origin")||t)==="opencode";if(!e?.updateAvailable||a)return null;const d=async()=>{try{await navigator.clipboard.writeText(Y6e),n(!0),setTimeout(()=>n(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return e.featureHighlight?Y.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-md animate-in slide-in-from-bottom-2 fade-in duration-300",children:Y.jsxs("div",{className:"bg-card border border-primary/30 rounded-xl shadow-2xl overflow-hidden",children:[Y.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/5 px-5 py-4 border-b border-border/50",children:Y.jsxs("div",{className:"flex items-start justify-between gap-3",children:[Y.jsxs("div",{className:"flex items-center gap-3",children:[Y.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),Y.jsxs("div",{children:[Y.jsx("h4",{className:"text-base font-semibold text-foreground",children:e.featureHighlight.title}),Y.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["New in ",e.latestVersion]})]})]}),Y.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors p-1",children:Y.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),Y.jsxs("div",{className:"px-5 py-4",children:[Y.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:e.featureHighlight.description}),Y.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["You have ",e.currentVersion]}),u&&Y.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Run the install script, then restart OpenCode."}),Y.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[Y.jsx("button",{onClick:d,className:"flex-1 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),Y.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground border border-border rounded-lg hover:bg-muted transition-colors",children:"Release notes"})]})]})]})}):Y.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-2 fade-in duration-300",children:Y.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:Y.jsxs("div",{className:"flex items-start gap-3",children:[Y.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:Y.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}),Y.jsxs("div",{className:"flex-1 min-w-0",children:[Y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[Y.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),Y.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:Y.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Y.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.latestVersion," is available (you have ",e.currentVersion,")"]}),Y.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[Y.jsx("button",{onClick:d,className:"flex-1 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),Y.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted transition-colors",children:"Notes"})]})]})]})})})},wle="plannotator-editor-mode",q6e="selection";function H6e(){const t=Br.getItem(wle);return t==="selection"||t==="comment"||t==="redline"?t:q6e}function W6e(t){Br.setItem(wle,t)}function UW({storageKey:t,defaultWidth:e=288,minWidth:r=200,maxWidth:n=600,side:a="right"}){const[i,s]=Ie.useState(()=>{const y=Br.getItem(t);if(y){const b=Number(y);if(!Number.isNaN(b)&&b>=r&&b<=n)return b}return e}),[o,l]=Ie.useState(!1),u=Ie.useRef(0),d=Ie.useRef(0),h=Ie.useRef(i),f=Ie.useCallback(y=>{h.current=y,s(y)},[]),p=Ie.useCallback(y=>{y.preventDefault(),u.current=y.clientX,d.current=h.current,l(!0)},[]);Ie.useEffect(()=>{if(!o)return;const y=E=>{const x=a==="right"?u.current-E.clientX:E.clientX-u.current;f(Math.min(n,Math.max(r,d.current+x)))},b=()=>{l(!1),Br.setItem(t,String(h.current))};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",b)}},[o,r,n,t,a,f]);const m=Ie.useCallback(()=>{f(e),Br.setItem(t,String(e))},[e,t,f]);return{width:i,isDragging:o,handleProps:{isDragging:o,onMouseDown:p,onDoubleClick:m}}}const zW=({isDragging:t,onMouseDown:e,onDoubleClick:r,className:n})=>Y.jsx("div",{onMouseDown:e,onDoubleClick:r,className:`w-1 cursor-col-resize flex-shrink-0 transition-colors ${t?"bg-primary/50":"hover:bg-border"}${n?` ${n}`:""}`}),j6e=({isOpen:t,onComplete:e})=>{const[r,n]=Ie.useState("acceptEdits");if(!t)return null;const a=()=>{Ele(r),e(r)};return Bf.createPortal(Y.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:Y.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[Y.jsxs("div",{className:"p-5 border-b border-border",children:[Y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})})}),Y.jsx("h3",{className:"font-semibold text-base",children:"New: Permission Mode Preservation"})]}),Y.jsx("p",{className:"text-sm text-muted-foreground",children:"Claude Code 2.1.7+ supports preserving your permission mode after plan approval. Choose your preferred automation level."}),Y.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Requires Claude Code 2.1.7 or later. Run ",Y.jsx("code",{className:"bg-muted px-1 rounded",children:"claude update"})," to update."]})]}),Y.jsx("div",{className:"p-4 space-y-2",children:FD.map(i=>Y.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all border ${r===i.value?"border-primary bg-primary/10":"border-transparent bg-muted/50 hover:bg-muted"}`,children:[Y.jsx("input",{type:"radio",name:"permissionMode",value:i.value,checked:r===i.value,onChange:()=>n(i.value),className:"mt-0.5 accent-primary"}),Y.jsxs("div",{className:"flex-1",children:[Y.jsx("div",{className:"text-sm font-medium",children:i.label}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:i.description})]})]},i.value))}),Y.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[Y.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),Y.jsx("button",{onClick:a,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Continue"})]})]})}),document.body)},K6e="https://plannotator.ai/assets/toc-sticky-preview.png",Q6e=({isOpen:t,onComplete:e})=>{const[r,n]=Ie.useState(!0),[a,i]=Ie.useState(!0),[s,o]=Ie.useState(!0);if(!t)return null;const l=()=>{const u={tocEnabled:r,stickyActionsEnabled:a};vle(u),T6e(),e(u)};return Bf.createPortal(Y.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:Y.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[Y.jsxs("div",{className:"p-5 border-b border-border",children:[Y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),Y.jsx("h3",{className:"font-semibold text-base",children:"New: Display Options"})]}),Y.jsx("p",{className:"text-sm text-muted-foreground",children:"We've added two features that help navigate larger plans."})]}),Y.jsxs("div",{className:"p-4 space-y-4",children:[s&&Y.jsx("img",{src:K6e,alt:"Table of Contents and Sticky Actions preview",className:"w-full rounded-lg border border-border",onError:()=>o(!1)}),Y.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[Y.jsx("input",{type:"checkbox",checked:r,onChange:()=>n(!r),className:"mt-0.5 accent-primary"}),Y.jsxs("div",{className:"flex-1",children:[Y.jsx("div",{className:"text-sm font-medium",children:"Auto-open Sidebar"}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:"Open sidebar with Table of Contents on load"})]})]}),Y.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[Y.jsx("input",{type:"checkbox",checked:a,onChange:()=>i(!a),className:"mt-0.5 accent-primary"}),Y.jsxs("div",{className:"flex-1",children:[Y.jsx("div",{className:"text-sm font-medium",children:"Sticky Actions"}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:"Keep action buttons visible while scrolling"})]})]})]}),Y.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[Y.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),Y.jsx("button",{onClick:l,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Save Settings"})]})]})}),document.body)},Ale="plannotator-plan-diff-marketing-seen";function P4(){return Br.getItem(Ale)!=="true"}function X6e(){Br.setItem(Ale,"true")}const Z6e="https://plannotator.ai/assets/plan-diff-preview.png",J6e="https://github.com/backnotprop/plannotator/issues",$6e={"claude-code":"https://youtu.be/uIWkFCg60Lk",opencode:"https://youtu.be/uIWkFCg60Lk",pi:"https://youtu.be/uIWkFCg60Lk"},e9e="https://youtu.be/uIWkFCg60Lk",t9e=({isOpen:t,origin:e,onComplete:r})=>{const[n,a]=Ie.useState(!1),i=e&&$6e[e]||e9e;if(!t)return null;const s=()=>{X6e(),r()};return Bf.createPortal(Y.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:Y.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-2xl shadow-2xl max-h-full flex flex-col",children:[Y.jsxs("div",{className:"p-5 border-b border-border",children:[Y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})})}),Y.jsx("h3",{className:"font-semibold text-base",children:"New: Plan Diff Mode"})]}),Y.jsx("p",{className:"text-sm text-muted-foreground",children:"See exactly what changed when a coding agent revises your plan."})]}),Y.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto min-h-0",children:[n?Y.jsx("div",{className:"w-full aspect-[16/7] rounded-lg border border-border bg-muted/50 flex items-center justify-center",children:Y.jsxs("div",{className:"text-center text-muted-foreground",children:[Y.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.41a2.25 2.25 0 013.182 0l2.909 2.91m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),Y.jsx("p",{className:"text-xs",children:"Plan Diff screenshot"})]})}):Y.jsx("img",{src:Z6e,alt:"Plan Diff Mode preview showing visual and raw diff views",className:"w-full rounded-lg border border-border",onError:()=>a(!0)}),Y.jsxs("div",{className:"space-y-3 text-sm text-foreground/90",children:[Y.jsxs("div",{className:"flex gap-2.5",children:[Y.jsx("div",{className:"shrink-0 mt-0.5",children:Y.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success mt-1.5"})}),Y.jsxs("p",{children:[Y.jsx("span",{className:"font-medium",children:"Two view modes"})," ",Y.jsx("span",{className:"text-muted-foreground",children:"— a rendered visual diff with color-coded borders for quick scanning, and a raw markdown diff for precision."})]})]}),Y.jsxs("div",{className:"flex gap-2.5",children:[Y.jsx("div",{className:"shrink-0 mt-0.5",children:Y.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5"})}),Y.jsxs("p",{children:[Y.jsx("span",{className:"font-medium",children:"Version history"})," ",Y.jsx("span",{className:"text-muted-foreground",children:"— compare against any previous version from the sidebar. Plans are automatically versioned as your agent iterates."})]})]})]}),Y.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50 hover:bg-muted border border-transparent hover:border-border transition-all group",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10 group-hover:bg-primary/20 transition-colors",children:Y.jsx("svg",{className:"w-4 h-4 text-primary",fill:"currentColor",viewBox:"0 0 24 24",children:Y.jsx("path",{d:"M8 5v14l11-7z"})})}),Y.jsx("span",{className:"text-sm font-medium text-foreground/90",children:"Watch Video Demo of Plan Diff"}),Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})]}),Y.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This is the first release of Plan Diff — rough edges are expected, especially around plan name matching across sessions. If something feels off or you have ideas, open an"," ",Y.jsx("a",{href:J6e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"issue"}),". Let's make this better together."]})]}),Y.jsx("div",{className:"p-4 border-t border-border flex justify-end",children:Y.jsx("button",{onClick:s,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Got it"})})]})}),document.body)};function r9e(t){const[e,r]=Ie.useState(t),[n,a]=Ie.useState("toc"),i=Ie.useCallback(l=>{r(!0),l&&a(l)},[]),s=Ie.useCallback(()=>{r(!1)},[]),o=Ie.useCallback(l=>{e?n===l?r(!1):a(l):(r(!0),a(l))},[e,n]);return{isOpen:e,activeTab:n,open:i,close:s,toggleTab:o}}class n9e{diff(e,r,n={}){let a;typeof n=="function"?(a=n,n={}):"callback"in n&&(a=n.callback);const i=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(i,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,a)}diffWithOptionsObj(e,r,n,a){var i;const s=x=>{if(x=this.postProcess(x,n),a){setTimeout(function(){a(x)},0);return}else return x},o=r.length,l=e.length;let u=1,d=o+l;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));const h=(i=n.timeout)!==null&&i!==void 0?i:1/0,f=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],r,e,0,n);if(p[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(p[0].lastComponent,r,e));let y=-1/0,b=1/0;const E=()=>{for(let x=Math.max(y,-u);x<=Math.min(b,u);x+=2){let T;const R=p[x-1],A=p[x+1];R&&(p[x-1]=void 0);let M=!1;if(A){const w=A.oldPos-x;M=A&&0<=w&&w<o}const I=R&&R.oldPos+1<l;if(!M&&!I){p[x]=void 0;continue}if(!I||M&&R.oldPos<A.oldPos?T=this.addToPath(A,!0,!1,0,n):T=this.addToPath(R,!1,!0,1,n),m=this.extractCommon(T,r,e,x,n),T.oldPos+1>=l&&m+1>=o)return s(this.buildValues(T.lastComponent,r,e))||!0;p[x]=T,T.oldPos+1>=l&&(b=Math.min(b,x-1)),m+1>=o&&(y=Math.max(y,x+1))}u++};if(a)(function x(){setTimeout(function(){if(u>d||Date.now()>f)return a(void 0);E()||x()},0)})();else for(;u<=d&&Date.now()<=f;){const x=E();if(x)return x}}addToPath(e,r,n,a,i){const s=e.lastComponent;return s&&!i.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+a,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+a,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,a,i){const s=r.length,o=n.length;let l=e.oldPos,u=l-a,d=0;for(;u+1<s&&l+1<o&&this.equals(n[l+1],r[u+1],i);)u++,l++,d++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const a=[];let i;for(;e;)a.push(e),i=e.previousComponent,delete e.previousComponent,e=i;a.reverse();const s=a.length;let o=0,l=0,u=0;for(;o<s;o++){const d=a[o];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=r.slice(l,l+d.count);h=h.map(function(f,p){const m=n[u+p];return m.length>f.length?m:f}),d.value=this.join(h)}else d.value=this.join(r.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}}return a}}class a9e extends n9e{constructor(){super(...arguments),this.tokenize=o9e}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
416
|
+
`).find(F=>F.startsWith("#")),k=z?z.replace(/^#+\s*/,"").trim():"Unknown Plan",B=PW(D.a);if(B.length===0)return{success:!0,count:0,planTitle:k,error:"No annotations found in share link"};const L=B.filter(F=>!e.some(U=>U.originalText===F.originalText&&U.type===F.type&&U.text===F.text));if(L.length>0&&(a([...e,...L]),E(L),D.g?.length)){const F=BW(D.g),U=new Set(r.map(W=>W.path)),q=F.filter(W=>!U.has(W.path));q.length>0&&i([...r,...q]),T(F)}return{success:!0,count:L.length,planTitle:k}}catch(N){return{success:!1,count:0,planTitle:"",error:N instanceof Error?N.message:"Failed to decompress share URL"}}},[e,r,a,i]);return{isSharedSession:l,isLoadingShared:d,shareUrl:f,shareUrlSize:m,pendingSharedAnnotations:b,sharedGlobalAttachments:x,clearPendingSharedAnnotations:R,refreshShareUrl:M,importFromShareUrl:I}}function L6e(t,e){const[r,n]=Ie.useState(null),a=Ie.useRef(null);return Ie.useEffect(()=>{const i=t.current;if(!i)return;const s=i.querySelectorAll('[data-block-type="heading"]');if(s.length===0)return;const o=new Map;return a.current=new IntersectionObserver(l=>{l.forEach(h=>{o.set(h.target,h.isIntersecting)});let u=null,d=1/0;for(const[h,f]of o)if(f){const p=h.getBoundingClientRect();p.top<d&&(d=p.top,u=h)}if(u){const h=u.getAttribute("data-block-id");h&&n(h)}},{root:i,rootMargin:"-80px 0px -80% 0px",threshold:[0,.1,.5,1]}),s.forEach(l=>{a.current?.observe(l)}),()=>{a.current?.disconnect()}},[t,e]),r}function FW(t){window.close(),setTimeout(()=>{window.closed||t()},300)}function P6e(t){const[e,r]=Ie.useState({phase:"idle"});Ie.useEffect(()=>{if(!t)return;const a=Qoe();a==="0"?(FW(()=>r({phase:"closeFailed"})),r({phase:"closed"})):r(a!=="off"?{phase:"counting",remaining:Number(a)}:{phase:"prompt"})},[t]),Ie.useEffect(()=>{if(e.phase!=="counting")return;if(e.remaining<=0){FW(()=>r({phase:"closeFailed"}));return}const a=setTimeout(()=>r(i=>i.phase==="counting"?{phase:"counting",remaining:i.remaining-1}:i),1e3);return()=>clearTimeout(a)},[e]);const n=Ie.useCallback(()=>{Xoe("3"),r({phase:"counting",remaining:3})},[]);return{state:e,enableAndStart:n}}const B6e=()=>Y.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),F6e=()=>Y.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})});function _6e({submitted:t,title:e,subtitle:r,agentLabel:n}){const{state:a,enableAndStart:i}=P6e(!!t);if(!t)return null;const s=t==="approved";return Y.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:Y.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[Y.jsx("div",{className:`mx-auto w-16 h-16 rounded-full flex items-center justify-center ${s?"bg-success/20 text-success":"bg-accent/20 text-accent"}`,children:s?Y.jsx(B6e,{}):Y.jsx(F6e,{})}),Y.jsxs("div",{className:"space-y-2",children:[Y.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),Y.jsx("p",{className:"text-muted-foreground",children:r})]}),Y.jsx("div",{className:"pt-4 border-t border-border space-y-2",children:a.phase==="counting"?Y.jsxs(Y.Fragment,{children:[Y.jsxs("p",{className:"text-sm text-muted-foreground",children:["This tab will close in ",Y.jsx("span",{className:"text-foreground font-medium",children:a.remaining})," second",a.remaining!==1?"s":"","..."]}),Y.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change this in Settings."})]}):a.phase==="closeFailed"?Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not close this tab automatically. Please close it manually."}),Y.jsxs("p",{className:"text-xs text-muted-foreground/60",children:["Auto-close works when the tab is opened by ",n,"."]})]}):Y.jsxs(Y.Fragment,{children:[Y.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can close this tab and return to ",Y.jsx("span",{className:"text-foreground font-medium",children:n}),"."]}),a.phase==="prompt"?Y.jsxs(Y.Fragment,{children:[Y.jsxs("label",{className:"flex items-center justify-center gap-2 cursor-pointer group",children:[Y.jsx("input",{type:"checkbox",checked:!1,onChange:i,className:"accent-primary"}),Y.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:"Auto-close this tab after 3 seconds"})]}),Y.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change the delay in Settings."})]}):Y.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Your response has been sent."})]})})]})})}const U6e="https://api.github.com/repos/backnotprop/plannotator/releases/latest",_W={"0.5.0":{title:"Code Review is here!",description:"Review git diffs with inline annotations. Run /plannotator-review to try it."}};function z6e(t,e){const r=i=>i.replace(/^v/,""),n=r(t).split(".").map(Number),a=r(e).split(".").map(Number);for(let i=0;i<Math.max(n.length,a.length);i++){const s=n[i]||0,o=a[i]||0;if(o>s)return!0;if(o<s)return!1}return!1}function G6e(){const[t,e]=Ie.useState(null);return Ie.useEffect(()=>{(async()=>{try{const n="0.9.2",i=new URLSearchParams(window.location.search).get("preview-update");if(i){const f=i.replace(/^v/,"");e({currentVersion:n,latestVersion:i,updateAvailable:!0,releaseUrl:`https://github.com/backnotprop/plannotator/releases/tag/v${f}`,featureHighlight:_W[f]});return}const s=await fetch(U6e);if(!s.ok)return;const o=await s.json(),l=o.tag_name,u=z6e(n,l),d=l.replace(/^v/,""),h=_W[d];e({currentVersion:n,latestVersion:l,updateAvailable:u,releaseUrl:o.html_url,featureHighlight:h})}catch(n){console.debug("Update check failed:",n)}})()},[]),t}const Y6e="curl -fsSL https://plannotator.ai/install.sh | bash",V6e=({origin:t})=>{const e=G6e(),[r,n]=Ie.useState(!1),[a,i]=Ie.useState(!1),u=(new URLSearchParams(window.location.search).get("preview-origin")||t)==="opencode";if(!e?.updateAvailable||a)return null;const d=async()=>{try{await navigator.clipboard.writeText(Y6e),n(!0),setTimeout(()=>n(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return e.featureHighlight?Y.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-md animate-in slide-in-from-bottom-2 fade-in duration-300",children:Y.jsxs("div",{className:"bg-card border border-primary/30 rounded-xl shadow-2xl overflow-hidden",children:[Y.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/5 px-5 py-4 border-b border-border/50",children:Y.jsxs("div",{className:"flex items-start justify-between gap-3",children:[Y.jsxs("div",{className:"flex items-center gap-3",children:[Y.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),Y.jsxs("div",{children:[Y.jsx("h4",{className:"text-base font-semibold text-foreground",children:e.featureHighlight.title}),Y.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["New in ",e.latestVersion]})]})]}),Y.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors p-1",children:Y.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),Y.jsxs("div",{className:"px-5 py-4",children:[Y.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:e.featureHighlight.description}),Y.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["You have ",e.currentVersion]}),u&&Y.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Run the install script, then restart OpenCode."}),Y.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[Y.jsx("button",{onClick:d,className:"flex-1 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),Y.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground border border-border rounded-lg hover:bg-muted transition-colors",children:"Release notes"})]})]})]})}):Y.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-2 fade-in duration-300",children:Y.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:Y.jsxs("div",{className:"flex items-start gap-3",children:[Y.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:Y.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}),Y.jsxs("div",{className:"flex-1 min-w-0",children:[Y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[Y.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),Y.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:Y.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Y.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.latestVersion," is available (you have ",e.currentVersion,")"]}),Y.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[Y.jsx("button",{onClick:d,className:"flex-1 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),Y.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted transition-colors",children:"Notes"})]})]})]})})})},wle="plannotator-editor-mode",q6e="selection";function H6e(){const t=Br.getItem(wle);return t==="selection"||t==="comment"||t==="redline"?t:q6e}function W6e(t){Br.setItem(wle,t)}function UW({storageKey:t,defaultWidth:e=288,minWidth:r=200,maxWidth:n=600,side:a="right"}){const[i,s]=Ie.useState(()=>{const y=Br.getItem(t);if(y){const b=Number(y);if(!Number.isNaN(b)&&b>=r&&b<=n)return b}return e}),[o,l]=Ie.useState(!1),u=Ie.useRef(0),d=Ie.useRef(0),h=Ie.useRef(i),f=Ie.useCallback(y=>{h.current=y,s(y)},[]),p=Ie.useCallback(y=>{y.preventDefault(),u.current=y.clientX,d.current=h.current,l(!0)},[]);Ie.useEffect(()=>{if(!o)return;const y=E=>{const x=a==="right"?u.current-E.clientX:E.clientX-u.current;f(Math.min(n,Math.max(r,d.current+x)))},b=()=>{l(!1),Br.setItem(t,String(h.current))};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",b)}},[o,r,n,t,a,f]);const m=Ie.useCallback(()=>{f(e),Br.setItem(t,String(e))},[e,t,f]);return{width:i,isDragging:o,handleProps:{isDragging:o,onMouseDown:p,onDoubleClick:m}}}const zW=({isDragging:t,onMouseDown:e,onDoubleClick:r,className:n})=>Y.jsx("div",{onMouseDown:e,onDoubleClick:r,className:`w-1 cursor-col-resize flex-shrink-0 transition-colors ${t?"bg-primary/50":"hover:bg-border"}${n?` ${n}`:""}`}),j6e=({isOpen:t,onComplete:e})=>{const[r,n]=Ie.useState("acceptEdits");if(!t)return null;const a=()=>{Ele(r),e(r)};return Bf.createPortal(Y.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:Y.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[Y.jsxs("div",{className:"p-5 border-b border-border",children:[Y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})})}),Y.jsx("h3",{className:"font-semibold text-base",children:"New: Permission Mode Preservation"})]}),Y.jsx("p",{className:"text-sm text-muted-foreground",children:"Claude Code 2.1.7+ supports preserving your permission mode after plan approval. Choose your preferred automation level."}),Y.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Requires Claude Code 2.1.7 or later. Run ",Y.jsx("code",{className:"bg-muted px-1 rounded",children:"claude update"})," to update."]})]}),Y.jsx("div",{className:"p-4 space-y-2",children:FD.map(i=>Y.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all border ${r===i.value?"border-primary bg-primary/10":"border-transparent bg-muted/50 hover:bg-muted"}`,children:[Y.jsx("input",{type:"radio",name:"permissionMode",value:i.value,checked:r===i.value,onChange:()=>n(i.value),className:"mt-0.5 accent-primary"}),Y.jsxs("div",{className:"flex-1",children:[Y.jsx("div",{className:"text-sm font-medium",children:i.label}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:i.description})]})]},i.value))}),Y.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[Y.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),Y.jsx("button",{onClick:a,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Continue"})]})]})}),document.body)},K6e="https://plannotator.ai/assets/toc-sticky-preview.png",Q6e=({isOpen:t,onComplete:e})=>{const[r,n]=Ie.useState(!0),[a,i]=Ie.useState(!0),[s,o]=Ie.useState(!0);if(!t)return null;const l=()=>{const u={tocEnabled:r,stickyActionsEnabled:a};vle(u),T6e(),e(u)};return Bf.createPortal(Y.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:Y.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[Y.jsxs("div",{className:"p-5 border-b border-border",children:[Y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),Y.jsx("h3",{className:"font-semibold text-base",children:"New: Display Options"})]}),Y.jsx("p",{className:"text-sm text-muted-foreground",children:"We've added two features that help navigate larger plans."})]}),Y.jsxs("div",{className:"p-4 space-y-4",children:[s&&Y.jsx("img",{src:K6e,alt:"Table of Contents and Sticky Actions preview",className:"w-full rounded-lg border border-border",onError:()=>o(!1)}),Y.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[Y.jsx("input",{type:"checkbox",checked:r,onChange:()=>n(!r),className:"mt-0.5 accent-primary"}),Y.jsxs("div",{className:"flex-1",children:[Y.jsx("div",{className:"text-sm font-medium",children:"Auto-open Sidebar"}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:"Open sidebar with Table of Contents on load"})]})]}),Y.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[Y.jsx("input",{type:"checkbox",checked:a,onChange:()=>i(!a),className:"mt-0.5 accent-primary"}),Y.jsxs("div",{className:"flex-1",children:[Y.jsx("div",{className:"text-sm font-medium",children:"Sticky Actions"}),Y.jsx("div",{className:"text-xs text-muted-foreground",children:"Keep action buttons visible while scrolling"})]})]})]}),Y.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[Y.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),Y.jsx("button",{onClick:l,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Save Settings"})]})]})}),document.body)},Ale="plannotator-plan-diff-marketing-seen";function P4(){return Br.getItem(Ale)!=="true"}function X6e(){Br.setItem(Ale,"true")}const Z6e="https://plannotator.ai/assets/plan-diff-preview.png",J6e="https://github.com/backnotprop/plannotator/issues",$6e={"claude-code":"https://youtu.be/uIWkFCg60Lk",opencode:"https://youtu.be/uIWkFCg60Lk",pi:"https://youtu.be/uIWkFCg60Lk"},e9e="https://youtu.be/uIWkFCg60Lk",t9e=({isOpen:t,origin:e,onComplete:r})=>{const[n,a]=Ie.useState(!1),i=e&&$6e[e]||e9e;if(!t)return null;const s=()=>{X6e(),r()};return Bf.createPortal(Y.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:Y.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-2xl shadow-2xl max-h-full flex flex-col",children:[Y.jsxs("div",{className:"p-5 border-b border-border",children:[Y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:Y.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})})}),Y.jsx("h3",{className:"font-semibold text-base",children:"New: Plan Diff Mode"})]}),Y.jsx("p",{className:"text-sm text-muted-foreground",children:"See exactly what changed when a coding agent revises your plan."})]}),Y.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto min-h-0",children:[n?Y.jsx("div",{className:"w-full aspect-[16/7] rounded-lg border border-border bg-muted/50 flex items-center justify-center",children:Y.jsxs("div",{className:"text-center text-muted-foreground",children:[Y.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.41a2.25 2.25 0 013.182 0l2.909 2.91m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),Y.jsx("p",{className:"text-xs",children:"Plan Diff screenshot"})]})}):Y.jsx("img",{src:Z6e,alt:"Plan Diff Mode preview showing visual and raw diff views",className:"w-full rounded-lg border border-border",onError:()=>a(!0)}),Y.jsxs("div",{className:"space-y-3 text-sm text-foreground/90",children:[Y.jsxs("div",{className:"flex gap-2.5",children:[Y.jsx("div",{className:"shrink-0 mt-0.5",children:Y.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success mt-1.5"})}),Y.jsxs("p",{children:[Y.jsx("span",{className:"font-medium",children:"Two view modes"})," ",Y.jsx("span",{className:"text-muted-foreground",children:"— a rendered visual diff with color-coded borders for quick scanning, and a raw markdown diff for precision."})]})]}),Y.jsxs("div",{className:"flex gap-2.5",children:[Y.jsx("div",{className:"shrink-0 mt-0.5",children:Y.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5"})}),Y.jsxs("p",{children:[Y.jsx("span",{className:"font-medium",children:"Version history"})," ",Y.jsx("span",{className:"text-muted-foreground",children:"— compare against any previous version from the sidebar. Plans are automatically versioned as your agent iterates."})]})]})]}),Y.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50 hover:bg-muted border border-transparent hover:border-border transition-all group",children:[Y.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10 group-hover:bg-primary/20 transition-colors",children:Y.jsx("svg",{className:"w-4 h-4 text-primary",fill:"currentColor",viewBox:"0 0 24 24",children:Y.jsx("path",{d:"M8 5v14l11-7z"})})}),Y.jsx("span",{className:"text-sm font-medium text-foreground/90",children:"Watch Video Demo of Plan Diff"}),Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})]}),Y.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This is the first release of Plan Diff — rough edges are expected, especially around plan name matching across sessions. If something feels off or you have ideas, open an"," ",Y.jsx("a",{href:J6e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"issue"}),". Let's make this better together."]})]}),Y.jsx("div",{className:"p-4 border-t border-border flex justify-end",children:Y.jsx("button",{onClick:s,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Got it"})})]})}),document.body)};function r9e(t){const[e,r]=Ie.useState(t),[n,a]=Ie.useState("toc"),i=Ie.useCallback(l=>{r(!0),l&&a(l)},[]),s=Ie.useCallback(()=>{r(!1)},[]),o=Ie.useCallback(l=>{e?n===l?r(!1):a(l):(r(!0),a(l))},[e,n]);return{isOpen:e,activeTab:n,open:i,close:s,toggleTab:o}}class n9e{diff(e,r,n={}){let a;typeof n=="function"?(a=n,n={}):"callback"in n&&(a=n.callback);const i=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(i,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,a)}diffWithOptionsObj(e,r,n,a){var i;const s=x=>{if(x=this.postProcess(x,n),a){setTimeout(function(){a(x)},0);return}else return x},o=r.length,l=e.length;let u=1,d=o+l;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));const h=(i=n.timeout)!==null&&i!==void 0?i:1/0,f=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],r,e,0,n);if(p[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(p[0].lastComponent,r,e));let y=-1/0,b=1/0;const E=()=>{for(let x=Math.max(y,-u);x<=Math.min(b,u);x+=2){let T;const R=p[x-1],A=p[x+1];R&&(p[x-1]=void 0);let M=!1;if(A){const w=A.oldPos-x;M=A&&0<=w&&w<o}const I=R&&R.oldPos+1<l;if(!M&&!I){p[x]=void 0;continue}if(!I||M&&R.oldPos<A.oldPos?T=this.addToPath(A,!0,!1,0,n):T=this.addToPath(R,!1,!0,1,n),m=this.extractCommon(T,r,e,x,n),T.oldPos+1>=l&&m+1>=o)return s(this.buildValues(T.lastComponent,r,e))||!0;p[x]=T,T.oldPos+1>=l&&(b=Math.min(b,x-1)),m+1>=o&&(y=Math.max(y,x+1))}u++};if(a)(function x(){setTimeout(function(){if(u>d||Date.now()>f)return a(void 0);E()||x()},0)})();else for(;u<=d&&Date.now()<=f;){const x=E();if(x)return x}}addToPath(e,r,n,a,i){const s=e.lastComponent;return s&&!i.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+a,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+a,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,a,i){const s=r.length,o=n.length;let l=e.oldPos,u=l-a,d=0;for(;u+1<s&&l+1<o&&this.equals(n[l+1],r[u+1],i);)u++,l++,d++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const a=[];let i;for(;e;)a.push(e),i=e.previousComponent,delete e.previousComponent,e=i;a.reverse();const s=a.length;let o=0,l=0,u=0;for(;o<s;o++){const d=a[o];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=r.slice(l,l+d.count);h=h.map(function(f,p){const m=n[u+p];return m.length>f.length?m:f}),d.value=this.join(h)}else d.value=this.join(r.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}}return a}}class a9e extends n9e{constructor(){super(...arguments),this.tokenize=o9e}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
417
417
|
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
|
418
418
|
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
419
419
|
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
|
@@ -718,7 +718,7 @@ export const CursorOverlay: React.FC<CursorOverlayProps> = ({
|
|
|
718
718
|
---
|
|
719
719
|
|
|
720
720
|
**Target:** Ship MVP in next sprint
|
|
721
|
-
`,A9e=()=>{const[t,e]=Ie.useState(w9e),[r,n]=Ie.useState([]),[a,i]=Ie.useState(null),[s,o]=Ie.useState([]),[l,u]=Ie.useState(null),[d,h]=Ie.useState(!1),[f,p]=Ie.useState(!1),[m,y]=Ie.useState(!1),[b,E]=Ie.useState(!1),[x,T]=Ie.useState(!1),[R,A]=Ie.useState(""),[M,I]=Ie.useState(!0),[w,N]=Ie.useState(H6e),[P,D]=Ie.useState(()=>Br.getItem("plannotator-tater-mode")==="true"),[_,z]=Ie.useState(()=>BD()),[k,B]=Ie.useState(!1),[L,F]=Ie.useState(null),[U,q]=Ie.useState([]),[W,G]=Ie.useState(!1),[j,X]=Ie.useState(!0),[re,Z]=Ie.useState(!1),[ce,se]=Ie.useState(null),[ve,ie]=Ie.useState(null),[J,te]=Ie.useState(!1),[ne,de]=Ie.useState(!1),[oe,ge]=Ie.useState(!1),[le,Oe]=Ie.useState("bypassPermissions"),[$,We]=Ie.useState(!0),[Se,Ze]=Ie.useState(void 0),[$e,at]=Ie.useState(null),[ke,Ve]=Ie.useState(!1),[Le,Ue]=Ie.useState(),[et,Re]=Ie.useState(null),[je,ue]=Ie.useState(!1),[xe,K]=Ie.useState("clean"),[me,pe]=Ie.useState(null),[Ce,we]=Ie.useState(null),Me=Ie.useRef(null),ze=Ie.useRef(null),Ne=UW({storageKey:"plannotator-panel-width"}),He=UW({storageKey:"plannotator-toc-width",defaultWidth:240,minWidth:160,maxWidth:400,side:"left"}),mt=Ne.isDragging||He.isDragging,dt=r9e(BD().tocEnabled);Ie.useEffect(()=>{_.tocEnabled?dt.open("toc"):dt.close()},[_.tocEnabled]);const ye=c9e(t,me,Ce),Fe=Ie.useMemo(()=>s.filter(wt=>wt.type==="heading").length,[s]),Pe=L6e(ze,Fe),{isSharedSession:Je,isLoadingShared:At,shareUrl:yt,shareUrlSize:Qe,pendingSharedAnnotations:ht,clearPendingSharedAnnotations:rt,importFromShareUrl:St}=D6e(t,r,U,e,n,q,()=>{X(!1)},Se),{getAgentWarning:Tt}=Tle(L);Ie.useEffect(()=>{if(ht&&ht.length>0){const wt=setTimeout(()=>{Me.current?.clearAllHighlights(),Me.current?.applySharedAnnotations(ht),rt()},100);return()=>clearTimeout(wt)}},[ht,rt]);const Mt=wt=>{D(wt),Br.setItem("plannotator-tater-mode",String(wt))},It=wt=>{N(wt),W6e(wt)};Ie.useEffect(()=>{At||Je||fetch("/api/plan").then(wt=>{if(!wt.ok)throw new Error("Not in API mode");return wt.json()}).then(wt=>{e(wt.plan),B(!0),wt.mode==="annotate"&&G(!0),wt.sharingEnabled!==void 0&&We(wt.sharingEnabled),wt.shareBaseUrl&&Ze(wt.shareBaseUrl),wt.repoInfo&&at(wt.repoInfo),wt.previousPlan!==void 0&&pe(wt.previousPlan),wt.versionInfo&&we(wt.versionInfo),wt.origin&&(F(wt.origin),wt.origin==="claude-code"&&R6e()?te(!0):DW()?de(!0):P4()&&ge(!0),Oe(ble().mode))}).catch(()=>{B(!1)}).finally(()=>X(!1))},[At,Je]),Ie.useEffect(()=>{const{frontmatter:wt}=_ee(t);u(wt),o(Uee(t))},[t]),Ie.useEffect(()=>{const wt=tr=>{const or=tr.clipboardData?.items;if(or){for(const ft of or)if(ft.type.startsWith("image/")){tr.preventDefault();const it=ft.getAsFile();if(it){const Et=RM(it.name,U.map(pt=>pt.name)),vt=URL.createObjectURL(it);ie({file:it,blobUrl:vt,initialName:Et})}break}}};return document.addEventListener("paste",wt),()=>document.removeEventListener("paste",wt)},[U]);const zt=async(wt,tr,or)=>{if(ve)try{const ft=new FormData,it=tr?new File([wt],"annotated.png",{type:"image/png"}):ve.file;ft.append("file",it);const Et=await fetch("/api/upload",{method:"POST",body:ft});if(Et.ok){const vt=await Et.json();q(pt=>[...pt,{path:vt.path,name:or}])}}catch{}finally{URL.revokeObjectURL(ve.blobUrl),ie(null)}},mr=()=>{ve&&(URL.revokeObjectURL(ve.blobUrl),ie(null))},Gt=async()=>{Z(!0);try{const wt=Iy(),tr=jg(),or=aP(),ft=PD(),it={};L==="claude-code"&&(it.permissionMode=le);const Et=S6e(or);Et&&(it.agentSwitch=Et),it.planSave={enabled:ft.enabled,...ft.customPath&&{customPath:ft.customPath}};const vt=F2(wt);wt.enabled&&vt&&(it.obsidian={vaultPath:vt,folder:wt.folder||"plannotator",plan:t}),tr.enabled&&(it.bear={plan:t}),(r.length>0||U.length>0)&&(it.feedback=Bt),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(it)}),se("approved")}catch{Z(!1)}},dr=async()=>{Z(!0);try{const wt=PD();await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:Bt,planSave:{enabled:wt.enabled,...wt.customPath&&{customPath:wt.customPath}}})}),se("denied")}catch{Z(!1)}},Fr=async()=>{Z(!0);try{await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:Bt,annotations:r})}),se("denied")}catch{Z(!1)}};Ie.useEffect(()=>{const wt=tr=>{if(tr.key!=="Enter"||!(tr.metaKey||tr.ctrlKey))return;const or=tr.target?.tagName;if(!(or==="INPUT"||or==="TEXTAREA")&&!(d||f||m||b||x||J||ne||oe||ve)&&!(ce||re)&&k){if(tr.preventDefault(),W){r.length===0?y(!0):Fr();return}if(r.length===0){if(L==="opencode"){const ft=Tt();if(ft){A(ft),T(!0);return}}Gt()}else dr()}};return window.addEventListener("keydown",wt),()=>window.removeEventListener("keydown",wt)},[d,f,m,b,x,J,ne,oe,ve,ce,re,k,r.length,W,L,Tt]);const Mr=wt=>{n(tr=>[...tr,wt]),i(wt.id),I(!0)},fr=wt=>{Me.current?.removeHighlight(wt),n(tr=>tr.filter(or=>or.id!==wt)),a===wt&&i(null)},_r=(wt,tr)=>{n(or=>or.map(ft=>ft.id===wt?{...ft,...tr}:ft))},Sn=(wt,tr)=>{n(or=>or.map(ft=>ft.author===wt?{...ft,author:tr}:ft))},Lt=wt=>{q(tr=>[...tr,wt])},_e=wt=>{q(tr=>tr.filter(or=>or.path!==wt))},xt=wt=>{},Bt=Ie.useMemo(()=>vye(s,r,U),[s,r,U]),wr=()=>{Ve(!1);const wt=new Blob([Bt],{type:"text/plain"}),tr=URL.createObjectURL(wt),or=document.createElement("a");or.href=tr,or.download="annotations.md",or.click(),URL.revokeObjectURL(tr),Re({type:"success",message:"Downloaded annotations"}),setTimeout(()=>Re(null),3e3)},Vr=async wt=>{Ve(!1);const tr={};if(wt==="obsidian"){const or=Iy(),ft=F2(or);ft&&(tr.obsidian={vaultPath:ft,folder:or.folder||"plannotator",plan:t})}wt==="bear"&&(tr.bear={plan:t});try{const it=(await(await fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(tr)})).json()).results?.[wt];it?.success?Re({type:"success",message:`Saved to ${wt==="obsidian"?"Obsidian":"Bear"}`}):Re({type:"error",message:it?.error||"Save failed"})}catch{Re({type:"error",message:"Save failed"})}setTimeout(()=>Re(null),3e3)};Ie.useEffect(()=>{const wt=tr=>{if(tr.key!=="s"||!(tr.metaKey||tr.ctrlKey))return;const or=tr.target?.tagName;if(or==="INPUT"||or==="TEXTAREA"||d||m||b||x||J||ne||oe||ve||ce||!k)return;tr.preventDefault();const ft=xle(),it=k4(),Et=jg().enabled;ft==="download"?wr():ft==="obsidian"&&it?Vr("obsidian"):ft==="bear"&&Et?Vr("bear"):(Ue("notes"),h(!0))};return window.addEventListener("keydown",wt),()=>window.removeEventListener("keydown",wt)},[d,m,b,x,J,ne,oe,ve,ce,k,t,Bt]),Ie.useEffect(()=>{if(!ke)return;const wt=tr=>{tr.target.closest("[data-export-dropdown]")||Ve(!1)};return document.addEventListener("mousedown",wt),()=>document.removeEventListener("mousedown",wt)},[ke]);const $t=Ie.useMemo(()=>L==="opencode"?"OpenCode":L==="claude-code"?"Claude Code":L==="pi"?"Pi":"Coding Agent",[L]);return Y.jsx(s6e,{defaultTheme:"dark",children:Y.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[P&&Y.jsx(v6e,{}),Y.jsxs("header",{className:"h-12 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl sticky top-0 z-20",children:[Y.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[Y.jsx("a",{href:"https://plannotator.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity",children:Y.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),Y.jsxs("a",{href:"https://github.com/backnotprop/plannotator/releases",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground font-mono opacity-60 hidden md:inline hover:opacity-100 transition-opacity",children:["v","0.9.1"]}),L&&Y.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline ${L==="claude-code"?"bg-orange-500/15 text-orange-400":L==="pi"?"bg-violet-500/15 text-violet-400":"bg-zinc-500/20 text-zinc-400"}`,children:$t})]}),Y.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[k&&Y.jsxs(Y.Fragment,{children:[Y.jsxs("button",{onClick:()=>{r.length===0?y(!0):W?Fr():dr()},disabled:re,className:`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all ${re?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-accent/15 text-accent hover:bg-accent/25 border border-accent/30"}`,title:"Send Feedback",children:[Y.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),Y.jsx("span",{className:"hidden md:inline",children:re?"Sending...":W?"Send Annotations":"Send Feedback"})]}),!W&&Y.jsxs("div",{className:"relative group/approve",children:[Y.jsxs("button",{onClick:()=>{if(L==="claude-code"&&r.length>0){E(!0);return}if(L==="opencode"){const wt=Tt();if(wt){A(wt),T(!0);return}}Gt()},disabled:re,className:`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all ${re?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":L==="claude-code"&&r.length>0?"bg-success/50 text-success-foreground/70 hover:bg-success hover:text-success-foreground":"bg-success text-success-foreground hover:opacity-90"}`,children:[Y.jsx("span",{className:"md:hidden",children:re?"...":"OK"}),Y.jsx("span",{className:"hidden md:inline",children:re?"Approving...":"Approve"})]}),L==="claude-code"&&r.length>0&&Y.jsxs("div",{className:"absolute top-full right-0 mt-2 px-3 py-2 bg-popover border border-border rounded-lg shadow-xl text-xs text-foreground w-56 text-center opacity-0 invisible group-hover/approve:opacity-100 group-hover/approve:visible transition-all pointer-events-none z-50",children:[Y.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),Y.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),$t," doesn't support feedback on approval. Your annotations won't be seen."]})]}),Y.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),Y.jsx(l6e,{}),Y.jsx(A6e,{taterMode:P,onTaterModeChange:Mt,onIdentityChange:Sn,origin:L,onUIPreferencesChange:z}),Y.jsx("button",{onClick:()=>I(!M),className:`p-1.5 rounded-md text-xs font-medium transition-all ${M?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:Y.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),Y.jsxs("div",{className:"relative flex","data-export-dropdown":!0,children:[Y.jsxs("button",{onClick:()=>{Ue(void 0),h(!0)},className:"p-1.5 md:px-2.5 md:py-1 rounded-l-md text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",title:"Export",children:[Y.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),Y.jsx("span",{className:"hidden md:inline",children:"Export"})]}),Y.jsx("button",{onClick:()=>Ve(wt=>!wt),className:"px-1 md:px-1.5 rounded-r-md text-xs bg-muted hover:bg-muted/80 border-l border-border/50 transition-colors flex items-center",title:"Quick save options",children:Y.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),ke&&Y.jsxs("div",{className:"absolute top-full right-0 mt-1 w-48 bg-popover border border-border rounded-lg shadow-xl z-50 py-1",children:[$&&Y.jsxs("button",{onClick:async()=>{Ve(!1);try{await navigator.clipboard.writeText(yt),Re({type:"success",message:"Share link copied"})}catch{Re({type:"error",message:"Failed to copy"})}setTimeout(()=>Re(null),3e3)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),"Copy Share Link"]}),Y.jsxs("button",{onClick:wr,className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download Annotations"]}),k&&k4()&&Y.jsxs("button",{onClick:()=>Vr("obsidian"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Obsidian"]}),k&&jg().enabled&&Y.jsxs("button",{onClick:()=>Vr("bear"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Bear"]}),k&&!k4()&&!jg().enabled&&Y.jsx("div",{className:"px-3 py-2 text-[10px] text-muted-foreground",children:"No notes apps configured."}),$&&Y.jsxs(Y.Fragment,{children:[Y.jsx("div",{className:"my-1 border-t border-border"}),Y.jsxs("button",{onClick:()=>{Ve(!1),p(!0)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m4-4l-4 4m0 0l-4-4m4 4V4"})}),"Import Review"]})]})]})]})]})]}),Y.jsxs("div",{className:`flex-1 flex overflow-hidden ${mt?"select-none":""}`,children:[!dt.isOpen&&Y.jsx(u9e,{activeTab:dt.activeTab,onToggleTab:dt.toggleTab,hasDiff:ye.hasPreviousVersion,className:"hidden lg:flex"}),dt.isOpen&&Y.jsxs(Y.Fragment,{children:[Y.jsx(m9e,{activeTab:dt.activeTab,onTabChange:dt.toggleTab,onClose:dt.close,width:He.width,blocks:s,annotations:r,activeSection:Pe,onTocNavigate:xt,versionInfo:Ce,versions:ye.versions,projectPlans:ye.projectPlans,selectedBaseVersion:ye.diffBaseVersion,onSelectBaseVersion:ye.selectBaseVersion,isPlanDiffActive:je,hasPreviousVersion:ye.hasPreviousVersion,onActivatePlanDiff:()=>ue(!0),isLoadingVersions:ye.isLoadingVersions,isSelectingVersion:ye.isSelectingVersion,fetchingVersion:ye.fetchingVersion,onFetchVersions:ye.fetchVersions,onFetchProjectPlans:ye.fetchProjectPlans}),Y.jsx(zW,{...He.handleProps,className:"hidden lg:block"})]}),Y.jsx("main",{ref:ze,className:"flex-1 min-w-0 overflow-y-auto bg-grid",children:Y.jsxs("div",{className:"min-h-full flex flex-col items-center px-4 py-3 md:px-10 md:py-8 xl:px-16",children:[!je&&Y.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex justify-start",children:Y.jsx(h6e,{mode:w,onChange:It,taterMode:P})}),je&&ye.diffBlocks&&ye.diffStats?Y.jsx(R9e,{diffBlocks:ye.diffBlocks,diffStats:ye.diffStats,diffMode:xe,onDiffModeChange:K,onPlanDiffToggle:()=>ue(!1),repoInfo:$e,baseVersionLabel:ye.diffBaseVersion!=null?`v${ye.diffBaseVersion}`:void 0}):Y.jsx(QLe,{ref:Me,blocks:s,markdown:t,frontmatter:l,annotations:r,onAddAnnotation:Mr,onSelectAnnotation:i,selectedAnnotationId:a,mode:w,taterMode:P,globalAttachments:U,onAddGlobalAttachment:Lt,onRemoveGlobalAttachment:_e,repoInfo:$e,stickyActions:_.stickyActionsEnabled,planDiffStats:ye.diffStats,isPlanDiffActive:je,onPlanDiffToggle:()=>ue(!je),hasPreviousVersion:ye.hasPreviousVersion})]})}),M&&Y.jsx(zW,{...Ne.handleProps}),Y.jsx(JLe,{isOpen:M,blocks:s,annotations:r,selectedId:a,onSelect:i,onDelete:fr,onEdit:_r,shareUrl:yt,sharingEnabled:$,width:Ne.width})]}),Y.jsx(a6e,{isOpen:d,onClose:()=>{h(!1),Ue(void 0)},shareUrl:yt,shareUrlSize:Qe,annotationsOutput:Bt,annotationCount:r.length,taterSprite:P?Y.jsx(nP,{}):void 0,sharingEnabled:$,markdown:t,isApiMode:k,initialTab:Le}),Y.jsx(i6e,{isOpen:f,onClose:()=>p(!1),onImport:St,shareBaseUrl:Se}),Y.jsx(M4,{isOpen:m,onClose:()=>y(!1),title:"Add Annotations First",message:`To provide feedback, select text in the plan and add annotations. ${$t} will use your annotations to revise the plan.`,variant:"info"}),Y.jsx(M4,{isOpen:b,onClose:()=>E(!1),onConfirm:()=>{E(!1),Gt()},title:"Annotations Won't Be Sent",message:Y.jsxs(Y.Fragment,{children:[$t," doesn't yet support feedback on approval. Your ",r.length," annotation",r.length!==1?"s":""," will be lost."]}),subMessage:Y.jsxs(Y.Fragment,{children:["To send feedback, use ",Y.jsx("strong",{children:"Send Feedback"})," instead.",Y.jsx("br",{}),Y.jsx("br",{}),"Want this feature? Upvote these issues:",Y.jsx("br",{}),Y.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/16001",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#16001"})," · ",Y.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/15755",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#15755"})]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),Y.jsx(M4,{isOpen:x,onClose:()=>T(!1),onConfirm:()=>{T(!1),Gt()},title:"Agent Not Found",message:R,subMessage:Y.jsxs(Y.Fragment,{children:["You can change the agent in ",Y.jsx("strong",{children:"Settings"}),", or approve anyway and OpenCode will use the default agent."]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),et&&Y.jsx("div",{className:`fixed top-16 right-4 z-50 px-3 py-2 rounded-lg text-xs font-medium shadow-lg transition-opacity ${et.type==="success"?"bg-success/15 text-success border border-success/30":"bg-destructive/15 text-destructive border border-destructive/30"}`,children:et.message}),Y.jsx(_6e,{submitted:ce,title:ce==="approved"?"Plan Approved":W?"Annotations Sent":"Feedback Sent",subtitle:ce==="approved"?`${$t} will proceed with the implementation.`:W?`${$t} will address your annotations on the file.`:`${$t} will revise the plan based on your annotations.`,agentLabel:$t}),Y.jsx(V6e,{origin:L}),Y.jsx(Vee,{isOpen:!!ve,imageSrc:ve?.blobUrl??"",initialName:ve?.initialName,onAccept:zt,onClose:mr}),Y.jsx(j6e,{isOpen:J,onComplete:wt=>{Oe(wt),te(!1),DW()?de(!0):P4()&&ge(!0)}}),Y.jsx(Q6e,{isOpen:ne,onComplete:wt=>{z(wt),de(!1),P4()&&ge(!0)}}),Y.jsx(t9e,{isOpen:oe,origin:L,onComplete:()=>{ge(!1)}})]})})},Ile=document.getElementById("root");if(!Ile)throw new Error("Could not find root element to mount to");const O9e=mye.createRoot(Ile);O9e.render(Y.jsx(Bee.StrictMode,{children:Y.jsx(A9e,{})}));class Ms{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Ms(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class oo{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new oo(r,Ms.range(this,e))}}class _t{constructor(e,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,a,i,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;a=s.start,i=s.end,a===o.length?n+=" at end of input: ":n+=" at position "+(a+1)+": ";var l=o.slice(a,i).replace(/[^]/g,"$&̲"),u;a>15?u="…"+o.slice(a-15,a):u=o.slice(0,a);var d;i+15<o.length?d=o.slice(i,i+15)+"…":d=o.slice(i),n+=u+l+d}var h=new Error(n);return h.name="ParseError",h.__proto__=_t.prototype,h.position=a,a!=null&&i!=null&&(h.length=i-a),h.rawMessage=e,h}}_t.prototype.__proto__=Error.prototype;var I9e=function(e,r){return e===void 0?r:e},N9e=/([A-Z])/g,k9e=function(e){return e.replace(N9e,"-$1").toLowerCase()},M9e={"&":"&",">":">","<":"<",'"':""","'":"'"},D9e=/[&><"']/g;function L9e(t){return String(t).replace(D9e,e=>M9e[e])}var Nle=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},P9e=function(e){var r=Nle(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},B9e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},F9e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},mn={deflt:I9e,escape:L9e,hyphenate:k9e,getBaseElem:Nle,isCharacterBox:P9e,protocolFromUrl:F9e},Z1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function _9e(t){if(t.default)return t.default;var e=t.type,r=Array.isArray(e)?e[0]:e;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class sP{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r in Z1)if(Z1.hasOwnProperty(r)){var n=Z1[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:_9e(n)}}reportNonstrict(e,r,n){var a=this.strict;if(typeof a=="function"&&(a=a(e,r,n)),!(!a||a==="ignore")){if(a===!0||a==="error")throw new _t("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+e+"]"),n);a==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]"))}}useStrictBehavior(e,r,n){var a=this.strict;if(typeof a=="function")try{a=a(e,r,n)}catch{a="error"}return!a||a==="ignore"?!1:a===!0||a==="error"?!0:a==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var r=mn.protocolFromUrl(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Ed{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return $l[U9e[this.id]]}sub(){return $l[z9e[this.id]]}fracNum(){return $l[G9e[this.id]]}fracDen(){return $l[Y9e[this.id]]}cramp(){return $l[V9e[this.id]]}text(){return $l[q9e[this.id]]}isTight(){return this.size>=2}}var oP=0,_2=1,sm=2,bu=3,ky=4,zo=5,Dm=6,hs=7,$l=[new Ed(oP,0,!1),new Ed(_2,0,!0),new Ed(sm,1,!1),new Ed(bu,1,!0),new Ed(ky,2,!1),new Ed(zo,2,!0),new Ed(Dm,3,!1),new Ed(hs,3,!0)],U9e=[ky,zo,ky,zo,Dm,hs,Dm,hs],z9e=[zo,zo,zo,zo,hs,hs,hs,hs],G9e=[sm,bu,ky,zo,Dm,hs,Dm,hs],Y9e=[bu,bu,zo,zo,hs,hs,hs,hs],V9e=[_2,_2,bu,bu,zo,zo,hs,hs],q9e=[oP,_2,sm,bu,sm,bu,sm,bu],Sr={DISPLAY:$l[oP],TEXT:$l[sm],SCRIPT:$l[ky],SCRIPTSCRIPT:$l[Dm]},_D=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function H9e(t){for(var e=0;e<_D.length;e++)for(var r=_D[e],n=0;n<r.blocks.length;n++){var a=r.blocks[n];if(t>=a[0]&&t<=a[1])return r.name}return null}var $x=[];_D.forEach(t=>t.blocks.forEach(e=>$x.push(...e)));function kle(t){for(var e=0;e<$x.length;e+=2)if(t>=$x[e]&&t<=$x[e+1])return!0;return!1}var Tg=80,W9e=function(e,r){return"M95,"+(622+e+r)+`
|
|
721
|
+
`,A9e=()=>{const[t,e]=Ie.useState(w9e),[r,n]=Ie.useState([]),[a,i]=Ie.useState(null),[s,o]=Ie.useState([]),[l,u]=Ie.useState(null),[d,h]=Ie.useState(!1),[f,p]=Ie.useState(!1),[m,y]=Ie.useState(!1),[b,E]=Ie.useState(!1),[x,T]=Ie.useState(!1),[R,A]=Ie.useState(""),[M,I]=Ie.useState(!0),[w,N]=Ie.useState(H6e),[P,D]=Ie.useState(()=>Br.getItem("plannotator-tater-mode")==="true"),[_,z]=Ie.useState(()=>BD()),[k,B]=Ie.useState(!1),[L,F]=Ie.useState(null),[U,q]=Ie.useState([]),[W,G]=Ie.useState(!1),[j,X]=Ie.useState(!0),[re,Z]=Ie.useState(!1),[ce,se]=Ie.useState(null),[ve,ie]=Ie.useState(null),[J,te]=Ie.useState(!1),[ne,de]=Ie.useState(!1),[oe,ge]=Ie.useState(!1),[le,Oe]=Ie.useState("bypassPermissions"),[$,We]=Ie.useState(!0),[Se,Ze]=Ie.useState(void 0),[$e,at]=Ie.useState(null),[ke,Ve]=Ie.useState(!1),[Le,Ue]=Ie.useState(),[et,Re]=Ie.useState(null),[je,ue]=Ie.useState(!1),[xe,K]=Ie.useState("clean"),[me,pe]=Ie.useState(null),[Ce,we]=Ie.useState(null),Me=Ie.useRef(null),ze=Ie.useRef(null),Ne=UW({storageKey:"plannotator-panel-width"}),He=UW({storageKey:"plannotator-toc-width",defaultWidth:240,minWidth:160,maxWidth:400,side:"left"}),mt=Ne.isDragging||He.isDragging,dt=r9e(BD().tocEnabled);Ie.useEffect(()=>{_.tocEnabled?dt.open("toc"):dt.close()},[_.tocEnabled]);const ye=c9e(t,me,Ce),Fe=Ie.useMemo(()=>s.filter(wt=>wt.type==="heading").length,[s]),Pe=L6e(ze,Fe),{isSharedSession:Je,isLoadingShared:At,shareUrl:yt,shareUrlSize:Qe,pendingSharedAnnotations:ht,clearPendingSharedAnnotations:rt,importFromShareUrl:St}=D6e(t,r,U,e,n,q,()=>{X(!1)},Se),{getAgentWarning:Tt}=Tle(L);Ie.useEffect(()=>{if(ht&&ht.length>0){const wt=setTimeout(()=>{Me.current?.clearAllHighlights(),Me.current?.applySharedAnnotations(ht),rt()},100);return()=>clearTimeout(wt)}},[ht,rt]);const Mt=wt=>{D(wt),Br.setItem("plannotator-tater-mode",String(wt))},It=wt=>{N(wt),W6e(wt)};Ie.useEffect(()=>{At||Je||fetch("/api/plan").then(wt=>{if(!wt.ok)throw new Error("Not in API mode");return wt.json()}).then(wt=>{e(wt.plan),B(!0),wt.mode==="annotate"&&G(!0),wt.sharingEnabled!==void 0&&We(wt.sharingEnabled),wt.shareBaseUrl&&Ze(wt.shareBaseUrl),wt.repoInfo&&at(wt.repoInfo),wt.previousPlan!==void 0&&pe(wt.previousPlan),wt.versionInfo&&we(wt.versionInfo),wt.origin&&(F(wt.origin),wt.origin==="claude-code"&&R6e()?te(!0):DW()?de(!0):P4()&&ge(!0),Oe(ble().mode))}).catch(()=>{B(!1)}).finally(()=>X(!1))},[At,Je]),Ie.useEffect(()=>{const{frontmatter:wt}=_ee(t);u(wt),o(Uee(t))},[t]),Ie.useEffect(()=>{const wt=tr=>{const or=tr.clipboardData?.items;if(or){for(const ft of or)if(ft.type.startsWith("image/")){tr.preventDefault();const it=ft.getAsFile();if(it){const Et=RM(it.name,U.map(pt=>pt.name)),vt=URL.createObjectURL(it);ie({file:it,blobUrl:vt,initialName:Et})}break}}};return document.addEventListener("paste",wt),()=>document.removeEventListener("paste",wt)},[U]);const zt=async(wt,tr,or)=>{if(ve)try{const ft=new FormData,it=tr?new File([wt],"annotated.png",{type:"image/png"}):ve.file;ft.append("file",it);const Et=await fetch("/api/upload",{method:"POST",body:ft});if(Et.ok){const vt=await Et.json();q(pt=>[...pt,{path:vt.path,name:or}])}}catch{}finally{URL.revokeObjectURL(ve.blobUrl),ie(null)}},mr=()=>{ve&&(URL.revokeObjectURL(ve.blobUrl),ie(null))},Gt=async()=>{Z(!0);try{const wt=Iy(),tr=jg(),or=aP(),ft=PD(),it={};L==="claude-code"&&(it.permissionMode=le);const Et=S6e(or);Et&&(it.agentSwitch=Et),it.planSave={enabled:ft.enabled,...ft.customPath&&{customPath:ft.customPath}};const vt=F2(wt);wt.enabled&&vt&&(it.obsidian={vaultPath:vt,folder:wt.folder||"plannotator",plan:t}),tr.enabled&&(it.bear={plan:t}),(r.length>0||U.length>0)&&(it.feedback=Bt),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(it)}),se("approved")}catch{Z(!1)}},dr=async()=>{Z(!0);try{const wt=PD();await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:Bt,planSave:{enabled:wt.enabled,...wt.customPath&&{customPath:wt.customPath}}})}),se("denied")}catch{Z(!1)}},Fr=async()=>{Z(!0);try{await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:Bt,annotations:r})}),se("denied")}catch{Z(!1)}};Ie.useEffect(()=>{const wt=tr=>{if(tr.key!=="Enter"||!(tr.metaKey||tr.ctrlKey))return;const or=tr.target?.tagName;if(!(or==="INPUT"||or==="TEXTAREA")&&!(d||f||m||b||x||J||ne||oe||ve)&&!(ce||re)&&k){if(tr.preventDefault(),W){r.length===0?y(!0):Fr();return}if(r.length===0){if(L==="opencode"){const ft=Tt();if(ft){A(ft),T(!0);return}}Gt()}else dr()}};return window.addEventListener("keydown",wt),()=>window.removeEventListener("keydown",wt)},[d,f,m,b,x,J,ne,oe,ve,ce,re,k,r.length,W,L,Tt]);const Mr=wt=>{n(tr=>[...tr,wt]),i(wt.id),I(!0)},fr=wt=>{Me.current?.removeHighlight(wt),n(tr=>tr.filter(or=>or.id!==wt)),a===wt&&i(null)},_r=(wt,tr)=>{n(or=>or.map(ft=>ft.id===wt?{...ft,...tr}:ft))},Sn=(wt,tr)=>{n(or=>or.map(ft=>ft.author===wt?{...ft,author:tr}:ft))},Lt=wt=>{q(tr=>[...tr,wt])},_e=wt=>{q(tr=>tr.filter(or=>or.path!==wt))},xt=wt=>{},Bt=Ie.useMemo(()=>vye(s,r,U),[s,r,U]),wr=()=>{Ve(!1);const wt=new Blob([Bt],{type:"text/plain"}),tr=URL.createObjectURL(wt),or=document.createElement("a");or.href=tr,or.download="annotations.md",or.click(),URL.revokeObjectURL(tr),Re({type:"success",message:"Downloaded annotations"}),setTimeout(()=>Re(null),3e3)},Vr=async wt=>{Ve(!1);const tr={};if(wt==="obsidian"){const or=Iy(),ft=F2(or);ft&&(tr.obsidian={vaultPath:ft,folder:or.folder||"plannotator",plan:t})}wt==="bear"&&(tr.bear={plan:t});try{const it=(await(await fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(tr)})).json()).results?.[wt];it?.success?Re({type:"success",message:`Saved to ${wt==="obsidian"?"Obsidian":"Bear"}`}):Re({type:"error",message:it?.error||"Save failed"})}catch{Re({type:"error",message:"Save failed"})}setTimeout(()=>Re(null),3e3)};Ie.useEffect(()=>{const wt=tr=>{if(tr.key!=="s"||!(tr.metaKey||tr.ctrlKey))return;const or=tr.target?.tagName;if(or==="INPUT"||or==="TEXTAREA"||d||m||b||x||J||ne||oe||ve||ce||!k)return;tr.preventDefault();const ft=xle(),it=k4(),Et=jg().enabled;ft==="download"?wr():ft==="obsidian"&&it?Vr("obsidian"):ft==="bear"&&Et?Vr("bear"):(Ue("notes"),h(!0))};return window.addEventListener("keydown",wt),()=>window.removeEventListener("keydown",wt)},[d,m,b,x,J,ne,oe,ve,ce,k,t,Bt]),Ie.useEffect(()=>{if(!ke)return;const wt=tr=>{tr.target.closest("[data-export-dropdown]")||Ve(!1)};return document.addEventListener("mousedown",wt),()=>document.removeEventListener("mousedown",wt)},[ke]);const $t=Ie.useMemo(()=>L==="opencode"?"OpenCode":L==="claude-code"?"Claude Code":L==="pi"?"Pi":"Coding Agent",[L]);return Y.jsx(s6e,{defaultTheme:"dark",children:Y.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[P&&Y.jsx(v6e,{}),Y.jsxs("header",{className:"h-12 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl sticky top-0 z-20",children:[Y.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[Y.jsx("a",{href:"https://plannotator.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity",children:Y.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),Y.jsxs("a",{href:"https://github.com/backnotprop/plannotator/releases",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground font-mono opacity-60 hidden md:inline hover:opacity-100 transition-opacity",children:["v","0.9.2"]}),L&&Y.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline ${L==="claude-code"?"bg-orange-500/15 text-orange-400":L==="pi"?"bg-violet-500/15 text-violet-400":"bg-zinc-500/20 text-zinc-400"}`,children:$t})]}),Y.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[k&&Y.jsxs(Y.Fragment,{children:[Y.jsxs("button",{onClick:()=>{r.length===0?y(!0):W?Fr():dr()},disabled:re,className:`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all ${re?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-accent/15 text-accent hover:bg-accent/25 border border-accent/30"}`,title:"Send Feedback",children:[Y.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),Y.jsx("span",{className:"hidden md:inline",children:re?"Sending...":W?"Send Annotations":"Send Feedback"})]}),!W&&Y.jsxs("div",{className:"relative group/approve",children:[Y.jsxs("button",{onClick:()=>{if(L==="claude-code"&&r.length>0){E(!0);return}if(L==="opencode"){const wt=Tt();if(wt){A(wt),T(!0);return}}Gt()},disabled:re,className:`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all ${re?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":L==="claude-code"&&r.length>0?"bg-success/50 text-success-foreground/70 hover:bg-success hover:text-success-foreground":"bg-success text-success-foreground hover:opacity-90"}`,children:[Y.jsx("span",{className:"md:hidden",children:re?"...":"OK"}),Y.jsx("span",{className:"hidden md:inline",children:re?"Approving...":"Approve"})]}),L==="claude-code"&&r.length>0&&Y.jsxs("div",{className:"absolute top-full right-0 mt-2 px-3 py-2 bg-popover border border-border rounded-lg shadow-xl text-xs text-foreground w-56 text-center opacity-0 invisible group-hover/approve:opacity-100 group-hover/approve:visible transition-all pointer-events-none z-50",children:[Y.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),Y.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),$t," doesn't support feedback on approval. Your annotations won't be seen."]})]}),Y.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),Y.jsx(l6e,{}),Y.jsx(A6e,{taterMode:P,onTaterModeChange:Mt,onIdentityChange:Sn,origin:L,onUIPreferencesChange:z}),Y.jsx("button",{onClick:()=>I(!M),className:`p-1.5 rounded-md text-xs font-medium transition-all ${M?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:Y.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),Y.jsxs("div",{className:"relative flex","data-export-dropdown":!0,children:[Y.jsxs("button",{onClick:()=>{Ue(void 0),h(!0)},className:"p-1.5 md:px-2.5 md:py-1 rounded-l-md text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",title:"Export",children:[Y.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),Y.jsx("span",{className:"hidden md:inline",children:"Export"})]}),Y.jsx("button",{onClick:()=>Ve(wt=>!wt),className:"px-1 md:px-1.5 rounded-r-md text-xs bg-muted hover:bg-muted/80 border-l border-border/50 transition-colors flex items-center",title:"Quick save options",children:Y.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),ke&&Y.jsxs("div",{className:"absolute top-full right-0 mt-1 w-48 bg-popover border border-border rounded-lg shadow-xl z-50 py-1",children:[$&&Y.jsxs("button",{onClick:async()=>{Ve(!1);try{await navigator.clipboard.writeText(yt),Re({type:"success",message:"Share link copied"})}catch{Re({type:"error",message:"Failed to copy"})}setTimeout(()=>Re(null),3e3)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),"Copy Share Link"]}),Y.jsxs("button",{onClick:wr,className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download Annotations"]}),k&&k4()&&Y.jsxs("button",{onClick:()=>Vr("obsidian"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Obsidian"]}),k&&jg().enabled&&Y.jsxs("button",{onClick:()=>Vr("bear"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Bear"]}),k&&!k4()&&!jg().enabled&&Y.jsx("div",{className:"px-3 py-2 text-[10px] text-muted-foreground",children:"No notes apps configured."}),$&&Y.jsxs(Y.Fragment,{children:[Y.jsx("div",{className:"my-1 border-t border-border"}),Y.jsxs("button",{onClick:()=>{Ve(!1),p(!0)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[Y.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m4-4l-4 4m0 0l-4-4m4 4V4"})}),"Import Review"]})]})]})]})]})]}),Y.jsxs("div",{className:`flex-1 flex overflow-hidden ${mt?"select-none":""}`,children:[!dt.isOpen&&Y.jsx(u9e,{activeTab:dt.activeTab,onToggleTab:dt.toggleTab,hasDiff:ye.hasPreviousVersion,className:"hidden lg:flex"}),dt.isOpen&&Y.jsxs(Y.Fragment,{children:[Y.jsx(m9e,{activeTab:dt.activeTab,onTabChange:dt.toggleTab,onClose:dt.close,width:He.width,blocks:s,annotations:r,activeSection:Pe,onTocNavigate:xt,versionInfo:Ce,versions:ye.versions,projectPlans:ye.projectPlans,selectedBaseVersion:ye.diffBaseVersion,onSelectBaseVersion:ye.selectBaseVersion,isPlanDiffActive:je,hasPreviousVersion:ye.hasPreviousVersion,onActivatePlanDiff:()=>ue(!0),isLoadingVersions:ye.isLoadingVersions,isSelectingVersion:ye.isSelectingVersion,fetchingVersion:ye.fetchingVersion,onFetchVersions:ye.fetchVersions,onFetchProjectPlans:ye.fetchProjectPlans}),Y.jsx(zW,{...He.handleProps,className:"hidden lg:block"})]}),Y.jsx("main",{ref:ze,className:"flex-1 min-w-0 overflow-y-auto bg-grid",children:Y.jsxs("div",{className:"min-h-full flex flex-col items-center px-4 py-3 md:px-10 md:py-8 xl:px-16",children:[!je&&Y.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex justify-start",children:Y.jsx(h6e,{mode:w,onChange:It,taterMode:P})}),je&&ye.diffBlocks&&ye.diffStats?Y.jsx(R9e,{diffBlocks:ye.diffBlocks,diffStats:ye.diffStats,diffMode:xe,onDiffModeChange:K,onPlanDiffToggle:()=>ue(!1),repoInfo:$e,baseVersionLabel:ye.diffBaseVersion!=null?`v${ye.diffBaseVersion}`:void 0}):Y.jsx(QLe,{ref:Me,blocks:s,markdown:t,frontmatter:l,annotations:r,onAddAnnotation:Mr,onSelectAnnotation:i,selectedAnnotationId:a,mode:w,taterMode:P,globalAttachments:U,onAddGlobalAttachment:Lt,onRemoveGlobalAttachment:_e,repoInfo:$e,stickyActions:_.stickyActionsEnabled,planDiffStats:ye.diffStats,isPlanDiffActive:je,onPlanDiffToggle:()=>ue(!je),hasPreviousVersion:ye.hasPreviousVersion})]})}),M&&Y.jsx(zW,{...Ne.handleProps}),Y.jsx(JLe,{isOpen:M,blocks:s,annotations:r,selectedId:a,onSelect:i,onDelete:fr,onEdit:_r,shareUrl:yt,sharingEnabled:$,width:Ne.width})]}),Y.jsx(a6e,{isOpen:d,onClose:()=>{h(!1),Ue(void 0)},shareUrl:yt,shareUrlSize:Qe,annotationsOutput:Bt,annotationCount:r.length,taterSprite:P?Y.jsx(nP,{}):void 0,sharingEnabled:$,markdown:t,isApiMode:k,initialTab:Le}),Y.jsx(i6e,{isOpen:f,onClose:()=>p(!1),onImport:St,shareBaseUrl:Se}),Y.jsx(M4,{isOpen:m,onClose:()=>y(!1),title:"Add Annotations First",message:`To provide feedback, select text in the plan and add annotations. ${$t} will use your annotations to revise the plan.`,variant:"info"}),Y.jsx(M4,{isOpen:b,onClose:()=>E(!1),onConfirm:()=>{E(!1),Gt()},title:"Annotations Won't Be Sent",message:Y.jsxs(Y.Fragment,{children:[$t," doesn't yet support feedback on approval. Your ",r.length," annotation",r.length!==1?"s":""," will be lost."]}),subMessage:Y.jsxs(Y.Fragment,{children:["To send feedback, use ",Y.jsx("strong",{children:"Send Feedback"})," instead.",Y.jsx("br",{}),Y.jsx("br",{}),"Want this feature? Upvote these issues:",Y.jsx("br",{}),Y.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/16001",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#16001"})," · ",Y.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/15755",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#15755"})]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),Y.jsx(M4,{isOpen:x,onClose:()=>T(!1),onConfirm:()=>{T(!1),Gt()},title:"Agent Not Found",message:R,subMessage:Y.jsxs(Y.Fragment,{children:["You can change the agent in ",Y.jsx("strong",{children:"Settings"}),", or approve anyway and OpenCode will use the default agent."]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),et&&Y.jsx("div",{className:`fixed top-16 right-4 z-50 px-3 py-2 rounded-lg text-xs font-medium shadow-lg transition-opacity ${et.type==="success"?"bg-success/15 text-success border border-success/30":"bg-destructive/15 text-destructive border border-destructive/30"}`,children:et.message}),Y.jsx(_6e,{submitted:ce,title:ce==="approved"?"Plan Approved":W?"Annotations Sent":"Feedback Sent",subtitle:ce==="approved"?`${$t} will proceed with the implementation.`:W?`${$t} will address your annotations on the file.`:`${$t} will revise the plan based on your annotations.`,agentLabel:$t}),Y.jsx(V6e,{origin:L}),Y.jsx(Vee,{isOpen:!!ve,imageSrc:ve?.blobUrl??"",initialName:ve?.initialName,onAccept:zt,onClose:mr}),Y.jsx(j6e,{isOpen:J,onComplete:wt=>{Oe(wt),te(!1),DW()?de(!0):P4()&&ge(!0)}}),Y.jsx(Q6e,{isOpen:ne,onComplete:wt=>{z(wt),de(!1),P4()&&ge(!0)}}),Y.jsx(t9e,{isOpen:oe,origin:L,onComplete:()=>{ge(!1)}})]})})},Ile=document.getElementById("root");if(!Ile)throw new Error("Could not find root element to mount to");const O9e=mye.createRoot(Ile);O9e.render(Y.jsx(Bee.StrictMode,{children:Y.jsx(A9e,{})}));class Ms{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Ms(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class oo{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new oo(r,Ms.range(this,e))}}class _t{constructor(e,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,a,i,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;a=s.start,i=s.end,a===o.length?n+=" at end of input: ":n+=" at position "+(a+1)+": ";var l=o.slice(a,i).replace(/[^]/g,"$&̲"),u;a>15?u="…"+o.slice(a-15,a):u=o.slice(0,a);var d;i+15<o.length?d=o.slice(i,i+15)+"…":d=o.slice(i),n+=u+l+d}var h=new Error(n);return h.name="ParseError",h.__proto__=_t.prototype,h.position=a,a!=null&&i!=null&&(h.length=i-a),h.rawMessage=e,h}}_t.prototype.__proto__=Error.prototype;var I9e=function(e,r){return e===void 0?r:e},N9e=/([A-Z])/g,k9e=function(e){return e.replace(N9e,"-$1").toLowerCase()},M9e={"&":"&",">":">","<":"<",'"':""","'":"'"},D9e=/[&><"']/g;function L9e(t){return String(t).replace(D9e,e=>M9e[e])}var Nle=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},P9e=function(e){var r=Nle(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},B9e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},F9e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},mn={deflt:I9e,escape:L9e,hyphenate:k9e,getBaseElem:Nle,isCharacterBox:P9e,protocolFromUrl:F9e},Z1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function _9e(t){if(t.default)return t.default;var e=t.type,r=Array.isArray(e)?e[0]:e;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class sP{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r in Z1)if(Z1.hasOwnProperty(r)){var n=Z1[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:_9e(n)}}reportNonstrict(e,r,n){var a=this.strict;if(typeof a=="function"&&(a=a(e,r,n)),!(!a||a==="ignore")){if(a===!0||a==="error")throw new _t("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+e+"]"),n);a==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]"))}}useStrictBehavior(e,r,n){var a=this.strict;if(typeof a=="function")try{a=a(e,r,n)}catch{a="error"}return!a||a==="ignore"?!1:a===!0||a==="error"?!0:a==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var r=mn.protocolFromUrl(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Ed{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return $l[U9e[this.id]]}sub(){return $l[z9e[this.id]]}fracNum(){return $l[G9e[this.id]]}fracDen(){return $l[Y9e[this.id]]}cramp(){return $l[V9e[this.id]]}text(){return $l[q9e[this.id]]}isTight(){return this.size>=2}}var oP=0,_2=1,sm=2,bu=3,ky=4,zo=5,Dm=6,hs=7,$l=[new Ed(oP,0,!1),new Ed(_2,0,!0),new Ed(sm,1,!1),new Ed(bu,1,!0),new Ed(ky,2,!1),new Ed(zo,2,!0),new Ed(Dm,3,!1),new Ed(hs,3,!0)],U9e=[ky,zo,ky,zo,Dm,hs,Dm,hs],z9e=[zo,zo,zo,zo,hs,hs,hs,hs],G9e=[sm,bu,ky,zo,Dm,hs,Dm,hs],Y9e=[bu,bu,zo,zo,hs,hs,hs,hs],V9e=[_2,_2,bu,bu,zo,zo,hs,hs],q9e=[oP,_2,sm,bu,sm,bu,sm,bu],Sr={DISPLAY:$l[oP],TEXT:$l[sm],SCRIPT:$l[ky],SCRIPTSCRIPT:$l[Dm]},_D=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function H9e(t){for(var e=0;e<_D.length;e++)for(var r=_D[e],n=0;n<r.blocks.length;n++){var a=r.blocks[n];if(t>=a[0]&&t<=a[1])return r.name}return null}var $x=[];_D.forEach(t=>t.blocks.forEach(e=>$x.push(...e)));function kle(t){for(var e=0;e<$x.length;e+=2)if(t>=$x[e]&&t<=$x[e+1])return!0;return!1}var Tg=80,W9e=function(e,r){return"M95,"+(622+e+r)+`
|
|
722
722
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
723
723
|
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
724
724
|
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|