PageSourceSearch

https://infosoft.ate-bus.ch:4443/2937.9249680dfc242ec3.js

js ate-bus.ch collected 2026-10-08 08:31:18 UTC 9,376 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[2937],{32937:(q,x,_)=>{_.r(x),_.d(x,{FilesystemWeb:()=>w});var l=_(10467),R=_(15083),D=_(11889);function A(m){const r=m.split("/").filter(n=>"."!==n),e=[];return r.forEach(n=>{".."===n&&e.length>0&&".."!==e[e.length-1]?e.pop():e.push(n)}),e.join("/")}class w extends R.E_{constructor(){var r;super(...arguments),r=this,this.DB_VERSION=1,this.DB_NAME="Disc",this._writeCmds=["add","put","delete"],this.downloadFile=function(){var e=(0,l.A)(function*(n){var t,i;const d=(0,R.EA)(n,n.webFetchExtra),s=yield fetch(n.url,d);let o;if(n.progress)if(null!=s&&s.body){const c=s.body.getReader();let h=0;const u=[],b=s.headers.get("content-type"),v=parseInt(s.headers.get("content-length")||"0",10);for(;;){const{done:f,value:g}=yield c.read();if(f)break;u.push(g),h+=(null==g?void 0:g.length)||0;const E={url:n.url,bytes:h,contentLength:v};r.notifyListeners("progress",E)}const p=new Uint8Array(h);let y=0;for(const f of u)typeof f>"u"||(p.set(f,y),y+=f.length);o=new Blob([p.buffer],{type:b||void 0})}else o=new Blob;else o=yield s.blob();return{path:(yield r.writeFile({path:n.path,directory:null!==(t=n.directory)&&void 0!==t?t:void 0,recursive:null!==(i=n.recursive)&&void 0!==i&&i,data:o})).uri,blob:o}});return function(n){return e.apply(this,arguments)}}()}initDb(){var r=this;return(0,l.A)(function*(){if(void 0!==r._db)return r._db;if(!("indexedDB"in window))throw r.unavailable("This browser doesn't support IndexedDB");return new Promise((e,n)=>{const t=indexedDB.open(r.DB_NAME,r.DB_VERSION);t.onupgradeneeded=w.doUpgrade,t.onsuccess=()=>{r._db=t.result,e(t.result)},t.onerror=()=>n(t.error),t.onblocked=()=>{console.warn("db blocked")}})})()}static doUpgrade(r){const n=r.target.result;r.oldVersion,n.objectStoreNames.contains("FileStorage")&&n.deleteObjectStore("FileStorage"),n.createObjectStore("FileStorage",{keyPath:"path"}).createIndex("by_folder","folder")}dbRequest(r,e){var n=this;return(0,l.A)(function*(){const t=-1!==n._writeCmds.indexOf(r)?"readwrite":"readonly";return n.initDb().then(i=>new Promise((d,s)=>{const c=i.transaction(["FileStorage"],t).objectStore("FileStorage")[r](...e);c.onsuccess=()=>d(c.result),c.onerror=()=>s(c.error)}))})()}dbIndexRequest(r,e,n){var t=this;return(0,l.A)(function*(){const i=-1!==t._writeCmds.indexOf(e)?"readwrite":"readonly";return t.initDb().then(d=>new Promise((s,o)=>{const u=d.transaction(["FileStorage"],i).objectStore("FileStorage").index(r)[e](...n);u.onsuccess=()=>s(u.result),u.onerror=()=>o(u.error)}))})()}getPath(r,e){const n=void 0!==e?e.replace(/^[/]+|[/]+$/g,""):"";let t="";return void 0!==r&&(t+="/"+r),""!==e&&(t+="/"+n),t}clear(){var r=this;return(0,l.A)(function*(){(yield r.initDb()).transaction(["FileStorage"],"readwrite").objectStore("FileStorage").clear()})()}readFile(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path),t=yield e.dbRequest("get",[n]);if(void 0===t)throw Error("File does not exist.");return{data:t.content?t.content:""}})()}writeFile(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path);let t=r.data;const i=r.encoding,d=r.recursive,s=yield e.dbRequest("get",[n]);if(s&&"directory"===s.type)throw Error("The supplied path is a directory.");const o=n.substr(0,n.lastIndexOf("/"));if(void 0===(yield e.dbRequest("get",[o]))){const u=o.indexOf("/",1);if(-1!==u){const b=o.substr(u);yield e.mkdir({path:b,directory:r.directory,recursive:d})}}if(!(i||t instanceof Blob||(t=t.indexOf(",")>=0?t.split(",")[1]:t,e.isBase64String(t))))throw Error("The supplied data is not valid base64 content.");const c=Date.now(),h={path:n,folder:o,type:"file",size:t instanceof Blob?t.size:t.length,ctime:c,mtime:c,content:t};return yield e.dbRequest("put",[h]),{uri:h.path}})()}appendFile(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path);let t=r.data;const i=r.encoding,d=n.substr(0,n.lastIndexOf("/")),s=Date.now();let o=s;const a=yield e.dbRequest("get",[n]);if(a&&"directory"===a.type)throw Error("The supplied path is a directory.");if(void 0===(yield e.dbRequest("get",[d]))){const u=d.indexOf("/",1);if(-1!==u){const b=d.substr(u);yield e.mkdir({path:b,directory:r.directory,recursive:!0})}}if(!i&&!e.isBase64String(t))throw Error("The supplied data is not val
1id base64 content.");if(void 0!==a){if(a.content instanceof Blob)throw Error("The occupied entry contains a Blob object which cannot be appended to.");t=void 0===a.content||i?a.content+t:btoa(atob(a.content)+atob(t)),o=a.ctime}const h={path:n,folder:d,type:"file",size:t.length,ctime:o,mtime:s,content:t};yield e.dbRequest("put",[h])})()}deleteFile(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path);if(void 0===(yield e.dbRequest("get",[n])))throw Error("File does not exist.");if(0!==(yield e.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(n)])).length)throw Error("Folder is not empty.");yield e.dbRequest("delete",[n])})()}mkdir(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path),t=r.recursive,i=n.substr(0,n.lastIndexOf("/")),d=(n.match(/\//g)||[]).length,s=yield e.dbRequest("get",[i]),o=yield e.dbRequest("get",[n]);if(1===d)throw Error("Cannot create Root directory");if(void 0!==o)throw Error("Current directory does already exist.");if(!t&&2!==d&&void 0===s)throw Error("Parent directory must exist");if(t&&2!==d&&void 0===s){const h=i.substr(i.indexOf("/",1));yield e.mkdir({path:h,directory:r.directory,recursive:t})}const a=Date.now(),c={path:n,folder:i,type:"directory",size:0,ctime:a,mtime:a};yield e.dbRequest("put",[c])})()}rmdir(r){var e=this;return(0,l.A)(function*(){const{path:n,directory:t,recursive:i}=r,d=e.getPath(t,n),s=yield e.dbRequest("get",[d]);if(void 0===s)throw Error("Folder does not exist.");if("directory"!==s.type)throw Error("Requested path is not a directory");const o=yield e.readdir({path:n,directory:t});if(0!==o.files.length&&!i)throw Error("Folder is not empty");for(const a of o.files){const c=`${n}/${a.name}`;"file"===(yield e.stat({path:c,directory:t})).type?yield e.deleteFile({path:c,directory:t}):yield e.rmdir({path:c,directory:t,recursive:i})}yield e.dbRequest("delete",[d])})()}readdir(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path),t=yield e.dbRequest("get",[n]);if(""!==r.path&&void 0===t)throw Error("Folder does not exist.");const i=yield e.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(n)]);return{files:yield Promise.all(i.map(function(){var s=(0,l.A)(function*(o){let a=yield e.dbRequest("get",[o]);return void 0===a&&(a=yield e.dbRequest("get",[o+"/"])),{name:o.substring(n.length+1),type:a.type,size:a.size,ctime:a.ctime,mtime:a.mtime,uri:a.path}});return function(o){return s.apply(this,arguments)}}()))}})()}getUri(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path);let t=yield e.dbRequest("get",[n]);return void 0===t&&(t=yield e.dbRequest("get",[n+"/"])),{uri:(null==t?void 0:t.path)||n}})()}stat(r){var e=this;return(0,l.A)(function*(){const n=e.getPath(r.directory,r.path);let t=yield e.dbRequest("get",[n]);if(void 0===t&&(t=yield e.dbRequest("get",[n+"/"])),void 0===t)throw Error("Entry does not exist.");return{type:t.type,size:t.size,ctime:t.ctime,mtime:t.mtime,uri:t.path}})()}rename(r){var e=this;return(0,l.A)(function*(){yield e._copy(r,!0)})()}copy(r){var e=this;return(0,l.A)(function*(){return e._copy(r,!1)})()}requestPermissions(){return(0,l.A)(function*(){return{publicStorage:"granted"}})()}checkPermissions(){return(0,l.A)(function*(){return{publicStorage:"granted"}})()}_copy(r){var e=this;return(0,l.A)(function*(n,t=!1){let{toDirectory:i}=n;const{to:d,from:s,directory:o}=n;if(!d||!s)throw Error("Both to and from must be provided");i||(i=o);const a=e.getPath(o,s),c=e.getPath(i,d);if(a===c)return{uri:c};if(function F(m,r){m=A(m),r=A(r);const e=m.split("/"),n=r.split("/");return m!==r&&e.every((t,i)=>t===n[i])}(a,c))throw Error("To path cannot contain the from path");let h;try{h=yield e.stat({path:d,directory:i})}catch{const y=d.split("/");y.pop();const f=y.join("/");if(y.length>0&&"directory"!==(yield e.stat({path:f,directory:i})).type)throw new Error("Parent directory of the to path is a file")}if(h&&"directory"===h.type)throw new Error("Cannot overwrite a directory with a file");const u=yield e.stat({path:s,directory:o}),b=function(){var p=(0,l.A)(function*(y,f,g){const E=e.getPath(i,y),P=yield e.dbRequest("get",[E]);P.ctime=f,P.mtime=g,yield e.dbRequest("put",[P])});return function(f,g,E){return p.apply(this,arguments)}}(),v=u.ctime?u.ctime:Date.now();switch(u.type){case"file":{const p=yield e.readFile({path:s,directory:o});let y;t&&(yield e.deleteFile({path:s,directory:o})),!(p.data instanceof Blob)&&!e.isBase64String(p.data)&&(y=D.Wi.UTF8);const f=yield e.writeFile({path:d,directory:i,data:p.data,encoding:y});return t&&(yield b(d,v,u.mtime)),f}case"directory":{if(h)throw Error("Cannot move a directory over an existing object");try{yield e.mkdir({path:d,directory:i,recursive:!1}),t&&(yield b(d,v,u.mtime))}catch{}const p=(yield e.readdir({path:s,directory:o})).files;for(const y of p)yield e._copy({from:`${s}/${y.name}`,to:`${d}/${y.name}`,directory:o,toDirectory:i},t);t&&(yield e.rmdir({path:s,directory:o}))}}return{uri:c}}).apply(this,arguments)}isBase64String(r){try{return btoa(atob(r))==r}catch{return!1}}}w._debug=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.