const c={health:"/api/health",createFile:"/api/v2/files",createNote:"/api/v2/notes",cardDecks:"/api/v2/card-decks",createCard:"/api/v2/cards",knowledgeDocument:"/api/v2/knowledge-documents",knowledgeBases:"/api/v2/knowledge-bases",noteFolders:"/api/v2/note-folders",notes:"/api/v2/notes",fileFolders:"/api/v2/file-folders",files:"/api/v2/files",assistantModel:"/api/v2/assistant/model",assistantChatStream:"/api/v2/assistant/chat/stream"},{health:A,createFile:d,createNote:_,cardDecks:m,createCard:p,knowledgeDocument:P,knowledgeBases:E,noteFolders:T,notes:f,fileFolders:h,files:g,assistantModel:u,assistantChatStream:w}=c,I="WiseMindAI Web Clipper",n="127.0.0.1:38221";function S(){return new Promise(e=>{if(!chrome.storage||!chrome.storage.sync){e(n);return}chrome.storage.sync.get(["wisemindConfig","wisemindHostPort"],s=>{const t=s.wisemindConfig||{};e(t.apiEndpoint||s.wisemindHostPort||n)})})}function H(){return new Promise(e=>{if(!chrome.storage||!chrome.storage.sync){e({});return}chrome.storage.sync.get(["wisemindConfig"],s=>{e(s.wisemindConfig||{})})})}function C(e,s){if(!e)return null;let t=e.trim();if(!t)return null;!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`http://${t}`);try{const a=new URL(t),r=a.port||(t.startsWith("https://")?"443":"80");return`http://${`${a.hostname}:${r}`}${s}`}catch{return null}}function D(e,s){const t=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),a=(e||"page").replace(/[<>:"/\\|?*]/g,"_").replace(/\s+/g," ").trim().slice(0,50),r=s.replace(/^\./,"");return`${a||"page"}_${t}.${r}`}function N(e,s,t,a){return new Promise((r,o)=>{chrome.downloads.download({url:e,filename:s,saveAs:!0},()=>{if(chrome.runtime.lastError){const i=chrome.runtime.lastError.message||"下载失败";o(new Error(i));return}t&&l(t),r()})})}function l(e){try{chrome.notifications.create({type:"basic",iconUrl:"icons/icon48.png",title:"WiseMindAI",message:e})}catch(s){console.warn("通知失败:",s)}}export{_ as A,n as D,I as E,f as a,C as b,T as c,D as d,N as e,d as f,A as g,P as h,h as i,E as j,H as k,S as l,m,p as n,g as o,u as p,w as q};
