texlite 0.5.0 → 0.5.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.
@@ -1,4 +1,4 @@
1
- import{_ as Ke}from"./index-BLh_AgbG.js";var Xe=Object.defineProperty,Me=r=>{throw TypeError(r)},Ye=(r,e,t)=>e in r?Xe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>Ye(r,typeof e!="symbol"?e+"":e,t),We=(r,e,t)=>e.has(r)||Me("Cannot "+t),$=(r,e,t)=>(We(r,e,"read from private field"),e.get(r)),he=(r,e,t)=>e.has(r)?Me("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),H=(r,e,t,n)=>(We(r,e,"write to private field"),e.set(r,t),t),E,S;const ke=Object.freeze({American:0,0:"American",British:1,1:"British",Australian:2,2:"Australian",Canadian:3,3:"Canadian",Indian:4,4:"Indian"}),He=Object.freeze({Plain:0,0:"Plain",Markdown:1,1:"Markdown",Typst:2,2:"Typst"});let W=class Q{static __wrap(e){const t=Object.create(Q.prototype);return t.__wbg_ptr=e,me.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof Q?e.__destroy_into_raw():0}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,me.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_lint_free(e,0)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.lint_from_json(t,n);if(_[2])throw A(_[1]);return Q.__wrap(_[0])}get_problem_text(){let e,t;try{const n=i.lint_get_problem_text(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}lint_kind(){let e,t;try{const n=i.lint_lint_kind(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}lint_kind_pretty(){let e,t;try{const n=i.lint_lint_kind_pretty(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}message(){let e,t;try{const n=i.lint_message(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}message_html(){let e,t;try{const n=i.lint_message_html(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}span(){const e=i.lint_span(this.__wbg_ptr);return _e.__wrap(e)}suggestion_count(){return i.lint_suggestion_count(this.__wbg_ptr)>>>0}suggestions(){const e=i.lint_suggestions(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}to_json(){let e,t;try{const n=i.lint_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(W.prototype[Symbol.dispose]=W.prototype.free);let fe=class ue{static __wrap(e){const t=Object.create(ue.prototype);return t.__wbg_ptr=e,je.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_linter_free(e,0)}apply_suggestion(e,t,n){let _,s;try{const a=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),y=u;oe(t,W),oe(n,Y);const b=i.linter_apply_suggestion(this.__wbg_ptr,a,y,t.__wbg_ptr,n.__wbg_ptr);var c=b[0],l=b[1];if(b[3])throw c=0,l=0,A(b[2]);return _=c,s=l,g(c,l)}finally{i.__wbindgen_free(_,s,1)}}clear_ignored_lints(){i.linter_clear_ignored_lints(this.__wbg_ptr)}clear_words(){i.linter_clear_words(this.__wbg_ptr)}context_hash(e,t){const n=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u;oe(t,W);const s=i.linter_context_hash(this.__wbg_ptr,n,_,t.__wbg_ptr);return BigInt.asUintN(64,s)}export_ignored_lints(){let e,t;try{const n=i.linter_export_ignored_lints(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}export_words(){const e=i.linter_export_words(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}generate_stats_file(){let e,t;try{const n=i.linter_generate_stats_file(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_dialect(){return i.linter_get_dialect(this.__wbg_ptr)}get_lint_config_as_json(){let e,t;try{const n=i.linter_get_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_config_as_object(){return i.linter_get_lint_config_as_object(this.__wbg_ptr)}get_lint_descriptions_as_json(){let e,t;try{const n=i.linter_get_lint_descriptions_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_descriptions_as_object(){return i.linter_get_lint_descriptions_as_object(this.__wbg_ptr)}get_lint_descriptions_html_as_json(){let e,t;try{const n=i.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_descriptions_html_as_object(){return i.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr)}get_structured_lint_config_as_json(){let e,t;try{const n=i.linter_get_structured_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_structured_lint_config_as_object(){return i.linter_get_structured_lint_config_as_object(this.__wbg_ptr)}ignore_hashes(e){const t=_t(e,i.__wbindgen_malloc),n=u;i.linter_ignore_hashes(this.__wbg_ptr,t,n)}ignore_lints(e,t){const n=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u,s=we(t,i.__wbindgen_malloc),c=u;i.linter_ignore_lints(this.__wbg_ptr,n,_,s,c)}import_ignored_lints(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_import_ignored_lints(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}import_stats_file(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_import_stats_file(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}import_weirpack(e){const t=it(e,i.__wbindgen_malloc),n=u,_=i.linter_import_weirpack(this.__wbg_ptr,t,n);if(_[2])throw A(_[1]);return A(_[0])}import_words(e){const t=we(e,i.__wbindgen_malloc),n=u;i.linter_import_words(this.__wbg_ptr,t,n)}is_likely_english(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u;return i.linter_is_likely_english(this.__wbg_ptr,t,n)!==0}isolate_english(e){let t,n;try{const _=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u,c=i.linter_isolate_english(this.__wbg_ptr,_,s);return t=c[0],n=c[1],g(c[0],c[1])}finally{i.__wbindgen_free(t,n,1)}}lint(e,t,n,_,s,c){const l=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),a=u;var y=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),b=u;const h=i.linter_lint(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=J(h[0],h[1]).slice();return i.__wbindgen_free(h[0],h[1]*4,4),T}static new(e){const t=i.linter_new(e);return ue.__wrap(t)}organized_lints(e,t,n,_,s,c){const l=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),a=u;var y=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),b=u;const h=i.linter_organized_lints(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=J(h[0],h[1]).slice();return i.__wbindgen_free(h[0],h[1]*4,4),T}set_lint_config_from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_set_lint_config_from_json(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}set_lint_config_from_object(e){const t=i.linter_set_lint_config_from_object(this.__wbg_ptr,e);if(t[1])throw A(t[0])}summarize_stats(e,t){return i.linter_summarize_stats(this.__wbg_ptr,!O(e),O(e)?BigInt(0):e,!O(t),O(t)?BigInt(0):t)}};Symbol.dispose&&(fe.prototype[Symbol.dispose]=fe.prototype.free);let re=class Be{static __wrap(e){const t=Object.create(Be.prototype);return t.__wbg_ptr=e,Se.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Se.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_organizedgroup_free(e,0)}get group(){let e,t;try{const n=i.__wbg_get_organizedgroup_group(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get lints(){const e=i.__wbg_get_organizedgroup_lints(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}set group(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u;i.__wbg_set_organizedgroup_group(this.__wbg_ptr,t,n)}set lints(e){const t=we(e,i.__wbindgen_malloc),n=u;i.__wbg_set_organizedgroup_lints(this.__wbg_ptr,t,n)}};Symbol.dispose&&(re.prototype[Symbol.dispose]=re.prototype.free);let _e=class Z{static __wrap(e){const t=Object.create(Z.prototype);return t.__wbg_ptr=e,ve.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ve.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_span_free(e,0)}get end(){return i.__wbg_get_span_end(this.__wbg_ptr)>>>0}get start(){return i.__wbg_get_span_start(this.__wbg_ptr)>>>0}set end(e){i.__wbg_set_span_end(this.__wbg_ptr,e)}set start(e){i.__wbg_set_span_start(this.__wbg_ptr,e)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.span_from_json(t,n);if(_[2])throw A(_[1]);return Z.__wrap(_[0])}is_empty(){return i.span_is_empty(this.__wbg_ptr)!==0}len(){return i.span_len(this.__wbg_ptr)>>>0}static new(e,t){const n=i.span_new(e,t);return Z.__wrap(n)}to_json(){let e,t;try{const n=i.span_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(_e.prototype[Symbol.dispose]=_e.prototype.free);let Y=class de{static __wrap(e){const t=Object.create(de.prototype);return t.__wbg_ptr=e,Ae.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_suggestion_free(e,0)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.suggestion_from_json(t,n);if(_[2])throw A(_[1]);return de.__wrap(_[0])}get_replacement_text(){let e,t;try{const n=i.suggestion_get_replacement_text(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}kind(){return i.suggestion_kind(this.__wbg_ptr)}to_json(){let e,t;try{const n=i.suggestion_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(Y.prototype[Symbol.dispose]=Y.prototype.free);const Qe=Object.freeze({Replace:0,0:"Replace",Remove:1,1:"Remove",InsertAfter:2,2:"InsertAfter"});function Ze(){return i.get_default_lint_config()}function et(){let r,e;try{const t=i.get_default_lint_config_as_json();return r=t[0],e=t[1],g(t[0],t[1])}finally{i.__wbindgen_free(r,e,1)}}function tt(){i.setup()}function nt(r){let e,t;try{const n=w(r,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u,s=i.to_title_case(n,_);return e=s[0],t=s[1],g(s[0],s[1])}finally{i.__wbindgen_free(e,t,1)}}function Ee(){return{__proto__:null,"./harper_wasm_slim_bg.js":{__proto__:null,__wbg_Error_bce6d499ff0a4aff:function(e,t){return Error(g(e,t))},__wbg_String_8564e559799eccda:function(e,t){const n=String(t),_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_boolean_get_2304fb8c853028c8:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return O(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_edece8177ad01481:function(e,t){const n=be(t),_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_is_function_5cd60d5cf78b4eef:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_b4593df85baada48:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_dde0fd9020db4434:function(e){return typeof e=="string"},__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c:function(e,t){return e==t},__wbg___wbindgen_number_get_f73a1244370fcc2c:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,O(_)?0:_,!0),m().setInt32(e+0,!O(_),!0)},__wbg___wbindgen_string_get_d109740c0d18f4d7:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var s=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_9c31b086c2b26051:function(e,t){throw new Error(g(e,t))},__wbg_call_13665d9f14390edc:function(){return k(function(e,t){return e.call(t)},arguments)},__wbg_done_54b8da57023b7ed2:function(e){return e.done},__wbg_entries_564a7e8b1e54ede5:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(g(e,t))}finally{i.__wbindgen_free(n,_,1)}},__wbg_getRandomValues_3f44b700395062e5:function(){return k(function(e,t){globalThis.crypto.getRandomValues(se(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return k(function(e,t){globalThis.crypto.getRandomValues(se(e,t))},arguments)},__wbg_getTime_09f1dd40a44edb30:function(e){return e.getTime()},__wbg_get_3e9a707ab7d352eb:function(){return k(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_98fdf51d029a75eb:function(e,t){return e[t>>>0]},__wbg_get_unchecked_1dfe6d05ad91d9b7:function(e,t){return e[t>>>0]},__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Uint8Array_abd07d4bd221d50b:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_iterator_1441b47f341dc34f:function(){return Symbol.iterator},__wbg_length_2591a0f4f659a55c:function(e){return e.length},__wbg_length_56fcd3e2b7e0299d:function(e){return e.length},__wbg_lint_new:function(e){return W.__wrap(e)},__wbg_lint_unwrap:function(e){return W.__unwrap(e)},__wbg_log_0c201ade58bb55e1:function(e,t,n,_,s,c,l,a){let y,b;try{y=e,b=t,console.log(g(e,t),g(n,_),g(s,c),g(l,a))}finally{i.__wbindgen_free(y,b,1)}},__wbg_log_ce2c4456b290c5e7:function(e,t){let n,_;try{n=e,_=t,console.log(g(e,t))}finally{i.__wbindgen_free(n,_,1)}},__wbg_mark_b4d943f3bc2d2404:function(e,t){performance.mark(g(e,t))},__wbg_measure_84362959e621a2c1:function(){return k(function(e,t,n,_){let s,c,l,a;try{s=e,c=t,l=n,a=_,performance.measure(g(e,t),g(n,_))}finally{i.__wbindgen_free(s,c,1),i.__wbindgen_free(l,a,1)}},arguments)},__wbg_new_02d162bc6cf02f60:function(){return new Object},__wbg_new_070df68d66325372:function(){return new Map},__wbg_new_0_2722fcdb71a888a6:function(){return new Date},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_310879b66b6e95e1:function(){return new Array},__wbg_new_7ddec6de44ff8f5d:function(e){return new Uint8Array(e)},__wbg_next_2a4e19f4f5083b0f:function(e){return e.next},__wbg_next_6429a146bf756f93:function(){return k(function(e){return e.next()},arguments)},__wbg_organizedgroup_new:function(e){return re.__wrap(e)},__wbg_prototypesetcall_5f9bdc8d75e07276:function(e,t,n){Uint8Array.prototype.set.call(se(e,t),n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_78ea6a19f4818587:function(e,t,n){e[t>>>0]=n},__wbg_set_facb7a5914e0fa39:function(e,t,n){return e.set(t,n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg_suggestion_new:function(e){return Y.__wrap(e)},__wbg_value_9cc0518af87a489c:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e,t){return g(e,t)},__wbindgen_init_externref_table:function(){const e=i.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const me=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_lint_free(r,1)),je=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_linter_free(r,1)),Se=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_organizedgroup_free(r,1)),ve=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_span_free(r,1)),Ae=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_suggestion_free(r,1));function Pe(r){const e=i.__externref_table_alloc();return i.__wbindgen_externrefs.set(e,r),e}function oe(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`)}function be(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let s="[";_>0&&(s+=be(r[0]));for(let c=1;c<_;c++)s+=", "+be(r[c]);return s+="]",s}const t=/\[object ([^\]]+)\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
1
+ import{_ as Ke}from"./index-DIKn1Ihd.js";var Xe=Object.defineProperty,Me=r=>{throw TypeError(r)},Ye=(r,e,t)=>e in r?Xe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>Ye(r,typeof e!="symbol"?e+"":e,t),We=(r,e,t)=>e.has(r)||Me("Cannot "+t),$=(r,e,t)=>(We(r,e,"read from private field"),e.get(r)),he=(r,e,t)=>e.has(r)?Me("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),H=(r,e,t,n)=>(We(r,e,"write to private field"),e.set(r,t),t),E,S;const ke=Object.freeze({American:0,0:"American",British:1,1:"British",Australian:2,2:"Australian",Canadian:3,3:"Canadian",Indian:4,4:"Indian"}),He=Object.freeze({Plain:0,0:"Plain",Markdown:1,1:"Markdown",Typst:2,2:"Typst"});let W=class Q{static __wrap(e){const t=Object.create(Q.prototype);return t.__wbg_ptr=e,me.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof Q?e.__destroy_into_raw():0}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,me.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_lint_free(e,0)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.lint_from_json(t,n);if(_[2])throw A(_[1]);return Q.__wrap(_[0])}get_problem_text(){let e,t;try{const n=i.lint_get_problem_text(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}lint_kind(){let e,t;try{const n=i.lint_lint_kind(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}lint_kind_pretty(){let e,t;try{const n=i.lint_lint_kind_pretty(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}message(){let e,t;try{const n=i.lint_message(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}message_html(){let e,t;try{const n=i.lint_message_html(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}span(){const e=i.lint_span(this.__wbg_ptr);return _e.__wrap(e)}suggestion_count(){return i.lint_suggestion_count(this.__wbg_ptr)>>>0}suggestions(){const e=i.lint_suggestions(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}to_json(){let e,t;try{const n=i.lint_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(W.prototype[Symbol.dispose]=W.prototype.free);let fe=class ue{static __wrap(e){const t=Object.create(ue.prototype);return t.__wbg_ptr=e,je.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_linter_free(e,0)}apply_suggestion(e,t,n){let _,s;try{const a=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),y=u;oe(t,W),oe(n,Y);const b=i.linter_apply_suggestion(this.__wbg_ptr,a,y,t.__wbg_ptr,n.__wbg_ptr);var c=b[0],l=b[1];if(b[3])throw c=0,l=0,A(b[2]);return _=c,s=l,g(c,l)}finally{i.__wbindgen_free(_,s,1)}}clear_ignored_lints(){i.linter_clear_ignored_lints(this.__wbg_ptr)}clear_words(){i.linter_clear_words(this.__wbg_ptr)}context_hash(e,t){const n=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u;oe(t,W);const s=i.linter_context_hash(this.__wbg_ptr,n,_,t.__wbg_ptr);return BigInt.asUintN(64,s)}export_ignored_lints(){let e,t;try{const n=i.linter_export_ignored_lints(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}export_words(){const e=i.linter_export_words(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}generate_stats_file(){let e,t;try{const n=i.linter_generate_stats_file(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_dialect(){return i.linter_get_dialect(this.__wbg_ptr)}get_lint_config_as_json(){let e,t;try{const n=i.linter_get_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_config_as_object(){return i.linter_get_lint_config_as_object(this.__wbg_ptr)}get_lint_descriptions_as_json(){let e,t;try{const n=i.linter_get_lint_descriptions_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_descriptions_as_object(){return i.linter_get_lint_descriptions_as_object(this.__wbg_ptr)}get_lint_descriptions_html_as_json(){let e,t;try{const n=i.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_descriptions_html_as_object(){return i.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr)}get_structured_lint_config_as_json(){let e,t;try{const n=i.linter_get_structured_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_structured_lint_config_as_object(){return i.linter_get_structured_lint_config_as_object(this.__wbg_ptr)}ignore_hashes(e){const t=_t(e,i.__wbindgen_malloc),n=u;i.linter_ignore_hashes(this.__wbg_ptr,t,n)}ignore_lints(e,t){const n=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u,s=we(t,i.__wbindgen_malloc),c=u;i.linter_ignore_lints(this.__wbg_ptr,n,_,s,c)}import_ignored_lints(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_import_ignored_lints(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}import_stats_file(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_import_stats_file(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}import_weirpack(e){const t=it(e,i.__wbindgen_malloc),n=u,_=i.linter_import_weirpack(this.__wbg_ptr,t,n);if(_[2])throw A(_[1]);return A(_[0])}import_words(e){const t=we(e,i.__wbindgen_malloc),n=u;i.linter_import_words(this.__wbg_ptr,t,n)}is_likely_english(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u;return i.linter_is_likely_english(this.__wbg_ptr,t,n)!==0}isolate_english(e){let t,n;try{const _=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u,c=i.linter_isolate_english(this.__wbg_ptr,_,s);return t=c[0],n=c[1],g(c[0],c[1])}finally{i.__wbindgen_free(t,n,1)}}lint(e,t,n,_,s,c){const l=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),a=u;var y=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),b=u;const h=i.linter_lint(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=J(h[0],h[1]).slice();return i.__wbindgen_free(h[0],h[1]*4,4),T}static new(e){const t=i.linter_new(e);return ue.__wrap(t)}organized_lints(e,t,n,_,s,c){const l=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),a=u;var y=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),b=u;const h=i.linter_organized_lints(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=J(h[0],h[1]).slice();return i.__wbindgen_free(h[0],h[1]*4,4),T}set_lint_config_from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_set_lint_config_from_json(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}set_lint_config_from_object(e){const t=i.linter_set_lint_config_from_object(this.__wbg_ptr,e);if(t[1])throw A(t[0])}summarize_stats(e,t){return i.linter_summarize_stats(this.__wbg_ptr,!O(e),O(e)?BigInt(0):e,!O(t),O(t)?BigInt(0):t)}};Symbol.dispose&&(fe.prototype[Symbol.dispose]=fe.prototype.free);let re=class Be{static __wrap(e){const t=Object.create(Be.prototype);return t.__wbg_ptr=e,Se.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Se.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_organizedgroup_free(e,0)}get group(){let e,t;try{const n=i.__wbg_get_organizedgroup_group(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get lints(){const e=i.__wbg_get_organizedgroup_lints(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}set group(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u;i.__wbg_set_organizedgroup_group(this.__wbg_ptr,t,n)}set lints(e){const t=we(e,i.__wbindgen_malloc),n=u;i.__wbg_set_organizedgroup_lints(this.__wbg_ptr,t,n)}};Symbol.dispose&&(re.prototype[Symbol.dispose]=re.prototype.free);let _e=class Z{static __wrap(e){const t=Object.create(Z.prototype);return t.__wbg_ptr=e,ve.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ve.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_span_free(e,0)}get end(){return i.__wbg_get_span_end(this.__wbg_ptr)>>>0}get start(){return i.__wbg_get_span_start(this.__wbg_ptr)>>>0}set end(e){i.__wbg_set_span_end(this.__wbg_ptr,e)}set start(e){i.__wbg_set_span_start(this.__wbg_ptr,e)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.span_from_json(t,n);if(_[2])throw A(_[1]);return Z.__wrap(_[0])}is_empty(){return i.span_is_empty(this.__wbg_ptr)!==0}len(){return i.span_len(this.__wbg_ptr)>>>0}static new(e,t){const n=i.span_new(e,t);return Z.__wrap(n)}to_json(){let e,t;try{const n=i.span_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(_e.prototype[Symbol.dispose]=_e.prototype.free);let Y=class de{static __wrap(e){const t=Object.create(de.prototype);return t.__wbg_ptr=e,Ae.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_suggestion_free(e,0)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.suggestion_from_json(t,n);if(_[2])throw A(_[1]);return de.__wrap(_[0])}get_replacement_text(){let e,t;try{const n=i.suggestion_get_replacement_text(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}kind(){return i.suggestion_kind(this.__wbg_ptr)}to_json(){let e,t;try{const n=i.suggestion_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(Y.prototype[Symbol.dispose]=Y.prototype.free);const Qe=Object.freeze({Replace:0,0:"Replace",Remove:1,1:"Remove",InsertAfter:2,2:"InsertAfter"});function Ze(){return i.get_default_lint_config()}function et(){let r,e;try{const t=i.get_default_lint_config_as_json();return r=t[0],e=t[1],g(t[0],t[1])}finally{i.__wbindgen_free(r,e,1)}}function tt(){i.setup()}function nt(r){let e,t;try{const n=w(r,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u,s=i.to_title_case(n,_);return e=s[0],t=s[1],g(s[0],s[1])}finally{i.__wbindgen_free(e,t,1)}}function Ee(){return{__proto__:null,"./harper_wasm_slim_bg.js":{__proto__:null,__wbg_Error_bce6d499ff0a4aff:function(e,t){return Error(g(e,t))},__wbg_String_8564e559799eccda:function(e,t){const n=String(t),_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_boolean_get_2304fb8c853028c8:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return O(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_edece8177ad01481:function(e,t){const n=be(t),_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_is_function_5cd60d5cf78b4eef:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_b4593df85baada48:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_dde0fd9020db4434:function(e){return typeof e=="string"},__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c:function(e,t){return e==t},__wbg___wbindgen_number_get_f73a1244370fcc2c:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,O(_)?0:_,!0),m().setInt32(e+0,!O(_),!0)},__wbg___wbindgen_string_get_d109740c0d18f4d7:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var s=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_9c31b086c2b26051:function(e,t){throw new Error(g(e,t))},__wbg_call_13665d9f14390edc:function(){return k(function(e,t){return e.call(t)},arguments)},__wbg_done_54b8da57023b7ed2:function(e){return e.done},__wbg_entries_564a7e8b1e54ede5:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(g(e,t))}finally{i.__wbindgen_free(n,_,1)}},__wbg_getRandomValues_3f44b700395062e5:function(){return k(function(e,t){globalThis.crypto.getRandomValues(se(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return k(function(e,t){globalThis.crypto.getRandomValues(se(e,t))},arguments)},__wbg_getTime_09f1dd40a44edb30:function(e){return e.getTime()},__wbg_get_3e9a707ab7d352eb:function(){return k(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_98fdf51d029a75eb:function(e,t){return e[t>>>0]},__wbg_get_unchecked_1dfe6d05ad91d9b7:function(e,t){return e[t>>>0]},__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Uint8Array_abd07d4bd221d50b:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_iterator_1441b47f341dc34f:function(){return Symbol.iterator},__wbg_length_2591a0f4f659a55c:function(e){return e.length},__wbg_length_56fcd3e2b7e0299d:function(e){return e.length},__wbg_lint_new:function(e){return W.__wrap(e)},__wbg_lint_unwrap:function(e){return W.__unwrap(e)},__wbg_log_0c201ade58bb55e1:function(e,t,n,_,s,c,l,a){let y,b;try{y=e,b=t,console.log(g(e,t),g(n,_),g(s,c),g(l,a))}finally{i.__wbindgen_free(y,b,1)}},__wbg_log_ce2c4456b290c5e7:function(e,t){let n,_;try{n=e,_=t,console.log(g(e,t))}finally{i.__wbindgen_free(n,_,1)}},__wbg_mark_b4d943f3bc2d2404:function(e,t){performance.mark(g(e,t))},__wbg_measure_84362959e621a2c1:function(){return k(function(e,t,n,_){let s,c,l,a;try{s=e,c=t,l=n,a=_,performance.measure(g(e,t),g(n,_))}finally{i.__wbindgen_free(s,c,1),i.__wbindgen_free(l,a,1)}},arguments)},__wbg_new_02d162bc6cf02f60:function(){return new Object},__wbg_new_070df68d66325372:function(){return new Map},__wbg_new_0_2722fcdb71a888a6:function(){return new Date},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_310879b66b6e95e1:function(){return new Array},__wbg_new_7ddec6de44ff8f5d:function(e){return new Uint8Array(e)},__wbg_next_2a4e19f4f5083b0f:function(e){return e.next},__wbg_next_6429a146bf756f93:function(){return k(function(e){return e.next()},arguments)},__wbg_organizedgroup_new:function(e){return re.__wrap(e)},__wbg_prototypesetcall_5f9bdc8d75e07276:function(e,t,n){Uint8Array.prototype.set.call(se(e,t),n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_78ea6a19f4818587:function(e,t,n){e[t>>>0]=n},__wbg_set_facb7a5914e0fa39:function(e,t,n){return e.set(t,n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg_suggestion_new:function(e){return Y.__wrap(e)},__wbg_value_9cc0518af87a489c:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e,t){return g(e,t)},__wbindgen_init_externref_table:function(){const e=i.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const me=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_lint_free(r,1)),je=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_linter_free(r,1)),Se=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_organizedgroup_free(r,1)),ve=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_span_free(r,1)),Ae=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_suggestion_free(r,1));function Pe(r){const e=i.__externref_table_alloc();return i.__wbindgen_externrefs.set(e,r),e}function oe(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`)}function be(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let s="[";_>0&&(s+=be(r[0]));for(let c=1;c<_;c++)s+=", "+be(r[c]);return s+="]",s}const t=/\[object ([^\]]+)\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
2
2
  ${r.stack}`:n}function J(r,e){r=r>>>0;const t=m(),n=[];for(let _=r;_<r+4*e;_+=4)n.push(i.__wbindgen_externrefs.get(t.getUint32(_,!0)));return i.__externref_drop_slice(r,e),n}function se(r,e){return r=r>>>0,P().subarray(r/1,r/1+e)}let C=null;function rt(){return(C===null||C.byteLength===0)&&(C=new BigUint64Array(i.memory.buffer)),C}let I=null;function m(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==i.memory.buffer)&&(I=new DataView(i.memory.buffer)),I}function g(r,e){return st(r>>>0,e)}let V=null;function P(){return(V===null||V.byteLength===0)&&(V=new Uint8Array(i.memory.buffer)),V}function k(r,e){try{return r.apply(this,e)}catch(t){const n=Pe(t);i.__wbindgen_exn_store(n)}}function O(r){return r==null}function _t(r,e){const t=e(r.length*8,8)>>>0;return rt().set(r,t/8),u=r.length,t}function it(r,e){const t=e(r.length*1,1)>>>0;return P().set(r,t/1),u=r.length,t}function we(r,e){const t=e(r.length*4,4)>>>0;for(let n=0;n<r.length;n++){const _=Pe(r[n]);m().setUint32(t+4*n,_,!0)}return u=r.length,t}function w(r,e,t){if(t===void 0){const l=q.encode(r),a=e(l.length,1)>>>0;return P().subarray(a,a+l.length).set(l),u=l.length,a}let n=r.length,_=e(n,1)>>>0;const s=P();let c=0;for(;c<n;c++){const l=r.charCodeAt(c);if(l>127)break;s[_+c]=l}if(c!==n){c!==0&&(r=r.slice(c)),_=t(_,n,n=c+r.length*3,1)>>>0;const l=P().subarray(_+c,_+n),a=q.encodeInto(r,l);c+=a.written,_=t(_,n,c,1)>>>0}return u=c,_}function A(r){const e=i.__wbindgen_externrefs.get(r);return i.__externref_table_dealloc(r),e}let ee=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ee.decode();const ot=2146435072;let ce=0;function st(r,e){return ce+=e,ce>=ot&&(ee=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),ee.decode(),ce=e),ee.decode(P().subarray(r,r+e))}const q=new TextEncoder;"encodeInto"in q||(q.encodeInto=function(r,e){const t=q.encode(r);return e.set(t),{read:r.length,written:t.length}});let u=0,i;function Ue(r,e){return i=r.exports,C=null,I=null,V=null,i.__wbindgen_start(),i}async function ct(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(_){if(r.ok&&t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",_);else throw _}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function lt(r){if(i!==void 0)return i;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=Ee();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Ue(t)}async function Le(r){if(i!==void 0)return i;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0&&(r=new URL);const e=Ee();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t}=await ct(await r,e);return Ue(t)}const at=Object.freeze(Object.defineProperty({__proto__:null,Dialect:ke,Language:He,Lint:W,Linter:fe,OrganizedGroup:re,Span:_e,Suggestion:Y,SuggestionKind:Qe,default:Le,get_default_lint_config:Ze,get_default_lint_config_as_json:et,initSync:lt,setup:tt,to_title_case:nt},Symbol.toStringTag,{value:"Module"})),gt=Object.freeze({American:0,0:"American",British:1,1:"British",Australian:2,2:"Australian",Canadian:3,3:"Canadian",Indian:4,4:"Indian"}),ft=Object.freeze({Plain:0,0:"Plain",Markdown:1,1:"Markdown",Typst:2,2:"Typst"});class v{static __wrap(e){const t=Object.create(v.prototype);return t.__wbg_ptr=e,xe.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof v?e.__destroy_into_raw():0}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,xe.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_lint_free(e,0)}static from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.lint_from_json(t,n);if(_[2])throw x(_[1]);return v.__wrap(_[0])}get_problem_text(){let e,t;try{const n=o.lint_get_problem_text(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}lint_kind(){let e,t;try{const n=o.lint_lint_kind(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}lint_kind_pretty(){let e,t;try{const n=o.lint_lint_kind_pretty(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}message(){let e,t;try{const n=o.lint_message(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}message_html(){let e,t;try{const n=o.lint_message_html(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}span(){const e=o.lint_span(this.__wbg_ptr);return R.__wrap(e)}suggestion_count(){return o.lint_suggestion_count(this.__wbg_ptr)>>>0}suggestions(){const e=o.lint_suggestions(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}to_json(){let e,t;try{const n=o.lint_to_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);class L{static __wrap(e){const t=Object.create(L.prototype);return t.__wbg_ptr=e,Oe.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_linter_free(e,0)}apply_suggestion(e,t,n){let _,s;try{const a=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),y=d;le(t,v),le(n,F);const b=o.linter_apply_suggestion(this.__wbg_ptr,a,y,t.__wbg_ptr,n.__wbg_ptr);var c=b[0],l=b[1];if(b[3])throw c=0,l=0,x(b[2]);return _=c,s=l,f(c,l)}finally{o.__wbindgen_free(_,s,1)}}clear_ignored_lints(){o.linter_clear_ignored_lints(this.__wbg_ptr)}clear_words(){o.linter_clear_words(this.__wbg_ptr)}context_hash(e,t){const n=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=d;le(t,v);const s=o.linter_context_hash(this.__wbg_ptr,n,_,t.__wbg_ptr);return BigInt.asUintN(64,s)}export_ignored_lints(){let e,t;try{const n=o.linter_export_ignored_lints(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}export_words(){const e=o.linter_export_words(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}generate_stats_file(){let e,t;try{const n=o.linter_generate_stats_file(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_dialect(){return o.linter_get_dialect(this.__wbg_ptr)}get_lint_config_as_json(){let e,t;try{const n=o.linter_get_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_lint_config_as_object(){return o.linter_get_lint_config_as_object(this.__wbg_ptr)}get_lint_descriptions_as_json(){let e,t;try{const n=o.linter_get_lint_descriptions_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_lint_descriptions_as_object(){return o.linter_get_lint_descriptions_as_object(this.__wbg_ptr)}get_lint_descriptions_html_as_json(){let e,t;try{const n=o.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_lint_descriptions_html_as_object(){return o.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr)}get_structured_lint_config_as_json(){let e,t;try{const n=o.linter_get_structured_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_structured_lint_config_as_object(){return o.linter_get_structured_lint_config_as_object(this.__wbg_ptr)}ignore_hashes(e){const t=ht(e,o.__wbindgen_malloc),n=d;o.linter_ignore_hashes(this.__wbg_ptr,t,n)}ignore_lints(e,t){const n=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=d,s=ye(t,o.__wbindgen_malloc),c=d;o.linter_ignore_lints(this.__wbg_ptr,n,_,s,c)}import_ignored_lints(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.linter_import_ignored_lints(this.__wbg_ptr,t,n);if(_[1])throw x(_[0])}import_stats_file(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.linter_import_stats_file(this.__wbg_ptr,t,n);if(_[1])throw x(_[0])}import_weirpack(e){const t=mt(e,o.__wbindgen_malloc),n=d,_=o.linter_import_weirpack(this.__wbg_ptr,t,n);if(_[2])throw x(_[1]);return x(_[0])}import_words(e){const t=ye(e,o.__wbindgen_malloc),n=d;o.linter_import_words(this.__wbg_ptr,t,n)}is_likely_english(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d;return o.linter_is_likely_english(this.__wbg_ptr,t,n)!==0}isolate_english(e){let t,n;try{const _=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d,c=o.linter_isolate_english(this.__wbg_ptr,_,s);return t=c[0],n=c[1],f(c[0],c[1])}finally{o.__wbindgen_free(t,n,1)}}lint(e,t,n,_,s,c){const l=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d;var y=z(_)?0:p(_,o.__wbindgen_malloc,o.__wbindgen_realloc),b=d;const h=o.linter_lint(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=K(h[0],h[1]).slice();return o.__wbindgen_free(h[0],h[1]*4,4),T}static new(e){const t=o.linter_new(e);return L.__wrap(t)}organized_lints(e,t,n,_,s,c){const l=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d;var y=z(_)?0:p(_,o.__wbindgen_malloc,o.__wbindgen_realloc),b=d;const h=o.linter_organized_lints(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=K(h[0],h[1]).slice();return o.__wbindgen_free(h[0],h[1]*4,4),T}set_lint_config_from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.linter_set_lint_config_from_json(this.__wbg_ptr,t,n);if(_[1])throw x(_[0])}set_lint_config_from_object(e){const t=o.linter_set_lint_config_from_object(this.__wbg_ptr,e);if(t[1])throw x(t[0])}summarize_stats(e,t){return o.linter_summarize_stats(this.__wbg_ptr,!z(e),z(e)?BigInt(0):e,!z(t),z(t)?BigInt(0):t)}}Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);class D{static __wrap(e){const t=Object.create(D.prototype);return t.__wbg_ptr=e,ze.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ze.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_organizedgroup_free(e,0)}get group(){let e,t;try{const n=o.__wbg_get_organizedgroup_group(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get lints(){const e=o.__wbg_get_organizedgroup_lints(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}set group(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d;o.__wbg_set_organizedgroup_group(this.__wbg_ptr,t,n)}set lints(e){const t=ye(e,o.__wbindgen_malloc),n=d;o.__wbg_set_organizedgroup_lints(this.__wbg_ptr,t,n)}}Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);class R{static __wrap(e){const t=Object.create(R.prototype);return t.__wbg_ptr=e,$e.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,$e.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_span_free(e,0)}get end(){return o.__wbg_get_span_end(this.__wbg_ptr)>>>0}get start(){return o.__wbg_get_span_start(this.__wbg_ptr)>>>0}set end(e){o.__wbg_set_span_end(this.__wbg_ptr,e)}set start(e){o.__wbg_set_span_start(this.__wbg_ptr,e)}static from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.span_from_json(t,n);if(_[2])throw x(_[1]);return R.__wrap(_[0])}is_empty(){return o.span_is_empty(this.__wbg_ptr)!==0}len(){return o.span_len(this.__wbg_ptr)>>>0}static new(e,t){const n=o.span_new(e,t);return R.__wrap(n)}to_json(){let e,t;try{const n=o.span_to_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);class F{static __wrap(e){const t=Object.create(F.prototype);return t.__wbg_ptr=e,Re.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Re.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_suggestion_free(e,0)}static from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.suggestion_from_json(t,n);if(_[2])throw x(_[1]);return F.__wrap(_[0])}get_replacement_text(){let e,t;try{const n=o.suggestion_get_replacement_text(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}kind(){return o.suggestion_kind(this.__wbg_ptr)}to_json(){let e,t;try{const n=o.suggestion_to_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(F.prototype[Symbol.dispose]=F.prototype.free);const ut=Object.freeze({Replace:0,0:"Replace",Remove:1,1:"Remove",InsertAfter:2,2:"InsertAfter"});function dt(){return o.get_default_lint_config()}function bt(){let r,e;try{const t=o.get_default_lint_config_as_json();return r=t[0],e=t[1],f(t[0],t[1])}finally{o.__wbindgen_free(r,e,1)}}function wt(){o.setup()}function pt(r){let e,t;try{const n=p(r,o.__wbindgen_malloc,o.__wbindgen_realloc),_=d,s=o.to_title_case(n,_);return e=s[0],t=s[1],f(s[0],s[1])}finally{o.__wbindgen_free(e,t,1)}}function De(){return{__proto__:null,"./harper_wasm_bg.js":{__proto__:null,__wbg_Error_bce6d499ff0a4aff:function(e,t){return Error(f(e,t))},__wbg_String_8564e559799eccda:function(e,t){const n=String(t),_=p(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d;j().setInt32(e+4,s,!0),j().setInt32(e+0,_,!0)},__wbg___wbindgen_boolean_get_2304fb8c853028c8:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return z(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_edece8177ad01481:function(e,t){const n=pe(t),_=p(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d;j().setInt32(e+4,s,!0),j().setInt32(e+0,_,!0)},__wbg___wbindgen_is_function_5cd60d5cf78b4eef:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_b4593df85baada48:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_dde0fd9020db4434:function(e){return typeof e=="string"},__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c:function(e,t){return e==t},__wbg___wbindgen_number_get_f73a1244370fcc2c:function(e,t){const n=t,_=typeof n=="number"?n:void 0;j().setFloat64(e+8,z(_)?0:_,!0),j().setInt32(e+0,!z(_),!0)},__wbg___wbindgen_string_get_d109740c0d18f4d7:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var s=z(_)?0:p(_,o.__wbindgen_malloc,o.__wbindgen_realloc),c=d;j().setInt32(e+4,c,!0),j().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_9c31b086c2b26051:function(e,t){throw new Error(f(e,t))},__wbg_call_13665d9f14390edc:function(){return B(function(e,t){return e.call(t)},arguments)},__wbg_done_54b8da57023b7ed2:function(e){return e.done},__wbg_entries_564a7e8b1e54ede5:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(f(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_getRandomValues_3f44b700395062e5:function(){return B(function(e,t){globalThis.crypto.getRandomValues(ae(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return B(function(e,t){globalThis.crypto.getRandomValues(ae(e,t))},arguments)},__wbg_getTime_09f1dd40a44edb30:function(e){return e.getTime()},__wbg_get_3e9a707ab7d352eb:function(){return B(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_98fdf51d029a75eb:function(e,t){return e[t>>>0]},__wbg_get_unchecked_1dfe6d05ad91d9b7:function(e,t){return e[t>>>0]},__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Uint8Array_abd07d4bd221d50b:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_iterator_1441b47f341dc34f:function(){return Symbol.iterator},__wbg_length_2591a0f4f659a55c:function(e){return e.length},__wbg_length_56fcd3e2b7e0299d:function(e){return e.length},__wbg_lint_new:function(e){return v.__wrap(e)},__wbg_lint_unwrap:function(e){return v.__unwrap(e)},__wbg_log_0c201ade58bb55e1:function(e,t,n,_,s,c,l,a){let y,b;try{y=e,b=t,console.log(f(e,t),f(n,_),f(s,c),f(l,a))}finally{o.__wbindgen_free(y,b,1)}},__wbg_log_ce2c4456b290c5e7:function(e,t){let n,_;try{n=e,_=t,console.log(f(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_mark_b4d943f3bc2d2404:function(e,t){performance.mark(f(e,t))},__wbg_measure_84362959e621a2c1:function(){return B(function(e,t,n,_){let s,c,l,a;try{s=e,c=t,l=n,a=_,performance.measure(f(e,t),f(n,_))}finally{o.__wbindgen_free(s,c,1),o.__wbindgen_free(l,a,1)}},arguments)},__wbg_new_02d162bc6cf02f60:function(){return new Object},__wbg_new_070df68d66325372:function(){return new Map},__wbg_new_0_2722fcdb71a888a6:function(){return new Date},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_310879b66b6e95e1:function(){return new Array},__wbg_new_7ddec6de44ff8f5d:function(e){return new Uint8Array(e)},__wbg_next_2a4e19f4f5083b0f:function(e){return e.next},__wbg_next_6429a146bf756f93:function(){return B(function(e){return e.next()},arguments)},__wbg_organizedgroup_new:function(e){return D.__wrap(e)},__wbg_prototypesetcall_5f9bdc8d75e07276:function(e,t,n){Uint8Array.prototype.set.call(ae(e,t),n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_78ea6a19f4818587:function(e,t,n){e[t>>>0]=n},__wbg_set_facb7a5914e0fa39:function(e,t,n){return e.set(t,n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=p(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d;j().setInt32(e+4,s,!0),j().setInt32(e+0,_,!0)},__wbg_suggestion_new:function(e){return F.__wrap(e)},__wbg_value_9cc0518af87a489c:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e,t){return f(e,t)},__wbindgen_init_externref_table:function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const xe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_lint_free(r,1)),Oe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_linter_free(r,1)),ze=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_organizedgroup_free(r,1)),$e=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_span_free(r,1)),Re=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_suggestion_free(r,1));function Ce(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}function le(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`)}function pe(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let s="[";_>0&&(s+=pe(r[0]));for(let c=1;c<_;c++)s+=", "+pe(r[c]);return s+="]",s}const t=/\[object ([^\]]+)\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
3
3
  ${r.stack}`:n}function K(r,e){r=r>>>0;const t=j(),n=[];for(let _=r;_<r+4*e;_+=4)n.push(o.__wbindgen_externrefs.get(t.getUint32(_,!0)));return o.__externref_drop_slice(r,e),n}function ae(r,e){return r=r>>>0,U().subarray(r/1,r/1+e)}let N=null;function yt(){return(N===null||N.byteLength===0)&&(N=new BigUint64Array(o.memory.buffer)),N}let M=null;function j(){return(M===null||M.buffer.detached===!0||M.buffer.detached===void 0&&M.buffer!==o.memory.buffer)&&(M=new DataView(o.memory.buffer)),M}function f(r,e){return St(r>>>0,e)}let G=null;function U(){return(G===null||G.byteLength===0)&&(G=new Uint8Array(o.memory.buffer)),G}function B(r,e){try{return r.apply(this,e)}catch(t){const n=Ce(t);o.__wbindgen_exn_store(n)}}function z(r){return r==null}function ht(r,e){const t=e(r.length*8,8)>>>0;return yt().set(r,t/8),d=r.length,t}function mt(r,e){const t=e(r.length*1,1)>>>0;return U().set(r,t/1),d=r.length,t}function ye(r,e){const t=e(r.length*4,4)>>>0;for(let n=0;n<r.length;n++){const _=Ce(r[n]);j().setUint32(t+4*n,_,!0)}return d=r.length,t}function p(r,e,t){if(t===void 0){const l=X.encode(r),a=e(l.length,1)>>>0;return U().subarray(a,a+l.length).set(l),d=l.length,a}let n=r.length,_=e(n,1)>>>0;const s=U();let c=0;for(;c<n;c++){const l=r.charCodeAt(c);if(l>127)break;s[_+c]=l}if(c!==n){c!==0&&(r=r.slice(c)),_=t(_,n,n=c+r.length*3,1)>>>0;const l=U().subarray(_+c,_+n),a=X.encodeInto(r,l);c+=a.written,_=t(_,n,c,1)>>>0}return d=c,_}function x(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let te=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});te.decode();const jt=2146435072;let ge=0;function St(r,e){return ge+=e,ge>=jt&&(te=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),te.decode(),ge=e),te.decode(U().subarray(r,r+e))}const X=new TextEncoder;"encodeInto"in X||(X.encodeInto=function(r,e){const t=X.encode(r);return e.set(t),{read:r.length,written:t.length}});let d=0,o;function Ve(r,e){return o=r.exports,N=null,M=null,G=null,o.__wbindgen_start(),o}async function vt(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(_){if(r.ok&&t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",_);else throw _}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function At(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=De();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Ve(t)}async function xt(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0&&(r=new URL);const e=De();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t}=await vt(await r,e);return Ve(t)}const Ot=Object.freeze(Object.defineProperty({__proto__:null,Dialect:gt,Language:ft,Lint:v,Linter:L,OrganizedGroup:D,Span:R,Suggestion:F,SuggestionKind:ut,default:xt,get_default_lint_config:dt,get_default_lint_config_as_json:bt,initSync:At,setup:wt,to_title_case:pt},Symbol.toStringTag,{value:"Module"})),zt=class ne extends Promise{constructor(e){super(t=>{t()}),he(this,E),he(this,S),H(this,E,e)}static from(e){return new ne(t=>{t(e())})}static resolve(e){return new ne(t=>{t(e)})}static reject(e){return new ne((t,n)=>{n(e)})}then(e,t){return $(this,S)??H(this,S,new Promise($(this,E))),$(this,S).then(e,t)}catch(e){return $(this,S)??H(this,S,new Promise($(this,E))),$(this,S).catch(e)}finally(e){return $(this,S)??H(this,S,new Promise($(this,E))),$(this,S).finally(e)}};E=new WeakMap;S=new WeakMap;let Ne=zt;const $t=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const _=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Rt(_,s)&&n||Object.defineProperty(r,t,s)},Rt=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Ft=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},Tt=(r,e)=>`/* Wrapped ${r}*/
4
4
  ${e}`,It=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Wt=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,_=Tt.bind(null,n,e.toString());Object.defineProperty(_,"name",Mt),Object.defineProperty(r,"toString",{...It,value:_})};function kt(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const _ of Reflect.ownKeys(e))$t(r,e,_,t);return Ft(r,e),Wt(r,e,n),r}const Bt=new WeakMap;function Fe(r,{cacheKey:e=([n])=>n,cache:t=new Map}={}){const n=new Map,_=function(...s){const c=e(s);if(n.has(c))return n.get(c);const l=(async()=>{try{if(t&&await t.has(c))return await t.get(c);const y=await r.apply(this,s);try{return y}finally{t&&await t.set(c,y)}}finally{n.delete(c)}})();return n.set(c,l),l};return kt(_,r,{ignoreNonConfigurable:!0}),Bt.set(_,t),_}function Ge(r){return r.includes("harper_wasm_slim")?"slim":"full"}function Ct(r){return r.glueFlavor??Ge(typeof r.url=="string"?r.url:r.url.href)}function Et(r){return r==="slim"?at:Ot}function Pt(r,e){return e==="slim"?r:r.includes("harper_wasm_bg.wasm")?r.replace("harper_wasm_bg.wasm","harper_wasm_slim_bg.wasm"):null}function Te(r){return typeof process<"u"&&r.startsWith("file://")?Ke(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).then(e=>new Promise((t,n)=>{e.readFile(new URL(r).pathname,(_,s)=>{_&&n(_),t(s)})})):r}async function Ie(r,e){const t=Et(e),n=Pt(r,e);if(n!=null)try{await Le({module_or_path:Te(n)})}catch(_){if(e==="slim")throw _}return await t.default({module_or_path:Te(r)}),t}const Ut={full:Fe(r=>Ie(r,"full")),slim:Fe(r=>Ie(r,"slim"))};function Je(r,e){return Ut[e](r)}function Vt(r,e){return qe.create(r,e)}class qe{constructor(){ie(this,"url",""),ie(this,"glueFlavor","full"),ie(this,"inner",null)}static create(e,t){const n=new Lt;return n.url=e,n.glueFlavor=t??Ge(typeof e=="string"?e:e.href),n.inner=Ne.from(()=>Je(typeof n.url=="string"?n.url:n.url.href,n.glueFlavor)),n}async getDefaultLintConfigAsJSON(){return(await this.inner).get_default_lint_config_as_json()}async getDefaultLintConfig(){return(await this.inner).get_default_lint_config()}async toTitleCase(e){return(await this.inner).to_title_case(e)}async setup(){(await this.inner).setup()}}class Lt extends qe{async createLinter(e){return(await this.getBinaryModule()).Linter.new(e??ke.American)}async getBinaryModule(){return await Ne.from(()=>Je(typeof this.url=="string"?this.url:this.url.href,this.glueFlavor))}}export{qe as B,ke as D,He as L,Ne as P,Qe as S,Vt as c,Ct as r};
@@ -1,3 +1,3 @@
1
- import{u as ye,r as n,j as e}from"./react-CsO_xvbl.js";import{i as h,M as H,L as p,G as q,C as ie,j as ne,T as ke,R as be,k as l}from"./index-BLh_AgbG.js";import{M as ve,P as Ce,a as Ne}from"./plus-CymJUapL.js";const we=h("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const ae=h("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const G=h("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oe=h("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);const W=h("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const ze=h("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const Se=h("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const Ee=h("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);const Te=h("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function Ue({open:g,project:o,onOpenChange:y,onBeforeMutation:r}){const{t:s,i18n:E}=ye(),[i,m]=n.useState(null),[J,V]=n.useState([]),[T,k]=n.useState(""),[F,K]=n.useState(()=>re(o.name)),[_,ce]=n.useState(!0),[D,Z]=n.useState(""),[b,M]=n.useState(null),[f,j]=n.useState(null),[R,U]=n.useState(!1),[le,v]=n.useState(!1),[$,L]=n.useState(!0),[P,A]=n.useState(!0),[a,C]=n.useState(""),[Q,N]=n.useState(""),[X,B]=n.useState(""),[u,x]=n.useState(!1),[w,Y]=n.useState(10),O=n.useRef(null),z=async(t=!1)=>{const c=await l(`/api/projects/${o.id}/git`);if(m(c.status),t&&(L(!c.status.tokenConfigured),A(!c.status.remoteUrl)),c.status.initialized&&c.status.latestCommit){const S=await l(`/api/projects/${o.id}/git/history`);V(S.commits)}else V([])};n.useEffect(()=>{if(!g){document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),x(!1),k("");return}N(""),B(""),M(null),x(!1),K(re(o.name)),C("load"),r().then(()=>z(!0)).catch(t=>N(t instanceof Error?t.message:s("errors.generic"))).finally(()=>C(""))},[g,o.id]),n.useEffect(()=>{const t=()=>x(document.fullscreenElement===O.current);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),n.useEffect(()=>{if(!u)return;const t=c=>{c.key==="Escape"&&!document.fullscreenElement&&x(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[u]);const d=async(t,c,S,ee)=>{C(t),N(""),B("");try{await c(),S&&B(S)}catch(se){const te=se instanceof Error?se.message:s("errors.generic");N(ee?`${ee}: ${te}`:te)}finally{C("")}},de=()=>d("token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"PUT",body:JSON.stringify({token:T})});m(t.status),k(""),L(!1)},s("git.tokenSaved")),he=()=>d("remove-token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"DELETE"});m(t.status),k("")},s("git.tokenRemoved")),ge=()=>d("repository",async()=>{const t=await l(`/api/projects/${o.id}/git/repository`,{method:"POST",body:JSON.stringify({name:F,private:_})});m(t.status),A(!1)},s("git.repositoryCreated")),ue=()=>d("commit",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/commit`,{method:"POST",body:JSON.stringify({message:D})});m(t.status),Z(""),M(null),await z()},s("git.committed")),me=()=>d("push",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/push`,{method:"POST"});m(t.status),await z()},s("git.pushed"),s("git.pushFailed")),I=t=>d("diff",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const c=t?`?revision=${encodeURIComponent(t)}`:"";M(await l(`/api/projects/${o.id}/git/diff${c}`))}),fe=async()=>{if(u){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),x(!1);return}const t=O.current;if(t?.requestFullscreen)try{await t.requestFullscreen()}catch{}x(!0)},xe=()=>{const t=f;t&&(j(null),d("checkout",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/checkout`,{method:"POST",body:JSON.stringify({revision:t==="branch"?null:t.sha,force:R})}),window.location.reload()}))},pe=()=>{v(!1),d("discard",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/discard`,{method:"POST"}),window.location.reload()})},je=a==="load"&&!i;return e.jsxs(e.Fragment,{children:[e.jsx(H,{open:g,extraWide:!0,className:u?"git-dialog-modal-fullscreen":void 0,title:s("git.title"),description:s("git.description"),onOpenChange:y,footer:e.jsx("button",{onClick:()=>y(!1),children:s("common.close")}),children:e.jsxs("div",{className:"git-dialog",children:[je&&e.jsxs("div",{className:"git-loading",children:[e.jsx(p,{className:"spin",size:22}),s("common.loading")]}),Q&&e.jsx("p",{className:"git-message error",children:Q}),X&&e.jsxs("p",{className:"git-message success",children:[e.jsx(q,{size:14}),X]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":$,onClick:()=>L(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(ze,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.authentication")}),e.jsx("small",{children:i.tokenConfigured?s("git.connectedAs",{login:i.githubLogin}):s("git.authenticationHint")})]})]}),$?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),$&&e.jsxs("div",{className:"git-section-content",children:[e.jsxs("div",{className:"git-token-guidance",children:[e.jsx("strong",{children:s("git.recommendedAccessTitle")}),e.jsx("span",{children:s("git.recommendedAccess")})]}),i.tokenConfigured&&e.jsxs("div",{className:"git-account",children:[e.jsx(W,{size:17}),e.jsx("span",{children:s("git.connectedAs",{login:i.githubLogin})}),e.jsxs("button",{className:"danger-text",disabled:!!a,onClick:he,children:[e.jsx(ke,{size:14}),s("git.removeToken")]})]}),e.jsxs("label",{className:"form-field",children:[i.tokenConfigured?s("git.replaceToken"):s("git.token"),e.jsx("input",{type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",value:T,placeholder:s("git.tokenPlaceholder"),onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"git-inline-actions",children:[e.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noreferrer",children:[s("git.createToken"),e.jsx(ae,{size:12})]}),e.jsxs("button",{disabled:!!a||T.trim().length<20,onClick:de,children:[a==="token"&&e.jsx(p,{className:"spin",size:13}),s("git.saveToken")]})]})]})]}),e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":P,onClick:()=>A(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(W,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.repository")}),e.jsx("small",{children:i.remoteUrl?i.repositoryName??i.remoteUrl:i.initialized?s("git.localReady"):s("git.localPending")})]})]}),P?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),P&&e.jsx("div",{className:"git-section-content",children:i.remoteUrl?e.jsxs("div",{className:"git-repository-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:i.repositoryName??s("git.origin")}),e.jsxs("small",{children:[i.branch??s("git.detachedAt",{revision:i.latestCommit?.shortSha??"HEAD"})," · ",i.dirty?s("git.changedFiles",{count:i.changedFiles}):s("git.clean")]})]}),i.repositoryHtmlUrl&&e.jsxs("a",{href:i.repositoryHtmlUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(ae,{size:14}),s("git.openGitHub")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"form-field",children:[s("git.repositoryName"),e.jsx("input",{value:F,onChange:t=>K(t.target.value)})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:t=>ce(t.target.checked)}),s("git.privateRepository")]}),e.jsxs("button",{className:"git-primary-action",disabled:!!a||!i.tokenConfigured||!F.trim(),onClick:ge,children:[a==="repository"?e.jsx(p,{className:"spin",size:14}):e.jsx(W,{size:14}),s("git.createRepository")]})]})})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(oe,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.commitAndPush")}),e.jsx("small",{children:i.branch?s("git.identity",{username:o.ownerUsername}):s("git.detachedHead")})]})]}),e.jsxs("label",{className:"form-field",children:[s("git.commitMessage"),e.jsx("textarea",{rows:3,value:D,placeholder:s("git.commitPlaceholder"),onChange:t=>Z(t.target.value)})]}),e.jsxs("div",{className:"git-action-row",children:[e.jsxs("button",{title:i.dirty?void 0:s("git.noChangesToCommit"),disabled:!!a||!i.branch||!i.dirty||!D.trim(),onClick:ue,children:[a==="commit"?e.jsx(p,{className:"spin",size:14}):e.jsx(oe,{size:14}),s("git.commit")]}),e.jsxs("button",{disabled:!!a||!i.branch||!i.tokenConfigured||!i.remoteUrl||!i.latestCommit,onClick:me,children:[a==="push"?e.jsx(p,{className:"spin",size:14}):e.jsx(we,{size:14}),s("git.push"),i.ahead>0&&e.jsx("span",{className:"git-count",children:i.ahead})]}),e.jsxs("button",{disabled:!!a||!i.latestCommit,onClick:()=>{I()},children:[a==="diff"?e.jsx(p,{className:"spin",size:14}):e.jsx(G,{size:14}),s("git.workingDiff")]}),e.jsxs("button",{className:"git-discard-button",title:i.restorable?s("git.discardChanges"):s("git.noChangesToDiscard"),disabled:!!a||!i.latestCommit||!i.restorable,onClick:()=>v(!0),children:[e.jsx(be,{size:14}),s("git.discardChanges")]}),!i.branch&&e.jsxs("button",{disabled:!!a,onClick:()=>{U(!1),j("branch")},children:[e.jsx(q,{size:14}),s("git.returnToBranch",{branch:i.defaultBranch})]}),e.jsxs("button",{disabled:!!a,onClick:()=>{d("refresh",z)},children:[e.jsx(Ee,{className:a==="refresh"?"spin":"",size:14}),s("git.refresh")]})]})]}),b&&e.jsxs("section",{ref:O,className:`git-section git-diff-section${u?" is-fullscreen":""}`,children:[e.jsxs("div",{className:"git-diff-heading",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(G,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.diffTitle")}),e.jsxs("small",{children:[b.title,b.truncated?` · ${s("git.diffTruncated")}`:""]})]})]}),e.jsxs("div",{className:"git-diff-controls",children:[e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":s("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w<=8,title:s("git.diffFontDecrease"),"aria-label":s("git.diffFontDecrease"),onClick:()=>Y(t=>Math.max(8,t-1)),children:e.jsx(ve,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[w,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w>=24,title:s("git.diffFontIncrease"),"aria-label":s("git.diffFontIncrease"),onClick:()=>Y(t=>Math.min(24,t+1)),children:e.jsx(Ce,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:s(u?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":s(u?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{fe()},children:u?e.jsx(Se,{size:15}):e.jsx(Ne,{size:15})})]})]}),e.jsx(Fe,{content:b.diff,empty:s("git.noChanges"),fontSize:w})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(q,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.history")}),e.jsx("small",{children:s("git.historyHint")})]})]}),e.jsxs("div",{className:"git-history",children:[J.map(t=>e.jsxs("article",{children:[e.jsx("code",{children:t.shortSha}),e.jsxs("div",{children:[e.jsx("strong",{children:t.message}),e.jsxs("small",{children:[t.authorName," · ",new Date(t.authoredAt).toLocaleString(E.resolvedLanguage)]})]}),e.jsxs("span",{children:[e.jsx("button",{title:s("git.viewCommitDiff"),disabled:!!a,onClick:()=>{I(t.sha)},children:e.jsx(G,{size:14})}),e.jsx("button",{title:s("git.checkoutVersion"),disabled:!!a,onClick:()=>{U(!1),j(t)},children:e.jsx(Te,{size:14})})]})]},t.sha)),J.length===0&&e.jsx("p",{className:"muted",children:s("git.noCommits")})]})]})]})]})}),e.jsx(H,{open:!!f,title:s(f==="branch"?"git.returnTitle":"git.checkoutTitle"),description:f==="branch"?s("git.returnDescription",{branch:i?.defaultBranch??"main"}):s("git.checkoutDescription",{revision:f?.shortSha??"",message:f?.message??""}),onOpenChange:t=>{t||j(null)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>j(null),children:s("common.cancel")}),e.jsx("button",{className:R?"danger":"primary",onClick:xe,children:s("git.checkout")})]}),children:e.jsxs("label",{className:"git-force-checkout",children:[e.jsx("input",{type:"checkbox",checked:R,onChange:t=>U(t.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.forceCheckout")}),e.jsx("small",{children:s("git.forceCheckoutDescription")})]})]})}),e.jsx(H,{open:le,title:s("git.discardTitle"),description:s("git.discardDescription"),onOpenChange:v,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>v(!1),children:s("common.cancel")}),e.jsx("button",{className:"danger",onClick:pe,children:s("git.discardConfirm")})]}),children:e.jsx(e.Fragment,{})})]})}function Fe({content:g,empty:o,fontSize:y}){return g.trim()?e.jsx("pre",{className:"git-diff",style:{fontSize:`${y}px`},children:g.split(`
1
+ import{u as ye,r as n,j as e}from"./react-CsO_xvbl.js";import{i as h,M as H,L as p,G as q,C as ie,j as ne,T as ke,R as be,k as l}from"./index-DIKn1Ihd.js";import{M as ve,P as Ce,a as Ne}from"./plus-yvkxQFZU.js";const we=h("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const ae=h("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const G=h("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oe=h("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);const W=h("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const ze=h("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const Se=h("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const Ee=h("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);const Te=h("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function Ue({open:g,project:o,onOpenChange:y,onBeforeMutation:r}){const{t:s,i18n:E}=ye(),[i,m]=n.useState(null),[J,V]=n.useState([]),[T,k]=n.useState(""),[F,K]=n.useState(()=>re(o.name)),[_,ce]=n.useState(!0),[D,Z]=n.useState(""),[b,M]=n.useState(null),[f,j]=n.useState(null),[R,U]=n.useState(!1),[le,v]=n.useState(!1),[$,L]=n.useState(!0),[P,A]=n.useState(!0),[a,C]=n.useState(""),[Q,N]=n.useState(""),[X,B]=n.useState(""),[u,x]=n.useState(!1),[w,Y]=n.useState(10),O=n.useRef(null),z=async(t=!1)=>{const c=await l(`/api/projects/${o.id}/git`);if(m(c.status),t&&(L(!c.status.tokenConfigured),A(!c.status.remoteUrl)),c.status.initialized&&c.status.latestCommit){const S=await l(`/api/projects/${o.id}/git/history`);V(S.commits)}else V([])};n.useEffect(()=>{if(!g){document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),x(!1),k("");return}N(""),B(""),M(null),x(!1),K(re(o.name)),C("load"),r().then(()=>z(!0)).catch(t=>N(t instanceof Error?t.message:s("errors.generic"))).finally(()=>C(""))},[g,o.id]),n.useEffect(()=>{const t=()=>x(document.fullscreenElement===O.current);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),n.useEffect(()=>{if(!u)return;const t=c=>{c.key==="Escape"&&!document.fullscreenElement&&x(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[u]);const d=async(t,c,S,ee)=>{C(t),N(""),B("");try{await c(),S&&B(S)}catch(se){const te=se instanceof Error?se.message:s("errors.generic");N(ee?`${ee}: ${te}`:te)}finally{C("")}},de=()=>d("token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"PUT",body:JSON.stringify({token:T})});m(t.status),k(""),L(!1)},s("git.tokenSaved")),he=()=>d("remove-token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"DELETE"});m(t.status),k("")},s("git.tokenRemoved")),ge=()=>d("repository",async()=>{const t=await l(`/api/projects/${o.id}/git/repository`,{method:"POST",body:JSON.stringify({name:F,private:_})});m(t.status),A(!1)},s("git.repositoryCreated")),ue=()=>d("commit",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/commit`,{method:"POST",body:JSON.stringify({message:D})});m(t.status),Z(""),M(null),await z()},s("git.committed")),me=()=>d("push",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/push`,{method:"POST"});m(t.status),await z()},s("git.pushed"),s("git.pushFailed")),I=t=>d("diff",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const c=t?`?revision=${encodeURIComponent(t)}`:"";M(await l(`/api/projects/${o.id}/git/diff${c}`))}),fe=async()=>{if(u){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),x(!1);return}const t=O.current;if(t?.requestFullscreen)try{await t.requestFullscreen()}catch{}x(!0)},xe=()=>{const t=f;t&&(j(null),d("checkout",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/checkout`,{method:"POST",body:JSON.stringify({revision:t==="branch"?null:t.sha,force:R})}),window.location.reload()}))},pe=()=>{v(!1),d("discard",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/discard`,{method:"POST"}),window.location.reload()})},je=a==="load"&&!i;return e.jsxs(e.Fragment,{children:[e.jsx(H,{open:g,extraWide:!0,className:u?"git-dialog-modal-fullscreen":void 0,title:s("git.title"),description:s("git.description"),onOpenChange:y,footer:e.jsx("button",{onClick:()=>y(!1),children:s("common.close")}),children:e.jsxs("div",{className:"git-dialog",children:[je&&e.jsxs("div",{className:"git-loading",children:[e.jsx(p,{className:"spin",size:22}),s("common.loading")]}),Q&&e.jsx("p",{className:"git-message error",children:Q}),X&&e.jsxs("p",{className:"git-message success",children:[e.jsx(q,{size:14}),X]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":$,onClick:()=>L(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(ze,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.authentication")}),e.jsx("small",{children:i.tokenConfigured?s("git.connectedAs",{login:i.githubLogin}):s("git.authenticationHint")})]})]}),$?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),$&&e.jsxs("div",{className:"git-section-content",children:[e.jsxs("div",{className:"git-token-guidance",children:[e.jsx("strong",{children:s("git.recommendedAccessTitle")}),e.jsx("span",{children:s("git.recommendedAccess")})]}),i.tokenConfigured&&e.jsxs("div",{className:"git-account",children:[e.jsx(W,{size:17}),e.jsx("span",{children:s("git.connectedAs",{login:i.githubLogin})}),e.jsxs("button",{className:"danger-text",disabled:!!a,onClick:he,children:[e.jsx(ke,{size:14}),s("git.removeToken")]})]}),e.jsxs("label",{className:"form-field",children:[i.tokenConfigured?s("git.replaceToken"):s("git.token"),e.jsx("input",{type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",value:T,placeholder:s("git.tokenPlaceholder"),onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"git-inline-actions",children:[e.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noreferrer",children:[s("git.createToken"),e.jsx(ae,{size:12})]}),e.jsxs("button",{disabled:!!a||T.trim().length<20,onClick:de,children:[a==="token"&&e.jsx(p,{className:"spin",size:13}),s("git.saveToken")]})]})]})]}),e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":P,onClick:()=>A(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(W,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.repository")}),e.jsx("small",{children:i.remoteUrl?i.repositoryName??i.remoteUrl:i.initialized?s("git.localReady"):s("git.localPending")})]})]}),P?e.jsx(ie,{size:16}):e.jsx(ne,{size:16})]}),P&&e.jsx("div",{className:"git-section-content",children:i.remoteUrl?e.jsxs("div",{className:"git-repository-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:i.repositoryName??s("git.origin")}),e.jsxs("small",{children:[i.branch??s("git.detachedAt",{revision:i.latestCommit?.shortSha??"HEAD"})," · ",i.dirty?s("git.changedFiles",{count:i.changedFiles}):s("git.clean")]})]}),i.repositoryHtmlUrl&&e.jsxs("a",{href:i.repositoryHtmlUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(ae,{size:14}),s("git.openGitHub")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"form-field",children:[s("git.repositoryName"),e.jsx("input",{value:F,onChange:t=>K(t.target.value)})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:t=>ce(t.target.checked)}),s("git.privateRepository")]}),e.jsxs("button",{className:"git-primary-action",disabled:!!a||!i.tokenConfigured||!F.trim(),onClick:ge,children:[a==="repository"?e.jsx(p,{className:"spin",size:14}):e.jsx(W,{size:14}),s("git.createRepository")]})]})})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(oe,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.commitAndPush")}),e.jsx("small",{children:i.branch?s("git.identity",{username:o.ownerUsername}):s("git.detachedHead")})]})]}),e.jsxs("label",{className:"form-field",children:[s("git.commitMessage"),e.jsx("textarea",{rows:3,value:D,placeholder:s("git.commitPlaceholder"),onChange:t=>Z(t.target.value)})]}),e.jsxs("div",{className:"git-action-row",children:[e.jsxs("button",{title:i.dirty?void 0:s("git.noChangesToCommit"),disabled:!!a||!i.branch||!i.dirty||!D.trim(),onClick:ue,children:[a==="commit"?e.jsx(p,{className:"spin",size:14}):e.jsx(oe,{size:14}),s("git.commit")]}),e.jsxs("button",{disabled:!!a||!i.branch||!i.tokenConfigured||!i.remoteUrl||!i.latestCommit,onClick:me,children:[a==="push"?e.jsx(p,{className:"spin",size:14}):e.jsx(we,{size:14}),s("git.push"),i.ahead>0&&e.jsx("span",{className:"git-count",children:i.ahead})]}),e.jsxs("button",{disabled:!!a||!i.latestCommit,onClick:()=>{I()},children:[a==="diff"?e.jsx(p,{className:"spin",size:14}):e.jsx(G,{size:14}),s("git.workingDiff")]}),e.jsxs("button",{className:"git-discard-button",title:i.restorable?s("git.discardChanges"):s("git.noChangesToDiscard"),disabled:!!a||!i.latestCommit||!i.restorable,onClick:()=>v(!0),children:[e.jsx(be,{size:14}),s("git.discardChanges")]}),!i.branch&&e.jsxs("button",{disabled:!!a,onClick:()=>{U(!1),j("branch")},children:[e.jsx(q,{size:14}),s("git.returnToBranch",{branch:i.defaultBranch})]}),e.jsxs("button",{disabled:!!a,onClick:()=>{d("refresh",z)},children:[e.jsx(Ee,{className:a==="refresh"?"spin":"",size:14}),s("git.refresh")]})]})]}),b&&e.jsxs("section",{ref:O,className:`git-section git-diff-section${u?" is-fullscreen":""}`,children:[e.jsxs("div",{className:"git-diff-heading",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(G,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.diffTitle")}),e.jsxs("small",{children:[b.title,b.truncated?` · ${s("git.diffTruncated")}`:""]})]})]}),e.jsxs("div",{className:"git-diff-controls",children:[e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":s("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w<=8,title:s("git.diffFontDecrease"),"aria-label":s("git.diffFontDecrease"),onClick:()=>Y(t=>Math.max(8,t-1)),children:e.jsx(ve,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[w,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w>=24,title:s("git.diffFontIncrease"),"aria-label":s("git.diffFontIncrease"),onClick:()=>Y(t=>Math.min(24,t+1)),children:e.jsx(Ce,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:s(u?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":s(u?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{fe()},children:u?e.jsx(Se,{size:15}):e.jsx(Ne,{size:15})})]})]}),e.jsx(Fe,{content:b.diff,empty:s("git.noChanges"),fontSize:w})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(q,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.history")}),e.jsx("small",{children:s("git.historyHint")})]})]}),e.jsxs("div",{className:"git-history",children:[J.map(t=>e.jsxs("article",{children:[e.jsx("code",{children:t.shortSha}),e.jsxs("div",{children:[e.jsx("strong",{children:t.message}),e.jsxs("small",{children:[t.authorName," · ",new Date(t.authoredAt).toLocaleString(E.resolvedLanguage)]})]}),e.jsxs("span",{children:[e.jsx("button",{title:s("git.viewCommitDiff"),disabled:!!a,onClick:()=>{I(t.sha)},children:e.jsx(G,{size:14})}),e.jsx("button",{title:s("git.checkoutVersion"),disabled:!!a,onClick:()=>{U(!1),j(t)},children:e.jsx(Te,{size:14})})]})]},t.sha)),J.length===0&&e.jsx("p",{className:"muted",children:s("git.noCommits")})]})]})]})]})}),e.jsx(H,{open:!!f,title:s(f==="branch"?"git.returnTitle":"git.checkoutTitle"),description:f==="branch"?s("git.returnDescription",{branch:i?.defaultBranch??"main"}):s("git.checkoutDescription",{revision:f?.shortSha??"",message:f?.message??""}),onOpenChange:t=>{t||j(null)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>j(null),children:s("common.cancel")}),e.jsx("button",{className:R?"danger":"primary",onClick:xe,children:s("git.checkout")})]}),children:e.jsxs("label",{className:"git-force-checkout",children:[e.jsx("input",{type:"checkbox",checked:R,onChange:t=>U(t.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.forceCheckout")}),e.jsx("small",{children:s("git.forceCheckoutDescription")})]})]})}),e.jsx(H,{open:le,title:s("git.discardTitle"),description:s("git.discardDescription"),onOpenChange:v,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>v(!1),children:s("common.cancel")}),e.jsx("button",{className:"danger",onClick:pe,children:s("git.discardConfirm")})]}),children:e.jsx(e.Fragment,{})})]})}function Fe({content:g,empty:o,fontSize:y}){return g.trim()?e.jsx("pre",{className:"git-diff",style:{fontSize:`${y}px`},children:g.split(`
2
2
  `).map((r,s)=>{const E=r.startsWith("+")&&!r.startsWith("+++")?"addition":r.startsWith("-")&&!r.startsWith("---")?"deletion":r.startsWith("@@")?"hunk":r.startsWith("diff ")?"header":"";return e.jsxs("span",{className:E,children:[r,`
3
3
  `]},s)})}):e.jsx("div",{className:"git-diff-empty",children:o})}function re(g){return g.trim().replace(/\s+/g,"-").replace(/[^A-Za-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^[.-]+|[.-]+$/g,"").slice(0,100)||"texlite-project"}export{Ue as GitDialog};
@@ -1 +1 @@
1
- import{u as Z,r as a,j as e}from"./react-CsO_xvbl.js";import{d as ee}from"./index-rBWMBTI-.js";import{i as T,k as j,M as se,L as D,T as _,R as I,S as te,F as ie,l as q}from"./index-BLh_AgbG.js";const re=T("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const F=T("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);const ae=T("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);const oe=T("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function de({open:r,project:c,onOpenChange:M,onBeforeMutation:V}){const{t,i18n:L}=Z(),[v,N]=a.useState([]),[l,z]=a.useState(null),[x,S]=a.useState(""),[o,b]=a.useState(null),[C,P]=a.useState(""),[u,p]=a.useState(null),[B,H]=a.useState(""),[k,w]=a.useState(null),[m,$]=a.useState(null),[y,n]=a.useState(""),[R,d]=a.useState(""),E=c.permission!=="read",U=c.permission==="owner";a.useEffect(()=>{if(!r)return;const s=new AbortController;return n("load"),d(""),p(null),j(`/api/projects/${c.id}/history`,{signal:s.signal}).then(i=>{N(i.versions),z(i.stats),S(h=>i.versions.some(g=>g.id===h)?h:i.versions[0]?.id??"")}).catch(i=>{J(i)||d(f(i))}).finally(()=>{s.signal.aborted||n("")}),()=>s.abort()},[r,c.id]),a.useEffect(()=>{if(!r||!x){b(null);return}const s=new AbortController;return n("detail"),p(null),j(`/api/projects/${c.id}/history/${x}`,{signal:s.signal}).then(i=>{b(i),H(i.version.label??"");const h=i.version.changedPaths.find(g=>i.files.some(A=>A.path===g))??i.files[0]?.path??"";P(h)}).catch(i=>{J(i)||d(f(i))}).finally(()=>{s.signal.aborted||n("")}),()=>s.abort()},[r,c.id,x]);const G=async(s=C)=>{if(s){n("compare"),d("");try{p(await j(`/api/projects/${c.id}/history/${x}/file?path=${encodeURIComponent(s)}`))}catch(i){d(f(i))}finally{n("")}}},K=async()=>{if(o){n("label"),d("");try{const s=await j(`/api/projects/${c.id}/history/${o.version.id}`,{method:"PATCH",body:JSON.stringify({label:B.trim()||null})});b(i=>i&&{...i,version:s.version}),N(i=>i.map(h=>h.id===s.version.id?s.version:h)),z(s.stats)}catch(s){d(f(s))}finally{n("")}}},W=async()=>{const s=m;if(s){$(null),n("delete"),d("");try{if(!await V())throw new Error(t("errors.collaborationUnavailable"));const i=s==="all"?`/api/projects/${c.id}/history`:`/api/projects/${c.id}/history/${s.id}`,h=await j(i,{method:"DELETE"});if(z(h.stats),s==="all")N([]),S(""),b(null),p(null);else{const g=v.filter(A=>A.id!==s.id);N(g),x===s.id&&(S(g[0]?.id??""),b(null),p(null))}}catch(i){d(f(i))}finally{n("")}}},Q=async()=>{const s=k;if(!(!s||!o)){w(null),n("restore"),d("");try{if(!await V())throw new Error(t("errors.collaborationUnavailable"));await j(`/api/projects/${c.id}/history/${o.version.id}/restore`,{method:"POST",body:JSON.stringify(s==="project"?{}:{path:s})}),window.location.reload()}catch(i){d(f(i)),n("")}}},X=a.useMemo(()=>{if(!u)return[];const s=new ee;s.Diff_Timeout=1;const i=s.diff_main(u.historical,u.comparison,!0);return s.diff_cleanupSemantic(i),i},[u]),Y=m&&m!=="all"?m.label||new Date(m.createdAt).toLocaleString(L.resolvedLanguage):"";return e.jsxs(e.Fragment,{children:[e.jsx(se,{open:r,extraWide:!0,className:"history-dialog-modal",title:t("history.title"),description:t("history.description"),onOpenChange:M,footer:e.jsx("button",{onClick:()=>M(!1),children:t("common.close")}),children:e.jsxs("div",{className:"history-dialog",children:[R&&e.jsx("p",{className:"error history-message",children:R}),y==="load"&&v.length===0?e.jsxs("div",{className:"history-loading",children:[e.jsx(D,{className:"spin",size:22}),t("common.loading")]}):e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:"history-timeline",children:[U&&l&&e.jsxs("div",{className:`history-stats${l.storageLimitExceeded?" exceeded":""}`,children:[e.jsxs("header",{children:[e.jsxs("span",{children:[e.jsx(ae,{size:14}),t("history.storage")]}),e.jsx("button",{type:"button",disabled:!!y||v.length===0,title:t("history.clearAll"),"aria-label":t("history.clearAll"),onClick:()=>$("all"),children:e.jsx(_,{size:13})})]}),e.jsx("strong",{children:t("history.storageUsage",{used:O(l.objectBytes),limit:O(l.maxStorageBytes)})}),e.jsx("progress",{max:l.maxStorageBytes,value:Math.min(l.objectBytes,l.maxStorageBytes)}),e.jsxs("small",{children:[t("history.versionUsage",{count:l.ordinaryVersionCount,limit:l.maxVersions}),l.labeledVersionCount>0?` · ${t("history.protectedVersions",{count:l.labeledVersionCount})}`:""]}),l.storageLimitExceeded&&e.jsx("small",{className:"history-storage-warning",children:t("history.storageExceeded")})]}),v.map(s=>e.jsxs("button",{className:s.id===x?"active":"",onClick:()=>S(s.id),children:[e.jsx(F,{size:15}),e.jsxs("span",{children:[e.jsx("strong",{children:s.label||t(`history.reasons.${s.reason}`)}),e.jsx("small",{children:new Date(s.createdAt).toLocaleString(L.resolvedLanguage)}),e.jsxs("small",{children:[s.author?.name??t("editor.deletedUser")," · ",t("history.changedCount",{count:s.changedPaths.length})]})]})]},s.id)),v.length===0&&e.jsx("p",{className:"muted padded",children:t("history.empty")})]}),e.jsx("section",{className:"history-detail",children:o&&e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"history-detail-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.version.label||t(`history.reasons.${o.version.reason}`)}),e.jsxs("small",{children:[e.jsx(re,{size:12}),new Date(o.version.createdAt).toLocaleString(L.resolvedLanguage)," · ",t("history.fileCount",{count:o.version.fileCount})]})]}),e.jsxs("span",{className:"history-detail-actions",children:[U&&e.jsxs("button",{className:"danger-text",disabled:!!y,onClick:()=>$(o.version),children:[e.jsx(_,{size:14}),t("history.deleteVersion")]}),E&&e.jsxs("button",{className:"danger-text",disabled:!!y,onClick:()=>w("project"),children:[e.jsx(I,{size:14}),t("history.restoreProject")]})]})]}),E&&e.jsxs("div",{className:"history-label",children:[e.jsxs("label",{children:[e.jsx(oe,{size:14}),e.jsx("input",{value:B,maxLength:80,placeholder:t("history.labelPlaceholder"),onChange:s=>H(s.target.value)})]}),e.jsxs("button",{disabled:y==="label"||B.trim()===(o.version.label??""),onClick:()=>{K()},children:[y==="label"?e.jsx(D,{className:"spin",size:13}):e.jsx(te,{size:13}),t("history.saveLabel")]})]}),e.jsxs("div",{className:"history-files",children:[e.jsx("div",{className:"history-file-list",children:o.files.map(s=>{const i=o.version.changedPaths.includes(s.path);return e.jsxs("button",{className:s.path===C?"active":"",title:s.path,onClick:()=>{P(s.path),p(null)},children:[e.jsx(ie,{size:13}),e.jsx("span",{children:s.path}),i&&e.jsx("small",{children:t("history.changed")})]},s.path)})}),e.jsxs("div",{className:"history-file-actions",children:[e.jsxs("button",{disabled:!C||!!y,onClick:()=>{G()},children:[y==="compare"?e.jsx(D,{className:"spin",size:13}):e.jsx(F,{size:13}),t("history.compareCurrent")]}),E&&e.jsxs("button",{disabled:!C||!!y,onClick:()=>w(C),children:[e.jsx(I,{size:13}),t("history.restoreFile")]})]})]}),e.jsx("div",{className:"history-comparison",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("header",{children:[e.jsx("strong",{children:u.path}),e.jsx("small",{children:t("history.comparingCurrent")})]}),e.jsx("pre",{children:X.map(([s,i],h)=>e.jsx("span",{className:s<0?"history-removed":s>0?"history-added":"",children:i},h))})]}):e.jsxs("div",{className:"history-comparison-empty",children:[e.jsx(F,{size:25}),e.jsx("span",{children:t("history.chooseFile")})]})})]})})]})]})}),e.jsx(q,{open:!!k,title:t(k==="project"?"history.restoreProjectTitle":"history.restoreFileTitle"),description:k==="project"?t("history.restoreProjectDescription"):t("history.restoreFileDescription",{path:k??""}),confirmLabel:t("history.restore"),danger:!0,onCancel:()=>w(null),onConfirm:()=>{Q()}}),e.jsx(q,{open:!!m,title:t(m==="all"?"history.clearAllTitle":"history.deleteVersionTitle"),description:m==="all"?t("history.clearAllDescription"):t("history.deleteVersionDescription",{name:Y}),confirmLabel:t(m==="all"?"history.clearAll":"history.deleteVersion"),danger:!0,onCancel:()=>$(null),onConfirm:()=>{W()}})]})}function O(r){return r<1024?`${r} B`:r<1024*1024?`${Math.round(r/102.4)/10} KB`:r<1024*1024*1024?`${Math.round(r/(1024*1024)*10)/10} MB`:`${Math.round(r/(1024*1024*1024)*10)/10} GB`}function f(r){return r instanceof Error?r.message:String(r)}function J(r){return r instanceof Error&&r.name==="AbortError"}export{de as HistoryDialog};
1
+ import{u as Z,r as a,j as e}from"./react-CsO_xvbl.js";import{d as ee}from"./index-rBWMBTI-.js";import{i as T,k as j,M as se,L as D,T as _,R as I,S as te,F as ie,l as q}from"./index-DIKn1Ihd.js";const re=T("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const F=T("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);const ae=T("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);const oe=T("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function de({open:r,project:c,onOpenChange:M,onBeforeMutation:V}){const{t,i18n:L}=Z(),[v,N]=a.useState([]),[l,z]=a.useState(null),[x,S]=a.useState(""),[o,b]=a.useState(null),[C,P]=a.useState(""),[u,p]=a.useState(null),[B,H]=a.useState(""),[k,w]=a.useState(null),[m,$]=a.useState(null),[y,n]=a.useState(""),[R,d]=a.useState(""),E=c.permission!=="read",U=c.permission==="owner";a.useEffect(()=>{if(!r)return;const s=new AbortController;return n("load"),d(""),p(null),j(`/api/projects/${c.id}/history`,{signal:s.signal}).then(i=>{N(i.versions),z(i.stats),S(h=>i.versions.some(g=>g.id===h)?h:i.versions[0]?.id??"")}).catch(i=>{J(i)||d(f(i))}).finally(()=>{s.signal.aborted||n("")}),()=>s.abort()},[r,c.id]),a.useEffect(()=>{if(!r||!x){b(null);return}const s=new AbortController;return n("detail"),p(null),j(`/api/projects/${c.id}/history/${x}`,{signal:s.signal}).then(i=>{b(i),H(i.version.label??"");const h=i.version.changedPaths.find(g=>i.files.some(A=>A.path===g))??i.files[0]?.path??"";P(h)}).catch(i=>{J(i)||d(f(i))}).finally(()=>{s.signal.aborted||n("")}),()=>s.abort()},[r,c.id,x]);const G=async(s=C)=>{if(s){n("compare"),d("");try{p(await j(`/api/projects/${c.id}/history/${x}/file?path=${encodeURIComponent(s)}`))}catch(i){d(f(i))}finally{n("")}}},K=async()=>{if(o){n("label"),d("");try{const s=await j(`/api/projects/${c.id}/history/${o.version.id}`,{method:"PATCH",body:JSON.stringify({label:B.trim()||null})});b(i=>i&&{...i,version:s.version}),N(i=>i.map(h=>h.id===s.version.id?s.version:h)),z(s.stats)}catch(s){d(f(s))}finally{n("")}}},W=async()=>{const s=m;if(s){$(null),n("delete"),d("");try{if(!await V())throw new Error(t("errors.collaborationUnavailable"));const i=s==="all"?`/api/projects/${c.id}/history`:`/api/projects/${c.id}/history/${s.id}`,h=await j(i,{method:"DELETE"});if(z(h.stats),s==="all")N([]),S(""),b(null),p(null);else{const g=v.filter(A=>A.id!==s.id);N(g),x===s.id&&(S(g[0]?.id??""),b(null),p(null))}}catch(i){d(f(i))}finally{n("")}}},Q=async()=>{const s=k;if(!(!s||!o)){w(null),n("restore"),d("");try{if(!await V())throw new Error(t("errors.collaborationUnavailable"));await j(`/api/projects/${c.id}/history/${o.version.id}/restore`,{method:"POST",body:JSON.stringify(s==="project"?{}:{path:s})}),window.location.reload()}catch(i){d(f(i)),n("")}}},X=a.useMemo(()=>{if(!u)return[];const s=new ee;s.Diff_Timeout=1;const i=s.diff_main(u.historical,u.comparison,!0);return s.diff_cleanupSemantic(i),i},[u]),Y=m&&m!=="all"?m.label||new Date(m.createdAt).toLocaleString(L.resolvedLanguage):"";return e.jsxs(e.Fragment,{children:[e.jsx(se,{open:r,extraWide:!0,className:"history-dialog-modal",title:t("history.title"),description:t("history.description"),onOpenChange:M,footer:e.jsx("button",{onClick:()=>M(!1),children:t("common.close")}),children:e.jsxs("div",{className:"history-dialog",children:[R&&e.jsx("p",{className:"error history-message",children:R}),y==="load"&&v.length===0?e.jsxs("div",{className:"history-loading",children:[e.jsx(D,{className:"spin",size:22}),t("common.loading")]}):e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:"history-timeline",children:[U&&l&&e.jsxs("div",{className:`history-stats${l.storageLimitExceeded?" exceeded":""}`,children:[e.jsxs("header",{children:[e.jsxs("span",{children:[e.jsx(ae,{size:14}),t("history.storage")]}),e.jsx("button",{type:"button",disabled:!!y||v.length===0,title:t("history.clearAll"),"aria-label":t("history.clearAll"),onClick:()=>$("all"),children:e.jsx(_,{size:13})})]}),e.jsx("strong",{children:t("history.storageUsage",{used:O(l.objectBytes),limit:O(l.maxStorageBytes)})}),e.jsx("progress",{max:l.maxStorageBytes,value:Math.min(l.objectBytes,l.maxStorageBytes)}),e.jsxs("small",{children:[t("history.versionUsage",{count:l.ordinaryVersionCount,limit:l.maxVersions}),l.labeledVersionCount>0?` · ${t("history.protectedVersions",{count:l.labeledVersionCount})}`:""]}),l.storageLimitExceeded&&e.jsx("small",{className:"history-storage-warning",children:t("history.storageExceeded")})]}),v.map(s=>e.jsxs("button",{className:s.id===x?"active":"",onClick:()=>S(s.id),children:[e.jsx(F,{size:15}),e.jsxs("span",{children:[e.jsx("strong",{children:s.label||t(`history.reasons.${s.reason}`)}),e.jsx("small",{children:new Date(s.createdAt).toLocaleString(L.resolvedLanguage)}),e.jsxs("small",{children:[s.author?.name??t("editor.deletedUser")," · ",t("history.changedCount",{count:s.changedPaths.length})]})]})]},s.id)),v.length===0&&e.jsx("p",{className:"muted padded",children:t("history.empty")})]}),e.jsx("section",{className:"history-detail",children:o&&e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"history-detail-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.version.label||t(`history.reasons.${o.version.reason}`)}),e.jsxs("small",{children:[e.jsx(re,{size:12}),new Date(o.version.createdAt).toLocaleString(L.resolvedLanguage)," · ",t("history.fileCount",{count:o.version.fileCount})]})]}),e.jsxs("span",{className:"history-detail-actions",children:[U&&e.jsxs("button",{className:"danger-text",disabled:!!y,onClick:()=>$(o.version),children:[e.jsx(_,{size:14}),t("history.deleteVersion")]}),E&&e.jsxs("button",{className:"danger-text",disabled:!!y,onClick:()=>w("project"),children:[e.jsx(I,{size:14}),t("history.restoreProject")]})]})]}),E&&e.jsxs("div",{className:"history-label",children:[e.jsxs("label",{children:[e.jsx(oe,{size:14}),e.jsx("input",{value:B,maxLength:80,placeholder:t("history.labelPlaceholder"),onChange:s=>H(s.target.value)})]}),e.jsxs("button",{disabled:y==="label"||B.trim()===(o.version.label??""),onClick:()=>{K()},children:[y==="label"?e.jsx(D,{className:"spin",size:13}):e.jsx(te,{size:13}),t("history.saveLabel")]})]}),e.jsxs("div",{className:"history-files",children:[e.jsx("div",{className:"history-file-list",children:o.files.map(s=>{const i=o.version.changedPaths.includes(s.path);return e.jsxs("button",{className:s.path===C?"active":"",title:s.path,onClick:()=>{P(s.path),p(null)},children:[e.jsx(ie,{size:13}),e.jsx("span",{children:s.path}),i&&e.jsx("small",{children:t("history.changed")})]},s.path)})}),e.jsxs("div",{className:"history-file-actions",children:[e.jsxs("button",{disabled:!C||!!y,onClick:()=>{G()},children:[y==="compare"?e.jsx(D,{className:"spin",size:13}):e.jsx(F,{size:13}),t("history.compareCurrent")]}),E&&e.jsxs("button",{disabled:!C||!!y,onClick:()=>w(C),children:[e.jsx(I,{size:13}),t("history.restoreFile")]})]})]}),e.jsx("div",{className:"history-comparison",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("header",{children:[e.jsx("strong",{children:u.path}),e.jsx("small",{children:t("history.comparingCurrent")})]}),e.jsx("pre",{children:X.map(([s,i],h)=>e.jsx("span",{className:s<0?"history-removed":s>0?"history-added":"",children:i},h))})]}):e.jsxs("div",{className:"history-comparison-empty",children:[e.jsx(F,{size:25}),e.jsx("span",{children:t("history.chooseFile")})]})})]})})]})]})}),e.jsx(q,{open:!!k,title:t(k==="project"?"history.restoreProjectTitle":"history.restoreFileTitle"),description:k==="project"?t("history.restoreProjectDescription"):t("history.restoreFileDescription",{path:k??""}),confirmLabel:t("history.restore"),danger:!0,onCancel:()=>w(null),onConfirm:()=>{Q()}}),e.jsx(q,{open:!!m,title:t(m==="all"?"history.clearAllTitle":"history.deleteVersionTitle"),description:m==="all"?t("history.clearAllDescription"):t("history.deleteVersionDescription",{name:Y}),confirmLabel:t(m==="all"?"history.clearAll":"history.deleteVersion"),danger:!0,onCancel:()=>$(null),onConfirm:()=>{W()}})]})}function O(r){return r<1024?`${r} B`:r<1024*1024?`${Math.round(r/102.4)/10} KB`:r<1024*1024*1024?`${Math.round(r/(1024*1024)*10)/10} MB`:`${Math.round(r/(1024*1024*1024)*10)/10} GB`}function f(r){return r instanceof Error?r.message:String(r)}function J(r){return r instanceof Error&&r.name==="AbortError"}export{de as HistoryDialog};
@@ -1,4 +1,4 @@
1
- import{u as oi,r as X,j as Pe}from"./react-CsO_xvbl.js";import{s as zr,E as se,V as ut,D as ne,a as Pt,R as ai,P as Qr,S as yt,b as be,f as si,M as qr,m as Rr,i as li,c as ci,d as ui,e as fi,g as hi,h as di,j as Or,k as Jr,l as Ct,n as pi,o as gi,p as vi,q as mi,r as yi,t as Ci,u as ki,v as wi,w as Si,x as xi,y as Ge,F as Wt,A as Ut,z as bi,W as Yr,B as Mi,C as Tr,G as Ir,H as Nt,I as Li,J as Ai,K as Ei,L as Ri,N as Oi,O as Ti,Q as Ii,T as Ni,U as Bi,X as Pi,Y as Di,Z as _i,_ as Ki,$ as Fi,a0 as $i,a1 as Hi,a2 as Vi,a3 as ji,a4 as Wi,a5 as zt,a6 as Ui,a7 as zi,a8 as Qi,a9 as qi,aa as xe,ab as Ji,ac as Yi}from"./editor-DMLs-XWi.js";import{r as Nr,c as ct,U as Qt,a as Dt,b as _t,d as Br,m as Zi,e as Xi,f as Bt,t as vt,g as mt,h as Gi}from"./index-BLh_AgbG.js";function eo(s){var i=s.Pos;function l(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),o=n.charCodeAt(t.ch);55296<=o&&o<=55551&&(r.ch+=1)}return{start:t,end:r}}var u=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"gc",type:"operator",operator:"toggleComment",isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],d=Object.create(null),v=u.length,w=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"put",shortName:"pu"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],S=Zt("");function x(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),s.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",xr),ge(e),s.on(e.getInputField(),"paste",E(e))}function N(e){e.setOption("disableInput",!1),e.off("cursorActivity",xr),s.off(e.getInputField(),"paste",E(e)),e.state.vim=null,st&&clearTimeout(st)}function E(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(ie(e.getCursor(),0,1)),ze.enterInsertMode(e,{},t))}),t.onPasteFn}var L=/[\d]/,P=[s.isWordChar,function(e){return e&&!s.isWordChar(e)&&!/\s/.test(e)}],D=[function(e){return/\S/.test(e)}],K=["<",">"],W=["-",'"',".",":","_","/","+"],F=/^\w$/,q=/^[A-Z]$/;try{q=new RegExp("^[\\p{Lu}]$","u")}catch{}function te(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function z(e){return/^[a-z]$/.test(e)}function le(e){return"()[]{}".indexOf(e)!=-1}function ce(e){return L.test(e)}function Ce(e){return q.test(e)}function ae(e){return/^\s*$/.test(e)}function _e(e){return".?!".indexOf(e)!=-1}function Je(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var Me={};function Ke(e,t,r,n,o){if(t===void 0&&!o)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),Me[e]={type:r,defaultValue:t,callback:o},n)for(var a=0;a<n.length;a++)Me[n[a]]=Me[e];t&&Ve(e,t)}function Ve(e,t,r,n){var o=Me[e];n=n||{};var a=n.scope;if(!o)return new Error("Unknown option: "+e);if(o.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}o.callback?(a!=="local"&&o.callback(t,void 0),a!=="global"&&r&&o.callback(t,r)):(a!=="local"&&(o.value=o.type=="boolean"?!!t:t),a!=="global"&&r&&(r.state.vim.options[e]={value:t}))}function pe(e,t,r){var n=Me[e];r=r||{};var o=r.scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){let a=t&&n.callback(void 0,t);return o!=="global"&&a!==void 0?a:o!=="local"?n.callback():void 0}else return(o!=="global"&&t&&t.state.vim.options[e]||o!=="local"&&n||{}).value}Ke("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let r=t.getOption("mode");return r=="null"?"":r}else{let r=e==""?"null":e;t.setOption("mode",r)}}),Ke("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.getOption("textwidth");return r}else{var n=Math.round(e);n>1&&t.setOption("textwidth",n)}});var je=function(){var e=100,t=-1,r=0,n=0,o=new Array(e);function a(h,p,g){var y=t%e,C=o[y];function k(b){var M=++t%e,I=o[M];I&&I.clear(),o[M]=h.setBookmark(b)}if(C){var m=C.find();m&&!Le(m,p)&&k(p)}else k(p);k(g),r=t,n=t-e+1,n<0&&(n=0)}function c(h,p){t+=p,t>r?t=r:t<n&&(t=n);var g=o[(e+t)%e];if(g&&!g.find()){var y=p>0?1:-1,C,k=h.getCursor();do if(t+=y,g=o[(e+t)%e],g&&(C=g.find())&&!Le(k,C))break;while(t<r&&t>n)}return g}function f(h,p){var g=t,y=c(h,p);return t=g,y&&y.find()}return{cachedCursor:void 0,add:a,find:f,move:c}},ft=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class tt{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=ft()}exitMacroRecordMode(){var t=A.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,r){var n=A.registerController.getRegister(r);if(n){if(n.clear(),this.latestRegister=r,t.openDialog){var o=Re("span",{class:"cm-vim-message"},"recording @"+r);this.onRecordingDone=t.openDialog(o,function(){},{bottom:!0})}this.isRecording=!0}}}function ge(e){return e.state.vim||(e.state.vim={inputState:new Xt,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new i(0,0),head:new i(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var A;function rt(){A={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:je(),macroModeState:new tt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new gn({}),searchHistoryController:new Gt,exCommandHistoryController:new Gt};for(var e in Me){var t=Me[e];t.value=t.defaultValue}}class B{constructor(t,r){this.keyName=t,this.key=r.key,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.shiftKey=r.shiftKey}}var Z,R={enterVimMode:x,leaveVimMode:N,buildKeyMap:function(){},getRegisterController:function(){return A.registerController},resetVimGlobalState_:rt,getVimGlobalState_:function(){return A},maybeInitVimState_:ge,suppressErrorLogging:!1,InsertModeKey:B,map:function(e,t,r){ke.map(e,t,r)},unmap:function(e,t){return ke.unmap(e,t)},noremap:function(e,t,r){ke.map(e,t,r,!0)},mapclear:function(e){var t=u.length,r=v,n=u.slice(0,t-r);if(u=u.slice(t-r),e)for(var o=n.length-1;o>=0;o--){var a=n[o];if(e!==a.context)if(a.context)this._mapCommand(a);else{var c=["normal","insert","visual"];for(var f in c)if(c[f]!==e){var h=Object.assign({},a);h.context=c[f],this._mapCommand(h)}}}},langmap:Yt,vimKeyFromEvent:ot,setOption:Ve,getOption:pe,defineOption:Ke,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');wr[e]=r,ke.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:ii,findKey:function(e,t,r){var n=ge(e),o=e;function a(){var g=A.macroModeState;if(g.isRecording){if(t=="q")return g.exitMacroRecordMode(),ue(o),!0;r!="mapping"&&ti(g,t)}}function c(){if(t=="<Esc>"){if(n.visualMode)Ne(o);else if(n.insertMode)He(o);else return;return ue(o),!0}}function f(){if(c())return!0;n.inputState.keyBuffer.push(t);var g=n.inputState.keyBuffer.join(""),y=t.length==1,C=Ue.matchCommand(g,u,n.inputState,"insert"),k=n.inputState.changeQueue;if(C.type=="none")return ue(o),!1;if(C.type=="partial"){if(C.expectLiteralNext&&(n.expectLiteralNext=!0),Z&&window.clearTimeout(Z),Z=y&&window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer.length&&ue(o)},pe("insertModeEscKeysTimeout")),y){var m=o.listSelections();(!k||k.removed.length!=m.length)&&(k=n.inputState.changeQueue=new dn),k.inserted+=t;for(var b=0;b<m.length;b++){var M=ye(m[b].anchor,m[b].head),I=$e(m[b].anchor,m[b].head),O=o.getRange(M,o.state.overwrite?ie(I,0,1):I);k.removed[b]=(k.removed[b]||"")+O}}return!y}else C.type=="full"&&(n.inputState.keyBuffer.length=0);if(n.expectLiteralNext=!1,Z&&window.clearTimeout(Z),C.command&&k){for(var m=o.listSelections(),b=0;b<m.length;b++){var T=m[b].head;o.replaceRange(k.removed[b]||"",ie(T,0,-k.inserted.length),T,"+input")}A.macroModeState.lastInsertModeChanges.changes.pop()}return C.command||ue(o),C.command}function h(){if(a()||c())return!0;n.inputState.keyBuffer.push(t);var g=n.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(g))return!0;var y=/^(\d*)(.*)$/.exec(g);if(!y)return ue(o),!1;var C=n.visualMode?"visual":"normal",k=y[2]||y[1];n.inputState.operatorShortcut&&n.inputState.operatorShortcut.slice(-1)==k&&(k=n.inputState.operatorShortcut);var m=Ue.matchCommand(k,u,n.inputState,C);return m.type=="none"?(ue(o),!1):m.type=="partial"?(m.expectLiteralNext&&(n.expectLiteralNext=!0),!0):m.type=="clear"?(ue(o),!0):(n.expectLiteralNext=!1,n.inputState.keyBuffer.length=0,y=/^(\d*)(.*)$/.exec(g),y&&y[1]&&y[1]!="0"&&n.inputState.pushRepeatDigit(y[1]),m.command)}var p=n.insertMode?f():h();if(p===!1)return!n.insertMode&&(t.length===1||s.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(p===!0)return function(){return!0};if(p)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof p!="object")return;p.type=="keyToKey"?We(o,p.toKeys,p):Ue.processCommand(o,n,p)}catch(g){throw o.state.vim=void 0,ge(o),R.suppressErrorLogging||console.log(g),g}return!0})}},handleEx:function(e,t){ke.processCommand(e,t)},defineMotion:vn,defineAction:yn,defineOperator:mn,mapCommand:Gn,_mapCommand:Rt,defineRegister:pn,exitVisualMode:Ne,exitInsertMode:He},J=[],Y=!1,Q;function nt(e){if(!Q)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),r=t.split("-");if(t=r.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
1
+ import{u as oi,r as X,j as Pe}from"./react-CsO_xvbl.js";import{s as zr,E as se,V as ut,D as ne,a as Pt,R as ai,P as Qr,S as yt,b as be,f as si,M as qr,m as Rr,i as li,c as ci,d as ui,e as fi,g as hi,h as di,j as Or,k as Jr,l as Ct,n as pi,o as gi,p as vi,q as mi,r as yi,t as Ci,u as ki,v as wi,w as Si,x as xi,y as Ge,F as Wt,A as Ut,z as bi,W as Yr,B as Mi,C as Tr,G as Ir,H as Nt,I as Li,J as Ai,K as Ei,L as Ri,N as Oi,O as Ti,Q as Ii,T as Ni,U as Bi,X as Pi,Y as Di,Z as _i,_ as Ki,$ as Fi,a0 as $i,a1 as Hi,a2 as Vi,a3 as ji,a4 as Wi,a5 as zt,a6 as Ui,a7 as zi,a8 as Qi,a9 as qi,aa as xe,ab as Ji,ac as Yi}from"./editor-DMLs-XWi.js";import{r as Nr,c as ct,U as Qt,a as Dt,b as _t,d as Br,m as Zi,e as Xi,f as Bt,t as vt,g as mt,h as Gi}from"./index-DIKn1Ihd.js";function eo(s){var i=s.Pos;function l(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),o=n.charCodeAt(t.ch);55296<=o&&o<=55551&&(r.ch+=1)}return{start:t,end:r}}var u=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"gc",type:"operator",operator:"toggleComment",isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],d=Object.create(null),v=u.length,w=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"put",shortName:"pu"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],S=Zt("");function x(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),s.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",xr),ge(e),s.on(e.getInputField(),"paste",E(e))}function N(e){e.setOption("disableInput",!1),e.off("cursorActivity",xr),s.off(e.getInputField(),"paste",E(e)),e.state.vim=null,st&&clearTimeout(st)}function E(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(ie(e.getCursor(),0,1)),ze.enterInsertMode(e,{},t))}),t.onPasteFn}var L=/[\d]/,P=[s.isWordChar,function(e){return e&&!s.isWordChar(e)&&!/\s/.test(e)}],D=[function(e){return/\S/.test(e)}],K=["<",">"],W=["-",'"',".",":","_","/","+"],F=/^\w$/,q=/^[A-Z]$/;try{q=new RegExp("^[\\p{Lu}]$","u")}catch{}function te(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function z(e){return/^[a-z]$/.test(e)}function le(e){return"()[]{}".indexOf(e)!=-1}function ce(e){return L.test(e)}function Ce(e){return q.test(e)}function ae(e){return/^\s*$/.test(e)}function _e(e){return".?!".indexOf(e)!=-1}function Je(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var Me={};function Ke(e,t,r,n,o){if(t===void 0&&!o)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),Me[e]={type:r,defaultValue:t,callback:o},n)for(var a=0;a<n.length;a++)Me[n[a]]=Me[e];t&&Ve(e,t)}function Ve(e,t,r,n){var o=Me[e];n=n||{};var a=n.scope;if(!o)return new Error("Unknown option: "+e);if(o.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}o.callback?(a!=="local"&&o.callback(t,void 0),a!=="global"&&r&&o.callback(t,r)):(a!=="local"&&(o.value=o.type=="boolean"?!!t:t),a!=="global"&&r&&(r.state.vim.options[e]={value:t}))}function pe(e,t,r){var n=Me[e];r=r||{};var o=r.scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){let a=t&&n.callback(void 0,t);return o!=="global"&&a!==void 0?a:o!=="local"?n.callback():void 0}else return(o!=="global"&&t&&t.state.vim.options[e]||o!=="local"&&n||{}).value}Ke("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let r=t.getOption("mode");return r=="null"?"":r}else{let r=e==""?"null":e;t.setOption("mode",r)}}),Ke("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.getOption("textwidth");return r}else{var n=Math.round(e);n>1&&t.setOption("textwidth",n)}});var je=function(){var e=100,t=-1,r=0,n=0,o=new Array(e);function a(h,p,g){var y=t%e,C=o[y];function k(b){var M=++t%e,I=o[M];I&&I.clear(),o[M]=h.setBookmark(b)}if(C){var m=C.find();m&&!Le(m,p)&&k(p)}else k(p);k(g),r=t,n=t-e+1,n<0&&(n=0)}function c(h,p){t+=p,t>r?t=r:t<n&&(t=n);var g=o[(e+t)%e];if(g&&!g.find()){var y=p>0?1:-1,C,k=h.getCursor();do if(t+=y,g=o[(e+t)%e],g&&(C=g.find())&&!Le(k,C))break;while(t<r&&t>n)}return g}function f(h,p){var g=t,y=c(h,p);return t=g,y&&y.find()}return{cachedCursor:void 0,add:a,find:f,move:c}},ft=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class tt{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=ft()}exitMacroRecordMode(){var t=A.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,r){var n=A.registerController.getRegister(r);if(n){if(n.clear(),this.latestRegister=r,t.openDialog){var o=Re("span",{class:"cm-vim-message"},"recording @"+r);this.onRecordingDone=t.openDialog(o,function(){},{bottom:!0})}this.isRecording=!0}}}function ge(e){return e.state.vim||(e.state.vim={inputState:new Xt,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new i(0,0),head:new i(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var A;function rt(){A={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:je(),macroModeState:new tt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new gn({}),searchHistoryController:new Gt,exCommandHistoryController:new Gt};for(var e in Me){var t=Me[e];t.value=t.defaultValue}}class B{constructor(t,r){this.keyName=t,this.key=r.key,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.shiftKey=r.shiftKey}}var Z,R={enterVimMode:x,leaveVimMode:N,buildKeyMap:function(){},getRegisterController:function(){return A.registerController},resetVimGlobalState_:rt,getVimGlobalState_:function(){return A},maybeInitVimState_:ge,suppressErrorLogging:!1,InsertModeKey:B,map:function(e,t,r){ke.map(e,t,r)},unmap:function(e,t){return ke.unmap(e,t)},noremap:function(e,t,r){ke.map(e,t,r,!0)},mapclear:function(e){var t=u.length,r=v,n=u.slice(0,t-r);if(u=u.slice(t-r),e)for(var o=n.length-1;o>=0;o--){var a=n[o];if(e!==a.context)if(a.context)this._mapCommand(a);else{var c=["normal","insert","visual"];for(var f in c)if(c[f]!==e){var h=Object.assign({},a);h.context=c[f],this._mapCommand(h)}}}},langmap:Yt,vimKeyFromEvent:ot,setOption:Ve,getOption:pe,defineOption:Ke,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');wr[e]=r,ke.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:ii,findKey:function(e,t,r){var n=ge(e),o=e;function a(){var g=A.macroModeState;if(g.isRecording){if(t=="q")return g.exitMacroRecordMode(),ue(o),!0;r!="mapping"&&ti(g,t)}}function c(){if(t=="<Esc>"){if(n.visualMode)Ne(o);else if(n.insertMode)He(o);else return;return ue(o),!0}}function f(){if(c())return!0;n.inputState.keyBuffer.push(t);var g=n.inputState.keyBuffer.join(""),y=t.length==1,C=Ue.matchCommand(g,u,n.inputState,"insert"),k=n.inputState.changeQueue;if(C.type=="none")return ue(o),!1;if(C.type=="partial"){if(C.expectLiteralNext&&(n.expectLiteralNext=!0),Z&&window.clearTimeout(Z),Z=y&&window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer.length&&ue(o)},pe("insertModeEscKeysTimeout")),y){var m=o.listSelections();(!k||k.removed.length!=m.length)&&(k=n.inputState.changeQueue=new dn),k.inserted+=t;for(var b=0;b<m.length;b++){var M=ye(m[b].anchor,m[b].head),I=$e(m[b].anchor,m[b].head),O=o.getRange(M,o.state.overwrite?ie(I,0,1):I);k.removed[b]=(k.removed[b]||"")+O}}return!y}else C.type=="full"&&(n.inputState.keyBuffer.length=0);if(n.expectLiteralNext=!1,Z&&window.clearTimeout(Z),C.command&&k){for(var m=o.listSelections(),b=0;b<m.length;b++){var T=m[b].head;o.replaceRange(k.removed[b]||"",ie(T,0,-k.inserted.length),T,"+input")}A.macroModeState.lastInsertModeChanges.changes.pop()}return C.command||ue(o),C.command}function h(){if(a()||c())return!0;n.inputState.keyBuffer.push(t);var g=n.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(g))return!0;var y=/^(\d*)(.*)$/.exec(g);if(!y)return ue(o),!1;var C=n.visualMode?"visual":"normal",k=y[2]||y[1];n.inputState.operatorShortcut&&n.inputState.operatorShortcut.slice(-1)==k&&(k=n.inputState.operatorShortcut);var m=Ue.matchCommand(k,u,n.inputState,C);return m.type=="none"?(ue(o),!1):m.type=="partial"?(m.expectLiteralNext&&(n.expectLiteralNext=!0),!0):m.type=="clear"?(ue(o),!0):(n.expectLiteralNext=!1,n.inputState.keyBuffer.length=0,y=/^(\d*)(.*)$/.exec(g),y&&y[1]&&y[1]!="0"&&n.inputState.pushRepeatDigit(y[1]),m.command)}var p=n.insertMode?f():h();if(p===!1)return!n.insertMode&&(t.length===1||s.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(p===!0)return function(){return!0};if(p)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof p!="object")return;p.type=="keyToKey"?We(o,p.toKeys,p):Ue.processCommand(o,n,p)}catch(g){throw o.state.vim=void 0,ge(o),R.suppressErrorLogging||console.log(g),g}return!0})}},handleEx:function(e,t){ke.processCommand(e,t)},defineMotion:vn,defineAction:yn,defineOperator:mn,mapCommand:Gn,_mapCommand:Rt,defineRegister:pn,exitVisualMode:Ne,exitInsertMode:He},J=[],Y=!1,Q;function nt(e){if(!Q)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),r=t.split("-");if(t=r.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
2
2
  `;else if(Ye[t]){var n=Q.value||"",o={key:Ye[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};Q.onKeyDown&&Q.onKeyDown(o,Q.value,c),Q&&Q.onKeyUp&&Q.onKeyUp(o,Q.value,c);return}}if(e==`
3
3
  `){var a=Q;Q=null,a.onClose&&a.onClose(a.value)}else Q.value=(Q.value||"")+e;function c(f){Q&&(typeof f=="string"?Q.value=f:Q=null)}}function We(e,t,r){var n=Y;if(r){if(J.indexOf(r)!=-1)return;J.push(r),Y=r.noremap!=!1}try{for(var o=ge(e),a=/<(?:[CSMA]-)*\w+>|./gi,c;c=a.exec(t);){var f=c[0],h=o.insertMode;if(Q){nt(f);continue}var p=R.handleKey(e,f,"mapping");if(!p&&h&&o.insertMode){if(f[0]=="<"){var g=f.toLowerCase().slice(1,-1),y=g.split("-");if(g=y.pop()||"",g=="lt")f="<";else if(g=="space")f=" ";else if(g=="cr")f=`
4
4
  `;else if(Ye.hasOwnProperty(g)){f=Ye[g],Ar(e,f);continue}else f=f[0],a.lastIndex=c.index+1}e.replaceSelection(f)}}}finally{if(J.pop(),Y=J.length?n:!1,!J.length&&Q){var C=Q;Q=null,pt(e,C)}}}var it={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},ht={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},Ye={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(it)).forEach(function(e){Ye[(it[e]||"").toLowerCase()]=Ye[e.toLowerCase()]=e});function ot(e,t){var r=e.key;if(!ht[r]){r.length>1&&r[0]=="n"&&(r=r.replace("Numpad","")),r=it[r]||r;var n="";if(e.ctrlKey&&(n+="C-"),e.altKey&&(n+="A-"),e.metaKey&&(n+="M-"),s.isMac&&n=="A-"&&r.length==1&&(n=n.slice(2)),(n||r.length>1)&&e.shiftKey&&(n+="S-"),t&&!t.expectLiteralNext&&r.length==1){if(S.keymap&&r in S.keymap)(S.remapCtrl!=!1||!n)&&(r=S.keymap[r]);else if(r.charCodeAt(0)>128&&!d[r]){var o=e.code?.slice(-1)||"";e.shiftKey||(o=o.toLowerCase()),o&&(r=o,!n&&e.altKey&&(n="A-"))}}return n+=r,n.length>1&&(n="<"+n+">"),n}}function Yt(e,t){S.string!==e&&(S=Zt(e)),S.remapCtrl=t}function Zt(e){let t={};if(!e)return{keymap:t,string:""};function r(n){return n.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(n=>{if(!n)return;const o=n.split(/((?:[^\\;]|\\.)+);/);if(o.length==3){const a=r(o[1]),c=r(o[2]);if(a.length!==c.length)return;for(let f=0;f<a.length;++f)t[a[f]]=c[f]}else if(o.length==1){const a=r(n);if(a.length%2!==0)return;for(let c=0;c<a.length;c+=2)t[a[c]]=a[c+1]}}),{keymap:t,string:e}}Ke("langmap",void 0,"string",["lmap"],function(e,t){if(e===void 0)return S.string;Yt(e)});class Xt{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(t){this.operator?this.motionRepeat=this.motionRepeat.concat(t):this.prefixRepeat=this.prefixRepeat.concat(t)}getRepeat(){var t=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(t=1,this.prefixRepeat.length>0&&(t*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(t*=parseInt(this.motionRepeat.join(""),10))),t}}function ue(e,t){e.state.vim.inputState=new Xt,e.state.vim.expectLiteralNext=!1,s.signal(e,"vim-command-done",t)}function dn(){this.removed=[],this.inserted=""}class Te{constructor(t,r,n){this.clear(),this.keyBuffer=[t||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!r,this.blockwise=!!n}setText(t,r,n){this.keyBuffer=[t||""],this.linewise=!!r,this.blockwise=!!n}pushText(t,r){r&&(this.linewise||this.keyBuffer.push(`
@@ -56,4 +56,4 @@ mark line col
56
56
  `).map(L=>L.replace(/(^|[^\\])%.*$/,"$1")).join(`
57
57
  `),x=(L,P)=>{if(P<=0)return;const D=K=>`\${${K}}`;return L+Array.from({length:P},(K,W)=>`{${D(W+1)}}`).join("")},N=L=>[...L.matchAll(/[moOrRdDsStvb]/g)].length,E=(L,P,D,K,W)=>{P&&!L.some(F=>F.label===P)&&L.push({label:P,detail:D,kind:K,source:"Current file",...W?{apply:W}:{}})};for(const L of S.matchAll(/\\(?:newcommand|renewcommand|providecommand|DeclareRobustCommand)\s*\*?\s*(?:\{\s*)?\\([A-Za-z@][A-Za-z@0-9:_]*)\s*(?:\})?\s*(?:\[(\d+)\])?/g)){const P=Number.parseInt(L[2]??"0",10);E(i,`\\${L[1]}`,"Project command","function",x(`\\${L[1]}`,P))}for(const L of S.matchAll(/\\(?:NewDocumentCommand|RenewDocumentCommand|ProvideDocumentCommand|DeclareDocumentCommand|DeclareExpandableDocumentCommand|RenewExpandableDocumentCommand|ProvideExpandableDocumentCommand)\s*\{\s*\\([A-Za-z@][A-Za-z@0-9:_]*)\s*\}\s*\{([^}]*)\}/g)){const P=N(L[2]);E(i,`\\${L[1]}`,"Project command","function",x(`\\${L[1]}`,P))}for(const L of S.matchAll(/\\(?:def|gdef|edef|xdef)\s*\\([A-Za-z@][A-Za-z@0-9:_]*)((?:\s*#\d+)*)/g)){const P=[...(L[2]??"").matchAll(/#\d+/g)].length;E(i,`\\${L[1]}`,"Project macro","function",x(`\\${L[1]}`,P))}for(const L of S.matchAll(/\\DeclarePairedDelimiter\s*\{?\\([A-Za-z@][A-Za-z@0-9:_]*)\}?/g))E(i,`\\${L[1]}`,"Project math delimiter","function");for(const L of S.matchAll(/\\cs_(?:new|set|gset|provide|generate)(?:_protected)?\:[A-Za-z]+\s+\\([A-Za-z@][A-Za-z@0-9:_]*)/g))E(i,`\\${L[1]}`,"Expl3 project command","function");for(const L of S.matchAll(/\\(?:newenvironment|renewenvironment|NewDocumentEnvironment|RenewDocumentEnvironment|DeclareDocumentEnvironment)\s*\*?\s*\{([^}]+)\}/g))E(l,L[1].trim(),"Project environment","keyword");for(const L of S.matchAll(/\\(?:label|hypertarget)\s*\{([^}]+)\}/g))E(u,L[1].trim(),"Label","constant");for(const L of S.matchAll(/\\(?:usepackage|RequirePackage)\s*(?:\[[^]]*\])?\s*\{([^}]+)\}/g))for(const P of L[1].split(","))E(v,P.trim(),"Package","text");for(const L of S.matchAll(/\\(?:input|include|subfile)\s*(?:\{([^}]+)\}|\s+([^\s%]+))/g))E(w,(L[1]??L[2]??"").trim(),"Project file","text");for(const L of S.matchAll(/\\(?:cite|citep|citet|parencite|textcite|autocite|footcite)(?:\w*)?\s*(?:\[[^]]*\])?\s*\{([^}]+)\}/g))for(const P of L[1].split(","))E(d,P.trim(),"Citation key","constant");return{commands:i,environments:l,labels:u,citations:d,packages:v,files:w}}const $r=new WeakMap;function ia(s){const i=s.state.doc,l=$r.get(i);if(l)return l;const u=na(s.state.doc.toString());return $r.set(i,u),u}const Hr={"Project command":"projectCommand","Project macro":"projectMacro","Expl3 project command":"expl3Command","Project math operator":"mathOperator","Project math delimiter":"mathDelimiter","Project environment":"projectEnvironment","Project file":"projectFile",Package:"package","Document class":"documentClass","Current file":"currentFile",Project:"project",LaTeX:"latex"};function oa(s,i,l=!0){const u=Hr[s.detail],d=s.source?Hr[s.source]:void 0,v=s.detail.match(/^Project command \((\d+) arguments?\)$/),w=s.source==="LaTeX"?"":v?i("completions.projectCommandArgs",{count:Number(v[1])}):u?i(`completions.${u}`):s.source==="LaTeX"?i("completions.standard"):s.detail,S=s.source==="LaTeX"?"":d?i(`completions.${d}`):s.source,x=S&&w?`${w} · ${S}`:w||S||void 0,N={label:s.label,type:s.kind,...x?{detail:x}:{},...s.info?{info:s.info}:{}};return l&&s.apply?xe(s.apply,N):N}function qe(s,...i){const l=[],u=new Set;for(const d of i)for(const v of d){const w="kind"in v?oa(v,s):v;u.has(w.label)||(u.add(w.label),l.push(w))}return l}function Vr(s){return s.map(({detail:i,...l})=>l)}function jr(s){return s.map(({apply:i,...l})=>l)}function et(s,i){const u=s.state.sliceDoc(0,s.pos).match(i);return!u||u.index===void 0?null:{from:s.pos-u[1].length,query:u[1]}}function aa(s){const l=s.state.sliceDoc(0,s.pos).match(/\\(begin|end)\{([^{}]*)$/);return!l||l.index===void 0?null:{from:s.pos-l[2].length,query:l[2],command:l[1]}}function sa(s){const i=s.state.doc.lineAt(s.pos);let l=0;for(let u=0;u<s.pos-i.from;u+=1){const d=i.text[u];if(d==="\\"){l+=1;continue}if(d==="%"&&l%2===0)return!0;l=0}return!1}function la(s){return{...s,apply(i,l,u,d){const w=i.state.doc.lineAt(u).text.match(/^\s*/)?.[0]??"",S=l.label,x=S+`}
58
58
  `+w+`
59
- `+w+"\\end{"+S+"}",N=u+S.length+1+1+w.length+1,E=i.state.sliceDoc(d,d+1)==="}"?1:0;i.dispatch({changes:{from:u,to:d+E,insert:x},selection:{anchor:N},annotations:[Ji.of(l),zt.userEvent.of("input.complete")]})}}}function ca(s,i,l,u,d){const v=qo(s.state.doc.toString(),i,l,u);if(!v)return!1;s.dispatch(d());const w=i+u.length;return s.dispatch({changes:{from:w,insert:v.insert},selection:{anchor:w+v.cursorOffset},annotations:zt.userEvent.of("input.complete")}),!0}function ua(s,i,l){if(sa(s))return null;const u=ia(s),d=s.matchBefore(/\\(?:[A-Za-z@0-9:_]*(?:\*)?|[,;!:])$/);if(d||s.explicit)return{from:d?.from??s.pos,options:Vr(qe(i,u.commands,l?.commands??[],ra())),validFor:/^\\(?:[A-Za-z@0-9:_]*(?:\*)?|[,;!:])$/};const v=aa(s);if(v){const L=qe(i,jr(u.environments),jr(l?.environments??[]));return{from:v.from,options:Vr(v.command==="begin"?L.map(la):L),validFor:/^[A-Za-z0-9*:_-]*$/}}const w=et(s,/\\(?:ref|pageref|autoref|nameref|cref|Cref|eqref|vref)\s*(?:\[[^]]*\])?\{([^{}]*)$/)??et(s,/\\hyperref\[([^\[\]]*)$/);if(w)return{from:w.from,options:qe(i,u.labels,l?.labels??[]),validFor:/^[^{}]*$/};const S=et(s,/\\(?:cite|citep|citet|parencite|textcite|autocite|footcite)(?:\w*)?(?:\[[^]]*\])?\{([^{}]*)$/);if(S)return{from:S.from,options:qe(i,u.citations,l?.citations??[]),validFor:/^[^{}]*$/};const x=et(s,/\\(?:input|include|subfile|includegraphics|bibliography|addbibresource)\s*(?:\[[^]]*\])?\{([^{}]*)$/);if(x)return{from:x.from,options:qe(i,u.files,l?.files??[]),validFor:/^[^{}]*$/};const N=et(s,/\\(?:usepackage|RequirePackage)\s*(?:\[[^]]*\])?\{([^{}]*)$/);if(N)return{from:N.from,options:qe(i,u.packages,l?.packages??[]),validFor:/^[^{}]*$/};const E=et(s,/\\documentclass\s*(?:\[[^]]*\])?\{([^{}]*)$/);return E?{from:E.from,options:qe(i,l?.files??[]),validFor:/^[^{}]*$/}:null}const fa=zi.of((s,i)=>{const l=s.doc.lineAt(i),u=l.text.match(/\\begin\{([^}]+)\}/);if(u){let v=1;for(let w=l.number+1;w<=s.doc.lines;w+=1){const S=s.doc.line(w),x=u[1].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(v+=(S.text.match(new RegExp(`\\\\begin\\{${x}\\}`,"g"))??[]).length,v-=(S.text.match(new RegExp(`\\\\end\\{${x}\\}`,"g"))??[]).length,v===0&&S.from>l.to)return{from:l.to,to:S.from}}}const d=l.text.match(/^\s*\\(part|chapter|section|subsection|subsubsection)\*?/);if(d){const v={part:0,chapter:0,section:1,subsection:2,subsubsection:3},w=v[d[1]];for(let S=l.number+1;S<=s.doc.lines;S+=1){const x=s.doc.line(S),N=x.text.match(/^\s*\\(part|chapter|section|subsection|subsubsection)\*?/);if(N&&v[N[1]]<=w)return{from:l.to,to:Math.max(l.to,x.from-1)}}if(l.to<s.doc.length)return{from:l.to,to:s.doc.length}}return null});function ka({value:s,readOnly:i,comments:l,focusComment:u,preferences:d,completionIndex:v,jumpTo:w,searchRequest:S,spellCheckIssues:x,spellCheckJump:N,collaboration:E,onChange:L,onSelection:P,onCommentClick:D,onSpellCheckReplace:K,onCursor:W}){const{t:F,i18n:q}=oi(),te=X.useRef(null),z=X.useRef(null),le=X.useRef(L),ce=X.useRef(P),Ce=X.useRef(D),ae=X.useRef(K),_e=X.useRef(W),Je=X.useRef(x),Me=X.useRef(S),Ke=X.useRef(v),Ve=X.useRef(new Ir),pe=X.useRef(new Ir),je=X.useRef(null),[ft,tt]=X.useState(d.vimMode?"NORMAL":""),[ge,A]=X.useState(null);le.current=L,ce.current=P,Ce.current=D,ae.current=K,_e.current=W,Je.current=x,Ke.current=v;const rt=(B,Z)=>{if(je.current?.(),je.current=null,!Z){tt("");return}const R=an(B);if(!R){tt("NORMAL");return}const J=()=>{const Y=R.state.vim?.mode??(R.state.vim?.insertMode?"insert":"normal");tt(Y.toUpperCase())};J(),R.on("vim-mode-change",J),je.current=()=>R.off("vim-mode-change",J)};return X.useEffect(()=>{if(!te.current)return;const B=E&&!i?new Qt(E.text):null,Z=Nt.create({doc:E?.text.toString()??s,extensions:[Li(),Ai(),...E?[]:[Ei()],Ri(),Oi(),Ti(),zo,Ii(qi),Ni(),Qr.high(se.inputHandler.of(ca)),Bi(),Pi(),fa,Zo,Xo,ea,Di({top:!0}),da(F),Nt.phrases.of(ha(F)),_i({override:[R=>ua(R,F,Ke.current)],activateOnTyping:!0}),...B?[Jt.of({undo:()=>B.undo()!==null,redo:()=>B.redo()!==null})]:[],pe.current.of(d.vimMode?Kr():[]),Ki.of([...Fi,...$i,...Hi,...Vi,...E&&!i?$o:[],...ji,...E?[]:Wi]),...E?[Ho(E.text,E.awareness,{undoManager:B??!1})]:[],Nt.readOnly.of(i),Ve.current.of(Wr(d)),se.domEventHandlers({click(R){const J=R.target.closest("[data-comment-id]");return J?.dataset.commentId&&Ce.current(J.dataset.commentId),!1},contextmenu(R){const J=R.target.closest("[data-spell-error]");if(!J)return!1;const Y=Number(J.dataset.spellFrom),Q=Number(J.dataset.spellTo),nt=Je.current.find(ht=>ht.from===Y&&ht.to===Q);if(!nt)return!1;R.preventDefault();const We=250,it=Math.min(300,100+nt.suggestions.length*34);return A({issue:nt,left:Math.max(8,Math.min(R.clientX,window.innerWidth-We-8)),top:Math.max(8,Math.min(R.clientY,window.innerHeight-it-8))}),!0},blur(R,J){const Y=J.state.selection.main;return ce.current(J.state.sliceDoc(Y.from,Y.to),Y.from,Y.to),E?.awareness.setLocalStateField("cursor",null),!1}}),se.updateListener.of(R=>{const J=R.transactions.some(Y=>Y.annotation(Fr));if(R.docChanged&&!J&&le.current(R.state.doc.toString()),R.docChanged&&A(null),R.selectionSet&&!R.docChanged&&R.transactions.some(Y=>Y.isUserEvent("input"))){const Y=R.state.selection.main.head,Q=Jo(R.state.doc.toString(),Y);Q&&R.view.dispatch({changes:{from:Y,insert:Q.insert},selection:{anchor:Y+Q.cursorOffset},annotations:zt.userEvent.of("input.complete")})}if(R.selectionSet||R.docChanged){const Y=R.state.selection.main;ce.current(R.state.sliceDoc(Y.from,Y.to),Y.from,Y.to);const Q=R.state.doc.lineAt(Y.head);_e.current(Q.number,Y.head-Q.from+1)}})]});return z.current=new se({state:Z,parent:te.current}),rt(z.current,d.vimMode),z.current.dispatch({effects:Vt.of(Ur(l))}),()=>{je.current?.(),je.current=null,z.current?.destroy(),z.current=null}},[i,q.resolvedLanguage,E?.text]),X.useEffect(()=>{const B=z.current;B&&(B.dispatch({effects:[Ve.current.reconfigure(Wr(d)),pe.current.reconfigure(d.vimMode?Kr():[])]}),rt(B,d.vimMode))},[d]),X.useEffect(()=>{const B=z.current;if(!B)return;const Z=B.state.doc.toString(),R=x.filter(J=>J.from>=0&&J.to<=Z.length&&J.to>J.from);B.dispatch({effects:[hn.of(R),jt.of(null)]})},[x]),X.useEffect(()=>{A(null)},[x]),X.useEffect(()=>{if(!ge)return;const B=R=>{R.target instanceof Element&&R.target.closest(".spell-suggestions-menu")||A(null)},Z=R=>{R.key==="Escape"&&A(null)};return document.addEventListener("mousedown",B,!0),document.addEventListener("keydown",Z,!0),()=>{document.removeEventListener("mousedown",B,!0),document.removeEventListener("keydown",Z,!0)}},[ge]),X.useEffect(()=>{const B=z.current;E||!B||B.state.doc.toString()===s||B.dispatch({changes:{from:0,to:B.state.doc.length,insert:s},annotations:Fr.of(!0)})},[s,E]),X.useEffect(()=>{z.current?.dispatch({effects:Vt.of(Ur(l))})},[l]),X.useEffect(()=>{const B=z.current;if(!B||!u||u.orphaned)return;const Z=Math.min(u.startOffset,B.state.doc.length),R=Math.min(Math.max(Z,u.endOffset),B.state.doc.length);B.dispatch({selection:{anchor:Z,head:R},effects:se.scrollIntoView(Z,{y:"center"})}),B.focus()},[u]),X.useEffect(()=>{const B=z.current;if(!B||!w)return;const Z=Math.max(1,Math.min(B.state.doc.lines,w.line)),R=B.state.doc.line(Z),J=Math.min(R.to,R.from+Math.max(0,w.column-1));B.dispatch({selection:{anchor:R.from,head:R.to},effects:se.scrollIntoView(J,{y:"center",yMargin:60})}),B.focus()},[w?.nonce]),X.useEffect(()=>{const B=z.current;if(!B||!N)return;const Z=Math.max(0,Math.min(N.from,B.state.doc.length)),R=Math.max(Z,Math.min(N.to,B.state.doc.length));B.dispatch({selection:{anchor:Z},effects:[jt.of({from:Z,to:R}),se.scrollIntoView(Z,{y:"center",yMargin:60})]}),B.focus()},[N?.nonce]),X.useEffect(()=>{const B=z.current;!B||S===0||S===Me.current||(Me.current=S,Ui(B))},[S]),Pe.jsxs("div",{className:"editor-shell",style:{fontFamily:Gi(d.font),fontSize:`${d.fontSize}px`,lineHeight:d.lineHeight},children:[Pe.jsx("div",{className:"editor-host",ref:te}),ge&&Pe.jsxs("div",{className:"spell-suggestions-menu",role:"menu","aria-label":F("editor.writingSuggestions"),onMouseDown:B=>B.stopPropagation(),children:[Pe.jsx("div",{className:"spell-suggestions-title",children:F("editor.writingSuggestions")}),ge.issue.message&&Pe.jsx("div",{className:"spell-suggestions-message",children:ge.issue.message}),ge.issue.suggestions.map((B,Z)=>Pe.jsx("button",{type:"button",role:"menuitem",disabled:i,title:i?F("editor.spellCheckReadOnly"):F("editor.replaceWith",{word:B||F("editor.removeText")}),onClick:()=>{ae.current(ge.issue,B),A(null)},children:B||F("editor.removeText")},`${B}-${Z}`)),ge.issue.suggestions.length===0&&Pe.jsx("span",{className:"spell-suggestions-empty",children:F("editor.noWritingSuggestions")}),i&&ge.issue.suggestions.length>0&&Pe.jsx("span",{className:"spell-suggestions-readonly",children:F("editor.spellCheckReadOnly")})]}),d.vimMode&&Pe.jsx("div",{className:"vim-editor-status",role:"status","aria-live":"polite",children:Pe.jsxs("span",{children:["--",ft||"NORMAL","--"]})})]})}function ha(s){return{Find:s("editor.search.find"),Replace:s("editor.search.replace"),next:s("editor.search.next"),previous:s("editor.search.previous"),all:s("editor.search.all"),"match case":s("editor.search.matchCase"),regexp:s("editor.search.regexp"),"by word":s("editor.search.wholeWord"),replace:s("editor.search.replaceNext"),"replace all":s("editor.search.replaceAll"),close:s("common.close"),"current match":s("editor.search.currentMatch"),"on line":s("editor.search.onLine"),"replaced match on line $":s("editor.search.replacedMatchOnLine"),"replaced $ matches":s("editor.search.replacedMatches"),"Go to line":s("editor.search.goToLine"),go:s("editor.search.go")}}function da(s){return ut.fromClass(class{constructor(i){this.view=i,this.document=i.state.doc,this.schedule()}view;frame=null;document;signature="";count=0;update(){this.schedule()}destroy(){this.frame!==null&&cancelAnimationFrame(this.frame)}schedule(){this.frame!==null&&cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(()=>{this.frame=null,this.render()})}render(){if(!Qi(this.view.state))return;const i=this.view.dom.querySelector(".cm-panel.cm-search");if(!i)return;let l=i.querySelector(".cm-search-count");if(!l){l=document.createElement("span"),l.className="cm-search-count",l.setAttribute("role","status"),l.setAttribute("aria-live","polite");const v=i.querySelector("[name=close]");i.insertBefore(l,v)}const u=Yi(this.view.state),d=jo(u);(this.document!==this.view.state.doc||this.signature!==d)&&(this.document=this.view.state.doc,this.signature=d,this.count=Vo(this.view.state,u)),l.textContent=u.search?u.valid?this.count===0?s("editor.search.noMatches"):s("editor.search.matchCount",{count:this.count}):s("editor.search.invalidQuery"):""}})}function Wr(s){return[se.contentAttributes.of({spellcheck:"false",autocorrect:"off",autocapitalize:"off",autocomplete:"off",lang:"en-US"}),se.theme({"&":{fontSize:`${s.fontSize}px`},".cm-scroller":{fontFamily:"inherit",lineHeight:"inherit"},".cm-content":{fontFamily:"inherit",fontSize:"inherit"},".cm-gutters":{fontFamily:"inherit",fontSize:"inherit"}}),s.lineWrapping?se.lineWrapping:[]]}function pa(s,i){const l=s.map(u=>({from:Math.max(0,Math.min(i,u.from)),to:Math.max(0,Math.min(i,u.to)),word:u.word,kind:u.kind,message:u.message})).filter(u=>u.to>u.from).sort((u,d)=>u.from-d.from||u.to-d.to);return ne.set(l.map(u=>ne.mark({class:u.kind==="spelling"?"cm-spell-error":"cm-grammar-warning",attributes:{title:u.message||u.word,"data-spell-error":"true","data-spell-kind":u.kind,"data-spell-from":String(u.from),"data-spell-to":String(u.to)}}).range(u.from,u.to)),!0)}function Ur(s){return s.map(i=>({id:i.id,from:i.startOffset,to:i.endOffset,resolved:i.resolved,orphaned:i.orphaned}))}function ga(s,i){const l=s.filter(u=>!u.orphaned).map(u=>{const d=Math.max(0,Math.min(i,u.from)),v=Math.max(d,Math.min(i,u.to)),w=`cm-source-comment${u.resolved?" cm-source-comment-resolved":""}`;return d===v?ne.widget({widget:new va(u.id,w),side:1}).range(d):ne.mark({class:w,attributes:{"data-comment-id":u.id}}).range(d,v)});return ne.set(l,!0)}class va extends Yr{constructor(i,l){super(),this.id=i,this.className=l}id;className;toDOM(){const i=document.createElement("span");return i.className=`${this.className} cm-comment-pin`,i.dataset.commentId=this.id,i.textContent="●",i}}export{ka as LatexEditor};
59
+ `+w+"\\end{"+S+"}",N=u+S.length+1+1+w.length+1,E=i.state.sliceDoc(d,d+1)==="}"?1:0;i.dispatch({changes:{from:u,to:d+E,insert:x},selection:{anchor:N},annotations:[Ji.of(l),zt.userEvent.of("input.complete")]})}}}function ca(s,i,l,u,d){const v=qo(s.state.doc.toString(),i,l,u);if(!v)return!1;s.dispatch(d());const w=i+u.length;return s.dispatch({changes:{from:w,insert:v.insert},selection:{anchor:w+v.cursorOffset},annotations:zt.userEvent.of("input.complete")}),!0}function ua(s,i,l){if(sa(s))return null;const u=ia(s),d=s.matchBefore(/\\(?:[A-Za-z@0-9:_]*(?:\*)?|[,;!:])$/);if(d||s.explicit)return{from:d?.from??s.pos,options:Vr(qe(i,u.commands,l?.commands??[],ra())),validFor:/^\\(?:[A-Za-z@0-9:_]*(?:\*)?|[,;!:])$/};const v=aa(s);if(v){const L=qe(i,jr(u.environments),jr(l?.environments??[]));return{from:v.from,options:Vr(v.command==="begin"?L.map(la):L),validFor:/^[A-Za-z0-9*:_-]*$/}}const w=et(s,/\\(?:ref|pageref|autoref|nameref|cref|Cref|eqref|vref)\s*(?:\[[^]]*\])?\{([^{}]*)$/)??et(s,/\\hyperref\[([^\[\]]*)$/);if(w)return{from:w.from,options:qe(i,u.labels,l?.labels??[]),validFor:/^[^{}]*$/};const S=et(s,/\\(?:cite|citep|citet|parencite|textcite|autocite|footcite)(?:\w*)?(?:\[[^]]*\])?\{([^{}]*)$/);if(S)return{from:S.from,options:qe(i,u.citations,l?.citations??[]),validFor:/^[^{}]*$/};const x=et(s,/\\(?:input|include|subfile|includegraphics|bibliography|addbibresource)\s*(?:\[[^]]*\])?\{([^{}]*)$/);if(x)return{from:x.from,options:qe(i,u.files,l?.files??[]),validFor:/^[^{}]*$/};const N=et(s,/\\(?:usepackage|RequirePackage)\s*(?:\[[^]]*\])?\{([^{}]*)$/);if(N)return{from:N.from,options:qe(i,u.packages,l?.packages??[]),validFor:/^[^{}]*$/};const E=et(s,/\\documentclass\s*(?:\[[^]]*\])?\{([^{}]*)$/);return E?{from:E.from,options:qe(i,l?.files??[]),validFor:/^[^{}]*$/}:null}const fa=zi.of((s,i)=>{const l=s.doc.lineAt(i),u=l.text.match(/\\begin\{([^}]+)\}/);if(u){let v=1;for(let w=l.number+1;w<=s.doc.lines;w+=1){const S=s.doc.line(w),x=u[1].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(v+=(S.text.match(new RegExp(`\\\\begin\\{${x}\\}`,"g"))??[]).length,v-=(S.text.match(new RegExp(`\\\\end\\{${x}\\}`,"g"))??[]).length,v===0&&S.from>l.to)return{from:l.to,to:S.from}}}const d=l.text.match(/^\s*\\(part|chapter|section|subsection|subsubsection)\*?/);if(d){const v={part:0,chapter:0,section:1,subsection:2,subsubsection:3},w=v[d[1]];for(let S=l.number+1;S<=s.doc.lines;S+=1){const x=s.doc.line(S),N=x.text.match(/^\s*\\(part|chapter|section|subsection|subsubsection)\*?/);if(N&&v[N[1]]<=w)return{from:l.to,to:Math.max(l.to,x.from-1)}}if(l.to<s.doc.length)return{from:l.to,to:s.doc.length}}return null});function ka({value:s,readOnly:i,comments:l,focusComment:u,preferences:d,completionIndex:v,jumpTo:w,searchRequest:S,spellCheckIssues:x,spellCheckJump:N,collaboration:E,onChange:L,onSelection:P,onCommentClick:D,onSpellCheckReplace:K,onCursor:W}){const{t:F,i18n:q}=oi(),te=X.useRef(null),z=X.useRef(null),le=X.useRef(L),ce=X.useRef(P),Ce=X.useRef(D),ae=X.useRef(K),_e=X.useRef(W),Je=X.useRef(x),Me=X.useRef(S),Ke=X.useRef(v),Ve=X.useRef(new Ir),pe=X.useRef(new Ir),je=X.useRef(null),[ft,tt]=X.useState(d.vimMode?"NORMAL":""),[ge,A]=X.useState(null);le.current=L,ce.current=P,Ce.current=D,ae.current=K,_e.current=W,Je.current=x,Ke.current=v;const rt=(B,Z)=>{if(je.current?.(),je.current=null,!Z){tt("");return}const R=an(B);if(!R){tt("NORMAL");return}const J=()=>{const Y=R.state.vim?.mode??(R.state.vim?.insertMode?"insert":"normal");tt(Y.toUpperCase())};J(),R.on("vim-mode-change",J),je.current=()=>R.off("vim-mode-change",J)};return X.useEffect(()=>{if(!te.current)return;const B=E&&!i?new Qt(E.text):null,Z=Nt.create({doc:E?.text.toString()??s,extensions:[Li(),Ai(),...E?[]:[Ei()],Ri(),Oi(),Ti(),zo,Ii(qi),Ni(),Qr.high(se.inputHandler.of(ca)),Bi(),Pi(),fa,Zo,Xo,ea,Di({top:!1}),da(F),Nt.phrases.of(ha(F)),_i({override:[R=>ua(R,F,Ke.current)],activateOnTyping:!0}),...B?[Jt.of({undo:()=>B.undo()!==null,redo:()=>B.redo()!==null})]:[],pe.current.of(d.vimMode?Kr():[]),Ki.of([...Fi,...$i,...Hi,...Vi,...E&&!i?$o:[],...ji,...E?[]:Wi]),...E?[Ho(E.text,E.awareness,{undoManager:B??!1})]:[],Nt.readOnly.of(i),Ve.current.of(Wr(d)),se.domEventHandlers({click(R){const J=R.target.closest("[data-comment-id]");return J?.dataset.commentId&&Ce.current(J.dataset.commentId),!1},contextmenu(R){const J=R.target.closest("[data-spell-error]");if(!J)return!1;const Y=Number(J.dataset.spellFrom),Q=Number(J.dataset.spellTo),nt=Je.current.find(ht=>ht.from===Y&&ht.to===Q);if(!nt)return!1;R.preventDefault();const We=250,it=Math.min(300,100+nt.suggestions.length*34);return A({issue:nt,left:Math.max(8,Math.min(R.clientX,window.innerWidth-We-8)),top:Math.max(8,Math.min(R.clientY,window.innerHeight-it-8))}),!0},blur(R,J){const Y=J.state.selection.main;return ce.current(J.state.sliceDoc(Y.from,Y.to),Y.from,Y.to),E?.awareness.setLocalStateField("cursor",null),!1}}),se.updateListener.of(R=>{const J=R.transactions.some(Y=>Y.annotation(Fr));if(R.docChanged&&!J&&le.current(R.state.doc.toString()),R.docChanged&&A(null),R.selectionSet&&!R.docChanged&&R.transactions.some(Y=>Y.isUserEvent("input"))){const Y=R.state.selection.main.head,Q=Jo(R.state.doc.toString(),Y);Q&&R.view.dispatch({changes:{from:Y,insert:Q.insert},selection:{anchor:Y+Q.cursorOffset},annotations:zt.userEvent.of("input.complete")})}if(R.selectionSet||R.docChanged){const Y=R.state.selection.main;ce.current(R.state.sliceDoc(Y.from,Y.to),Y.from,Y.to);const Q=R.state.doc.lineAt(Y.head);_e.current(Q.number,Y.head-Q.from+1)}})]});return z.current=new se({state:Z,parent:te.current}),rt(z.current,d.vimMode),z.current.dispatch({effects:Vt.of(Ur(l))}),()=>{je.current?.(),je.current=null,z.current?.destroy(),z.current=null}},[i,q.resolvedLanguage,E?.text]),X.useEffect(()=>{const B=z.current;B&&(B.dispatch({effects:[Ve.current.reconfigure(Wr(d)),pe.current.reconfigure(d.vimMode?Kr():[])]}),rt(B,d.vimMode))},[d]),X.useEffect(()=>{const B=z.current;if(!B)return;const Z=B.state.doc.toString(),R=x.filter(J=>J.from>=0&&J.to<=Z.length&&J.to>J.from);B.dispatch({effects:[hn.of(R),jt.of(null)]})},[x]),X.useEffect(()=>{A(null)},[x]),X.useEffect(()=>{if(!ge)return;const B=R=>{R.target instanceof Element&&R.target.closest(".spell-suggestions-menu")||A(null)},Z=R=>{R.key==="Escape"&&A(null)};return document.addEventListener("mousedown",B,!0),document.addEventListener("keydown",Z,!0),()=>{document.removeEventListener("mousedown",B,!0),document.removeEventListener("keydown",Z,!0)}},[ge]),X.useEffect(()=>{const B=z.current;E||!B||B.state.doc.toString()===s||B.dispatch({changes:{from:0,to:B.state.doc.length,insert:s},annotations:Fr.of(!0)})},[s,E]),X.useEffect(()=>{z.current?.dispatch({effects:Vt.of(Ur(l))})},[l]),X.useEffect(()=>{const B=z.current;if(!B||!u||u.orphaned)return;const Z=Math.min(u.startOffset,B.state.doc.length),R=Math.min(Math.max(Z,u.endOffset),B.state.doc.length);B.dispatch({selection:{anchor:Z,head:R},effects:se.scrollIntoView(Z,{y:"center"})}),B.focus()},[u]),X.useEffect(()=>{const B=z.current;if(!B||!w)return;const Z=Math.max(1,Math.min(B.state.doc.lines,w.line)),R=B.state.doc.line(Z),J=Math.min(R.to,R.from+Math.max(0,w.column-1));B.dispatch({selection:{anchor:R.from,head:R.to},effects:se.scrollIntoView(J,{y:"center",yMargin:60})}),B.focus()},[w?.nonce]),X.useEffect(()=>{const B=z.current;if(!B||!N)return;const Z=Math.max(0,Math.min(N.from,B.state.doc.length)),R=Math.max(Z,Math.min(N.to,B.state.doc.length));B.dispatch({selection:{anchor:Z},effects:[jt.of({from:Z,to:R}),se.scrollIntoView(Z,{y:"center",yMargin:60})]}),B.focus()},[N?.nonce]),X.useEffect(()=>{const B=z.current;!B||S===0||S===Me.current||(Me.current=S,Ui(B))},[S]),Pe.jsxs("div",{className:"editor-shell",style:{fontFamily:Gi(d.font),fontSize:`${d.fontSize}px`,lineHeight:d.lineHeight},children:[Pe.jsx("div",{className:"editor-host",ref:te}),ge&&Pe.jsxs("div",{className:"spell-suggestions-menu",role:"menu","aria-label":F("editor.writingSuggestions"),onMouseDown:B=>B.stopPropagation(),children:[Pe.jsx("div",{className:"spell-suggestions-title",children:F("editor.writingSuggestions")}),ge.issue.message&&Pe.jsx("div",{className:"spell-suggestions-message",children:ge.issue.message}),ge.issue.suggestions.map((B,Z)=>Pe.jsx("button",{type:"button",role:"menuitem",disabled:i,title:i?F("editor.spellCheckReadOnly"):F("editor.replaceWith",{word:B||F("editor.removeText")}),onClick:()=>{ae.current(ge.issue,B),A(null)},children:B||F("editor.removeText")},`${B}-${Z}`)),ge.issue.suggestions.length===0&&Pe.jsx("span",{className:"spell-suggestions-empty",children:F("editor.noWritingSuggestions")}),i&&ge.issue.suggestions.length>0&&Pe.jsx("span",{className:"spell-suggestions-readonly",children:F("editor.spellCheckReadOnly")})]}),d.vimMode&&Pe.jsx("div",{className:"vim-editor-status",role:"status","aria-live":"polite",children:Pe.jsxs("span",{children:["--",ft||"NORMAL","--"]})})]})}function ha(s){return{Find:s("editor.search.find"),Replace:s("editor.search.replace"),next:s("editor.search.next"),previous:s("editor.search.previous"),all:s("editor.search.all"),"match case":s("editor.search.matchCase"),regexp:s("editor.search.regexp"),"by word":s("editor.search.wholeWord"),replace:s("editor.search.replaceNext"),"replace all":s("editor.search.replaceAll"),close:s("common.close"),"current match":s("editor.search.currentMatch"),"on line":s("editor.search.onLine"),"replaced match on line $":s("editor.search.replacedMatchOnLine"),"replaced $ matches":s("editor.search.replacedMatches"),"Go to line":s("editor.search.goToLine"),go:s("editor.search.go")}}function da(s){return ut.fromClass(class{constructor(i){this.view=i,this.document=i.state.doc,this.schedule()}view;frame=null;document;signature="";count=0;update(){this.schedule()}destroy(){this.frame!==null&&cancelAnimationFrame(this.frame)}schedule(){this.frame!==null&&cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(()=>{this.frame=null,this.render()})}render(){if(!Qi(this.view.state))return;const i=this.view.dom.querySelector(".cm-panel.cm-search");if(!i)return;let l=i.querySelector(".cm-search-count");if(!l){l=document.createElement("span"),l.className="cm-search-count",l.setAttribute("role","status"),l.setAttribute("aria-live","polite");const v=i.querySelector("[name=close]");i.insertBefore(l,v)}const u=Yi(this.view.state),d=jo(u);(this.document!==this.view.state.doc||this.signature!==d)&&(this.document=this.view.state.doc,this.signature=d,this.count=Vo(this.view.state,u)),l.textContent=u.search?u.valid?this.count===0?s("editor.search.noMatches"):s("editor.search.matchCount",{count:this.count}):s("editor.search.invalidQuery"):""}})}function Wr(s){return[se.contentAttributes.of({spellcheck:"false",autocorrect:"off",autocapitalize:"off",autocomplete:"off",lang:"en-US"}),se.theme({"&":{fontSize:`${s.fontSize}px`},".cm-scroller":{fontFamily:"inherit",lineHeight:"inherit"},".cm-content":{fontFamily:"inherit",fontSize:"inherit"},".cm-gutters":{fontFamily:"inherit",fontSize:"inherit"}}),s.lineWrapping?se.lineWrapping:[]]}function pa(s,i){const l=s.map(u=>({from:Math.max(0,Math.min(i,u.from)),to:Math.max(0,Math.min(i,u.to)),word:u.word,kind:u.kind,message:u.message})).filter(u=>u.to>u.from).sort((u,d)=>u.from-d.from||u.to-d.to);return ne.set(l.map(u=>ne.mark({class:u.kind==="spelling"?"cm-spell-error":"cm-grammar-warning",attributes:{title:u.message||u.word,"data-spell-error":"true","data-spell-kind":u.kind,"data-spell-from":String(u.from),"data-spell-to":String(u.to)}}).range(u.from,u.to)),!0)}function Ur(s){return s.map(i=>({id:i.id,from:i.startOffset,to:i.endOffset,resolved:i.resolved,orphaned:i.orphaned}))}function ga(s,i){const l=s.filter(u=>!u.orphaned).map(u=>{const d=Math.max(0,Math.min(i,u.from)),v=Math.max(d,Math.min(i,u.to)),w=`cm-source-comment${u.resolved?" cm-source-comment-resolved":""}`;return d===v?ne.widget({widget:new va(u.id,w),side:1}).range(d):ne.mark({class:w,attributes:{"data-comment-id":u.id}}).range(d,v)});return ne.set(l,!0)}class va extends Yr{constructor(i,l){super(),this.id=i,this.className=l}id;className;toDOM(){const i=document.createElement("span");return i.className=`${this.className} cm-comment-pin`,i.dataset.commentId=this.id,i.textContent="●",i}}export{ka as LatexEditor};
@@ -0,0 +1 @@
1
+ import{u as T,r as i,j as s}from"./react-CsO_xvbl.js";import{g as V,P as Z,w as O,G as U}from"./pdf-DPnwNQHb.js";import{M as Y,P as F,a as X}from"./plus-yvkxQFZU.js";import{L as H}from"./index-DIKn1Ihd.js";U.workerSrc=O;const q=new Z;function te({url:C,target:u,compiling:E=!1,onViewportLocation:k,onDoubleClickLocation:f}){const{t:r}=T(),p=i.useRef(null),[h,L]=i.useState(null),[b,x]=i.useState(0),[o,m]=i.useState(100),[I,y]=i.useState(""),N=i.useRef(new Map),M=i.useCallback((e,t)=>{t?N.current.set(e,t):N.current.delete(e)},[]),S=async e=>{if(!h||e==null)return;let t=e;if(typeof e=="string"&&(t=await h.getDestination(e).catch(()=>null)),!Array.isArray(t)||t.length===0)return;const d=t[0];let l=null;if(typeof d=="number"&&Number.isInteger(d))l=d;else if(d!=null)try{l=await h.getPageIndex(d)}catch{return}l==null||l<0||l>=h.numPages||N.current.get(l+1)?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})},P=()=>{const e=p.current;if(!e)return;const t=e.getBoundingClientRect(),d=t.left+t.width/2,l=t.top+t.height/2,D=[...e.querySelectorAll(".pdf-page")],n=D.find(j=>{const R=j.getBoundingClientRect();return l>=R.top&&l<=R.bottom})??D.reduce((j,R)=>{if(!j)return R;const $=Math.abs(R.getBoundingClientRect().top-l),B=Math.abs(j.getBoundingClientRect().top-l);return $<B?R:j},null);if(!n)return;const a=n.getBoundingClientRect(),c=Number(n.dataset.scale)||1,v=Number(n.dataset.page),W=Math.max(0,Math.min(a.width,d-a.left))/c,A=Math.max(0,Math.min(a.height,l-a.top))/c;v&&k(v,W,A)};i.useEffect(()=>{const e=p.current;if(!e)return;const t=()=>x(e.clientWidth);t();const d=new ResizeObserver(t);return d.observe(e),()=>d.disconnect()},[]),i.useEffect(()=>{let e=!1;L(null),y("");const t=V({url:C,worker:q});return t.promise.then(d=>{e||L(d)}).catch(()=>{e||y(r("editor.pdfLoadFailed"))}),()=>{e=!0,t.destroy()}},[C]),i.useEffect(()=>{o>100||!p.current||(p.current.scrollLeft=0)},[o,b,h]);const g=e=>m(t=>Math.min(200,Math.max(50,t+e))),z=()=>{p.current&&(p.current.scrollLeft=0),m(100)},w=e=>{!e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY,P())};return s.jsxs("div",{className:"pdf-viewer",children:[s.jsxs("div",{className:"pdf-toolbar",role:"toolbar","aria-label":r("editor.pdfZoomControls"),children:[s.jsx("button",{disabled:o<=50,title:r("editor.pdfZoomOut"),"aria-label":r("editor.pdfZoomOut"),onClick:()=>g(-10),children:s.jsx(Y,{size:14})}),s.jsxs("span",{className:"pdf-zoom-value","aria-live":"polite",children:[o,"%"]}),s.jsx("button",{disabled:o>=200,title:r("editor.pdfZoomIn"),"aria-label":r("editor.pdfZoomIn"),onClick:()=>g(10),children:s.jsx(F,{size:14})}),s.jsxs("button",{className:"pdf-fit-width",title:r("editor.pdfFitWidth"),onClick:z,children:[s.jsx(X,{size:13}),r("editor.pdfFitWidth")]})]}),E&&s.jsxs("div",{className:"pdf-compiling-overlay",role:"status","aria-live":"polite",children:[s.jsx(H,{className:"spin",size:20}),s.jsx("span",{children:r("editor.compiling")})]}),s.jsx("div",{className:"pdf-document",ref:p,onScroll:P,onWheel:w,children:s.jsxs("div",{className:"pdf-pages",style:{width:`${Math.max(1,b-28)*Math.max(1,o/100)}px`},children:[I&&s.jsx("div",{className:"preview-empty",children:s.jsx("strong",{children:I})}),h&&b>0&&Array.from({length:h.numPages},(e,t)=>s.jsx(G,{document:h,pageNumber:t+1,availableWidth:b-28,zoom:o/100,target:u?.page===t+1?u:null,onReady:P,onPageElement:M,onInternalLink:S,onDoubleClickLocation:f},t+1))]})})]})}function G({document:C,pageNumber:u,availableWidth:E,zoom:k,target:f,onReady:r,onPageElement:p,onInternalLink:h,onDoubleClickLocation:L}){const b=i.useRef(null),x=i.useRef(null),o=i.useRef(null),[m,I]=i.useState(1),[y,N]=i.useState({width:0,height:0}),[M,S]=i.useState(u===1),[P,g]=i.useState(!1),[z,w]=i.useState(null),[e,t]=i.useState([]);i.useEffect(()=>{const n=b.current;if(!n||M)return;if(!("IntersectionObserver"in window)){S(!0);return}const a=new IntersectionObserver(c=>{c.some(v=>v.isIntersecting)&&(S(!0),a.disconnect())},{rootMargin:"900px 0px"});return a.observe(n),()=>a.disconnect()},[M]),i.useEffect(()=>{f&&S(!0)},[f?.nonce]),i.useEffect(()=>{if(!M)return;let n=!1,a=null;return g(!1),w(null),t([]),C.getPage(u).then(c=>{if(n)return;const v=c.getViewport({scale:1}),W=E/v.width,A=Math.min(3.3,Math.max(.175,W*k)),j=c.getViewport({scale:A});if(I(A),N({width:j.width,height:j.height}),w(j),c.getAnnotations({intent:"display"}).then(B=>{n||t(B)}).catch(()=>{n||t([])}),!x.current)return;const R=Math.max(1,window.devicePixelRatio||1),$=c.getViewport({scale:A*R});return x.current.width=Math.floor($.width),x.current.height=Math.floor($.height),a=c.render({canvas:x.current,viewport:$}),a.promise.then(()=>{n||(g(!0),window.requestAnimationFrame(r))})}).catch(()=>{}),()=>{n=!0,a?.cancel()}},[C,u,E,k,M]),i.useEffect(()=>{!f||!o.current||o.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},[f?.nonce,m]);const d=n=>{if(!L||!P||n.target instanceof HTMLElement&&n.target.closest("a"))return;const a=x.current;if(!a)return;const c=a.getBoundingClientRect();if(n.clientX<c.left||n.clientX>c.right||n.clientY<c.top||n.clientY>c.bottom)return;const v=m||1,W=Math.max(0,Math.min(c.width,n.clientX-c.left))/v,A=Math.max(0,Math.min(c.height,n.clientY-c.top))/v;L(u,W,A)},l=Math.max(1,E*k),D=l*(792/612);return s.jsxs("figure",{ref:n=>{b.current=n,p(u,n)},onDoubleClick:d,className:`pdf-page${P?" rendered":" loading"}`,"data-page":u,"data-scale":m,style:{width:`${y.width||l}px`,minHeight:`${y.height||D}px`},children:[s.jsx("canvas",{ref:x,style:{width:`${y.width||l}px`,height:`${y.height||D}px`}}),P&&z&&s.jsx(_,{annotations:e,viewport:z,onInternalLink:h}),f&&s.jsx("span",{ref:o,className:"pdf-sync-marker",style:{left:f.x*m,top:f.y*m}}),s.jsx("figcaption",{children:u})]})}function _({annotations:C,viewport:u,onInternalLink:E}){const{t:k}=T(),f=k("editor.pdfLink");return s.jsx("div",{className:"pdf-annotation-layer","aria-label":k("editor.pdfLinks"),children:C.filter(r=>r.subtype==="Link"&&Array.isArray(r.rect)&&r.rect.length>=4).map((r,p)=>{const[h,L]=u.convertToViewportPoint(r.rect[0],r.rect[1]),[b,x]=u.convertToViewportPoint(r.rect[2],r.rect[3]),o=[h,L,b,x],m=Math.min(o[0],o[2]),I=Math.min(o[1],o[3]),y=Math.abs(o[2]-o[0]),N=Math.abs(o[3]-o[1]),M=typeof r.title=="string"?r.title.trim():"",S=typeof r.unsafeUrl=="string"?r.unsafeUrl.trim():"",g=(typeof r.url=="string"?r.url.trim():"")||(/^(?:https?|mailto|ftp):/i.test(S)?S:""),z=r.dest;if(!g&&z==null)return null;const w=!!g;return s.jsx("a",{className:"pdf-annotation-link",href:g||"#",target:w?"_blank":void 0,rel:w?"noreferrer":void 0,title:M||(w?g:f),"aria-label":M||(w?g:f),style:{left:m,top:I,width:y,height:N},onClick:w?void 0:e=>{e.preventDefault(),E(z)}},`${p}-${m}-${I}`)})})}export{te as PdfPreview};