docstra 1.9.9-next.1 → 1.9.9-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mdx/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ye=Object.create;var j=Object.defineProperty,Ee=Object.defineProperties,be=Object.getOwnPropertyDescriptor,Pe=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,Dt=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var ct=(e,s,t)=>s in e?j(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,b=(e,s)=>{for(var t in s||(s={}))Rt.call(s,t)&&ct(e,t,s[t]);if(Dt)for(var t of Dt(s))De.call(s,t)&&ct(e,t,s[t]);return e},v=(e,s)=>Ee(e,Pe(s));var dt=(e,s)=>()=>(e&&(s=e(e=0)),s);var It=(e,s)=>{for(var t in s)j(e,t,{get:s[t],enumerable:!0})},Tt=(e,s,t,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of xe(s))!Rt.call(e,n)&&n!==t&&j(e,n,{get:()=>s[n],enumerable:!(i=be(s,n))||i.enumerable});return e};var D=(e,s,t)=>(t=e!=null?ye(ve(e)):{},Tt(s||!e||!e.__esModule?j(t,"default",{value:e,enumerable:!0}):t,e)),Re=e=>Tt(j({},"__esModule",{value:!0}),e);var f=(e,s,t)=>ct(e,typeof s!="symbol"?s+"":s,t);function Lt(e,s={}){let t=s.entryType||s.type;if(t==="both"&&(t=x.FILE_DIR_TYPE),t&&(s.type=t),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!Wt.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${Wt.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return s.root=e,new pt(s)}var T,S,At,x,ut,Ot,Te,Wt,Se,Fe,Ne,We,kt,Ct,pt,jt=dt(()=>{"use strict";T=require("fs/promises"),S=require("path"),At=require("stream"),x={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},ut={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:x.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(ut);Ot="READDIRP_RECURSIVE_ERROR",Te=new Set(["ENOENT","EPERM","EACCES","ELOOP",Ot]),Wt=[x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE],Se=new Set([x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE]),Fe=new Set([x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE]),Ne=e=>Te.has(e.code),We=process.platform==="win32",kt=e=>!0,Ct=e=>{if(e===void 0)return kt;if(typeof e=="function")return e;if(typeof e=="string"){let s=e.trim();return t=>t.basename===s}if(Array.isArray(e)){let s=e.map(t=>t.trim());return t=>s.some(i=>t.basename===i)}return kt},pt=class extends At.Readable{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});f(this,"parents");f(this,"reading");f(this,"parent");f(this,"_stat");f(this,"_maxDepth");f(this,"_wantsDir");f(this,"_wantsFile");f(this,"_wantsEverything");f(this,"_root");f(this,"_isDirent");f(this,"_statsProp");f(this,"_rdOptions");f(this,"_fileFilter");f(this,"_directoryFilter");let i=b(b({},ut),t),{root:n,type:r}=i;this._fileFilter=Ct(i.fileFilter),this._directoryFilter=Ct(i.directoryFilter);let o=i.lstat?T.lstat:T.stat;We?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=i.depth!=null&&Number.isSafeInteger(i.depth)?i.depth:ut.depth,this._wantsDir=r?Se.has(r):!1,this._wantsFile=r?Fe.has(r):!1,this._wantsEverything=r===x.EVERYTHING_TYPE,this._root=(0,S.resolve)(n),this._isDirent=!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let i=this.parent,n=i&&i.files;if(n&&n.length>0){let{path:r,depth:o}=i,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),l=await Promise.all(a);for(let c of l){if(!c)continue;if(this.destroyed)return;let h=await this._getEntryType(c);h==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),t--)):(h==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i)}finally{this.reading=!1}}}async _exploreDir(t,i){let n;try{n=await(0,T.readdir)(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:i,path:t}}async _formatEntry(t,i){let n,r=this._isDirent?t.name:t;try{let o=(0,S.resolve)((0,S.join)(i,r));n={path:(0,S.relative)(this._root,o),fullPath:o,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(t){Ne(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let i=t[this._statsProp];if(i.isFile())return"file";if(i.isDirectory())return"directory";if(i&&i.isSymbolicLink()){let n=t.fullPath;try{let r=await(0,T.realpath)(n),o=await(0,T.lstat)(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===S.sep){let l=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return l.code=Ot,this._onError(l)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let i=t&&t[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}}});function Mt(e,s,t,i,n){let r=(o,a)=>{t(e),n(o,a,{watchedPath:e}),a&&e!==a&&V(w.resolve(e,a),F,w.join(e,a))};try{return(0,N.watch)(e,{persistent:s.persistent},r)}catch(o){i(o);return}}var N,I,Ht,w,ke,wt,zt,X,J,gt,Ce,Ae,Oe,$t,g,R,Le,je,F,G,O,Me,He,ze,_t,z,$e,$,Yt,q,V,Ye,mt,Ue,K,Ut=dt(()=>{"use strict";N=require("fs"),I=require("fs/promises"),Ht=require("os"),w=D(require("path"),1),ke="data",wt="end",zt="close",X=()=>{},J=process.platform,gt=J==="win32",Ce=J==="darwin",Ae=J==="linux",Oe=J==="freebsd",$t=(0,Ht.type)()==="OS400",g={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},R=g,Le="watch",je={lstat:I.lstat,stat:I.stat},F="listeners",G="errHandlers",O="rawEmitters",Me=[F,G,O],He=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ze=e=>He.has(w.extname(e).slice(1).toLowerCase()),_t=(e,s)=>{e instanceof Set?e.forEach(s):s(e)},z=(e,s,t)=>{let i=e[s];i instanceof Set||(e[s]=i=new Set([i])),i.add(t)},$e=e=>s=>{let t=e[s];t instanceof Set?t.clear():delete e[s]},$=(e,s,t)=>{let i=e[s];i instanceof Set?i.delete(t):i===t&&delete e[s]},Yt=e=>e instanceof Set?e.size===0:!e,q=new Map;V=(e,s,t,i,n)=>{let r=q.get(e);r&&_t(r[s],o=>{o(t,i,n)})},Ye=(e,s,t,i)=>{let{listener:n,errHandler:r,rawEmitter:o}=i,a=q.get(s),l;if(!t.persistent)return l=Mt(e,t,n,r,o),l?l.close.bind(l):void 0;if(a)z(a,F,n),z(a,G,r),z(a,O,o);else{if(l=Mt(e,t,V.bind(null,s,F),r,V.bind(null,s,O)),!l)return;l.on(R.ERROR,async c=>{let h=V.bind(null,s,G);if(a&&(a.watcherUnusable=!0),gt&&c.code==="EPERM")try{await(await(0,I.open)(e,"r")).close(),h(c)}catch(d){}else h(c)}),a={listeners:n,errHandlers:r,rawEmitters:o,watcher:l},q.set(s,a)}return()=>{$(a,F,n),$(a,G,r),$(a,O,o),Yt(a.listeners)&&(a.watcher.close(),q.delete(s),Me.forEach($e(a)),a.watcher=void 0,Object.freeze(a))}},mt=new Map,Ue=(e,s,t,i)=>{let{listener:n,rawEmitter:r}=i,o=mt.get(s),a=o&&o.options;return a&&(a.persistent<t.persistent||a.interval>t.interval)&&((0,N.unwatchFile)(s),o=void 0),o?(z(o,F,n),z(o,O,r)):(o={listeners:n,rawEmitters:r,options:t,watcher:(0,N.watchFile)(s,t,(l,c)=>{_t(o.rawEmitters,d=>{d(R.CHANGE,s,{curr:l,prev:c})});let h=l.mtimeMs;(l.size!==c.size||h>c.mtimeMs||h===0)&&_t(o.listeners,d=>d(e,l))})},mt.set(s,o)),()=>{$(o,F,n),$(o,O,r),Yt(o.listeners)&&(mt.delete(s),(0,N.unwatchFile)(s),o.options=o.watcher=void 0,Object.freeze(o))}},K=class{constructor(s){f(this,"fsw");f(this,"_boundHandleError");this.fsw=s,this._boundHandleError=t=>s._handleError(t)}_watchWithNodeFs(s,t){let i=this.fsw.options,n=w.dirname(s),r=w.basename(s);this.fsw._getWatchedDir(n).add(r);let a=w.resolve(s),l={persistent:i.persistent};t||(t=X);let c;if(i.usePolling){let h=i.interval!==i.binaryInterval;l.interval=h&&ze(r)?i.binaryInterval:i.interval,c=Ue(s,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else c=Ye(s,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(s,t,i){if(this.fsw.closed)return;let n=w.dirname(s),r=w.basename(s),o=this.fsw._getWatchedDir(n),a=t;if(o.has(r))return;let l=async(h,d)=>{if(this.fsw._throttle(Le,s,5)){if(!d||d.mtimeMs===0)try{let u=await(0,I.stat)(s);if(this.fsw.closed)return;let m=u.atimeMs,_=u.mtimeMs;if((!m||m<=_||_!==a.mtimeMs)&&this.fsw._emit(R.CHANGE,s,u),(Ce||Ae||Oe)&&a.ino!==u.ino){this.fsw._closeFile(h),a=u;let E=this._watchWithNodeFs(s,l);E&&this.fsw._addPathCloser(h,E)}else a=u}catch(u){this.fsw._remove(n,r)}else if(o.has(r)){let u=d.atimeMs,m=d.mtimeMs;(!u||u<=m||m!==a.mtimeMs)&&this.fsw._emit(R.CHANGE,s,d),a=d}}},c=this._watchWithNodeFs(s,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(s)){if(!this.fsw._throttle(R.ADD,s,0))return;this.fsw._emit(R.ADD,s,t)}return c}async _handleSymlink(s,t,i,n){if(this.fsw.closed)return;let r=s.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await(0,I.realpath)(i)}catch(l){return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(n)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(R.CHANGE,i,s.stats)):(o.add(n),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(R.ADD,i,s.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(s,t,i,n,r,o,a){s=w.join(s,"");let l=n?`${s}:${n}`:s;if(a=this.fsw._throttle("readdir",l,1e3),!a)return;let c=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(s,{fileFilter:u=>i.filterPath(u),directoryFilter:u=>i.filterDir(u)});if(d)return d.on(ke,async u=>{if(this.fsw.closed){d=void 0;return}let m=u.path,_=w.join(s,m);if(h.add(m),!(u.stats.isSymbolicLink()&&await this._handleSymlink(u,s,_,m))){if(this.fsw.closed){d=void 0;return}(m===n||!n&&!c.has(m))&&(this.fsw._incrReadyCount(),_=w.join(r,w.relative(r,_)),this._addToNodeFs(_,t,i,o+1))}}).on(R.ERROR,this._boundHandleError),new Promise((u,m)=>{if(!d)return m();d.once(wt,()=>{if(this.fsw.closed){d=void 0;return}let _=a?a.clear():!1;u(void 0),c.getChildren().filter(E=>E!==s&&!h.has(E)).forEach(E=>{this.fsw._remove(s,E)}),d=void 0,_&&this._handleRead(s,!1,i,n,r,o,a)})})}async _handleDir(s,t,i,n,r,o,a){let l=this.fsw._getWatchedDir(w.dirname(s)),c=l.has(w.basename(s));!(i&&this.fsw.options.ignoreInitial)&&!r&&!c&&this.fsw._emit(R.ADD_DIR,s,t),l.add(w.basename(s)),this.fsw._getWatchedDir(s);let h,d,u=this.fsw.options.depth;if((u==null||n<=u)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(s,i,o,r,s,n,h),this.fsw.closed))return;d=this._watchWithNodeFs(s,(m,_)=>{_&&_.mtimeMs===0||this._handleRead(m,!1,o,r,s,n,h)})}return d}async _addToNodeFs(s,t,i,n,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(s)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(s);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await je[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let c=this.fsw.options.followSymlinks,h;if(l.isDirectory()){let d=w.resolve(s),u=c?await(0,I.realpath)(s):s;if(this.fsw.closed||(h=await this._handleDir(a.watchPath,l,t,n,r,a,u),this.fsw.closed))return;d!==u&&u!==void 0&&this.fsw._symlinkPaths.set(d,u)}else if(l.isSymbolicLink()){let d=c?await(0,I.realpath)(s):s;if(this.fsw.closed)return;let u=w.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(R.ADD,a.watchPath,l),h=await this._handleDir(u,l,t,n,s,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(s),d)}else h=this._handleFile(a.watchPath,l,t);return o(),h&&this.fsw._addPathCloser(s,h),!1}catch(l){if(this.fsw._handleError(l))return o(),s}}}});var ee={};It(ee,{FSWatcher:()=>Y,WatchHelper:()=>Z,default:()=>rs,watch:()=>te});function Q(e){return Array.isArray(e)?e:[e]}function Je(e){return typeof e=="function"?e:typeof e=="string"?s=>e===s:e instanceof RegExp?s=>e.test(s):typeof e=="object"&&e!==null?s=>{if(e.path===s)return!0;if(e.recursive){let t=p.relative(e.path,s);return t?!t.startsWith("..")&&!p.isAbsolute(t):!1}return!1}:()=>!1}function Qe(e){if(typeof e!="string")throw new Error("string expected");e=p.normalize(e),e=e.replace(/\\/g,"/");let s=!1;return e.startsWith("//")&&(s=!0),e=e.replace(Qt,"/"),s&&(e="/"+e),e}function Bt(e,s,t){let i=Qe(s);for(let n=0;n<e.length;n++){let r=e[n];if(r(i,t))return!0}return!1}function Ze(e,s){if(e==null)throw new TypeError("anymatch: specify first argument");let i=Q(e).map(n=>Je(n));return s==null?(n,r)=>Bt(i,n,r):Bt(i,s)}function te(e,s={}){let t=new Y(s);return t.add(e),t}var Kt,Xt,tt,p,yt,Be,Jt,Ge,qe,Ve,Qt,Ke,Xe,Et,Gt,qt,Zt,Vt,ts,es,bt,ss,is,Z,Y,rs,se=dt(()=>{"use strict";Kt=require("events"),Xt=require("fs"),tt=require("fs/promises"),p=D(require("path"),1);jt();Ut();yt="/",Be="//",Jt=".",Ge="..",qe="string",Ve=/\\/g,Qt=/\/\//g,Ke=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Xe=/^\.[/\\]/;Et=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);Gt=e=>{let s=Q(e).flat();if(!s.every(t=>typeof t===qe))throw new TypeError(`Non-string provided as watch path: ${s}`);return s.map(Zt)},qt=e=>{let s=e.replace(Ve,yt),t=!1;return s.startsWith(Be)&&(t=!0),s=s.replace(Qt,yt),t&&(s=yt+s),s},Zt=e=>qt(p.normalize(qt(e))),Vt=(e="")=>s=>typeof s=="string"?Zt(p.isAbsolute(s)?s:p.join(e,s)):s,ts=(e,s)=>p.isAbsolute(e)?e:p.join(s,e),es=Object.freeze(new Set),bt=class{constructor(s,t){f(this,"path");f(this,"_removeWatcher");f(this,"items");this.path=s,this._removeWatcher=t,this.items=new Set}add(s){let{items:t}=this;t&&s!==Jt&&s!==Ge&&t.add(s)}async remove(s){let{items:t}=this;if(!t||(t.delete(s),t.size>0))return;let i=this.path;try{await(0,tt.readdir)(i)}catch(n){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(s){let{items:t}=this;if(t)return t.has(s)}getChildren(){let{items:s}=this;return s?[...s.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=X,this.items=es,Object.freeze(this)}},ss="stat",is="lstat",Z=class{constructor(s,t,i){f(this,"fsw");f(this,"path");f(this,"watchPath");f(this,"fullWatchPath");f(this,"dirParts");f(this,"followSymlinks");f(this,"statMethod");this.fsw=i;let n=s;this.path=s=s.replace(Xe,""),this.watchPath=n,this.fullWatchPath=p.resolve(n),this.dirParts=[],this.dirParts.forEach(r=>{r.length>1&&r.pop()}),this.followSymlinks=t,this.statMethod=t?ss:is}entryPath(s){return p.join(this.watchPath,p.relative(this.watchPath,s.fullPath))}filterPath(s){let{stats:t}=s;if(t&&t.isSymbolicLink())return this.filterDir(s);let i=this.entryPath(s);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(s){return this.fsw._isntIgnored(this.entryPath(s),s.stats)}},Y=class extends Kt.EventEmitter{constructor(t={}){super();f(this,"closed");f(this,"options");f(this,"_closers");f(this,"_ignoredPaths");f(this,"_throttled");f(this,"_streams");f(this,"_symlinkPaths");f(this,"_watched");f(this,"_pendingWrites");f(this,"_pendingUnlinks");f(this,"_readyCount");f(this,"_emitReady");f(this,"_closePromise");f(this,"_userIgnored");f(this,"_readyEmitted");f(this,"_emitRaw");f(this,"_boundRemove");f(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let i=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r=v(b({persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0},t),{ignored:t.ignored?Q(t.ignored):Q([]),awaitWriteFinish:i===!0?n:typeof i=="object"?b(b({},n),i):!1});$t&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let c=o.toLowerCase();c==="false"||c==="0"?r.usePolling=!1:c==="true"||c==="1"?r.usePolling=!0:r.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let l=0;this._emitReady=()=>{l++,l>=this._readyCount&&(this._emitReady=X,this._readyEmitted=!0,process.nextTick(()=>this.emit(g.READY)))},this._emitRaw=(...c)=>this.emit(g.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new K(this),Object.freeze(r)}_addIgnoredPath(t){if(Et(t)){for(let i of this._ignoredPaths)if(Et(i)&&i.path===t.path&&i.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let i of this._ignoredPaths)Et(i)&&i.path===t&&this._ignoredPaths.delete(i)}add(t,i,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Gt(t);return r&&(o=o.map(a=>ts(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,i);return l&&this._emitReady(),l})).then(a=>{this.closed||a.forEach(l=>{l&&this.add(p.dirname(l),p.basename(i||l))})}),this}unwatch(t){if(this.closed)return this;let i=Gt(t),{cwd:n}=this.options;return i.forEach(r=>{!p.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=p.join(n,r)),r=p.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(i=>i.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((i,n)=>{let o=(this.options.cwd?p.relative(this.options.cwd,n):n)||Jt;t[o]=i.getChildren().sort()}),t}emitWithAll(t,i){this.emit(t,...i),t!==g.ERROR&&this.emit(g.ALL,t,...i)}async _emit(t,i,n){if(this.closed)return;let r=this.options;gt&&(i=p.normalize(i)),r.cwd&&(i=p.relative(r.cwd,i));let o=[i];n!=null&&o.push(n);let a=r.awaitWriteFinish,l;if(a&&(l=this._pendingWrites.get(i)))return l.lastChange=new Date,this;if(r.atomic){if(t===g.UNLINK)return this._pendingUnlinks.set(i,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((c,h)=>{this.emit(...c),this.emit(g.ALL,...c),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===g.ADD&&this._pendingUnlinks.has(i)&&(t=g.CHANGE,this._pendingUnlinks.delete(i))}if(a&&(t===g.ADD||t===g.CHANGE)&&this._readyEmitted){let c=(h,d)=>{h?(t=g.ERROR,o[0]=h,this.emitWithAll(t,o)):d&&(o.length>1?o[1]=d:o.push(d),this.emitWithAll(t,o))};return this._awaitWriteFinish(i,a.stabilityThreshold,t,c),this}if(t===g.CHANGE&&!this._throttle(g.CHANGE,i,50))return this;if(r.alwaysStat&&n===void 0&&(t===g.ADD||t===g.ADD_DIR||t===g.CHANGE)){let c=r.cwd?p.join(r.cwd,i):i,h;try{h=await(0,tt.stat)(c)}catch(d){}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let i=t&&t.code;return t&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(g.ERROR,t),t||this.closed}_throttle(t,i,n){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(i);if(o)return o.count++,!1;let a,l=()=>{let h=r.get(i),d=h?h.count:0;return r.delete(i),clearTimeout(a),h&&clearTimeout(h.timeoutObject),d};a=setTimeout(l,n);let c={timeoutObject:a,clear:l,count:0};return r.set(i,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,i,n,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,l,c=t;this.options.cwd&&!p.isAbsolute(t)&&(c=p.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;function u(m){(0,Xt.stat)(c,(_,E)=>{if(_||!d.has(t)){_&&_.code!=="ENOENT"&&r(_);return}let P=Number(new Date);m&&E.size!==m.size&&(d.get(t).lastChange=P);let at=d.get(t);P-at.lastChange>=i?(d.delete(t),r(void 0,E)):l=setTimeout(u,a,E)})}d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(l),n)}),l=setTimeout(u,a))}_isIgnored(t,i){if(this.options.atomic&&Ke.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,o=(this.options.ignored||[]).map(Vt(n)),l=[...[...this._ignoredPaths].map(Vt(n)),...o];this._userIgnored=Ze(l,void 0)}return this._userIgnored(t,i)}_isntIgnored(t,i){return!this._isIgnored(t,i)}_getWatchHelpers(t){return new Z(t,this.options.followSymlinks,this)}_getWatchedDir(t){let i=p.resolve(t);return this._watched.has(i)||this._watched.set(i,new bt(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,i,n){let r=p.join(t,i),o=p.resolve(r);if(n=n!=null?n:this._watched.has(r)||this._watched.has(o),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,i,!0),this._getWatchedDir(r).getChildren().forEach(m=>this._remove(r,m));let c=this._getWatchedDir(t),h=c.has(i);c.remove(i),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let d=r;if(this.options.cwd&&(d=p.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===g.ADD)return;this._watched.delete(r),this._watched.delete(o);let u=n?g.UNLINK_DIR:g.UNLINK;h&&!this._isIgnored(r)&&this._emit(u,r),this._closePath(r)}_closePath(t){this._closeFile(t);let i=p.dirname(t);this._getWatchedDir(i).remove(p.basename(t))}_closeFile(t){let i=this._closers.get(t);i&&(i.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,i){if(!i)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(i)}_readdirp(t,i){if(this.closed)return;let n=v(b({type:g.ALL,alwaysStat:!0,lstat:!0},i),{depth:0}),r=Lt(t,n);return this._streams.add(r),r.once(zt,()=>{r=void 0}),r.once(wt,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};rs={watch:te,FSWatcher:Y}});var ws={};It(ws,{createSource:()=>ps,defaultMdxComponents:()=>Ie,defineDocstraConfig:()=>_s,generateSidebar:()=>ue,getPageData:()=>ms,loadDocstraConfig:()=>ge,runDocstraBuild:()=>nt,runDocstraDev:()=>_e,withDocstra:()=>us});module.exports=Re(ws);var C=require("lucide-react"),M=require("react/jsx-runtime");function ht({type:e="info",children:s}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},n={info:C.InfoIcon,warning:C.AlertTriangleIcon,error:C.AlertCircleIcon}[e];return(0,M.jsxs)("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[(0,M.jsx)(n,{className:"w-5 h-5 shrink-0"}),(0,M.jsx)("div",{children:s})]})}var Nt=D(require("next/link"));var Ft=require("lucide-react");function ft(e){return e!=null&&e.length?e.join("/"):""}function St(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}var H=require("react/jsx-runtime");function A({children:e,level:s}){let t=`h${s}`,n=St(typeof e=="string"?e:"");return(0,H.jsxs)(t,{id:n,className:"group",children:[(0,H.jsx)("a",{className:"not-prose",href:`#${n}`,children:e}),(0,H.jsx)(Ft.LinkIcon,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}var y=require("react/jsx-runtime"),Ie={h1:e=>(0,y.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>(0,y.jsx)(A,v(b({},e),{level:2})),h3:e=>(0,y.jsx)(A,v(b({},e),{level:3})),h4:e=>(0,y.jsx)(A,v(b({},e),{level:4})),h5:e=>(0,y.jsx)(A,v(b({},e),{level:5})),p:e=>(0,y.jsx)("p",{children:e.children}),hr:e=>(0,y.jsx)("hr",v(b({},e),{className:"border-gray-200"})),a:e=>e.href.startsWith("http")?(0,y.jsx)("a",v(b({href:e.href,className:"underline underline-offset-4"},e),{target:"_blank",rel:"noopener noreferrer",children:e.children})):(0,y.jsx)(Nt.default,v(b({href:e.href,className:"underline underline-offset-4"},e),{children:e.children})),ul:e=>(0,y.jsx)("ul",{children:e.children}),li:e=>(0,y.jsx)("li",{children:e.children}),ol:e=>(0,y.jsx)("ol",{children:e.children}),blockquote:e=>(0,y.jsx)("blockquote",{className:"not-italic",children:e.children}),pre:e=>(0,y.jsx)("pre",{className:"not-prose",children:e.children}),Callout:ht,table:e=>(0,y.jsx)("table",{children:e.children}),thead:e=>(0,y.jsx)("thead",{children:e.children}),tbody:e=>(0,y.jsx)("tbody",{children:e.children}),tr:e=>(0,y.jsx)("tr",{children:e.children}),th:e=>(0,y.jsx)("th",{children:e.children}),td:e=>(0,y.jsx)("td",{children:e.children})};var k=D(require("fs"),1),L=D(require("path"),1),ot=D(require("fs"),1),W=D(require("path"),1),he=D(require("fs"),1),fe=D(require("gray-matter"),1),it=D(require("path"),1),we=D(require("fs"),1);var ns=Object.defineProperty,os=Object.defineProperties,as=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,ie=(e,s,t)=>s in e?ns(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,et=(e,s)=>{for(var t in s||(s={}))ce.call(s,t)&&ie(e,t,s[t]);if(rt)for(var t of rt(s))de.call(s,t)&&ie(e,t,s[t]);return e},st=(e,s)=>os(e,as(s)),U=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof require!="undefined"?require:s)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ls=(e,s)=>{var t={};for(var i in e)ce.call(e,i)&&s.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&rt)for(var i of rt(e))s.indexOf(i)<0&&de.call(e,i)&&(t[i]=e[i]);return t};function re(e){try{let s=he.default.readFileSync(e,"utf-8"),{data:t}=(0,fe.default)(s);return{title:t.title,icon:t.icon,description:t.description,defaultOpen:t.defaultOpen,collapsible:t.collapsible}}catch(s){return{}}}function ue(e,s="/docs"){return ot.default.existsSync(e)?pe(e,e,s):[]}function pe(e,s,t){var i;let n=ot.default.readdirSync(e,{withFileTypes:!0}).sort((o,a)=>{let l=ne(o.name),c=ne(a.name);return l!==null&&c!==null?l-c:l!==null?-1:c!==null?1:o.name.localeCompare(a.name)}),r=[];for(let o of n){if(o.name.startsWith("_")||o.name.startsWith("."))continue;let a=W.default.join(e,o.name);if(o.isDirectory()){let l=B(o.name),c=cs(a),h=pe(a,s,t);if(c){let P=Pt(W.default.relative(s,c).replace(/\\/g,"/")),at=xt(P,t);h=h.filter(lt=>!(lt.type==="page"&&lt.href===at))}if(h.length===0&&!c)continue;let d=oe(l),u,m=!0,_=!0;if(c){let P=re(c);P.title&&(d=P.title),P.icon&&(u=P.icon),P.defaultOpen!==void 0&&(m=P.defaultOpen),P.collapsible!==void 0&&(_=P.collapsible)}let E={type:"section",title:d,children:h,href:c?xt(Pt(W.default.relative(s,c).replace(/\\/g,"/")),t):"",icon:u,defaultOpen:m,collapsible:_};r.push(E)}else if(o.name.endsWith(".md")||o.name.endsWith(".mdx")){let l=W.default.relative(s,a).replace(/\\/g,"/"),c=Pt(l),h=re(a),d=o.name.replace(/\.(md|mdx)$/,""),u=B(d),m=xt(c,t),_=u.toLowerCase()==="index",E={type:"page",title:(i=h.title)!=null?i:oe(_?B(W.default.basename(e)):u),href:m,icon:h.icon};r.push(E)}}return r}function ne(e){let s=e.match(/^(\d+)-/);return s?parseInt(s[1],10):null}function B(e){return e.replace(/^\d+-/,"")}function cs(e){let s=ot.default.readdirSync(e);for(let t of s){let i=B(t);if(i==="index.md"||i==="index.mdx")return W.default.join(e,t)}return null}function oe(e){return e.toLowerCase()==="index"?"Home":e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Pt(e){return e.replace(/\\/g,"/").split("/").map(s=>B(s)).join("/").replace(/\/index\.(md|mdx)$/,"").replace(/\.(md|mdx)$/,"").replace(/^index$/,"")}function xt(e,s){return!e||e==="index"||e===""?s:`${s}/${e.startsWith("/")?e.slice(1):e}`}function nt(e,s="/docs"){let t=process.cwd(),i=L.default.join(t,".docstra"),n=L.default.join(i,"index.ts");k.default.existsSync(e)||(console.error(`Content directory not found: ${e}`),console.error(`Please create "${e}" or update "contentDir" in docstra.config.ts`),process.exit(1)),k.default.existsSync(i)||k.default.mkdirSync(i,{recursive:!0});let r=me(e);r.length===0&&console.warn(`No .md or .mdx files found in ${e}`);let o=[],a=[];r.forEach((h,d)=>{let u=L.default.relative(i,h).replace(/\\/g,"/"),m=`d${d}`;o.push(`import * as ${m} from "${u}?docstra";`);let _=L.default.relative(e,h).replace(/\\/g,"/"),E=hs(_);a.push(`{
1
+ "use strict";var ye=Object.create;var j=Object.defineProperty,Ee=Object.defineProperties,be=Object.getOwnPropertyDescriptor,Pe=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,vt=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var ct=(e,s,t)=>s in e?j(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,b=(e,s)=>{for(var t in s||(s={}))Dt.call(s,t)&&ct(e,t,s[t]);if(vt)for(var t of vt(s))De.call(s,t)&&ct(e,t,s[t]);return e},v=(e,s)=>Ee(e,Pe(s));var dt=(e,s)=>()=>(e&&(s=e(e=0)),s);var Rt=(e,s)=>{for(var t in s)j(e,t,{get:s[t],enumerable:!0})},It=(e,s,t,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of xe(s))!Dt.call(e,n)&&n!==t&&j(e,n,{get:()=>s[n],enumerable:!(i=be(s,n))||i.enumerable});return e};var D=(e,s,t)=>(t=e!=null?ye(ve(e)):{},It(s||!e||!e.__esModule?j(t,"default",{value:e,enumerable:!0}):t,e)),Re=e=>It(j({},"__esModule",{value:!0}),e);var f=(e,s,t)=>ct(e,typeof s!="symbol"?s+"":s,t);function Ot(e,s={}){let t=s.entryType||s.type;if(t==="both"&&(t=x.FILE_DIR_TYPE),t&&(s.type=t),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!Nt.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${Nt.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return s.root=e,new ut(s)}var T,S,Ct,x,ft,At,Te,Nt,Se,Fe,Ne,We,Wt,kt,ut,Lt=dt(()=>{"use strict";T=require("fs/promises"),S=require("path"),Ct=require("stream"),x={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},ft={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:x.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(ft);At="READDIRP_RECURSIVE_ERROR",Te=new Set(["ENOENT","EPERM","EACCES","ELOOP",At]),Nt=[x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE],Se=new Set([x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE]),Fe=new Set([x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE]),Ne=e=>Te.has(e.code),We=process.platform==="win32",Wt=e=>!0,kt=e=>{if(e===void 0)return Wt;if(typeof e=="function")return e;if(typeof e=="string"){let s=e.trim();return t=>t.basename===s}if(Array.isArray(e)){let s=e.map(t=>t.trim());return t=>s.some(i=>t.basename===i)}return Wt},ut=class extends Ct.Readable{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});f(this,"parents");f(this,"reading");f(this,"parent");f(this,"_stat");f(this,"_maxDepth");f(this,"_wantsDir");f(this,"_wantsFile");f(this,"_wantsEverything");f(this,"_root");f(this,"_isDirent");f(this,"_statsProp");f(this,"_rdOptions");f(this,"_fileFilter");f(this,"_directoryFilter");let i=b(b({},ft),t),{root:n,type:r}=i;this._fileFilter=kt(i.fileFilter),this._directoryFilter=kt(i.directoryFilter);let o=i.lstat?T.lstat:T.stat;We?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=i.depth!=null&&Number.isSafeInteger(i.depth)?i.depth:ft.depth,this._wantsDir=r?Se.has(r):!1,this._wantsFile=r?Fe.has(r):!1,this._wantsEverything=r===x.EVERYTHING_TYPE,this._root=(0,S.resolve)(n),this._isDirent=!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let i=this.parent,n=i&&i.files;if(n&&n.length>0){let{path:r,depth:o}=i,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),l=await Promise.all(a);for(let c of l){if(!c)continue;if(this.destroyed)return;let h=await this._getEntryType(c);h==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),t--)):(h==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i)}finally{this.reading=!1}}}async _exploreDir(t,i){let n;try{n=await(0,T.readdir)(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:i,path:t}}async _formatEntry(t,i){let n,r=this._isDirent?t.name:t;try{let o=(0,S.resolve)((0,S.join)(i,r));n={path:(0,S.relative)(this._root,o),fullPath:o,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(t){Ne(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let i=t[this._statsProp];if(i.isFile())return"file";if(i.isDirectory())return"directory";if(i&&i.isSymbolicLink()){let n=t.fullPath;try{let r=await(0,T.realpath)(n),o=await(0,T.lstat)(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===S.sep){let l=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return l.code=At,this._onError(l)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let i=t&&t[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}}});function jt(e,s,t,i,n){let r=(o,a)=>{t(e),n(o,a,{watchedPath:e}),a&&e!==a&&V(w.resolve(e,a),F,w.join(e,a))};try{return(0,N.watch)(e,{persistent:s.persistent},r)}catch(o){i(o);return}}var N,I,Mt,w,ke,_t,Ht,X,J,wt,Ce,Ae,Oe,zt,g,R,Le,je,F,B,O,Me,He,ze,mt,z,$e,$,$t,q,V,Ye,pt,Ue,K,Yt=dt(()=>{"use strict";N=require("fs"),I=require("fs/promises"),Mt=require("os"),w=D(require("path"),1),ke="data",_t="end",Ht="close",X=()=>{},J=process.platform,wt=J==="win32",Ce=J==="darwin",Ae=J==="linux",Oe=J==="freebsd",zt=(0,Mt.type)()==="OS400",g={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},R=g,Le="watch",je={lstat:I.lstat,stat:I.stat},F="listeners",B="errHandlers",O="rawEmitters",Me=[F,B,O],He=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ze=e=>He.has(w.extname(e).slice(1).toLowerCase()),mt=(e,s)=>{e instanceof Set?e.forEach(s):s(e)},z=(e,s,t)=>{let i=e[s];i instanceof Set||(e[s]=i=new Set([i])),i.add(t)},$e=e=>s=>{let t=e[s];t instanceof Set?t.clear():delete e[s]},$=(e,s,t)=>{let i=e[s];i instanceof Set?i.delete(t):i===t&&delete e[s]},$t=e=>e instanceof Set?e.size===0:!e,q=new Map;V=(e,s,t,i,n)=>{let r=q.get(e);r&&mt(r[s],o=>{o(t,i,n)})},Ye=(e,s,t,i)=>{let{listener:n,errHandler:r,rawEmitter:o}=i,a=q.get(s),l;if(!t.persistent)return l=jt(e,t,n,r,o),l?l.close.bind(l):void 0;if(a)z(a,F,n),z(a,B,r),z(a,O,o);else{if(l=jt(e,t,V.bind(null,s,F),r,V.bind(null,s,O)),!l)return;l.on(R.ERROR,async c=>{let h=V.bind(null,s,B);if(a&&(a.watcherUnusable=!0),wt&&c.code==="EPERM")try{await(await(0,I.open)(e,"r")).close(),h(c)}catch(d){}else h(c)}),a={listeners:n,errHandlers:r,rawEmitters:o,watcher:l},q.set(s,a)}return()=>{$(a,F,n),$(a,B,r),$(a,O,o),$t(a.listeners)&&(a.watcher.close(),q.delete(s),Me.forEach($e(a)),a.watcher=void 0,Object.freeze(a))}},pt=new Map,Ue=(e,s,t,i)=>{let{listener:n,rawEmitter:r}=i,o=pt.get(s),a=o&&o.options;return a&&(a.persistent<t.persistent||a.interval>t.interval)&&((0,N.unwatchFile)(s),o=void 0),o?(z(o,F,n),z(o,O,r)):(o={listeners:n,rawEmitters:r,options:t,watcher:(0,N.watchFile)(s,t,(l,c)=>{mt(o.rawEmitters,d=>{d(R.CHANGE,s,{curr:l,prev:c})});let h=l.mtimeMs;(l.size!==c.size||h>c.mtimeMs||h===0)&&mt(o.listeners,d=>d(e,l))})},pt.set(s,o)),()=>{$(o,F,n),$(o,O,r),$t(o.listeners)&&(pt.delete(s),(0,N.unwatchFile)(s),o.options=o.watcher=void 0,Object.freeze(o))}},K=class{constructor(s){f(this,"fsw");f(this,"_boundHandleError");this.fsw=s,this._boundHandleError=t=>s._handleError(t)}_watchWithNodeFs(s,t){let i=this.fsw.options,n=w.dirname(s),r=w.basename(s);this.fsw._getWatchedDir(n).add(r);let a=w.resolve(s),l={persistent:i.persistent};t||(t=X);let c;if(i.usePolling){let h=i.interval!==i.binaryInterval;l.interval=h&&ze(r)?i.binaryInterval:i.interval,c=Ue(s,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else c=Ye(s,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(s,t,i){if(this.fsw.closed)return;let n=w.dirname(s),r=w.basename(s),o=this.fsw._getWatchedDir(n),a=t;if(o.has(r))return;let l=async(h,d)=>{if(this.fsw._throttle(Le,s,5)){if(!d||d.mtimeMs===0)try{let u=await(0,I.stat)(s);if(this.fsw.closed)return;let m=u.atimeMs,_=u.mtimeMs;if((!m||m<=_||_!==a.mtimeMs)&&this.fsw._emit(R.CHANGE,s,u),(Ce||Ae||Oe)&&a.ino!==u.ino){this.fsw._closeFile(h),a=u;let E=this._watchWithNodeFs(s,l);E&&this.fsw._addPathCloser(h,E)}else a=u}catch(u){this.fsw._remove(n,r)}else if(o.has(r)){let u=d.atimeMs,m=d.mtimeMs;(!u||u<=m||m!==a.mtimeMs)&&this.fsw._emit(R.CHANGE,s,d),a=d}}},c=this._watchWithNodeFs(s,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(s)){if(!this.fsw._throttle(R.ADD,s,0))return;this.fsw._emit(R.ADD,s,t)}return c}async _handleSymlink(s,t,i,n){if(this.fsw.closed)return;let r=s.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await(0,I.realpath)(i)}catch(l){return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(n)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(R.CHANGE,i,s.stats)):(o.add(n),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(R.ADD,i,s.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(s,t,i,n,r,o,a){s=w.join(s,"");let l=n?`${s}:${n}`:s;if(a=this.fsw._throttle("readdir",l,1e3),!a)return;let c=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(s,{fileFilter:u=>i.filterPath(u),directoryFilter:u=>i.filterDir(u)});if(d)return d.on(ke,async u=>{if(this.fsw.closed){d=void 0;return}let m=u.path,_=w.join(s,m);if(h.add(m),!(u.stats.isSymbolicLink()&&await this._handleSymlink(u,s,_,m))){if(this.fsw.closed){d=void 0;return}(m===n||!n&&!c.has(m))&&(this.fsw._incrReadyCount(),_=w.join(r,w.relative(r,_)),this._addToNodeFs(_,t,i,o+1))}}).on(R.ERROR,this._boundHandleError),new Promise((u,m)=>{if(!d)return m();d.once(_t,()=>{if(this.fsw.closed){d=void 0;return}let _=a?a.clear():!1;u(void 0),c.getChildren().filter(E=>E!==s&&!h.has(E)).forEach(E=>{this.fsw._remove(s,E)}),d=void 0,_&&this._handleRead(s,!1,i,n,r,o,a)})})}async _handleDir(s,t,i,n,r,o,a){let l=this.fsw._getWatchedDir(w.dirname(s)),c=l.has(w.basename(s));!(i&&this.fsw.options.ignoreInitial)&&!r&&!c&&this.fsw._emit(R.ADD_DIR,s,t),l.add(w.basename(s)),this.fsw._getWatchedDir(s);let h,d,u=this.fsw.options.depth;if((u==null||n<=u)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(s,i,o,r,s,n,h),this.fsw.closed))return;d=this._watchWithNodeFs(s,(m,_)=>{_&&_.mtimeMs===0||this._handleRead(m,!1,o,r,s,n,h)})}return d}async _addToNodeFs(s,t,i,n,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(s)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(s);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await je[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let c=this.fsw.options.followSymlinks,h;if(l.isDirectory()){let d=w.resolve(s),u=c?await(0,I.realpath)(s):s;if(this.fsw.closed||(h=await this._handleDir(a.watchPath,l,t,n,r,a,u),this.fsw.closed))return;d!==u&&u!==void 0&&this.fsw._symlinkPaths.set(d,u)}else if(l.isSymbolicLink()){let d=c?await(0,I.realpath)(s):s;if(this.fsw.closed)return;let u=w.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(R.ADD,a.watchPath,l),h=await this._handleDir(u,l,t,n,s,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(s),d)}else h=this._handleFile(a.watchPath,l,t);return o(),h&&this.fsw._addPathCloser(s,h),!1}catch(l){if(this.fsw._handleError(l))return o(),s}}}});var te={};Rt(te,{FSWatcher:()=>Y,WatchHelper:()=>Z,default:()=>rs,watch:()=>Zt});function Q(e){return Array.isArray(e)?e:[e]}function Je(e){return typeof e=="function"?e:typeof e=="string"?s=>e===s:e instanceof RegExp?s=>e.test(s):typeof e=="object"&&e!==null?s=>{if(e.path===s)return!0;if(e.recursive){let t=p.relative(e.path,s);return t?!t.startsWith("..")&&!p.isAbsolute(t):!1}return!1}:()=>!1}function Qe(e){if(typeof e!="string")throw new Error("string expected");e=p.normalize(e),e=e.replace(/\\/g,"/");let s=!1;return e.startsWith("//")&&(s=!0),e=e.replace(Jt,"/"),s&&(e="/"+e),e}function Ut(e,s,t){let i=Qe(s);for(let n=0;n<e.length;n++){let r=e[n];if(r(i,t))return!0}return!1}function Ze(e,s){if(e==null)throw new TypeError("anymatch: specify first argument");let i=Q(e).map(n=>Je(n));return s==null?(n,r)=>Ut(i,n,r):Ut(i,s)}function Zt(e,s={}){let t=new Y(s);return t.add(e),t}var Vt,Kt,tt,p,gt,Ge,Xt,Be,qe,Ve,Jt,Ke,Xe,yt,Gt,Bt,Qt,qt,ts,es,Et,ss,is,Z,Y,rs,ee=dt(()=>{"use strict";Vt=require("events"),Kt=require("fs"),tt=require("fs/promises"),p=D(require("path"),1);Lt();Yt();gt="/",Ge="//",Xt=".",Be="..",qe="string",Ve=/\\/g,Jt=/\/\//g,Ke=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Xe=/^\.[/\\]/;yt=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);Gt=e=>{let s=Q(e).flat();if(!s.every(t=>typeof t===qe))throw new TypeError(`Non-string provided as watch path: ${s}`);return s.map(Qt)},Bt=e=>{let s=e.replace(Ve,gt),t=!1;return s.startsWith(Ge)&&(t=!0),s=s.replace(Jt,gt),t&&(s=gt+s),s},Qt=e=>Bt(p.normalize(Bt(e))),qt=(e="")=>s=>typeof s=="string"?Qt(p.isAbsolute(s)?s:p.join(e,s)):s,ts=(e,s)=>p.isAbsolute(e)?e:p.join(s,e),es=Object.freeze(new Set),Et=class{constructor(s,t){f(this,"path");f(this,"_removeWatcher");f(this,"items");this.path=s,this._removeWatcher=t,this.items=new Set}add(s){let{items:t}=this;t&&s!==Xt&&s!==Be&&t.add(s)}async remove(s){let{items:t}=this;if(!t||(t.delete(s),t.size>0))return;let i=this.path;try{await(0,tt.readdir)(i)}catch(n){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(s){let{items:t}=this;if(t)return t.has(s)}getChildren(){let{items:s}=this;return s?[...s.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=X,this.items=es,Object.freeze(this)}},ss="stat",is="lstat",Z=class{constructor(s,t,i){f(this,"fsw");f(this,"path");f(this,"watchPath");f(this,"fullWatchPath");f(this,"dirParts");f(this,"followSymlinks");f(this,"statMethod");this.fsw=i;let n=s;this.path=s=s.replace(Xe,""),this.watchPath=n,this.fullWatchPath=p.resolve(n),this.dirParts=[],this.dirParts.forEach(r=>{r.length>1&&r.pop()}),this.followSymlinks=t,this.statMethod=t?ss:is}entryPath(s){return p.join(this.watchPath,p.relative(this.watchPath,s.fullPath))}filterPath(s){let{stats:t}=s;if(t&&t.isSymbolicLink())return this.filterDir(s);let i=this.entryPath(s);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(s){return this.fsw._isntIgnored(this.entryPath(s),s.stats)}},Y=class extends Vt.EventEmitter{constructor(t={}){super();f(this,"closed");f(this,"options");f(this,"_closers");f(this,"_ignoredPaths");f(this,"_throttled");f(this,"_streams");f(this,"_symlinkPaths");f(this,"_watched");f(this,"_pendingWrites");f(this,"_pendingUnlinks");f(this,"_readyCount");f(this,"_emitReady");f(this,"_closePromise");f(this,"_userIgnored");f(this,"_readyEmitted");f(this,"_emitRaw");f(this,"_boundRemove");f(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let i=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r=v(b({persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0},t),{ignored:t.ignored?Q(t.ignored):Q([]),awaitWriteFinish:i===!0?n:typeof i=="object"?b(b({},n),i):!1});zt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let c=o.toLowerCase();c==="false"||c==="0"?r.usePolling=!1:c==="true"||c==="1"?r.usePolling=!0:r.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let l=0;this._emitReady=()=>{l++,l>=this._readyCount&&(this._emitReady=X,this._readyEmitted=!0,process.nextTick(()=>this.emit(g.READY)))},this._emitRaw=(...c)=>this.emit(g.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new K(this),Object.freeze(r)}_addIgnoredPath(t){if(yt(t)){for(let i of this._ignoredPaths)if(yt(i)&&i.path===t.path&&i.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let i of this._ignoredPaths)yt(i)&&i.path===t&&this._ignoredPaths.delete(i)}add(t,i,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Gt(t);return r&&(o=o.map(a=>ts(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,i);return l&&this._emitReady(),l})).then(a=>{this.closed||a.forEach(l=>{l&&this.add(p.dirname(l),p.basename(i||l))})}),this}unwatch(t){if(this.closed)return this;let i=Gt(t),{cwd:n}=this.options;return i.forEach(r=>{!p.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=p.join(n,r)),r=p.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(i=>i.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((i,n)=>{let o=(this.options.cwd?p.relative(this.options.cwd,n):n)||Xt;t[o]=i.getChildren().sort()}),t}emitWithAll(t,i){this.emit(t,...i),t!==g.ERROR&&this.emit(g.ALL,t,...i)}async _emit(t,i,n){if(this.closed)return;let r=this.options;wt&&(i=p.normalize(i)),r.cwd&&(i=p.relative(r.cwd,i));let o=[i];n!=null&&o.push(n);let a=r.awaitWriteFinish,l;if(a&&(l=this._pendingWrites.get(i)))return l.lastChange=new Date,this;if(r.atomic){if(t===g.UNLINK)return this._pendingUnlinks.set(i,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((c,h)=>{this.emit(...c),this.emit(g.ALL,...c),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===g.ADD&&this._pendingUnlinks.has(i)&&(t=g.CHANGE,this._pendingUnlinks.delete(i))}if(a&&(t===g.ADD||t===g.CHANGE)&&this._readyEmitted){let c=(h,d)=>{h?(t=g.ERROR,o[0]=h,this.emitWithAll(t,o)):d&&(o.length>1?o[1]=d:o.push(d),this.emitWithAll(t,o))};return this._awaitWriteFinish(i,a.stabilityThreshold,t,c),this}if(t===g.CHANGE&&!this._throttle(g.CHANGE,i,50))return this;if(r.alwaysStat&&n===void 0&&(t===g.ADD||t===g.ADD_DIR||t===g.CHANGE)){let c=r.cwd?p.join(r.cwd,i):i,h;try{h=await(0,tt.stat)(c)}catch(d){}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let i=t&&t.code;return t&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(g.ERROR,t),t||this.closed}_throttle(t,i,n){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(i);if(o)return o.count++,!1;let a,l=()=>{let h=r.get(i),d=h?h.count:0;return r.delete(i),clearTimeout(a),h&&clearTimeout(h.timeoutObject),d};a=setTimeout(l,n);let c={timeoutObject:a,clear:l,count:0};return r.set(i,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,i,n,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,l,c=t;this.options.cwd&&!p.isAbsolute(t)&&(c=p.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;function u(m){(0,Kt.stat)(c,(_,E)=>{if(_||!d.has(t)){_&&_.code!=="ENOENT"&&r(_);return}let P=Number(new Date);m&&E.size!==m.size&&(d.get(t).lastChange=P);let at=d.get(t);P-at.lastChange>=i?(d.delete(t),r(void 0,E)):l=setTimeout(u,a,E)})}d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(l),n)}),l=setTimeout(u,a))}_isIgnored(t,i){if(this.options.atomic&&Ke.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,o=(this.options.ignored||[]).map(qt(n)),l=[...[...this._ignoredPaths].map(qt(n)),...o];this._userIgnored=Ze(l,void 0)}return this._userIgnored(t,i)}_isntIgnored(t,i){return!this._isIgnored(t,i)}_getWatchHelpers(t){return new Z(t,this.options.followSymlinks,this)}_getWatchedDir(t){let i=p.resolve(t);return this._watched.has(i)||this._watched.set(i,new Et(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,i,n){let r=p.join(t,i),o=p.resolve(r);if(n=n!=null?n:this._watched.has(r)||this._watched.has(o),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,i,!0),this._getWatchedDir(r).getChildren().forEach(m=>this._remove(r,m));let c=this._getWatchedDir(t),h=c.has(i);c.remove(i),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let d=r;if(this.options.cwd&&(d=p.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===g.ADD)return;this._watched.delete(r),this._watched.delete(o);let u=n?g.UNLINK_DIR:g.UNLINK;h&&!this._isIgnored(r)&&this._emit(u,r),this._closePath(r)}_closePath(t){this._closeFile(t);let i=p.dirname(t);this._getWatchedDir(i).remove(p.basename(t))}_closeFile(t){let i=this._closers.get(t);i&&(i.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,i){if(!i)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(i)}_readdirp(t,i){if(this.closed)return;let n=v(b({type:g.ALL,alwaysStat:!0,lstat:!0},i),{depth:0}),r=Ot(t,n);return this._streams.add(r),r.once(Ht,()=>{r=void 0}),r.once(_t,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};rs={watch:Zt,FSWatcher:Y}});var ws={};Rt(ws,{createSource:()=>ps,defaultMdxComponents:()=>Ie,defineDocstraConfig:()=>_s,generateSidebar:()=>ue,getPageData:()=>ms,loadDocstraConfig:()=>ge,runDocstraBuild:()=>nt,runDocstraDev:()=>_e,withDocstra:()=>us});module.exports=Re(ws);var C=require("lucide-react"),M=require("react/jsx-runtime");function ht({type:e="info",children:s}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},n={info:C.InfoIcon,warning:C.AlertTriangleIcon,error:C.AlertCircleIcon}[e];return(0,M.jsxs)("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[(0,M.jsx)(n,{className:"w-5 h-5 shrink-0"}),(0,M.jsx)("div",{children:s})]})}var Ft=D(require("next/link"));var St=require("lucide-react");function Tt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}var H=require("react/jsx-runtime");function A({children:e,level:s}){let t=`h${s}`,n=Tt(typeof e=="string"?e:"");return(0,H.jsxs)(t,{id:n,className:"group",children:[(0,H.jsx)("a",{className:"not-prose",href:`#${n}`,children:e}),(0,H.jsx)(St.LinkIcon,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}var y=require("react/jsx-runtime"),Ie={h1:e=>(0,y.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>(0,y.jsx)(A,v(b({},e),{level:2})),h3:e=>(0,y.jsx)(A,v(b({},e),{level:3})),h4:e=>(0,y.jsx)(A,v(b({},e),{level:4})),h5:e=>(0,y.jsx)(A,v(b({},e),{level:5})),p:e=>(0,y.jsx)("p",{children:e.children}),hr:e=>(0,y.jsx)("hr",v(b({},e),{className:"border-gray-200"})),a:e=>e.href.startsWith("http")?(0,y.jsx)("a",v(b({href:e.href,className:"underline underline-offset-4"},e),{target:"_blank",rel:"noopener noreferrer",children:e.children})):(0,y.jsx)(Ft.default,v(b({href:e.href,className:"underline underline-offset-4"},e),{children:e.children})),ul:e=>(0,y.jsx)("ul",{children:e.children}),li:e=>(0,y.jsx)("li",{children:e.children}),ol:e=>(0,y.jsx)("ol",{children:e.children}),blockquote:e=>(0,y.jsx)("blockquote",{className:"not-italic",children:e.children}),pre:e=>(0,y.jsx)("pre",{className:"not-prose",children:e.children}),Callout:ht,table:e=>(0,y.jsx)("table",{children:e.children}),thead:e=>(0,y.jsx)("thead",{children:e.children}),tbody:e=>(0,y.jsx)("tbody",{children:e.children}),tr:e=>(0,y.jsx)("tr",{children:e.children}),th:e=>(0,y.jsx)("th",{children:e.children}),td:e=>(0,y.jsx)("td",{children:e.children})};var k=D(require("fs"),1),L=D(require("path"),1),ot=D(require("fs"),1),W=D(require("path"),1),he=D(require("fs"),1),fe=D(require("gray-matter"),1),it=D(require("path"),1),we=D(require("fs"),1),ns=Object.defineProperty,os=Object.defineProperties,as=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,se=(e,s,t)=>s in e?ns(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,et=(e,s)=>{for(var t in s||(s={}))ce.call(s,t)&&se(e,t,s[t]);if(rt)for(var t of rt(s))de.call(s,t)&&se(e,t,s[t]);return e},st=(e,s)=>os(e,as(s)),U=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof require!="undefined"?require:s)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ls=(e,s)=>{var t={};for(var i in e)ce.call(e,i)&&s.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&rt)for(var i of rt(e))s.indexOf(i)<0&&de.call(e,i)&&(t[i]=e[i]);return t};function ie(e){try{let s=he.default.readFileSync(e,"utf-8"),{data:t}=(0,fe.default)(s);return{title:t.title,icon:t.icon,description:t.description,defaultOpen:t.defaultOpen,collapsible:t.collapsible}}catch(s){return{}}}function ue(e,s="/docs"){return ot.default.existsSync(e)?pe(e,e,s):[]}function pe(e,s,t){var i;let n=ot.default.readdirSync(e,{withFileTypes:!0}).sort((o,a)=>{let l=re(o.name),c=re(a.name);return l!==null&&c!==null?l-c:l!==null?-1:c!==null?1:o.name.localeCompare(a.name)}),r=[];for(let o of n){if(o.name.startsWith("_")||o.name.startsWith("."))continue;let a=W.default.join(e,o.name);if(o.isDirectory()){let l=G(o.name),c=cs(a),h=pe(a,s,t);if(c){let P=bt(W.default.relative(s,c).replace(/\\/g,"/")),at=Pt(P,t);h=h.filter(lt=>!(lt.type==="page"&&lt.href===at))}if(h.length===0&&!c)continue;let d=ne(l),u,m=!0,_=!0;if(c){let P=ie(c);P.title&&(d=P.title),P.icon&&(u=P.icon),P.defaultOpen!==void 0&&(m=P.defaultOpen),P.collapsible!==void 0&&(_=P.collapsible)}let E={type:"section",title:d,children:h,href:c?Pt(bt(W.default.relative(s,c).replace(/\\/g,"/")),t):"",icon:u,defaultOpen:m,collapsible:_};r.push(E)}else if(o.name.endsWith(".md")||o.name.endsWith(".mdx")){let l=W.default.relative(s,a).replace(/\\/g,"/"),c=bt(l),h=ie(a),d=o.name.replace(/\.(md|mdx)$/,""),u=G(d),m=Pt(c,t),_=u.toLowerCase()==="index",E={type:"page",title:(i=h.title)!=null?i:ne(_?G(W.default.basename(e)):u),href:m,icon:h.icon};r.push(E)}}return r}function re(e){let s=e.match(/^(\d+)-/);return s?parseInt(s[1],10):null}function G(e){return e.replace(/^\d+-/,"")}function cs(e){let s=ot.default.readdirSync(e);for(let t of s){let i=G(t);if(i==="index.md"||i==="index.mdx")return W.default.join(e,t)}return null}function ne(e){return e.toLowerCase()==="index"?"Home":e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function bt(e){return e.replace(/\\/g,"/").split("/").map(s=>G(s)).join("/").replace(/\/index\.(md|mdx)$/,"").replace(/\.(md|mdx)$/,"").replace(/^index$/,"")}function Pt(e,s){return!e||e==="index"||e===""?s:`${s}/${e.startsWith("/")?e.slice(1):e}`}function nt(e,s="/docs"){let t=process.cwd(),i=L.default.join(t,".docstra"),n=L.default.join(i,"index.ts");k.default.existsSync(e)||(console.error(`Content directory not found: ${e}`),console.error(`Please create "${e}" or update "contentDir" in docstra.config.ts`),process.exit(1)),k.default.existsSync(i)||k.default.mkdirSync(i,{recursive:!0});let r=me(e);r.length===0&&console.warn(`No .md or .mdx files found in ${e}`);let o=[],a=[];r.forEach((h,d)=>{let u=L.default.relative(i,h).replace(/\\/g,"/"),m=`d${d}`;o.push(`import * as ${m} from "${u}?docstra";`);let _=L.default.relative(e,h).replace(/\\/g,"/"),E=hs(_);a.push(`{
2
2
  slug: "${E}",
3
3
  path: "${_}",
4
4
  data: {
@@ -19,7 +19,7 @@ export const docs = [
19
19
  ];
20
20
 
21
21
  export const sidebarItems: SidebarItem[] = ${JSON.stringify(l,null,2)} as SidebarItem[];
22
- `;k.default.writeFileSync(n,c,"utf8")}function me(e){return k.default.readdirSync(e).flatMap(s=>{let t=L.default.join(e,s);return k.default.statSync(t).isDirectory()?me(t):s.endsWith(".md")||s.endsWith(".mdx")?[t]:[]})}function ds(e){return e.replace(/^\d+-/,"")}function hs(e){return e.replace(/\\/g,"/").split("/").map(s=>ds(s)).join("/").replace(/\.(md|mdx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")}var ae=!1,vt=null;async function _e(e){if(ae)return;ae=!0,await nt(e);let{FSWatcher:s}=await Promise.resolve().then(()=>(se(),ee)),t="docstra.config.ts",i=new s({ignoreInitial:!0,persistent:!0,ignored:["node_modules",".next"]});i.add([e,t]),console.log("\x1B[32m \u2713 \x1B[0mDocstra dev server started..."),i.on("all",async(n,r)=>{!r.endsWith(".md")&&!r.endsWith(".mdx")&&!r.endsWith("docstra.config.ts")||(vt&&clearTimeout(vt),vt=setTimeout(async()=>{await nt(e)},200),console.info("MDX content rebuilt successfully"))}),process.on("exit",()=>{i.closed||i.close()})}var fs="docs/content";function ge(){var e;let s=process.cwd(),t=it.default.join(s,"docstra.config.ts"),i={};if(we.default.existsSync(t))try{delete U.cache[U.resolve(t)];let r=U(t);i=(e=r.default)!=null?e:r}catch(r){console.error("Failed to load docstra.config.ts",r),process.exit(1)}else console.warn("No docstra.config.ts found, using defaults");let n=i.contentDir?it.default.resolve(s,i.contentDir):it.default.join(s,fs);return{root:s,contentDir:n,userConfig:i}}var le=!1;function us(e={}){var s,t;let i=process.env.NODE_ENV==="development",n=process.env.NODE_ENV==="production",r=ge().contentDir;le||(le=!0,i&&_e(r),n&&(nt(r),console.log("\x1B[32m \u2713 \x1B[0mDocstra MDX index generated successfully")));let o=st(et({},e.turbopack),{rules:st(et({},(s=e.turbopack)==null?void 0:s.rules),{"*.{md,mdx}":{loaders:[{loader:U.resolve("./loader")}],as:"*.js"}})});return st(et({},e),{turbopack:o,pageExtensions:(t=e.pageExtensions)!=null?t:["ts","tsx","js","jsx","md","mdx"],webpack:(a,l)=>(a.module.rules.push({test:/\.(md|mdx)$/,resourceQuery:/docstra/,use:[{loader:U.resolve("./loader")}]}),typeof e.webpack=="function"?e.webpack(a,l):a)})}function ps(e,s){return{getPage:t=>{let i=e.find(a=>a.slug===ft(t));if(!i)return null;let n=i.data,{body:r}=n,o=ls(n,["body"]);return st(et({},o),{slug:i.slug,path:i.path})},getPageBody:t=>{let i=e.find(n=>n.slug===ft(t));return i?i.data.body:null},generateStaticParams:()=>e.map(t=>({slug:t.slug===""?[]:t.slug.split("/")})),generateSitemap:({baseUrl:t,lastmod:i,changefreq:n,priority:r})=>e.map(o=>{let a=o.slug===""?"":o.slug.replace(/\/?index$/,"");return{url:`${t}/${a}`.replace(/\/$/,""),lastModified:i,changeFrequency:n,priority:r}}),sidebarItems:s!=null?s:[]}}function ms(e,s){return s.find(t=>t.slug===((e==null?void 0:e.filter(Boolean).join("/"))||""))}function _s(e){return e}0&&(module.exports={createSource,defaultMdxComponents,defineDocstraConfig,generateSidebar,getPageData,loadDocstraConfig,runDocstraBuild,runDocstraDev,withDocstra});
22
+ `;k.default.writeFileSync(n,c,"utf8")}function me(e){return k.default.readdirSync(e).flatMap(s=>{let t=L.default.join(e,s);return k.default.statSync(t).isDirectory()?me(t):s.endsWith(".md")||s.endsWith(".mdx")?[t]:[]})}function ds(e){return e.replace(/^\d+-/,"")}function hs(e){return e.replace(/\\/g,"/").split("/").map(s=>ds(s)).join("/").replace(/\.(md|mdx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")}var oe=!1,xt=null;async function _e(e){if(oe)return;oe=!0,await nt(e);let{FSWatcher:s}=await Promise.resolve().then(()=>(ee(),te)),t="docstra.config.ts",i=new s({ignoreInitial:!0,persistent:!0,ignored:["node_modules",".next"]});i.add([e,t]),console.log("\x1B[32m \u2713 \x1B[0mDocstra dev server started..."),i.on("all",async(n,r)=>{!r.endsWith(".md")&&!r.endsWith(".mdx")&&!r.endsWith("docstra.config.ts")||(xt&&clearTimeout(xt),xt=setTimeout(async()=>{await nt(e)},200),console.info("MDX content rebuilt successfully"))}),process.on("exit",()=>{i.closed||i.close()})}var fs="docs/content";function ge(){var e;let s=process.cwd(),t=it.default.join(s,"docstra.config.ts"),i={};if(we.default.existsSync(t))try{delete U.cache[U.resolve(t)];let r=U(t);i=(e=r.default)!=null?e:r}catch(r){console.error("Failed to load docstra.config.ts",r),process.exit(1)}else console.warn("No docstra.config.ts found, using defaults");let n=i.contentDir?it.default.resolve(s,i.contentDir):it.default.join(s,fs);return{root:s,contentDir:n,userConfig:i}}var ae=!1;function us(e={}){var s,t;let i=process.env.NODE_ENV==="development",n=process.env.NODE_ENV==="production",r=ge().contentDir;ae||(ae=!0,i&&_e(r),n&&(nt(r),console.log("\x1B[32m \u2713 \x1B[0mDocstra MDX index generated successfully")));let o=st(et({},e.turbopack),{rules:st(et({},(s=e.turbopack)==null?void 0:s.rules),{"*.{md,mdx}":{loaders:[{loader:U.resolve("./loader")}],as:"*.js"}})});return st(et({},e),{turbopack:o,pageExtensions:(t=e.pageExtensions)!=null?t:["ts","tsx","js","jsx","md","mdx"],webpack:(a,l)=>(a.module.rules.push({test:/\.(md|mdx)$/,resourceQuery:/docstra/,use:[{loader:U.resolve("./loader")}]}),typeof e.webpack=="function"?e.webpack(a,l):a)})}function le(e){return e!=null&&e.length?e.join("/"):""}function ps(e,s){return{getPage:t=>{let i=e.find(a=>a.slug===le(t));if(!i)return null;let n=i.data,{body:r}=n,o=ls(n,["body"]);return st(et({},o),{slug:i.slug,path:i.path})},getPageBody:t=>{let i=e.find(n=>n.slug===le(t));return i?i.data.body:null},generateStaticParams:()=>e.map(t=>({slug:t.slug===""?[]:t.slug.split("/")})),generateSitemap:({baseUrl:t,lastmod:i,changefreq:n,priority:r})=>e.map(o=>{let a=o.slug===""?"":o.slug.replace(/\/?index$/,"");return{url:`${t}/${a}`.replace(/\/$/,""),lastModified:i,changeFrequency:n,priority:r}}),sidebarItems:s!=null?s:[]}}function ms(e,s){return s.find(t=>t.slug===((e==null?void 0:e.filter(Boolean).join("/"))||""))}function _s(e){return e}0&&(module.exports={createSource,defaultMdxComponents,defineDocstraConfig,generateSidebar,getPageData,loadDocstraConfig,runDocstraBuild,runDocstraDev,withDocstra});
23
23
  /*! Bundled license information:
24
24
 
25
25
  chokidar/index.js:
@@ -1,4 +1,4 @@
1
- var gt=Object.defineProperty,ie=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var wt=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var J=(e,s,t)=>s in e?gt(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,b=(e,s)=>{for(var t in s||(s={}))ne.call(s,t)&&J(e,t,s[t]);if(wt)for(var t of wt(s))oe.call(s,t)&&J(e,t,s[t]);return e},v=(e,s)=>ie(e,re(s));var R=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof require!="undefined"?require:s)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Q=(e,s)=>()=>(e&&(s=e(e=0)),s);var ae=(e,s)=>{for(var t in s)gt(e,t,{get:s[t],enumerable:!0})};var f=(e,s,t)=>J(e,typeof s!="symbol"?s+"":s,t);import{lstat as Pt,readdir as me,realpath as _e,stat as we}from"fs/promises";import{join as ge,relative as ye,resolve as xt,sep as Ee}from"path";import{Readable as be}from"stream";function Tt(e,s={}){let t=s.entryType||s.type;if(t==="both"&&(t=x.FILE_DIR_TYPE),t&&(s.type=t),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!vt.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${vt.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return s.root=e,new st(s)}var x,et,It,Pe,vt,xe,ve,De,Re,Dt,Rt,st,St=Q(()=>{"use strict";x={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},et={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:x.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(et);It="READDIRP_RECURSIVE_ERROR",Pe=new Set(["ENOENT","EPERM","EACCES","ELOOP",It]),vt=[x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE],xe=new Set([x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE]),ve=new Set([x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE]),De=e=>Pe.has(e.code),Re=process.platform==="win32",Dt=e=>!0,Rt=e=>{if(e===void 0)return Dt;if(typeof e=="function")return e;if(typeof e=="string"){let s=e.trim();return t=>t.basename===s}if(Array.isArray(e)){let s=e.map(t=>t.trim());return t=>s.some(i=>t.basename===i)}return Dt},st=class extends be{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});f(this,"parents");f(this,"reading");f(this,"parent");f(this,"_stat");f(this,"_maxDepth");f(this,"_wantsDir");f(this,"_wantsFile");f(this,"_wantsEverything");f(this,"_root");f(this,"_isDirent");f(this,"_statsProp");f(this,"_rdOptions");f(this,"_fileFilter");f(this,"_directoryFilter");let i=b(b({},et),t),{root:n,type:r}=i;this._fileFilter=Rt(i.fileFilter),this._directoryFilter=Rt(i.directoryFilter);let o=i.lstat?Pt:we;Re?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=i.depth!=null&&Number.isSafeInteger(i.depth)?i.depth:et.depth,this._wantsDir=r?xe.has(r):!1,this._wantsFile=r?ve.has(r):!1,this._wantsEverything=r===x.EVERYTHING_TYPE,this._root=xt(n),this._isDirent=!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let i=this.parent,n=i&&i.files;if(n&&n.length>0){let{path:r,depth:o}=i,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),l=await Promise.all(a);for(let c of l){if(!c)continue;if(this.destroyed)return;let h=await this._getEntryType(c);h==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),t--)):(h==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i)}finally{this.reading=!1}}}async _exploreDir(t,i){let n;try{n=await me(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:i,path:t}}async _formatEntry(t,i){let n,r=this._isDirent?t.name:t;try{let o=xt(ge(i,r));n={path:ye(this._root,o),fullPath:o,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(t){De(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let i=t[this._statsProp];if(i.isFile())return"file";if(i.isDirectory())return"directory";if(i&&i.isSymbolicLink()){let n=t.fullPath;try{let r=await _e(n),o=await Pt(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===Ee){let l=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return l.code=It,this._onError(l)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let i=t&&t[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}}});import{watch as Ie,unwatchFile as Ft,watchFile as Te}from"fs";import{realpath as it,lstat as Se,open as Fe,stat as Wt}from"fs/promises";import{type as Ne}from"os";import*as w from"path";function Nt(e,s,t,i,n){let r=(o,a)=>{t(e),n(o,a,{watchedPath:e}),a&&e!==a&&H(w.resolve(e,a),I,w.join(e,a))};try{return Ie(e,{persistent:s.persistent},r)}catch(o){i(o);return}}var We,ot,kt,$,Y,at,ke,Ce,Ae,Ct,g,D,Oe,Le,I,j,S,je,Me,He,nt,W,ze,k,At,M,H,$e,rt,Ye,z,Ot=Q(()=>{"use strict";We="data",ot="end",kt="close",$=()=>{},Y=process.platform,at=Y==="win32",ke=Y==="darwin",Ce=Y==="linux",Ae=Y==="freebsd",Ct=Ne()==="OS400",g={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},D=g,Oe="watch",Le={lstat:Se,stat:Wt},I="listeners",j="errHandlers",S="rawEmitters",je=[I,j,S],Me=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),He=e=>Me.has(w.extname(e).slice(1).toLowerCase()),nt=(e,s)=>{e instanceof Set?e.forEach(s):s(e)},W=(e,s,t)=>{let i=e[s];i instanceof Set||(e[s]=i=new Set([i])),i.add(t)},ze=e=>s=>{let t=e[s];t instanceof Set?t.clear():delete e[s]},k=(e,s,t)=>{let i=e[s];i instanceof Set?i.delete(t):i===t&&delete e[s]},At=e=>e instanceof Set?e.size===0:!e,M=new Map;H=(e,s,t,i,n)=>{let r=M.get(e);r&&nt(r[s],o=>{o(t,i,n)})},$e=(e,s,t,i)=>{let{listener:n,errHandler:r,rawEmitter:o}=i,a=M.get(s),l;if(!t.persistent)return l=Nt(e,t,n,r,o),l?l.close.bind(l):void 0;if(a)W(a,I,n),W(a,j,r),W(a,S,o);else{if(l=Nt(e,t,H.bind(null,s,I),r,H.bind(null,s,S)),!l)return;l.on(D.ERROR,async c=>{let h=H.bind(null,s,j);if(a&&(a.watcherUnusable=!0),at&&c.code==="EPERM")try{await(await Fe(e,"r")).close(),h(c)}catch(d){}else h(c)}),a={listeners:n,errHandlers:r,rawEmitters:o,watcher:l},M.set(s,a)}return()=>{k(a,I,n),k(a,j,r),k(a,S,o),At(a.listeners)&&(a.watcher.close(),M.delete(s),je.forEach(ze(a)),a.watcher=void 0,Object.freeze(a))}},rt=new Map,Ye=(e,s,t,i)=>{let{listener:n,rawEmitter:r}=i,o=rt.get(s),a=o&&o.options;return a&&(a.persistent<t.persistent||a.interval>t.interval)&&(Ft(s),o=void 0),o?(W(o,I,n),W(o,S,r)):(o={listeners:n,rawEmitters:r,options:t,watcher:Te(s,t,(l,c)=>{nt(o.rawEmitters,d=>{d(D.CHANGE,s,{curr:l,prev:c})});let h=l.mtimeMs;(l.size!==c.size||h>c.mtimeMs||h===0)&&nt(o.listeners,d=>d(e,l))})},rt.set(s,o)),()=>{k(o,I,n),k(o,S,r),At(o.listeners)&&(rt.delete(s),Ft(s),o.options=o.watcher=void 0,Object.freeze(o))}},z=class{constructor(s){f(this,"fsw");f(this,"_boundHandleError");this.fsw=s,this._boundHandleError=t=>s._handleError(t)}_watchWithNodeFs(s,t){let i=this.fsw.options,n=w.dirname(s),r=w.basename(s);this.fsw._getWatchedDir(n).add(r);let a=w.resolve(s),l={persistent:i.persistent};t||(t=$);let c;if(i.usePolling){let h=i.interval!==i.binaryInterval;l.interval=h&&He(r)?i.binaryInterval:i.interval,c=Ye(s,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else c=$e(s,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(s,t,i){if(this.fsw.closed)return;let n=w.dirname(s),r=w.basename(s),o=this.fsw._getWatchedDir(n),a=t;if(o.has(r))return;let l=async(h,d)=>{if(this.fsw._throttle(Oe,s,5)){if(!d||d.mtimeMs===0)try{let u=await Wt(s);if(this.fsw.closed)return;let m=u.atimeMs,_=u.mtimeMs;if((!m||m<=_||_!==a.mtimeMs)&&this.fsw._emit(D.CHANGE,s,u),(ke||Ce||Ae)&&a.ino!==u.ino){this.fsw._closeFile(h),a=u;let E=this._watchWithNodeFs(s,l);E&&this.fsw._addPathCloser(h,E)}else a=u}catch(u){this.fsw._remove(n,r)}else if(o.has(r)){let u=d.atimeMs,m=d.mtimeMs;(!u||u<=m||m!==a.mtimeMs)&&this.fsw._emit(D.CHANGE,s,d),a=d}}},c=this._watchWithNodeFs(s,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(s)){if(!this.fsw._throttle(D.ADD,s,0))return;this.fsw._emit(D.ADD,s,t)}return c}async _handleSymlink(s,t,i,n){if(this.fsw.closed)return;let r=s.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await it(i)}catch(l){return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(n)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(D.CHANGE,i,s.stats)):(o.add(n),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(D.ADD,i,s.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(s,t,i,n,r,o,a){s=w.join(s,"");let l=n?`${s}:${n}`:s;if(a=this.fsw._throttle("readdir",l,1e3),!a)return;let c=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(s,{fileFilter:u=>i.filterPath(u),directoryFilter:u=>i.filterDir(u)});if(d)return d.on(We,async u=>{if(this.fsw.closed){d=void 0;return}let m=u.path,_=w.join(s,m);if(h.add(m),!(u.stats.isSymbolicLink()&&await this._handleSymlink(u,s,_,m))){if(this.fsw.closed){d=void 0;return}(m===n||!n&&!c.has(m))&&(this.fsw._incrReadyCount(),_=w.join(r,w.relative(r,_)),this._addToNodeFs(_,t,i,o+1))}}).on(D.ERROR,this._boundHandleError),new Promise((u,m)=>{if(!d)return m();d.once(ot,()=>{if(this.fsw.closed){d=void 0;return}let _=a?a.clear():!1;u(void 0),c.getChildren().filter(E=>E!==s&&!h.has(E)).forEach(E=>{this.fsw._remove(s,E)}),d=void 0,_&&this._handleRead(s,!1,i,n,r,o,a)})})}async _handleDir(s,t,i,n,r,o,a){let l=this.fsw._getWatchedDir(w.dirname(s)),c=l.has(w.basename(s));!(i&&this.fsw.options.ignoreInitial)&&!r&&!c&&this.fsw._emit(D.ADD_DIR,s,t),l.add(w.basename(s)),this.fsw._getWatchedDir(s);let h,d,u=this.fsw.options.depth;if((u==null||n<=u)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(s,i,o,r,s,n,h),this.fsw.closed))return;d=this._watchWithNodeFs(s,(m,_)=>{_&&_.mtimeMs===0||this._handleRead(m,!1,o,r,s,n,h)})}return d}async _addToNodeFs(s,t,i,n,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(s)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(s);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await Le[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let c=this.fsw.options.followSymlinks,h;if(l.isDirectory()){let d=w.resolve(s),u=c?await it(s):s;if(this.fsw.closed||(h=await this._handleDir(a.watchPath,l,t,n,r,a,u),this.fsw.closed))return;d!==u&&u!==void 0&&this.fsw._symlinkPaths.set(d,u)}else if(l.isSymbolicLink()){let d=c?await it(s):s;if(this.fsw.closed)return;let u=w.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(D.ADD,a.watchPath,l),h=await this._handleDir(u,l,t,n,s,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(s),d)}else h=this._handleFile(a.watchPath,l,t);return o(),h&&this.fsw._addPathCloser(s,h),!1}catch(l){if(this.fsw._handleError(l))return o(),s}}}});var Bt={};ae(Bt,{FSWatcher:()=>C,WatchHelper:()=>B,default:()=>as,watch:()=>Ut});import{EventEmitter as Ue}from"events";import{stat as Be}from"fs";import{readdir as Ge,stat as qe}from"fs/promises";import*as p from"path";function U(e){return Array.isArray(e)?e:[e]}function ts(e){return typeof e=="function"?e:typeof e=="string"?s=>e===s:e instanceof RegExp?s=>e.test(s):typeof e=="object"&&e!==null?s=>{if(e.path===s)return!0;if(e.recursive){let t=p.relative(e.path,s);return t?!t.startsWith("..")&&!p.isAbsolute(t):!1}return!1}:()=>!1}function es(e){if(typeof e!="string")throw new Error("string expected");e=p.normalize(e),e=e.replace(/\\/g,"/");let s=!1;return e.startsWith("//")&&(s=!0),e=e.replace($t,"/"),s&&(e="/"+e),e}function Lt(e,s,t){let i=es(s);for(let n=0;n<e.length;n++){let r=e[n];if(r(i,t))return!0}return!1}function ss(e,s){if(e==null)throw new TypeError("anymatch: specify first argument");let i=U(e).map(n=>ts(n));return s==null?(n,r)=>Lt(i,n,r):Lt(i,s)}function Ut(e,s={}){let t=new C(s);return t.add(e),t}var lt,Ve,zt,Ke,Xe,Je,$t,Qe,Ze,ct,jt,Mt,Yt,Ht,is,rs,dt,ns,os,B,C,as,Gt=Q(()=>{"use strict";St();Ot();lt="/",Ve="//",zt=".",Ke="..",Xe="string",Je=/\\/g,$t=/\/\//g,Qe=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Ze=/^\.[/\\]/;ct=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);jt=e=>{let s=U(e).flat();if(!s.every(t=>typeof t===Xe))throw new TypeError(`Non-string provided as watch path: ${s}`);return s.map(Yt)},Mt=e=>{let s=e.replace(Je,lt),t=!1;return s.startsWith(Ve)&&(t=!0),s=s.replace($t,lt),t&&(s=lt+s),s},Yt=e=>Mt(p.normalize(Mt(e))),Ht=(e="")=>s=>typeof s=="string"?Yt(p.isAbsolute(s)?s:p.join(e,s)):s,is=(e,s)=>p.isAbsolute(e)?e:p.join(s,e),rs=Object.freeze(new Set),dt=class{constructor(s,t){f(this,"path");f(this,"_removeWatcher");f(this,"items");this.path=s,this._removeWatcher=t,this.items=new Set}add(s){let{items:t}=this;t&&s!==zt&&s!==Ke&&t.add(s)}async remove(s){let{items:t}=this;if(!t||(t.delete(s),t.size>0))return;let i=this.path;try{await Ge(i)}catch(n){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(s){let{items:t}=this;if(t)return t.has(s)}getChildren(){let{items:s}=this;return s?[...s.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=$,this.items=rs,Object.freeze(this)}},ns="stat",os="lstat",B=class{constructor(s,t,i){f(this,"fsw");f(this,"path");f(this,"watchPath");f(this,"fullWatchPath");f(this,"dirParts");f(this,"followSymlinks");f(this,"statMethod");this.fsw=i;let n=s;this.path=s=s.replace(Ze,""),this.watchPath=n,this.fullWatchPath=p.resolve(n),this.dirParts=[],this.dirParts.forEach(r=>{r.length>1&&r.pop()}),this.followSymlinks=t,this.statMethod=t?ns:os}entryPath(s){return p.join(this.watchPath,p.relative(this.watchPath,s.fullPath))}filterPath(s){let{stats:t}=s;if(t&&t.isSymbolicLink())return this.filterDir(s);let i=this.entryPath(s);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(s){return this.fsw._isntIgnored(this.entryPath(s),s.stats)}},C=class extends Ue{constructor(t={}){super();f(this,"closed");f(this,"options");f(this,"_closers");f(this,"_ignoredPaths");f(this,"_throttled");f(this,"_streams");f(this,"_symlinkPaths");f(this,"_watched");f(this,"_pendingWrites");f(this,"_pendingUnlinks");f(this,"_readyCount");f(this,"_emitReady");f(this,"_closePromise");f(this,"_userIgnored");f(this,"_readyEmitted");f(this,"_emitRaw");f(this,"_boundRemove");f(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let i=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r=v(b({persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0},t),{ignored:t.ignored?U(t.ignored):U([]),awaitWriteFinish:i===!0?n:typeof i=="object"?b(b({},n),i):!1});Ct&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let c=o.toLowerCase();c==="false"||c==="0"?r.usePolling=!1:c==="true"||c==="1"?r.usePolling=!0:r.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let l=0;this._emitReady=()=>{l++,l>=this._readyCount&&(this._emitReady=$,this._readyEmitted=!0,process.nextTick(()=>this.emit(g.READY)))},this._emitRaw=(...c)=>this.emit(g.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new z(this),Object.freeze(r)}_addIgnoredPath(t){if(ct(t)){for(let i of this._ignoredPaths)if(ct(i)&&i.path===t.path&&i.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let i of this._ignoredPaths)ct(i)&&i.path===t&&this._ignoredPaths.delete(i)}add(t,i,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=jt(t);return r&&(o=o.map(a=>is(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,i);return l&&this._emitReady(),l})).then(a=>{this.closed||a.forEach(l=>{l&&this.add(p.dirname(l),p.basename(i||l))})}),this}unwatch(t){if(this.closed)return this;let i=jt(t),{cwd:n}=this.options;return i.forEach(r=>{!p.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=p.join(n,r)),r=p.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(i=>i.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((i,n)=>{let o=(this.options.cwd?p.relative(this.options.cwd,n):n)||zt;t[o]=i.getChildren().sort()}),t}emitWithAll(t,i){this.emit(t,...i),t!==g.ERROR&&this.emit(g.ALL,t,...i)}async _emit(t,i,n){if(this.closed)return;let r=this.options;at&&(i=p.normalize(i)),r.cwd&&(i=p.relative(r.cwd,i));let o=[i];n!=null&&o.push(n);let a=r.awaitWriteFinish,l;if(a&&(l=this._pendingWrites.get(i)))return l.lastChange=new Date,this;if(r.atomic){if(t===g.UNLINK)return this._pendingUnlinks.set(i,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((c,h)=>{this.emit(...c),this.emit(g.ALL,...c),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===g.ADD&&this._pendingUnlinks.has(i)&&(t=g.CHANGE,this._pendingUnlinks.delete(i))}if(a&&(t===g.ADD||t===g.CHANGE)&&this._readyEmitted){let c=(h,d)=>{h?(t=g.ERROR,o[0]=h,this.emitWithAll(t,o)):d&&(o.length>1?o[1]=d:o.push(d),this.emitWithAll(t,o))};return this._awaitWriteFinish(i,a.stabilityThreshold,t,c),this}if(t===g.CHANGE&&!this._throttle(g.CHANGE,i,50))return this;if(r.alwaysStat&&n===void 0&&(t===g.ADD||t===g.ADD_DIR||t===g.CHANGE)){let c=r.cwd?p.join(r.cwd,i):i,h;try{h=await qe(c)}catch(d){}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let i=t&&t.code;return t&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(g.ERROR,t),t||this.closed}_throttle(t,i,n){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(i);if(o)return o.count++,!1;let a,l=()=>{let h=r.get(i),d=h?h.count:0;return r.delete(i),clearTimeout(a),h&&clearTimeout(h.timeoutObject),d};a=setTimeout(l,n);let c={timeoutObject:a,clear:l,count:0};return r.set(i,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,i,n,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,l,c=t;this.options.cwd&&!p.isAbsolute(t)&&(c=p.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;function u(m){Be(c,(_,E)=>{if(_||!d.has(t)){_&&_.code!=="ENOENT"&&r(_);return}let P=Number(new Date);m&&E.size!==m.size&&(d.get(t).lastChange=P);let K=d.get(t);P-K.lastChange>=i?(d.delete(t),r(void 0,E)):l=setTimeout(u,a,E)})}d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(l),n)}),l=setTimeout(u,a))}_isIgnored(t,i){if(this.options.atomic&&Qe.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,o=(this.options.ignored||[]).map(Ht(n)),l=[...[...this._ignoredPaths].map(Ht(n)),...o];this._userIgnored=ss(l,void 0)}return this._userIgnored(t,i)}_isntIgnored(t,i){return!this._isIgnored(t,i)}_getWatchHelpers(t){return new B(t,this.options.followSymlinks,this)}_getWatchedDir(t){let i=p.resolve(t);return this._watched.has(i)||this._watched.set(i,new dt(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,i,n){let r=p.join(t,i),o=p.resolve(r);if(n=n!=null?n:this._watched.has(r)||this._watched.has(o),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,i,!0),this._getWatchedDir(r).getChildren().forEach(m=>this._remove(r,m));let c=this._getWatchedDir(t),h=c.has(i);c.remove(i),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let d=r;if(this.options.cwd&&(d=p.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===g.ADD)return;this._watched.delete(r),this._watched.delete(o);let u=n?g.UNLINK_DIR:g.UNLINK;h&&!this._isIgnored(r)&&this._emit(u,r),this._closePath(r)}_closePath(t){this._closeFile(t);let i=p.dirname(t);this._getWatchedDir(i).remove(p.basename(t))}_closeFile(t){let i=this._closers.get(t);i&&(i.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,i){if(!i)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(i)}_readdirp(t,i){if(this.closed)return;let n=v(b({type:g.ALL,alwaysStat:!0,lstat:!0},i),{depth:0}),r=Tt(t,n);return this._streams.add(r),r.once(kt,()=>{r=void 0}),r.once(ot,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};as={watch:Ut,FSWatcher:C}});import{AlertTriangleIcon as le,InfoIcon as ce,AlertCircleIcon as de}from"lucide-react";import{jsx as yt,jsxs as he}from"react/jsx-runtime";function Z({type:e="info",children:s}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},n={info:ce,warning:le,error:de}[e];return he("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[yt(n,{className:"w-5 h-5 shrink-0"}),yt("div",{children:s})]})}import pe from"next/link";import{LinkIcon as fe}from"lucide-react";function tt(e){return e!=null&&e.length?e.join("/"):""}function Et(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}import{jsx as bt,jsxs as ue}from"react/jsx-runtime";function T({children:e,level:s}){let t=`h${s}`,n=Et(typeof e=="string"?e:"");return ue(t,{id:n,className:"group",children:[bt("a",{className:"not-prose",href:`#${n}`,children:e}),bt(fe,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}import{jsx as y}from"react/jsx-runtime";var Cs={h1:e=>y("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>y(T,v(b({},e),{level:2})),h3:e=>y(T,v(b({},e),{level:3})),h4:e=>y(T,v(b({},e),{level:4})),h5:e=>y(T,v(b({},e),{level:5})),p:e=>y("p",{children:e.children}),hr:e=>y("hr",v(b({},e),{className:"border-gray-200"})),a:e=>e.href.startsWith("http")?y("a",v(b({href:e.href,className:"underline underline-offset-4"},e),{target:"_blank",rel:"noopener noreferrer",children:e.children})):y(pe,v(b({href:e.href,className:"underline underline-offset-4"},e),{children:e.children})),ul:e=>y("ul",{children:e.children}),li:e=>y("li",{children:e.children}),ol:e=>y("ol",{children:e.children}),blockquote:e=>y("blockquote",{className:"not-italic",children:e.children}),pre:e=>y("pre",{className:"not-prose",children:e.children}),Callout:Z,table:e=>y("table",{children:e.children}),thead:e=>y("thead",{children:e.children}),tbody:e=>y("tbody",{children:e.children}),tr:e=>y("tr",{children:e.children}),th:e=>y("th",{children:e.children}),td:e=>y("td",{children:e.children})};import N from"fs";import A from"path";import _t from"fs";import F from"path";import fs from"fs";import us from"gray-matter";import pt from"path";import ys from"fs";var ls=Object.defineProperty,cs=Object.defineProperties,ds=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,qt=(e,s,t)=>s in e?ls(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,G=(e,s)=>{for(var t in s||(s={}))Zt.call(s,t)&&qt(e,t,s[t]);if(V)for(var t of V(s))te.call(s,t)&&qt(e,t,s[t]);return e},q=(e,s)=>cs(e,ds(s)),O=(e=>typeof R!="undefined"?R:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof R!="undefined"?R:s)[t]}):e)(function(e){if(typeof R!="undefined")return R.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),hs=(e,s)=>{var t={};for(var i in e)Zt.call(e,i)&&s.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&V)for(var i of V(e))s.indexOf(i)<0&&te.call(e,i)&&(t[i]=e[i]);return t};function Vt(e){try{let s=fs.readFileSync(e,"utf-8"),{data:t}=us(s);return{title:t.title,icon:t.icon,description:t.description,defaultOpen:t.defaultOpen,collapsible:t.collapsible}}catch(s){return{}}}function ps(e,s="/docs"){return _t.existsSync(e)?ee(e,e,s):[]}function ee(e,s,t){var i;let n=_t.readdirSync(e,{withFileTypes:!0}).sort((o,a)=>{let l=Kt(o.name),c=Kt(a.name);return l!==null&&c!==null?l-c:l!==null?-1:c!==null?1:o.name.localeCompare(a.name)}),r=[];for(let o of n){if(o.name.startsWith("_")||o.name.startsWith("."))continue;let a=F.join(e,o.name);if(o.isDirectory()){let l=L(o.name),c=ms(a),h=ee(a,s,t);if(c){let P=ht(F.relative(s,c).replace(/\\/g,"/")),K=ft(P,t);h=h.filter(X=>!(X.type==="page"&&X.href===K))}if(h.length===0&&!c)continue;let d=Xt(l),u,m=!0,_=!0;if(c){let P=Vt(c);P.title&&(d=P.title),P.icon&&(u=P.icon),P.defaultOpen!==void 0&&(m=P.defaultOpen),P.collapsible!==void 0&&(_=P.collapsible)}let E={type:"section",title:d,children:h,href:c?ft(ht(F.relative(s,c).replace(/\\/g,"/")),t):"",icon:u,defaultOpen:m,collapsible:_};r.push(E)}else if(o.name.endsWith(".md")||o.name.endsWith(".mdx")){let l=F.relative(s,a).replace(/\\/g,"/"),c=ht(l),h=Vt(a),d=o.name.replace(/\.(md|mdx)$/,""),u=L(d),m=ft(c,t),_=u.toLowerCase()==="index",E={type:"page",title:(i=h.title)!=null?i:Xt(_?L(F.basename(e)):u),href:m,icon:h.icon};r.push(E)}}return r}function Kt(e){let s=e.match(/^(\d+)-/);return s?parseInt(s[1],10):null}function L(e){return e.replace(/^\d+-/,"")}function ms(e){let s=_t.readdirSync(e);for(let t of s){let i=L(t);if(i==="index.md"||i==="index.mdx")return F.join(e,t)}return null}function Xt(e){return e.toLowerCase()==="index"?"Home":e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function ht(e){return e.replace(/\\/g,"/").split("/").map(s=>L(s)).join("/").replace(/\/index\.(md|mdx)$/,"").replace(/\.(md|mdx)$/,"").replace(/^index$/,"")}function ft(e,s){return!e||e==="index"||e===""?s:`${s}/${e.startsWith("/")?e.slice(1):e}`}function mt(e,s="/docs"){let t=process.cwd(),i=A.join(t,".docstra"),n=A.join(i,"index.ts");N.existsSync(e)||(console.error(`Content directory not found: ${e}`),console.error(`Please create "${e}" or update "contentDir" in docstra.config.ts`),process.exit(1)),N.existsSync(i)||N.mkdirSync(i,{recursive:!0});let r=se(e);r.length===0&&console.warn(`No .md or .mdx files found in ${e}`);let o=[],a=[];r.forEach((h,d)=>{let u=A.relative(i,h).replace(/\\/g,"/"),m=`d${d}`;o.push(`import * as ${m} from "${u}?docstra";`);let _=A.relative(e,h).replace(/\\/g,"/"),E=ws(_);a.push(`{
1
+ var wt=Object.defineProperty,ie=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var _t=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var J=(e,s,t)=>s in e?wt(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,b=(e,s)=>{for(var t in s||(s={}))ne.call(s,t)&&J(e,t,s[t]);if(_t)for(var t of _t(s))oe.call(s,t)&&J(e,t,s[t]);return e},v=(e,s)=>ie(e,re(s));var R=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof require!="undefined"?require:s)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Q=(e,s)=>()=>(e&&(s=e(e=0)),s);var ae=(e,s)=>{for(var t in s)wt(e,t,{get:s[t],enumerable:!0})};var f=(e,s,t)=>J(e,typeof s!="symbol"?s+"":s,t);import{lstat as bt,readdir as me,realpath as _e,stat as we}from"fs/promises";import{join as ge,relative as ye,resolve as Pt,sep as Ee}from"path";import{Readable as be}from"stream";function It(e,s={}){let t=s.entryType||s.type;if(t==="both"&&(t=x.FILE_DIR_TYPE),t&&(s.type=t),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!xt.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${xt.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return s.root=e,new et(s)}var x,tt,Rt,Pe,xt,xe,ve,De,Re,vt,Dt,et,Tt=Q(()=>{"use strict";x={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},tt={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:x.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(tt);Rt="READDIRP_RECURSIVE_ERROR",Pe=new Set(["ENOENT","EPERM","EACCES","ELOOP",Rt]),xt=[x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE],xe=new Set([x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE]),ve=new Set([x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE]),De=e=>Pe.has(e.code),Re=process.platform==="win32",vt=e=>!0,Dt=e=>{if(e===void 0)return vt;if(typeof e=="function")return e;if(typeof e=="string"){let s=e.trim();return t=>t.basename===s}if(Array.isArray(e)){let s=e.map(t=>t.trim());return t=>s.some(i=>t.basename===i)}return vt},et=class extends be{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});f(this,"parents");f(this,"reading");f(this,"parent");f(this,"_stat");f(this,"_maxDepth");f(this,"_wantsDir");f(this,"_wantsFile");f(this,"_wantsEverything");f(this,"_root");f(this,"_isDirent");f(this,"_statsProp");f(this,"_rdOptions");f(this,"_fileFilter");f(this,"_directoryFilter");let i=b(b({},tt),t),{root:n,type:r}=i;this._fileFilter=Dt(i.fileFilter),this._directoryFilter=Dt(i.directoryFilter);let o=i.lstat?bt:we;Re?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=i.depth!=null&&Number.isSafeInteger(i.depth)?i.depth:tt.depth,this._wantsDir=r?xe.has(r):!1,this._wantsFile=r?ve.has(r):!1,this._wantsEverything=r===x.EVERYTHING_TYPE,this._root=Pt(n),this._isDirent=!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let i=this.parent,n=i&&i.files;if(n&&n.length>0){let{path:r,depth:o}=i,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),l=await Promise.all(a);for(let c of l){if(!c)continue;if(this.destroyed)return;let h=await this._getEntryType(c);h==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),t--)):(h==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i)}finally{this.reading=!1}}}async _exploreDir(t,i){let n;try{n=await me(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:i,path:t}}async _formatEntry(t,i){let n,r=this._isDirent?t.name:t;try{let o=Pt(ge(i,r));n={path:ye(this._root,o),fullPath:o,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(t){De(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let i=t[this._statsProp];if(i.isFile())return"file";if(i.isDirectory())return"directory";if(i&&i.isSymbolicLink()){let n=t.fullPath;try{let r=await _e(n),o=await bt(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===Ee){let l=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return l.code=Rt,this._onError(l)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let i=t&&t[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}}});import{watch as Ie,unwatchFile as St,watchFile as Te}from"fs";import{realpath as st,lstat as Se,open as Fe,stat as Nt}from"fs/promises";import{type as Ne}from"os";import*as w from"path";function Ft(e,s,t,i,n){let r=(o,a)=>{t(e),n(o,a,{watchedPath:e}),a&&e!==a&&H(w.resolve(e,a),I,w.join(e,a))};try{return Ie(e,{persistent:s.persistent},r)}catch(o){i(o);return}}var We,nt,Wt,$,Y,ot,ke,Ce,Ae,kt,g,D,Oe,Le,I,j,S,je,Me,He,rt,W,ze,k,Ct,M,H,$e,it,Ye,z,At=Q(()=>{"use strict";We="data",nt="end",Wt="close",$=()=>{},Y=process.platform,ot=Y==="win32",ke=Y==="darwin",Ce=Y==="linux",Ae=Y==="freebsd",kt=Ne()==="OS400",g={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},D=g,Oe="watch",Le={lstat:Se,stat:Nt},I="listeners",j="errHandlers",S="rawEmitters",je=[I,j,S],Me=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),He=e=>Me.has(w.extname(e).slice(1).toLowerCase()),rt=(e,s)=>{e instanceof Set?e.forEach(s):s(e)},W=(e,s,t)=>{let i=e[s];i instanceof Set||(e[s]=i=new Set([i])),i.add(t)},ze=e=>s=>{let t=e[s];t instanceof Set?t.clear():delete e[s]},k=(e,s,t)=>{let i=e[s];i instanceof Set?i.delete(t):i===t&&delete e[s]},Ct=e=>e instanceof Set?e.size===0:!e,M=new Map;H=(e,s,t,i,n)=>{let r=M.get(e);r&&rt(r[s],o=>{o(t,i,n)})},$e=(e,s,t,i)=>{let{listener:n,errHandler:r,rawEmitter:o}=i,a=M.get(s),l;if(!t.persistent)return l=Ft(e,t,n,r,o),l?l.close.bind(l):void 0;if(a)W(a,I,n),W(a,j,r),W(a,S,o);else{if(l=Ft(e,t,H.bind(null,s,I),r,H.bind(null,s,S)),!l)return;l.on(D.ERROR,async c=>{let h=H.bind(null,s,j);if(a&&(a.watcherUnusable=!0),ot&&c.code==="EPERM")try{await(await Fe(e,"r")).close(),h(c)}catch(d){}else h(c)}),a={listeners:n,errHandlers:r,rawEmitters:o,watcher:l},M.set(s,a)}return()=>{k(a,I,n),k(a,j,r),k(a,S,o),Ct(a.listeners)&&(a.watcher.close(),M.delete(s),je.forEach(ze(a)),a.watcher=void 0,Object.freeze(a))}},it=new Map,Ye=(e,s,t,i)=>{let{listener:n,rawEmitter:r}=i,o=it.get(s),a=o&&o.options;return a&&(a.persistent<t.persistent||a.interval>t.interval)&&(St(s),o=void 0),o?(W(o,I,n),W(o,S,r)):(o={listeners:n,rawEmitters:r,options:t,watcher:Te(s,t,(l,c)=>{rt(o.rawEmitters,d=>{d(D.CHANGE,s,{curr:l,prev:c})});let h=l.mtimeMs;(l.size!==c.size||h>c.mtimeMs||h===0)&&rt(o.listeners,d=>d(e,l))})},it.set(s,o)),()=>{k(o,I,n),k(o,S,r),Ct(o.listeners)&&(it.delete(s),St(s),o.options=o.watcher=void 0,Object.freeze(o))}},z=class{constructor(s){f(this,"fsw");f(this,"_boundHandleError");this.fsw=s,this._boundHandleError=t=>s._handleError(t)}_watchWithNodeFs(s,t){let i=this.fsw.options,n=w.dirname(s),r=w.basename(s);this.fsw._getWatchedDir(n).add(r);let a=w.resolve(s),l={persistent:i.persistent};t||(t=$);let c;if(i.usePolling){let h=i.interval!==i.binaryInterval;l.interval=h&&He(r)?i.binaryInterval:i.interval,c=Ye(s,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else c=$e(s,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(s,t,i){if(this.fsw.closed)return;let n=w.dirname(s),r=w.basename(s),o=this.fsw._getWatchedDir(n),a=t;if(o.has(r))return;let l=async(h,d)=>{if(this.fsw._throttle(Oe,s,5)){if(!d||d.mtimeMs===0)try{let u=await Nt(s);if(this.fsw.closed)return;let m=u.atimeMs,_=u.mtimeMs;if((!m||m<=_||_!==a.mtimeMs)&&this.fsw._emit(D.CHANGE,s,u),(ke||Ce||Ae)&&a.ino!==u.ino){this.fsw._closeFile(h),a=u;let E=this._watchWithNodeFs(s,l);E&&this.fsw._addPathCloser(h,E)}else a=u}catch(u){this.fsw._remove(n,r)}else if(o.has(r)){let u=d.atimeMs,m=d.mtimeMs;(!u||u<=m||m!==a.mtimeMs)&&this.fsw._emit(D.CHANGE,s,d),a=d}}},c=this._watchWithNodeFs(s,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(s)){if(!this.fsw._throttle(D.ADD,s,0))return;this.fsw._emit(D.ADD,s,t)}return c}async _handleSymlink(s,t,i,n){if(this.fsw.closed)return;let r=s.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await st(i)}catch(l){return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(n)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(D.CHANGE,i,s.stats)):(o.add(n),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(D.ADD,i,s.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(s,t,i,n,r,o,a){s=w.join(s,"");let l=n?`${s}:${n}`:s;if(a=this.fsw._throttle("readdir",l,1e3),!a)return;let c=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(s,{fileFilter:u=>i.filterPath(u),directoryFilter:u=>i.filterDir(u)});if(d)return d.on(We,async u=>{if(this.fsw.closed){d=void 0;return}let m=u.path,_=w.join(s,m);if(h.add(m),!(u.stats.isSymbolicLink()&&await this._handleSymlink(u,s,_,m))){if(this.fsw.closed){d=void 0;return}(m===n||!n&&!c.has(m))&&(this.fsw._incrReadyCount(),_=w.join(r,w.relative(r,_)),this._addToNodeFs(_,t,i,o+1))}}).on(D.ERROR,this._boundHandleError),new Promise((u,m)=>{if(!d)return m();d.once(nt,()=>{if(this.fsw.closed){d=void 0;return}let _=a?a.clear():!1;u(void 0),c.getChildren().filter(E=>E!==s&&!h.has(E)).forEach(E=>{this.fsw._remove(s,E)}),d=void 0,_&&this._handleRead(s,!1,i,n,r,o,a)})})}async _handleDir(s,t,i,n,r,o,a){let l=this.fsw._getWatchedDir(w.dirname(s)),c=l.has(w.basename(s));!(i&&this.fsw.options.ignoreInitial)&&!r&&!c&&this.fsw._emit(D.ADD_DIR,s,t),l.add(w.basename(s)),this.fsw._getWatchedDir(s);let h,d,u=this.fsw.options.depth;if((u==null||n<=u)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(s,i,o,r,s,n,h),this.fsw.closed))return;d=this._watchWithNodeFs(s,(m,_)=>{_&&_.mtimeMs===0||this._handleRead(m,!1,o,r,s,n,h)})}return d}async _addToNodeFs(s,t,i,n,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(s)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(s);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await Le[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let c=this.fsw.options.followSymlinks,h;if(l.isDirectory()){let d=w.resolve(s),u=c?await st(s):s;if(this.fsw.closed||(h=await this._handleDir(a.watchPath,l,t,n,r,a,u),this.fsw.closed))return;d!==u&&u!==void 0&&this.fsw._symlinkPaths.set(d,u)}else if(l.isSymbolicLink()){let d=c?await st(s):s;if(this.fsw.closed)return;let u=w.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(D.ADD,a.watchPath,l),h=await this._handleDir(u,l,t,n,s,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(s),d)}else h=this._handleFile(a.watchPath,l,t);return o(),h&&this.fsw._addPathCloser(s,h),!1}catch(l){if(this.fsw._handleError(l))return o(),s}}}});var Ut={};ae(Ut,{FSWatcher:()=>C,WatchHelper:()=>G,default:()=>as,watch:()=>Yt});import{EventEmitter as Ue}from"events";import{stat as Ge}from"fs";import{readdir as Be,stat as qe}from"fs/promises";import*as p from"path";function U(e){return Array.isArray(e)?e:[e]}function ts(e){return typeof e=="function"?e:typeof e=="string"?s=>e===s:e instanceof RegExp?s=>e.test(s):typeof e=="object"&&e!==null?s=>{if(e.path===s)return!0;if(e.recursive){let t=p.relative(e.path,s);return t?!t.startsWith("..")&&!p.isAbsolute(t):!1}return!1}:()=>!1}function es(e){if(typeof e!="string")throw new Error("string expected");e=p.normalize(e),e=e.replace(/\\/g,"/");let s=!1;return e.startsWith("//")&&(s=!0),e=e.replace(zt,"/"),s&&(e="/"+e),e}function Ot(e,s,t){let i=es(s);for(let n=0;n<e.length;n++){let r=e[n];if(r(i,t))return!0}return!1}function ss(e,s){if(e==null)throw new TypeError("anymatch: specify first argument");let i=U(e).map(n=>ts(n));return s==null?(n,r)=>Ot(i,n,r):Ot(i,s)}function Yt(e,s={}){let t=new C(s);return t.add(e),t}var at,Ve,Ht,Ke,Xe,Je,zt,Qe,Ze,lt,Lt,jt,$t,Mt,is,rs,ct,ns,os,G,C,as,Gt=Q(()=>{"use strict";Tt();At();at="/",Ve="//",Ht=".",Ke="..",Xe="string",Je=/\\/g,zt=/\/\//g,Qe=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Ze=/^\.[/\\]/;lt=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);Lt=e=>{let s=U(e).flat();if(!s.every(t=>typeof t===Xe))throw new TypeError(`Non-string provided as watch path: ${s}`);return s.map($t)},jt=e=>{let s=e.replace(Je,at),t=!1;return s.startsWith(Ve)&&(t=!0),s=s.replace(zt,at),t&&(s=at+s),s},$t=e=>jt(p.normalize(jt(e))),Mt=(e="")=>s=>typeof s=="string"?$t(p.isAbsolute(s)?s:p.join(e,s)):s,is=(e,s)=>p.isAbsolute(e)?e:p.join(s,e),rs=Object.freeze(new Set),ct=class{constructor(s,t){f(this,"path");f(this,"_removeWatcher");f(this,"items");this.path=s,this._removeWatcher=t,this.items=new Set}add(s){let{items:t}=this;t&&s!==Ht&&s!==Ke&&t.add(s)}async remove(s){let{items:t}=this;if(!t||(t.delete(s),t.size>0))return;let i=this.path;try{await Be(i)}catch(n){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(s){let{items:t}=this;if(t)return t.has(s)}getChildren(){let{items:s}=this;return s?[...s.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=$,this.items=rs,Object.freeze(this)}},ns="stat",os="lstat",G=class{constructor(s,t,i){f(this,"fsw");f(this,"path");f(this,"watchPath");f(this,"fullWatchPath");f(this,"dirParts");f(this,"followSymlinks");f(this,"statMethod");this.fsw=i;let n=s;this.path=s=s.replace(Ze,""),this.watchPath=n,this.fullWatchPath=p.resolve(n),this.dirParts=[],this.dirParts.forEach(r=>{r.length>1&&r.pop()}),this.followSymlinks=t,this.statMethod=t?ns:os}entryPath(s){return p.join(this.watchPath,p.relative(this.watchPath,s.fullPath))}filterPath(s){let{stats:t}=s;if(t&&t.isSymbolicLink())return this.filterDir(s);let i=this.entryPath(s);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(s){return this.fsw._isntIgnored(this.entryPath(s),s.stats)}},C=class extends Ue{constructor(t={}){super();f(this,"closed");f(this,"options");f(this,"_closers");f(this,"_ignoredPaths");f(this,"_throttled");f(this,"_streams");f(this,"_symlinkPaths");f(this,"_watched");f(this,"_pendingWrites");f(this,"_pendingUnlinks");f(this,"_readyCount");f(this,"_emitReady");f(this,"_closePromise");f(this,"_userIgnored");f(this,"_readyEmitted");f(this,"_emitRaw");f(this,"_boundRemove");f(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let i=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r=v(b({persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0},t),{ignored:t.ignored?U(t.ignored):U([]),awaitWriteFinish:i===!0?n:typeof i=="object"?b(b({},n),i):!1});kt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let c=o.toLowerCase();c==="false"||c==="0"?r.usePolling=!1:c==="true"||c==="1"?r.usePolling=!0:r.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let l=0;this._emitReady=()=>{l++,l>=this._readyCount&&(this._emitReady=$,this._readyEmitted=!0,process.nextTick(()=>this.emit(g.READY)))},this._emitRaw=(...c)=>this.emit(g.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new z(this),Object.freeze(r)}_addIgnoredPath(t){if(lt(t)){for(let i of this._ignoredPaths)if(lt(i)&&i.path===t.path&&i.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let i of this._ignoredPaths)lt(i)&&i.path===t&&this._ignoredPaths.delete(i)}add(t,i,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Lt(t);return r&&(o=o.map(a=>is(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,i);return l&&this._emitReady(),l})).then(a=>{this.closed||a.forEach(l=>{l&&this.add(p.dirname(l),p.basename(i||l))})}),this}unwatch(t){if(this.closed)return this;let i=Lt(t),{cwd:n}=this.options;return i.forEach(r=>{!p.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=p.join(n,r)),r=p.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(i=>i.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((i,n)=>{let o=(this.options.cwd?p.relative(this.options.cwd,n):n)||Ht;t[o]=i.getChildren().sort()}),t}emitWithAll(t,i){this.emit(t,...i),t!==g.ERROR&&this.emit(g.ALL,t,...i)}async _emit(t,i,n){if(this.closed)return;let r=this.options;ot&&(i=p.normalize(i)),r.cwd&&(i=p.relative(r.cwd,i));let o=[i];n!=null&&o.push(n);let a=r.awaitWriteFinish,l;if(a&&(l=this._pendingWrites.get(i)))return l.lastChange=new Date,this;if(r.atomic){if(t===g.UNLINK)return this._pendingUnlinks.set(i,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((c,h)=>{this.emit(...c),this.emit(g.ALL,...c),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===g.ADD&&this._pendingUnlinks.has(i)&&(t=g.CHANGE,this._pendingUnlinks.delete(i))}if(a&&(t===g.ADD||t===g.CHANGE)&&this._readyEmitted){let c=(h,d)=>{h?(t=g.ERROR,o[0]=h,this.emitWithAll(t,o)):d&&(o.length>1?o[1]=d:o.push(d),this.emitWithAll(t,o))};return this._awaitWriteFinish(i,a.stabilityThreshold,t,c),this}if(t===g.CHANGE&&!this._throttle(g.CHANGE,i,50))return this;if(r.alwaysStat&&n===void 0&&(t===g.ADD||t===g.ADD_DIR||t===g.CHANGE)){let c=r.cwd?p.join(r.cwd,i):i,h;try{h=await qe(c)}catch(d){}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let i=t&&t.code;return t&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(g.ERROR,t),t||this.closed}_throttle(t,i,n){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(i);if(o)return o.count++,!1;let a,l=()=>{let h=r.get(i),d=h?h.count:0;return r.delete(i),clearTimeout(a),h&&clearTimeout(h.timeoutObject),d};a=setTimeout(l,n);let c={timeoutObject:a,clear:l,count:0};return r.set(i,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,i,n,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,l,c=t;this.options.cwd&&!p.isAbsolute(t)&&(c=p.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;function u(m){Ge(c,(_,E)=>{if(_||!d.has(t)){_&&_.code!=="ENOENT"&&r(_);return}let P=Number(new Date);m&&E.size!==m.size&&(d.get(t).lastChange=P);let K=d.get(t);P-K.lastChange>=i?(d.delete(t),r(void 0,E)):l=setTimeout(u,a,E)})}d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(l),n)}),l=setTimeout(u,a))}_isIgnored(t,i){if(this.options.atomic&&Qe.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,o=(this.options.ignored||[]).map(Mt(n)),l=[...[...this._ignoredPaths].map(Mt(n)),...o];this._userIgnored=ss(l,void 0)}return this._userIgnored(t,i)}_isntIgnored(t,i){return!this._isIgnored(t,i)}_getWatchHelpers(t){return new G(t,this.options.followSymlinks,this)}_getWatchedDir(t){let i=p.resolve(t);return this._watched.has(i)||this._watched.set(i,new ct(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,i,n){let r=p.join(t,i),o=p.resolve(r);if(n=n!=null?n:this._watched.has(r)||this._watched.has(o),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,i,!0),this._getWatchedDir(r).getChildren().forEach(m=>this._remove(r,m));let c=this._getWatchedDir(t),h=c.has(i);c.remove(i),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let d=r;if(this.options.cwd&&(d=p.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===g.ADD)return;this._watched.delete(r),this._watched.delete(o);let u=n?g.UNLINK_DIR:g.UNLINK;h&&!this._isIgnored(r)&&this._emit(u,r),this._closePath(r)}_closePath(t){this._closeFile(t);let i=p.dirname(t);this._getWatchedDir(i).remove(p.basename(t))}_closeFile(t){let i=this._closers.get(t);i&&(i.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,i){if(!i)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(i)}_readdirp(t,i){if(this.closed)return;let n=v(b({type:g.ALL,alwaysStat:!0,lstat:!0},i),{depth:0}),r=It(t,n);return this._streams.add(r),r.once(Wt,()=>{r=void 0}),r.once(nt,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};as={watch:Yt,FSWatcher:C}});import{AlertTriangleIcon as le,InfoIcon as ce,AlertCircleIcon as de}from"lucide-react";import{jsx as gt,jsxs as he}from"react/jsx-runtime";function Z({type:e="info",children:s}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},n={info:ce,warning:le,error:de}[e];return he("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[gt(n,{className:"w-5 h-5 shrink-0"}),gt("div",{children:s})]})}import pe from"next/link";import{LinkIcon as fe}from"lucide-react";function yt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}import{jsx as Et,jsxs as ue}from"react/jsx-runtime";function T({children:e,level:s}){let t=`h${s}`,n=yt(typeof e=="string"?e:"");return ue(t,{id:n,className:"group",children:[Et("a",{className:"not-prose",href:`#${n}`,children:e}),Et(fe,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}import{jsx as y}from"react/jsx-runtime";var Cs={h1:e=>y("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>y(T,v(b({},e),{level:2})),h3:e=>y(T,v(b({},e),{level:3})),h4:e=>y(T,v(b({},e),{level:4})),h5:e=>y(T,v(b({},e),{level:5})),p:e=>y("p",{children:e.children}),hr:e=>y("hr",v(b({},e),{className:"border-gray-200"})),a:e=>e.href.startsWith("http")?y("a",v(b({href:e.href,className:"underline underline-offset-4"},e),{target:"_blank",rel:"noopener noreferrer",children:e.children})):y(pe,v(b({href:e.href,className:"underline underline-offset-4"},e),{children:e.children})),ul:e=>y("ul",{children:e.children}),li:e=>y("li",{children:e.children}),ol:e=>y("ol",{children:e.children}),blockquote:e=>y("blockquote",{className:"not-italic",children:e.children}),pre:e=>y("pre",{className:"not-prose",children:e.children}),Callout:Z,table:e=>y("table",{children:e.children}),thead:e=>y("thead",{children:e.children}),tbody:e=>y("tbody",{children:e.children}),tr:e=>y("tr",{children:e.children}),th:e=>y("th",{children:e.children}),td:e=>y("td",{children:e.children})};import N from"fs";import A from"path";import mt from"fs";import F from"path";import fs from"fs";import us from"gray-matter";import ut from"path";import ys from"fs";var ls=Object.defineProperty,cs=Object.defineProperties,ds=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,Bt=(e,s,t)=>s in e?ls(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,B=(e,s)=>{for(var t in s||(s={}))Zt.call(s,t)&&Bt(e,t,s[t]);if(V)for(var t of V(s))te.call(s,t)&&Bt(e,t,s[t]);return e},q=(e,s)=>cs(e,ds(s)),O=(e=>typeof R!="undefined"?R:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof R!="undefined"?R:s)[t]}):e)(function(e){if(typeof R!="undefined")return R.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),hs=(e,s)=>{var t={};for(var i in e)Zt.call(e,i)&&s.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&V)for(var i of V(e))s.indexOf(i)<0&&te.call(e,i)&&(t[i]=e[i]);return t};function qt(e){try{let s=fs.readFileSync(e,"utf-8"),{data:t}=us(s);return{title:t.title,icon:t.icon,description:t.description,defaultOpen:t.defaultOpen,collapsible:t.collapsible}}catch(s){return{}}}function ps(e,s="/docs"){return mt.existsSync(e)?ee(e,e,s):[]}function ee(e,s,t){var i;let n=mt.readdirSync(e,{withFileTypes:!0}).sort((o,a)=>{let l=Vt(o.name),c=Vt(a.name);return l!==null&&c!==null?l-c:l!==null?-1:c!==null?1:o.name.localeCompare(a.name)}),r=[];for(let o of n){if(o.name.startsWith("_")||o.name.startsWith("."))continue;let a=F.join(e,o.name);if(o.isDirectory()){let l=L(o.name),c=ms(a),h=ee(a,s,t);if(c){let P=dt(F.relative(s,c).replace(/\\/g,"/")),K=ht(P,t);h=h.filter(X=>!(X.type==="page"&&X.href===K))}if(h.length===0&&!c)continue;let d=Kt(l),u,m=!0,_=!0;if(c){let P=qt(c);P.title&&(d=P.title),P.icon&&(u=P.icon),P.defaultOpen!==void 0&&(m=P.defaultOpen),P.collapsible!==void 0&&(_=P.collapsible)}let E={type:"section",title:d,children:h,href:c?ht(dt(F.relative(s,c).replace(/\\/g,"/")),t):"",icon:u,defaultOpen:m,collapsible:_};r.push(E)}else if(o.name.endsWith(".md")||o.name.endsWith(".mdx")){let l=F.relative(s,a).replace(/\\/g,"/"),c=dt(l),h=qt(a),d=o.name.replace(/\.(md|mdx)$/,""),u=L(d),m=ht(c,t),_=u.toLowerCase()==="index",E={type:"page",title:(i=h.title)!=null?i:Kt(_?L(F.basename(e)):u),href:m,icon:h.icon};r.push(E)}}return r}function Vt(e){let s=e.match(/^(\d+)-/);return s?parseInt(s[1],10):null}function L(e){return e.replace(/^\d+-/,"")}function ms(e){let s=mt.readdirSync(e);for(let t of s){let i=L(t);if(i==="index.md"||i==="index.mdx")return F.join(e,t)}return null}function Kt(e){return e.toLowerCase()==="index"?"Home":e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function dt(e){return e.replace(/\\/g,"/").split("/").map(s=>L(s)).join("/").replace(/\/index\.(md|mdx)$/,"").replace(/\.(md|mdx)$/,"").replace(/^index$/,"")}function ht(e,s){return!e||e==="index"||e===""?s:`${s}/${e.startsWith("/")?e.slice(1):e}`}function pt(e,s="/docs"){let t=process.cwd(),i=A.join(t,".docstra"),n=A.join(i,"index.ts");N.existsSync(e)||(console.error(`Content directory not found: ${e}`),console.error(`Please create "${e}" or update "contentDir" in docstra.config.ts`),process.exit(1)),N.existsSync(i)||N.mkdirSync(i,{recursive:!0});let r=se(e);r.length===0&&console.warn(`No .md or .mdx files found in ${e}`);let o=[],a=[];r.forEach((h,d)=>{let u=A.relative(i,h).replace(/\\/g,"/"),m=`d${d}`;o.push(`import * as ${m} from "${u}?docstra";`);let _=A.relative(e,h).replace(/\\/g,"/"),E=ws(_);a.push(`{
2
2
  slug: "${E}",
3
3
  path: "${_}",
4
4
  data: {
@@ -19,7 +19,7 @@ export const docs = [
19
19
  ];
20
20
 
21
21
  export const sidebarItems: SidebarItem[] = ${JSON.stringify(l,null,2)} as SidebarItem[];
22
- `;N.writeFileSync(n,c,"utf8")}function se(e){return N.readdirSync(e).flatMap(s=>{let t=A.join(e,s);return N.statSync(t).isDirectory()?se(t):s.endsWith(".md")||s.endsWith(".mdx")?[t]:[]})}function _s(e){return e.replace(/^\d+-/,"")}function ws(e){return e.replace(/\\/g,"/").split("/").map(s=>_s(s)).join("/").replace(/\.(md|mdx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")}var Jt=!1,ut=null;async function gs(e){if(Jt)return;Jt=!0,await mt(e);let{FSWatcher:s}=await Promise.resolve().then(()=>(Gt(),Bt)),t="docstra.config.ts",i=new s({ignoreInitial:!0,persistent:!0,ignored:["node_modules",".next"]});i.add([e,t]),console.log("\x1B[32m \u2713 \x1B[0mDocstra dev server started..."),i.on("all",async(n,r)=>{!r.endsWith(".md")&&!r.endsWith(".mdx")&&!r.endsWith("docstra.config.ts")||(ut&&clearTimeout(ut),ut=setTimeout(async()=>{await mt(e)},200),console.info("MDX content rebuilt successfully"))}),process.on("exit",()=>{i.closed||i.close()})}var Es="docs/content";function bs(){var e;let s=process.cwd(),t=pt.join(s,"docstra.config.ts"),i={};if(ys.existsSync(t))try{delete O.cache[O.resolve(t)];let r=O(t);i=(e=r.default)!=null?e:r}catch(r){console.error("Failed to load docstra.config.ts",r),process.exit(1)}else console.warn("No docstra.config.ts found, using defaults");let n=i.contentDir?pt.resolve(s,i.contentDir):pt.join(s,Es);return{root:s,contentDir:n,userConfig:i}}var Qt=!1;function di(e={}){var s,t;let i=process.env.NODE_ENV==="development",n=process.env.NODE_ENV==="production",r=bs().contentDir;Qt||(Qt=!0,i&&gs(r),n&&(mt(r),console.log("\x1B[32m \u2713 \x1B[0mDocstra MDX index generated successfully")));let o=q(G({},e.turbopack),{rules:q(G({},(s=e.turbopack)==null?void 0:s.rules),{"*.{md,mdx}":{loaders:[{loader:O.resolve("./loader")}],as:"*.js"}})});return q(G({},e),{turbopack:o,pageExtensions:(t=e.pageExtensions)!=null?t:["ts","tsx","js","jsx","md","mdx"],webpack:(a,l)=>(a.module.rules.push({test:/\.(md|mdx)$/,resourceQuery:/docstra/,use:[{loader:O.resolve("./loader")}]}),typeof e.webpack=="function"?e.webpack(a,l):a)})}function fi(e,s){return{getPage:t=>{let i=e.find(a=>a.slug===tt(t));if(!i)return null;let n=i.data,{body:r}=n,o=hs(n,["body"]);return q(G({},o),{slug:i.slug,path:i.path})},getPageBody:t=>{let i=e.find(n=>n.slug===tt(t));return i?i.data.body:null},generateStaticParams:()=>e.map(t=>({slug:t.slug===""?[]:t.slug.split("/")})),generateSitemap:({baseUrl:t,lastmod:i,changefreq:n,priority:r})=>e.map(o=>{let a=o.slug===""?"":o.slug.replace(/\/?index$/,"");return{url:`${t}/${a}`.replace(/\/$/,""),lastModified:i,changeFrequency:n,priority:r}}),sidebarItems:s!=null?s:[]}}function ui(e,s){return s.find(t=>t.slug===((e==null?void 0:e.filter(Boolean).join("/"))||""))}function pi(e){return e}export{fi as createSource,Cs as defaultMdxComponents,pi as defineDocstraConfig,ps as generateSidebar,ui as getPageData,bs as loadDocstraConfig,mt as runDocstraBuild,gs as runDocstraDev,di as withDocstra};
22
+ `;N.writeFileSync(n,c,"utf8")}function se(e){return N.readdirSync(e).flatMap(s=>{let t=A.join(e,s);return N.statSync(t).isDirectory()?se(t):s.endsWith(".md")||s.endsWith(".mdx")?[t]:[]})}function _s(e){return e.replace(/^\d+-/,"")}function ws(e){return e.replace(/\\/g,"/").split("/").map(s=>_s(s)).join("/").replace(/\.(md|mdx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")}var Xt=!1,ft=null;async function gs(e){if(Xt)return;Xt=!0,await pt(e);let{FSWatcher:s}=await Promise.resolve().then(()=>(Gt(),Ut)),t="docstra.config.ts",i=new s({ignoreInitial:!0,persistent:!0,ignored:["node_modules",".next"]});i.add([e,t]),console.log("\x1B[32m \u2713 \x1B[0mDocstra dev server started..."),i.on("all",async(n,r)=>{!r.endsWith(".md")&&!r.endsWith(".mdx")&&!r.endsWith("docstra.config.ts")||(ft&&clearTimeout(ft),ft=setTimeout(async()=>{await pt(e)},200),console.info("MDX content rebuilt successfully"))}),process.on("exit",()=>{i.closed||i.close()})}var Es="docs/content";function bs(){var e;let s=process.cwd(),t=ut.join(s,"docstra.config.ts"),i={};if(ys.existsSync(t))try{delete O.cache[O.resolve(t)];let r=O(t);i=(e=r.default)!=null?e:r}catch(r){console.error("Failed to load docstra.config.ts",r),process.exit(1)}else console.warn("No docstra.config.ts found, using defaults");let n=i.contentDir?ut.resolve(s,i.contentDir):ut.join(s,Es);return{root:s,contentDir:n,userConfig:i}}var Jt=!1;function di(e={}){var s,t;let i=process.env.NODE_ENV==="development",n=process.env.NODE_ENV==="production",r=bs().contentDir;Jt||(Jt=!0,i&&gs(r),n&&(pt(r),console.log("\x1B[32m \u2713 \x1B[0mDocstra MDX index generated successfully")));let o=q(B({},e.turbopack),{rules:q(B({},(s=e.turbopack)==null?void 0:s.rules),{"*.{md,mdx}":{loaders:[{loader:O.resolve("./loader")}],as:"*.js"}})});return q(B({},e),{turbopack:o,pageExtensions:(t=e.pageExtensions)!=null?t:["ts","tsx","js","jsx","md","mdx"],webpack:(a,l)=>(a.module.rules.push({test:/\.(md|mdx)$/,resourceQuery:/docstra/,use:[{loader:O.resolve("./loader")}]}),typeof e.webpack=="function"?e.webpack(a,l):a)})}function Qt(e){return e!=null&&e.length?e.join("/"):""}function hi(e,s){return{getPage:t=>{let i=e.find(a=>a.slug===Qt(t));if(!i)return null;let n=i.data,{body:r}=n,o=hs(n,["body"]);return q(B({},o),{slug:i.slug,path:i.path})},getPageBody:t=>{let i=e.find(n=>n.slug===Qt(t));return i?i.data.body:null},generateStaticParams:()=>e.map(t=>({slug:t.slug===""?[]:t.slug.split("/")})),generateSitemap:({baseUrl:t,lastmod:i,changefreq:n,priority:r})=>e.map(o=>{let a=o.slug===""?"":o.slug.replace(/\/?index$/,"");return{url:`${t}/${a}`.replace(/\/$/,""),lastModified:i,changeFrequency:n,priority:r}}),sidebarItems:s!=null?s:[]}}function fi(e,s){return s.find(t=>t.slug===((e==null?void 0:e.filter(Boolean).join("/"))||""))}function ui(e){return e}export{hi as createSource,Cs as defaultMdxComponents,ui as defineDocstraConfig,ps as generateSidebar,fi as getPageData,bs as loadDocstraConfig,pt as runDocstraBuild,gs as runDocstraDev,di as withDocstra};
23
23
  /*! Bundled license information:
24
24
 
25
25
  chokidar/index.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docstra",
3
- "version": "1.9.9-next.1",
3
+ "version": "1.9.9-next.2",
4
4
  "description": "The Modern Documentation Framework for Next.js",
5
5
  "files": [
6
6
  "dist"
@@ -32,7 +32,6 @@
32
32
  "tsup": "^8.5.1",
33
33
  "typescript": "^5.9.3",
34
34
  "@docstra/eslint-config": "1.0.0",
35
- "@docstra/utils": "1.0.0",
36
35
  "docstra-mdx": "0.0.1",
37
36
  "@docstra/typescript-config": "1.0.0"
38
37
  },