@devwareng/vanilla-ts 1.9.100 → 1.9.102
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/index.cjs +18 -16
- package/dist/index.js +21 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
"use strict";var xe=Object.create;var B=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var it=(s,t)=>()=>(s&&(t=s(s=0)),t);var qt=(s,t)=>{for(var e in t)B(s,e,{get:t[e],enumerable:!0})},Yt=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ae(t))!Ce.call(s,n)&&n!==e&&B(s,n,{get:()=>t[n],enumerable:!(r=De(t,n))||r.enumerable});return s};var v=(s,t,e)=>(e=s!=null?xe(Me(s)):{},Yt(t||!s||!s.__esModule?B(e,"default",{value:s,enumerable:!0}):e,s)),Oe=s=>Yt(B({},"__esModule",{value:!0}),s);function ae(s,t={}){let e=t.entryType||t.type;if(e==="both"&&(e=R.FILE_DIR_TYPE),e&&(t.type=e),s){if(typeof s!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(e&&!se.includes(e))throw new Error(`readdirp: Invalid type passed. Use one of ${se.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=s,new It(t)}var M,ie,C,R,Ft,oe,$e,se,We,je,Ue,qe,ne,re,It,ce=it(()=>{"use strict";M=require("fs/promises"),ie=require("stream"),C=require("path"),R={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},Ft={root:".",fileFilter:s=>!0,directoryFilter:s=>!0,type:R.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(Ft);oe="READDIRP_RECURSIVE_ERROR",$e=new Set(["ENOENT","EPERM","EACCES","ELOOP",oe]),se=[R.DIR_TYPE,R.EVERYTHING_TYPE,R.FILE_DIR_TYPE,R.FILE_TYPE],We=new Set([R.DIR_TYPE,R.EVERYTHING_TYPE,R.FILE_DIR_TYPE]),je=new Set([R.EVERYTHING_TYPE,R.FILE_DIR_TYPE,R.FILE_TYPE]),Ue=s=>$e.has(s.code),qe=process.platform==="win32",ne=s=>!0,re=s=>{if(s===void 0)return ne;if(typeof s=="function")return s;if(typeof s=="string"){let t=s.trim();return e=>e.basename===t}if(Array.isArray(s)){let t=s.map(e=>e.trim());return e=>t.some(r=>e.basename===r)}return ne},It=class extends ie.Readable{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});let e={...Ft,...t},{root:r,type:n}=e;this._fileFilter=re(e.fileFilter),this._directoryFilter=re(e.directoryFilter);let i=e.lstat?M.lstat:M.stat;qe?this._stat=a=>i(a,{bigint:!0}):this._stat=i,this._maxDepth=e.depth??Ft.depth,this._wantsDir=n?We.has(n):!1,this._wantsFile=n?je.has(n):!1,this._wantsEverything=n===R.EVERYTHING_TYPE,this._root=(0,C.resolve)(r),this._isDirent=!e.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(r,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let e=this.parent,r=e&&e.files;if(r&&r.length>0){let{path:n,depth:i}=e,a=r.splice(0,t).map(c=>this._formatEntry(c,n)),o=await Promise.all(a);for(let c of o){if(!c)continue;if(this.destroyed)return;let l=await this._getEntryType(c);l==="directory"&&this._directoryFilter(c)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,i+1)),this._wantsDir&&(this.push(c),t--)):(l==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let n=this.parents.pop();if(!n){this.push(null);break}if(this.parent=await n,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(t,e){let r;try{r=await(0,M.readdir)(t,this._rdOptions)}catch(n){this._onError(n)}return{files:r,depth:e,path:t}}async _formatEntry(t,e){let r,n=this._isDirent?t.name:t;try{let i=(0,C.resolve)((0,C.join)(e,n));r={path:(0,C.relative)(this._root,i),fullPath:i,basename:n},r[this._statsProp]=this._isDirent?t:await this._stat(i)}catch(i){this._onError(i);return}return r}_onError(t){Ue(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let e=t[this._statsProp];if(e.isFile())return"file";if(e.isDirectory())return"directory";if(e&&e.isSymbolicLink()){let r=t.fullPath;try{let n=await(0,M.realpath)(r),i=await(0,M.lstat)(n);if(i.isFile())return"file";if(i.isDirectory()){let a=n.length;if(r.startsWith(n)&&r.substr(a,1)===C.sep){let o=new Error(`Circular symlink detected: "${r}" points to "${n}"`);return o.code=oe,this._onError(o)}return"directory"}}catch(n){return this._onError(n),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}}});function le(s,t,e,r,n){let i=(a,o)=>{e(s),n(a,o,{watchedPath:s}),o&&s!==o&&J(E.resolve(s,o),F,E.join(s,o))};try{return(0,I.watch)(s,{persistent:t.persistent},i)}catch(a){r(a);return}}var I,b,E,ue,Ye,Nt,de,tt,et,zt,Be,Ge,Ve,he,T,L,Ke,Qe,F,Q,k,Ze,Je,Xe,kt,W,ts,j,fe,Z,J,es,Ht,ss,X,me=it(()=>{"use strict";I=require("fs"),b=require("fs/promises"),E=v(require("path"),1),ue=require("os"),Ye="data",Nt="end",de="close",tt=()=>{},et=process.platform,zt=et==="win32",Be=et==="darwin",Ge=et==="linux",Ve=et==="freebsd",he=(0,ue.type)()==="OS400",T={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},L=T,Ke="watch",Qe={lstat:b.lstat,stat:b.stat},F="listeners",Q="errHandlers",k="rawEmitters",Ze=[F,Q,k],Je=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"]),Xe=s=>Je.has(E.extname(s).slice(1).toLowerCase()),kt=(s,t)=>{s instanceof Set?s.forEach(t):t(s)},W=(s,t,e)=>{let r=s[t];r instanceof Set||(s[t]=r=new Set([r])),r.add(e)},ts=s=>t=>{let e=s[t];e instanceof Set?e.clear():delete s[t]},j=(s,t,e)=>{let r=s[t];r instanceof Set?r.delete(e):r===e&&delete s[t]},fe=s=>s instanceof Set?s.size===0:!s,Z=new Map;J=(s,t,e,r,n)=>{let i=Z.get(s);i&&kt(i[t],a=>{a(e,r,n)})},es=(s,t,e,r)=>{let{listener:n,errHandler:i,rawEmitter:a}=r,o=Z.get(t),c;if(!e.persistent)return c=le(s,e,n,i,a),c?c.close.bind(c):void 0;if(o)W(o,F,n),W(o,Q,i),W(o,k,a);else{if(c=le(s,e,J.bind(null,t,F),i,J.bind(null,t,k)),!c)return;c.on(L.ERROR,async l=>{let u=J.bind(null,t,Q);if(o&&(o.watcherUnusable=!0),zt&&l.code==="EPERM")try{await(await(0,b.open)(s,"r")).close(),u(l)}catch{}else u(l)}),o={listeners:n,errHandlers:i,rawEmitters:a,watcher:c},Z.set(t,o)}return()=>{j(o,F,n),j(o,Q,i),j(o,k,a),fe(o.listeners)&&(o.watcher.close(),Z.delete(t),Ze.forEach(ts(o)),o.watcher=void 0,Object.freeze(o))}},Ht=new Map,ss=(s,t,e,r)=>{let{listener:n,rawEmitter:i}=r,a=Ht.get(t),o=a&&a.options;return o&&(o.persistent<e.persistent||o.interval>e.interval)&&((0,I.unwatchFile)(t),a=void 0),a?(W(a,F,n),W(a,k,i)):(a={listeners:n,rawEmitters:i,options:e,watcher:(0,I.watchFile)(t,e,(c,l)=>{kt(a.rawEmitters,d=>{d(L.CHANGE,t,{curr:c,prev:l})});let u=c.mtimeMs;(c.size!==l.size||u>l.mtimeMs||u===0)&&kt(a.listeners,d=>d(s,c))})},Ht.set(t,a)),()=>{j(a,F,n),j(a,k,i),fe(a.listeners)&&(Ht.delete(t),(0,I.unwatchFile)(t),a.options=a.watcher=void 0,Object.freeze(a))}},X=class{constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e)}_watchWithNodeFs(t,e){let r=this.fsw.options,n=E.dirname(t),i=E.basename(t);this.fsw._getWatchedDir(n).add(i);let o=E.resolve(t),c={persistent:r.persistent};e||(e=tt);let l;if(r.usePolling){let u=r.interval!==r.binaryInterval;c.interval=u&&Xe(i)?r.binaryInterval:r.interval,l=ss(t,o,c,{listener:e,rawEmitter:this.fsw._emitRaw})}else l=es(t,o,c,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(t,e,r){if(this.fsw.closed)return;let n=E.dirname(t),i=E.basename(t),a=this.fsw._getWatchedDir(n),o=e;if(a.has(i))return;let c=async(u,d)=>{if(this.fsw._throttle(Ke,t,5)){if(!d||d.mtimeMs===0)try{let h=await(0,b.stat)(t);if(this.fsw.closed)return;let f=h.atimeMs,y=h.mtimeMs;if((!f||f<=y||y!==o.mtimeMs)&&this.fsw._emit(L.CHANGE,t,h),(Be||Ge||Ve)&&o.ino!==h.ino){this.fsw._closeFile(u),o=h;let p=this._watchWithNodeFs(t,c);p&&this.fsw._addPathCloser(u,p)}else o=h}catch{this.fsw._remove(n,i)}else if(a.has(i)){let h=d.atimeMs,f=d.mtimeMs;(!h||h<=f||f!==o.mtimeMs)&&this.fsw._emit(L.CHANGE,t,d),o=d}}},l=this._watchWithNodeFs(t,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(L.ADD,t,0))return;this.fsw._emit(L.ADD,t,e)}return l}async _handleSymlink(t,e,r,n){if(this.fsw.closed)return;let i=t.fullPath,a=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let o;try{o=await(0,b.realpath)(r)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(n)?this.fsw._symlinkPaths.get(i)!==o&&(this.fsw._symlinkPaths.set(i,o),this.fsw._emit(L.CHANGE,r,t.stats)):(a.add(n),this.fsw._symlinkPaths.set(i,o),this.fsw._emit(L.ADD,r,t.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(t,e,r,n,i,a,o){if(t=E.join(t,""),o=this.fsw._throttle("readdir",t,1e3),!o)return;let c=this.fsw._getWatchedDir(r.path),l=new Set,u=this.fsw._readdirp(t,{fileFilter:d=>r.filterPath(d),directoryFilter:d=>r.filterDir(d)});if(u)return u.on(Ye,async d=>{if(this.fsw.closed){u=void 0;return}let h=d.path,f=E.join(t,h);if(l.add(h),!(d.stats.isSymbolicLink()&&await this._handleSymlink(d,t,f,h))){if(this.fsw.closed){u=void 0;return}(h===n||!n&&!c.has(h))&&(this.fsw._incrReadyCount(),f=E.join(i,E.relative(i,f)),this._addToNodeFs(f,e,r,a+1))}}).on(L.ERROR,this._boundHandleError),new Promise((d,h)=>{if(!u)return h();u.once(Nt,()=>{if(this.fsw.closed){u=void 0;return}let f=o?o.clear():!1;d(void 0),c.getChildren().filter(y=>y!==t&&!l.has(y)).forEach(y=>{this.fsw._remove(t,y)}),u=void 0,f&&this._handleRead(t,!1,r,n,i,a,o)})})}async _handleDir(t,e,r,n,i,a,o){let c=this.fsw._getWatchedDir(E.dirname(t)),l=c.has(E.basename(t));!(r&&this.fsw.options.ignoreInitial)&&!i&&!l&&this.fsw._emit(L.ADD_DIR,t,e),c.add(E.basename(t)),this.fsw._getWatchedDir(t);let u,d,h=this.fsw.options.depth;if((h==null||n<=h)&&!this.fsw._symlinkPaths.has(o)){if(!i&&(await this._handleRead(t,r,a,i,t,n,u),this.fsw.closed))return;d=this._watchWithNodeFs(t,(f,y)=>{y&&y.mtimeMs===0||this._handleRead(f,!1,a,i,t,n,u)})}return d}async _addToNodeFs(t,e,r,n,i){let a=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return a(),!1;let o=this.fsw._getWatchHelpers(t);r&&(o.filterPath=c=>r.filterPath(c),o.filterDir=c=>r.filterDir(c));try{let c=await Qe[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,c))return a(),!1;let l=this.fsw.options.followSymlinks,u;if(c.isDirectory()){let d=E.resolve(t),h=l?await(0,b.realpath)(t):t;if(this.fsw.closed||(u=await this._handleDir(o.watchPath,c,e,n,i,o,h),this.fsw.closed))return;d!==h&&h!==void 0&&this.fsw._symlinkPaths.set(d,h)}else if(c.isSymbolicLink()){let d=l?await(0,b.realpath)(t):t;if(this.fsw.closed)return;let h=E.dirname(o.watchPath);if(this.fsw._getWatchedDir(h).add(o.watchPath),this.fsw._emit(L.ADD,o.watchPath,c),u=await this._handleDir(h,c,e,n,t,o,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(E.resolve(t),d)}else u=this._handleFile(o.watchPath,c,e);return a(),u&&this.fsw._addPathCloser(t,u),!1}catch(c){if(this.fsw._handleError(c))return a(),t}}}});var Re={};qt(Re,{FSWatcher:()=>U,WatchHelper:()=>nt,default:()=>gs,watch:()=>ve});function st(s){return Array.isArray(s)?s:[s]}function ls(s){return typeof s=="function"?s:typeof s=="string"?t=>s===t:s instanceof RegExp?t=>s.test(t):typeof s=="object"&&s!==null?t=>{if(s.path===t)return!0;if(s.recursive){let e=m.relative(s.path,t);return e?!e.startsWith("..")&&!m.isAbsolute(e):!1}return!1}:()=>!1}function us(s){if(typeof s!="string")throw new Error("string expected");s=m.normalize(s),s=s.replace(/\\/g,"/");let t=!1;s.startsWith("//")&&(t=!0);let e=/\/\//;for(;s.match(e);)s=s.replace(e,"/");return t&&(s="/"+s),s}function ge(s,t,e){let r=us(t);for(let n=0;n<s.length;n++){let i=s[n];if(i(r,e))return!0}return!1}function ds(s,t){if(s==null)throw new TypeError("anymatch: specify first argument");let r=st(s).map(n=>ls(n));return t==null?(n,i)=>ge(r,n,i):ge(r,t)}function ve(s,t={}){let e=new U(t);return e.add(s),e}var Te,rt,_e,m,$t,ns,Se,rs,is,os,pe,as,cs,Wt,ye,Ee,Pe,we,hs,fs,jt,ms,ps,nt,U,gs,Le=it(()=>{"use strict";Te=require("fs"),rt=require("fs/promises"),_e=require("events"),m=v(require("path"),1);ce();me();$t="/",ns="//",Se=".",rs="..",is="string",os=/\\/g,pe=/\/\//,as=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,cs=/^\.[/\\]/;Wt=s=>typeof s=="object"&&s!==null&&!(s instanceof RegExp);ye=s=>{let t=st(s).flat();if(!t.every(e=>typeof e===is))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(Pe)},Ee=s=>{let t=s.replace(os,$t),e=!1;for(t.startsWith(ns)&&(e=!0);t.match(pe);)t=t.replace(pe,$t);return e&&(t=$t+t),t},Pe=s=>Ee(m.normalize(Ee(s))),we=(s="")=>t=>typeof t=="string"?Pe(m.isAbsolute(t)?t:m.join(s,t)):t,hs=(s,t)=>m.isAbsolute(s)?s:m.join(t,s),fs=Object.freeze(new Set),jt=class{constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set}add(t){let{items:e}=this;e&&t!==Se&&t!==rs&&e.add(t)}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let r=this.path;try{await(0,rt.readdir)(r)}catch{this._removeWatcher&&this._removeWatcher(m.dirname(r),m.basename(r))}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=tt,this.items=fs,Object.freeze(this)}},ms="stat",ps="lstat",nt=class{constructor(t,e,r){this.fsw=r;let n=t;this.path=t=t.replace(cs,""),this.watchPath=n,this.fullWatchPath=m.resolve(n),this.dirParts=[],this.dirParts.forEach(i=>{i.length>1&&i.pop()}),this.followSymlinks=e,this.statMethod=e?ms:ps}entryPath(t){return m.join(this.watchPath,m.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let r=this.entryPath(t);return this.fsw._isntIgnored(r,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},U=class extends _e.EventEmitter{constructor(t={}){super(),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 e=t.awaitWriteFinish,r={stabilityThreshold:2e3,pollInterval:100},n={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...t,ignored:t.ignored?st(t.ignored):st([]),awaitWriteFinish:e===!0?r:typeof e=="object"?{...r,...e}:!1};he&&(n.usePolling=!0),n.atomic===void 0&&(n.atomic=!n.usePolling);let i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){let c=i.toLowerCase();c==="false"||c==="0"?n.usePolling=!1:c==="true"||c==="1"?n.usePolling=!0:n.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(n.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=tt,this._readyEmitted=!0,process.nextTick(()=>this.emit(T.READY)))},this._emitRaw=(...c)=>this.emit(T.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=n,this._nodeFsHandler=new X(this),Object.freeze(n)}_addIgnoredPath(t){if(Wt(t)){for(let e of this._ignoredPaths)if(Wt(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let e of this._ignoredPaths)Wt(e)&&e.path===t&&this._ignoredPaths.delete(e)}add(t,e,r){let{cwd:n}=this.options;this.closed=!1,this._closePromise=void 0;let i=ye(t);return n&&(i=i.map(a=>hs(a,n))),i.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=i.length,Promise.all(i.map(async a=>{let o=await this._nodeFsHandler._addToNodeFs(a,!r,void 0,0,e);return o&&this._emitReady(),o})).then(a=>{this.closed||a.forEach(o=>{o&&this.add(m.dirname(o),m.basename(e||o))})}),this}unwatch(t){if(this.closed)return this;let e=ye(t),{cwd:r}=this.options;return e.forEach(n=>{!m.isAbsolute(n)&&!this._closers.has(n)&&(r&&(n=m.join(r,n)),n=m.resolve(n)),this._closePath(n),this._addIgnoredPath(n),this._watched.has(n)&&this._addIgnoredPath({path:n,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(e=>e.forEach(r=>{let n=r();n instanceof Promise&&t.push(n)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.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((e,r)=>{let i=(this.options.cwd?m.relative(this.options.cwd,r):r)||Se;t[i]=e.getChildren().sort()}),t}emitWithAll(t,e){this.emit(t,...e),t!==T.ERROR&&this.emit(T.ALL,t,...e)}async _emit(t,e,r){if(this.closed)return;let n=this.options;zt&&(e=m.normalize(e)),n.cwd&&(e=m.relative(n.cwd,e));let i=[e];r!=null&&i.push(r);let a=n.awaitWriteFinish,o;if(a&&(o=this._pendingWrites.get(e)))return o.lastChange=new Date,this;if(n.atomic){if(t===T.UNLINK)return this._pendingUnlinks.set(e,[t,...i]),setTimeout(()=>{this._pendingUnlinks.forEach((c,l)=>{this.emit(...c),this.emit(T.ALL,...c),this._pendingUnlinks.delete(l)})},typeof n.atomic=="number"?n.atomic:100),this;t===T.ADD&&this._pendingUnlinks.has(e)&&(t=T.CHANGE,this._pendingUnlinks.delete(e))}if(a&&(t===T.ADD||t===T.CHANGE)&&this._readyEmitted){let c=(l,u)=>{l?(t=T.ERROR,i[0]=l,this.emitWithAll(t,i)):u&&(i.length>1?i[1]=u:i.push(u),this.emitWithAll(t,i))};return this._awaitWriteFinish(e,a.stabilityThreshold,t,c),this}if(t===T.CHANGE&&!this._throttle(T.CHANGE,e,50))return this;if(n.alwaysStat&&r===void 0&&(t===T.ADD||t===T.ADD_DIR||t===T.CHANGE)){let c=n.cwd?m.join(n.cwd,e):e,l;try{l=await(0,rt.stat)(c)}catch{}if(!l||this.closed)return;i.push(l)}return this.emitWithAll(t,i),this}_handleError(t){let e=t&&t.code;return t&&e!=="ENOENT"&&e!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||e!=="EPERM"&&e!=="EACCES")&&this.emit(T.ERROR,t),t||this.closed}_throttle(t,e,r){this._throttled.has(t)||this._throttled.set(t,new Map);let n=this._throttled.get(t);if(!n)throw new Error("invalid throttle");let i=n.get(e);if(i)return i.count++,!1;let a,o=()=>{let l=n.get(e),u=l?l.count:0;return n.delete(e),clearTimeout(a),l&&clearTimeout(l.timeoutObject),u};a=setTimeout(o,r);let c={timeoutObject:a,clear:o,count:0};return n.set(e,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,r,n){let i=this.options.awaitWriteFinish;if(typeof i!="object")return;let a=i.pollInterval,o,c=t;this.options.cwd&&!m.isAbsolute(t)&&(c=m.join(this.options.cwd,t));let l=new Date,u=this._pendingWrites;function d(h){(0,Te.stat)(c,(f,y)=>{if(f||!u.has(t)){f&&f.code!=="ENOENT"&&n(f);return}let p=Number(new Date);h&&y.size!==h.size&&(u.get(t).lastChange=p);let S=u.get(t);p-S.lastChange>=e?(u.delete(t),n(void 0,y)):o=setTimeout(d,a,y)})}u.has(t)||(u.set(t,{lastChange:l,cancelWait:()=>(u.delete(t),clearTimeout(o),r)}),o=setTimeout(d,a))}_isIgnored(t,e){if(this.options.atomic&&as.test(t))return!0;if(!this._userIgnored){let{cwd:r}=this.options,i=(this.options.ignored||[]).map(we(r)),o=[...[...this._ignoredPaths].map(we(r)),...i];this._userIgnored=ds(o,void 0)}return this._userIgnored(t,e)}_isntIgnored(t,e){return!this._isIgnored(t,e)}_getWatchHelpers(t){return new nt(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=m.resolve(t);return this._watched.has(e)||this._watched.set(e,new jt(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,e,r){let n=m.join(t,e),i=m.resolve(n);if(r=r??(this._watched.has(n)||this._watched.has(i)),!this._throttle("remove",n,100))return;!r&&this._watched.size===1&&this.add(t,e,!0),this._getWatchedDir(n).getChildren().forEach(h=>this._remove(n,h));let c=this._getWatchedDir(t),l=c.has(e);c.remove(e),this._symlinkPaths.has(i)&&this._symlinkPaths.delete(i);let u=n;if(this.options.cwd&&(u=m.relative(this.options.cwd,n)),this.options.awaitWriteFinish&&this._pendingWrites.has(u)&&this._pendingWrites.get(u).cancelWait()===T.ADD)return;this._watched.delete(n),this._watched.delete(i);let d=r?T.UNLINK_DIR:T.UNLINK;l&&!this._isIgnored(n)&&this._emit(d,n),this._closePath(n)}_closePath(t){this._closeFile(t);let e=m.dirname(t);this._getWatchedDir(e).remove(m.basename(t))}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(r=>r()),this._closers.delete(t))}_addPathCloser(t,e){if(!e)return;let r=this._closers.get(t);r||(r=[],this._closers.set(t,r)),r.push(e)}_readdirp(t,e){if(this.closed)return;let r={type:T.ALL,alwaysStat:!0,lstat:!0,...e,depth:0},n=ae(t,r);return this._streams.add(n),n.once(de,()=>{n=void 0}),n.once(Nt,()=>{n&&(this._streams.delete(n),n=void 0)}),n}};gs={watch:ve,FSWatcher:U}});var ys={};qt(ys,{TSFilebasedRouter:()=>be,TSRouter:()=>K,createEffect:()=>Lt,createSignal:()=>Rt,html:()=>ot,loadPyFiles:()=>xt,mapper:()=>Bt,renderChildRoutes:()=>vt,useAnchor:()=>$,useAnchorSingle:()=>Et,useInitialDOM:()=>gt,useTSAuth:()=>_t,useTSCollection:()=>Tt,useTSComponent:()=>z,useTSElementEach:()=>V,useTSElements:()=>mt,useTSEvent:()=>lt,useTSEventAll:()=>ht,useTSExtractParams:()=>dt,useTSLazy:()=>Dt,useTSMetaData:()=>wt,useTSNavigate:()=>St,useTSNoReload:()=>Ct,useTSOutlet:()=>Pt,useTSParams:()=>N,useTSPurifier:()=>ct,useTSSSRHydration:()=>At,useTSSelect:()=>H,useTSloadBrython:()=>bt});module.exports=Oe(ys);function Fe(s){let t=s==null?"":String(s),e=t.toLowerCase();return(e.includes("<script")||e.includes("javascript:"))&&(t=""),t=t.replace(/url\(\s*(['"])?\s*\1?\s*\)/gi,""),t.replace(/<\s*(script|iframe|object|embed|link|style|meta|body)[^>]*>.*?<\s*\/\s*\1\s*>/gi,"").replace(/<\s*(script|iframe|object|embed|link|style|meta)[^>]*>/gi,"").replace(/\s+on\w+\s*=\s*(['"]).*?\1/gi,"").replace(/\s+on\w+\s*=\s*[^\s>]+/gi,"").replace(/\s(href|src)\s*=\s*(['"]?)\s*(javascript:|vbscript:|data:|file:)[^'">\s]*\2/gi,'$1="#"')}function ot(s,...t){return s.reduce((e,r,n)=>{let i=n<t.length?Fe(t[n]):"";return e+r+i},"")}var Ie=s=>s.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|textarea|svg|math|body)[^>]*>/gi,"").replace(/<(?!\/?(b|i|em|strong|p|br|ul|ol|li|a|div|span|h1|h2|h3|h4|h5|h6|section|article|input|button)\b)[^>]*>/gi,"").replace(/\s+on[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s*style\s*=\s*("[^"]*"|'[^']*')/gi,"").replace(/<a\b([^>]*)href\s*=\s*(['"]?)(?!https?:|#)[^'"\s>]+(['"]?)([^>]*)>/gi,"<a$1$4>").replace(/\s+(href|src)\s*=\s*(['"]?)\s*(javascript:|data:)[^'"\s>]*/gi,"").replace(/<a\b([^>]*)\bhref\s*=\s*(['"])(\/blog|#blog)\2([^>]*)>/gi,'<a$1 href=$2$3$2 href-line="true"$4>').trim(),Bt=s=>s?.map(t=>Ie(t)).join("")??"";var at=v(require("dompurify"),1),ct=(s,t)=>{let r={...{ADD_TAGS:["my-custom-tag"]},...t};return typeof s=="string"?at.default.sanitize(s,r):at.default.sanitize(s.innerHTML,r)};var lt=(s,t,e)=>{if(typeof s=="string"){let r=document.getElementById(s);r?r.addEventListener(t,e):console.warn(`Element with id '${s}' not found.`)}else s instanceof HTMLElement?s.addEventListener(t,e):s===document?document.addEventListener(t,e):console.warn("Invalid target parameter provided.")};var Gt=require("zustand/vanilla"),ut=v(require("dompurify"),1);function He(s,t){let e=[],r=s.replace(/:[^/]+/g,o=>(e.push(o.slice(1)),"([^/]+)")),n=new RegExp(`^${r}$`),i=t.match(n),a={};return i&&e.forEach((o,c)=>{a[o]=ut.default.sanitize(i[c+1]??"")}),a}function ke(s){let t={},e=new URLSearchParams(s);for(let[r,n]of e.entries())t[r]=ut.default.sanitize(n);return t}var N=(0,Gt.createStore)((s,t)=>({params:{},query:{},setFromPattern:e=>{let r=window.location.pathname,n=He(e,r),i=ke(window.location.search);s({params:n,query:i})},getParam:e=>t().params[e],getQuery:e=>t().query[e]}));function dt(s){let t=N.getState();t.setFromPattern(s);let e=t.params,r=t.query;return{...e,...r}}var ht=(s,t,e)=>{let r=document.querySelectorAll(s);return r.forEach(n=>{n.addEventListener(t,e)}),()=>{r.forEach(n=>{n.removeEventListener(t,e)})}};var ft=v(require("dompurify"),1),mt=(s,t,e={},r)=>{let n={USE_PROFILES:{svg:!0,html:!0},ALLOWED_TAGS:["svg","path","circle","rect","line","polyline","polygon","g","main","div","h1","h2","h3","h4","h5","h6","p","button","span","a","img","input","ul","li","i","label","form"],ALLOWED_ATTR:["class","id","href","src","alt","title","fill","stroke","stroke-width","viewBox","xmlns","d","x","y","cx","cy","r","width","height","type","name","value","placeholder","data-click","data-change","data-select","data-classlist","data-hover","data-submit","data-key","data-event"],FORBID_TAGS:["script","iframe","foreignObject","body","html"],FORBID_ATTR:["style","xlink:href"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|ftp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,...r};ft.default.addHook("uponSanitizeAttribute",(o,c)=>{let l=(c.attrName||"").toLowerCase(),u=(c.attrValue??"").toString().trim();if(l.startsWith("on")){c.keepAttr=!1;return}if(/^data-(click|change|submit|select|hover|classlist|key|event)$/.test(l)){c.keepAttr=!0;return}if(o.nodeName.toLowerCase()==="img"&&l==="src"){/^https?:\/\//i.test(u)||/^\/(?!\/)/.test(u)||/^data:image\/(png|jpeg|jpg|gif|webp);base64,/i.test(u)||(c.keepAttr=!1);return}if(l==="class"){let h=u.split(/\s+/).filter(Boolean).filter(f=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]*$/.test(f)){if(/^bg-\[url\(.*\)\]$/.test(f)){let y=f.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return y===""||/^https?:\/\//i.test(y)||/^\/(?!\/)/.test(y)||/^\.{0,2}\//.test(y)}return/^bg-\[\]$/.test(f),!0}return!1});c.attrValue=h.join(" ");return}});let i=ft.default.sanitize(t,{...n,RETURN_DOM_FRAGMENT:!0});for(;s.firstChild;)s.removeChild(s.firstChild);s.appendChild(i);let a=(o,c)=>{s.querySelectorAll(`[${o}]`).forEach(l=>{let u=l.getAttribute(o);u&&Object.prototype.hasOwnProperty.call(e,u)&&l.addEventListener(c,d=>{c==="submit"&&d.preventDefault(),e[u](d)})})};a("data-click","click"),a("data-change","change"),a("data-select","select"),a("data-submit","submit"),s.querySelectorAll("[data-key]").forEach(o=>{let c=o.dataset.key,l=o.dataset.event??"click";c&&Object.prototype.hasOwnProperty.call(e,c)&&o.addEventListener(l,e[c])}),s.querySelectorAll("[data-hover]").forEach(o=>{let c=o.dataset.hover;c&&Object.prototype.hasOwnProperty.call(e,c)&&(o.addEventListener("mouseenter",e[c]),o.addEventListener("mouseleave",e[c]))}),s.querySelectorAll("[data-classlist]").forEach(o=>{let c=o.dataset.classlist;/^[a-zA-Z0-9\-\s:_]+$/.test(c)&&o.classList.add(...c.split(/\s+/))})};var pt=v(require("dompurify"),1),G=null,gt=(s,t)=>{if(typeof document>"u")return;let e=document.getElementById(s);if(!e)return;pt.default.addHook("uponSanitizeAttribute",(a,o)=>{let c=(o.attrName||"").toLowerCase(),l=(o.attrValue??"").toString().trim();if(c.startsWith("on")){o.keepAttr=!1;return}if((c==="href"||c==="src")&&/^(javascript:|vbscript:|data:|file:|about:)/i.test(l)){o.keepAttr=!1;return}if(c==="class"){let d=l.split(/\s+/).filter(Boolean).filter(h=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]+$/.test(h)){if(/^bg-\[url\(.*\)\]$/.test(h)){let f=h.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return f===""||/^https?:\/\//i.test(f)||/^\/(?!\/)/.test(f)||/^\.{0,2}\//.test(f)}return!0}return!1});o.attrValue=d.join(" ");return}if(c==="style"){o.keepAttr=!1;return}});let r=e.cloneNode(!0),n=pt.default.sanitize(r.innerHTML,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["div","span","p","h1","h2","h3","h4","h5","h6","ul","ol","li","strong","em","a","img","br","form","button","input","label"],ALLOWED_ATTR:["href","src","alt","title","class","id","type","name","value","placeholder","data-click","data-change","data-submit","data-select","data-hover","data-classlist"],FORBID_TAGS:["script","iframe","object","embed","body","html","svg","math","link","meta"],ALLOW_DATA_ATTR:!0,KEEP_CONTENT:!1,RETURN_DOM_FRAGMENT:!0}),i=Array.from(n.childNodes).map(a=>a.outerHTML||a.textContent||"").join("");if(G!==null&&i!==G){let a=document.createElement("div");t(a);let c=new DOMParser().parseFromString(G,"text/html");for(;e.firstChild;)e.removeChild(e.firstChild);c.body.childNodes.forEach(l=>e.appendChild(l.cloneNode(!0)))}else{for(G=i;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),t(e)}};var yt=v(require("dompurify"),1);typeof window<"u"&&!window.__anchorSinglePopstateHandlerAttached&&(window.addEventListener("popstate",s=>{let t=s.state;t?.scrollPosition!==void 0&&window.scrollTo(0,t.scrollPosition)}),window.__anchorSinglePopstateHandlerAttached=!0);var Et=(s,t,e,r="",n=null)=>{if(!s)return;let i=yt.default.sanitize(t,{ALLOWED_URI_REGEXP:/^(https?:|\/)/}),a=yt.default.sanitize(e,{USE_PROFILES:{html:!1}});s.setAttribute("href",i),s.setAttribute("aria-label",a),r&&(s.className=r.trim()),n&&s.replaceChildren(n),typeof window<"u"&&s.addEventListener("click",o=>{o.preventDefault();let l=o.currentTarget.getAttribute("href");if(l){let u=window.scrollY;window.scrollTo(0,0),window.history.pushState({scrollPosition:u},"",l),dispatchEvent(new PopStateEvent("popstate"))}})};var D=v(require("dompurify"),1);var Vt=(s="'self' 'nonce-rAnd0m123' 'unsafe-inline' 'unsafe-eval'",t="'self' 'nonce-rAnd0m123'",e="'none'",r="'self' https://fonts.googleapis.com https://fonts.gstatic.com",n="'self' https://blogger.googleusercontent.com",i=["'self'","https://fonts.googleapis.com","https://fonts.gstatic.com","https://www.google.com/maps/"],a="'self' https://www.youtube.com",o="'self'",c="/csp-report",l=!1)=>{let u=()=>{try{let d=document.querySelector('meta[http-equiv="Content-Security-Policy"]');d||(d=document.createElement("meta"),d.setAttribute("http-equiv","Content-Security-Policy"),document.head.appendChild(d));let h=l?`report-uri ${c};`:"";d.setAttribute("content",`default-src 'self'; script-src ${s}; style-src ${t}; object-src ${e}; font-src ${r}; img-src ${n}; connect-src ${i.join(" ")}; frame-src ${a}; base-uri ${o}; ${h}`)}catch(d){console.error("Error adding CSP meta element:",d)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",u):u()};var wt=(s,t)=>{let e={name:D.default.sanitize(s.name||""),title:D.default.sanitize(s.title||""),description:D.default.sanitize(s.description||"Default description"),author:D.default.sanitize(s.author||""),favicon:s.favicon},r=g=>{e.name=D.default.sanitize(g),p("name",e.name)},n=g=>{e.title=D.default.sanitize(g),document.title=e.title},i=g=>{e.description=D.default.sanitize(g),p("description",e.description)},a=g=>{e.author=D.default.sanitize(g),p("author",e.author)},o=g=>{e.favicon=D.default.sanitize(g);let w=document.querySelector('link[rel="icon"]');w||(w=document.createElement("link"),w.rel="icon",document.head.appendChild(w)),w.href=e.favicon},c=()=>e.name,l=()=>e.title,u=()=>e.description,d=()=>e.author,h=()=>e.favicon,f=()=>e,y=(g,w)=>{let _=document.createElement("meta");_.setAttribute("name",g),_.setAttribute("content",w),document.head.appendChild(_)},p=(g,w)=>{let _=document.querySelector(`meta[name="${g}"]`);_?_.setAttribute("content",w):y(g,w)},S=()=>{e.title&&(document.title=e.title),e.name&&p("name",e.name),e.description&&p("description",e.description),e.author&&p("author",e.author),e.favicon&&o(e.favicon)};return t&&Vt(t.scriptSrc,t.styleSrc,t.objectSrc,Array.isArray(t.connectSrc)?t.connectSrc.join(" "):t.connectSrc,t.reportOnly!==void 0?String(t.reportOnly):void 0),S(),{setName:r,setTitle:n,setDescription:i,setAuthor:a,setFavicon:o,getName:c,getTitle:l,getDescription:u,getAuthor:d,getFavicon:h,getAllMetaData:f,appendMetaTagsToHead:S}};var Kt=v(require("dompurify"),1),z=(s,t,e,r,n)=>{let i=`#${s}`,a=t.querySelectorAll(i);if(a.length===0)throw new Error(`[useTSComponent] No element found with id '${s}' in the given parent.`);if(a.length>1)throw new Error(`[useTSComponent] Duplicate id '${s}' detected. Found ${a.length} elements.`);let o=a[0];o.innerHTML=Kt.default.sanitize(o.innerHTML,{USE_PROFILES:{html:!0}}),e(o,r,n)};var Tt=(s,t,e,r=[])=>{let n=new Set;s.forEach((i,a)=>{if(n.has(i)){console.warn(`[useTSCollection] Duplicate ID in collection array: "${i}" \u2014 skipping.`);return}n.add(i);let o=t.querySelectorAll(`#${i}`);if(o.length>1){console.warn(`[useTSCollection] Duplicate ID in DOM: "${i}" (${o.length} elements found) \u2014 skipping component mount.`);return}let c=e[a],l=Array.isArray(r)?r[a]:void 0;typeof c=="function"?z(i,t,c,l):console.warn(`[useTSCollection] No valid component function found for ID: "${i}"`)})};var H=(s,t)=>{let r=(t??document).querySelectorAll(s);if(r.length===0)return process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] No element found for selector: '${s}'`),null;if(s.startsWith("#")&&r.length>1){if(process.env.NODE_ENV!=="production")throw new Error(`[useTSSelect] Duplicate ID detected: '${s}'. Found ${r.length} elements with this ID.`);return r[0]}return r.length>1&&process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] Multiple elements found for selector: '${s}'. Returning the first one.`),r[0]};var Qt=require("jwt-decode"),_t=(s,t)=>{let e=localStorage.getItem("token");if(!e)return window.location.href=t,null;try{let r=(0,Qt.jwtDecode)(e),n=Date.now()/1e3;return r.exp&&r.exp<n&&(console.error("Token has expired"),window.localStorage.removeItem("token"),window.location.href=t),null}catch(r){return console.error("Invalid token:",r),window.location.href=t,null}};var V=(s,t,e)=>{s.forEach(r=>{t.forEach(n=>{r.addEventListener(n,i=>{e(r,i)})})})};var St=()=>({back:()=>window.history.back(),forward:()=>window.history.forward()});var Pt=(s,t)=>{let e=document.querySelector(`#${s}`)||document.querySelector(`.${s}`);if(!e)return;let r=window.location.pathname.replace(/\/$/,"");for(let n of t){let i=n.path.replace(/\/$/,"");if(r===i||r.startsWith(`${i}/`)){n.component(e);break}}};function vt(s,t){let e=window.location.pathname.replace(/\/$/,"");t.routes.forEach(r=>{r.children?.length&&r.children.forEach(n=>{let i=n.path.replace(/\/$/,"");if(e===i||e.startsWith(`${i}/`)){let a=s.querySelector(`#${n.outlet}`)||s.querySelector(`.${n.outlet}`);a instanceof HTMLElement&&n.element&&n.element(a)}})})}var Zt=require("zustand/vanilla");function Rt(s){let t=(0,Zt.createStore)(()=>({value:s})),e=new Set;return{get:()=>t.getState().value,set:r=>{t.setState({value:r}),e.forEach(n=>n(r))},subscribe:r=>(e.add(r),r(t.getState().value),()=>e.delete(r))}}function Lt(s){let t=s();typeof t=="function"&&t()}var bt=async()=>{let s="https://cdn.jsdelivr.net/npm/brython@3/brython.min.js",t="https://cdn.jsdelivr.net/npm/brython@3/brython_stdlib.js",e=r=>new Promise((n,i)=>{let a=document.createElement("script");a.src=r,a.onload=()=>n(),a.onerror=()=>i(new Error(`Failed to load ${r}`)),document.head.appendChild(a)});await e(s),await e(t),typeof window.brython=="function"?window.brython():console.error("Brython did not load correctly.")},xt=s=>new Promise((t,e)=>{let r=document.createElement("script");r.type="text/python",r.src=`/src/python/${s}`,r.onload=()=>t(),r.onerror=()=>e(new Error(`Failed to load ${s}`)),document.body.appendChild(r)});function Dt(s){let t=null;return async(e,r)=>{try{if(!t){let n=await s();t=n.default||n}if(typeof t=="function")return t(e,r);if(t instanceof HTMLElement){let n=t.cloneNode(!0);return e?.appendChild(n),n}if(typeof t=="object"&&t!==null&&"render"in t&&typeof t.render=="function")return t.render(e,r);console.warn("useTSLazy: Unsupported module type",t)}catch(n){console.error("useTSLazy failed:",n)}}}var At=s=>typeof window>"u"?{isDOM:null}:{isDOM:s||document.body};var Jt=require("lodash-es"),Mt=s=>s;typeof window<"u"&&typeof document<"u"&&(Mt=s=>{let t=document.createElement("div");return t.innerText=s,t.innerHTML});var Ne=s=>{(s?Array.isArray(s)?s:s instanceof HTMLAnchorElement?[s]:Array.from(s):Array.from(document.querySelectorAll("a"))).forEach(e=>{if(!e||e.dataset.anchorEnhanced==="true")return;e.dataset.anchorEnhanced="true";let r=e.getAttribute("class")||"";e.setAttribute("class",Mt(r));let n=e.getAttribute("aria-label");n&&e.setAttribute("aria-label",Mt(n));let i=e.querySelector(":scope > *");i&&(e.innerHTML="",e.appendChild(i));let a=e.getAttribute("href")||"";if(!a.startsWith("#")){try{if(new URL(a,window.location.href).origin!==window.location.origin)return}catch{return}e.addEventListener("click",o=>{o.preventDefault();let c=e.getAttribute("href")||"";try{let l=new URL(c,window.location.href);window.history.pushState({},"",l.pathname+l.search+l.hash),window.dispatchEvent(new PopStateEvent("popstate"))}catch(l){console.error("Invalid URL in anchor:",c,l)}})}})},ze=(0,Jt.debounce)(Ne,50),$=s=>{ze(s)};var Ct=s=>{if(!s)return;let t=H("a",s);$(t)};var Ot=v(require("dompurify"),1);var te=require("zustand/vanilla"),ee=v(require("dompurify"),1),O=(0,te.createStore)(s=>({params:{},query:{},setParams:t=>s(()=>({params:Xt(t)})),setQuery:t=>s(()=>({query:Xt(t)}))}));function Xt(s){let t={};for(let e in s)t[e]=ee.default.sanitize(s[e]);return t}var K=class{constructor(t,e){this.routes=[];this.routes=t,this.expectedParams=new Set(e),window.addEventListener("popstate",this.handlePopState.bind(this)),this.handlePopState()}handlePopState(){let t=window.location.pathname,e=window.location.search,r=this.parseQueryParams(e),n=this.findMatchingRoute(t,this.routes);if(n){if(n.routeto){this.navigate(n.routeto);return}let i=this.filterAndSanitizeParams(n.params);O.getState().setParams(i),O.getState().setQuery(r);let a=document.createElement("div");if(n.element?.(a,i,r),n.children){let o=t.slice(n.path.length),c=a.querySelector("#child");c&&this.renderChildren(n.children,o,c,i,r)}}else{let i=this.findMatchingRoute("*",this.routes);if(i){let a=this.filterAndSanitizeParams(i.params);O.getState().setParams(a),O.getState().setQuery(r);let o=document.createElement("div");i.element?.(o,a,r)}}}renderChildren(t,e,r,n,i){if(!t||t.length===0){let o=r.querySelector("#child");o&&o.remove();return}let a=this.findMatchingRoute(e,t);if(a){let o=document.createElement("div");o.id="child";let c={...n,...a.params},l=this.filterAndSanitizeParams(c);if(O.getState().setParams(l),O.getState().setQuery(i),a.element?.(o,l,i),r.appendChild(o),a.children){let u=e.slice(a.path.length);this.renderChildren(a.children,u,o,l,i)}}}parseQueryParams(t){let e={},r=new URLSearchParams(t);for(let[n,i]of r.entries())this.expectedParams.has(n)&&(e[n]=Ot.default.sanitize(i));return e}findMatchingRoute(t,e,r={}){for(let n of e){let i=n.path;if(i==="*")return n;{let o=[],c=i.replace(/:[^\s/]+/g,d=>(o.push(d.substring(1)),"([^\\s/]+)")),l=new RegExp(`^${c}(?:/|$)`),u=t.match(l);if(u){let d={...r};if(o.forEach((h,f)=>{d[h]=u[f+1]??""}),n.children){let h=t.slice(u[0].length),f=this.findMatchingRoute(h,n.children,d);if(f)return f}return{...n,params:d}}}}}filterAndSanitizeParams(t){if(!t)return{};let e={};for(let r in t)this.expectedParams.has(r)&&(e[r]=Ot.default.sanitize(t[r]??""));return e}navigate(t){history.pushState(null,"",t),this.handlePopState()}addRoute(t){this.routes.push(t)}};var x=v(require("path"),1),be=()=>({name:"ts-filebased-router",async buildStart(){if(typeof process>"u"||!process.versions?.node)return;let s=await import("fs/promises"),t=await Promise.resolve().then(()=>(Le(),Re)),e=x.default.resolve("src/pages"),r=x.default.resolve("src/gen"),n=x.default.resolve("src/routes"),i=x.default.join(r,"tsrouter.gen.ts"),a=x.default.join(n,"__root.ts"),o=process.env.NODE_ENV!=="production";async function c(p){try{await s.mkdir(p,{recursive:!0})}catch{}}function l(p,S){let g="/"+x.default.relative(S,p).replace(/\\/g,"/");return g=g.replace(/\.ts$/,"").replace(/\/index$/,"")||"/",g.replace(/\[(.+?)\]/g,":$1")}function u(p){return p.replace(/^\//,"").split("/").map(S=>S.startsWith(":")?S.slice(1):S).filter(Boolean).join("-")||"index"}function d(p,S){let w=x.default.relative(S,p).replace(/\\/g,"/").split("/").filter(Boolean),_=w[w.length-1].replace(".ts",""),A=w.length>1?w[w.length-2]:"";if(_==="index")return A?A.charAt(0).toUpperCase()+A.slice(1):"Index";if(_.startsWith("[")&&_.endsWith("]")){let P=_.slice(1,-1);return A.charAt(0).toUpperCase()+P.charAt(0).toUpperCase()+P.slice(1)}return _.charAt(0).toUpperCase()+_.slice(1)}async function h(p){let S=await s.readdir(p,{withFileTypes:!0}),g=[];for(let w of S){let _=x.default.join(p,w.name);if(w.isDirectory())g=g.concat(await h(_));else if(w.isFile()&&w.name.endsWith(".ts")){let A=l(_,e),P=u(A),q=d(_,e);g.push({file:_,route:A,routeName:P,importName:q})}}return g}function f(){return`import { createRouter } from "@/gen/tsrouter.gen";
|
|
1
|
+
"use strict";var xe=Object.create;var G=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var ot=(s,t)=>()=>(s&&(t=s(s=0)),t);var qt=(s,t)=>{for(var e in t)G(s,e,{get:t[e],enumerable:!0})},Yt=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of De(t))!Ce.call(s,r)&&r!==e&&G(s,r,{get:()=>t[r],enumerable:!(n=Ae(t,r))||n.enumerable});return s};var v=(s,t,e)=>(e=s!=null?xe(Me(s)):{},Yt(t||!s||!s.__esModule?G(e,"default",{value:s,enumerable:!0}):e,s)),Oe=s=>Yt(G({},"__esModule",{value:!0}),s);function ae(s,t={}){let e=t.entryType||t.type;if(e==="both"&&(e=R.FILE_DIR_TYPE),e&&(t.type=e),s){if(typeof s!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(e&&!se.includes(e))throw new Error(`readdirp: Invalid type passed. Use one of ${se.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=s,new Ht(t)}var M,ie,C,R,It,oe,ze,se,We,je,Ue,qe,re,ne,Ht,ce=ot(()=>{"use strict";M=require("fs/promises"),ie=require("stream"),C=require("path"),R={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},It={root:".",fileFilter:s=>!0,directoryFilter:s=>!0,type:R.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(It);oe="READDIRP_RECURSIVE_ERROR",ze=new Set(["ENOENT","EPERM","EACCES","ELOOP",oe]),se=[R.DIR_TYPE,R.EVERYTHING_TYPE,R.FILE_DIR_TYPE,R.FILE_TYPE],We=new Set([R.DIR_TYPE,R.EVERYTHING_TYPE,R.FILE_DIR_TYPE]),je=new Set([R.EVERYTHING_TYPE,R.FILE_DIR_TYPE,R.FILE_TYPE]),Ue=s=>ze.has(s.code),qe=process.platform==="win32",re=s=>!0,ne=s=>{if(s===void 0)return re;if(typeof s=="function")return s;if(typeof s=="string"){let t=s.trim();return e=>e.basename===t}if(Array.isArray(s)){let t=s.map(e=>e.trim());return e=>t.some(n=>e.basename===n)}return re},Ht=class extends ie.Readable{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});let e={...It,...t},{root:n,type:r}=e;this._fileFilter=ne(e.fileFilter),this._directoryFilter=ne(e.directoryFilter);let i=e.lstat?M.lstat:M.stat;qe?this._stat=a=>i(a,{bigint:!0}):this._stat=i,this._maxDepth=e.depth??It.depth,this._wantsDir=r?We.has(r):!1,this._wantsFile=r?je.has(r):!1,this._wantsEverything=r===R.EVERYTHING_TYPE,this._root=(0,C.resolve)(n),this._isDirent=!e.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 e=this.parent,n=e&&e.files;if(n&&n.length>0){let{path:r,depth:i}=e,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),o=await Promise.all(a);for(let c of o){if(!c)continue;if(this.destroyed)return;let l=await this._getEntryType(c);l==="directory"&&this._directoryFilter(c)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,i+1)),this._wantsDir&&(this.push(c),t--)):(l==="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(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(t,e){let n;try{n=await(0,M.readdir)(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:e,path:t}}async _formatEntry(t,e){let n,r=this._isDirent?t.name:t;try{let i=(0,C.resolve)((0,C.join)(e,r));n={path:(0,C.relative)(this._root,i),fullPath:i,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(i)}catch(i){this._onError(i);return}return n}_onError(t){Ue(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let e=t[this._statsProp];if(e.isFile())return"file";if(e.isDirectory())return"directory";if(e&&e.isSymbolicLink()){let n=t.fullPath;try{let r=await(0,M.realpath)(n),i=await(0,M.lstat)(r);if(i.isFile())return"file";if(i.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===C.sep){let o=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return o.code=oe,this._onError(o)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}}});function le(s,t,e,n,r){let i=(a,o)=>{e(s),r(a,o,{watchedPath:s}),o&&s!==o&&X(w.resolve(s,o),F,w.join(s,o))};try{return(0,I.watch)(s,{persistent:t.persistent},i)}catch(a){n(a);return}}var I,L,w,ue,Ye,$t,de,et,st,zt,Be,Ge,Ve,he,T,b,Ke,Qe,F,Z,N,Ze,Je,Xe,kt,W,ts,j,fe,J,X,es,Nt,ss,tt,me=ot(()=>{"use strict";I=require("fs"),L=require("fs/promises"),w=v(require("path"),1),ue=require("os"),Ye="data",$t="end",de="close",et=()=>{},st=process.platform,zt=st==="win32",Be=st==="darwin",Ge=st==="linux",Ve=st==="freebsd",he=(0,ue.type)()==="OS400",T={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},b=T,Ke="watch",Qe={lstat:L.lstat,stat:L.stat},F="listeners",Z="errHandlers",N="rawEmitters",Ze=[F,Z,N],Je=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"]),Xe=s=>Je.has(w.extname(s).slice(1).toLowerCase()),kt=(s,t)=>{s instanceof Set?s.forEach(t):t(s)},W=(s,t,e)=>{let n=s[t];n instanceof Set||(s[t]=n=new Set([n])),n.add(e)},ts=s=>t=>{let e=s[t];e instanceof Set?e.clear():delete s[t]},j=(s,t,e)=>{let n=s[t];n instanceof Set?n.delete(e):n===e&&delete s[t]},fe=s=>s instanceof Set?s.size===0:!s,J=new Map;X=(s,t,e,n,r)=>{let i=J.get(s);i&&kt(i[t],a=>{a(e,n,r)})},es=(s,t,e,n)=>{let{listener:r,errHandler:i,rawEmitter:a}=n,o=J.get(t),c;if(!e.persistent)return c=le(s,e,r,i,a),c?c.close.bind(c):void 0;if(o)W(o,F,r),W(o,Z,i),W(o,N,a);else{if(c=le(s,e,X.bind(null,t,F),i,X.bind(null,t,N)),!c)return;c.on(b.ERROR,async l=>{let u=X.bind(null,t,Z);if(o&&(o.watcherUnusable=!0),zt&&l.code==="EPERM")try{await(await(0,L.open)(s,"r")).close(),u(l)}catch{}else u(l)}),o={listeners:r,errHandlers:i,rawEmitters:a,watcher:c},J.set(t,o)}return()=>{j(o,F,r),j(o,Z,i),j(o,N,a),fe(o.listeners)&&(o.watcher.close(),J.delete(t),Ze.forEach(ts(o)),o.watcher=void 0,Object.freeze(o))}},Nt=new Map,ss=(s,t,e,n)=>{let{listener:r,rawEmitter:i}=n,a=Nt.get(t),o=a&&a.options;return o&&(o.persistent<e.persistent||o.interval>e.interval)&&((0,I.unwatchFile)(t),a=void 0),a?(W(a,F,r),W(a,N,i)):(a={listeners:r,rawEmitters:i,options:e,watcher:(0,I.watchFile)(t,e,(c,l)=>{kt(a.rawEmitters,d=>{d(b.CHANGE,t,{curr:c,prev:l})});let u=c.mtimeMs;(c.size!==l.size||u>l.mtimeMs||u===0)&&kt(a.listeners,d=>d(s,c))})},Nt.set(t,a)),()=>{j(a,F,r),j(a,N,i),fe(a.listeners)&&(Nt.delete(t),(0,I.unwatchFile)(t),a.options=a.watcher=void 0,Object.freeze(a))}},tt=class{constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e)}_watchWithNodeFs(t,e){let n=this.fsw.options,r=w.dirname(t),i=w.basename(t);this.fsw._getWatchedDir(r).add(i);let o=w.resolve(t),c={persistent:n.persistent};e||(e=et);let l;if(n.usePolling){let u=n.interval!==n.binaryInterval;c.interval=u&&Xe(i)?n.binaryInterval:n.interval,l=ss(t,o,c,{listener:e,rawEmitter:this.fsw._emitRaw})}else l=es(t,o,c,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(t,e,n){if(this.fsw.closed)return;let r=w.dirname(t),i=w.basename(t),a=this.fsw._getWatchedDir(r),o=e;if(a.has(i))return;let c=async(u,d)=>{if(this.fsw._throttle(Ke,t,5)){if(!d||d.mtimeMs===0)try{let h=await(0,L.stat)(t);if(this.fsw.closed)return;let f=h.atimeMs,E=h.mtimeMs;if((!f||f<=E||E!==o.mtimeMs)&&this.fsw._emit(b.CHANGE,t,h),(Be||Ge||Ve)&&o.ino!==h.ino){this.fsw._closeFile(u),o=h;let p=this._watchWithNodeFs(t,c);p&&this.fsw._addPathCloser(u,p)}else o=h}catch{this.fsw._remove(r,i)}else if(a.has(i)){let h=d.atimeMs,f=d.mtimeMs;(!h||h<=f||f!==o.mtimeMs)&&this.fsw._emit(b.CHANGE,t,d),o=d}}},l=this._watchWithNodeFs(t,c);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(b.ADD,t,0))return;this.fsw._emit(b.ADD,t,e)}return l}async _handleSymlink(t,e,n,r){if(this.fsw.closed)return;let i=t.fullPath,a=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let o;try{o=await(0,L.realpath)(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(i)!==o&&(this.fsw._symlinkPaths.set(i,o),this.fsw._emit(b.CHANGE,n,t.stats)):(a.add(r),this.fsw._symlinkPaths.set(i,o),this.fsw._emit(b.ADD,n,t.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(t,e,n,r,i,a,o){if(t=w.join(t,""),o=this.fsw._throttle("readdir",t,1e3),!o)return;let c=this.fsw._getWatchedDir(n.path),l=new Set,u=this.fsw._readdirp(t,{fileFilter:d=>n.filterPath(d),directoryFilter:d=>n.filterDir(d)});if(u)return u.on(Ye,async d=>{if(this.fsw.closed){u=void 0;return}let h=d.path,f=w.join(t,h);if(l.add(h),!(d.stats.isSymbolicLink()&&await this._handleSymlink(d,t,f,h))){if(this.fsw.closed){u=void 0;return}(h===r||!r&&!c.has(h))&&(this.fsw._incrReadyCount(),f=w.join(i,w.relative(i,f)),this._addToNodeFs(f,e,n,a+1))}}).on(b.ERROR,this._boundHandleError),new Promise((d,h)=>{if(!u)return h();u.once($t,()=>{if(this.fsw.closed){u=void 0;return}let f=o?o.clear():!1;d(void 0),c.getChildren().filter(E=>E!==t&&!l.has(E)).forEach(E=>{this.fsw._remove(t,E)}),u=void 0,f&&this._handleRead(t,!1,n,r,i,a,o)})})}async _handleDir(t,e,n,r,i,a,o){let c=this.fsw._getWatchedDir(w.dirname(t)),l=c.has(w.basename(t));!(n&&this.fsw.options.ignoreInitial)&&!i&&!l&&this.fsw._emit(b.ADD_DIR,t,e),c.add(w.basename(t)),this.fsw._getWatchedDir(t);let u,d,h=this.fsw.options.depth;if((h==null||r<=h)&&!this.fsw._symlinkPaths.has(o)){if(!i&&(await this._handleRead(t,n,a,i,t,r,u),this.fsw.closed))return;d=this._watchWithNodeFs(t,(f,E)=>{E&&E.mtimeMs===0||this._handleRead(f,!1,a,i,t,r,u)})}return d}async _addToNodeFs(t,e,n,r,i){let a=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return a(),!1;let o=this.fsw._getWatchHelpers(t);n&&(o.filterPath=c=>n.filterPath(c),o.filterDir=c=>n.filterDir(c));try{let c=await Qe[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,c))return a(),!1;let l=this.fsw.options.followSymlinks,u;if(c.isDirectory()){let d=w.resolve(t),h=l?await(0,L.realpath)(t):t;if(this.fsw.closed||(u=await this._handleDir(o.watchPath,c,e,r,i,o,h),this.fsw.closed))return;d!==h&&h!==void 0&&this.fsw._symlinkPaths.set(d,h)}else if(c.isSymbolicLink()){let d=l?await(0,L.realpath)(t):t;if(this.fsw.closed)return;let h=w.dirname(o.watchPath);if(this.fsw._getWatchedDir(h).add(o.watchPath),this.fsw._emit(b.ADD,o.watchPath,c),u=await this._handleDir(h,c,e,r,t,o,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(t),d)}else u=this._handleFile(o.watchPath,c,e);return a(),u&&this.fsw._addPathCloser(t,u),!1}catch(c){if(this.fsw._handleError(c))return a(),t}}}});var Re={};qt(Re,{FSWatcher:()=>U,WatchHelper:()=>nt,default:()=>gs,watch:()=>ve});function rt(s){return Array.isArray(s)?s:[s]}function ls(s){return typeof s=="function"?s:typeof s=="string"?t=>s===t:s instanceof RegExp?t=>s.test(t):typeof s=="object"&&s!==null?t=>{if(s.path===t)return!0;if(s.recursive){let e=m.relative(s.path,t);return e?!e.startsWith("..")&&!m.isAbsolute(e):!1}return!1}:()=>!1}function us(s){if(typeof s!="string")throw new Error("string expected");s=m.normalize(s),s=s.replace(/\\/g,"/");let t=!1;s.startsWith("//")&&(t=!0);let e=/\/\//;for(;s.match(e);)s=s.replace(e,"/");return t&&(s="/"+s),s}function ge(s,t,e){let n=us(t);for(let r=0;r<s.length;r++){let i=s[r];if(i(n,e))return!0}return!1}function ds(s,t){if(s==null)throw new TypeError("anymatch: specify first argument");let n=rt(s).map(r=>ls(r));return t==null?(r,i)=>ge(n,r,i):ge(n,t)}function ve(s,t={}){let e=new U(t);return e.add(s),e}var Te,it,_e,m,Wt,rs,Se,ns,is,os,pe,as,cs,jt,Ee,we,Pe,ye,hs,fs,Ut,ms,ps,nt,U,gs,be=ot(()=>{"use strict";Te=require("fs"),it=require("fs/promises"),_e=require("events"),m=v(require("path"),1);ce();me();Wt="/",rs="//",Se=".",ns="..",is="string",os=/\\/g,pe=/\/\//,as=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,cs=/^\.[/\\]/;jt=s=>typeof s=="object"&&s!==null&&!(s instanceof RegExp);Ee=s=>{let t=rt(s).flat();if(!t.every(e=>typeof e===is))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(Pe)},we=s=>{let t=s.replace(os,Wt),e=!1;for(t.startsWith(rs)&&(e=!0);t.match(pe);)t=t.replace(pe,Wt);return e&&(t=Wt+t),t},Pe=s=>we(m.normalize(we(s))),ye=(s="")=>t=>typeof t=="string"?Pe(m.isAbsolute(t)?t:m.join(s,t)):t,hs=(s,t)=>m.isAbsolute(s)?s:m.join(t,s),fs=Object.freeze(new Set),Ut=class{constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set}add(t){let{items:e}=this;e&&t!==Se&&t!==ns&&e.add(t)}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let n=this.path;try{await(0,it.readdir)(n)}catch{this._removeWatcher&&this._removeWatcher(m.dirname(n),m.basename(n))}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=et,this.items=fs,Object.freeze(this)}},ms="stat",ps="lstat",nt=class{constructor(t,e,n){this.fsw=n;let r=t;this.path=t=t.replace(cs,""),this.watchPath=r,this.fullWatchPath=m.resolve(r),this.dirParts=[],this.dirParts.forEach(i=>{i.length>1&&i.pop()}),this.followSymlinks=e,this.statMethod=e?ms:ps}entryPath(t){return m.join(this.watchPath,m.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let n=this.entryPath(t);return this.fsw._isntIgnored(n,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},U=class extends _e.EventEmitter{constructor(t={}){super(),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 e=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...t,ignored:t.ignored?rt(t.ignored):rt([]),awaitWriteFinish:e===!0?n:typeof e=="object"?{...n,...e}:!1};he&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){let c=i.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 o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=et,this._readyEmitted=!0,process.nextTick(()=>this.emit(T.READY)))},this._emitRaw=(...c)=>this.emit(T.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new tt(this),Object.freeze(r)}_addIgnoredPath(t){if(jt(t)){for(let e of this._ignoredPaths)if(jt(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let e of this._ignoredPaths)jt(e)&&e.path===t&&this._ignoredPaths.delete(e)}add(t,e,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let i=Ee(t);return r&&(i=i.map(a=>hs(a,r))),i.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=i.length,Promise.all(i.map(async a=>{let o=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,e);return o&&this._emitReady(),o})).then(a=>{this.closed||a.forEach(o=>{o&&this.add(m.dirname(o),m.basename(e||o))})}),this}unwatch(t){if(this.closed)return this;let e=Ee(t),{cwd:n}=this.options;return e.forEach(r=>{!m.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=m.join(n,r)),r=m.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(e=>e.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.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((e,n)=>{let i=(this.options.cwd?m.relative(this.options.cwd,n):n)||Se;t[i]=e.getChildren().sort()}),t}emitWithAll(t,e){this.emit(t,...e),t!==T.ERROR&&this.emit(T.ALL,t,...e)}async _emit(t,e,n){if(this.closed)return;let r=this.options;zt&&(e=m.normalize(e)),r.cwd&&(e=m.relative(r.cwd,e));let i=[e];n!=null&&i.push(n);let a=r.awaitWriteFinish,o;if(a&&(o=this._pendingWrites.get(e)))return o.lastChange=new Date,this;if(r.atomic){if(t===T.UNLINK)return this._pendingUnlinks.set(e,[t,...i]),setTimeout(()=>{this._pendingUnlinks.forEach((c,l)=>{this.emit(...c),this.emit(T.ALL,...c),this._pendingUnlinks.delete(l)})},typeof r.atomic=="number"?r.atomic:100),this;t===T.ADD&&this._pendingUnlinks.has(e)&&(t=T.CHANGE,this._pendingUnlinks.delete(e))}if(a&&(t===T.ADD||t===T.CHANGE)&&this._readyEmitted){let c=(l,u)=>{l?(t=T.ERROR,i[0]=l,this.emitWithAll(t,i)):u&&(i.length>1?i[1]=u:i.push(u),this.emitWithAll(t,i))};return this._awaitWriteFinish(e,a.stabilityThreshold,t,c),this}if(t===T.CHANGE&&!this._throttle(T.CHANGE,e,50))return this;if(r.alwaysStat&&n===void 0&&(t===T.ADD||t===T.ADD_DIR||t===T.CHANGE)){let c=r.cwd?m.join(r.cwd,e):e,l;try{l=await(0,it.stat)(c)}catch{}if(!l||this.closed)return;i.push(l)}return this.emitWithAll(t,i),this}_handleError(t){let e=t&&t.code;return t&&e!=="ENOENT"&&e!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||e!=="EPERM"&&e!=="EACCES")&&this.emit(T.ERROR,t),t||this.closed}_throttle(t,e,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 i=r.get(e);if(i)return i.count++,!1;let a,o=()=>{let l=r.get(e),u=l?l.count:0;return r.delete(e),clearTimeout(a),l&&clearTimeout(l.timeoutObject),u};a=setTimeout(o,n);let c={timeoutObject:a,clear:o,count:0};return r.set(e,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,n,r){let i=this.options.awaitWriteFinish;if(typeof i!="object")return;let a=i.pollInterval,o,c=t;this.options.cwd&&!m.isAbsolute(t)&&(c=m.join(this.options.cwd,t));let l=new Date,u=this._pendingWrites;function d(h){(0,Te.stat)(c,(f,E)=>{if(f||!u.has(t)){f&&f.code!=="ENOENT"&&r(f);return}let p=Number(new Date);h&&E.size!==h.size&&(u.get(t).lastChange=p);let S=u.get(t);p-S.lastChange>=e?(u.delete(t),r(void 0,E)):o=setTimeout(d,a,E)})}u.has(t)||(u.set(t,{lastChange:l,cancelWait:()=>(u.delete(t),clearTimeout(o),n)}),o=setTimeout(d,a))}_isIgnored(t,e){if(this.options.atomic&&as.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,i=(this.options.ignored||[]).map(ye(n)),o=[...[...this._ignoredPaths].map(ye(n)),...i];this._userIgnored=ds(o,void 0)}return this._userIgnored(t,e)}_isntIgnored(t,e){return!this._isIgnored(t,e)}_getWatchHelpers(t){return new nt(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=m.resolve(t);return this._watched.has(e)||this._watched.set(e,new Ut(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,e,n){let r=m.join(t,e),i=m.resolve(r);if(n=n??(this._watched.has(r)||this._watched.has(i)),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,e,!0),this._getWatchedDir(r).getChildren().forEach(h=>this._remove(r,h));let c=this._getWatchedDir(t),l=c.has(e);c.remove(e),this._symlinkPaths.has(i)&&this._symlinkPaths.delete(i);let u=r;if(this.options.cwd&&(u=m.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(u)&&this._pendingWrites.get(u).cancelWait()===T.ADD)return;this._watched.delete(r),this._watched.delete(i);let d=n?T.UNLINK_DIR:T.UNLINK;l&&!this._isIgnored(r)&&this._emit(d,r),this._closePath(r)}_closePath(t){this._closeFile(t);let e=m.dirname(t);this._getWatchedDir(e).remove(m.basename(t))}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,e){if(!e)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(e)}_readdirp(t,e){if(this.closed)return;let n={type:T.ALL,alwaysStat:!0,lstat:!0,...e,depth:0},r=ae(t,n);return this._streams.add(r),r.once(de,()=>{r=void 0}),r.once($t,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};gs={watch:ve,FSWatcher:U}});var Es={};qt(Es,{TSFilebasedRouter:()=>Le,TSRouter:()=>Q,createEffect:()=>Lt,createSignal:()=>bt,html:()=>at,loadPyFiles:()=>At,mapper:()=>Bt,renderChildRoutes:()=>Rt,useAnchor:()=>z,useAnchorSingle:()=>yt,useInitialDOM:()=>Et,useTSAuth:()=>St,useTSCollection:()=>_t,useTSComponent:()=>$,useTSElementEach:()=>K,useTSElements:()=>pt,useTSEvent:()=>ut,useTSEventAll:()=>ft,useTSExtractParams:()=>ht,useTSLazy:()=>Dt,useTSMetaData:()=>Tt,useTSNavigate:()=>Pt,useTSNoReload:()=>Ot,useTSOutlet:()=>vt,useTSParams:()=>k,useTSPurifier:()=>lt,useTSSSRHydration:()=>Mt,useTSSelect:()=>H,useTSloadBrython:()=>xt});module.exports=Oe(Es);function Fe(s){let t=s==null?"":String(s),e=t.toLowerCase();return(e.includes("<script")||e.includes("javascript:"))&&(t=""),t=t.replace(/url\(\s*(['"])?\s*\1?\s*\)/gi,""),t.replace(/<\s*(script|iframe|object|embed|link|style|meta|body)[^>]*>.*?<\s*\/\s*\1\s*>/gi,"").replace(/<\s*(script|iframe|object|embed|link|style|meta)[^>]*>/gi,"").replace(/\s+on\w+\s*=\s*(['"]).*?\1/gi,"").replace(/\s+on\w+\s*=\s*[^\s>]+/gi,"").replace(/\s(href|src)\s*=\s*(['"]?)\s*(javascript:|vbscript:|data:|file:)[^'">\s]*\2/gi,'$1="#"')}function at(s,...t){return s.reduce((e,n,r)=>{let i=r<t.length?Fe(t[r]):"";return e+n+i},"")}var Ie=s=>s.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|textarea|svg|math|body)[^>]*>/gi,"").replace(/<(?!\/?(b|i|em|strong|p|br|ul|ol|li|a|div|span|h1|h2|h3|h4|h5|h6|section|article|input|button)\b)[^>]*>/gi,"").replace(/\s+on[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s*style\s*=\s*("[^"]*"|'[^']*')/gi,"").replace(/<a\b([^>]*)href\s*=\s*(['"]?)(?!https?:|#)[^'"\s>]+(['"]?)([^>]*)>/gi,"<a$1$4>").replace(/\s+(href|src)\s*=\s*(['"]?)\s*(javascript:|data:)[^'"\s>]*/gi,"").replace(/<a\b([^>]*)\bhref\s*=\s*(['"])(\/blog|#blog)\2([^>]*)>/gi,'<a$1 href=$2$3$2 href-line="true"$4>').trim(),Bt=s=>s?.map(t=>Ie(t)).join("")??"";var ct=v(require("dompurify"),1),lt=(s,t)=>{let n={...{ADD_TAGS:["my-custom-tag"]},...t};return typeof s=="string"?ct.default.sanitize(s,n):ct.default.sanitize(s.innerHTML,n)};var ut=(s,t,e)=>{if(typeof s=="string"){let n=document.getElementById(s);n?n.addEventListener(t,e):console.warn(`Element with id '${s}' not found.`)}else s instanceof HTMLElement?s.addEventListener(t,e):s===document?document.addEventListener(t,e):console.warn("Invalid target parameter provided.")};var Gt=require("zustand/vanilla"),dt=v(require("dompurify"),1);function He(s,t){let e=[],n=s.replace(/:[^/]+/g,o=>(e.push(o.slice(1)),"([^/]+)")),r=new RegExp(`^${n}$`),i=t.match(r),a={};return i&&e.forEach((o,c)=>{a[o]=dt.default.sanitize(i[c+1]??"")}),a}function Ne(s){let t={},e=new URLSearchParams(s);for(let[n,r]of e.entries())t[n]=dt.default.sanitize(r);return t}var k=(0,Gt.createStore)((s,t)=>({params:{},query:{},setFromPattern:e=>{let n=window.location.pathname,r=He(e,n),i=Ne(window.location.search);s({params:r,query:i})},getParam:e=>t().params[e],getQuery:e=>t().query[e]}));function ht(s){let t=k.getState();t.setFromPattern(s);let e=t.params,n=t.query;return{...e,...n}}var ft=(s,t,e)=>{let n=document.querySelectorAll(s);return n.forEach(r=>{r.addEventListener(t,e)}),()=>{n.forEach(r=>{r.removeEventListener(t,e)})}};var mt=v(require("dompurify"),1),pt=(s,t,e={},n)=>{let r={USE_PROFILES:{svg:!0,html:!0},ALLOWED_TAGS:["svg","path","circle","rect","line","polyline","polygon","g","main","div","h1","h2","h3","h4","h5","h6","p","button","span","a","img","input","ul","li","i","label","form"],ALLOWED_ATTR:["class","id","href","src","alt","title","fill","stroke","stroke-width","viewBox","xmlns","d","x","y","cx","cy","r","width","height","type","name","value","placeholder","data-click","data-change","data-select","data-classlist","data-hover","data-submit","data-key","data-event"],FORBID_TAGS:["script","iframe","foreignObject","body","html"],FORBID_ATTR:["style","xlink:href"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|ftp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,...n};mt.default.addHook("uponSanitizeAttribute",(o,c)=>{let l=(c.attrName||"").toLowerCase(),u=(c.attrValue??"").toString().trim();if(l.startsWith("on")){c.keepAttr=!1;return}if(/^data-(click|change|submit|select|hover|classlist|key|event)$/.test(l)){c.keepAttr=!0;return}if(o.nodeName.toLowerCase()==="img"&&l==="src"){/^https?:\/\//i.test(u)||/^\/(?!\/)/.test(u)||/^data:image\/(png|jpeg|jpg|gif|webp);base64,/i.test(u)||(c.keepAttr=!1);return}if(l==="class"){let h=u.split(/\s+/).filter(Boolean).filter(f=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]*$/.test(f)){if(/^bg-\[url\(.*\)\]$/.test(f)){let E=f.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return E===""||/^https?:\/\//i.test(E)||/^\/(?!\/)/.test(E)||/^\.{0,2}\//.test(E)}return/^bg-\[\]$/.test(f),!0}return!1});c.attrValue=h.join(" ");return}});let i=mt.default.sanitize(t,{...r,RETURN_DOM_FRAGMENT:!0});for(;s.firstChild;)s.removeChild(s.firstChild);s.appendChild(i);let a=(o,c)=>{s.querySelectorAll(`[${o}]`).forEach(l=>{let u=l.getAttribute(o);u&&Object.prototype.hasOwnProperty.call(e,u)&&l.addEventListener(c,d=>{c==="submit"&&d.preventDefault(),e[u](d)})})};a("data-click","click"),a("data-change","change"),a("data-select","select"),a("data-submit","submit"),s.querySelectorAll("[data-key]").forEach(o=>{let c=o.dataset.key,l=o.dataset.event??"click";c&&Object.prototype.hasOwnProperty.call(e,c)&&o.addEventListener(l,e[c])}),s.querySelectorAll("[data-hover]").forEach(o=>{let c=o.dataset.hover;c&&Object.prototype.hasOwnProperty.call(e,c)&&(o.addEventListener("mouseenter",e[c]),o.addEventListener("mouseleave",e[c]))}),s.querySelectorAll("[data-classlist]").forEach(o=>{let c=o.dataset.classlist;/^[a-zA-Z0-9\-\s:_]+$/.test(c)&&o.classList.add(...c.split(/\s+/))})};var gt=v(require("dompurify"),1),V=null,Et=(s,t)=>{if(typeof document>"u")return;let e=document.getElementById(s);if(!e)return;gt.default.addHook("uponSanitizeAttribute",(a,o)=>{let c=(o.attrName||"").toLowerCase(),l=(o.attrValue??"").toString().trim();if(c.startsWith("on")){o.keepAttr=!1;return}if((c==="href"||c==="src")&&/^(javascript:|vbscript:|data:|file:|about:)/i.test(l)){o.keepAttr=!1;return}if(c==="class"){let d=l.split(/\s+/).filter(Boolean).filter(h=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]+$/.test(h)){if(/^bg-\[url\(.*\)\]$/.test(h)){let f=h.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return f===""||/^https?:\/\//i.test(f)||/^\/(?!\/)/.test(f)||/^\.{0,2}\//.test(f)}return!0}return!1});o.attrValue=d.join(" ");return}if(c==="style"){o.keepAttr=!1;return}});let n=e.cloneNode(!0),r=gt.default.sanitize(n.innerHTML,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["div","span","p","h1","h2","h3","h4","h5","h6","ul","ol","li","strong","em","a","img","br","form","button","input","label"],ALLOWED_ATTR:["href","src","alt","title","class","id","type","name","value","placeholder","data-click","data-change","data-submit","data-select","data-hover","data-classlist"],FORBID_TAGS:["script","iframe","object","embed","body","html","svg","math","link","meta"],ALLOW_DATA_ATTR:!0,KEEP_CONTENT:!1,RETURN_DOM_FRAGMENT:!0}),i=Array.from(r.childNodes).map(a=>a.outerHTML||a.textContent||"").join("");if(V!==null&&i!==V){let a=document.createElement("div");t(a);let c=new DOMParser().parseFromString(V,"text/html");for(;e.firstChild;)e.removeChild(e.firstChild);c.body.childNodes.forEach(l=>e.appendChild(l.cloneNode(!0)))}else{for(V=i;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(r),t(e)}};var wt=v(require("dompurify"),1);typeof window<"u"&&!window.__anchorSinglePopstateHandlerAttached&&(window.addEventListener("popstate",s=>{let t=s.state;t?.scrollPosition!==void 0&&window.scrollTo(0,t.scrollPosition)}),window.__anchorSinglePopstateHandlerAttached=!0);var yt=(s,t,e,n="",r=null)=>{if(!s)return;let i=wt.default.sanitize(t,{ALLOWED_URI_REGEXP:/^(https?:|\/)/}),a=wt.default.sanitize(e,{USE_PROFILES:{html:!1}});s.setAttribute("href",i),s.setAttribute("aria-label",a),n&&(s.className=n.trim()),r&&s.replaceChildren(r),typeof window<"u"&&s.addEventListener("click",o=>{o.preventDefault();let l=o.currentTarget.getAttribute("href");if(l){let u=window.scrollY;window.scrollTo(0,0),window.history.pushState({scrollPosition:u},"",l),dispatchEvent(new PopStateEvent("popstate"))}})};var A=v(require("dompurify"),1);var Vt=(s="'self' 'nonce-rAnd0m123' 'unsafe-inline' 'unsafe-eval'",t="'self' 'nonce-rAnd0m123'",e="'none'",n="'self' https://fonts.googleapis.com https://fonts.gstatic.com",r="'self' https://blogger.googleusercontent.com",i=["'self'","https://fonts.googleapis.com","https://fonts.gstatic.com","https://www.google.com/maps/"],a="'self' https://www.youtube.com",o="'self'",c="/csp-report",l=!1)=>{let u=()=>{try{let d=document.querySelector('meta[http-equiv="Content-Security-Policy"]');d||(d=document.createElement("meta"),d.setAttribute("http-equiv","Content-Security-Policy"),document.head.appendChild(d));let h=l?`report-uri ${c};`:"";d.setAttribute("content",`default-src 'self'; script-src ${s}; style-src ${t}; object-src ${e}; font-src ${n}; img-src ${r}; connect-src ${i.join(" ")}; frame-src ${a}; base-uri ${o}; ${h}`)}catch(d){console.error("Error adding CSP meta element:",d)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",u):u()};var Tt=(s,t)=>{let e={name:A.default.sanitize(s.name||""),title:A.default.sanitize(s.title||""),description:A.default.sanitize(s.description||"Default description"),author:A.default.sanitize(s.author||""),favicon:s.favicon},n=g=>{e.name=A.default.sanitize(g),p("name",e.name)},r=g=>{e.title=A.default.sanitize(g),document.title=e.title},i=g=>{e.description=A.default.sanitize(g),p("description",e.description)},a=g=>{e.author=A.default.sanitize(g),p("author",e.author)},o=g=>{e.favicon=A.default.sanitize(g);let y=document.querySelector('link[rel="icon"]');y||(y=document.createElement("link"),y.rel="icon",document.head.appendChild(y)),y.href=e.favicon},c=()=>e.name,l=()=>e.title,u=()=>e.description,d=()=>e.author,h=()=>e.favicon,f=()=>e,E=(g,y)=>{let _=document.createElement("meta");_.setAttribute("name",g),_.setAttribute("content",y),document.head.appendChild(_)},p=(g,y)=>{let _=document.querySelector(`meta[name="${g}"]`);_?_.setAttribute("content",y):E(g,y)},S=()=>{e.title&&(document.title=e.title),e.name&&p("name",e.name),e.description&&p("description",e.description),e.author&&p("author",e.author),e.favicon&&o(e.favicon)};return t&&Vt(t.scriptSrc,t.styleSrc,t.objectSrc,Array.isArray(t.connectSrc)?t.connectSrc.join(" "):t.connectSrc,t.reportOnly!==void 0?String(t.reportOnly):void 0),S(),{setName:n,setTitle:r,setDescription:i,setAuthor:a,setFavicon:o,getName:c,getTitle:l,getDescription:u,getAuthor:d,getFavicon:h,getAllMetaData:f,appendMetaTagsToHead:S}};var Kt=v(require("dompurify"),1),$=(s,t,e,n,r)=>{let i=`#${s}`,a=t.querySelectorAll(i);if(a.length===0)throw new Error(`[useTSComponent] No element found with id '${s}' in the given parent.`);if(a.length>1)throw new Error(`[useTSComponent] Duplicate id '${s}' detected. Found ${a.length} elements.`);let o=a[0];o.innerHTML=Kt.default.sanitize(o.innerHTML,{USE_PROFILES:{html:!0}}),e(o,n,r)};var _t=(s,t,e,n=[])=>{let r=new Set;s.forEach((i,a)=>{if(r.has(i)){console.warn(`[useTSCollection] Duplicate ID in collection array: "${i}" \u2014 skipping.`);return}r.add(i);let o=t.querySelectorAll(`#${i}`);if(o.length>1){console.warn(`[useTSCollection] Duplicate ID in DOM: "${i}" (${o.length} elements found) \u2014 skipping component mount.`);return}let c=e[a],l=Array.isArray(n)?n[a]:void 0;typeof c=="function"?$(i,t,c,l):console.warn(`[useTSCollection] No valid component function found for ID: "${i}"`)})};var H=(s,t)=>{let n=(t??document).querySelectorAll(s);if(n.length===0)return process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] No element found for selector: '${s}'`),null;if(s.startsWith("#")&&n.length>1){if(process.env.NODE_ENV!=="production")throw new Error(`[useTSSelect] Duplicate ID detected: '${s}'. Found ${n.length} elements with this ID.`);return n[0]}return n.length>1&&process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] Multiple elements found for selector: '${s}'. Returning the first one.`),n[0]};var Qt=require("jwt-decode"),St=(s,t)=>{let e=localStorage.getItem("token");if(!e)return window.location.href=t,null;try{let n=(0,Qt.jwtDecode)(e),r=Date.now()/1e3;return n.exp&&n.exp<r&&(console.error("Token has expired"),window.localStorage.removeItem("token"),window.location.href=t),null}catch(n){return console.error("Invalid token:",n),window.location.href=t,null}};var K=(s,t,e)=>{s.forEach(n=>{t.forEach(r=>{n.addEventListener(r,i=>{e(n,i)})})})};var Pt=()=>({back:()=>window.history.back(),forward:()=>window.history.forward()});var vt=(s,t)=>{let e=document.querySelector(`#${s}`)||document.querySelector(`.${s}`);if(!e)return;let n=window.location.pathname.replace(/\/$/,"");for(let r of t){let i=r.path.replace(/\/$/,"");if(n===i||n.startsWith(`${i}/`)){r.component(e);break}}};function Rt(s,t){let e=window.location.pathname.replace(/\/$/,"");t.routes.forEach(n=>{n.children?.length&&n.children.forEach(r=>{let i=r.path.replace(/\/$/,"");if(e===i||e.startsWith(`${i}/`)){let a=s.querySelector(`#${r.outlet}`)||s.querySelector(`.${r.outlet}`);a instanceof HTMLElement&&r.element&&r.element(a)}})})}var Zt=require("zustand/vanilla");function bt(s){let t=(0,Zt.createStore)(()=>({value:s})),e=new Set;return{get:()=>t.getState().value,set:n=>{t.setState({value:n}),e.forEach(r=>r(n))},subscribe:n=>(e.add(n),n(t.getState().value),()=>e.delete(n))}}function Lt(s){let t=s();typeof t=="function"&&t()}var xt=async()=>{let s="https://cdn.jsdelivr.net/npm/brython@3/brython.min.js",t="https://cdn.jsdelivr.net/npm/brython@3/brython_stdlib.js",e=n=>new Promise((r,i)=>{let a=document.createElement("script");a.src=n,a.onload=()=>r(),a.onerror=()=>i(new Error(`Failed to load ${n}`)),document.head.appendChild(a)});await e(s),await e(t),typeof window.brython=="function"?window.brython():console.error("Brython did not load correctly.")},At=s=>new Promise((t,e)=>{let n=document.createElement("script");n.type="text/python",n.src=`/src/python/${s}`,n.onload=()=>t(),n.onerror=()=>e(new Error(`Failed to load ${s}`)),document.body.appendChild(n)});function Dt(s){let t=null;return async(e,n)=>{try{if(!t){let r=await s();t=r.default||r}if(typeof t=="function")return t(e,n);if(t instanceof HTMLElement){let r=t.cloneNode(!0);return e?.appendChild(r),r}if(typeof t=="object"&&t!==null&&"render"in t&&typeof t.render=="function")return t.render(e,n);console.warn("useTSLazy: Unsupported module type",t)}catch(r){console.error("useTSLazy failed:",r)}}}var Mt=s=>typeof window>"u"?{isDOM:null}:{isDOM:s||document.body};var Jt=require("lodash-es"),Ct=s=>s;typeof window<"u"&&typeof document<"u"&&(Ct=s=>{let t=document.createElement("div");return t.innerText=s,t.innerHTML});var ke=s=>{(s?Array.isArray(s)?s:s instanceof HTMLAnchorElement?[s]:Array.from(s):Array.from(document.querySelectorAll("a"))).forEach(e=>{if(!e||e.dataset.anchorEnhanced==="true")return;e.dataset.anchorEnhanced="true";let n=e.getAttribute("class")||"";e.setAttribute("class",Ct(n));let r=e.getAttribute("aria-label");r&&e.setAttribute("aria-label",Ct(r));let i=e.querySelector(":scope > *");i&&(e.innerHTML="",e.appendChild(i));let a=e.getAttribute("href")||"";if(!a.startsWith("#")){try{if(new URL(a,window.location.href).origin!==window.location.origin)return}catch{return}e.addEventListener("click",o=>{o.preventDefault();let c=e.getAttribute("href")||"";try{let l=new URL(c,window.location.href);window.history.pushState({},"",l.pathname+l.search+l.hash),window.dispatchEvent(new PopStateEvent("popstate"))}catch(l){console.error("Invalid URL in anchor:",c,l)}})}})},$e=(0,Jt.debounce)(ke,50),z=s=>{$e(s)};var Ot=s=>{if(!s)return;let t=H("a",s);z(t)};var Ft=v(require("dompurify"),1);var te=require("zustand/vanilla"),ee=v(require("dompurify"),1),O=(0,te.createStore)(s=>({params:{},query:{},setParams:t=>s(()=>({params:Xt(t)})),setQuery:t=>s(()=>({query:Xt(t)}))}));function Xt(s){let t={};for(let e in s)t[e]=ee.default.sanitize(s[e]);return t}var Q=class{constructor(t,e){this.routes=[];this.routes=t,this.expectedParams=new Set(e),window.addEventListener("popstate",this.handlePopState.bind(this)),this.handlePopState()}handlePopState(){let t=window.location.pathname,e=window.location.search,n=this.parseQueryParams(e),r=this.findMatchingRoute(t,this.routes);if(r){if(r.routeto){this.navigate(r.routeto);return}let i=this.filterAndSanitizeParams(r.params);O.getState().setParams(i),O.getState().setQuery(n);let a=document.createElement("div");if(r.element?.(a,i,n),r.children){let o=t.slice(r.path.length),c=a.querySelector("#child");c&&this.renderChildren(r.children,o,c,i,n)}}else{let i=this.findMatchingRoute("*",this.routes);if(i){let a=this.filterAndSanitizeParams(i.params);O.getState().setParams(a),O.getState().setQuery(n);let o=document.createElement("div");i.element?.(o,a,n)}}}renderChildren(t,e,n,r,i){if(!t||t.length===0){let o=n.querySelector("#child");o&&o.remove();return}let a=this.findMatchingRoute(e,t);if(a){let o=document.createElement("div");o.id="child";let c={...r,...a.params},l=this.filterAndSanitizeParams(c);if(O.getState().setParams(l),O.getState().setQuery(i),a.element?.(o,l,i),n.appendChild(o),a.children){let u=e.slice(a.path.length);this.renderChildren(a.children,u,o,l,i)}}}parseQueryParams(t){let e={},n=new URLSearchParams(t);for(let[r,i]of n.entries())this.expectedParams.has(r)&&(e[r]=Ft.default.sanitize(i));return e}findMatchingRoute(t,e,n={}){for(let r of e){let i=r.path;if(i==="*")return r;{let o=[],c=i.replace(/:[^\s/]+/g,d=>(o.push(d.substring(1)),"([^\\s/]+)")),l=new RegExp(`^${c}(?:/|$)`),u=t.match(l);if(u){let d={...n};if(o.forEach((h,f)=>{d[h]=u[f+1]??""}),r.children){let h=t.slice(u[0].length),f=this.findMatchingRoute(h,r.children,d);if(f)return f}return{...r,params:d}}}}}filterAndSanitizeParams(t){if(!t)return{};let e={};for(let n in t)this.expectedParams.has(n)&&(e[n]=Ft.default.sanitize(t[n]??""));return e}navigate(t){history.pushState(null,"",t),this.handlePopState()}addRoute(t){this.routes.push(t)}};var x=v(require("path"),1),Le=()=>({name:"ts-filebased-router",async buildStart(){if(typeof process>"u"||!process.versions?.node)return;let s=await import("fs/promises"),t=await Promise.resolve().then(()=>(be(),Re)),e=x.default.resolve("src/pages"),n=x.default.resolve("src/gen"),r=x.default.resolve("src/routes"),i=x.default.join(n,"tsrouter.gen.ts"),a=x.default.join(r,"__root.ts"),o=process.env.NODE_ENV!=="production";async function c(p){try{await s.mkdir(p,{recursive:!0})}catch{}}function l(p,S){let g="/"+x.default.relative(S,p).replace(/\\/g,"/");return g=g.replace(/\.ts$/,"").replace(/\/index$/,"")||"/",g.replace(/\[(.+?)\]/g,":$1")}function u(p){return p.replace(/^\//,"").split("/").map(S=>S.startsWith(":")?S.slice(1):S).filter(Boolean).join("-")||"index"}function d(p,S){let y=x.default.relative(S,p).replace(/\\/g,"/").split("/").filter(Boolean),_=y[y.length-1].replace(".ts",""),D=y.length>1?y[y.length-2]:"";if(_==="index")return D?D.charAt(0).toUpperCase()+D.slice(1):"Index";if(_.startsWith("[")&&_.endsWith("]")){let P=_.slice(1,-1);return D.charAt(0).toUpperCase()+P.charAt(0).toUpperCase()+P.slice(1)}return _.charAt(0).toUpperCase()+_.slice(1)}async function h(p){let S=await s.readdir(p,{withFileTypes:!0}),g=[];for(let y of S){let _=x.default.join(p,y.name);if(y.isDirectory())g=g.concat(await h(_));else if(y.isFile()&&y.name.endsWith(".ts")){let D=l(_,e),P=u(D),q=d(_,e);g.push({file:_,route:D,routeName:P,importName:q})}}return g}function f(){return`import { createRouter } from "@/gen/tsrouter.gen";
|
|
2
|
+
|
|
2
3
|
export const Router = async (DOM: HTMLElement) => {
|
|
3
4
|
const router = await createRouter(DOM);
|
|
5
|
+
|
|
4
6
|
await router.navigate(window.location.pathname + window.location.search);
|
|
7
|
+
|
|
5
8
|
window.addEventListener("popstate", () => {
|
|
6
9
|
void router.navigate(window.location.pathname + window.location.search, false);
|
|
7
10
|
});
|
|
8
|
-
};`}async function
|
|
11
|
+
};`}async function E(){let p=await h(e),S=p.find(P=>P.route==="/notfound"),g=p.filter(P=>P.route!=="/notfound");for(let P of p)if(!(await s.readFile(P.file,"utf-8")).trim()){let Y=P.importName,B=P.route.includes(":");await s.writeFile(P.file,`import { html, useTSElements, useTSMetaData${B?", useTSExtractParams":""} } from "@devwareng/vanilla-ts";
|
|
9
12
|
|
|
10
13
|
export default function ${Y}(DOM: HTMLElement) {
|
|
11
14
|
useTSMetaData({
|
|
@@ -15,22 +18,23 @@ export default function ${Y}(DOM: HTMLElement) {
|
|
|
15
18
|
favicon: "/favicon.ico",
|
|
16
19
|
});
|
|
17
20
|
|
|
18
|
-
const params = useTSExtractParams("${P.route}")
|
|
19
|
-
|
|
21
|
+
${B?`const params = useTSExtractParams("${P.route}");`:""}
|
|
22
|
+
|
|
23
|
+
${B?"if (Object.values(params).some(v => !v)) return;":""}
|
|
20
24
|
|
|
21
25
|
const ui = useTSElements(
|
|
22
26
|
DOM,
|
|
23
27
|
html\`
|
|
24
28
|
<div>
|
|
25
29
|
<h1>${Y}</h1>
|
|
26
|
-
${
|
|
30
|
+
${B?"<pre>${JSON.stringify(params, null, 2)}</pre>":""}
|
|
27
31
|
</div>
|
|
28
32
|
\`
|
|
29
33
|
);
|
|
30
34
|
|
|
31
35
|
return ui;
|
|
32
|
-
}`,"utf-8")}let
|
|
33
|
-
`),
|
|
36
|
+
}`,"utf-8")}let y=g.map(P=>{let q="../pages/"+x.default.relative(e,P.file).replace(/\\/g,"/").replace(/\.ts$/,"");return`{ path: "${P.route}", name: "${P.routeName}", component: useTSLazy(() => import("${q}")) }`}).join(`,
|
|
37
|
+
`),D=`// AUTO-GENERATED FILE
|
|
34
38
|
import { useTSLazy, html, useTSElements } from "@devwareng/vanilla-ts";
|
|
35
39
|
|
|
36
40
|
type Route = {
|
|
@@ -39,28 +43,26 @@ type Route = {
|
|
|
39
43
|
component: (DOM: HTMLElement) => Promise<any>;
|
|
40
44
|
};
|
|
41
45
|
|
|
42
|
-
${S?`export const NotFound = useTSLazy(() => import("../pages/${x.default.relative(e,S.file).replace(/\\/g,"/").replace(/\.ts$/,"")}"))`:
|
|
46
|
+
${S?`export const NotFound = useTSLazy(() => import("../pages/${x.default.relative(e,S.file).replace(/\\/g,"/").replace(/\.ts$/,"")}"))`:"export function NotFound(DOM: HTMLElement) {\n return useTSElements(DOM, html`<div><h1>404 - Page Not Found</h1></div>`);\n}"}
|
|
43
47
|
|
|
44
48
|
export const routeTree: Route[] = [
|
|
45
|
-
${
|
|
49
|
+
${y}
|
|
46
50
|
];
|
|
47
51
|
|
|
48
52
|
export async function createRouter(DOM: HTMLElement) {
|
|
53
|
+
|
|
49
54
|
function matchRoute(path: string) {
|
|
50
55
|
for (const route of routeTree) {
|
|
51
|
-
const
|
|
52
|
-
const regex = new RegExp("^" + route.path.replace(/:([^/]+)/g, (_, key) => { keys.push(key); return "([^/]+)" }) + "$");
|
|
56
|
+
const regex = new RegExp("^" + route.path.replace(/:([^/]+)/g, "([^/]+)") + "$");
|
|
53
57
|
const pathname = path.split("?")[0];
|
|
54
|
-
|
|
55
|
-
if (match) {
|
|
56
|
-
return route; // params extracted inside component
|
|
57
|
-
}
|
|
58
|
+
if (pathname?.match(regex)) return route;
|
|
58
59
|
}
|
|
59
60
|
return null;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
async function navigate(path: string, pushState: boolean = true) {
|
|
63
64
|
const match = matchRoute(path);
|
|
65
|
+
|
|
64
66
|
if (match) {
|
|
65
67
|
await match.component(DOM);
|
|
66
68
|
if (pushState) history.pushState({}, "", path);
|
|
@@ -71,7 +73,7 @@ export async function createRouter(DOM: HTMLElement) {
|
|
|
71
73
|
|
|
72
74
|
return { navigate, routes: routeTree };
|
|
73
75
|
}
|
|
74
|
-
`;await c(
|
|
76
|
+
`;await c(n),await s.writeFile(i,D,"utf-8"),await s.writeFile(a,f(),"utf-8")}await c(n),await c(r),await c(e),await E(),o&&(t.watch(e).on("all",async(S,g)=>{g.endsWith(".ts")&&await E()}),t.watch(a).on("unlink",async()=>{await s.writeFile(a,f(),"utf-8")})),console.log("\u{1F7E2} TS Filebased Router Generated (Smart Params Enabled)")}});0&&(module.exports={TSFilebasedRouter,TSRouter,createEffect,createSignal,html,loadPyFiles,mapper,renderChildRoutes,useAnchor,useAnchorSingle,useInitialDOM,useTSAuth,useTSCollection,useTSComponent,useTSElementEach,useTSElements,useTSEvent,useTSEventAll,useTSExtractParams,useTSLazy,useTSMetaData,useTSNavigate,useTSNoReload,useTSOutlet,useTSParams,useTSPurifier,useTSSSRHydration,useTSSelect,useTSloadBrython});
|
|
75
77
|
/*! Bundled license information:
|
|
76
78
|
|
|
77
79
|
chokidar/esm/index.js:
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
function de(n){let t=n==null?"":String(n),e=t.toLowerCase();return(e.includes("<script")||e.includes("javascript:"))&&(t=""),t=t.replace(/url\(\s*(['"])?\s*\1?\s*\)/gi,""),t.replace(/<\s*(script|iframe|object|embed|link|style|meta|body)[^>]*>.*?<\s*\/\s*\1\s*>/gi,"").replace(/<\s*(script|iframe|object|embed|link|style|meta)[^>]*>/gi,"").replace(/\s+on\w+\s*=\s*(['"]).*?\1/gi,"").replace(/\s+on\w+\s*=\s*[^\s>]+/gi,"").replace(/\s(href|src)\s*=\s*(['"]?)\s*(javascript:|vbscript:|data:|file:)[^'">\s]*\2/gi,'$1="#"')}function N(n,...t){return n.reduce((e,r,o)=>{let i=o<t.length?de(t[o]):"";return e+r+i},"")}var me=n=>n.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|textarea|svg|math|body)[^>]*>/gi,"").replace(/<(?!\/?(b|i|em|strong|p|br|ul|ol|li|a|div|span|h1|h2|h3|h4|h5|h6|section|article|input|button)\b)[^>]*>/gi,"").replace(/\s+on[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s*style\s*=\s*("[^"]*"|'[^']*')/gi,"").replace(/<a\b([^>]*)href\s*=\s*(['"]?)(?!https?:|#)[^'"\s>]+(['"]?)([^>]*)>/gi,"<a$1$4>").replace(/\s+(href|src)\s*=\s*(['"]?)\s*(javascript:|data:)[^'"\s>]*/gi,"").replace(/<a\b([^>]*)\bhref\s*=\s*(['"])(\/blog|#blog)\2([^>]*)>/gi,'<a$1 href=$2$3$2 href-line="true"$4>').trim(),pe=n=>n?.map(t=>me(t)).join("")??"";import F from"dompurify";var _=(n,t)=>{let r={...{ADD_TAGS:["my-custom-tag"]},...t};return typeof n=="string"?F.sanitize(n,r):F.sanitize(n.innerHTML,r)};var z=(n,t,e)=>{if(typeof n=="string"){let r=document.getElementById(n);r?r.addEventListener(t,e):console.warn(`Element with id '${n}' not found.`)}else n instanceof HTMLElement?n.addEventListener(t,e):n===document?document.addEventListener(t,e):console.warn("Invalid target parameter provided.")};import{createStore as fe}from"zustand/vanilla";import I from"dompurify";function he(n,t){let e=[],r=n.replace(/:[^/]+/g,s=>(e.push(s.slice(1)),"([^/]+)")),o=new RegExp(`^${r}$`),i=t.match(o),a={};return i&&e.forEach((s,c)=>{a[s]=I.sanitize(i[c+1]??"")}),a}function ge(n){let t={},e=new URLSearchParams(n);for(let[r,o]of e.entries())t[r]=I.sanitize(o);return t}var P=fe((n,t)=>({params:{},query:{},setFromPattern:e=>{let r=window.location.pathname,o=he(e,r),i=ge(window.location.search);n({params:o,query:i})},getParam:e=>t().params[e],getQuery:e=>t().query[e]}));function q(n){let t=P.getState();t.setFromPattern(n);let e=t.params,r=t.query;return{...e,...r}}var U=(n,t,e)=>{let r=document.querySelectorAll(n);return r.forEach(o=>{o.addEventListener(t,e)}),()=>{r.forEach(o=>{o.removeEventListener(t,e)})}};import j from"dompurify";var B=(n,t,e={},r)=>{let o={USE_PROFILES:{svg:!0,html:!0},ALLOWED_TAGS:["svg","path","circle","rect","line","polyline","polygon","g","main","div","h1","h2","h3","h4","h5","h6","p","button","span","a","img","input","ul","li","i","label","form"],ALLOWED_ATTR:["class","id","href","src","alt","title","fill","stroke","stroke-width","viewBox","xmlns","d","x","y","cx","cy","r","width","height","type","name","value","placeholder","data-click","data-change","data-select","data-classlist","data-hover","data-submit","data-key","data-event"],FORBID_TAGS:["script","iframe","foreignObject","body","html"],FORBID_ATTR:["style","xlink:href"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|ftp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,...r};j.addHook("uponSanitizeAttribute",(s,c)=>{let l=(c.attrName||"").toLowerCase(),d=(c.attrValue??"").toString().trim();if(l.startsWith("on")){c.keepAttr=!1;return}if(/^data-(click|change|submit|select|hover|classlist|key|event)$/.test(l)){c.keepAttr=!0;return}if(s.nodeName.toLowerCase()==="img"&&l==="src"){/^https?:\/\//i.test(d)||/^\/(?!\/)/.test(d)||/^data:image\/(png|jpeg|jpg|gif|webp);base64,/i.test(d)||(c.keepAttr=!1);return}if(l==="class"){let S=d.split(/\s+/).filter(Boolean).filter(h=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]*$/.test(h)){if(/^bg-\[url\(.*\)\]$/.test(h)){let v=h.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return v===""||/^https?:\/\//i.test(v)||/^\/(?!\/)/.test(v)||/^\.{0,2}\//.test(v)}return/^bg-\[\]$/.test(h),!0}return!1});c.attrValue=S.join(" ");return}});let i=j.sanitize(t,{...o,RETURN_DOM_FRAGMENT:!0});for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(i);let a=(s,c)=>{n.querySelectorAll(`[${s}]`).forEach(l=>{let d=l.getAttribute(s);d&&Object.prototype.hasOwnProperty.call(e,d)&&l.addEventListener(c,m=>{c==="submit"&&m.preventDefault(),e[d](m)})})};a("data-click","click"),a("data-change","change"),a("data-select","select"),a("data-submit","submit"),n.querySelectorAll("[data-key]").forEach(s=>{let c=s.dataset.key,l=s.dataset.event??"click";c&&Object.prototype.hasOwnProperty.call(e,c)&&s.addEventListener(l,e[c])}),n.querySelectorAll("[data-hover]").forEach(s=>{let c=s.dataset.hover;c&&Object.prototype.hasOwnProperty.call(e,c)&&(s.addEventListener("mouseenter",e[c]),s.addEventListener("mouseleave",e[c]))}),n.querySelectorAll("[data-classlist]").forEach(s=>{let c=s.dataset.classlist;/^[a-zA-Z0-9\-\s:_]+$/.test(c)&&s.classList.add(...c.split(/\s+/))})};import W from"dompurify";var x=null,G=(n,t)=>{if(typeof document>"u")return;let e=document.getElementById(n);if(!e)return;W.addHook("uponSanitizeAttribute",(a,s)=>{let c=(s.attrName||"").toLowerCase(),l=(s.attrValue??"").toString().trim();if(c.startsWith("on")){s.keepAttr=!1;return}if((c==="href"||c==="src")&&/^(javascript:|vbscript:|data:|file:|about:)/i.test(l)){s.keepAttr=!1;return}if(c==="class"){let m=l.split(/\s+/).filter(Boolean).filter(S=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]+$/.test(S)){if(/^bg-\[url\(.*\)\]$/.test(S)){let h=S.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return h===""||/^https?:\/\//i.test(h)||/^\/(?!\/)/.test(h)||/^\.{0,2}\//.test(h)}return!0}return!1});s.attrValue=m.join(" ");return}if(c==="style"){s.keepAttr=!1;return}});let r=e.cloneNode(!0),o=W.sanitize(r.innerHTML,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["div","span","p","h1","h2","h3","h4","h5","h6","ul","ol","li","strong","em","a","img","br","form","button","input","label"],ALLOWED_ATTR:["href","src","alt","title","class","id","type","name","value","placeholder","data-click","data-change","data-submit","data-select","data-hover","data-classlist"],FORBID_TAGS:["script","iframe","object","embed","body","html","svg","math","link","meta"],ALLOW_DATA_ATTR:!0,KEEP_CONTENT:!1,RETURN_DOM_FRAGMENT:!0}),i=Array.from(o.childNodes).map(a=>a.outerHTML||a.textContent||"").join("");if(x!==null&&i!==x){let a=document.createElement("div");t(a);let c=new DOMParser().parseFromString(x,"text/html");for(;e.firstChild;)e.removeChild(e.firstChild);c.body.childNodes.forEach(l=>e.appendChild(l.cloneNode(!0)))}else{for(x=i;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(o),t(e)}};import V from"dompurify";typeof window<"u"&&!window.__anchorSinglePopstateHandlerAttached&&(window.addEventListener("popstate",n=>{let t=n.state;t?.scrollPosition!==void 0&&window.scrollTo(0,t.scrollPosition)}),window.__anchorSinglePopstateHandlerAttached=!0);var Q=(n,t,e,r="",o=null)=>{if(!n)return;let i=V.sanitize(t,{ALLOWED_URI_REGEXP:/^(https?:|\/)/}),a=V.sanitize(e,{USE_PROFILES:{html:!1}});n.setAttribute("href",i),n.setAttribute("aria-label",a),r&&(n.className=r.trim()),o&&n.replaceChildren(o),typeof window<"u"&&n.addEventListener("click",s=>{s.preventDefault();let l=s.currentTarget.getAttribute("href");if(l){let d=window.scrollY;window.scrollTo(0,0),window.history.pushState({scrollPosition:d},"",l),dispatchEvent(new PopStateEvent("popstate"))}})};import L from"dompurify";var K=(n="'self' 'nonce-rAnd0m123' 'unsafe-inline' 'unsafe-eval'",t="'self' 'nonce-rAnd0m123'",e="'none'",r="'self' https://fonts.googleapis.com https://fonts.gstatic.com",o="'self' https://blogger.googleusercontent.com",i=["'self'","https://fonts.googleapis.com","https://fonts.gstatic.com","https://www.google.com/maps/"],a="'self' https://www.youtube.com",s="'self'",c="/csp-report",l=!1)=>{let d=()=>{try{let m=document.querySelector('meta[http-equiv="Content-Security-Policy"]');m||(m=document.createElement("meta"),m.setAttribute("http-equiv","Content-Security-Policy"),document.head.appendChild(m));let S=l?`report-uri ${c};`:"";m.setAttribute("content",`default-src 'self'; script-src ${n}; style-src ${t}; object-src ${e}; font-src ${r}; img-src ${o}; connect-src ${i.join(" ")}; frame-src ${a}; base-uri ${s}; ${S}`)}catch(m){console.error("Error adding CSP meta element:",m)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",d):d()};var Y=(n,t)=>{let e={name:L.sanitize(n.name||""),title:L.sanitize(n.title||""),description:L.sanitize(n.description||"Default description"),author:L.sanitize(n.author||""),favicon:n.favicon},r=u=>{e.name=L.sanitize(u),p("name",e.name)},o=u=>{e.title=L.sanitize(u),document.title=e.title},i=u=>{e.description=L.sanitize(u),p("description",e.description)},a=u=>{e.author=L.sanitize(u),p("author",e.author)},s=u=>{e.favicon=L.sanitize(u);let f=document.querySelector('link[rel="icon"]');f||(f=document.createElement("link"),f.rel="icon",document.head.appendChild(f)),f.href=e.favicon},c=()=>e.name,l=()=>e.title,d=()=>e.description,m=()=>e.author,S=()=>e.favicon,h=()=>e,v=(u,f)=>{let g=document.createElement("meta");g.setAttribute("name",u),g.setAttribute("content",f),document.head.appendChild(g)},p=(u,f)=>{let g=document.querySelector(`meta[name="${u}"]`);g?g.setAttribute("content",f):v(u,f)},E=()=>{e.title&&(document.title=e.title),e.name&&p("name",e.name),e.description&&p("description",e.description),e.author&&p("author",e.author),e.favicon&&s(e.favicon)};return t&&K(t.scriptSrc,t.styleSrc,t.objectSrc,Array.isArray(t.connectSrc)?t.connectSrc.join(" "):t.connectSrc,t.reportOnly!==void 0?String(t.reportOnly):void 0),E(),{setName:r,setTitle:o,setDescription:i,setAuthor:a,setFavicon:s,getName:c,getTitle:l,getDescription:d,getAuthor:m,getFavicon:S,getAllMetaData:h,appendMetaTagsToHead:E}};import Te from"dompurify";var D=(n,t,e,r,o)=>{let i=`#${n}`,a=t.querySelectorAll(i);if(a.length===0)throw new Error(`[useTSComponent] No element found with id '${n}' in the given parent.`);if(a.length>1)throw new Error(`[useTSComponent] Duplicate id '${n}' detected. Found ${a.length} elements.`);let s=a[0];s.innerHTML=Te.sanitize(s.innerHTML,{USE_PROFILES:{html:!0}}),e(s,r,o)};var Z=(n,t,e,r=[])=>{let o=new Set;n.forEach((i,a)=>{if(o.has(i)){console.warn(`[useTSCollection] Duplicate ID in collection array: "${i}" \u2014 skipping.`);return}o.add(i);let s=t.querySelectorAll(`#${i}`);if(s.length>1){console.warn(`[useTSCollection] Duplicate ID in DOM: "${i}" (${s.length} elements found) \u2014 skipping component mount.`);return}let c=e[a],l=Array.isArray(r)?r[a]:void 0;typeof c=="function"?D(i,t,c,l):console.warn(`[useTSCollection] No valid component function found for ID: "${i}"`)})};var R=(n,t)=>{let r=(t??document).querySelectorAll(n);if(r.length===0)return process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] No element found for selector: '${n}'`),null;if(n.startsWith("#")&&r.length>1){if(process.env.NODE_ENV!=="production")throw new Error(`[useTSSelect] Duplicate ID detected: '${n}'. Found ${r.length} elements with this ID.`);return r[0]}return r.length>1&&process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] Multiple elements found for selector: '${n}'. Returning the first one.`),r[0]};import{jwtDecode as Se}from"jwt-decode";var J=(n,t)=>{let e=localStorage.getItem("token");if(!e)return window.location.href=t,null;try{let r=Se(e),o=Date.now()/1e3;return r.exp&&r.exp<o&&(console.error("Token has expired"),window.localStorage.removeItem("token"),window.location.href=t),null}catch(r){return console.error("Invalid token:",r),window.location.href=t,null}};var C=(n,t,e)=>{n.forEach(r=>{t.forEach(o=>{r.addEventListener(o,i=>{e(r,i)})})})};var X=()=>({back:()=>window.history.back(),forward:()=>window.history.forward()});var ee=(n,t)=>{let e=document.querySelector(`#${n}`)||document.querySelector(`.${n}`);if(!e)return;let r=window.location.pathname.replace(/\/$/,"");for(let o of t){let i=o.path.replace(/\/$/,"");if(r===i||r.startsWith(`${i}/`)){o.component(e);break}}};function te(n,t){let e=window.location.pathname.replace(/\/$/,"");t.routes.forEach(r=>{r.children?.length&&r.children.forEach(o=>{let i=o.path.replace(/\/$/,"");if(e===i||e.startsWith(`${i}/`)){let a=n.querySelector(`#${o.outlet}`)||n.querySelector(`.${o.outlet}`);a instanceof HTMLElement&&o.element&&o.element(a)}})})}import{createStore as Ee}from"zustand/vanilla";function ne(n){let t=Ee(()=>({value:n})),e=new Set;return{get:()=>t.getState().value,set:r=>{t.setState({value:r}),e.forEach(o=>o(r))},subscribe:r=>(e.add(r),r(t.getState().value),()=>e.delete(r))}}function re(n){let t=n();typeof t=="function"&&t()}var oe=async()=>{let n="https://cdn.jsdelivr.net/npm/brython@3/brython.min.js",t="https://cdn.jsdelivr.net/npm/brython@3/brython_stdlib.js",e=r=>new Promise((o,i)=>{let a=document.createElement("script");a.src=r,a.onload=()=>o(),a.onerror=()=>i(new Error(`Failed to load ${r}`)),document.head.appendChild(a)});await e(n),await e(t),typeof window.brython=="function"?window.brython():console.error("Brython did not load correctly.")},se=n=>new Promise((t,e)=>{let r=document.createElement("script");r.type="text/python",r.src=`/src/python/${n}`,r.onload=()=>t(),r.onerror=()=>e(new Error(`Failed to load ${n}`)),document.body.appendChild(r)});function ie(n){let t=null;return async(e,r)=>{try{if(!t){let o=await n();t=o.default||o}if(typeof t=="function")return t(e,r);if(t instanceof HTMLElement){let o=t.cloneNode(!0);return e?.appendChild(o),o}if(typeof t=="object"&&t!==null&&"render"in t&&typeof t.render=="function")return t.render(e,r);console.warn("useTSLazy: Unsupported module type",t)}catch(o){console.error("useTSLazy failed:",o)}}}var ae=n=>typeof window>"u"?{isDOM:null}:{isDOM:n||document.body};import{debounce as ye}from"lodash-es";var H=n=>n;typeof window<"u"&&typeof document<"u"&&(H=n=>{let t=document.createElement("div");return t.innerText=n,t.innerHTML});var ve=n=>{(n?Array.isArray(n)?n:n instanceof HTMLAnchorElement?[n]:Array.from(n):Array.from(document.querySelectorAll("a"))).forEach(e=>{if(!e||e.dataset.anchorEnhanced==="true")return;e.dataset.anchorEnhanced="true";let r=e.getAttribute("class")||"";e.setAttribute("class",H(r));let o=e.getAttribute("aria-label");o&&e.setAttribute("aria-label",H(o));let i=e.querySelector(":scope > *");i&&(e.innerHTML="",e.appendChild(i));let a=e.getAttribute("href")||"";if(!a.startsWith("#")){try{if(new URL(a,window.location.href).origin!==window.location.origin)return}catch{return}e.addEventListener("click",s=>{s.preventDefault();let c=e.getAttribute("href")||"";try{let l=new URL(c,window.location.href);window.history.pushState({},"",l.pathname+l.search+l.hash),window.dispatchEvent(new PopStateEvent("popstate"))}catch(l){console.error("Invalid URL in anchor:",c,l)}})}})},we=ye(ve,50),O=n=>{we(n)};var ce=n=>{if(!n)return;let t=R("a",n);O(t)};import ue from"dompurify";import{createStore as Le}from"zustand/vanilla";import Me from"dompurify";var M=Le(n=>({params:{},query:{},setParams:t=>n(()=>({params:le(t)})),setQuery:t=>n(()=>({query:le(t)}))}));function le(n){let t={};for(let e in n)t[e]=Me.sanitize(n[e]);return t}var $=class{constructor(t,e){this.routes=[];this.routes=t,this.expectedParams=new Set(e),window.addEventListener("popstate",this.handlePopState.bind(this)),this.handlePopState()}handlePopState(){let t=window.location.pathname,e=window.location.search,r=this.parseQueryParams(e),o=this.findMatchingRoute(t,this.routes);if(o){if(o.routeto){this.navigate(o.routeto);return}let i=this.filterAndSanitizeParams(o.params);M.getState().setParams(i),M.getState().setQuery(r);let a=document.createElement("div");if(o.element?.(a,i,r),o.children){let s=t.slice(o.path.length),c=a.querySelector("#child");c&&this.renderChildren(o.children,s,c,i,r)}}else{let i=this.findMatchingRoute("*",this.routes);if(i){let a=this.filterAndSanitizeParams(i.params);M.getState().setParams(a),M.getState().setQuery(r);let s=document.createElement("div");i.element?.(s,a,r)}}}renderChildren(t,e,r,o,i){if(!t||t.length===0){let s=r.querySelector("#child");s&&s.remove();return}let a=this.findMatchingRoute(e,t);if(a){let s=document.createElement("div");s.id="child";let c={...o,...a.params},l=this.filterAndSanitizeParams(c);if(M.getState().setParams(l),M.getState().setQuery(i),a.element?.(s,l,i),r.appendChild(s),a.children){let d=e.slice(a.path.length);this.renderChildren(a.children,d,s,l,i)}}}parseQueryParams(t){let e={},r=new URLSearchParams(t);for(let[o,i]of r.entries())this.expectedParams.has(o)&&(e[o]=ue.sanitize(i));return e}findMatchingRoute(t,e,r={}){for(let o of e){let i=o.path;if(i==="*")return o;{let s=[],c=i.replace(/:[^\s/]+/g,m=>(s.push(m.substring(1)),"([^\\s/]+)")),l=new RegExp(`^${c}(?:/|$)`),d=t.match(l);if(d){let m={...r};if(s.forEach((S,h)=>{m[S]=d[h+1]??""}),o.children){let S=t.slice(d[0].length),h=this.findMatchingRoute(S,o.children,m);if(h)return h}return{...o,params:m}}}}}filterAndSanitizeParams(t){if(!t)return{};let e={};for(let r in t)this.expectedParams.has(r)&&(e[r]=ue.sanitize(t[r]??""));return e}navigate(t){history.pushState(null,"",t),this.handlePopState()}addRoute(t){this.routes.push(t)}};import y from"path";var Re=()=>({name:"ts-filebased-router",async buildStart(){if(typeof process>"u"||!process.versions?.node)return;let n=await import("fs/promises"),t=await import("./esm-KRNKVVL7.js"),e=y.resolve("src/pages"),r=y.resolve("src/gen"),o=y.resolve("src/routes"),i=y.join(r,"tsrouter.gen.ts"),a=y.join(o,"__root.ts"),s=process.env.NODE_ENV!=="production";async function c(p){try{await n.mkdir(p,{recursive:!0})}catch{}}function l(p,E){let u="/"+y.relative(E,p).replace(/\\/g,"/");return u=u.replace(/\.ts$/,"").replace(/\/index$/,"")||"/",u.replace(/\[(.+?)\]/g,":$1")}function d(p){return p.replace(/^\//,"").split("/").map(E=>E.startsWith(":")?E.slice(1):E).filter(Boolean).join("-")||"index"}function m(p,E){let f=y.relative(E,p).replace(/\\/g,"/").split("/").filter(Boolean),g=f[f.length-1].replace(".ts",""),w=f.length>1?f[f.length-2]:"";if(g==="index")return w?w.charAt(0).toUpperCase()+w.slice(1):"Index";if(g.startsWith("[")&&g.endsWith("]")){let T=g.slice(1,-1);return w.charAt(0).toUpperCase()+T.charAt(0).toUpperCase()+T.slice(1)}return g.charAt(0).toUpperCase()+g.slice(1)}async function S(p){let E=await n.readdir(p,{withFileTypes:!0}),u=[];for(let f of E){let g=y.join(p,f.name);if(f.isDirectory())u=u.concat(await S(g));else if(f.isFile()&&f.name.endsWith(".ts")){let w=l(g,e),T=d(w),A=m(g,e);u.push({file:g,route:w,routeName:T,importName:A})}}return u}function h(){return`import { createRouter } from "@/gen/tsrouter.gen";
|
|
1
|
+
function de(n){let t=n==null?"":String(n),e=t.toLowerCase();return(e.includes("<script")||e.includes("javascript:"))&&(t=""),t=t.replace(/url\(\s*(['"])?\s*\1?\s*\)/gi,""),t.replace(/<\s*(script|iframe|object|embed|link|style|meta|body)[^>]*>.*?<\s*\/\s*\1\s*>/gi,"").replace(/<\s*(script|iframe|object|embed|link|style|meta)[^>]*>/gi,"").replace(/\s+on\w+\s*=\s*(['"]).*?\1/gi,"").replace(/\s+on\w+\s*=\s*[^\s>]+/gi,"").replace(/\s(href|src)\s*=\s*(['"]?)\s*(javascript:|vbscript:|data:|file:)[^'">\s]*\2/gi,'$1="#"')}function N(n,...t){return n.reduce((e,r,o)=>{let i=o<t.length?de(t[o]):"";return e+r+i},"")}var me=n=>n.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|textarea|svg|math|body)[^>]*>/gi,"").replace(/<(?!\/?(b|i|em|strong|p|br|ul|ol|li|a|div|span|h1|h2|h3|h4|h5|h6|section|article|input|button)\b)[^>]*>/gi,"").replace(/\s+on[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s*style\s*=\s*("[^"]*"|'[^']*')/gi,"").replace(/<a\b([^>]*)href\s*=\s*(['"]?)(?!https?:|#)[^'"\s>]+(['"]?)([^>]*)>/gi,"<a$1$4>").replace(/\s+(href|src)\s*=\s*(['"]?)\s*(javascript:|data:)[^'"\s>]*/gi,"").replace(/<a\b([^>]*)\bhref\s*=\s*(['"])(\/blog|#blog)\2([^>]*)>/gi,'<a$1 href=$2$3$2 href-line="true"$4>').trim(),pe=n=>n?.map(t=>me(t)).join("")??"";import F from"dompurify";var z=(n,t)=>{let r={...{ADD_TAGS:["my-custom-tag"]},...t};return typeof n=="string"?F.sanitize(n,r):F.sanitize(n.innerHTML,r)};var _=(n,t,e)=>{if(typeof n=="string"){let r=document.getElementById(n);r?r.addEventListener(t,e):console.warn(`Element with id '${n}' not found.`)}else n instanceof HTMLElement?n.addEventListener(t,e):n===document?document.addEventListener(t,e):console.warn("Invalid target parameter provided.")};import{createStore as fe}from"zustand/vanilla";import I from"dompurify";function he(n,t){let e=[],r=n.replace(/:[^/]+/g,s=>(e.push(s.slice(1)),"([^/]+)")),o=new RegExp(`^${r}$`),i=t.match(o),a={};return i&&e.forEach((s,c)=>{a[s]=I.sanitize(i[c+1]??"")}),a}function ge(n){let t={},e=new URLSearchParams(n);for(let[r,o]of e.entries())t[r]=I.sanitize(o);return t}var x=fe((n,t)=>({params:{},query:{},setFromPattern:e=>{let r=window.location.pathname,o=he(e,r),i=ge(window.location.search);n({params:o,query:i})},getParam:e=>t().params[e],getQuery:e=>t().query[e]}));function q(n){let t=x.getState();t.setFromPattern(n);let e=t.params,r=t.query;return{...e,...r}}var U=(n,t,e)=>{let r=document.querySelectorAll(n);return r.forEach(o=>{o.addEventListener(t,e)}),()=>{r.forEach(o=>{o.removeEventListener(t,e)})}};import j from"dompurify";var B=(n,t,e={},r)=>{let o={USE_PROFILES:{svg:!0,html:!0},ALLOWED_TAGS:["svg","path","circle","rect","line","polyline","polygon","g","main","div","h1","h2","h3","h4","h5","h6","p","button","span","a","img","input","ul","li","i","label","form"],ALLOWED_ATTR:["class","id","href","src","alt","title","fill","stroke","stroke-width","viewBox","xmlns","d","x","y","cx","cy","r","width","height","type","name","value","placeholder","data-click","data-change","data-select","data-classlist","data-hover","data-submit","data-key","data-event"],FORBID_TAGS:["script","iframe","foreignObject","body","html"],FORBID_ATTR:["style","xlink:href"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|ftp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,...r};j.addHook("uponSanitizeAttribute",(s,c)=>{let l=(c.attrName||"").toLowerCase(),d=(c.attrValue??"").toString().trim();if(l.startsWith("on")){c.keepAttr=!1;return}if(/^data-(click|change|submit|select|hover|classlist|key|event)$/.test(l)){c.keepAttr=!0;return}if(s.nodeName.toLowerCase()==="img"&&l==="src"){/^https?:\/\//i.test(d)||/^\/(?!\/)/.test(d)||/^data:image\/(png|jpeg|jpg|gif|webp);base64,/i.test(d)||(c.keepAttr=!1);return}if(l==="class"){let S=d.split(/\s+/).filter(Boolean).filter(h=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]*$/.test(h)){if(/^bg-\[url\(.*\)\]$/.test(h)){let v=h.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return v===""||/^https?:\/\//i.test(v)||/^\/(?!\/)/.test(v)||/^\.{0,2}\//.test(v)}return/^bg-\[\]$/.test(h),!0}return!1});c.attrValue=S.join(" ");return}});let i=j.sanitize(t,{...o,RETURN_DOM_FRAGMENT:!0});for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(i);let a=(s,c)=>{n.querySelectorAll(`[${s}]`).forEach(l=>{let d=l.getAttribute(s);d&&Object.prototype.hasOwnProperty.call(e,d)&&l.addEventListener(c,m=>{c==="submit"&&m.preventDefault(),e[d](m)})})};a("data-click","click"),a("data-change","change"),a("data-select","select"),a("data-submit","submit"),n.querySelectorAll("[data-key]").forEach(s=>{let c=s.dataset.key,l=s.dataset.event??"click";c&&Object.prototype.hasOwnProperty.call(e,c)&&s.addEventListener(l,e[c])}),n.querySelectorAll("[data-hover]").forEach(s=>{let c=s.dataset.hover;c&&Object.prototype.hasOwnProperty.call(e,c)&&(s.addEventListener("mouseenter",e[c]),s.addEventListener("mouseleave",e[c]))}),n.querySelectorAll("[data-classlist]").forEach(s=>{let c=s.dataset.classlist;/^[a-zA-Z0-9\-\s:_]+$/.test(c)&&s.classList.add(...c.split(/\s+/))})};import W from"dompurify";var D=null,G=(n,t)=>{if(typeof document>"u")return;let e=document.getElementById(n);if(!e)return;W.addHook("uponSanitizeAttribute",(a,s)=>{let c=(s.attrName||"").toLowerCase(),l=(s.attrValue??"").toString().trim();if(c.startsWith("on")){s.keepAttr=!1;return}if((c==="href"||c==="src")&&/^(javascript:|vbscript:|data:|file:|about:)/i.test(l)){s.keepAttr=!1;return}if(c==="class"){let m=l.split(/\s+/).filter(Boolean).filter(S=>{if(/^[a-zA-Z0-9\-\:\/_\[\]\(\)]+$/.test(S)){if(/^bg-\[url\(.*\)\]$/.test(S)){let h=S.replace(/^bg-\[url\(/,"").replace(/\)\]$/,"").replace(/^['"]|['"]$/g,"");return h===""||/^https?:\/\//i.test(h)||/^\/(?!\/)/.test(h)||/^\.{0,2}\//.test(h)}return!0}return!1});s.attrValue=m.join(" ");return}if(c==="style"){s.keepAttr=!1;return}});let r=e.cloneNode(!0),o=W.sanitize(r.innerHTML,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["div","span","p","h1","h2","h3","h4","h5","h6","ul","ol","li","strong","em","a","img","br","form","button","input","label"],ALLOWED_ATTR:["href","src","alt","title","class","id","type","name","value","placeholder","data-click","data-change","data-submit","data-select","data-hover","data-classlist"],FORBID_TAGS:["script","iframe","object","embed","body","html","svg","math","link","meta"],ALLOW_DATA_ATTR:!0,KEEP_CONTENT:!1,RETURN_DOM_FRAGMENT:!0}),i=Array.from(o.childNodes).map(a=>a.outerHTML||a.textContent||"").join("");if(D!==null&&i!==D){let a=document.createElement("div");t(a);let c=new DOMParser().parseFromString(D,"text/html");for(;e.firstChild;)e.removeChild(e.firstChild);c.body.childNodes.forEach(l=>e.appendChild(l.cloneNode(!0)))}else{for(D=i;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(o),t(e)}};import V from"dompurify";typeof window<"u"&&!window.__anchorSinglePopstateHandlerAttached&&(window.addEventListener("popstate",n=>{let t=n.state;t?.scrollPosition!==void 0&&window.scrollTo(0,t.scrollPosition)}),window.__anchorSinglePopstateHandlerAttached=!0);var Q=(n,t,e,r="",o=null)=>{if(!n)return;let i=V.sanitize(t,{ALLOWED_URI_REGEXP:/^(https?:|\/)/}),a=V.sanitize(e,{USE_PROFILES:{html:!1}});n.setAttribute("href",i),n.setAttribute("aria-label",a),r&&(n.className=r.trim()),o&&n.replaceChildren(o),typeof window<"u"&&n.addEventListener("click",s=>{s.preventDefault();let l=s.currentTarget.getAttribute("href");if(l){let d=window.scrollY;window.scrollTo(0,0),window.history.pushState({scrollPosition:d},"",l),dispatchEvent(new PopStateEvent("popstate"))}})};import L from"dompurify";var K=(n="'self' 'nonce-rAnd0m123' 'unsafe-inline' 'unsafe-eval'",t="'self' 'nonce-rAnd0m123'",e="'none'",r="'self' https://fonts.googleapis.com https://fonts.gstatic.com",o="'self' https://blogger.googleusercontent.com",i=["'self'","https://fonts.googleapis.com","https://fonts.gstatic.com","https://www.google.com/maps/"],a="'self' https://www.youtube.com",s="'self'",c="/csp-report",l=!1)=>{let d=()=>{try{let m=document.querySelector('meta[http-equiv="Content-Security-Policy"]');m||(m=document.createElement("meta"),m.setAttribute("http-equiv","Content-Security-Policy"),document.head.appendChild(m));let S=l?`report-uri ${c};`:"";m.setAttribute("content",`default-src 'self'; script-src ${n}; style-src ${t}; object-src ${e}; font-src ${r}; img-src ${o}; connect-src ${i.join(" ")}; frame-src ${a}; base-uri ${s}; ${S}`)}catch(m){console.error("Error adding CSP meta element:",m)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",d):d()};var Z=(n,t)=>{let e={name:L.sanitize(n.name||""),title:L.sanitize(n.title||""),description:L.sanitize(n.description||"Default description"),author:L.sanitize(n.author||""),favicon:n.favicon},r=u=>{e.name=L.sanitize(u),p("name",e.name)},o=u=>{e.title=L.sanitize(u),document.title=e.title},i=u=>{e.description=L.sanitize(u),p("description",e.description)},a=u=>{e.author=L.sanitize(u),p("author",e.author)},s=u=>{e.favicon=L.sanitize(u);let f=document.querySelector('link[rel="icon"]');f||(f=document.createElement("link"),f.rel="icon",document.head.appendChild(f)),f.href=e.favicon},c=()=>e.name,l=()=>e.title,d=()=>e.description,m=()=>e.author,S=()=>e.favicon,h=()=>e,v=(u,f)=>{let g=document.createElement("meta");g.setAttribute("name",u),g.setAttribute("content",f),document.head.appendChild(g)},p=(u,f)=>{let g=document.querySelector(`meta[name="${u}"]`);g?g.setAttribute("content",f):v(u,f)},E=()=>{e.title&&(document.title=e.title),e.name&&p("name",e.name),e.description&&p("description",e.description),e.author&&p("author",e.author),e.favicon&&s(e.favicon)};return t&&K(t.scriptSrc,t.styleSrc,t.objectSrc,Array.isArray(t.connectSrc)?t.connectSrc.join(" "):t.connectSrc,t.reportOnly!==void 0?String(t.reportOnly):void 0),E(),{setName:r,setTitle:o,setDescription:i,setAuthor:a,setFavicon:s,getName:c,getTitle:l,getDescription:d,getAuthor:m,getFavicon:S,getAllMetaData:h,appendMetaTagsToHead:E}};import Te from"dompurify";var C=(n,t,e,r,o)=>{let i=`#${n}`,a=t.querySelectorAll(i);if(a.length===0)throw new Error(`[useTSComponent] No element found with id '${n}' in the given parent.`);if(a.length>1)throw new Error(`[useTSComponent] Duplicate id '${n}' detected. Found ${a.length} elements.`);let s=a[0];s.innerHTML=Te.sanitize(s.innerHTML,{USE_PROFILES:{html:!0}}),e(s,r,o)};var J=(n,t,e,r=[])=>{let o=new Set;n.forEach((i,a)=>{if(o.has(i)){console.warn(`[useTSCollection] Duplicate ID in collection array: "${i}" \u2014 skipping.`);return}o.add(i);let s=t.querySelectorAll(`#${i}`);if(s.length>1){console.warn(`[useTSCollection] Duplicate ID in DOM: "${i}" (${s.length} elements found) \u2014 skipping component mount.`);return}let c=e[a],l=Array.isArray(r)?r[a]:void 0;typeof c=="function"?C(i,t,c,l):console.warn(`[useTSCollection] No valid component function found for ID: "${i}"`)})};var R=(n,t)=>{let r=(t??document).querySelectorAll(n);if(r.length===0)return process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] No element found for selector: '${n}'`),null;if(n.startsWith("#")&&r.length>1){if(process.env.NODE_ENV!=="production")throw new Error(`[useTSSelect] Duplicate ID detected: '${n}'. Found ${r.length} elements with this ID.`);return r[0]}return r.length>1&&process.env.NODE_ENV!=="production"&&console.warn(`[useTSSelect] Multiple elements found for selector: '${n}'. Returning the first one.`),r[0]};import{jwtDecode as Se}from"jwt-decode";var X=(n,t)=>{let e=localStorage.getItem("token");if(!e)return window.location.href=t,null;try{let r=Se(e),o=Date.now()/1e3;return r.exp&&r.exp<o&&(console.error("Token has expired"),window.localStorage.removeItem("token"),window.location.href=t),null}catch(r){return console.error("Invalid token:",r),window.location.href=t,null}};var H=(n,t,e)=>{n.forEach(r=>{t.forEach(o=>{r.addEventListener(o,i=>{e(r,i)})})})};var Y=()=>({back:()=>window.history.back(),forward:()=>window.history.forward()});var ee=(n,t)=>{let e=document.querySelector(`#${n}`)||document.querySelector(`.${n}`);if(!e)return;let r=window.location.pathname.replace(/\/$/,"");for(let o of t){let i=o.path.replace(/\/$/,"");if(r===i||r.startsWith(`${i}/`)){o.component(e);break}}};function te(n,t){let e=window.location.pathname.replace(/\/$/,"");t.routes.forEach(r=>{r.children?.length&&r.children.forEach(o=>{let i=o.path.replace(/\/$/,"");if(e===i||e.startsWith(`${i}/`)){let a=n.querySelector(`#${o.outlet}`)||n.querySelector(`.${o.outlet}`);a instanceof HTMLElement&&o.element&&o.element(a)}})})}import{createStore as Ee}from"zustand/vanilla";function ne(n){let t=Ee(()=>({value:n})),e=new Set;return{get:()=>t.getState().value,set:r=>{t.setState({value:r}),e.forEach(o=>o(r))},subscribe:r=>(e.add(r),r(t.getState().value),()=>e.delete(r))}}function re(n){let t=n();typeof t=="function"&&t()}var oe=async()=>{let n="https://cdn.jsdelivr.net/npm/brython@3/brython.min.js",t="https://cdn.jsdelivr.net/npm/brython@3/brython_stdlib.js",e=r=>new Promise((o,i)=>{let a=document.createElement("script");a.src=r,a.onload=()=>o(),a.onerror=()=>i(new Error(`Failed to load ${r}`)),document.head.appendChild(a)});await e(n),await e(t),typeof window.brython=="function"?window.brython():console.error("Brython did not load correctly.")},se=n=>new Promise((t,e)=>{let r=document.createElement("script");r.type="text/python",r.src=`/src/python/${n}`,r.onload=()=>t(),r.onerror=()=>e(new Error(`Failed to load ${n}`)),document.body.appendChild(r)});function ie(n){let t=null;return async(e,r)=>{try{if(!t){let o=await n();t=o.default||o}if(typeof t=="function")return t(e,r);if(t instanceof HTMLElement){let o=t.cloneNode(!0);return e?.appendChild(o),o}if(typeof t=="object"&&t!==null&&"render"in t&&typeof t.render=="function")return t.render(e,r);console.warn("useTSLazy: Unsupported module type",t)}catch(o){console.error("useTSLazy failed:",o)}}}var ae=n=>typeof window>"u"?{isDOM:null}:{isDOM:n||document.body};import{debounce as ye}from"lodash-es";var $=n=>n;typeof window<"u"&&typeof document<"u"&&($=n=>{let t=document.createElement("div");return t.innerText=n,t.innerHTML});var ve=n=>{(n?Array.isArray(n)?n:n instanceof HTMLAnchorElement?[n]:Array.from(n):Array.from(document.querySelectorAll("a"))).forEach(e=>{if(!e||e.dataset.anchorEnhanced==="true")return;e.dataset.anchorEnhanced="true";let r=e.getAttribute("class")||"";e.setAttribute("class",$(r));let o=e.getAttribute("aria-label");o&&e.setAttribute("aria-label",$(o));let i=e.querySelector(":scope > *");i&&(e.innerHTML="",e.appendChild(i));let a=e.getAttribute("href")||"";if(!a.startsWith("#")){try{if(new URL(a,window.location.href).origin!==window.location.origin)return}catch{return}e.addEventListener("click",s=>{s.preventDefault();let c=e.getAttribute("href")||"";try{let l=new URL(c,window.location.href);window.history.pushState({},"",l.pathname+l.search+l.hash),window.dispatchEvent(new PopStateEvent("popstate"))}catch(l){console.error("Invalid URL in anchor:",c,l)}})}})},we=ye(ve,50),O=n=>{we(n)};var ce=n=>{if(!n)return;let t=R("a",n);O(t)};import ue from"dompurify";import{createStore as Le}from"zustand/vanilla";import Me from"dompurify";var M=Le(n=>({params:{},query:{},setParams:t=>n(()=>({params:le(t)})),setQuery:t=>n(()=>({query:le(t)}))}));function le(n){let t={};for(let e in n)t[e]=Me.sanitize(n[e]);return t}var k=class{constructor(t,e){this.routes=[];this.routes=t,this.expectedParams=new Set(e),window.addEventListener("popstate",this.handlePopState.bind(this)),this.handlePopState()}handlePopState(){let t=window.location.pathname,e=window.location.search,r=this.parseQueryParams(e),o=this.findMatchingRoute(t,this.routes);if(o){if(o.routeto){this.navigate(o.routeto);return}let i=this.filterAndSanitizeParams(o.params);M.getState().setParams(i),M.getState().setQuery(r);let a=document.createElement("div");if(o.element?.(a,i,r),o.children){let s=t.slice(o.path.length),c=a.querySelector("#child");c&&this.renderChildren(o.children,s,c,i,r)}}else{let i=this.findMatchingRoute("*",this.routes);if(i){let a=this.filterAndSanitizeParams(i.params);M.getState().setParams(a),M.getState().setQuery(r);let s=document.createElement("div");i.element?.(s,a,r)}}}renderChildren(t,e,r,o,i){if(!t||t.length===0){let s=r.querySelector("#child");s&&s.remove();return}let a=this.findMatchingRoute(e,t);if(a){let s=document.createElement("div");s.id="child";let c={...o,...a.params},l=this.filterAndSanitizeParams(c);if(M.getState().setParams(l),M.getState().setQuery(i),a.element?.(s,l,i),r.appendChild(s),a.children){let d=e.slice(a.path.length);this.renderChildren(a.children,d,s,l,i)}}}parseQueryParams(t){let e={},r=new URLSearchParams(t);for(let[o,i]of r.entries())this.expectedParams.has(o)&&(e[o]=ue.sanitize(i));return e}findMatchingRoute(t,e,r={}){for(let o of e){let i=o.path;if(i==="*")return o;{let s=[],c=i.replace(/:[^\s/]+/g,m=>(s.push(m.substring(1)),"([^\\s/]+)")),l=new RegExp(`^${c}(?:/|$)`),d=t.match(l);if(d){let m={...r};if(s.forEach((S,h)=>{m[S]=d[h+1]??""}),o.children){let S=t.slice(d[0].length),h=this.findMatchingRoute(S,o.children,m);if(h)return h}return{...o,params:m}}}}}filterAndSanitizeParams(t){if(!t)return{};let e={};for(let r in t)this.expectedParams.has(r)&&(e[r]=ue.sanitize(t[r]??""));return e}navigate(t){history.pushState(null,"",t),this.handlePopState()}addRoute(t){this.routes.push(t)}};import y from"path";var Re=()=>({name:"ts-filebased-router",async buildStart(){if(typeof process>"u"||!process.versions?.node)return;let n=await import("fs/promises"),t=await import("./esm-KRNKVVL7.js"),e=y.resolve("src/pages"),r=y.resolve("src/gen"),o=y.resolve("src/routes"),i=y.join(r,"tsrouter.gen.ts"),a=y.join(o,"__root.ts"),s=process.env.NODE_ENV!=="production";async function c(p){try{await n.mkdir(p,{recursive:!0})}catch{}}function l(p,E){let u="/"+y.relative(E,p).replace(/\\/g,"/");return u=u.replace(/\.ts$/,"").replace(/\/index$/,"")||"/",u.replace(/\[(.+?)\]/g,":$1")}function d(p){return p.replace(/^\//,"").split("/").map(E=>E.startsWith(":")?E.slice(1):E).filter(Boolean).join("-")||"index"}function m(p,E){let f=y.relative(E,p).replace(/\\/g,"/").split("/").filter(Boolean),g=f[f.length-1].replace(".ts",""),w=f.length>1?f[f.length-2]:"";if(g==="index")return w?w.charAt(0).toUpperCase()+w.slice(1):"Index";if(g.startsWith("[")&&g.endsWith("]")){let T=g.slice(1,-1);return w.charAt(0).toUpperCase()+T.charAt(0).toUpperCase()+T.slice(1)}return g.charAt(0).toUpperCase()+g.slice(1)}async function S(p){let E=await n.readdir(p,{withFileTypes:!0}),u=[];for(let f of E){let g=y.join(p,f.name);if(f.isDirectory())u=u.concat(await S(g));else if(f.isFile()&&f.name.endsWith(".ts")){let w=l(g,e),T=d(w),b=m(g,e);u.push({file:g,route:w,routeName:T,importName:b})}}return u}function h(){return`import { createRouter } from "@/gen/tsrouter.gen";
|
|
2
|
+
|
|
2
3
|
export const Router = async (DOM: HTMLElement) => {
|
|
3
4
|
const router = await createRouter(DOM);
|
|
5
|
+
|
|
4
6
|
await router.navigate(window.location.pathname + window.location.search);
|
|
7
|
+
|
|
5
8
|
window.addEventListener("popstate", () => {
|
|
6
9
|
void router.navigate(window.location.pathname + window.location.search, false);
|
|
7
10
|
});
|
|
8
|
-
};`}async function v(){let p=await S(e),E=p.find(T=>T.route==="/notfound"),u=p.filter(T=>T.route!=="/notfound");for(let T of p)if(!(await n.readFile(T.file,"utf-8")).trim()){let
|
|
11
|
+
};`}async function v(){let p=await S(e),E=p.find(T=>T.route==="/notfound"),u=p.filter(T=>T.route!=="/notfound");for(let T of p)if(!(await n.readFile(T.file,"utf-8")).trim()){let A=T.importName,P=T.route.includes(":");await n.writeFile(T.file,`import { html, useTSElements, useTSMetaData${P?", useTSExtractParams":""} } from "@devwareng/vanilla-ts";
|
|
9
12
|
|
|
10
|
-
export default function ${
|
|
13
|
+
export default function ${A}(DOM: HTMLElement) {
|
|
11
14
|
useTSMetaData({
|
|
12
|
-
title: "${
|
|
13
|
-
description: "${
|
|
15
|
+
title: "${A}",
|
|
16
|
+
description: "${A}",
|
|
14
17
|
author: "Your name here",
|
|
15
18
|
favicon: "/favicon.ico",
|
|
16
19
|
});
|
|
17
20
|
|
|
18
|
-
const params = useTSExtractParams("${T.route}")
|
|
19
|
-
|
|
21
|
+
${P?`const params = useTSExtractParams("${T.route}");`:""}
|
|
22
|
+
|
|
23
|
+
${P?"if (Object.values(params).some(v => !v)) return;":""}
|
|
20
24
|
|
|
21
25
|
const ui = useTSElements(
|
|
22
26
|
DOM,
|
|
23
27
|
html\`
|
|
24
28
|
<div>
|
|
25
|
-
<h1>${
|
|
26
|
-
${
|
|
29
|
+
<h1>${A}</h1>
|
|
30
|
+
${P?"<pre>${JSON.stringify(params, null, 2)}</pre>":""}
|
|
27
31
|
</div>
|
|
28
32
|
\`
|
|
29
33
|
);
|
|
30
34
|
|
|
31
35
|
return ui;
|
|
32
|
-
}`,"utf-8")}let f=u.map(T=>{let
|
|
33
|
-
`),w=`// AUTO-GENERATED FILE
|
|
36
|
+
}`,"utf-8")}let f=u.map(T=>{let b="../pages/"+y.relative(e,T.file).replace(/\\/g,"/").replace(/\.ts$/,"");return`{ path: "${T.route}", name: "${T.routeName}", component: useTSLazy(() => import("${b}")) }`}).join(`,
|
|
37
|
+
`),w=`// AUTO-GENERATED FILE
|
|
34
38
|
import { useTSLazy, html, useTSElements } from "@devwareng/vanilla-ts";
|
|
35
39
|
|
|
36
40
|
type Route = {
|
|
@@ -39,28 +43,26 @@ type Route = {
|
|
|
39
43
|
component: (DOM: HTMLElement) => Promise<any>;
|
|
40
44
|
};
|
|
41
45
|
|
|
42
|
-
${E?`export const NotFound = useTSLazy(() => import("../pages/${y.relative(e,E.file).replace(/\\/g,"/").replace(/\.ts$/,"")}"))`:
|
|
46
|
+
${E?`export const NotFound = useTSLazy(() => import("../pages/${y.relative(e,E.file).replace(/\\/g,"/").replace(/\.ts$/,"")}"))`:"export function NotFound(DOM: HTMLElement) {\n return useTSElements(DOM, html`<div><h1>404 - Page Not Found</h1></div>`);\n}"}
|
|
43
47
|
|
|
44
48
|
export const routeTree: Route[] = [
|
|
45
49
|
${f}
|
|
46
50
|
];
|
|
47
51
|
|
|
48
52
|
export async function createRouter(DOM: HTMLElement) {
|
|
53
|
+
|
|
49
54
|
function matchRoute(path: string) {
|
|
50
55
|
for (const route of routeTree) {
|
|
51
|
-
const
|
|
52
|
-
const regex = new RegExp("^" + route.path.replace(/:([^/]+)/g, (_, key) => { keys.push(key); return "([^/]+)" }) + "$");
|
|
56
|
+
const regex = new RegExp("^" + route.path.replace(/:([^/]+)/g, "([^/]+)") + "$");
|
|
53
57
|
const pathname = path.split("?")[0];
|
|
54
|
-
|
|
55
|
-
if (match) {
|
|
56
|
-
return route; // params extracted inside component
|
|
57
|
-
}
|
|
58
|
+
if (pathname?.match(regex)) return route;
|
|
58
59
|
}
|
|
59
60
|
return null;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
async function navigate(path: string, pushState: boolean = true) {
|
|
63
64
|
const match = matchRoute(path);
|
|
65
|
+
|
|
64
66
|
if (match) {
|
|
65
67
|
await match.component(DOM);
|
|
66
68
|
if (pushState) history.pushState({}, "", path);
|
|
@@ -71,4 +73,4 @@ export async function createRouter(DOM: HTMLElement) {
|
|
|
71
73
|
|
|
72
74
|
return { navigate, routes: routeTree };
|
|
73
75
|
}
|
|
74
|
-
`;await c(r),await n.writeFile(i,w,"utf-8"),await n.writeFile(a,h(),"utf-8")}await c(r),await c(o),await c(e),await v(),s&&(t.watch(e).on("all",async(E,u)=>{u.endsWith(".ts")&&await v()}),t.watch(a).on("unlink",async()=>{await n.writeFile(a,h(),"utf-8")})),console.log("\u{1F7E2} TS Filebased Router Generated
|
|
76
|
+
`;await c(r),await n.writeFile(i,w,"utf-8"),await n.writeFile(a,h(),"utf-8")}await c(r),await c(o),await c(e),await v(),s&&(t.watch(e).on("all",async(E,u)=>{u.endsWith(".ts")&&await v()}),t.watch(a).on("unlink",async()=>{await n.writeFile(a,h(),"utf-8")})),console.log("\u{1F7E2} TS Filebased Router Generated (Smart Params Enabled)")}});export{Re as TSFilebasedRouter,k as TSRouter,re as createEffect,ne as createSignal,N as html,se as loadPyFiles,pe as mapper,te as renderChildRoutes,O as useAnchor,Q as useAnchorSingle,G as useInitialDOM,X as useTSAuth,J as useTSCollection,C as useTSComponent,H as useTSElementEach,B as useTSElements,_ as useTSEvent,U as useTSEventAll,q as useTSExtractParams,ie as useTSLazy,Z as useTSMetaData,Y as useTSNavigate,ce as useTSNoReload,ee as useTSOutlet,x as useTSParams,z as useTSPurifier,ae as useTSSSRHydration,R as useTSSelect,oe as useTSloadBrython};
|