filecat 5.35.2 → 5.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/377.7f79691db52622ff2b8f.js +2 -0
- package/build/dist/542.05dd23045d96b2ff4ed7.js +2 -0
- package/build/dist/584.81eac9b4edaa072e73ca.js +2 -0
- package/build/dist/923.cda356caeaadc337e460.js +1 -0
- package/build/dist/{943.a2a4885cc95c4d2e434b.js → 943.8415378fb80a6355618c.js} +2 -2
- package/build/dist/index.html +1 -1
- package/build/dist/{main.5d5a84a2d13bbc0c0b94.js → main.c754beaced8725b5e80b.js} +2 -2
- package/build/main.js +1 -1
- package/build/threads.work.filecat.js +1 -1
- package/package.json +1 -1
- package/shell/pkg.ts +10 -4
- package/build/dist/377.08cdcdc78c590d78c67f.js +0 -2
- package/build/dist/542.9ec303dd1d7178e1a260.js +0 -2
- package/build/dist/584.221a52cee9ef0da9cbed.js +0 -2
- package/build/dist/923.f3cd70ad11c340d1adc6.js +0 -1
- /package/build/dist/{377.08cdcdc78c590d78c67f.js.LICENSE.txt → 377.7f79691db52622ff2b8f.js.LICENSE.txt} +0 -0
- /package/build/dist/{542.9ec303dd1d7178e1a260.js.LICENSE.txt → 542.05dd23045d96b2ff4ed7.js.LICENSE.txt} +0 -0
- /package/build/dist/{584.221a52cee9ef0da9cbed.js.LICENSE.txt → 584.81eac9b4edaa072e73ca.js.LICENSE.txt} +0 -0
- /package/build/dist/{943.a2a4885cc95c4d2e434b.js.LICENSE.txt → 943.8415378fb80a6355618c.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.5d5a84a2d13bbc0c0b94.js.LICENSE.txt → main.c754beaced8725b5e80b.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;k=e,"memory"===e&&(b||(b=new o.default.Index({tokenize:"strict"}),x=new o.default.Index({tokenize:"strict"}))),"sqlite"===e&&(v=new u(i,{nativeBinding:a}),v.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=v.prepare("\n SELECT mtime FROM docs WHERE file_path = ? LIMIT 1\n "),y=v.prepare("\n SELECT mtime FROM doc_names WHERE file_path = ? LIMIT 1\n "),f=v.prepare("INSERT INTO docs (file_path, content, mtime) VALUES (?, ?, ?)"),d=v.prepare("INSERT INTO doc_names (file_path, name, mtime) VALUES (?, ?, ?)"),g=v.prepare("DELETE FROM docs WHERE file_path = ?"),p=v.prepare("DELETE FROM doc_names WHERE file_path = ?"),m=v.prepare("\n SELECT file_path\n FROM docs\n WHERE docs MATCH ?\n ORDER BY bm25(docs)\n LIMIT 50\n "),_=v.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"===k&&v){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"===k){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"===k&&(b?.remove(e),x?.remove(e)),"sqlite"===k&&v&&(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"===k){const t={suggest:!0,resolution:9,context:!0,limit:50};return{ids:b?.search(n,t)||[],names_ids:x?.search(n,t)||[]}}if("sqlite"===k&&v){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"===k&&(b?.clear(),x?.clear(),b=null,x=null),"sqlite"===k&&v&&(v.close(),v=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,v=null,k="memory"},917(__unused_webpack_module,exports,__webpack_require__){"use strict";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{}}Object.defineProperty(exports,"__esModule",{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){return s.default.promises.writeFile(t,e)}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";Object.defineProperty(e,"__esModule",{value:!0}),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;Object.defineProperty(e,"__esModule",{value:!0}),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";Object.defineProperty(e,"__esModule",{value:!0}),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={},v=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"]]),k=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),j=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],S={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:v},LatinAdvanced:{mapper:v,matcher:k,replacer:j},LatinExtra:{mapper:v,replacer:j.concat([/(?!^)[aeo]/g,""]),matcher:k},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=S[n];for(let t,i=1;i<e.length&&(t=e.charAt(i),"h"===t||"w"===t||!(t=S[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=F,this.A=BigInt(t)):(this.B=C,this.A=t)}function O(t=8){if(!this||this.constructor!==O)return new O(t);this.index=h(),this.h=[],this.size=0,t>32?(this.B=F,this.A=BigInt(t)):(this.B=C,this.A=t)}function C(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 F(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 I,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),I=new n.FlexSearch.Index(B),delete n.FlexSearch):I=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(I,s[0]),I.import(s[0],t)):((n=s&&I[e].apply(I,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++)},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++)},(s=z.prototype).has=O.prototype.has=function(t){const e=this.index[this.B(t)];return e&&e.has(t)},s.delete=O.prototype.delete=function(t){const e=this.index[this.B(t)];e&&e.delete(t)&&this.size--},s.clear=O.prototype.clear=function(){this.index=h(),this.h=[],this.size=0},s.values=O.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e},s.keys=O.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e},s.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 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,v=0,k=0;k<w.length;k++){var j=w[k],S=B.encode(j);let t;if((S=S.length>1?S.join(" "):S[0])&&j){for(var A=j.length,M=(B.split?j.replace(B.split,""):j).length-S.length,E="",z=0,O=0;O<m.length;O++){var C=m[O];if(C){var F=C.length;F+=M<0?0:M,z&&F<=z||(C=S.indexOf(C))>-1&&(E=(C?j.substring(0,C):"")+o+j.substring(C,C+F)+h+(C+F<A?j.substring(C+F):""),z=F,t=!0)}}E&&(l&&(b<0&&(b=_.length+(_?1:0)),x=_.length+(_?1:0)+E.length,v+=A,e.push(y.length),y.push({match:E})),_+=(_?" ":"")+E)}if(t){if(l&&v>=l)break}else _+=(_?" ":"")+(j=w[k]),l&&y.push({text:j})}if(v=e.length*(r.length-2),g||p||l&&_.length-v>l)if(k=x-b,g>0&&(k+=g),p>0&&(k+=p),k<=(v=l+v-2*d))w=g?b-(g>0?g:0):b-((v-k)/2|0),y=p?x+(p>0?p:0):w+v,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={},v={},k={},j={},S={},E=M=A=0,O=z=1;;){var I=void 0;for(let t,i=0;i<e.length;i++){if(t=e[i],E)if(M!==E){if(k[i+1])continue;if(t+=E,b[t]){A-=d,v[i+1]=1,k[i+1]=1;continue}if(t>=y.length-1){if(t>=y.length){k[i+1]=1,t>=w.length&&(v[i+1]=1);continue}A-=d}if(_=y[t].text,F=p&&S[i]){if(!(F>0)){k[i+1]=1;continue}if(_.length>F){if(k[i+1]=1,!c)continue;_=_.substring(0,F)}(F-=_.length)||(F=-1),S[i]=F}if(A+_.length+1<=l)_=" "+_,x[i]+=_;else{if(!c){k[i+1]=1;continue}(I=l-A-1)>0&&(_=" "+_.substring(0,I),x[i]+=_),k[i+1]=1}}else{if(k[i])continue;if(t-=M,b[t]){A-=d,k[i]=1,v[i]=1;continue}if(t<=0){if(t<0){k[i]=1,v[i]=1;continue}A-=d}if(_=y[t].text,F=g&&j[i]){if(!(F>0)){k[i]=1;continue}if(_.length>F){if(k[i]=1,!c)continue;_=_.substring(_.length-F)}(F-=_.length)||(F=-1),j[i]=F}if(A+_.length+1<=l)_+=" ",x[i]=_+x[i];else{if(!c){k[i]=1;continue}(I=_.length+1-(l-A))>=0&&I<_.length&&(_=_.substring(I)+" ",x[i]=_+x[i]),k[i]=1}}else{let e;if(_=y[t].match,g&&(j[i]=g),p&&(S[i]=p),i&&A++,t?!i&&d&&(A+=d):(v[i]=1,k[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)){I=z=O=v[i]=0;break}x[i]=_,e&&(v[i+1]=1,k[i+1]=1)}A+=_.length,I=b[t]=1}if(I)M===E?E++:M++;else{if(M===E?z=0:O=0,!z&&!O)break;z?E=++M:E++}}_="";for(let t,e=0;e<x.length;e++)t=(v[e]?e?" ":"":(e&&!s?" ":"")+s)+x[e],_+=t;s&&!v[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 O(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 v=[];for(let t,e=0;e<y.length;e++)if(t=y[e],t.field&&t.tag){var k=t.tag;if(k.constructor===Array)for(var j=0;j<k.length;j++)v.push(t.field,k[j]);else v.push(t.field,k)}else{k=Object.keys(t);for(let e,i,n=0;n<k.length;n++)if(e=k[n],i=t[e],i.constructor===Array)for(j=0;j<i.length;j++)v.push(e,i[j]);else v.push(e,i)}if(y=v,!t){if(r=[],v.length)for(y=0;y<v.length;y+=2){if(this.db){if(!(n=this.index.get(v[y])))continue;r.push(n=n.db.tag(v[y+1],e,x,b))}else n=ht.call(this,v[y],v[y+1],e,x,b);s.push(w?{field:v[y],tag:v[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),v=(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{j=(k=A||i||{}).enrich;var S=this.index.get(c);if(y&&(this.db&&(k.tag=y,k.field=g,m=S.db.support_tag_search),!m&&j&&(k.enrich=!1),m||(k.limit=0,k.offset=0)),h=d?S.searchCache(t,y&&!m?0:e,k):S.search(t,y&&!m?0:e,k),y&&!m&&(k.limit=e,k.offset=x),j&&(k.enrich=j),v){v[f]=h;continue}}if(a=(h=h.result||h)&&h.length,y&&a){if(k=[],j=0,this.db&&n){if(!m)for(S=g.length;S<n.length;S++){let t=n[S];if(t&&t.length)j++,k.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)j++,k.push(t);else if(!u)return w?s:new et(s,this)}if(j){if(h=rt(h,k,e,x,w),a=h.length,!a&&!u)return w?h:new et(h,this);j--}}if(a)r[_]=c,s.push(h),_++;else if(1===g.length)return w?s:new et(s,this)}if(v){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)}v.push(r.db.tag(y[b+1],e,x,!1))}const n=this;return Promise.all(v).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(v=[],x=0;x<r.length;x++){if(y=s[x],b&&y.length&&void 0===y[0].doc&&(this.db?v.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&&v.length){const e=this;return Promise.all(v).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 vt(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 kt(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 jt(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 St(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 O(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):kt(d,a,h),o="";switch(this.tokenize){case"tolerant":if(vt(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),vt(this,f,o=h+e+l,r,t,i),vt(this,f,o=h+l,r,t,i);vt(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):kt(d,a,h,s,n);vt(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):kt(d,a,h,s,l);vt(this,f,o,c,t,i)}o=""}case"forward":if(s>1){for(l=0;l<s;l++)vt(this,f,o+=g[this.rtl?s-1-l:l],r,t,i);break}default:if(vt(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];vt(this,u,(c=this.bidirectional&&g>o)?o:g,this.score?this.score(e,o,h,g,l-1):kt(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 St.call(this,g[0],"",e,d,o,u,l);if(2===n&&s&&!r)return St.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 jt(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 jt(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 Ot="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ct=["map","ctx","tag","reg","cfg"],Ft=h();function It(t,e={}){if(!this||this.constructor!==It)return new It(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=It.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(),Ft[t.id]||(Ft[t.id]=[]),Ft[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<Ct.length;n++){i=Ct[n];for(let n,s=0;s<Ft[t.id].length;s++)n=Ft[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(Ot.deleteDatabase(this.id))},s.clear=function(){const t=[];for(let e,i=0;i<Ct.length;i++){e=Ct[i];for(let i,n=0;n<Ft[this.id].length;n++)i=Ft[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:It,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"),v=i(896).readFileSync(x),k=new WebAssembly.Module(v),j=new WebAssembly.Instance(k,s);n=j.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__={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(k=e,"memory"===e){if(b)return;b=new o.default.Index({tokenize:"strict"}),x=new o.default.Index({tokenize:"strict"})}if("sqlite"===e){if(v)return;v=new u(i,{nativeBinding:a}),v.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=v.prepare("\n SELECT mtime FROM docs WHERE file_path = ? LIMIT 1\n "),y=v.prepare("\n SELECT mtime FROM doc_names WHERE file_path = ? LIMIT 1\n "),f=v.prepare("INSERT INTO docs (file_path, content, mtime) VALUES (?, ?, ?)"),d=v.prepare("INSERT INTO doc_names (file_path, name, mtime) VALUES (?, ?, ?)"),g=v.prepare("DELETE FROM docs WHERE file_path = ?"),p=v.prepare("DELETE FROM doc_names WHERE file_path = ?"),m=v.prepare("\n SELECT file_path\n FROM docs\n WHERE docs MATCH ?\n ORDER BY bm25(docs)\n LIMIT 50\n "),_=v.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"===k&&v){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"===k){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"===k&&(b?.remove(e),x?.remove(e)),"sqlite"===k&&v&&(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"===k){const t={suggest:!0,resolution:9,context:!0,limit:50};return{ids:b?.search(n,t)||[],names_ids:x?.search(n,t)||[]}}if("sqlite"===k&&v){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"===k&&(b?.clear(),x?.clear(),b=null,x=null),"sqlite"===k&&v&&(v.close(),v=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,v=null,k="memory"},917(__unused_webpack_module,exports,__webpack_require__){"use strict";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{}}Object.defineProperty(exports,"__esModule",{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){return s.default.promises.writeFile(t,e)}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";Object.defineProperty(e,"__esModule",{value:!0}),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;Object.defineProperty(e,"__esModule",{value:!0}),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";Object.defineProperty(e,"__esModule",{value:!0}),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={},v=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"]]),k=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),j=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],S={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:v},LatinAdvanced:{mapper:v,matcher:k,replacer:j},LatinExtra:{mapper:v,replacer:j.concat([/(?!^)[aeo]/g,""]),matcher:k},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=S[n];for(let t,i=1;i<e.length&&(t=e.charAt(i),"h"===t||"w"===t||!(t=S[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=F,this.A=BigInt(t)):(this.B=C,this.A=t)}function O(t=8){if(!this||this.constructor!==O)return new O(t);this.index=h(),this.h=[],this.size=0,t>32?(this.B=F,this.A=BigInt(t)):(this.B=C,this.A=t)}function C(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 F(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 I,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),I=new n.FlexSearch.Index(B),delete n.FlexSearch):I=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(I,s[0]),I.import(s[0],t)):((n=s&&I[e].apply(I,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++)},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++)},(s=z.prototype).has=O.prototype.has=function(t){const e=this.index[this.B(t)];return e&&e.has(t)},s.delete=O.prototype.delete=function(t){const e=this.index[this.B(t)];e&&e.delete(t)&&this.size--},s.clear=O.prototype.clear=function(){this.index=h(),this.h=[],this.size=0},s.values=O.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e},s.keys=O.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e},s.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 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,v=0,k=0;k<w.length;k++){var j=w[k],S=B.encode(j);let t;if((S=S.length>1?S.join(" "):S[0])&&j){for(var A=j.length,M=(B.split?j.replace(B.split,""):j).length-S.length,E="",z=0,O=0;O<m.length;O++){var C=m[O];if(C){var F=C.length;F+=M<0?0:M,z&&F<=z||(C=S.indexOf(C))>-1&&(E=(C?j.substring(0,C):"")+o+j.substring(C,C+F)+h+(C+F<A?j.substring(C+F):""),z=F,t=!0)}}E&&(l&&(b<0&&(b=_.length+(_?1:0)),x=_.length+(_?1:0)+E.length,v+=A,e.push(y.length),y.push({match:E})),_+=(_?" ":"")+E)}if(t){if(l&&v>=l)break}else _+=(_?" ":"")+(j=w[k]),l&&y.push({text:j})}if(v=e.length*(r.length-2),g||p||l&&_.length-v>l)if(k=x-b,g>0&&(k+=g),p>0&&(k+=p),k<=(v=l+v-2*d))w=g?b-(g>0?g:0):b-((v-k)/2|0),y=p?x+(p>0?p:0):w+v,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={},v={},k={},j={},S={},E=M=A=0,O=z=1;;){var I=void 0;for(let t,i=0;i<e.length;i++){if(t=e[i],E)if(M!==E){if(k[i+1])continue;if(t+=E,b[t]){A-=d,v[i+1]=1,k[i+1]=1;continue}if(t>=y.length-1){if(t>=y.length){k[i+1]=1,t>=w.length&&(v[i+1]=1);continue}A-=d}if(_=y[t].text,F=p&&S[i]){if(!(F>0)){k[i+1]=1;continue}if(_.length>F){if(k[i+1]=1,!c)continue;_=_.substring(0,F)}(F-=_.length)||(F=-1),S[i]=F}if(A+_.length+1<=l)_=" "+_,x[i]+=_;else{if(!c){k[i+1]=1;continue}(I=l-A-1)>0&&(_=" "+_.substring(0,I),x[i]+=_),k[i+1]=1}}else{if(k[i])continue;if(t-=M,b[t]){A-=d,k[i]=1,v[i]=1;continue}if(t<=0){if(t<0){k[i]=1,v[i]=1;continue}A-=d}if(_=y[t].text,F=g&&j[i]){if(!(F>0)){k[i]=1;continue}if(_.length>F){if(k[i]=1,!c)continue;_=_.substring(_.length-F)}(F-=_.length)||(F=-1),j[i]=F}if(A+_.length+1<=l)_+=" ",x[i]=_+x[i];else{if(!c){k[i]=1;continue}(I=_.length+1-(l-A))>=0&&I<_.length&&(_=_.substring(I)+" ",x[i]=_+x[i]),k[i]=1}}else{let e;if(_=y[t].match,g&&(j[i]=g),p&&(S[i]=p),i&&A++,t?!i&&d&&(A+=d):(v[i]=1,k[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)){I=z=O=v[i]=0;break}x[i]=_,e&&(v[i+1]=1,k[i+1]=1)}A+=_.length,I=b[t]=1}if(I)M===E?E++:M++;else{if(M===E?z=0:O=0,!z&&!O)break;z?E=++M:E++}}_="";for(let t,e=0;e<x.length;e++)t=(v[e]?e?" ":"":(e&&!s?" ":"")+s)+x[e],_+=t;s&&!v[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 O(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 v=[];for(let t,e=0;e<y.length;e++)if(t=y[e],t.field&&t.tag){var k=t.tag;if(k.constructor===Array)for(var j=0;j<k.length;j++)v.push(t.field,k[j]);else v.push(t.field,k)}else{k=Object.keys(t);for(let e,i,n=0;n<k.length;n++)if(e=k[n],i=t[e],i.constructor===Array)for(j=0;j<i.length;j++)v.push(e,i[j]);else v.push(e,i)}if(y=v,!t){if(r=[],v.length)for(y=0;y<v.length;y+=2){if(this.db){if(!(n=this.index.get(v[y])))continue;r.push(n=n.db.tag(v[y+1],e,x,b))}else n=ht.call(this,v[y],v[y+1],e,x,b);s.push(w?{field:v[y],tag:v[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),v=(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{j=(k=A||i||{}).enrich;var S=this.index.get(c);if(y&&(this.db&&(k.tag=y,k.field=g,m=S.db.support_tag_search),!m&&j&&(k.enrich=!1),m||(k.limit=0,k.offset=0)),h=d?S.searchCache(t,y&&!m?0:e,k):S.search(t,y&&!m?0:e,k),y&&!m&&(k.limit=e,k.offset=x),j&&(k.enrich=j),v){v[f]=h;continue}}if(a=(h=h.result||h)&&h.length,y&&a){if(k=[],j=0,this.db&&n){if(!m)for(S=g.length;S<n.length;S++){let t=n[S];if(t&&t.length)j++,k.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)j++,k.push(t);else if(!u)return w?s:new et(s,this)}if(j){if(h=rt(h,k,e,x,w),a=h.length,!a&&!u)return w?h:new et(h,this);j--}}if(a)r[_]=c,s.push(h),_++;else if(1===g.length)return w?s:new et(s,this)}if(v){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)}v.push(r.db.tag(y[b+1],e,x,!1))}const n=this;return Promise.all(v).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(v=[],x=0;x<r.length;x++){if(y=s[x],b&&y.length&&void 0===y[0].doc&&(this.db?v.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&&v.length){const e=this;return Promise.all(v).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 vt(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 kt(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 jt(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 St(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 O(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):kt(d,a,h),o="";switch(this.tokenize){case"tolerant":if(vt(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),vt(this,f,o=h+e+l,r,t,i),vt(this,f,o=h+l,r,t,i);vt(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):kt(d,a,h,s,n);vt(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):kt(d,a,h,s,l);vt(this,f,o,c,t,i)}o=""}case"forward":if(s>1){for(l=0;l<s;l++)vt(this,f,o+=g[this.rtl?s-1-l:l],r,t,i);break}default:if(vt(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];vt(this,u,(c=this.bidirectional&&g>o)?o:g,this.score?this.score(e,o,h,g,l-1):kt(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 St.call(this,g[0],"",e,d,o,u,l);if(2===n&&s&&!r)return St.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 jt(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 jt(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 Ot="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ct=["map","ctx","tag","reg","cfg"],Ft=h();function It(t,e={}){if(!this||this.constructor!==It)return new It(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=It.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(),Ft[t.id]||(Ft[t.id]=[]),Ft[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<Ct.length;n++){i=Ct[n];for(let n,s=0;s<Ft[t.id].length;s++)n=Ft[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(Ot.deleteDatabase(this.id))},s.clear=function(){const t=[];for(let e,i=0;i<Ct.length;i++){e=Ct[i];for(let i,n=0;n<Ft[this.id].length;n++)i=Ft[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:It,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"),v=i(896).readFileSync(x),k=new WebAssembly.Module(v),j=new WebAssembly.Instance(k,s);n=j.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)()})()})();
|
package/package.json
CHANGED
package/shell/pkg.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {FileCompressType} from "../src/common/file.pojo";
|
|
2
2
|
import {FileService} from "../src/main/domain/file/file.service";
|
|
3
3
|
import {fileCompress} from "../src/main/domain/file/file.compress";
|
|
4
|
+
import {download_ripgrep} from "../src/main/domain/bin/download-ripgrep";
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
const fs = require('fs');
|
|
@@ -39,7 +40,12 @@ for (const file of fs.readdirSync(root_path)) {
|
|
|
39
40
|
} catch (e) {
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
async function run() {
|
|
45
|
+
await download_ripgrep()
|
|
46
|
+
// args[0] 会在 package.json 所在目录下
|
|
47
|
+
await fileCompress.compress("tar",9,args[0], filePaths, directorys,(v)=>{
|
|
48
|
+
console.log(`压缩进度:${v.toFixed(2)}`)
|
|
49
|
+
},true)
|
|
50
|
+
}
|
|
51
|
+
run()
|