filecat 5.64.3 → 5.64.7
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/build/dist/{245.dc065241394f0cffabf1.js → 245.4ca217130f15e0845e7d.js} +2 -2
- package/build/dist/{273.02908579159f8d86c2a9.js → 273.29365fe310c1ce34688b.js} +2 -2
- package/build/dist/{377.832cc69b34fb1364cf71.js → 377.11bcb3fc6ee31acc4dc2.js} +2 -2
- package/build/dist/{943.e0716eaa31a74e534ac3.js → 943.278dd68b5e2bca1105ef.js} +2 -2
- package/build/dist/index.html +1 -1
- package/build/dist/{main.38c7c367767688dd5424.js → main.274a4910c617098dfdef.js} +2 -2
- package/build/main.js +1 -1
- package/build/threads.work.filecat.js +1 -1
- package/build/threads.work.filecat.js.LICENSE.txt +2 -0
- package/package.json +1 -1
- /package/build/dist/{245.dc065241394f0cffabf1.js.LICENSE.txt → 245.4ca217130f15e0845e7d.js.LICENSE.txt} +0 -0
- /package/build/dist/{273.02908579159f8d86c2a9.js.LICENSE.txt → 273.29365fe310c1ce34688b.js.LICENSE.txt} +0 -0
- /package/build/dist/{377.832cc69b34fb1364cf71.js.LICENSE.txt → 377.11bcb3fc6ee31acc4dc2.js.LICENSE.txt} +0 -0
- /package/build/dist/{943.e0716eaa31a74e534ac3.js.LICENSE.txt → 943.278dd68b5e2bca1105ef.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.38c7c367767688dd5424.js.LICENSE.txt → main.274a4910c617098dfdef.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see threads.work.filecat.js.LICENSE.txt */
|
|
2
|
-
(()=>{var __webpack_modules__={54(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.start_ai_agent_agent=function(){(0,s.register_threads_worker_handler)(r.threads_msg_type.docs_init,async t=>{const{index_storage_type:e,db_path:i}=t.data;if(v=e,"memory"===e){if(b)return;b=new o.default.Index({tokenize:"strict"}),x=new o.default.Index({tokenize:"strict"})}if("sqlite"===e){if(k)return;k=new u(i,{nativeBinding:a}),k.exec("\n CREATE VIRTUAL TABLE IF NOT EXISTS docs USING fts5(\n file_path UNINDEXED,\n content,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n \n CREATE VIRTUAL TABLE IF NOT EXISTS doc_names USING fts5(\n file_path UNINDEXED,\n name,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n "),w=k.prepare("\n SELECT mtime FROM docs WHERE file_path = ? LIMIT 1\n "),y=k.prepare("\n SELECT mtime FROM doc_names WHERE file_path = ? LIMIT 1\n "),f=k.prepare("INSERT INTO docs (file_path, content, mtime) VALUES (?, ?, ?)"),d=k.prepare("INSERT INTO doc_names (file_path, name, mtime) VALUES (?, ?, ?)"),g=k.prepare("DELETE FROM docs WHERE file_path = ?"),p=k.prepare("DELETE FROM doc_names WHERE file_path = ?"),m=k.prepare("\n SELECT file_path\n FROM docs\n WHERE docs MATCH ?\n ORDER BY bm25(docs)\n LIMIT 50\n "),_=k.prepare("\n SELECT file_path\n FROM doc_names\n WHERE doc_names MATCH ?\n ORDER BY bm25(doc_names)\n LIMIT 50\n ")}}),(0,s.register_threads_worker_handler)(r.threads_msg_type.docs_add,async t=>{let e,i,{use_zh_segmentation:n,file_path:s,mtime:r}=t.data;if("sqlite"===v&&k){r=r??(await c.FileUtil.statSync(s)).mtime;const t=w.get(s);if(t&&t.mtime===r)return{char_num:0};e=`${s} ${(await c.FileUtil.readFileSync(s)).toString()}。`,i=e.length;let o=e,l=s;n&&(o=(0,h.cut)(e,!0).join(" "),l=(0,h.cut)(s,!0).join(" ")),g.run(s),p.run(s),f.run(s,o,r),d.run(s,l,r)}if("memory"===v){e=`${s} ${(await c.FileUtil.readFileSync(s)).toString()}。`,i=e.length;let t=e.toLowerCase(),r=s.toLowerCase();n&&(t=(0,h.cut)(e,!0).join(" ").toLowerCase(),r=(0,h.cut)(s,!0).join(" ").toLowerCase()),b?.add(s,t),x?.add(s,r)}return{char_num:i}}),(0,s.register_threads_worker_handler)(r.threads_msg_type.docs_del,async t=>{const{file_path:e}=t.data;"memory"===v&&(b?.remove(e),x?.remove(e)),"sqlite"===v&&k&&(g.run(e),p.run(e))}),(0,s.register_threads_worker_handler)(r.threads_msg_type.docs_search,async t=>{const{key:e,use_zh_segmentation:i}=t.data;let n=e;if(i){n=(0,h.cut)(e,!0).map(t=>t+"*").join(" OR ")}if("memory"===v){const t={suggest:!0,resolution:9,context:!0,limit:50};return{ids:b?.search(n,t)||[],names_ids:x?.search(n,t)||[]}}if("sqlite"===v&&k){const t=(0,h.cut)(n,!0).filter(t=>""!==t.trim()).map(t=>t+"*").join(" OR "),e=m.all(t),i=_.all(t);return{ids:e.map(t=>t.file_path),names_ids:i.map(t=>t.file_path)}}return{ids:[],names_ids:[]}}),(0,s.register_threads_worker_handler)(r.threads_msg_type.docs_close,async()=>{"memory"===v&&(b?.clear(),x?.clear(),b=null,x=null),"sqlite"===v&&k&&(k.close(),k=null)})};const s=i(324),r=i(525),o=n(i(474)),h=i(880),l=i(917),c=i(776),a=(0,l.get_bin_dependency)("sqlite3"),u=(0,l.get_bin_dependency)("better-sqlite3");let f,d,g,p,m,_,w,y,b=null,x=null,k=null,v="memory"},917(__unused_webpack_module,exports,__webpack_require__){"use strict";var __webpack_unused_export__;function get_bin_dependency(module,auto_throw=!1){try{return"sqlite3"===module?__webpack_require__(642):eval("require")(module)}catch(t){if(console.log(`npm 模块没有加载失败,请手动安装 npm 依赖( -g 安装的就尝试全局安装,本地仓库安装的就在仓库内安装):${module} error ${t.message}`),auto_throw)throw t}return{}}__webpack_unused_export__={value:!0},exports.get_bin_dependency=get_bin_dependency},776(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.FileUtil=void 0;const s=n(i(896)),r=n(i(928));e.FileUtil=class{static async statSync(t){return s.default.promises.stat(t)}static async readdirSync(t){return s.default.promises.readdir(t)}static async readFileSync(t){return s.default.promises.readFile(t)}static async open(t,e,i){return s.default.promises.open(t,e,i)}static async access(t){try{return await s.default.promises.access(t,s.default.constants.F_OK),!0}catch{return!1}}static async access_all(t){let e=0;for(const i of t)try{await s.default.promises.access(i,s.default.constants.F_OK),e++}catch{}return e===t.length}static async appendFileSync(t,e,i){return s.default.promises.appendFile(t,e,i)}static async writeFileSync(t,e,i){return s.default.promises.writeFile(t,e,i)}static async writeFileSyncWithUtf8bom(t,e){return e.startsWith("\ufeff")||(e="\ufeff"+e),s.default.promises.writeFile(t,e,{encoding:"utf8"})}static async truncateSync(t){return s.default.promises.truncate(t)}static async unlinkSync(t){return s.default.promises.unlink(t)}static async mkdirSync(t,e){return s.default.promises.mkdir(t,e)}static async renameSync(t,e){return s.default.promises.rename(t,e)}static async getUniqueFileName(t){const e=r.default.dirname(t),i=r.default.extname(t),n=r.default.basename(t,i);let s=t,o=1;for(;await this.access(s);)s=r.default.join(e,`${n}(${o})${i}`),o++;return s}static async get_exe_path_by_env_dir(t,e){if(!await this.access(t))return null;if(!(await this.statSync(t)).isDirectory())return null;const i=await this.readdirSync(t);for(const n of i)if(n.startsWith(e))return r.default.join(t,`${n}`);return null}static async ensure_dir(t){await s.default.promises.mkdir(t,{recursive:!0})}static async copy(t,e,i=[]){if((await s.default.promises.stat(t)).isFile()){if(await this.ensure_dir(r.default.dirname(e)),i.includes(r.default.basename(t)))return;return void await s.default.promises.copyFile(t,e)}await this.ensure_dir(e);const n=await s.default.promises.readdir(t,{withFileTypes:!0});for(const o of n){const n=r.default.join(t,o.name),h=r.default.join(e,o.name);i.includes(o.name)||(o.isDirectory()?await this.copy(n,h,i):o.isFile()&&await s.default.promises.copyFile(n,h))}}static async remove_dir(t){if(!await this.access(t))return;if((await s.default.promises.stat(t)).isFile())return void await s.default.promises.unlink(t);const e=await s.default.promises.readdir(t);for(const i of e){const e=r.default.join(t,i);(await s.default.promises.stat(e)).isDirectory()?await this.remove_dir(e):await s.default.promises.unlink(e)}await s.default.promises.rmdir(t)}static async find_max_numbered_version_file(t){const e=r.default.dirname(t),i=r.default.basename(t);if(!await this.access(e))return null;const n=await s.default.promises.readdir(e);let o=-1,h=null;const l=r.default.join(e,i);await this.access(l)&&(h=l,o=0);for(const t of n){if(!t.startsWith(i))continue;const n=t.slice(i.length);if(0===n.length)continue;let s=0,l=!1;for(const t of n){if(!(t>="0"&&t<="9")){l=!1;break}s=10*s+(t.charCodeAt(0)-48),l=!0}l&&(s>o&&(o=s,h=r.default.join(e,t)))}return h}static async get_next_numbered_name(t){const e=r.default.dirname(t),i=r.default.basename(t);if(!await this.access(e))return t;const n=await s.default.promises.readdir(e);let o=0;const h=r.default.join(e,i);if(!await this.access(h))return h;for(const t of n){if(!t.startsWith(i))continue;const e=t.slice(i.length);if(!e)continue;let n=0,s=!1;for(const t of e){if(!(t>="0"&&t<="9")){s=!1;break}n=10*n+(t.charCodeAt(0)-48),s=!0}s&&(n>o&&(o=n))}return r.default.join(e,`${i}${o+1}`)}}},285(t,e,i){"use strict";e.file_search_start=function(){(0,n.register_threads_worker_handler)(s.threads_msg_type.file_search,async t=>{const{start:e,end:i,file_path:c,query_text_buffer:a,ram_id:u}=t.data;let f=0,d=Buffer.alloc(0);const g=r.openSync(c,"r");let p=0;for(;f<i&&!l[u];){const t=Buffer.alloc(2097152);let e=r.readSync(g,t,0,t.length,f);if(0===e)break;f+=e,d=Buffer.concat([d,t.subarray(0,e)]),(0,n.threads_send)({type:s.threads_msg_type.search_file_progress,data:{progress:(100*f/i).toFixed(0),ram_id:u}});const l=[];if(h(d,a,l),l.length>0){for(let t=0;t<l.length;t++)l[t]+=p;(0,n.threads_send)({type:s.threads_msg_type.search_file_index,data:{find_index:l,ram_id:u}})}p+=d.length-a.length,d=o(d,d.length-a.length,d.length)}return(0,n.threads_send)({type:s.threads_msg_type.search_file_end,data:{ram_id:u}}),r.closeSync(g),"ok"}),(0,n.register_threads_worker_handler)(s.threads_msg_type.file_search_close,async t=>{const{ram_id:e}=t.data;return l[e]=!0,"ok"}),(0,n.register_threads_worker_handler)(s.threads_msg_type.file_search_start,async t=>{const{ram_id:e}=t.data;return delete l[e],"ok"})};const n=i(324),s=i(525),r=i(896);function o(t,e,i){const n=i-e,s=Buffer.alloc(n);return t.copy(s,0,e,i),s}function h(t,e,i){const n=function(t){const e={},i=t.length;for(let n=0;n<i;n++)e[t[n]]=n;return e}(e),s=t.length,r=e.length,o=s-r;let h=0;for(;h<=o;){let o=r-1;for(;o>=0&&t[h+o]===e[o];)o--;if(o<0)i.push(h),h+=h+r<s?r-n[t[h+r]]||r:1;else{const e=n[t[h+o]],i=void 0!==e?o-e:o+1;h+=Math.max(i,1)}}}const l={}},525(t,e){"use strict";var i;e.threads_msg_type=void 0,function(t){t[t.hello=1]="hello",t[t.file_search_start=2]="file_search_start",t[t.file_search=3]="file_search",t[t.file_search_close=4]="file_search_close",t[t.search_file_index=5]="search_file_index",t[t.search_file_progress=6]="search_file_progress",t[t.search_file_end=7]="search_file_end",t[t.docs_init=8]="docs_init",t[t.docs_add=9]="docs_add",t[t.docs_del=10]="docs_del",t[t.docs_close=11]="docs_close",t[t.docs_search=12]="docs_search"}(i||(e.threads_msg_type=i={}))},324(t,e,i){"use strict";e.register_threads_worker_handler=o,e.threads_send=h;const n=i(167),s=i(525);console.log("[worker] 子线程启动, workerData=",n.workerData);const r=new Map;function o(t,e){r.set(t,e)}function h(t){try{n.parentPort?.postMessage(t)}catch(t){console.error("[worker] send failed:",t)}}n.parentPort?.on("message",t=>{(async function(t){try{const e=r.get(t.type);if(!e)return void h({id:t.id,type:t.type,data:`unknown type ${t.type}`});const i=await e(t);h({id:t.id,type:t.type,data:i})}catch(e){h({id:t.id,type:t.type,data:null,error:e?.message||String(e)}),console.error("[worker] task error:",e)}})(t).catch(console.error)}),o(s.threads_msg_type.hello,async t=>new Promise((e,i)=>setTimeout(()=>{if(Math.random()<.05)return i(new Error("模拟错误"));e(`done:${t.data}`)},500))),console.log("[worker] ready and waiting for messages..."),process.on("uncaughtException",t=>{console.error("子线程全局未捕获异常:",t)}),process.on("unhandledRejection",t=>{console.error("子线程未处理的 Promise 拒绝:",t)})},474(t,e,i){t=i.nmd(t),function e(n){"use strict";var s;function r(t,e,i){const n=typeof i,s=typeof t;if("undefined"!==n){if("undefined"!==s){if(i){if("function"===s&&n===s)return function(e){return t(i(e))};if((e=t.constructor)===i.constructor){if(e===Array)return i.concat(t);if(e===Map){var r=new Map(i);for(var o of t)r.set(o[0],o[1]);return r}if(e===Set){for(r of(o=new Set(i),t.values()))o.add(r);return o}}}return t}return i}return"undefined"===s?e:t}function o(t,e){return void 0===t?e:t}function h(){return Object.create(null)}function l(t){return"string"==typeof t}function c(t){return"object"==typeof t}function a(t,e){if(l(e))t=t[e];else for(let i=0;t&&i<e.length;i++)t=t[e[i]];return t}(n=t)._factory=e;const u=/[^\p{L}\p{N}]+/u,f=/(\d{3})/g,d=/(\D)(\d{3})/g,g=/(\d{3})(\D)/g,p=/[\u0300-\u036f]/g;function m(t={}){if(!this||this.constructor!==m)return new m(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}function _(t){t.F=null,t.B.clear(),t.D.clear()}function w(t,e,i){i||(e||"object"!=typeof t?"object"==typeof e&&(i=e,e=0):i=t),i&&(t=i.query||t,e=i.limit||e);let n=""+(e||0);i&&(n+=(i.offset||0)+!!i.context+!!i.suggest+(!1!==i.resolve)+(i.resolution||this.resolution)+(i.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new y);let s=this.cache.get(t+n);if(!s){const r=i&&i.cache;r&&(i.cache=!1),s=this.search(t,e,i),r&&(i.cache=r),this.cache.set(t+n,s)}return s}function y(t){this.limit=t&&!0!==t?t:1e3,this.cache=new Map,this.h=""}(s=m.prototype).assign=function(t){this.normalize=r(t.normalize,!0,this.normalize);let e,i=t.include,n=i||t.exclude||t.split;if(n||""===n){if("object"==typeof n&&n.constructor!==RegExp){let t="";e=!i,i||(t+="\\p{Z}"),n.letter&&(t+="\\p{L}"),n.number&&(t+="\\p{N}",e=!!i),n.symbol&&(t+="\\p{S}"),n.punctuation&&(t+="\\p{P}"),n.control&&(t+="\\p{C}"),(n=n.char)&&(t+="object"==typeof n?n.join(""):n);try{this.split=new RegExp("["+(i?"^":"")+t+"]+","u")}catch(t){this.split=/\s+/}}else this.split=n,e=!1===n||"a1a".split(n).length<2;this.numeric=r(t.numeric,e)}else{try{this.split=r(this.split,u)}catch(t){this.split=/\s+/}this.numeric=r(t.numeric,r(this.numeric,!0))}if(this.prepare=r(t.prepare,null,this.prepare),this.finalize=r(t.finalize,null,this.finalize),n=t.filter,this.filter="function"==typeof n?n:r(n&&new Set(n),null,this.filter),this.dedupe=r(t.dedupe,!0,this.dedupe),this.matcher=r((n=t.matcher)&&new Map(n),null,this.matcher),this.mapper=r((n=t.mapper)&&new Map(n),null,this.mapper),this.stemmer=r((n=t.stemmer)&&new Map(n),null,this.stemmer),this.replacer=r(t.replacer,null,this.replacer),this.minlength=r(t.minlength,1,this.minlength),this.maxlength=r(t.maxlength,1024,this.maxlength),this.rtl=r(t.rtl,!1,this.rtl),(this.cache=n=r(t.cache,!0,this.cache))&&(this.F=null,this.L="number"==typeof n?n:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const t of this.matcher.keys())this.h+=(this.h?"|":"")+t;if(this.stemmer)for(const t of this.stemmer.keys())this.A+=(this.A?"|":"")+t;return this},s.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&_(this),this},s.addFilter=function(t){return"function"==typeof t?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&_(this),this},s.addMapper=function(t,e){return"object"==typeof t?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&_(this),this)},s.addMatcher=function(t,e){return"object"==typeof t?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&_(this),this)},s.addReplacer=function(t,e){return"string"==typeof t?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&_(this),this)},s.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(_,50,this);this.normalize&&(t="function"==typeof this.normalize?this.normalize(t):p?t.normalize("NFKD").replace(p,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(d,"$1 $2").replace(g,"$1 $2").replace(f,"$1 "));const i=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n,s,r=[],o=h(),l=this.split||""===this.split?t.split(this.split):[t];for(let t,h,a=0;a<l.length;a++)if((t=h=l[a])&&!(t.length<this.minlength||t.length>this.maxlength)){if(e){if(o[t])continue;o[t]=1}else{if(n===t)continue;n=t}if(i)r.push(t);else if(!this.filter||("function"==typeof this.filter?this.filter(t):!this.filter.has(t))){if(this.cache&&t.length<=this.I)if(this.F){var c=this.D.get(t);if(c||""===c){c&&r.push(c);continue}}else this.F=setTimeout(_,50,this);if(this.stemmer){let e;for(this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));e!==t&&t.length>2;)e=t,t=t.replace(this.K,t=>this.stemmer.get(t))}if(t&&(this.mapper||this.dedupe&&t.length>1)){c="";for(let e,i,n=0,s="";n<t.length;n++)e=t.charAt(n),e===s&&this.dedupe||((i=this.mapper&&this.mapper.get(e))||""===i?i===s&&this.dedupe||!(s=i)||(c+=i):c+=s=e);t=c}if(this.matcher&&t.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),t=t.replace(this.J,t=>this.matcher.get(t))),t&&this.replacer)for(c=0;t&&c<this.replacer.length;c+=2)t=t.replace(this.replacer[c],this.replacer[c+1]);if(this.cache&&h.length<=this.I&&(this.D.set(h,t),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),t){if(t!==h)if(e){if(o[t])continue;o[t]=1}else{if(s===t)continue;s=t}r.push(t)}}}return this.finalize&&(r=this.finalize(r)||r),this.cache&&t.length<=this.H&&(this.B.set(t,r),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),r},y.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},y.prototype.get=function(t){const e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e},y.prototype.remove=function(t){for(const e of this.cache){const i=e[0];e[1].includes(t)&&this.cache.delete(i)}},y.prototype.clear=function(){this.cache.clear(),this.h=""};const b={normalize:!1,numeric:!1,dedupe:!1},x={},k=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),v=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),S=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],j={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var A={Exact:b,Default:x,Normalize:x,LatinBalance:{mapper:k},LatinAdvanced:{mapper:k,matcher:v,replacer:S},LatinExtra:{mapper:k,replacer:S.concat([/(?!^)[aeo]/g,""]),matcher:v},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let i=0;i<t.length;i++){var e=t[i];let n=e.charAt(0),s=j[n];for(let t,i=1;i<e.length&&(t=e.charAt(i),"h"===t||"w"===t||!(t=j[t])||t===s||(n+=t,s=t,4!==n.length));i++);t[i]=n}}},CJK:{split:""},LatinExact:b,LatinDefault:x,LatinSimple:x};function M(t,e,i,n){let s=[];for(let r,o=0;o<t.index.length;o++)if(r=t.index[o],e>=r.length)e-=r.length;else{const o=(e=r[n?"splice":"slice"](e,i)).length;if(o&&(s=s.length?s.concat(e):e,i-=o,n&&(t.length-=o),!i))break;e=0}return s}function E(t){if(!this||this.constructor!==E)return new E(t);this.index=t?[t]:[],this.length=t?t.length:0;const e=this;return new Proxy([],{get:(t,i)=>"length"===i?e.length:"push"===i?function(t){e.index[e.index.length-1].push(t),e.length++}:"pop"===i?function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()}:"indexOf"===i?function(t){let i=0;for(let n,s,r=0;r<e.index.length;r++){if(n=e.index[r],s=n.indexOf(t),s>=0)return i+s;i+=n.length}return-1}:"includes"===i?function(t){for(let i=0;i<e.index.length;i++)if(e.index[i].includes(t))return!0;return!1}:"slice"===i?function(t,i){return M(e,t||0,i||e.length,!1)}:"splice"===i?function(t,i){return M(e,t||0,i||e.length,!0)}:"constructor"===i?Array:"symbol"!=typeof i?(t=e.index[i/2**31|0])&&t[i]:void 0,set:(t,i,n)=>(t=i/2**31|0,(e.index[t]||(e.index[t]=[]))[i]=n,e.length++,!0)})}function z(t=8){if(!this||this.constructor!==z)return new z(t);this.index=h(),this.h=[],this.size=0,t>32?(this.B=I,this.A=BigInt(t)):(this.B=F,this.A=t)}function C(t=8){if(!this||this.constructor!==C)return new C(t);this.index=h(),this.h=[],this.size=0,t>32?(this.B=I,this.A=BigInt(t)):(this.B=F,this.A=t)}function F(t){let e=2**this.A-1;if("number"==typeof t)return t&e;let i=0,n=this.A+1;for(let s=0;s<t.length;s++)i=(i*n^t.charCodeAt(s))&e;return 32===this.A?i+2**31:i}function I(t){let e=BigInt(2)**this.A-BigInt(1);var i=typeof t;if("bigint"===i)return t&e;if("number"===i)return BigInt(t)&e;i=BigInt(0);let n=this.A+BigInt(1);for(let s=0;s<t.length;s++)i=(i*n^BigInt(t.charCodeAt(s)))&e;return i}let O,B,D,q,L;async function T(t){var e=(t=t.data).task;const i=t.id;let s=t.args;if("init"===e)B=t.options||{},(e=t.factory)?(Function("return "+e)()(n),O=new n.FlexSearch.Index(B),delete n.FlexSearch):O=new Et(B),postMessage({id:i});else{let n;"export"===e&&(s[1]?(s[0]=B.export,s[2]=0,s[3]=1):s=null),"import"===e?s[0]&&(t=await B.import.call(O,s[0]),O.import(s[0],t)):((n=s&&O[e].apply(O,s))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),"search"===e&&n.result&&(n=n.result)),postMessage("search"===e?{id:i,msg:n}:{id:i})}}function R(t){N.call(t,"add"),N.call(t,"append"),N.call(t,"search"),N.call(t,"update"),N.call(t,"remove"),N.call(t,"searchCache")}function $(){D=L=0}function N(t){this[t+"Async"]=function(){const e=arguments;var i=e[e.length-1];let n;if("function"==typeof i&&(n=i,delete e[e.length-1]),D?L||(L=Date.now()-q>=this.priority*this.priority*3):(D=setTimeout($,0),q=Date.now()),L){const i=this;return new Promise(n=>{setTimeout(function(){n(i[t+"Async"].apply(i,e))},0)})}const s=this[t].apply(this,e);return i=s.then?s:new Promise(t=>t(s)),n&&i.then(n),i}}E.prototype.clear=function(){this.index.length=0},E.prototype.push=function(){},z.prototype.get=function(t){const e=this.index[this.B(t)];return e&&e.get(t)},z.prototype.set=function(t,e){var i=this.B(t);let n=this.index[i];n?(i=n.size,n.set(t,e),(i-=n.size)&&this.size++):(this.index[i]=n=new Map([[t,e]]),this.h.push(n),this.size++)},C.prototype.add=function(t){var e=this.B(t);let i=this.index[e];i?(e=i.size,i.add(t),(e-=i.size)&&this.size++):(this.index[e]=i=new Set([t]),this.h.push(i),this.size++)},(s=z.prototype).has=C.prototype.has=function(t){const e=this.index[this.B(t)];return e&&e.has(t)},s.delete=C.prototype.delete=function(t){const e=this.index[this.B(t)];e&&e.delete(t)&&this.size--},s.clear=C.prototype.clear=function(){this.index=h(),this.h=[],this.size=0},s.values=C.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e},s.keys=C.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e},s.entries=C.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};let P=0;function U(t={},e){function s(i){function n(t){const e=(t=t.data||t).id,i=e&&l.h[e];i&&(i(t.msg),delete l.h[e])}if(this.worker=i,this.h=h(),this.worker)return o?this.worker.on("message",n):this.worker.onmessage=n,t.config?new Promise(function(e){P>1e9&&(P=0),l.h[++P]=function(){e(l)},l.worker.postMessage({id:P,task:"init",factory:r,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:r,options:t}),this)}if(!this||this.constructor!==U)return new U(t);let r=void 0!==n?n._factory:"undefined"!=typeof window?window._factory:null;r&&(r=r.toString());const o="undefined"==typeof window,l=this,c=function(t,e,n){return e?new(i(167).Worker)(__dirname+"/node/node.js"):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+T.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof n?n:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}(r,o,t.worker);return c.then?c.then(function(t){return s.call(l,t)}):s.call(this,c)}function W(t){U.prototype[t]=function(){const e=this,i=[].slice.call(arguments);var n=i[i.length-1];let s;return"function"==typeof n&&(s=n,i.pop()),n=new Promise(function(n){"export"===t&&"function"==typeof i[0]&&(i[0]=null),P>1e9&&(P=0),e.h[++P]=n,e.worker.postMessage({task:t,id:P,args:i})}),s?(n.then(s),this):n}}function H(t,e,i,n,s,r){if(t=t[s],n===i.length-1)e[s]=r||t;else if(t)if(t.constructor===Array)for(e=e[s]=Array(t.length),s=0;s<t.length;s++)H(t,e,i,n,s);else e=e[s]||(e[s]=h()),s=i[++n],H(t,e,i,n,s)}function J(t,e,i,n,s,r,o,h){if(t=t[o])if(n===e.length-1){if(t.constructor===Array){if(i[n]){for(e=0;e<t.length;e++)s.add(r,t[e],!0,!0);return}t=t.join(" ")}s.add(r,t,h,!0)}else if(t.constructor===Array)for(o=0;o<t.length;o++)J(t,e,i,n,s,r,o,h);else o=e[++n],J(t,e,i,n,s,r,o,h)}function K(t,e,i,n){if(!t.length)return t;if(1===t.length)return t=t[0],t=i||t.length>e?t.slice(i,i+e):t,n?lt.call(this,t):t;let s=[];for(let r,o,h=0;h<t.length;h++)if((r=t[h])&&(o=r.length)){if(i){if(i>=o){i-=o;continue}r=r.slice(i,i+e),o=r.length,i=0}if(o>e&&(r=r.slice(0,e),o=e),!s.length&&o>=e)return n?lt.call(this,r):r;if(s.push(r),!(e-=o))break}return s=s.length>1?[].concat.apply([],s):s[0],n?lt.call(this,s):s}function G(t,e,i,n){var s=n[0];if(s[0]&&s[0].query)return t[e].apply(t,s);if(!("and"!==e&&"not"!==e||t.result.length||t.await||s.suggest))return n.length>1&&(s=n[n.length-1]),(n=s.resolve)?t.await||t.result:t;let r,o,h,l,c,a=[],u=0,f=0;for(e=0;e<n.length;e++)if(s=n[e]){var d=void 0;if(s.constructor===et)d=s.await||s.result;else if(s.then||s.constructor===Array)d=s;else{u=s.limit||0,f=s.offset||0,h=s.suggest,o=s.resolve,r=((l=s.highlight||t.highlight)||s.enrich)&&o,d=s.queue;let i=s.async||d,n=s.index,g=s.query;if(n?t.index||(t.index=n):n=t.index,g||s.tag){const r=s.field||s.pluck;if(r&&(!g||t.query&&!l||(t.query=g,t.field=r,t.highlight=l),n=n.index.get(r)),d&&(c||t.await)){let r;c=1;const o=t.C.length,h=new Promise(function(t){r=t});(function(e,n){h.h=function(){n.index=null,n.resolve=!1;let s=i?e.searchAsync(n):e.search(n);return s.then?s.then(function(e){return t.C[o]=e=e.result||e,r(e),e}):(s=s.result||s,r(s),s)}})(n,Object.assign({},s)),t.C.push(h),a[e]=h;continue}s.resolve=!1,s.index=null,d=i?n.searchAsync(s):n.search(s),s.resolve=o,s.index=n}else if(s.and)d=X(s,"and",n);else if(s.or)d=X(s,"or",n);else if(s.not)d=X(s,"not",n);else{if(!s.xor)continue;d=X(s,"xor",n)}}d.await?(c=1,d=d.await):d.then?(c=1,d=d.then(function(t){return t.result||t})):d=d.result||d,a[e]=d}if(c&&!t.await&&(t.await=new Promise(function(e){t.return=e})),c){const e=Promise.all(a).then(function(n){for(let s=0;s<t.C.length;s++)if(t.C[s]===e){t.C[s]=function(){return i.call(t,n,u,f,r,o,h,l)};break}it(t)});t.C.push(e)}else{if(!t.await)return i.call(t,a,u,f,r,o,h,l);t.C.push(function(){return i.call(t,a,u,f,r,o,h,l)})}return o?t.await||t.result:t}function X(t,e,i){const n=(t=t[e])[0]||t;return n.index||(n.index=i),i=new et(n),t.length>1&&(i=i[e].apply(i,t.slice(1))),i}function V(t,e,i,n,s,r,o){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=st(t,e,i,!1,this.h),i=0)),s&&(this.await=null),s?this.resolve(e,i,n,o):this}function Y(t,e,i,n,s,r,o){if(!r&&!this.result.length)return s?this.result:this;let h;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let n=0;for(let e,i,s=0;s<t.length;s++)if((e=t[s])&&(i=e.length))n<i&&(n=i);else if(!r){n=0;break}n?(this.result=nt(t,n,e,i,r,this.h,s),h=!0):this.result=[]}else r||(this.result=t);return s&&(this.await=null),s?this.resolve(e,i,n,o,h):this}function Z(t,e,i,n,s,r,o){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{t:{r=i;var l=this.h;const n=[],o=h();let c=0;for(let e,i=0;i<t.length;i++)if(e=t[i]){c<e.length&&(c=e.length);for(let t,i=0;i<e.length;i++)if(t=e[i])for(let e,i=0;i<t.length;i++)e=t[i],o[e]=o[e]?2:1}for(let i,h=0,a=0;h<c;h++)for(let c,u=0;u<t.length;u++)if((c=t[u])&&(i=c[h]))for(let c,f=0;f<i.length;f++)if(c=i[f],1===o[c])if(r)r--;else if(s){if(n.push(c),n.length===e){t=n;break t}}else{const i=h+(u?l:0);if(n[i]||(n[i]=[]),n[i].push(c),++a===e){t=n;break t}}t=n}this.result=t,l=!0}else r||(this.result=t);return s&&(this.await=null),s?this.resolve(e,i,n,o,l):this}function Q(t,e,i,n,s,r,o){if(!r&&!this.result.length)return s?this.result:this;if(t.length&&this.result.length){t:{r=i;var h=[];t=new Set(t.flat().flat());for(let i,n=0,o=0;n<this.result.length;n++)if(i=this.result[n])for(let l,c=0;c<i.length;c++)if(l=i[c],!t.has(l))if(r)r--;else if(s){if(h.push(l),h.length===e){t=h;break t}}else if(h[n]||(h[n]=[]),h[n].push(l),++o===e){t=h;break t}t=h}this.result=t,h=!0}return s&&(this.await=null),s?this.resolve(e,i,n,o,h):this}function tt(t,e,i,n,s){let r,o,h;"string"==typeof s?(r=s,s=""):r=s.template,o=r.indexOf("$1"),h=r.substring(o+2),o=r.substring(0,o);let l=s&&s.boundary,c=!s||!1!==s.clip,u=s&&s.merge&&h&&o&&new RegExp(h+" "+o,"g");var f=0;if("object"==typeof(s=s&&s.ellipsis)){var d=s.template;f=d.length-2,s=s.pattern}let g,p;"string"!=typeof s&&(s=!1===s?"":"..."),f&&(s=d.replace("$1",s)),d=s.length-f,"object"==typeof l&&(g=l.before,0===g&&(g=-1),p=l.after,0===p&&(p=-1),l=l.total||9e5),f=new Map;for(let B,D,q,L=0;L<e.length;L++){let T;if(n)T=e,q=n;else{var m=e[L];if(q=m.field,!q)continue;T=m.result}D=i.get(q),B=D.encoder,"string"!=typeof(m=f.get(B))&&(m=B.encode(t),f.set(B,m));for(let t=0;t<T.length;t++){var _=T[t].doc;if(!_)continue;if(!(_=a(_,q)))continue;var w=_.trim().split(/\s+/);if(!w.length)continue;_="";var y=[];let e=[];for(var b=-1,x=-1,k=0,v=0;v<w.length;v++){var S=w[v],j=B.encode(S);let t;if((j=j.length>1?j.join(" "):j[0])&&S){for(var A=S.length,M=(B.split?S.replace(B.split,""):S).length-j.length,E="",z=0,C=0;C<m.length;C++){var F=m[C];if(F){var I=F.length;I+=M<0?0:M,z&&I<=z||(F=j.indexOf(F))>-1&&(E=(F?S.substring(0,F):"")+o+S.substring(F,F+I)+h+(F+I<A?S.substring(F+I):""),z=I,t=!0)}}E&&(l&&(b<0&&(b=_.length+(_?1:0)),x=_.length+(_?1:0)+E.length,k+=A,e.push(y.length),y.push({match:E})),_+=(_?" ":"")+E)}if(t){if(l&&k>=l)break}else _+=(_?" ":"")+(S=w[v]),l&&y.push({text:S})}if(k=e.length*(r.length-2),g||p||l&&_.length-k>l)if(v=x-b,g>0&&(v+=g),p>0&&(v+=p),v<=(k=l+k-2*d))w=g?b-(g>0?g:0):b-((k-v)/2|0),y=p?x+(p>0?p:0):w+k,c||(w>0&&" "!==_.charAt(w)&&" "!==_.charAt(w-1)&&((w=_.indexOf(" ",w))<0&&(w=0)),y<_.length&&" "!==_.charAt(y-1)&&" "!==_.charAt(y)&&((y=_.lastIndexOf(" ",y))<x?y=x:++y)),_=(w?s:"")+_.substring(w,y)+(y<_.length?s:"");else{for(x=[],b={},k={},v={},S={},j={},E=M=A=0,C=z=1;;){var O=void 0;for(let t,i=0;i<e.length;i++){if(t=e[i],E)if(M!==E){if(v[i+1])continue;if(t+=E,b[t]){A-=d,k[i+1]=1,v[i+1]=1;continue}if(t>=y.length-1){if(t>=y.length){v[i+1]=1,t>=w.length&&(k[i+1]=1);continue}A-=d}if(_=y[t].text,I=p&&j[i]){if(!(I>0)){v[i+1]=1;continue}if(_.length>I){if(v[i+1]=1,!c)continue;_=_.substring(0,I)}(I-=_.length)||(I=-1),j[i]=I}if(A+_.length+1<=l)_=" "+_,x[i]+=_;else{if(!c){v[i+1]=1;continue}(O=l-A-1)>0&&(_=" "+_.substring(0,O),x[i]+=_),v[i+1]=1}}else{if(v[i])continue;if(t-=M,b[t]){A-=d,v[i]=1,k[i]=1;continue}if(t<=0){if(t<0){v[i]=1,k[i]=1;continue}A-=d}if(_=y[t].text,I=g&&S[i]){if(!(I>0)){v[i]=1;continue}if(_.length>I){if(v[i]=1,!c)continue;_=_.substring(_.length-I)}(I-=_.length)||(I=-1),S[i]=I}if(A+_.length+1<=l)_+=" ",x[i]=_+x[i];else{if(!c){v[i]=1;continue}(O=_.length+1-(l-A))>=0&&O<_.length&&(_=_.substring(O)+" ",x[i]=_+x[i]),v[i]=1}}else{let e;if(_=y[t].match,g&&(S[i]=g),p&&(j[i]=p),i&&A++,t?!i&&d&&(A+=d):(k[i]=1,v[i]=1),t>=w.length-1||t<y.length-1&&y[t+1].match?e=1:d&&(A+=d),A-=r.length-2,i&&!(A+_.length<=l)){O=z=C=k[i]=0;break}x[i]=_,e&&(k[i+1]=1,v[i+1]=1)}A+=_.length,O=b[t]=1}if(O)M===E?E++:M++;else{if(M===E?z=0:C=0,!z&&!C)break;z?E=++M:E++}}_="";for(let t,e=0;e<x.length;e++)t=(k[e]?e?" ":"":(e&&!s?" ":"")+s)+x[e],_+=t;s&&!k[x.length]&&(_+=s)}u&&(_=_.replace(u," ")),T[t].highlight=_}if(n)break}return e}function et(t,e){if(!this||this.constructor!==et)return new et(t,e);let i,n,s,r,o,h,l=0;if(t&&t.index){const i=t;if(e=i.index,l=i.boost||0,n=i.query){s=i.field||i.pluck,r=i.highlight;const n=i.resolve;t=i.async||i.queue,i.resolve=!1,i.index=null,t=t?e.searchAsync(i):e.search(i),i.resolve=n,i.index=e,t=t.result||t}else t=[]}if(t&&t.then){const e=this;i=[t=t.then(function(t){e.C[0]=e.result=t.result||t,it(e)})],t=[],o=new Promise(function(t){h=t})}this.index=e||null,this.result=t||[],this.h=l,this.C=i||[],this.await=o||null,this.return=h||null,this.highlight=r||null,this.query=n||"",this.field=s||""}function it(t,e){let i=t.result;var n=t.await;t.await=null;for(let e,s=0;s<t.C.length;s++)if(e=t.C[s])if("function"==typeof e)i=e(),t.C[s]=i=i.result||i,s--;else if(e.h)i=e.h(),t.C[s]=i=i.result||i,s--;else if(e.then)return t.await=n;return n=t.return,t.C=[],t.return=null,e||n(i),i}function nt(t,e,i,n,s,r,o){const l=t.length;let c,a,u=[];c=h();for(let h,f,d,g,p=0;p<e;p++)for(let e=0;e<l;e++)if(d=t[e],p<d.length&&(h=d[p]))for(let t=0;t<h.length;t++){if(f=h[t],(a=c[f])?c[f]++:(a=0,c[f]=1),g=u[a]||(u[a]=[]),!o){let t=p+(e||!s?0:r||0);g=g[t]||(g[t]=[])}if(g.push(f),o&&i&&a===l-1&&g.length-n===i)return n?g.slice(n):g}if(t=u.length)if(s)u=u.length>1?st(u,i,n,o,r):(u=u[0])&&i&&u.length>i||n?u.slice(n,i+n):u;else{if(t<l)return[];if(u=u[t-1],i||n)if(o)(u.length>i||n)&&(u=u.slice(n,i+n));else{s=[];for(let t,e=0;e<u.length;e++)if(t=u[e])if(n&&t.length>n)n-=t.length;else if((i&&t.length>i||n)&&(t=t.slice(n,i+n),i-=t.length,n&&(n-=t.length)),s.push(t),!i)break;u=s}}return u}function st(t,e,i,n,s){const r=[],o=h();let l;var c=t.length;let a;if(n){for(s=c-1;s>=0;s--)if(a=(n=t[s])&&n.length)for(c=0;c<a;c++)if(l=n[c],!o[l])if(o[l]=1,i)i--;else if(r.push(l),r.length===e)return r}else for(let h,u=c-1,f=0;u>=0;u--){h=t[u];for(let t=0;t<h.length;t++)if(a=(n=h[t])&&n.length)for(let h=0;h<a;h++)if(l=n[h],!o[l])if(o[l]=1,i)i--;else{let i=(t+(u<c-1&&s||0))/(u+1)|0;if((r[i]||(r[i]=[])).push(l),++f===e)return r}}return r}function rt(t,e,i,n,s){const r=h(),o=[];for(let t,i=0;i<e.length;i++){t=e[i];for(let e=0;e<t.length;e++)r[t[e]]=1}if(s){for(let e,s=0;s<t.length;s++)if(e=t[s],r[e])if(n)n--;else if(o.push(e),r[e]=0,i&&0===--i)break}else for(let i,n,s=0;s<t.result.length;s++)for(i=t.result[s],e=0;e<i.length;e++)n=i[e],r[n]&&((o[s]||(o[s]=[])).push(n),r[n]=0);return o}function ot(t){const e=[],i=h(),n=h();for(let s,r,o,h,l,c,a,u=0;u<t.length;u++){s=t[u],r=s.field,o=s.result;for(let t=0;t<o.length;t++)l=o[t],"object"!=typeof l?l={id:h=l}:h=l.id,(c=i[h])?c.push(r):(l.field=i[h]=[r],e.push(l)),(a=l.highlight)&&(c=n[h],c||(n[h]=c={},l.highlight=c),c[r]=a)}return e}function ht(t,e,i,n,s){return(t=this.tag.get(t))&&(t=t.get(e))?((e=t.length-n)>0&&((i&&e>i||n)&&(t=t.slice(n,n+i)),s&&(t=lt.call(this,t))),t):[]}function lt(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);const e=Array(t.length);for(let i,n=0;n<t.length;n++)i=t[n],e[n]={id:i,doc:this.store.get(i)};return e}function ct(t){if(!this||this.constructor!==ct)return new ct(t);const e=t.document||t.doc||t;let i,n;if(this.B=[],this.field=[],this.D=[],this.key=(i=e.key||e.id)&&ut(i,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new C(n):new Set:n?new z(n):new Map,this.h=(i=e.store||null)&&i&&!0!==i&&[],this.store=i?n?new z(n):new Map:null,this.cache=(i=t.cache||null)&&new y(i),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=at.call(this,t,e),this.tag=null,(i=e.tag)&&("string"==typeof i&&(i=[i]),i.length)){this.tag=new Map,this.A=[],this.F=[];for(let t,e,n=0;n<i.length;n++){if(t=i[n],e=t.field||t,!e)throw Error("The tag field from the document descriptor is undefined.");t.custom?this.A[n]=t.custom:(this.A[n]=ut(e,this.D),t.filter&&("string"==typeof this.A[n]&&(this.A[n]=new String(this.A[n])),this.A[n].G=t.filter)),this.F[n]=e,this.tag.set(e,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(const e of this.index.values())e.then&&t.push(e);if(t.length){const e=this;return Promise.all(t).then(function(t){let i=0;for(const n of e.index.entries()){const s=n[0];let r=n[1];r.then&&(r=t[i],e.index.set(s,r),i++)}return e})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}function at(t,e){const i=new Map;let n=e.index||e.field||e;l(n)&&(n=[n]);for(let e,r,o=0;o<n.length;o++){if(e=n[o],l(e)||(r=e,e=e.field),r=c(r)?Object.assign({},t,r):t,this.worker){var s=void 0;s=new U(r,s=(s=r.encoder)&&s.encode?s:new m("string"==typeof s?A[s]:s||{})),i.set(e,s)}this.worker||i.set(e,new Et(r,this.reg)),r.custom?this.B[o]=r.custom:(this.B[o]=ut(e,this.D),r.filter&&("string"==typeof this.B[o]&&(this.B[o]=new String(this.B[o])),this.B[o].G=r.filter)),this.field[o]=e}if(this.h){l(t=e.store)&&(t=[t]);for(let e,i,n=0;n<t.length;n++)e=t[n],i=e.field||e,e.custom?(this.h[n]=e.custom,e.custom.O=i):(this.h[n]=ut(i,this.D),e.filter&&("string"==typeof this.h[n]&&(this.h[n]=new String(this.h[n])),this.h[n].G=e.filter))}return i}function ut(t,e){const i=t.split(":");let n=0;for(let s=0;s<i.length;s++)"]"===(t=i[s])[t.length-1]&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(i[n++]=t);return n<i.length&&(i.length=n),n>1?i:i[0]}function ft(t,e=0){let i=[],n=[];e&&(e=25e4/e*5e3|0);for(const s of t.entries())n.push(s),n.length===e&&(i.push(n),n=[]);return n.length&&i.push(n),i}function dt(t,e){e||(e=new Map);for(let i,n=0;n<t.length;n++)i=t[n],e.set(i[0],i[1]);return e}function gt(t,e=0){let i=[],n=[];e&&(e=25e4/e*1e3|0);for(const s of t.entries())n.push([s[0],ft(s[1])[0]||[]]),n.length===e&&(i.push(n),n=[]);return n.length&&i.push(n),i}function pt(t,e){e||(e=new Map);for(let i,n,s=0;s<t.length;s++)i=t[s],n=e.get(i[0]),e.set(i[0],dt(i[1],n));return e}function mt(t){let e=[],i=[];for(const n of t.keys())i.push(n),25e4===i.length&&(e.push(i),i=[]);return i.length&&e.push(i),e}function _t(t,e){e||(e=new Set);for(let i=0;i<t.length;i++)e.add(t[i]);return e}function wt(t,e,i,n,s,r,o=0){const h=n&&n.constructor===Array;var l=h?n.shift():n;if(!l)return this.export(t,e,s,r+1);if((l=t((e?e+".":"")+(o+1)+"."+i,JSON.stringify(l)))&&l.then){const c=this;return l.then(function(){return wt.call(c,t,e,i,h?n:null,s,r,o+1)})}return wt.call(this,t,e,i,h?n:null,s,r,o+1)}function yt(t,e){let i="";for(const n of t.entries()){t=n[0];const s=n[1];let r="";for(let t,i=0;i<s.length;i++){t=s[i]||[""];let n="";for(let i=0;i<t.length;i++)n+=(n?",":"")+("string"===e?'"'+t[i]+'"':t[i]);n="["+n+"]",r+=(r?",":"")+n}r='["'+t+'",['+r+"]]",i+=(i?",":"")+r}return i}function bt(t,e){let i=0;var n=void 0===e;if(t.constructor===Array){for(let s,r,o,h=0;h<t.length;h++)if((s=t[h])&&s.length){if(n)return 1;if(r=s.indexOf(e),r>=0){if(s.length>1)return s.splice(r,1),1;if(delete t[h],i)return 1;o=1}else{if(o)return 1;i++}}}else for(let s of t.entries())n=s[0],bt(s[1],e)?i++:t.delete(n);return i}W("add"),W("append"),W("search"),W("update"),W("remove"),W("clear"),W("export"),W("import"),U.prototype.searchCache=w,R(U.prototype),ct.prototype.add=function(t,e,i){if(c(t)&&(t=a(e=t,this.key)),e&&(t||0===t)){if(!i&&this.reg.has(t))return this.update(t,e);for(let r,o=0;o<this.field.length;o++){r=this.B[o];var n=this.index.get(this.field[o]);if("function"==typeof r){var s=r(e);s&&n.add(t,s,i,!0)}else(!(s=r.G)||s(e))&&(r.constructor===String?r=[""+r]:l(r)&&(r=[r]),J(e,r,this.D,0,n,t,r[0],i))}if(this.tag)for(n=0;n<this.A.length;n++){var r=this.A[n];s=this.tag.get(this.F[n]);let c=h();if("function"==typeof r){if(!(r=r(e)))continue}else{var o=r.G;if(o&&!o(e))continue;r.constructor===String&&(r=""+r),r=a(e,r)}if(s&&r){l(r)&&(r=[r]);for(let e,n,h=0;h<r.length;h++)if(e=r[h],!c[e]&&(c[e]=1,(o=s.get(e))?n=o:s.set(e,n=[]),!i||!n.includes(t))){if(n.length===2**31-1){if(o=new E(n),this.fastupdate)for(let t of this.reg.values())t.includes(n)&&(t[t.indexOf(n)]=o);s.set(e,n=o)}n.push(t),this.fastupdate&&((o=this.reg.get(t))?o.push(n):this.reg.set(t,[n]))}}}if(this.store&&(!i||!this.store.has(t))){let n;if(this.h){n=h();for(let t,s=0;s<this.h.length;s++){if(t=this.h[s],(i=t.G)&&!i(e))continue;let r;if("function"==typeof t){if(r=t(e),!r)continue;t=[t.O]}else if(l(t)||t.constructor===String){n[t]=e[t];continue}H(e,n,t,0,t[0],r)}}this.store.set(t,n||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this},et.prototype.or=function(){return G(this,"or",V,arguments)},et.prototype.and=function(){return G(this,"and",Y,arguments)},et.prototype.xor=function(){return G(this,"xor",Z,arguments)},et.prototype.not=function(){return G(this,"not",Q,arguments)},(s=et.prototype).limit=function(t){if(this.await){const e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){const e=[];for(let i,n=0;n<this.result.length;n++)if(i=this.result[n]){if(!(i.length<=t)){e[n]=i.slice(0,t);break}if(e[n]=i,!(t-=i.length))break}this.result=e}return this},s.offset=function(t){if(this.await){const e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){const e=[];for(let i,n=0;n<this.result.length;n++)(i=this.result[n])&&(i.length<=t?t-=i.length:(e[n]=i.slice(t),t=0));this.result=e}return this},s.boost=function(t){if(this.await){const e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this},s.resolve=function(t,e,i,n,s){let r=this.await?it(this,!0):this.result;if(r.then){const o=this;return r.then(function(){return o.resolve(t,e,i,n,s)})}return r.length&&("object"==typeof t?(n=t.highlight||this.highlight,i=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,i=!!n||i),r=s?i?lt.call(this.index,r):r:K.call(this.index,r,t||100,e,i)),this.finalize(r,n)},s.finalize=function(t,e){if(t.then){const i=this;return t.then(function(t){return i.finalize(t,e)})}e&&t.length&&this.query&&(t=tt(this.query,t,this.index.index,this.field,e));const i=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",i&&i(t),t},h(),ct.prototype.search=function(t,e,i,n){i||(!e&&c(t)?(i=t,t=""):c(e)&&(i=e,e=0));let s=[];var r=[];let h,a,u,f,d,g,p,m,_=0,w=!0;if(i){i.constructor===Array&&(i={index:i}),t=i.query||t,h=i.pluck,a=i.merge,f=i.boost,g=h||i.field||(g=i.index)&&(g.index?null:g);var y=this.tag&&i.tag;u=i.suggest,w=!1!==i.resolve,d=i.cache,p=w&&this.store&&i.highlight;var b=!!p||w&&this.store&&i.enrich;e=i.limit||e;var x=i.offset||0;if(e||(e=w?100:0),y&&(!this.db||!n)){y.constructor!==Array&&(y=[y]);var k=[];for(let t,e=0;e<y.length;e++)if(t=y[e],t.field&&t.tag){var v=t.tag;if(v.constructor===Array)for(var S=0;S<v.length;S++)k.push(t.field,v[S]);else k.push(t.field,v)}else{v=Object.keys(t);for(let e,i,n=0;n<v.length;n++)if(e=v[n],i=t[e],i.constructor===Array)for(S=0;S<i.length;S++)k.push(e,i[S]);else k.push(e,i)}if(y=k,!t){if(r=[],k.length)for(y=0;y<k.length;y+=2){if(this.db){if(!(n=this.index.get(k[y])))continue;r.push(n=n.db.tag(k[y+1],e,x,b))}else n=ht.call(this,k[y],k[y+1],e,x,b);s.push(w?{field:k[y],tag:k[y+1],result:n}:[n])}if(r.length){const t=this;return Promise.all(r).then(function(e){for(let t=0;t<e.length;t++)w?s[t].result=e[t]:s[t]=e[t];return w?s:new et(s.length>1?nt(s,1,0,0,u,f):s[0],t)})}return w?s:new et(s.length>1?nt(s,1,0,0,u,f):s[0],this)}}w||h||!(g=g||this.field)||(l(g)?h=g:(g.constructor===Array&&1===g.length&&(g=g[0]),h=g.field||g.index)),g&&g.constructor!==Array&&(g=[g])}g||(g=this.field),k=(this.worker||this.db)&&!n&&[];for(let h,c,a,f=0;f<g.length;f++){if(c=g[f],this.db&&this.tag&&!this.B[f])continue;let A;if(l(c)||(A=c,c=A.field,t=A.query||t,e=o(A.limit,e),x=o(A.offset,x),u=o(A.suggest,u),p=w&&this.store&&o(A.highlight,p),b=!!p||w&&this.store&&o(A.enrich,b),d=o(A.cache,d)),n)h=n[f];else{S=(v=A||i||{}).enrich;var j=this.index.get(c);if(y&&(this.db&&(v.tag=y,v.field=g,m=j.db.support_tag_search),!m&&S&&(v.enrich=!1),m||(v.limit=0,v.offset=0)),h=d?j.searchCache(t,y&&!m?0:e,v):j.search(t,y&&!m?0:e,v),y&&!m&&(v.limit=e,v.offset=x),S&&(v.enrich=S),k){k[f]=h;continue}}if(a=(h=h.result||h)&&h.length,y&&a){if(v=[],S=0,this.db&&n){if(!m)for(j=g.length;j<n.length;j++){let t=n[j];if(t&&t.length)S++,v.push(t);else if(!u)return w?s:new et(s,this)}}else for(let t,e,i=0;i<y.length;i+=2){if(t=this.tag.get(y[i]),!t){if(u)continue;return w?s:new et(s,this)}if(e=(t=t&&t.get(y[i+1]))&&t.length)S++,v.push(t);else if(!u)return w?s:new et(s,this)}if(S){if(h=rt(h,v,e,x,w),a=h.length,!a&&!u)return w?h:new et(h,this);S--}}if(a)r[_]=c,s.push(h),_++;else if(1===g.length)return w?s:new et(s,this)}if(k){if(this.db&&y&&y.length&&!m)for(b=0;b<y.length;b+=2){if(!(r=this.index.get(y[b]))){if(u)continue;return w?s:new et(s,this)}k.push(r.db.tag(y[b+1],e,x,!1))}const n=this;return Promise.all(k).then(function(s){return i&&(i.resolve=w),s.length&&(s=n.search(t,e,i,s)),s})}if(!_)return w?s:new et(s,this);if(h&&(!b||!this.store))return s=s[0],w?s:new et(s,this);for(k=[],x=0;x<r.length;x++){if(y=s[x],b&&y.length&&void 0===y[0].doc&&(this.db?k.push(y=this.index.get(this.field[0]).db.enrich(y)):y=lt.call(this,y)),h)return w?p?tt(t,y,this.index,h,p):y:new et(y,this);s[x]={field:r[x],result:y}}if(b&&this.db&&k.length){const e=this;return Promise.all(k).then(function(i){for(let t=0;t<i.length;t++)s[t].result=i[t];return p&&(s=tt(t,s,e.index,h,p)),a?ot(s):s})}return p&&(s=tt(t,s,this.index,h,p)),a?ot(s):s},(s=ct.prototype).mount=function(t){let e=this.field;if(this.tag)for(let t,n=0;n<this.F.length;n++){t=this.F[n];var i=void 0;this.index.set(t,i=new Et({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(t),i.tag=this.tag.get(t)}i=[];const n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let s,r,o=0;o<e.length;o++){n.field=r=e[o],s=this.index.get(r);const h=new t.constructor(t.id,n);h.id=t.id,i[o]=h.mount(s),s.document=!0,o?s.bypass=!0:s.store=this.store}const s=this;return this.db=Promise.all(i).then(function(){s.db=!0})},s.commit=async function(){const t=[];for(const e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()},s.destroy=function(){const t=[];for(const e of this.index.values())t.push(e.destroy());return Promise.all(t)},s.append=function(t,e){return this.add(t,e,!0)},s.update=function(t,e){return this.remove(t).add(t,e)},s.remove=function(t){for(var e of(c(t)&&(t=a(t,this.key)),this.index.values()))e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let i of this.tag.values())for(let n of i){e=n[0];const s=n[1],r=s.indexOf(t);r>-1&&(s.length>1?s.splice(r,1):i.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this},s.clear=function(){const t=[];for(const e of this.index.values()){const i=e.clear();i.then&&t.push(i)}if(this.tag)for(const t of this.tag.values())t.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this},s.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)},s.cleanup=function(){for(const t of this.index.values())t.cleanup();return this},s.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(t){return t[0]&&t[0].doc||null}):this.store.get(t)||null},s.set=function(t,e){return"object"==typeof t&&(t=a(e=t,this.key)),this.store.set(t,e),this},s.searchCache=w,s.export=function(t,e,i=0,n=0){if(i<this.field.length){const s=this.field[i];if((e=this.index.get(s).export(t,s,i,n=1))&&e.then){const n=this;return e.then(function(){return n.export(t,s,i+1)})}return this.export(t,s,i+1)}let s,r;switch(n){case 0:s="reg",r=mt(this.reg),e=null;break;case 1:s="tag",r=this.tag&>(this.tag,this.reg.size),e=null;break;case 2:s="doc",r=this.store&&ft(this.store),e=null;break;default:return}return wt.call(this,t,e,s,r||null,i,n)},s.import=function(t,e){var i=t.split(".");"json"===i[i.length-1]&&i.pop();const n=i.length>2?i[0]:"";if(i=i.length>2?i[2]:i[1],this.worker&&n)return this.index.get(n).import(t);if(e){if("string"==typeof e&&(e=JSON.parse(e)),n)return this.index.get(n).import(i,e);switch(i){case"reg":this.fastupdate=!1,this.reg=_t(e,this.reg);for(let t,e=0;e<this.field.length;e++)t=this.index.get(this.field[e]),t.fastupdate=!1,t.reg=this.reg;if(this.worker){e=[];for(const i of this.index.values())e.push(i.import(t));return Promise.all(e)}break;case"tag":this.tag=pt(e,this.tag);break;case"doc":this.store=dt(e,this.store)}}},R(ct.prototype),Et.prototype.remove=function(t,e){const i=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(i){if(this.fastupdate){for(let e,n,s=0;s<i.length;s++)if((e=i[s])&&(n=e.length))if(e[n-1]===t)e.pop();else{const i=e.indexOf(t);i>=0&&e.splice(i,1)}}else bt(this.map,t),this.depth&&bt(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&zt(this)),this.cache&&this.cache.remove(t),this};const xt={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};function kt(t,e,i,n,s,r,o){let l,c;if(!(l=e[i])||o&&!l[o]){if(o?((e=l||(e[i]=h()))[o]=1,c=t.ctx,(l=c.get(o))?c=l:c.set(o,c=t.keystore?new z(t.keystore):new Map)):(c=t.map,e[i]=1),(l=c.get(i))?c=l:c.set(i,c=l=[]),r)for(let i,r=0;r<l.length;r++)if((i=l[r])&&i.includes(s)){if(r<=n)return;i.splice(i.indexOf(s),1),t.fastupdate&&(e=t.reg.get(s))&&e.splice(e.indexOf(i),1);break}if(c=c[n]||(c[n]=[]),c.push(s),c.length===2**31-1){if(e=new E(c),t.fastupdate)for(let i of t.reg.values())i.includes(c)&&(i[i.indexOf(c)]=e);l[n]=c=e}t.fastupdate&&((n=t.reg.get(s))?n.push(c):t.reg.set(s,[c]))}}function vt(t,e,i,n,s){return i&&t>1?e+(n||0)<=t?i+(s||0):(t-1)/(e+(n||0))*(i+(s||0))+1|0:0}function St(t,e,i,n,s,r,o){let h=t.length,l=t;if(h>1)l=nt(t,e,i,n,s,r,o);else if(1===h)return o?K.call(null,t[0],i,n):new et(t[0],this);return o?l:new et(l,this)}function jt(t,e,i,n,s,r,o){return t=Mt(this,t,e,i,n,s,r,o),this.db?t.then(function(t){return s?t||[]:new et(t,this)}):t&&t.length?s?K.call(this,t,i,n):new et(t,this):s?[]:new et([],this)}function At(t,e,i,n){let s=[];if(t&&t.length){if(t.length<=n)return void e.push(t);for(let e,i=0;i<n;i++)(e=t[i])&&(s[i]=e);if(s.length)return void e.push(s)}if(!i)return s}function Mt(t,e,i,n,s,r,o,h){let l;return i&&(l=t.bidirectional&&e>i)&&(l=i,i=e,e=l),t.db?t.db.get(e,i,n,s,r,o,h):t=i?(t=t.ctx.get(i))&&t.get(e):t.map.get(e)}function Et(t,e){if(!this||this.constructor!==Et)return new Et(t);if(t){var i=l(t)?t:t.preset;i&&(t=Object.assign({},xt[i],t))}else t={};const n=!0===(i=t.context)?{depth:1}:i||{},s=l(t.encoder)?A[t.encoder]:t.encode||t.encoder||{};this.encoder=s.encode?s:"object"==typeof s?new m(s):{encode:s},this.resolution=t.resolution||9,this.tokenize=i=(i=t.tokenize)&&"default"!==i&&"exact"!==i&&i||"strict",this.depth="strict"===i&&n.depth||0,this.bidirectional=!1!==n.bidirectional,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(i=t.keystore||0)&&(this.keystore=i),this.map=i?new z(i):new Map,this.ctx=i?new z(i):new Map,this.reg=e||(this.fastupdate?i?new z(i):new Map:i?new C(i):new Set),this.N=n.resolution||3,this.rtl=s.rtl||t.rtl||!1,this.cache=(i=t.cache||null)&&new y(i),this.resolve=!1!==t.resolve,(i=t.db)&&(this.db=this.mount(i)),this.M=!1!==t.commit,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}function zt(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}Et.prototype.add=function(t,e,i,n){if(e&&(t||0===t)){if(!n&&!i&&this.reg.has(t))return this.update(t,e);n=this.depth;const a=(e=this.encoder.encode(e,!n)).length;if(a){const u=h(),f=h(),d=this.resolution;for(let h=0;h<a;h++){let g=e[this.rtl?a-1-h:h];var s=g.length;if(s&&(n||!f[g])){var r=this.score?this.score(e,g,h,null,0):vt(d,a,h),o="";switch(this.tokenize){case"tolerant":if(kt(this,f,g,r,t,i),s>2){for(let e,n,h,l,c=1;c<s-1;c++)e=g.charAt(c),n=g.charAt(c+1),h=g.substring(0,c)+n,l=g.substring(c+2),kt(this,f,o=h+e+l,r,t,i),kt(this,f,o=h+l,r,t,i);kt(this,f,g.substring(0,g.length-1),r,t,i)}break;case"full":if(s>2){for(let n,c=0;c<s;c++)for(r=s;r>c;r--){o=g.substring(c,r),n=this.rtl?s-1-c:c;var l=this.score?this.score(e,g,h,o,n):vt(d,a,h,s,n);kt(this,f,o,l,t,i)}break}case"bidirectional":case"reverse":if(s>1){for(l=s-1;l>0;l--){o=g[this.rtl?s-1-l:l]+o;var c=this.score?this.score(e,g,h,o,l):vt(d,a,h,s,l);kt(this,f,o,c,t,i)}o=""}case"forward":if(s>1){for(l=0;l<s;l++)kt(this,f,o+=g[this.rtl?s-1-l:l],r,t,i);break}default:if(kt(this,f,g,r,t,i),n&&a>1&&h<a-1)for(s=this.N,o=g,r=Math.min(n+1,this.rtl?h+1:a-h),l=1;l<r;l++){g=e[this.rtl?a-1-h-l:h+l];kt(this,u,(c=this.bidirectional&&g>o)?o:g,this.score?this.score(e,o,h,g,l-1):vt(s+(a/2>s?0:1),a,h,r-1,l-1),t,i,c?g:o)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(i?{ins:t}:{del:t}),this.M&&zt(this)),this},Et.prototype.search=function(t,e,i){if(i||(e||"object"!=typeof t?"object"==typeof e&&(i=e,e=0):(i=t,t="")),i&&i.cache)return i.cache=!1,t=this.searchCache(t,e,i),i.cache=!0,t;let n,s,r,o,l,c,a,u,f=[],d=0;i&&(t=i.query||t,e=i.limit||e,d=i.offset||0,s=i.context,r=i.suggest,u=(o=i.resolve)&&i.enrich,c=i.boost,a=i.resolution,l=this.db&&i.tag),void 0===o&&(o=this.resolve),s=this.depth&&!1!==s;let g=this.encoder.encode(t,!s);if(n=g.length,e=e||(o?100:0),1===n)return jt.call(this,g[0],"",e,d,o,u,l);if(2===n&&s&&!r)return jt.call(this,g[1],g[0],e,d,o,u,l);let p,m=h(),_=0;if(s&&(p=g[0],_=1),a||0===a||(a=p?this.N:this.resolution),this.db){if(this.db.search&&!1!==(i=this.db.search(this,g,e,d,r,o,u,l)))return i;const t=this;return async function(){for(let e,i;_<n;_++){if((i=g[_])&&!m[i]){if(m[i]=1,e=await Mt(t,i,p,0,0,!1,!1),e=At(e,f,r,a)){f=e;break}p&&(r&&e&&f.length||(p=i))}r&&p&&_===n-1&&!f.length&&(a=t.resolution,p="",_=-1,m=h())}return St(f,a,e,d,r,c,o)}()}for(let t,e;_<n;_++){if((e=g[_])&&!m[e]){if(m[e]=1,t=Mt(this,e,p,0,0,!1,!1),t=At(t,f,r,a)){f=t;break}p&&(r&&t&&f.length||(p=e))}r&&p&&_===n-1&&!f.length&&(a=this.resolution,p="",_=-1,m=h())}return St(f,a,e,d,r,c,o)},(s=Et.prototype).mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)},s.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},s.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()},s.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},s.append=function(t,e){return this.add(t,e,!0)},s.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)},s.update=function(t,e){const i=this,n=this.remove(t);return n&&n.then?n.then(()=>i.add(t,e)):this.add(t,e)},s.cleanup=function(){return this.fastupdate?(bt(this.map),this.depth&&bt(this.ctx),this):this},s.searchCache=w,s.export=function(t,e,i=0,n=0){let s,r;switch(n){case 0:s="reg",r=mt(this.reg);break;case 1:s="cfg",r=null;break;case 2:s="map",r=ft(this.map,this.reg.size);break;case 3:s="ctx",r=gt(this.ctx,this.reg.size);break;default:return}return wt.call(this,t,e,s,r,i,n)},s.import=function(t,e){if(e)switch("string"==typeof e&&(e=JSON.parse(e)),t=t.split("."),"json"===t[t.length-1]&&t.pop(),3===t.length&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=_t(e,this.reg);break;case"map":this.map=dt(e,this.map);break;case"ctx":this.ctx=pt(e,this.ctx)}},s.serialize=function(t=!0){let e="",i="",n="";if(this.reg.size){let t;for(var s of this.reg.keys())t||(t=typeof s),e+=(e?",":"")+("string"===t?'"'+s+'"':s);e="index.reg=new Set(["+e+"]);",i=yt(this.map,t),i="index.map=new Map(["+i+"]);";for(const e of this.ctx.entries()){s=e[0];let i=yt(e[1],t);i="new Map(["+i+"])",i='["'+s+'",'+i+"]",n+=(n?",":"")+i}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+i+n+"}":e+i+n},R(Et.prototype);const Ct="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ft=["map","ctx","tag","reg","cfg"],It=h();function Ot(t,e={}){if(!this||this.constructor!==Ot)return new Ot(t,e);"object"==typeof t&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Bt(t,e,i){const n=t.value;let s,r=0;for(let t,o=0;o<n.length;o++){if(t=i?n:n[o]){for(let i,r,h=0;h<e.length;h++)if(r=e[h],i=t.indexOf(r),i>=0){if(s=1,!(t.length>1)){n[o]=[];break}t.splice(i,1)}r+=t.length}if(i)break}r?s&&t.update(n):t.delete(),t.continue()}function Dt(t,e){return new Promise((i,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,i(this.result)},t.onerror=t.onblocked=n,t=null})}(s=Ot.prototype).mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())},s.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),It[t.id]||(It[t.id]=[]),It[t.id].push(t.field);const e=Ct.open(t.id,1);return e.onupgradeneeded=function(){const e=t.db=this.result;for(let i,n=0;n<Ft.length;n++){i=Ft[n];for(let n,s=0;s<It[t.id].length;s++)n=It[t.id][s],e.objectStoreNames.contains(i+("reg"!==i&&n?":"+n:""))||e.createObjectStore(i+("reg"!==i&&n?":"+n:""))}},t.db=Dt(e,function(e){t.db=e,t.db.onversionchange=function(){t.close()}})},s.close=function(){this.db&&this.db.close(),this.db=null},s.destroy=function(){return Dt(Ct.deleteDatabase(this.id))},s.clear=function(){const t=[];for(let e,i=0;i<Ft.length;i++){e=Ft[i];for(let i,n=0;n<It[this.id].length;n++)i=It[this.id][n],t.push(e+("reg"!==e&&i?":"+i:""))}const e=this.db.transaction(t,"readwrite");for(let i=0;i<t.length;i++)e.objectStore(t[i]).clear();return Dt(e)},s.get=function(t,e,i=0,n=0,s=!0,r=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);const o=this;return Dt(t).then(function(t){let e=[];if(!t||!t.length)return e;if(s){if(!i&&!n&&1===t.length)return t[0];for(let s,r=0;r<t.length;r++)if((s=t[r])&&s.length){if(n>=s.length){n-=s.length;continue}const t=i?n+Math.min(s.length-n,i):s.length;for(let i=n;i<t;i++)e.push(s[i]);if(n=0,e.length===i)break}return r?o.enrich(e):e}return t})},s.tag=function(t,e=0,i=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);const s=this;return Dt(t).then(function(t){return!t||!t.length||i>=t.length?[]:e||i?(t=t.slice(i,i+e),n?s.enrich(t):t):t})},s.enrich=function(t){"object"!=typeof t&&(t=[t]);const e=this.db.transaction("reg","readonly").objectStore("reg"),i=[];for(let n=0;n<t.length;n++)i[n]=Dt(e.get(t[n]));return Promise.all(i).then(function(e){for(let i=0;i<e.length;i++)e[i]={id:t[i],doc:e[i]?JSON.parse(e[i]):null};return e})},s.has=function(t){return Dt(t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t)).then(function(t){return!!t})},s.search=null,s.info=function(){},s.transaction=function(t,e,i){t+="reg"!==t&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return i.call(this,n);let s=this.db.transaction(t,e);this.h[t+":"+e]=n=s.objectStore(t);const r=i.call(this,n);return this.h[t+":"+e]=null,Dt(s).finally(function(){return r})},s.commit=async function(t){let e=t.commit_task,i=[];t.commit_task=[];for(let t,n=0;n<e.length;n++)t=e[n],t.del&&i.push(t.del);i.length&&await this.remove(i),t.reg.size&&(await this.transaction("map","readwrite",function(e){for(const i of t.map){const t=i[0],n=i[1];n.length&&(e.get(t).onsuccess=function(){let i=this.result;var s;if(i&&i.length){const t=Math.max(i.length,n.length);for(let e,r,o=0;o<t;o++)if((r=n[o])&&r.length){if((e=i[o])&&e.length)for(s=0;s<r.length;s++)e.push(r[s]);else i[o]=r;s=1}}else i=n,s=1;s&&e.put(i,t)})}}),await this.transaction("ctx","readwrite",function(e){for(const i of t.ctx){const t=i[0],n=i[1];for(const i of n){const n=i[0],s=i[1];s.length&&(e.get(t+":"+n).onsuccess=function(){let i=this.result;var r;if(i&&i.length){const t=Math.max(i.length,s.length);for(let e,n,o=0;o<t;o++)if((n=s[o])&&n.length){if((e=i[o])&&e.length)for(r=0;r<n.length;r++)e.push(n[r]);else i[o]=n;r=1}}else i=s,r=1;r&&e.put(i,t+":"+n)})}}}),t.store?await this.transaction("reg","readwrite",function(e){for(const i of t.store){const t=i[0],n=i[1];e.put("object"==typeof n?JSON.stringify(n):1,t)}}):t.bypass||await this.transaction("reg","readwrite",function(e){for(const i of t.reg.keys())e.put(1,i)}),t.tag&&await this.transaction("tag","readwrite",function(e){for(const i of t.tag){const t=i[0],n=i[1];n.length&&(e.get(t).onsuccess=function(){let i=this.result;i=i&&i.length?i.concat(n):n,e.put(i,t)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())},s.remove=function(t){return"object"!=typeof t&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){const e=this.result;e&&Bt(e,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){const e=this.result;e&&Bt(e,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){const e=this.result;e&&Bt(e,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let i=0;i<t.length;i++)e.delete(t[i])})])};const qt={Index:Et,Charset:A,Encoder:m,Document:ct,Worker:U,Resolver:et,IndexedDB:Ot,Language:{}},Lt=void 0!==n?n:"undefined"!=typeof global?global:n;let Tt;(Tt=Lt.define)&&Tt.amd?Tt([],function(){return qt}):"object"==typeof Lt.exports?Lt.exports=qt:Lt.FlexSearch=qt}(this||self)},880(t,e,i){let n,s={};s.__wbindgen_placeholder__=t.exports;const{TextDecoder:r,TextEncoder:o}=i(23);let h=null;function l(){return null!==h&&0!==h.byteLength||(h=new Uint8Array(n.memory.buffer)),h}let c=new r("utf-8",{ignoreBOM:!0,fatal:!0});function a(t,e){return function(t,e){return c.decode(l().subarray(t,t+e))}(t>>>=0,e)}function u(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return`${t}`;if("string"==e)return`"${t}"`;if("symbol"==e){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==e){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const e=t.length;let i="[";e>0&&(i+=u(t[0]));for(let n=1;n<e;n++)i+=", "+u(t[n]);return i+="]",i}const i=/\[object ([^\]]+)\]/.exec(toString.call(t));let n;if(!(i&&i.length>1))return toString.call(t);if(n=i[1],"Object"==n)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:n}c.decode();let f=0;const d=new o("utf-8"),g="function"==typeof d.encodeInto?function(t,e){return d.encodeInto(t,e)}:function(t,e){const i=d.encode(t);return e.set(i),{read:t.length,written:i.length}};function p(t,e,i){if(void 0===i){const i=d.encode(t),n=e(i.length,1)>>>0;return l().subarray(n,n+i.length).set(i),f=i.length,n}let n=t.length,s=e(n,1)>>>0;const r=l();let o=0;for(;o<n;o++){const e=t.charCodeAt(o);if(e>127)break;r[s+o]=e}if(o!==n){0!==o&&(t=t.slice(o)),s=i(s,n,n=o+3*t.length,1)>>>0;const e=l().subarray(s+o,s+n);o+=g(t,e).written,s=i(s,n,o,1)>>>0}return f=o,s}let m=null;function _(){return(null===m||!0===m.buffer.detached||void 0===m.buffer.detached&&m.buffer!==n.memory.buffer)&&(m=new DataView(n.memory.buffer)),m}function w(t){return null==t}function y(t,e){t>>>=0;const i=_(),s=[];for(let r=t;r<t+4*e;r+=4)s.push(n.__wbindgen_export_2.get(i.getUint32(r,!0)));return n.__externref_drop_slice(t,e),s}function b(t){const e=n.__wbindgen_export_2.get(t);return n.__externref_table_dealloc(t),e}t.exports.cut=function(t,e){const i=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),s=f,r=n.cut(i,s,w(e)?16777215:e?1:0);var o=y(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),o},t.exports.cut_all=function(t){const e=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),i=f,s=n.cut_all(e,i);var r=y(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),r},t.exports.cut_for_search=function(t,e){const i=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),s=f,r=n.cut_for_search(i,s,w(e)?16777215:e?1:0);var o=y(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),o},t.exports.tokenize=function(t,e,i){const s=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),r=f,o=p(e,n.__wbindgen_malloc,n.__wbindgen_realloc),h=f,l=n.tokenize(s,r,o,h,w(i)?16777215:i?1:0);if(l[3])throw b(l[2]);var c=y(l[0],l[1]).slice();return n.__wbindgen_free(l[0],4*l[1],4),c},t.exports.add_word=function(t,e,i){const s=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),r=f;var o=w(i)?0:p(i,n.__wbindgen_malloc,n.__wbindgen_realloc),h=f;return n.add_word(s,r,w(e)?4294967297:e>>>0,o,h)>>>0},t.exports.tag=function(t,e){const i=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),s=f,r=n.tag(i,s,w(e)?16777215:e?1:0);var o=y(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),o},t.exports.with_dict=function(t){const e=p(t,n.__wbindgen_malloc,n.__wbindgen_realloc),i=f,s=n.with_dict(e,i);if(s[1])throw b(s[0])},t.exports.__wbg_Error_0497d5bdba9362e5=function(t,e){return Error(a(t,e))},t.exports.__wbg_new_07b483f72211fd66=function(){return new Object},t.exports.__wbg_set_3f1d0b984ed272ed=function(t,e,i){t[e]=i},t.exports.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},t.exports.__wbindgen_debug_string=function(t,e){const i=p(u(e),n.__wbindgen_malloc,n.__wbindgen_realloc),s=f;_().setInt32(t+4,s,!0),_().setInt32(t+0,i,!0)},t.exports.__wbindgen_init_externref_table=function(){const t=n.__wbindgen_export_2,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},t.exports.__wbindgen_number_new=function(t){return t},t.exports.__wbindgen_string_new=function(t,e){return a(t,e)},t.exports.__wbindgen_throw=function(t,e){throw new Error(a(t,e))};const x=i(928).join(__dirname,"jieba_rs_wasm_bg.wasm"),k=i(896).readFileSync(x),v=new WebAssembly.Module(k),S=new WebAssembly.Instance(v,s);n=S.exports,t.exports.__wasm=n,n.__wbindgen_start()},642(t){"use strict";t.exports=require("better-sqlite3/build/Release/better_sqlite3.node")},896(t){"use strict";t.exports=require("fs")},928(t){"use strict";t.exports=require("path")},23(t){"use strict";t.exports=require("util")},167(t){"use strict";t.exports=require("worker_threads")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={id:t,loaded:!1,exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var __webpack_exports__={};(()=>{"use strict";const t=__webpack_require__(285),e=__webpack_require__(54);(0,t.file_search_start)(),(0,e.start_ai_agent_agent)()})()})();
|
|
2
|
+
(()=>{var __webpack_modules__={3054(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.start_ai_agent_agent=function(){(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_init,async t=>{const{index_storage_type:e,db_path:i}=t.data;if(E=e,"memory"===e){if(b)return;b=new o.default.Index({tokenize:"strict"}),v=new o.default.Index({tokenize:"strict"})}if("sqlite"===e){if(S)return;S=new u(i,{nativeBinding:h}),S.exec("\n CREATE VIRTUAL TABLE IF NOT EXISTS docs USING fts5(\n file_path UNINDEXED,\n content,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n \n CREATE VIRTUAL TABLE IF NOT EXISTS doc_names USING fts5(\n file_path UNINDEXED,\n name,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n "),_=S.prepare("\n SELECT mtime FROM docs WHERE file_path = ? LIMIT 1\n "),w=S.prepare("\n SELECT mtime FROM doc_names WHERE file_path = ? LIMIT 1\n "),f=S.prepare("INSERT INTO docs (file_path, content, mtime) VALUES (?, ?, ?)"),d=S.prepare("INSERT INTO doc_names (file_path, name, mtime) VALUES (?, ?, ?)"),p=S.prepare("DELETE FROM docs WHERE file_path = ?"),m=S.prepare("DELETE FROM doc_names WHERE file_path = ?"),g=S.prepare("\n SELECT file_path\n FROM docs\n WHERE docs MATCH ?\n ORDER BY bm25(docs)\n LIMIT 50\n "),y=S.prepare("\n SELECT file_path\n FROM doc_names\n WHERE doc_names MATCH ?\n ORDER BY bm25(doc_names)\n LIMIT 50\n ")}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_add,async t=>{let e,i,{use_zh_segmentation:n,file_path:r,mtime:s}=t.data;if("sqlite"===E&&S){s=s??(await l.FileUtil.statSync(r)).mtime;const t=_.get(r);if(t&&t.mtime===s)return{char_num:0};e=`${r} ${(await l.FileUtil.readFileSync(r)).toString()}。`,i=e.length;let o=e,c=r;n&&(o=(0,a.cut)(e,!0).join(" "),c=(0,a.cut)(r,!0).join(" ")),p.run(r),m.run(r),f.run(r,o,s),d.run(r,c,s)}if("memory"===E){e=`${r} ${(await l.FileUtil.readFileSync(r)).toString()}。`,i=e.length;let t=e.toLowerCase(),s=r.toLowerCase();n&&(t=(0,a.cut)(e,!0).join(" ").toLowerCase(),s=(0,a.cut)(r,!0).join(" ").toLowerCase()),b?.add(r,t),v?.add(r,s)}return{char_num:i}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_del,async t=>{const{file_path:e}=t.data;"memory"===E&&(b?.remove(e),v?.remove(e)),"sqlite"===E&&S&&(p.run(e),m.run(e))}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_search,async t=>{const{key:e,use_zh_segmentation:i}=t.data;let n=e;if(i){n=(0,a.cut)(e,!0).map(t=>t+"*").join(" OR ")}if("memory"===E){const t={suggest:!0,resolution:9,context:!0,limit:50};return{ids:b?.search(n,t)||[],names_ids:v?.search(n,t)||[]}}if("sqlite"===E&&S){const t=(0,a.cut)(n,!0).filter(t=>""!==t.trim()).map(t=>t+"*").join(" OR "),e=g.all(t),i=y.all(t);return{ids:e.map(t=>t.file_path),names_ids:i.map(t=>t.file_path)}}return{ids:[],names_ids:[]}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_close,async()=>{"memory"===E&&(b?.clear(),v?.clear(),b=null,v=null),"sqlite"===E&&S&&(S.close(),S=null)})};const r=i(324),s=i(7525),o=n(i(5474)),a=i(2880),c=i(3917),l=i(1776),h=(0,c.get_bin_dependency)("sqlite3"),u=(0,c.get_bin_dependency)("better-sqlite3");let f,d,p,m,g,y,_,w,b=null,v=null,S=null,E="memory"},3917(__unused_webpack_module,exports,__webpack_require__){"use strict";var __webpack_unused_export__;function get_bin_dependency(module,auto_throw=!1){try{return"sqlite3"===module?__webpack_require__(9642):eval("require")(module)}catch(t){if(console.log(`npm 模块没有加载失败,请手动安装 npm 依赖( -g 安装的就尝试全局安装,本地仓库安装的就在仓库内安装):${module} error ${t.message}`),auto_throw)throw t}return{}}__webpack_unused_export__={value:!0},exports.get_bin_dependency=get_bin_dependency},1776(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.FileUtil=void 0;const r=n(i(9896)),s=n(i(6928));e.FileUtil=class{static async statSync(t){return r.default.promises.stat(t)}static async readdirSync(t){return r.default.promises.readdir(t)}static async readFileSync(t){return r.default.promises.readFile(t)}static async open(t,e,i){return r.default.promises.open(t,e,i)}static async access(t){try{return await r.default.promises.access(t,r.default.constants.F_OK),!0}catch{return!1}}static async access_all(t){let e=0;for(const i of t)try{await r.default.promises.access(i,r.default.constants.F_OK),e++}catch{}return e===t.length}static async appendFileSync(t,e,i){return r.default.promises.appendFile(t,e,i)}static async writeFileSync(t,e,i){return r.default.promises.writeFile(t,e,i)}static async writeFileSyncWithUtf8bom(t,e){return e.startsWith("\ufeff")||(e="\ufeff"+e),r.default.promises.writeFile(t,e,{encoding:"utf8"})}static async truncateSync(t){return r.default.promises.truncate(t)}static async unlinkSync(t){return r.default.promises.unlink(t)}static async mkdirSync(t,e){return r.default.promises.mkdir(t,e)}static async renameSync(t,e){return r.default.promises.rename(t,e)}static async getUniqueFileName(t){const e=s.default.dirname(t),i=s.default.extname(t),n=s.default.basename(t,i);let r=t,o=1;for(;await this.access(r);)r=s.default.join(e,`${n}(${o})${i}`),o++;return r}static async get_exe_path_by_env_dir(t,e){if(!await this.access(t))return null;if(!(await this.statSync(t)).isDirectory())return null;const i=await this.readdirSync(t);for(const n of i)if(n.startsWith(e))return s.default.join(t,`${n}`);return null}static async ensure_dir(t){await r.default.promises.mkdir(t,{recursive:!0})}static async copy(t,e,i=[]){if((await r.default.promises.stat(t)).isFile()){if(await this.ensure_dir(s.default.dirname(e)),i.includes(s.default.basename(t)))return;return void await r.default.promises.copyFile(t,e)}await this.ensure_dir(e);const n=await r.default.promises.readdir(t,{withFileTypes:!0});for(const o of n){const n=s.default.join(t,o.name),a=s.default.join(e,o.name);i.includes(o.name)||(o.isDirectory()?await this.copy(n,a,i):o.isFile()&&await r.default.promises.copyFile(n,a))}}static async remove_dir(t){if(!await this.access(t))return;if((await r.default.promises.stat(t)).isFile())return void await r.default.promises.unlink(t);const e=await r.default.promises.readdir(t);for(const i of e){const e=s.default.join(t,i);(await r.default.promises.stat(e)).isDirectory()?await this.remove_dir(e):await r.default.promises.unlink(e)}await r.default.promises.rmdir(t)}static async find_max_numbered_version_file(t){const e=s.default.dirname(t),i=s.default.basename(t);if(!await this.access(e))return null;const n=await r.default.promises.readdir(e);let o=-1,a=null;const c=s.default.join(e,i);await this.access(c)&&(a=c,o=0);for(const t of n){if(!t.startsWith(i))continue;const n=t.slice(i.length);if(0===n.length)continue;let r=0,c=!1;for(const t of n){if(!(t>="0"&&t<="9")){c=!1;break}r=10*r+(t.charCodeAt(0)-48),c=!0}c&&(r>o&&(o=r,a=s.default.join(e,t)))}return a}static async get_next_numbered_name(t){const e=s.default.dirname(t),i=s.default.basename(t);if(!await this.access(e))return t;const n=await r.default.promises.readdir(e);let o=0;const a=s.default.join(e,i);if(!await this.access(a))return a;for(const t of n){if(!t.startsWith(i))continue;const e=t.slice(i.length);if(!e)continue;let n=0,r=!1;for(const t of e){if(!(t>="0"&&t<="9")){r=!1;break}n=10*n+(t.charCodeAt(0)-48),r=!0}r&&(n>o&&(o=n))}return s.default.join(e,`${i}${o+1}`)}}},3285(t,e,i){"use strict";e.file_search_start=function(){(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search,async t=>{const{start:e,end:i,file_path:l,query_text_buffer:h,ram_id:u}=t.data;let f=0,d=Buffer.alloc(0);const p=s.openSync(l,"r");let m=0;for(;f<i&&!c[u];){const t=Buffer.alloc(2097152);let e=s.readSync(p,t,0,t.length,f);if(0===e)break;f+=e,d=Buffer.concat([d,t.subarray(0,e)]),(0,n.threads_send)({type:r.threads_msg_type.search_file_progress,data:{progress:(100*f/i).toFixed(0),ram_id:u}});const c=[];if(a(d,h,c),c.length>0){for(let t=0;t<c.length;t++)c[t]+=m;(0,n.threads_send)({type:r.threads_msg_type.search_file_index,data:{find_index:c,ram_id:u}})}m+=d.length-h.length,d=o(d,d.length-h.length,d.length)}return(0,n.threads_send)({type:r.threads_msg_type.search_file_end,data:{ram_id:u}}),s.closeSync(p),"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_close,async t=>{const{ram_id:e}=t.data;return c[e]=!0,"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_start,async t=>{const{ram_id:e}=t.data;return delete c[e],"ok"})};const n=i(324),r=i(7525),s=i(9896);function o(t,e,i){const n=i-e,r=Buffer.alloc(n);return t.copy(r,0,e,i),r}function a(t,e,i){const n=function(t){const e={},i=t.length;for(let n=0;n<i;n++)e[t[n]]=n;return e}(e),r=t.length,s=e.length,o=r-s;let a=0;for(;a<=o;){let o=s-1;for(;o>=0&&t[a+o]===e[o];)o--;if(o<0)i.push(a),a+=a+s<r?s-n[t[a+s]]||s:1;else{const e=n[t[a+o]],i=void 0!==e?o-e:o+1;a+=Math.max(i,1)}}}const c={}},1532(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncQueue=void 0,e.normalizeSyncRelativePath=s,e.safeResolveSyncPath=function(t,e){const i=r.default.resolve(t),n=r.default.resolve(i,e??""),s=i.endsWith(r.default.sep)?i:`${i}${r.default.sep}`;if(n!==i&&!n.startsWith(s))throw new Error(`Invalid sync path: ${e}`);return n},e.buildSyncEnvelope=function(t,e=Buffer.alloc(0)){const i=Buffer.from(JSON.stringify(t)),n=Buffer.alloc(4);return n.writeUInt32BE(i.length,0),Buffer.concat([n,i,e])},e.parseSyncEnvelope=function(t){if(t.length<4)throw new Error("Invalid sync envelope");const e=t.readUInt32BE(0),i=4+e;if(t.length<i)throw new Error("Invalid sync envelope header length");const n=JSON.parse(t.subarray(4,i).toString()),r=t.subarray(i);return{header:n,payload:r}},e.createSyncIgnoreMatcher=function(t=[]){const e=(t??[]).map(t=>s(String(t??"").trim())).filter(Boolean),i=e.filter(t=>t.includes("*")||t.includes("?")).map(t=>function(t){const e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,":::DOUBLE_STAR:::").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").replace(/:::DOUBLE_STAR:::/g,".*");return new RegExp(`^${e}$`)}(t));return(t,n=!1)=>{const r=s(t);if(!r)return!1;for(const t of e){if(!t)continue;if(t.includes("*")||t.includes("?")){if(i.some(t=>t.test(r)))return!0;continue}if(r===t)return!0;if(r.startsWith(`${t}/`))return!0;if(r.split("/").includes(t))return!0;if(n&&r===`${t}/`)return!0}return!1}},e.stringToHash32=o,e.getFilePathHash=function(t,e){return o(s(r.default.relative(t,e))||e)};const r=n(i(6928));function s(t){return(t??"").replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,"")}function o(t){let e,i=305419896;const n=Buffer.from(t,"utf-8"),r=3&n.length,s=n.length-r>>2;for(let t=0;t<s;t++){const r=t<<2;e=n[r]|n[r+1]<<8|n[r+2]<<16|n[r+3]<<24,e=Math.imul(e,3432918353),e=e<<15|e>>>17,e=Math.imul(e,461845907),i^=e,i=i<<13|i>>>19,i=Math.imul(i,5)+3864292196}e=0;const o=s<<2;switch(r){case 3:e^=n[o+2]<<16;case 2:e^=n[o+1]<<8;case 1:e^=n[o],e=Math.imul(e,3432918353),e=e<<15|e>>>17,e=Math.imul(e,461845907),i^=e}return i^=n.length,i^=i>>>16,i=Math.imul(i,2246822507),i^=i>>>13,i=Math.imul(i,3266489909),i^=i>>>16,i>>>0}e.AsyncQueue=class{concurrency;processor;next_interval;queue=[];activeCount=0;constructor(t=1,e,i=100){this.concurrency=t,this.processor=e,this.next_interval=i}push(t){this.queue.push(t),this.next()}get size(){return this.queue.length}next(){if(this.activeCount>=this.concurrency||0===this.queue.length)return;const t=this.queue.shift();t&&(this.activeCount++,this.processor(t).finally(()=>{this.activeCount--,setTimeout(this.next.bind(this),this.next_interval)}).catch(t=>{console.error("[AsyncQueue Error]",t)}),this.next())}clear(){this.queue=[],this.activeCount=0}}},746(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.workerService=e.TcpSyncWorkerService=void 0,e.tcp_file_sync_work_start=function(){(0,l.register_threads_worker_handler)(h.threads_msg_type.file_watch_init,async t=>{const{task:i,client_num_id:n,cache_path:r}=t.data;e.workerService.open_task(i,n,r).catch(console.error)}),(0,l.register_threads_worker_handler)(h.threads_msg_type.file_watch_close,async t=>{const{task_id:i}=t.data;e.workerService.stopRuntime(i)}),(0,l.register_threads_worker_handler)(h.threads_msg_type.file_watch_apply,async t=>{const{buffer:i}=t.data;e.workerService.apply_remote_event(i).catch(console.error)}),(0,l.register_threads_worker_handler)(h.threads_msg_type.file_watch_sync_task_get,async t=>e.workerService.client_sync_task_get())};const r=n(i(6928)),s=n(i(9896)),o=n(i(1605)),a=i(1532),c=i(1776),l=i(324),h=i(7525),u=i(158);class f{runtime_map=new Map;cache_timers=new Map;client_sync_task_get(){const t=[];for(const e of this.runtime_map.keys()){const i=this.runtime_map.get(e);i.task.running_num=i.queue.size,t.push(i.task)}return t}stopRuntime(t){const e=this.runtime_map.get(t);e?.watcher&&e.watcher.close(),e?.queue&&e.queue.clear(),this.runtime_map.delete(t),this.cache_timers.has(t)&&(clearTimeout(this.cache_timers.get(t)),this.cache_timers.delete(t))}clearAll(){for(const t of this.runtime_map.keys())this.stopRuntime(t)}scheduleSuppress(t,e){const i=(0,a.normalizeSyncRelativePath)(e);i&&(t.suppress_set.add(i),setTimeout(()=>{t.suppress_set.delete(i)},5e3))}isSuppressed(t,e){const i=(0,a.normalizeSyncRelativePath)(e);return!!i&&t.suppress_set.has(i)}saveCache(t,e,i){this.cache_timers.has(t)&&clearTimeout(this.cache_timers.get(t));const n=setTimeout(async()=>{try{await c.FileUtil.writeFileSync(e,JSON.stringify(i,null,2))}catch(e){console.error(`[Sync Cache] 保存同步缓存失败 -> 任务 ID: ${t}`,e)}this.cache_timers.delete(t)},1e3);this.cache_timers.set(t,n)}async applySourceEvent(t,e,i){const n=this.runtime_map.get(t.id);if(!n)return;const c=(0,a.normalizeSyncRelativePath)(e.relative_path);if(!c)return;if(n.ignore(c,e.is_directory))return;if(this.isSuppressed(n,c))return;const l=(0,a.safeResolveSyncPath)(n.local_dir,c);switch(this.scheduleSuppress(n,c),e.event){case"addDir":await o.default.ensureDir(l);break;case"unlinkDir":case"unlink":!1!==t.delete_missing&&await o.default.remove(l);break;case"add":case"change":await o.default.ensureDir(r.default.dirname(l)),await s.default.promises.writeFile(l,i)}}async processSyncTaskItem(t,e,i){const{event:n,fullPath:o}=e,c=(0,a.normalizeSyncRelativePath)(r.default.relative(t.local_dir,o));var u;if(c&&!this.isSuppressed(t,c))try{const e="addDir"===n||"unlinkDir"===n;let r,f=Date.now(),d=Buffer.alloc(0),p=[];if("add"===n||"change"===n)try{const e=await s.default.promises.stat(o);f=e.mtimeMs,r=e.size;const i=(0,a.getFilePathHash)(t.local_dir,o);if(t.cache_file_map[i]&&t.cache_file_map[i].mtime===f)return;const n=await(u=o,s.default.promises.readFile(u));d=n,n.buffer instanceof ArrayBuffer&&p.push(n.buffer)}catch(t){return}const m=(0,a.buildSyncEnvelope)({task_id:t.task.id,event:n,relative_path:c,is_directory:e,mtime:f,size:r,source_client_num_id:i,target_client_num_id:t.remote_client_id},d);if((0,l.threads_send)({type:h.threads_msg_type.file_watch_send,data:{current_client_id:i,buffer:m}},p),"add"===n||"change"===n){const e=(0,a.getFilePathHash)(t.local_dir,o);t.cache_file_map[e]={mtime:f},this.saveCache(t.task.id,t.cache_path,t.cache_file_map)}}catch(t){console.error(`[Sync Queue] 处理文件事件失败: ${o} 继续下一个`,t)}}async apply_remote_event(t){const e=Buffer.from(t),i=(0,a.parseSyncEnvelope)(e),n=this.runtime_map.get(i.header.task_id);if(!n||!n.task.open)return;const r=n.task;r.source_client_num_id!==i.header.target_client_num_id&&r.target_client_num_id!==i.header.target_client_num_id||await this.applySourceEvent(r,i.header,i.payload)}async watchLocalDir(t,e){const i=this.runtime_map.get(t.id);if(!i||i.watcher)return;await o.default.ensureDir(i.local_dir);const n=u.watch(i.local_dir,{persistent:!0,ignoreInitial:!t.full_sync,alwaysStat:!1,ignored:t=>{const e=(0,a.normalizeSyncRelativePath)(r.default.relative(i.local_dir,t));return!!e&&i.ignore(e,!1)}});i.watcher=n;const s=(t,e)=>{const n=(0,a.normalizeSyncRelativePath)(r.default.relative(i.local_dir,e));if(!n)return;const s="addDir"===t||"unlinkDir"===t;i.ignore(n,s)||this.isSuppressed(i,n)||i.queue.push({event:t,fullPath:e})};n.on("add",t=>{s("add",t)}),n.on("change",t=>{s("change",t)}),n.on("unlink",e=>{const n=(0,a.getFilePathHash)(i.local_dir,e);i.cache_file_map[n]&&(delete i.cache_file_map[n],this.saveCache(t.id,i.cache_path,i.cache_file_map)),s("unlink",e)}),n.on("addDir",t=>{s("addDir",t)}),n.on("unlinkDir",t=>{s("unlinkDir",t)}),n.on("error",t=>{console.error("sync watcher error",t)}),n.on("ready",()=>{console.log(`[Sync] 任务 ${t.id} 的初始化本地盘点遍历完成。`)})}async open_task(t,e,i){this.stopRuntime(t.id);let n={};if(await c.FileUtil.access(i))try{n=JSON.parse((await c.FileUtil.readFileSync(i)).toString())}catch(e){console.error(`[Sync Cache] 解析本地增量缓存失败,重置为空缓存: ${t.id}`,e)}else await c.FileUtil.writeFileSync(i,JSON.stringify(n));let r="",s=0;t.source_client_num_id===e?(r=t.source_dir,s=t.target_client_num_id):(r=t.target_dir,s=t.source_client_num_id);const l={},h=new a.AsyncQueue(1,async t=>{await this.processSyncTaskItem(l,t,e)}),u={task:t,ignore:(0,a.createSyncIgnoreMatcher)(t.ignore_list),suppress_set:new Set,local_dir:r,remote_client_id:s,cache_file_map:n,cache_path:i,client_num_id:e,queue:h};Object.assign(l,u),this.runtime_map.set(t.id,u),t.target_client_num_id!==e||t.two_way_sync?await this.watchLocalDir(t,e):await o.default.ensureDir(t.target_dir)}reset_tasks(t){this.clearAll()}}e.TcpSyncWorkerService=f,e.workerService=new f},7525(t,e){"use strict";var i;e.threads_msg_type=void 0,function(t){t[t.hello=1]="hello",t[t.file_search_start=2]="file_search_start",t[t.file_search=3]="file_search",t[t.file_search_close=4]="file_search_close",t[t.search_file_index=5]="search_file_index",t[t.search_file_progress=6]="search_file_progress",t[t.search_file_end=7]="search_file_end",t[t.docs_init=8]="docs_init",t[t.docs_add=9]="docs_add",t[t.docs_del=10]="docs_del",t[t.docs_close=11]="docs_close",t[t.docs_search=12]="docs_search",t[t.file_watch_init=13]="file_watch_init",t[t.file_watch_send=14]="file_watch_send",t[t.file_watch_close=15]="file_watch_close",t[t.file_watch_apply=16]="file_watch_apply",t[t.file_watch_sync_task_get=17]="file_watch_sync_task_get"}(i||(e.threads_msg_type=i={}))},324(t,e,i){"use strict";e.register_threads_worker_handler=o,e.threads_send=a;const n=i(8167),r=i(7525);console.log("[worker] 子线程启动, workerData=",n.workerData);const s=new Map;function o(t,e){s.set(t,e)}function a(t,e){try{n.parentPort?.postMessage(t,e)}catch(t){console.error("[worker] send failed:",t)}}n.parentPort?.on("message",t=>{(async function(t){try{const e=s.get(t.type);if(!e)return void a({id:t.id,type:t.type,data:`unknown type ${t.type}`});const i=await e(t);a({id:t.id,type:t.type,data:i})}catch(e){a({id:t.id,type:t.type,data:null,error:e?.message||String(e)}),console.error("[worker] task error:",e)}})(t).catch(console.error)}),o(r.threads_msg_type.hello,async t=>new Promise((e,i)=>setTimeout(()=>{if(Math.random()<.05)return i(new Error("模拟错误"));e(`done:${t.data}`)},500))),console.log("[worker] ready and waiting for messages..."),process.on("uncaughtException",t=>{console.error("子线程全局未捕获异常:",t)}),process.on("unhandledRejection",t=>{console.error("子线程未处理的 Promise 拒绝:",t)})},5266(t,e,i){"use strict";e.NodeFsHandler=e.EVENTS=e.isIBMi=e.gH=e.j9=e.aP=e.isWindows=e.EMPTY_FN=e.STR_CLOSE=e.STR_END=e.j1=void 0;const n=i(9896),r=i(1943),s=i(6928),o=i(857);e.j1="data",e.STR_END="end",e.STR_CLOSE="close";e.EMPTY_FN=()=>{};const a=process.platform;e.isWindows="win32"===a,e.aP="darwin"===a,e.j9="linux"===a,e.gH="freebsd"===a,e.isIBMi="OS400"===(0,o.type)(),e.EVENTS={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"};const c=e.EVENTS,l={lstat:r.lstat,stat:r.stat},h="listeners",u="errHandlers",f="rawEmitters",d=[h,u,f],p=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"]),m=(t,e)=>{t instanceof Set?t.forEach(e):e(t)},g=(t,e,i)=>{let n=t[e];n instanceof Set||(t[e]=n=new Set([n])),n.add(i)},y=(t,e,i)=>{const n=t[e];n instanceof Set?n.delete(i):n===i&&delete t[e]},_=t=>t instanceof Set?0===t.size:!t,w=new Map;function b(t,e,i,r,o){const a=(e,n)=>{i(t),o(e,n,{watchedPath:t}),n&&t!==n&&v(s.resolve(t,n),h,s.join(t,n))};try{return(0,n.watch)(t,{persistent:e.persistent},a)}catch(t){return void r(t)}}const v=(t,e,i,n,r)=>{const s=w.get(t);s&&m(s[e],t=>{t(i,n,r)})},S=(t,i,n,s)=>{const{listener:o,errHandler:a,rawEmitter:l}=s;let p,m=w.get(i);if(!n.persistent){if(p=b(t,n,o,a,l),!p)return;return p.close.bind(p)}if(m)g(m,h,o),g(m,u,a),g(m,f,l);else{if(p=b(t,n,v.bind(null,i,h),a,v.bind(null,i,f)),!p)return;p.on(c.ERROR,async n=>{const s=v.bind(null,i,u);if(m&&(m.watcherUnusable=!0),e.isWindows&&"EPERM"===n.code)try{const e=await(0,r.open)(t,"r");await e.close(),s(n)}catch(t){}else s(n)}),m={listeners:o,errHandlers:a,rawEmitters:l,watcher:p},w.set(i,m)}return()=>{y(m,h,o),y(m,u,a),y(m,f,l),_(m.listeners)&&(m.watcher.close(),w.delete(i),d.forEach((t=>e=>{const i=t[e];i instanceof Set?i.clear():delete t[e]})(m)),m.watcher=void 0,Object.freeze(m))}},E=new Map;e.NodeFsHandler=class{constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e)}_watchWithNodeFs(t,i){const r=this.fsw.options,o=s.dirname(t),a=s.basename(t);this.fsw._getWatchedDir(o).add(a);const l=s.resolve(t),u={persistent:r.persistent};let d;if(i||(i=e.EMPTY_FN),r.usePolling){const e=r.interval!==r.binaryInterval;u.interval=e&&(w=a,p.has(s.extname(w).slice(1).toLowerCase()))?r.binaryInterval:r.interval,d=((t,e,i,r)=>{const{listener:s,rawEmitter:o}=r;let a=E.get(e);const l=a&&a.options;return l&&(l.persistent<i.persistent||l.interval>i.interval)&&((0,n.unwatchFile)(e),a=void 0),a?(g(a,h,s),g(a,f,o)):(a={listeners:s,rawEmitters:o,options:i,watcher:(0,n.watchFile)(e,i,(i,n)=>{m(a.rawEmitters,t=>{t(c.CHANGE,e,{curr:i,prev:n})});const r=i.mtimeMs;(i.size!==n.size||r>n.mtimeMs||0===r)&&m(a.listeners,e=>e(t,i))})},E.set(e,a)),()=>{y(a,h,s),y(a,f,o),_(a.listeners)&&(E.delete(e),(0,n.unwatchFile)(e),a.options=a.watcher=void 0,Object.freeze(a))}})(t,l,u,{listener:i,rawEmitter:this.fsw._emitRaw})}else d=S(t,l,u,{listener:i,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});var w;return d}_handleFile(t,i,n){if(this.fsw.closed)return;const o=s.dirname(t),a=s.basename(t),l=this.fsw._getWatchedDir(o);let h=i;if(l.has(a))return;const u=async(i,n)=>{if(this.fsw._throttle("watch",t,5))if(n&&0!==n.mtimeMs){if(l.has(a)){const e=n.atimeMs,i=n.mtimeMs;(!e||e<=i||i!==h.mtimeMs)&&this.fsw._emit(c.CHANGE,t,n),h=n}}else try{const n=await(0,r.stat)(t);if(this.fsw.closed)return;const s=n.atimeMs,o=n.mtimeMs;if((!s||s<=o||o!==h.mtimeMs)&&this.fsw._emit(c.CHANGE,t,n),(e.aP||e.j9||e.gH)&&h.ino!==n.ino){this.fsw._closeFile(i),h=n;const e=this._watchWithNodeFs(t,u);e&&this.fsw._addPathCloser(i,e)}else h=n}catch(t){this.fsw._remove(o,a)}},f=this._watchWithNodeFs(t,u);if((!n||!this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(c.ADD,t,0))return;this.fsw._emit(c.ADD,t,i)}return f}async _handleSymlink(t,e,i,n){if(this.fsw.closed)return;const s=t.fullPath,o=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){let e;this.fsw._incrReadyCount();try{e=await(0,r.realpath)(i)}catch(t){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return o.has(n)?this.fsw._symlinkPaths.get(s)!==e&&(this.fsw._symlinkPaths.set(s,e),this.fsw._emit(c.CHANGE,i,t.stats)):(o.add(n),this.fsw._symlinkPaths.set(s,e),this.fsw._emit(c.ADD,i,t.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(s))return!0;this.fsw._symlinkPaths.set(s,!0)}_handleRead(t,i,n,r,o,a,l){if(t=s.join(t,""),!(l=this.fsw._throttle("readdir",t,1e3)))return;const h=this.fsw._getWatchedDir(n.path),u=new Set;let f=this.fsw._readdirp(t,{fileFilter:t=>n.filterPath(t),directoryFilter:t=>n.filterDir(t)});return f?(f.on(e.j1,async e=>{if(this.fsw.closed)return void(f=void 0);const c=e.path;let l=s.join(t,c);u.add(c),e.stats.isSymbolicLink()&&await this._handleSymlink(e,t,l,c)||(this.fsw.closed?f=void 0:c!==r&&(r||h.has(c))||(this.fsw._incrReadyCount(),l=s.join(o,s.relative(o,l)),this._addToNodeFs(l,i,n,a+1)))}).on(c.ERROR,this._boundHandleError),new Promise((i,s)=>{if(!f)return s();f.once(e.STR_END,()=>{if(this.fsw.closed)return void(f=void 0);const e=!!l&&l.clear();i(void 0),h.getChildren().filter(e=>e!==t&&!u.has(e)).forEach(e=>{this.fsw._remove(t,e)}),f=void 0,e&&this._handleRead(t,!1,n,r,o,a,l)})})):void 0}async _handleDir(t,e,i,n,r,o,a){const l=this.fsw._getWatchedDir(s.dirname(t)),h=l.has(s.basename(t));let u,f;i&&this.fsw.options.ignoreInitial||r||h||this.fsw._emit(c.ADD_DIR,t,e),l.add(s.basename(t)),this.fsw._getWatchedDir(t);const d=this.fsw.options.depth;if((null==d||n<=d)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(t,i,o,r,t,n,u),this.fsw.closed))return;f=this._watchWithNodeFs(t,(e,i)=>{i&&0===i.mtimeMs||this._handleRead(e,!1,o,r,t,n,u)})}return f}async _addToNodeFs(t,e,i,n,o){const a=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return a(),!1;const h=this.fsw._getWatchHelpers(t);i&&(h.filterPath=t=>i.filterPath(t),h.filterDir=t=>i.filterDir(t));try{const i=await l[h.statMethod](h.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(h.watchPath,i))return a(),!1;const u=this.fsw.options.followSymlinks;let f;if(i.isDirectory()){const a=s.resolve(t),c=u?await(0,r.realpath)(t):t;if(this.fsw.closed)return;if(f=await this._handleDir(h.watchPath,i,e,n,o,h,c),this.fsw.closed)return;a!==c&&void 0!==c&&this.fsw._symlinkPaths.set(a,c)}else if(i.isSymbolicLink()){const o=u?await(0,r.realpath)(t):t;if(this.fsw.closed)return;const a=s.dirname(h.watchPath);if(this.fsw._getWatchedDir(a).add(h.watchPath),this.fsw._emit(c.ADD,h.watchPath,i),f=await this._handleDir(a,i,e,n,t,h,o),this.fsw.closed)return;void 0!==o&&this.fsw._symlinkPaths.set(s.resolve(t),o)}else f=this._handleFile(h.watchPath,i,e);return a(),f&&this.fsw._addPathCloser(t,f),!1}catch(e){if(this.fsw._handleError(e))return a(),t}}}},158(t,e,i){"use strict";e.watch=x;const n=i(9896),r=i(1943),s=i(4434),o=i(6928),a=i(9084),c=i(5266),l=/\\/g,h=/\/\//,u=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,f=/^\.[/\\]/;function d(t){return Array.isArray(t)?t:[t]}const p=t=>"object"==typeof t&&null!==t&&!(t instanceof RegExp);function m(t,e,i){const n=function(t){if("string"!=typeof t)throw new Error("string expected");let e=!1;(t=(t=o.normalize(t)).replace(/\\/g,"/")).startsWith("//")&&(e=!0);const i=/\/\//;for(;t.match(i);)t=t.replace(i,"/");return e&&(t="/"+t),t}(e);for(let e=0;e<t.length;e++){if((0,t[e])(n,i))return!0}return!1}function g(t,e){if(null==t)throw new TypeError("anymatch: specify first argument");const i=d(t).map(t=>function(t){return"function"==typeof t?t:"string"==typeof t?e=>t===e:t instanceof RegExp?e=>t.test(e):"object"==typeof t&&null!==t?e=>{if(t.path===e)return!0;if(t.recursive){const i=o.relative(t.path,e);return!!i&&!i.startsWith("..")&&!o.isAbsolute(i)}return!1}:()=>!1}(t));return null==e?(t,e)=>m(i,t,e):m(i,e)}const y=t=>{const e=d(t).flat();if(!e.every(t=>"string"==typeof t))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(w)},_=t=>{let e=t.replace(l,"/"),i=!1;for(e.startsWith("//")&&(i=!0);e.match(h);)e=e.replace(h,"/");return i&&(e="/"+e),e},w=t=>_(o.normalize(_(t))),b=(t="")=>e=>"string"==typeof e?w(o.isAbsolute(e)?e:o.join(t,e)):e,v=Object.freeze(new Set);class S{constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set}add(t){const{items:e}=this;e&&"."!==t&&".."!==t&&e.add(t)}async remove(t){const{items:e}=this;if(!e)return;if(e.delete(t),e.size>0)return;const i=this.path;try{await(0,r.readdir)(i)}catch(t){this._removeWatcher&&this._removeWatcher(o.dirname(i),o.basename(i))}}has(t){const{items:e}=this;if(e)return e.has(t)}getChildren(){const{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=c.EMPTY_FN,this.items=v,Object.freeze(this)}}class E{constructor(t,e,i){this.fsw=i;const n=t;this.path=t=t.replace(f,""),this.watchPath=n,this.fullWatchPath=o.resolve(n),this.dirParts=[],this.dirParts.forEach(t=>{t.length>1&&t.pop()}),this.followSymlinks=e,this.statMethod=e?"stat":"lstat"}entryPath(t){return o.join(this.watchPath,o.relative(this.watchPath,t.fullPath))}filterPath(t){const{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);const i=this.entryPath(t);return this.fsw._isntIgnored(i,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}}class k extends s.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;const e=t.awaitWriteFinish,i={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?d(t.ignored):d([]),awaitWriteFinish:!0===e?i:"object"==typeof e&&{...i,...e}};c.isIBMi&&(n.usePolling=!0),void 0===n.atomic&&(n.atomic=!n.usePolling);const r=process.env.CHOKIDAR_USEPOLLING;if(void 0!==r){const t=r.toLowerCase();n.usePolling="false"!==t&&"0"!==t&&("true"===t||"1"===t||!!t)}const s=process.env.CHOKIDAR_INTERVAL;s&&(n.interval=Number.parseInt(s,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=c.EMPTY_FN,this._readyEmitted=!0,process.nextTick(()=>this.emit(c.EVENTS.READY)))},this._emitRaw=(...t)=>this.emit(c.EVENTS.RAW,...t),this._boundRemove=this._remove.bind(this),this.options=n,this._nodeFsHandler=new c.NodeFsHandler(this),Object.freeze(n)}_addIgnoredPath(t){if(p(t))for(const e of this._ignoredPaths)if(p(e)&&e.path===t.path&&e.recursive===t.recursive)return;this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),"string"==typeof t)for(const e of this._ignoredPaths)p(e)&&e.path===t&&this._ignoredPaths.delete(e)}add(t,e,i){const{cwd:n}=this.options;this.closed=!1,this._closePromise=void 0;let r=y(t);return n&&(r=r.map(t=>{const e=((t,e)=>o.isAbsolute(t)?t:o.join(e,t))(t,n);return e})),r.forEach(t=>{this._removeIgnoredPath(t)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=r.length,Promise.all(r.map(async t=>{const n=await this._nodeFsHandler._addToNodeFs(t,!i,void 0,0,e);return n&&this._emitReady(),n})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(o.dirname(t),o.basename(e||t))})}),this}unwatch(t){if(this.closed)return this;const e=y(t),{cwd:i}=this.options;return e.forEach(t=>{o.isAbsolute(t)||this._closers.has(t)||(i&&(t=o.join(i,t)),t=o.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();const t=[];return this._closers.forEach(e=>e.forEach(e=>{const i=e();i instanceof Promise&&t.push(i)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.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(){const t={};return this._watched.forEach((e,i)=>{const n=this.options.cwd?o.relative(this.options.cwd,i):i;t[n||"."]=e.getChildren().sort()}),t}emitWithAll(t,e){this.emit(t,...e),t!==c.EVENTS.ERROR&&this.emit(c.EVENTS.ALL,t,...e)}async _emit(t,e,i){if(this.closed)return;const n=this.options;c.isWindows&&(e=o.normalize(e)),n.cwd&&(e=o.relative(n.cwd,e));const s=[e];null!=i&&s.push(i);const a=n.awaitWriteFinish;let l;if(a&&(l=this._pendingWrites.get(e)))return l.lastChange=new Date,this;if(n.atomic){if(t===c.EVENTS.UNLINK)return this._pendingUnlinks.set(e,[t,...s]),setTimeout(()=>{this._pendingUnlinks.forEach((t,e)=>{this.emit(...t),this.emit(c.EVENTS.ALL,...t),this._pendingUnlinks.delete(e)})},"number"==typeof n.atomic?n.atomic:100),this;t===c.EVENTS.ADD&&this._pendingUnlinks.has(e)&&(t=c.EVENTS.CHANGE,this._pendingUnlinks.delete(e))}if(a&&(t===c.EVENTS.ADD||t===c.EVENTS.CHANGE)&&this._readyEmitted){const i=(e,i)=>{e?(t=c.EVENTS.ERROR,s[0]=e,this.emitWithAll(t,s)):i&&(s.length>1?s[1]=i:s.push(i),this.emitWithAll(t,s))};return this._awaitWriteFinish(e,a.stabilityThreshold,t,i),this}if(t===c.EVENTS.CHANGE){if(!this._throttle(c.EVENTS.CHANGE,e,50))return this}if(n.alwaysStat&&void 0===i&&(t===c.EVENTS.ADD||t===c.EVENTS.ADD_DIR||t===c.EVENTS.CHANGE)){const t=n.cwd?o.join(n.cwd,e):e;let i;try{i=await(0,r.stat)(t)}catch(t){}if(!i||this.closed)return;s.push(i)}return this.emitWithAll(t,s),this}_handleError(t){const e=t&&t.code;return t&&"ENOENT"!==e&&"ENOTDIR"!==e&&(!this.options.ignorePermissionErrors||"EPERM"!==e&&"EACCES"!==e)&&this.emit(c.EVENTS.ERROR,t),t||this.closed}_throttle(t,e,i){this._throttled.has(t)||this._throttled.set(t,new Map);const n=this._throttled.get(t);if(!n)throw new Error("invalid throttle");const r=n.get(e);if(r)return r.count++,!1;let s;const o=()=>{const t=n.get(e),i=t?t.count:0;return n.delete(e),clearTimeout(s),t&&clearTimeout(t.timeoutObject),i};s=setTimeout(o,i);const a={timeoutObject:s,clear:o,count:0};return n.set(e,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,i,r){const s=this.options.awaitWriteFinish;if("object"!=typeof s)return;const a=s.pollInterval;let c,l=t;this.options.cwd&&!o.isAbsolute(t)&&(l=o.join(this.options.cwd,t));const h=new Date,u=this._pendingWrites;u.has(t)||(u.set(t,{lastChange:h,cancelWait:()=>(u.delete(t),clearTimeout(c),i)}),c=setTimeout(function i(s){(0,n.stat)(l,(n,o)=>{if(n||!u.has(t))return void(n&&"ENOENT"!==n.code&&r(n));const l=Number(new Date);s&&o.size!==s.size&&(u.get(t).lastChange=l),l-u.get(t).lastChange>=e?(u.delete(t),r(void 0,o)):c=setTimeout(i,a,o)})},a))}_isIgnored(t,e){if(this.options.atomic&&u.test(t))return!0;if(!this._userIgnored){const{cwd:t}=this.options,e=(this.options.ignored||[]).map(b(t)),i=[...[...this._ignoredPaths].map(b(t)),...e];this._userIgnored=g(i,void 0)}return this._userIgnored(t,e)}_isntIgnored(t,e){return!this._isIgnored(t,e)}_getWatchHelpers(t){return new E(t,this.options.followSymlinks,this)}_getWatchedDir(t){const e=o.resolve(t);return this._watched.has(e)||this._watched.set(e,new S(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return!!this.options.ignorePermissionErrors||Boolean(256&Number(t.mode))}_remove(t,e,i){const n=o.join(t,e),r=o.resolve(n);if(i=null!=i?i:this._watched.has(n)||this._watched.has(r),!this._throttle("remove",n,100))return;i||1!==this._watched.size||this.add(t,e,!0);this._getWatchedDir(n).getChildren().forEach(t=>this._remove(n,t));const s=this._getWatchedDir(t),a=s.has(e);s.remove(e),this._symlinkPaths.has(r)&&this._symlinkPaths.delete(r);let l=n;if(this.options.cwd&&(l=o.relative(this.options.cwd,n)),this.options.awaitWriteFinish&&this._pendingWrites.has(l)){if(this._pendingWrites.get(l).cancelWait()===c.EVENTS.ADD)return}this._watched.delete(n),this._watched.delete(r);const h=i?c.EVENTS.UNLINK_DIR:c.EVENTS.UNLINK;a&&!this._isIgnored(n)&&this._emit(h,n),this._closePath(n)}_closePath(t){this._closeFile(t);const e=o.dirname(t);this._getWatchedDir(e).remove(o.basename(t))}_closeFile(t){const e=this._closers.get(t);e&&(e.forEach(t=>t()),this._closers.delete(t))}_addPathCloser(t,e){if(!e)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(e)}_readdirp(t,e){if(this.closed)return;const i={type:c.EVENTS.ALL,alwaysStat:!0,lstat:!0,...e,depth:0};let n=(0,a.readdirp)(t,i);return this._streams.add(n),n.once(c.STR_CLOSE,()=>{n=void 0}),n.once(c.STR_END,()=>{n&&(this._streams.delete(n),n=void 0)}),n}}function x(t,e={}){const i=new k(e);return i.add(t),i}},5474(t,e,i){t=i.nmd(t),function e(n){"use strict";var r;function s(t,e,i){const n=typeof i,r=typeof t;if("undefined"!==n){if("undefined"!==r){if(i){if("function"===r&&n===r)return function(e){return t(i(e))};if((e=t.constructor)===i.constructor){if(e===Array)return i.concat(t);if(e===Map){var s=new Map(i);for(var o of t)s.set(o[0],o[1]);return s}if(e===Set){for(s of(o=new Set(i),t.values()))o.add(s);return o}}}return t}return i}return"undefined"===r?e:t}function o(t,e){return void 0===t?e:t}function a(){return Object.create(null)}function c(t){return"string"==typeof t}function l(t){return"object"==typeof t}function h(t,e){if(c(e))t=t[e];else for(let i=0;t&&i<e.length;i++)t=t[e[i]];return t}(n=t)._factory=e;const u=/[^\p{L}\p{N}]+/u,f=/(\d{3})/g,d=/(\D)(\d{3})/g,p=/(\d{3})(\D)/g,m=/[\u0300-\u036f]/g;function g(t={}){if(!this||this.constructor!==g)return new g(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}function y(t){t.F=null,t.B.clear(),t.D.clear()}function _(t,e,i){i||(e||"object"!=typeof t?"object"==typeof e&&(i=e,e=0):i=t),i&&(t=i.query||t,e=i.limit||e);let n=""+(e||0);i&&(n+=(i.offset||0)+!!i.context+!!i.suggest+(!1!==i.resolve)+(i.resolution||this.resolution)+(i.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new w);let r=this.cache.get(t+n);if(!r){const s=i&&i.cache;s&&(i.cache=!1),r=this.search(t,e,i),s&&(i.cache=s),this.cache.set(t+n,r)}return r}function w(t){this.limit=t&&!0!==t?t:1e3,this.cache=new Map,this.h=""}(r=g.prototype).assign=function(t){this.normalize=s(t.normalize,!0,this.normalize);let e,i=t.include,n=i||t.exclude||t.split;if(n||""===n){if("object"==typeof n&&n.constructor!==RegExp){let t="";e=!i,i||(t+="\\p{Z}"),n.letter&&(t+="\\p{L}"),n.number&&(t+="\\p{N}",e=!!i),n.symbol&&(t+="\\p{S}"),n.punctuation&&(t+="\\p{P}"),n.control&&(t+="\\p{C}"),(n=n.char)&&(t+="object"==typeof n?n.join(""):n);try{this.split=new RegExp("["+(i?"^":"")+t+"]+","u")}catch(t){this.split=/\s+/}}else this.split=n,e=!1===n||"a1a".split(n).length<2;this.numeric=s(t.numeric,e)}else{try{this.split=s(this.split,u)}catch(t){this.split=/\s+/}this.numeric=s(t.numeric,s(this.numeric,!0))}if(this.prepare=s(t.prepare,null,this.prepare),this.finalize=s(t.finalize,null,this.finalize),n=t.filter,this.filter="function"==typeof n?n:s(n&&new Set(n),null,this.filter),this.dedupe=s(t.dedupe,!0,this.dedupe),this.matcher=s((n=t.matcher)&&new Map(n),null,this.matcher),this.mapper=s((n=t.mapper)&&new Map(n),null,this.mapper),this.stemmer=s((n=t.stemmer)&&new Map(n),null,this.stemmer),this.replacer=s(t.replacer,null,this.replacer),this.minlength=s(t.minlength,1,this.minlength),this.maxlength=s(t.maxlength,1024,this.maxlength),this.rtl=s(t.rtl,!1,this.rtl),(this.cache=n=s(t.cache,!0,this.cache))&&(this.F=null,this.L="number"==typeof n?n:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const t of this.matcher.keys())this.h+=(this.h?"|":"")+t;if(this.stemmer)for(const t of this.stemmer.keys())this.A+=(this.A?"|":"")+t;return this},r.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&y(this),this},r.addFilter=function(t){return"function"==typeof t?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&y(this),this},r.addMapper=function(t,e){return"object"==typeof t?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&y(this),this)},r.addMatcher=function(t,e){return"object"==typeof t?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&y(this),this)},r.addReplacer=function(t,e){return"string"==typeof t?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&y(this),this)},r.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(y,50,this);this.normalize&&(t="function"==typeof this.normalize?this.normalize(t):m?t.normalize("NFKD").replace(m,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(d,"$1 $2").replace(p,"$1 $2").replace(f,"$1 "));const i=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n,r,s=[],o=a(),c=this.split||""===this.split?t.split(this.split):[t];for(let t,a,h=0;h<c.length;h++)if((t=a=c[h])&&!(t.length<this.minlength||t.length>this.maxlength)){if(e){if(o[t])continue;o[t]=1}else{if(n===t)continue;n=t}if(i)s.push(t);else if(!this.filter||("function"==typeof this.filter?this.filter(t):!this.filter.has(t))){if(this.cache&&t.length<=this.I)if(this.F){var l=this.D.get(t);if(l||""===l){l&&s.push(l);continue}}else this.F=setTimeout(y,50,this);if(this.stemmer){let e;for(this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));e!==t&&t.length>2;)e=t,t=t.replace(this.K,t=>this.stemmer.get(t))}if(t&&(this.mapper||this.dedupe&&t.length>1)){l="";for(let e,i,n=0,r="";n<t.length;n++)e=t.charAt(n),e===r&&this.dedupe||((i=this.mapper&&this.mapper.get(e))||""===i?i===r&&this.dedupe||!(r=i)||(l+=i):l+=r=e);t=l}if(this.matcher&&t.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),t=t.replace(this.J,t=>this.matcher.get(t))),t&&this.replacer)for(l=0;t&&l<this.replacer.length;l+=2)t=t.replace(this.replacer[l],this.replacer[l+1]);if(this.cache&&a.length<=this.I&&(this.D.set(a,t),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),t){if(t!==a)if(e){if(o[t])continue;o[t]=1}else{if(r===t)continue;r=t}s.push(t)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&t.length<=this.H&&(this.B.set(t,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s},w.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},w.prototype.get=function(t){const e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e},w.prototype.remove=function(t){for(const e of this.cache){const i=e[0];e[1].includes(t)&&this.cache.delete(i)}},w.prototype.clear=function(){this.cache.clear(),this.h=""};const b={normalize:!1,numeric:!1,dedupe:!1},v={},S=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),E=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),k=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],x={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var P={Exact:b,Default:v,Normalize:v,LatinBalance:{mapper:S},LatinAdvanced:{mapper:S,matcher:E,replacer:k},LatinExtra:{mapper:S,replacer:k.concat([/(?!^)[aeo]/g,""]),matcher:E},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let i=0;i<t.length;i++){var e=t[i];let n=e.charAt(0),r=x[n];for(let t,i=1;i<e.length&&(t=e.charAt(i),"h"===t||"w"===t||!(t=x[t])||t===r||(n+=t,r=t,4!==n.length));i++);t[i]=n}}},CJK:{split:""},LatinExact:b,LatinDefault:v,LatinSimple:v};function D(t,e,i,n){let r=[];for(let s,o=0;o<t.index.length;o++)if(s=t.index[o],e>=s.length)e-=s.length;else{const o=(e=s[n?"splice":"slice"](e,i)).length;if(o&&(r=r.length?r.concat(e):e,i-=o,n&&(t.length-=o),!i))break;e=0}return r}function F(t){if(!this||this.constructor!==F)return new F(t);this.index=t?[t]:[],this.length=t?t.length:0;const e=this;return new Proxy([],{get:(t,i)=>"length"===i?e.length:"push"===i?function(t){e.index[e.index.length-1].push(t),e.length++}:"pop"===i?function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()}:"indexOf"===i?function(t){let i=0;for(let n,r,s=0;s<e.index.length;s++){if(n=e.index[s],r=n.indexOf(t),r>=0)return i+r;i+=n.length}return-1}:"includes"===i?function(t){for(let i=0;i<e.index.length;i++)if(e.index[i].includes(t))return!0;return!1}:"slice"===i?function(t,i){return D(e,t||0,i||e.length,!1)}:"splice"===i?function(t,i){return D(e,t||0,i||e.length,!0)}:"constructor"===i?Array:"symbol"!=typeof i?(t=e.index[i/2**31|0])&&t[i]:void 0,set:(t,i,n)=>(t=i/2**31|0,(e.index[t]||(e.index[t]=[]))[i]=n,e.length++,!0)})}function N(t=8){if(!this||this.constructor!==N)return new N(t);this.index=a(),this.h=[],this.size=0,t>32?(this.B=I,this.A=BigInt(t)):(this.B=T,this.A=t)}function O(t=8){if(!this||this.constructor!==O)return new O(t);this.index=a(),this.h=[],this.size=0,t>32?(this.B=I,this.A=BigInt(t)):(this.B=T,this.A=t)}function T(t){let e=2**this.A-1;if("number"==typeof t)return t&e;let i=0,n=this.A+1;for(let r=0;r<t.length;r++)i=(i*n^t.charCodeAt(r))&e;return 32===this.A?i+2**31:i}function I(t){let e=BigInt(2)**this.A-BigInt(1);var i=typeof t;if("bigint"===i)return t&e;if("number"===i)return BigInt(t)&e;i=BigInt(0);let n=this.A+BigInt(1);for(let r=0;r<t.length;r++)i=(i*n^BigInt(t.charCodeAt(r)))&e;return i}let j,R,A,C,M;async function L(t){var e=(t=t.data).task;const i=t.id;let r=t.args;if("init"===e)R=t.options||{},(e=t.factory)?(Function("return "+e)()(n),j=new n.FlexSearch.Index(R),delete n.FlexSearch):j=new Ft(R),postMessage({id:i});else{let n;"export"===e&&(r[1]?(r[0]=R.export,r[2]=0,r[3]=1):r=null),"import"===e?r[0]&&(t=await R.import.call(j,r[0]),j.import(r[0],t)):((n=r&&j[e].apply(j,r))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),"search"===e&&n.result&&(n=n.result)),postMessage("search"===e?{id:i,msg:n}:{id:i})}}function z(t){$.call(t,"add"),$.call(t,"append"),$.call(t,"search"),$.call(t,"update"),$.call(t,"remove"),$.call(t,"searchCache")}function W(){A=M=0}function $(t){this[t+"Async"]=function(){const e=arguments;var i=e[e.length-1];let n;if("function"==typeof i&&(n=i,delete e[e.length-1]),A?M||(M=Date.now()-C>=this.priority*this.priority*3):(A=setTimeout(W,0),C=Date.now()),M){const i=this;return new Promise(n=>{setTimeout(function(){n(i[t+"Async"].apply(i,e))},0)})}const r=this[t].apply(this,e);return i=r.then?r:new Promise(t=>t(r)),n&&i.then(n),i}}F.prototype.clear=function(){this.index.length=0},F.prototype.push=function(){},N.prototype.get=function(t){const e=this.index[this.B(t)];return e&&e.get(t)},N.prototype.set=function(t,e){var i=this.B(t);let n=this.index[i];n?(i=n.size,n.set(t,e),(i-=n.size)&&this.size++):(this.index[i]=n=new Map([[t,e]]),this.h.push(n),this.size++)},O.prototype.add=function(t){var e=this.B(t);let i=this.index[e];i?(e=i.size,i.add(t),(e-=i.size)&&this.size++):(this.index[e]=i=new Set([t]),this.h.push(i),this.size++)},(r=N.prototype).has=O.prototype.has=function(t){const e=this.index[this.B(t)];return e&&e.has(t)},r.delete=O.prototype.delete=function(t){const e=this.index[this.B(t)];e&&e.delete(t)&&this.size--},r.clear=O.prototype.clear=function(){this.index=a(),this.h=[],this.size=0},r.values=O.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e},r.keys=O.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e},r.entries=O.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};let B=0;function q(t={},e){function r(i){function n(t){const e=(t=t.data||t).id,i=e&&c.h[e];i&&(i(t.msg),delete c.h[e])}if(this.worker=i,this.h=a(),this.worker)return o?this.worker.on("message",n):this.worker.onmessage=n,t.config?new Promise(function(e){B>1e9&&(B=0),c.h[++B]=function(){e(c)},c.worker.postMessage({id:B,task:"init",factory:s,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:s,options:t}),this)}if(!this||this.constructor!==q)return new q(t);let s=void 0!==n?n._factory:"undefined"!=typeof window?window._factory:null;s&&(s=s.toString());const o="undefined"==typeof window,c=this,l=function(t,e,n){return e?new(i(8167).Worker)(__dirname+"/node/node.js"):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+L.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof n?n:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}(s,o,t.worker);return l.then?l.then(function(t){return r.call(c,t)}):r.call(this,l)}function U(t){q.prototype[t]=function(){const e=this,i=[].slice.call(arguments);var n=i[i.length-1];let r;return"function"==typeof n&&(r=n,i.pop()),n=new Promise(function(n){"export"===t&&"function"==typeof i[0]&&(i[0]=null),B>1e9&&(B=0),e.h[++B]=n,e.worker.postMessage({task:t,id:B,args:i})}),r?(n.then(r),this):n}}function H(t,e,i,n,r,s){if(t=t[r],n===i.length-1)e[r]=s||t;else if(t)if(t.constructor===Array)for(e=e[r]=Array(t.length),r=0;r<t.length;r++)H(t,e,i,n,r);else e=e[r]||(e[r]=a()),r=i[++n],H(t,e,i,n,r)}function Y(t,e,i,n,r,s,o,a){if(t=t[o])if(n===e.length-1){if(t.constructor===Array){if(i[n]){for(e=0;e<t.length;e++)r.add(s,t[e],!0,!0);return}t=t.join(" ")}r.add(s,t,a,!0)}else if(t.constructor===Array)for(o=0;o<t.length;o++)Y(t,e,i,n,r,s,o,a);else o=e[++n],Y(t,e,i,n,r,s,o,a)}function V(t,e,i,n){if(!t.length)return t;if(1===t.length)return t=t[0],t=i||t.length>e?t.slice(i,i+e):t,n?ct.call(this,t):t;let r=[];for(let s,o,a=0;a<t.length;a++)if((s=t[a])&&(o=s.length)){if(i){if(i>=o){i-=o;continue}s=s.slice(i,i+e),o=s.length,i=0}if(o>e&&(s=s.slice(0,e),o=e),!r.length&&o>=e)return n?ct.call(this,s):s;if(r.push(s),!(e-=o))break}return r=r.length>1?[].concat.apply([],r):r[0],n?ct.call(this,r):r}function J(t,e,i,n){var r=n[0];if(r[0]&&r[0].query)return t[e].apply(t,r);if(!("and"!==e&&"not"!==e||t.result.length||t.await||r.suggest))return n.length>1&&(r=n[n.length-1]),(n=r.resolve)?t.await||t.result:t;let s,o,a,c,l,h=[],u=0,f=0;for(e=0;e<n.length;e++)if(r=n[e]){var d=void 0;if(r.constructor===et)d=r.await||r.result;else if(r.then||r.constructor===Array)d=r;else{u=r.limit||0,f=r.offset||0,a=r.suggest,o=r.resolve,s=((c=r.highlight||t.highlight)||r.enrich)&&o,d=r.queue;let i=r.async||d,n=r.index,p=r.query;if(n?t.index||(t.index=n):n=t.index,p||r.tag){const s=r.field||r.pluck;if(s&&(!p||t.query&&!c||(t.query=p,t.field=s,t.highlight=c),n=n.index.get(s)),d&&(l||t.await)){let s;l=1;const o=t.C.length,a=new Promise(function(t){s=t});(function(e,n){a.h=function(){n.index=null,n.resolve=!1;let r=i?e.searchAsync(n):e.search(n);return r.then?r.then(function(e){return t.C[o]=e=e.result||e,s(e),e}):(r=r.result||r,s(r),r)}})(n,Object.assign({},r)),t.C.push(a),h[e]=a;continue}r.resolve=!1,r.index=null,d=i?n.searchAsync(r):n.search(r),r.resolve=o,r.index=n}else if(r.and)d=G(r,"and",n);else if(r.or)d=G(r,"or",n);else if(r.not)d=G(r,"not",n);else{if(!r.xor)continue;d=G(r,"xor",n)}}d.await?(l=1,d=d.await):d.then?(l=1,d=d.then(function(t){return t.result||t})):d=d.result||d,h[e]=d}if(l&&!t.await&&(t.await=new Promise(function(e){t.return=e})),l){const e=Promise.all(h).then(function(n){for(let r=0;r<t.C.length;r++)if(t.C[r]===e){t.C[r]=function(){return i.call(t,n,u,f,s,o,a,c)};break}it(t)});t.C.push(e)}else{if(!t.await)return i.call(t,h,u,f,s,o,a,c);t.C.push(function(){return i.call(t,h,u,f,s,o,a,c)})}return o?t.await||t.result:t}function G(t,e,i){const n=(t=t[e])[0]||t;return n.index||(n.index=i),i=new et(n),t.length>1&&(i=i[e].apply(i,t.slice(1))),i}function K(t,e,i,n,r,s,o){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=rt(t,e,i,!1,this.h),i=0)),r&&(this.await=null),r?this.resolve(e,i,n,o):this}function X(t,e,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;let a;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let n=0;for(let e,i,r=0;r<t.length;r++)if((e=t[r])&&(i=e.length))n<i&&(n=i);else if(!s){n=0;break}n?(this.result=nt(t,n,e,i,s,this.h,r),a=!0):this.result=[]}else s||(this.result=t);return r&&(this.await=null),r?this.resolve(e,i,n,o,a):this}function Q(t,e,i,n,r,s,o){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{t:{s=i;var c=this.h;const n=[],o=a();let l=0;for(let e,i=0;i<t.length;i++)if(e=t[i]){l<e.length&&(l=e.length);for(let t,i=0;i<e.length;i++)if(t=e[i])for(let e,i=0;i<t.length;i++)e=t[i],o[e]=o[e]?2:1}for(let i,a=0,h=0;a<l;a++)for(let l,u=0;u<t.length;u++)if((l=t[u])&&(i=l[a]))for(let l,f=0;f<i.length;f++)if(l=i[f],1===o[l])if(s)s--;else if(r){if(n.push(l),n.length===e){t=n;break t}}else{const i=a+(u?c:0);if(n[i]||(n[i]=[]),n[i].push(l),++h===e){t=n;break t}}t=n}this.result=t,c=!0}else s||(this.result=t);return r&&(this.await=null),r?this.resolve(e,i,n,o,c):this}function Z(t,e,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;if(t.length&&this.result.length){t:{s=i;var a=[];t=new Set(t.flat().flat());for(let i,n=0,o=0;n<this.result.length;n++)if(i=this.result[n])for(let c,l=0;l<i.length;l++)if(c=i[l],!t.has(c))if(s)s--;else if(r){if(a.push(c),a.length===e){t=a;break t}}else if(a[n]||(a[n]=[]),a[n].push(c),++o===e){t=a;break t}t=a}this.result=t,a=!0}return r&&(this.await=null),r?this.resolve(e,i,n,o,a):this}function tt(t,e,i,n,r){let s,o,a;"string"==typeof r?(s=r,r=""):s=r.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let c=r&&r.boundary,l=!r||!1!==r.clip,u=r&&r.merge&&a&&o&&new RegExp(a+" "+o,"g");var f=0;if("object"==typeof(r=r&&r.ellipsis)){var d=r.template;f=d.length-2,r=r.pattern}let p,m;"string"!=typeof r&&(r=!1===r?"":"..."),f&&(r=d.replace("$1",r)),d=r.length-f,"object"==typeof c&&(p=c.before,0===p&&(p=-1),m=c.after,0===m&&(m=-1),c=c.total||9e5),f=new Map;for(let R,A,C,M=0;M<e.length;M++){let L;if(n)L=e,C=n;else{var g=e[M];if(C=g.field,!C)continue;L=g.result}A=i.get(C),R=A.encoder,"string"!=typeof(g=f.get(R))&&(g=R.encode(t),f.set(R,g));for(let t=0;t<L.length;t++){var y=L[t].doc;if(!y)continue;if(!(y=h(y,C)))continue;var _=y.trim().split(/\s+/);if(!_.length)continue;y="";var w=[];let e=[];for(var b=-1,v=-1,S=0,E=0;E<_.length;E++){var k=_[E],x=R.encode(k);let t;if((x=x.length>1?x.join(" "):x[0])&&k){for(var P=k.length,D=(R.split?k.replace(R.split,""):k).length-x.length,F="",N=0,O=0;O<g.length;O++){var T=g[O];if(T){var I=T.length;I+=D<0?0:D,N&&I<=N||(T=x.indexOf(T))>-1&&(F=(T?k.substring(0,T):"")+o+k.substring(T,T+I)+a+(T+I<P?k.substring(T+I):""),N=I,t=!0)}}F&&(c&&(b<0&&(b=y.length+(y?1:0)),v=y.length+(y?1:0)+F.length,S+=P,e.push(w.length),w.push({match:F})),y+=(y?" ":"")+F)}if(t){if(c&&S>=c)break}else y+=(y?" ":"")+(k=_[E]),c&&w.push({text:k})}if(S=e.length*(s.length-2),p||m||c&&y.length-S>c)if(E=v-b,p>0&&(E+=p),m>0&&(E+=m),E<=(S=c+S-2*d))_=p?b-(p>0?p:0):b-((S-E)/2|0),w=m?v+(m>0?m:0):_+S,l||(_>0&&" "!==y.charAt(_)&&" "!==y.charAt(_-1)&&((_=y.indexOf(" ",_))<0&&(_=0)),w<y.length&&" "!==y.charAt(w-1)&&" "!==y.charAt(w)&&((w=y.lastIndexOf(" ",w))<v?w=v:++w)),y=(_?r:"")+y.substring(_,w)+(w<y.length?r:"");else{for(v=[],b={},S={},E={},k={},x={},F=D=P=0,O=N=1;;){var j=void 0;for(let t,i=0;i<e.length;i++){if(t=e[i],F)if(D!==F){if(E[i+1])continue;if(t+=F,b[t]){P-=d,S[i+1]=1,E[i+1]=1;continue}if(t>=w.length-1){if(t>=w.length){E[i+1]=1,t>=_.length&&(S[i+1]=1);continue}P-=d}if(y=w[t].text,I=m&&x[i]){if(!(I>0)){E[i+1]=1;continue}if(y.length>I){if(E[i+1]=1,!l)continue;y=y.substring(0,I)}(I-=y.length)||(I=-1),x[i]=I}if(P+y.length+1<=c)y=" "+y,v[i]+=y;else{if(!l){E[i+1]=1;continue}(j=c-P-1)>0&&(y=" "+y.substring(0,j),v[i]+=y),E[i+1]=1}}else{if(E[i])continue;if(t-=D,b[t]){P-=d,E[i]=1,S[i]=1;continue}if(t<=0){if(t<0){E[i]=1,S[i]=1;continue}P-=d}if(y=w[t].text,I=p&&k[i]){if(!(I>0)){E[i]=1;continue}if(y.length>I){if(E[i]=1,!l)continue;y=y.substring(y.length-I)}(I-=y.length)||(I=-1),k[i]=I}if(P+y.length+1<=c)y+=" ",v[i]=y+v[i];else{if(!l){E[i]=1;continue}(j=y.length+1-(c-P))>=0&&j<y.length&&(y=y.substring(j)+" ",v[i]=y+v[i]),E[i]=1}}else{let e;if(y=w[t].match,p&&(k[i]=p),m&&(x[i]=m),i&&P++,t?!i&&d&&(P+=d):(S[i]=1,E[i]=1),t>=_.length-1||t<w.length-1&&w[t+1].match?e=1:d&&(P+=d),P-=s.length-2,i&&!(P+y.length<=c)){j=N=O=S[i]=0;break}v[i]=y,e&&(S[i+1]=1,E[i+1]=1)}P+=y.length,j=b[t]=1}if(j)D===F?F++:D++;else{if(D===F?N=0:O=0,!N&&!O)break;N?F=++D:F++}}y="";for(let t,e=0;e<v.length;e++)t=(S[e]?e?" ":"":(e&&!r?" ":"")+r)+v[e],y+=t;r&&!S[v.length]&&(y+=r)}u&&(y=y.replace(u," ")),L[t].highlight=y}if(n)break}return e}function et(t,e){if(!this||this.constructor!==et)return new et(t,e);let i,n,r,s,o,a,c=0;if(t&&t.index){const i=t;if(e=i.index,c=i.boost||0,n=i.query){r=i.field||i.pluck,s=i.highlight;const n=i.resolve;t=i.async||i.queue,i.resolve=!1,i.index=null,t=t?e.searchAsync(i):e.search(i),i.resolve=n,i.index=e,t=t.result||t}else t=[]}if(t&&t.then){const e=this;i=[t=t.then(function(t){e.C[0]=e.result=t.result||t,it(e)})],t=[],o=new Promise(function(t){a=t})}this.index=e||null,this.result=t||[],this.h=c,this.C=i||[],this.await=o||null,this.return=a||null,this.highlight=s||null,this.query=n||"",this.field=r||""}function it(t,e){let i=t.result;var n=t.await;t.await=null;for(let e,r=0;r<t.C.length;r++)if(e=t.C[r])if("function"==typeof e)i=e(),t.C[r]=i=i.result||i,r--;else if(e.h)i=e.h(),t.C[r]=i=i.result||i,r--;else if(e.then)return t.await=n;return n=t.return,t.C=[],t.return=null,e||n(i),i}function nt(t,e,i,n,r,s,o){const c=t.length;let l,h,u=[];l=a();for(let a,f,d,p,m=0;m<e;m++)for(let e=0;e<c;e++)if(d=t[e],m<d.length&&(a=d[m]))for(let t=0;t<a.length;t++){if(f=a[t],(h=l[f])?l[f]++:(h=0,l[f]=1),p=u[h]||(u[h]=[]),!o){let t=m+(e||!r?0:s||0);p=p[t]||(p[t]=[])}if(p.push(f),o&&i&&h===c-1&&p.length-n===i)return n?p.slice(n):p}if(t=u.length)if(r)u=u.length>1?rt(u,i,n,o,s):(u=u[0])&&i&&u.length>i||n?u.slice(n,i+n):u;else{if(t<c)return[];if(u=u[t-1],i||n)if(o)(u.length>i||n)&&(u=u.slice(n,i+n));else{r=[];for(let t,e=0;e<u.length;e++)if(t=u[e])if(n&&t.length>n)n-=t.length;else if((i&&t.length>i||n)&&(t=t.slice(n,i+n),i-=t.length,n&&(n-=t.length)),r.push(t),!i)break;u=r}}return u}function rt(t,e,i,n,r){const s=[],o=a();let c;var l=t.length;let h;if(n){for(r=l-1;r>=0;r--)if(h=(n=t[r])&&n.length)for(l=0;l<h;l++)if(c=n[l],!o[c])if(o[c]=1,i)i--;else if(s.push(c),s.length===e)return s}else for(let a,u=l-1,f=0;u>=0;u--){a=t[u];for(let t=0;t<a.length;t++)if(h=(n=a[t])&&n.length)for(let a=0;a<h;a++)if(c=n[a],!o[c])if(o[c]=1,i)i--;else{let i=(t+(u<l-1&&r||0))/(u+1)|0;if((s[i]||(s[i]=[])).push(c),++f===e)return s}}return s}function st(t,e,i,n,r){const s=a(),o=[];for(let t,i=0;i<e.length;i++){t=e[i];for(let e=0;e<t.length;e++)s[t[e]]=1}if(r){for(let e,r=0;r<t.length;r++)if(e=t[r],s[e])if(n)n--;else if(o.push(e),s[e]=0,i&&0===--i)break}else for(let i,n,r=0;r<t.result.length;r++)for(i=t.result[r],e=0;e<i.length;e++)n=i[e],s[n]&&((o[r]||(o[r]=[])).push(n),s[n]=0);return o}function ot(t){const e=[],i=a(),n=a();for(let r,s,o,a,c,l,h,u=0;u<t.length;u++){r=t[u],s=r.field,o=r.result;for(let t=0;t<o.length;t++)c=o[t],"object"!=typeof c?c={id:a=c}:a=c.id,(l=i[a])?l.push(s):(c.field=i[a]=[s],e.push(c)),(h=c.highlight)&&(l=n[a],l||(n[a]=l={},c.highlight=l),l[s]=h)}return e}function at(t,e,i,n,r){return(t=this.tag.get(t))&&(t=t.get(e))?((e=t.length-n)>0&&((i&&e>i||n)&&(t=t.slice(n,n+i)),r&&(t=ct.call(this,t))),t):[]}function ct(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);const e=Array(t.length);for(let i,n=0;n<t.length;n++)i=t[n],e[n]={id:i,doc:this.store.get(i)};return e}function lt(t){if(!this||this.constructor!==lt)return new lt(t);const e=t.document||t.doc||t;let i,n;if(this.B=[],this.field=[],this.D=[],this.key=(i=e.key||e.id)&&ut(i,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new O(n):new Set:n?new N(n):new Map,this.h=(i=e.store||null)&&i&&!0!==i&&[],this.store=i?n?new N(n):new Map:null,this.cache=(i=t.cache||null)&&new w(i),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=ht.call(this,t,e),this.tag=null,(i=e.tag)&&("string"==typeof i&&(i=[i]),i.length)){this.tag=new Map,this.A=[],this.F=[];for(let t,e,n=0;n<i.length;n++){if(t=i[n],e=t.field||t,!e)throw Error("The tag field from the document descriptor is undefined.");t.custom?this.A[n]=t.custom:(this.A[n]=ut(e,this.D),t.filter&&("string"==typeof this.A[n]&&(this.A[n]=new String(this.A[n])),this.A[n].G=t.filter)),this.F[n]=e,this.tag.set(e,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(const e of this.index.values())e.then&&t.push(e);if(t.length){const e=this;return Promise.all(t).then(function(t){let i=0;for(const n of e.index.entries()){const r=n[0];let s=n[1];s.then&&(s=t[i],e.index.set(r,s),i++)}return e})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}function ht(t,e){const i=new Map;let n=e.index||e.field||e;c(n)&&(n=[n]);for(let e,s,o=0;o<n.length;o++){if(e=n[o],c(e)||(s=e,e=e.field),s=l(s)?Object.assign({},t,s):t,this.worker){var r=void 0;r=new q(s,r=(r=s.encoder)&&r.encode?r:new g("string"==typeof r?P[r]:r||{})),i.set(e,r)}this.worker||i.set(e,new Ft(s,this.reg)),s.custom?this.B[o]=s.custom:(this.B[o]=ut(e,this.D),s.filter&&("string"==typeof this.B[o]&&(this.B[o]=new String(this.B[o])),this.B[o].G=s.filter)),this.field[o]=e}if(this.h){c(t=e.store)&&(t=[t]);for(let e,i,n=0;n<t.length;n++)e=t[n],i=e.field||e,e.custom?(this.h[n]=e.custom,e.custom.O=i):(this.h[n]=ut(i,this.D),e.filter&&("string"==typeof this.h[n]&&(this.h[n]=new String(this.h[n])),this.h[n].G=e.filter))}return i}function ut(t,e){const i=t.split(":");let n=0;for(let r=0;r<i.length;r++)"]"===(t=i[r])[t.length-1]&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(i[n++]=t);return n<i.length&&(i.length=n),n>1?i:i[0]}function ft(t,e=0){let i=[],n=[];e&&(e=25e4/e*5e3|0);for(const r of t.entries())n.push(r),n.length===e&&(i.push(n),n=[]);return n.length&&i.push(n),i}function dt(t,e){e||(e=new Map);for(let i,n=0;n<t.length;n++)i=t[n],e.set(i[0],i[1]);return e}function pt(t,e=0){let i=[],n=[];e&&(e=25e4/e*1e3|0);for(const r of t.entries())n.push([r[0],ft(r[1])[0]||[]]),n.length===e&&(i.push(n),n=[]);return n.length&&i.push(n),i}function mt(t,e){e||(e=new Map);for(let i,n,r=0;r<t.length;r++)i=t[r],n=e.get(i[0]),e.set(i[0],dt(i[1],n));return e}function gt(t){let e=[],i=[];for(const n of t.keys())i.push(n),25e4===i.length&&(e.push(i),i=[]);return i.length&&e.push(i),e}function yt(t,e){e||(e=new Set);for(let i=0;i<t.length;i++)e.add(t[i]);return e}function _t(t,e,i,n,r,s,o=0){const a=n&&n.constructor===Array;var c=a?n.shift():n;if(!c)return this.export(t,e,r,s+1);if((c=t((e?e+".":"")+(o+1)+"."+i,JSON.stringify(c)))&&c.then){const l=this;return c.then(function(){return _t.call(l,t,e,i,a?n:null,r,s,o+1)})}return _t.call(this,t,e,i,a?n:null,r,s,o+1)}function wt(t,e){let i="";for(const n of t.entries()){t=n[0];const r=n[1];let s="";for(let t,i=0;i<r.length;i++){t=r[i]||[""];let n="";for(let i=0;i<t.length;i++)n+=(n?",":"")+("string"===e?'"'+t[i]+'"':t[i]);n="["+n+"]",s+=(s?",":"")+n}s='["'+t+'",['+s+"]]",i+=(i?",":"")+s}return i}function bt(t,e){let i=0;var n=void 0===e;if(t.constructor===Array){for(let r,s,o,a=0;a<t.length;a++)if((r=t[a])&&r.length){if(n)return 1;if(s=r.indexOf(e),s>=0){if(r.length>1)return r.splice(s,1),1;if(delete t[a],i)return 1;o=1}else{if(o)return 1;i++}}}else for(let r of t.entries())n=r[0],bt(r[1],e)?i++:t.delete(n);return i}U("add"),U("append"),U("search"),U("update"),U("remove"),U("clear"),U("export"),U("import"),q.prototype.searchCache=_,z(q.prototype),lt.prototype.add=function(t,e,i){if(l(t)&&(t=h(e=t,this.key)),e&&(t||0===t)){if(!i&&this.reg.has(t))return this.update(t,e);for(let s,o=0;o<this.field.length;o++){s=this.B[o];var n=this.index.get(this.field[o]);if("function"==typeof s){var r=s(e);r&&n.add(t,r,i,!0)}else(!(r=s.G)||r(e))&&(s.constructor===String?s=[""+s]:c(s)&&(s=[s]),Y(e,s,this.D,0,n,t,s[0],i))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];r=this.tag.get(this.F[n]);let l=a();if("function"==typeof s){if(!(s=s(e)))continue}else{var o=s.G;if(o&&!o(e))continue;s.constructor===String&&(s=""+s),s=h(e,s)}if(r&&s){c(s)&&(s=[s]);for(let e,n,a=0;a<s.length;a++)if(e=s[a],!l[e]&&(l[e]=1,(o=r.get(e))?n=o:r.set(e,n=[]),!i||!n.includes(t))){if(n.length===2**31-1){if(o=new F(n),this.fastupdate)for(let t of this.reg.values())t.includes(n)&&(t[t.indexOf(n)]=o);r.set(e,n=o)}n.push(t),this.fastupdate&&((o=this.reg.get(t))?o.push(n):this.reg.set(t,[n]))}}}if(this.store&&(!i||!this.store.has(t))){let n;if(this.h){n=a();for(let t,r=0;r<this.h.length;r++){if(t=this.h[r],(i=t.G)&&!i(e))continue;let s;if("function"==typeof t){if(s=t(e),!s)continue;t=[t.O]}else if(c(t)||t.constructor===String){n[t]=e[t];continue}H(e,n,t,0,t[0],s)}}this.store.set(t,n||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this},et.prototype.or=function(){return J(this,"or",K,arguments)},et.prototype.and=function(){return J(this,"and",X,arguments)},et.prototype.xor=function(){return J(this,"xor",Q,arguments)},et.prototype.not=function(){return J(this,"not",Z,arguments)},(r=et.prototype).limit=function(t){if(this.await){const e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){const e=[];for(let i,n=0;n<this.result.length;n++)if(i=this.result[n]){if(!(i.length<=t)){e[n]=i.slice(0,t);break}if(e[n]=i,!(t-=i.length))break}this.result=e}return this},r.offset=function(t){if(this.await){const e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){const e=[];for(let i,n=0;n<this.result.length;n++)(i=this.result[n])&&(i.length<=t?t-=i.length:(e[n]=i.slice(t),t=0));this.result=e}return this},r.boost=function(t){if(this.await){const e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this},r.resolve=function(t,e,i,n,r){let s=this.await?it(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(t,e,i,n,r)})}return s.length&&("object"==typeof t?(n=t.highlight||this.highlight,i=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,i=!!n||i),s=r?i?ct.call(this.index,s):s:V.call(this.index,s,t||100,e,i)),this.finalize(s,n)},r.finalize=function(t,e){if(t.then){const i=this;return t.then(function(t){return i.finalize(t,e)})}e&&t.length&&this.query&&(t=tt(this.query,t,this.index.index,this.field,e));const i=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",i&&i(t),t},a(),lt.prototype.search=function(t,e,i,n){i||(!e&&l(t)?(i=t,t=""):l(e)&&(i=e,e=0));let r=[];var s=[];let a,h,u,f,d,p,m,g,y=0,_=!0;if(i){i.constructor===Array&&(i={index:i}),t=i.query||t,a=i.pluck,h=i.merge,f=i.boost,p=a||i.field||(p=i.index)&&(p.index?null:p);var w=this.tag&&i.tag;u=i.suggest,_=!1!==i.resolve,d=i.cache,m=_&&this.store&&i.highlight;var b=!!m||_&&this.store&&i.enrich;e=i.limit||e;var v=i.offset||0;if(e||(e=_?100:0),w&&(!this.db||!n)){w.constructor!==Array&&(w=[w]);var S=[];for(let t,e=0;e<w.length;e++)if(t=w[e],t.field&&t.tag){var E=t.tag;if(E.constructor===Array)for(var k=0;k<E.length;k++)S.push(t.field,E[k]);else S.push(t.field,E)}else{E=Object.keys(t);for(let e,i,n=0;n<E.length;n++)if(e=E[n],i=t[e],i.constructor===Array)for(k=0;k<i.length;k++)S.push(e,i[k]);else S.push(e,i)}if(w=S,!t){if(s=[],S.length)for(w=0;w<S.length;w+=2){if(this.db){if(!(n=this.index.get(S[w])))continue;s.push(n=n.db.tag(S[w+1],e,v,b))}else n=at.call(this,S[w],S[w+1],e,v,b);r.push(_?{field:S[w],tag:S[w+1],result:n}:[n])}if(s.length){const t=this;return Promise.all(s).then(function(e){for(let t=0;t<e.length;t++)_?r[t].result=e[t]:r[t]=e[t];return _?r:new et(r.length>1?nt(r,1,0,0,u,f):r[0],t)})}return _?r:new et(r.length>1?nt(r,1,0,0,u,f):r[0],this)}}_||a||!(p=p||this.field)||(c(p)?a=p:(p.constructor===Array&&1===p.length&&(p=p[0]),a=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field),S=(this.worker||this.db)&&!n&&[];for(let a,l,h,f=0;f<p.length;f++){if(l=p[f],this.db&&this.tag&&!this.B[f])continue;let P;if(c(l)||(P=l,l=P.field,t=P.query||t,e=o(P.limit,e),v=o(P.offset,v),u=o(P.suggest,u),m=_&&this.store&&o(P.highlight,m),b=!!m||_&&this.store&&o(P.enrich,b),d=o(P.cache,d)),n)a=n[f];else{k=(E=P||i||{}).enrich;var x=this.index.get(l);if(w&&(this.db&&(E.tag=w,E.field=p,g=x.db.support_tag_search),!g&&k&&(E.enrich=!1),g||(E.limit=0,E.offset=0)),a=d?x.searchCache(t,w&&!g?0:e,E):x.search(t,w&&!g?0:e,E),w&&!g&&(E.limit=e,E.offset=v),k&&(E.enrich=k),S){S[f]=a;continue}}if(h=(a=a.result||a)&&a.length,w&&h){if(E=[],k=0,this.db&&n){if(!g)for(x=p.length;x<n.length;x++){let t=n[x];if(t&&t.length)k++,E.push(t);else if(!u)return _?r:new et(r,this)}}else for(let t,e,i=0;i<w.length;i+=2){if(t=this.tag.get(w[i]),!t){if(u)continue;return _?r:new et(r,this)}if(e=(t=t&&t.get(w[i+1]))&&t.length)k++,E.push(t);else if(!u)return _?r:new et(r,this)}if(k){if(a=st(a,E,e,v,_),h=a.length,!h&&!u)return _?a:new et(a,this);k--}}if(h)s[y]=l,r.push(a),y++;else if(1===p.length)return _?r:new et(r,this)}if(S){if(this.db&&w&&w.length&&!g)for(b=0;b<w.length;b+=2){if(!(s=this.index.get(w[b]))){if(u)continue;return _?r:new et(r,this)}S.push(s.db.tag(w[b+1],e,v,!1))}const n=this;return Promise.all(S).then(function(r){return i&&(i.resolve=_),r.length&&(r=n.search(t,e,i,r)),r})}if(!y)return _?r:new et(r,this);if(a&&(!b||!this.store))return r=r[0],_?r:new et(r,this);for(S=[],v=0;v<s.length;v++){if(w=r[v],b&&w.length&&void 0===w[0].doc&&(this.db?S.push(w=this.index.get(this.field[0]).db.enrich(w)):w=ct.call(this,w)),a)return _?m?tt(t,w,this.index,a,m):w:new et(w,this);r[v]={field:s[v],result:w}}if(b&&this.db&&S.length){const e=this;return Promise.all(S).then(function(i){for(let t=0;t<i.length;t++)r[t].result=i[t];return m&&(r=tt(t,r,e.index,a,m)),h?ot(r):r})}return m&&(r=tt(t,r,this.index,a,m)),h?ot(r):r},(r=lt.prototype).mount=function(t){let e=this.field;if(this.tag)for(let t,n=0;n<this.F.length;n++){t=this.F[n];var i=void 0;this.index.set(t,i=new Ft({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(t),i.tag=this.tag.get(t)}i=[];const n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let r,s,o=0;o<e.length;o++){n.field=s=e[o],r=this.index.get(s);const a=new t.constructor(t.id,n);a.id=t.id,i[o]=a.mount(r),r.document=!0,o?r.bypass=!0:r.store=this.store}const r=this;return this.db=Promise.all(i).then(function(){r.db=!0})},r.commit=async function(){const t=[];for(const e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()},r.destroy=function(){const t=[];for(const e of this.index.values())t.push(e.destroy());return Promise.all(t)},r.append=function(t,e){return this.add(t,e,!0)},r.update=function(t,e){return this.remove(t).add(t,e)},r.remove=function(t){for(var e of(l(t)&&(t=h(t,this.key)),this.index.values()))e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let i of this.tag.values())for(let n of i){e=n[0];const r=n[1],s=r.indexOf(t);s>-1&&(r.length>1?r.splice(s,1):i.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this},r.clear=function(){const t=[];for(const e of this.index.values()){const i=e.clear();i.then&&t.push(i)}if(this.tag)for(const t of this.tag.values())t.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this},r.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)},r.cleanup=function(){for(const t of this.index.values())t.cleanup();return this},r.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(t){return t[0]&&t[0].doc||null}):this.store.get(t)||null},r.set=function(t,e){return"object"==typeof t&&(t=h(e=t,this.key)),this.store.set(t,e),this},r.searchCache=_,r.export=function(t,e,i=0,n=0){if(i<this.field.length){const r=this.field[i];if((e=this.index.get(r).export(t,r,i,n=1))&&e.then){const n=this;return e.then(function(){return n.export(t,r,i+1)})}return this.export(t,r,i+1)}let r,s;switch(n){case 0:r="reg",s=gt(this.reg),e=null;break;case 1:r="tag",s=this.tag&&pt(this.tag,this.reg.size),e=null;break;case 2:r="doc",s=this.store&&ft(this.store),e=null;break;default:return}return _t.call(this,t,e,r,s||null,i,n)},r.import=function(t,e){var i=t.split(".");"json"===i[i.length-1]&&i.pop();const n=i.length>2?i[0]:"";if(i=i.length>2?i[2]:i[1],this.worker&&n)return this.index.get(n).import(t);if(e){if("string"==typeof e&&(e=JSON.parse(e)),n)return this.index.get(n).import(i,e);switch(i){case"reg":this.fastupdate=!1,this.reg=yt(e,this.reg);for(let t,e=0;e<this.field.length;e++)t=this.index.get(this.field[e]),t.fastupdate=!1,t.reg=this.reg;if(this.worker){e=[];for(const i of this.index.values())e.push(i.import(t));return Promise.all(e)}break;case"tag":this.tag=mt(e,this.tag);break;case"doc":this.store=dt(e,this.store)}}},z(lt.prototype),Ft.prototype.remove=function(t,e){const i=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(i){if(this.fastupdate){for(let e,n,r=0;r<i.length;r++)if((e=i[r])&&(n=e.length))if(e[n-1]===t)e.pop();else{const i=e.indexOf(t);i>=0&&e.splice(i,1)}}else bt(this.map,t),this.depth&&bt(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&Nt(this)),this.cache&&this.cache.remove(t),this};const vt={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};function St(t,e,i,n,r,s,o){let c,l;if(!(c=e[i])||o&&!c[o]){if(o?((e=c||(e[i]=a()))[o]=1,l=t.ctx,(c=l.get(o))?l=c:l.set(o,l=t.keystore?new N(t.keystore):new Map)):(l=t.map,e[i]=1),(c=l.get(i))?l=c:l.set(i,l=c=[]),s)for(let i,s=0;s<c.length;s++)if((i=c[s])&&i.includes(r)){if(s<=n)return;i.splice(i.indexOf(r),1),t.fastupdate&&(e=t.reg.get(r))&&e.splice(e.indexOf(i),1);break}if(l=l[n]||(l[n]=[]),l.push(r),l.length===2**31-1){if(e=new F(l),t.fastupdate)for(let i of t.reg.values())i.includes(l)&&(i[i.indexOf(l)]=e);c[n]=l=e}t.fastupdate&&((n=t.reg.get(r))?n.push(l):t.reg.set(r,[l]))}}function Et(t,e,i,n,r){return i&&t>1?e+(n||0)<=t?i+(r||0):(t-1)/(e+(n||0))*(i+(r||0))+1|0:0}function kt(t,e,i,n,r,s,o){let a=t.length,c=t;if(a>1)c=nt(t,e,i,n,r,s,o);else if(1===a)return o?V.call(null,t[0],i,n):new et(t[0],this);return o?c:new et(c,this)}function xt(t,e,i,n,r,s,o){return t=Dt(this,t,e,i,n,r,s,o),this.db?t.then(function(t){return r?t||[]:new et(t,this)}):t&&t.length?r?V.call(this,t,i,n):new et(t,this):r?[]:new et([],this)}function Pt(t,e,i,n){let r=[];if(t&&t.length){if(t.length<=n)return void e.push(t);for(let e,i=0;i<n;i++)(e=t[i])&&(r[i]=e);if(r.length)return void e.push(r)}if(!i)return r}function Dt(t,e,i,n,r,s,o,a){let c;return i&&(c=t.bidirectional&&e>i)&&(c=i,i=e,e=c),t.db?t.db.get(e,i,n,r,s,o,a):t=i?(t=t.ctx.get(i))&&t.get(e):t.map.get(e)}function Ft(t,e){if(!this||this.constructor!==Ft)return new Ft(t);if(t){var i=c(t)?t:t.preset;i&&(t=Object.assign({},vt[i],t))}else t={};const n=!0===(i=t.context)?{depth:1}:i||{},r=c(t.encoder)?P[t.encoder]:t.encode||t.encoder||{};this.encoder=r.encode?r:"object"==typeof r?new g(r):{encode:r},this.resolution=t.resolution||9,this.tokenize=i=(i=t.tokenize)&&"default"!==i&&"exact"!==i&&i||"strict",this.depth="strict"===i&&n.depth||0,this.bidirectional=!1!==n.bidirectional,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(i=t.keystore||0)&&(this.keystore=i),this.map=i?new N(i):new Map,this.ctx=i?new N(i):new Map,this.reg=e||(this.fastupdate?i?new N(i):new Map:i?new O(i):new Set),this.N=n.resolution||3,this.rtl=r.rtl||t.rtl||!1,this.cache=(i=t.cache||null)&&new w(i),this.resolve=!1!==t.resolve,(i=t.db)&&(this.db=this.mount(i)),this.M=!1!==t.commit,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}function Nt(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}Ft.prototype.add=function(t,e,i,n){if(e&&(t||0===t)){if(!n&&!i&&this.reg.has(t))return this.update(t,e);n=this.depth;const h=(e=this.encoder.encode(e,!n)).length;if(h){const u=a(),f=a(),d=this.resolution;for(let a=0;a<h;a++){let p=e[this.rtl?h-1-a:a];var r=p.length;if(r&&(n||!f[p])){var s=this.score?this.score(e,p,a,null,0):Et(d,h,a),o="";switch(this.tokenize){case"tolerant":if(St(this,f,p,s,t,i),r>2){for(let e,n,a,c,l=1;l<r-1;l++)e=p.charAt(l),n=p.charAt(l+1),a=p.substring(0,l)+n,c=p.substring(l+2),St(this,f,o=a+e+c,s,t,i),St(this,f,o=a+c,s,t,i);St(this,f,p.substring(0,p.length-1),s,t,i)}break;case"full":if(r>2){for(let n,l=0;l<r;l++)for(s=r;s>l;s--){o=p.substring(l,s),n=this.rtl?r-1-l:l;var c=this.score?this.score(e,p,a,o,n):Et(d,h,a,r,n);St(this,f,o,c,t,i)}break}case"bidirectional":case"reverse":if(r>1){for(c=r-1;c>0;c--){o=p[this.rtl?r-1-c:c]+o;var l=this.score?this.score(e,p,a,o,c):Et(d,h,a,r,c);St(this,f,o,l,t,i)}o=""}case"forward":if(r>1){for(c=0;c<r;c++)St(this,f,o+=p[this.rtl?r-1-c:c],s,t,i);break}default:if(St(this,f,p,s,t,i),n&&h>1&&a<h-1)for(r=this.N,o=p,s=Math.min(n+1,this.rtl?a+1:h-a),c=1;c<s;c++){p=e[this.rtl?h-1-a-c:a+c];St(this,u,(l=this.bidirectional&&p>o)?o:p,this.score?this.score(e,o,a,p,c-1):Et(r+(h/2>r?0:1),h,a,s-1,c-1),t,i,l?p:o)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(i?{ins:t}:{del:t}),this.M&&Nt(this)),this},Ft.prototype.search=function(t,e,i){if(i||(e||"object"!=typeof t?"object"==typeof e&&(i=e,e=0):(i=t,t="")),i&&i.cache)return i.cache=!1,t=this.searchCache(t,e,i),i.cache=!0,t;let n,r,s,o,c,l,h,u,f=[],d=0;i&&(t=i.query||t,e=i.limit||e,d=i.offset||0,r=i.context,s=i.suggest,u=(o=i.resolve)&&i.enrich,l=i.boost,h=i.resolution,c=this.db&&i.tag),void 0===o&&(o=this.resolve),r=this.depth&&!1!==r;let p=this.encoder.encode(t,!r);if(n=p.length,e=e||(o?100:0),1===n)return xt.call(this,p[0],"",e,d,o,u,c);if(2===n&&r&&!s)return xt.call(this,p[1],p[0],e,d,o,u,c);let m,g=a(),y=0;if(r&&(m=p[0],y=1),h||0===h||(h=m?this.N:this.resolution),this.db){if(this.db.search&&!1!==(i=this.db.search(this,p,e,d,s,o,u,c)))return i;const t=this;return async function(){for(let e,i;y<n;y++){if((i=p[y])&&!g[i]){if(g[i]=1,e=await Dt(t,i,m,0,0,!1,!1),e=Pt(e,f,s,h)){f=e;break}m&&(s&&e&&f.length||(m=i))}s&&m&&y===n-1&&!f.length&&(h=t.resolution,m="",y=-1,g=a())}return kt(f,h,e,d,s,l,o)}()}for(let t,e;y<n;y++){if((e=p[y])&&!g[e]){if(g[e]=1,t=Dt(this,e,m,0,0,!1,!1),t=Pt(t,f,s,h)){f=t;break}m&&(s&&t&&f.length||(m=e))}s&&m&&y===n-1&&!f.length&&(h=this.resolution,m="",y=-1,g=a())}return kt(f,h,e,d,s,l,o)},(r=Ft.prototype).mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)},r.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},r.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()},r.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},r.append=function(t,e){return this.add(t,e,!0)},r.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)},r.update=function(t,e){const i=this,n=this.remove(t);return n&&n.then?n.then(()=>i.add(t,e)):this.add(t,e)},r.cleanup=function(){return this.fastupdate?(bt(this.map),this.depth&&bt(this.ctx),this):this},r.searchCache=_,r.export=function(t,e,i=0,n=0){let r,s;switch(n){case 0:r="reg",s=gt(this.reg);break;case 1:r="cfg",s=null;break;case 2:r="map",s=ft(this.map,this.reg.size);break;case 3:r="ctx",s=pt(this.ctx,this.reg.size);break;default:return}return _t.call(this,t,e,r,s,i,n)},r.import=function(t,e){if(e)switch("string"==typeof e&&(e=JSON.parse(e)),t=t.split("."),"json"===t[t.length-1]&&t.pop(),3===t.length&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=yt(e,this.reg);break;case"map":this.map=dt(e,this.map);break;case"ctx":this.ctx=mt(e,this.ctx)}},r.serialize=function(t=!0){let e="",i="",n="";if(this.reg.size){let t;for(var r of this.reg.keys())t||(t=typeof r),e+=(e?",":"")+("string"===t?'"'+r+'"':r);e="index.reg=new Set(["+e+"]);",i=wt(this.map,t),i="index.map=new Map(["+i+"]);";for(const e of this.ctx.entries()){r=e[0];let i=wt(e[1],t);i="new Map(["+i+"])",i='["'+r+'",'+i+"]",n+=(n?",":"")+i}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+i+n+"}":e+i+n},z(Ft.prototype);const Ot="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Tt=["map","ctx","tag","reg","cfg"],It=a();function jt(t,e={}){if(!this||this.constructor!==jt)return new jt(t,e);"object"==typeof t&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Rt(t,e,i){const n=t.value;let r,s=0;for(let t,o=0;o<n.length;o++){if(t=i?n:n[o]){for(let i,s,a=0;a<e.length;a++)if(s=e[a],i=t.indexOf(s),i>=0){if(r=1,!(t.length>1)){n[o]=[];break}t.splice(i,1)}s+=t.length}if(i)break}s?r&&t.update(n):t.delete(),t.continue()}function At(t,e){return new Promise((i,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,i(this.result)},t.onerror=t.onblocked=n,t=null})}(r=jt.prototype).mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())},r.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),It[t.id]||(It[t.id]=[]),It[t.id].push(t.field);const e=Ot.open(t.id,1);return e.onupgradeneeded=function(){const e=t.db=this.result;for(let i,n=0;n<Tt.length;n++){i=Tt[n];for(let n,r=0;r<It[t.id].length;r++)n=It[t.id][r],e.objectStoreNames.contains(i+("reg"!==i&&n?":"+n:""))||e.createObjectStore(i+("reg"!==i&&n?":"+n:""))}},t.db=At(e,function(e){t.db=e,t.db.onversionchange=function(){t.close()}})},r.close=function(){this.db&&this.db.close(),this.db=null},r.destroy=function(){return At(Ot.deleteDatabase(this.id))},r.clear=function(){const t=[];for(let e,i=0;i<Tt.length;i++){e=Tt[i];for(let i,n=0;n<It[this.id].length;n++)i=It[this.id][n],t.push(e+("reg"!==e&&i?":"+i:""))}const e=this.db.transaction(t,"readwrite");for(let i=0;i<t.length;i++)e.objectStore(t[i]).clear();return At(e)},r.get=function(t,e,i=0,n=0,r=!0,s=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);const o=this;return At(t).then(function(t){let e=[];if(!t||!t.length)return e;if(r){if(!i&&!n&&1===t.length)return t[0];for(let r,s=0;s<t.length;s++)if((r=t[s])&&r.length){if(n>=r.length){n-=r.length;continue}const t=i?n+Math.min(r.length-n,i):r.length;for(let i=n;i<t;i++)e.push(r[i]);if(n=0,e.length===i)break}return s?o.enrich(e):e}return t})},r.tag=function(t,e=0,i=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);const r=this;return At(t).then(function(t){return!t||!t.length||i>=t.length?[]:e||i?(t=t.slice(i,i+e),n?r.enrich(t):t):t})},r.enrich=function(t){"object"!=typeof t&&(t=[t]);const e=this.db.transaction("reg","readonly").objectStore("reg"),i=[];for(let n=0;n<t.length;n++)i[n]=At(e.get(t[n]));return Promise.all(i).then(function(e){for(let i=0;i<e.length;i++)e[i]={id:t[i],doc:e[i]?JSON.parse(e[i]):null};return e})},r.has=function(t){return At(t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t)).then(function(t){return!!t})},r.search=null,r.info=function(){},r.transaction=function(t,e,i){t+="reg"!==t&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return i.call(this,n);let r=this.db.transaction(t,e);this.h[t+":"+e]=n=r.objectStore(t);const s=i.call(this,n);return this.h[t+":"+e]=null,At(r).finally(function(){return s})},r.commit=async function(t){let e=t.commit_task,i=[];t.commit_task=[];for(let t,n=0;n<e.length;n++)t=e[n],t.del&&i.push(t.del);i.length&&await this.remove(i),t.reg.size&&(await this.transaction("map","readwrite",function(e){for(const i of t.map){const t=i[0],n=i[1];n.length&&(e.get(t).onsuccess=function(){let i=this.result;var r;if(i&&i.length){const t=Math.max(i.length,n.length);for(let e,s,o=0;o<t;o++)if((s=n[o])&&s.length){if((e=i[o])&&e.length)for(r=0;r<s.length;r++)e.push(s[r]);else i[o]=s;r=1}}else i=n,r=1;r&&e.put(i,t)})}}),await this.transaction("ctx","readwrite",function(e){for(const i of t.ctx){const t=i[0],n=i[1];for(const i of n){const n=i[0],r=i[1];r.length&&(e.get(t+":"+n).onsuccess=function(){let i=this.result;var s;if(i&&i.length){const t=Math.max(i.length,r.length);for(let e,n,o=0;o<t;o++)if((n=r[o])&&n.length){if((e=i[o])&&e.length)for(s=0;s<n.length;s++)e.push(n[s]);else i[o]=n;s=1}}else i=r,s=1;s&&e.put(i,t+":"+n)})}}}),t.store?await this.transaction("reg","readwrite",function(e){for(const i of t.store){const t=i[0],n=i[1];e.put("object"==typeof n?JSON.stringify(n):1,t)}}):t.bypass||await this.transaction("reg","readwrite",function(e){for(const i of t.reg.keys())e.put(1,i)}),t.tag&&await this.transaction("tag","readwrite",function(e){for(const i of t.tag){const t=i[0],n=i[1];n.length&&(e.get(t).onsuccess=function(){let i=this.result;i=i&&i.length?i.concat(n):n,e.put(i,t)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())},r.remove=function(t){return"object"!=typeof t&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){const e=this.result;e&&Rt(e,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){const e=this.result;e&&Rt(e,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){const e=this.result;e&&Rt(e,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let i=0;i<t.length;i++)e.delete(t[i])})])};const Ct={Index:Ft,Charset:P,Encoder:g,Document:lt,Worker:q,Resolver:et,IndexedDB:jt,Language:{}},Mt=void 0!==n?n:"undefined"!=typeof global?global:n;let Lt;(Lt=Mt.define)&&Lt.amd?Lt([],function(){return Ct}):"object"==typeof Mt.exports?Mt.exports=Ct:Mt.FlexSearch=Ct}(this||self)},3876(t,e,i){"use strict";const n=i(3735),r=i(6928),s=i(3798).mkdirsSync,o=i(7211).utimesMillisSync,a=i(6462);function c(t,e,i,s){const o=(s.dereference?n.statSync:n.lstatSync)(e);if(o.isDirectory())return function(t,e,i,r,s){return e?u(i,r,s):function(t,e,i,r){return n.mkdirSync(i),u(e,i,r),h(i,t)}(t.mode,i,r,s)}(o,t,e,i,s);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(t,e,i,r,s){return e?function(t,e,i,r){if(r.overwrite)return n.unlinkSync(i),l(t,e,i,r);if(r.errorOnExist)throw new Error(`'${i}' already exists`)}(t,i,r,s):l(t,i,r,s)}(o,t,e,i,s);if(o.isSymbolicLink())return function(t,e,i,s){let o=n.readlinkSync(e);s.dereference&&(o=r.resolve(process.cwd(),o));if(t){let t;try{t=n.readlinkSync(i)}catch(t){if("EINVAL"===t.code||"UNKNOWN"===t.code)return n.symlinkSync(o,i);throw t}if(s.dereference&&(t=r.resolve(process.cwd(),t)),o!==t){if(a.isSrcSubdir(o,t))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${t}'.`);if(a.isSrcSubdir(t,o))throw new Error(`Cannot overwrite '${t}' with '${o}'.`)}return function(t,e){return n.unlinkSync(e),n.symlinkSync(t,e)}(o,i)}return n.symlinkSync(o,i)}(t,e,i,s);if(o.isSocket())throw new Error(`Cannot copy a socket file: ${e}`);if(o.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${e}`);throw new Error(`Unknown file: ${e}`)}function l(t,e,i,r){return n.copyFileSync(e,i),r.preserveTimestamps&&function(t,e,i){(function(t){return!(128&t)})(t)&&function(t,e){h(t,128|e)}(i,t);(function(t,e){const i=n.statSync(t);o(e,i.atime,i.mtime)})(e,i)}(t.mode,e,i),h(i,t.mode)}function h(t,e){return n.chmodSync(t,e)}function u(t,e,i){const r=n.opendirSync(t);try{let n;for(;null!==(n=r.readSync());)f(n.name,t,e,i)}finally{r.closeSync()}}function f(t,e,i,n){const s=r.join(e,t),o=r.join(i,t);if(n.filter&&!n.filter(s,o))return;const{destStat:l}=a.checkPathsSync(s,o,"copy",n);return c(l,s,o,n)}t.exports=function(t,e,i){"function"==typeof i&&(i={filter:i}),(i=i||{}).clobber=!("clobber"in i)||!!i.clobber,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:o,destStat:l}=a.checkPathsSync(t,e,"copy",i);if(a.checkParentPathsSync(t,o,e,"copy"),i.filter&&!i.filter(t,e))return;const h=r.dirname(e);return n.existsSync(h)||s(h),c(l,t,e,i)}},4994(t,e,i){"use strict";const n=i(8737),r=i(6928),{mkdirs:s}=i(3798),{pathExists:o}=i(9288),{utimesMillis:a}=i(7211),c=i(6462),{asyncIteratorConcurrentProcess:l}=i(6322);async function h(t,e,i){return!i.filter||i.filter(t,e)}async function u(t,e,i,s){const o=s.dereference?n.stat:n.lstat,a=await o(e);if(a.isDirectory())return async function(t,e,i,s,o){e||await n.mkdir(s);await l(await n.opendir(i),async t=>{const e=r.join(i,t.name),n=r.join(s,t.name);if(await h(e,n,o)){const{destStat:t}=await c.checkPaths(e,n,"copy",o);await u(t,e,n,o)}}),e||await n.chmod(s,t.mode)}(a,t,e,i,s);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return async function(t,e,i,r,s){if(!e)return f(t,i,r,s);if(s.overwrite)return await n.unlink(r),f(t,i,r,s);if(s.errorOnExist)throw new Error(`'${r}' already exists`)}(a,t,e,i,s);if(a.isSymbolicLink())return async function(t,e,i,s){let o=await n.readlink(e);s.dereference&&(o=r.resolve(process.cwd(),o));if(!t)return n.symlink(o,i);let a=null;try{a=await n.readlink(i)}catch(t){if("EINVAL"===t.code||"UNKNOWN"===t.code)return n.symlink(o,i);throw t}s.dereference&&(a=r.resolve(process.cwd(),a));if(o!==a){if(c.isSrcSubdir(o,a))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${a}'.`);if(c.isSrcSubdir(a,o))throw new Error(`Cannot overwrite '${a}' with '${o}'.`)}return await n.unlink(i),n.symlink(o,i)}(t,e,i,s);if(a.isSocket())throw new Error(`Cannot copy a socket file: ${e}`);if(a.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${e}`);throw new Error(`Unknown file: ${e}`)}async function f(t,e,i,r){if(await n.copyFile(e,i),r.preserveTimestamps){128&t.mode||await function(t,e){return n.chmod(t,128|e)}(i,t.mode);const r=await n.stat(e);await a(i,r.atime,r.mtime)}return n.chmod(i,t.mode)}t.exports=async function(t,e,i={}){"function"==typeof i&&(i={filter:i}),i.clobber=!("clobber"in i)||!!i.clobber,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001");const{srcStat:n,destStat:a}=await c.checkPaths(t,e,"copy",i);if(await c.checkParentPaths(t,n,e,"copy"),!await h(t,e,i))return;const l=r.dirname(e);await o(l)||await s(l),await u(a,t,e,i)}},4423(t,e,i){"use strict";const n=i(1236).fromPromise;t.exports={copy:n(i(4994)),copySync:i(3876)}},2591(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(8737),s=i(6928),o=i(3798),a=i(5422),c=n(async function(t){let e;try{e=await r.readdir(t)}catch{return o.mkdirs(t)}return Promise.all(e.map(e=>a.remove(s.join(t,e))))});function l(t){let e;try{e=r.readdirSync(t)}catch{return o.mkdirsSync(t)}e.forEach(e=>{e=s.join(t,e),a.removeSync(e)})}t.exports={emptyDirSync:l,emptydirSync:l,emptyDir:c,emptydir:c}},9616(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(6928),s=i(8737),o=i(3798);t.exports={createFile:n(async function(t){let e;try{e=await s.stat(t)}catch{}if(e&&e.isFile())return;const i=r.dirname(t);let n=null;try{n=await s.stat(i)}catch(e){if("ENOENT"===e.code)return await o.mkdirs(i),void await s.writeFile(t,"");throw e}n.isDirectory()?await s.writeFile(t,""):await s.readdir(i)}),createFileSync:function(t){let e;try{e=s.statSync(t)}catch{}if(e&&e.isFile())return;const i=r.dirname(t);try{s.statSync(i).isDirectory()||s.readdirSync(i)}catch(t){if(!t||"ENOENT"!==t.code)throw t;o.mkdirsSync(i)}s.writeFileSync(t,"")}}},6288(t,e,i){"use strict";const{createFile:n,createFileSync:r}=i(9616),{createLink:s,createLinkSync:o}=i(1522),{createSymlink:a,createSymlinkSync:c}=i(5291);t.exports={createFile:n,createFileSync:r,ensureFile:n,ensureFileSync:r,createLink:s,createLinkSync:o,ensureLink:s,ensureLinkSync:o,createSymlink:a,createSymlinkSync:c,ensureSymlink:a,ensureSymlinkSync:c}},1522(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(6928),s=i(8737),o=i(3798),{pathExists:a}=i(9288),{areIdentical:c}=i(6462);t.exports={createLink:n(async function(t,e){let i,n;try{i=await s.lstat(e,{bigint:!0})}catch{}try{n=await s.lstat(t,{bigint:!0})}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}if(i&&c(n,i))return;const l=r.dirname(e);await a(l)||await o.mkdirs(l),await s.link(t,e)}),createLinkSync:function(t,e){let i;try{i=s.lstatSync(e,{bigint:!0})}catch{}try{const e=s.lstatSync(t,{bigint:!0});if(i&&c(e,i))return}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}const n=r.dirname(e);return s.existsSync(n)||o.mkdirsSync(n),s.linkSync(t,e)}}},3838(t,e,i){"use strict";const n=i(6928),r=i(8737),{pathExists:s}=i(9288),o=i(1236).fromPromise;t.exports={symlinkPaths:o(async function(t,e){if(n.isAbsolute(t)){try{await r.lstat(t)}catch(t){throw t.message=t.message.replace("lstat","ensureSymlink"),t}return{toCwd:t,toDst:t}}const i=n.dirname(e),o=n.join(i,t);if(await s(o))return{toCwd:o,toDst:t};try{await r.lstat(t)}catch(t){throw t.message=t.message.replace("lstat","ensureSymlink"),t}return{toCwd:t,toDst:n.relative(i,t)}}),symlinkPathsSync:function(t,e){if(n.isAbsolute(t)){if(!r.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}const i=n.dirname(e),s=n.join(i,t);if(r.existsSync(s))return{toCwd:s,toDst:t};if(!r.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:n.relative(i,t)}}}},7064(t,e,i){"use strict";const n=i(8737),r=i(1236).fromPromise;t.exports={symlinkType:r(async function(t,e){if(e)return e;let i;try{i=await n.lstat(t)}catch{return"file"}return i&&i.isDirectory()?"dir":"file"}),symlinkTypeSync:function(t,e){if(e)return e;let i;try{i=n.lstatSync(t)}catch{return"file"}return i&&i.isDirectory()?"dir":"file"}}},5291(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(6928),s=i(8737),{mkdirs:o,mkdirsSync:a}=i(3798),{symlinkPaths:c,symlinkPathsSync:l}=i(3838),{symlinkType:h,symlinkTypeSync:u}=i(7064),{pathExists:f}=i(9288),{areIdentical:d}=i(6462);t.exports={createSymlink:n(async function(t,e,i){let n;try{n=await s.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let i;if(r.isAbsolute(t))i=await s.stat(t,{bigint:!0});else{const n=r.dirname(e),o=r.join(n,t);try{i=await s.stat(o,{bigint:!0})}catch{i=await s.stat(t,{bigint:!0})}}const n=await s.stat(e,{bigint:!0});if(d(i,n))return}const a=await c(t,e);t=a.toDst;const l=await h(a.toCwd,i),u=r.dirname(e);return await f(u)||await o(u),s.symlink(t,e,l)}),createSymlinkSync:function(t,e,i){let n;try{n=s.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let i;if(r.isAbsolute(t))i=s.statSync(t,{bigint:!0});else{const n=r.dirname(e),o=r.join(n,t);try{i=s.statSync(o,{bigint:!0})}catch{i=s.statSync(t,{bigint:!0})}}const n=s.statSync(e,{bigint:!0});if(d(i,n))return}const o=l(t,e);t=o.toDst,i=u(o.toCwd,i);const c=r.dirname(e);return s.existsSync(c)||a(c),s.symlinkSync(t,e,i)}}},8737(t,e,i){"use strict";const n=i(1236).fromCallback,r=i(3735),s=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>"function"==typeof r[t]);Object.assign(e,r),s.forEach(t=>{e[t]=n(r[t])}),e.exists=function(t,e){return"function"==typeof e?r.exists(t,e):new Promise(e=>r.exists(t,e))},e.read=function(t,e,i,n,s,o){return"function"==typeof o?r.read(t,e,i,n,s,o):new Promise((o,a)=>{r.read(t,e,i,n,s,(t,e,i)=>{if(t)return a(t);o({bytesRead:e,buffer:i})})})},e.write=function(t,e,...i){return"function"==typeof i[i.length-1]?r.write(t,e,...i):new Promise((n,s)=>{r.write(t,e,...i,(t,e,i)=>{if(t)return s(t);n({bytesWritten:e,buffer:i})})})},e.readv=function(t,e,...i){return"function"==typeof i[i.length-1]?r.readv(t,e,...i):new Promise((n,s)=>{r.readv(t,e,...i,(t,e,i)=>{if(t)return s(t);n({bytesRead:e,buffers:i})})})},e.writev=function(t,e,...i){return"function"==typeof i[i.length-1]?r.writev(t,e,...i):new Promise((n,s)=>{r.writev(t,e,...i,(t,e,i)=>{if(t)return s(t);n({bytesWritten:e,buffers:i})})})},"function"==typeof r.realpath.native?e.realpath.native=n(r.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")},1605(t,e,i){"use strict";t.exports={...i(8737),...i(4423),...i(2591),...i(6288),...i(3376),...i(3798),...i(2455),...i(7024),...i(9288),...i(5422)}},3376(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(2934);r.outputJson=n(i(6426)),r.outputJsonSync=i(2188),r.outputJSON=r.outputJson,r.outputJSONSync=r.outputJsonSync,r.writeJSON=r.writeJson,r.writeJSONSync=r.writeJsonSync,r.readJSON=r.readJson,r.readJSONSync=r.readJsonSync,t.exports=r},2934(t,e,i){"use strict";const n=i(2909);t.exports={readJson:n.readFile,readJsonSync:n.readFileSync,writeJson:n.writeFile,writeJsonSync:n.writeFileSync}},2188(t,e,i){"use strict";const{stringify:n}=i(1144),{outputFileSync:r}=i(7024);t.exports=function(t,e,i){const s=n(e,i);r(t,s,i)}},6426(t,e,i){"use strict";const{stringify:n}=i(1144),{outputFile:r}=i(7024);t.exports=async function(t,e,i={}){const s=n(e,i);await r(t,s,i)}},3798(t,e,i){"use strict";const n=i(1236).fromPromise,{makeDir:r,makeDirSync:s}=i(8916),o=n(r);t.exports={mkdirs:o,mkdirsSync:s,mkdirp:o,mkdirpSync:s,ensureDir:o,ensureDirSync:s}},8916(t,e,i){"use strict";const n=i(8737),{checkPath:r}=i(7111),s=t=>"number"==typeof t?t:{mode:511,...t}.mode;t.exports.makeDir=async(t,e)=>(r(t),n.mkdir(t,{mode:s(e),recursive:!0})),t.exports.makeDirSync=(t,e)=>(r(t),n.mkdirSync(t,{mode:s(e),recursive:!0}))},7111(t,e,i){"use strict";const n=i(6928);t.exports.checkPath=function(t){if("win32"===process.platform){if(/[<>:"|?*]/.test(t.replace(n.parse(t).root,""))){const e=new Error(`Path contains invalid characters: ${t}`);throw e.code="EINVAL",e}}}},2455(t,e,i){"use strict";const n=i(1236).fromPromise;t.exports={move:n(i(3314)),moveSync:i(6244)}},6244(t,e,i){"use strict";const n=i(3735),r=i(6928),s=i(4423).copySync,o=i(5422).removeSync,a=i(3798).mkdirpSync,c=i(6462);function l(t,e,i){try{n.renameSync(t,e)}catch(n){if("EXDEV"!==n.code)throw n;return function(t,e,i){const n={overwrite:i,errorOnExist:!0,preserveTimestamps:!0};return s(t,e,n),o(t)}(t,e,i)}}t.exports=function(t,e,i){const s=(i=i||{}).overwrite||i.clobber||!1,{srcStat:h,isChangingCase:u=!1}=c.checkPathsSync(t,e,"move",i);return c.checkParentPathsSync(t,h,e,"move"),function(t){const e=r.dirname(t);return r.parse(e).root===e}(e)||a(r.dirname(e)),function(t,e,i,r){if(r)return l(t,e,i);if(i)return o(e),l(t,e,i);if(n.existsSync(e))throw new Error("dest already exists.");return l(t,e,i)}(t,e,s,u)}},3314(t,e,i){"use strict";const n=i(8737),r=i(6928),{copy:s}=i(4423),{remove:o}=i(5422),{mkdirp:a}=i(3798),{pathExists:c}=i(9288),l=i(6462);t.exports=async function(t,e,i={}){const h=i.overwrite||i.clobber||!1,{srcStat:u,isChangingCase:f=!1}=await l.checkPaths(t,e,"move",i);await l.checkParentPaths(t,u,e,"move");const d=r.dirname(e);return r.parse(d).root!==d&&await a(d),async function(t,e,i,r){if(!r)if(i)await o(e);else if(await c(e))throw new Error("dest already exists.");try{await n.rename(t,e)}catch(n){if("EXDEV"!==n.code)throw n;await async function(t,e,i){const n={overwrite:i,errorOnExist:!0,preserveTimestamps:!0};return await s(t,e,n),o(t)}(t,e,i)}}(t,e,h,f)}},7024(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(8737),s=i(6928),o=i(3798),a=i(9288).pathExists;t.exports={outputFile:n(async function(t,e,i="utf-8"){const n=s.dirname(t);return await a(n)||await o.mkdirs(n),r.writeFile(t,e,i)}),outputFileSync:function(t,...e){const i=s.dirname(t);r.existsSync(i)||o.mkdirsSync(i),r.writeFileSync(t,...e)}}},9288(t,e,i){"use strict";const n=i(1236).fromPromise,r=i(8737);t.exports={pathExists:n(function(t){return r.access(t).then(()=>!0).catch(()=>!1)}),pathExistsSync:r.existsSync}},5422(t,e,i){"use strict";const n=i(3735),r=i(1236).fromCallback;t.exports={remove:r(function(t,e){n.rm(t,{recursive:!0,force:!0},e)}),removeSync:function(t){n.rmSync(t,{recursive:!0,force:!0})}}},6322(t){"use strict";t.exports={asyncIteratorConcurrentProcess:async function(t,e){const i=[];for await(const n of t)i.push(e(n).then(()=>null,t=>t??new Error("unknown error")));await Promise.all(i.map(t=>t.then(t=>{if(null!==t)throw t})))}}},6462(t,e,i){"use strict";const n=i(8737),r=i(6928),s=i(1236).fromPromise;function o(t,e){return void 0!==e.ino&&void 0!==e.dev&&e.ino===t.ino&&e.dev===t.dev}function a(t,e){const i=r.resolve(t).split(r.sep).filter(t=>t),n=r.resolve(e).split(r.sep).filter(t=>t);return i.every((t,e)=>n[e]===t)}function c(t,e,i){return`Cannot ${i} '${t}' to a subdirectory of itself, '${e}'.`}t.exports={checkPaths:s(async function(t,e,i,s){const{srcStat:l,destStat:h}=await function(t,e,i){const r=i.dereference?t=>n.stat(t,{bigint:!0}):t=>n.lstat(t,{bigint:!0});return Promise.all([r(t),r(e).catch(t=>{if("ENOENT"===t.code)return null;throw t})]).then(([t,e])=>({srcStat:t,destStat:e}))}(t,e,s);if(h){if(o(l,h)){const n=r.basename(t),s=r.basename(e);if("move"===i&&n!==s&&n.toLowerCase()===s.toLowerCase())return{srcStat:l,destStat:h,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(l.isDirectory()&&!h.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!l.isDirectory()&&h.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(l.isDirectory()&&a(t,e))throw new Error(c(t,e,i));return{srcStat:l,destStat:h}}),checkPathsSync:function(t,e,i,s){const{srcStat:l,destStat:h}=function(t,e,i){let r;const s=i.dereference?t=>n.statSync(t,{bigint:!0}):t=>n.lstatSync(t,{bigint:!0}),o=s(t);try{r=s(e)}catch(t){if("ENOENT"===t.code)return{srcStat:o,destStat:null};throw t}return{srcStat:o,destStat:r}}(t,e,s);if(h){if(o(l,h)){const n=r.basename(t),s=r.basename(e);if("move"===i&&n!==s&&n.toLowerCase()===s.toLowerCase())return{srcStat:l,destStat:h,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(l.isDirectory()&&!h.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!l.isDirectory()&&h.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(l.isDirectory()&&a(t,e))throw new Error(c(t,e,i));return{srcStat:l,destStat:h}},checkParentPaths:s(async function t(e,i,s,a){const l=r.resolve(r.dirname(e)),h=r.resolve(r.dirname(s));if(h===l||h===r.parse(h).root)return;let u;try{u=await n.stat(h,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(o(i,u))throw new Error(c(e,s,a));return t(e,i,h,a)}),checkParentPathsSync:function t(e,i,s,a){const l=r.resolve(r.dirname(e)),h=r.resolve(r.dirname(s));if(h===l||h===r.parse(h).root)return;let u;try{u=n.statSync(h,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(o(i,u))throw new Error(c(e,s,a));return t(e,i,h,a)},isSrcSubdir:a,areIdentical:o}},7211(t,e,i){"use strict";const n=i(8737),r=i(1236).fromPromise;t.exports={utimesMillis:r(async function(t,e,i){const r=await n.open(t,"r+");let s=null;try{await n.futimes(r,e,i)}catch(t){s=t}finally{try{await n.close(r)}catch(t){s||(s=t)}}if(s)throw s}),utimesMillisSync:function(t,e,i){const r=n.openSync(t,"r+");let s=null;try{n.futimesSync(r,e,i)}catch(t){s=t}finally{try{n.closeSync(r)}catch(t){s||(s=t)}}if(s)throw s}}},1283(t){"use strict";t.exports=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Object)var i={__proto__:e(t)};else i=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(t,e))}),i};var e=Object.getPrototypeOf||function(t){return t.__proto__}},3735(t,e,i){var n,r,s=i(9896),o=i(9106),a=i(1995),c=i(1283),l=i(9023);function h(t,e){Object.defineProperty(t,n,{get:function(){return e}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(n=Symbol.for("graceful-fs.queue"),r=Symbol.for("graceful-fs.previous")):(n="___graceful-fs.queue",r="___graceful-fs.previous");var u,f=function(){};if(l.debuglog?f=l.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(f=function(){var t=l.format.apply(l,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: "),console.error(t)}),!s[n]){var d=global[n]||[];h(s,d),s.close=function(t){function e(e,i){return t.call(s,e,function(t){t||g(),"function"==typeof i&&i.apply(this,arguments)})}return Object.defineProperty(e,r,{value:t}),e}(s.close),s.closeSync=function(t){function e(e){t.apply(s,arguments),g()}return Object.defineProperty(e,r,{value:t}),e}(s.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){f(s[n]),i(2613).equal(s[n].length,0)})}function p(t){o(t),t.gracefulify=p,t.createReadStream=function(e,i){return new t.ReadStream(e,i)},t.createWriteStream=function(e,i){return new t.WriteStream(e,i)};var e=t.readFile;t.readFile=function(t,i,n){"function"==typeof i&&(n=i,i=null);return function t(i,n,r,s){return e(i,n,function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof r&&r.apply(this,arguments):m([t,[i,n,r],e,s||Date.now(),Date.now()])})}(t,i,n)};var i=t.writeFile;t.writeFile=function(t,e,n,r){"function"==typeof n&&(r=n,n=null);return function t(e,n,r,s,o){return i(e,n,r,function(i){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof s&&s.apply(this,arguments):m([t,[e,n,r,s],i,o||Date.now(),Date.now()])})}(t,e,n,r)};var n=t.appendFile;n&&(t.appendFile=function(t,e,i,r){"function"==typeof i&&(r=i,i=null);return function t(e,i,r,s,o){return n(e,i,r,function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof s&&s.apply(this,arguments):m([t,[e,i,r,s],n,o||Date.now(),Date.now()])})}(t,e,i,r)});var r=t.copyFile;r&&(t.copyFile=function(t,e,i,n){"function"==typeof i&&(n=i,i=0);return function t(e,i,n,s,o){return r(e,i,n,function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof s&&s.apply(this,arguments):m([t,[e,i,n,s],r,o||Date.now(),Date.now()])})}(t,e,i,n)});var s=t.readdir;t.readdir=function(t,e,i){"function"==typeof e&&(i=e,e=null);var n=c.test(process.version)?function(t,e,i,n){return s(t,r(t,e,i,n))}:function(t,e,i,n){return s(t,e,r(t,e,i,n))};return n(t,e,i);function r(t,e,i,r){return function(s,o){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?(o&&o.sort&&o.sort(),"function"==typeof i&&i.call(this,s,o)):m([n,[t,e,i],s,r||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var l=a(t);g=l.ReadStream,y=l.WriteStream}var h=t.ReadStream;h&&(g.prototype=Object.create(h.prototype),g.prototype.open=function(){var t=this;w(t.path,t.flags,t.mode,function(e,i){e?(t.autoClose&&t.destroy(),t.emit("error",e)):(t.fd=i,t.emit("open",i),t.read())})});var u=t.WriteStream;u&&(y.prototype=Object.create(u.prototype),y.prototype.open=function(){var t=this;w(t.path,t.flags,t.mode,function(e,i){e?(t.destroy(),t.emit("error",e)):(t.fd=i,t.emit("open",i))})}),Object.defineProperty(t,"ReadStream",{get:function(){return g},set:function(t){g=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return y},set:function(t){y=t},enumerable:!0,configurable:!0});var f=g;Object.defineProperty(t,"FileReadStream",{get:function(){return f},set:function(t){f=t},enumerable:!0,configurable:!0});var d=y;function g(t,e){return this instanceof g?(h.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function y(t,e){return this instanceof y?(u.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}Object.defineProperty(t,"FileWriteStream",{get:function(){return d},set:function(t){d=t},enumerable:!0,configurable:!0});var _=t.open;function w(t,e,i,n){return"function"==typeof i&&(n=i,i=null),function t(e,i,n,r,s){return _(e,i,n,function(o,a){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof r&&r.apply(this,arguments):m([t,[e,i,n,r],o,s||Date.now(),Date.now()])})}(t,e,i,n)}return t.open=w,t}function m(t){f("ENQUEUE",t[0].name,t[1]),s[n].push(t),y()}function g(){for(var t=Date.now(),e=0;e<s[n].length;++e)s[n][e].length>2&&(s[n][e][3]=t,s[n][e][4]=t);y()}function y(){if(clearTimeout(u),u=void 0,0!==s[n].length){var t=s[n].shift(),e=t[0],i=t[1],r=t[2],o=t[3],a=t[4];if(void 0===o)f("RETRY",e.name,i),e.apply(null,i);else if(Date.now()-o>=6e4){f("TIMEOUT",e.name,i);var c=i.pop();"function"==typeof c&&c.call(null,r)}else{var l=Date.now()-a,h=Math.max(a-o,1);l>=Math.min(1.2*h,100)?(f("RETRY",e.name,i),e.apply(null,i.concat([o]))):s[n].push(t)}void 0===u&&(u=setTimeout(y,0))}}global[n]||h(global,s[n]),t.exports=p(c(s)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!s.__patched&&(t.exports=p(s),s.__patched=!0)},1995(t,e,i){var n=i(2203).Stream;t.exports=function(t){return{ReadStream:function e(i,r){if(!(this instanceof e))return new e(i,r);n.call(this);var s=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),a=0,c=o.length;a<c;a++){var l=o[a];this[l]=r[l]}this.encoding&&this.setEncoding(this.encoding);if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick(function(){s._read()});t.open(this.path,this.flags,this.mode,function(t,e){if(t)return s.emit("error",t),void(s.readable=!1);s.fd=e,s.emit("open",e),s._read()})},WriteStream:function e(i,r){if(!(this instanceof e))return new e(i,r);n.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var s=Object.keys(r),o=0,a=s.length;o<a;o++){var c=s[o];this[c]=r[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}}},9106(t,e,i){var n=i(9140),r=process.cwd,s=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return s||(s=r.call(process)),s};try{process.cwd()}catch(t){}if("function"==typeof process.chdir){var a=process.chdir;process.chdir=function(t){s=null,a.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,a)}t.exports=function(t){n.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(t){t.lchmod=function(e,i,r){t.open(e,n.O_WRONLY|n.O_SYMLINK,i,function(e,n){e?r&&r(e):t.fchmod(n,i,function(e){t.close(n,function(t){r&&r(e||t)})})})},t.lchmodSync=function(e,i){var r,s=t.openSync(e,n.O_WRONLY|n.O_SYMLINK,i),o=!0;try{r=t.fchmodSync(s,i),o=!1}finally{if(o)try{t.closeSync(s)}catch(t){}else t.closeSync(s)}return r}}(t);t.lutimes||function(t){n.hasOwnProperty("O_SYMLINK")&&t.futimes?(t.lutimes=function(e,i,r,s){t.open(e,n.O_SYMLINK,function(e,n){e?s&&s(e):t.futimes(n,i,r,function(e){t.close(n,function(t){s&&s(e||t)})})})},t.lutimesSync=function(e,i,r){var s,o=t.openSync(e,n.O_SYMLINK),a=!0;try{s=t.futimesSync(o,i,r),a=!1}finally{if(a)try{t.closeSync(o)}catch(t){}else t.closeSync(o)}return s}):t.futimes&&(t.lutimes=function(t,e,i,n){n&&process.nextTick(n)},t.lutimesSync=function(){})}(t);t.chown=r(t.chown),t.fchown=r(t.fchown),t.lchown=r(t.lchown),t.chmod=e(t.chmod),t.fchmod=e(t.fchmod),t.lchmod=e(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(t,e,i){i&&process.nextTick(i)},t.lchmodSync=function(){});t.chown&&!t.lchown&&(t.lchown=function(t,e,i,n){n&&process.nextTick(n)},t.lchownSync=function(){});"win32"===o&&(t.rename="function"!=typeof t.rename?t.rename:function(e){function i(i,n,r){var s=Date.now(),o=0;e(i,n,function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-s<6e4)return setTimeout(function(){t.stat(n,function(t,s){t&&"ENOENT"===t.code?e(i,n,a):r(c)})},o),void(o<100&&(o+=10));r&&r(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(i,e),i}(t.rename));function e(e){return e?function(i,n,r){return e.call(t,i,n,function(t){l(t)&&(t=null),r&&r.apply(this,arguments)})}:e}function i(e){return e?function(i,n){try{return e.call(t,i,n)}catch(t){if(!l(t))throw t}}:e}function r(e){return e?function(i,n,r,s){return e.call(t,i,n,r,function(t){l(t)&&(t=null),s&&s.apply(this,arguments)})}:e}function s(e){return e?function(i,n,r){try{return e.call(t,i,n,r)}catch(t){if(!l(t))throw t}}:e}function a(e){return e?function(i,n,r){function s(t,e){e&&(e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296)),r&&r.apply(this,arguments)}return"function"==typeof n&&(r=n,n=null),n?e.call(t,i,n,s):e.call(t,i,s)}:e}function c(e){return e?function(i,n){var r=n?e.call(t,i,n):e.call(t,i);return r&&(r.uid<0&&(r.uid+=4294967296),r.gid<0&&(r.gid+=4294967296)),r}:e}function l(t){return!t||("ENOSYS"===t.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==t.code&&"EPERM"!==t.code))}t.read="function"!=typeof t.read?t.read:function(e){function i(i,n,r,s,o,a){var c;if(a&&"function"==typeof a){var l=0;c=function(h,u,f){if(h&&"EAGAIN"===h.code&&l<10)return l++,e.call(t,i,n,r,s,o,c);a.apply(this,arguments)}}return e.call(t,i,n,r,s,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(i,e),i}(t.read),t.readSync="function"!=typeof t.readSync?t.readSync:(h=t.readSync,function(e,i,n,r,s){for(var o=0;;)try{return h.call(t,e,i,n,r,s)}catch(t){if("EAGAIN"===t.code&&o<10){o++;continue}throw t}});var h}},2880(t,e,i){let n,r={};r.__wbindgen_placeholder__=t.exports;const{TextDecoder:s,TextEncoder:o}=i(9023);let a=null;function c(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(n.memory.buffer)),a}let l=new s("utf-8",{ignoreBOM:!0,fatal:!0});function h(t,e){return function(t,e){return l.decode(c().subarray(t,t+e))}(t>>>=0,e)}function u(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return`${t}`;if("string"==e)return`"${t}"`;if("symbol"==e){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==e){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const e=t.length;let i="[";e>0&&(i+=u(t[0]));for(let n=1;n<e;n++)i+=", "+u(t[n]);return i+="]",i}const i=/\[object ([^\]]+)\]/.exec(toString.call(t));let n;if(!(i&&i.length>1))return toString.call(t);if(n=i[1],"Object"==n)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:n}l.decode();let f=0;const d=new o("utf-8"),p="function"==typeof d.encodeInto?function(t,e){return d.encodeInto(t,e)}:function(t,e){const i=d.encode(t);return e.set(i),{read:t.length,written:i.length}};function m(t,e,i){if(void 0===i){const i=d.encode(t),n=e(i.length,1)>>>0;return c().subarray(n,n+i.length).set(i),f=i.length,n}let n=t.length,r=e(n,1)>>>0;const s=c();let o=0;for(;o<n;o++){const e=t.charCodeAt(o);if(e>127)break;s[r+o]=e}if(o!==n){0!==o&&(t=t.slice(o)),r=i(r,n,n=o+3*t.length,1)>>>0;const e=c().subarray(r+o,r+n);o+=p(t,e).written,r=i(r,n,o,1)>>>0}return f=o,r}let g=null;function y(){return(null===g||!0===g.buffer.detached||void 0===g.buffer.detached&&g.buffer!==n.memory.buffer)&&(g=new DataView(n.memory.buffer)),g}function _(t){return null==t}function w(t,e){t>>>=0;const i=y(),r=[];for(let s=t;s<t+4*e;s+=4)r.push(n.__wbindgen_export_2.get(i.getUint32(s,!0)));return n.__externref_drop_slice(t,e),r}function b(t){const e=n.__wbindgen_export_2.get(t);return n.__externref_table_dealloc(t),e}t.exports.cut=function(t,e){const i=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),r=f,s=n.cut(i,r,_(e)?16777215:e?1:0);var o=w(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},t.exports.cut_all=function(t){const e=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),i=f,r=n.cut_all(e,i);var s=w(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),s},t.exports.cut_for_search=function(t,e){const i=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),r=f,s=n.cut_for_search(i,r,_(e)?16777215:e?1:0);var o=w(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},t.exports.tokenize=function(t,e,i){const r=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),s=f,o=m(e,n.__wbindgen_malloc,n.__wbindgen_realloc),a=f,c=n.tokenize(r,s,o,a,_(i)?16777215:i?1:0);if(c[3])throw b(c[2]);var l=w(c[0],c[1]).slice();return n.__wbindgen_free(c[0],4*c[1],4),l},t.exports.add_word=function(t,e,i){const r=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),s=f;var o=_(i)?0:m(i,n.__wbindgen_malloc,n.__wbindgen_realloc),a=f;return n.add_word(r,s,_(e)?4294967297:e>>>0,o,a)>>>0},t.exports.tag=function(t,e){const i=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),r=f,s=n.tag(i,r,_(e)?16777215:e?1:0);var o=w(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},t.exports.with_dict=function(t){const e=m(t,n.__wbindgen_malloc,n.__wbindgen_realloc),i=f,r=n.with_dict(e,i);if(r[1])throw b(r[0])},t.exports.__wbg_Error_0497d5bdba9362e5=function(t,e){return Error(h(t,e))},t.exports.__wbg_new_07b483f72211fd66=function(){return new Object},t.exports.__wbg_set_3f1d0b984ed272ed=function(t,e,i){t[e]=i},t.exports.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},t.exports.__wbindgen_debug_string=function(t,e){const i=m(u(e),n.__wbindgen_malloc,n.__wbindgen_realloc),r=f;y().setInt32(t+4,r,!0),y().setInt32(t+0,i,!0)},t.exports.__wbindgen_init_externref_table=function(){const t=n.__wbindgen_export_2,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},t.exports.__wbindgen_number_new=function(t){return t},t.exports.__wbindgen_string_new=function(t,e){return h(t,e)},t.exports.__wbindgen_throw=function(t,e){throw new Error(h(t,e))};const v=i(6928).join(__dirname,"jieba_rs_wasm_bg.wasm"),S=i(9896).readFileSync(v),E=new WebAssembly.Module(S),k=new WebAssembly.Instance(E,r);n=k.exports,t.exports.__wasm=n,n.__wbindgen_start()},2909(t,e,i){let n;try{n=i(3735)}catch(t){n=i(9896)}const r=i(1236),{stringify:s,stripBom:o}=i(1144);const a=r.fromPromise(async function(t,e={}){"string"==typeof e&&(e={encoding:e});const i=e.fs||n,s=!("throws"in e)||e.throws;let a,c=await r.fromCallback(i.readFile)(t,e);c=o(c);try{a=JSON.parse(c,e?e.reviver:null)}catch(e){if(s)throw e.message=`${t}: ${e.message}`,e;return null}return a});const c=r.fromPromise(async function(t,e,i={}){const o=i.fs||n,a=s(e,i);await r.fromCallback(o.writeFile)(t,a,i)});t.exports={readFile:a,readFileSync:function(t,e={}){"string"==typeof e&&(e={encoding:e});const i=e.fs||n,r=!("throws"in e)||e.throws;try{let n=i.readFileSync(t,e);return n=o(n),JSON.parse(n,e.reviver)}catch(e){if(r)throw e.message=`${t}: ${e.message}`,e;return null}},writeFile:c,writeFileSync:function(t,e,i={}){const r=i.fs||n,o=s(e,i);return r.writeFileSync(t,o,i)}}},1144(t){t.exports={stringify:function(t,{EOL:e="\n",finalEOL:i=!0,replacer:n=null,spaces:r}={}){const s=i?e:"",o=JSON.stringify(t,n,r);if(void 0===o)throw new TypeError(`Converting ${typeof t} value to JSON is not supported`);return o.replace(/\n/g,e)+s},stripBom:function(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}}},9084(t,e,i){"use strict";e.S6=void 0,e.readdirp=g;const n=i(1455),r=i(7075),s=i(6760);e.S6={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"};const o={root:".",fileFilter:t=>!0,directoryFilter:t=>!0,type:e.S6.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(o);const a="READDIRP_RECURSIVE_ERROR",c=new Set(["ENOENT","EPERM","EACCES","ELOOP",a]),l=[e.S6.DIR_TYPE,e.S6.EVERYTHING_TYPE,e.S6.FILE_DIR_TYPE,e.S6.FILE_TYPE],h=new Set([e.S6.DIR_TYPE,e.S6.EVERYTHING_TYPE,e.S6.FILE_DIR_TYPE]),u=new Set([e.S6.EVERYTHING_TYPE,e.S6.FILE_DIR_TYPE,e.S6.FILE_TYPE]),f="win32"===process.platform,d=t=>!0,p=t=>{if(void 0===t)return d;if("function"==typeof t)return t;if("string"==typeof t){const e=t.trim();return t=>t.basename===e}if(Array.isArray(t)){const e=t.map(t=>t.trim());return t=>e.some(e=>t.basename===e)}return d};class m extends r.Readable{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});const i={...o,...t},{root:r,type:a}=i;this._fileFilter=p(i.fileFilter),this._directoryFilter=p(i.directoryFilter);const c=i.lstat?n.lstat:n.stat;this._stat=f?t=>c(t,{bigint:!0}):c,this._maxDepth=i.depth??o.depth,this._wantsDir=!!a&&h.has(a),this._wantsFile=!!a&&u.has(a),this._wantsEverything=a===e.S6.EVERYTHING_TYPE,this._root=(0,s.resolve)(r),this._isDirent=!i.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;){const e=this.parent,i=e&&e.files;if(i&&i.length>0){const{path:n,depth:r}=e,s=i.splice(0,t).map(t=>this._formatEntry(t,n)),o=await Promise.all(s);for(const e of o){if(!e)continue;if(this.destroyed)return;const i=await this._getEntryType(e);"directory"===i&&this._directoryFilter(e)?(r<=this._maxDepth&&this.parents.push(this._exploreDir(e.fullPath,r+1)),this._wantsDir&&(this.push(e),t--)):("file"===i||this._includeAsFile(e))&&this._fileFilter(e)&&this._wantsFile&&(this.push(e),t--)}}else{const t=this.parents.pop();if(!t){this.push(null);break}if(this.parent=await t,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(t,e){let i;try{i=await(0,n.readdir)(t,this._rdOptions)}catch(t){this._onError(t)}return{files:i,depth:e,path:t}}async _formatEntry(t,e){let i;const n=this._isDirent?t.name:t;try{const r=(0,s.resolve)((0,s.join)(e,n));i={path:(0,s.relative)(this._root,r),fullPath:r,basename:n},i[this._statsProp]=this._isDirent?t:await this._stat(r)}catch(t){return void this._onError(t)}return i}_onError(t){var e;e=t,c.has(e.code)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";const e=t[this._statsProp];if(e.isFile())return"file";if(e.isDirectory())return"directory";if(e&&e.isSymbolicLink()){const e=t.fullPath;try{const t=await(0,n.realpath)(e),i=await(0,n.lstat)(t);if(i.isFile())return"file";if(i.isDirectory()){const i=t.length;if(e.startsWith(t)&&e.substr(i,1)===s.sep){const i=new Error(`Circular symlink detected: "${e}" points to "${t}"`);return i.code=a,this._onError(i)}return"directory"}}catch(t){return this._onError(t),""}}}_includeAsFile(t){const e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}}function g(t,i={}){let n=i.entryType||i.type;if("both"===n&&(n=e.S6.FILE_DIR_TYPE),n&&(i.type=n),!t)throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");if("string"!=typeof t)throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(n&&!l.includes(n))throw new Error(`readdirp: Invalid type passed. Use one of ${l.join(", ")}`);return i.root=t,new m(i)}},1236(t,e){"use strict";e.fromCallback=function(t){return Object.defineProperty(function(...e){if("function"!=typeof e[e.length-1])return new Promise((i,n)=>{e.push((t,e)=>null!=t?n(t):i(e)),t.apply(this,e)});t.apply(this,e)},"name",{value:t.name})},e.fromPromise=function(t){return Object.defineProperty(function(...e){const i=e[e.length-1];if("function"!=typeof i)return t.apply(this,e);e.pop(),t.apply(this,e).then(t=>i(null,t),i)},"name",{value:t.name})}},9642(t){"use strict";t.exports=require("better-sqlite3/build/Release/better_sqlite3.node")},2613(t){"use strict";t.exports=require("assert")},9140(t){"use strict";t.exports=require("constants")},4434(t){"use strict";t.exports=require("events")},9896(t){"use strict";t.exports=require("fs")},1943(t){"use strict";t.exports=require("fs/promises")},1455(t){"use strict";t.exports=require("node:fs/promises")},6760(t){"use strict";t.exports=require("node:path")},7075(t){"use strict";t.exports=require("node:stream")},857(t){"use strict";t.exports=require("os")},6928(t){"use strict";t.exports=require("path")},2203(t){"use strict";t.exports=require("stream")},9023(t){"use strict";t.exports=require("util")},8167(t){"use strict";t.exports=require("worker_threads")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={id:t,loaded:!1,exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var __webpack_exports__={};(()=>{"use strict";const t=__webpack_require__(3285),e=__webpack_require__(3054),i=__webpack_require__(746);(0,t.file_search_start)(),(0,e.start_ai_agent_agent)(),(0,i.tcp_file_sync_work_start)()})()})();
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|