@inkeep/open-knowledge 0.6.0-beta.0 → 0.6.0-beta.1
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/dist/assets/skills/open-knowledge/SKILL.md +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/constants-C0dm6XrR.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-pu_7zCAy.mjs → init-Dx6AdWPr.mjs} +3 -3
- package/dist/init-jAKvTa9U.mjs +1 -0
- package/dist/{loader-DwgxIIbN.mjs → loader-B_c4LV6V.mjs} +2 -2
- package/dist/loader-DpGoDP4I.mjs +1 -0
- package/dist/preview-CifNm6Oe.mjs +1 -0
- package/dist/{preview-Bep4xj-R.mjs → preview-DBHMZYsR.mjs} +2 -2
- package/dist/public/assets/{index-Izdfgq4i.js → index-zU1ANKhn.js} +2 -2
- package/dist/public/index.html +1 -1
- package/dist/{repair-launch-json-ByfyoscN.mjs → repair-launch-json-BGZghXjn.mjs} +2 -2
- package/dist/{repair-mcp-configs-D6LjdRhL.mjs → repair-mcp-configs-71a8eAG0.mjs} +2 -2
- package/dist/{src-DOCgFp9P.mjs → src-B_7W-2eF.mjs} +2 -2
- package/dist/{start-CojePtz9.mjs → start-BwpG-0n6.mjs} +2 -2
- package/dist/start-CMyq5RDd.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-JUZqR_Yu.mjs +0 -2
- package/dist/init-DD_r2nwd.mjs +0 -1
- package/dist/loader-CTWe5z9-.mjs +0 -1
- package/dist/preview-DtrIs0gZ.mjs +0 -1
- package/dist/start-PJUtb0rl.mjs +0 -1
|
@@ -20,7 +20,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
20
20
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
21
21
|
|
|
22
22
|
Please compile your catalog first.
|
|
23
|
-
`)),cf(s)&&yf.test(s)?bf(s):cf(s)?s:wf(s,this._locale,this._locales)(t,n?.formats)}t=this._.bind(this);date(e,t){return pf(this._locales||this._locale,e,t)}number(e,t){return hf(this._locales||this._locale,e,t)}};function Df(e={}){return new Ef(e)}var Of=Df(),kf=JSON.parse(`{"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"0-31GV":["Removing"],"0YEbfk":["Connect to AI tools"],"0t0bbC":["Could not save sync preference: ",["detail"]],"0xnmlQ":["Repository name"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1HBhDS":["Checking out files"],"1Ta7Fd":["Open ",["basename"]],"1WgmEM":["Failed to load template: ",["errorMessage"]],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"2q_Q7x":["Visibility"],"2tgFCe":["Starting clone"],"3h5zMp":["Something went wrong loading the settings panel."],"3wiBAs":["Where should it live?"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"4CfgPM":["Project folder created, but git init failed. Try again."],"4TzU0n":["Initialize"],"4jDd0j":["Anyone can see"],"5o4lc1":["Open Knowledge will be initialized at <0>",["gitRoot"],"</0> — the parent of your new folder, because it contains a <1>.git</1> folder (one project per git repo)."],"5qNxOe":[["count","plural",{"one":["#"," item could not be moved to the Trash. Do you want to permanently delete instead?"],"other":["#"," items could not be moved to the Trash. Do you want to permanently delete instead?"]}]],"5wV2qQ":["and more"],"5y_9lO":["Waiting for authorization"],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6YtxFj":["Name"],"6bTTAN":["Invalid input — pick a different folder."],"6gRgw8":["Retry"],"6nB8LV":["Paste a personal access token"],"77SdEP":["Delete ",["itemName"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7PzzBU":["User"],"7d1a0d":["Public"],"7qRHf0":["Install for Claude Chat & Cowork"],"8C2UQ5":["No git remote was detected for this project. Set one up if you would like automatic git syncing."],"8XQ7Ib":["Pick an owner"],"8XQRON":["Loading repositories"],"8XS8nG":["Open in your favorite AI editor."],"95uxb3":["Signed in as <0>@",["signedInLogin"],"</0>"],"96G6Re":["New folder"],"9UQ730":["Clone"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9oE4C3":["Browse your repos:"],"A5hiCy":["Create template"],"AMyJts":["This path is on an external volume (/Volumes/...). Open Knowledge will lose track of files when the drive ejects."],"AThCb_":["Open Knowledge manages the <0>open-knowledge</0> MCP server name, the <1>open-knowledge-ui</1> launch config, and <2>ok</2> / <3>open-knowledge</3> on PATH (including OK-owned symlinks). Using a custom wrapper? Register it under a different name."],"AVoO4B":["Open <0>",["verificationUri"],"</0> and enter this code:"],"AddR83":["Could not create project. Try again or pick a different location."],"B3NAZC":["Open Navigator"],"Bdha5y":["Publishing..."],"C0NPNd":["Add Open Knowledge to your AI tools"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"D8OV7J":["Only collaborators"],"DPfwMq":["Done"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"EgMJem":["Lands at <0>",["targetPath"],"</0>. Agents resolve it via leaf → root walk-up — closest-wins on filename collision."],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"FEr96N":["Theme"],"FF5rwn":["Connect Open Knowledge to other tools you use."],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"Fxf4jq":["Description (optional)"],"FyW0WO":["Authorize in browser"],"G1Gw0v":["New template"],"GJ3011":["Use ",["ext"]," extension"],"GUpclA":["Created if missing; reused if it exists."],"GgQgML":["You picked your home directory. Open Knowledge will index everything in your home tree — large and may surface personal files."],"GjElCU":["Select a file from the sidebar, or pick where to edit alongside your agent."],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"GvHKEy":["Filter repositories"],"HIb0vl":["Network error — please try again"],"HP5ML3":["Sign in to GitHub to continue."],"HRU-eL":["You picked ~/Documents. Open Knowledge will index every markdown file under it. If you only want to manage a sub-folder, choose a smaller scope."],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HpK_8d":["Reload"],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IKoTAC":["Keep disabled"],"IajAbS":["Add a starter pack"],"J-lpiN":["Repository URL or owner/repo"],"J2Mv98":["Name (e.g. ",["login"],")"],"JUamR6":["This name has no characters that are safe for a folder identifier. Try a name with at least one letter or number."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jqqevv":["System error"],"K1ckLX":["Failed to create folder"],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K9J00P":["Clone failed — connection error"],"KDw4GX":["Try again"],"KX1MZR":["Your repositories"],"KZkHZv":["Signed in as @",["login"]],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"L-rMC9":["Reset to default"],"L3CEC1":["this item"],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"LE7t79":["Clone to a new folder"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LlHqdU":["Initializing project"],"LtI9AS":["Owner"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"MKOVhz":["Enable git auto-sync"],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MtR6ZK":["Not signed in to GitHub."],"NOHyEE":["Retry push"],"NYUhy5":["Subfolder name"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"Nu4DdT":["Sync"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"ODD5Jc":["Edit ",["templateLabel"]],"ODGGlj":["Folder name: ",["detail"]],"OYnx7O":["Path cannot start with \\"/\\""],"OZtLT5":["Checking GitHub sign-in..."],"OmHTGj":["Disable git auto-sync"],"Oos8fo":["Copy command"],"Ox3-3h":["No matches."],"Oxyd5f":["Pick a name"],"P-ye9o":["Could not open folder picker"],"PHRoEJ":["Open shared document"],"PKLY-1":["Opening..."],"PiH3UR":["Copied!"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"QQghPu":["Install in Claude Desktop"],"RDrXh4":["Configure user, project, and integration settings."],"RGkNeJ":["Initialize a starter pack"],"RJ3a8Z":["Looking for <0>",["lookingForUrl"],"</0>."],"RN62Q8":["We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."],"RSqaSd":["Project root"],"SP385B":["No repositories found."],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"T-4cw2":["Pick a layout that matches what you're building. Each pack ships with folders, templates, and agent-readable descriptions. You can mix and match later."],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TKQ7K-":["Install"],"TP9_K5":["Token"],"TXrEYR":["No templates resolve here. Add one in this folder's Templates section, or in Settings → Templates."],"ThmUrC":["Could not finalize project setup. Try again."],"TmKshB":["Invalid token — check that it has repo scope"],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"UBv8UK":["Delete Permanently"],"UQAp48":["Search templates"],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"VdXv4D":["Clone from GitHub"],"W8uemY":["Pick a starter pack to scaffold folders, templates, and AI-readable rules."],"W8vpBM":["starter pack"],"WEzuMq":["Create a new Open Knowledge project in the folder of your choice."],"WL6puM":["Path resolves outside project"],"WZ-vBy":["Permanently deletes <0>",["targetGitPath"],"</0> and all its git history. Working files stay in place. If the parent git repo is intentional (e.g. you cloned it), cancel and pick a location outside it."],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"Wtw22s":["Installing"],"Wyxs0x":["Path cannot contain \\"..\\""],"X8kjQX":["Re-authenticate with GitHub"],"XU0OXn":["Enable auto-sync"],"XYlJJT":["Setting up"],"XyNe7f":["Electron bridge unavailable. Refresh and try again."],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YGIi_c":["Reinstall"],"YTLmTM":["Remove the parent <0>.git</0> folder"],"Y_kL7X":["Customize how the editor looks and behaves."],"YjhKI5":["Cloning..."],"YwPUUP":["This pack is already set up here."],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z8KDox":["Enter a folder name (e.g. brain)."],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"ZWgr0b":["In a subfolder"],"ZWolSV":["You picked the filesystem root (/). Scaffolding here will scan every file on this machine — make sure that's what you want."],"ZWyHmq":["This project"],"ZmGmNh":["Let's set up your project."],"_K2CvV":["Template"],"_N2eSU":["org"],"_qD6mn":["Pick the folder where you've cloned it."],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"aIgBKf":["Can't nest projects. An Open Knowledge project already exists at <0>",["rootPath"],"</0>. Choose a location outside it, or open that project instead."],"aOp3hw":["Couldn't move to Trash"],"aWlJai":["Starting sign-in flow"],"adsMWO":["Resolving deltas"],"av_PD9":["you"],"b4itZn":["Working"],"bBE5tC":["Detected on this machine"],"bD8I7O":["Complete"],"bHboUQ":["Edit template"],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c5rF4v":["What is this knowledge base for?"],"c8iK2Y":["No templates found."],"cBbVqQ":["The folder name <0>",["rawName"],"</0> can't be used as a project identifier — it has no characters left after sanitization. Click Browse to pick a folder whose name contains at least one alphanumeric character."],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cnGeoo":["Delete"],"cqQyPB":["Folder name"],"csDS2L":["Available"],"d2uTPx":["Server error (HTTP ",["status"],")"],"dEgA5A":["Cancel"],"dGaH3A":["Create a token at <0>github.com/settings/tokens</0> with <1>repo</1> scope."],"dTaauv":["Reason: ",["reason"]],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"eFJkVt":["Clone failed: ",["cloneError"]],"eSu2Xn":["Writes a project-MCP config for each selected tool; Claude also gets <0>.claude/launch.json</0>."],"ensWZc":["or start from scratch <0/>"],"f65AOQ":["Start from"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fX82Jn":["Open Knowledge will create a <0>.ok/</0> folder here to track this project's metadata."],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gYz2ep":["Expires in ",["timeLabel"]],"gcV0dI":["The folders and templates are in place; there's nothing left to scaffold."],"ghYcYZ":["File extension"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtmbUO":["Sign in to GitHub"],"hA8GQ6":["Will replace existing Open Knowledge entry"],"hJu2pH":["This folder already has files. Add a name to create a new subfolder inside it."],"hSySVc":["Install handoff failed: ",["msg"]],"hYDc6B":["Name cannot be empty"],"hYFQsG":["Validating"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"he3ygx":["Copy"],"hwFOFD":["Settings failed to load"],"hxEUVJ":["Initialize ",["selectedPackName"]],"hynz2K":["Download started"],"iH8pgl":["Back"],"iKSP5j":["Word wrap"],"iMCW9z":["Publish & copy link"],"iTylMl":["Templates"],"i_grbe":["Click Browse to pick or create a project folder."],"idD8Ev":["Saved"],"iqugog":["Initialize failed: ",["errorDetail"]],"jGJy-9":["Downloads ",["shareOwner"],"/",["shareRepo"]," from GitHub."],"jjtmV_":["First file name"],"jnXr0e":["Clone failed. Please try again."],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kolRU1":["Do you want to permanently delete instead?"],"l17ab4":["Could not write project files. Try a different location."],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lanW9H":["Sign in to clone"],"lhjq3G":["Reset ",["labelText"]," to default"],"ll2yNl":["Content directory"],"m16xKo":["Add"],"mGaZwZ":["See the full install guide"],"mKZODc":["Adds the Open Knowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"mSJ3Rn":["Computing scaffold plan"],"mYLRjR":["You picked ~/Desktop. Open Knowledge will index everything on your desktop."],"mf37rL":["Retrying"],"mmpzAq":["Wrap long lines in the markdown source editor."],"muWKMD":["No response — try again"],"nNYV3Y":["and ",["remaining"]," more"],"nYKerc":["(user-level only)"],"nbfdhU":["Integrations"],"p2LEhJ":["Personal access token"],"pAlxX6":["Open this folder with Open Knowledge"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pWT04I":["Checking..."],"pdHb22":["GitHub App"],"prHfed":["Each selected tool gets an Open Knowledge MCP entry."],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qbfj1f":["Receiving objects"],"qo4zCg":["Path cannot contain backslashes"],"r51jLC":["File saved & Claude Desktop App opened"],"rEnIww":["Published to ",["ownerLogin"],"/",["repoName"],"."],"rlUzXK":["Could not validate folder. Please try again."],"s-XOaI":["File name"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sJK6pq":["Permission denied"],"saYiIO":["Path cannot contain null bytes"],"snrVQ7":["probe failed"],"tCelbM":["A folder named <0>",["sanitized"],"</0> already has files at this location. Pick a different name."],"tXkhj_":["Start"],"tfDRzk":["Save"],"uF9ruK":["Saving"],"u_lS4C":["Clone complete — opening project"],"v-h2hx":["Delete ",["targetGitPath"]],"v41fCm":["File not found"],"vPYaz3":["Scaffold directly under this project."],"vQayZz":["Add a remote with <0>git remote add origin <url></0> in this project's directory. This page will update automatically once a remote is detected."],"ve8vEM":["Code expired — please try again"],"wJijgU":["Location"],"wbv9xO":["Create new project"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"y1t8bQ":["Settings sections"],"yQE2r9":["Loading"],"yu8Pzy":["Not detected"],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"z2G3EK":["<0>",["rawName"],"</0> has characters unsafe for the on-disk identifier, so the project will be created as <1>",["sanitized"],"</1>. Click Browse to pick a safer name."],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"zXZ0sB":["Open Knowledge initializes at <0>",["projectDir"],"</0> — the parent of <1>",["pickedRelative"],"</1> because it contains a <2>.git</2> folder (one .ok/ per git repo). <3>Content directory</3> defaults to <4>.</4> (the whole repo); type a sub-folder to narrow it."],"zXZJoN":["Add token"],"zwBp5t":["Private"]}`),Af=`en`;Of.load(Af,kf),Of.activate(Af);function jf(e){return`#/${encodeURIComponent(e)}`}function Mf(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(jf(e.doc))})}var Nf=4e3,Pf=1440*60*1e3;function Ff(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){X.success(`Opened existing Open Knowledge project at ${e.ancestorPath}`,{duration:Nf});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>lr[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`Open Knowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`;X[r?`error`:`success`](n,{duration:r?Pf:Nf});return}let t=ns(e.gitRoot,e.pickedPath)??e.pickedPath;X.success(`Initialized Open Knowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Nf})})}var If=!1;function Lf(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Nt(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Rf(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var zf=0,Bf=0,Vf=0,Hf=0,Uf=null,Wf=[`linkResolutionDecoration$`],Gf=new WeakSet,Kf=new WeakSet;function qf(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Jf(){return!1}function Yf(){return!Jf()}function Xf(e,t){if(Yf())return t;let n=`ok/cold/nodeview-factory-${qf(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Nt(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Zf(e){if(Yf())return;let t=e.state.plugins;for(let e of t){if(Kf.has(e))continue;let t=e.spec?.key?.key;if(!t||!Wf.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Kf.add(e);continue}let i=`ok/cold/decoration-${qf(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Nt(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Kf.add(e)}}function Qf(e){if(Yf())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=Xf(e,n);r.__okWrapped=!0,t[e]=r}}function $f(e){return Yf()?e:e.map(e=>{let t=e.name??`unknown`,n=qf(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function ep(){if(!If){If=!0,Lf(Ln.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return Yf()||(Uf=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Rf(i.editorState),durationMs:r}}),Lf(Ln.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!Yf()&&!Gf.has(e)&&t.view&&(Zf(t.view),Qf(t.view),Gf.add(e)),{docSize:Rf(t.editorState)}}),Lf(Ln.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Hf+=1;let i=e;return!Yf()&&i.view&&Qf(i.view),{docSize:Rf(i.view),seq:Hf,durationMs:r}}),Lf(Yn.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Bf+=1,{seq:Bf,docSize:Rf(e.state),durationMs:r})),Lf(Yn.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Vf+=1,{seq:Vf,docSize:Rf(e.state),durationMs:r})),Lf(Fe.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{zf+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:zf,topLevelYElements:a,durationMs:r}}),Lf(lt.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Nt(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!Yf()&&e===`first-paint`&&Uf!==null)){let e=Uf,n=Math.max(0,t.startTime-e);Nt(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),Uf=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var tp=`Relaunch`,np=`Release notes`,rp=`Updates paused`,ip=`Download`,ap=`Reset to defaults`,op=`Relaunch failed — please restart manually`,sp=`Recovery action failed — please try again`;function cp(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function lp(e){return`Version ${e} ready to install`}function up(e){return`Updated to Version ${e}`}function dp(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var fp=0,pp=0,mp=1,hp=2,gp=3;function _p(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded`;t({id:i,body:lp(r),priority:hp,action:{label:tp,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:cp(op,e),variant:`error`,priority:mp})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:up(n),priority:gp,action:{label:np,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:rp,priority:pp,action:{label:ip,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function vp(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:cp(sp,e),variant:`error`,priority:fp})};n({id:i,body:dp(t.currentBuild),priority:fp,action:{label:ap,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var yp=[],bp=new Set,xp=!1;function Sp(){for(let e of bp)e()}function Cp(e){let t=yp.findIndex(t=>t.id===e.id);if(t===-1)yp=[...yp,e];else{let n=yp.slice();n[t]=e,yp=n}Sp()}function wp(e){let t=yp.filter(t=>t.id!==e);t.length!==yp.length&&(yp=t,Sp())}function Tp(){return yp}function Ep(e){return bp.add(e),()=>{bp.delete(e)}}function Dp(){if(xp||typeof window>`u`)return;let e=window.okDesktop;e&&(xp=!0,_p(e,Cp,wp),e.state.query().then(t=>{t.schemaIncompatibility&&vp(e,t.schemaIncompatibility,Cp,wp)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Op=`ok-omnibar-recents-v1`,kp=10;function Ap(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function jp(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Mp(e,t){return`${e}:${t}`}function Np(e){let t=jp(e);if(!t)return[];try{let e=t.getItem(Op);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Ap).slice(0,kp):[]}catch{return[]}}function Pp(e,t){let n=jp(t);if(n)try{n.setItem(Op,JSON.stringify(e.slice(0,kp)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Fp(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,kp)}function Ip(e,t){return e.filter(e=>t.has(Mp(e.kind,e.path)))}var Lp=50,Rp=30,zp=``,Bp=null;function Vp(e){return e.trim().toLowerCase()}function Hp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Up(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Wp(e,t,n=new Map,r=new Map){let i=[];for(let t of e){let e=r.get(t)?.modified,a=n.get(t);i.push({kind:`file`,path:t,name:cr(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:cr(e)});return i.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),i}function Gp(e){return In({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function Kp(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:dr(e.map(Gp))}}function qp(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function Jp(e){let t=qp(e);return Bp&&zp===t?Bp:(zp=t,Bp=Kp(e),Bp)}function Yp(e,t,n=Lp){return Xp(Jp(e),t,n)}function Xp(e,t,n=Lp){let r=Vp(t);return r?Hr(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function Zp(e,t){let n=Up(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(Hp).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function Qp(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=cr(e.path);return{kind:e.kind===`page`?`file`:`folder`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function $p(e,t={}){let n=e.trim();if(!n)return[];let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,scopes:[`page`,`folder`,`content`],limit:t.limit??Rp}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Fn(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(Qp).filter(e=>!!e)}function em(e,t,n=[]){let r=Vp(t);return r?Vp([e,...n].join(` `)).includes(r):!0}var tm=`tag:`;function nm(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function rm(e,t){return Me(e,t)}var im=I;async function am(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var om=`open-knowledge:doc-panel-tab`,sm=null;function cm(){let e=sm;return sm=null,e}function lm(e,t=typeof window>`u`?new EventTarget:window){sm=e,t.dispatchEvent(new CustomEvent(om,{detail:{tab:e}}))}function um(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(om,n),()=>t.removeEventListener(om,n)}var dm=[`.md`,`.mdx`];function fm(e){let t=e.toLowerCase();for(let e of dm)if(t.endsWith(e))return e;return null}function pm(e){let t=fm(e);return t?e.slice(0,-t.length):e}var mm=`__blank__`,hm={local:0,inherited:1};function gm(e){return[...e].sort((e,t)=>{let n=hm[e.scope]-hm[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}function _m(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function vm(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function ym(e){let t=e.fileName.trim(),n=fm(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function bm(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&e.altKey&&e.key.toLowerCase()===`n`)}function xm(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Sm(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{_:d}=Kt(),{addPage:f}=Nr(),p=Qa(u?null:a),m=u??p,[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`.md`),[x,S]=(0,Q.useState)(mm),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{if(n){w(null),k(null),D(!1),v(``),S(i===`file`&&s?s:mm),I(!1);let e=i===`file`?o??`untitled`:`index`,t=fm(e);b(t??`.md`),g(t?pm(e):e)}},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==m.state.data||t[7]!==m.state.status?(V=m.state.status===`ready`?gm(m.state.data.folder.templates_available??[]):[],t[6]=m.state.data,t[7]=m.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==m.state.data||t[10]!==m.state.status||t[11]!==n||t[12]!==x?(U=()=>{n&&x!==mm&&m.state.status===`ready`&&((m.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(mm))},t[9]=m.state.data,t[10]=m.state.status,t[11]=n,t[12]=x,t[13]=U):U=t[13];let W;t[14]!==m.state||t[15]!==n||t[16]!==x?(W=[n,x,m.state],t[14]=m.state,t[15]=n,t[16]=x,t[17]=W):W=t[17],(0,Q.useEffect)(U,W);let G=i===`file`,ee=m.state.status===`loading`||m.state.status===`idle`,te=m.state.status===`error`?m.state.message:null,ne;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){let t=fm(e);t?(b(t),g(pm(e))):g(e),w(null)},t[18]=ne):ne=t[18];let re=ne,ie;t[19]!==y||t[20]!==h||t[21]!==_||t[22]!==a||t[23]!==i?(ie=function(){return ym({kind:i,initialDir:a,fileName:h,fileExtension:y,folderName:_})},t[19]=y,t[20]=h,t[21]=_,t[22]=a,t[23]=i,t[24]=ie):ie=t[24];let ae=ie,oe;t[25]!==d||t[26]!==h||t[27]!==_||t[28]!==i?(oe=function(){if(i===`folder`){let e=_m(_.trim());if(e)return{message:d({id:`ODGGlj`,values:{detail:d(vm(e))}}),field:`folder`}}let e=_m(h.trim());return e?{message:d(vm(e)),field:`file`}:null},t[25]=d,t[26]=h,t[27]=_,t[28]=i,t[29]=oe):oe=t[29];let se=oe,ce;t[30]!==E||t[31]!==h||t[32]!==_||t[33]!==i?(ce=E||!h.trim()||i===`folder`&&!_.trim(),t[30]=E,t[31]=h,t[32]=_,t[33]=i,t[34]=ce):ce=t[34];let le=ce,ue;t[35]!==d||t[36]!==f||t[37]!==ae||t[38]!==se||t[39]!==i||t[40]!==l||t[41]!==r||t[42]!==x?(ue=async function(){let e=se();if(e){w(e.message),k(e.field);return}D(!0),w(null),k(null);let t=ae(),n=i===`file`&&x!==mm?x:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await T(e,d({id:`d2uTPx`,values:{status:t}}));if(!n.ok){D(!1),w(n.title),k(`form`);return}let o=Ur.safeParse(n.body);if(D(!1),!o.success){w(d(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),k(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,f(s),Wr([`files`,`backlinks`,`graph`]),l?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),D(!1),w(d({id:`HIb0vl`})),k(`form`)}},t[35]=d,t[36]=f,t[37]=ae,t[38]=se,t[39]=i,t[40]=l,t[41]=r,t[42]=x,t[43]=ue):ue=t[43];let de=ue,K;t[44]!==d||t[45]!==a?(K=a||d({id:`L6Hhh6`}),t[44]=d,t[45]=a,t[46]=K):K=t[46];let fe=K,pe;t[47]===i?pe=t[48]:(pe=(0,Z.jsx)(Ao,{children:i===`file`?(0,Z.jsx)(J,{id:`HdkSiO`}):(0,Z.jsx)(J,{id:`96G6Re`})}),t[47]=i,t[48]=pe);let me;t[49]!==c||t[50]!==fe?(me=c??(0,Z.jsx)(J,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[49]=c,t[50]=fe,t[51]=me):me=t[51];let he;t[52]===me?he=t[53]:(he=(0,Z.jsx)(Oo,{children:me}),t[52]=me,t[53]=he);let ge;t[54]!==pe||t[55]!==he?(ge=(0,Z.jsxs)(Bo,{children:[pe,he]}),t[54]=pe,t[55]=he,t[56]=ge):ge=t[56];let _e;t[57]!==x||t[58]!==G||t[59]!==N||t[60]!==F||t[61]!==P||t[62]!==H||t[63]!==te||t[64]!==ee?(_e=G&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{id:N,className:`mb-1.5 block text-sm font-medium`,children:(0,Z.jsx)(J,{id:`f65AOQ`})}),te?(0,Z.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:(0,Z.jsx)(J,{id:`sE7R19`,values:{templatesError:te}})}):null,(0,Z.jsx)(wm,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:x,onValueChange:S,templates:H,loading:ee}),!ee&&!te&&H.length===0?(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`TXrEYR`})}):null]}),t[57]=x,t[58]=G,t[59]=N,t[60]=F,t[61]=P,t[62]=H,t[63]=te,t[64]=ee,t[65]=_e):_e=t[65];let ve;t[66]!==d||t[67]!==C||t[68]!==O||t[69]!==A||t[70]!==j||t[71]!==_||t[72]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(J,{id:`cqQyPB`})}),(0,Z.jsx)(Wo,{ref:R,id:j,value:_,onChange:e=>{v(e.target.value),w(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":C&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":C&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=_m(_.trim());if(t){w(d({id:`ODGGlj`,values:{detail:d(vm(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[66]=d,t[67]=C,t[68]=O,t[69]=A,t[70]=j,t[71]=_,t[72]=i,t[73]=ve):ve=t[73];let ye;t[74]===i?ye=t[75]:(ye=i===`folder`?(0,Z.jsx)(J,{id:`jjtmV_`}):(0,Z.jsx)(J,{id:`s-XOaI`}),t[74]=i,t[75]=ye);let be;t[76]!==M||t[77]!==ye?(be=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:M,children:ye}),t[76]=M,t[77]=ye,t[78]=be):be=t[78];let xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>re(e.target.value),t[79]=xe):xe=t[79];let Se=i===`file`,Ce=C&&(O===`file`||O===`form`)?A:void 0,we=C&&(O===`file`||O===`form`)?!0:void 0,Te;t[80]!==de||t[81]!==le?(Te=e=>{e.key===`Enter`&&!le&&de()},t[80]=de,t[81]=le,t[82]=Te):Te=t[82];let Ee;t[83]!==M||t[84]!==h||t[85]!==Se||t[86]!==Ce||t[87]!==we||t[88]!==Te?(Ee=(0,Z.jsx)(Wo,{ref:L,id:M,value:h,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:Cm,onKeyDown:Te,className:`flex-1`}),t[83]=M,t[84]=h,t[85]=Se,t[86]=Ce,t[87]=we,t[88]=Te,t[89]=Ee):Ee=t[89];let De;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(De=e=>{(e===`.md`||e===`.mdx`)&&b(e)},t[90]=De):De=t[90];let Oe;t[91]===d?Oe=t[92]:(Oe=d({id:`ghYcYZ`}),t[91]=d,t[92]=Oe);let ke;t[93]===d?ke=t[94]:(ke=dm.map(e=>(0,Z.jsx)(Xo,{value:e,"aria-label":d({id:`GJ3011`,values:{ext:e}}),children:e},e)),t[93]=d,t[94]=ke);let Ae;t[95]!==y||t[96]!==Oe||t[97]!==ke?(Ae=(0,Z.jsx)($o,{type:`single`,value:y,onValueChange:De,variant:`outline`,"aria-label":Oe,className:`shrink-0`,children:ke}),t[95]=y,t[96]=Oe,t[97]=ke,t[98]=Ae):Ae=t[98];let je;t[99]!==Ee||t[100]!==Ae?(je=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Ee,Ae]}),t[99]=Ee,t[100]=Ae,t[101]=je):je=t[101];let Me;t[102]!==C||t[103]!==A?(Me=C&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:C}),t[102]=C,t[103]=A,t[104]=Me):Me=t[104];let Ne;t[105]!==be||t[106]!==je||t[107]!==Me?(Ne=(0,Z.jsxs)(`div`,{children:[be,je,Me]}),t[105]=be,t[106]=je,t[107]=Me,t[108]=Ne):Ne=t[108];let Pe;t[109]!==_e||t[110]!==ve||t[111]!==Ne?(Pe=(0,Z.jsx)(Lo,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[_e,ve,Ne]})}),t[109]=_e,t[110]=ve,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]===r?Fe=t[114]:(Fe=()=>r(!1),t[113]=r,t[114]=Fe);let Ie;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(J,{id:`dEgA5A`}),t[115]=Ie):Ie=t[115];let q;t[116]!==E||t[117]!==Fe?(q=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:Fe,disabled:E,children:Ie}),t[116]=E,t[117]=Fe,t[118]=q):q=t[118];let Le;t[119]===E?Le=t[120]:(Le=E?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[119]=E,t[120]=Le);let Re;t[121]!==de||t[122]!==le||t[123]!==Le?(Re=(0,Z.jsx)(Y,{onClick:de,disabled:le,children:Le}),t[121]=de,t[122]=le,t[123]=Le,t[124]=Re):Re=t[124];let ze;t[125]!==q||t[126]!==Re?(ze=(0,Z.jsxs)(Ro,{children:[q,Re]}),t[125]=q,t[126]=Re,t[127]=ze):ze=t[127];let Be;t[128]!==ge||t[129]!==Pe||t[130]!==ze?(Be=(0,Z.jsxs)(Po,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,Pe,ze]}),t[128]=ge,t[129]=Pe,t[130]=ze,t[131]=Be):Be=t[131];let Ve;return t[132]!==r||t[133]!==n||t[134]!==Be?(Ve=(0,Z.jsx)(Vo,{open:n,onOpenChange:r,children:Be}),t[132]=r,t[133]=n,t[134]=Be,t[135]=Ve):Ve=t[135],Ve}function Cm(e){return xm(e.currentTarget)}function wm(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=Kt(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let m=f,h=o===mm,g=i?d:void 0,_=`${r} ${n}`,v;t[5]!==h||t[6]!==l||t[7]!==m?.name||t[8]!==m?.title||t[9]!==o?(v=l?(0,Z.jsx)(J,{id:`Hl89Qd`}):h?(0,Z.jsx)(J,{id:`E7BhZn`}):m?.title??m?.name??o,t[5]=h,t[6]=l,t[7]=m?.name,t[8]=m?.title,t[9]=o,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`span`,{className:`truncate`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==h||t[14]!==l||t[15]!==m?(b=!l&&!h&&m?(0,Z.jsx)(Om,{entry:m}):null,t[13]=h,t[14]=l,t[15]=m,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(nc,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=S):S=t[20];let C;t[21]!==l||t[22]!==i||t[23]!==g||t[24]!==_||t[25]!==x||t[26]!==n?(C=(0,Z.jsx)(Gt,{asChild:!0,children:(0,Z.jsxs)(Y,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":g,"aria-labelledby":_,disabled:l,className:`w-full justify-between font-normal`,children:[x,S]})}),t[21]=l,t[22]=i,t[23]=g,t[24]=_,t[25]=x,t[26]=n,t[27]=C):C=t[27];let w;t[28]===u?w=t[29]:(w=u({id:`UQAp48`}),t[28]=u,t[29]=w);let T;t[30]===w?T=t[31]:(T=(0,Z.jsx)(Ee,{placeholder:w}),t[30]=w,t[31]=T);let E;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`c8iK2Y`})}),t[32]=E):E=t[32];let O;t[33]!==a||t[34]!==s?(O=()=>{s(mm),a(!1)},t[33]=a,t[34]=s,t[35]=O):O=t[35];let k=o===mm?`opacity-100`:`opacity-0`,j;t[36]===k?j=t[37]:(j=Di(`mt-1 size-4 shrink-0`,k),t[36]=k,t[37]=j);let M;t[38]===j?M=t[39]:(M=(0,Z.jsx)(Eo,{className:j,"aria-hidden":`true`}),t[38]=j,t[39]=M);let N;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`E7BhZn`})}),t[40]=N):N=t[40];let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[N,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hZoBHK`})})]}),t[41]=P):P=t[41];let F;t[42]!==O||t[43]!==M?(F=(0,Z.jsxs)(D,{value:`Blank note empty`,onSelect:O,className:`items-start gap-3`,children:[M,P]}),t[42]=O,t[43]=M,t[44]=F):F=t[44];let I;if(t[45]!==a||t[46]!==s||t[47]!==c||t[48]!==o){let e;t[50]!==a||t[51]!==s||t[52]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(D,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Eo,{className:Di(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(Om,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[50]=a,t[51]=s,t[52]=o,t[53]=e):e=t[53],I=c.map(e),t[45]=a,t[46]=s,t[47]=c,t[48]=o,t[49]=I}else I=t[49];let L;t[54]!==d||t[55]!==F||t[56]!==I?(L=(0,Z.jsxs)(z,{id:d,className:`subtle-scrollbar`,children:[E,F,I]}),t[54]=d,t[55]=F,t[56]=I,t[57]=L):L=t[57];let R;t[58]!==T||t[59]!==L?(R=(0,Z.jsx)(K,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Dm,onWheel:Em,onTouchMove:Tm,children:(0,Z.jsxs)(p,{children:[T,L]})}),t[58]=T,t[59]=L,t[60]=R):R=t[60];let B;return t[61]!==a||t[62]!==i||t[63]!==R||t[64]!==C?(B=(0,Z.jsxs)(H,{open:i,onOpenChange:a,children:[C,R]}),t[61]=a,t[62]=i,t[63]=R,t[64]=C,t[65]=B):B=t[65],B}function Tm(e){e.stopPropagation()}function Em(e){e.stopPropagation()}function Dm(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function Om(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Di(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(J,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(Be,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function km(e){return e.split(`/`).pop()??e}function Am(e,t){let n=new Map;for(let e of t?.folders??[])n.set(e.path,e.summary);let r=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:n.get(km(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:km(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function jm(e){let t=(0,$.c)(20),{plan:n,selectedPack:r}=e,i,a,o,s,c,l;if(t[0]!==n||t[1]!==r){let e=[...Am(n,r)].sort(Pm),u=new Set(e.map(Nm));c=`space-y-2`,t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-primary`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center`,children:`◇`}),`What gets created`]}),t[8]=l):l=t[8],s=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,i=`Items to be created`,a=`py-1.5`,o=e.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let i=t.slice(0,e).join(`/`);u.has(i)&&(n++,r=e)}let i=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),a=e.kind===`folder`;return(0,Z.jsxs)(`li`,{className:`relative flex min-w-0 items-center gap-1.5 py-1 pr-3`,style:{paddingLeft:`${12+n*16}px`},children:[Array.from({length:n},Mm),a?(0,Z.jsx)(bc,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0 text-foreground/80`,children:i}),a&&e.description?(0,Z.jsxs)(jn,{children:[(0,Z.jsx)(En,{"aria-label":`Show description`,className:`flex shrink-0 cursor-help rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(er,{children:e.description})]}):null]},e.name)}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];let u;t[9]!==i||t[10]!==a||t[11]!==o?(u=(0,Z.jsx)(`ul`,{"aria-label":i,className:a,children:o}),t[9]=i,t[10]=a,t[11]=o,t[12]=u):u=t[12];let d;t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{className:s,children:u}),t[13]=s,t[14]=u,t[15]=d):d=t[15];let f;return t[16]!==c||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{className:c,children:[l,d]}),t[16]=c,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function Mm(e,t){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0 bottom-0 w-px bg-border/50`,style:{left:`${12+t*16+8}px`}},`guide:${t}`)}function Nm(e){return e.name.replace(/\/$/,``)}function Pm(e,t){return e.name.localeCompare(t.name)}async function Fm(e){let t=await e.json().catch(()=>null),n=gr.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function Im(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:e.seed.plan,apply:e.seed.apply,listPacks:e.seed.listPacks}:{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Fm(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Fm(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result}:{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var Lm={"knowledge-base":Ec,"software-lifecycle":k,"plain-notes":tl,worldbuilding:lc,"writing-pipeline":Rc,gbrain:Mc};function Rm(e){return Lm[e]??Ec}function zm(e){let t=(0,$.c)(28),{onPackSelect:n,className:r,packs:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=i===void 0,u,d;t[0]===l?(u=t[1],d=t[2]):(u=()=>{if(!l)return;let e=!1;return(async()=>{try{let t=await Im().listPacks();if(e)return;t.ok?o(t.packs):c(t.error.message)}catch(t){let n=t;if(e)return;c(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},d=[l],t[0]=l,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f=l?a:i;if(s!==null){let e;t[3]===r?e=t[4]:(e=Di(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[3]=r,t[4]=e);let n;return t[5]!==s||t[6]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,s]}),t[5]=s,t[6]=e,t[7]=n):n=t[7],n}if(f===null){let e;t[8]===r?e=t[9]:(e=Di(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},Vm).map(Bm),t[10]=n):n=t[10];let i;return t[11]!==e||t[12]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[11]=e,t[12]=n,t[13]=i):i=t[13],i}if(f.length===0){let e;t[14]===r?e=t[15]:(e=Di(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,r),t[14]=r,t[15]=e);let n;return t[16]===e?n=t[17]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[16]=e,t[17]=n),n}let p;t[18]===r?p=t[19]:(p=Di(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[18]=r,t[19]=p);let m;if(t[20]!==n||t[21]!==f){let e;t[23]===n?e=t[24]:(e=e=>(0,Z.jsx)(Hm,{pack:e,onSelect:()=>n(e.id)},e.id),t[23]=n,t[24]=e),m=f.map(e),t[20]=n,t[21]=f,t[22]=m}else m=t[22];let h;return t[25]!==p||t[26]!==m?(h=(0,Z.jsx)(`div`,{className:p,children:m}),t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function Bm(e){return(0,Z.jsx)(Wm,{},`skeleton-${e}`)}function Vm(e,t){return t}function Hm(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Rm(n.id),t[0]=n.id,t[1]=i);let a=i,{files:o,folders:s}=n.entryCounts,c;t[2]===a?c=t[3]:(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 items-center justify-center rounded-lg bg-primary/5 text-primary`,children:(0,Z.jsx)(a,{className:`size-4`})}),t[2]=a,t[3]=c);let l;t[4]===n.name?l=t[5]:(l=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.description?d=t[10]:(d=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==s?(p=Um({files:o,folders:s}),t[14]=o,t[15]=s,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`p`,{className:`mt-auto pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==r||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[f,m]}),t[19]=r,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Um({files:e,folders:t}){let n=e>0?`${e} ${e===1?`file`:`files`}`:null,r=`${t} ${t===1?`folder`:`folders`}`;return n?`${n} · ${r}`:r}function Wm(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(nt,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}function Gm(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ku,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Km(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ju,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(qu,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var qm=`knowledge-base`;function Jm(e){let t=(0,$.c)(68),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Kt(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??qm),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Im().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??qm),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(Ym),Im().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Im().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);X.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let e=x?.name??o({id:`W8vpBM`}),n=t.result.applied,a=o(n===0?{id:`K6jjWB`,values:{packName:e}}:{id:`x3-2ta`,values:{packName:e,projectEntries:n}});X.success(a),i?.(),r(!1)}else{let n=t.error.message;X.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F;t[21]!==o||t[22]!==x||t[23]!==v?(F=v===`configure`&&x?x.description:o({id:`T-4cw2`}),t[21]=o,t[22]=x,t[23]=v,t[24]=F):F=t[24];let I=F,L;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){p(e),y(`configure`),b.current=!0},t[25]=L):L=t[25];let R=L,z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[26]=z):z=t[26];let B=z,V;t[27]===P?V=t[28]:(V=(0,Z.jsx)(Ao,{children:P}),t[27]=P,t[28]=V);let H;t[29]===I?H=t[30]:(H=(0,Z.jsx)(Oo,{children:I}),t[29]=I,t[30]=H);let U;t[31]!==V||t[32]!==H?(U=(0,Z.jsxs)(Bo,{children:[V,H]}),t[31]=V,t[32]=H,t[33]=U):U=t[33];let W;t[34]!==u||t[35]!==c||t[36]!==m||t[37]!==x||t[38]!==v||t[39]!==g?(W=v===`pick`?(0,Z.jsx)(Lo,{children:(0,Z.jsx)(zm,{packs:u,onPackSelect:R})}):(0,Z.jsxs)(Lo,{className:`space-y-6`,children:[(0,Z.jsx)(Xm,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Zm,{phase:c,selectedPack:x})]}),t[34]=u,t[35]=c,t[36]=m,t[37]=x,t[38]=v,t[39]=g,t[40]=W):W=t[40];let G;t[41]!==M||t[42]!==v?(G=v===`configure`&&!M?(0,Z.jsxs)(Y,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:B,children:[(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(J,{id:`iH8pgl`})]}):null,t[41]=M,t[42]=v,t[43]=G):G=t[43];let ee;t[44]===r?ee=t[45]:(ee=()=>r(!1),t[44]=r,t[45]=ee);let te;t[46]===c.kind?te=t[47]:(te=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(J,{id:`yz7wBu`}):(0,Z.jsx)(J,{id:`dEgA5A`}),t[46]=c.kind,t[47]=te);let ne;t[48]!==ee||t[49]!==te?(ne=(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,onClick:ee,children:te}),t[48]=ee,t[49]=te,t[50]=ne):ne=t[50];let re;t[51]!==j||t[52]!==c.kind||t[53]!==v||t[54]!==O?(re=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(Y,{onClick:j,disabled:O,children:(0,Z.jsx)(J,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(Y,{disabled:!0,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`XYlJJT`})]}):null,t[51]=j,t[52]=c.kind,t[53]=v,t[54]=O,t[55]=re):re=t[55];let ie;t[56]!==G||t[57]!==ne||t[58]!==re?(ie=(0,Z.jsxs)(Ro,{children:[G,ne,re]}),t[56]=G,t[57]=ne,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]!==U||t[61]!==W||t[62]!==ie?(ae=(0,Z.jsxs)(Po,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[U,W,ie]}),t[60]=U,t[61]=W,t[62]=ie,t[63]=ae):ae=t[63];let oe;return t[64]!==r||t[65]!==n||t[66]!==ae?(oe=(0,Z.jsx)(Vo,{open:n,onOpenChange:r,children:ae}),t[64]=r,t[65]=n,t[66]=ae,t[67]=oe):oe=t[67],oe}function Ym(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Xm(e){let t=(0,$.c)(21),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`3wiBAs`})}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(lo,{children:(0,Z.jsx)(J,{id:`RSqaSd`})}),t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ro,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(co,{orientation:`horizontal`,children:[(0,Z.jsxs)(Ja,{children:[l,(0,Z.jsx)(La,{className:`text-1sm`,children:(0,Z.jsx)(J,{id:`vPYaz3`})})]}),(0,Z.jsx)(Km,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(lo,{children:(0,Z.jsx)(J,{id:`ZWgr0b`})}),t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(La,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(J,{id:`GUpclA`})}),t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==r?(p=n===`subfolder`&&(0,Z.jsx)(Wo,{value:r,onChange:e=>o(e.target.value),placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=n,t[8]=o,t[9]=i,t[10]=r,t[11]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,Z.jsxs)(Ja,{children:[d,f,p]}),t[12]=p,t[13]=m);let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Km,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=h):h=t[14];let g;t[15]===m?g=t[16]:(g=(0,Z.jsx)(ro,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(co,{orientation:`horizontal`,children:[m,h]})}),t[15]=m,t[16]=g);let _;return t[17]!==n||t[18]!==g||t[19]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(Gm,{className:`sm:flex`,value:n,onValueChange:c,children:[u,g]})]}),t[17]=n,t[18]=g,t[19]=c,t[20]=_):_=t[20],_}function Zm(e){let t=(0,$.c)(13),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`mSJ3Rn`})]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(J,{id:`YwPUUP`})}),t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`gcV0dI`})})]}),t[4]=n):n=t[4],n}let i;t[5]!==n.plan||t[6]!==r?(i=(0,Z.jsx)(jm,{plan:n.plan,selectedPack:r}),t[5]=n.plan,t[6]=r,t[7]=i):i=t[7];let a;t[8]===n.plan.warnings?a=t[9]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(Qm)}):null,t[8]=n.plan.warnings,t[9]=a);let o;return t[10]!==i||t[11]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[10]=i,t[11]=a,t[12]=o):o=t[12],o}function Qm(e){return(0,Z.jsx)(`p`,{children:e},e)}var $m=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],eh=$m.filter(e=>e.id!==`claude-cowork`),th=`#settings`;function nh(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function rh(e){return e.replace(/^#/,``)===`settings`}function ih(){return typeof window>`u`?``:window.location.hash}function ah(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(sh),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,Q.startTransition)(()=>{n(rh(ih()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a=oh,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function oh(){typeof window>`u`||rh(ih())&&window.history.back()}function sh(){return rh(ih())}function ch(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(dh),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(uh);if(!e||!t.ok)return;let i=Ar.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(lh),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function lh(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function uh(){return null}function dh(){return fh()}function fh(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function ph(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function mh(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Fn(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function hh(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?ph(e):mh()}var gh=`ok:skill:cowork:installed`,_h=`1`,vh=250,yh=`/api/skill/install-state`;function bh(e){return`${gh}:v${e}`}var xh=new Map;async function Sh(e={},t={}){let n=t.force?`__force__`:`__default__`,r=xh.get(n);if(r)return r;let i=Ch(e,t);return xh.set(n,i),i.finally(()=>{xh.get(n)===i&&xh.delete(n)}),i}async function Ch(e,t){let n=e.installer===void 0?hh():e.installer,r=wh(e.storage),i=e.fetchSnapshot??Eh,a=e.serverTimeoutMs??vh,o=null;if(!t.force){try{o=await Dh(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=bh(o?.currentVersion??e.fallbackSkillVersion??Th());if(!t.force&&r?.getItem(s)===_h)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,_h)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function wh(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Th(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Eh(){let e;try{e=await fetch(yh,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Dh(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Oh(e){return Sh({},e)}function kh(){return Sh({},{force:!0})}async function Ah(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function jh(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ah({target:`claude-cowork`,url:Lr({mode:`cowork`},e)},n);case`claude-code`:return Ah({target:`claude-code`,url:Lr({mode:`code`},e)},n);case`codex`:return Ah({target:`codex`,url:zr(e)},n);case`cursor`:return Ah({target:`cursor`,url:ii(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Mh(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Nh(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Nh(e)}}}function Nh(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function Ph(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function Fh(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Ih(e){return`${e}.md`}function Lh(e){if(!e.docName||!e.workspace)return null;let t=Ih(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Fh(n,t,r)}}function Rh(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function zh(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Bh(e){return Mh(e.installUrl).then(()=>void 0)}function Vh(e){return`Opened in ${e}.`}function Hh(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Uh(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Wh(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}function Gh(e){return e.docContext===null?e.folderRelativePath?vi(e.folderRelativePath):bi():jr(e.docContext.relativePath)}async function Kh(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:Gh(t)},a=await n.dispatchHandoff(i),o=Wh(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Vh(s));else{let i=Uh(r),a=Hh(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Kh(e,t,n,r+1)}}})}return a}function qh(e){return $m.find(t=>t.id===e)?.displayName??e}function Jh(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Yh(){return{dispatchHandoff:jh,recordHandoff:Ph,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Jh(),getDisplayName:qh,ensureCoworkSkillInstalled:Oh}}function Xh(){return{dispatch:(e,t)=>Kh(e,t,Yh()),reinstallCoworkSkill:kh}}var Zh=[...new Set($m.flatMap(e=>e.schemes))];function Qh(e,t){let n=t.now?.()??Date.now(),r={};for(let t of $m){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function $h(e){return Qh({},e)}async function eg(e){let t=e.schemes??Zh,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var tg=Object.fromEntries(Zh.map(e=>[e,{installed:!1}]));async function ng(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return tg}if(!t.ok)return tg;let n;try{n=await t.json()}catch{return tg}if(typeof n!=`object`||!n||Array.isArray(n))return tg;let r=n,i={};for(let e of Zh)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function rg(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function ig(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=$h({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Qh(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!rg(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function ag(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function og(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>eg({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>ng({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function sg(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(cg),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=ig(og());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function cg(){return $h({isElectronHost:ag(),now:Date.now})}var lg=3e3,ug=(e,t,n)=>pl(e,t,n,`CommandPalette`);function dg(e){window.location.assign(kr(e))}function fg(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:_i(t)}function pg(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?ye:E,s;t[0]===n?s=t[1]:(s=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=s);let c=s,l=`snippet`in n?n.snippet:void 0,u=`${n.kind} ${n.path}`,d=`command-palette-nav-${n.kind}-${n.path}`,f;t[2]===o?f=t[3]:(f=(0,Z.jsx)(o,{className:`mt-0.5`}),t[2]=o,t[3]=f);let p;t[4]!==a||t[5]!==c?(p=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(mg,{query:a,text:c})}),t[4]=a,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==n.path||t[8]!==a?(m=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(mg,{query:a,text:n.path})}),t[7]=n.path,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==l?(h=l?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(mg,{query:a,text:l})}):null,t[10]=a,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[p,m,h]}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==i||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==g?(_=(0,Z.jsxs)(D,{value:u,onSelect:i,"data-testid":d,className:`items-start`,children:[f,g]}),t[17]=i,t[18]=u,t[19]=d,t[20]=f,t[21]=g,t[22]=_):_=t[22],_}function mg(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=Zp(n,r).map(hg),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function hg(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function gg({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function _g(e){let t=(0,$.c)(136),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,[o,s]=(0,Q.useState)(``),c=(0,Q.useDeferredValue)(o),l=c.trim(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(`idle`),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[1]=h):h=t[1];let[g,_]=(0,Q.useState)(h),v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[2]=v):v=t[2];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[3]=T):T=t[3];let[O,k]=(0,Q.useState)(T),[j,M]=(0,Q.useState)(`idle`),N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[4]=N):N=t[4];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(`idle`),R=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),{activeDocName:H,activeTarget:U}=dt(),{pages:W,pageTitles:G,pageMeta:ee,folderPaths:te}=Nr(),ne=ch(),{states:re,refresh:ie}=sg(),{dispatch:ae}=Xh(),oe=Lh({docName:H,workspace:ne}),se=Wp(W,te,G,ee),ce=Ip(y,new Set(se.map(bg))),le=a?.config.projectPath??null,ue=a?g.filter(e=>e.path!==le):[],de;t[5]!==H||t[6]!==U?(de=fg(U,H),t[5]=H,t[6]=U,t[7]=de):de=t[7];let K=de,fe=l===``?[]:Yp(se,l,8),pe,me;t[8]!==i||t[9]!==r?(pe=()=>{let e=function(e){e.key===`k`&&(Ti()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},me=[i,r],t[8]=i,t[9]=r,t[10]=pe,t[11]=me):(pe=t[10],me=t[11]),(0,Q.useEffect)(pe,me);let he,ge;t[12]!==a||t[13]!==r||t[14]!==ie?(he=()=>{if(r){if(b(Np()),ie(),a){let e=!1;return ug(async()=>{let t=await a.project.listRecent();e||_(t)},`Failed to load recent projects.`),()=>{e=!0}}return}s(``),k([]),M(`idle`),R.current=!1,F([]),L(`idle`)},ge=[r,a,ie],t[12]=a,t[13]=r,t[14]=ie,t[15]=he,t[16]=ge):(he=t[15],ge=t[16]),(0,Q.useEffect)(he,ge);let _e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_e=()=>{B.current&&(B.current.scrollTop=0)},t[17]=_e):_e=t[17];let ve;t[18]===o?ve=t[19]:(ve=[o],t[18]=o,t[19]=ve),(0,Q.useEffect)(_e,ve);let xe=nm(c,new Set(O.map(yg))),we=xe.kind!==`normal`,Te,De;t[20]!==we||t[21]!==r?(Te=()=>{if(!r||!we||R.current)return;R.current=!0,M(`loading`);let e=!1;return im().then(t=>{e||(k(t),M(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),k([]),M(`error`))}),()=>{e=!0}},De=[r,we],t[20]=we,t[21]=r,t[22]=Te,t[23]=De):(Te=t[22],De=t[23]),(0,Q.useEffect)(Te,De);let Oe=xe.kind===`tag-docs`?xe.tagName:null;(0,Q.useEffect)(()=>{if(!r||Oe===null){F([]),L(`idle`);return}L(`loading`),F([]);let e=!1;return am(Oe).then(t=>{e||(F(t),L(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),F([]),L(`error`))}),()=>{e=!0}},[r,Oe]),(0,Q.useEffect)(()=>{if(!r||!l||we){f([]),m(`idle`);return}let e=new AbortController;m(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),f([]),m(`error`)},lg);return $p(l,{signal:e.signal}).then(e=>{window.clearTimeout(n),f(e),m(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(f([]),m(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,l,we]);let ke;t[24]===i?ke=t[25]:(ke=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),ug(async()=>{await e()},n)},t[24]=i,t[25]=ke);let Ae=ke,je;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Fp(Np(),t);Pp(n),b(n)},t[26]=je):je=t[26];let Me=je,Ne;t[27]===i?Ne=t[28]:(Ne=function(e){i(!1),Me(e),dg(e.path)},t[27]=i,t[28]=Ne);let Pe=Ne,Fe=!we&&l===``&&ce.length>0,Ie=gg({searchResults:d,fallbackSearchResults:fe,searchStatus:p}),q=!we&&Ie.length>0,Le=!we&&l!==``&&p===`loading`&&!q,Re;t[29]!==c||t[30]!==we?(Re=!we&&em(`New file`,c,[`create file`]),t[29]=c,t[30]=we,t[31]=Re):Re=t[31];let ze=Re,Be;t[32]!==c||t[33]!==we?(Be=!we&&em(`New folder`,c,[`create folder`]),t[32]=c,t[33]=we,t[34]=Be):Be=t[34];let Ve=Be,He;t[35]!==H||t[36]!==c||t[37]!==we?(He=!we&&H!==null&&em(`Open graph`,c,[`graph panel network`]),t[35]=H,t[36]=c,t[37]=we,t[38]=He):He=t[38];let Ue=He,We;t[39]!==c||t[40]!==we?(We=!we&&em(`Initialize starter pack`,c,[`scaffold`,`seed`,`pack`,`starter`]),t[39]=c,t[40]=we,t[41]=We):We=t[41];let Ge=We,Ke;t[42]!==a||t[43]!==c||t[44]!==we?(Ke=!we&&a!==null&&em(`Open folder on disk`,c,[`project`]),t[42]=a,t[43]=c,t[44]=we,t[45]=Ke):Ke=t[45];let qe=Ke,Je;t[46]!==a||t[47]!==c||t[48]!==we?(Je=!we&&a!==null&&em(`Switch Project`,c,[`switch project navigator projects`]),t[46]=a,t[47]=c,t[48]=we,t[49]=Je):Je=t[49];let Ye=Je,Xe;t[50]!==c||t[51]!==we?(Xe=!we&&em(`Settings`,c,[`preferences config`]),t[50]=c,t[51]=we,t[52]=Xe):Xe=t[52];let Ze=Xe,Qe;t[53]!==c||t[54]!==we?(Qe=!we&&em(`Install for Claude Chat & Cowork (Desktop App)`,c,[`claude desktop install cowork`]),t[53]=c,t[54]=we,t[55]=Qe):Qe=t[55];let $e=Qe,et=!we&&a!==null&&ue.length>0&&(l===``||ue.some(e=>em(`${e.name} ${e.path}`,c,[`open recent project`]))),tt=!we&&oe!==null&&(l===``||eh.some(e=>em(`Open with AI ${e.displayName}`,c,[e.id,`agent handoff`,`open in`]))),nt=xe.kind===`tag-list`?rm(O,xe.query):[],rt=xe.kind===`tag-list`&&j!==`loading`&&nt.length===0,it=xe.kind===`tag-docs`&&I===`success`&&P.length===0,at=we||Fe||q||Le||ze||Ve||Ue||Ge||qe||Ye||Ze||$e||et||tt,ot;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(e){s(`${tm}${e}`)},t[56]=ot):ot=t[56];let st=ot,ct=Ce,lt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(lt={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[57]=lt):lt=t[57];let ut;t[58]===o?ut=t[59]:(ut=(0,Z.jsx)(Ee,{ref:V,value:o,onValueChange:s,placeholder:`Search files, folders, or commands`}),t[58]=o,t[59]=ut);let ft;t[60]===we?ft=t[61]:(ft=()=>{s(we?``:tm),V.current?.focus()},t[60]=we,t[61]=ft);let pt=we?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,mt;t[62]===pt?mt=t[63]:(mt=Di(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,pt),t[62]=pt,t[63]=mt);let ht,gt;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Z.jsx)(Se,{className:`size-3.5`}),gt=(0,Z.jsx)(`span`,{children:`By tag`}),t[64]=ht,t[65]=gt):(ht=t[64],gt=t[65]);let _t;t[66]!==we||t[67]!==ft||t[68]!==mt?(_t=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:ft,"data-testid":`command-palette-filter-tag`,"data-active":we,"aria-pressed":we,className:mt,children:[ht,gt]})}),t[66]=we,t[67]=ft,t[68]=mt,t[69]=_t):_t=t[69];let vt=z,yt;t[70]!==q||t[71]!==Le?(yt=Le&&!q?(0,Z.jsx)(A,{children:`Searching`}):null,t[70]=q,t[71]=Le,t[72]=yt):yt=t[72];let bt=at?null:(0,Z.jsx)(A,{children:p===`error`?`Search failed.`:`No matching commands.`}),St=xe.kind===`tag-list`?(0,Z.jsxs)(be,{heading:xe.query?`Tags matching "${xe.query}"`:`All tags`,children:[j===`loading`?(0,Z.jsx)(A,{children:`Loading tags`}):null,j===`error`?(0,Z.jsx)(A,{children:`Failed to load tags. Press Escape and re-open to retry.`}):null,rt?(0,Z.jsx)(A,{children:xe.query?`No tags match "${xe.query}".`:"No tags yet — author `#tagname` in any doc to populate the index."}):null,nt.map(e=>(0,Z.jsxs)(D,{value:`tag ${e.name}`,onSelect:()=>st(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(Se,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:[e.count,` `,e.count===1?`doc`:`docs`]})]},`tag:${e.name}`))]}):null,Ct;t[73]!==i||t[74]!==xe||t[75]!==it||t[76]!==P||t[77]!==I?(Ct=xe.kind===`tag-docs`?(0,Z.jsxs)(be,{heading:`Docs tagged #${xe.tagName}`,children:[I===`loading`?(0,Z.jsx)(A,{children:`Loading docs`}):null,I===`error`?(0,Z.jsx)(A,{children:`Failed to load docs. Press Escape and re-open to retry.`}):null,it?(0,Z.jsx)(A,{children:`No docs registered under #${xe.tagName}.`}):null,P.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName;return(0,Z.jsxs)(D,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),dg(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(E,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==xe.tagName)?(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:[`via`,` `,e.matchingTags.filter(e=>e!==xe.tagName).map(vg).join(`, `)]}):null]})]},`tag-doc:${e.docName}`)})]}):null,t[73]=i,t[74]=xe,t[75]=it,t[76]=P,t[77]=I,t[78]=Ct):Ct=t[78];let wt=Fe?(0,Z.jsx)(be,{heading:`Recently opened`,children:ce.map(e=>(0,Z.jsx)(pg,{entry:e,onSelect:()=>Pe(e)},Mp(e.kind,e.path)))}):null,Tt;t[79]!==H||t[80]!==i||t[81]!==S||t[82]!==w||t[83]!==ze||t[84]!==Ve||t[85]!==Ue||t[86]!==Ge?(Tt=ze||Ve||Ue||Ge?(0,Z.jsxs)(be,{heading:`Commands`,children:[ze?(0,Z.jsxs)(D,{value:`new file create file`,onSelect:()=>{i(!1),S(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(mc,{}),(0,Z.jsx)(`span`,{children:`New file`})]}):null,Ve?(0,Z.jsxs)(D,{value:`new folder create folder`,onSelect:()=>{i(!1),S(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(yc,{}),(0,Z.jsx)(`span`,{children:`New folder`})]}):null,Ue?(0,Z.jsxs)(D,{value:`open graph graph panel network`,onSelect:()=>{H&&(i(!1),lm(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Mc,{}),(0,Z.jsx)(`span`,{children:`Open graph`})]}):null,Ge?(0,Z.jsxs)(D,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),w(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(Pc,{}),(0,Z.jsx)(`span`,{children:`Initialize starter pack`})]}):null]}):null,t[79]=H,t[80]=i,t[81]=S,t[82]=w,t[83]=ze,t[84]=Ve,t[85]=Ue,t[86]=Ge,t[87]=Tt):Tt=t[87];let Et=tt?(0,Z.jsx)(be,{heading:`Open with AI`,children:eh.filter(e=>em(`Open with AI ${e.displayName}`,c,[e.id,`agent handoff`,`open in`])).map(e=>{let t=re[e.id],n=t.installed===!0&&oe!==null,r=t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null,a=r?`Open with AI ${e.displayName}, ${r}`:`Open with AI ${e.displayName}`;return(0,Z.jsxs)(D,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!oe||(i(!1),ae(e.id,oe))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Open with AI `,e.displayName]}),r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})}):null,Dt;t[88]!==a||t[89]!==i||t[90]!==Ae||t[91]!==$e||t[92]!==qe||t[93]!==Ye||t[94]!==Ze?(Dt=qe||Ye||Ze||$e?(0,Z.jsxs)(be,{heading:`Project`,children:[qe&&a?(0,Z.jsxs)(D,{value:`open folder on disk project`,onSelect:()=>Ae(async()=>{let e=await a.dialog.openFolder();e&&await a.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(ye,{}),(0,Z.jsx)(`span`,{children:`Open folder on disk`}),(0,Z.jsx)(xt,{children:`⌘O`})]}):null,Ye&&a?(0,Z.jsxs)(D,{value:`switch-project navigator projects`,onSelect:()=>Ae(()=>a.navigator.open(),`Failed to open Project Navigator.`),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(Tc,{}),(0,Z.jsx)(`span`,{children:`Switch Project`}),(0,Z.jsx)(xt,{children:`⌘⇧N`})]}):null,Ze?(0,Z.jsxs)(D,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=th)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Jc,{}),(0,Z.jsx)(`span`,{children:`Settings`}),(0,Z.jsx)(xt,{children:`⌘,`})]}):null,$e?(0,Z.jsxs)(D,{value:`install claude desktop cowork app`,onSelect:()=>{i(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(Xa,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)`})]}):null]}):null,t[88]=a,t[89]=i,t[90]=Ae,t[91]=$e,t[92]=qe,t[93]=Ye,t[94]=Ze,t[95]=Dt):Dt=t[95];let Ot=et&&a?(0,Z.jsx)(be,{heading:`Open recent project`,children:ue.filter(e=>em(`${e.name} ${e.path}`,c,[`open recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(D,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>Ae(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(kt,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]})]},e.path))}):null,At=q?(0,Z.jsx)(be,{heading:`Search`,children:Ie.map(e=>(0,Z.jsx)(pg,{entry:e,query:l,onSelect:()=>Pe(e)},Mp(e.kind,e.path)))}):null,jt;t[96]!==vt||t[97]!==yt||t[98]!==bt||t[99]!==St||t[100]!==Ct||t[101]!==wt||t[102]!==Tt||t[103]!==Et||t[104]!==Dt||t[105]!==Ot||t[106]!==At?(jt=(0,Z.jsxs)(vt,{ref:B,className:`subtle-scrollbar`,children:[yt,bt,St,Ct,wt,Tt,Et,Dt,Ot,At]}),t[96]=vt,t[97]=yt,t[98]=bt,t[99]=St,t[100]=Ct,t[101]=wt,t[102]=Tt,t[103]=Et,t[104]=Dt,t[105]=Ot,t[106]=At,t[107]=jt):jt=t[107];let Mt;t[108]!==ct||t[109]!==i||t[110]!==r||t[111]!==lt||t[112]!==ut||t[113]!==_t||t[114]!==jt?(Mt=(0,Z.jsxs)(ct,{open:r,onOpenChange:i,title:`Workspace Command Palette`,description:`Search files, folders, and commands for the current workspace.`,className:`sm:max-w-2xl`,commandProps:lt,children:[ut,_t,jt]}),t[108]=ct,t[109]=i,t[110]=r,t[111]=lt,t[112]=ut,t[113]=_t,t[114]=jt,t[115]=Mt):Mt=t[115];let Nt=x===`file`,Pt;t[116]===S?Pt=t[117]:(Pt=e=>{e||S(null)},t[116]=S,t[117]=Pt);let Ft;t[118]!==K||t[119]!==Nt||t[120]!==Pt?(Ft=(0,Z.jsx)(Sm,{open:Nt,onOpenChange:Pt,kind:`file`,initialDir:K}),t[118]=K,t[119]=Nt,t[120]=Pt,t[121]=Ft):Ft=t[121];let It=x===`folder`,Lt;t[122]===S?Lt=t[123]:(Lt=e=>{e||S(null)},t[122]=S,t[123]=Lt);let Rt;t[124]!==K||t[125]!==It||t[126]!==Lt?(Rt=(0,Z.jsx)(Sm,{open:It,onOpenChange:Lt,kind:`folder`,initialDir:K}),t[124]=K,t[125]=It,t[126]=Lt,t[127]=Rt):Rt=t[127];let zt;t[128]!==C||t[129]!==w?(zt=(0,Z.jsx)(Jm,{open:C,onOpenChange:w}),t[128]=C,t[129]=w,t[130]=zt):zt=t[130];let Bt;return t[131]!==Mt||t[132]!==Ft||t[133]!==Rt||t[134]!==zt?(Bt=(0,Z.jsxs)(Z.Fragment,{children:[Mt,Ft,Rt,zt]}),t[131]=Mt,t[132]=Ft,t[133]=Rt,t[134]=zt,t[135]=Bt):Bt=t[135],Bt}function vg(e){return`#${e}`}function yg(e){return e.name}function bg(e){return Mp(e.kind,e.path)}var xg=500;function Sg(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Cg(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function wg(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=dt(),[a,o]=(0,Q.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),xg);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,Q.useEffect)(s,c);let l=Sg(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Cg(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.ok/local/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Z.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function Tg(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(Fn(e)??Of._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function Eg(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),Tg(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(ct,e),()=>document.removeEventListener(ct,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(kr(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)(Bo,{children:(0,Z.jsx)(Ao,{children:(0,Z.jsx)(J,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(Lo,{children:(0,Z.jsx)(Dg,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(Po,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(Vo,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function Dg(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(J,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(J,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(Og)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function Og(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var kg=`raw-mdx-nav`,Ag=`ok-editor-mode-v1`,jg=[`wysiwyg`,`source`],Mg=`wysiwyg`;function Ng(e){return jg.includes(e)}function Pg(e=localStorage){try{let t=e.getItem(Ag);if(t===null)return Mg;if(Ng(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Mg}function Fg(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Ng(n)?n:Pg(t)}function Ig(e,t=localStorage){try{return t.setItem(Ag,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Lg(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Fg),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Ig(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function Rg(e){let t=(0,$.c)(25),{open:n,onResolved:r}=e,{_:i}=Kt(),a=Sa(),o;t[0]!==i||t[1]!==r||t[2]!==a?(o=function(e){if(a===null){X.error(i({id:`fiMNLl`}));return}let t=a(e);if(!t.ok){let n=t.error;X.error(i(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}r()},t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Bo,{children:(0,Z.jsx)($i,{})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ha,{}),t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(Lo,{children:[l,(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ZLQol-`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})})]}),t[6]=u):u=t[6];let d;t[7]===s?d=t[8]:(d=()=>s(!1),t[7]=s,t[8]=d);let f=a===null,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`IKoTAC`}),t[9]=p):p=t[9];let m;t[10]!==d||t[11]!==f?(m=(0,Z.jsx)(Y,{variant:`ghost`,className:`uppercase font-mono`,onClick:d,disabled:f,children:p}),t[10]=d,t[11]=f,t[12]=m):m=t[12];let h;t[13]===s?h=t[14]:(h=()=>s(!0),t[13]=s,t[14]=h);let g=a===null,_;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(J,{id:`XU0OXn`}),t[15]=_):_=t[15];let v;t[16]!==g||t[17]!==h?(v=(0,Z.jsx)(Y,{onClick:h,disabled:g,children:_}),t[16]=g,t[17]=h,t[18]=v):v=t[18];let y;t[19]!==v||t[20]!==m?(y=(0,Z.jsxs)(Po,{className:`sm:max-w-lg`,showCloseButton:!1,children:[c,u,(0,Z.jsxs)(Ro,{children:[m,v]})]}),t[19]=v,t[20]=m,t[21]=y):y=t[21];let b;return t[22]!==n||t[23]!==y?(b=(0,Z.jsx)(Vo,{open:n,onOpenChange:zg,children:y}),t[22]=n,t[23]=y,t[24]=b):b=t[24],b}function zg(){}function Bg(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=fo();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ir,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Z.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var Vg=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function Hg(e,t,n,r,i,a){if(e==r)return[];let o=Qg(e,t,n,r,i,a),s=$g(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new Vg(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Vg(t,t+o,i,i),new Vg(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new Vg(t,t,i,i+o),new Vg(n,n,i+o+c,a)]}if(c==1||l==1)return[new Vg(t,n,i,a)];let u=t_(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Hg(e,t,o,r,i,s).concat(Hg(e,o+c,n,r,s+c,a))}return Kg(e,t,n,r,i,a)}var Ug=1e9,Wg=0,Gg=!1;function Kg(e,t,n,r,i,a){let o=n-t,s=a-i;if(Ug<1e9&&Math.min(o,s)>Ug*16||Wg>0&&Date.now()>Wg)return Math.min(o,s)>Ug*64?[new Vg(t,n,i,a)]:n_(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Jg.reset(c),Yg.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:Yg,f=d?null:Jg;for(let p=0;p<c;p++){if(p>Ug||Wg>0&&!(p&63)&&Date.now()>Wg)return n_(e,t,n,r,i,a);let m=Jg.advance(p,o,s,c,d,!1,l)||Yg.advance(p,o,s,c,f,!0,u);if(m)return Xg(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Vg(t,n,i,a)]}var qg=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},Jg=new qg,Yg=new qg;function Xg(e,t,n,r,i,a,o,s){let c=!1;return!__(e,r)&&++r==n&&(c=!0),!__(i,s)&&++s==o&&(c=!0),c?[new Vg(t,n,a,o)]:Hg(e,t,r,i,a,s).concat(Hg(e,r,n,i,s,o))}function Zg(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Qg(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Zg(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!__(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function $g(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Zg(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!__(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function e_(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){__(e,s)||s++;let u=s+o;if(__(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=Qg(e,u,n,r,i+f+d.length,a),c=$g(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function t_(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=t_(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:e_(e,t,n,r,i,a,Math.floor(o/4),-1)}function n_(e,t,n,r,i,a){Gg=!0;let o=n-t,s=a-i,c;if(o<s){let s=e_(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=e_(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Vg(t,n,i,a)];let[l,u,d]=c;return Hg(e,t,l,r,i,u).concat(Hg(e,l+d,n,r,u+d,a))}function r_(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new Vg(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function i_(e,t,n){for(;;){r_(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Qg(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Vg(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=$g(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Vg(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new Vg(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new Vg(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function a_(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=f_(t,a.fromA,l),f=d_(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new Vg(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=d_(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Vg(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=f_(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Vg(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=m_(n,a.fromB,a.toB),r,o=t<0?-1:p_(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=m_(t,a.fromA,a.toA),r,o=n<0?-1:p_(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return r_(e,3),e}var o_;try{o_=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function s_(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function c_(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!s_(n):o_?!h_(n)||t==e.length-1?+!!o_.test(String.fromCharCode(n)):o_.test(e.slice(t,t+2))?2:0:0}function l_(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!s_(n):o_?!g_(n)||t==1?+!!o_.test(String.fromCharCode(n)):o_.test(e.slice(t-2,t))?2:0:0}var u_=8;function d_(e,t,n){if(t==e.length||!l_(e,t))return t;for(let r=t,i=t+n,a=0;a<u_;a++){let t=c_(e,r);if(!t||r+t>i)return r;r+=t}return t}function f_(e,t,n){if(!t||!c_(e,t))return t;for(let r=t,i=t-n,a=0;a<u_;a++){let t=l_(e,r);if(!t||r-t<i)return r;r-=t}return t}function p_(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function m_(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var h_=e=>e>=55296&&e<=56319,g_=e=>e>=56320&&e<=57343;function __(e,t){return!t||t==e.length||!h_(e.charCodeAt(t-1))||!g_(e.charCodeAt(t))}function v_(e,t,n){let r=n?.override;return r?r(e,t):(Ug=(n?.scanLimit??1e9)>>1,Wg=n?.timeout?Date.now()+n.timeout:0,Gg=!1,i_(e,t,Hg(e,0,e.length,t,0,t.length)))}function y_(){return!Gg}function b_(e,t,n){return a_(v_(e,t,n),e,t)}var x_=hs.define({combine:e=>e[0]}),S_=gs.define(),C_=hs.define(),w_=us.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(S_)&&(e=n.value);for(let n of t.state.facet(C_))e=n(e,t);return e}});function T_(e){let t=e.field(w_,!1);if(!t)return null;let n=e.facet(x_);return{chunks:t,side:n?n.side:null}}var E_=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return k_(b_(e.toString(),t.toString(),n),e,t,0,0,y_())}static updateA(e,t,n,r,i){return N_(M_(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return N_(M_(e,r,!1,t.length),e,t,n,i)}};function D_(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function O_(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function k_(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=D_(c.fromA+r,c.fromB+i,t,n),[d,f]=O_(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=D_(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=O_(a.toA+r,a.toB+i,t,n),s++}o.push(new E_(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var A_=1e3;function j_(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function M_(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>A_&&([l,d]=j_(e,a-A_,n,!0)),o<t.length-A_&&([u,f]=j_(e,o+A_,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function N_(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=b_(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of k_(h,n,r,d,f,y_()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var P_={scanLimit:500},F_=_s.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=G_(e))}update(e){(e.docChanged||e.viewportChanged||L_(e.startState,e.state)||R_(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=G_(e.view))}},{decorations:e=>e.deco}),I_=ss.low(xs({class:`cm-changeGutter`,markers:e=>e.plugin(F_)?.gutter||ws.empty}));function L_(e,t){return e.field(w_,!1)!=t.field(w_,!1)}function R_(e,t){return e.facet(x_)!=t.facet(x_)}var z_=ps.line({class:`cm-changedLine`}),B_=ps.mark({class:`cm-changedText`}),V_=ps.mark({tagName:`ins`,class:`cm-insertedLine`}),H_=ps.mark({tagName:`del`,class:`cm-deletedLine`}),U_=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function W_(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,z_),i.add(o,s,n?H_:V_),a&&a.add(o,o,U_);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,z_),a&&a.add(u,u,U_);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,B_),s<t)c++;else break}u=t}}}function G_(e){let t=e.state.field(w_),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(x_),o=n==`a`,s=new ms,c=i?new ms:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&W_(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var K_=class extends os{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},q_=gs.define({map:(e,t)=>e.map(t)}),J_=us.define({create:()=>ps.none,update:(e,t)=>{for(let e of t.effects)if(e.is(q_))return e.value;return e.map(t.changes)},provide:e=>ys.decorations.from(e)}),Y_=.01;function X_(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Z_(e,t,n){let r=new ms,i=new ms,a=e.state.field(J_).iter(),o=t.state.field(J_).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-Y_?(l-=n,r.add(s,s,ps.widget({widget:new K_(-n),block:!0,side:-1}))):n>Y_&&(u+=n,i.add(c,c,ps.widget({widget:new K_(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<Y_?r.add(e.state.doc.length,e.state.doc.length,ps.widget({widget:new K_(-p),block:!0,side:1})):p>Y_&&i.add(t.state.doc.length,t.state.doc.length,ps.widget({widget:new K_(p),block:!0,side:1}));let m=r.finish(),h=i.finish();X_(m,e.state.field(J_))||e.dispatch({effects:q_.of(m)}),X_(h,t.state.field(J_))||t.dispatch({effects:q_.of(h)})}var Q_=gs.define({map:(e,t)=>t.mapPos(e)}),$_=class extends os{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:Q_.of(n)});let{side:r,sibling:i}=e.state.facet(x_);i&&i().dispatch({effects:Q_.of(ev(n,e.state.field(w_),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function ev(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var tv=us.define({create(e){return ps.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Q_)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ys.decorations.from(e)});function nv({margin:e=3,minSize:t=4}){return tv.init(n=>rv(n,e,t))}function rv(e,t,n){let r=new ms,i=e.facet(x_).side==`a`,a=e.field(w_),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,ps.replace({widget:new $_(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var iv=ys.styleModule.of(new Ss({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),av=ys.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),ov=new vs,sv=new vs,cv=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||P_;let t=[ss.low(F_),av,iv,J_,ys.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(q_)))&&this.measure()})],n=[x_.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(I_);let r=ls.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ys.editorAttributes.of({class:`cm-merge-a`}),sv.of(n),t]}),i=[x_.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(I_);let a=ls.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ys.editorAttributes.of({class:`cm-merge-b`}),sv.of(i),t]});this.chunks=E_.build(r.doc,a.doc,this.diffConf);let o=[w_.init(()=>this.chunks),ov.of(e.collapseUnchanged?nv(e.collapseUnchanged):[])];r=r.update({effects:gs.appendConfig.of(o)}).state,a=a.update({effects:gs.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new ys({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ys({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),cs.empty(e[0].startState.doc.length));this.chunks=t==this.a?E_.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):E_.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:S_.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:S_.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(x_),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(sv.reconfigure([x_.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?I_:[]])),a.push(sv.reconfigure([x_.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?I_:[]]))}if(r){let t=ov.reconfigure(e.collapseUnchanged?nv(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){Z_(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=lv(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=lv(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function lv(e){let t=e.nextSibling;return e.remove(),t}var uv=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},dv=ss.low(xs({class:`cm-changeGutter`,markers:e=>e.plugin(F_)?.gutter||ws.empty,widgetMarker:(e,t)=>t instanceof gv?uv:null}));function fv(e){let t=typeof e.original==`string`?fs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||P_;return[ss.low(F_),xv,av,ys.editorAttributes.of({class:`cm-merge-b`}),C_.of((e,t)=>{let r=t.effects.find(e=>e.is(pv));return r&&(e=E_.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=E_.updateB(e,t.state.field(mv),t.newDoc,t.changes,n)),e}),x_.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Dv:void 0,side:`b`}),mv.init(()=>t),e.gutter===!1?[]:dv,e.collapseUnchanged?nv(e.collapseUnchanged):[],w_.init(e=>E_.build(t,e.doc,n))]}var pv=gs.define(),mv=us.define({create:()=>fs.empty,update(e,t){for(let n of t.effects)n.is(pv)&&(e=n.value.doc);return e}}),hv=new WeakMap,gv=class extends os{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function _v(e,t,n){let r=hv.get(t.changes);if(r)return r;let i=ps.widget({block:!0,side:-1,widget:new gv(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(x_),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),vv(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),yv(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(mv).sliceString(t.fromA,t.endA),u=a&&e.facet(Ts),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
23
|
+
`)),cf(s)&&yf.test(s)?bf(s):cf(s)?s:wf(s,this._locale,this._locales)(t,n?.formats)}t=this._.bind(this);date(e,t){return pf(this._locales||this._locale,e,t)}number(e,t){return hf(this._locales||this._locale,e,t)}};function Df(e={}){return new Ef(e)}var Of=Df(),kf=JSON.parse(`{"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"0-31GV":["Removing"],"0YEbfk":["Connect to AI tools"],"0rwwOn":["By tag"],"0t0bbC":["Could not save sync preference: ",["detail"]],"0xnmlQ":["Repository name"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1HBhDS":["Checking out files"],"1Ta7Fd":["Open ",["basename"]],"1WgmEM":["Failed to load template: ",["errorMessage"]],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"2QM24L":["All tags"],"2Xs2jo":["Switch Project"],"2q_Q7x":["Visibility"],"2tgFCe":["Starting clone"],"3Fcb0I":["Open graph"],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3wiBAs":["Where should it live?"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"45MZFs":["Commands"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4CfgPM":["Project folder created, but git init failed. Try again."],"4TzU0n":["Initialize"],"4jDd0j":["Anyone can see"],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5o4lc1":["Open Knowledge will be initialized at <0>",["gitRoot"],"</0> — the parent of your new folder, because it contains a <1>.git</1> folder (one project per git repo)."],"5qNxOe":[["count","plural",{"one":["#"," item could not be moved to the Trash. Do you want to permanently delete instead?"],"other":["#"," items could not be moved to the Trash. Do you want to permanently delete instead?"]}]],"5wV2qQ":["and more"],"5y_9lO":["Waiting for authorization"],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6YtxFj":["Name"],"6_ZOw4":["Copied full path"],"6bTTAN":["Invalid input — pick a different folder."],"6gRgw8":["Retry"],"6nB8LV":["Paste a personal access token"],"74eHt-":["No file or folder selected"],"77SdEP":["Delete ",["itemName"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7PzzBU":["User"],"7d1a0d":["Public"],"7qRHf0":["Install for Claude Chat & Cowork"],"8C2UQ5":["No git remote was detected for this project. Set one up if you would like automatic git syncing."],"8XQ7Ib":["Pick an owner"],"8XQRON":["Loading repositories"],"8XS8nG":["Open in your favorite AI editor."],"95uxb3":["Signed in as <0>@",["signedInLogin"],"</0>"],"96G6Re":["New folder"],"9UQ730":["Clone"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9oE4C3":["Browse your repos:"],"A1taO8":["Search"],"A5hiCy":["Create template"],"AMyJts":["This path is on an external volume (/Volumes/...). Open Knowledge will lose track of files when the drive ejects."],"AThCb_":["Open Knowledge manages the <0>open-knowledge</0> MCP server name, the <1>open-knowledge-ui</1> launch config, and <2>ok</2> / <3>open-knowledge</3> on PATH (including OK-owned symlinks). Using a custom wrapper? Register it under a different name."],"AVoO4B":["Open <0>",["verificationUri"],"</0> and enter this code:"],"AddR83":["Could not create project. Try again or pick a different location."],"B3NAZC":["Open Navigator"],"BBtVak":["Collapse All"],"BJpGCq":["Open in Terminal"],"Bdha5y":["Publishing..."],"C0NPNd":["Add Open Knowledge to your AI tools"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CvsD6Y":["via ",["viaTags"]],"D8OV7J":["Only collaborators"],"DPfwMq":["Done"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"EgMJem":["Lands at <0>",["targetPath"],"</0>. Agents resolve it via leaf → root walk-up — closest-wins on filename collision."],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"FEr96N":["Theme"],"FF5rwn":["Connect Open Knowledge to other tools you use."],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"Fxf4jq":["Description (optional)"],"FyW0WO":["Authorize in browser"],"G1Gw0v":["New template"],"GJ3011":["Use ",["ext"]," extension"],"GUpclA":["Created if missing; reused if it exists."],"GgQgML":["You picked your home directory. Open Knowledge will index everything in your home tree — large and may surface personal files."],"GjElCU":["Select a file from the sidebar, or pick where to edit alongside your agent."],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"GvHKEy":["Filter repositories"],"HIb0vl":["Network error — please try again"],"HP5ML3":["Sign in to GitHub to continue."],"HRU-eL":["You picked ~/Documents. Open Knowledge will index every markdown file under it. If you only want to manage a sub-folder, choose a smaller scope."],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HpK_8d":["Reload"],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"IKoTAC":["Keep disabled"],"IajAbS":["Add a starter pack"],"J-lpiN":["Repository URL or owner/repo"],"J2Mv98":["Name (e.g. ",["login"],")"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JUamR6":["This name has no characters that are safe for a folder identifier. Try a name with at least one letter or number."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jqqevv":["System error"],"K1ckLX":["Failed to create folder"],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K9J00P":["Clone failed — connection error"],"KDw4GX":["Try again"],"KX1MZR":["Your repositories"],"KZkHZv":["Signed in as @",["login"]],"K_wz1u":["Show Hidden Files"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"L-rMC9":["Reset to default"],"L3CEC1":["this item"],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LlHqdU":["Initializing project"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"Lu_dOh":["Tree View Options"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"MKOVhz":["Enable git auto-sync"],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MW64zN":["New File"],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"MmDDWK":["Recently opened"],"MtR6ZK":["Not signed in to GitHub."],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NOHyEE":["Retry push"],"NYUhy5":["Subfolder name"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"Nu4DdT":["Sync"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"O7_W_a":["Open with AI"],"ODD5Jc":["Edit ",["templateLabel"]],"ODGGlj":["Folder name: ",["detail"]],"OYnx7O":["Path cannot start with \\"/\\""],"OZtLT5":["Checking GitHub sign-in..."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"Oos8fo":["Copy command"],"Ox3-3h":["No matches."],"Oxyd5f":["Pick a name"],"P-ye9o":["Could not open folder picker"],"P47EWZ":["Could not update sidebar settings"],"PHRoEJ":["Open shared document"],"PKLY-1":["Opening..."],"PiH3UR":["Copied!"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"QQghPu":["Install in Claude Desktop"],"RDrXh4":["Configure user, project, and integration settings."],"RGkNeJ":["Initialize a starter pack"],"RJ3a8Z":["Looking for <0>",["lookingForUrl"],"</0>."],"RN62Q8":["We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."],"RSqaSd":["Project root"],"SP385B":["No repositories found."],"SUOoXn":["Failed to open project."],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"T-4cw2":["Pick a layout that matches what you're building. Each pack ships with folders, templates, and agent-readable descriptions. You can mix and match later."],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TKQ7K-":["Install"],"TP9_K5":["Token"],"TXrEYR":["No templates resolve here. Add one in this folder's Templates section, or in Settings → Templates."],"ThmUrC":["Could not finalize project setup. Try again."],"TmKshB":["Invalid token — check that it has repo scope"],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UBv8UK":["Delete Permanently"],"UQAp48":["Search templates"],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"Up2_7p":["Copy full path"],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"VdXv4D":["Clone from GitHub"],"W8uemY":["Pick a starter pack to scaffold folders, templates, and AI-readable rules."],"W8vpBM":["starter pack"],"WEzuMq":["Create a new Open Knowledge project in the folder of your choice."],"WL6puM":["Path resolves outside project"],"WPwDin":["Open folder on disk"],"WRNXKp":["Searching"],"WZ-vBy":["Permanently deletes <0>",["targetGitPath"],"</0> and all its git history. Working files stay in place. If the parent git repo is intentional (e.g. you cloned it), cancel and pick a location outside it."],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"WqLq6M":["Open with AI ",["displayName"]],"Wtw22s":["Installing"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X8kjQX":["Re-authenticate with GitHub"],"XU0OXn":["Enable auto-sync"],"XYlJJT":["Setting up"],"XyNe7f":["Electron bridge unavailable. Refresh and try again."],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YGIi_c":["Reinstall"],"YTLmTM":["Remove the parent <0>.git</0> folder"],"Y_kL7X":["Customize how the editor looks and behaves."],"YjhKI5":["Cloning..."],"YwPUUP":["This pack is already set up here."],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z8KDox":["Enter a folder name (e.g. brain)."],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"ZWgr0b":["In a subfolder"],"ZWolSV":["You picked the filesystem root (/). Scaffolding here will scan every file on this machine — make sure that's what you want."],"ZWyHmq":["This project"],"ZmGmNh":["Let's set up your project."],"_6IEmc":["Open in Terminal, No workspace"],"_K2CvV":["Template"],"_N2eSU":["org"],"_qD6mn":["Pick the folder where you've cloned it."],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"aIgBKf":["Can't nest projects. An Open Knowledge project already exists at <0>",["rootPath"],"</0>. Choose a location outside it, or open that project instead."],"aOp3hw":["Couldn't move to Trash"],"aWlJai":["Starting sign-in flow"],"a_u4ck":["Loading tags"],"adsMWO":["Resolving deltas"],"av_PD9":["you"],"b392Dr":["Expand All"],"b4itZn":["Working"],"bBE5tC":["Detected on this machine"],"bD8I7O":["Complete"],"bHboUQ":["Edit template"],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c5rF4v":["What is this knowledge base for?"],"c8iK2Y":["No templates found."],"cBbVqQ":["The folder name <0>",["rawName"],"</0> can't be used as a project identifier — it has no characters left after sanitization. Click Browse to pick a folder whose name contains at least one alphanumeric character."],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cnGeoo":["Delete"],"cqQyPB":["Folder name"],"csDS2L":["Available"],"d2uTPx":["Server error (HTTP ",["status"],")"],"dEgA5A":["Cancel"],"dGaH3A":["Create a token at <0>github.com/settings/tokens</0> with <1>repo</1> scope."],"dTaauv":["Reason: ",["reason"]],"e0NrBM":["Project"],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"eFJkVt":["Clone failed: ",["cloneError"]],"eSu2Xn":["Writes a project-MCP config for each selected tool; Claude also gets <0>.claude/launch.json</0>."],"ensWZc":["or start from scratch <0/>"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f65AOQ":["Start from"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fX82Jn":["Open Knowledge will create a <0>.ok/</0> folder here to track this project's metadata."],"fYKgzG":["Failed to load recent projects."],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gYz2ep":["Expires in ",["timeLabel"]],"gcV0dI":["The folders and templates are in place; there's nothing left to scaffold."],"ggs9f8":["Search files, folders, or commands"],"ghYcYZ":["File extension"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtmbUO":["Sign in to GitHub"],"hA8GQ6":["Will replace existing Open Knowledge entry"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hJu2pH":["This folder already has files. Add a name to create a new subfolder inside it."],"hSySVc":["Install handoff failed: ",["msg"]],"hYDc6B":["Name cannot be empty"],"hYFQsG":["Validating"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"he3ygx":["Copy"],"hwFOFD":["Settings failed to load"],"hxEUVJ":["Initialize ",["selectedPackName"]],"hynz2K":["Download started"],"i3f2kh":["No matching commands."],"i8dKs-":["Show all files"],"iH8pgl":["Back"],"iKSP5j":["Word wrap"],"iMCW9z":["Publish & copy link"],"iTylMl":["Templates"],"i_grbe":["Click Browse to pick or create a project folder."],"idD8Ev":["Saved"],"iqugog":["Initialize failed: ",["errorDetail"]],"jGJy-9":["Downloads ",["shareOwner"],"/",["shareRepo"]," from GitHub."],"jjtmV_":["First file name"],"jnXr0e":["Clone failed. Please try again."],"jol95m":["Failed to open Project Navigator."],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kolRU1":["Do you want to permanently delete instead?"],"l17ab4":["Could not write project files. Try a different location."],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lanW9H":["Sign in to clone"],"lhjq3G":["Reset ",["labelText"]," to default"],"ll2yNl":["Content directory"],"ls1N1w":["(missing)"],"m16xKo":["Add"],"mGaZwZ":["See the full install guide"],"mKZODc":["Adds the Open Knowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"mSJ3Rn":["Computing scaffold plan"],"mYLRjR":["You picked ~/Desktop. Open Knowledge will index everything on your desktop."],"mf37rL":["Retrying"],"mmpzAq":["Wrap long lines in the markdown source editor."],"muWKMD":["No response — try again"],"nNYV3Y":["and ",["remaining"]," more"],"nYKerc":["(user-level only)"],"nbfdhU":["Integrations"],"o2yoFu":["Reveal in Finder, No workspace"],"p2LEhJ":["Personal access token"],"pAlxX6":["Open this folder with Open Knowledge"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pdHb22":["GitHub App"],"pkAft1":["Search failed."],"prHfed":["Each selected tool gets an Open Knowledge MCP entry."],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qbfj1f":["Receiving objects"],"qo4zCg":["Path cannot contain backslashes"],"qvWGzP":["Collapse all"],"r51jLC":["File saved & Claude Desktop App opened"],"rEnIww":["Published to ",["ownerLogin"],"/",["repoName"],"."],"rlUzXK":["Could not validate folder. Please try again."],"s-XOaI":["File name"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sJK6pq":["Permission denied"],"saYiIO":["Path cannot contain null bytes"],"snrVQ7":["probe failed"],"tCelbM":["A folder named <0>",["sanitized"],"</0> already has files at this location. Pick a different name."],"tX5yOZ":["New Folder"],"tXkhj_":["Start"],"tfDRzk":["Save"],"uF9ruK":["Saving"],"u_lS4C":["Clone complete — opening project"],"uuoHOU":["Command failed."],"v-h2hx":["Delete ",["targetGitPath"]],"v41fCm":["File not found"],"vPYaz3":["Scaffold directly under this project."],"vQayZz":["Add a remote with <0>git remote add origin <url></0> in this project's directory. This page will update automatically once a remote is detected."],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"wJijgU":["Location"],"wTcjov":["No workspace"],"wbv9xO":["Create new project"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"y1t8bQ":["Settings sections"],"yQE2r9":["Loading"],"yu8Pzy":["Not detected"],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"z2G3EK":["<0>",["rawName"],"</0> has characters unsafe for the on-disk identifier, so the project will be created as <1>",["sanitized"],"</1>. Click Browse to pick a safer name."],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"zXZ0sB":["Open Knowledge initializes at <0>",["projectDir"],"</0> — the parent of <1>",["pickedRelative"],"</1> because it contains a <2>.git</2> folder (one .ok/ per git repo). <3>Content directory</3> defaults to <4>.</4> (the whole repo); type a sub-folder to narrow it."],"zXZJoN":["Add token"],"zwBp5t":["Private"]}`),Af=`en`;Of.load(Af,kf),Of.activate(Af);function jf(e){return`#/${encodeURIComponent(e)}`}function Mf(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(jf(e.doc))})}var Nf=4e3,Pf=1440*60*1e3;function Ff(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){X.success(`Opened existing Open Knowledge project at ${e.ancestorPath}`,{duration:Nf});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>lr[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`Open Knowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`;X[r?`error`:`success`](n,{duration:r?Pf:Nf});return}let t=ns(e.gitRoot,e.pickedPath)??e.pickedPath;X.success(`Initialized Open Knowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Nf})})}var If=!1;function Lf(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Nt(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Rf(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var zf=0,Bf=0,Vf=0,Hf=0,Uf=null,Wf=[`linkResolutionDecoration$`],Gf=new WeakSet,Kf=new WeakSet;function qf(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Jf(){return!1}function Yf(){return!Jf()}function Xf(e,t){if(Yf())return t;let n=`ok/cold/nodeview-factory-${qf(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Nt(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Zf(e){if(Yf())return;let t=e.state.plugins;for(let e of t){if(Kf.has(e))continue;let t=e.spec?.key?.key;if(!t||!Wf.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Kf.add(e);continue}let i=`ok/cold/decoration-${qf(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Nt(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Kf.add(e)}}function Qf(e){if(Yf())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=Xf(e,n);r.__okWrapped=!0,t[e]=r}}function $f(e){return Yf()?e:e.map(e=>{let t=e.name??`unknown`,n=qf(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Nt(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function ep(){if(!If){If=!0,Lf(Ln.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return Yf()||(Uf=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Rf(i.editorState),durationMs:r}}),Lf(Ln.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!Yf()&&!Gf.has(e)&&t.view&&(Zf(t.view),Qf(t.view),Gf.add(e)),{docSize:Rf(t.editorState)}}),Lf(Ln.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Hf+=1;let i=e;return!Yf()&&i.view&&Qf(i.view),{docSize:Rf(i.view),seq:Hf,durationMs:r}}),Lf(Yn.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Bf+=1,{seq:Bf,docSize:Rf(e.state),durationMs:r})),Lf(Yn.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Vf+=1,{seq:Vf,docSize:Rf(e.state),durationMs:r})),Lf(Fe.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{zf+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:zf,topLevelYElements:a,durationMs:r}}),Lf(lt.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Nt(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!Yf()&&e===`first-paint`&&Uf!==null)){let e=Uf,n=Math.max(0,t.startTime-e);Nt(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),Uf=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var tp=`Relaunch`,np=`Release notes`,rp=`Updates paused`,ip=`Download`,ap=`Reset to defaults`,op=`Relaunch failed — please restart manually`,sp=`Recovery action failed — please try again`;function cp(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function lp(e){return`Version ${e} ready to install`}function up(e){return`Updated to Version ${e}`}function dp(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var fp=0,pp=0,mp=1,hp=2,gp=3;function _p(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded`;t({id:i,body:lp(r),priority:hp,action:{label:tp,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:cp(op,e),variant:`error`,priority:mp})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:up(n),priority:gp,action:{label:np,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:rp,priority:pp,action:{label:ip,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function vp(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:cp(sp,e),variant:`error`,priority:fp})};n({id:i,body:dp(t.currentBuild),priority:fp,action:{label:ap,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var yp=[],bp=new Set,xp=!1;function Sp(){for(let e of bp)e()}function Cp(e){let t=yp.findIndex(t=>t.id===e.id);if(t===-1)yp=[...yp,e];else{let n=yp.slice();n[t]=e,yp=n}Sp()}function wp(e){let t=yp.filter(t=>t.id!==e);t.length!==yp.length&&(yp=t,Sp())}function Tp(){return yp}function Ep(e){return bp.add(e),()=>{bp.delete(e)}}function Dp(){if(xp||typeof window>`u`)return;let e=window.okDesktop;e&&(xp=!0,_p(e,Cp,wp),e.state.query().then(t=>{t.schemaIncompatibility&&vp(e,t.schemaIncompatibility,Cp,wp)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Op=`ok-omnibar-recents-v1`,kp=10;function Ap(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function jp(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Mp(e,t){return`${e}:${t}`}function Np(e){let t=jp(e);if(!t)return[];try{let e=t.getItem(Op);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Ap).slice(0,kp):[]}catch{return[]}}function Pp(e,t){let n=jp(t);if(n)try{n.setItem(Op,JSON.stringify(e.slice(0,kp)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Fp(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,kp)}function Ip(e,t){return e.filter(e=>t.has(Mp(e.kind,e.path)))}var Lp=50,Rp=30,zp=``,Bp=null;function Vp(e){return e.trim().toLowerCase()}function Hp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Up(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Wp(e,t,n=new Map,r=new Map){let i=[];for(let t of e){let e=r.get(t)?.modified,a=n.get(t);i.push({kind:`file`,path:t,name:cr(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:cr(e)});return i.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),i}function Gp(e){return In({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function Kp(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:dr(e.map(Gp))}}function qp(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function Jp(e){let t=qp(e);return Bp&&zp===t?Bp:(zp=t,Bp=Kp(e),Bp)}function Yp(e,t,n=Lp){return Xp(Jp(e),t,n)}function Xp(e,t,n=Lp){let r=Vp(t);return r?Hr(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function Zp(e,t){let n=Up(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(Hp).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function Qp(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=cr(e.path);return{kind:e.kind===`page`?`file`:`folder`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function $p(e,t={}){let n=e.trim();if(!n)return[];let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,scopes:[`page`,`folder`,`content`],limit:t.limit??Rp}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Fn(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(Qp).filter(e=>!!e)}function em(e,t,n=[]){let r=Vp(t);return r?Vp([e,...n].join(` `)).includes(r):!0}var tm=`tag:`;function nm(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function rm(e,t){return Me(e,t)}var im=I;async function am(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var om=`open-knowledge:doc-panel-tab`,sm=null;function cm(){let e=sm;return sm=null,e}function lm(e,t=typeof window>`u`?new EventTarget:window){sm=e,t.dispatchEvent(new CustomEvent(om,{detail:{tab:e}}))}function um(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(om,n),()=>t.removeEventListener(om,n)}var dm=[`.md`,`.mdx`];function fm(e){let t=e.toLowerCase();for(let e of dm)if(t.endsWith(e))return e;return null}function pm(e){let t=fm(e);return t?e.slice(0,-t.length):e}var mm=`__blank__`,hm={local:0,inherited:1};function gm(e){return[...e].sort((e,t)=>{let n=hm[e.scope]-hm[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}function _m(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function vm(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function ym(e){let t=e.fileName.trim(),n=fm(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function bm(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&e.altKey&&e.key.toLowerCase()===`n`)}function xm(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Sm(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{_:d}=Kt(),{addPage:f}=Nr(),p=Qa(u?null:a),m=u??p,[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`.md`),[x,S]=(0,Q.useState)(mm),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{if(n){w(null),k(null),D(!1),v(``),S(i===`file`&&s?s:mm),I(!1);let e=i===`file`?o??`untitled`:`index`,t=fm(e);b(t??`.md`),g(t?pm(e):e)}},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==m.state.data||t[7]!==m.state.status?(V=m.state.status===`ready`?gm(m.state.data.folder.templates_available??[]):[],t[6]=m.state.data,t[7]=m.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==m.state.data||t[10]!==m.state.status||t[11]!==n||t[12]!==x?(U=()=>{n&&x!==mm&&m.state.status===`ready`&&((m.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(mm))},t[9]=m.state.data,t[10]=m.state.status,t[11]=n,t[12]=x,t[13]=U):U=t[13];let W;t[14]!==m.state||t[15]!==n||t[16]!==x?(W=[n,x,m.state],t[14]=m.state,t[15]=n,t[16]=x,t[17]=W):W=t[17],(0,Q.useEffect)(U,W);let G=i===`file`,ee=m.state.status===`loading`||m.state.status===`idle`,te=m.state.status===`error`?m.state.message:null,ne;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){let t=fm(e);t?(b(t),g(pm(e))):g(e),w(null)},t[18]=ne):ne=t[18];let re=ne,ie;t[19]!==y||t[20]!==h||t[21]!==_||t[22]!==a||t[23]!==i?(ie=function(){return ym({kind:i,initialDir:a,fileName:h,fileExtension:y,folderName:_})},t[19]=y,t[20]=h,t[21]=_,t[22]=a,t[23]=i,t[24]=ie):ie=t[24];let ae=ie,oe;t[25]!==d||t[26]!==h||t[27]!==_||t[28]!==i?(oe=function(){if(i===`folder`){let e=_m(_.trim());if(e)return{message:d({id:`ODGGlj`,values:{detail:d(vm(e))}}),field:`folder`}}let e=_m(h.trim());return e?{message:d(vm(e)),field:`file`}:null},t[25]=d,t[26]=h,t[27]=_,t[28]=i,t[29]=oe):oe=t[29];let se=oe,ce;t[30]!==E||t[31]!==h||t[32]!==_||t[33]!==i?(ce=E||!h.trim()||i===`folder`&&!_.trim(),t[30]=E,t[31]=h,t[32]=_,t[33]=i,t[34]=ce):ce=t[34];let le=ce,ue;t[35]!==d||t[36]!==f||t[37]!==ae||t[38]!==se||t[39]!==i||t[40]!==l||t[41]!==r||t[42]!==x?(ue=async function(){let e=se();if(e){w(e.message),k(e.field);return}D(!0),w(null),k(null);let t=ae(),n=i===`file`&&x!==mm?x:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await T(e,d({id:`d2uTPx`,values:{status:t}}));if(!n.ok){D(!1),w(n.title),k(`form`);return}let o=Ur.safeParse(n.body);if(D(!1),!o.success){w(d(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),k(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,f(s),Wr([`files`,`backlinks`,`graph`]),l?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),D(!1),w(d({id:`HIb0vl`})),k(`form`)}},t[35]=d,t[36]=f,t[37]=ae,t[38]=se,t[39]=i,t[40]=l,t[41]=r,t[42]=x,t[43]=ue):ue=t[43];let de=ue,K;t[44]!==d||t[45]!==a?(K=a||d({id:`L6Hhh6`}),t[44]=d,t[45]=a,t[46]=K):K=t[46];let fe=K,pe;t[47]===i?pe=t[48]:(pe=(0,Z.jsx)(Ao,{children:i===`file`?(0,Z.jsx)(J,{id:`HdkSiO`}):(0,Z.jsx)(J,{id:`96G6Re`})}),t[47]=i,t[48]=pe);let me;t[49]!==c||t[50]!==fe?(me=c??(0,Z.jsx)(J,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[49]=c,t[50]=fe,t[51]=me):me=t[51];let he;t[52]===me?he=t[53]:(he=(0,Z.jsx)(Oo,{children:me}),t[52]=me,t[53]=he);let ge;t[54]!==pe||t[55]!==he?(ge=(0,Z.jsxs)(Bo,{children:[pe,he]}),t[54]=pe,t[55]=he,t[56]=ge):ge=t[56];let _e;t[57]!==x||t[58]!==G||t[59]!==N||t[60]!==F||t[61]!==P||t[62]!==H||t[63]!==te||t[64]!==ee?(_e=G&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{id:N,className:`mb-1.5 block text-sm font-medium`,children:(0,Z.jsx)(J,{id:`f65AOQ`})}),te?(0,Z.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:(0,Z.jsx)(J,{id:`sE7R19`,values:{templatesError:te}})}):null,(0,Z.jsx)(wm,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:x,onValueChange:S,templates:H,loading:ee}),!ee&&!te&&H.length===0?(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`TXrEYR`})}):null]}),t[57]=x,t[58]=G,t[59]=N,t[60]=F,t[61]=P,t[62]=H,t[63]=te,t[64]=ee,t[65]=_e):_e=t[65];let ve;t[66]!==d||t[67]!==C||t[68]!==O||t[69]!==A||t[70]!==j||t[71]!==_||t[72]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(J,{id:`cqQyPB`})}),(0,Z.jsx)(Wo,{ref:R,id:j,value:_,onChange:e=>{v(e.target.value),w(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":C&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":C&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=_m(_.trim());if(t){w(d({id:`ODGGlj`,values:{detail:d(vm(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[66]=d,t[67]=C,t[68]=O,t[69]=A,t[70]=j,t[71]=_,t[72]=i,t[73]=ve):ve=t[73];let ye;t[74]===i?ye=t[75]:(ye=i===`folder`?(0,Z.jsx)(J,{id:`jjtmV_`}):(0,Z.jsx)(J,{id:`s-XOaI`}),t[74]=i,t[75]=ye);let be;t[76]!==M||t[77]!==ye?(be=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:M,children:ye}),t[76]=M,t[77]=ye,t[78]=be):be=t[78];let xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>re(e.target.value),t[79]=xe):xe=t[79];let Se=i===`file`,Ce=C&&(O===`file`||O===`form`)?A:void 0,we=C&&(O===`file`||O===`form`)?!0:void 0,Te;t[80]!==de||t[81]!==le?(Te=e=>{e.key===`Enter`&&!le&&de()},t[80]=de,t[81]=le,t[82]=Te):Te=t[82];let Ee;t[83]!==M||t[84]!==h||t[85]!==Se||t[86]!==Ce||t[87]!==we||t[88]!==Te?(Ee=(0,Z.jsx)(Wo,{ref:L,id:M,value:h,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:Cm,onKeyDown:Te,className:`flex-1`}),t[83]=M,t[84]=h,t[85]=Se,t[86]=Ce,t[87]=we,t[88]=Te,t[89]=Ee):Ee=t[89];let De;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(De=e=>{(e===`.md`||e===`.mdx`)&&b(e)},t[90]=De):De=t[90];let Oe;t[91]===d?Oe=t[92]:(Oe=d({id:`ghYcYZ`}),t[91]=d,t[92]=Oe);let ke;t[93]===d?ke=t[94]:(ke=dm.map(e=>(0,Z.jsx)(Xo,{value:e,"aria-label":d({id:`GJ3011`,values:{ext:e}}),children:e},e)),t[93]=d,t[94]=ke);let Ae;t[95]!==y||t[96]!==Oe||t[97]!==ke?(Ae=(0,Z.jsx)($o,{type:`single`,value:y,onValueChange:De,variant:`outline`,"aria-label":Oe,className:`shrink-0`,children:ke}),t[95]=y,t[96]=Oe,t[97]=ke,t[98]=Ae):Ae=t[98];let je;t[99]!==Ee||t[100]!==Ae?(je=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Ee,Ae]}),t[99]=Ee,t[100]=Ae,t[101]=je):je=t[101];let Me;t[102]!==C||t[103]!==A?(Me=C&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:C}),t[102]=C,t[103]=A,t[104]=Me):Me=t[104];let Ne;t[105]!==be||t[106]!==je||t[107]!==Me?(Ne=(0,Z.jsxs)(`div`,{children:[be,je,Me]}),t[105]=be,t[106]=je,t[107]=Me,t[108]=Ne):Ne=t[108];let Pe;t[109]!==_e||t[110]!==ve||t[111]!==Ne?(Pe=(0,Z.jsx)(Lo,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[_e,ve,Ne]})}),t[109]=_e,t[110]=ve,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]===r?Fe=t[114]:(Fe=()=>r(!1),t[113]=r,t[114]=Fe);let Ie;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(J,{id:`dEgA5A`}),t[115]=Ie):Ie=t[115];let q;t[116]!==E||t[117]!==Fe?(q=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:Fe,disabled:E,children:Ie}),t[116]=E,t[117]=Fe,t[118]=q):q=t[118];let Le;t[119]===E?Le=t[120]:(Le=E?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[119]=E,t[120]=Le);let Re;t[121]!==de||t[122]!==le||t[123]!==Le?(Re=(0,Z.jsx)(Y,{onClick:de,disabled:le,children:Le}),t[121]=de,t[122]=le,t[123]=Le,t[124]=Re):Re=t[124];let ze;t[125]!==q||t[126]!==Re?(ze=(0,Z.jsxs)(Ro,{children:[q,Re]}),t[125]=q,t[126]=Re,t[127]=ze):ze=t[127];let Be;t[128]!==ge||t[129]!==Pe||t[130]!==ze?(Be=(0,Z.jsxs)(Po,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,Pe,ze]}),t[128]=ge,t[129]=Pe,t[130]=ze,t[131]=Be):Be=t[131];let Ve;return t[132]!==r||t[133]!==n||t[134]!==Be?(Ve=(0,Z.jsx)(Vo,{open:n,onOpenChange:r,children:Be}),t[132]=r,t[133]=n,t[134]=Be,t[135]=Ve):Ve=t[135],Ve}function Cm(e){return xm(e.currentTarget)}function wm(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=Kt(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let m=f,h=o===mm,g=i?d:void 0,_=`${r} ${n}`,v;t[5]!==h||t[6]!==l||t[7]!==m?.name||t[8]!==m?.title||t[9]!==o?(v=l?(0,Z.jsx)(J,{id:`Hl89Qd`}):h?(0,Z.jsx)(J,{id:`E7BhZn`}):m?.title??m?.name??o,t[5]=h,t[6]=l,t[7]=m?.name,t[8]=m?.title,t[9]=o,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`span`,{className:`truncate`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==h||t[14]!==l||t[15]!==m?(b=!l&&!h&&m?(0,Z.jsx)(Om,{entry:m}):null,t[13]=h,t[14]=l,t[15]=m,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(nc,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=S):S=t[20];let C;t[21]!==l||t[22]!==i||t[23]!==g||t[24]!==_||t[25]!==x||t[26]!==n?(C=(0,Z.jsx)(Gt,{asChild:!0,children:(0,Z.jsxs)(Y,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":g,"aria-labelledby":_,disabled:l,className:`w-full justify-between font-normal`,children:[x,S]})}),t[21]=l,t[22]=i,t[23]=g,t[24]=_,t[25]=x,t[26]=n,t[27]=C):C=t[27];let w;t[28]===u?w=t[29]:(w=u({id:`UQAp48`}),t[28]=u,t[29]=w);let T;t[30]===w?T=t[31]:(T=(0,Z.jsx)(Ee,{placeholder:w}),t[30]=w,t[31]=T);let E;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`c8iK2Y`})}),t[32]=E):E=t[32];let O;t[33]!==a||t[34]!==s?(O=()=>{s(mm),a(!1)},t[33]=a,t[34]=s,t[35]=O):O=t[35];let k=o===mm?`opacity-100`:`opacity-0`,j;t[36]===k?j=t[37]:(j=Di(`mt-1 size-4 shrink-0`,k),t[36]=k,t[37]=j);let M;t[38]===j?M=t[39]:(M=(0,Z.jsx)(Eo,{className:j,"aria-hidden":`true`}),t[38]=j,t[39]=M);let N;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`E7BhZn`})}),t[40]=N):N=t[40];let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[N,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hZoBHK`})})]}),t[41]=P):P=t[41];let F;t[42]!==O||t[43]!==M?(F=(0,Z.jsxs)(D,{value:`Blank note empty`,onSelect:O,className:`items-start gap-3`,children:[M,P]}),t[42]=O,t[43]=M,t[44]=F):F=t[44];let I;if(t[45]!==a||t[46]!==s||t[47]!==c||t[48]!==o){let e;t[50]!==a||t[51]!==s||t[52]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(D,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Eo,{className:Di(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(Om,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[50]=a,t[51]=s,t[52]=o,t[53]=e):e=t[53],I=c.map(e),t[45]=a,t[46]=s,t[47]=c,t[48]=o,t[49]=I}else I=t[49];let L;t[54]!==d||t[55]!==F||t[56]!==I?(L=(0,Z.jsxs)(z,{id:d,className:`subtle-scrollbar`,children:[E,F,I]}),t[54]=d,t[55]=F,t[56]=I,t[57]=L):L=t[57];let R;t[58]!==T||t[59]!==L?(R=(0,Z.jsx)(K,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Dm,onWheel:Em,onTouchMove:Tm,children:(0,Z.jsxs)(p,{children:[T,L]})}),t[58]=T,t[59]=L,t[60]=R):R=t[60];let B;return t[61]!==a||t[62]!==i||t[63]!==R||t[64]!==C?(B=(0,Z.jsxs)(H,{open:i,onOpenChange:a,children:[C,R]}),t[61]=a,t[62]=i,t[63]=R,t[64]=C,t[65]=B):B=t[65],B}function Tm(e){e.stopPropagation()}function Em(e){e.stopPropagation()}function Dm(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function Om(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Di(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(J,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(Be,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function km(e){return e.split(`/`).pop()??e}function Am(e,t){let n=new Map;for(let e of t?.folders??[])n.set(e.path,e.summary);let r=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:n.get(km(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:km(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function jm(e){let t=(0,$.c)(20),{plan:n,selectedPack:r}=e,i,a,o,s,c,l;if(t[0]!==n||t[1]!==r){let e=[...Am(n,r)].sort(Pm),u=new Set(e.map(Nm));c=`space-y-2`,t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-primary`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center`,children:`◇`}),`What gets created`]}),t[8]=l):l=t[8],s=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,i=`Items to be created`,a=`py-1.5`,o=e.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let i=t.slice(0,e).join(`/`);u.has(i)&&(n++,r=e)}let i=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),a=e.kind===`folder`;return(0,Z.jsxs)(`li`,{className:`relative flex min-w-0 items-center gap-1.5 py-1 pr-3`,style:{paddingLeft:`${12+n*16}px`},children:[Array.from({length:n},Mm),a?(0,Z.jsx)(bc,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0 text-foreground/80`,children:i}),a&&e.description?(0,Z.jsxs)(jn,{children:[(0,Z.jsx)(En,{"aria-label":`Show description`,className:`flex shrink-0 cursor-help rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(er,{children:e.description})]}):null]},e.name)}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];let u;t[9]!==i||t[10]!==a||t[11]!==o?(u=(0,Z.jsx)(`ul`,{"aria-label":i,className:a,children:o}),t[9]=i,t[10]=a,t[11]=o,t[12]=u):u=t[12];let d;t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{className:s,children:u}),t[13]=s,t[14]=u,t[15]=d):d=t[15];let f;return t[16]!==c||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{className:c,children:[l,d]}),t[16]=c,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function Mm(e,t){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0 bottom-0 w-px bg-border/50`,style:{left:`${12+t*16+8}px`}},`guide:${t}`)}function Nm(e){return e.name.replace(/\/$/,``)}function Pm(e,t){return e.name.localeCompare(t.name)}async function Fm(e){let t=await e.json().catch(()=>null),n=gr.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function Im(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:e.seed.plan,apply:e.seed.apply,listPacks:e.seed.listPacks}:{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Fm(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Fm(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result}:{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var Lm={"knowledge-base":Ec,"software-lifecycle":k,"plain-notes":tl,worldbuilding:lc,"writing-pipeline":Rc,gbrain:Mc};function Rm(e){return Lm[e]??Ec}function zm(e){let t=(0,$.c)(28),{onPackSelect:n,className:r,packs:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=i===void 0,u,d;t[0]===l?(u=t[1],d=t[2]):(u=()=>{if(!l)return;let e=!1;return(async()=>{try{let t=await Im().listPacks();if(e)return;t.ok?o(t.packs):c(t.error.message)}catch(t){let n=t;if(e)return;c(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},d=[l],t[0]=l,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f=l?a:i;if(s!==null){let e;t[3]===r?e=t[4]:(e=Di(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[3]=r,t[4]=e);let n;return t[5]!==s||t[6]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,s]}),t[5]=s,t[6]=e,t[7]=n):n=t[7],n}if(f===null){let e;t[8]===r?e=t[9]:(e=Di(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},Vm).map(Bm),t[10]=n):n=t[10];let i;return t[11]!==e||t[12]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[11]=e,t[12]=n,t[13]=i):i=t[13],i}if(f.length===0){let e;t[14]===r?e=t[15]:(e=Di(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,r),t[14]=r,t[15]=e);let n;return t[16]===e?n=t[17]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[16]=e,t[17]=n),n}let p;t[18]===r?p=t[19]:(p=Di(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[18]=r,t[19]=p);let m;if(t[20]!==n||t[21]!==f){let e;t[23]===n?e=t[24]:(e=e=>(0,Z.jsx)(Hm,{pack:e,onSelect:()=>n(e.id)},e.id),t[23]=n,t[24]=e),m=f.map(e),t[20]=n,t[21]=f,t[22]=m}else m=t[22];let h;return t[25]!==p||t[26]!==m?(h=(0,Z.jsx)(`div`,{className:p,children:m}),t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function Bm(e){return(0,Z.jsx)(Wm,{},`skeleton-${e}`)}function Vm(e,t){return t}function Hm(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Rm(n.id),t[0]=n.id,t[1]=i);let a=i,{files:o,folders:s}=n.entryCounts,c;t[2]===a?c=t[3]:(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 items-center justify-center rounded-lg bg-primary/5 text-primary`,children:(0,Z.jsx)(a,{className:`size-4`})}),t[2]=a,t[3]=c);let l;t[4]===n.name?l=t[5]:(l=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.description?d=t[10]:(d=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==s?(p=Um({files:o,folders:s}),t[14]=o,t[15]=s,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`p`,{className:`mt-auto pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==r||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[f,m]}),t[19]=r,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Um({files:e,folders:t}){let n=e>0?`${e} ${e===1?`file`:`files`}`:null,r=`${t} ${t===1?`folder`:`folders`}`;return n?`${n} · ${r}`:r}function Wm(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(nt,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}function Gm(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ku,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Km(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ju,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(qu,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var qm=`knowledge-base`;function Jm(e){let t=(0,$.c)(68),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Kt(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??qm),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Im().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??qm),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(Ym),Im().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Im().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);X.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let e=x?.name??o({id:`W8vpBM`}),n=t.result.applied,a=o(n===0?{id:`K6jjWB`,values:{packName:e}}:{id:`x3-2ta`,values:{packName:e,projectEntries:n}});X.success(a),i?.(),r(!1)}else{let n=t.error.message;X.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F;t[21]!==o||t[22]!==x||t[23]!==v?(F=v===`configure`&&x?x.description:o({id:`T-4cw2`}),t[21]=o,t[22]=x,t[23]=v,t[24]=F):F=t[24];let I=F,L;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){p(e),y(`configure`),b.current=!0},t[25]=L):L=t[25];let R=L,z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[26]=z):z=t[26];let B=z,V;t[27]===P?V=t[28]:(V=(0,Z.jsx)(Ao,{children:P}),t[27]=P,t[28]=V);let H;t[29]===I?H=t[30]:(H=(0,Z.jsx)(Oo,{children:I}),t[29]=I,t[30]=H);let U;t[31]!==V||t[32]!==H?(U=(0,Z.jsxs)(Bo,{children:[V,H]}),t[31]=V,t[32]=H,t[33]=U):U=t[33];let W;t[34]!==u||t[35]!==c||t[36]!==m||t[37]!==x||t[38]!==v||t[39]!==g?(W=v===`pick`?(0,Z.jsx)(Lo,{children:(0,Z.jsx)(zm,{packs:u,onPackSelect:R})}):(0,Z.jsxs)(Lo,{className:`space-y-6`,children:[(0,Z.jsx)(Xm,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Zm,{phase:c,selectedPack:x})]}),t[34]=u,t[35]=c,t[36]=m,t[37]=x,t[38]=v,t[39]=g,t[40]=W):W=t[40];let G;t[41]!==M||t[42]!==v?(G=v===`configure`&&!M?(0,Z.jsxs)(Y,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:B,children:[(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(J,{id:`iH8pgl`})]}):null,t[41]=M,t[42]=v,t[43]=G):G=t[43];let ee;t[44]===r?ee=t[45]:(ee=()=>r(!1),t[44]=r,t[45]=ee);let te;t[46]===c.kind?te=t[47]:(te=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(J,{id:`yz7wBu`}):(0,Z.jsx)(J,{id:`dEgA5A`}),t[46]=c.kind,t[47]=te);let ne;t[48]!==ee||t[49]!==te?(ne=(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,onClick:ee,children:te}),t[48]=ee,t[49]=te,t[50]=ne):ne=t[50];let re;t[51]!==j||t[52]!==c.kind||t[53]!==v||t[54]!==O?(re=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(Y,{onClick:j,disabled:O,children:(0,Z.jsx)(J,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(Y,{disabled:!0,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`XYlJJT`})]}):null,t[51]=j,t[52]=c.kind,t[53]=v,t[54]=O,t[55]=re):re=t[55];let ie;t[56]!==G||t[57]!==ne||t[58]!==re?(ie=(0,Z.jsxs)(Ro,{children:[G,ne,re]}),t[56]=G,t[57]=ne,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]!==U||t[61]!==W||t[62]!==ie?(ae=(0,Z.jsxs)(Po,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[U,W,ie]}),t[60]=U,t[61]=W,t[62]=ie,t[63]=ae):ae=t[63];let oe;return t[64]!==r||t[65]!==n||t[66]!==ae?(oe=(0,Z.jsx)(Vo,{open:n,onOpenChange:r,children:ae}),t[64]=r,t[65]=n,t[66]=ae,t[67]=oe):oe=t[67],oe}function Ym(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Xm(e){let t=(0,$.c)(21),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`3wiBAs`})}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(lo,{children:(0,Z.jsx)(J,{id:`RSqaSd`})}),t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ro,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(co,{orientation:`horizontal`,children:[(0,Z.jsxs)(Ja,{children:[l,(0,Z.jsx)(La,{className:`text-1sm`,children:(0,Z.jsx)(J,{id:`vPYaz3`})})]}),(0,Z.jsx)(Km,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(lo,{children:(0,Z.jsx)(J,{id:`ZWgr0b`})}),t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(La,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(J,{id:`GUpclA`})}),t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==r?(p=n===`subfolder`&&(0,Z.jsx)(Wo,{value:r,onChange:e=>o(e.target.value),placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=n,t[8]=o,t[9]=i,t[10]=r,t[11]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,Z.jsxs)(Ja,{children:[d,f,p]}),t[12]=p,t[13]=m);let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Km,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=h):h=t[14];let g;t[15]===m?g=t[16]:(g=(0,Z.jsx)(ro,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(co,{orientation:`horizontal`,children:[m,h]})}),t[15]=m,t[16]=g);let _;return t[17]!==n||t[18]!==g||t[19]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(Gm,{className:`sm:flex`,value:n,onValueChange:c,children:[u,g]})]}),t[17]=n,t[18]=g,t[19]=c,t[20]=_):_=t[20],_}function Zm(e){let t=(0,$.c)(13),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`mSJ3Rn`})]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(J,{id:`YwPUUP`})}),t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`gcV0dI`})})]}),t[4]=n):n=t[4],n}let i;t[5]!==n.plan||t[6]!==r?(i=(0,Z.jsx)(jm,{plan:n.plan,selectedPack:r}),t[5]=n.plan,t[6]=r,t[7]=i):i=t[7];let a;t[8]===n.plan.warnings?a=t[9]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(Qm)}):null,t[8]=n.plan.warnings,t[9]=a);let o;return t[10]!==i||t[11]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[10]=i,t[11]=a,t[12]=o):o=t[12],o}function Qm(e){return(0,Z.jsx)(`p`,{children:e},e)}var $m=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],eh=$m.filter(e=>e.id!==`claude-cowork`),th=`#settings`;function nh(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function rh(e){return e.replace(/^#/,``)===`settings`}function ih(){return typeof window>`u`?``:window.location.hash}function ah(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(sh),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,Q.startTransition)(()=>{n(rh(ih()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a=oh,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function oh(){typeof window>`u`||rh(ih())&&window.history.back()}function sh(){return rh(ih())}function ch(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(dh),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(uh);if(!e||!t.ok)return;let i=Ar.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(lh),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function lh(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function uh(){return null}function dh(){return fh()}function fh(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function ph(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function mh(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Fn(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function hh(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?ph(e):mh()}var gh=`ok:skill:cowork:installed`,_h=`1`,vh=250,yh=`/api/skill/install-state`;function bh(e){return`${gh}:v${e}`}var xh=new Map;async function Sh(e={},t={}){let n=t.force?`__force__`:`__default__`,r=xh.get(n);if(r)return r;let i=Ch(e,t);return xh.set(n,i),i.finally(()=>{xh.get(n)===i&&xh.delete(n)}),i}async function Ch(e,t){let n=e.installer===void 0?hh():e.installer,r=wh(e.storage),i=e.fetchSnapshot??Eh,a=e.serverTimeoutMs??vh,o=null;if(!t.force){try{o=await Dh(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=bh(o?.currentVersion??e.fallbackSkillVersion??Th());if(!t.force&&r?.getItem(s)===_h)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,_h)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function wh(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Th(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Eh(){let e;try{e=await fetch(yh,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Dh(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Oh(e){return Sh({},e)}function kh(){return Sh({},{force:!0})}async function Ah(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function jh(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ah({target:`claude-cowork`,url:Lr({mode:`cowork`},e)},n);case`claude-code`:return Ah({target:`claude-code`,url:Lr({mode:`code`},e)},n);case`codex`:return Ah({target:`codex`,url:zr(e)},n);case`cursor`:return Ah({target:`cursor`,url:ii(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Mh(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Nh(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Nh(e)}}}function Nh(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function Ph(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function Fh(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Ih(e){return`${e}.md`}function Lh(e){if(!e.docName||!e.workspace)return null;let t=Ih(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Fh(n,t,r)}}function Rh(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function zh(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Bh(e){return Mh(e.installUrl).then(()=>void 0)}function Vh(e){return`Opened in ${e}.`}function Hh(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Uh(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Wh(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}function Gh(e){return e.docContext===null?e.folderRelativePath?vi(e.folderRelativePath):bi():jr(e.docContext.relativePath)}async function Kh(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:Gh(t)},a=await n.dispatchHandoff(i),o=Wh(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Vh(s));else{let i=Uh(r),a=Hh(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Kh(e,t,n,r+1)}}})}return a}function qh(e){return $m.find(t=>t.id===e)?.displayName??e}function Jh(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Yh(){return{dispatchHandoff:jh,recordHandoff:Ph,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Jh(),getDisplayName:qh,ensureCoworkSkillInstalled:Oh}}function Xh(){return{dispatch:(e,t)=>Kh(e,t,Yh()),reinstallCoworkSkill:kh}}var Zh=[...new Set($m.flatMap(e=>e.schemes))];function Qh(e,t){let n=t.now?.()??Date.now(),r={};for(let t of $m){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function $h(e){return Qh({},e)}async function eg(e){let t=e.schemes??Zh,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var tg=Object.fromEntries(Zh.map(e=>[e,{installed:!1}]));async function ng(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return tg}if(!t.ok)return tg;let n;try{n=await t.json()}catch{return tg}if(typeof n!=`object`||!n||Array.isArray(n))return tg;let r=n,i={};for(let e of Zh)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function rg(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function ig(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=$h({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Qh(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!rg(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function ag(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function og(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>eg({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>ng({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function sg(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(cg),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=ig(og());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function cg(){return $h({isElectronHost:ag(),now:Date.now})}var lg=3e3,ug=(e,t,n)=>pl(e,t,n,`CommandPalette`);function dg(e){window.location.assign(kr(e))}function fg(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:_i(t)}function pg(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?ye:E,s;t[0]===n?s=t[1]:(s=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=s);let c=s,l=`snippet`in n?n.snippet:void 0,u=`${n.kind} ${n.path}`,d=`command-palette-nav-${n.kind}-${n.path}`,f;t[2]===o?f=t[3]:(f=(0,Z.jsx)(o,{className:`mt-0.5`}),t[2]=o,t[3]=f);let p;t[4]!==a||t[5]!==c?(p=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(mg,{query:a,text:c})}),t[4]=a,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==n.path||t[8]!==a?(m=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(mg,{query:a,text:n.path})}),t[7]=n.path,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==l?(h=l?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(mg,{query:a,text:l})}):null,t[10]=a,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[p,m,h]}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==i||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==g?(_=(0,Z.jsxs)(D,{value:u,onSelect:i,"data-testid":d,className:`items-start`,children:[f,g]}),t[17]=i,t[18]=u,t[19]=d,t[20]=f,t[21]=g,t[22]=_):_=t[22],_}function mg(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=Zp(n,r).map(hg),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function hg(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function gg({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function _g(e){let t=(0,$.c)(151),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=Kt(),[s,c]=(0,Q.useState)(``),l=(0,Q.useDeferredValue)(s),u=l.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(`idle`),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[1]=g):g=t[1];let[_,v]=(0,Q.useState)(g),y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],t[2]=y):y=t[2];let[b,x]=(0,Q.useState)(y),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[3]=O):O=t[3];let[k,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(`idle`),P;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[4]=P):P=t[4];let[F,I]=(0,Q.useState)(P),[L,R]=(0,Q.useState)(`idle`),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),{activeDocName:U,activeTarget:W}=dt(),{pages:G,pageTitles:ee,pageMeta:te,folderPaths:ne}=Nr(),re=ch(),{states:ie,refresh:ae}=sg(),{dispatch:oe}=Xh(),se=Lh({docName:U,workspace:re}),ce=Wp(G,ne,ee,te),le=Ip(b,new Set(ce.map(bg))),ue=a?.config.projectPath??null,de=a?_.filter(e=>e.path!==ue):[],K;t[5]!==U||t[6]!==W?(K=fg(W,U),t[5]=U,t[6]=W,t[7]=K):K=t[7];let fe=K,pe=u===``?[]:Yp(ce,u,8),me,he;t[8]!==i||t[9]!==r?(me=()=>{let e=function(e){e.key===`k`&&(Ti()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},he=[i,r],t[8]=i,t[9]=r,t[10]=me,t[11]=he):(me=t[10],he=t[11]),(0,Q.useEffect)(me,he);let ge,_e;t[12]!==o||t[13]!==a||t[14]!==r||t[15]!==ae?(ge=()=>{if(r){if(x(Np()),ae(),a){let e=!1;return ug(async()=>{let t=await a.project.listRecent();e||v(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}c(``),j([]),N(`idle`),B.current=!1,I([]),R(`idle`)},_e=[r,a,ae,o],t[12]=o,t[13]=a,t[14]=r,t[15]=ae,t[16]=ge,t[17]=_e):(ge=t[16],_e=t[17]),(0,Q.useEffect)(ge,_e);let ve;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>{V.current&&(V.current.scrollTop=0)},t[18]=ve):ve=t[18];let xe;t[19]===s?xe=t[20]:(xe=[s],t[19]=s,t[20]=xe),(0,Q.useEffect)(ve,xe);let we=nm(l,new Set(k.map(yg))),Te=we.kind!==`normal`,De=we.kind===`tag-list`?we.query:``,Oe=we.kind===`tag-docs`?we.tagName:``,ke,Ae;t[21]!==Te||t[22]!==r?(ke=()=>{if(!r||!Te||B.current)return;B.current=!0,N(`loading`);let e=!1;return im().then(t=>{e||(j(t),N(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),j([]),N(`error`))}),()=>{e=!0}},Ae=[r,Te],t[21]=Te,t[22]=r,t[23]=ke,t[24]=Ae):(ke=t[23],Ae=t[24]),(0,Q.useEffect)(ke,Ae);let je=we.kind===`tag-docs`?we.tagName:null;(0,Q.useEffect)(()=>{if(!r||je===null){I([]),R(`idle`);return}R(`loading`),I([]);let e=!1;return am(je).then(t=>{e||(I(t),R(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),I([]),R(`error`))}),()=>{e=!0}},[r,je]),(0,Q.useEffect)(()=>{if(!r||!u||Te){p([]),h(`idle`);return}let e=new AbortController;h(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),p([]),h(`error`)},lg);return $p(u,{signal:e.signal}).then(e=>{window.clearTimeout(n),p(e),h(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(p([]),h(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,u,Te]);let Me;t[25]!==o||t[26]!==i?(Me=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),ug(async()=>{await e()},n)},t[25]=o,t[26]=i,t[27]=Me):Me=t[27];let Ne=Me,Pe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Fp(Np(),t);Pp(n),x(n)},t[28]=Pe):Pe=t[28];let Fe=Pe,Ie;t[29]===i?Ie=t[30]:(Ie=function(e){i(!1),Fe(e),dg(e.path)},t[29]=i,t[30]=Ie);let q=Ie,Le=!Te&&u===``&&le.length>0,Re=gg({searchResults:f,fallbackSearchResults:pe,searchStatus:m}),ze=!Te&&Re.length>0,Be=!Te&&u!==``&&m===`loading`&&!ze,Ve;t[31]!==o||t[32]!==l||t[33]!==Te?(Ve=!Te&&em(o({id:`HdkSiO`}),l,[`create file`]),t[31]=o,t[32]=l,t[33]=Te,t[34]=Ve):Ve=t[34];let He=Ve,Ue;t[35]!==o||t[36]!==l||t[37]!==Te?(Ue=!Te&&em(o({id:`96G6Re`}),l,[`create folder`]),t[35]=o,t[36]=l,t[37]=Te,t[38]=Ue):Ue=t[38];let We=Ue,Ge;t[39]!==o||t[40]!==U||t[41]!==l||t[42]!==Te?(Ge=!Te&&U!==null&&em(o({id:`3Fcb0I`}),l,[`graph panel network`]),t[39]=o,t[40]=U,t[41]=l,t[42]=Te,t[43]=Ge):Ge=t[43];let Ke=Ge,qe;t[44]!==o||t[45]!==l||t[46]!==Te?(qe=!Te&&em(o({id:`fWi7pn`}),l,[`scaffold`,`seed`,`pack`,`starter`]),t[44]=o,t[45]=l,t[46]=Te,t[47]=qe):qe=t[47];let Je=qe,Ye;t[48]!==o||t[49]!==a||t[50]!==l||t[51]!==Te?(Ye=!Te&&a!==null&&em(o({id:`WPwDin`}),l,[`project`]),t[48]=o,t[49]=a,t[50]=l,t[51]=Te,t[52]=Ye):Ye=t[52];let Xe=Ye,Ze;t[53]!==o||t[54]!==a||t[55]!==l||t[56]!==Te?(Ze=!Te&&a!==null&&em(o({id:`2Xs2jo`}),l,[`switch project navigator projects`]),t[53]=o,t[54]=a,t[55]=l,t[56]=Te,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==o||t[59]!==l||t[60]!==Te?($e=!Te&&em(o({id:`Tz0i8g`}),l,[`preferences config`]),t[58]=o,t[59]=l,t[60]=Te,t[61]=$e):$e=t[61];let et=$e,tt;t[62]!==o||t[63]!==l||t[64]!==Te?(tt=!Te&&em(o({id:`62Pc08`}),l,[`claude desktop install cowork`]),t[62]=o,t[63]=l,t[64]=Te,t[65]=tt):tt=t[65];let nt=tt,rt=!Te&&a!==null&&de.length>0&&(u===``||de.some(e=>em(`${e.name} ${e.path}`,l,[`open recent project`]))),it=!Te&&se!==null&&(u===``||eh.some(e=>{let t=e.displayName;return em(o({id:`WqLq6M`,values:{displayName:t}}),l,[e.id,`agent handoff`,`open in`])})),at=we.kind===`tag-list`?rm(k,we.query):[],ot=we.kind===`tag-list`&&M!==`loading`&&at.length===0,st=we.kind===`tag-docs`&&L===`success`&&F.length===0,ct=Te||Le||ze||Be||He||We||Ke||Je||Xe||Qe||et||nt||rt||it,lt;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(lt=function(e){c(`${tm}${e}`)},t[66]=lt):lt=t[66];let ut=lt,ft=Ce,pt;t[67]===o?pt=t[68]:(pt=o({id:`1bDVu5`}),t[67]=o,t[68]=pt);let mt;t[69]===o?mt=t[70]:(mt=o({id:`5GRxoA`}),t[69]=o,t[70]=mt);let ht;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ht={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[71]=ht):ht=t[71];let gt;t[72]===o?gt=t[73]:(gt=o({id:`ggs9f8`}),t[72]=o,t[73]=gt);let _t;t[74]!==s||t[75]!==gt?(_t=(0,Z.jsx)(Ee,{ref:H,value:s,onValueChange:c,placeholder:gt}),t[74]=s,t[75]=gt,t[76]=_t):_t=t[76];let vt;t[77]===Te?vt=t[78]:(vt=()=>{c(Te?``:tm),H.current?.focus()},t[77]=Te,t[78]=vt);let yt=Te?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,bt;t[79]===yt?bt=t[80]:(bt=Di(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,yt),t[79]=yt,t[80]=bt);let St,Ct;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,Z.jsx)(Se,{className:`size-3.5`}),Ct=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`0rwwOn`})}),t[81]=St,t[82]=Ct):(St=t[81],Ct=t[82]);let wt;t[83]!==Te||t[84]!==vt||t[85]!==bt?(wt=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:vt,"data-testid":`command-palette-filter-tag`,"data-active":Te,"aria-pressed":Te,className:bt,children:[St,Ct]})}),t[83]=Te,t[84]=vt,t[85]=bt,t[86]=wt):wt=t[86];let Tt=z,Et;t[87]!==ze||t[88]!==Be?(Et=Be&&!ze?(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`WRNXKp`})}):null,t[87]=ze,t[88]=Be,t[89]=Et):Et=t[89];let Dt=ct?null:(0,Z.jsx)(A,{children:m===`error`?(0,Z.jsx)(J,{id:`pkAft1`}):(0,Z.jsx)(J,{id:`i3f2kh`})}),Ot=we.kind===`tag-list`?(0,Z.jsxs)(be,{heading:we.query?o({id:`evs0iw`,values:{tagListQuery:De}}):o({id:`2QM24L`}),children:[M===`loading`?(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`a_u4ck`})}):null,M===`error`?(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`MZoxVx`})}):null,ot?(0,Z.jsx)(A,{children:we.query?o({id:`X0ttSN`,values:{tagListQuery:De}}):o({id:`JLUTgi`})}):null,at.map(e=>(0,Z.jsxs)(D,{value:`tag ${e.name}`,onSelect:()=>ut(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(Se,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(J,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,At=we.kind===`tag-docs`?(0,Z.jsxs)(be,{heading:o({id:`hGmuTc`,values:{tagDocsName:Oe}}),children:[L===`loading`?(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`pWbsW6`})}):null,L===`error`?(0,Z.jsx)(A,{children:(0,Z.jsx)(J,{id:`48uGTI`})}):null,st?(0,Z.jsx)(A,{children:o({id:`NIWAux`,values:{tagDocsName:Oe}})}):null,F.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==we.tagName).map(vg).join(`, `);return(0,Z.jsxs)(D,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),dg(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(E,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==we.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(J,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,jt=Le?(0,Z.jsx)(be,{heading:o({id:`MmDDWK`}),children:le.map(e=>(0,Z.jsx)(pg,{entry:e,onSelect:()=>q(e)},Mp(e.kind,e.path)))}):null,Mt;t[90]!==o||t[91]!==U||t[92]!==i||t[93]!==C||t[94]!==T||t[95]!==He||t[96]!==We||t[97]!==Ke||t[98]!==Je?(Mt=He||We||Ke||Je?(0,Z.jsxs)(be,{heading:o({id:`45MZFs`}),children:[He?(0,Z.jsxs)(D,{value:`new file create file`,onSelect:()=>{i(!1),C(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(mc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`HdkSiO`})})]}):null,We?(0,Z.jsxs)(D,{value:`new folder create folder`,onSelect:()=>{i(!1),C(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(yc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`96G6Re`})})]}):null,Ke?(0,Z.jsxs)(D,{value:`open graph graph panel network`,onSelect:()=>{U&&(i(!1),lm(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Mc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`3Fcb0I`})})]}):null,Je?(0,Z.jsxs)(D,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),T(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(Pc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`fWi7pn`})})]}):null]}):null,t[90]=o,t[91]=U,t[92]=i,t[93]=C,t[94]=T,t[95]=He,t[96]=We,t[97]=Ke,t[98]=Je,t[99]=Mt):Mt=t[99];let Nt=it?(0,Z.jsx)(be,{heading:o({id:`O7_W_a`}),children:eh.filter(e=>{let t=e.displayName;return em(o({id:`WqLq6M`,values:{displayName:t}}),l,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=ie[e.id],n=t.installed===!0&&se!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`1ZpfyB`,values:{displayName:r,hint:a}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(D,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!se||(i(!1),oe(e.id,se))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`WqLq6M`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,Pt;t[100]!==o||t[101]!==a||t[102]!==i||t[103]!==Ne||t[104]!==nt||t[105]!==Xe||t[106]!==Qe||t[107]!==et?(Pt=Xe||Qe||et||nt?(0,Z.jsxs)(be,{heading:o({id:`e0NrBM`}),children:[Xe&&a?(0,Z.jsxs)(D,{value:`open folder on disk project`,onSelect:()=>Ne(async()=>{let e=await a.dialog.openFolder();e&&await a.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(ye,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`WPwDin`})}),(0,Z.jsx)(xt,{children:`⌘O`})]}):null,Qe&&a?(0,Z.jsxs)(D,{value:`switch-project navigator projects`,onSelect:()=>Ne(()=>a.navigator.open(),o({id:`jol95m`})),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(Tc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`2Xs2jo`})}),(0,Z.jsx)(xt,{children:`⌘⇧N`})]}):null,et?(0,Z.jsxs)(D,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=th)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Jc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),(0,Z.jsx)(xt,{children:`⌘,`})]}):null,nt?(0,Z.jsxs)(D,{value:`install claude desktop cowork app`,onSelect:()=>{i(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(Xa,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`62Pc08`})})]}):null]}):null,t[100]=o,t[101]=a,t[102]=i,t[103]=Ne,t[104]=nt,t[105]=Xe,t[106]=Qe,t[107]=et,t[108]=Pt):Pt=t[108];let Ft=rt&&a?(0,Z.jsx)(be,{heading:o({id:`3iyGWF`}),children:de.filter(e=>em(`${e.name} ${e.path}`,l,[`open recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(D,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>Ne(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(kt,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(J,{id:`ls1N1w`})]}):null]})]})]},e.path))}):null,It=ze?(0,Z.jsx)(be,{heading:o({id:`A1taO8`}),children:Re.map(e=>(0,Z.jsx)(pg,{entry:e,query:u,onSelect:()=>q(e)},Mp(e.kind,e.path)))}):null,Lt;t[109]!==Tt||t[110]!==Et||t[111]!==Dt||t[112]!==Ot||t[113]!==At||t[114]!==jt||t[115]!==Mt||t[116]!==Nt||t[117]!==Pt||t[118]!==Ft||t[119]!==It?(Lt=(0,Z.jsxs)(Tt,{ref:V,className:`subtle-scrollbar`,children:[Et,Dt,Ot,At,jt,Mt,Nt,Pt,Ft,It]}),t[109]=Tt,t[110]=Et,t[111]=Dt,t[112]=Ot,t[113]=At,t[114]=jt,t[115]=Mt,t[116]=Nt,t[117]=Pt,t[118]=Ft,t[119]=It,t[120]=Lt):Lt=t[120];let Rt;t[121]!==ft||t[122]!==i||t[123]!==r||t[124]!==pt||t[125]!==mt||t[126]!==ht||t[127]!==_t||t[128]!==wt||t[129]!==Lt?(Rt=(0,Z.jsxs)(ft,{open:r,onOpenChange:i,title:pt,description:mt,className:`sm:max-w-2xl`,commandProps:ht,children:[_t,wt,Lt]}),t[121]=ft,t[122]=i,t[123]=r,t[124]=pt,t[125]=mt,t[126]=ht,t[127]=_t,t[128]=wt,t[129]=Lt,t[130]=Rt):Rt=t[130];let zt=S===`file`,Bt;t[131]===C?Bt=t[132]:(Bt=e=>{e||C(null)},t[131]=C,t[132]=Bt);let Vt;t[133]!==fe||t[134]!==zt||t[135]!==Bt?(Vt=(0,Z.jsx)(Sm,{open:zt,onOpenChange:Bt,kind:`file`,initialDir:fe}),t[133]=fe,t[134]=zt,t[135]=Bt,t[136]=Vt):Vt=t[136];let Ht=S===`folder`,Ut;t[137]===C?Ut=t[138]:(Ut=e=>{e||C(null)},t[137]=C,t[138]=Ut);let Wt;t[139]!==fe||t[140]!==Ht||t[141]!==Ut?(Wt=(0,Z.jsx)(Sm,{open:Ht,onOpenChange:Ut,kind:`folder`,initialDir:fe}),t[139]=fe,t[140]=Ht,t[141]=Ut,t[142]=Wt):Wt=t[142];let Gt;t[143]!==w||t[144]!==T?(Gt=(0,Z.jsx)(Jm,{open:w,onOpenChange:T}),t[143]=w,t[144]=T,t[145]=Gt):Gt=t[145];let qt;return t[146]!==Rt||t[147]!==Vt||t[148]!==Wt||t[149]!==Gt?(qt=(0,Z.jsxs)(Z.Fragment,{children:[Rt,Vt,Wt,Gt]}),t[146]=Rt,t[147]=Vt,t[148]=Wt,t[149]=Gt,t[150]=qt):qt=t[150],qt}function vg(e){return`#${e}`}function yg(e){return e.name}function bg(e){return Mp(e.kind,e.path)}var xg=500;function Sg(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Cg(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function wg(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=dt(),[a,o]=(0,Q.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),xg);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,Q.useEffect)(s,c);let l=Sg(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Cg(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.ok/local/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Z.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function Tg(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(Fn(e)??Of._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function Eg(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),Tg(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(ct,e),()=>document.removeEventListener(ct,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(kr(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)(Bo,{children:(0,Z.jsx)(Ao,{children:(0,Z.jsx)(J,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(Lo,{children:(0,Z.jsx)(Dg,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(Po,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(Vo,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function Dg(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(J,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(J,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(Og)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function Og(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var kg=`raw-mdx-nav`,Ag=`ok-editor-mode-v1`,jg=[`wysiwyg`,`source`],Mg=`wysiwyg`;function Ng(e){return jg.includes(e)}function Pg(e=localStorage){try{let t=e.getItem(Ag);if(t===null)return Mg;if(Ng(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Mg}function Fg(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Ng(n)?n:Pg(t)}function Ig(e,t=localStorage){try{return t.setItem(Ag,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Lg(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Fg),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Ig(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function Rg(e){let t=(0,$.c)(25),{open:n,onResolved:r}=e,{_:i}=Kt(),a=Sa(),o;t[0]!==i||t[1]!==r||t[2]!==a?(o=function(e){if(a===null){X.error(i({id:`fiMNLl`}));return}let t=a(e);if(!t.ok){let n=t.error;X.error(i(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}r()},t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Bo,{children:(0,Z.jsx)($i,{})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ha,{}),t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(Lo,{children:[l,(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ZLQol-`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})})]}),t[6]=u):u=t[6];let d;t[7]===s?d=t[8]:(d=()=>s(!1),t[7]=s,t[8]=d);let f=a===null,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`IKoTAC`}),t[9]=p):p=t[9];let m;t[10]!==d||t[11]!==f?(m=(0,Z.jsx)(Y,{variant:`ghost`,className:`uppercase font-mono`,onClick:d,disabled:f,children:p}),t[10]=d,t[11]=f,t[12]=m):m=t[12];let h;t[13]===s?h=t[14]:(h=()=>s(!0),t[13]=s,t[14]=h);let g=a===null,_;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(J,{id:`XU0OXn`}),t[15]=_):_=t[15];let v;t[16]!==g||t[17]!==h?(v=(0,Z.jsx)(Y,{onClick:h,disabled:g,children:_}),t[16]=g,t[17]=h,t[18]=v):v=t[18];let y;t[19]!==v||t[20]!==m?(y=(0,Z.jsxs)(Po,{className:`sm:max-w-lg`,showCloseButton:!1,children:[c,u,(0,Z.jsxs)(Ro,{children:[m,v]})]}),t[19]=v,t[20]=m,t[21]=y):y=t[21];let b;return t[22]!==n||t[23]!==y?(b=(0,Z.jsx)(Vo,{open:n,onOpenChange:zg,children:y}),t[22]=n,t[23]=y,t[24]=b):b=t[24],b}function zg(){}function Bg(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=fo();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ir,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Z.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var Vg=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function Hg(e,t,n,r,i,a){if(e==r)return[];let o=Qg(e,t,n,r,i,a),s=$g(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new Vg(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Vg(t,t+o,i,i),new Vg(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new Vg(t,t,i,i+o),new Vg(n,n,i+o+c,a)]}if(c==1||l==1)return[new Vg(t,n,i,a)];let u=t_(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Hg(e,t,o,r,i,s).concat(Hg(e,o+c,n,r,s+c,a))}return Kg(e,t,n,r,i,a)}var Ug=1e9,Wg=0,Gg=!1;function Kg(e,t,n,r,i,a){let o=n-t,s=a-i;if(Ug<1e9&&Math.min(o,s)>Ug*16||Wg>0&&Date.now()>Wg)return Math.min(o,s)>Ug*64?[new Vg(t,n,i,a)]:n_(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Jg.reset(c),Yg.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:Yg,f=d?null:Jg;for(let p=0;p<c;p++){if(p>Ug||Wg>0&&!(p&63)&&Date.now()>Wg)return n_(e,t,n,r,i,a);let m=Jg.advance(p,o,s,c,d,!1,l)||Yg.advance(p,o,s,c,f,!0,u);if(m)return Xg(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Vg(t,n,i,a)]}var qg=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},Jg=new qg,Yg=new qg;function Xg(e,t,n,r,i,a,o,s){let c=!1;return!__(e,r)&&++r==n&&(c=!0),!__(i,s)&&++s==o&&(c=!0),c?[new Vg(t,n,a,o)]:Hg(e,t,r,i,a,s).concat(Hg(e,r,n,i,s,o))}function Zg(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Qg(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Zg(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!__(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function $g(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Zg(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!__(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function e_(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){__(e,s)||s++;let u=s+o;if(__(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=Qg(e,u,n,r,i+f+d.length,a),c=$g(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function t_(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=t_(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:e_(e,t,n,r,i,a,Math.floor(o/4),-1)}function n_(e,t,n,r,i,a){Gg=!0;let o=n-t,s=a-i,c;if(o<s){let s=e_(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=e_(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Vg(t,n,i,a)];let[l,u,d]=c;return Hg(e,t,l,r,i,u).concat(Hg(e,l+d,n,r,u+d,a))}function r_(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new Vg(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function i_(e,t,n){for(;;){r_(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Qg(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Vg(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=$g(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Vg(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new Vg(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new Vg(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function a_(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=f_(t,a.fromA,l),f=d_(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new Vg(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=d_(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Vg(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=f_(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Vg(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=m_(n,a.fromB,a.toB),r,o=t<0?-1:p_(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=m_(t,a.fromA,a.toA),r,o=n<0?-1:p_(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return r_(e,3),e}var o_;try{o_=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function s_(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function c_(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!s_(n):o_?!h_(n)||t==e.length-1?+!!o_.test(String.fromCharCode(n)):o_.test(e.slice(t,t+2))?2:0:0}function l_(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!s_(n):o_?!g_(n)||t==1?+!!o_.test(String.fromCharCode(n)):o_.test(e.slice(t-2,t))?2:0:0}var u_=8;function d_(e,t,n){if(t==e.length||!l_(e,t))return t;for(let r=t,i=t+n,a=0;a<u_;a++){let t=c_(e,r);if(!t||r+t>i)return r;r+=t}return t}function f_(e,t,n){if(!t||!c_(e,t))return t;for(let r=t,i=t-n,a=0;a<u_;a++){let t=l_(e,r);if(!t||r-t<i)return r;r-=t}return t}function p_(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function m_(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var h_=e=>e>=55296&&e<=56319,g_=e=>e>=56320&&e<=57343;function __(e,t){return!t||t==e.length||!h_(e.charCodeAt(t-1))||!g_(e.charCodeAt(t))}function v_(e,t,n){let r=n?.override;return r?r(e,t):(Ug=(n?.scanLimit??1e9)>>1,Wg=n?.timeout?Date.now()+n.timeout:0,Gg=!1,i_(e,t,Hg(e,0,e.length,t,0,t.length)))}function y_(){return!Gg}function b_(e,t,n){return a_(v_(e,t,n),e,t)}var x_=hs.define({combine:e=>e[0]}),S_=gs.define(),C_=hs.define(),w_=us.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(S_)&&(e=n.value);for(let n of t.state.facet(C_))e=n(e,t);return e}});function T_(e){let t=e.field(w_,!1);if(!t)return null;let n=e.facet(x_);return{chunks:t,side:n?n.side:null}}var E_=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return k_(b_(e.toString(),t.toString(),n),e,t,0,0,y_())}static updateA(e,t,n,r,i){return N_(M_(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return N_(M_(e,r,!1,t.length),e,t,n,i)}};function D_(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function O_(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function k_(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=D_(c.fromA+r,c.fromB+i,t,n),[d,f]=O_(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=D_(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=O_(a.toA+r,a.toB+i,t,n),s++}o.push(new E_(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var A_=1e3;function j_(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function M_(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>A_&&([l,d]=j_(e,a-A_,n,!0)),o<t.length-A_&&([u,f]=j_(e,o+A_,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function N_(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=b_(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of k_(h,n,r,d,f,y_()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var P_={scanLimit:500},F_=_s.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=G_(e))}update(e){(e.docChanged||e.viewportChanged||L_(e.startState,e.state)||R_(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=G_(e.view))}},{decorations:e=>e.deco}),I_=ss.low(xs({class:`cm-changeGutter`,markers:e=>e.plugin(F_)?.gutter||ws.empty}));function L_(e,t){return e.field(w_,!1)!=t.field(w_,!1)}function R_(e,t){return e.facet(x_)!=t.facet(x_)}var z_=ps.line({class:`cm-changedLine`}),B_=ps.mark({class:`cm-changedText`}),V_=ps.mark({tagName:`ins`,class:`cm-insertedLine`}),H_=ps.mark({tagName:`del`,class:`cm-deletedLine`}),U_=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function W_(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,z_),i.add(o,s,n?H_:V_),a&&a.add(o,o,U_);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,z_),a&&a.add(u,u,U_);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,B_),s<t)c++;else break}u=t}}}function G_(e){let t=e.state.field(w_),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(x_),o=n==`a`,s=new ms,c=i?new ms:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&W_(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var K_=class extends os{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},q_=gs.define({map:(e,t)=>e.map(t)}),J_=us.define({create:()=>ps.none,update:(e,t)=>{for(let e of t.effects)if(e.is(q_))return e.value;return e.map(t.changes)},provide:e=>ys.decorations.from(e)}),Y_=.01;function X_(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Z_(e,t,n){let r=new ms,i=new ms,a=e.state.field(J_).iter(),o=t.state.field(J_).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-Y_?(l-=n,r.add(s,s,ps.widget({widget:new K_(-n),block:!0,side:-1}))):n>Y_&&(u+=n,i.add(c,c,ps.widget({widget:new K_(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<Y_?r.add(e.state.doc.length,e.state.doc.length,ps.widget({widget:new K_(-p),block:!0,side:1})):p>Y_&&i.add(t.state.doc.length,t.state.doc.length,ps.widget({widget:new K_(p),block:!0,side:1}));let m=r.finish(),h=i.finish();X_(m,e.state.field(J_))||e.dispatch({effects:q_.of(m)}),X_(h,t.state.field(J_))||t.dispatch({effects:q_.of(h)})}var Q_=gs.define({map:(e,t)=>t.mapPos(e)}),$_=class extends os{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:Q_.of(n)});let{side:r,sibling:i}=e.state.facet(x_);i&&i().dispatch({effects:Q_.of(ev(n,e.state.field(w_),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function ev(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var tv=us.define({create(e){return ps.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Q_)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ys.decorations.from(e)});function nv({margin:e=3,minSize:t=4}){return tv.init(n=>rv(n,e,t))}function rv(e,t,n){let r=new ms,i=e.facet(x_).side==`a`,a=e.field(w_),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,ps.replace({widget:new $_(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var iv=ys.styleModule.of(new Ss({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),av=ys.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),ov=new vs,sv=new vs,cv=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||P_;let t=[ss.low(F_),av,iv,J_,ys.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(q_)))&&this.measure()})],n=[x_.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(I_);let r=ls.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ys.editorAttributes.of({class:`cm-merge-a`}),sv.of(n),t]}),i=[x_.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(I_);let a=ls.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ys.editorAttributes.of({class:`cm-merge-b`}),sv.of(i),t]});this.chunks=E_.build(r.doc,a.doc,this.diffConf);let o=[w_.init(()=>this.chunks),ov.of(e.collapseUnchanged?nv(e.collapseUnchanged):[])];r=r.update({effects:gs.appendConfig.of(o)}).state,a=a.update({effects:gs.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new ys({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ys({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),cs.empty(e[0].startState.doc.length));this.chunks=t==this.a?E_.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):E_.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:S_.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:S_.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(x_),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(sv.reconfigure([x_.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?I_:[]])),a.push(sv.reconfigure([x_.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?I_:[]]))}if(r){let t=ov.reconfigure(e.collapseUnchanged?nv(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){Z_(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=lv(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=lv(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function lv(e){let t=e.nextSibling;return e.remove(),t}var uv=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},dv=ss.low(xs({class:`cm-changeGutter`,markers:e=>e.plugin(F_)?.gutter||ws.empty,widgetMarker:(e,t)=>t instanceof gv?uv:null}));function fv(e){let t=typeof e.original==`string`?fs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||P_;return[ss.low(F_),xv,av,ys.editorAttributes.of({class:`cm-merge-b`}),C_.of((e,t)=>{let r=t.effects.find(e=>e.is(pv));return r&&(e=E_.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=E_.updateB(e,t.state.field(mv),t.newDoc,t.changes,n)),e}),x_.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Dv:void 0,side:`b`}),mv.init(()=>t),e.gutter===!1?[]:dv,e.collapseUnchanged?nv(e.collapseUnchanged):[],w_.init(e=>E_.build(t,e.doc,n))]}var pv=gs.define(),mv=us.define({create:()=>fs.empty,update(e,t){for(let n of t.effects)n.is(pv)&&(e=n.value.doc);return e}}),hv=new WeakMap,gv=class extends os{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function _v(e,t,n){let r=hv.get(t.changes);if(r)return r;let i=ps.widget({block:!0,side:-1,widget:new gv(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(x_),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),vv(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),yv(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(mv).sliceString(t.fromA,t.endA),u=a&&e.facet(Ts),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
24
24
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
25
25
|
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;ds(t,{style:t=>Es(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return hv.set(t.changes,i),i}function vv(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(w_).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(mv);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=cs.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:pv.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function yv(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(w_).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(mv).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function bv(e){let t=new ms;for(let n of e.field(w_)){let r=e.facet(x_).overrideChunk&&Cv(e,n);t.add(n.fromB,n.fromB,_v(e,n,!!r))}return t.finish()}var xv=us.define({create:e=>bv(e),update(e,t){return t.state.field(w_,!1)==t.startState.field(w_,!1)?e:bv(t.state)},provide:e=>ys.decorations.from(e)}),Sv=new WeakMap;function Cv(e,t){let n=Sv.get(t);if(n!==void 0)return n;n=null;let r=e.field(mv),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(ps.widget({widget:new wv(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(B_.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Sv.set(t,n),n}var wv=class extends os{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},Tv=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Ev=ps.line({class:`cm-inlineChangedLine`});function Dv(e,t,n,r){let i=Cv(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,Tv),n.add(o.from,o.from,Ev);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var Ov=fe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),kv=Rt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Av(e){let t=(0,$.c)(20),{oldContent:n,newContent:r,layout:i,conflictMode:a,onResolve:o,onAbort:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),{resolvedTheme:u}=Gr(),d=(0,Q.useRef)(o),f=(0,Q.useRef)(s),[p,m]=(0,Q.useState)(null),h;t[0]!==s||t[1]!==o?(h=()=>{d.current=o,f.current=s},t[0]=s,t[1]=o,t[2]=h):h=t[2],(0,Q.useEffect)(h);let g,v;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?Ov:kv,t=[ys.editable.of(!1),ls.readOnly.of(!0)],o=[As,_(),...t,e,ys.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new ys({doc:r,extensions:[As,_(),ys.editable.of(!1),e,ys.lineWrapping,fv({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ys.updateListener.of(e=>{let t=T_(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=T_(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new cv({a:{doc:n,extensions:o},b:{doc:r,extensions:o},parent:c.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):l.current=new ys({doc:r,extensions:[...o,fv({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},v=[n,r,i,u,a],t[3]=a,t[4]=i,t[5]=r,t[6]=n,t[7]=u,t[8]=g,t[9]=v):(g=t[8],v=t[9]),(0,Q.useEffect)(g,v);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){let e=l.current;!e||!(e instanceof ys)||d.current?.(e.state.doc.toString())},t[10]=y):y=t[10];let b=y,x=p===0,S=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=C):C=t[11];let w;t[12]!==x||t[13]!==a||t[14]!==S||t[15]!==s||t[16]!==o?(w=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${x?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:S}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s&&(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:s,children:`Exit merge`}),o&&(0,Z.jsx)(Y,{variant:`default`,size:`sm`,disabled:!x,onClick:b,children:`Save resolution`})]})]}),t[12]=x,t[13]=a,t[14]=S,t[15]=s,t[16]=o,t[17]=w):w=t[17];let T;return t[18]===w?T=t[19]:(T=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[C,w]}),t[18]=w,t[19]=T),T}function jv(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Io,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Mv(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(zo,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Nv(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Mo,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pv(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Nv,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=Di(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 motion-reduce:transition-none motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Z.jsx)(Ho,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(Do,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(Mv,{children:[l,(0,Z.jsxs)(jo,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Fv(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Iv(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Di(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(No,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function Lv(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:{conflicts:[],error:`server`}}catch{return{conflicts:[],error:`network`}}}async function Rv(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}`);if(!t.ok)return{ours:``,theirs:``,base:``};let n=await t.json();return{ours:n.ours??``,theirs:n.theirs??``,base:n.base??``}}catch{return{ours:``,theirs:``,base:``}}}async function zv(e,t,n){try{let r={file:e,strategy:t};return n!==void 0&&(r.content=n),(await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})).ok}catch{return!1}}var Bv=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function Vv(e){let t=(0,$.c)(31),{file:n,onResolve:r,onAbort:i}=e,[a,o]=(0,Q.useState)(null),s,c;if(t[0]===n?(s=t[1],c=t[2]):(s=()=>{let e=!1;return Rv(n).then(t=>{e||o(t)}),()=>{e=!0}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c),a===null){let e;t[3]===i?e=t[4]:(e=e=>!e&&i(),t[3]=i,t[4]=e);let r;t[5]===n?r=t[6]:(r=(0,Z.jsx)(Bo,{className:`shrink-0`,children:(0,Z.jsxs)(Ao,{children:[`Resolving: `,n]})}),t[5]=n,t[6]=r);let a;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground`,children:`Loading`}),t[7]=a):a=t[7];let o;t[8]===r?o=t[9]:(o=(0,Z.jsxs)(Po,{className:Bv,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(Vo,{open:!0,onOpenChange:e,children:o}),t[10]=e,t[11]=o,t[12]=s):s=t[12],s}let l;t[13]===i?l=t[14]:(l=e=>!e&&i(),t[13]=i,t[14]=l);let u;t[15]===n?u=t[16]:(u=(0,Z.jsxs)(Ao,{className:`text-sm font-medium`,children:[`Resolving: `,n]}),t[15]=n,t[16]=u);let d;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Red = your version (ours). Green = team's version (theirs). Accept each hunk to take theirs, reject to keep yours, then save.`}),t[17]=d):d=t[17];let f;t[18]===u?f=t[19]:(f=(0,Z.jsxs)(Bo,{className:`px-4 pt-4 pb-2 shrink-0`,children:[u,d]}),t[18]=u,t[19]=f);let p;t[20]!==i||t[21]!==r||t[22]!==a.ours||t[23]!==a.theirs?(p=(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Z.jsx)(Av,{oldContent:a.ours,newContent:a.theirs,layout:`unified`,conflictMode:!0,onResolve:r,onAbort:i})}),t[20]=i,t[21]=r,t[22]=a.ours,t[23]=a.theirs,t[24]=p):p=t[24];let m;t[25]!==f||t[26]!==p?(m=(0,Z.jsxs)(Po,{className:`${Bv} p-0`,children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27];let h;return t[28]!==l||t[29]!==m?(h=(0,Z.jsx)(Vo,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function Hv(e){let t=(0,$.c)(50),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Set,t[1]=l):l=t[1];let[u,d]=(0,Q.useState)(l),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[2]=f):f=t[2];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(null),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){Lv().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(Uv));return new Set([...e].filter(e=>!n.has(e)))})})},t[3]=_):_=t[3];let v=_,y,b;t[4]===n?(y=t[5],b=t[6]):(y=()=>{n&&v()},b=[n],t[4]=n,t[5]=y,t[6]=b),(0,Q.useEffect)(y,b);let x,S;t[7]===n?(x=t[8],S=t[9]):(x=()=>Dr(e=>{e.includes(`sync-status`)&&n&&v()}),S=[n],t[7]=n,t[8]=x,t[9]=S),(0,Q.useEffect)(x,S);let C,w;t[10]!==a.length||t[11]!==r||t[12]!==n||t[13]!==u.size?(w=()=>{n&&a.length>0&&u.size>=a.length&&(X.success(`All conflicts resolved — sync resuming`),r(!1),d(new Set))},C=[n,a.length,u.size,r],t[10]=a.length,t[11]=r,t[12]=n,t[13]=u.size,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,Q.useEffect)(w,C);let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=async function(e,t,n){m(t=>new Set([...t,e]));let r=await zv(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):X.error(`Failed to resolve ${e}`)},t[16]=T):T=t[16];let E=T,D;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){g(e)},t[17]=D):D=t[17];let O=D,k;t[18]===h?k=t[19]:(k=async function(e){if(!h)return;let t=h;g(null),await E(t,`content`,e)},t[18]=h,t[19]=k);let A=k,j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){g(null)},t[20]=j):j=t[20];let M=j,N;t[21]===r?N=t[22]:(N=async function(){try{(await fetch(`/api/sync/abort-merge`,{method:`POST`})).ok?X.info(`Merge aborted — sync paused`):X.error(`Failed to abort merge`)}catch{X.error(`Failed to abort merge — connection error`)}r(!1),d(new Set)},t[21]=r,t[22]=N);let P=N,F=a.length,I=u.size,L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Iv,{className:`text-sm font-medium`,children:`Resolve conflicts`}),t[23]=L):L=t[23];let R;t[24]!==I||t[25]!==F?(R=F>0&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[I,` of `,F,` resolved`]}),t[24]=I,t[25]=F,t[26]=R):R=t[26];let z;t[27]===R?z=t[28]:(z=(0,Z.jsxs)(Fv,{className:`px-4 py-3 border-b shrink-0`,children:[L,R]}),t[27]=R,t[28]=z);let B;t[29]!==a||t[30]!==s||t[31]!==u||t[32]!==p?(B=(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar`,children:s?(0,Z.jsxs)(`div`,{className:`px-4 py-6 text-sm text-center space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-destructive`,children:s===`network`?`Could not reach the sync server — check your connection.`:`Sync server error — try again in a moment.`}),(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,onClick:v,children:`Retry`})]}):a.length===0?(0,Z.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground text-center`,children:`No conflicts found.`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:a.map(e=>{let t=u.has(e.file),n=p.has(e.file),r=e.file.split(`/`).pop()??e.file;return(0,Z.jsxs)(`li`,{className:`px-4 py-3 ${t?`opacity-50`:``}`,children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium truncate mb-2`,title:e.file,children:[t?`✓ `:``,r]}),!t&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`mine`),children:`Keep my version`}),(0,Z.jsx)(Y,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`theirs`),children:`Keep team's version`}),(0,Z.jsx)(Y,{variant:`ghost`,size:`xs`,disabled:n,onClick:()=>O(e.file),children:`Resolve manually`})]})]},e.file)})})}),t[29]=a,t[30]=s,t[31]=u,t[32]=p,t[33]=B):B=t[33];let V;t[34]===P?V=t[35]:(V=(0,Z.jsx)(`div`,{className:`px-4 py-3 border-t shrink-0`,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:P,children:`Exit merge`})}),t[34]=P,t[35]=V);let H;t[36]!==z||t[37]!==B||t[38]!==V?(H=(0,Z.jsxs)(Pv,{side:`right`,className:`w-80 sm:w-96 flex flex-col gap-0 p-0`,children:[z,B,V]}),t[36]=z,t[37]=B,t[38]=V,t[39]=H):H=t[39];let U;t[40]!==r||t[41]!==n||t[42]!==H?(U=(0,Z.jsx)(jv,{open:n,onOpenChange:r,children:H}),t[40]=r,t[41]=n,t[42]=H,t[43]=U):U=t[43];let W;t[44]!==A||t[45]!==h?(W=h&&(0,Z.jsx)(Vv,{file:h,onResolve:e=>void A(e),onAbort:M}),t[44]=A,t[45]=h,t[46]=W):W=t[46];let G;return t[47]!==U||t[48]!==W?(G=(0,Z.jsxs)(Z.Fragment,{children:[U,W]}),t[47]=U,t[48]=W,t[49]=G):G=t[49],G}function Uv(e){return e.file}var Wv=5;async function Gv(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=gr.safeParse(n);throw e.success?Error(e.data.title):new pt(`Failed to parse backlinks error response (HTTP ${t.status})`,{status:t.status})}let r=li.safeParse(n);if(!r.success)throw new pt(`Backlinks response did not match expected shape.`,{status:t.status});return r.data.backlinks}async function Kv(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=gr.safeParse(n);throw e.success?Error(e.data.title):new pt(`Failed to parse forward-links error response (HTTP ${t.status})`,{status:t.status})}let r=Rn.safeParse(n);if(!r.success)throw new pt(`Forward-links response did not match expected shape.`,{status:t.status});return r.data.forwardLinks}function qv(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function Jv(e){window.location.hash=kr(e)}function Yv(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ke,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(vn,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(_n,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Ko,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Xv(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=Wv)return null;let a=n-Wv,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Ke,{className:`size-3`}):(0,Z.jsx)(Uo,{className:`size-3`}),t[0]=r,t[1]=o);let s=r?`Show fewer`:`Show ${a} more`,c;return t[2]!==r||t[3]!==i||t[4]!==o||t[5]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function Zv(e){let t=(0,$.c)(35),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m}=e,h=o!==void 0&&o!==a,g=r??`text-muted-foreground`,_;t[0]===g?_=t[1]:(_=Di(`mt-0.5 shrink-0`,g),t[0]=g,t[1]=_);let v;t[2]!==n||t[3]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:n}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y=v,b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(b=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsx)(`span`,{className:`sr-only`,children:` (opens in new tab)`}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:Di(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=b):b=t[12];let x=b,S;t[13]===y?S=t[14]:(S=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:y}),t[13]=y,t[14]=S);let C;t[15]!==s||t[16]!==o||t[17]!==h?(C=h?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=h,t[18]=C):C=t[18];let w;t[19]===c?w=t[20]:(w=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=w);let T;t[21]!==x||t[22]!==C||t[23]!==w?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[x,C,w]}),t[21]=x,t[22]=C,t[23]=w,t[24]=T):T=t[24];let E;t[25]!==S||t[26]!==T?(E=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[S,T]}),t[25]=S,t[26]=T,t[27]=E):E=t[27];let D=E;if(i){let e;t[28]===D?e=t[29]:(e=(0,Z.jsx)(En,{asChild:!0,children:D}),t[28]=D,t[29]=e);let n;t[30]===i?n=t[31]:(n=(0,Z.jsx)(er,{side:`top`,children:i}),t[30]=i,t[31]=n);let r;return t[32]!==e||t[33]!==n?(r=(0,Z.jsxs)(jn,{children:[e,n]}),t[32]=e,t[33]=n,t[34]=r):r=t[34],r}return D}function Qv(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=Nr(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>Gv(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==a||t[5]!==i?(c=!a&&i.has(n),t[3]=n,t[4]=a,t[5]=i,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=on(l),p;t[11]===u?p=t[12]:(p=u===void 0?[]:u,t[11]=u,t[12]=p);let m=p,[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(n);_!==n&&(v(n),g(!1));let y;t[13]!==m||t[14]!==h?(y=h?m:m.slice(0,Wv),t[13]=m,t[14]=h,t[15]=y):y=t[15];let b=y,x;t[16]!==m.length||t[17]!==d?(x=(0,Z.jsx)(Yv,{title:`Backlinks`,count:m.length,isLoading:d}),t[16]=m.length,t[17]=d,t[18]=x):x=t[18];let S;t[19]!==m.length||t[20]!==f||t[21]!==h||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==b?(S=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(rn,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):m.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(dn,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:b.map((e,t)=>{let n=To(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(Zv,{icon:(0,Z.jsx)(Te,{className:`size-3.5`}),title:e.title,path:qv(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:kr(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(Xv,{total:m.length,expanded:h,onToggle:()=>g($v)})]}),t[19]=m.length,t[20]=f,t[21]=h,t[22]=r,t[23]=d,t[24]=i,t[25]=b,t[26]=S):S=t[26];let C;t[27]!==d||t[28]!==S?(C=(0,Z.jsx)(Go,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:S})}),t[27]=d,t[28]=S,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==x?(w=(0,Z.jsxs)(qo,{defaultOpen:!0,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32],w}function $v(e){return!e}function ey(e){let t=(0,$.c)(42),{docName:n}=e,{addPage:r,folderPaths:i,pages:a,pagesBySlug:o,loading:s}=Nr(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>Kv(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==a||t[5]!==s?(u=!s&&a.has(n),t[3]=n,t[4]=a,t[5]=s,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==l||t[9]!==u?(d={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=d):d=t[10];let{data:f,isLoading:p,error:m}=on(d),h;t[11]===f?h=t[12]:(h=f===void 0?[]:f,t[11]=f,t[12]=h);let g=h,[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(n);x!==n&&(S(n),b(!1),v(null));let C;t[13]!==y||t[14]!==g?(C=y?g:g.slice(0,Wv),t[13]=y,t[14]=g,t[15]=C):C=t[15];let w=C,T;t[16]!==r||t[17]!==_?(T=async function(e,t){if(!_){v(t);try{await xe(e,{addPage:r,onCreated:Jv}),v(null)}catch(e){let t=e;X.error(t instanceof Error?t.message:`Failed to create page`),v(null)}}},t[16]=r,t[17]=_,t[18]=T):T=t[18];let E=T,D;t[19]!==_||t[20]!==i||t[21]!==E||t[22]!==a||t[23]!==o||t[24]!==s?(D=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(Zv,{icon:(0,Z.jsx)(wo,{className:`size-3.5`}),rowTooltip:`Opens in a new tab`,title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let t=ve(e.docName,{pages:a,folderPaths:i,pagesBySlug:o}),n=!s&&t.kind===`create`,r=!s&&t.kind===`navigate`&&t.displayState===`folder`,c=qv(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,d=kr(t.kind===`navigate`?t.hashDocName:e.docName,e.anchor);if(n&&t.kind===`create`){let n={initialDir:t.initialDir,suggestedName:t.suggestedName};return(0,Z.jsx)(Zv,{icon:(0,Z.jsx)(Ir,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:_===u?`Creating page`:`Missing page — click to create`,ariaLabel:_===u?`Creating page: ${e.title}.`:`Missing page: ${e.title}. Click to create.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:_!==null,onClick:()=>void E(n,u)},u)}return r&&t.kind===`navigate`?(0,Z.jsx)(Zv,{icon:(0,Z.jsx)(bc,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:`Folder target: ${e.title}. Click to open the overview.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d},u):(0,Z.jsx)(Zv,{icon:(0,Z.jsx)(Te,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d},u)},t[19]=_,t[20]=i,t[21]=E,t[22]=a,t[23]=o,t[24]=s,t[25]=D):D=t[25];let O=D,k;t[26]!==p||t[27]!==g.length?(k=(0,Z.jsx)(Yv,{title:`Outgoing`,count:g.length,isLoading:p}),t[26]=p,t[27]=g.length,t[28]=k):k=t[28];let A;t[29]!==m||t[30]!==y||t[31]!==p||t[32]!==g.length||t[33]!==O||t[34]!==w?(A=m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(rn,{children:m instanceof Error?m.message:`Failed to load outgoing links`})}):g.length===0&&!p?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(dn,{children:`This page doesn't link to anything yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:w.map(O)}),(0,Z.jsx)(Xv,{total:g.length,expanded:y,onToggle:()=>b(ty)})]}),t[29]=m,t[30]=y,t[31]=p,t[32]=g.length,t[33]=O,t[34]=w,t[35]=A):A=t[35];let j;t[36]!==p||t[37]!==A?(j=(0,Z.jsx)(Go,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":p,children:A})}),t[36]=p,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==k||t[40]!==j?(M=(0,Z.jsxs)(qo,{defaultOpen:!0,children:[k,j]}),t[39]=k,t[40]=j,t[41]=M):M=t[41],M}function ty(e){return!e}function ny(e){let t=(0,$.c)(11),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(ey,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ba,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Qv,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(hn,{className:`px-0 py-0`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==i||t[9]!==c?(l=(0,Z.jsx)(yn,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var ry=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends ry{};function iy(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function ay(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function oy(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function sy(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function cy(e,t){return oy(e,t,``)}function ly(e,t){return sy(e,t,``)}function uy(e,t){return t.slice(0,dy(e,t))}function dy(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function fy(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function py(e,t){if(t)return hy(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function my(e,t){if(t)return hy(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function hy(e,t){if(!t)return[my(e),py(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=fy(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var gy=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,_y=RegExp(`[${gy}]+|\\s+|[^${gy}]`,`ug`);new class extends ry{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=fy(e,r)}else n=e.match(_y)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&vy(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&vy(n,i,r,null,t.intlSegmenter),e}};function vy(e,t,n,r,i){if(t&&n){let[a,o]=hy(t.value,i),[s,c]=hy(n.value,i);if(e){let r=iy(a,s);e.value=sy(e.value,s,r),t.value=cy(t.value,r),n.value=cy(n.value,r)}if(r){let e=ay(o,c);r.value=oy(r.value,c,e),t.value=ly(t.value,e),n.value=ly(n.value,e)}}else if(n){if(e){let e=my(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=my(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=my(r.value,i),[a,o]=hy(t.value,i),s=iy(n,a);t.value=cy(t.value,s);let c=ay(cy(n,s),o);t.value=ly(t.value,c),r.value=oy(r.value,n,c),e.value=sy(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=my(r.value,i),n=uy(py(t.value,i),e);t.value=ly(t.value,n)}else if(e){let n=uy(py(e.value,i),my(t.value,i));t.value=cy(t.value,n)}}new class extends ry{tokenize(e){let t=RegExp(`(\\r?\\n)|[${gy}]+|[^\\S\\n\\r]+|[^${gy}]`,`ug`);return e.match(t)||[]}};var yy=new class extends ry{constructor(){super(...arguments),this.tokenize=xy}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
26
26
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
@@ -1925,4 +1925,4 @@ This template lives at an ancestor folder — deleting affects every folder unde
|
|
|
1925
1925
|
`;function fV(e){hV(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=JB(i);a&&(gV(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(oV,a),pV(a),!t.hasAttribute(sV)&&(_V(t,a),t.setAttribute(sV,``)))}function pV(e){cV=e,lV!==null&&clearTimeout(lV),lV=setTimeout(mV,uV)}function mV(){cV=null,lV!==null&&(clearTimeout(lV),lV=null)}function hV(e){let t=e.querySelectorAll(`[${oV}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(oV);if(!t){e.removeAttribute(oV);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(oV);continue}let r=JB(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(oV)}if(cV===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||JB(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==cV&&e.setAttribute(oV,cV))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&mV()}function gV(e,t){let n=e.querySelector(`[${aV}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(aV,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function _V(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function vV(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function yV(e,t,n={}){if(!e)return vV(t);let r=Zr(e);if(t&&r!==t)return vV(t);switch(e.kind){case`doc`:return vV(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?vV(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function bV(e,t){if(!e)return{kind:`none`};let n=t.find(t=>kO(t)===e);if(n&&An(n))return{kind:`asset`,path:n.path,hash:Jr(n.path),mediaKind:n.mediaKind};let r=NO(e);return e.endsWith(`/`)?t.some(e=>ur(e)?e.path===r||e.path.startsWith(`${r}/`):(An(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>mi(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var xV=`You can restore this file from the Trash.`;function SV(e){let t=xV,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind===`file`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function CV(e,t){return e===`web`?null:SV(t)}function wV(e){return e.kind===`folder`?`${e.name}/`:e.docExt?`${e.name}${e.docExt}`:e.name}var TV=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function EV(e){return typeof e==`string`&&TV.includes(e)?e:`system-error`}function DV(e){switch(e){case`not-found`:return Of._({id:`v41fCm`});case`permission-denied`:return Of._({id:`sJK6pq`});case`system-error`:return Of._({id:`Jqqevv`});case`path-escape`:return Of._({id:`WL6puM`})}}function OV(e){let t=DV(e.reason),n=e.detail;return n?Of._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Of._({id:`dTaauv`,values:{reason:t}})}function kV(e){return e.kind===`folder`?`${e.name}/`:e.name}function AV(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?kV(c):``;u=s?Of._({id:`5qNxOe`,values:{count:l}}):c?`${Of._({id:`E_BHoD`,values:{targetName:e}})}\n${OV(c)}`:Of._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Ao,{children:(0,Z.jsx)(J,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(Bo,{children:[f,(0,Z.jsx)(Oo,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(Lo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(jV)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nt,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`mf37rL`})]}):(0,Z.jsx)(J,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nt,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`s3caR3`})]}):(0,Z.jsx)(J,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(Y,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(Ro,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(Po,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function jV(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:kV(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:OV(e)})]},e.path)}function MV(e){return e?.isDirectory()?e:null}function NV(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function PV(e,t,n,r){let i=(0,$.c)(6),a,o;i[0]!==n||i[1]!==t||i[2]!==e||i[3]!==r?(a=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=MV(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}NV(e,o),o.focus(),i()},o=[n,t,e,r],i[0]=n,i[1]=t,i[2]=e,i[3]=r,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}var FV={"not-found":`Terminal.app not found`,"spawn-error":`Could not launch Terminal`,timeout:`Terminal took too long to respond`,"path-escape":`Path resolves outside the project`,"ipc-error":`Lost connection to the main process`};async function IV(e,t){let n;try{n=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),X.error(`Could not open Terminal`,{description:FV[`ipc-error`]});return}n.ok||(console.warn(`[shell] openInTerminal failed`,{reason:n.reason,dirAbsPath:t}),X.error(`Could not open Terminal`,{description:FV[n.reason]}))}var LV=`open-knowledge:file-tree-menu-action-delete`,RV=`open-knowledge:file-tree-menu-action-rename`,zV=`open-knowledge:file-tree-menu-action-duplicate`;function BV(e){window.dispatchEvent(new CustomEvent(LV,{detail:{target:e}}))}function VV(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(LV,t),()=>window.removeEventListener(LV,t)}function HV(e){window.dispatchEvent(new CustomEvent(RV,{detail:{target:e}}))}function UV(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(RV,t),()=>window.removeEventListener(RV,t)}function WV(e){window.dispatchEvent(new CustomEvent(zV,{detail:{target:e}}))}function GV(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(zV,t),()=>window.removeEventListener(zV,t)}function KV(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function qV(e){return e?`No workspace`:null}function JV(e){let t=(0,$.c)(39),{input:n,installStates:r,dispatch:i,webFallbackVisible:a}=e,o=a===void 0?!0:a,s=n===null,c;t[0]===s?c=t[1]:(c=qV(s),t[0]=s,t[1]=c);let l=c,u,d,f,p,m,h;if(t[2]!==i||t[3]!==l||t[4]!==n||t[5]!==s||t[6]!==r){let e;t[13]===r?e=t[14]:(e=e=>r[e.id]?.installed===!0,t[13]=r,t[14]=e);let a=eh.filter(e);f=r[`claude-code`]?.installed===!0;let o;t[15]===n?o=t[16]:(o=n!==null&&n.docContext!==null?jr(n.docContext.relativePath):``,t[15]=n,t[16]=o);let c=o,g;t[17]!==n||t[18]!==c?(g=()=>{n!==null&&ES(c)},t[17]=n,t[18]=c,t[19]=g):g=t[19],p=g,d=oo,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(Ji,{"aria-hidden":`true`}),`Open with AI`]}),t[20]=h):h=t[20],u=pa;let _;t[21]!==i||t[22]!==l||t[23]!==n||t[24]!==s?(_=e=>{let t=!s,r=l?`Open with AI ${e.displayName}, ${l}`:`Open with AI ${e.displayName}`;return(0,Z.jsxs)(Aa,{disabled:!t,onSelect:()=>{n&&i(e.id,n)},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":r,children:[(0,Z.jsx)(bS,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)},t[21]=i,t[22]=l,t[23]=n,t[24]=s,t[25]=_):_=t[25],m=a.map(_),t[2]=i,t[3]=l,t[4]=n,t[5]=s,t[6]=r,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12];let g;t[26]!==f||t[27]!==p||t[28]!==s||t[29]!==o?(g=o&&!f?(0,Z.jsxs)(Aa,{onSelect:p,disabled:s,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(bt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}):null,t[26]=f,t[27]=p,t[28]=s,t[29]=o,t[30]=g):g=t[30];let _;t[31]!==u||t[32]!==m||t[33]!==g?(_=(0,Z.jsxs)(u,{children:[m,g]}),t[31]=u,t[32]=m,t[33]=g,t[34]=_):_=t[34];let v;return t[35]!==d||t[36]!==h||t[37]!==_?(v=(0,Z.jsxs)(d,{children:[h,_]}),t[35]=d,t[36]=h,t[37]=_,t[38]=v):v=t[38],v}var YV=Vt(`HOVER_INTENT_MS`,80),XV=3,ZV=20,QV=new Map,$V=new Set,eH=[],tH=new Map;function nH(e){for(tH.delete(e),tH.set(e,!0);tH.size>ZV;){let e=tH.keys().next().value;if(e===void 0)break;tH.delete(e)}}function rH(e){$V.delete(e),aH()}function iH(e,t){let n=Date.now();Nt(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),se(e,t,n)}function aH(){for(;$V.size<XV&&eH.length>0;){let e=eH.shift();if(!e)break;if(!tH.has(e.docName)){$V.add(e.docName),nH(e.docName);try{let t=e.prewarm(e.docName);t&&iH(e.docName,t)}catch(t){Nt(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{rH(e.docName)}}}}function oH(e,t){if(Je(e)||tH.has(e))return;let n=QV.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(QV.delete(e),$V.size>=XV){eH.push({docName:e,prewarm:t});return}nH(e),$V.add(e);try{let n=t(e);n&&iH(e,n)}catch(t){Nt(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{rH(e)}},YV);QV.set(e,{timer:r,prewarm:t})}function sH(e){let t=QV.get(e);t&&(clearTimeout(t.timer),QV.delete(e))}var cH=/\.(md|mdx)$/i;function lH(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function uH(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function dH(e){let t=e.match(cH);return t?t[0]:null}async function fH(e,t){try{await navigator.clipboard.writeText(e),X.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(`Could not copy ${t}`)}}var pH=new Set([`agents`,`agent`,`claude`,`skill`]),mH=`ok-file-tree-link-decoration`,hH=`ok-file-tree-agent-decoration`;function gH(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function _H(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${gH(t)}</symbol>`}var vH=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1926
1926
|
${_H(mH,M)}
|
|
1927
1927
|
${_H(hH,$s)}
|
|
1928
|
-
</svg>`,yH=`${QB}\n${dV}`;function bH(e){return{...uM({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function xH(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&pH.has(t)}function SH(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function CH(e){let t=(0,$.c)(14),{item:n,workspace:r,onClose:i}=e,a=typeof window<`u`?window.okDesktop:void 0;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=SH(a.platform),t[0]=o):o=t[0];let s=o,c=r?null:`No workspace`,l=!r,u;t[1]!==n||t[2]!==i||t[3]!==r?(u=()=>{if(!r)return;i();let e=Fh(r.contentDir,BO(n),r.pathSeparator);a.shell.showItemInFolder(e)},t[1]=n,t[2]=i,t[3]=r,t[4]=u):u=t[4];let d=c?`${s}, ${c}`:s,f,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(ye,{"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{className:`flex-1`,children:s}),t[5]=f,t[6]=p):(f=t[5],p=t[6]);let m;t[7]===c?m=t[8]:(m=c?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:c}):null,t[7]=c,t[8]=m);let h;return t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==m?(h=(0,Z.jsxs)(Aa,{disabled:l,onSelect:u,"aria-label":d,children:[f,p,m]}),t[9]=l,t[10]=u,t[11]=d,t[12]=m,t[13]=h):h=t[13],h}function wH(e){let t=(0,$.c)(12),{dirAbsPath:n,onClose:r}=e,i=typeof window<`u`?window.okDesktop:void 0;if(!i)return null;let a=n===null?`No workspace`:null,o=n===null,s;t[0]!==n||t[1]!==r?(s=()=>{n!==null&&(r(),IV(i,n))},t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=a?`Open in Terminal, ${a}`:`Open in Terminal`,l,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(il,{"aria-hidden":`true`}),u=(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in Terminal`}),t[3]=l,t[4]=u):(l=t[3],u=t[4]);let d;t[5]===a?d=t[6]:(d=a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:a}):null,t[5]=a,t[6]=d);let f;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==d?(f=(0,Z.jsxs)(Aa,{disabled:o,onSelect:s,"aria-label":c,children:[l,u,d]}),t[7]=o,t[8]=s,t[9]=c,t[10]=d,t[11]=f):f=t[11],f}function TH(e){return zO({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function EH(e,t){return e!==t&&e.startsWith(t)}function DH(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>EH(e,t))).map(TH)}function OH(e,t){return e===t||e.startsWith(`${t}/`)}function kH(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function AH(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)mi(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=jO(e);OH(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function jH(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:OH(t.createdPath,e.path)}function MH(e){let t=(0,$.c)(78),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onStartCreatingFromTemplate:f,onDuplicate:p,onDelete:m,onExpandSubtree:h,onCollapseSubtree:g,folderTreePaths:_,isAsset:v,isAssetTreePath:y}=e,b,x,S,C,w,T,E,D;if(t[0]!==v||t[1]!==y||t[2]!==n||t[3]!==u?.appearance?.sidebar?.showAllFiles||t[4]!==u?.appearance?.sidebar?.showHiddenFiles||t[5]!==s||t[6]!==c||t[7]!==l){D=zO(n),C=n.kind===`directory`,b=!v&&c!==null,S=C?`Hide folder`:`Hide this file`,T=u?.appearance?.sidebar?.showHiddenFiles??!1,w=u?.appearance?.sidebar?.showAllFiles??!1,x=l!==null;let e=s.getSelectedPaths();E=e.includes(D.treePath)?DH(e,y):[],t[0]=v,t[1]=y,t[2]=n,t[3]=u?.appearance?.sidebar?.showAllFiles,t[4]=u?.appearance?.sidebar?.showHiddenFiles,t[5]=s,t[6]=c,t[7]=l,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w,t[13]=T,t[14]=E,t[15]=D}else b=t[8],x=t[9],S=t[10],C=t[11],w=t[12],T=t[13],E=t[14],D=t[15];let O=E,k;t[16]!==O||t[17]!==D?(k=O.length>1?O:[D],t[16]=O,t[17]=D,t[18]=k):k=t[18];let A=k,j=A.length>1?`Delete ${A.length} Items`:`Delete`,M;t[19]!==C||t[20]!==n||t[21]!==a?(M=C&&a?Fh(a.contentDir,BO(n),a.pathSeparator):null,t[19]=C,t[20]=n,t[21]=a,t[22]=M):M=t[22];let N=M,P;if(t[23]!==C||t[24]!==n||t[25]!==a){bb0:{if(!a||C){P=null;break bb0}let e=BO(n),t=e.lastIndexOf(`/`);if(t===-1){P=a.contentDir;break bb0}P=Fh(a.contentDir,e.slice(0,t),a.pathSeparator)}t[23]=C,t[24]=n,t[25]=a,t[26]=P}else P=t[26];let I=P,L;t[27]!==v||t[28]!==C||t[29]!==n||t[30]!==a?(L=v?null:C?zh({folderRelativePath:BO(n),workspace:a}):Lh({docName:OO(n.path),workspace:a}),t[27]=v,t[28]=C,t[29]=n,t[30]=a,t[31]=L):L=t[31];let z=L,B;t[32]===r?B=t[33]:(B=()=>r.close({restoreFocus:!1}),t[32]=r,t[33]=B);let V=B,H;t[34]===r?H=t[35]:(H=()=>r.close(),t[34]=r,t[35]=H);let U=H,W;t[36]===l?W=t[37]:(W=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,wi(t.error)),X.error(`Could not update sidebar settings`,{description:wi(t.error)}))},t[36]=l,t[37]=W);let G=W,ee;t[38]===l?ee=t[39]:(ee=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,wi(t.error)),X.error(`Could not update sidebar settings`,{description:wi(t.error)}))},t[38]=l,t[39]=ee);let te=ee,ne=0,re=0;if(C){let e=MO(n.path);for(let t of _)(t===e||t.startsWith(e))&&(ne++,MV(s.getItem(t))?.isExpanded()&&re++)}let ie=C&&re<ne,ae=C&&re>0,oe;t[40]===U?oe=t[41]:(oe=e=>{e||U()},t[40]=U,t[41]=oe);let se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[42]=se):se=t[42];let ce;t[43]!==i||t[44]!==b||t[45]!==x||t[46]!==U||t[47]!==V||t[48]!==j||t[49]!==A||t[50]!==N||t[51]!==te||t[52]!==G||t[53]!==o||t[54]!==z||t[55]!==S||t[56]!==v||t[57]!==C||t[58]!==n||t[59]!==s||t[60]!==c||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==h||t[65]!==d||t[66]!==f||t[67]!==I||t[68]!==w||t[69]!==T||t[70]!==ae||t[71]!==ie||t[72]!==D||t[73]!==a?(ce=(0,Z.jsx)(Oa,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),d(`file`,jO(n.path))},children:[(0,Z.jsx)($c,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),f(jO(n.path))},children:[(0,Z.jsx)(hc,{"aria-hidden":`true`}),`New from template`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),d(`folder`,jO(n.path))},children:[(0,Z.jsx)(yc,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(ma,{}),(0,Z.jsx)(CH,{item:n,workspace:a,onClose:U}),(0,Z.jsx)(JV,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(wH,{dirAbsPath:N,onClose:U}),(0,Z.jsxs)(oo,{children:[(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Copy Path`]}),(0,Z.jsxs)(pa,{children:[(0,Z.jsx)(Aa,{disabled:!a,onSelect:()=>{a&&(U(),fH(Fh(a.contentDir,BO(n),a.pathSeparator),`full path`))},children:`Full Path`}),(0,Z.jsx)(Aa,{onSelect:()=>{U(),fH(BO(n),`relative path`)},children:`Relative Path`})]})]}),(0,Z.jsx)(ma,{}),(0,Z.jsx)(da,{checked:T,onCheckedChange:G,disabled:!x,"data-testid":`file-tree-menu-show-hidden-files`,children:`Show Hidden Files`}),(0,Z.jsx)(da,{checked:w,onCheckedChange:te,disabled:!x,"data-testid":`file-tree-menu-show-all-files`,children:`Show all files`}),ie||ae?(0,Z.jsx)(ma,{}):null,ie?(0,Z.jsxs)(Aa,{onSelect:()=>{U(),h(n.path)},children:[(0,Z.jsx)(sl,{"aria-hidden":`true`}),`Expand All`]}):null,ae?(0,Z.jsxs)(Aa,{onSelect:()=>{U(),g(n.path)},children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Collapse All`]}):null,(0,Z.jsx)(ma,{}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{U(),p(D)},children:[(0,Z.jsx)(je,{"aria-hidden":`true`}),`Duplicate`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(it,{"aria-hidden":`true`}),`Rename`]}),(0,Z.jsxs)(Aa,{"data-testid":`file-tree-menu-hide`,disabled:!b,onSelect:()=>{if(!c)return;U();let e=iV(D),t=po(c.current()),n=no(t,e);if(n===t)return;c.patch(io(n));let r=D.path.split(`/`).pop()||D.path;X.success(`Hidden folder “${r}”`,{description:`Manage hidden files in Settings → Ignore patterns.`,duration:5e3})},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),S]}),(0,Z.jsxs)(Aa,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(A)},children:[(0,Z.jsx)(pe,{"aria-hidden":`true`}),j]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(CH,{item:n,workspace:a,onClose:U}),!v&&(0,Z.jsx)(JV,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(wH,{dirAbsPath:I,onClose:U}),(0,Z.jsxs)(oo,{children:[(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Copy Path`]}),(0,Z.jsxs)(pa,{children:[(0,Z.jsx)(Aa,{disabled:!a,onSelect:()=>{a&&(U(),fH(Fh(a.contentDir,BO(n),a.pathSeparator),`full path`))},children:`Full Path`}),(0,Z.jsx)(Aa,{onSelect:()=>{U(),fH(BO(n),`relative path`)},children:`Relative Path`})]})]}),v?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{U(),p(D)},children:[(0,Z.jsx)(je,{"aria-hidden":`true`}),`Duplicate`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(it,{"aria-hidden":`true`}),`Rename`]}),(0,Z.jsxs)(Aa,{"data-testid":`file-tree-menu-hide`,disabled:!b,onSelect:()=>{if(!c)return;U();let e=iV(D),t=po(c.current()),n=no(t,e);if(n===t)return;c.patch(io(n));let r=D.path.split(`/`).pop()||D.path;X.success(`Hidden “${r}”`,{description:`Manage hidden files in Settings → Ignore patterns.`,duration:5e3})},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),S]}),(0,Z.jsxs)(Aa,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(A)},children:[(0,Z.jsx)(pe,{"aria-hidden":`true`}),j]})]})]})}),t[43]=i,t[44]=b,t[45]=x,t[46]=U,t[47]=V,t[48]=j,t[49]=A,t[50]=N,t[51]=te,t[52]=G,t[53]=o,t[54]=z,t[55]=S,t[56]=v,t[57]=C,t[58]=n,t[59]=s,t[60]=c,t[61]=g,t[62]=m,t[63]=p,t[64]=h,t[65]=d,t[66]=f,t[67]=I,t[68]=w,t[69]=T,t[70]=ae,t[71]=ie,t[72]=D,t[73]=a,t[74]=ce):ce=t[74];let le;return t[75]!==oe||t[76]!==ce?(le=(0,Z.jsxs)(ka,{open:!0,modal:!1,onOpenChange:oe,children:[se,ce]}),t[75]=oe,t[76]=ce,t[77]=le):le=t[77],le}function NH(e){let t=(0,$.c)(236),{ref:n}=e,{activeDocName:r,activeTarget:i,closeTabs:a,closeDocument:o,closeAndClearForRename:s,getPoolActiveDocName:c,isNewTabActive:l,openTarget:u,prewarm:d,remapTabsForRename:f}=dt(),{notifySidebarFileSelected:p}=UD(),{resolvedTheme:m}=Gr(),{addPage:h}=Nr(),g;t[0]!==p||t[1]!==u?(g=function(e){u({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),lH(kr(e)),p()},t[0]=p,t[1]=u,t[2]=g):g=t[2];let _=g,v;t[3]!==p||t[4]!==u?(v=function(e){let t=ei(e);u({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),lH(t),p()},t[3]=p,t[4]=u,t[5]=v):v=t[5];let y=v,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[6]=x):x=t[6];let[S,C]=(0,Q.useState)(x),[w,E]=(0,Q.useState)(!0),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),B=(0,Q.useRef)(S),V;t[7]!==S||t[8]!==y||t[9]!==_||t[10]!==p||t[11]!==u?(V=function(e,t){let n=bV(e,t===void 0?S:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,NO(e));return}if(n.kind===`asset`){u({kind:`asset`,target:n.path,assetPath:n.path,mediaKind:n.mediaKind},{tabBehavior:`replace-active`}),lH(n.hash),p();return}if(n.kind===`folder`){y(n.path);return}_(n.path)},t[7]=S,t[8]=y,t[9]=_,t[10]=p,t[11]=u,t[12]=V):V=t[12];let H=V,U=(0,Q.useRef)(r),W;t[13]===S?W=t[14]:(W=new Set(S.filter(An).map($H)),t[13]=S,t[14]=W);let G=W,ee=(0,Q.useRef)(G),te;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[15]=te):te=t[15];let ne=(0,Q.useRef)(te),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(QH),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(!1),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(!1),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),K=(0,Q.useRef)(null),fe=(0,Q.useRef)(ZH),pe=(0,Q.useRef)(XH),me=(0,Q.useRef)(YH),he=(0,Q.useRef)(JH),ge=(0,Q.useRef)(i),{selectedFilePath:_e,selectedFolderPath:ve,navigationPath:ye}=yV(i,l?null:r),be=_e?DO(_e,S.find(e=>mi(e)&&e.docName===_e)?.docExt):ve?MO(ve):i?.kind===`asset`?i.assetPath:null,xe=sg().states,{dispatch:Se}=Xh(),Ce;t[16]!==Se||t[17]!==xe?(Ce={installStates:xe,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Se},t[16]=Se,t[17]=xe,t[18]=Ce):Ce=t[18];let we=Ce,{okignoreBinding:Te,projectLocalBinding:Ee,merged:De}=b(),Oe=De?.appearance?.sidebar?.showHiddenFiles??!1,ke=De?.appearance?.sidebar?.showAllFiles??!1,Ae;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>ce.current===null,t[19]=Ae):Ae=t[19];let je=Ae,Me;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[20]=Me):Me=t[20];let Ne;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={set:`complete`,spriteSheet:vH},t[21]=Ne):Ne=t[21];let Pe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[22]=Pe):Pe=t[22];let Fe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={canDrag:je,canDrop:je,onDropComplete:e=>he.current(e),onDropError:qH},t[23]=Fe):Fe=t[23];let Ie;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ie={paths:Me,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:Ne,unsafeCSS:yH,composition:Pe,dragAndDrop:Fe,renaming:{canRename:je,onRename:e=>pe.current(e),onError:e=>me.current(e)},onSelectionChange:e=>fe.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=B.current.find(e=>mi(e)&&DO(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:mH,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:xH(t.path)?{icon:hH,title:`Agent configuration file`}:null}},t[24]=Ie):Ie=t[24];let{model:q}=qB(Ie),Le;t[25]===q?Le=t[26]:(Le=function(e){let t=q.getItem(e)??q.getItem(MO(e));return t?.isDirectory()?MO(jO(t.getPath())):e},t[25]=q,t[26]=Le);let Re=Le,ze,Be;t[27]===S?(ze=t[28],Be=t[29]):(Be=PO(S),ze=FO(Be),t[27]=S,t[28]=ze,t[29]=Be);let Ve=ze,He=(0,Q.useRef)(Be),We;t[30]===S?We=t[31]:(We=LO(S),t[30]=S,t[31]=We);let Ge=We,Ke=(0,Q.useRef)(Ge),qe=ve?RO(MO(ve)).slice(0,-1):RO(be??ye),Je=qe.join(`\0`),Ye;if(t[32]!==q){let e=()=>{let e=new Set;for(let t of Ke.current)MV(q.getItem(t))?.isExpanded()&&e.add(t);return e};Ye=t=>{let n=new Set(LO(t??B.current)),r=e();for(let e of ne.current)r.add(e);return[...r].filter(e=>n.has(e))},t[32]=q,t[33]=Ye}else Ye=t[33];let Xe=Ye,Ze;t[34]!==Xe||t[35]!==q?(Ze=e=>{let t=PO(e??B.current);q.resetPaths(t,{initialExpandedPaths:Xe(e)})},t[34]=Xe,t[35]=q,t[36]=Ze):Ze=t[36];let Qe=Ze,$e;t[37]===Symbol.for(`react.memo_cache_sentinel`)?($e=e=>{ae.current=IO(e)},t[37]=$e):$e=t[37];let et=$e,tt;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>ee.current.has(e),t[38]=tt):tt=t[38];let nt=tt,rt;t[39]!==h||t[40]!==y||t[41]!==_||t[42]!==Qe?(rt=async function(e){if(ce.current!==null)return;let t=()=>{A(null),ce.current=null};ce.current=e.path,A(e.path),O(null);try{let n=await T(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),`Failed to duplicate path`);if(!n.ok){X.error(n.title),O(n.title),Qe(),t();return}let r=N(yi,n.body,`duplicate-path`,null);if(r===null){X.error(`Duplicate succeeded but the sidebar may be out of date — refresh to resync`),O(`Duplicate succeeded but the sidebar may be out of date — refresh to resync`),Wr([`files`,`backlinks`,`graph`]),Qe(),t();return}for(let e of r.duplicatedDocNames)h(e);C(t=>{let n=QO(t,e,r);return Qe(n),et(n),n}),Wr([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?y(r.path):_(r.path)),X.success(r.kind===`folder`?`Folder duplicated`:`File duplicated`,{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(`Could not duplicate item`,{description:r}),Qe(),t()}},t[39]=h,t[40]=y,t[41]=_,t[42]=Qe,t[43]=rt):rt=t[43];let it=rt,at=(0,Q.useRef)(it),ot;t[44]===it?ot=t[45]:(ot=()=>{at.current=it},t[44]=it,t[45]=ot),(0,Q.useEffect)(ot);let st=function(e){let t=uH(e);if(!t||dH(t))return!1;let n=q.getFocusedPath()??q.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||nt(n))return!1;let r=dH(n);if(!r)return!1;let i=MO(t);if(!Ke.current.includes(i))return!1;let a=`${t}${r}`;return He.current.includes(a)?!1:(Ft({sourcePath:n,destinationPath:a,isFolder:!1}),q.move(n,a),!0)},ct;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>{let t=e??re.current;!t||re.current!==t||(t.disposeCommitListener(),re.current=null)},t[46]=ct):ct=t[46];let lt=ct,ut;t[47]!==lt||t[48]!==o||t[49]!==a||t[50]!==Qe?(ut=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;lt(e),r&&A(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=await T(t,`Failed to clean up pending ${e.kind}`);if(n.ok)return;let i=`${n.title} - ${e.kind} "${e.createdPath}" still exists on disk`;r?X.error(i):console.warn(`[FileTree] cleanup pending create failed: ${i}`),r&&(A(null),Qe());return}}catch(t){console.warn(`[FileTree] cleanup pending create failed:`,t),r&&X.error(`Network error - ${e.kind} "${e.createdPath}" still exists on disk`),r&&(A(null),Qe());return}r&&(e.kind===`file`?o(e.createdPath):a([Ue(e.createdPath)],{force:!0})),r&&C(t=>{let n=ZO(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return et(n),n}),Wr([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&A(null)},t[47]=lt,t[48]=o,t[49]=a,t[50]=Qe,t[51]=ut):ut=t[51];let ft=ut,pt,mt;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>()=>{let e=re.current;e&&ie.current(e,{restoreLocation:!1,updateUi:!1}).catch(KH)},mt=[],t[52]=pt,t[53]=mt):(pt=t[52],mt=t[53]),(0,Q.useEffect)(pt,mt);let ht,gt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>{let e=!0,t=KV(async function(){try{let t=ue.current,n=await T(await fetch(t?`/api/documents?showAll=true`:`/api/documents`),`Failed to load documents`);if(!e)return;if(!n.ok)O(n.title);else{let e=Mr.safeParse(n.body);if(!e.success)O(`Documents response did not match expected shape.`);else{let n=le.current||t;C(or(e.data.documents,n)),O(null)}}}catch(t){let n=t;e&&O(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&E(!1)});de.current=()=>t.request(),t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=Dr(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,de.current=null,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},gt=[],t[54]=ht,t[55]=gt):(ht=t[54],gt=t[55]),(0,Q.useEffect)(ht,gt);let _t=(0,Q.useRef)(!0),yt;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(yt=()=>{if(_t.current){_t.current=!1;return}de.current?.()},t[56]=yt):yt=t[56];let bt;t[57]===Oe?bt=t[58]:(bt=[Oe],t[57]=Oe,t[58]=bt),(0,Q.useEffect)(yt,bt);let xt=(0,Q.useRef)(!0),St;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(St=()=>{if(xt.current){xt.current=!1;return}de.current?.()},t[59]=St):St=t[59];let Ct;t[60]===ke?Ct=t[61]:(Ct=[ke],t[60]=ke,t[61]=Ct),(0,Q.useEffect)(St,Ct);let wt,Tt;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=N(Ar,n,`workspace`,null);r&&z({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(GH),()=>{e=!1}},Tt=[],t[62]=wt,t[63]=Tt):(wt=t[62],Tt=t[63]),(0,Q.useEffect)(wt,Tt);let Et;t[64]!==Xe||t[65]!==q||t[66]!==Ve?(Et=()=>{if(ae.current===Ve){ae.current=null;return}q.resetPaths(He.current,{initialExpandedPaths:Xe()})},t[64]=Xe,t[65]=q,t[66]=Ve,t[67]=Et):Et=t[67];let Dt;t[68]!==q||t[69]!==Ve?(Dt=[q,Ve],t[68]=q,t[69]=Ve,t[70]=Dt):Dt=t[70],(0,Q.useEffect)(Et,Dt),PV(q,be,Je,se);let Ot,kt;t[71]===q?(Ot=t[72],kt=t[73]):(Ot=()=>q.subscribe(()=>{if(!q.isSearchOpen())for(let e of ne.current){let t=MV(q.getItem(e));t&&!t.isExpanded()&&t.expand()}}),kt=[q],t[71]=q,t[72]=Ot,t[73]=kt),(0,Q.useEffect)(Ot,kt);let At,jt;t[74]===q?(At=t[75],jt=t[76]):(At=()=>q.onMutation(`remove`,e=>{let t=re.current;!t||e.path!==t.renamePath||ie.current(t)}),jt=[q],t[74]=q,t[75]=At,t[76]=jt),(0,Q.useEffect)(At,jt);let Nt;t[77]!==h||t[78]!==s||t[79]!==c||t[80]!==y||t[81]!==f?(Nt=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??U.current,a=$O(i,e),o=n?.folderPath??(ge.current?.kind===`folder`?ge.current.folderPath:null),l=o?Mt(o,r):null;vt(e);let u=ek(e,c());await Promise.all(u.map(e=>s(e)));for(let t of e)h(t.toDocName);f(e,r),C(t=>{let n=XO(t,e,r);return et(n),n}),o&&l&&l!==o?y(l):a&&a!==i&&(window.location.hash=kr(a)),Wr([`files`,`backlinks`,`graph`])},t[77]=h,t[78]=s,t[79]=c,t[80]=y,t[81]=f,t[82]=Nt):Nt=t[82];let Pt=Nt;async function Ft(e){let t=VO(e.sourcePath,e.isFolder);A(t),O(null);try{if(!e.isFolder&&nt(t)){X.error(`Assets cannot be renamed from the sidebar`),queueMicrotask(()=>{Qe()}),lt(),A(null);return}let n=XB(e.sourcePath,e.destinationPath,e.isFolder);if(n.kind===`block`){X.error(`File extensions are managed automatically - please rename without changing the extension`),queueMicrotask(()=>{Qe()}),lt(),A(null);return}let r=VO(n.destinationPath,e.isFolder),i=e.isFolder?{kind:`folder`,fromPath:jO(t),toPath:jO(r)}:{kind:`file`,fromPath:OO(t),toPath:OO(r)},a={docName:U.current,folderPath:ge.current?.kind===`folder`?ge.current.folderPath:null},o=await T(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to rename path`);if(!o.ok){X.error(o.title),O(o.title),Qe();let e=re.current;e&&e.renamePath===t?await ft(e):lt(),A(null);return}let s=N(mr,o.body,`rename-path`,{renamed:[]});try{await Pt(s.renamed,e.isFolder?[{fromPath:jO(t),toPath:jO(r)}]:[],a)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:t,destinationTreePath:r,renamedCount:s.renamed.length}),X.error(`Rename succeeded but the sidebar may be out of date — refresh to resync`)}lt(),A(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),X.error(`Network error — please try again`),O(`Network error — please try again`),Qe();let n=re.current;n&&n.renamePath===t?await ft(n):lt(),A(null)}}let It;t[83]!==Pt||t[84]!==Qe?(It=async function(e){let t=e.draggedPaths.map(t=>{let n=WO(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(WH);if(t.length!==0){if(t.some(e=>nt(e.sourcePath))){X.error(`Assets cannot be moved from the sidebar`),Qe();return}A(t[0]?.sourcePath??null),O(null);try{let e=[],n=[],r={docName:U.current,folderPath:ge.current?.kind===`folder`?ge.current.folderPath:null};for(let r of t){let t=r.sourcePath.endsWith(`/`),i=t?{kind:`folder`,fromPath:jO(r.sourcePath),toPath:jO(r.destinationTreePath)}:{kind:`file`,fromPath:OO(r.sourcePath),toPath:OO(r.destinationTreePath)},a=await T(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to move`);if(!a.ok){X.error(a.title),O(a.title),Qe(),A(null);return}let o=N(mr,a.body,`rename-path:drop`,{renamed:[]});e=e.concat(o.renamed),t&&n.push({fromPath:jO(r.sourcePath),toPath:jO(r.destinationTreePath)})}try{await Pt(e,n,r)}catch(n){console.warn(`[FileTree] post-move reconciliation failed`,{err:n,operationCount:t.length,renamedCount:e.length}),X.error(`Move succeeded but the sidebar may be out of date — refresh to resync`)}A(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(`Network error — please try again`),Qe(),A(null)}}},t[83]=Pt,t[84]=Qe,t[85]=It):It=t[85];let Lt=It,Rt;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=function(e){L({parentDir:e})},t[86]=Rt):Rt=t[86];let zt=Rt,Bt;t[87]!==ft||t[88]!==lt||t[89]!==q||t[90]!==y||t[91]!==_||t[92]!==Qe||t[93]!==Be?(Bt=async function(e,t){if(ce.current)return;let n=re.current;n&<(n);try{let n=HO(e,t,[...Be,...Ke.current]);A(n.renamePath),ce.current=n.renamePath;let r=window.location.hash,i;if(e===`file`){let e=UO(`file`,n.addPath),t=await T(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create file`);if(!t.ok){X.error(t.title),O(t.title),A(null),ce.current=null;return}let r=OO(e),a=N(Ur,t.body,`create-page`,{docName:r}).docName;i=a;let o=e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`;C(e=>{if(e.some(e=>mi(e)&&e.docName===a))return e;let t=[...e,{kind:`document`,docName:a,docExt:o,modified:new Date().toISOString(),size:0}];return et(t),t}),Wr([`files`,`backlinks`,`graph`]),_(a)}else{let e=jO(n.addPath),t=await T(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create folder`);if(!t.ok){X.error(t.title),O(t.title),A(null),ce.current=null;return}i=N(qr,t.body,`create-folder`,{path:e}).path,C(e=>{if(e.some(e=>ur(e)&&e.path===i))return e;let t=[...e,{kind:`folder`,path:i,modified:new Date().toISOString(),size:0}];return et(t),t}),Wr([`files`]),y(i)}let a=!1,o=e=>{if(e.key!==`Enter`)return;let t=re.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>lt(t))};document.addEventListener(`keydown`,o,!0),re.current={kind:e,renamePath:n.renamePath,createdPath:i,previousHash:r,disposeCommitListener:()=>{a||(a=!0,document.removeEventListener(`keydown`,o,!0))}},A(null),ce.current=null,q.add(n.addPath),q.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(`Could not start creating a new item`);let t=re.current;t?await ft(t):lt(),A(null),ce.current=null,Qe()}},t[87]=ft,t[88]=lt,t[89]=q,t[90]=y,t[91]=_,t[92]=Qe,t[93]=Be,t[94]=Bt):Bt=t[94];let Vt=Bt,Ht;t[95]===q?Ht=t[96]:(Ht=function(e){let t=MO(e);(0,Q.startTransition)(()=>{for(let e of Ke.current)if(e===t||e.startsWith(t)){let t=MV(q.getItem(e));t&&t.expand()}})},t[95]=q,t[96]=Ht);let Ut=Ht,Wt;t[97]===q?Wt=t[98]:(Wt=function(e){let t=MO(e),n=new Set(ne.current);(0,Q.startTransition)(()=>{for(let e of[...Ke.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=MV(q.getItem(e));t&&t.collapse()}})},t[97]=q,t[98]=Wt);let Gt=Wt,Kt;t[99]!==H||t[100]!==qe||t[101]!==r||t[102]!==i||t[103]!==G||t[104]!==k||t[105]!==ft||t[106]!==S||t[107]!==Ge||t[108]!==Lt||t[109]!==Ft||t[110]!==Re||t[111]!==st||t[112]!==ke||t[113]!==Oe||t[114]!==Be?(Kt=()=>{B.current=S,U.current=r,ge.current=i,ee.current=G,ce.current=k,le.current=Oe,ue.current=ke,He.current=Be,Ke.current=Ge,ne.current=qe,ie.current=ft,fe.current=e=>{if(se.current||e.length!==1)return;let t=e[0];t&&H(Re(t),S)},me.current=e=>{st(e)||X.error(e)},pe.current=Ft,he.current=Lt},t[99]=H,t[100]=qe,t[101]=r,t[102]=i,t[103]=G,t[104]=k,t[105]=ft,t[106]=S,t[107]=Ge,t[108]=Lt,t[109]=Ft,t[110]=Re,t[111]=st,t[112]=ke,t[113]=Oe,t[114]=Be,t[115]=Kt):Kt=t[115],(0,Q.useLayoutEffect)(Kt);let qt,J;t[116]===q?(qt=t[117],J=t[118]):(qt=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||kH(e.target))return;let a=K.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=q.getFocusedPath()??q.getSelectedPaths()[0]??null;if(!t)return;let n=q.getItem(t)??q.getItem(MO(t)),r=n?.isDirectory()?MO(jO(n.getPath())):t;if(ee.current.has(r))return;at.current(TH(r)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Ke.current,...He.current]);se.current=!0;for(let e of u)!e||ee.current.has(e)||q.getItem(e)?.select();queueMicrotask(()=>{se.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},J=[q],t[116]=q,t[117]=qt,t[118]=J),(0,Q.useEffect)(qt,J);let Jt,Yt;t[119]!==S.length||t[120]!==w?(Jt=()=>{if(w||S.length===0)return;let e=K.current?.querySelector(Uj)?.shadowRoot;if(!e)return;let t=UH,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Yt=[w,S.length],t[119]=S.length,t[120]=w,t[121]=Jt,t[122]=Yt):(Jt=t[121],Yt=t[122]),(0,Q.useEffect)(Jt,Yt);let Xt,Zt;t[123]!==S.length||t[124]!==w?(Xt=()=>{if(w||S.length===0)return;let e=K.current?.querySelector(Uj)?.shadowRoot;if(!e)return;let t=()=>$B(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Zt=[w,S.length],t[123]=S.length,t[124]=w,t[125]=Xt,t[126]=Zt):(Xt=t[125],Zt=t[126]),(0,Q.useEffect)(Xt,Zt);let Qt,$t;t[127]!==S.length||t[128]!==w?(Qt=()=>{if(w||S.length===0)return;let e=K.current?.querySelector(Uj)?.shadowRoot;if(!e)return;let t=()=>fV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},$t=[w,S.length],t[127]=S.length,t[128]=w,t[129]=Qt,t[130]=$t):(Qt=t[129],$t=t[130]),(0,Q.useEffect)(Qt,$t);let en;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(en={folderCount:0,expandedCount:0},t[131]=en):en=t[131];let tn=(0,Q.useRef)(en),nn=(0,Q.useRef)(Vt),rn=(0,Q.useRef)(zt),an;t[132]===Vt?an=t[133]:(an=()=>{nn.current=Vt,rn.current=zt},t[132]=Vt,t[133]=an),(0,Q.useEffect)(an);let on,sn;t[134]===q?(on=t[135],sn=t[136]):(on=()=>({startCreating(e,t){nn.current(e,t)},startCreatingFromTemplate(e){rn.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of Ke.current){let t=MV(q.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ne.current);(0,Q.startTransition)(()=>{for(let t of[...Ke.current].reverse()){if(e.has(t))continue;let n=MV(q.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Ke.current,t=0;for(let n of e)MV(q.getItem(n))?.isExpanded()&&t++;let n=e.length,r=tn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return tn.current=i,i},subscribe(e){return q.subscribe(e)}}),sn=[q],t[134]=q,t[135]=on,t[136]=sn),(0,Q.useImperativeHandle)(n,on,sn);let cn;t[137]!==lt||t[138]!==s||t[139]!==a||t[140]!==q?(cn=async function(e,t,n){let r=AH(e,B.current,Ke.current),i=re.current;i&&e.some(e=>jH(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),lt(i));let o=new Set([...r.docNames,...t]),c=new Set([...r.folderPaths,...n]);a([...[...o].map(HH),...[...c].map(VH)],{force:!0}),await Promise.all([...o].map(e=>s(e)));for(let t of e){let e=t.kind===`folder`?MO(t.path):DO(t.path,t.docExt);q.getItem(e)&&q.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}C(e=>{let t=ZO(e,[...o]);for(let e of c)t=ZO(t,[],e);return et(t),t}),Wr([`files`,`backlinks`,`graph`])},t[137]=lt,t[138]=s,t[139]=a,t[140]=q,t[141]=cn):cn=t[141];let ln=cn,un;t[142]===ln?un=t[143]:(un=async function(e){let t=[],n=[],r=[];for(let i of e){A(i.path);let e=await T(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:i.kind,path:i.path})}),`Failed to delete path`);if(!e.ok)return r.length>0&&await ln(r,t,n),X.error(e.title),!1;let a=N(Si,e.body,`delete-path`,{deletedDocNames:[]});t.push(...a.deletedDocNames),i.kind===`folder`&&n.push(i.path),r.push(i)}return await ln(r,t,n),!0},t[142]=ln,t[143]=un);let dn=un,fn;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(fn=async function(e,t,n){let r=[],i=[];for(let a of e){A(a.path);let e=tk(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:EV(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[144]=fn):fn=t[144];let pn=fn,mn;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(mn=async function(e){let t=[],n=[],r=[];for(let i of e)try{let e=await T(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:i.kind,path:i.path})}),`Failed to clean up after trash`);if(!e.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${i.kind}:${i.path}`,reason:e.title}),r.push({target:i,reason:e.title});continue}let a=N(Tn,e.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...a.deletedDocNames),i.kind===`folder`&&n.push(i.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${i.kind}:${i.path}`,err:t}),r.push({target:i,reason:`Network error during cleanup`})}if(r.length>0){let e=r.length,t=e===1?`item`:`items`;X.error(`Server-side cleanup failed for ${e} ${t}`,{description:`The file is in your Trash; the file-watcher will reconcile.`})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[145]=mn):mn=t[145];let hn=mn,gn;t[146]!==ln||t[147]!==dn||t[148]!==Qe||t[149]!==R?(gn=async function(e){let t=e[0];if(!t)return;A(t.path),M(null);let n=typeof window<`u`?window.okDesktop:void 0;try{if(n&&R){let{trashed:t,failed:r}=await pn(e,n,R);if(t.length>0){let e=await hn(t);e?await ln(t,e.deletedDocNames,e.deletedFolderPaths):await ln(t,t.filter(BH).map(zH),t.filter(RH).map(LH))}r.length>0&&F({failed:r,originalTargets:[...e]}),A(null)}else{let t=await dn(e);A(null),t||Qe()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(`Could not complete delete`,{description:n}),A(null),Qe()}},t[146]=ln,t[147]=dn,t[148]=Qe,t[149]=R,t[150]=gn):gn=t[150];let _n=gn,vn;t[151]!==dn||t[152]!==Qe||t[153]!==P?(vn=async function(){if(!P)return;let e=new Set(P.failed.map(IH)),t=P.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(F(null),t.length!==0){A(t[0]?.path??null);try{let e=await dn(t);A(null),e||Qe()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(`Could not complete delete`,{description:n}),A(null),Qe()}}},t[151]=dn,t[152]=Qe,t[153]=P,t[154]=vn):vn=t[154];let yn=vn,bn;t[155]!==_n||t[156]!==P?(bn=async function(){if(!P)return;let e=new Set(P.failed.map(FH)),t=P.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));F(null),await _n(t)},t[155]=_n,t[156]=P,t[157]=bn):bn=t[157];let xn=bn,Sn=(0,Q.useRef)(_n),Cn;t[158]===_n?Cn=t[159]:(Cn=()=>{Sn.current=_n},t[158]=_n,t[159]=Cn),(0,Q.useEffect)(Cn);let wn,En;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(wn=()=>VV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=B.current.find(e=>mi(e)&&e.docName===t);Sn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Sn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),En=[],t[160]=wn,t[161]=En):(wn=t[160],En=t[161]),(0,Q.useEffect)(wn,En);let Dn,On;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=()=>GV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=B.current.find(e=>mi(e)&&e.docName===t);at.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){at.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),On=[],t[162]=Dn,t[163]=On):(Dn=t[162],On=t[163]),(0,Q.useEffect)(Dn,On);let kn,jn;t[164]===q?(kn=t[165],jn=t[166]):(kn=()=>UV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=DO(t,B.current.find(e=>mi(e)&&e.docName===t)?.docExt);q.startRenaming(n);return}if(e.kind===`folder`){q.startRenaming(e.folderPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),jn=[q],t[164]=q,t[165]=kn,t[166]=jn),(0,Q.useEffect)(kn,jn);let Mn;t[167]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=function(){let e=oe.current;e&&sH(e),oe.current=null},t[167]=Mn):Mn=t[167];let Nn=Mn,Pn;t[168]===d?Pn=t[169]:(Pn=function(e){let t=eU(e.nativeEvent);if(!t||t.endsWith(`/`)){Nn();return}let n=OO(t),r=B.current.find(e=>kO(e)===t);if(r&&An(r)){Nn();return}oe.current!==n&&(Nn(),oe.current=n,oH(n,e=>d(e)))},t[168]=d,t[169]=Pn);let Fn=Pn,In;t[170]!==H||t[171]!==q||t[172]!==y?(In=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=tU(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?MO(n):n;if(q.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=jO(r);if(window.location.hash===ei(e))return;queueMicrotask(()=>y(e));return}let i=OO(r);window.location.hash!==kr(i)&&queueMicrotask(()=>H(r))},t[170]=H,t[171]=q,t[172]=y,t[173]=In):In=t[173];let Ln=In;if(w){let e;return t[174]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rU,{}),t[174]=e):e=t[174],e}if(S.length===0){if(D){let e;return t[175]===D?e=t[176]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:D})}),t[175]=D,t[176]=e),e}let e;t[177]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[177]=e):e=t[177];let n;return t[178]===Vt?n=t[179]:(n=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>Vt(`file`,``),children:`Create your first file`})]}),t[178]=Vt,t[179]=n),n}let Rn=k!==null,zn=j?.targets[0]??null,Bn;t[180]===D?Bn=t[181]:(Bn=D&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:D}),t[180]=D,t[181]=Bn);let Vn;t[182]===m?Vn=t[183]:(Vn=bH(m),t[182]=m,t[183]=Vn);let Hn;t[184]!==Rn||t[185]!==G||t[186]!==Gt||t[187]!==Ut||t[188]!==Ge||t[189]!==it||t[190]!==we||t[191]!==De||t[192]!==q||t[193]!==Te||t[194]!==Ee||t[195]!==Vt||t[196]!==R?(Hn=(e,t)=>(0,Z.jsx)(MH,{item:e,context:t,anyActionBusy:Rn,workspace:R,handoff:we,model:q,okignoreBinding:Te,projectLocalBinding:Ee,mergedConfig:De,onStartCreating:Vt,onStartCreatingFromTemplate:zt,onDuplicate:it,onDelete:e=>M({targets:e}),onExpandSubtree:Ut,onCollapseSubtree:Gt,folderTreePaths:Ge,isAsset:G.has(e.path),isAssetTreePath:nt}),t[184]=Rn,t[185]=G,t[186]=Gt,t[187]=Ut,t[188]=Ge,t[189]=it,t[190]=we,t[191]=De,t[192]=q,t[193]=Te,t[194]=Ee,t[195]=Vt,t[196]=R,t[197]=Hn):Hn=t[197];let Un;t[198]!==Ln||t[199]!==Fn||t[200]!==q||t[201]!==Bn||t[202]!==Vn||t[203]!==Hn?(Un=(0,Z.jsx)(`div`,{ref:K,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(KB,{header:Bn,model:q,style:Vn,onClickCapture:Ln,onMouseMove:Fn,onMouseLeave:Nn,renderContextMenu:Hn})}),t[198]=Ln,t[199]=Fn,t[200]=q,t[201]=Bn,t[202]=Vn,t[203]=Hn,t[204]=Un):Un=t[204];let Wn=!!j,Gn;t[205]===k?Gn=t[206]:(Gn=e=>{!e&&!k&&M(null)},t[205]=k,t[206]=Gn);let Kn;t[207]!==k||t[208]!==j||t[209]!==_n||t[210]!==zn?(Kn=j&&zn&&(0,Z.jsx)(ho,{...(()=>{let e=CV(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,j.targets);return e?{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(PH)}):null}:{itemName:j.targets.length===1?`${zn.name}${zn.kind===`file`?zn.docExt??`.md`:`/`}`:void 0,customTitle:j.targets.length>1?`Delete selected items`:void 0,customDescription:j.targets.length>1?`Are you sure you want to delete ${j.targets.length} selected items? Folders and all files inside them will be deleted. This action cannot be undone.`:zn.kind===`folder`?`Are you sure you want to delete ${zn.name}/ and all files inside? This action cannot be undone.`:void 0}})(),isSubmitting:k!==null,onDelete:()=>_n(j.targets)}),t[207]=k,t[208]=j,t[209]=_n,t[210]=zn,t[211]=Kn):Kn=t[211];let qn;t[212]!==Wn||t[213]!==Gn||t[214]!==Kn?(qn=(0,Z.jsx)(Vo,{open:Wn,onOpenChange:Gn,children:Kn}),t[212]=Wn,t[213]=Gn,t[214]=Kn,t[215]=qn):qn=t[215];let Jn=!!P,Yn;t[216]===k?Yn=t[217]:(Yn=e=>{!e&&!k&&F(null)},t[216]=k,t[217]=Yn);let Xn;t[218]!==k||t[219]!==yn||t[220]!==xn||t[221]!==P?(Xn=P&&(0,Z.jsx)(AV,{failedTargets:P.failed,isSubmitting:k!==null,onDeletePermanently:yn,onRetry:xn,onCancel:()=>F(null)}),t[218]=k,t[219]=yn,t[220]=xn,t[221]=P,t[222]=Xn):Xn=t[222];let Zn;t[223]!==Jn||t[224]!==Yn||t[225]!==Xn?(Zn=(0,Z.jsx)(Vo,{open:Jn,onOpenChange:Yn,children:Xn}),t[223]=Jn,t[224]=Yn,t[225]=Xn,t[226]=Zn):Zn=t[226];let Qn=I!==null,$n;t[227]===Symbol.for(`react.memo_cache_sentinel`)?($n=e=>{e||L(null)},t[227]=$n):$n=t[227];let er=I?.parentDir??``,tr;t[228]!==Qn||t[229]!==er?(tr=(0,Z.jsx)(Sm,{open:Qn,onOpenChange:$n,kind:`file`,initialDir:er}),t[228]=Qn,t[229]=er,t[230]=tr):tr=t[230];let nr;return t[231]!==Un||t[232]!==qn||t[233]!==Zn||t[234]!==tr?(nr=(0,Z.jsxs)(Z.Fragment,{children:[Un,qn,Zn,tr]}),t[231]=Un,t[232]=qn,t[233]=Zn,t[234]=tr,t[235]=nr):nr=t[235],nr}function PH(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:wV(e)},`${e.kind}:${e.path}`)}function FH(e){return`${e.kind}:${e.path}`}function IH(e){return`${e.kind}:${e.path}`}function LH(e){return e.path}function RH(e){return e.kind===`folder`}function zH(e){return e.path}function BH(e){return e.kind===`file`}function VH(e){return Ue(e)}function HH(e){return ht(e)}function UH(e){return e.endsWith(`/`)?e.slice(0,-1):e}function WH(e){return!!e}function GH(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function KH(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function qH(e){X.error(e)}function JH(){}function YH(e){return X.error(e)}function XH(){}function ZH(){}async function QH(){}function $H(e){return kO(e)}function eU(e){return tU(e)?.dataset.itemPath??null}function tU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var nU=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function rU(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:nU.map(iU)}),e[0]=t):t=e[0],t}function iU(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(mo,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(mo,{className:`h-3 ${e}`})]},t)}function aU(e){return e?`No workspace`:null}function oU(e){let t=(0,$.c)(41),{input:n,installStates:r,dispatch:i,webFallbackVisible:a}=e,o=a===void 0?!0:a,s=n===null,c;t[0]===s?c=t[1]:(c=aU(s),t[0]=s,t[1]=c);let l=c,u,d,f,p,m,h,g;if(t[2]!==i||t[3]!==l||t[4]!==n||t[5]!==s||t[6]!==r||t[7]!==o){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[15]===r?e=t[16]:(e=e=>r[e.id]?.installed===!0,t[15]=r,t[16]=e);let a=eh.filter(e);f=r[`claude-code`]?.installed===!0;let c;t[17]===n?c=t[18]:(c=n!==null&&n.docContext!==null?jr(n.docContext.relativePath):``,t[17]=n,t[18]=c);let _=c,v;t[19]!==n||t[20]!==_?(v=()=>{n!==null&&ES(_)},t[19]=n,t[20]=_,t[21]=v):v=t[21],p=v;let y=o&&!f;if(a.length===0&&!y){g=null;break bb0}d=lk,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(fk,{children:[(0,Z.jsx)(Ji,{"aria-hidden":`true`}),`Open with AI`]}),t[22]=h):h=t[22],u=pk;let b;t[23]!==i||t[24]!==l||t[25]!==n||t[26]!==s?(b=e=>{let t=!s,r=l?`Open with AI ${e.displayName}, ${l}`:`Open with AI ${e.displayName}`;return(0,Z.jsxs)(dk,{disabled:!t,onSelect:()=>{n&&i(e.id,n)},"data-testid":`empty-space-open-in-${e.id}`,"aria-label":r,children:[(0,Z.jsx)(bS,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)},t[23]=i,t[24]=l,t[25]=n,t[26]=s,t[27]=b):b=t[27],m=a.map(b)}t[2]=i,t[3]=l,t[4]=n,t[5]=s,t[6]=r,t[7]=o,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[28]!==f||t[29]!==p||t[30]!==s||t[31]!==o?(_=o&&!f?(0,Z.jsxs)(dk,{onSelect:p,disabled:s,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(bt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}):null,t[28]=f,t[29]=p,t[30]=s,t[31]=o,t[32]=_):_=t[32];let v;t[33]!==u||t[34]!==m||t[35]!==_?(v=(0,Z.jsxs)(u,{children:[m,_]}),t[33]=u,t[34]=m,t[35]=_,t[36]=v):v=t[36];let y;return t[37]!==d||t[38]!==h||t[39]!==v?(y=(0,Z.jsxs)(d,{children:[h,v]}),t[37]=d,t[38]=h,t[39]=v,t[40]=y):y=t[40],y}var sU=(e,t,n)=>pl(e,t,n,`ProjectSwitcher`);function cU(e){let t=(0,$.c)(59),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return sU(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,Q.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),sU(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),sU(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),sU(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=ka,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(nc,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(rO,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=Oa,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ua,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Z.jsx)(ua,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(Aa,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(ma,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(Aa,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Z.jsx)(Aa,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:`Switch Project`}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Z.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Z.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function lU(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Sr(`sidebarSearchPill`)}function uU(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Di(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(x,{"aria-hidden":`true`}),o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:`Search`}),t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(sC,{className:`text-foreground/70`,children:Ti()?`⌘ K`:`Ctrl K`}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Y,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function dU(e){let t=(0,$.c)(33),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Do,{"aria-hidden":`true`,className:`size-3`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:a}),t[1]=r,t[2]=o);let s=o;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${i}`,a;t[3]===n.body?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[3]=n.body,t[4]=a);let o;t[5]!==s||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,s]}),t[5]=s,t[6]=a,t[7]=o):o=t[7];let c;t[8]===n.action?c=t[9]:(c=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[8]=n.action,t[9]=c);let l;t[10]===n.secondaryAction?l=t[11]:(l=()=>{n.secondaryAction?.onClick()},t[10]=n.secondaryAction,t[11]=l);let u;t[12]!==n.secondaryAction.label||t[13]!==l?(u=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:l,children:n.secondaryAction.label}),t[12]=n.secondaryAction.label,t[13]=l,t[14]=u):u=t[14];let d;t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==d||t[19]!==e||t[20]!==r||t[21]!==o?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,d]}),t[18]=d,t[19]=e,t[20]=r,t[21]=o,t[22]=f):f=t[22],f}let c=`update-notice-${n.id}`,l=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,u;t[23]===n.body?u=t[24]:(u=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[23]=n.body,t[24]=u);let d;t[25]===n.action?d=t[26]:(d=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[25]=n.action,t[26]=d);let f;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":c,className:l,children:[u,d,s]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f):f=t[32],f}function fU(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function pU(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Ep,Tp,Tp),n;e[0]===t?n=e[1]:(n=fU(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{wp(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(dU,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function mU(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Fh(n.contentDir,Ih(t),n.pathSeparator):e?.kind===`folder`?Fh(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function hU(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Fh(n.contentDir,t.slice(0,e),n.pathSeparator)}return e?.kind===`folder`?Fh(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function gU(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Ih(t):e?.kind===`folder`?e.folderPath:``}function _U(e,t,n){return e===null?Rh({workspace:n}):e.kind===`folder`?n?zh({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?Lh({docName:t,workspace:n}):null}var vU={folderCount:0,expandedCount:0},yU=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function bU(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(yU)!==null}function xU(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(q,{name:`file-sidebar`,children:(0,Z.jsx)(CU,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var SU=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(En,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(er,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(jn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function CU(e){let t=(0,$.c)(164),{onOpenSearch:n}=e,[r,i]=(0,Q.useState)(null),{activeDocName:a,activeTarget:o}=dt(),s;t[0]!==a||t[1]!==o?(s=o?.kind===`folder`||o?.kind===`folder-index`?o.folderPath:_i(a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=typeof window<`u`&&window.okDesktop!=null,{state:u}=UD(),d=u===`expanded`,f=l&&u===`collapsed`,[p,m]=(0,Q.useState)(vU),h,g;t[3]===r?(h=t[4],g=t[5]):(h=()=>{if(r!==null)return m(r.getFolderState()),r.subscribe(()=>{m(r.getFolderState())})},g=[r],t[3]=r,t[4]=h,t[5]=g),(0,Q.useEffect)(h,g);let _,v;t[6]===r?(_=t[7],v=t[8]):(_=()=>{if(r!==null)return dC(()=>{r.startCreating(`file`,``)})},v=[r],t[6]=r,t[7]=_,t[8]=v),(0,Q.useEffect)(_,v);let y=p.folderCount>0,x=y&&p.expandedCount===p.folderCount,S=p.expandedCount===0,C=Qa(``),w=C.state.status===`ready`?(C.state.data.folder.templates_available?.length??0)>0:!0,T=typeof window<`u`?window.okDesktop:void 0,E=ch(),D=sg().states,{dispatch:O}=Xh(),k;t[9]===E?k=t[10]:(k=Rh({workspace:E}),t[9]=E,t[10]=k);let A=k,{projectLocalBinding:j,merged:M}=b(),N=M?.appearance?.sidebar?.showHiddenFiles??!1,P=M?.appearance?.sidebar?.showAllFiles??!1,I=y&&!x,L=y&&!S,R=I||L,z=DU,B;t[11]!==r||t[12]!==E?(B=()=>{E&&r?.startCreating(`file`,``)},t[11]=r,t[12]=E,t[13]=B):B=t[13];let V=B,H;t[14]!==r||t[15]!==E?(H=()=>{E&&r?.startCreatingFromTemplate(``)},t[14]=r,t[15]=E,t[16]=H):H=t[16];let U=H,W;t[17]!==r||t[18]!==E?(W=()=>{E&&r?.startCreating(`folder`,``)},t[17]=r,t[18]=E,t[19]=W):W=t[19];let G=W,ee;t[20]===E?ee=t[21]:(ee=()=>{!E||!T||T.shell.showItemInFolder(E.contentDir)},t[20]=E,t[21]=ee);let te=ee,ne;t[22]===E?ne=t[23]:(ne=()=>{!E||!T||IV(T,E.contentDir)},t[22]=E,t[23]=ne);let re=ne,ie;t[24]===E?ie=t[25]:(ie=async()=>{if(E)try{await navigator.clipboard.writeText(E.contentDir),X.success(`Copied full path`,{description:E.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(`Could not copy full path`)}},t[24]=E,t[25]=ie);let ae=ie,oe;t[26]===j?oe=t[27]:(oe=e=>{if(j===null)return;let t=j.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,wi(t.error)),X.error(`Could not update sidebar settings`,{description:wi(t.error)}))},t[26]=j,t[27]=oe);let se=oe,ce;t[28]===j?ce=t[29]:(ce=e=>{if(j===null)return;let t=j.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,wi(t.error)),X.error(`Could not update sidebar settings`,{description:wi(t.error)}))},t[28]=j,t[29]=ce);let le=ce,de;t[30]===r?de=t[31]:(de=()=>{r?.expandAll()},t[30]=r,t[31]=de);let K=de,fe;t[32]===r?fe=t[33]:(fe=()=>{r?.collapseAll()},t[32]=r,t[33]=fe);let pe=fe,me,he;t[34]!==P||t[35]!==L||t[36]!==I||t[37]!==N?(me=()=>{T&&T.editor.notifyViewMenuStateChanged({showHiddenFiles:N,showAllFiles:P,canExpandAll:I,canCollapseAll:L})},he=[T,N,P,I,L],t[34]=P,t[35]=L,t[36]=I,t[37]=N,t[38]=me,t[39]=he):(me=t[38],he=t[39]),(0,Q.useEffect)(me,he);let ge,_e;t[40]!==a||t[41]!==o||t[42]!==O||t[43]!==D||t[44]!==c||t[45]!==j||t[46]!==P||t[47]!==N||t[48]!==r||t[49]!==E?(ge=()=>{if(T)return T.onMenuAction(e=>{switch(e){case`new-doc`:if(!E||!r)return;r.startCreating(`file`,c);return;case`new-folder`:if(!E||!r)return;r.startCreating(`folder`,c);return;case`new-from-template`:if(!E||!r)return;r.startCreatingFromTemplate(c);return;case`rename`:if(!o)return;HV(o);return;case`duplicate`:if(!o)return;WV(o);return;case`move-to-trash`:if(!o)return;BV(o);return;case`reveal-in-finder`:{if(!T||!E)return;let e=mU(o,a,E);T.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!T||!E)return;IV(T,hU(o,a,E));return;case`send-to-ai`:{let e=eh.filter(e=>D[e.id]?.installed===!0);if(e.length===0){X.error(`No AI agents installed`);return}let t=_U(o,a,E);if(!t)return;let[n]=e;if(!n)return;O(n.id,t);return}case`copy-full-path`:{if(!E)return;let e=mU(o,a,E);navigator.clipboard.writeText(e).then(()=>X.success(`Copied full path`,{description:e})).catch(EU);return}case`copy-relative-path`:{let e=gU(o,a);if(e===``){X.error(`No file or folder selected`);return}navigator.clipboard.writeText(e).then(()=>X.success(`Copied relative path`,{description:e})).catch(TU);return}case`toggle-show-hidden-files`:{if(j===null)return;let e=j.patch({appearance:{sidebar:{showHiddenFiles:!N}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,wi(e.error)),X.error(`Could not update sidebar settings`,{description:wi(e.error)}));return}case`toggle-show-all-files`:{if(j===null)return;let e=j.patch({appearance:{sidebar:{showAllFiles:!P}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,wi(e.error)),X.error(`Could not update sidebar settings`,{description:wi(e.error)}));return}case`expand-all-tree`:r?.expandAll();return;case`collapse-all-tree`:r?.collapseAll();return;case`delete`:case`toggle-sidebar`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:return}})},_e=[T,r,E,o,a,c,j,N,P,D,O],t[40]=a,t[41]=o,t[42]=O,t[43]=D,t[44]=c,t[45]=j,t[46]=P,t[47]=N,t[48]=r,t[49]=E,t[50]=ge,t[51]=_e):(ge=t[50],_e=t[51]),(0,Q.useEffect)(ge,_e);let ve=f&&`opacity-0`,be;t[52]===ve?be=t[53]:(be=Di(`flex-row h-12 items-center py-0 px-3`,l?`justify-end`:`justify-between`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ve,l&&`[-webkit-app-region:drag]`),t[52]=ve,t[53]=be);let xe;t[54]===d?xe=t[55]:(xe=d&&!l?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}):null,t[54]=d,t[55]=xe);let Se;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Se=Di(`flex items-center gap-1`,l&&`[&>*]:[-webkit-app-region:no-drag]`),t[56]=Se):Se=t[56];let Ce;t[57]!==x||t[58]!==y||t[59]!==S||t[60]!==r?(Ce=y?(0,Z.jsxs)(ka,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(SU,{icon:Oc,label:`Tree View Options`})}),(0,Z.jsxs)(Oa,{align:`end`,children:[x?null:(0,Z.jsxs)(Aa,{onSelect:()=>r?.expandAll(),children:[(0,Z.jsx)(sl,{"aria-hidden":`true`}),`Expand All`]}),S?null:(0,Z.jsxs)(Aa,{onSelect:()=>r?.collapseAll(),children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Collapse All`]})]})]}):null,t[57]=x,t[58]=y,t[59]=S,t[60]=r,t[61]=Ce):Ce=t[61];let we;t[62]!==c||t[63]!==r?(we=(0,Z.jsx)(SU,{icon:$c,label:`New File`,onClick:()=>r?.startCreating(`file`,c)}),t[62]=c,t[63]=r,t[64]=we):we=t[64];let Te;t[65]!==w||t[66]!==c||t[67]!==r?(Te=w?(0,Z.jsx)(SU,{icon:hc,label:`New from template`,onClick:()=>r?.startCreatingFromTemplate(c)}):null,t[65]=w,t[66]=c,t[67]=r,t[68]=Te):Te=t[68];let Ee;t[69]!==c||t[70]!==r?(Ee=(0,Z.jsx)(SU,{icon:yc,label:`New Folder`,onClick:()=>r?.startCreating(`folder`,c)}),t[69]=c,t[70]=r,t[71]=Ee):Ee=t[71];let De;t[72]!==Ce||t[73]!==we||t[74]!==Te||t[75]!==Ee?(De=(0,Z.jsxs)(`div`,{className:Se,children:[Ce,we,Te,Ee]}),t[72]=Ce,t[73]=we,t[74]=Te,t[75]=Ee,t[76]=De):De=t[76];let Oe;t[77]!==be||t[78]!==xe||t[79]!==De?(Oe=(0,Z.jsxs)(ZD,{"data-electron-drag":l?``:void 0,className:be,children:[xe,De]}),t[77]=be,t[78]=xe,t[79]=De,t[80]=Oe):Oe=t[80];let ke=f&&`opacity-0`,Ae;t[81]===ke?Ae=t[82]:(Ae=Di(`px-2 pb-2`,l&&`[-webkit-app-region:no-drag]`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ke),t[81]=ke,t[82]=Ae);let je;t[83]===u?je=t[84]:(je=[u],t[83]=u,t[84]=je);let Me;t[85]===n?Me=t[86]:(Me=(0,Z.jsx)(uU,{onClick:n}),t[85]=n,t[86]=Me);let Ne;t[87]!==je||t[88]!==Me?(Ne=(0,Z.jsx)(ue,{fallbackRender:wU,onError:lU,resetKeys:je,children:Me}),t[87]=je,t[88]=Me,t[89]=Ne):Ne=t[89];let Pe;t[90]!==Ae||t[91]!==Ne?(Pe=(0,Z.jsx)(`div`,{className:Ae,children:Ne}),t[90]=Ae,t[91]=Ne,t[92]=Pe):Pe=t[92];let Fe;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,Z.jsx)($D,{children:(0,Z.jsx)(NH,{ref:i})}),t[93]=Fe):Fe=t[93];let Ie,q;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsxs)(QD,{className:`px-0`,children:[(0,Z.jsx)(pU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(eO,{children:(0,Z.jsx)(tO,{children:(0,Z.jsx)(cU,{bridge:window.okDesktop})})}):null]}),q=(0,Z.jsx)(YD,{enableToggle:!1}),t[94]=Ie,t[95]=q):(Ie=t[94],q=t[95]);let Le;t[96]!==Oe||t[97]!==Pe?(Le=(0,Z.jsx)(ck,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:z,children:[Oe,Pe,Fe,Ie,q]})}),t[96]=Oe,t[97]=Pe,t[98]=Le):Le=t[98];let Re=!E,ze;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)($c,{"aria-hidden":`true`}),t[99]=ze):ze=t[99];let Be;t[100]!==V||t[101]!==Re?(Be=(0,Z.jsxs)(dk,{disabled:Re,onSelect:V,"data-testid":`empty-space-menu-new-file`,children:[ze,`New File`]}),t[100]=V,t[101]=Re,t[102]=Be):Be=t[102];let Ve=!E||!w,He;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(hc,{"aria-hidden":`true`}),t[103]=He):He=t[103];let Ue;t[104]!==U||t[105]!==Ve?(Ue=(0,Z.jsxs)(dk,{disabled:Ve,onSelect:U,"data-testid":`empty-space-menu-new-from-template`,children:[He,`New from template`]}),t[104]=U,t[105]=Ve,t[106]=Ue):Ue=t[106];let We=!E,Ge;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(yc,{"aria-hidden":`true`}),t[107]=Ge):Ge=t[107];let Ke;t[108]!==G||t[109]!==We?(Ke=(0,Z.jsxs)(dk,{disabled:We,onSelect:G,"data-testid":`empty-space-menu-new-folder`,children:[Ge,`New Folder`]}),t[108]=G,t[109]=We,t[110]=Ke):Ke=t[110];let qe;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsx)(hk,{}),t[111]=qe):qe=t[111];let Je;t[112]!==te||t[113]!==E?(Je=T?(0,Z.jsxs)(dk,{disabled:!E,onSelect:te,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":E?`Reveal in Finder`:`Reveal in Finder, No workspace`,children:[(0,Z.jsx)(ye,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Reveal in Finder`}),E?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`No workspace`})]}):null,t[112]=te,t[113]=E,t[114]=Je):Je=t[114];let Ye;t[115]!==O||t[116]!==A||t[117]!==D?(Ye=(0,Z.jsx)(oU,{input:A,installStates:D,dispatch:O,webFallbackVisible:!1}),t[115]=O,t[116]=A,t[117]=D,t[118]=Ye):Ye=t[118];let Xe;t[119]!==re||t[120]!==E?(Xe=T?(0,Z.jsxs)(dk,{disabled:!E,onSelect:re,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":E?`Open in Terminal`:`Open in Terminal, No workspace`,children:[(0,Z.jsx)(il,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in Terminal`}),E?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`No workspace`})]}):null,t[119]=re,t[120]=E,t[121]=Xe):Xe=t[121];let Ze=!E,Qe=E?`Copy full path`:`Copy full path, No workspace`,$e,et;t[122]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(F,{"aria-hidden":`true`}),et=(0,Z.jsx)(`span`,{className:`flex-1`,children:`Copy full path`}),t[122]=$e,t[123]=et):($e=t[122],et=t[123]);let tt;t[124]===E?tt=t[125]:(tt=E?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`No workspace`}),t[124]=E,t[125]=tt);let nt;t[126]!==ae||t[127]!==Ze||t[128]!==Qe||t[129]!==tt?(nt=(0,Z.jsxs)(dk,{disabled:Ze,onSelect:ae,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Qe,children:[$e,et,tt]}),t[126]=ae,t[127]=Ze,t[128]=Qe,t[129]=tt,t[130]=nt):nt=t[130];let rt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(hk,{}),t[131]=rt):rt=t[131];let it=j===null,at;t[132]!==se||t[133]!==N||t[134]!==it?(at=(0,Z.jsx)(mk,{checked:N,onCheckedChange:se,disabled:it,"data-testid":`empty-space-menu-show-hidden-files`,children:`Show Hidden Files`}),t[132]=se,t[133]=N,t[134]=it,t[135]=at):at=t[135];let ot=j===null,st;t[136]!==le||t[137]!==P||t[138]!==ot?(st=(0,Z.jsx)(mk,{checked:P,onCheckedChange:le,disabled:ot,"data-testid":`empty-space-menu-show-all-files`,children:`Show all files`}),t[136]=le,t[137]=P,t[138]=ot,t[139]=st):st=t[139];let ct;t[140]===R?ct=t[141]:(ct=R?(0,Z.jsx)(hk,{}):null,t[140]=R,t[141]=ct);let lt;t[142]!==K||t[143]!==I?(lt=I?(0,Z.jsxs)(dk,{onSelect:K,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(sl,{"aria-hidden":`true`}),`Expand all`]}):null,t[142]=K,t[143]=I,t[144]=lt):lt=t[144];let ut;t[145]!==pe||t[146]!==L?(ut=L?(0,Z.jsxs)(dk,{onSelect:pe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Collapse all`]}):null,t[145]=pe,t[146]=L,t[147]=ut):ut=t[147];let ft;t[148]!==Be||t[149]!==Ue||t[150]!==Ke||t[151]!==Je||t[152]!==Ye||t[153]!==Xe||t[154]!==nt||t[155]!==at||t[156]!==st||t[157]!==ct||t[158]!==lt||t[159]!==ut?(ft=(0,Z.jsxs)(uk,{children:[Be,Ue,Ke,qe,Je,Ye,Xe,nt,rt,at,st,ct,lt,ut]}),t[148]=Be,t[149]=Ue,t[150]=Ke,t[151]=Je,t[152]=Ye,t[153]=Xe,t[154]=nt,t[155]=at,t[156]=st,t[157]=ct,t[158]=lt,t[159]=ut,t[160]=ft):ft=t[160];let pt;return t[161]!==Le||t[162]!==ft?(pt=(0,Z.jsx)(qD,{variant:`inset`,children:(0,Z.jsxs)(sk,{children:[Le,ft]})}),t[161]=Le,t[162]=ft,t[163]=pt):pt=t[163],pt}function wU(){return null}function TU(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(`Could not copy relative path`)}function EU(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(`Could not copy full path`)}function DU(e){bU(e.target)&&(e.preventDefault(),e.stopPropagation())}function OU(){let e=(0,$.c)(17),t=bn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=dt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Ot,i=new ze({url:n,name:Xn,document:e,onStateless:e=>{let{payload:t}=e;G(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:PU,onConfigValidationRejected:NU,onConfigIgnoreNestedError:MU,onUnknown:jU})},onClose:AU,onDisconnect:kU}),a=Dr(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=ne(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Wr([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function kU(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function AU(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function jU(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function MU(e){so(e)}function NU(e){uo(e)}function PU(e){Wr([e.ch])}var FU=`#install-claude-desktop`;function IU(e){return e===`#settings`||e===FU}function LU(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function RU(){let e=(0,$.c)(20),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=dt(),{openTargetTransition:i}=St(),{assetPaths:a,folderPaths:o,loading:s,pages:c}=Nr(),l=(0,Q.useRef)(null),u;e[0]!==a||e[1]!==o||e[2]!==c?(u=LU(c,o,a),e[0]=a,e[1]=o,e[2]=c,e[3]=u):u=e[3];let d=u,f,p;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==n||e[9]!==r||e[10]!==d?(f=()=>{s||!r||l.current===d||(l.current=d,n({pages:c,folderPaths:o,assetPaths:a}))},p=[a,o,s,c,n,r,d],e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=n,e[9]=r,e[10]=d,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p);let m,h;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(m=()=>{e();function e(){if(IU(window.location.hash))return;let e=$r(window.location.hash);if(e){let t=ti(e.split(`.`).pop()??``);Nt(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=oi(window.location.hash);if(!n){Nt(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Nt(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Fr(n,{pages:c,folderPaths:o});if(r.kind===`missing`&&/\/+$/.test(n.trim())){Nt(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=ui(r);Nt(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},h=[t,o,s,i,c],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=m,e[19]=h):(m=e[18],h=e[19]),(0,Q.useEffect)(m,h),null}function zU(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===FU),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===FU&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===FU){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(Ia,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function BU(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(VU,t),null}function VU(){let e=function(e){let t=e.target;nh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=th))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function HU(){let e=(0,$.c)(4),{activeTarget:t}=dt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function UU(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=dt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:_i(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;bm({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Sm,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function WU(){let e=(0,$.c)(21),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=t?hl({bridge:t,authQueryTransport:yl(),cloneTransport:Tl(),openSignIn:()=>new Promise(e=>{c(()=>e),o(!0)})}):null,e[0]=l):l=e[0];let u=l,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(wg,{}),e[1]=d):d=e[1];let f,p,m,h,g,_,v,y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(OU,{}),p=(0,Z.jsx)(RU,{}),m=(0,Z.jsx)(HU,{}),h=(0,Z.jsx)(UU,{}),g=(0,Z.jsx)(BU,{}),_=(0,Z.jsx)(zU,{}),v=(0,Z.jsx)(Fd,{}),y=t&&u?(0,Z.jsx)(Yd,{bridge:t,cloneController:u}):null,e[2]=f,e[3]=p,e[4]=m,e[5]=h,e[6]=g,e[7]=_,e[8]=v,e[9]=y):(f=e[2],p=e[3],m=e[4],h=e[5],g=e[6],_=e[7],v=e[8],y=e[9]);let b;e[10]!==a||e[11]!==s?(b=t?(0,Z.jsx)(rd,{open:a,onOpenChange:e=>{e||(o(!1),s?.(null),c(null))},onSuccess:e=>{s?.({authenticated:!0,host:`github.com`,login:e.login}),c(null)}}):null,e[10]=a,e[11]=s,e[12]=b):b=e[12];let x;e[13]===r?x=e[14]:(x=(0,Z.jsx)(_g,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=x);let S;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=S):S=e[15];let C;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(xU,{onOpenSearch:()=>i(!0)}),e[16]=C):C=e[16];let w;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(WD,{className:`h-screen overflow-hidden`,children:[C,(0,Z.jsx)(XD,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(jA,{})})]}),e[17]=w):w=e[17];let T;return e[18]!==b||e[19]!==x?(T=(0,Z.jsx)(q,{name:`app`,children:(0,Z.jsx)(Dt,{children:(0,Z.jsxs)(he,{children:[d,(0,Z.jsxs)(si,{children:[f,p,m,h,g,_,v,y,b,x,S,w]})]})})}),e[18]=b,e[19]=x,e[20]=T):T=e[20],T}Ns(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&of({apiOrigin:window.okDesktop.config.apiOrigin}),Jf()&&ep(),Dp(),typeof window<`u`&&Mf({bridge:window.okDesktop}),typeof window<`u`&&as({bridge:window.okDesktop}),typeof window<`u`&&ts({bridge:window.okDesktop}),typeof window<`u`&&Ff({bridge:window.okDesktop}),typeof window<`u`&&Jd({bridge:window.okDesktop});var GU=new Hs({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),KU=document.getElementById(`root`);if(!KU)throw Error(`Root element not found`);var qU=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Qs.createRoot)(KU).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(qt,{i18n:Of,children:(0,Z.jsx)(pn,{client:GU,children:(0,Z.jsxs)(Qr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Xr,{children:qU&&window.okDesktop?(0,Z.jsx)(ef,{bridge:window.okDesktop}):(0,Z.jsx)(WU,{})}),(0,Z.jsx)(af,{richColors:!0,closeButton:!0})]})})})}));
|
|
1928
|
+
</svg>`,yH=`${QB}\n${dV}`;function bH(e){return{...uM({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function xH(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&pH.has(t)}function SH(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function CH(e){let t=(0,$.c)(14),{item:n,workspace:r,onClose:i}=e,a=typeof window<`u`?window.okDesktop:void 0;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=SH(a.platform),t[0]=o):o=t[0];let s=o,c=r?null:`No workspace`,l=!r,u;t[1]!==n||t[2]!==i||t[3]!==r?(u=()=>{if(!r)return;i();let e=Fh(r.contentDir,BO(n),r.pathSeparator);a.shell.showItemInFolder(e)},t[1]=n,t[2]=i,t[3]=r,t[4]=u):u=t[4];let d=c?`${s}, ${c}`:s,f,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(ye,{"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{className:`flex-1`,children:s}),t[5]=f,t[6]=p):(f=t[5],p=t[6]);let m;t[7]===c?m=t[8]:(m=c?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:c}):null,t[7]=c,t[8]=m);let h;return t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==m?(h=(0,Z.jsxs)(Aa,{disabled:l,onSelect:u,"aria-label":d,children:[f,p,m]}),t[9]=l,t[10]=u,t[11]=d,t[12]=m,t[13]=h):h=t[13],h}function wH(e){let t=(0,$.c)(12),{dirAbsPath:n,onClose:r}=e,i=typeof window<`u`?window.okDesktop:void 0;if(!i)return null;let a=n===null?`No workspace`:null,o=n===null,s;t[0]!==n||t[1]!==r?(s=()=>{n!==null&&(r(),IV(i,n))},t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=a?`Open in Terminal, ${a}`:`Open in Terminal`,l,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(il,{"aria-hidden":`true`}),u=(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in Terminal`}),t[3]=l,t[4]=u):(l=t[3],u=t[4]);let d;t[5]===a?d=t[6]:(d=a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:a}):null,t[5]=a,t[6]=d);let f;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==d?(f=(0,Z.jsxs)(Aa,{disabled:o,onSelect:s,"aria-label":c,children:[l,u,d]}),t[7]=o,t[8]=s,t[9]=c,t[10]=d,t[11]=f):f=t[11],f}function TH(e){return zO({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function EH(e,t){return e!==t&&e.startsWith(t)}function DH(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>EH(e,t))).map(TH)}function OH(e,t){return e===t||e.startsWith(`${t}/`)}function kH(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function AH(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)mi(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=jO(e);OH(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function jH(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:OH(t.createdPath,e.path)}function MH(e){let t=(0,$.c)(78),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onStartCreatingFromTemplate:f,onDuplicate:p,onDelete:m,onExpandSubtree:h,onCollapseSubtree:g,folderTreePaths:_,isAsset:v,isAssetTreePath:y}=e,b,x,S,C,w,T,E,D;if(t[0]!==v||t[1]!==y||t[2]!==n||t[3]!==u?.appearance?.sidebar?.showAllFiles||t[4]!==u?.appearance?.sidebar?.showHiddenFiles||t[5]!==s||t[6]!==c||t[7]!==l){D=zO(n),C=n.kind===`directory`,b=!v&&c!==null,S=C?`Hide folder`:`Hide this file`,T=u?.appearance?.sidebar?.showHiddenFiles??!1,w=u?.appearance?.sidebar?.showAllFiles??!1,x=l!==null;let e=s.getSelectedPaths();E=e.includes(D.treePath)?DH(e,y):[],t[0]=v,t[1]=y,t[2]=n,t[3]=u?.appearance?.sidebar?.showAllFiles,t[4]=u?.appearance?.sidebar?.showHiddenFiles,t[5]=s,t[6]=c,t[7]=l,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w,t[13]=T,t[14]=E,t[15]=D}else b=t[8],x=t[9],S=t[10],C=t[11],w=t[12],T=t[13],E=t[14],D=t[15];let O=E,k;t[16]!==O||t[17]!==D?(k=O.length>1?O:[D],t[16]=O,t[17]=D,t[18]=k):k=t[18];let A=k,j=A.length>1?`Delete ${A.length} Items`:`Delete`,M;t[19]!==C||t[20]!==n||t[21]!==a?(M=C&&a?Fh(a.contentDir,BO(n),a.pathSeparator):null,t[19]=C,t[20]=n,t[21]=a,t[22]=M):M=t[22];let N=M,P;if(t[23]!==C||t[24]!==n||t[25]!==a){bb0:{if(!a||C){P=null;break bb0}let e=BO(n),t=e.lastIndexOf(`/`);if(t===-1){P=a.contentDir;break bb0}P=Fh(a.contentDir,e.slice(0,t),a.pathSeparator)}t[23]=C,t[24]=n,t[25]=a,t[26]=P}else P=t[26];let I=P,L;t[27]!==v||t[28]!==C||t[29]!==n||t[30]!==a?(L=v?null:C?zh({folderRelativePath:BO(n),workspace:a}):Lh({docName:OO(n.path),workspace:a}),t[27]=v,t[28]=C,t[29]=n,t[30]=a,t[31]=L):L=t[31];let z=L,B;t[32]===r?B=t[33]:(B=()=>r.close({restoreFocus:!1}),t[32]=r,t[33]=B);let V=B,H;t[34]===r?H=t[35]:(H=()=>r.close(),t[34]=r,t[35]=H);let U=H,W;t[36]===l?W=t[37]:(W=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,wi(t.error)),X.error(`Could not update sidebar settings`,{description:wi(t.error)}))},t[36]=l,t[37]=W);let G=W,ee;t[38]===l?ee=t[39]:(ee=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,wi(t.error)),X.error(`Could not update sidebar settings`,{description:wi(t.error)}))},t[38]=l,t[39]=ee);let te=ee,ne=0,re=0;if(C){let e=MO(n.path);for(let t of _)(t===e||t.startsWith(e))&&(ne++,MV(s.getItem(t))?.isExpanded()&&re++)}let ie=C&&re<ne,ae=C&&re>0,oe;t[40]===U?oe=t[41]:(oe=e=>{e||U()},t[40]=U,t[41]=oe);let se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[42]=se):se=t[42];let ce;t[43]!==i||t[44]!==b||t[45]!==x||t[46]!==U||t[47]!==V||t[48]!==j||t[49]!==A||t[50]!==N||t[51]!==te||t[52]!==G||t[53]!==o||t[54]!==z||t[55]!==S||t[56]!==v||t[57]!==C||t[58]!==n||t[59]!==s||t[60]!==c||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==h||t[65]!==d||t[66]!==f||t[67]!==I||t[68]!==w||t[69]!==T||t[70]!==ae||t[71]!==ie||t[72]!==D||t[73]!==a?(ce=(0,Z.jsx)(Oa,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),d(`file`,jO(n.path))},children:[(0,Z.jsx)($c,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),f(jO(n.path))},children:[(0,Z.jsx)(hc,{"aria-hidden":`true`}),`New from template`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),d(`folder`,jO(n.path))},children:[(0,Z.jsx)(yc,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(ma,{}),(0,Z.jsx)(CH,{item:n,workspace:a,onClose:U}),(0,Z.jsx)(JV,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(wH,{dirAbsPath:N,onClose:U}),(0,Z.jsxs)(oo,{children:[(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Copy Path`]}),(0,Z.jsxs)(pa,{children:[(0,Z.jsx)(Aa,{disabled:!a,onSelect:()=>{a&&(U(),fH(Fh(a.contentDir,BO(n),a.pathSeparator),`full path`))},children:`Full Path`}),(0,Z.jsx)(Aa,{onSelect:()=>{U(),fH(BO(n),`relative path`)},children:`Relative Path`})]})]}),(0,Z.jsx)(ma,{}),(0,Z.jsx)(da,{checked:T,onCheckedChange:G,disabled:!x,"data-testid":`file-tree-menu-show-hidden-files`,children:`Show Hidden Files`}),(0,Z.jsx)(da,{checked:w,onCheckedChange:te,disabled:!x,"data-testid":`file-tree-menu-show-all-files`,children:`Show all files`}),ie||ae?(0,Z.jsx)(ma,{}):null,ie?(0,Z.jsxs)(Aa,{onSelect:()=>{U(),h(n.path)},children:[(0,Z.jsx)(sl,{"aria-hidden":`true`}),`Expand All`]}):null,ae?(0,Z.jsxs)(Aa,{onSelect:()=>{U(),g(n.path)},children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Collapse All`]}):null,(0,Z.jsx)(ma,{}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{U(),p(D)},children:[(0,Z.jsx)(je,{"aria-hidden":`true`}),`Duplicate`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(it,{"aria-hidden":`true`}),`Rename`]}),(0,Z.jsxs)(Aa,{"data-testid":`file-tree-menu-hide`,disabled:!b,onSelect:()=>{if(!c)return;U();let e=iV(D),t=po(c.current()),n=no(t,e);if(n===t)return;c.patch(io(n));let r=D.path.split(`/`).pop()||D.path;X.success(`Hidden folder “${r}”`,{description:`Manage hidden files in Settings → Ignore patterns.`,duration:5e3})},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),S]}),(0,Z.jsxs)(Aa,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(A)},children:[(0,Z.jsx)(pe,{"aria-hidden":`true`}),j]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(CH,{item:n,workspace:a,onClose:U}),!v&&(0,Z.jsx)(JV,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(wH,{dirAbsPath:I,onClose:U}),(0,Z.jsxs)(oo,{children:[(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Copy Path`]}),(0,Z.jsxs)(pa,{children:[(0,Z.jsx)(Aa,{disabled:!a,onSelect:()=>{a&&(U(),fH(Fh(a.contentDir,BO(n),a.pathSeparator),`full path`))},children:`Full Path`}),(0,Z.jsx)(Aa,{onSelect:()=>{U(),fH(BO(n),`relative path`)},children:`Relative Path`})]})]}),v?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{U(),p(D)},children:[(0,Z.jsx)(je,{"aria-hidden":`true`}),`Duplicate`]}),(0,Z.jsxs)(Aa,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(it,{"aria-hidden":`true`}),`Rename`]}),(0,Z.jsxs)(Aa,{"data-testid":`file-tree-menu-hide`,disabled:!b,onSelect:()=>{if(!c)return;U();let e=iV(D),t=po(c.current()),n=no(t,e);if(n===t)return;c.patch(io(n));let r=D.path.split(`/`).pop()||D.path;X.success(`Hidden “${r}”`,{description:`Manage hidden files in Settings → Ignore patterns.`,duration:5e3})},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),S]}),(0,Z.jsxs)(Aa,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(A)},children:[(0,Z.jsx)(pe,{"aria-hidden":`true`}),j]})]})]})}),t[43]=i,t[44]=b,t[45]=x,t[46]=U,t[47]=V,t[48]=j,t[49]=A,t[50]=N,t[51]=te,t[52]=G,t[53]=o,t[54]=z,t[55]=S,t[56]=v,t[57]=C,t[58]=n,t[59]=s,t[60]=c,t[61]=g,t[62]=m,t[63]=p,t[64]=h,t[65]=d,t[66]=f,t[67]=I,t[68]=w,t[69]=T,t[70]=ae,t[71]=ie,t[72]=D,t[73]=a,t[74]=ce):ce=t[74];let le;return t[75]!==oe||t[76]!==ce?(le=(0,Z.jsxs)(ka,{open:!0,modal:!1,onOpenChange:oe,children:[se,ce]}),t[75]=oe,t[76]=ce,t[77]=le):le=t[77],le}function NH(e){let t=(0,$.c)(236),{ref:n}=e,{activeDocName:r,activeTarget:i,closeTabs:a,closeDocument:o,closeAndClearForRename:s,getPoolActiveDocName:c,isNewTabActive:l,openTarget:u,prewarm:d,remapTabsForRename:f}=dt(),{notifySidebarFileSelected:p}=UD(),{resolvedTheme:m}=Gr(),{addPage:h}=Nr(),g;t[0]!==p||t[1]!==u?(g=function(e){u({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),lH(kr(e)),p()},t[0]=p,t[1]=u,t[2]=g):g=t[2];let _=g,v;t[3]!==p||t[4]!==u?(v=function(e){let t=ei(e);u({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),lH(t),p()},t[3]=p,t[4]=u,t[5]=v):v=t[5];let y=v,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[6]=x):x=t[6];let[S,C]=(0,Q.useState)(x),[w,E]=(0,Q.useState)(!0),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),B=(0,Q.useRef)(S),V;t[7]!==S||t[8]!==y||t[9]!==_||t[10]!==p||t[11]!==u?(V=function(e,t){let n=bV(e,t===void 0?S:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,NO(e));return}if(n.kind===`asset`){u({kind:`asset`,target:n.path,assetPath:n.path,mediaKind:n.mediaKind},{tabBehavior:`replace-active`}),lH(n.hash),p();return}if(n.kind===`folder`){y(n.path);return}_(n.path)},t[7]=S,t[8]=y,t[9]=_,t[10]=p,t[11]=u,t[12]=V):V=t[12];let H=V,U=(0,Q.useRef)(r),W;t[13]===S?W=t[14]:(W=new Set(S.filter(An).map($H)),t[13]=S,t[14]=W);let G=W,ee=(0,Q.useRef)(G),te;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[15]=te):te=t[15];let ne=(0,Q.useRef)(te),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(QH),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(!1),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(!1),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),K=(0,Q.useRef)(null),fe=(0,Q.useRef)(ZH),pe=(0,Q.useRef)(XH),me=(0,Q.useRef)(YH),he=(0,Q.useRef)(JH),ge=(0,Q.useRef)(i),{selectedFilePath:_e,selectedFolderPath:ve,navigationPath:ye}=yV(i,l?null:r),be=_e?DO(_e,S.find(e=>mi(e)&&e.docName===_e)?.docExt):ve?MO(ve):i?.kind===`asset`?i.assetPath:null,xe=sg().states,{dispatch:Se}=Xh(),Ce;t[16]!==Se||t[17]!==xe?(Ce={installStates:xe,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Se},t[16]=Se,t[17]=xe,t[18]=Ce):Ce=t[18];let we=Ce,{okignoreBinding:Te,projectLocalBinding:Ee,merged:De}=b(),Oe=De?.appearance?.sidebar?.showHiddenFiles??!1,ke=De?.appearance?.sidebar?.showAllFiles??!1,Ae;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>ce.current===null,t[19]=Ae):Ae=t[19];let je=Ae,Me;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[20]=Me):Me=t[20];let Ne;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={set:`complete`,spriteSheet:vH},t[21]=Ne):Ne=t[21];let Pe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[22]=Pe):Pe=t[22];let Fe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={canDrag:je,canDrop:je,onDropComplete:e=>he.current(e),onDropError:qH},t[23]=Fe):Fe=t[23];let Ie;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ie={paths:Me,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:Ne,unsafeCSS:yH,composition:Pe,dragAndDrop:Fe,renaming:{canRename:je,onRename:e=>pe.current(e),onError:e=>me.current(e)},onSelectionChange:e=>fe.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=B.current.find(e=>mi(e)&&DO(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:mH,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:xH(t.path)?{icon:hH,title:`Agent configuration file`}:null}},t[24]=Ie):Ie=t[24];let{model:q}=qB(Ie),Le;t[25]===q?Le=t[26]:(Le=function(e){let t=q.getItem(e)??q.getItem(MO(e));return t?.isDirectory()?MO(jO(t.getPath())):e},t[25]=q,t[26]=Le);let Re=Le,ze,Be;t[27]===S?(ze=t[28],Be=t[29]):(Be=PO(S),ze=FO(Be),t[27]=S,t[28]=ze,t[29]=Be);let Ve=ze,He=(0,Q.useRef)(Be),We;t[30]===S?We=t[31]:(We=LO(S),t[30]=S,t[31]=We);let Ge=We,Ke=(0,Q.useRef)(Ge),qe=ve?RO(MO(ve)).slice(0,-1):RO(be??ye),Je=qe.join(`\0`),Ye;if(t[32]!==q){let e=()=>{let e=new Set;for(let t of Ke.current)MV(q.getItem(t))?.isExpanded()&&e.add(t);return e};Ye=t=>{let n=new Set(LO(t??B.current)),r=e();for(let e of ne.current)r.add(e);return[...r].filter(e=>n.has(e))},t[32]=q,t[33]=Ye}else Ye=t[33];let Xe=Ye,Ze;t[34]!==Xe||t[35]!==q?(Ze=e=>{let t=PO(e??B.current);q.resetPaths(t,{initialExpandedPaths:Xe(e)})},t[34]=Xe,t[35]=q,t[36]=Ze):Ze=t[36];let Qe=Ze,$e;t[37]===Symbol.for(`react.memo_cache_sentinel`)?($e=e=>{ae.current=IO(e)},t[37]=$e):$e=t[37];let et=$e,tt;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>ee.current.has(e),t[38]=tt):tt=t[38];let nt=tt,rt;t[39]!==h||t[40]!==y||t[41]!==_||t[42]!==Qe?(rt=async function(e){if(ce.current!==null)return;let t=()=>{A(null),ce.current=null};ce.current=e.path,A(e.path),O(null);try{let n=await T(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),`Failed to duplicate path`);if(!n.ok){X.error(n.title),O(n.title),Qe(),t();return}let r=N(yi,n.body,`duplicate-path`,null);if(r===null){X.error(`Duplicate succeeded but the sidebar may be out of date — refresh to resync`),O(`Duplicate succeeded but the sidebar may be out of date — refresh to resync`),Wr([`files`,`backlinks`,`graph`]),Qe(),t();return}for(let e of r.duplicatedDocNames)h(e);C(t=>{let n=QO(t,e,r);return Qe(n),et(n),n}),Wr([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?y(r.path):_(r.path)),X.success(r.kind===`folder`?`Folder duplicated`:`File duplicated`,{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(`Could not duplicate item`,{description:r}),Qe(),t()}},t[39]=h,t[40]=y,t[41]=_,t[42]=Qe,t[43]=rt):rt=t[43];let it=rt,at=(0,Q.useRef)(it),ot;t[44]===it?ot=t[45]:(ot=()=>{at.current=it},t[44]=it,t[45]=ot),(0,Q.useEffect)(ot);let st=function(e){let t=uH(e);if(!t||dH(t))return!1;let n=q.getFocusedPath()??q.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||nt(n))return!1;let r=dH(n);if(!r)return!1;let i=MO(t);if(!Ke.current.includes(i))return!1;let a=`${t}${r}`;return He.current.includes(a)?!1:(Ft({sourcePath:n,destinationPath:a,isFolder:!1}),q.move(n,a),!0)},ct;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>{let t=e??re.current;!t||re.current!==t||(t.disposeCommitListener(),re.current=null)},t[46]=ct):ct=t[46];let lt=ct,ut;t[47]!==lt||t[48]!==o||t[49]!==a||t[50]!==Qe?(ut=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;lt(e),r&&A(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=await T(t,`Failed to clean up pending ${e.kind}`);if(n.ok)return;let i=`${n.title} - ${e.kind} "${e.createdPath}" still exists on disk`;r?X.error(i):console.warn(`[FileTree] cleanup pending create failed: ${i}`),r&&(A(null),Qe());return}}catch(t){console.warn(`[FileTree] cleanup pending create failed:`,t),r&&X.error(`Network error - ${e.kind} "${e.createdPath}" still exists on disk`),r&&(A(null),Qe());return}r&&(e.kind===`file`?o(e.createdPath):a([Ue(e.createdPath)],{force:!0})),r&&C(t=>{let n=ZO(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return et(n),n}),Wr([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&A(null)},t[47]=lt,t[48]=o,t[49]=a,t[50]=Qe,t[51]=ut):ut=t[51];let ft=ut,pt,mt;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>()=>{let e=re.current;e&&ie.current(e,{restoreLocation:!1,updateUi:!1}).catch(KH)},mt=[],t[52]=pt,t[53]=mt):(pt=t[52],mt=t[53]),(0,Q.useEffect)(pt,mt);let ht,gt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>{let e=!0,t=KV(async function(){try{let t=ue.current,n=await T(await fetch(t?`/api/documents?showAll=true`:`/api/documents`),`Failed to load documents`);if(!e)return;if(!n.ok)O(n.title);else{let e=Mr.safeParse(n.body);if(!e.success)O(`Documents response did not match expected shape.`);else{let n=le.current||t;C(or(e.data.documents,n)),O(null)}}}catch(t){let n=t;e&&O(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&E(!1)});de.current=()=>t.request(),t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=Dr(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,de.current=null,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},gt=[],t[54]=ht,t[55]=gt):(ht=t[54],gt=t[55]),(0,Q.useEffect)(ht,gt);let _t=(0,Q.useRef)(!0),yt;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(yt=()=>{if(_t.current){_t.current=!1;return}de.current?.()},t[56]=yt):yt=t[56];let bt;t[57]===Oe?bt=t[58]:(bt=[Oe],t[57]=Oe,t[58]=bt),(0,Q.useEffect)(yt,bt);let xt=(0,Q.useRef)(!0),St;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(St=()=>{if(xt.current){xt.current=!1;return}de.current?.()},t[59]=St):St=t[59];let Ct;t[60]===ke?Ct=t[61]:(Ct=[ke],t[60]=ke,t[61]=Ct),(0,Q.useEffect)(St,Ct);let wt,Tt;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=N(Ar,n,`workspace`,null);r&&z({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(GH),()=>{e=!1}},Tt=[],t[62]=wt,t[63]=Tt):(wt=t[62],Tt=t[63]),(0,Q.useEffect)(wt,Tt);let Et;t[64]!==Xe||t[65]!==q||t[66]!==Ve?(Et=()=>{if(ae.current===Ve){ae.current=null;return}q.resetPaths(He.current,{initialExpandedPaths:Xe()})},t[64]=Xe,t[65]=q,t[66]=Ve,t[67]=Et):Et=t[67];let Dt;t[68]!==q||t[69]!==Ve?(Dt=[q,Ve],t[68]=q,t[69]=Ve,t[70]=Dt):Dt=t[70],(0,Q.useEffect)(Et,Dt),PV(q,be,Je,se);let Ot,kt;t[71]===q?(Ot=t[72],kt=t[73]):(Ot=()=>q.subscribe(()=>{if(!q.isSearchOpen())for(let e of ne.current){let t=MV(q.getItem(e));t&&!t.isExpanded()&&t.expand()}}),kt=[q],t[71]=q,t[72]=Ot,t[73]=kt),(0,Q.useEffect)(Ot,kt);let At,jt;t[74]===q?(At=t[75],jt=t[76]):(At=()=>q.onMutation(`remove`,e=>{let t=re.current;!t||e.path!==t.renamePath||ie.current(t)}),jt=[q],t[74]=q,t[75]=At,t[76]=jt),(0,Q.useEffect)(At,jt);let Nt;t[77]!==h||t[78]!==s||t[79]!==c||t[80]!==y||t[81]!==f?(Nt=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??U.current,a=$O(i,e),o=n?.folderPath??(ge.current?.kind===`folder`?ge.current.folderPath:null),l=o?Mt(o,r):null;vt(e);let u=ek(e,c());await Promise.all(u.map(e=>s(e)));for(let t of e)h(t.toDocName);f(e,r),C(t=>{let n=XO(t,e,r);return et(n),n}),o&&l&&l!==o?y(l):a&&a!==i&&(window.location.hash=kr(a)),Wr([`files`,`backlinks`,`graph`])},t[77]=h,t[78]=s,t[79]=c,t[80]=y,t[81]=f,t[82]=Nt):Nt=t[82];let Pt=Nt;async function Ft(e){let t=VO(e.sourcePath,e.isFolder);A(t),O(null);try{if(!e.isFolder&&nt(t)){X.error(`Assets cannot be renamed from the sidebar`),queueMicrotask(()=>{Qe()}),lt(),A(null);return}let n=XB(e.sourcePath,e.destinationPath,e.isFolder);if(n.kind===`block`){X.error(`File extensions are managed automatically - please rename without changing the extension`),queueMicrotask(()=>{Qe()}),lt(),A(null);return}let r=VO(n.destinationPath,e.isFolder),i=e.isFolder?{kind:`folder`,fromPath:jO(t),toPath:jO(r)}:{kind:`file`,fromPath:OO(t),toPath:OO(r)},a={docName:U.current,folderPath:ge.current?.kind===`folder`?ge.current.folderPath:null},o=await T(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to rename path`);if(!o.ok){X.error(o.title),O(o.title),Qe();let e=re.current;e&&e.renamePath===t?await ft(e):lt(),A(null);return}let s=N(mr,o.body,`rename-path`,{renamed:[]});try{await Pt(s.renamed,e.isFolder?[{fromPath:jO(t),toPath:jO(r)}]:[],a)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:t,destinationTreePath:r,renamedCount:s.renamed.length}),X.error(`Rename succeeded but the sidebar may be out of date — refresh to resync`)}lt(),A(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),X.error(`Network error — please try again`),O(`Network error — please try again`),Qe();let n=re.current;n&&n.renamePath===t?await ft(n):lt(),A(null)}}let It;t[83]!==Pt||t[84]!==Qe?(It=async function(e){let t=e.draggedPaths.map(t=>{let n=WO(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(WH);if(t.length!==0){if(t.some(e=>nt(e.sourcePath))){X.error(`Assets cannot be moved from the sidebar`),Qe();return}A(t[0]?.sourcePath??null),O(null);try{let e=[],n=[],r={docName:U.current,folderPath:ge.current?.kind===`folder`?ge.current.folderPath:null};for(let r of t){let t=r.sourcePath.endsWith(`/`),i=t?{kind:`folder`,fromPath:jO(r.sourcePath),toPath:jO(r.destinationTreePath)}:{kind:`file`,fromPath:OO(r.sourcePath),toPath:OO(r.destinationTreePath)},a=await T(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to move`);if(!a.ok){X.error(a.title),O(a.title),Qe(),A(null);return}let o=N(mr,a.body,`rename-path:drop`,{renamed:[]});e=e.concat(o.renamed),t&&n.push({fromPath:jO(r.sourcePath),toPath:jO(r.destinationTreePath)})}try{await Pt(e,n,r)}catch(n){console.warn(`[FileTree] post-move reconciliation failed`,{err:n,operationCount:t.length,renamedCount:e.length}),X.error(`Move succeeded but the sidebar may be out of date — refresh to resync`)}A(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(`Network error — please try again`),Qe(),A(null)}}},t[83]=Pt,t[84]=Qe,t[85]=It):It=t[85];let Lt=It,Rt;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=function(e){L({parentDir:e})},t[86]=Rt):Rt=t[86];let zt=Rt,Bt;t[87]!==ft||t[88]!==lt||t[89]!==q||t[90]!==y||t[91]!==_||t[92]!==Qe||t[93]!==Be?(Bt=async function(e,t){if(ce.current)return;let n=re.current;n&<(n);try{let n=HO(e,t,[...Be,...Ke.current]);A(n.renamePath),ce.current=n.renamePath;let r=window.location.hash,i;if(e===`file`){let e=UO(`file`,n.addPath),t=await T(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create file`);if(!t.ok){X.error(t.title),O(t.title),A(null),ce.current=null;return}let r=OO(e),a=N(Ur,t.body,`create-page`,{docName:r}).docName;i=a;let o=e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`;C(e=>{if(e.some(e=>mi(e)&&e.docName===a))return e;let t=[...e,{kind:`document`,docName:a,docExt:o,modified:new Date().toISOString(),size:0}];return et(t),t}),Wr([`files`,`backlinks`,`graph`]),_(a)}else{let e=jO(n.addPath),t=await T(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create folder`);if(!t.ok){X.error(t.title),O(t.title),A(null),ce.current=null;return}i=N(qr,t.body,`create-folder`,{path:e}).path,C(e=>{if(e.some(e=>ur(e)&&e.path===i))return e;let t=[...e,{kind:`folder`,path:i,modified:new Date().toISOString(),size:0}];return et(t),t}),Wr([`files`]),y(i)}let a=!1,o=e=>{if(e.key!==`Enter`)return;let t=re.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>lt(t))};document.addEventListener(`keydown`,o,!0),re.current={kind:e,renamePath:n.renamePath,createdPath:i,previousHash:r,disposeCommitListener:()=>{a||(a=!0,document.removeEventListener(`keydown`,o,!0))}},A(null),ce.current=null,q.add(n.addPath),q.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(`Could not start creating a new item`);let t=re.current;t?await ft(t):lt(),A(null),ce.current=null,Qe()}},t[87]=ft,t[88]=lt,t[89]=q,t[90]=y,t[91]=_,t[92]=Qe,t[93]=Be,t[94]=Bt):Bt=t[94];let Vt=Bt,Ht;t[95]===q?Ht=t[96]:(Ht=function(e){let t=MO(e);(0,Q.startTransition)(()=>{for(let e of Ke.current)if(e===t||e.startsWith(t)){let t=MV(q.getItem(e));t&&t.expand()}})},t[95]=q,t[96]=Ht);let Ut=Ht,Wt;t[97]===q?Wt=t[98]:(Wt=function(e){let t=MO(e),n=new Set(ne.current);(0,Q.startTransition)(()=>{for(let e of[...Ke.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=MV(q.getItem(e));t&&t.collapse()}})},t[97]=q,t[98]=Wt);let Gt=Wt,Kt;t[99]!==H||t[100]!==qe||t[101]!==r||t[102]!==i||t[103]!==G||t[104]!==k||t[105]!==ft||t[106]!==S||t[107]!==Ge||t[108]!==Lt||t[109]!==Ft||t[110]!==Re||t[111]!==st||t[112]!==ke||t[113]!==Oe||t[114]!==Be?(Kt=()=>{B.current=S,U.current=r,ge.current=i,ee.current=G,ce.current=k,le.current=Oe,ue.current=ke,He.current=Be,Ke.current=Ge,ne.current=qe,ie.current=ft,fe.current=e=>{if(se.current||e.length!==1)return;let t=e[0];t&&H(Re(t),S)},me.current=e=>{st(e)||X.error(e)},pe.current=Ft,he.current=Lt},t[99]=H,t[100]=qe,t[101]=r,t[102]=i,t[103]=G,t[104]=k,t[105]=ft,t[106]=S,t[107]=Ge,t[108]=Lt,t[109]=Ft,t[110]=Re,t[111]=st,t[112]=ke,t[113]=Oe,t[114]=Be,t[115]=Kt):Kt=t[115],(0,Q.useLayoutEffect)(Kt);let qt,J;t[116]===q?(qt=t[117],J=t[118]):(qt=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||kH(e.target))return;let a=K.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=q.getFocusedPath()??q.getSelectedPaths()[0]??null;if(!t)return;let n=q.getItem(t)??q.getItem(MO(t)),r=n?.isDirectory()?MO(jO(n.getPath())):t;if(ee.current.has(r))return;at.current(TH(r)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Ke.current,...He.current]);se.current=!0;for(let e of u)!e||ee.current.has(e)||q.getItem(e)?.select();queueMicrotask(()=>{se.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},J=[q],t[116]=q,t[117]=qt,t[118]=J),(0,Q.useEffect)(qt,J);let Jt,Yt;t[119]!==S.length||t[120]!==w?(Jt=()=>{if(w||S.length===0)return;let e=K.current?.querySelector(Uj)?.shadowRoot;if(!e)return;let t=UH,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Yt=[w,S.length],t[119]=S.length,t[120]=w,t[121]=Jt,t[122]=Yt):(Jt=t[121],Yt=t[122]),(0,Q.useEffect)(Jt,Yt);let Xt,Zt;t[123]!==S.length||t[124]!==w?(Xt=()=>{if(w||S.length===0)return;let e=K.current?.querySelector(Uj)?.shadowRoot;if(!e)return;let t=()=>$B(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Zt=[w,S.length],t[123]=S.length,t[124]=w,t[125]=Xt,t[126]=Zt):(Xt=t[125],Zt=t[126]),(0,Q.useEffect)(Xt,Zt);let Qt,$t;t[127]!==S.length||t[128]!==w?(Qt=()=>{if(w||S.length===0)return;let e=K.current?.querySelector(Uj)?.shadowRoot;if(!e)return;let t=()=>fV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},$t=[w,S.length],t[127]=S.length,t[128]=w,t[129]=Qt,t[130]=$t):(Qt=t[129],$t=t[130]),(0,Q.useEffect)(Qt,$t);let en;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(en={folderCount:0,expandedCount:0},t[131]=en):en=t[131];let tn=(0,Q.useRef)(en),nn=(0,Q.useRef)(Vt),rn=(0,Q.useRef)(zt),an;t[132]===Vt?an=t[133]:(an=()=>{nn.current=Vt,rn.current=zt},t[132]=Vt,t[133]=an),(0,Q.useEffect)(an);let on,sn;t[134]===q?(on=t[135],sn=t[136]):(on=()=>({startCreating(e,t){nn.current(e,t)},startCreatingFromTemplate(e){rn.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of Ke.current){let t=MV(q.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ne.current);(0,Q.startTransition)(()=>{for(let t of[...Ke.current].reverse()){if(e.has(t))continue;let n=MV(q.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Ke.current,t=0;for(let n of e)MV(q.getItem(n))?.isExpanded()&&t++;let n=e.length,r=tn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return tn.current=i,i},subscribe(e){return q.subscribe(e)}}),sn=[q],t[134]=q,t[135]=on,t[136]=sn),(0,Q.useImperativeHandle)(n,on,sn);let cn;t[137]!==lt||t[138]!==s||t[139]!==a||t[140]!==q?(cn=async function(e,t,n){let r=AH(e,B.current,Ke.current),i=re.current;i&&e.some(e=>jH(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),lt(i));let o=new Set([...r.docNames,...t]),c=new Set([...r.folderPaths,...n]);a([...[...o].map(HH),...[...c].map(VH)],{force:!0}),await Promise.all([...o].map(e=>s(e)));for(let t of e){let e=t.kind===`folder`?MO(t.path):DO(t.path,t.docExt);q.getItem(e)&&q.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}C(e=>{let t=ZO(e,[...o]);for(let e of c)t=ZO(t,[],e);return et(t),t}),Wr([`files`,`backlinks`,`graph`])},t[137]=lt,t[138]=s,t[139]=a,t[140]=q,t[141]=cn):cn=t[141];let ln=cn,un;t[142]===ln?un=t[143]:(un=async function(e){let t=[],n=[],r=[];for(let i of e){A(i.path);let e=await T(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:i.kind,path:i.path})}),`Failed to delete path`);if(!e.ok)return r.length>0&&await ln(r,t,n),X.error(e.title),!1;let a=N(Si,e.body,`delete-path`,{deletedDocNames:[]});t.push(...a.deletedDocNames),i.kind===`folder`&&n.push(i.path),r.push(i)}return await ln(r,t,n),!0},t[142]=ln,t[143]=un);let dn=un,fn;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(fn=async function(e,t,n){let r=[],i=[];for(let a of e){A(a.path);let e=tk(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:EV(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[144]=fn):fn=t[144];let pn=fn,mn;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(mn=async function(e){let t=[],n=[],r=[];for(let i of e)try{let e=await T(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:i.kind,path:i.path})}),`Failed to clean up after trash`);if(!e.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${i.kind}:${i.path}`,reason:e.title}),r.push({target:i,reason:e.title});continue}let a=N(Tn,e.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...a.deletedDocNames),i.kind===`folder`&&n.push(i.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${i.kind}:${i.path}`,err:t}),r.push({target:i,reason:`Network error during cleanup`})}if(r.length>0){let e=r.length,t=e===1?`item`:`items`;X.error(`Server-side cleanup failed for ${e} ${t}`,{description:`The file is in your Trash; the file-watcher will reconcile.`})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[145]=mn):mn=t[145];let hn=mn,gn;t[146]!==ln||t[147]!==dn||t[148]!==Qe||t[149]!==R?(gn=async function(e){let t=e[0];if(!t)return;A(t.path),M(null);let n=typeof window<`u`?window.okDesktop:void 0;try{if(n&&R){let{trashed:t,failed:r}=await pn(e,n,R);if(t.length>0){let e=await hn(t);e?await ln(t,e.deletedDocNames,e.deletedFolderPaths):await ln(t,t.filter(BH).map(zH),t.filter(RH).map(LH))}r.length>0&&F({failed:r,originalTargets:[...e]}),A(null)}else{let t=await dn(e);A(null),t||Qe()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(`Could not complete delete`,{description:n}),A(null),Qe()}},t[146]=ln,t[147]=dn,t[148]=Qe,t[149]=R,t[150]=gn):gn=t[150];let _n=gn,vn;t[151]!==dn||t[152]!==Qe||t[153]!==P?(vn=async function(){if(!P)return;let e=new Set(P.failed.map(IH)),t=P.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(F(null),t.length!==0){A(t[0]?.path??null);try{let e=await dn(t);A(null),e||Qe()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(`Could not complete delete`,{description:n}),A(null),Qe()}}},t[151]=dn,t[152]=Qe,t[153]=P,t[154]=vn):vn=t[154];let yn=vn,bn;t[155]!==_n||t[156]!==P?(bn=async function(){if(!P)return;let e=new Set(P.failed.map(FH)),t=P.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));F(null),await _n(t)},t[155]=_n,t[156]=P,t[157]=bn):bn=t[157];let xn=bn,Sn=(0,Q.useRef)(_n),Cn;t[158]===_n?Cn=t[159]:(Cn=()=>{Sn.current=_n},t[158]=_n,t[159]=Cn),(0,Q.useEffect)(Cn);let wn,En;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(wn=()=>VV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=B.current.find(e=>mi(e)&&e.docName===t);Sn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Sn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),En=[],t[160]=wn,t[161]=En):(wn=t[160],En=t[161]),(0,Q.useEffect)(wn,En);let Dn,On;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=()=>GV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=B.current.find(e=>mi(e)&&e.docName===t);at.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){at.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),On=[],t[162]=Dn,t[163]=On):(Dn=t[162],On=t[163]),(0,Q.useEffect)(Dn,On);let kn,jn;t[164]===q?(kn=t[165],jn=t[166]):(kn=()=>UV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=DO(t,B.current.find(e=>mi(e)&&e.docName===t)?.docExt);q.startRenaming(n);return}if(e.kind===`folder`){q.startRenaming(e.folderPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),jn=[q],t[164]=q,t[165]=kn,t[166]=jn),(0,Q.useEffect)(kn,jn);let Mn;t[167]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=function(){let e=oe.current;e&&sH(e),oe.current=null},t[167]=Mn):Mn=t[167];let Nn=Mn,Pn;t[168]===d?Pn=t[169]:(Pn=function(e){let t=eU(e.nativeEvent);if(!t||t.endsWith(`/`)){Nn();return}let n=OO(t),r=B.current.find(e=>kO(e)===t);if(r&&An(r)){Nn();return}oe.current!==n&&(Nn(),oe.current=n,oH(n,e=>d(e)))},t[168]=d,t[169]=Pn);let Fn=Pn,In;t[170]!==H||t[171]!==q||t[172]!==y?(In=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=tU(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?MO(n):n;if(q.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=jO(r);if(window.location.hash===ei(e))return;queueMicrotask(()=>y(e));return}let i=OO(r);window.location.hash!==kr(i)&&queueMicrotask(()=>H(r))},t[170]=H,t[171]=q,t[172]=y,t[173]=In):In=t[173];let Ln=In;if(w){let e;return t[174]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rU,{}),t[174]=e):e=t[174],e}if(S.length===0){if(D){let e;return t[175]===D?e=t[176]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:D})}),t[175]=D,t[176]=e),e}let e;t[177]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[177]=e):e=t[177];let n;return t[178]===Vt?n=t[179]:(n=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>Vt(`file`,``),children:`Create your first file`})]}),t[178]=Vt,t[179]=n),n}let Rn=k!==null,zn=j?.targets[0]??null,Bn;t[180]===D?Bn=t[181]:(Bn=D&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:D}),t[180]=D,t[181]=Bn);let Vn;t[182]===m?Vn=t[183]:(Vn=bH(m),t[182]=m,t[183]=Vn);let Hn;t[184]!==Rn||t[185]!==G||t[186]!==Gt||t[187]!==Ut||t[188]!==Ge||t[189]!==it||t[190]!==we||t[191]!==De||t[192]!==q||t[193]!==Te||t[194]!==Ee||t[195]!==Vt||t[196]!==R?(Hn=(e,t)=>(0,Z.jsx)(MH,{item:e,context:t,anyActionBusy:Rn,workspace:R,handoff:we,model:q,okignoreBinding:Te,projectLocalBinding:Ee,mergedConfig:De,onStartCreating:Vt,onStartCreatingFromTemplate:zt,onDuplicate:it,onDelete:e=>M({targets:e}),onExpandSubtree:Ut,onCollapseSubtree:Gt,folderTreePaths:Ge,isAsset:G.has(e.path),isAssetTreePath:nt}),t[184]=Rn,t[185]=G,t[186]=Gt,t[187]=Ut,t[188]=Ge,t[189]=it,t[190]=we,t[191]=De,t[192]=q,t[193]=Te,t[194]=Ee,t[195]=Vt,t[196]=R,t[197]=Hn):Hn=t[197];let Un;t[198]!==Ln||t[199]!==Fn||t[200]!==q||t[201]!==Bn||t[202]!==Vn||t[203]!==Hn?(Un=(0,Z.jsx)(`div`,{ref:K,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(KB,{header:Bn,model:q,style:Vn,onClickCapture:Ln,onMouseMove:Fn,onMouseLeave:Nn,renderContextMenu:Hn})}),t[198]=Ln,t[199]=Fn,t[200]=q,t[201]=Bn,t[202]=Vn,t[203]=Hn,t[204]=Un):Un=t[204];let Wn=!!j,Gn;t[205]===k?Gn=t[206]:(Gn=e=>{!e&&!k&&M(null)},t[205]=k,t[206]=Gn);let Kn;t[207]!==k||t[208]!==j||t[209]!==_n||t[210]!==zn?(Kn=j&&zn&&(0,Z.jsx)(ho,{...(()=>{let e=CV(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,j.targets);return e?{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(PH)}):null}:{itemName:j.targets.length===1?`${zn.name}${zn.kind===`file`?zn.docExt??`.md`:`/`}`:void 0,customTitle:j.targets.length>1?`Delete selected items`:void 0,customDescription:j.targets.length>1?`Are you sure you want to delete ${j.targets.length} selected items? Folders and all files inside them will be deleted. This action cannot be undone.`:zn.kind===`folder`?`Are you sure you want to delete ${zn.name}/ and all files inside? This action cannot be undone.`:void 0}})(),isSubmitting:k!==null,onDelete:()=>_n(j.targets)}),t[207]=k,t[208]=j,t[209]=_n,t[210]=zn,t[211]=Kn):Kn=t[211];let qn;t[212]!==Wn||t[213]!==Gn||t[214]!==Kn?(qn=(0,Z.jsx)(Vo,{open:Wn,onOpenChange:Gn,children:Kn}),t[212]=Wn,t[213]=Gn,t[214]=Kn,t[215]=qn):qn=t[215];let Jn=!!P,Yn;t[216]===k?Yn=t[217]:(Yn=e=>{!e&&!k&&F(null)},t[216]=k,t[217]=Yn);let Xn;t[218]!==k||t[219]!==yn||t[220]!==xn||t[221]!==P?(Xn=P&&(0,Z.jsx)(AV,{failedTargets:P.failed,isSubmitting:k!==null,onDeletePermanently:yn,onRetry:xn,onCancel:()=>F(null)}),t[218]=k,t[219]=yn,t[220]=xn,t[221]=P,t[222]=Xn):Xn=t[222];let Zn;t[223]!==Jn||t[224]!==Yn||t[225]!==Xn?(Zn=(0,Z.jsx)(Vo,{open:Jn,onOpenChange:Yn,children:Xn}),t[223]=Jn,t[224]=Yn,t[225]=Xn,t[226]=Zn):Zn=t[226];let Qn=I!==null,$n;t[227]===Symbol.for(`react.memo_cache_sentinel`)?($n=e=>{e||L(null)},t[227]=$n):$n=t[227];let er=I?.parentDir??``,tr;t[228]!==Qn||t[229]!==er?(tr=(0,Z.jsx)(Sm,{open:Qn,onOpenChange:$n,kind:`file`,initialDir:er}),t[228]=Qn,t[229]=er,t[230]=tr):tr=t[230];let nr;return t[231]!==Un||t[232]!==qn||t[233]!==Zn||t[234]!==tr?(nr=(0,Z.jsxs)(Z.Fragment,{children:[Un,qn,Zn,tr]}),t[231]=Un,t[232]=qn,t[233]=Zn,t[234]=tr,t[235]=nr):nr=t[235],nr}function PH(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:wV(e)},`${e.kind}:${e.path}`)}function FH(e){return`${e.kind}:${e.path}`}function IH(e){return`${e.kind}:${e.path}`}function LH(e){return e.path}function RH(e){return e.kind===`folder`}function zH(e){return e.path}function BH(e){return e.kind===`file`}function VH(e){return Ue(e)}function HH(e){return ht(e)}function UH(e){return e.endsWith(`/`)?e.slice(0,-1):e}function WH(e){return!!e}function GH(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function KH(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function qH(e){X.error(e)}function JH(){}function YH(e){return X.error(e)}function XH(){}function ZH(){}async function QH(){}function $H(e){return kO(e)}function eU(e){return tU(e)?.dataset.itemPath??null}function tU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var nU=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function rU(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:nU.map(iU)}),e[0]=t):t=e[0],t}function iU(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(mo,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(mo,{className:`h-3 ${e}`})]},t)}function aU(e){return e?`No workspace`:null}function oU(e){let t=(0,$.c)(41),{input:n,installStates:r,dispatch:i,webFallbackVisible:a}=e,o=a===void 0?!0:a,s=n===null,c;t[0]===s?c=t[1]:(c=aU(s),t[0]=s,t[1]=c);let l=c,u,d,f,p,m,h,g;if(t[2]!==i||t[3]!==l||t[4]!==n||t[5]!==s||t[6]!==r||t[7]!==o){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[15]===r?e=t[16]:(e=e=>r[e.id]?.installed===!0,t[15]=r,t[16]=e);let a=eh.filter(e);f=r[`claude-code`]?.installed===!0;let c;t[17]===n?c=t[18]:(c=n!==null&&n.docContext!==null?jr(n.docContext.relativePath):``,t[17]=n,t[18]=c);let _=c,v;t[19]!==n||t[20]!==_?(v=()=>{n!==null&&ES(_)},t[19]=n,t[20]=_,t[21]=v):v=t[21],p=v;let y=o&&!f;if(a.length===0&&!y){g=null;break bb0}d=lk,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(fk,{children:[(0,Z.jsx)(Ji,{"aria-hidden":`true`}),`Open with AI`]}),t[22]=h):h=t[22],u=pk;let b;t[23]!==i||t[24]!==l||t[25]!==n||t[26]!==s?(b=e=>{let t=!s,r=l?`Open with AI ${e.displayName}, ${l}`:`Open with AI ${e.displayName}`;return(0,Z.jsxs)(dk,{disabled:!t,onSelect:()=>{n&&i(e.id,n)},"data-testid":`empty-space-open-in-${e.id}`,"aria-label":r,children:[(0,Z.jsx)(bS,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)},t[23]=i,t[24]=l,t[25]=n,t[26]=s,t[27]=b):b=t[27],m=a.map(b)}t[2]=i,t[3]=l,t[4]=n,t[5]=s,t[6]=r,t[7]=o,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[28]!==f||t[29]!==p||t[30]!==s||t[31]!==o?(_=o&&!f?(0,Z.jsxs)(dk,{onSelect:p,disabled:s,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(bt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}):null,t[28]=f,t[29]=p,t[30]=s,t[31]=o,t[32]=_):_=t[32];let v;t[33]!==u||t[34]!==m||t[35]!==_?(v=(0,Z.jsxs)(u,{children:[m,_]}),t[33]=u,t[34]=m,t[35]=_,t[36]=v):v=t[36];let y;return t[37]!==d||t[38]!==h||t[39]!==v?(y=(0,Z.jsxs)(d,{children:[h,v]}),t[37]=d,t[38]=h,t[39]=v,t[40]=y):y=t[40],y}var sU=(e,t,n)=>pl(e,t,n,`ProjectSwitcher`);function cU(e){let t=(0,$.c)(59),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return sU(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,Q.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),sU(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),sU(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),sU(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=ka,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(nc,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(rO,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=Oa,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ua,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Z.jsx)(ua,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(Aa,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(ma,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(Aa,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Z.jsx)(Aa,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:`Switch Project`}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Z.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Z.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function lU(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Sr(`sidebarSearchPill`)}function uU(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Di(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(x,{"aria-hidden":`true`}),o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:`Search`}),t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(sC,{className:`text-foreground/70`,children:Ti()?`⌘ K`:`Ctrl K`}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Y,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function dU(e){let t=(0,$.c)(33),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Do,{"aria-hidden":`true`,className:`size-3`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:a}),t[1]=r,t[2]=o);let s=o;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${i}`,a;t[3]===n.body?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[3]=n.body,t[4]=a);let o;t[5]!==s||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,s]}),t[5]=s,t[6]=a,t[7]=o):o=t[7];let c;t[8]===n.action?c=t[9]:(c=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[8]=n.action,t[9]=c);let l;t[10]===n.secondaryAction?l=t[11]:(l=()=>{n.secondaryAction?.onClick()},t[10]=n.secondaryAction,t[11]=l);let u;t[12]!==n.secondaryAction.label||t[13]!==l?(u=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:l,children:n.secondaryAction.label}),t[12]=n.secondaryAction.label,t[13]=l,t[14]=u):u=t[14];let d;t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==d||t[19]!==e||t[20]!==r||t[21]!==o?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,d]}),t[18]=d,t[19]=e,t[20]=r,t[21]=o,t[22]=f):f=t[22],f}let c=`update-notice-${n.id}`,l=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,u;t[23]===n.body?u=t[24]:(u=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[23]=n.body,t[24]=u);let d;t[25]===n.action?d=t[26]:(d=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[25]=n.action,t[26]=d);let f;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":c,className:l,children:[u,d,s]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f):f=t[32],f}function fU(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function pU(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Ep,Tp,Tp),n;e[0]===t?n=e[1]:(n=fU(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{wp(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(dU,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function mU(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Fh(n.contentDir,Ih(t),n.pathSeparator):e?.kind===`folder`?Fh(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function hU(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Fh(n.contentDir,t.slice(0,e),n.pathSeparator)}return e?.kind===`folder`?Fh(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function gU(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Ih(t):e?.kind===`folder`?e.folderPath:``}function _U(e,t,n){return e===null?Rh({workspace:n}):e.kind===`folder`?n?zh({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?Lh({docName:t,workspace:n}):null}var vU={folderCount:0,expandedCount:0},yU=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function bU(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(yU)!==null}function xU(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(q,{name:`file-sidebar`,children:(0,Z.jsx)(CU,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var SU=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(En,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(er,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(jn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function CU(e){let t=(0,$.c)(190),{onOpenSearch:n}=e,{_:r}=Kt(),[i,a]=(0,Q.useState)(null),{activeDocName:o,activeTarget:s}=dt(),c;t[0]!==o||t[1]!==s?(c=s?.kind===`folder`||s?.kind===`folder-index`?s.folderPath:_i(o),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u=typeof window<`u`&&window.okDesktop!=null,{state:d}=UD(),f=d===`expanded`,p=u&&d===`collapsed`,[m,h]=(0,Q.useState)(vU),g,_;t[3]===i?(g=t[4],_=t[5]):(g=()=>{if(i!==null)return h(i.getFolderState()),i.subscribe(()=>{h(i.getFolderState())})},_=[i],t[3]=i,t[4]=g,t[5]=_),(0,Q.useEffect)(g,_);let v,y;t[6]===i?(v=t[7],y=t[8]):(v=()=>{if(i!==null)return dC(()=>{i.startCreating(`file`,``)})},y=[i],t[6]=i,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let x=m.folderCount>0,S=x&&m.expandedCount===m.folderCount,C=m.expandedCount===0,w=Qa(``),T=w.state.status===`ready`?(w.state.data.folder.templates_available?.length??0)>0:!0,E=typeof window<`u`?window.okDesktop:void 0,D=ch(),O=sg().states,{dispatch:k}=Xh(),A;t[9]===D?A=t[10]:(A=Rh({workspace:D}),t[9]=D,t[10]=A);let j=A,{projectLocalBinding:M,merged:N}=b(),P=N?.appearance?.sidebar?.showHiddenFiles??!1,I=N?.appearance?.sidebar?.showAllFiles??!1,L=x&&!S,R=x&&!C,z=L||R,B=TU,V;t[11]!==i||t[12]!==D?(V=()=>{D&&i?.startCreating(`file`,``)},t[11]=i,t[12]=D,t[13]=V):V=t[13];let H=V,U;t[14]!==i||t[15]!==D?(U=()=>{D&&i?.startCreatingFromTemplate(``)},t[14]=i,t[15]=D,t[16]=U):U=t[16];let W=U,G;t[17]!==i||t[18]!==D?(G=()=>{D&&i?.startCreating(`folder`,``)},t[17]=i,t[18]=D,t[19]=G):G=t[19];let ee=G,te;t[20]===D?te=t[21]:(te=()=>{!D||!E||E.shell.showItemInFolder(D.contentDir)},t[20]=D,t[21]=te);let ne=te,re;t[22]===D?re=t[23]:(re=()=>{!D||!E||IV(E,D.contentDir)},t[22]=D,t[23]=re);let ie=re,ae;t[24]!==r||t[25]!==D?(ae=async()=>{if(D)try{await navigator.clipboard.writeText(D.contentDir),X.success(r({id:`6_ZOw4`}),{description:D.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=D,t[26]=ae):ae=t[26];let oe=ae,se;t[27]!==r||t[28]!==M?(se=e=>{if(M===null)return;let t=M.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,wi(t.error)),X.error(r({id:`P47EWZ`}),{description:wi(t.error)}))},t[27]=r,t[28]=M,t[29]=se):se=t[29];let ce=se,le;t[30]!==r||t[31]!==M?(le=e=>{if(M===null)return;let t=M.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,wi(t.error)),X.error(r({id:`P47EWZ`}),{description:wi(t.error)}))},t[30]=r,t[31]=M,t[32]=le):le=t[32];let de=le,K;t[33]===i?K=t[34]:(K=()=>{i?.expandAll()},t[33]=i,t[34]=K);let fe=K,pe;t[35]===i?pe=t[36]:(pe=()=>{i?.collapseAll()},t[35]=i,t[36]=pe);let me=pe,he,ge;t[37]!==I||t[38]!==R||t[39]!==L||t[40]!==P?(he=()=>{E&&E.editor.notifyViewMenuStateChanged({showHiddenFiles:P,showAllFiles:I,canExpandAll:L,canCollapseAll:R})},ge=[E,P,I,L,R],t[37]=I,t[38]=R,t[39]=L,t[40]=P,t[41]=he,t[42]=ge):(he=t[41],ge=t[42]),(0,Q.useEffect)(he,ge);let _e,ve;t[43]!==r||t[44]!==o||t[45]!==s||t[46]!==k||t[47]!==O||t[48]!==l||t[49]!==M||t[50]!==I||t[51]!==P||t[52]!==i||t[53]!==D?(_e=()=>{if(E)return E.onMenuAction(e=>{switch(e){case`new-doc`:if(!D||!i)return;i.startCreating(`file`,l);return;case`new-folder`:if(!D||!i)return;i.startCreating(`folder`,l);return;case`new-from-template`:if(!D||!i)return;i.startCreatingFromTemplate(l);return;case`rename`:if(!s)return;HV(s);return;case`duplicate`:if(!s)return;WV(s);return;case`move-to-trash`:if(!s)return;BV(s);return;case`reveal-in-finder`:{if(!E||!D)return;let e=mU(s,o,D);E.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!E||!D)return;IV(E,hU(s,o,D));return;case`send-to-ai`:{let e=eh.filter(e=>O[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=_U(s,o,D);if(!t)return;let[n]=e;if(!n)return;k(n.id,t);return}case`copy-full-path`:{if(!D)return;let e=mU(s,o,D);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=gU(s,o);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(M===null)return;let e=M.patch({appearance:{sidebar:{showHiddenFiles:!P}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,wi(e.error)),X.error(r({id:`P47EWZ`}),{description:wi(e.error)}));return}case`toggle-show-all-files`:{if(M===null)return;let e=M.patch({appearance:{sidebar:{showAllFiles:!I}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,wi(e.error)),X.error(r({id:`P47EWZ`}),{description:wi(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`delete`:case`toggle-sidebar`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:return}})},ve=[E,i,D,s,o,l,M,P,I,O,k,r],t[43]=r,t[44]=o,t[45]=s,t[46]=k,t[47]=O,t[48]=l,t[49]=M,t[50]=I,t[51]=P,t[52]=i,t[53]=D,t[54]=_e,t[55]=ve):(_e=t[54],ve=t[55]),(0,Q.useEffect)(_e,ve);let be=p&&`opacity-0`,xe;t[56]===be?xe=t[57]:(xe=Di(`flex-row h-12 items-center py-0 px-3`,u?`justify-end`:`justify-between`,u&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,be,u&&`[-webkit-app-region:drag]`),t[56]=be,t[57]=xe);let Se;t[58]===f?Se=t[59]:(Se=f&&!u?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[58]=f,t[59]=Se);let Ce;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Di(`flex items-center gap-1`,u&&`[&>*]:[-webkit-app-region:no-drag]`),t[60]=Ce):Ce=t[60];let we;t[61]!==r||t[62]!==S||t[63]!==x||t[64]!==C||t[65]!==i?(we=x?(0,Z.jsxs)(ka,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(SU,{icon:Oc,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(Oa,{align:`end`,children:[S?null:(0,Z.jsxs)(Aa,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(sl,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`b392Dr`})]}),C?null:(0,Z.jsxs)(Aa,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`BBtVak`})]})]})]}):null,t[61]=r,t[62]=S,t[63]=x,t[64]=C,t[65]=i,t[66]=we):we=t[66];let Te;t[67]===r?Te=t[68]:(Te=r({id:`MW64zN`}),t[67]=r,t[68]=Te);let Ee;t[69]!==l||t[70]!==i?(Ee=()=>i?.startCreating(`file`,l),t[69]=l,t[70]=i,t[71]=Ee):Ee=t[71];let De;t[72]!==Te||t[73]!==Ee?(De=(0,Z.jsx)(SU,{icon:$c,label:Te,onClick:Ee}),t[72]=Te,t[73]=Ee,t[74]=De):De=t[74];let Oe;t[75]!==r||t[76]!==T||t[77]!==l||t[78]!==i?(Oe=T?(0,Z.jsx)(SU,{icon:hc,label:r({id:`Uuj_R4`}),onClick:()=>i?.startCreatingFromTemplate(l)}):null,t[75]=r,t[76]=T,t[77]=l,t[78]=i,t[79]=Oe):Oe=t[79];let ke;t[80]===r?ke=t[81]:(ke=r({id:`tX5yOZ`}),t[80]=r,t[81]=ke);let Ae;t[82]!==l||t[83]!==i?(Ae=()=>i?.startCreating(`folder`,l),t[82]=l,t[83]=i,t[84]=Ae):Ae=t[84];let je;t[85]!==ke||t[86]!==Ae?(je=(0,Z.jsx)(SU,{icon:yc,label:ke,onClick:Ae}),t[85]=ke,t[86]=Ae,t[87]=je):je=t[87];let Me;t[88]!==we||t[89]!==De||t[90]!==Oe||t[91]!==je?(Me=(0,Z.jsxs)(`div`,{className:Ce,children:[we,De,Oe,je]}),t[88]=we,t[89]=De,t[90]=Oe,t[91]=je,t[92]=Me):Me=t[92];let Ne;t[93]!==xe||t[94]!==Se||t[95]!==Me?(Ne=(0,Z.jsxs)(ZD,{"data-electron-drag":u?``:void 0,className:xe,children:[Se,Me]}),t[93]=xe,t[94]=Se,t[95]=Me,t[96]=Ne):Ne=t[96];let Pe=p&&`opacity-0`,Fe;t[97]===Pe?Fe=t[98]:(Fe=Di(`px-2 pb-2`,u&&`[-webkit-app-region:no-drag]`,u&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Pe),t[97]=Pe,t[98]=Fe);let Ie;t[99]===d?Ie=t[100]:(Ie=[d],t[99]=d,t[100]=Ie);let q;t[101]===n?q=t[102]:(q=(0,Z.jsx)(uU,{onClick:n}),t[101]=n,t[102]=q);let Le;t[103]!==Ie||t[104]!==q?(Le=(0,Z.jsx)(ue,{fallbackRender:wU,onError:lU,resetKeys:Ie,children:q}),t[103]=Ie,t[104]=q,t[105]=Le):Le=t[105];let Re;t[106]!==Fe||t[107]!==Le?(Re=(0,Z.jsx)(`div`,{className:Fe,children:Le}),t[106]=Fe,t[107]=Le,t[108]=Re):Re=t[108];let ze;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)($D,{children:(0,Z.jsx)(NH,{ref:a})}),t[109]=ze):ze=t[109];let Be,Ve;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsxs)(QD,{className:`px-0`,children:[(0,Z.jsx)(pU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(eO,{children:(0,Z.jsx)(tO,{children:(0,Z.jsx)(cU,{bridge:window.okDesktop})})}):null]}),Ve=(0,Z.jsx)(YD,{enableToggle:!1}),t[110]=Be,t[111]=Ve):(Be=t[110],Ve=t[111]);let He;t[112]!==Ne||t[113]!==Re?(He=(0,Z.jsx)(ck,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:B,children:[Ne,Re,ze,Be,Ve]})}),t[112]=Ne,t[113]=Re,t[114]=He):He=t[114];let Ue=!D,We,Ge;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)($c,{"aria-hidden":`true`}),Ge=(0,Z.jsx)(J,{id:`MW64zN`}),t[115]=We,t[116]=Ge):(We=t[115],Ge=t[116]);let Ke;t[117]!==H||t[118]!==Ue?(Ke=(0,Z.jsxs)(dk,{disabled:Ue,onSelect:H,"data-testid":`empty-space-menu-new-file`,children:[We,Ge]}),t[117]=H,t[118]=Ue,t[119]=Ke):Ke=t[119];let qe=!D||!T,Je,Ye;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(hc,{"aria-hidden":`true`}),Ye=(0,Z.jsx)(J,{id:`Uuj_R4`}),t[120]=Je,t[121]=Ye):(Je=t[120],Ye=t[121]);let Xe;t[122]!==W||t[123]!==qe?(Xe=(0,Z.jsxs)(dk,{disabled:qe,onSelect:W,"data-testid":`empty-space-menu-new-from-template`,children:[Je,Ye]}),t[122]=W,t[123]=qe,t[124]=Xe):Xe=t[124];let Ze=!D,Qe,$e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(yc,{"aria-hidden":`true`}),$e=(0,Z.jsx)(J,{id:`tX5yOZ`}),t[125]=Qe,t[126]=$e):(Qe=t[125],$e=t[126]);let et;t[127]!==ee||t[128]!==Ze?(et=(0,Z.jsxs)(dk,{disabled:Ze,onSelect:ee,"data-testid":`empty-space-menu-new-folder`,children:[Qe,$e]}),t[127]=ee,t[128]=Ze,t[129]=et):et=t[129];let tt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(hk,{}),t[130]=tt):tt=t[130];let nt;t[131]!==r||t[132]!==ne||t[133]!==D?(nt=E?(0,Z.jsxs)(dk,{disabled:!D,onSelect:ne,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(D?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(ye,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),D?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[131]=r,t[132]=ne,t[133]=D,t[134]=nt):nt=t[134];let rt;t[135]!==k||t[136]!==j||t[137]!==O?(rt=(0,Z.jsx)(oU,{input:j,installStates:O,dispatch:k,webFallbackVisible:!1}),t[135]=k,t[136]=j,t[137]=O,t[138]=rt):rt=t[138];let it;t[139]!==r||t[140]!==ie||t[141]!==D?(it=E?(0,Z.jsxs)(dk,{disabled:!D,onSelect:ie,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(D?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(il,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`BJpGCq`})}),D?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[139]=r,t[140]=ie,t[141]=D,t[142]=it):it=t[142];let at=!D,ot;t[143]!==r||t[144]!==D?(ot=r(D?{id:`Up2_7p`}:{id:`U8CD-l`}),t[143]=r,t[144]=D,t[145]=ot):ot=t[145];let st;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(F,{"aria-hidden":`true`}),t[146]=st):st=t[146];let ct;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[147]=ct):ct=t[147];let lt;t[148]===D?lt=t[149]:(lt=D?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[148]=D,t[149]=lt);let ut;t[150]!==oe||t[151]!==at||t[152]!==ot||t[153]!==lt?(ut=(0,Z.jsxs)(dk,{disabled:at,onSelect:oe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ot,children:[st,ct,lt]}),t[150]=oe,t[151]=at,t[152]=ot,t[153]=lt,t[154]=ut):ut=t[154];let ft;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(hk,{}),t[155]=ft):ft=t[155];let pt=M===null,mt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(J,{id:`K_wz1u`}),t[156]=mt):mt=t[156];let ht;t[157]!==ce||t[158]!==P||t[159]!==pt?(ht=(0,Z.jsx)(mk,{checked:P,onCheckedChange:ce,disabled:pt,"data-testid":`empty-space-menu-show-hidden-files`,children:mt}),t[157]=ce,t[158]=P,t[159]=pt,t[160]=ht):ht=t[160];let gt=M===null,_t;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(J,{id:`i8dKs-`}),t[161]=_t):_t=t[161];let vt;t[162]!==de||t[163]!==I||t[164]!==gt?(vt=(0,Z.jsx)(mk,{checked:I,onCheckedChange:de,disabled:gt,"data-testid":`empty-space-menu-show-all-files`,children:_t}),t[162]=de,t[163]=I,t[164]=gt,t[165]=vt):vt=t[165];let yt;t[166]===z?yt=t[167]:(yt=z?(0,Z.jsx)(hk,{}):null,t[166]=z,t[167]=yt);let bt;t[168]!==fe||t[169]!==L?(bt=L?(0,Z.jsxs)(dk,{onSelect:fe,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(sl,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[168]=fe,t[169]=L,t[170]=bt):bt=t[170];let xt;t[171]!==me||t[172]!==R?(xt=R?(0,Z.jsxs)(dk,{onSelect:me,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[171]=me,t[172]=R,t[173]=xt):xt=t[173];let St;t[174]!==Ke||t[175]!==Xe||t[176]!==et||t[177]!==nt||t[178]!==rt||t[179]!==it||t[180]!==ut||t[181]!==ht||t[182]!==vt||t[183]!==yt||t[184]!==bt||t[185]!==xt?(St=(0,Z.jsxs)(uk,{children:[Ke,Xe,et,tt,nt,rt,it,ut,ft,ht,vt,yt,bt,xt]}),t[174]=Ke,t[175]=Xe,t[176]=et,t[177]=nt,t[178]=rt,t[179]=it,t[180]=ut,t[181]=ht,t[182]=vt,t[183]=yt,t[184]=bt,t[185]=xt,t[186]=St):St=t[186];let Ct;return t[187]!==He||t[188]!==St?(Ct=(0,Z.jsx)(qD,{variant:`inset`,children:(0,Z.jsxs)(sk,{children:[He,St]})}),t[187]=He,t[188]=St,t[189]=Ct):Ct=t[189],Ct}function wU(){return null}function TU(e){bU(e.target)&&(e.preventDefault(),e.stopPropagation())}function EU(){let e=(0,$.c)(17),t=bn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=dt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Ot,i=new ze({url:n,name:Xn,document:e,onStateless:e=>{let{payload:t}=e;G(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:MU,onConfigValidationRejected:jU,onConfigIgnoreNestedError:AU,onUnknown:kU})},onClose:OU,onDisconnect:DU}),a=Dr(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=ne(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Wr([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function DU(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function OU(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function kU(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function AU(e){so(e)}function jU(e){uo(e)}function MU(e){Wr([e.ch])}var NU=`#install-claude-desktop`;function PU(e){return e===`#settings`||e===NU}function FU(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function IU(){let e=(0,$.c)(20),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=dt(),{openTargetTransition:i}=St(),{assetPaths:a,folderPaths:o,loading:s,pages:c}=Nr(),l=(0,Q.useRef)(null),u;e[0]!==a||e[1]!==o||e[2]!==c?(u=FU(c,o,a),e[0]=a,e[1]=o,e[2]=c,e[3]=u):u=e[3];let d=u,f,p;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==n||e[9]!==r||e[10]!==d?(f=()=>{s||!r||l.current===d||(l.current=d,n({pages:c,folderPaths:o,assetPaths:a}))},p=[a,o,s,c,n,r,d],e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=n,e[9]=r,e[10]=d,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p);let m,h;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(m=()=>{e();function e(){if(PU(window.location.hash))return;let e=$r(window.location.hash);if(e){let t=ti(e.split(`.`).pop()??``);Nt(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=oi(window.location.hash);if(!n){Nt(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Nt(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Fr(n,{pages:c,folderPaths:o});if(r.kind===`missing`&&/\/+$/.test(n.trim())){Nt(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=ui(r);Nt(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},h=[t,o,s,i,c],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=m,e[19]=h):(m=e[18],h=e[19]),(0,Q.useEffect)(m,h),null}function LU(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===NU),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===NU&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===NU){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(Ia,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function RU(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(zU,t),null}function zU(){let e=function(e){let t=e.target;nh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=th))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function BU(){let e=(0,$.c)(4),{activeTarget:t}=dt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function VU(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=dt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:_i(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;bm({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Sm,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function HU(){let e=(0,$.c)(21),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=t?hl({bridge:t,authQueryTransport:yl(),cloneTransport:Tl(),openSignIn:()=>new Promise(e=>{c(()=>e),o(!0)})}):null,e[0]=l):l=e[0];let u=l,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(wg,{}),e[1]=d):d=e[1];let f,p,m,h,g,_,v,y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(EU,{}),p=(0,Z.jsx)(IU,{}),m=(0,Z.jsx)(BU,{}),h=(0,Z.jsx)(VU,{}),g=(0,Z.jsx)(RU,{}),_=(0,Z.jsx)(LU,{}),v=(0,Z.jsx)(Fd,{}),y=t&&u?(0,Z.jsx)(Yd,{bridge:t,cloneController:u}):null,e[2]=f,e[3]=p,e[4]=m,e[5]=h,e[6]=g,e[7]=_,e[8]=v,e[9]=y):(f=e[2],p=e[3],m=e[4],h=e[5],g=e[6],_=e[7],v=e[8],y=e[9]);let b;e[10]!==a||e[11]!==s?(b=t?(0,Z.jsx)(rd,{open:a,onOpenChange:e=>{e||(o(!1),s?.(null),c(null))},onSuccess:e=>{s?.({authenticated:!0,host:`github.com`,login:e.login}),c(null)}}):null,e[10]=a,e[11]=s,e[12]=b):b=e[12];let x;e[13]===r?x=e[14]:(x=(0,Z.jsx)(_g,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=x);let S;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=S):S=e[15];let C;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(xU,{onOpenSearch:()=>i(!0)}),e[16]=C):C=e[16];let w;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(WD,{className:`h-screen overflow-hidden`,children:[C,(0,Z.jsx)(XD,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(jA,{})})]}),e[17]=w):w=e[17];let T;return e[18]!==b||e[19]!==x?(T=(0,Z.jsx)(q,{name:`app`,children:(0,Z.jsx)(Dt,{children:(0,Z.jsxs)(he,{children:[d,(0,Z.jsxs)(si,{children:[f,p,m,h,g,_,v,y,b,x,S,w]})]})})}),e[18]=b,e[19]=x,e[20]=T):T=e[20],T}Ns(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&of({apiOrigin:window.okDesktop.config.apiOrigin}),Jf()&&ep(),Dp(),typeof window<`u`&&Mf({bridge:window.okDesktop}),typeof window<`u`&&as({bridge:window.okDesktop}),typeof window<`u`&&ts({bridge:window.okDesktop}),typeof window<`u`&&Ff({bridge:window.okDesktop}),typeof window<`u`&&Jd({bridge:window.okDesktop});var UU=new Hs({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),WU=document.getElementById(`root`);if(!WU)throw Error(`Root element not found`);var GU=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Qs.createRoot)(WU).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(qt,{i18n:Of,children:(0,Z.jsx)(pn,{client:UU,children:(0,Z.jsxs)(Qr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Xr,{children:GU&&window.okDesktop?(0,Z.jsx)(ef,{bridge:window.okDesktop}):(0,Z.jsx)(HU,{})}),(0,Z.jsx)(af,{richColors:!0,closeButton:!0})]})})})}));
|